Function toWei

  • Converts a number to Wei.

    Returns

    The number in Wei.

    Throws

    Error if the number is invalid.

    Parameters

    • etherInput: string | number | bigint

      The number to convert to Wei.

    • unit: "noether" | "wei" | "kwei" | "Kwei" | "babbage" | "femtoether" | "mwei" | "Mwei" | "lovelace" | "picoether" | "gwei" | "Gwei" | "shannon" | "nanoether" | "nano" | "szabo" | "microether" | "micro" | "finney" | "milliether" | "milli" | "ether" | "kether" | "grand" | "mether" | "gether" | "tether"

      The unit to convert to, default ether.

    Returns bigint