Skip to content

A simple module for creating, manipulating and signing Moac transactions

License

Notifications You must be signed in to change notification settings

wanpixiaozi/moacjs-tx

Repository files navigation

SYNOPSIS

NPM Package Build Status Coverage Status js-standard-style

INSTALL

npm install moacjs-tx

USAGE

`const Chain3 = require('chain3')
const chain3 = new Chain3(new Chain3.providers.HttpProvider('http://localhost:8545')) 
const MoacTx = require('moacjs-tx')
const privateKey = XXX

const txParams = {
  nonce: '0x00',
  gasPrice: '0x09184e72a000', 
  gasLimit: '0x2710',
  to: '0x0000000000000000000000000000000000000000', 
  value: '0x00', 
  data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
  shardingFlag: 0,
  // chainId - mainnet: 99, testnet: 101
  chainId: 101
}

const tx = new MoacTx(rawTx)
const serializedTx = tx.sign(fromSecret)
chain3.mc.sendRawTransaction(serializedTx, function (err, hash) {
    if (!err) {
      console.log('succeed: ', hash)
      return hash
    } else {
      console.log('error:', err)
      console.log('raw tx:', rawTx)
    }
})`

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 get from https://github.com/wanpixiaozi/moacjs-tx/blob/master/dist/moacjs-tx.min.js.

API

./docs/

LICENSE

MPL-2.0

About

A simple module for creating, manipulating and signing Moac transactions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published