Skip to content

Commit

Permalink
fix: refetch v1 delegations after register to phase-2
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwbabylonlab committed Jan 8, 2025
1 parent 77fa49c commit 3b596c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/app/components/Delegations/Delegation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { RegistrationStartModal } from "@/app/components/Modals/RegistrationModa
import { SignModal } from "@/app/components/Modals/SignModal/SignModal";
import { ONE_MINUTE } from "@/app/constants";
import { useRegistrationService } from "@/app/hooks/services/useRegistrationService";
import { useHealthCheck } from "@/app/hooks/useHealthCheck";
import { useDelegationState } from "@/app/state/DelegationState";
import { useFinalityProviderState } from "@/app/state/FinalityProviderState";
import {
Expand Down Expand Up @@ -68,7 +67,6 @@ export const Delegation: React.FC<DelegationProps> = ({

const { startTimestamp } = stakingTx;
const [currentTime, setCurrentTime] = useState(Date.now());
const { isApiNormal, isGeoBlocked } = useHealthCheck();
const {
processing,
registrationStep: step,
Expand Down
5 changes: 5 additions & 0 deletions src/app/hooks/services/useRegistrationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { DelegationV2StakingState as DelegationState } from "@/app/types/delegat
import { ErrorState } from "@/app/types/errors";
import { retry } from "@/utils";

import { useDelegations } from "../client/api/useDelegations";

import { SigningStep, useTransactionService } from "./useTransactionService";

interface RegistrationData {
Expand All @@ -28,6 +30,7 @@ export function useRegistrationService() {
selectedDelegation,
resetRegistration: reset,
} = useDelegationState();
const { refetch: refetchV1Delegations } = useDelegations();
const { transitionPhase1Delegation } = useTransactionService();
const { addDelegation } = useDelegationV2State();
const { showError } = useError();
Expand Down Expand Up @@ -85,6 +88,7 @@ export function useRegistrationService() {
);
if (delegation) {
setStep("registration-verified");
refetchV1Delegations();
}
setProcessing(false);
} catch (error: any) {
Expand All @@ -104,6 +108,7 @@ export function useRegistrationService() {
showError,
selectedDelegation,
addDelegation,
refetchV1Delegations,
]);

return { registerPhase1Delegation };
Expand Down

0 comments on commit 3b596c7

Please sign in to comment.