Constants
API
| Function | Signature |
|---|---|
from | (input) => Effect<AccountStateType, Error> |
empty | () => AccountStateType |
isEmpty | (account) => boolean |
isContract | (account) => boolean |
Ethereum account nonce, balance, codeHash, storageRoot
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()
EMPTY_CODE_HASH // keccak256 of empty bytes
EMPTY_STORAGE_ROOT // empty trie root
| Function | Signature |
|---|---|
from | (input) => Effect<AccountStateType, Error> |
empty | () => AccountStateType |
isEmpty | (account) => boolean |
isContract | (account) => boolean |