diff --git a/dapp/src/hooks/orangeKit/useConnector.ts b/dapp/src/hooks/orangeKit/useConnector.ts index b533ed648..6b1c494a3 100644 --- a/dapp/src/hooks/orangeKit/useConnector.ts +++ b/dapp/src/hooks/orangeKit/useConnector.ts @@ -2,19 +2,18 @@ import { useMemo } from "react" import { useAccount } from "wagmi" import { orangeKit } from "#/utils" import { OrangeKitConnector } from "#/types" +import useWalletAddress from "../store/useWalletAddress" type UseConnectorReturn = OrangeKitConnector | undefined export function useConnector(): UseConnectorReturn { - const { connector, status } = useAccount() + const { connector } = useAccount() + const address = useWalletAddress() return useMemo(() => { - if ( - orangeKit.isOrangeKitConnector(connector) && - orangeKit.isConnectedStatus(status) - ) + if (address && orangeKit.isOrangeKitConnector(connector)) return orangeKit.typeConversionToOrangeKitConnector(connector) return undefined - }, [connector, status]) + }, [connector, address]) } diff --git a/dapp/src/hooks/sdk/useInitializeAcreSdk.ts b/dapp/src/hooks/sdk/useInitializeAcreSdk.ts index 05cd359b8..a6974bcd5 100644 --- a/dapp/src/hooks/sdk/useInitializeAcreSdk.ts +++ b/dapp/src/hooks/sdk/useInitializeAcreSdk.ts @@ -3,12 +3,10 @@ import { logPromiseFailure } from "#/utils" import { useAcreContext } from "#/acre-react/hooks" import { AcreBitcoinProvider } from "@acre-btc/sdk" import { useBitcoinProvider } from "../orangeKit/useBitcoinProvider" -import { useWallet } from "../useWallet" export function useInitializeAcreSdk() { const { init } = useAcreContext() const bitcoinProvider = useBitcoinProvider() - const { address } = useWallet() useEffect(() => { const initSDK = async (provider?: AcreBitcoinProvider) => { @@ -16,5 +14,5 @@ export function useInitializeAcreSdk() { } logPromiseFailure(initSDK(bitcoinProvider)) - }, [init, bitcoinProvider, address]) + }, [init, bitcoinProvider]) }