@fuel-ts/address v0.95.0 • Docs
Class: Address
Address
provides a type safe wrapper for converting between different address formats ands comparing them for equality.
Extends
Constructors
new Address()
new Address(
address
):Address
Parameters
• address: `fuel${string}`
A Bech32 address
Returns
Overrides
Defined in
address.ts:39
Properties
bech32Address
readonly
bech32Address: `fuel${string}`
Defined in
address.ts:33
Methods
equals()
equals(
other
):boolean
Compares this the bech32Address
property to another for direct equality
Parameters
• other: Address
Another address to compare against
Returns
boolean
The equality of the comparison
Overrides
Defined in
address.ts:154
toAddress()
toAddress(): `fuel${string}`
Returns the bech32Address
property
Returns
`fuel${string}`
The bech32Address
property
Overrides
Defined in
address.ts:66
toAssetId()
toAssetId():
AssetId
Wraps the bech32Address
property and returns as an AssetId
.
Returns
The bech32Address
property as an AssetId
Defined in
address.ts:133
toB256()
toB256():
string
Converts and returns the bech32Address
property to a 256 bit hash string
Returns
string
The bech32Address
property as a 256 bit hash string
Overrides
Defined in
address.ts:75
toBytes()
toBytes():
Uint8Array
Converts and returns the bech32Address
property to a byte array
Returns
Uint8Array
The bech32Address
property as a byte array
Overrides
Defined in
address.ts:84
toChecksum()
toChecksum():
string
Takes an B256 Address and returns back an checksum address. The implementation follows the ERC-55 https://github.com/ethereum/ercs/blob/master/ERCS/erc-55.md.
Returns
string
A new ChecksumAddress
instance
Defined in
address.ts:57
toEvmAddress()
toEvmAddress():
EvmAddress
Clears the first 12 bytes of the bech32Address
property and returns it as a EvmAddress
Returns
The bech32Address
property as an EvmAddress
Defined in
address.ts:120
toHexString()
toHexString():
string
Converts
Returns
string
The bech32Address
property as a 256 bit hash string
Overrides
Defined in
address.ts:93
toJSON()
toJSON():
string
Converts and returns the bech32Address
property as a string
Returns
string
The bech32Address
property as a string
Overrides
Defined in
address.ts:111
toString()
toString():
string
returns the address checksum
as a string
Returns
string
The bech32Address
property as a string
Overrides
Defined in
address.ts:102
valueOf()
valueOf():
string
returns the address checksum
as a string
Returns
string
The value of bech32Address
property
Defined in
address.ts:144
fromAddressOrString()
static
fromAddressOrString(address
):AbstractAddress
Takes an ambiguous string or address and creates an Address
Parameters
• address: string
| AbstractAddress
Returns
a new Address
instance
Defined in
address.ts:214
fromB256()
static
fromB256(b256Address
):Address
Takes a B256 Address and creates an Address
Parameters
• b256Address: string
A b256 hash
Returns
A new Address
instance
Defined in
address.ts:179
fromDynamicInput()
static
fromDynamicInput(address
):Address
Takes a dynamic string or AbstractAddress
and creates an Address
Parameters
• address: string
| AbstractAddress
Returns
A new Address
instance
Throws
Error - Unknown address if the format is not recognised
Defined in
address.ts:225
fromEvmAddress()
static
fromEvmAddress(evmAddress
):Address
Takes an Evm Address and returns back an Address
Parameters
• evmAddress: string
Returns
A new Address
instance
Defined in
address.ts:259
fromPublicKey()
static
fromPublicKey(publicKey
):Address
Takes a Public Key, hashes it, and creates an Address
Parameters
• publicKey: string
A wallets public key
Returns
A new Address
instance
Defined in
address.ts:164
fromRandom()
static
fromRandom():Address
Creates an Address
with a randomized bech32Address
property
Returns
A new Address
instance
Defined in
address.ts:195
fromString()
static
fromString(address
):Address
Takes an ambiguous string and attempts to create an Address
Parameters
• address: string
An ambiguous string
Returns
A new Address
instance
Defined in
address.ts:205
isChecksumValid()
static
isChecksumValid(address
):boolean
Takes an ChecksumAddress and validates if it is a valid checksum address.
Parameters
• address: string
Returns
boolean
A boolean
instance indicating if the address is valid.
Defined in
address.ts:277