How to use the abi-decoder.addABI function in abi-decoder

To help you get started, we’ve selected a few abi-decoder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ostdotcom / ost-price-oracle / test / lib / event_decoder.js View on Github external
logger.debug('**** contract address: ' + txReceipt.logs[i].address + ' at log index(' + i + ') in TxHash: ' + txReceipt.transactionHash + '');

        if (!currContractAddrFromReciept) {
          logger.error('**** No contract found for contract address: ' + txReceipt.logs[i].address + ' at log index(' + i + ') in TxHash: ' + txReceipt.transactionHash + '');
          continue;
        }

        // ABI not found
        if (!contractAbi) {
          logger.error("ABI not found for contract: "+contractAddr);
          return;
        }

        relevantLogs.push(txReceipt.logs[i]);
        abiDecoder.addABI(contractAbi);
      }

      if(relevantLogs.length > 0) {
        decodedEvents = abiDecoder.decodeLogs(relevantLogs);
      }

    }

    return this.getFormattedEvents(decodedEvents);
  }
github ipfsconsortium / IPFSConsortiumProxy / src / plugins / peepeth / index.js View on Github external
addWatch(options) {
		options.logger.info('addWatch starting Peepeth %s ( from block %s)', metaData.contract, metaData.startblock);
		const contract = new options.web3.eth.Contract(metaData.abi, metaData.contract);

		abiDecoder.addABI(metaData.abi);

		this.options = options;

		this.highestBlock = 0;
		this.eventCount = 0;
		this.pinCount = 0;
		this.picHashes = [];
		this.defaultTtl = 60 * 60 * 24 * 365 * 10; // 10 years

		contract.events.allEvents({
			fromBlock: metaData.startblock,
		}, (error, result) => {
			if (error == null) {
				options.web3.eth.getTransaction(result.transactionHash).then((transaction) => {
					if (transaction.blockNumber > this.highestBlock) {
						this.highestBlock = transaction.blockNumber;
github OpenST / openst.js / test / integration / WalletOperations.js View on Github external
tokenHolderProxy,
      0,
      logoutExData,
      0,
      0,
      0,
      0,
      config.NULL_ADDRESS,
      config.NULL_ADDRESS,
      ownerSignature.signature,
      txOptions
    );

    const txReceipt = await auxiliaryWeb3.eth.getTransactionReceipt(result.transactionHash);

    abiDecoder.addABI(abiBinProvider.getABI('GnosisSafe'));
    abiDecoder.addABI(abiBinProvider.getABI('TokenHolder'));

    const decodedResult = abiDecoder.decodeLogs(txReceipt.logs);

    const sessionsLoggedOutEvent = JSON.parse(JSON.stringify(decodedResult));

    assert.strictEqual(sessionsLoggedOutEvent[0].name, 'SessionsLoggedOut', 'Incorrect event emitted');
    assert.strictEqual(sessionsLoggedOutEvent[0].events[0].value, '2', 'Incorrect sessionwindow value');
  });
github dharmaprotocol / dharma.js / __test__ / integration / servicing_api / runners / get_repayment_schedule.ts View on Github external
debtOrder = await adaptersApi.simpleInterestLoan.toDebtOrder({
                debtor: DEBTOR,
                creditor: CREDITOR,
                principalAmount: Units.ether(1),
                principalTokenSymbol: "REP",
                interestRate: new BigNumber(0.14),
                amortizationUnit: scenario.amortizationUnit,
                termLength: scenario.termLength,
            });

            debtOrder.debtorSignature = await signerApi.asDebtor(debtOrder);

            issuanceHash = await orderApi.getIssuanceHash(debtOrder);

            ABIDecoder.addABI(repaymentRouter.abi);
        });
github theoephraim / ethdevtools / src / devtools / store.js View on Github external
ADD_CONTRACT: (state, payload) => {
      console.log('ADD_CONTRACT', { payload });
      Vue.set(state.contracts, payload.address.toLowerCase(), payload);
      Vue.set(state.logs, `contract|${payload.address}`, {
        time: +new Date(),
        type: 'contract',
        address: payload.address,
      });
      AbiDecoder.addABI(payload.abi);
    },
  },
github brave / ethereum-remote-client / ui / app / components / pending-tx / index.js View on Github external
const Component = require('react').Component
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const clone = require('clone')
const abi = require('human-standard-token-abi')
const abiDecoder = require('abi-decoder')
abiDecoder.addABI(abi)
const inherits = require('util').inherits
const actions = require('../../actions')
const util = require('../../util')
const ConfirmSendEther = require('./confirm-send-ether')
const ConfirmSendToken = require('./confirm-send-token')
const ConfirmDeployContract = require('./confirm-deploy-contract')
const Loading = require('../loading')

const TX_TYPES = {
  DEPLOY_CONTRACT: 'deploy_contract',
  SEND_ETHER: 'send_ether',
  SEND_TOKEN: 'send_token',
}

module.exports = connect(mapStateToProps, mapDispatchToProps)(PendingTx)

abi-decoder

Nodejs and Javascript library for decoding data params and events from ethereum transactions"

GPL-3.0
Latest version published 4 years ago

Package Health Score

47 / 100
Full package analysis