@colony/colony-js-contract-client
Advanced tools
Comparing version 1.12.0 to 1.13.0-beta.0
@@ -39,2 +39,6 @@ 'use strict'; | ||
var _lodash = require('lodash.flatmap'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _ContractEvent = require('./ContractEvent'); | ||
@@ -62,2 +66,4 @@ | ||
/* eslint-disable import/no-cycle */ | ||
var ContractClient = function () { | ||
@@ -301,2 +307,15 @@ (0, _createClass3.default)(ContractClient, null, [{ | ||
* Get logs from the contract with filter. | ||
* | ||
* The filter `topics` is an array, where each element is a string, array of | ||
* strings, or null. In each position, these represent a filter which matches | ||
* events including that single topic, one of any of the array of topics, or | ||
* any topic in that position respectively. | ||
* | ||
* - String: match only this topic in this position | ||
* - Array: match any of these topics in this position | ||
* - Null: match any topic in this position | ||
* | ||
* The returned logs will match these filters in each position. Trailing null | ||
* values will require a topic in that position (e.g. [null, null] will only | ||
* match logs with at least two topics). | ||
*/ | ||
@@ -322,6 +341,6 @@ | ||
extraTopics = eventNames.reduce(function (acc, eventName) { | ||
extraTopics = (0, _lodash2.default)(eventNames, function (eventName) { | ||
if (!_this.events[eventName]) throw new Error('Cannot get logs for unknown event'); | ||
return [].concat((0, _toConsumableArray3.default)(acc), (0, _toConsumableArray3.default)(_this.events[eventName].interface.topics)); | ||
}, []); | ||
return _this.events[eventName].interface.topics; | ||
}); | ||
@@ -335,3 +354,3 @@ // Combine any existing topics with the extra ones | ||
} else { | ||
topics[0] = [].concat((0, _toConsumableArray3.default)(topics[0]), (0, _toConsumableArray3.default)(extraTopics)); | ||
topics[0] = [topics[0]].concat((0, _toConsumableArray3.default)(extraTopics)); | ||
} | ||
@@ -463,11 +482,17 @@ | ||
var event = new _ContractEvent2.default({ | ||
eventName: eventName, | ||
client: this, | ||
argsDef: argsDef | ||
}); | ||
// Allow initialising of clients where some events may be missing in the | ||
// ABI, due to changing of events on the contract. | ||
try { | ||
var event = new _ContractEvent2.default({ | ||
eventName: eventName, | ||
client: this, | ||
argsDef: argsDef | ||
}); | ||
Object.assign(this.events, (0, _defineProperty3.default)({}, eventName, event)); | ||
Object.assign(this.events, (0, _defineProperty3.default)({}, eventName, event)); | ||
Object.assign(this.eventSignatures, (0, _defineProperty3.default)({}, event.interface.topics[0], event)); | ||
Object.assign(this.eventSignatures, (0, _defineProperty3.default)({}, event.interface.topics[0], event)); | ||
} catch (error) { | ||
console.info(error); | ||
} | ||
} | ||
@@ -489,5 +514,4 @@ }, { | ||
}(); | ||
/* eslint-disable import/no-cycle */ | ||
exports.default = ContractClient; | ||
//# sourceMappingURL=ContractClient.js.map |
{ | ||
"name": "@colony/colony-js-contract-client", | ||
"version": "1.12.0", | ||
"version": "1.13.0-beta.0", | ||
"description": "Method-like interface for Smart Contracts", | ||
@@ -61,2 +61,3 @@ "keywords": [ | ||
"bs58": "^4.0.1", | ||
"lodash.flatmap": "^4.5.0", | ||
"lodash.isequal": "^4.5.0", | ||
@@ -75,3 +76,3 @@ "lodash.isplainobject": "^4.0.6", | ||
}, | ||
"gitHead": "3e2fd620a0daed21a7c00ff072289efaeeb3edc8" | ||
"gitHead": "0306787ae2225f6fa49d0847f4493270a5d8455c" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1312382
7605
11
1
+ Addedlodash.flatmap@^4.5.0
+ Addedlodash.flatmap@4.5.0(transitive)