Skip to content

Commit

Permalink
changing ipfs liks to our own ipfs gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
Viterbo committed Feb 6, 2024
1 parent b17ae45 commit 19b13ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/antelope/stores/utils/nft-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function extractNftMetadata(
// We need to look at the metadata
// we iterate over the metadata properties
for (const property in metadata) {
const value = metadata[property];
const value = (metadata[property] as string ?? '').replace('ipfs://', IPFS_GATEWAY);
if (!value) {
continue;
}
Expand Down
4 changes: 1 addition & 3 deletions src/antelope/types/NFTClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
IndexerNftMetadata,
IndexerTokenHoldersResponse,
} from 'src/antelope/types/IndexerTypes';
import { IPFS_GATEWAY, extractNftMetadata } from 'src/antelope/stores/utils/nft-utils';
import { extractNftMetadata } from 'src/antelope/stores/utils/nft-utils';
import { useContractStore } from 'src/antelope/stores/contract';
import { useNftsStore } from 'src/antelope/stores/nfts';
import EVMChainSettings from 'src/antelope/chains/EVMChainSettings';
Expand Down Expand Up @@ -143,8 +143,6 @@ export async function constructNft(
}, {} as { [key: string]: string });
}

indexerData.metadata.image = ((indexerData.metadata.image as string) ?? '').replace('ipfs://', IPFS_GATEWAY);

const { image, mediaType, mediaSource } = await extractNftMetadata(indexerData.imageCache ?? '', indexerData.tokenUri ?? '', indexerData.metadata ?? {});
const commonData: NftPrecursorData = {
name: (indexerData.metadata?.name ?? '') as string,
Expand Down

0 comments on commit 19b13ca

Please sign in to comment.