import { ProviderInterface, ProviderInterface$Callback, ProviderInterface$Emitted, ProviderInterface$EmitCb } from '../types'; import './polyfill'; /** * @name HttpProvider * @summary The HTTP Provider allows sending requests using HTTP to a HTTP RPC server TCP port. * @description It does not support subscriptions so you won't be able to listen to events * such as new blocks or balance changes. It is usually preferrable using the [[WsProvider]]. * * @example *
* * ```javascript * import Api from '@polkadot/api'; * import HttpProvider from '@polkadot/api-provider/http'; * * const provider = new HttpProvider('http://127.0.0.1:9933'); * const api = new Api(provider); * ``` * * @see [[WsProvider]] */ export default class HttpProvider implements ProviderInterface { private coder; private endpoint; private l; /** * @param {string} endpoint The endpoint url starting with http:// */ constructor(endpoint: string); /** * @summary Whether the node is connected or not. * @return {boolean} true if connected */ isConnected(): boolean; /** * @summary Events are not supported with the HttpProvider, see [[WsProvider]]. * @description HTTP Provider does not have 'on' emitters. WebSockets should be used instead. */ on(type: ProviderInterface$Emitted, sub: ProviderInterface$EmitCb): void; /** * @summary Send HTTP POST Request with Body to configured HTTP Endpoint. */ send(method: string, params: Array): Promise; /** * @summary Subscriptions are not supported with the HttpProvider, see [[WsProvider]]. */ subscribe(types: string, method: string, params: Array, cb: ProviderInterface$Callback): Promise; /** * @summary Subscriptions are not supported with the HttpProvider, see [[WsProvider]]. */ unsubscribe(type: string, method: string, id: number): Promise; }