Isomorphic JavaScript SDK for NULS blockchain.
Warning
This project is still in early development stages. It is strongly not recommended to use this in a production environment.
Install
$ npm i nuls-js
Usage
import NULS from 'nuls-js';
const account = NULS.account.create();
console.log(account.address);
Guide
https://CCC-NULS.github.io/nuls-js/
Documentation
https://CCC-NULS.github.io/nuls-js/typedoc/index.html
Features
Account Management
TODO
- Read an address balance
- Read node details
- Read address transactions
- Token transactions
- Node joining/leaving
- Node reward output/input
- Red/yellow card transactions
- Send a transaction
- Find all consensus nodes
- Find all nodes
- Find richList/mostActive addresses
- Recent transactions
License
See the LICENSE file for details.
Type aliases
AddressHash
AddressHash: Buffer
BlockHash
BlockHash: string
BlockHex
BlockHex: string
ContractCallArg
ContractCallArg: string | string[]
ContractMethodsArgCustomType
ContractMethodsArgCustomType: string
ContractMethodsArgType
ContractMethodsArgType: "String" | "double" | "long" | "int" | "boolean" | "Address" | "BigInteger"
IContractCallGasResponse
IContractCallGasResponse: number
IContractGetMethodsResponse
IContractViewResponse
IContractViewResponse: string
INulsDataData
INulsDataData: Buffer | null
ITxDataRewardData
ITxDataRewardData: Buffer
IVarByteData
IVarByteData: Buffer
SignatureHash
SignatureHash: Buffer
TransactionHash
TransactionHash: string
TransactionHex
TransactionHex: string
Variables
Const ADDRESS_LENGTH
ADDRESS_LENGTH: 23 = 23
Const BLACK_HOLE_ADDRESS
BLACK_HOLE_ADDRESS: "Nse5FeeiYk1opxdc5RqYpEWkiUDGNuLs" = "Nse5FeeiYk1opxdc5RqYpEWkiUDGNuLs"
Const CONSENSUS_LOCK_TIME
CONSENSUS_LOCK_TIME: -1 = -1
Const CONSTRUCTOR_METHOD_NAME
CONSTRUCTOR_METHOD_NAME: "<init>" = "<init>"
Const CONTRACT_MAX_GAS_LIMIT
CONTRACT_MAX_GAS_LIMIT: 10000000 = 10000000
Const CONTRACT_MIN_GAS_PRICE
CONTRACT_MIN_GAS_PRICE: 25 = 25
Const HASH_LENGTH
HASH_LENGTH: 34 = 34
Const MAX_FEE_PRICE_1024_BYTES
MAX_FEE_PRICE_1024_BYTES: 1000000 = 1000000
Const MIN_FEE_PRICE_1024_BYTES
MIN_FEE_PRICE_1024_BYTES: 100000 = 100000
Const NULS_BASE
NULS_BASE: number = 10**8
Const NULS_DECIMALS
NULS_DECIMALS: 8 = 8
Const P2SH_ADDRESS_TYPE
P2SH_ADDRESS_TYPE: 3 = 3
Const PLACE_HOLDER
PLACE_HOLDER: Buffer = Buffer.from([0xFF, 0xFF, 0xFF, 0xFF])
Const PRIVATE_KEY_LENGTH
PRIVATE_KEY_LENGTH: 64 = 64
Const QRCode
QRCode: QRCodeClass = new QRCodeClass()
Functions
addressFromHash
-
Parameters
Returns string
createTransactionSignature
getFee
- getFee(size: number, feePrice: number): number
-
Parameters
-
size: number
-
feePrice: number
Returns number
getMaxFee
- getMaxFee(size: number): number
-
Parameters
Returns number
getMinFee
- getMinFee(size: number): number
-
Parameters
Returns number
getPrivateKeyBuffer
- getPrivateKeyBuffer(privateKey: string): Buffer
-
Parameters
Returns Buffer
getXOR
- getXOR(bytes: Buffer): number
-
Parameters
Returns number
hashFromPublicKey
- hashFromPublicKey(publicKey: Buffer, __namedParameters?: object): Buffer
-
Parameters
-
publicKey: Buffer
-
Default value __namedParameters: object = {}
Returns Buffer
isHex
- isHex(input: string): boolean
-
Parameters
Returns boolean
isValidAddress
- isValidAddress(address: string): boolean
-
Parameters
Returns boolean
isValidHash
- isValidHash(hash: string): boolean
-
Parameters
Returns boolean
isValidPrivateKey
- isValidPrivateKey(privateKey: string): boolean
-
Parameters
Returns boolean
naToNuls
- naToNuls(na: number): number
-
Parameters
Returns number
nulsToNa
- nulsToNa(nuls: number): number
-
Parameters
Returns number
publicKeyFromPrivateKey
- publicKeyFromPrivateKey(privateKey: Buffer): Buffer
-
Parameters
Returns Buffer
readUint64LE
- readUint64LE(buffer: Buffer, offset: number): number
-
Parameters
-
buffer: Buffer
-
offset: number
Returns number
ripemd160
- ripemd160(buffer: Buffer): Buffer
-
Parameters
Returns Buffer
sha256
- sha256(buffer: Buffer): Buffer
-
Parameters
Returns Buffer
sha256Twice
- sha256Twice(buffer: Buffer): Buffer
-
Parameters
Returns Buffer
writeUint64LE
- writeUint64LE(data: number, buf: Buffer, offset: number): number
-
Parameters
-
data: number
-
buf: Buffer
-
offset: number
Returns number
CoinData
https://github.com/nuls-io/nuls/blob/master/core-module/kernel/src/main/java/io/nuls/kernel/model/CoinData.java