@omisego/omg-js-util
Advanced tools
Comparing version 3.0.0-alpha.4 to 3.0.0-alpha.5
{ | ||
"name": "@omisego/omg-js-util", | ||
"version": "3.0.0-alpha.4", | ||
"version": "3.0.0-alpha.5", | ||
"description": "OMG util module", | ||
@@ -30,3 +30,3 @@ "main": "src/index.js", | ||
}, | ||
"gitHead": "73bd9623820d5e13f8b1487d3a4b4f7621d74797" | ||
"gitHead": "cae561670c71319ed2d2e66ce0adf402da308b06" | ||
} |
@@ -21,3 +21,6 @@ /* | ||
hexToBytes: require('./hexToBytes'), | ||
ArgTypes: require('./ArgTypes') | ||
ArgTypes: require('./ArgTypes'), | ||
hexPrefix: require('./hexPrefix'), | ||
ethErrorReason: require('./ethErrorReason') | ||
} | ||
@@ -24,2 +24,3 @@ /* | ||
const getToSignHash = require('./signHash') | ||
const hexPrefix = require('./hexPrefix') | ||
@@ -117,5 +118,5 @@ const MAX_INPUTS = 4 | ||
*/ | ||
encode: function ({ transactionType, inputs, outputs, metadata, signatures }) { | ||
encode: function ({ transactionType, inputs, outputs, metadata, signatures }, { signed = true } = {}) { | ||
const txArray = [transactionType] | ||
signatures && txArray.unshift(signatures) | ||
signatures && signed && txArray.unshift(signatures) | ||
const inputArray = [] | ||
@@ -138,5 +139,10 @@ const outputArray = [] | ||
txArray.push(metadata) | ||
return `0x${rlp.encode(txArray).toString('hex')}` | ||
return hexPrefix(rlp.encode(txArray).toString('hex')) | ||
}, | ||
rlpDecode: function (hash) { | ||
const rawTx = Buffer.isBuffer(hash) ? hash : Buffer.from(hash.replace('0x', ''), 'hex') | ||
return rlp.decode(rawTx) | ||
}, | ||
/** | ||
@@ -143,0 +149,0 @@ * Decodes an RLP encoded transaction |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68059
20
1681