diff --git a/src/app/components/Modals/UnbondWithdrawModal.tsx b/src/app/components/Modals/UnbondWithdrawModal.tsx index d77cfc64..63aeb715 100644 --- a/src/app/components/Modals/UnbondWithdrawModal.tsx +++ b/src/app/components/Modals/UnbondWithdrawModal.tsx @@ -1,10 +1,9 @@ import { IoMdClose } from "react-icons/io"; -import { useGlobalParams } from "@/app/context/api/GlobalParamsProvider"; +import { useVersionInfo } from "@/app/context/api/VersionInfo"; import { getNetworkConfig } from "@/config/network.config"; import { blocksToDisplayTime } from "@/utils/blocksToDisplayTime"; import { satoshiToBtc } from "@/utils/btcConversions"; -import { getCurrentGlobalParamsVersion } from "@/utils/globalParams"; import { maxDecimals } from "@/utils/maxDecimals"; import { LoadingView } from "../Loading/Loading"; @@ -33,17 +32,9 @@ export const UnbondWithdrawModal: React.FC = ({ awaitingWalletResponse, }) => { const { coinName, networkName } = getNetworkConfig(); - const { data: allGlobalParamsVersions } = useGlobalParams(); + const versionInfo = useVersionInfo(); - const getGlobalParamsForDelegation = (startHeight: number) => { - const { currentVersion } = getCurrentGlobalParamsVersion( - startHeight, - allGlobalParamsVersions || [], - ); - return currentVersion; - }; - - const globalParams = getGlobalParamsForDelegation(delegationHeight); + const globalParams = versionInfo?.currentVersion; const unbondingFeeSat = globalParams?.unbondingFeeSat || 0; const unbondingTimeBlocks = globalParams?.unbondingTime || 0; diff --git a/src/app/hooks/useVersions.ts b/src/app/hooks/useVersions.ts index e076a867..a1893072 100644 --- a/src/app/hooks/useVersions.ts +++ b/src/app/hooks/useVersions.ts @@ -1,11 +1,11 @@ import { getGlobalParams } from "@/app/api/getGlobalParams"; import { useAPIQuery } from "@/app/hooks/useApi"; -export const VARSIONS_KEY = "VARSIONS"; +export const VERSIONS_KEY = "VERSIONS"; export function useVersions({ enabled = true }: { enabled?: boolean } = {}) { const data = useAPIQuery({ - queryKey: [VARSIONS_KEY], + queryKey: [VERSIONS_KEY], queryFn: getGlobalParams, enabled, });