11"use client" ;
22
33import { WalletAddress } from "@/components/blocks/wallet-address" ;
4+ import { CopyTextButton } from "@/components/ui/CopyTextButton" ;
45import { Spinner } from "@/components/ui/Spinner/Spinner" ;
6+ import { useThirdwebClient } from "@/constants/thirdweb.client" ;
57import { useDashboardRouter } from "@/lib/DashboardRouter" ;
68import {
79 Box ,
@@ -15,15 +17,18 @@ import {
1517 useBreakpointValue ,
1618} from "@chakra-ui/react" ;
1719import { useChainSlug } from "hooks/chains/chainSlug" ;
18- import { ChevronLeftIcon } from "lucide-react" ;
20+ import { ChevronLeftIcon , ExternalLinkIcon } from "lucide-react" ;
21+ import Link from "next/link" ;
1922import { useState } from "react" ;
2023import type { ThirdwebContract } from "thirdweb" ;
2124import { getNFT as getErc721NFT } from "thirdweb/extensions/erc721" ;
2225import { getNFT as getErc1155NFT } from "thirdweb/extensions/erc1155" ;
2326import { useReadContract } from "thirdweb/react" ;
27+ import { resolveScheme } from "thirdweb/storage" ;
2428import { Badge , Button , Card , CodeBlock , Heading , Text } from "tw-components" ;
2529import { AddressCopyButton } from "tw-components/AddressCopyButton" ;
2630import { NFTMediaWithEmptyState } from "tw-components/nft-media" ;
31+ import { shortenString } from "utils/usedapp-external" ;
2732import { NftProperty } from "../components/nft-property" ;
2833import { useNFTDrawerTabs } from "./useNftDrawerTabs" ;
2934
@@ -65,6 +70,8 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
6570 tokenId,
6671 } ) ;
6772
73+ const client = useThirdwebClient ( ) ;
74+
6875 const { data : nft , isPending } = useReadContract (
6976 isErc721 ? getErc721NFT : getErc1155NFT ,
7077 {
@@ -240,6 +247,28 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
240247 </ GridItem >
241248 </ >
242249 ) }
250+ < GridItem colSpan = { 4 } >
251+ < Heading size = "label.md" > Token URI</ Heading >
252+ </ GridItem >
253+ < GridItem
254+ colSpan = { 8 }
255+ className = "flex flex-row items-center gap-1"
256+ >
257+ < CopyTextButton
258+ textToCopy = { nft . tokenURI }
259+ textToShow = { shortenString ( nft . tokenURI ) }
260+ tooltip = "The URI of this NFT"
261+ copyIconPosition = "right"
262+ />
263+ < Button variant = "ghost" >
264+ < Link
265+ href = { resolveScheme ( { client, uri : nft . tokenURI } ) }
266+ target = "_blank"
267+ >
268+ < ExternalLinkIcon className = "size-4" />
269+ </ Link >
270+ </ Button >
271+ </ GridItem >
243272 </ SimpleGrid >
244273 </ Card >
245274 { properties ? (
0 commit comments