diff --git a/package.json b/package.json index e24aab2..868fa29 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.2.9", + "version": "0.2.10", "type": "module", "scripts": { "dev": "vite", diff --git a/src/components/TopBar/Wallet/InitialWalletView.tsx b/src/components/TopBar/Wallet/InitialWalletView.tsx index f15ad4f..a26a51c 100644 --- a/src/components/TopBar/Wallet/InitialWalletView.tsx +++ b/src/components/TopBar/Wallet/InitialWalletView.tsx @@ -12,7 +12,7 @@ import { import { styled } from '@mui/material/styles'; import CloseIcon from '@mui/icons-material/Close'; import LoopIcon from '@mui/icons-material/Loop'; -import { ReactElement, useState } from "react"; +import { ReactElement, useState, useEffect } from "react"; import { useNavigate, createSearchParams } from "react-router-dom"; import GhostStyledIcon from "../../Icon/GhostIcon"; @@ -105,7 +105,7 @@ const WalletTotalValue = ({ address, tokens }) => { ); }; -function InitialWalletView({ address, chainId, onClose }) { +function InitialWalletView({ isWalletOpen, address, chainId, onClose }) { const theme = useTheme(); const navigate = useNavigate(); const tokens = useWallet(chainId, address); @@ -122,6 +122,12 @@ function InitialWalletView({ address, chainId, onClose }) { onClose(); } + useEffect(() => { + if (isWalletOpen) { + Object.values(tokens ?? {}).forEach(token => token.refetch()); + } + }, [isWalletOpen, tokens]) + return ( diff --git a/src/components/TopBar/Wallet/Token.tsx b/src/components/TopBar/Wallet/Token.tsx index 72f8089..998dffb 100644 --- a/src/components/TopBar/Wallet/Token.tsx +++ b/src/components/TopBar/Wallet/Token.tsx @@ -192,6 +192,7 @@ export const useWallet = (chainId, userAddress) => { price: daiPrice, icons: ["GDAI"], externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/gDAI.svg", + refetch: daiRefetch, }, ftso: { symbol: ftsoSymbol, @@ -200,6 +201,7 @@ export const useWallet = (chainId, userAddress) => { price: ftsoPrice, icons: ["FTSO"], externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/eGHST.svg", + refetch: ftsoRefetch, }, stnk: { symbol: stnkSymbol, @@ -208,6 +210,7 @@ export const useWallet = (chainId, userAddress) => { price: stnkPrice, icons: ["STNK"], externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/sGHST.svg", + refetch: stnkRefetch, }, ghst: { symbol: ghstSymbol, @@ -216,6 +219,7 @@ export const useWallet = (chainId, userAddress) => { price: ghstPrice, icons: ["GHST"], externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/GHST.svg", + refetch: ghstRefetch, }, daiFtso: { isPool: true, @@ -225,6 +229,7 @@ export const useWallet = (chainId, userAddress) => { price: lpDaiFtsoPrice, icons: ["GDAI", "FTSO"], externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/uni-v2.svg", + refetch: lpDaiFtsoRefetch, } }; diff --git a/src/components/TopBar/Wallet/index.tsx b/src/components/TopBar/Wallet/index.tsx index 8dbcefa..76598dc 100644 --- a/src/components/TopBar/Wallet/index.tsx +++ b/src/components/TopBar/Wallet/index.tsx @@ -76,7 +76,7 @@ export function Wallet({ address, chainId, connect }) { onOpen={openWallet} onClose={closeWallet} > - + );