Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ethereum-input-data-decoder

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethereum-input-data-decoder - npm Package Compare versions

Comparing version 0.0.17 to 0.1.0

bin/ethereum_input_data_decoder

9

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc