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

// EOA with balance
const eoa = yield* AccountState.from({
  nonce: 5n,
  balance: 1000000000000000000n  // 1 ETH
})

// Contract (with code hash)
const contract = yield* AccountState.from({
  nonce: 1n,
  balance: 0n,
  codeHash: '0x...',
  storageRoot: '0x...'
})

// Checks
AccountState.isEmpty(account)     // zero nonce, balance, no code
AccountState.isContract(account)  // has code
const empty = AccountState.empty()

Constants

EMPTY_CODE_HASH    // keccak256 of empty bytes
EMPTY_STORAGE_ROOT // empty trie root

API

FunctionSignature
from(input) => Effect<AccountStateType, Error>
empty() => AccountStateType
isEmpty(account) => boolean
isContract(account) => boolean