Skip to content

vojtechsimetka/evm-calldata-decode

Repository files navigation

evm-calldata-decode

Tests standard-readme compliant js-standard-style

Library for decoding function name and arguments from EVM calldata

Warning: This project is in beta state. There might (and most probably will) be changes in the future to its API and working. Also, no guarantees can be made about its stability, efficiency, and security at this stage.

Table of Contents

Install

npm install evm-calldata-decode --save

The project also expects peer dependency @ethersproject or the individual modules @ethersproject/abi, @ethersproject/bignumber, @ethersproject/bytes, @ethersproject/keccak256, @ethersproject/strings

Usage

import { decodeCallData } from 'evm-calldata-decode'

Decode calldata with ABI

const calldata = '0x1234567800000...'
const abi = '[{"inputs": [...],"name": "mint","type": "function", ...}, ...]'
decodeCallDataWithSignatureDB(calldata, abi)

Decode calldate with online smart contract validator

NOT IMPLEMENTED YET

Attempts to decode calldata with ABI retrieved from Etherscan or Sourcify.

const calldata = '0x1234567800000....'
const contract_address = '0x0....0'
decodeCallDataWithSignatureDB(calldata, contract_address)

Decode calldata with evm signature database

NOT IMPLEMENTED YET

Attempts to decode calldata with a signature retrieved from Ethereum Signature Database. This is a last resort option if only the calldata are known.

const calldata = '0x1234567800000....'
decodeCallDataWithSignatureDB(calldata)

Maintainers

License

MIT