Skip to content

Commit

Permalink
fix: review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
totraev committed Oct 4, 2024
1 parent 35cc9c1 commit 4737aea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
15 changes: 3 additions & 12 deletions src/app/components/Modals/UnbondWithdrawModal.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -33,17 +32,9 @@ export const UnbondWithdrawModal: React.FC<PreviewModalProps> = ({
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;

Expand Down
4 changes: 2 additions & 2 deletions src/app/hooks/useVersions.ts
Original file line number Diff line number Diff line change
@@ -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,
});
Expand Down

0 comments on commit 4737aea

Please sign in to comment.