Class PublicApiClient

Represents a PublicApiClient object.

See

  • getNodeStatus - Get the node status.
  • getAddresses - Get addresses.
  • getBlocks - Get blocks.
  • getEndorsements - Get endorsements.
  • getOperations - Get operations.
  • getCliques - Get cliques.
  • getStakers - Get stakers.
  • getDatastoreEntries - Get datastore entries.
  • getBlockcliqueBlockBySlot - Get blockclique block by slot.
  • getGraphInterval - Get graph interval.

Hierarchy

  • BaseClient
    • PublicApiClient

Implements

Constructors

Properties

clientConfig: IClientConfig

Methods

  • Show data about a block (content, finality ...).

    Remarks

    The blocks are stored in the node cache. After a certain time (depending of the network activity), the blocks are removed from the cache and the node will not be able to return the block data. The corresponding api parameter is 'max_discarded_blocks'. More information can be found here: https://docs.massa.net/en/latest/testnet/all-config.html

    Returns

    A promise which resolves in the block data.

    Parameters

    • blockIds: string[]

      The block ids as an array of strings.

    Returns Promise<IBlockInfo[]>

  • Retrieves the node's status.

    Remarks

    The returned information includes:

    • Whether the node is reachable
    • The number of connected peers
    • The node's version
    • The node's configuration parameters

    Returns

    A promise that resolves to the node's status information.

    Returns Promise<INodeStatus>

  • Sends a post JSON rpc request to the node.

    Throws

    An error if the rpc method returns an error.

    Returns

    A promise that resolves as the result of the rpc method.

    Type Parameters

    • T

    Parameters

    • resource: JSON_RPC_REQUEST_METHOD

      The rpc method to call.

    • params: object

      The parameters to pass to the rpc method.

    Returns Promise<T>

  • Set new providers as IProvider.

    Throws

    Will throw an error if no public providers are included in the given array of providers.

    Throws

    Will throw an error if no private providers are included in the given array of providers.

    Parameters

    • providers: IProvider[]

      The new providers to set as an array of IProvider.

    Returns void

Generated using TypeDoc