From b74967a9fff2826a04a4a1a5a056c96b3d59f2be Mon Sep 17 00:00:00 2001 From: MartinSchere Date: Sun, 11 Feb 2024 14:48:27 +0100 Subject: [PATCH] chore: call get detected wallets --- package.json | 2 +- src/index.ts | 8 ++++++-- src/store/index.ts | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8ed1336..bf906fa 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.1.2", + "version": "0.1.3", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/src/index.ts b/src/index.ts index 057a229..64a2926 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,7 +31,7 @@ const defaultOptions: UseCardanoWalletOptions = { // prefetchUtxosInterval: null, }; -type ReturnVal = Omit & { +type ReturnVal = Omit & { connect: (walletName: WalletName) => Promise; }; @@ -39,7 +39,11 @@ 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 diff --git a/src/store/index.ts b/src/store/index.ts index dc210f1..795449c 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -35,6 +35,7 @@ export type State = { network: null | NetworkId; connect: (walletName: WalletName, localStorageKey: string) => Promise; + getDetectedWallets: () => void; disconnect: () => void; refetchBalance: () => Promise; };