diff --git a/src/contracts/smart-contract.ts b/src/contracts/smart-contract.ts index ef4cbb58e..365b425a7 100644 --- a/src/contracts/smart-contract.ts +++ b/src/contracts/smart-contract.ts @@ -94,15 +94,15 @@ export class SmartContract< /** * Auto-detects ERC20 standard functions. */ - public token: Erc20 | undefined; + public token: Erc20 | undefined; /** * Auto-detects ERC721 standard functions. */ - public nft: Erc721 | undefined; + public nft: Erc721 | undefined; /** * Auto-detects ERC1155 standard functions. */ - public edition: Erc1155 | undefined; + public edition: Erc1155 | undefined; constructor( network: NetworkOrSignerOrProvider, diff --git a/src/core/classes/contract-events.ts b/src/core/classes/contract-events.ts index 0a10a1dcb..88ad3954b 100644 --- a/src/core/classes/contract-events.ts +++ b/src/core/classes/contract-events.ts @@ -63,11 +63,22 @@ export class ContractEvents { this.contractWrapper.readContract.on(event.name, (...args) => { // convert event info into nice object with named properties const results: Record = {}; - event.inputs - .map((i) => i.name) - .forEach((arg, index) => { - results[arg] = args[index]; - }); + event.inputs.forEach((param, index) => { + if (Array.isArray(args[index])) { + const obj: Record = {}; + const components = param.components; + if (components) { + const arr = args[index]; + for (let i = 0; i < components.length; i++) { + const name = components[i].name; + obj[name] = arr[i]; + } + results[param.name] = obj; + } + } else { + results[param.name] = args[index]; + } + }); listener(results); }); }