Skip to content

Commit 1eae4bc

Browse files
committed
fix: fix partian and full validator withdrawal
1 parent 6e795e9 commit 1eae4bc

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

features/validators/modals/withdraw-to-vault-modal/content/form/form.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export const WithdrawToVaultModalForm: FC<FormProps> = ({
8181
amount: isPartial ? null : 0n,
8282
index,
8383
pubkey,
84+
validatorWithdrawalFee,
8485
},
8586
disabled:
8687
!isDappActive ||
@@ -102,8 +103,9 @@ export const WithdrawToVaultModalForm: FC<FormProps> = ({
102103
amount: isPartial ? null : 0n,
103104
index,
104105
pubkey,
106+
validatorWithdrawalFee,
105107
});
106-
}, [index, isPartial, pubkey, reset]);
108+
}, [index, isPartial, pubkey, reset, validatorWithdrawalFee]);
107109

108110
const onSubmit = useCallback(
109111
async (formData: WithdrawalFormValidatedValues) => {

features/validators/modals/withdraw-to-vault-modal/hooks/use-withdrawal-to-vault.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ export const useWithdrawalToVault = () => {
2929
const { address } = useDappStatus();
3030

3131
const withdrawToVault = useCallback(
32-
async ({ amount, index, pubkey }: WithdrawalFormValidatedValues) => {
32+
async ({
33+
amount,
34+
index,
35+
pubkey,
36+
validatorWithdrawalFee,
37+
}: WithdrawalFormValidatedValues) => {
3338
invariant(activeVault, '[useWithdrawalToVault] activeVault is undefined');
3439
invariant(
3540
!disabled,
@@ -54,8 +59,10 @@ export const useWithdrawalToVault = () => {
5459
[amountInGwei],
5560
address,
5661
]),
62+
value: validatorWithdrawalFee,
5763
loadingActionText: mainActionLoadingText,
5864
});
65+
5966
return calls;
6067
};
6168

features/validators/modals/withdraw-to-vault-modal/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ export type WithdrawalFormFieldValues = {
1515
amount: WithdrawalFormValidatedValues['amount'] | null;
1616
index: WithdrawalFormValidatedValues['index'];
1717
pubkey: WithdrawalFormValidatedValues['pubkey'];
18+
validatorWithdrawalFee: WithdrawalFormValidatedValues['validatorWithdrawalFee'];
1819
};

features/validators/modals/withdraw-to-vault-modal/validation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const withdrawalFormSchema = ({
3333
: z.literal(0n),
3434
index: z.number(),
3535
pubkey: pubkeySchema,
36+
validatorWithdrawalFee: z.bigint(),
3637
});
3738
};
3839

0 commit comments

Comments
 (0)