import { ContentCopyRounded, OpenInNew } from '@mui/icons-material' import { Box, Typography } from '@mui/material' import type { Chain } from '@openocean.finance/widget-sdk' import { useTranslation } from 'react-i18next' import { Card } from '../../components/Card/Card.js' import { CardIconButton } from '../../components/Card/CardIconButton.js' import { CardTitle } from '../../components/Card/CardTitle.js' import { useExplorer } from '../../hooks/useExplorer.js' interface TransferIdCardProps { transferId: string chain: Chain | number } const getTxHash = (transferId: string) => transferId.indexOf('_') !== -1 ? transferId.substring(0, transferId.indexOf('_')) : transferId export const TransferIdCard = ({ transferId, chain }: TransferIdCardProps) => { const { t } = useTranslation() const { getTransactionLink } = useExplorer() const copyTransferId = async () => { await navigator.clipboard.writeText(transferId) } const openTransferIdInExplorer = () => { const txHash = getTxHash(transferId) window.open(getTransactionLink({ txHash, chain }), '_blank') } return ( {t('translation:main.transferId')} {transferId} ) }