import { formatNumber, t, toBigNum } from '@vegaprotocol/react-helpers'; import type { Toast } from '@vegaprotocol/ui-toolkit'; import { Intent } from '@vegaprotocol/ui-toolkit'; import { ApprovalStatus, VerificationStatus } from '@vegaprotocol/withdraws'; import { useCallback, useMemo } from 'react'; import compact from 'lodash/compact'; import type { EthWithdrawalApprovalState } from '@vegaprotocol/web3'; import { useEthWithdrawApprovalsStore } from '@vegaprotocol/web3'; const intentMap: { [s in ApprovalStatus]: Intent } = { Pending: Intent.Warning, Error: Intent.Danger, Idle: Intent.None, Delayed: Intent.Warning, Ready: Intent.Success, }; const EthWithdrawalApprovalToastContent = ({ tx, }: { tx: EthWithdrawalApprovalState; }) => { let title = ''; if (tx.status === ApprovalStatus.Error) { title = t('Error occurred'); } if (tx.status === ApprovalStatus.Pending) { title = t('Pending approval'); } if (tx.status === ApprovalStatus.Delayed) { title = t('Delayed'); } const num = formatNumber( toBigNum(tx.withdrawal.amount, tx.withdrawal.asset.decimals), tx.withdrawal.asset.decimals ); const details = (