ethereum-input-data-decoder
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -89,3 +89,3 @@ 'use strict'; | ||
var dataBuf = Buffer.from(data.replace(/^0x/, ''), 'hex'); | ||
var methodId = dataBuf.subarray(0, 4).toString('hex'); | ||
var methodId = toHexString(dataBuf.subarray(0, 4)); | ||
var inputsBuf = dataBuf.subarray(4); | ||
@@ -99,3 +99,3 @@ | ||
}) : []; | ||
var hash = ethabi.methodID(name, types).toString('hex'); | ||
var hash = toHexString(ethabi.methodID(name, types)); | ||
@@ -167,2 +167,8 @@ if (hash === methodId) { | ||
function toHexString(byteArray) { | ||
return Array.from(byteArray, function (byte) { | ||
return ('0' + (byte & 0xFF).toString(16)).slice(-2); | ||
}).join(''); | ||
} | ||
module.exports = InputDataDecoder; |
10
index.js
@@ -76,3 +76,3 @@ const fs = require('fs') | ||
const dataBuf = Buffer.from(data.replace(/^0x/, ''), 'hex') | ||
const methodId = dataBuf.subarray(0, 4).toString('hex') | ||
const methodId = toHexString(dataBuf.subarray(0, 4)) | ||
var inputsBuf = dataBuf.subarray(4) | ||
@@ -84,3 +84,3 @@ | ||
const types = obj.inputs ? obj.inputs.map(x => x.type) : [] | ||
const hash = ethabi.methodID(name, types).toString('hex') | ||
const hash = toHexString(ethabi.methodID(name, types)) | ||
@@ -149,2 +149,8 @@ if (hash === methodId) { | ||
function toHexString (byteArray) { | ||
return Array.from(byteArray, function (byte) { | ||
return ('0' + (byte & 0xFF).toString(16)).slice(-2) | ||
}).join('') | ||
} | ||
module.exports = InputDataDecoder |
{ | ||
"name": "ethereum-input-data-decoder", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Ethereum smart contract transaction input data decoder", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
991368
26138