2.4.0 • Published 4 years ago

abi-decoder v2.4.0

Weekly downloads
13,673
License
GPL-3.0
Repository
github
Last release
4 years ago

abi-decoder

Nodejs and Javascript library for decoding data params and events from etherem transactions

Install

npm install abi-decoder
bower install abi-decoder

Instantiate

<script src="bower_components/abi-decoder/dist/abi-decoder.js"> // Javascript
const abiDecoder = require('abi-decoder'); // NodeJS

Add ABI's

Need to pass the ABI's manually to the library in order to be able to decode params later

const testABI = [{"inputs": [{"type": "address", "name": ""}], "constant": true, "name": "isInstantiation", "payable": false, "outputs": [{"type": "bool", "name": ""}], "type": "function"}, {"inputs": [{"type": "address[]", "name": "_owners"}, {"type": "uint256", "name": "_required"}, {"type": "uint256", "name": "_dailyLimit"}], "constant": false, "name": "create", "payable": false, "outputs": [{"type": "address", "name": "wallet"}], "type": "function"}, {"inputs": [{"type": "address", "name": ""}, {"type": "uint256", "name": ""}], "constant": true, "name": "instantiations", "payable": false, "outputs": [{"type": "address", "name": ""}], "type": "function"}, {"inputs": [{"type": "address", "name": "creator"}], "constant": true, "name": "getInstantiationCount", "payable": false, "outputs": [{"type": "uint256", "name": ""}], "type": "function"}, {"inputs": [{"indexed": false, "type": "address", "name": "sender"}, {"indexed": false, "type": "address", "name": "instantiation"}], "type": "event", "name": "ContractInstantiation", "anonymous": false}];
abiDecoder.addABI(testABI);

Decode Tx data

const testData = "0x53d9d9100000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a6d9c5f7d4de3cef51ad3b7235d79ccc95114de5000000000000000000000000a6d9c5f7d4de3cef51ad3b7235d79ccc95114daa";
const decodedData = abiDecoder.decodeMethod(testData);

Decode Logs from Tx Receipt

web3.eth.getTransactionReceipt("0x9199e262aaab0a6ec99558b3e9f42397c07a2bb9c6befb637643aebfb03cc32a", function(e, receipt) {
  const decodedLogs = abiDecoder.decodeLogs(receipt.logs);
});
@qiibee/qb-api@tyz-wallet/crypto-rpc@tyz-wallet/tyz-wallet-core-service@haywael/typechainca-contractsnode_mongo_expressweb3dagger@thesis-co/mechamittens-extensionperi-financebitcore-wallet-service-sprc@radar/setprotocol.jscryptopay-js@steakwallet/chainskcc-bridge-sdk@dodoex-io/core@beycandeveloper/eth-chains@beycandeveloper/eth-wallets@beycandeveloper/multi-chainkcc-bridge-sdk-bsc@everything-registry/sub-chunk-1089@kucoin/kcc-bridge-sdk@1kx/typechaintabookey-gaslesssynthetixsynthetix-demaasynthetix-v2synthetix_kdstaalswap-jstest-omg-jswalletcswalletcs-libwanchain-dapp-connectstaking-servicesswitcheo-node-apithales-contractsvelasmon@dmihal/tabookey-gasless@dodoex/core@rsksmart/rif-marketplace-cache@peri-finance/peri-finance@perifinance/peri-finance@rout-horizon/horizon-testnet@rout-horizon/testnet-contractsjcc-ethereum-abijcc-moac-abijeffzwangprovideritaquemaximeipfsconsortiumproxyjvault.next.jsstd_multisig_controllerstn-sdk-litestn5_membershiptx-checkertxrevealtruffle-conflux-decodertw-eth-clitransaction-analyzertokenflow-gethtoken-buddy@appliedblockchain/mantle@appliedblockchain/mantle-api@appliedblockchain/mantle-core@appliedblockchain/simple-block-explorer@audius/libs@audius/sdk@authereum/common@augurproject/sdk@adora-wallet/adoracore-wallet-service@adora-wallet/adoracore-node@baguette-exchange/contracts@aztec-3/relay-client@afklblockchain/wt-contracts@bloomprotocol/verify-kit@bzxnetwork/contracts@celo/payments-server8x.js@8xprotocol/8x.js@8xprotocol/service-node-core@abcpros/bitcore-wallet-service@abcpros/bitcore-node@cognitochain/dharma.js@dharmaprotocol/dharma.js@dexon-foundation/truffle-decoder@dataxfi/datax.jsxpq-js-libzoo-game-sdktruffle-decodertruffle-eventsuse-fullstory-web3verifiable-dataverifiable-data-testxtreamly_slippage_predictor@openstfoundation/openst-platform@ducatus/bitcore-wallet-service@ducatus/crypto-rpc@ducatus/ducatuscore-wallet-service@finbook/duo-contract-wrapper@horizon-protocol/smart-contract@horizon-protocol/testrepo@ethql/core
2.4.0

4 years ago

2.3.0

5 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.6

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago