Skip to content

Commit

Permalink
Query for name and symbol on ERC721 contracts regardless of whether o…
Browse files Browse the repository at this point in the history
…r not they support the metadata interface (#834)

* query for name and symbol on erc721 contracts regardless of whether or not they support the metadata interface
  • Loading branch information
adonesky1 authored and MajorLift committed Oct 11, 2023
1 parent 7a24b8c commit 8921657
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ export class ERC1155Standard {
image: string | undefined;
}> => {
const isERC1155 = await this.contractSupportsBase1155Interface(address);

if (!isERC1155) {
throw new Error("This isn't a valid ERC1155 contract");
}
let tokenURI, image;

if (tokenId) {
Expand All @@ -209,14 +213,10 @@ export class ERC1155Standard {
}

// TODO consider querying to the metadata to get name.
if (isERC1155) {
return {
standard: ERC1155,
tokenURI,
image,
};
}

throw new Error("This isn't a valid ERC1155 contract");
return {
standard: ERC1155,
tokenURI,
image,
};
};
}
Loading

0 comments on commit 8921657

Please sign in to comment.