Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

eminerjs-tx

ethereumjs3MPL-2.01.0.2

An simple module for creating, manipulating and signing eminer transactions

ethereum, transactions

readme

package.json [usage example]

"dependencies": {
  'aurorajs-tx': 'eminer/aurorajs-tx',
  ...
}

USAGE

const AuroraTx = require('aurorajs-tx')
const privateKey = Buffer.from('e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex')
const chainId = 1

function EMtoHex(address) {
    return address.replace(/^EM/, '0x')
}

const txParams = {
  nonce: '0x00',
  gasPrice: '0x09184e72a000', 
  gasLimit: '0x2710',
  to: EMtoHex('EM0000000000000000000000000000000000000000'), 
  value: '0x00', 
  data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
  action: 0, // 0 for regular/asset transaction, 6 for call contract
  asset: EMtoHex('EM0000000000000000000000000000000000000000'), //asset id, use it when asset transaction
  subAddress: 'EM140e0b100bc3c5820a5d5ed3cf94d54491f51a2fb590033560f603659600033565733600' // subAddress,use it when need subAddress

const tx = new AuroraTx(txParams)
tx.sign(privateKey, chainId)
const serializedTx = tx.serialize()

for more example can see examples/em-transactions.js.

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.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog (modification: no type change headlines) and this project adheres to Semantic Versioning.

1.3.7 - 2018-07-25

  • Fix bug causing FakeTransaction.from to not retrieve sender address from tx signature, see PR #118

1.3.6 - 2018-07-02

  • Fixes issue #108 with the FakeTransaction.hash() function by reverting the introduced signature handling changes in Fake transaction hash creation from PR #94 introduced in v1.3.5. The signature is now again only created and added to the hash when from address is set and from is not defaulting to the zero adress any more, see PR #110
  • Added additional tests to cover issue described above

1.3.5 - 2018-06-22

  • Include signature by default in FakeTransaction.hash, PR #97
  • Fix FakeTransaction signature failure bug, PR #94

1.3.4 - 2018-03-06

  • Fix a bug producing hash collisions on FakeTransaction for different senders, PR #81
  • Switched from deprecated es2015 to env babel preset, PR #86
  • Dropped Node 4 support

1.3.3 - 2017-07-12

  • Allow zeros in v,r,s signature values
  • Dropped browserify transform from package.json
  • (combined v1.3.3 and v1.3.2 release notes)

1.3.1 - 2017-05-13

  • Added ES5 build

1.3.0 - 2017-04-24

  • EIP155: allow v value to be greater than one byte (replay attack protection)
  • Added browserify ES2015 transform to package.json
  • Improved documentation
  • (combined v1.3.0, v1.2.5 and v1.2.4 release notes)

1.2.3 - 2017-01-30

  • EIP155 hash implementation
  • README example and doc fixes

1.2.2 - 2016-12-15

  • Moved chainId param to txParams, parse sig for chainId (EIP155 refactor)
  • Test improvements
  • (combined v1.2.2 and v1.2.1 release notes)

1.2.0 - 2016-12-14

  • Added EIP155 changes
  • Renamed chain_id to chainId
  • Node 4/5 compatibility
  • ES6 standards

Older releases: