Class: Address
@fuel-ts/address.Address
Address
provides a type safe wrapper for converting between different address formats ands comparing them for equality.
Hierarchy
↳
Address
Constructors
constructor
• new Address(address
): Address
Parameters
Name | Type | Description |
---|---|---|
address | `fuel${string}` | A Bech32 address |
Returns
Overrides
Defined in
Properties
bech32Address
• Readonly
bech32Address: `fuel${string}`
Defined in
Methods
equals
▸ equals(other
): boolean
Compares this the bech32Address
property to another for direct equality
Parameters
Name | Type | Description |
---|---|---|
other | Address | Another address to compare against |
Returns
boolean
The equality of the comparison
Overrides
Defined in
toAddress
▸ toAddress(): `fuel${string}`
Returns the bech32Address
property
Returns
`fuel${string}`
The bech32Address
property
Overrides
Defined in
toAssetId
▸ toAssetId(): AssetId
Wraps the bech32Address
property and returns as an AssetId
.
Returns
The bech32Address
property as an AssetId
Defined in
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
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
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
toHexString
▸ toHexString(): string
Converts
Returns
string
The bech32Address
property as a 256 bit hash string
Overrides
Defined in
toJSON
▸ toJSON(): string
Converts and returns the bech32Address
property as a string
Returns
string
The bech32Address
property as a string
Overrides
Defined in
toString
▸ toString(): string
Converts and returns the bech32Address
property as a string
Returns
string
The bech32Address
property as a string
Overrides
Defined in
valueOf
▸ valueOf(): string
Returns the value of the bech32Address
property
Returns
string
The value of bech32Address
property
Defined in
fromAddressOrString
▸ fromAddressOrString(address
): AbstractAddress
Takes an ambiguous string or address and creates an Address
Parameters
Name | Type |
---|---|
address | string | AbstractAddress |
Returns
a new Address
instance
Defined in
fromB256
▸ fromB256(b256Address
): Address
Takes a B256 Address and creates an Address
Parameters
Name | Type | Description |
---|---|---|
b256Address | string | A b256 hash |
Returns
A new Address
instance
Defined in
fromDynamicInput
▸ fromDynamicInput(address
): Address
Takes a dynamic string or AbstractAddress
and creates an Address
Throws
Error - Unknown address if the format is not recognised
Parameters
Name | Type |
---|---|
address | string | AbstractAddress |
Returns
A new Address
instance
Defined in
fromEvmAddress
▸ fromEvmAddress(evmAddress
): Address
Takes an Evm Address and returns back an Address
Parameters
Name | Type |
---|---|
evmAddress | string |
Returns
A new Address
instance
Defined in
fromPublicKey
▸ fromPublicKey(publicKey
): Address
Takes a Public Key, hashes it, and creates an Address
Parameters
Name | Type | Description |
---|---|---|
publicKey | string | A wallets public key |
Returns
A new Address
instance
Defined in
fromRandom
▸ fromRandom(): Address
Creates an Address
with a randomized bech32Address
property
Returns
A new Address
instance
Defined in
fromString
▸ fromString(address
): Address
Takes an ambiguous string and attempts to create an Address
Parameters
Name | Type | Description |
---|---|---|
address | string | An ambiguous string |
Returns
A new Address
instance