Change Schemas
API
| Function | Signature |
|---|---|
from | (map) => Effect<StateDiffType, StateDiffError> |
getAccount | (diff, address) => AccountDiff | undefined |
getAddresses | (diff) => Address[] |
isEmpty | (diff) => boolean |
Track account balance, nonce, and code changes
import { StateDiff, Address } from 'voltaire-effect'
import { Effect } from 'effect'
const diff = yield* StateDiff.from(new Map([
[Address('0x...'), {
balance: { from: 100n, to: 200n },
nonce: { from: 1n, to: 2n }
}]
]))
// Query
const accountDiff = StateDiff.getAccount(diff, addressBytes)
const addresses = StateDiff.getAddresses(diff)
const empty = StateDiff.isEmpty(diff)
BalanceChangeSchema // { from: bigint, to: bigint }
NonceChangeSchema // { from: bigint, to: bigint }
CodeChangeSchema // { from: Uint8Array | null, to: Uint8Array | null }
AccountDiffSchema // { balance?, nonce?, code? }
| Function | Signature |
|---|---|
from | (map) => Effect<StateDiffType, StateDiffError> |
getAccount | (diff, address) => AccountDiff | undefined |
getAddresses | (diff) => Address[] |
isEmpty | (diff) => boolean |