From 9323701f9b5110896683685d69bea96a7700684d Mon Sep 17 00:00:00 2001 From: ryanml Date: Tue, 25 Jul 2023 08:44:40 -0700 Subject: [PATCH] Fixing 'View on Opensea' link for main and testnet NFTs (#19797) --- ui/components/app/nft-details/nft-details.js | 5 +++-- ui/components/app/nft-details/nft-details.test.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/components/app/nft-details/nft-details.js b/ui/components/app/nft-details/nft-details.js index 491506339..5a8df995e 100644 --- a/ui/components/app/nft-details/nft-details.js +++ b/ui/components/app/nft-details/nft-details.js @@ -112,12 +112,13 @@ export default function NftDetails({ nft }) { const getOpenSeaLink = () => { switch (currentNetwork) { case CHAIN_IDS.MAINNET: - return `https://opensea.io/assets/${address}/${tokenId}`; + return `https://opensea.io/assets/ethereum/${address}/${tokenId}`; case CHAIN_IDS.POLYGON: return `https://opensea.io/assets/matic/${address}/${tokenId}`; case CHAIN_IDS.GOERLI: + return `https://testnets.opensea.io/assets/goerli/${address}/${tokenId}`; case CHAIN_IDS.SEPOLIA: - return `https://testnets.opensea.io/assets/${address}/${tokenId}`; + return `https://testnets.opensea.io/assets/sepolia/${address}/${tokenId}`; default: return null; } diff --git a/ui/components/app/nft-details/nft-details.test.js b/ui/components/app/nft-details/nft-details.test.js index aab54bd60..7733e75ae 100644 --- a/ui/components/app/nft-details/nft-details.test.js +++ b/ui/components/app/nft-details/nft-details.test.js @@ -165,7 +165,7 @@ describe('NFT Details', () => { await waitFor(() => { expect(global.platform.openTab).toHaveBeenCalledWith({ - url: `https://testnets.opensea.io/assets/${nfts[5].address}/${nfts[5].tokenId}`, + url: `https://testnets.opensea.io/assets/goerli/${nfts[5].address}/${nfts[5].tokenId}`, }); }); }); @@ -200,7 +200,7 @@ describe('NFT Details', () => { await waitFor(() => { expect(global.platform.openTab).toHaveBeenCalledWith({ - url: `https://opensea.io/assets/${nfts[5].address}/${nfts[5].tokenId}`, + url: `https://opensea.io/assets/ethereum/${nfts[5].address}/${nfts[5].tokenId}`, }); }); }); @@ -272,7 +272,7 @@ describe('NFT Details', () => { await waitFor(() => { expect(global.platform.openTab).toHaveBeenCalledWith({ - url: `https://testnets.opensea.io/assets/${nfts[5].address}/${nfts[5].tokenId}`, + url: `https://testnets.opensea.io/assets/sepolia/${nfts[5].address}/${nfts[5].tokenId}`, }); }); });