22
33import { WalletAddress } from "@/components/blocks/wallet-address" ;
44import { Spinner } from "@/components/ui/Spinner/Spinner" ;
5+ import { useThirdwebClient } from "@/constants/thirdweb.client" ;
56import { useDashboardRouter } from "@/lib/DashboardRouter" ;
67import {
78 Box ,
@@ -15,12 +16,14 @@ import {
1516 useBreakpointValue ,
1617} from "@chakra-ui/react" ;
1718import { useNFTDrawerTabs } from "core-ui/nft-drawer/useNftDrawerTabs" ;
18- import { ChevronLeftIcon } from "lucide-react" ;
19+ import { ChevronLeftIcon , ExternalLinkIcon } from "lucide-react" ;
20+ import Link from "next/link" ;
1921import { useState } from "react" ;
2022import type { ThirdwebContract } from "thirdweb" ;
2123import { getNFT as getErc721NFT } from "thirdweb/extensions/erc721" ;
2224import { getNFT as getErc1155NFT } from "thirdweb/extensions/erc1155" ;
2325import { useReadContract } from "thirdweb/react" ;
26+ import { resolveScheme } from "thirdweb/storage" ;
2427import { Badge , Button , Card , CodeBlock , Heading , Text } from "tw-components" ;
2528import { AddressCopyButton } from "tw-components/AddressCopyButton" ;
2629import { NFTMediaWithEmptyState } from "tw-components/nft-media" ;
@@ -65,6 +68,8 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
6568 tokenId,
6669 } ) ;
6770
71+ const client = useThirdwebClient ( ) ;
72+
6873 const { data : nft , isPending } = useReadContract (
6974 isErc721 ? getErc721NFT : getErc1155NFT ,
7075 {
@@ -240,6 +245,26 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
240245 </ GridItem >
241246 </ >
242247 ) }
248+ < GridItem colSpan = { 4 } >
249+ < Heading size = "label.md" > Token URI</ Heading >
250+ </ GridItem >
251+ < GridItem
252+ colSpan = { 8 }
253+ className = "flex flex-row items-center gap-2"
254+ >
255+ < AddressCopyButton
256+ size = "xs"
257+ address = { nft . tokenURI }
258+ title = "Token URI"
259+ shortenAddress = { true }
260+ />
261+ < Link
262+ href = { resolveScheme ( { client, uri : nft . tokenURI } ) }
263+ target = "_blank"
264+ >
265+ < ExternalLinkIcon className = "size-4" />
266+ </ Link >
267+ </ GridItem >
243268 </ SimpleGrid >
244269 </ Card >
245270 { properties ? (
0 commit comments