Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TestRPC

Hierarchy

  • TestRPC

Index

Constructors

constructor

Methods

advanceToBlock

  • advanceToBlock(blockNumber: number): Promise<void>
  • Parameters

    • blockNumber: number

    Returns Promise<void>

increaseTime

  • increaseTime(seconds: number): Promise<number>
  • Jump forward in time. Takes one parameter, which is the amount of time to increase in seconds. Returns the total time adjustment, in seconds.

    Parameters

    • seconds: number

    Returns Promise<number>

increaseTimeTo

  • increaseTimeTo(target: number): Promise<number>
  • Beware that due to the need of calling two separate testrpc methods and rpc calls overhead it's hard to increase time precisely to a target point so design your test to tolerate small fluctuations from time to time.

    Parameters

    • target: number

      time in seconds

    Returns Promise<number>

mine

  • mine(): Promise<void>
  • Force a block to be mined. Takes no parameters. Mines a block independent of whether or not mining is started or stopped.

    Returns Promise<void>

revert

  • revert(snapshotId?: undefined | string): Promise<boolean>
  • Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to. If no snapshot id is passed it will revert to the latest snapshot. Returns true.

    Parameters

    • Optional snapshotId: undefined | string

    Returns Promise<boolean>

snapshot

  • snapshot(): Promise<string>
  • Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the integer id of the snapshot created.

    Returns Promise<string>

With 🖖 by Dbrain