eth-data-decoder
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i eth-data-decoder

Weekly Downloads

6

Version

0.0.2

License

MIT

Unpacked Size

38.7 kB

Total Files

31

Last publish

Collaborators

  • zabirauf