Skip to content

Commit

Permalink
Change IpfsGateWayApi to support ipfs for IdentifierNFT
Browse files Browse the repository at this point in the history
  • Loading branch information
wk3368 committed Aug 10, 2022
1 parent e165ee0 commit 486c55b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ui/app/helpers/utils/nft-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,18 @@ async function generateScriptFunctionPayloadHex(

export function imageSourceUrls(imageUrl) {
const ipfsGatewayAPIs = [
'https://ipfs.infura.io:5001/api/v0/cat?arg=',
'https://ipfs.io/ipfs/',
// 'https://ipfs.infura.io:5001/api/v0/cat?arg=',
// 'https://ipfs.infura.io:5001/api/v0/cat?arg=',
// 'https://dweb.link',
// 'https://cloudflare-ipfs.com',
// 'https://gateway.pinata.cloud',
];
const urls = [];
if (imageUrl && imageUrl.length && imageUrl.indexOf('ipfs') === 0) {
const hash = imageUrl.split('//')[1];
ipfsGatewayAPIs.forEach((api) => urls.push(`${ api }${ hash }`));
const ext = imageUrl.split('.').length > 1 ? '' : '.png'
ipfsGatewayAPIs.forEach((api) => urls.push(`${ api }${ hash }${ ext }`));
} else {
urls.push(imageUrl);
}
Expand Down

0 comments on commit 486c55b

Please sign in to comment.