utils_helperfunctions
avalanche › Utils-HelperFunctions
Module: Utils-HelperFunctions
Index
Functions
- MaxWeightFormula
- NodeIDStringToBuffer
- UnixNow
- bufferToNodeIDString
- bufferToPrivateKeyString
- calcBytesCost
- costExportTx
- costImportTx
- getPreferredHRP
- privateKeyStringToBuffer
Functions
MaxWeightFormula
▸ MaxWeightFormula(staked
: BN, cap
: BN): BN
Defined in src/utils/helperfunctions.ts:32
Parameters:
Name | Type |
---|---|
staked | BN |
cap | BN |
Returns: BN
NodeIDStringToBuffer
▸ NodeIDStringToBuffer(pk
: string): Buffer
Defined in src/utils/helperfunctions.ts:81
Takes a nodeID string and produces a nodeID Buffer.
Parameters:
Name | Type | Description |
---|---|---|
pk | string | A 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:
Name | Type | Description |
---|---|---|
pk | Buffer | A 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:
Name | Type | Description |
---|---|---|
pk | Buffer | A Buffer for the private key. |
Returns: string
calcBytesCost
▸ calcBytesCost(len
: number): number
Defined in src/utils/helperfunctions.ts:102
Parameters:
Name | Type |
---|---|
len | number |
Returns: number
costExportTx
▸ costExportTx(tx
: UnsignedTx): number
Defined in src/utils/helperfunctions.ts:106
Parameters:
Name | Type |
---|---|
tx | UnsignedTx |
Returns: number
costImportTx
▸ costImportTx(tx
: UnsignedTx): number
Defined in src/utils/helperfunctions.ts:91
Parameters:
Name | Type |
---|---|
tx | UnsignedTx |
Returns: number
getPreferredHRP
▸ getPreferredHRP(networkID
: number): string
Defined in src/utils/helperfunctions.ts:23
Parameters:
Name | Type | Default |
---|---|---|
networkID | number | undefined |
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:
Name | Type | Description |
---|---|---|
pk | string | A string for the private key. |
Returns: Buffer