Updated dist files.

This commit is contained in:
Richard Moore 2020-04-16 21:59:53 -04:00
parent 798cafa6fe
commit 2f30410ddd
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
37 changed files with 351 additions and 193 deletions

@ -3,6 +3,12 @@ Changelog
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
ethers/v5.0.0-beta.182 (2020-04-16 21:53)
-----------------------------------------
- Added support for Contract event parsing error recovery. ([cc72f76](https://github.com/ethers-io/ethers.js/commit/cc72f76695572d235d7f5a5ad4dc1838a5fe884a))
- Fix provider log filters with zero topics. ([#785](https://github.com/ethers-io/ethers.js/issues/785); [4ef0e4f](https://github.com/ethers-io/ethers.js/commit/4ef0e4f7653226bf8cca86e065ad614e7288af96))
ethers/v5.0.0-beta.181 (2020-04-15 18:23)
-----------------------------------------

@ -1 +1 @@
export declare const version = "asm/5.0.0-beta.157";
export declare const version = "asm/5.0.0-beta.158";

@ -1 +1 @@
export const version = "asm/5.0.0-beta.157";
export const version = "asm/5.0.0-beta.158";

@ -1 +1 @@
export declare const version = "asm/5.0.0-beta.157";
export declare const version = "asm/5.0.0-beta.158";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "asm/5.0.0-beta.157";
exports.version = "asm/5.0.0-beta.158";

@ -29,7 +29,7 @@
"generate": "node ./generate.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xc32734413bbb1f14895c26ed325257354c8bc27312b70ecf81426ed4086da18b",
"tarballHash": "0x9abc89b9aa04b781f4a5864c033d6ce1677175f0c28a09ecb7c73012d377e2a7",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.157"
"version": "5.0.0-beta.158"
}

@ -1 +1 @@
export const version = "asm/5.0.0-beta.157";
export const version = "asm/5.0.0-beta.158";

@ -1 +1 @@
export declare const version = "contracts/5.0.0-beta.147";
export declare const version = "contracts/5.0.0-beta.148";

@ -1 +1 @@
export const version = "contracts/5.0.0-beta.147";
export const version = "contracts/5.0.0-beta.148";

@ -25,6 +25,7 @@ export interface Event extends Log {
event?: string;
eventSignature?: string;
args?: Result;
decodeError?: Error;
decode?: (data: string, topics?: Array<string>) => any;
removeListener: () => void;
getBlock: () => Promise<Block>;
@ -52,6 +53,7 @@ declare class RunningEvent {
listenerCount(): number;
run(args: Array<any>): number;
prepareEvent(event: Event): void;
getEmit(event: Event): Array<any>;
}
export declare type ContractInterface = string | Array<Fragment | JsonFragment | string> | Interface;
export declare class Contract {
@ -85,7 +87,7 @@ export declare class Contract {
private _normalizeRunningEvent;
private _getRunningEvent;
_checkRunningEvents(runningEvent: RunningEvent): void;
private _wrapEvent;
_wrapEvent(runningEvent: RunningEvent, log: Log, listener: Listener): Event;
private _addEventListener;
queryFilter(event: EventFilter, fromBlockOrBlockhash?: BlockTag | string, toBlock?: BlockTag): Promise<Array<Event>>;
on(event: EventFilter | string, listener: Listener): this;

@ -223,12 +223,21 @@ class RunningEvent {
}
prepareEvent(event) {
}
// Returns the array that will be applied to an emit
getEmit(event) {
return [event];
}
}
class ErrorRunningEvent extends RunningEvent {
constructor() {
super("error", null);
}
}
// @TODO Fragment should inherit Wildcard? and just override getEmit?
// or have a common abstract super class, with enough constructor
// options to configure both.
// A Fragment Event will populate all the properties that Wildcard
// will, and additioanlly dereference the arguments when emitting
class FragmentRunningEvent extends RunningEvent {
constructor(address, contractInterface, fragment, topics) {
const filter = {
@ -256,9 +265,26 @@ class FragmentRunningEvent extends RunningEvent {
event.decode = (data, topics) => {
return this.interface.decodeEventLog(this.fragment, data, topics);
};
try {
event.args = this.interface.decodeEventLog(this.fragment, event.data, event.topics);
}
catch (error) {
event.args = null;
event.decodeError = error;
throw error;
}
}
getEmit(event) {
const args = (event.args || []).slice();
args.push(event);
return args;
}
}
// A Wildard Event will attempt to populate:
// - event The name of the event name
// - eventSignature The full signature of the event
// - decode A function to decode data and topics
// - args The decoded data and topics
class WildcardRunningEvent extends RunningEvent {
constructor(address, contractInterface) {
super("*", { address: address });
@ -267,8 +293,8 @@ class WildcardRunningEvent extends RunningEvent {
}
prepareEvent(event) {
super.prepareEvent(event);
try {
const parsed = this.interface.parseLog(event);
if (parsed) {
event.event = parsed.name;
event.eventSignature = parsed.signature;
event.decode = (data, topics) => {
@ -276,6 +302,9 @@ class WildcardRunningEvent extends RunningEvent {
};
event.args = parsed.args;
}
catch (error) {
// No matching event
}
}
}
export class Contract {
@ -482,28 +511,27 @@ export class Contract {
if (eventName === "*") {
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
}
// Get the event Fragment (throws if ambiguous/unknown event)
const fragment = this.interface.getEvent(eventName);
if (!fragment) {
logger.throwArgumentError("unknown event - " + eventName, "eventName", eventName);
}
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment));
}
const filter = {
address: this.address
};
// Find the matching event in the ABI; if none, we still allow filtering
// since it may be a filter for an otherwise unknown event
if (eventName.topics) {
if (eventName.topics[0]) {
// We have topics to filter by...
if (eventName.topics && eventName.topics.length > 0) {
// Is it a known topichash? (throws if no matching topichash)
try {
const fragment = this.interface.getEvent(eventName.topics[0]);
if (fragment) {
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics));
}
}
filter.topics = eventName.topics;
}
catch (error) { }
// Filter by the unknown topichash
const filter = {
address: this.address,
topics: eventName.topics
};
return this._normalizeRunningEvent(new RunningEvent(getEventTag(filter), filter));
}
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
}
_checkRunningEvents(runningEvent) {
if (runningEvent.listenerCount() === 0) {
delete this._runningEvents[runningEvent.tag];
@ -515,15 +543,10 @@ export class Contract {
}
}
}
// Subclasses can override this to gracefully recover
// from parse errors if they wish
_wrapEvent(runningEvent, log, listener) {
const event = deepCopy(log);
try {
runningEvent.prepareEvent(event);
}
catch (error) {
this.emit("error", error);
throw error;
}
event.removeListener = () => {
if (!listener) {
return;
@ -534,6 +557,8 @@ export class Contract {
event.getBlock = () => { return this.provider.getBlock(log.blockHash); };
event.getTransaction = () => { return this.provider.getTransaction(log.transactionHash); };
event.getTransactionReceipt = () => { return this.provider.getTransactionReceipt(log.transactionHash); };
// This may throw if the topics and data mismatch the signature
runningEvent.prepareEvent(event);
return event;
}
_addEventListener(runningEvent, listener, once) {
@ -543,12 +568,19 @@ export class Contract {
runningEvent.addListener(listener, once);
// Track this running event and its listeners (may already be there; but no hard in updating)
this._runningEvents[runningEvent.tag] = runningEvent;
// If we are not polling the provider, start
// If we are not polling the provider, start polling
if (!this._wrappedEmits[runningEvent.tag]) {
const wrappedEmit = (log) => {
const event = this._wrapEvent(runningEvent, log, listener);
const args = (event.args || []).slice();
args.push(event);
let event = null;
try {
event = this._wrapEvent(runningEvent, log, listener);
}
catch (error) {
// There was an error decoding the data and topics
this.emit("error", error, event);
return;
}
const args = runningEvent.getEmit(event);
this.emit(runningEvent.filter, ...args);
};
this._wrappedEmits[runningEvent.tag] = wrappedEmit;

@ -1 +1 @@
export declare const version = "contracts/5.0.0-beta.147";
export declare const version = "contracts/5.0.0-beta.148";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "contracts/5.0.0-beta.147";
exports.version = "contracts/5.0.0-beta.148";

@ -25,6 +25,7 @@ export interface Event extends Log {
event?: string;
eventSignature?: string;
args?: Result;
decodeError?: Error;
decode?: (data: string, topics?: Array<string>) => any;
removeListener: () => void;
getBlock: () => Promise<Block>;
@ -52,6 +53,7 @@ declare class RunningEvent {
listenerCount(): number;
run(args: Array<any>): number;
prepareEvent(event: Event): void;
getEmit(event: Event): Array<any>;
}
export declare type ContractInterface = string | Array<Fragment | JsonFragment | string> | Interface;
export declare class Contract {
@ -85,7 +87,7 @@ export declare class Contract {
private _normalizeRunningEvent;
private _getRunningEvent;
_checkRunningEvents(runningEvent: RunningEvent): void;
private _wrapEvent;
_wrapEvent(runningEvent: RunningEvent, log: Log, listener: Listener): Event;
private _addEventListener;
queryFilter(event: EventFilter, fromBlockOrBlockhash?: BlockTag | string, toBlock?: BlockTag): Promise<Array<Event>>;
on(event: EventFilter | string, listener: Listener): this;

@ -250,6 +250,10 @@ var RunningEvent = /** @class */ (function () {
};
RunningEvent.prototype.prepareEvent = function (event) {
};
// Returns the array that will be applied to an emit
RunningEvent.prototype.getEmit = function (event) {
return [event];
};
return RunningEvent;
}());
var ErrorRunningEvent = /** @class */ (function (_super) {
@ -259,6 +263,11 @@ var ErrorRunningEvent = /** @class */ (function (_super) {
}
return ErrorRunningEvent;
}(RunningEvent));
// @TODO Fragment should inherit Wildcard? and just override getEmit?
// or have a common abstract super class, with enough constructor
// options to configure both.
// A Fragment Event will populate all the properties that Wildcard
// will, and additioanlly dereference the arguments when emitting
var FragmentRunningEvent = /** @class */ (function (_super) {
__extends(FragmentRunningEvent, _super);
function FragmentRunningEvent(address, contractInterface, fragment, topics) {
@ -290,10 +299,27 @@ var FragmentRunningEvent = /** @class */ (function (_super) {
event.decode = function (data, topics) {
return _this.interface.decodeEventLog(_this.fragment, data, topics);
};
try {
event.args = this.interface.decodeEventLog(this.fragment, event.data, event.topics);
}
catch (error) {
event.args = null;
event.decodeError = error;
throw error;
}
};
FragmentRunningEvent.prototype.getEmit = function (event) {
var args = (event.args || []).slice();
args.push(event);
return args;
};
return FragmentRunningEvent;
}(RunningEvent));
// A Wildard Event will attempt to populate:
// - event The name of the event name
// - eventSignature The full signature of the event
// - decode A function to decode data and topics
// - args The decoded data and topics
var WildcardRunningEvent = /** @class */ (function (_super) {
__extends(WildcardRunningEvent, _super);
function WildcardRunningEvent(address, contractInterface) {
@ -305,14 +331,17 @@ var WildcardRunningEvent = /** @class */ (function (_super) {
WildcardRunningEvent.prototype.prepareEvent = function (event) {
var _this = this;
_super.prototype.prepareEvent.call(this, event);
var parsed = this.interface.parseLog(event);
if (parsed) {
event.event = parsed.name;
event.eventSignature = parsed.signature;
try {
var parsed_1 = this.interface.parseLog(event);
event.event = parsed_1.name;
event.eventSignature = parsed_1.signature;
event.decode = function (data, topics) {
return _this.interface.decodeEventLog(parsed.eventFragment, data, topics);
return _this.interface.decodeEventLog(parsed_1.eventFragment, data, topics);
};
event.args = parsed.args;
event.args = parsed_1.args;
}
catch (error) {
// No matching event
}
};
return WildcardRunningEvent;
@ -529,27 +558,26 @@ var Contract = /** @class */ (function () {
if (eventName === "*") {
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
}
// Get the event Fragment (throws if ambiguous/unknown event)
var fragment = this.interface.getEvent(eventName);
if (!fragment) {
logger.throwArgumentError("unknown event - " + eventName, "eventName", eventName);
}
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment));
}
var filter = {
address: this.address
};
// Find the matching event in the ABI; if none, we still allow filtering
// since it may be a filter for an otherwise unknown event
if (eventName.topics) {
if (eventName.topics[0]) {
// We have topics to filter by...
if (eventName.topics && eventName.topics.length > 0) {
// Is it a known topichash? (throws if no matching topichash)
try {
var fragment = this.interface.getEvent(eventName.topics[0]);
if (fragment) {
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics));
}
}
filter.topics = eventName.topics;
}
catch (error) { }
// Filter by the unknown topichash
var filter = {
address: this.address,
topics: eventName.topics
};
return this._normalizeRunningEvent(new RunningEvent(getEventTag(filter), filter));
}
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
};
Contract.prototype._checkRunningEvents = function (runningEvent) {
if (runningEvent.listenerCount() === 0) {
@ -562,16 +590,11 @@ var Contract = /** @class */ (function () {
}
}
};
// Subclasses can override this to gracefully recover
// from parse errors if they wish
Contract.prototype._wrapEvent = function (runningEvent, log, listener) {
var _this = this;
var event = properties_1.deepCopy(log);
try {
runningEvent.prepareEvent(event);
}
catch (error) {
this.emit("error", error);
throw error;
}
event.removeListener = function () {
if (!listener) {
return;
@ -582,6 +605,8 @@ var Contract = /** @class */ (function () {
event.getBlock = function () { return _this.provider.getBlock(log.blockHash); };
event.getTransaction = function () { return _this.provider.getTransaction(log.transactionHash); };
event.getTransactionReceipt = function () { return _this.provider.getTransactionReceipt(log.transactionHash); };
// This may throw if the topics and data mismatch the signature
runningEvent.prepareEvent(event);
return event;
};
Contract.prototype._addEventListener = function (runningEvent, listener, once) {
@ -592,12 +617,19 @@ var Contract = /** @class */ (function () {
runningEvent.addListener(listener, once);
// Track this running event and its listeners (may already be there; but no hard in updating)
this._runningEvents[runningEvent.tag] = runningEvent;
// If we are not polling the provider, start
// If we are not polling the provider, start polling
if (!this._wrappedEmits[runningEvent.tag]) {
var wrappedEmit = function (log) {
var event = _this._wrapEvent(runningEvent, log, listener);
var args = (event.args || []).slice();
args.push(event);
var event = null;
try {
event = _this._wrapEvent(runningEvent, log, listener);
}
catch (error) {
// There was an error decoding the data and topics
_this.emit("error", error, event);
return;
}
var args = runningEvent.getEmit(event);
_this.emit.apply(_this, __spreadArrays([runningEvent.filter], args));
};
this._wrappedEmits[runningEvent.tag] = wrappedEmit;

@ -32,7 +32,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xf9eed94c2691cdfba2ad5388d60b3c10740a130b29ff74ac141e5b5043d79f87",
"tarballHash": "0x4ff43d361fce2dcebd688d0f068197f8c95444c5a790620dd453119436c5db15",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.147"
"version": "5.0.0-beta.148"
}

@ -1 +1 @@
export const version = "contracts/5.0.0-beta.147";
export const version = "contracts/5.0.0-beta.148";

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -7987,7 +7987,7 @@ class VoidSigner extends Signer {
}
}
const version$b = "contracts/5.0.0-beta.147";
const version$b = "contracts/5.0.0-beta.148";
"use strict";
const logger$f = new Logger(version$b);
@ -8204,12 +8204,21 @@ class RunningEvent {
}
prepareEvent(event) {
}
// Returns the array that will be applied to an emit
getEmit(event) {
return [event];
}
}
class ErrorRunningEvent extends RunningEvent {
constructor() {
super("error", null);
}
}
// @TODO Fragment should inherit Wildcard? and just override getEmit?
// or have a common abstract super class, with enough constructor
// options to configure both.
// A Fragment Event will populate all the properties that Wildcard
// will, and additioanlly dereference the arguments when emitting
class FragmentRunningEvent extends RunningEvent {
constructor(address, contractInterface, fragment, topics) {
const filter = {
@ -8237,9 +8246,26 @@ class FragmentRunningEvent extends RunningEvent {
event.decode = (data, topics) => {
return this.interface.decodeEventLog(this.fragment, data, topics);
};
try {
event.args = this.interface.decodeEventLog(this.fragment, event.data, event.topics);
}
catch (error) {
event.args = null;
event.decodeError = error;
throw error;
}
}
getEmit(event) {
const args = (event.args || []).slice();
args.push(event);
return args;
}
}
// A Wildard Event will attempt to populate:
// - event The name of the event name
// - eventSignature The full signature of the event
// - decode A function to decode data and topics
// - args The decoded data and topics
class WildcardRunningEvent extends RunningEvent {
constructor(address, contractInterface) {
super("*", { address: address });
@ -8248,8 +8274,8 @@ class WildcardRunningEvent extends RunningEvent {
}
prepareEvent(event) {
super.prepareEvent(event);
try {
const parsed = this.interface.parseLog(event);
if (parsed) {
event.event = parsed.name;
event.eventSignature = parsed.signature;
event.decode = (data, topics) => {
@ -8257,6 +8283,9 @@ class WildcardRunningEvent extends RunningEvent {
};
event.args = parsed.args;
}
catch (error) {
// No matching event
}
}
}
class Contract {
@ -8463,28 +8492,27 @@ class Contract {
if (eventName === "*") {
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
}
// Get the event Fragment (throws if ambiguous/unknown event)
const fragment = this.interface.getEvent(eventName);
if (!fragment) {
logger$f.throwArgumentError("unknown event - " + eventName, "eventName", eventName);
}
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment));
}
const filter = {
address: this.address
};
// Find the matching event in the ABI; if none, we still allow filtering
// since it may be a filter for an otherwise unknown event
if (eventName.topics) {
if (eventName.topics[0]) {
// We have topics to filter by...
if (eventName.topics && eventName.topics.length > 0) {
// Is it a known topichash? (throws if no matching topichash)
try {
const fragment = this.interface.getEvent(eventName.topics[0]);
if (fragment) {
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics));
}
}
filter.topics = eventName.topics;
}
catch (error) { }
// Filter by the unknown topichash
const filter = {
address: this.address,
topics: eventName.topics
};
return this._normalizeRunningEvent(new RunningEvent(getEventTag(filter), filter));
}
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
}
_checkRunningEvents(runningEvent) {
if (runningEvent.listenerCount() === 0) {
delete this._runningEvents[runningEvent.tag];
@ -8496,15 +8524,10 @@ class Contract {
}
}
}
// Subclasses can override this to gracefully recover
// from parse errors if they wish
_wrapEvent(runningEvent, log, listener) {
const event = deepCopy(log);
try {
runningEvent.prepareEvent(event);
}
catch (error) {
this.emit("error", error);
throw error;
}
event.removeListener = () => {
if (!listener) {
return;
@ -8515,6 +8538,8 @@ class Contract {
event.getBlock = () => { return this.provider.getBlock(log.blockHash); };
event.getTransaction = () => { return this.provider.getTransaction(log.transactionHash); };
event.getTransactionReceipt = () => { return this.provider.getTransactionReceipt(log.transactionHash); };
// This may throw if the topics and data mismatch the signature
runningEvent.prepareEvent(event);
return event;
}
_addEventListener(runningEvent, listener, once) {
@ -8524,12 +8549,19 @@ class Contract {
runningEvent.addListener(listener, once);
// Track this running event and its listeners (may already be there; but no hard in updating)
this._runningEvents[runningEvent.tag] = runningEvent;
// If we are not polling the provider, start
// If we are not polling the provider, start polling
if (!this._wrappedEmits[runningEvent.tag]) {
const wrappedEmit = (log) => {
const event = this._wrapEvent(runningEvent, log, listener);
const args = (event.args || []).slice();
args.push(event);
let event = null;
try {
event = this._wrapEvent(runningEvent, log, listener);
}
catch (error) {
// There was an error decoding the data and topics
this.emit("error", error, event);
return;
}
const args = runningEvent.getEmit(event);
this.emit(runningEvent.filter, ...args);
};
this._wrappedEmits[runningEvent.tag] = wrappedEmit;
@ -16345,7 +16377,7 @@ function poll(func, options) {
});
}
const version$k = "providers/5.0.0-beta.161";
const version$k = "providers/5.0.0-beta.162";
"use strict";
const logger$o = new Logger(version$k);
@ -16747,7 +16779,7 @@ function checkTopic(topic) {
function serializeTopics(topics) {
// Remove trailing null AND-topics; they are redundant
topics = topics.slice();
while (topics[topics.length - 1] == null) {
while (topics.length > 0 && topics[topics.length - 1] == null) {
topics.pop();
}
return topics.map((topic) => {
@ -16768,6 +16800,9 @@ function serializeTopics(topics) {
}).join("&");
}
function deserializeTopics(data) {
if (data === "") {
return [];
}
return data.split(/&/g).map((topic) => {
return topic.split("|").map((topic) => {
return ((topic === "null") ? null : topic);
@ -16842,12 +16877,14 @@ class Event {
if (comps[0] !== "filter") {
return null;
}
const filter = {
address: comps[1],
topics: deserializeTopics(comps[2])
};
if (!filter.address || filter.address === "*") {
delete filter.address;
const address = comps[1];
const topics = deserializeTopics(comps[2]);
const filter = {};
if (topics.length > 0) {
filter.topics = topics;
}
if (address && address !== "*") {
filter.address = address;
}
return filter;
}
@ -19195,7 +19232,7 @@ class Web3Provider extends JsonRpcProvider {
var _version$6 = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "providers/5.0.0-beta.161";
exports.version = "providers/5.0.0-beta.162";
});
var _version$7 = unwrapExports(_version$6);
@ -19728,7 +19765,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
Indexed: Indexed
});
const version$m = "ethers/5.0.0-beta.181";
const version$m = "ethers/5.0.0-beta.182";
"use strict";
const errors = Logger.errors;

File diff suppressed because one or more lines are too long

@ -8908,7 +8908,7 @@
var _version$m = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "contracts/5.0.0-beta.147";
exports.version = "contracts/5.0.0-beta.148";
});
var _version$n = unwrapExports(_version$m);
@ -9167,6 +9167,10 @@
};
RunningEvent.prototype.prepareEvent = function (event) {
};
// Returns the array that will be applied to an emit
RunningEvent.prototype.getEmit = function (event) {
return [event];
};
return RunningEvent;
}());
var ErrorRunningEvent = /** @class */ (function (_super) {
@ -9176,6 +9180,11 @@
}
return ErrorRunningEvent;
}(RunningEvent));
// @TODO Fragment should inherit Wildcard? and just override getEmit?
// or have a common abstract super class, with enough constructor
// options to configure both.
// A Fragment Event will populate all the properties that Wildcard
// will, and additioanlly dereference the arguments when emitting
var FragmentRunningEvent = /** @class */ (function (_super) {
__extends(FragmentRunningEvent, _super);
function FragmentRunningEvent(address, contractInterface, fragment, topics) {
@ -9207,10 +9216,27 @@
event.decode = function (data, topics) {
return _this.interface.decodeEventLog(_this.fragment, data, topics);
};
try {
event.args = this.interface.decodeEventLog(this.fragment, event.data, event.topics);
}
catch (error) {
event.args = null;
event.decodeError = error;
throw error;
}
};
FragmentRunningEvent.prototype.getEmit = function (event) {
var args = (event.args || []).slice();
args.push(event);
return args;
};
return FragmentRunningEvent;
}(RunningEvent));
// A Wildard Event will attempt to populate:
// - event The name of the event name
// - eventSignature The full signature of the event
// - decode A function to decode data and topics
// - args The decoded data and topics
var WildcardRunningEvent = /** @class */ (function (_super) {
__extends(WildcardRunningEvent, _super);
function WildcardRunningEvent(address, contractInterface) {
@ -9222,14 +9248,17 @@
WildcardRunningEvent.prototype.prepareEvent = function (event) {
var _this = this;
_super.prototype.prepareEvent.call(this, event);
var parsed = this.interface.parseLog(event);
if (parsed) {
event.event = parsed.name;
event.eventSignature = parsed.signature;
try {
var parsed_1 = this.interface.parseLog(event);
event.event = parsed_1.name;
event.eventSignature = parsed_1.signature;
event.decode = function (data, topics) {
return _this.interface.decodeEventLog(parsed.eventFragment, data, topics);
return _this.interface.decodeEventLog(parsed_1.eventFragment, data, topics);
};
event.args = parsed.args;
event.args = parsed_1.args;
}
catch (error) {
// No matching event
}
};
return WildcardRunningEvent;
@ -9446,27 +9475,26 @@
if (eventName === "*") {
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
}
// Get the event Fragment (throws if ambiguous/unknown event)
var fragment = this.interface.getEvent(eventName);
if (!fragment) {
logger.throwArgumentError("unknown event - " + eventName, "eventName", eventName);
}
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment));
}
var filter = {
address: this.address
};
// Find the matching event in the ABI; if none, we still allow filtering
// since it may be a filter for an otherwise unknown event
if (eventName.topics) {
if (eventName.topics[0]) {
// We have topics to filter by...
if (eventName.topics && eventName.topics.length > 0) {
// Is it a known topichash? (throws if no matching topichash)
try {
var fragment = this.interface.getEvent(eventName.topics[0]);
if (fragment) {
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics));
}
}
filter.topics = eventName.topics;
}
catch (error) { }
// Filter by the unknown topichash
var filter = {
address: this.address,
topics: eventName.topics
};
return this._normalizeRunningEvent(new RunningEvent(getEventTag(filter), filter));
}
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
};
Contract.prototype._checkRunningEvents = function (runningEvent) {
if (runningEvent.listenerCount() === 0) {
@ -9479,16 +9507,11 @@
}
}
};
// Subclasses can override this to gracefully recover
// from parse errors if they wish
Contract.prototype._wrapEvent = function (runningEvent, log, listener) {
var _this = this;
var event = lib$3.deepCopy(log);
try {
runningEvent.prepareEvent(event);
}
catch (error) {
this.emit("error", error);
throw error;
}
event.removeListener = function () {
if (!listener) {
return;
@ -9499,6 +9522,8 @@
event.getBlock = function () { return _this.provider.getBlock(log.blockHash); };
event.getTransaction = function () { return _this.provider.getTransaction(log.transactionHash); };
event.getTransactionReceipt = function () { return _this.provider.getTransactionReceipt(log.transactionHash); };
// This may throw if the topics and data mismatch the signature
runningEvent.prepareEvent(event);
return event;
};
Contract.prototype._addEventListener = function (runningEvent, listener, once) {
@ -9509,12 +9534,19 @@
runningEvent.addListener(listener, once);
// Track this running event and its listeners (may already be there; but no hard in updating)
this._runningEvents[runningEvent.tag] = runningEvent;
// If we are not polling the provider, start
// If we are not polling the provider, start polling
if (!this._wrappedEmits[runningEvent.tag]) {
var wrappedEmit = function (log) {
var event = _this._wrapEvent(runningEvent, log, listener);
var args = (event.args || []).slice();
args.push(event);
var event = null;
try {
event = _this._wrapEvent(runningEvent, log, listener);
}
catch (error) {
// There was an error decoding the data and topics
_this.emit("error", error, event);
return;
}
var args = runningEvent.getEmit(event);
_this.emit.apply(_this, __spreadArrays([runningEvent.filter], args));
};
this._wrappedEmits[runningEvent.tag] = wrappedEmit;
@ -17806,7 +17838,7 @@
var _version$I = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "providers/5.0.0-beta.161";
exports.version = "providers/5.0.0-beta.162";
});
var _version$J = unwrapExports(_version$I);
@ -18284,7 +18316,7 @@
function serializeTopics(topics) {
// Remove trailing null AND-topics; they are redundant
topics = topics.slice();
while (topics[topics.length - 1] == null) {
while (topics.length > 0 && topics[topics.length - 1] == null) {
topics.pop();
}
return topics.map(function (topic) {
@ -18305,6 +18337,9 @@
}).join("&");
}
function deserializeTopics(data) {
if (data === "") {
return [];
}
return data.split(/&/g).map(function (topic) {
return topic.split("|").map(function (topic) {
return ((topic === "null") ? null : topic);
@ -18392,12 +18427,14 @@
if (comps[0] !== "filter") {
return null;
}
var filter = {
address: comps[1],
topics: deserializeTopics(comps[2])
};
if (!filter.address || filter.address === "*") {
delete filter.address;
var address = comps[1];
var topics = deserializeTopics(comps[2]);
var filter = {};
if (topics.length > 0) {
filter.topics = topics;
}
if (address && address !== "*") {
filter.address = address;
}
return filter;
},
@ -22351,7 +22388,7 @@
var _version$M = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.0-beta.181";
exports.version = "ethers/5.0.0-beta.182";
});
var _version$N = unwrapExports(_version$M);

File diff suppressed because one or more lines are too long

@ -1 +1 @@
export declare const version = "ethers/5.0.0-beta.181";
export declare const version = "ethers/5.0.0-beta.182";

@ -1 +1 @@
export const version = "ethers/5.0.0-beta.181";
export const version = "ethers/5.0.0-beta.182";

@ -1 +1 @@
export declare const version = "ethers/5.0.0-beta.181";
export declare const version = "ethers/5.0.0-beta.182";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.0-beta.181";
exports.version = "ethers/5.0.0-beta.182";

@ -52,7 +52,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xa3e07c74fc1ea53f660f1543f14b836069db93879d1aad93fa033b03eb16f564",
"tarballHash": "0x17d9052dc2dcc4b6a160772fb2f80eeecc56137584c6d8ee54d912f52c3efa84",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.181"
"version": "5.0.0-beta.182"
}

@ -1 +1 @@
export const version = "ethers/5.0.0-beta.181";
export const version = "ethers/5.0.0-beta.182";

@ -1 +1 @@
export declare const version = "providers/5.0.0-beta.161";
export declare const version = "providers/5.0.0-beta.162";

@ -1 +1 @@
export const version = "providers/5.0.0-beta.161";
export const version = "providers/5.0.0-beta.162";

@ -34,7 +34,7 @@ function checkTopic(topic) {
function serializeTopics(topics) {
// Remove trailing null AND-topics; they are redundant
topics = topics.slice();
while (topics[topics.length - 1] == null) {
while (topics.length > 0 && topics[topics.length - 1] == null) {
topics.pop();
}
return topics.map((topic) => {
@ -55,6 +55,9 @@ function serializeTopics(topics) {
}).join("&");
}
function deserializeTopics(data) {
if (data === "") {
return [];
}
return data.split(/&/g).map((topic) => {
return topic.split("|").map((topic) => {
return ((topic === "null") ? null : topic);
@ -129,12 +132,14 @@ export class Event {
if (comps[0] !== "filter") {
return null;
}
const filter = {
address: comps[1],
topics: deserializeTopics(comps[2])
};
if (!filter.address || filter.address === "*") {
delete filter.address;
const address = comps[1];
const topics = deserializeTopics(comps[2]);
const filter = {};
if (topics.length > 0) {
filter.topics = topics;
}
if (address && address !== "*") {
filter.address = address;
}
return filter;
}

@ -1 +1 @@
export declare const version = "providers/5.0.0-beta.161";
export declare const version = "providers/5.0.0-beta.162";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "providers/5.0.0-beta.161";
exports.version = "providers/5.0.0-beta.162";

@ -75,7 +75,7 @@ function checkTopic(topic) {
function serializeTopics(topics) {
// Remove trailing null AND-topics; they are redundant
topics = topics.slice();
while (topics[topics.length - 1] == null) {
while (topics.length > 0 && topics[topics.length - 1] == null) {
topics.pop();
}
return topics.map(function (topic) {
@ -96,6 +96,9 @@ function serializeTopics(topics) {
}).join("&");
}
function deserializeTopics(data) {
if (data === "") {
return [];
}
return data.split(/&/g).map(function (topic) {
return topic.split("|").map(function (topic) {
return ((topic === "null") ? null : topic);
@ -183,12 +186,14 @@ var Event = /** @class */ (function () {
if (comps[0] !== "filter") {
return null;
}
var filter = {
address: comps[1],
topics: deserializeTopics(comps[2])
};
if (!filter.address || filter.address === "*") {
delete filter.address;
var address = comps[1];
var topics = deserializeTopics(comps[2]);
var filter = {};
if (topics.length > 0) {
filter.topics = topics;
}
if (address && address !== "*") {
filter.address = address;
}
return filter;
},

@ -46,7 +46,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x72ffec5f93c2e2263163a4e8a21016ca74bc67313b2ca84314cededde6d6bebf",
"tarballHash": "0x820979f20cca0966c9833c0a1b55e28ec19ed526cf3b4ac7401131dd0bcdf8ef",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.161"
"version": "5.0.0-beta.162"
}

@ -1 +1 @@
export const version = "providers/5.0.0-beta.161";
export const version = "providers/5.0.0-beta.162";