# Value

Utility functions for displaying and parsing Ethereum Values as defined under **2.1. Value** in the [Ethereum Yellow Paper](https://ethereum.github.io/yellowpaper/paper.pdf)

## Examples

```ts twoslash
// @noErrors
import { Value } from 'ox'

const value = Value.fromEther('1')
// @log: 1_000_000_000_000_000_000n

const formattedValue = Value.formatEther(value)
// @log: '1'

const value = Value.fromEther('1', 'szabo')
// @log: 1_000_000n
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Value.format`](/api/Value/format) | Formats a `bigint` Value to its string representation (divided by the given exponent). |
| [`Value.formatEther`](/api/Value/formatEther) | Formats a `bigint` Value (default: wei) to a string representation of Ether. |
| [`Value.formatGwei`](/api/Value/formatGwei) | Formats a `bigint` Value (default: wei) to a string representation of Gwei. |
| [`Value.from`](/api/Value/from) | Parses a `string` representation of a Value to `bigint` (multiplied by the given exponent). |
| [`Value.fromEther`](/api/Value/fromEther) | Parses a string representation of Ether to a `bigint` Value (default: wei). |
| [`Value.fromGwei`](/api/Value/fromGwei) | Parses a string representation of Gwei to a `bigint` Value (default: wei). |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Value.InvalidDecimalNumberError`](/api/Value/errors#valueinvaliddecimalnumbererror) | Thrown when a value is not a valid decimal number. |
| [`Value.InvalidDecimalsError`](/api/Value/errors#valueinvaliddecimalserror) | Thrown when the `decimals` argument is not a non-negative integer. |
