Skip to content

Commit

Permalink
chore: call get detected wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchere committed Feb 11, 2024
1 parent 73f3544 commit b74967a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.2",
"version": "0.1.3",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ const defaultOptions: UseCardanoWalletOptions = {
// prefetchUtxosInterval: null,
};

type ReturnVal = Omit<State, 'connect'> & {
type ReturnVal = Omit<State, 'connect' | 'getDetectedWallets'> & {
connect: (walletName: WalletName) => Promise<void>;
};

const useCardanoWallet = ({
autoConnect = true,
localStorageKey = 'cardano-wallet-name',
}: UseCardanoWalletOptions = defaultOptions): ReturnVal => {
const { connect: connectWithStore, ...rest } = useStore();
const { connect: connectWithStore, getDetectedWallets, ...rest } = useStore();

useEffect(() => {
getDetectedWallets();
}, [getDetectedWallets]);

useEffect(() => {
// Check localStorage in case we are in SSR
Expand Down
1 change: 1 addition & 0 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type State = {
network: null | NetworkId;

connect: (walletName: WalletName, localStorageKey: string) => Promise<void>;
getDetectedWallets: () => void;
disconnect: () => void;
refetchBalance: () => Promise<void>;
};
Expand Down

0 comments on commit b74967a

Please sign in to comment.