UNPKG

@nomiclabs/buidler

Version:

Buidler is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.

179 lines 7.17 kB
/// <reference types="bn.js" /> /// <reference types="node" /> /// <reference types="ethereumjs-block" /> import { RunBlockResult } from "@nomiclabs/ethereumjs-vm/dist/runBlock"; import Common from "ethereumjs-common"; import { Transaction } from "ethereumjs-tx"; import { BN, ECDSASignature } from "ethereumjs-util"; import EventEmitter from "events"; import { CompilerInput, CompilerOutput } from "../stack-traces/compiler-types"; import { MessageTrace } from "../stack-traces/message-trace"; import { RpcLogOutput } from "./output"; export declare type Block = any; export interface GenesisAccount { privateKey: string; balance: string | number | BN; } export declare const COINBASE_ADDRESS: Buffer; export interface CallParams { to: Buffer; from: Buffer; gasLimit: BN; gasPrice: BN; value: BN; data: Buffer; } export interface TransactionParams { to: Buffer; from: Buffer; gasLimit: BN; gasPrice: BN; value: BN; data: Buffer; nonce: BN; } export interface FilterParams { fromBlock: BN; toBlock: BN; addresses: Buffer[]; normalizedTopics: Array<Array<Buffer | null> | null>; } export interface TxReceipt { status: 0 | 1; gasUsed: Buffer; bitvector: Buffer; logs: RpcLogOutput[]; } export interface TxBlockResult { receipt: TxReceipt; createAddresses: Buffer | undefined; bloomBitvector: Buffer; } export interface SolidityTracerOptions { solidityVersion: string; compilerInput: CompilerInput; compilerOutput: CompilerOutput; } export declare class BuidlerNode extends EventEmitter { private readonly _vm; private readonly _blockchain; private readonly _blockGasLimit; static create(hardfork: string, networkName: string, chainId: number, networkId: number, blockGasLimit: number, genesisAccounts?: GenesisAccount[], solidityVersion?: string, allowUnlimitedContractSize?: boolean, initialDate?: Date, compilerInput?: CompilerInput, compilerOutput?: CompilerOutput): Promise<[Common, BuidlerNode]>; private readonly _common; private readonly _stateManager; private readonly _accountPrivateKeys; private _blockTimeOffsetSeconds; private _nextBlockTimestamp; private _transactionByHash; private _transactionHashToBlockHash; private _blockHashToTxBlockResults; private _blockHashToTotalDifficulty; private _lastFilterId; private _filters; private _nextSnapshotId; private readonly _snapshots; private readonly _vmTracer; private readonly _vmTraceDecoder; private readonly _solidityTracer; private readonly _consoleLogger; private _failedStackTraces; private readonly _getLatestBlock; private readonly _getBlock; private constructor(); getSignedTransaction(txParams: TransactionParams): Promise<Transaction>; _getFakeTransaction(txParams: TransactionParams): Promise<Transaction>; runTransactionInNewBlock(tx: Transaction): Promise<{ trace: MessageTrace; block: Block; blockResult: RunBlockResult; error?: Error; consoleLogMessages: string[]; }>; mineEmptyBlock(timestamp: BN): Promise<RunBlockResult>; runCall(call: CallParams, blockNumber: BN | null): Promise<{ result: Buffer; trace: MessageTrace; error?: Error; consoleLogMessages: string[]; }>; getAccountBalance(address: Buffer, blockNumber: BN | null): Promise<BN>; getAccountNonce(address: Buffer, blockNumber: BN | null): Promise<BN>; getAccountNonceInPreviousBlock(address: Buffer): Promise<BN>; getLatestBlock(): Promise<Block>; getLatestBlockNumber(): Promise<BN>; getLocalAccountAddresses(): Promise<string[]>; getBlockGasLimit(): Promise<BN>; estimateGas(txParams: TransactionParams, blockNumber: BN | null): Promise<{ estimation: BN; trace: MessageTrace; error?: Error; consoleLogMessages: string[]; }>; getGasPrice(): Promise<BN>; getCoinbaseAddress(): Promise<Buffer>; getStorageAt(address: Buffer, slot: BN, blockNumber: BN | null): Promise<Buffer>; getBlockByNumber(blockNumber: BN): Promise<Block | undefined>; getBlockByHash(hash: Buffer): Promise<Block | undefined>; getBlockByTransactionHash(hash: Buffer): Promise<Block | undefined>; getBlockTotalDifficulty(block: Block): Promise<BN>; getCode(address: Buffer, blockNumber: BN | null): Promise<Buffer>; setNextBlockTimestamp(timestamp: BN): Promise<void>; increaseTime(increment: BN): Promise<void>; getTimeIncrement(): Promise<BN>; getNextBlockTimestamp(): Promise<BN>; getSuccessfulTransactionByHash(hash: Buffer): Promise<Transaction | undefined>; getTxBlockResults(block: Block): Promise<TxBlockResult[] | undefined>; getPendingTransactions(): Promise<Transaction[]>; signPersonalMessage(address: Buffer, data: Buffer): Promise<ECDSASignature>; signTypedData(address: Buffer, typedData: any): Promise<string>; getStackTraceFailuresCount(): Promise<number>; takeSnapshot(): Promise<number>; revertToSnapshot(id: number): Promise<boolean>; newFilter(filterParams: FilterParams, isSubscription: boolean): Promise<BN>; newBlockFilter(isSubscription: boolean): Promise<BN>; newPendingTransactionFilter(isSubscription: boolean): Promise<BN>; uninstallFilter(filterId: BN, subscription: boolean): Promise<boolean>; getFilterChanges(filterId: BN): Promise<string[] | RpcLogOutput[] | undefined>; getFilterLogs(filterId: BN): Promise<RpcLogOutput[] | undefined>; getLogs(filterParams: FilterParams): Promise<RpcLogOutput[]>; addCompilationResult(compilerVersion: string, compilerInput: CompilerInput, compilerOutput: CompilerOutput): Promise<boolean>; private _getSnapshotIndex; private _initLocalAccounts; private _getConsoleLogMessages; private _manageErrors; private _isContractTooLargeStackTrace; private _calculateTimestampAndOffset; private _getNextBlockTemplate; private _resetNextBlockTimestamp; private _saveTransactionAsReceived; private _getLocalAccountPrivateKey; private _addTransactionToBlock; private _saveBlockAsSuccessfullyRun; private _putBlock; private _hasBlockWithHash; private _saveTransactionAsSuccessfullyRun; private _transactionWasSuccessful; private _timestampClashesWithPreviousBlockOne; private _increaseBlockTimestamp; private _setBlockTimestamp; private _validateTransaction; private _computeTotalDifficulty; private _runOnBlockContext; private _correctInitialEstimation; private _binarySearchEstimation; /** * This function runs a transaction and reverts all the modifications that it * makes. * * If throwOnError is true, errors are managed locally and thrown on * failure. If it's false, the tx's RunTxResult is returned, and the vmTracer * inspected/resetted. */ private _runTxAndRevertMutations; private _computeFilterParams; private _newDeadline; private _getNextFilterId; private _filterIdToFiltersKey; private _emitEthEvent; } //# sourceMappingURL=node.d.ts.map