-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This was accidentally removed during the merge.
- Loading branch information
1 parent
2820180
commit c8c8bbb
Showing
1 changed file
with
8 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
import { useEffect } from "react" | ||
import { useInterval } from "@chakra-ui/react" | ||
import { ONE_MINUTE_IN_SECONDS, ONE_SEC_IN_MILLISECONDS } from "#/constants" | ||
import { logPromiseFailure } from "#/utils" | ||
import { useWalletContext } from "../useWalletContext" | ||
import { useFetchBTCBalance } from "./useFetchBTCBalance" | ||
import { useFetchMinDepositAmount } from "./useFetchMinDepositAmount" | ||
import { useFetchDeposits } from "./useFetchDeposits" | ||
|
||
const INTERVAL_TIME = ONE_SEC_IN_MILLISECONDS * ONE_MINUTE_IN_SECONDS * 30 | ||
|
||
export function useInitDataFromSdk() { | ||
const { btcAccount } = useWalletContext() | ||
const fetchDeposits = useFetchDeposits() | ||
|
||
useFetchBTCBalance() | ||
useFetchMinDepositAmount() | ||
|
||
useEffect(() => { | ||
if (btcAccount) { | ||
logPromiseFailure(fetchDeposits()) | ||
} | ||
}, [btcAccount, fetchDeposits]) | ||
|
||
useFetchBTCBalance() | ||
useFetchMinDepositAmount() | ||
useInterval(() => logPromiseFailure(fetchDeposits()), INTERVAL_TIME) | ||
} |