Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/contracts/smart-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ export class SmartContract<
/**
* Auto-detects ERC20 standard functions.
*/
public token: Erc20<BaseERC20> | undefined;
public token: Erc20 | undefined;
/**
* Auto-detects ERC721 standard functions.
*/
public nft: Erc721<BaseERC721> | undefined;
public nft: Erc721 | undefined;
/**
* Auto-detects ERC1155 standard functions.
*/
public edition: Erc1155<BaseERC1155> | undefined;
public edition: Erc1155 | undefined;

constructor(
network: NetworkOrSignerOrProvider,
Expand Down
21 changes: 16 additions & 5 deletions src/core/classes/contract-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,22 @@ export class ContractEvents<TContract extends BaseContract> {
this.contractWrapper.readContract.on(event.name, (...args) => {
// convert event info into nice object with named properties
const results: Record<string, any> = {};
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<string, any> = {};
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);
});
}
Expand Down