How to use the web3-core-helpers.formatters.inputLogFormatter function in web3-core-helpers

To help you get started, we’ve selected a few web3-core-helpers 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 citahub / cita-sdk-js / packages / cita-sdk / src / contract / index.ts View on Github external
// prevent the event "newListener" and "removeListener" from being overwritten
  this._checkListener('newListener', subOptions.event.name, subOptions.callback)
  this._checkListener(
    'removeListener',
    subOptions.event.name,
    subOptions.callback
  )

  // TODO check if listener already exists? and reuse subscription if options are the same.

  // create new subscription
  var subscription = new Subscription({
    subscription: {
      params: 1,
      inputFormatter: [formatters.inputLogFormatter],
      outputFormatter: this._decodeEventABI.bind(subOptions.event),
      // DUBLICATE, also in web3-eth
      subscriptionHandler: function(output: any) {
        if (output.removed) {
          ctx.emit('changed', output)
        } else {
          ctx.emit('data', output)
        }

        if (_.isFunction(ctx.callback)) {
          ctx.callback(null, output, this)
        }
      }
    },
    type: 'eth',
    requestManager: this._requestManager
github citahub / cita-sdk-js / packages / cita-sdk / lib / contract / index.js View on Github external
Contract.prototype.getPastEvents = function () {
    const subOptions = this._generateEventOptions.apply(this, arguments);
    let getPastLogs = new Method({
        name: 'getPastLogs',
        call: 'getLogs',
        params: 1,
        inputFormatter: [formatters.inputLogFormatter],
        outputFormatter: this._decodeEventABI.bind(subOptions.event)
    });
    getPastLogs.setRequestManager(this._requestManager);
    const call = getPastLogs.buildCall();
    getPastLogs = null;
    return call(subOptions.params, subOptions.callback);
};
exports.default = Contract;
github ethereum / web3.js / packages / web3-eth-contract / src / index.js View on Github external
Contract.prototype.getPastEvents = function(){
    var subOptions = this._generateEventOptions.apply(this, arguments);

    var getPastLogs = new Method({
        name: 'getPastLogs',
        call: 'eth_getLogs',
        params: 1,
        inputFormatter: [formatters.inputLogFormatter],
        outputFormatter: this._decodeEventABI.bind(subOptions.event)
    });
    getPastLogs.setRequestManager(this._requestManager);
    var call = getPastLogs.buildCall();

    getPastLogs = null;

    return call(subOptions.params, subOptions.callback);
};