Skip to content

@fuel-ts/address v0.94.6Docs


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

Address

Overrides

AbstractAddress.constructor

Defined in

address.ts:37

Properties

bech32Address

readonly bech32Address: `fuel${string}`

Deprecated

The bech32Address is now deprecated. Please migrate to toB256 as this will be the standard going forward.

Defined in

address.ts:31

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

Deprecated

The bech32Address is now deprecated. Please migrate to toB256 as this will be the standard going forward.

Overrides

AbstractAddress.equals

Defined in

address.ts:151


toAddress()

toAddress(): `fuel${string}`

Returns the bech32Address property

Returns

`fuel${string}`

The bech32Address property

Deprecated

The bech32Address is now deprecated. Please migrate to toB256 as this will be the standard going forward.

Overrides

AbstractAddress.toAddress

Defined in

address.ts:55


toAssetId()

toAssetId(): AssetId

Wraps the bech32Address property and returns as an AssetId.

Returns

AssetId

The bech32Address property as an AssetId

Deprecated

The bech32Address is now deprecated. Please migrate to toB256 as this will be the standard going forward.

Defined in

address.ts:128


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

Deprecated

The bech32Address is now deprecated. Please migrate to toB256 as this will be the standard going forward.

Overrides

AbstractAddress.toB256

Defined in

address.ts:65


toBytes()

toBytes(): Uint8Array

Converts and returns the bech32Address property to a byte array

Returns

Uint8Array

The bech32Address property as a byte array

Deprecated

The bech32Address is now deprecated. Please migrate to toB256 as this will be the standard going forward.

Overrides

AbstractAddress.toBytes

Defined in

address.ts:75


toEvmAddress()

toEvmAddress(): EvmAddress

Clears the first 12 bytes of the bech32Address property and returns it as a EvmAddress

Returns

EvmAddress

The bech32Address property as an EvmAddress

Deprecated

The bech32Address is now deprecated. Please migrate to toB256 as this will be the standard going forward.

Defined in

address.ts:114


toHexString()

toHexString(): string

Converts

Returns

string

The bech32Address property as a 256 bit hash string

Deprecated

The bech32Address is now deprecated. Please migrate to toB256 as this will be the standard going forward.

Overrides

AbstractAddress.toHexString

Defined in

address.ts:85


toJSON()

toJSON(): string

Converts and returns the bech32Address property as a string

Returns

string

The bech32Address property as a string

Deprecated

The bech32Address is now deprecated. Please migrate to toB256 as this will be the standard going forward.

Overrides

AbstractAddress.toJSON

Defined in

address.ts:104


toString()

toString(): string

Converts and returns the bech32Address property as a string

Returns

string

The bech32Address property as a string

Overrides

AbstractAddress.toString

Defined in

address.ts:94


valueOf()

valueOf(): string

Returns the value of the bech32Address property

Returns

string

The value of bech32Address property

Deprecated

The bech32Address is now deprecated. Please migrate to toB256 as this will be the standard going forward.

Defined in

address.ts:140


fromAddressOrString()

static fromAddressOrString(address): AbstractAddress

Takes an ambiguous string or address and creates an Address

Parameters

address: string | AbstractAddress

Returns

AbstractAddress

a new Address instance

Defined in

address.ts:211


fromB256()

static fromB256(b256Address): Address

Takes a B256 Address and creates an Address

Parameters

b256Address: string

A b256 hash

Returns

Address

A new Address instance

Defined in

address.ts:176


fromDynamicInput()

static fromDynamicInput(address): Address

Takes a dynamic string or AbstractAddress and creates an Address

Parameters

address: string | AbstractAddress

Returns

Address

A new Address instance

Throws

Error - Unknown address if the format is not recognised

Defined in

address.ts:222


fromEvmAddress()

static fromEvmAddress(evmAddress): Address

Takes an Evm Address and returns back an Address

Parameters

evmAddress: string

Returns

Address

A new Address instance

Defined in

address.ts:256


fromPublicKey()

static fromPublicKey(publicKey): Address

Takes a Public Key, hashes it, and creates an Address

Parameters

publicKey: string

A wallets public key

Returns

Address

A new Address instance

Defined in

address.ts:161


fromRandom()

static fromRandom(): Address

Creates an Address with a randomized bech32Address property

Returns

Address

A new Address instance

Defined in

address.ts:192


fromString()

static fromString(address): Address

Takes an ambiguous string and attempts to create an Address

Parameters

address: string

An ambiguous string

Returns

Address

A new Address instance

Defined in

address.ts:202