All utility methods

All method packed into the utils object.

MethodParametersReturnDescription

getAddressFromPrivateKey

(privateKey: string)

Promise<string>

Gets the address for the given PK based on the ED25519 curve and bech32 address conversion.

generateKeyPair

()

Promise<{ privateKey: string; address: string; }>

Generates a new privateKey/Address pair, based on the ED25519 curve and bech32 address conversion.

getProviders

()

Gets the current provider object.

setProviders

(providers: IProvider)

void

Sets the provider object.

broadcastTransactions

(txs: ITransaction[])

Promise<IBroadcastResponse>

Broadcasts an array of transactions to the provided node.

decodeTransaction

Promise<IDecodedTransaction>

Decodes a built transaction to a more human readable json.

transactionsProcessed

(txs: Promise[], tries?: number)

Promise<IDecodedTransaction[]>

Resolves when all the broadcasted transactions are on chain, rejects when the try limit is reached.

accountsReady

(accounts: Account[])

Promise<void>

Resolves when all the accounts in the array are initialized.

validateSignature

(message: string, signature: string, address: string)

Promise<boolean>

Checks if a signature is compatible with a given address and message.

decodeAddress

(address: string)

Promise<Uint8Array>

Decodes and address to an Uint8Array publicKey

toHex

(data: Uint8Array)

string

Helper method to convert Uint8Array to hex string.

Last updated