1.0.4 • Published 5 years ago
matrixjs-tx v1.0.4
SYNOPSIS
INSTALL
npm install matrixjs-tx
USAGE
const Matrix = require('matrixjs-tx')
const privateKey = Buffer.from('e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex')
const txParams = {
nonce: '0x00',
gasPrice: '0x0430e23400',
gasLimit: '0x033450',
to: 'MAN.5xYzBHrJfXeJi9yQ8Qq8hvm19bU4',
value: '0x00',
data: '0x',
chainId: 3,
v: '0x3',
r: '0x',
s: '0x',
TxEnterType: '',
IsEntrustTx: 1,
CommitTime: 1564545105,
extra_to: [[0, 0, []]],
// extra_to: [[0, 0, [['MAN.2WeBpo7BxfUxVmryJrqLSAKwxMW2U', '0x2c68af0bb140000', '0x'], ['MAN.2izwMiCSYWjTKfazv1qUaoQzDFJPG', '0x2c68af0bb140000', '0x']]]],
}
const tx = new Matrix(txParams)
tx.sign(privateKey)
const serializedTx = tx.serialize()
Note: this package expects ECMAScript 6 (ES6) as a minimum environment. From browsers lacking ES6 support, please use a shim (like es6-shim) before including any of the builds from this repo.
BROWSER
For a browser build please see https://github.com/matrixjs/browser-builds.