deth
Version:
Ethereum node focused on Developer Experience
48 lines (47 loc) • 2.14 kB
TypeScript
import VM from 'ethereumts-vm';
import { Transaction } from 'ethereumjs-tx';
import { RpcTransactionReceipt, RpcTransactionResponse, RpcBlockResponse } from '../model';
import { TestChainOptions } from '../TestChainOptions';
import { Hash, Address, Quantity, HexData } from '../primitives';
import { DethStateManger } from './storage/DethStateManger';
import { DethBlockchain } from './storage/DethBlockchain';
import { SnapshotObject } from './storage/SnapshotObject';
interface VMSnapshot {
blockchain: DethBlockchain;
stateManager: DethStateManger;
}
/**
* TestVM is a wrapper around ethereumts-vm (our fork). It provides a promise-based
* interface and abstracts away weird ethereumjs specific details
*/
export declare class TestVM {
private options;
vm: VM;
state: SnapshotObject<{
stateManger: DethStateManger;
blockchain: DethBlockchain;
}>;
pendingTransactions: Transaction[];
transactions: Map<Hash, RpcTransactionResponse>;
receipts: Map<Hash, RpcTransactionReceipt>;
snapshots: VMSnapshot[];
constructor(options: TestChainOptions);
init(): Promise<void>;
installStepHook(hook: Function): void;
makeSnapshot(): number;
revertToSnapshot(id: number): void;
private hotswapStateStorageForVm;
getBlockNumber(): Promise<Quantity>;
getLatestBlock(): Promise<RpcBlockResponse>;
addPendingTransaction(signedTransaction: HexData): Promise<Hash>;
mineBlock(clockSkew: number): Promise<void>;
getTransaction(hash: Hash): RpcTransactionResponse | undefined;
getTransactionReceipt(hash: Hash): RpcTransactionReceipt | undefined;
getNonce(address: Address): Promise<import("ts-essentials").Opaque<"Quantity", string>>;
getBalance(address: Address): Promise<import("ts-essentials").Opaque<"Quantity", string>>;
private getAccount;
getCode(address: Address): Promise<import("ts-essentials").Opaque<"HexData", string>>;
runIsolatedTransaction(transaction: Transaction, clockSkew: number): Promise<import("ethereumts-vm/dist/runTx").RunTxResult>;
getBlock(hashOrNumber: string): Promise<RpcBlockResponse>;
}
export {};