Skip to content

Commit

Permalink
✨Updating balances after swap
Browse files Browse the repository at this point in the history
  • Loading branch information
MattPoblete committed Sep 4, 2024
1 parent c530bc1 commit a233a75
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Swap/SwapComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { requiresTrustline } from 'helpers/stellar';
import { relevantTokensType } from 'hooks';
import { useToken } from 'hooks/tokens/useToken';
import useGetNativeTokenBalance from 'hooks/useGetNativeTokenBalance';
import { SuccessfullSwapResponse, useSwapCallback } from 'hooks/useSwapCallback';
import { useSwapCallback } from 'hooks/useSwapCallback';
import useSwapMainButton from 'hooks/useSwapMainButton';
import useSwapNetworkFees from 'hooks/useSwapNetworkFees';
import { TokenType } from 'interfaces';
Expand All @@ -37,7 +37,7 @@ import { opacify } from 'themes/utils';
import SwapCurrencyInputPanel from '../CurrencyInputPanel/SwapCurrencyInputPanel';
import SwapHeader from './SwapHeader';
import { ArrowWrapper, SwapWrapper } from './styleds';
import * as StellarSdk from '@stellar/stellar-sdk';
import useGetMyBalances from 'hooks/useGetMyBalances';

export const SwapSection = styled('div')(({ theme }) => ({
position: 'relative',
Expand Down Expand Up @@ -116,6 +116,7 @@ export function SwapComponent({
handleDoSwap?: (setSwapState: (value: SetStateAction<SwapStateProps>) => void) => void;
}) {
const sorobanContext = useSorobanReact();
const { refetch } = useGetMyBalances()
const { SnackbarContext } = useContext(AppContext);
const [showPriceImpactModal, setShowPriceImpactModal] = useState<boolean>(false);
const [txError, setTxError] = useState<boolean>(false);
Expand Down Expand Up @@ -300,6 +301,9 @@ export function SwapComponent({
...currentState,
showConfirm: false,
}));
}).finally(() => {
refetch()
nativeBalance.mutate()
});
};

Expand Down

0 comments on commit a233a75

Please sign in to comment.