Skip to content

Value.fromEther

Parses a string representation of Ether to a bigint Value (default: wei).

Imports

Named
import { Value } from 'ox'

Examples

import { Value } from 'ox'
 
Value.fromEther('420')
420000000000000000000n

Definition

function fromEther(
  ether: string,
  unit?: 'wei' | 'gwei' | 'szabo' | 'finney',
): bigint

Source: src/Value.ts

Parameters

ether

  • Type: string

String representation of Ether.

unit

  • Type: 'wei' | 'gwei' | 'szabo' | 'finney'
  • Optional

The unit to parse to.

Return Type

A bigint Value.

bigint