@burstjs/util
Useful utilities and tools for building Burstcoin applications
Installation
Install using npm:
npm install @burstjs/util
or using yarn:
yarn add @burstjs/util
API Reference
Modules
- util
Members
- isValid ⇒
boolean
Check for valid Burst address (format: BURST-XXXX-XXXX-XXXX-XXXXX, XXXX-XXXX-XXXX-XXXXX)
Constants
- initialCodeword
Original work Copyright (c) 2018 PoC-Consortium
Modified work Copyright (c) 2019 Burst Apps Team
Functions
- constructBurstAddress(parts)
Construct a Burst address from a string array
- convertAddressToNumericId(address) ⇒
Converts BURST-XXXX-XXXX-XXXX-XXXXX into numeric Id
- convertNQTStringToNumber(amount) ⇒
Helper method to convert a String to number
- convertNumberToNQTString(n) ⇒
Helper method to Number to String(8 decimals) representation
- convertNumericIdToAddress(numericId) ⇒
Encode a numeric id into BURST-XXXX-XXXX-XXXX-XXXXX
- isValid(address) ⇒
boolean
Check for valid Burst address (format: BURST-XXXX-XXXX-XXXX-XXXXX, XXXX-XXXX-XXXX-XXXXX)
- splitBurstAddress(address)
Split the Burst address string into an array of 4 parts
util
util~burstAddressPattern
A useful regex for matching burst addresses
Kind: inner constant of util
isValid ⇒ boolean
Check for valid Burst address (format: BURST-XXXX-XXXX-XXXX-XXXXX, XXXX-XXXX-XXXX-XXXXX)
Kind: global variable
Returns: boolean
-
true, if is a valid address, else false
Note: This is with prior quick check
Param | Type | Description |
---|
address | string | The address |
initialCodeword
Original work Copyright (c) 2018 PoC-Consortium
Modified work Copyright (c) 2019 Burst Apps Team
Kind: global constant
constructBurstAddress(parts)
Construct a Burst address from a string array
Kind: global function
Param | Description |
---|
parts | 4 parts string array |
convertAddressToNumericId(address) ⇒
Converts BURST-XXXX-XXXX-XXXX-XXXXX into numeric Id
Kind: global function
Returns:
The numeric id, or undefined if address is invalid
Param | Description |
---|
address | The BURST address |
convertNQTStringToNumber(amount) ⇒
Helper method to convert a String to number
Kind: global function
Returns:
A number expressed in Burst (not NQT)
Throws:
Param | Description |
---|
amount | The amount in NQT |
convertNumberToNQTString(n) ⇒
Helper method to Number to String(8 decimals) representation
Kind: global function
Returns:
a NQT number string
Param | Description |
---|
n | the number |
convertNumericIdToAddress(numericId) ⇒
Encode a numeric id into BURST-XXXX-XXXX-XXXX-XXXXX
Kind: global function
Returns:
the BURST address in Reed-Solomon encoding, or undefined if passed null, undefined
Param | Description |
---|
numericId | The numeric Id |
isValid(address) ⇒ boolean
Check for valid Burst address (format: BURST-XXXX-XXXX-XXXX-XXXXX, XXXX-XXXX-XXXX-XXXXX)
Kind: global function
Returns: boolean
-
true, if is a valid address, else false
Param | Type | Description |
---|
address | string | The address |
splitBurstAddress(address)
Split the Burst address string into an array of 4 parts
Kind: global function
Param | Description |
---|
address | A valid Burst address |