diff --git a/src/hooks/useBridgeFees.ts b/src/hooks/useBridgeFees.ts index 7cc54c444..ca673b643 100644 --- a/src/hooks/useBridgeFees.ts +++ b/src/hooks/useBridgeFees.ts @@ -20,12 +20,7 @@ export function useBridgeFees( ) { const { block } = useBlock(toChainId); const enabledQuery = - !!toChainId && - !!fromChainId && - !!block && - !!tokenSymbol && - amount.gt(0) && - !!recipientAddress; + !!toChainId && !!fromChainId && !!block && !!tokenSymbol && amount.gt(0); const queryKey = enabledQuery ? bridgeFeesQueryKey( tokenSymbol, @@ -44,7 +39,7 @@ export function useBridgeFees( blockTimestamp: block!.timestamp, toChainId: toChainId!, fromChainId: fromChainId!, - recipientAddress: recipientAddress!, + recipientAddress, }); }, { diff --git a/src/utils/bridge.ts b/src/utils/bridge.ts index 6976f8a7b..904f11fd2 100644 --- a/src/utils/bridge.ts +++ b/src/utils/bridge.ts @@ -32,7 +32,7 @@ type GetBridgeFeesArgs = { blockTimestamp: number; fromChainId: ChainId; toChainId: ChainId; - recipientAddress: string; + recipientAddress?: string; }; export type GetBridgeFeesResult = BridgeFees & { diff --git a/src/utils/serverless-api/mocked/coingecko.mocked.ts b/src/utils/serverless-api/mocked/coingecko.mocked.ts index 00d069f88..4da59c865 100644 --- a/src/utils/serverless-api/mocked/coingecko.mocked.ts +++ b/src/utils/serverless-api/mocked/coingecko.mocked.ts @@ -7,6 +7,6 @@ export async function coingeckoMockedApiCall( price: ethers.BigNumber; }> { return { - price: ethers.utils.parseEther(String("0.1")), + price: ethers.utils.parseEther(String("0.17")), }; } diff --git a/src/utils/serverless-api/mocked/suggested-fees.mocked.ts b/src/utils/serverless-api/mocked/suggested-fees.mocked.ts index 5fa235e71..1f2693757 100644 --- a/src/utils/serverless-api/mocked/suggested-fees.mocked.ts +++ b/src/utils/serverless-api/mocked/suggested-fees.mocked.ts @@ -1,6 +1,7 @@ import { BigNumber, ethers } from "ethers"; -import { ChainId } from "utils/constants"; +import { ChainId, getTokenByAddress } from "utils/constants"; import { SuggestedApiFeeReturnType } from "../types"; +import { parseUnits } from "utils/format"; /** * Creates a mocked variant of the suggestedAPI Call @@ -15,24 +16,27 @@ export async function suggestedFeesMockedApiCall( _originToken: string, _toChainid: ChainId, _fromChainid: ChainId, - _recipientAddress: string + _recipientAddress?: string ): Promise { + const token = getTokenByAddress(_originToken); + const decimals = token?.decimals ?? 18; + return { relayerFee: { pct: BigNumber.from("1"), - total: BigNumber.from("1"), + total: parseUnits("0.5", decimals), }, relayerCapitalFee: { pct: BigNumber.from("1"), - total: BigNumber.from("1"), + total: parseUnits("0.5", decimals), }, relayerGasFee: { pct: BigNumber.from("1"), - total: BigNumber.from("1"), + total: parseUnits("0.5", decimals), }, lpFee: { pct: BigNumber.from("1"), - total: BigNumber.from("1"), + total: parseUnits("0.5", decimals), }, isAmountTooLow: false, quoteBlock: BigNumber.from("1"), diff --git a/src/utils/serverless-api/prod/suggested-fees.prod.ts b/src/utils/serverless-api/prod/suggested-fees.prod.ts index 422afb17e..e966cf550 100644 --- a/src/utils/serverless-api/prod/suggested-fees.prod.ts +++ b/src/utils/serverless-api/prod/suggested-fees.prod.ts @@ -16,14 +16,14 @@ export async function suggestedFeesApiCall( originToken: string, toChainid: ChainId, fromChainid: ChainId, - recipientAddress: string + recipientAddress?: string ): Promise { const response = await axios.get(`/api/suggested-fees`, { params: { token: originToken, destinationChainId: toChainid, originChainId: fromChainid, - recipientAddress, + recipient: recipientAddress, amount: amount.toString(), skipAmountLimit: true, }, diff --git a/src/utils/serverless-api/types.ts b/src/utils/serverless-api/types.ts index f9c72f9db..f26f77448 100644 --- a/src/utils/serverless-api/types.ts +++ b/src/utils/serverless-api/types.ts @@ -57,7 +57,7 @@ export type SuggestedApiFeeType = ( originToken: string, toChainid: ChainId, fromChainid: ChainId, - recipientAddress: string + recipientAddress?: string ) => Promise; export type RetrieveLinkedWalletType = (