Skip to content

bolo-labs/eth-data-decoder

Repository files navigation

Ethereum Data Decoder (TypeScript)

The library can be used to decode contract transactions data. The library uses TypeScript to provide type information for the decoded data, this helps it self document and make it easier for you to use the library.

Installation

Using NPM

npm install eth-data-decoder

using Yarn

yarn add eth-data-decoder

Example

import { parseContractABI, decodeTransactionDataProcessor } from 'eth-data-decoder'; const contractABI = parseContractABI(contractABIString); const decoder = decodeTransactionDataProcessor(contractABI); // ... // ... // ... // Decode the transaction input const decodedData = decoder(transaction.input); // Get the name of the function called console.log(`Function name: ${decodedData.functionABI.name})`); // Get the list of the param names and its values decodedData.params.map( param => console.log(`Name: ${param.abi.name}, Value: ${param.rawValue}));

License

MIT © 2019 Zohaib Rauf.

About

Ethereum contract data decoder

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published