A class for providing JSON-RPC channels with blockchain node endpoints.

Constructors

  • Creates a new Provider object.

    Parameters

    • ain: default

      The Ain object.

    • endpoint: string

      The blockchain node endpoint.

    • axiosConfig: undefined | AxiosRequestConfig

      The axios request config object.

    Returns default

Properties

ain: default

The Ain object.

apiEndpoint: string

The blockchain node JSON-RPC endpoint.

endpoint: string

The blockchain node endpoint.

httpClient: AxiosInstance

The axios http client object.

Methods

  • Fetches the blockchain node's address.

    Returns Promise<string>

    The return value of the blockchain API.

  • Creates a JSON-RPC payload and sends it to the network.

    Parameters

    • rpcMethod: string

      The JSON-RPC method.

    • Optional params: any

      The JSON-RPC parameters.

    Returns Promise<any>

  • Sets the http client's default timeout value.

    Parameters

    • time: number

      The timeout value (in milliseconds).

    Returns void