UNPKG

@signumjs/core

Version:

Principal package with functions and models for building Signum Network applications.

42 lines (41 loc) 1.75 kB
import { Api } from '../typings/api'; import { ApiVersion } from '../constants/apiVersion'; import { Http } from '@signumjs/http'; /** * Settings for API used in {@link composeApi} * * */ export declare class ApiSettings { nodeHost: string; reliableNodeHosts?: string[]; httpClientOptions?: any; httpClient?: Http; apiVersion?: ApiVersion; /** * @param nodeHost {string} The url of the peer/node * @param reliableNodeHosts A list of node/peer hosts that can be chosen of, * usually a list of reliable/trusted nodes. This is necessary for the automatic node selection. * @param httpClientOptions {any} The optional request configuration for the passed Http client * @param httpClient {Http} It's possible to add a custom Http client adapter. Default is an Axios based implementation * @param apiVersion {ApiVersion} For future usage. * The default implementation uses axios. In case of a custom client pass your own options. * see [Axios Configuration](https://github.com/axios/axios#request-config) */ constructor(nodeHost: string, reliableNodeHosts?: string[], httpClientOptions?: any, httpClient?: Http, apiVersion?: ApiVersion); } /** * Composes the API, i.e. setup the environment and mounts the API structure * with its functions. * * ```ts * const api = composeApi(new ApiSettings('https://europe.signum.network')), // one of the mainnet nodes * ``` * * Note, that this method mounts the __entire__ API, i.e. all available methods. One may also customize the API composition * using {@link ApiComposer}. * * @param settings necessary execution context * @return The _complete_ API * */ export declare function composeApi(settings: ApiSettings): Api;