Package Exports
- @maticnetwork/eth-decoder
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@maticnetwork/eth-decoder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
eth-decoder
Simple library to decode ethereum transaction and logs
Install
$ npm install --save @maticnetwork/eth-decoderUsage
Log parser
import { LogDecoder } from "@maticnetwork/eth-decoder"
const ERC20TokenABI = /* { .... } */ // ABI for ERC20 token contract
// create decoder object
const decoder = new LogDecoder(
[
ERC20TokenABI,
// ... other ABIs
]
);
// parse logs
const parsedLogs = decoder.decodeLogs(receipt.logs) // For truffle testsuite, use `receipt.receipt.logs`
console.log(parsedLogs)Tx parser
import { TxDecoder } from "@maticnetwork/eth-decoder"
const ERC20TokenABI = /* { .... } */ // ABI for ERC20 token contract
// create decoder object
const decoder = new TxDecoder(
[
ERC20TokenABI,
// ... other ABIs
]
);
// parse tx
const parsedTx = decoder.decodeTx({ data: '0x..', value: '1000', from: '...', ... })
console.log(parsedTx)License
MIT