We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 880b33a + 0ce39cb commit 163c50aCopy full SHA for 163c50a
1 file changed
lib/account-store.ts
@@ -1,4 +1,5 @@
1
import { create } from "zustand";
2
+import { persist } from "zustand/middleware";
3
4
export type AccountType = "eoa" | "safe";
5
@@ -12,10 +13,17 @@ interface AccountState {
12
13
setSelectedAccount: (account: Account | null) => void;
14
}
15
-export const useAccountStore = create<AccountState>((set) => ({
16
- selectedAccount: null,
17
- setSelectedAccount: (account) => set({ selectedAccount: account }),
18
-}));
+export const useAccountStore = create<AccountState>()(
+ persist(
+ (set) => ({
19
+ selectedAccount: null,
20
+ setSelectedAccount: (account) => set({ selectedAccount: account }),
21
+ }),
22
+ {
23
+ name: "selected-account-storage",
24
+ },
25
+ ),
26
+);
27
28
export function selectWalletAccount(address: string) {
29
useAccountStore.setState({
0 commit comments