diff --git a/apps/main/src/dex/components/PagePool/Swap/index.tsx b/apps/main/src/dex/components/PagePool/Swap/index.tsx index 208ba4efd0..3e4577ece2 100644 --- a/apps/main/src/dex/components/PagePool/Swap/index.tsx +++ b/apps/main/src/dex/components/PagePool/Swap/index.tsx @@ -75,6 +75,7 @@ const Swap = ({ const hasRouter = useStore((state) => state.hasRouter) const isMaxLoading = useStore((state) => state.poolSwap.isMaxLoading) const isPageVisible = useLayoutStore((state) => state.isPageVisible) + const fetchUserPoolList = useStore((state) => state.user.fetchUserPoolList) const fetchUserPoolInfo = useStore((state) => state.user.fetchUserPoolInfo) const fetchStepApprove = useStore((state) => state.poolSwap.fetchStepApprove) const fetchStepSwap = useStore((state) => state.poolSwap.fetchStepSwap) @@ -269,8 +270,16 @@ const Swap = ({ // get user balances useEffect(() => { - if (curve && poolId && haveSigner && (isUndefined(userFromBalance) || isUndefined(userToBalance))) { - void fetchUserPoolInfo(curve, poolId, true) + if ( + curve && + !curve.isNoRPC && + poolId && + haveSigner && + (isUndefined(userFromBalance) || isUndefined(userToBalance)) + ) { + void fetchUserPoolList(curve).then(() => { + void fetchUserPoolInfo(curve, poolId, true) + }) } // eslint-disable-next-line react-hooks/exhaustive-deps }, [chainId, poolId, haveSigner, userFromBalance, userToBalance]) diff --git a/apps/main/src/dex/components/PagePool/index.tsx b/apps/main/src/dex/components/PagePool/index.tsx index a56d89bc3b..bb11cef634 100644 --- a/apps/main/src/dex/components/PagePool/index.tsx +++ b/apps/main/src/dex/components/PagePool/index.tsx @@ -81,6 +81,7 @@ const Transfer = (pageTransferProps: PageTransferProps) => { const currencyReserves = useStore((state) => state.pools.currencyReserves[chainIdPoolId]) const isPageVisible = useLayoutStore((state) => state.isPageVisible) const isMdUp = useLayoutStore((state) => state.isMdUp) + const fetchUserPoolList = useStore((state) => state.user.fetchUserPoolList) const fetchUserPoolInfo = useStore((state) => state.user.fetchUserPoolInfo) const fetchPoolStats = useStore((state) => state.pools.fetchPoolStats) const setPoolIsWrapped = useStore((state) => state.pools.setPoolIsWrapped) @@ -166,10 +167,12 @@ const Transfer = (pageTransferProps: PageTransferProps) => { // fetch user pool info useEffect(() => { - if (curve && poolId && signerAddress) { - void fetchUserPoolInfo(curve, poolId) + if (curve && !curve.isNoRPC && poolId && signerAddress) { + void fetchUserPoolList(curve).then(() => { + void fetchUserPoolInfo(curve, poolId) + }) } - }, [rChainId, poolId, signerAddress, curve, fetchUserPoolInfo]) + }, [rChainId, poolId, signerAddress, curve, fetchUserPoolInfo, fetchUserPoolList]) const isRewardsDistributor = useMemo( () => diff --git a/apps/main/src/dex/store/createUserSlice.ts b/apps/main/src/dex/store/createUserSlice.ts index 97615f97df..4d19cc4d46 100644 --- a/apps/main/src/dex/store/createUserSlice.ts +++ b/apps/main/src/dex/store/createUserSlice.ts @@ -151,6 +151,7 @@ const createUserSlice = (set: SetState, get: GetState): UserSlice return fetchedWalletBalances } catch (error) { get()[sliceKey].setStateByKey('error', 'error-get-pool-wallet-balances') + get()[sliceKey].setStateByKey('walletBalancesLoading', false) return fetchedWalletBalances } },