/** * External Interfaces for other EthereumJS libraries */ import type { Account, Address, PrefixedHexString } from '@nomicfoundation/ethereumjs-util' export interface StorageDump { [key: string]: string } /** * Object that can contain a set of storage keys associated with an account. */ export interface StorageRange { /** * A dictionary where the keys are hashed storage keys, and the values are * objects containing the preimage of the hashed key (in `key`) and the * storage key (in `value`). Currently, there is no way to retrieve preimages, * so they are always `null`. */ storage: { [key: string]: { key: string | null value: string } } /** * The next (hashed) storage key after the greatest storage key * contained in `storage`. */ nextKey: string | null } export type AccountFields = Partial> export type StorageProof = { key: PrefixedHexString proof: PrefixedHexString[] value: PrefixedHexString } export type Proof = { address: PrefixedHexString balance: PrefixedHexString codeHash: PrefixedHexString nonce: PrefixedHexString storageHash: PrefixedHexString accountProof: PrefixedHexString[] storageProof: StorageProof[] } /* * Access List types */ export type AccessListItem = { address: PrefixedHexString storageKeys: PrefixedHexString[] } /* * An Access List as a tuple of [address: Uint8Array, storageKeys: Uint8Array[]] */ export type AccessListBytesItem = [Uint8Array, Uint8Array[]] export type AccessListBytes = AccessListBytesItem[] export type AccessList = AccessListItem[] export interface StateManagerInterface { getAccount(address: Address): Promise putAccount(address: Address, account?: Account): Promise deleteAccount(address: Address): Promise modifyAccountFields(address: Address, accountFields: AccountFields): Promise putContractCode(address: Address, value: Uint8Array): Promise getContractCode(address: Address): Promise getContractStorage(address: Address, key: Uint8Array): Promise putContractStorage(address: Address, key: Uint8Array, value: Uint8Array): Promise clearContractStorage(address: Address): Promise checkpoint(): Promise commit(): Promise revert(): Promise getStateRoot(): Promise setStateRoot(stateRoot: Uint8Array, clearCache?: boolean): Promise getProof?(address: Address, storageSlots: Uint8Array[]): Promise hasStateRoot(root: Uint8Array): Promise // only used in client shallowCopy(downlevelCaches?: boolean): StateManagerInterface } export interface EVMStateManagerInterface extends StateManagerInterface { originalStorageCache: { get(address: Address, key: Uint8Array): Promise clear(): void } dumpStorage(address: Address): Promise // only used in client dumpStorageRange(address: Address, startKey: bigint, limit: number): Promise // only used in client generateCanonicalGenesis(initState: any): Promise // TODO make input more typesafe getProof(address: Address, storageSlots?: Uint8Array[]): Promise shallowCopy(downlevelCaches?: boolean): EVMStateManagerInterface }