Skip to content

Commit

Permalink
fix: format currency title in swap and approve
Browse files Browse the repository at this point in the history
  • Loading branch information
damnnou committed Apr 17, 2024
1 parent 0df89a1 commit ab55ee7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/hooks/common/useApprove.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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";
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<Currency> | undefined, spender: Address) {
Expand Down Expand Up @@ -35,7 +35,7 @@ export function useApprove(amountToApprove: CurrencyAmount<Currency> | 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
}
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/swap/useSwapCallback.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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";
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";

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ab55ee7

Please sign in to comment.