diff --git a/dapp/src/hooks/useRequestBitcoinAccount.ts b/dapp/src/hooks/useRequestBitcoinAccount.ts index 9d31aced8..3f7a0d120 100644 --- a/dapp/src/hooks/useRequestBitcoinAccount.ts +++ b/dapp/src/hooks/useRequestBitcoinAccount.ts @@ -1,20 +1,8 @@ -import { Account, WalletAPIClient } from "@ledgerhq/wallet-api-client" import { useRequestAccount } from "@ledgerhq/wallet-api-client-react" import { useCallback, useContext, useEffect } from "react" import { LedgerLiveAppContext } from "../contexts/LedgerLiveAppContext" import { CURRENCY_ID_BITCOIN } from "../constants" - -type UseRequestAccount = { - pending: boolean - account: Account | null - error: unknown -} - -type RequestAccountParams = Parameters - -type UseRequestAccountReturn = { - requestAccount: (...params: RequestAccountParams) => Promise -} & UseRequestAccount +import { UseRequestAccountReturn } from "../types" export function useRequestBitcoinAccount(): UseRequestAccountReturn { const { setBtcAccount } = useContext(LedgerLiveAppContext) diff --git a/dapp/src/hooks/useRequestEthereumAccount.ts b/dapp/src/hooks/useRequestEthereumAccount.ts index a9e7bc929..b3c674d4c 100644 --- a/dapp/src/hooks/useRequestEthereumAccount.ts +++ b/dapp/src/hooks/useRequestEthereumAccount.ts @@ -1,20 +1,8 @@ -import { Account, WalletAPIClient } from "@ledgerhq/wallet-api-client" import { useRequestAccount } from "@ledgerhq/wallet-api-client-react" import { useCallback, useContext, useEffect } from "react" import { LedgerLiveAppContext } from "../contexts/LedgerLiveAppContext" import { CURRENCY_ID_ETHEREUM } from "../constants" - -type UseRequestAccount = { - pending: boolean - account: Account | null - error: unknown -} - -type RequestAccountParams = Parameters - -type UseRequestAccountReturn = { - requestAccount: (...params: RequestAccountParams) => Promise -} & UseRequestAccount +import { UseRequestAccountReturn } from "../types" export function useRequestEthereumAccount(): UseRequestAccountReturn { const { setEthAccount } = useContext(LedgerLiveAppContext) diff --git a/dapp/src/types/index.ts b/dapp/src/types/index.ts new file mode 100644 index 000000000..96cd9d44f --- /dev/null +++ b/dapp/src/types/index.ts @@ -0,0 +1 @@ +export * from "./ledger-live-app" diff --git a/dapp/src/types/ledger-live-app.ts b/dapp/src/types/ledger-live-app.ts new file mode 100644 index 000000000..84dc9fec8 --- /dev/null +++ b/dapp/src/types/ledger-live-app.ts @@ -0,0 +1,13 @@ +import { Account, WalletAPIClient } from "@ledgerhq/wallet-api-client" + +type UseRequestAccount = { + pending: boolean + account: Account | null + error: unknown +} + +type RequestAccountParams = Parameters + +export type UseRequestAccountReturn = { + requestAccount: (...params: RequestAccountParams) => Promise +} & UseRequestAccount