Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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
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;
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);
};