Options
All
  • Public
  • Public/Protected
  • All
Menu

Class State

Read the state of the Ellcrys blockchain on a client.

export
class

State

Hierarchy

Index

Constructors

constructor

Properties

Protected client

client: RPCClient

Methods

getAccount

  • getAccount(address: string): Promise<Account>
  • Get a specific account on the network

    memberof

    State

    Parameters

    • address: string

      The address of the accounts

    Returns Promise<Account>

getAccountNonce

  • getAccountNonce(address: string): Promise<number>
  • Get the nonce of a given address

    memberof

    State

    Parameters

    • address: string

      The address whose nonce will be fetched

    Returns Promise<number>

getBestChain

  • getBestChain(): Promise<Chain>

getBlock

  • getBlock(num: number): Promise<Block>
  • Get a block by number

    memberof

    State

    Parameters

    • num: number

      The block number/height

    Returns Promise<Block>

getBlockByHash

  • getBlockByHash(blockHash: string): Promise<Block>
  • Get a block by block Hash.

    memberof

    State

    Parameters

    • blockHash: string

      The hash of the block.

    Returns Promise<Block>

getBranches

  • getBranches(): Promise<Branches[]>
  • Get all the known branches on the node

    memberof

    State

    Returns Promise<Branches[]>

getDifficulty

  • getDifficulty(): Promise<Difficulty>
  • Get the current difficulty and total difficulty of the network.

    memberof

    State

    Returns Promise<Difficulty>

getMinedBlocks

  • getMinedBlocks(opts?: ArgMindedBlock): Promise<MinedBlocksResult>
  • Fetch blocks mined by the node. It is possible to limit the results by specifying opts.limit to a desired number.

    To support pagination, set opts.lastHash to get only results after a specified block hash.

    Given the possibility that a node may mined blocks using different coinbase (and public key), use opts.creatorPubKey to return blocks mined by a specific public key (or account).

    memberof

    State

    Parameters

    • Default value opts: ArgMindedBlock = {}

    Returns Promise<MinedBlocksResult>

getObjects

  • getObjects(filter: JSON): Promise<any>
  • Returns raw db objects (Debug only)

    memberof

    State

    Parameters

    • filter: JSON

      Filter parameters

    Returns Promise<any>

getOrphans

  • getOrphans(): Promise<Block[]>

getReOrgs

  • getReOrgs(): Promise<ReOrgInfo[]>
  • Get a list of re-organization events that have occurred from the node's perspective

    memberof

    State

    Returns Promise<ReOrgInfo[]>

getTipBlock

  • getTipBlock(): Promise<Block>
  • Return the block with the highest height or number on the node

    memberof

    State

    Returns Promise<Block>

getTransaction

  • getTransaction(txHash: string): Promise<Transaction>
  • Get a transaction by its hash

    memberof

    State

    Parameters

    • txHash: string

      The transaction's hash

    Returns Promise<Transaction>

listAccounts

  • listAccounts(): Promise<Account[]>

listTopAccounts

  • listTopAccounts(limit: number): Promise<Account[]>
  • Get a list of top accounts on the network.

    memberof

    State

    Parameters

    • limit: number

      The maximum number of top accounts to return

    Returns Promise<Account[]>

suggestNonce

  • suggestNonce(address: string): Promise<number>
  • Get a suggestion about the next nonce of an account.

    memberof

    State

    Parameters

    • address: string

      The address of the account.

    Returns Promise<number>