0.2.3 • Published 6 years ago
@cobo/tron v0.2.3
Tron HDWallet
You will create a tron HD instance and use the methods of the instance:
yarn add @cobo/tronStatic Methods:
fromMasterSeed- Create HD instance from a master seedfromExtendedKey- Create HD instance from a base58 stringfromMnemonic- Create HD instance from a mnemonicfromPrivateKey- Create HD instance from a private keygenerateMnemonic- Generate new mnemonic, or you can usebip39directly
Instance Methods:
derivePath- Return a derived HD node instance use a path ("m/44'/194'/0'/0/0")deriveChild- Return a derived HD node instancegetPrivateExtendedKey- Return the private extend key (base58)getPublicExtendedKey- Return the public extend key (base58)getAddress- Return the tron addresssignMessage- Retrun signed messageverfiyMessage- verify the SignaturegenerateTransaction- Return a tron transactionto- the address you want to send toamount- 1000000 = 1 TRXtoken- default is TRXlatestBlock- lastest tron block from any api backend
freeze- Freeze to get TRON poweramount- int, 1000000 = 1 TRXduration- int, how many days, default is 3latestBlock- lastest block info
unfreeze- Unfreeze all the TRXlatestBlock- lastest block info
const latestBlock = {
hash: 'e996dc5c0ecc96773d31d1cdd6e9db3140cdfcd6fcdbaadfc65ab3e4ad7b352f',
number: 195022,
timestamp: 1527312435000
}
return Tron
.fromMnemonic('alice loves bob')
.generateTransaction(latestBlock, '27Vsbb84NX6hNgR7kAGwi74BAXV7TdCcHTp', 100000000)Examples
See test/test.js for detail usage