Utils

utils.0x

Prefixes "0x" to a hex.

Standard Parameters
Standard Parameters

Parameter

Type

Description

hex

string | BN | Buffer

Hex

Returns

string

utils.strip0x

Removes "0x" from a hex.

Standard Parameters
Standard Parameters

Parameter

Type

Description

hex

string | BN | Buffer

Hex

Returns

string

utils.randomNonce

Generate a random nonce for a new transaction.

Standard Parameters
Standard Parameters

None

Returns

string

utils.value

Converts valueIn to an amount denominated in unitIn.

Standard Parameters
Standard Parameters

Parameter

Type

Description

valueIn

unitIn

Returns

string

utils.<Bitcoin|Zcash|BitcoinCash>.getUTXOs

Retrieve UTXOs for the specified asset.

Standard Parameters
Standard Parameters

Parameter

Type

Description

isTestnet

boolean

Testnet flag.

Returns

[UTXO]

utils.<Bitcoin|Zcash|BitcoinCash>.addressToHex

Convert the specified asset's address string to hex.

Standard Parameters
Standard Parameters

Parameter

Type

Description

address

string

Address string.

Returns

string

utils.<Bitcoin|Zcash|BitcoinCash>.addressFrom

Retrieve the specified asset's address string from a hex.

Standard Parameters
Standard Parameters

Parameter

Type

Description

address

string

Address hex string.

Returns

string