Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
ethereum-tx-decoder
Advanced tools
Readme
Lightweight utility for decoding function parameters from Ethereum transactions.
Minimal dependencies.
Find the exact function parameters that triggered an event.
npm i ethereum-tx-decoder
decodeTx()
Decode raw transactions into an Object.
var txDecoder = require('ethereum-tx-decoder');
// transaction.raw = '0x...'
var decodedTx = txDecoder.decodeTx(transaction.raw);
// {
// nonce: Number
// gasPrice: BigNumber
// gasLimit: BigNumber
// to: string (hex)
// value: BigNumber
// data: string (hex)
// v: Number
// r: string (hex)
// s: string (hex)
// }
Need to know from
or chainId
? Use ethers.Wallet.parseTransaction()
instead.
class FunctionDecoder
Decode function call data into the original parameter values.
ethers.Contract
: // contract = new Contract(address, abi, provider)
var fnDecoder = new txDecoder.FunctionDecoder(contract.interface);
abi
: // Internally creates an ethers.Interface object.
var fnDecoder = new txDecoder.FunctionDecoder(abi);
decodeFn()
fnDecoder.decodeFn(decodedTx.data);
// Result {
// ...All function parameters indexed by both name and position...
// }
Note: decodeFn()
returns an Arrayish
.
decodeFnFromTx()
Shortcut for decoding a function from transaction.
fnDecoder.decodeFnFromTx(transaction.raw);
FAQs
Lightweight utility for decoding function parameters from Ethereum transactions.
The npm package ethereum-tx-decoder receives a total of 1,473 weekly downloads. As such, ethereum-tx-decoder popularity was classified as popular.
We found that ethereum-tx-decoder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.