diff --git a/packages/contracts/src.ts/index.ts b/packages/contracts/src.ts/index.ts index 176d9b64f..6cb6aed8e 100644 --- a/packages/contracts/src.ts/index.ts +++ b/packages/contracts/src.ts/index.ts @@ -764,7 +764,7 @@ export class Contract { if (!this._wrappedEmits[runningEvent.tag]) { const wrappedEmit = (log: Log) => { const event = this._wrapEvent(runningEvent, log, listener); - const args = (event.args || []); + const args = (event.args || []).slice(); args.push(event); this.emit(runningEvent.filter, ...args); }; diff --git a/packages/tests/src.ts/test-contract.ts b/packages/tests/src.ts/test-contract.ts index 94a0d97e9..c6d88231e 100644 --- a/packages/tests/src.ts/test-contract.ts +++ b/packages/tests/src.ts/test-contract.ts @@ -58,9 +58,9 @@ function TestContractEvents() { done = true; let args = Array.prototype.slice.call(arguments); - let event = args.pop(); + let event = args[args.length - 1]; event.removeListener(); - equals(event.event, args, expected); + equals(event.event, args.slice(0, args.length - 1), expected); resolve(); });