Skip to content

Commit

Permalink
fix(Swap): add missing scenario for re-computing trade obj (#1464)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao authored Jul 18, 2023
1 parent 52ffd0d commit 013f0e0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pages/Swap/components/SwapForm/SwapForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ const SwapForm = ({
},
onSuccess: onSwap,
onFeeChange: (data) => {
// if input currency is being used for fees
if (data.isEqualToActionCurrency) {
const previousFeeData = transaction.fee.data;

// checks previous fee because it could be affecting the trade amounts
// only computes another trade when fee currency is equal to input currency
if (previousFeeData?.isEqualToActionCurrency || data.isEqualToActionCurrency) {
handleChangeTrade(data);
}
}
Expand Down

2 comments on commit 013f0e0

@vercel
Copy link

@vercel vercel bot commented on 013f0e0 Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 013f0e0 Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.