fix: key generation error

This commit is contained in:
Wagalidoom
2025-08-27 19:54:05 +02:00
parent df73ec40d5
commit a58fca154d
3 changed files with 6 additions and 7 deletions

View File

@@ -1,6 +1,4 @@
import { Dispatch, SetStateAction, createContext, useContext, useState } from "react";
import { Network, NetworkConfig } from "./types";
import { GlobalContext } from "./GlobalContext";
import { Dispatch, SetStateAction, createContext, useState } from "react";
interface KeyCreationContextType {
folderLocation: string;
@@ -52,7 +50,6 @@ const KeyCreationContextWrapper = ({ children }: { children: React.ReactNode}) =
const [password, setPassword] = useState<string>("");
const [withdrawalAddress, setWithdrawalAddress] = useState<string>("");
const [compounding, setCompounding] = useState<boolean>(false);
const { network } = useContext(GlobalContext);
return (
<KeyCreationContext.Provider value={{
@@ -64,7 +61,7 @@ const KeyCreationContextWrapper = ({ children }: { children: React.ReactNode}) =
setMnemonic,
numberOfKeys,
setNumberOfKeys,
amount: amount / NetworkConfig[network].multiplier,
amount: amount,
setAmount,
password,
setPassword,

View File

@@ -23,6 +23,7 @@ import {
} from "../constants";
import { GlobalContext } from "../GlobalContext";
import { KeyCreationContext } from "../KeyCreationContext";
import { NetworkConfig } from "../types";
/**
* Form to provide number of keys, index, password, and optional withdrawal address necessary to
@@ -64,7 +65,7 @@ const ConfigureValidatorKeys = () => {
const [inputIndex, setInputIndex] = useState(index);
const [inputIndexError, setInputIndexError] = useState(false);
const [inputAmount, setInputAmount] = useState(amount);
const [inputAmount, setInputAmount] = useState(amount / NetworkConfig[network].multiplier);
const [inputAmountError, setInputAmountError] = useState(false);
const [inputPassword, setInputPassword] = useState(password);

View File

@@ -13,6 +13,7 @@ import {
} from "../constants";
import { GlobalContext } from "../GlobalContext";
import { KeyCreationContext } from "../KeyCreationContext";
import { NetworkConfig } from "../types";
/**
* Allows the user to select a destination folder for the validator keys.
@@ -61,7 +62,7 @@ const CreateValidatorKeys = () => {
}
// Convert user provided amount to integer representation of gwei
const gweiAmount = parseInt((amount * ETH_TO_GWEI).toString());
const gweiAmount = parseInt((amount * NetworkConfig[network].multiplier * ETH_TO_GWEI).toString());
window.eth2Deposit.generateKeys(
mnemonic,