'use client'; import { useCallback } from 'react'; import { cn, text } from '@/styles/theme'; import { useAccount } from 'wagmi'; import { getChainExplorer } from '@/core/network/getChainExplorer'; import { Toast } from '@/internal/components/Toast'; import { SuccessSvg } from '@/internal/svg/successSvg'; import type { SwapToastProps } from '../types'; import { useSwapContext } from './SwapProvider'; export function SwapToast({ className, duration = 5000, position = 'bottom-center', render, }: SwapToastProps) { const { isToastVisible, setIsToastVisible, setTransactionHash, transactionHash, } = useSwapContext(); const { chainId } = useAccount(); const chainExplorer = getChainExplorer(chainId); const resetToastState = useCallback(() => { setIsToastVisible(false); setTransactionHash(''); }, [setIsToastVisible, setTransactionHash]); if (render) { return render({ isToastVisible, transactionHash, resetToastState, chainExplorer, }); } if (!isToastVisible) { return null; } return (

Successful

View transaction
); }