Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query for name and symbol on ERC721 contracts regardless of whether or not they support the metadata interface #834

Merged
merged 4 commits into from
May 19, 2022
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
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