Laska.util
Class of Laksa common tools, providing useful functions and utilities.
Usage
const Laksa=require('laksa')
// or
import Laksa from 'laksa'
// initialize, but provider setting is non-essential
const laksa=new Laksa()
laksa.util.<{Method|Object|Class}>
Methods
- Laksa.util.add0x
- Laksa.util.compressPublicKey
- Laksa.util.createTransactionJson
- Laksa.util.encodeTransaction
- Laksa.util.extractValidator
- Laksa.util.fromAscii
- Laksa.util.fromUtf8
- Laksa.util.generatePrivateKey
- Laksa.util.getAddressFromPrivatekey
- Laksa.util.getAddressFromPublicKey
- Laksa.util.getPubKeyFromPrivateKey
- Laksa.util.hexToNumber
- Laksa.util.intToByteArray
- Laksa.util.isAddress
- Laksa.util.isArray
- Laksa.util.isBN
- Laksa.util.isBoolean
- Laksa.util.isFunction
- Laksa.util.isHash
- Laksa.util.isHex
- Laksa.util.isJson
- Laksa.util.isNull
- Laksa.util.isNumber
- Laksa.util.isObject
- Laksa.util.isPrivateKey
- Laksa.util.isPubkey
- Laksa.util.isString
- Laksa.util.isUndefined
- Laksa.util.isUrl
- Laksa.util.numberToHex
- Laksa.util.padLeft
- Laksa.util.padRight
- Laksa.util.randomBytes
- Laksa.util.strip0x
- Laksa.util.toAscii
- Laksa.util.toBN
- Laksa.util.toHex
- Laksa.util.toUtf8
- Laksa.util.utf8ToHex
- Laksa.util.validateArgs
- Laksa.util.validateFunctionArgs
- Laksa.util.validator
- Laksa.util.verifyPrivateKey
Methods
add0x
Add an '0x' prefix to value
Typed
add0x(value:string|BN|number|object)=> string;
parameters
returns
usage
// //suppose Laksa is initialized
//
// const address = "9bfec715a6bd658fcb62b0f8cc9bfa2ade71434a";
//
// // use callback to get the result
// Laksa.zil.getBalance({ address: address }, (err, data) => {
// if (err) {
// console.log(err);
// }
// console.log(data);
// });
//
// // use then to return Promises
// Laksa.zil.getBalance({ address: address }).then(console.log);