Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ChainService

Generic Chain Service class.

This class can be used to call the chain api directly, in case a function is not supported yet by SignumJS. Usually, you won't need to do it.

Hierarchy

  • ChainService

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

settings

Methods

query

  • query<T>(method: string, args?: any, options?: any): Promise<T>

selectBestHost

  • selectBestHost(reconfigure?: boolean, checkMethod?: string): Promise<string>
  • Automatically selects the best host, according to its response time, i.e. the fastest node host will be returned (and set as nodeHost internally)

    throws

    Error If reliableNodeHosts is empty, or if all requests to the reliableNodeHosts fail

    Parameters

    • Default value reconfigure: boolean = false

      An optional flag to set automatic reconfiguration. Default is false Attention: Reconfiguration works only, if you use the default http client. Otherwise, you need to reconfigure manually!

    • Default value checkMethod: string = "getBlockchainStatus"

      The optional API method to be called. This applies only for GET methods. Default is getBlockchainStatus

    Returns Promise<string>

send

  • send<T>(method: string, args?: SendArgs, body?: object, options?: any): Promise<T>
  • Send data to chain node

    throws

    HttpError in case of failure

    Type parameters

    • T

    Parameters

    • method: string

      The method according https://europe.signum.network/api-doc/. Note that there are only a few POST methods

    • Default value args: SendArgs = {}

      A JSON object which will be mapped to url params

    • Optional body: object

      An object with key value pairs to submit as post body

    • Optional options: any

      The optional request configuration for the passed Http client (default is AxiosRequestConfig )

    Returns Promise<T>

    The response data of success

toApiEndpoint

  • toApiEndpoint(method: string, data?: object): string