diff --git a/src/app/context/mempool/BtcHeightProvider.tsx b/src/app/context/mempool/BtcHeightProvider.tsx deleted file mode 100644 index 20b06cd0..00000000 --- a/src/app/context/mempool/BtcHeightProvider.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { useQuery } from "@tanstack/react-query"; -import React, { ReactNode, createContext, useContext } from "react"; - -import { getTipHeight } from "@/utils/mempool_api"; - -interface BtcHeightProviderProps { - children: ReactNode; -} - -const BtcHeightContext = createContext(undefined); - -export const BtcHeightProvider: React.FC = ({ - children, -}) => { - const { data } = useQuery({ - queryKey: ["BTC_HEIGHT_MEMPOOL_API"], - queryFn: async () => getTipHeight(), - refetchInterval: 60000, // 1 minute - }); - - return ( - - {children} - - ); -}; - -/* - * BTC Height Context. Provides the current BTC height from the mempool API. - * Note: This value is for information display only. - * Not suppose to be used for staking or other critical operations. - */ -export const useBtcHeight = () => useContext(BtcHeightContext); diff --git a/src/app/hooks/useDelegations.ts b/src/app/hooks/useDelegations.ts index 3ecca66c..8668a8de 100644 --- a/src/app/hooks/useDelegations.ts +++ b/src/app/hooks/useDelegations.ts @@ -5,6 +5,7 @@ import { getDelegations, type PaginatedDelegations, } from "@/app/api/getDelegations"; +import { ONE_MINUTE } from "@/app/constants"; import { useError } from "@/app/context/Error/ErrorContext"; import { useWallet } from "@/app/context/wallet/WalletProvider"; import { ErrorState } from "@/app/types/errors"; @@ -24,7 +25,7 @@ export function useDelegations({ enabled = true }: { enabled?: boolean } = {}) { ? lastPage?.pagination?.next_key : null, initialPageParam: "", - refetchInterval: 60000, // 1 minute + refetchInterval: ONE_MINUTE, enabled: Boolean(publicKeyNoCoord) && enabled, select: (data) => { const flattenedData = data.pages.reduce( diff --git a/src/app/providers.tsx b/src/app/providers.tsx index 43632544..76ab2408 100644 --- a/src/app/providers.tsx +++ b/src/app/providers.tsx @@ -8,7 +8,6 @@ import React from "react"; import { ErrorProvider } from "./context/Error/ErrorContext"; import { StakingStatsProvider } from "./context/api/StakingStatsProvider"; -import { BtcHeightProvider } from "./context/mempool/BtcHeightProvider"; import { WalletProvider } from "./context/wallet/WalletProvider"; import { AppState } from "./state"; @@ -21,13 +20,11 @@ function Providers({ children }: React.PropsWithChildren) { - - - - {children} - - - + + + {children} + +