Skip to content

Commit

Permalink
prevent quotes from the wrong type being passed to the wrong fn (#6436)
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobar79 authored and ibrahimtaveras00 committed Jan 31, 2025
1 parent d3485bb commit c17fbf3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/raps/actions/crosschainSwap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Signer } from '@ethersproject/abstract-signer';
import { CrosschainQuote, fillCrosschainQuote } from '@rainbow-me/swaps';
import { CrosschainQuote, fillCrosschainQuote, SwapType } from '@rainbow-me/swaps';
import { Address } from 'viem';
import { estimateGasWithPadding, getProvider, toHex } from '@/handlers/web3';
import { add } from '@/helpers/utilities';
Expand Down Expand Up @@ -155,7 +155,7 @@ export const executeCrosschainSwap = async ({
wallet: Signer;
referrer?: ReferrerType;
}) => {
if (!wallet || !quote) return null;
if (!wallet || !quote || quote.swapType !== SwapType.crossChain) return null;

const transactionParams = {
gasLimit: toHex(gasLimit) || undefined,
Expand Down
3 changes: 2 additions & 1 deletion src/raps/actions/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,10 @@ export const executeSwap = async ({
} else if (quote.swapType === SwapType.unwrap) {
return unwrapNativeAsset(quote.sellAmount, wallet, getWrappedAssetAddress(quote), transactionParams);
// Swap
} else {
} else if (quote.swapType === SwapType.normal) {
return fillQuote(quote, transactionParams, wallet, permit, chainId as number, REFERRER);
}
return null;
};

export const swap = async ({
Expand Down

0 comments on commit c17fbf3

Please sign in to comment.