Skip to main content

utils_helperfunctions

avalancheUtils-HelperFunctions

Module: Utils-HelperFunctions

Index

Functions

Functions

MaxWeightFormula

MaxWeightFormula(staked: BN, cap: BN): BN

Defined in src/utils/helperfunctions.ts:32

Parameters:

NameType
stakedBN
capBN

Returns: BN


NodeIDStringToBuffer

NodeIDStringToBuffer(pk: string): Buffer

Defined in src/utils/helperfunctions.ts:81

Takes a nodeID string and produces a nodeID Buffer.

Parameters:

NameTypeDescription
pkstringA string for the nodeID.

Returns: Buffer


UnixNow

UnixNow(): BN

Defined in src/utils/helperfunctions.ts:39

Function providing the current UNIX time using a BN.

Returns: BN


bufferToNodeIDString

bufferToNodeIDString(pk: Buffer): string

Defined in src/utils/helperfunctions.ts:72

Takes a nodeID buffer and produces a nodeID string with prefix.

Parameters:

NameTypeDescription
pkBufferA Buffer for the nodeID.

Returns: string


bufferToPrivateKeyString

bufferToPrivateKeyString(pk: Buffer): string

Defined in src/utils/helperfunctions.ts:48

Takes a private key buffer and produces a private key string with prefix.

Parameters:

NameTypeDescription
pkBufferA Buffer for the private key.

Returns: string


calcBytesCost

calcBytesCost(len: number): number

Defined in src/utils/helperfunctions.ts:102

Parameters:

NameType
lennumber

Returns: number


costExportTx

costExportTx(tx: UnsignedTx): number

Defined in src/utils/helperfunctions.ts:106

Parameters:

NameType
txUnsignedTx

Returns: number


costImportTx

costImportTx(tx: UnsignedTx): number

Defined in src/utils/helperfunctions.ts:91

Parameters:

NameType
txUnsignedTx

Returns: number


getPreferredHRP

getPreferredHRP(networkID: number): string

Defined in src/utils/helperfunctions.ts:23

Parameters:

NameTypeDefault
networkIDnumberundefined

Returns: string


privateKeyStringToBuffer

privateKeyStringToBuffer(pk: string): Buffer

Defined in src/utils/helperfunctions.ts:57

Takes a private key string and produces a private key Buffer.

Parameters:

NameTypeDescription
pkstringA string for the private key.

Returns: Buffer