web3-eth-contract
Advanced tools
Comparing version 1.0.0-beta.43 to 1.0.0-beta.44
@@ -760,3 +760,3 @@ 'use strict'; | ||
_inherits(PastEventLogsMethod, _GetPastLogsMethod); | ||
function PastEventLogsMethod(utils, formatters, eventLogDecoder, abiItemModel) { | ||
function PastEventLogsMethod(utils, formatters, eventLogDecoder, abiItemModel, eventOptionsMapper) { | ||
var _this; | ||
@@ -767,5 +767,12 @@ _classCallCheck(this, PastEventLogsMethod); | ||
_this.eventLogDecoder = eventLogDecoder; | ||
_this.eventOptionsMapper = eventOptionsMapper; | ||
return _this; | ||
} | ||
_createClass(PastEventLogsMethod, [{ | ||
key: "beforeExecution", | ||
value: function beforeExecution(moduleInstance) { | ||
_get(_getPrototypeOf(PastEventLogsMethod.prototype), "beforeExecution", this).call(this, moduleInstance); | ||
this.parameters[0] = this.eventOptionsMapper.map(this.abiItemModel, moduleInstance, this.parameters[0]); | ||
} | ||
}, { | ||
key: "afterExecution", | ||
@@ -786,3 +793,3 @@ value: function afterExecution(response) { | ||
_inherits(AllPastEventLogsMethod, _GetPastLogsMethod); | ||
function AllPastEventLogsMethod(utils, formatters, allEventsLogDecoder, abiModel) { | ||
function AllPastEventLogsMethod(utils, formatters, allEventsLogDecoder, abiModel, allEventsOptionsMapper) { | ||
var _this; | ||
@@ -793,5 +800,12 @@ _classCallCheck(this, AllPastEventLogsMethod); | ||
_this.allEventsLogDecoder = allEventsLogDecoder; | ||
_this.allEventsOptionsMapper = allEventsOptionsMapper; | ||
return _this; | ||
} | ||
_createClass(AllPastEventLogsMethod, [{ | ||
key: "beforeExecution", | ||
value: function beforeExecution(moduleInstance) { | ||
_get(_getPrototypeOf(AllPastEventLogsMethod.prototype), "beforeExecution", this).call(this, moduleInstance); | ||
this.parameters[0] = this.allEventsOptionsMapper.map(this.abiModel, moduleInstance, this.parameters[0]); | ||
} | ||
}, { | ||
key: "afterExecution", | ||
@@ -846,3 +860,3 @@ value: function afterExecution(response) { | ||
value: function createPastEventLogsMethod(abiItem) { | ||
return new PastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createEventLogDecoder(), abiItem); | ||
return new PastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createEventLogDecoder(), abiItem, this.contractModuleFactory.createEventOptionsMapper()); | ||
} | ||
@@ -852,3 +866,3 @@ }, { | ||
value: function createAllPastEventLogsMethod(abiModel) { | ||
return new AllPastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createAllEventsLogDecoder(), abiModel); | ||
return new AllPastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createAllEventsLogDecoder(), abiModel, this.contractModuleFactory.createAllEventsOptionsMapper()); | ||
} | ||
@@ -983,41 +997,44 @@ }, { | ||
key: "getPastEvents", | ||
value: function getPastEvents(eventName, options, callback) { | ||
var _this2 = this; | ||
return new Promise( | ||
function () { | ||
var _ref = _asyncToGenerator( | ||
_regeneratorRuntime.mark(function _callee(resolve, reject) { | ||
var method; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (eventName !== 'allEvents') { | ||
if (!_this2.abiModel.hasEvent(eventName)) { | ||
reject(new Error("Event with name \"".concat(eventName, "\" does not exists."))); | ||
} | ||
method = _this2.methodFactory.createPastEventLogsMethod(_this2.abiModel.getEvent(eventName)); | ||
} else { | ||
method = _this2.methodFactory.createAllPastEventLogsMethod(_this2.abiModel); | ||
} | ||
method.parameters = [options]; | ||
method.callback = callback; | ||
_context.t0 = resolve; | ||
value: function () { | ||
var _getPastEvents = _asyncToGenerator( | ||
_regeneratorRuntime.mark(function _callee(eventName, options, callback) { | ||
var method, response; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (!(eventName !== 'allEvents')) { | ||
_context.next = 6; | ||
return method.execute(_this2); | ||
case 6: | ||
_context.t1 = _context.sent; | ||
return _context.abrupt("return", (0, _context.t0)(_context.t1)); | ||
case 8: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
break; | ||
} | ||
if (this.abiModel.hasEvent(eventName)) { | ||
_context.next = 3; | ||
break; | ||
} | ||
throw new Error("Event with name \"".concat(eventName, "\" does not exists.")); | ||
case 3: | ||
method = this.methodFactory.createPastEventLogsMethod(this.abiModel.getEvent(eventName)); | ||
_context.next = 7; | ||
break; | ||
case 6: | ||
method = this.methodFactory.createAllPastEventLogsMethod(this.abiModel); | ||
case 7: | ||
method.parameters = [options]; | ||
method.callback = callback; | ||
_context.next = 11; | ||
return method.execute(this); | ||
case 11: | ||
response = _context.sent; | ||
return _context.abrupt("return", response); | ||
case 13: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, this); | ||
})); | ||
return function (_x, _x2) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}()); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
return function getPastEvents(_x, _x2, _x3) { | ||
return _getPastEvents.apply(this, arguments); | ||
}; | ||
}() | ||
}, { | ||
@@ -1024,0 +1041,0 @@ key: "deploy", |
@@ -580,7 +580,12 @@ import * as Utils from 'web3-utils'; | ||
class PastEventLogsMethod extends GetPastLogsMethod { | ||
constructor(utils, formatters$$1, eventLogDecoder, abiItemModel) { | ||
constructor(utils, formatters$$1, eventLogDecoder, abiItemModel, eventOptionsMapper) { | ||
super(utils, formatters$$1); | ||
this.abiItemModel = abiItemModel; | ||
this.eventLogDecoder = eventLogDecoder; | ||
this.eventOptionsMapper = eventOptionsMapper; | ||
} | ||
beforeExecution(moduleInstance) { | ||
super.beforeExecution(moduleInstance); | ||
this.parameters[0] = this.eventOptionsMapper.map(this.abiItemModel, moduleInstance, this.parameters[0]); | ||
} | ||
afterExecution(response) { | ||
@@ -595,7 +600,12 @@ const formattedLogs = super.afterExecution(response); | ||
class AllPastEventLogsMethod extends GetPastLogsMethod { | ||
constructor(utils, formatters$$1, allEventsLogDecoder, abiModel) { | ||
constructor(utils, formatters$$1, allEventsLogDecoder, abiModel, allEventsOptionsMapper) { | ||
super(utils, formatters$$1); | ||
this.abiModel = abiModel; | ||
this.allEventsLogDecoder = allEventsLogDecoder; | ||
this.allEventsOptionsMapper = allEventsOptionsMapper; | ||
} | ||
beforeExecution(moduleInstance) { | ||
super.beforeExecution(moduleInstance); | ||
this.parameters[0] = this.allEventsOptionsMapper.map(this.abiModel, moduleInstance, this.parameters[0]); | ||
} | ||
afterExecution(response) { | ||
@@ -640,6 +650,6 @@ const formattedLogs = super.afterExecution(response); | ||
createPastEventLogsMethod(abiItem) { | ||
return new PastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createEventLogDecoder(), abiItem); | ||
return new PastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createEventLogDecoder(), abiItem, this.contractModuleFactory.createEventOptionsMapper()); | ||
} | ||
createAllPastEventLogsMethod(abiModel) { | ||
return new AllPastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createAllEventsLogDecoder(), abiModel); | ||
return new AllPastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createAllEventsLogDecoder(), abiModel, this.contractModuleFactory.createAllEventsOptionsMapper()); | ||
} | ||
@@ -740,17 +750,16 @@ createCallContractMethod(abiItem) { | ||
} | ||
getPastEvents(eventName, options, callback) { | ||
return new Promise(async (resolve, reject) => { | ||
let method; | ||
if (eventName !== 'allEvents') { | ||
if (!this.abiModel.hasEvent(eventName)) { | ||
reject(new Error(`Event with name "${eventName}" does not exists.`)); | ||
} | ||
method = this.methodFactory.createPastEventLogsMethod(this.abiModel.getEvent(eventName)); | ||
} else { | ||
method = this.methodFactory.createAllPastEventLogsMethod(this.abiModel); | ||
async getPastEvents(eventName, options, callback) { | ||
let method; | ||
if (eventName !== 'allEvents') { | ||
if (!this.abiModel.hasEvent(eventName)) { | ||
throw new Error(`Event with name "${eventName}" does not exists.`); | ||
} | ||
method.parameters = [options]; | ||
method.callback = callback; | ||
return resolve((await method.execute(this))); | ||
}); | ||
method = this.methodFactory.createPastEventLogsMethod(this.abiModel.getEvent(eventName)); | ||
} else { | ||
method = this.methodFactory.createAllPastEventLogsMethod(this.abiModel); | ||
} | ||
method.parameters = [options]; | ||
method.callback = callback; | ||
const response = await method.execute(this); | ||
return response; | ||
} | ||
@@ -757,0 +766,0 @@ deploy(options) { |
@@ -752,3 +752,3 @@ (function (global, factory) { | ||
_inherits(PastEventLogsMethod, _GetPastLogsMethod); | ||
function PastEventLogsMethod(utils, formatters, eventLogDecoder, abiItemModel) { | ||
function PastEventLogsMethod(utils, formatters, eventLogDecoder, abiItemModel, eventOptionsMapper) { | ||
var _this; | ||
@@ -759,5 +759,12 @@ _classCallCheck(this, PastEventLogsMethod); | ||
_this.eventLogDecoder = eventLogDecoder; | ||
_this.eventOptionsMapper = eventOptionsMapper; | ||
return _this; | ||
} | ||
_createClass(PastEventLogsMethod, [{ | ||
key: "beforeExecution", | ||
value: function beforeExecution(moduleInstance) { | ||
_get(_getPrototypeOf(PastEventLogsMethod.prototype), "beforeExecution", this).call(this, moduleInstance); | ||
this.parameters[0] = this.eventOptionsMapper.map(this.abiItemModel, moduleInstance, this.parameters[0]); | ||
} | ||
}, { | ||
key: "afterExecution", | ||
@@ -778,3 +785,3 @@ value: function afterExecution(response) { | ||
_inherits(AllPastEventLogsMethod, _GetPastLogsMethod); | ||
function AllPastEventLogsMethod(utils, formatters, allEventsLogDecoder, abiModel) { | ||
function AllPastEventLogsMethod(utils, formatters, allEventsLogDecoder, abiModel, allEventsOptionsMapper) { | ||
var _this; | ||
@@ -785,5 +792,12 @@ _classCallCheck(this, AllPastEventLogsMethod); | ||
_this.allEventsLogDecoder = allEventsLogDecoder; | ||
_this.allEventsOptionsMapper = allEventsOptionsMapper; | ||
return _this; | ||
} | ||
_createClass(AllPastEventLogsMethod, [{ | ||
key: "beforeExecution", | ||
value: function beforeExecution(moduleInstance) { | ||
_get(_getPrototypeOf(AllPastEventLogsMethod.prototype), "beforeExecution", this).call(this, moduleInstance); | ||
this.parameters[0] = this.allEventsOptionsMapper.map(this.abiModel, moduleInstance, this.parameters[0]); | ||
} | ||
}, { | ||
key: "afterExecution", | ||
@@ -838,3 +852,3 @@ value: function afterExecution(response) { | ||
value: function createPastEventLogsMethod(abiItem) { | ||
return new PastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createEventLogDecoder(), abiItem); | ||
return new PastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createEventLogDecoder(), abiItem, this.contractModuleFactory.createEventOptionsMapper()); | ||
} | ||
@@ -844,3 +858,3 @@ }, { | ||
value: function createAllPastEventLogsMethod(abiModel) { | ||
return new AllPastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createAllEventsLogDecoder(), abiModel); | ||
return new AllPastEventLogsMethod(this.utils, this.formatters, this.contractModuleFactory.createAllEventsLogDecoder(), abiModel, this.contractModuleFactory.createAllEventsOptionsMapper()); | ||
} | ||
@@ -975,41 +989,44 @@ }, { | ||
key: "getPastEvents", | ||
value: function getPastEvents(eventName, options, callback) { | ||
var _this2 = this; | ||
return new Promise( | ||
function () { | ||
var _ref = _asyncToGenerator( | ||
_regeneratorRuntime.mark(function _callee(resolve, reject) { | ||
var method; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (eventName !== 'allEvents') { | ||
if (!_this2.abiModel.hasEvent(eventName)) { | ||
reject(new Error("Event with name \"".concat(eventName, "\" does not exists."))); | ||
} | ||
method = _this2.methodFactory.createPastEventLogsMethod(_this2.abiModel.getEvent(eventName)); | ||
} else { | ||
method = _this2.methodFactory.createAllPastEventLogsMethod(_this2.abiModel); | ||
} | ||
method.parameters = [options]; | ||
method.callback = callback; | ||
_context.t0 = resolve; | ||
value: function () { | ||
var _getPastEvents = _asyncToGenerator( | ||
_regeneratorRuntime.mark(function _callee(eventName, options, callback) { | ||
var method, response; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (!(eventName !== 'allEvents')) { | ||
_context.next = 6; | ||
return method.execute(_this2); | ||
case 6: | ||
_context.t1 = _context.sent; | ||
return _context.abrupt("return", (0, _context.t0)(_context.t1)); | ||
case 8: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
break; | ||
} | ||
if (this.abiModel.hasEvent(eventName)) { | ||
_context.next = 3; | ||
break; | ||
} | ||
throw new Error("Event with name \"".concat(eventName, "\" does not exists.")); | ||
case 3: | ||
method = this.methodFactory.createPastEventLogsMethod(this.abiModel.getEvent(eventName)); | ||
_context.next = 7; | ||
break; | ||
case 6: | ||
method = this.methodFactory.createAllPastEventLogsMethod(this.abiModel); | ||
case 7: | ||
method.parameters = [options]; | ||
method.callback = callback; | ||
_context.next = 11; | ||
return method.execute(this); | ||
case 11: | ||
response = _context.sent; | ||
return _context.abrupt("return", response); | ||
case 13: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, this); | ||
})); | ||
return function (_x, _x2) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}()); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
return function getPastEvents(_x, _x2, _x3) { | ||
return _getPastEvents.apply(this, arguments); | ||
}; | ||
}() | ||
}, { | ||
@@ -1016,0 +1033,0 @@ key: "deploy", |
{ | ||
"name": "web3-eth-contract", | ||
"namespace": "ethereum", | ||
"version": "1.0.0-beta.43", | ||
"version": "1.0.0-beta.44", | ||
"description": "Web3 module to interact with Ethereum smart contracts.", | ||
@@ -21,11 +21,11 @@ "repository": "https://github.com/ethereum/web3.js/tree/1.0/packages/web3-eth-contract", | ||
"lodash": "^4.17.11", | ||
"web3-core": "1.0.0-beta.43", | ||
"web3-core-helpers": "1.0.0-beta.43", | ||
"web3-core-method": "1.0.0-beta.43", | ||
"web3-core-promievent": "1.0.0-beta.43", | ||
"web3-core-subscriptions": "1.0.0-beta.43", | ||
"web3-eth-abi": "1.0.0-beta.43", | ||
"web3-eth-accounts": "1.0.0-beta.43", | ||
"web3-providers": "1.0.0-beta.43", | ||
"web3-utils": "1.0.0-beta.43" | ||
"web3-core": "1.0.0-beta.44", | ||
"web3-core-helpers": "1.0.0-beta.44", | ||
"web3-core-method": "1.0.0-beta.44", | ||
"web3-core-promievent": "1.0.0-beta.44", | ||
"web3-core-subscriptions": "1.0.0-beta.44", | ||
"web3-eth-abi": "1.0.0-beta.44", | ||
"web3-eth-accounts": "1.0.0-beta.44", | ||
"web3-providers": "1.0.0-beta.44", | ||
"web3-utils": "1.0.0-beta.44" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
258972
3210
+ Addedweb3-core@1.0.0-beta.44(transitive)
+ Addedweb3-core-helpers@1.0.0-beta.44(transitive)
+ Addedweb3-core-method@1.0.0-beta.44(transitive)
+ Addedweb3-core-promievent@1.0.0-beta.44(transitive)
+ Addedweb3-core-subscriptions@1.0.0-beta.44(transitive)
+ Addedweb3-eth-abi@1.0.0-beta.44(transitive)
+ Addedweb3-eth-accounts@1.0.0-beta.44(transitive)
+ Addedweb3-eth-iban@1.0.0-beta.44(transitive)
+ Addedweb3-providers@1.0.0-beta.44(transitive)
+ Addedweb3-utils@1.0.0-beta.44(transitive)
- Removedweb3-core@1.0.0-beta.43(transitive)
- Removedweb3-core-helpers@1.0.0-beta.43(transitive)
- Removedweb3-core-method@1.0.0-beta.43(transitive)
- Removedweb3-core-promievent@1.0.0-beta.43(transitive)
- Removedweb3-core-subscriptions@1.0.0-beta.43(transitive)
- Removedweb3-eth-abi@1.0.0-beta.43(transitive)
- Removedweb3-eth-accounts@1.0.0-beta.43(transitive)
- Removedweb3-eth-iban@1.0.0-beta.43(transitive)
- Removedweb3-providers@1.0.0-beta.43(transitive)
- Removedweb3-utils@1.0.0-beta.43(transitive)
Updatedweb3-core@1.0.0-beta.44
Updatedweb3-eth-abi@1.0.0-beta.44
Updatedweb3-providers@1.0.0-beta.44
Updatedweb3-utils@1.0.0-beta.44