Function fromWei

  • Converts a number from Wei to a string.

    Returns

    The string representation of the number.

    Throws

    Error if the number is invalid.

    Parameters

    • weiInput: string | number | bigint

      The number to convert from 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.

    • Optional optionsInput: {
          commify?: boolean;
          pad?: boolean;
      }

      The options to use for the conversion.

      • Optional commify?: boolean

        Whether to add commas to separate thousands.

      • Optional pad?: boolean

        Whether to pad the fractional part with zeros.

    Returns string