UNPKG

deth

Version:

Ethereum node focused on Developer Experience

35 lines (34 loc) 1.67 kB
/// <reference types="node" /> import Account from 'ethereumjs-account'; import { Dictionary } from 'ts-essentials'; import { CheckpointMap } from './CheckpointMap'; import { Address } from '../../primitives/Address'; import { Hash, Quantity } from '../../primitives'; /** * Holds account, code, storage state in memory. * Pretends to maintain trie like structure by generating fake state roots and load them as snapshots when needed */ export declare class DethStateManger { private accountsState; private codeState; private storageState; private savedAccountsState; private savedCodeState; private savedStorageState; private saveIndex; constructor(accountsState?: CheckpointMap<Account, Address>, codeState?: CheckpointMap<Buffer, Hash>, storageState?: CheckpointMap<Dictionary<Buffer>, Address>, savedAccountsState?: CheckpointMap<CheckpointMap<Account>, Hash>, savedCodeState?: CheckpointMap<CheckpointMap<Buffer>, Hash>, savedStorageState?: CheckpointMap<CheckpointMap<Dictionary<Buffer>, Address>, Hash>, saveIndex?: number); copy(): DethStateManger; getAccount(address: Address): Account; putAccount(address: Address, account: Account): void; putContractCode(address: Address, code: Buffer): void; getContractCode(address: Address): Buffer; getContractStorage(address: Address, key: Quantity): Buffer; putContractStorage(address: Address, key: Quantity, value: Buffer): void; clearContractStorage(address: Address): void; checkpoint(): void; commit(): void; revert(): void; getStateRoot(): Hash; setStateRoot(root: Hash): void; isAccountEmpty(address: Address): boolean; }