refetch wallet balance on wallet swap
This commit is contained in:
parent
8829719e67
commit
605637a9de
|
@ -31,7 +31,7 @@ const set = mangoStore.getState().set
|
|||
const SwapForm = () => {
|
||||
const { t } = useTranslation(['common', 'swap', 'trade'])
|
||||
const groupLoaded = mangoStore((s) => s.groupLoaded)
|
||||
const { mangoAccountAddress } = useMangoAccount()
|
||||
const { mangoAccountAddress, initialLoad } = useMangoAccount()
|
||||
const { connected } = useWallet()
|
||||
const { query } = useRouter()
|
||||
const [showTokenSelect, setShowTokenSelect] =
|
||||
|
@ -55,10 +55,10 @@ const SwapForm = () => {
|
|||
|
||||
// enable wallet swap when connected and no mango account
|
||||
useEffect(() => {
|
||||
if (connected && !mangoAccountAddress) {
|
||||
if (connected && !mangoAccountAddress && !initialLoad) {
|
||||
setWalletSwap(true)
|
||||
}
|
||||
}, [connected, mangoAccountAddress])
|
||||
}, [connected, mangoAccountAddress, initialLoad])
|
||||
|
||||
// setup swap from url query
|
||||
useEffect(() => {
|
||||
|
|
|
@ -256,6 +256,7 @@ const SwapReviewRouteInfo = ({
|
|||
|
||||
const onWalletSwap = useCallback(async () => {
|
||||
if (!selectedRoute || !inputBank || !outputBank || !wallet.publicKey) return
|
||||
const actions = mangoStore.getState().actions
|
||||
const client = mangoStore.getState().client
|
||||
const connection = mangoStore.getState().connection
|
||||
setSubmitting(true)
|
||||
|
@ -276,6 +277,7 @@ const SwapReviewRouteInfo = ({
|
|||
type: 'success',
|
||||
txid: tx.signature,
|
||||
})
|
||||
actions.fetchWalletTokens(wallet.publicKey)
|
||||
} catch (e) {
|
||||
console.log('error swapping wallet tokens', e)
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue