From 6a8a0da52372e227434920e7e4e0b21d4c367e30 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Sat, 7 Sep 2024 16:22:46 -0400 Subject: [PATCH] Only pass message params to limits if message is defined --- api/suggested-fees.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/api/suggested-fees.ts b/api/suggested-fees.ts index a2febe790..f69430af7 100644 --- a/api/suggested-fees.ts +++ b/api/suggested-fees.ts @@ -89,7 +89,8 @@ const handler = async ( relayer ??= getDefaultRelayerAddress(destinationChainId, inputToken.symbol); recipient ??= DEFAULT_SIMULATED_RECIPIENT_ADDRESS; - if (sdk.utils.isDefined(message)) { + const depositWithMessage = sdk.utils.isDefined(message); + if (depositWithMessage) { validateDepositMessage( recipient, destinationChainId, @@ -150,9 +151,6 @@ const handler = async ( ENABLED_ROUTES.acrossConfigStoreAddress, provider ); - const baseCurrency = sdk.utils - .getNativeTokenSymbol(destinationChainId) - .toLowerCase(); // Aggregate multiple calls into a single multicall to decrease // opportunities for RPC calls to be delayed. @@ -190,10 +188,12 @@ const handler = async ( outputToken.address, computedOriginChainId, destinationChainId, - amountInput, - recipient, - relayer, - message + // Only pass in the following parameters if message is defined, otherwise leave them undefined so we are more + // likely to hit the /limits cache using the above parameters that are not specific to this deposit. + depositWithMessage ? amountInput : undefined, + depositWithMessage ? recipient : undefined, + depositWithMessage ? relayer : undefined, + depositWithMessage ? message : undefined ), ]); const { maxDeposit, maxDepositInstant, minDeposit, relayerFeeDetails } =