Skip to content

Value.formatEther

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

Imports

Named
import { Value } from 'ox'

Examples

import { Value } from 'ox'
 
Value.formatEther(1_000_000_000_000_000_000n)
'1'

Definition

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

Source: src/Value.ts

Parameters

wei

  • Type: bigint

The Value to format.

unit

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

The unit to format the Value in.

Return Type

The Ether string representation of the Value.

string