ethereum-input-data-decoder
Advanced tools
Comparing version 0.0.17 to 0.1.0
{ | ||
"name": "ethereum-input-data-decoder", | ||
"version": "0.0.17", | ||
"version": "0.1.0", | ||
"description": "Ethereum smart contract transaction input data decoder", | ||
@@ -14,2 +14,5 @@ "main": "dist/index.js", | ||
}, | ||
"bin": { | ||
"ethereum_input_data_decoder": "bin/ethereum_input_data_decoder" | ||
}, | ||
"repository": { | ||
@@ -33,4 +36,6 @@ "type": "git", | ||
"dependencies": { | ||
"bn.js": "^4.11.8", | ||
"ethereumjs-abi": "^0.6.4", | ||
"ethers": "^2.1.3" | ||
"ethers": "^2.1.3", | ||
"meow": "^5.0.0" | ||
}, | ||
@@ -37,0 +42,0 @@ "keywords": [ |
@@ -101,2 +101,70 @@ <h3 align="center"> | ||
## CLI | ||
## Install | ||
```bash | ||
npm install -g ethereum-input-data-decoder | ||
``` | ||
### Usage | ||
```bash | ||
$ ethereum_input_data_decoder --help | ||
Ethereum smart contract transaction input data decoder | ||
Usage | ||
$ ethereum_input_data_decoder [flags] [input] | ||
Options | ||
--abi, -a ABI file path | ||
--input, -i Input data file path | ||
Examples | ||
$ ethereum_input_data_decoder --abi token.abi --input data.txt | ||
$ ethereum_input_data_decoder --abi token.abi "0x23b872dd..." | ||
``` | ||
### Example | ||
Pass ABI file and input data as file: | ||
```bash | ||
$ ethereum_input_data_decoder --abi abi.json --input data.tx | ||
name registerOffChainDonation | ||
address 0x5a9dac9315fdd1c3d13ef8af7fdfeb522db08f02 | ||
uint256 1487012400 | ||
uint256 4204852 | ||
string BTC | ||
bytes32 0xf3df64775a2dfb6bc9e09dced96d0816ff5055bf95da13ce5b6c3f53b97071c8 | ||
``` | ||
Pass ABI file and input data as string: | ||
```bash | ||
$ ethereum_input_data_decoder --abi abi.json 0x67043cae0...000000 | ||
name registerOffChainDonation | ||
address 0x5a9dac9315fdd1c3d13ef8af7fdfeb522db08f02 | ||
uint256 1487012400 | ||
uint256 4204852 | ||
string BTC | ||
bytes32 0xf3df64775a2dfb6bc9e09dced96d0816ff5055bf95da13ce5b6c3f53b97071c8 | ||
``` | ||
You can also pipe the input data: | ||
```bash | ||
$ cat data.txt | ethereum_input_data_decoder --abi abi.json | ||
name registerOffChainDonation | ||
address 0x5a9dac9315fdd1c3d13ef8af7fdfeb522db08f02 | ||
uint256 1487012400 | ||
uint256 4204852 | ||
string BTC | ||
bytes32 0xf3df64775a2dfb6bc9e09dced96d0816ff5055bf95da13ce5b6c3f53b97071c8 | ||
``` | ||
## Test | ||
@@ -103,0 +171,0 @@ |
@@ -7,7 +7,7 @@ const fs = require('fs') | ||
// https://etherscan.io/tx/0xa6f019f2fc916bd8df607f1c99148ebb06322999ff08bc88927fe8406acae1b2 | ||
const data = '0x67043cae0000000000000000000000005a9dac9315fdd1c3d13ef8af7fdfeb522db08f020000000000000000000000000000000000000000000000000000000058a20230000000000000000000000000000000000000000000000000000000000040293400000000000000000000000000000000000000000000000000000000000000a0f3df64775a2dfb6bc9e09dced96d0816ff5055bf95da13ce5b6c3f53b97071c800000000000000000000000000000000000000000000000000000000000000034254430000000000000000000000000000000000000000000000000000000000' | ||
const data = fs.readFileSync(`${__dirname}/data/abi1_input_data.txt`) | ||
t.test('abi filepath', t => { | ||
t.plan(6) | ||
const decoder = new InputDataDecoder(`${__dirname}/data/abi.json`) | ||
const decoder = new InputDataDecoder(`${__dirname}/data/abi1.json`) | ||
@@ -32,3 +32,3 @@ const result = decoder.decodeData(data) | ||
t.plan(6) | ||
const abi = JSON.parse(fs.readFileSync(`${__dirname}/data/abi.json`)) | ||
const abi = JSON.parse(fs.readFileSync(`${__dirname}/data/abi1.json`)) | ||
const decoder = new InputDataDecoder(abi) | ||
@@ -56,3 +56,3 @@ | ||
const abi = JSON.parse(fs.readFileSync(`${__dirname}/data/abi.json`)) | ||
const abi = JSON.parse(fs.readFileSync(`${__dirname}/data/abi1.json`)) | ||
const decoder = new InputDataDecoder(abi) | ||
@@ -74,3 +74,3 @@ | ||
const data = fs.readFileSync(`${__dirname}/data/erc71_transferfrom_tx_data.txt`) | ||
const data = fs.readFileSync(`${__dirname}/data/erc721_transferfrom_tx_data.txt`) | ||
const result = decoder.decodeData(data) | ||
@@ -77,0 +77,0 @@ |
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
990892
22
26124
222
4
10
+ Addedbn.js@^4.11.8
+ Addedmeow@^5.0.0
+ Addedarray-find-index@1.0.2(transitive)
+ Addedarrify@1.0.1(transitive)
+ Addedcamelcase@4.1.0(transitive)
+ Addedcamelcase-keys@4.2.0(transitive)
+ Addedcurrently-unhandled@0.4.1(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddecamelize-keys@1.1.1(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedfind-up@2.1.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedindent-string@3.2.0(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-plain-obj@1.1.0(transitive)
+ Addedjson-parse-better-errors@1.0.2(transitive)
+ Addedload-json-file@4.0.0(transitive)
+ Addedlocate-path@2.0.0(transitive)
+ Addedloud-rejection@1.6.0(transitive)
+ Addedmap-obj@1.0.12.0.0(transitive)
+ Addedmeow@5.0.0(transitive)
+ Addedminimist-options@3.0.2(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addedp-limit@1.3.0(transitive)
+ Addedp-locate@2.0.0(transitive)
+ Addedp-try@1.0.0(transitive)
+ Addedparse-json@4.0.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@3.0.0(transitive)
+ Addedpify@3.0.0(transitive)
+ Addedquick-lru@1.1.0(transitive)
+ Addedread-pkg@3.0.0(transitive)
+ Addedread-pkg-up@3.0.0(transitive)
+ Addedredent@2.0.0(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedstrip-bom@3.0.0(transitive)
+ Addedstrip-indent@2.0.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtrim-newlines@2.0.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
+ Addedyargs-parser@10.1.0(transitive)