Skip to content

Commit

Permalink
fix: only fetch accounts from connected wallets (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
tien authored Oct 15, 2024
1 parent 31af73e commit 9c9c6f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/ten-fishes-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reactive-dot/react": patch
---

Fixed an issue where accounts were being fetched from wallets that were not connected.
4 changes: 2 additions & 2 deletions packages/react/src/stores/accounts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { withAtomFamilyErrorCatcher } from "../utils/jotai.js";
import { chainSpecDataAtomFamily } from "./client.js";
import { walletsAtom } from "./wallets.js";
import { connectedWalletsAtom } from "./wallets.js";
import { getAccounts, type ChainId, type Config } from "@reactive-dot/core";
import type { WalletAccount } from "@reactive-dot/core/wallets.js";
import type { Atom } from "jotai";
Expand All @@ -17,7 +17,7 @@ export const accountsAtom = atomFamily(
atomWithObservable,
)((get) =>
getAccounts(
get(walletsAtom(param.config)),
get(connectedWalletsAtom(param.config)),
param.chainId === undefined
? undefined
: // @ts-expect-error `chainId` will never be undefined
Expand Down

0 comments on commit 9c9c6f3

Please sign in to comment.