Skip to content

Commit

Permalink
Fetch the deposits in interval
Browse files Browse the repository at this point in the history
This was accidentally removed during the merge.
  • Loading branch information
r-czajkowski committed May 29, 2024
1 parent 2820180 commit c8c8bbb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dapp/src/hooks/sdk/useInitDataFromSdk.ts
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)
}

0 comments on commit c8c8bbb

Please sign in to comment.