Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/expectEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function decodeLogs (logs, emitter, eventName) {
eventABI = eventABI[0];

// The first topic will equal the hash of the event signature
const eventSignature = `${eventName}(${eventABI.inputs.map(input => input.type).join(',')})`;
const eventSignature = signature(eventName, eventABI.inputs);
const eventTopic = web3.utils.sha3(eventSignature);

// Only decode events of type 'EventName'
Expand All @@ -143,6 +143,12 @@ function decodeLogs (logs, emitter, eventName) {
.map(decoded => ({ event: eventName, args: decoded }));
}

function signature (name, inputs) {
return `${name}(${inputs.map(
input => input.type === 'tuple' ? signature('', input.components) : input.type,
).join(',')})`;
}

function contains (args, key, value) {
expect(key in args).to.equal(true, `Event argument '${key}' not found`);

Expand Down Expand Up @@ -191,11 +197,11 @@ expectEvent.notEmitted.inTransaction = notInTransaction;
expectEvent.not = {};
expectEvent.not.inConstruction = deprecate(
notInConstruction,
'expectEvent.not is deprecated. Use expectEvent.notEmitted instead.'
'expectEvent.not is deprecated. Use expectEvent.notEmitted instead.',
);
expectEvent.not.inTransaction = deprecate(
notInTransaction,
'expectEvent.not is deprecated. Use expectEvent.notEmitted instead.'
'expectEvent.not is deprecated. Use expectEvent.notEmitted instead.',
);

module.exports = expectEvent;