2.4.0 • Published 3 years ago

abi-decoder v2.4.0

Weekly downloads
13,673
License
GPL-3.0
Repository
github
Last release
3 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/typechaindoloresaccusantiumdracma_coreduo-contract-utilellevenelleven-v2odiovoluptatemeth-blockchain-helpereth-chainsaweonacore-serviceeonacore-crypto-rpceth-swapeth-revealoikos-v3oikoscashzoo-game-sdkquasiusto@perifinance/peri-finance@peri-finance/peri-finance@phoenix-global/horizon@sinu5oidlab/servicesqb-apipynthetixgsnneloguardians.jsoone-synthetixwalletcswalletcs-libevan.prompteth-internal-transaction-disecterxpq-js-libxtreamly_slippage_predictor@pstehlik/dharma.js@thales-dao/contracts@truffle-types/events-decoderwanchain-dapp-connectpetermunachi-ellevenfederatorpublic-wallet-apipolymarket-gsn-providerpolkastarter-jsfuel-web3-providerjeffzwangprovidersc-indexersapienteofficia@windingtree/lif-token@appliedblockchain/mantle@appliedblockchain/mantle-api@appliedblockchain/mantle-core@appliedblockchain/simple-block-explorersedlaudantium@bloomprotocol/verify-kit@dexon-foundation/truffle-decoderapp-v99-commonshibax@baguette-exchange/contractskongtama_core@cognitochain/dharma.js@dharmaprotocol/dharma.jssmart-contract-loadersmart-trade-networkssmart-trade-networks-contracts@synthr-staging/js@synthr/js@suku/governance-eth-lib@suku/suku-governance-eth-lib@rndlabs/monsi@rout-horizon/horizon-testnet@rout-horizon/testnet-contracts@swtrse/bitcore-wallet-service@swtrse/crypto-rpc@uma/common@umaprotocol/commonitaquemaximeipfsconsortiumproxy@8xprotocol/8x.js@8xprotocol/service-node-core@vondas/loupe8x.js
2.4.0

3 years ago

2.3.0

4 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.6

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago