Fixed Contract events for immutable Result.

This commit is contained in:
Richard Moore 2020-03-30 22:08:55 -04:00
parent 75abc0e5f6
commit 092ce9bcc2
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
2 changed files with 3 additions and 3 deletions

@ -764,7 +764,7 @@ export class Contract {
if (!this._wrappedEmits[runningEvent.tag]) { if (!this._wrappedEmits[runningEvent.tag]) {
const wrappedEmit = (log: Log) => { const wrappedEmit = (log: Log) => {
const event = this._wrapEvent(runningEvent, log, listener); const event = this._wrapEvent(runningEvent, log, listener);
const args = (event.args || []); const args = (event.args || []).slice();
args.push(event); args.push(event);
this.emit(runningEvent.filter, ...args); this.emit(runningEvent.filter, ...args);
}; };

@ -58,9 +58,9 @@ function TestContractEvents() {
done = true; done = true;
let args = Array.prototype.slice.call(arguments); let args = Array.prototype.slice.call(arguments);
let event = args.pop(); let event = args[args.length - 1];
event.removeListener(); event.removeListener();
equals(event.event, args, expected); equals(event.event, args.slice(0, args.length - 1), expected);
resolve(); resolve();
}); });