0.1.2 • Published 2 years ago
evm-calldata-decode v0.1.2
evm-calldata-decode
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)