Skip to main content
import * as MaxFeePerGas from 'voltaire-effect/MaxFeePerGas'
import * as Schema from 'effect/Schema'
import { Effect } from 'effect'

// Schema: validate wei values
const fee = Schema.decodeSync(MaxFeePerGas.MaxFeePerGasSchema)(30000000000n)

// Schema: convert from gwei
const feeFromGwei = Schema.decodeSync(MaxFeePerGas.MaxFeePerGasFromGweiSchema)(30)

// Effect: create with error handling
const program = MaxFeePerGas.from(30000000000n)
const maxFee = Effect.runSync(program)

// Effect: from gwei
const fromGwei = MaxFeePerGas.fromGwei(30)

// Pure: convert to gwei
const gwei = MaxFeePerGas.toGwei(maxFee)

API

FunctionInputOutput
frombigint | number | stringEffect<MaxFeePerGasType, UintError>
fromGweinumberEffect<MaxFeePerGasType, Error>
toGweiMaxFeePerGasTypebigint