@mysten/dapp-kit
Version:
A collection of React hooks and components for interacting with the Sui blockchain and wallets.
28 lines (24 loc) • 690 B
JavaScript
// src/hooks/wallet/useWalletStore.ts
import { useContext } from "react";
import { useStore } from "zustand";
// src/contexts/walletContext.ts
import { createContext } from "react";
var WalletContext = createContext(null);
// src/hooks/wallet/useWalletStore.ts
function useWalletStore(selector) {
const store = useContext(WalletContext);
if (!store) {
throw new Error(
"Could not find WalletContext. Ensure that you have set up the WalletProvider."
);
}
return useStore(store, selector);
}
// src/hooks/wallet/useWallets.ts
function useWallets() {
return useWalletStore((state) => state.wallets);
}
export {
useWallets
};
//# sourceMappingURL=useWallets.js.map