Skip to main content

Class: Utils

Utils class for utils.

Table of contents

Methods

Methods

generateMnemonic

Static generateMnemonic(): string

Generates a new mnemonic.

Returns

string


mnemonicToHexSeed

Static mnemonicToHexSeed(mnemonic): string

Returns a hex encoded seed for a mnemonic.

Parameters

NameType
mnemonicstring

Returns

string


computeAliasId

Static computeAliasId(outputId): string

Computes the alias id for the given alias output id.

Parameters

NameType
outputIdstring

Returns

string


computeNftId

Static computeNftId(outputId): string

Computes the NFT id for the given NFT output id.

Parameters

NameType
outputIdstring

Returns

string


computeFoundryId

Static computeFoundryId(aliasAddress, serialNumber, tokenSchemeKind): string

Computes the foundry id.

Parameters

NameType
aliasAddressstring
serialNumbernumber
tokenSchemeKindnumber

Returns

string


parseBech32Address

Static parseBech32Address(address): Address

Returns a valid Address parsed from a String.

Parameters

NameType
addressstring

Returns

Address


blockId

Static blockId(block): string

Returns a block ID (Blake2b256 hash of the block bytes)

Parameters

NameType
blockIBlock

Returns

string


bech32ToHex

Static bech32ToHex(bech32): string

Transforms bech32 to hex.

Parameters

NameType
bech32string

Returns

string


hexToBech32

Static hexToBech32(hex, bech32Hrp): string

Transforms a hex encoded address to a bech32 encoded address.

Parameters

NameType
hexstring
bech32Hrpstring

Returns

string


aliasIdToBech32

Static aliasIdToBech32(aliasId, bech32Hrp): string

Transforms an alias id to a bech32 encoded address.

Parameters

NameType
aliasIdstring
bech32Hrpstring

Returns

string


nftIdToBech32

Static nftIdToBech32(nftId, bech32Hrp): string

Transforms an nft id to a bech32 encoded address.

Parameters

NameType
nftIdstring
bech32Hrpstring

Returns

string


hexPublicKeyToBech32Address

Static hexPublicKeyToBech32Address(hex, bech32Hrp): string

Transforms a hex encoded public key to a bech32 encoded address.

Parameters

NameType
hexstring
bech32Hrpstring

Returns

string


isAddressValid

Static isAddressValid(address): boolean

Checks if a String is a valid bech32 encoded address.

Parameters

NameType
addressstring

Returns

boolean


hashTransactionEssence

Static hashTransactionEssence(essence): string

Compute the hash of a transaction essence.

Parameters

NameType
essenceITransactionEssence

Returns

string


verifyEd25519Signature

Static verifyEd25519Signature(signature, message): boolean

Verifies the Ed25519Signature against a message.

Parameters

NameType
signatureEd25519Signature
messagestring

Returns

boolean


verifySecp256k1EcdsaSignature

Static verifySecp256k1EcdsaSignature(publicKey, signature, message): boolean

Verifies the Secp256k1Ecdsa Signature against a message.

Parameters

NameType
publicKeystring
signaturestring
messagestring

Returns

boolean


verifyMnemonic

Static verifyMnemonic(mnemonic): void

Verify if a mnemonic is a valid BIP39 mnemonic.

Parameters

NameType
mnemonicstring

Returns

void