Skip to content

Commit

Permalink
refetch quote if a user selects a new assset to sell with a buy asset…
Browse files Browse the repository at this point in the history
… already selected (#5643)
  • Loading branch information
walmat committed Apr 19, 2024
1 parent e6e501a commit 99ba043
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/__swaps__/screens/Swap/hooks/useSwapInputsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,12 @@ export function useSwapInputsController({
if (!assetToBuy.value) {
handleOutputPress();
} else {
if (initialAmount > 0) {
isFetching.value = true;
isQuoteStale.value = 1;

runOnJS(handleInputAmountLogic)(initialAmount);
}
handleInputPress();
}
};
Expand All @@ -678,7 +684,6 @@ export function useSwapInputsController({
runOnUI(updateValues)();

const inputAmount = Number(inputValues.value.inputAmount);
// TODO: Trigger a quote refetch here.
if (assetToSell.value && assetToSellPrice.value) {
if (inputAmount > 0) {
isFetching.value = true;
Expand Down
1 change: 1 addition & 0 deletions src/__swaps__/utils/swaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export const DEFAULT_SLIPPAGE_BIPS = {
[ChainId.zora]: 200,
[ChainId.arbitrum]: 200,
[ChainId.avalanche]: 200,
[ChainId.blast]: 200,
};

export const slippageInBipsToString = (slippageInBips: number) => (slippageInBips / 100).toString();
Expand Down

0 comments on commit 99ba043

Please sign in to comment.