Skip to content

Commit

Permalink
Only pass message params to limits if message is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Sep 7, 2024
1 parent 8f299a4 commit 6a8a0da
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions api/suggested-fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 } =
Expand Down

0 comments on commit 6a8a0da

Please sign in to comment.