Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit 5f62499

Browse files
Fix gnosis balance fetching (#90)
1 parent 77e3070 commit 5f62499

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/hooks/async/wallet.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { SupportedChainId } from "../../constants/chain";
22
import { useThirdwebConfigContext } from "../../contexts/thirdweb-config";
33
import { ContractAddress } from "../../types";
44
import { cacheKeys } from "../../utils/cache-keys";
5+
import { useAddress } from "../useAddress";
56
import { useChainId } from "../useChainId";
67
import { useSigner } from "../useSigner";
78
import { UserWallet } from "@thirdweb-dev/sdk/dist/browser";
@@ -19,6 +20,7 @@ export function useBalance(tokenAddress?: ContractAddress) {
1920
const { rpcUrlMap } = useThirdwebConfigContext();
2021
const chainId = useChainId() as SupportedChainId;
2122
const signer = useSigner();
23+
const walletAddress = useAddress();
2224

2325
const walletSDK = useMemo(() => {
2426
if (signer) {
@@ -32,9 +34,6 @@ export function useBalance(tokenAddress?: ContractAddress) {
3234
return undefined;
3335
}, [signer, chainId]);
3436

35-
// this is ugly but it works
36-
const walletAddress = (walletSDK as any)?.connection?.signer?._address;
37-
3837
const cacheKey = useMemo(() => {
3938
return cacheKeys.wallet.balance(chainId, walletAddress, tokenAddress);
4039
}, [chainId, tokenAddress, walletAddress]);

0 commit comments

Comments
 (0)