|
|
@ -1,7 +1,7 @@ |
|
|
|
import { useCallback, useState } from 'react'; |
|
|
|
import { useCallback, useState } from 'react'; |
|
|
|
import { toast } from 'react-toastify'; |
|
|
|
import { toast } from 'react-toastify'; |
|
|
|
|
|
|
|
|
|
|
|
import { TypedTransactionReceipt, WarpTxCategory } from '@hyperlane-xyz/sdk'; |
|
|
|
import { TokenStandard, TypedTransactionReceipt, WarpTxCategory } from '@hyperlane-xyz/sdk'; |
|
|
|
import { toTitleCase, toWei } from '@hyperlane-xyz/utils'; |
|
|
|
import { toTitleCase, toWei } from '@hyperlane-xyz/utils'; |
|
|
|
|
|
|
|
|
|
|
|
import { toastTxSuccess } from '../../components/toast/TxSuccessToast'; |
|
|
|
import { toastTxSuccess } from '../../components/toast/TxSuccessToast'; |
|
|
@ -18,6 +18,8 @@ import { |
|
|
|
import { TransferContext, TransferFormValues, TransferStatus } from './types'; |
|
|
|
import { TransferContext, TransferFormValues, TransferStatus } from './types'; |
|
|
|
import { tryGetMsgIdFromTransferReceipt } from './utils'; |
|
|
|
import { tryGetMsgIdFromTransferReceipt } from './utils'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SKIP_DEST_BALANCE_CHECK_STANDARDS = [TokenStandard.EvmHypCollateralFiat]; |
|
|
|
|
|
|
|
|
|
|
|
export function useTokenTransfer(onDone?: () => void) { |
|
|
|
export function useTokenTransfer(onDone?: () => void) { |
|
|
|
const { transfers, addTransfer, updateTransferStatus } = useStore((s) => ({ |
|
|
|
const { transfers, addTransfer, updateTransferStatus } = useStore((s) => ({ |
|
|
|
transfers: s.transfers, |
|
|
|
transfers: s.transfers, |
|
|
@ -108,7 +110,9 @@ async function executeTransfer({ |
|
|
|
|
|
|
|
|
|
|
|
const warpCore = getWarpCore(); |
|
|
|
const warpCore = getWarpCore(); |
|
|
|
|
|
|
|
|
|
|
|
const isCollateralSufficient = await warpCore.isDestinationCollateralSufficient({ |
|
|
|
const isCollateralSufficient = SKIP_DEST_BALANCE_CHECK_STANDARDS.includes(originToken.standard) |
|
|
|
|
|
|
|
? true |
|
|
|
|
|
|
|
: await warpCore.isDestinationCollateralSufficient({ |
|
|
|
originTokenAmount, |
|
|
|
originTokenAmount, |
|
|
|
destination, |
|
|
|
destination, |
|
|
|
}); |
|
|
|
}); |
|
|
|