Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BurstService

Generic BRS Web Service class.

Hierarchy

  • BurstService

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

settings

Methods

query

  • query<T>(method: string, args?: any, options?: any | AxiosRequestConfig): Promise<T>
  • Requests a query to BRS

    throws

    HttpError in case of failure

    Type parameters

    • T

    Parameters

    • method: string

      The BRS method according https://burstwiki.org/wiki/The_Burst_API

    • Default value args: any = {}

      A JSON object which will be mapped to url params

    • Optional options: any | AxiosRequestConfig

      The optional request configuration for the passed Http client

    Returns Promise<T>

    The response data of success

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?: any, body?: any, options?: any | AxiosRequestConfig): Promise<T>
  • Send data to BRS

    throws

    HttpError in case of failure

    Type parameters

    • T

    Parameters

    • method: string

      The BRS method according https://burstwiki.org/wiki/The_Burst_API. Note that there are only a few POST methods

    • Default value args: any = {}

      A JSON object which will be mapped to url params

    • Default value body: any = {}

      An object with key value pairs to submit as post body

    • Optional options: any | AxiosRequestConfig

      The optional request configuration for the passed Http client

    Returns Promise<T>

    The response data of success

toBRSEndpoint

  • toBRSEndpoint(method: string, data?: any): string