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

Fix erc1155 image look up #4276

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,12 @@ export class ERC1155Standard {
]);

if (tokenURI) {
// https://docs.openzeppelin.com/contracts/5.x/api/token/erc1155#ERC1155-uri-uint256-
// replace the {id} with the token type ID
const slashIndex = tokenURI.lastIndexOf('/');
const tokenURIWithId = `${tokenURI.substring(0, slashIndex)}/${tokenId}`;
try {
const response = await timeoutFetch(tokenURI);
const response = await timeoutFetch(tokenURIWithId);
const object = await response.json();
image = object?.image;
if (image?.startsWith('ipfs://')) {
Expand Down
Loading