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

// Schema: accepts number, bigint, or string (0 to UINT64_MAX)
const index = Schema.decodeSync(WithdrawalIndex.BigInt)(123456n)

// Effect constructor
const result = await Effect.runPromise(WithdrawalIndex.from(123456n))

// Conversions
WithdrawalIndex.toBigInt(index) // lossless
WithdrawalIndex.toNumber(index) // may lose precision
WithdrawalIndex.equals(a, b)

// Constant
WithdrawalIndex.UINT64_MAX // 18446744073709551615n
64-bit unsigned integers assigned sequentially as withdrawals are processed.