Options
All
  • Public
  • Public/Protected
  • All
Menu

Reads from an array of Block objects, useful for testing.

Hierarchy

Index

Constructors

constructor

  • new JsonActionReader(blockchain: Block[], startAtBlock?: number, onlyIrreversible?: boolean, maxHistoryLength?: number, requestInstance?: any): JsonActionReader

Properties

Protected blockHistory

blockHistory: Block[] = []

Protected blockchain

blockchain: Block[]

Protected currentBlockData

currentBlockData: Block | null = null

currentBlockNumber

currentBlockNumber: number

headBlockNumber

headBlockNumber: number = 0

isFirstBlock

isFirstBlock: boolean = true

Protected maxHistoryLength

maxHistoryLength: number

Protected onlyIrreversible

onlyIrreversible: boolean

Protected requestInstance

requestInstance: any

startAtBlock

startAtBlock: number

Methods

getBlock

  • getBlock(blockNumber: number): Promise<Block>

getHeadBlockNumber

  • getHeadBlockNumber(): Promise<number>

nextBlock

  • nextBlock(): Promise<[Block, boolean]>

rollback

  • rollback(): Promise<void>
  • Incrementally rolls back reader state one block at a time, comparing the blockHistory with newly fetched blocks. Rollback is finished when either the current block's previous hash matches the previous block's hash, or when history is exhausted.

    Returns Promise<void>

Protected rollbackExhausted

  • rollbackExhausted(): void

seekToBlock

  • seekToBlock(blockNumber: number): Promise<void>