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.

Constructors

Properties

Methods

  • Selects the fastest responding host from the configured reliable node hosts.

    Parameters

    • 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!

    • timeout: number = 10_000

      The optional amount of time in milliseconds to check. Default is 10_000

    • checkMethod: string = 'getBlockchainStatus'

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

    Returns Promise<string>

    Promise resolving to the selected host

    Error if no reliable hosts are configured or if all hosts fail

  • Send data to chain node

    Type Parameters

    • T

    Parameters

    • method: string

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

    • args: SendArgs = {}

      A JSON object which will be mapped to url params

    • Optionalbody: object

      An object with key value pairs to submit as post body

    • Optionaloptions: any

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

    Returns Promise<T>

    The response data of success

    HttpError in case of failure