diff --git a/src/hooks/common/useApprove.ts b/src/hooks/common/useApprove.ts index 07432cf..4124609 100644 --- a/src/hooks/common/useApprove.ts +++ b/src/hooks/common/useApprove.ts @@ -1,3 +1,4 @@ +import { formatBalance } from '@/utils/common/formatBalance'; import { Currency, CurrencyAmount, Percent, Trade, TradeType } from "@cryptoalgebra/integral-sdk"; import { useNeedAllowance } from "./useNeedAllowance"; import { ApprovalState, ApprovalStateType } from "@/types/approve-state"; @@ -5,7 +6,6 @@ import { useMemo } from "react"; import { Address, erc20ABI, useContractWrite, usePrepareContractWrite } from "wagmi"; import { ALGEBRA_ROUTER } from "@/constants/addresses"; import { useTransactionAwait } from "./useTransactionAwait"; -import { formatCurrency } from "@/utils/common/formatCurrency"; import { TransactionType } from "@/state/pendingTransactionsStore"; export function useApprove(amountToApprove: CurrencyAmount | undefined, spender: Address) { @@ -35,7 +35,7 @@ export function useApprove(amountToApprove: CurrencyAmount | undefined const { isLoading, isSuccess } = useTransactionAwait( approvalData?.hash, { - title: `Approve ${formatCurrency.format(Number(amountToApprove?.toSignificant()))} ${amountToApprove?.currency.symbol}`, + title: `Approve ${formatBalance(amountToApprove?.toSignificant() as string)} ${amountToApprove?.currency.symbol}`, tokenA: token?.address as Address, type: TransactionType.SWAP } diff --git a/src/hooks/swap/useSwapCallback.ts b/src/hooks/swap/useSwapCallback.ts index 13df435..41434b4 100644 --- a/src/hooks/swap/useSwapCallback.ts +++ b/src/hooks/swap/useSwapCallback.ts @@ -1,3 +1,4 @@ +import { formatBalance } from '@/utils/common/formatBalance'; import { Currency, Percent, Trade, TradeType } from "@cryptoalgebra/integral-sdk"; import { Address, useAccount, useContractWrite } from "wagmi"; import { useSwapCallArguments } from "./useSwapCallArguments"; @@ -5,7 +6,6 @@ import { getAlgebraRouter, usePrepareAlgebraRouterMulticall } from "@/generated" import { useEffect, useMemo, useState } from "react"; import { SwapCallbackState } from "@/types/swap-state"; import { useTransactionAwait } from "../common/useTransactionAwait"; -import { formatCurrency } from "@/utils/common/formatCurrency"; import { ApprovalStateType } from "@/types/approve-state"; import { TransactionType } from "@/state/pendingTransactionsStore"; @@ -117,7 +117,7 @@ export function useSwapCallback( const { isLoading, isSuccess } = useTransactionAwait( swapData?.hash, { - title: `Swap ${formatCurrency.format(Number(trade?.inputAmount.toSignificant()))} ${trade?.inputAmount.currency.symbol}`, + title: `Swap ${formatBalance(trade?.inputAmount.toSignificant() as string)} ${trade?.inputAmount.currency.symbol}`, tokenA: trade?.inputAmount.currency.wrapped.address as Address, tokenB: trade?.outputAmount.currency.wrapped.address as Address, type: TransactionType.SWAP