11import React , { useEffect , useState } from 'react'
22import cx from 'classnames'
3- import { PlusCircleIcon , ReplyIcon } from '@heroicons/react/outline'
3+ import { DocumentDuplicateIcon , PlusCircleIcon , ReplyIcon } from '@heroicons/react/outline'
44import {
55 ASSOCIATED_TOKEN_PROGRAM_ID ,
66 Token as SplToken ,
@@ -20,6 +20,8 @@ import Address from '@components/Address'
2020
2121import AddAssetModal from '../WalletDetails/AddAssetModal'
2222import useLegacyConnectionContext from '@hooks/useLegacyConnectionContext'
23+ import Tooltip from '@components/Tooltip'
24+ import { notify } from '@utils/notifications'
2325
2426interface Props {
2527 className ?: string
@@ -55,6 +57,20 @@ export default function Header(props: Props) {
5557 }
5658 } , [ props . asset , props . wallet ] )
5759
60+ async function copyMintAddress ( ) {
61+ const mint = props . asset . raw . extensions . mint ?. publicKey
62+ const base58 = mint ?. toBase58 ( ) || ''
63+
64+ try {
65+ await navigator ?. clipboard ?. writeText ( base58 )
66+ } catch {
67+ notify ( {
68+ type : 'error' ,
69+ message : 'Could not copy address to clipboard' ,
70+ } )
71+ }
72+ }
73+
5874 return (
5975 < div
6076 className = { cx (
@@ -122,6 +138,11 @@ export default function Header(props: Props) {
122138 ? 'SOL'
123139 : props . asset . symbol }
124140 </ span >
141+ < span className = "text-sm ml-2 inline-block relative top-1" onClick = { copyMintAddress } >
142+ < Tooltip content = "Copy Mint Address" >
143+ < DocumentDuplicateIcon className = "cursor-pointer h-[1.25em] w-[1.25em]" />
144+ </ Tooltip >
145+ </ span >
125146 </ div >
126147 </ div >
127148 </ div >
0 commit comments