Skip to content

Commit

Permalink
fix: change ipfs gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-barros committed May 6, 2024
1 parent 3991002 commit 020a575
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Testing getAssetImageUrl function', () => {
const fortmatImgSrcSpyResult = 'fortmatImgSrcSpy';
const fortmatImgSrcSpy = jest.spyOn(getImages, 'fortmatImgSrc').mockReturnValueOnce(fortmatImgSrcSpyResult);

expect(getImages.getAssetImageUrl('ipfs://image')).toBe('https://ipfs.io/ipfs/image');
expect(getImages.getAssetImageUrl('ipfs://image')).toBe('https://ipfs.blockfrost.dev/ipfs/image');
expect(getImages.getAssetImageUrl('data:image/image')).toBe('data:image/image');
expect(getImages.getAssetImageUrl('image')).toBe(fortmatImgSrcSpyResult);
expect(fortmatImgSrcSpy).toBeCalledWith({ img: 'image', type: 'png' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const fortmatImgSrc = (params: { img: string; type: string }): string =>

export const getAssetImageUrl = (image: string): string => {
if (image.startsWith('ipfs')) {
return image.replace('ipfs://', 'https://ipfs.io/ipfs/');
return image.replace('ipfs://', 'https://ipfs.blockfrost.dev/ipfs/');
}

if (image.startsWith('data:image/')) return image;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('Testing nftImageSelector', () => {
const imageUri = 'ipfs://nft-address' as unknown as Wallet.Asset.Uri;
const image = nftImageSelector(imageUri);

expect(image).toBe('https://ipfs.io/ipfs/nft-address');
expect(image).toBe('https://ipfs.blockfrost.dev/ipfs/nft-address');
});
});
2 changes: 1 addition & 1 deletion packages/e2e-tests/src/assert/adaHandleAssert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { browser } from '@wdio/globals';

class AdaHandleAssert {
public customHandleSrcValue = 'https://ipfs.io/ipfs/zdj7WX1C4V25M3YwFkj8ySLAnKR2eCQZ76pn96CNMc27Es2LP';
public customHandleSrcValue = 'https://ipfs.blockfrost.dev/ipfs/zdj7WX1C4V25M3YwFkj8ySLAnKR2eCQZ76pn96CNMc27Es2LP';

async assertSeeCustomImage(imageElement: WebdriverIO.Element) {
await imageElement.scrollIntoView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const TransactionAssets = ({
if (value === '' || value === undefined) {
return themeFallbackImage;
} else if (value.startsWith('ipfs')) {
return value.replace('ipfs://', 'https://ipfs.io/ipfs/');
return value.replace('ipfs://', 'https://ipfs.blockfrost.dev/ipfs/');
} else if (isImageBase64Encoded(value)) {
return `data:image/png;base64,${value}`;
} else {
Expand Down

0 comments on commit 020a575

Please sign in to comment.