Gitbook rendering updates (#159)
* Add .nodoc for in-flux packages * Start with clean-slate for re-generation * Update with working (although manual) config
This commit is contained in:
@@ -26,460 +26,3 @@ const version = await provider.send('client_version', []);
|
||||
console.log('clientVersion', version);
|
||||
```
|
||||
|
||||
## Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [HttpProvider](classes/httpprovider.md)
|
||||
* [WsProvider](classes/wsprovider.md)
|
||||
|
||||
### Interfaces
|
||||
|
||||
* [ProviderInterface](interfaces/providerinterface.md)
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [HttpState](#httpstate)
|
||||
* [JsonRpcObject](#jsonrpcobject)
|
||||
* [JsonRpcRequest](#jsonrpcrequest)
|
||||
* [JsonRpcResponse](#jsonrpcresponse)
|
||||
* [JsonRpcResponseBase](#jsonrpcresponsebase)
|
||||
* [JsonRpcResponseBase$Error](#jsonrpcresponsebase_error)
|
||||
* [MockState](#mockstate)
|
||||
* [MockState$Requests](#mockstate_requests)
|
||||
* [MockState$Storage](#mockstate_storage)
|
||||
* [MockState$Subscription$Callback](#mockstate_subscription_callback)
|
||||
* [MockState$Subscriptions](#mockstate_subscriptions)
|
||||
* [ProviderInterface$Callback](#providerinterface_callback)
|
||||
* [ProviderInterface$EmitCb](#providerinterface_emitcb)
|
||||
* [ProviderInterface$Emitted](#providerinterface_emitted)
|
||||
* [RpcCoder](#rpccoder)
|
||||
* [RpcCoderState](#rpccoderstate)
|
||||
|
||||
### Functions
|
||||
|
||||
* [decodeResponse](#decoderesponse)
|
||||
* [encodeJson](#encodejson)
|
||||
* [encodeObject](#encodeobject)
|
||||
* [mockProvider](#mockprovider)
|
||||
* [mocks](#mocks)
|
||||
* [on](#on)
|
||||
* [rpcCoder](#rpccoder)
|
||||
* [send](#send)
|
||||
* [state](#state)
|
||||
* [subscribe](#subscribe)
|
||||
* [unsubscribe](#unsubscribe)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="httpstate"></a>
|
||||
|
||||
### HttpState
|
||||
|
||||
**Ƭ HttpState**: *`object`*
|
||||
|
||||
*Defined in [http/types.d.ts:8](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/types.d.ts#L8)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="jsonrpcobject"></a>
|
||||
|
||||
### JsonRpcObject
|
||||
|
||||
**Ƭ JsonRpcObject**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:5](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L5)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="jsonrpcrequest"></a>
|
||||
|
||||
### JsonRpcRequest
|
||||
|
||||
**Ƭ JsonRpcRequest**: * [JsonRpcObject](#jsonrpcobject) & `object`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L10)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponse"></a>
|
||||
|
||||
### JsonRpcResponse
|
||||
|
||||
**Ƭ JsonRpcResponse**: * [JsonRpcObject](#jsonrpcobject) & [JsonRpcResponseBase](#jsonrpcresponsebase)
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:36](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L36)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponsebase"></a>
|
||||
|
||||
### JsonRpcResponseBase
|
||||
|
||||
**Ƭ JsonRpcResponseBase**: * `JsonRpcResponse$Single` & `JsonRpcResponse$Subscription`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:34](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L34)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponsebase_error"></a>
|
||||
|
||||
### JsonRpcResponseBase$Error
|
||||
|
||||
**Ƭ JsonRpcResponseBase$Error**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:15](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L15)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="mockstate"></a>
|
||||
|
||||
### MockState
|
||||
|
||||
**Ƭ MockState**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:27](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L27)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="mockstate_requests"></a>
|
||||
|
||||
### MockState$Requests
|
||||
|
||||
**Ƭ MockState$Requests**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:23](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L23)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `function`
|
||||
|
||||
▸(storage: *[MockState$Storage](#mockstate_storage)*, params: *`Array`<`any`>*): `string`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| storage | [MockState$Storage](#mockstate_storage) |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `string`
|
||||
|
||||
___
|
||||
<a id="mockstate_storage"></a>
|
||||
|
||||
### MockState$Storage
|
||||
|
||||
**Ƭ MockState$Storage**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:19](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L19)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="mockstate_subscription_callback"></a>
|
||||
|
||||
### MockState$Subscription$Callback
|
||||
|
||||
**Ƭ MockState$Subscription$Callback**: *`function`*
|
||||
|
||||
*Defined in [mock/types.d.ts:8](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L8)*
|
||||
|
||||
#### Type declaration
|
||||
▸(error: * `Error` | `null`*, value: *`any`*): `void`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| error | `Error` | `null`|
|
||||
| value | `any` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="mockstate_subscriptions"></a>
|
||||
|
||||
### MockState$Subscriptions
|
||||
|
||||
**Ƭ MockState$Subscriptions**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:10](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L10)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `object`
|
||||
|
||||
___
|
||||
<a id="providerinterface_callback"></a>
|
||||
|
||||
### ProviderInterface$Callback
|
||||
|
||||
**Ƭ ProviderInterface$Callback**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:38](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L38)*
|
||||
|
||||
#### Type declaration
|
||||
▸(error: * `Error` | `null`*, result: *`any`*): `void`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| error | `Error` | `null`|
|
||||
| result | `any` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="providerinterface_emitcb"></a>
|
||||
|
||||
### ProviderInterface$EmitCb
|
||||
|
||||
**Ƭ ProviderInterface$EmitCb**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:42](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L42)*
|
||||
|
||||
#### Type declaration
|
||||
▸(value?: *`any`*): `any`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Optional` value | `any` |
|
||||
|
||||
**Returns:** `any`
|
||||
|
||||
___
|
||||
<a id="providerinterface_emitted"></a>
|
||||
|
||||
### ProviderInterface$Emitted
|
||||
|
||||
**Ƭ ProviderInterface$Emitted**: * "connected" | "disconnected"
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:40](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L40)*
|
||||
|
||||
___
|
||||
<a id="rpccoder"></a>
|
||||
|
||||
### RpcCoder
|
||||
|
||||
**Ƭ RpcCoder**: *`object`*
|
||||
|
||||
*Defined in [coder/json/types.d.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/types.d.ts#L7)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="rpccoderstate"></a>
|
||||
|
||||
### RpcCoderState
|
||||
|
||||
**Ƭ RpcCoderState**: *`object`*
|
||||
|
||||
*Defined in [coder/json/types.d.ts:14](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/types.d.ts#L14)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
|
||||
## Functions
|
||||
|
||||
<a id="decoderesponse"></a>
|
||||
|
||||
### decodeResponse
|
||||
|
||||
▸ **decodeResponse**(self: *[RpcCoderState](#rpccoderstate)*, response: *[JsonRpcResponse](#jsonrpcresponse)*): `any`
|
||||
|
||||
*Defined in [coder/json/decodeResponse.ts:22](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/decodeResponse.ts#L22)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](#rpccoderstate) |
|
||||
| response | [JsonRpcResponse](#jsonrpcresponse) |
|
||||
|
||||
**Returns:** `any`
|
||||
|
||||
___
|
||||
<a id="encodejson"></a>
|
||||
|
||||
### encodeJson
|
||||
|
||||
▸ **encodeJson**(self: *[RpcCoderState](#rpccoderstate)*, method: *`string`*, params: *`Array`<`any`>*): `string`
|
||||
|
||||
*Defined in [coder/json/encodeJson.ts:9](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/encodeJson.ts#L9)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](#rpccoderstate) |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `string`
|
||||
|
||||
___
|
||||
<a id="encodeobject"></a>
|
||||
|
||||
### encodeObject
|
||||
|
||||
▸ **encodeObject**(self: *[RpcCoderState](#rpccoderstate)*, method: *`string`*, params: *`Array`<`any`>*): [JsonRpcRequest](#jsonrpcrequest)
|
||||
|
||||
*Defined in [coder/json/encodeObject.ts:8](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/encodeObject.ts#L8)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](#rpccoderstate) |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** [JsonRpcRequest](#jsonrpcrequest)
|
||||
|
||||
___
|
||||
<a id="mockprovider"></a>
|
||||
|
||||
### mockProvider
|
||||
|
||||
▸ **mockProvider**(): [ProviderInterface](interfaces/providerinterface.md)
|
||||
|
||||
*Defined in [mock/index.ts:18](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/index.ts#L18)*
|
||||
|
||||
A moock provider mainly used for testing.
|
||||
|
||||
**Returns:** [ProviderInterface](interfaces/providerinterface.md)
|
||||
The mock provider
|
||||
|
||||
___
|
||||
<a id="mocks"></a>
|
||||
|
||||
### mocks
|
||||
|
||||
▸ **mocks**(__namedParameters: *`object`*): `void`
|
||||
|
||||
*Defined in [mock/mocks.ts:68](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/mocks.ts#L68)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
### on
|
||||
|
||||
▸ **on**(self: *[MockState](#mockstate)*, type: *[ProviderInterface$Emitted](#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](#providerinterface_emitcb)*): `void`
|
||||
|
||||
*Defined in [mock/on.ts:8](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/on.ts#L8)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](#mockstate) |
|
||||
| type | [ProviderInterface$Emitted](#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](#providerinterface_emitcb) |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="rpccoder"></a>
|
||||
|
||||
### rpcCoder
|
||||
|
||||
▸ **rpcCoder**(): [RpcCoder](#rpccoder)
|
||||
|
||||
*Defined in [coder/json/index.ts:12](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/index.ts#L12)*
|
||||
|
||||
**Returns:** [RpcCoder](#rpccoder)
|
||||
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
### send
|
||||
|
||||
▸ **send**(__namedParameters: *`object`*, method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Defined in [mock/send.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/send.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
___
|
||||
<a id="state"></a>
|
||||
|
||||
### state
|
||||
|
||||
▸ **state**(): [MockState](#mockstate)
|
||||
|
||||
*Defined in [mock/state.ts:38](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/state.ts#L38)*
|
||||
|
||||
**Returns:** [MockState](#mockstate)
|
||||
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
### subscribe
|
||||
|
||||
▸ **subscribe**(self: *[MockState](#mockstate)*, type: *`string`*, method: *`string`*, params: *`Array`<`any`>*): `Promise`<`number`>
|
||||
|
||||
*Defined in [mock/subscribe.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/subscribe.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](#mockstate) |
|
||||
| type | `string` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
### unsubscribe
|
||||
|
||||
▸ **unsubscribe**(self: *[MockState](#mockstate)*, type: *`string`*, name: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Defined in [mock/unsubscribe.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/unsubscribe.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](#mockstate) |
|
||||
| type | `string` |
|
||||
| name | `string` |
|
||||
| id | `number` |
|
||||
|
||||
**Returns:** `Promise`<`boolean`>
|
||||
|
||||
___
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
* ["coder/json/decodeResponse"](modules/_coder_json_decoderesponse_.md)
|
||||
* ["coder/json/encodeJson"](modules/_coder_json_encodejson_.md)
|
||||
* ["coder/json/encodeObject"](modules/_coder_json_encodeobject_.md)
|
||||
* ["coder/json/index"](modules/_coder_json_index_.md)
|
||||
* ["coder/json/types.d"](modules/_coder_json_types_d_.md)
|
||||
* ["http/index"](modules/_http_index_.md)
|
||||
* [HttpProvider](classes/_http_index_.httpprovider.md)
|
||||
* ["http/polyfill"](modules/_http_polyfill_.md)
|
||||
* ["http/types.d"](modules/_http_types_d_.md)
|
||||
* ["index"](modules/_index_.md)
|
||||
* ["mock/index"](modules/_mock_index_.md)
|
||||
* ["mock/mocks"](modules/_mock_mocks_.md)
|
||||
* ["mock/on"](modules/_mock_on_.md)
|
||||
* ["mock/send"](modules/_mock_send_.md)
|
||||
* ["mock/state"](modules/_mock_state_.md)
|
||||
* ["mock/subscribe"](modules/_mock_subscribe_.md)
|
||||
* ["mock/types.d"](modules/_mock_types_d_.md)
|
||||
* ["mock/unsubscribe"](modules/_mock_unsubscribe_.md)
|
||||
* ["types.d"](modules/_types_d_.md)
|
||||
* [ProviderInterface](interfaces/_types_d_.providerinterface.md)
|
||||
* ["ws/index"](modules/_ws_index_.md)
|
||||
* [WsProvider](classes/_ws_index_.wsprovider.md)
|
||||
* ["ws/polyfill"](modules/_ws_polyfill_.md)
|
||||
@@ -0,0 +1,615 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>HttpProvider · Polkadot API Book</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="_ws_index_.wsprovider.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../../">
|
||||
|
||||
<a href="../../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../../api/">
|
||||
|
||||
<a href="../../api/">
|
||||
|
||||
|
||||
api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.3.1" data-path="_http_index_.httpprovider.html">
|
||||
|
||||
<a href="_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
|
||||
api-rx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../examples/">
|
||||
|
||||
<a href="../../examples/">
|
||||
|
||||
|
||||
Overview
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../examples/01_simple_connect/">
|
||||
|
||||
<a href="../../examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../../examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../examples/04_generate_account/">
|
||||
|
||||
<a href="../../examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../examples/05_read_storage/">
|
||||
|
||||
<a href="../../examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../../examples/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../../examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="../.." >HttpProvider</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<p>The HTTP Provider allows sending requests using HTTP. 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 <a href="_ws_index_.wsprovider.html">WsProvider</a>.
|
||||
<em><strong>example</strong></em>: <code>javascript
|
||||
import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
const provider = new WsProvider('http://127.0.0.1:9933');
|
||||
const api = createApi(provider);</code></p>
|
||||
<p><em><strong>see</strong></em>: <a href="_ws_index_.wsprovider.html">WsProvider</a></p>
|
||||
<h1 id="hierarchy">Hierarchy</h1>
|
||||
<p><strong>HttpProvider</strong></p>
|
||||
<h1 id="implements">Implements</h1>
|
||||
<ul>
|
||||
<li><a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a></li>
|
||||
</ul>
|
||||
<h1 id="constructors">Constructors</h1>
|
||||
<p><a id="constructor"></a></p>
|
||||
<h2 id="constructor">constructor</h2>
|
||||
<p>⊕ <strong>new HttpProvider</strong>(endpoint: <em><code>string</code></em>): <a href="_http_index_.httpprovider.html">HttpProvider</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L35" target="_blank">http/index.ts:35</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>endpoint</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <a href="_http_index_.httpprovider.html">HttpProvider</a></p>
|
||||
<hr>
|
||||
<h1 id="methods">Methods</h1>
|
||||
<p><a id="isconnected"></a></p>
|
||||
<h2 id="isconnected">isConnected</h2>
|
||||
<p>▸ <strong>isConnected</strong>(): <code>boolean</code></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#isconnected">isConnected</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L49" target="_blank">http/index.ts:49</a></em></p>
|
||||
<p>Whether the node is connected or not.</p>
|
||||
<p><strong>Returns:</strong> <code>boolean</code>
|
||||
true if connected</p>
|
||||
<hr>
|
||||
<p><a id="on"></a></p>
|
||||
<h2 id="on">on</h2>
|
||||
<p>▸ <strong>on</strong>(type: <em><a href="../modules/_types_d_.md#providerinterface_emitted">ProviderInterface$Emitted</a></em>, sub: <em><a href="../modules/_types_d_.md#providerinterface_emitcb">ProviderInterface$EmitCb</a></em>): <code>void</code></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#on">on</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L56" target="_blank">http/index.ts:56</a></em></p>
|
||||
<p>Events are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><a href="../modules/_types_d_.md#providerinterface_emitted">ProviderInterface$Emitted</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sub</td>
|
||||
<td><a href="../modules/_types_d_.md#providerinterface_emitcb">ProviderInterface$EmitCb</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="send"></a></p>
|
||||
<h2 id="send">send</h2>
|
||||
<p>▸ <strong>send</strong>(method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>Promise</code><<code>any</code>></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#send">send</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L60" target="_blank">http/index.ts:60</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>any</code>></p>
|
||||
<hr>
|
||||
<p><a id="subscribe"></a></p>
|
||||
<h2 id="subscribe">subscribe</h2>
|
||||
<p>▸ <strong>subscribe</strong>(types: <em><code>string</code></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>, cb: <em><a href="../modules/_types_d_.md#providerinterface_callback">ProviderInterface$Callback</a></em>): <code>Promise</code><<code>number</code>></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#subscribe">subscribe</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L82" target="_blank">http/index.ts:82</a></em></p>
|
||||
<p>Subscriptions are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>types</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cb</td>
|
||||
<td><a href="../modules/_types_d_.md#providerinterface_callback">ProviderInterface$Callback</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>number</code>></p>
|
||||
<hr>
|
||||
<p><a id="unsubscribe"></a></p>
|
||||
<h2 id="unsubscribe">unsubscribe</h2>
|
||||
<p>▸ <strong>unsubscribe</strong>(type: <em><code>string</code></em>, method: <em><code>string</code></em>, id: <em><code>number</code></em>): <code>Promise</code><<code>boolean</code>></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#unsubscribe">unsubscribe</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L91" target="_blank">http/index.ts:91</a></em></p>
|
||||
<p>Subscriptions are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>id</td>
|
||||
<td><code>number</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>boolean</code>></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../" class="navigation navigation-prev " aria-label="Previous page: api-provider">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="_ws_index_.wsprovider.html" class="navigation navigation-next " aria-label="Next page: WsProvider">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"HttpProvider","level":"1.3.1","depth":2,"next":{"title":"WsProvider","level":"1.3.2","depth":2,"path":"api-provider/classes/_ws_index_.wsprovider.md","ref":"api-provider/classes/_ws_index_.wsprovider.md","articles":[]},"previous":{"title":"api-provider","level":"1.3","depth":1,"path":"api-provider/README.md","ref":"api-provider/README.md","articles":[{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},{"title":"WsProvider","level":"1.3.2","depth":2,"path":"api-provider/classes/_ws_index_.wsprovider.md","ref":"api-provider/classes/_ws_index_.wsprovider.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/classes/_http_index_.httpprovider.md","mtime":"2018-09-19T11:17:52.197Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook.js"></script>
|
||||
<script src="../../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
|
||||
|
||||
The HTTP Provider allows sending requests using HTTP. 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](_ws_index_.wsprovider.md).
|
||||
*__example__*: ```javascript
|
||||
import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
const provider = new WsProvider('http://127.0.0.1:9933');
|
||||
const api = createApi(provider);
|
||||
```
|
||||
|
||||
*__see__*: [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**HttpProvider**
|
||||
|
||||
# Implements
|
||||
|
||||
* [ProviderInterface](../interfaces/_types_d_.providerinterface.md)
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new HttpProvider**(endpoint: *`string`*): [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
*Defined in [http/index.ts:35](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L35)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| endpoint | `string` |
|
||||
|
||||
**Returns:** [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="isconnected"></a>
|
||||
|
||||
## isConnected
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[isConnected](../interfaces/_types_d_.providerinterface.md#isconnected)*
|
||||
|
||||
*Defined in [http/index.ts:49](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L49)*
|
||||
|
||||
Whether the node is connected or not.
|
||||
|
||||
**Returns:** `boolean`
|
||||
true if connected
|
||||
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
## on
|
||||
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb)*): `void`
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[on](../interfaces/_types_d_.providerinterface.md#on)*
|
||||
|
||||
*Defined in [http/index.ts:56](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L56)*
|
||||
|
||||
Events are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | [ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb) |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
## send
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[send](../interfaces/_types_d_.providerinterface.md#send)*
|
||||
|
||||
*Defined in [http/index.ts:60](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L60)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
## subscribe
|
||||
|
||||
▸ **subscribe**(types: *`string`*, method: *`string`*, params: *`Array`<`any`>*, cb: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[subscribe](../interfaces/_types_d_.providerinterface.md#subscribe)*
|
||||
|
||||
*Defined in [http/index.ts:82](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L82)*
|
||||
|
||||
Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| types | `string` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
| cb | [ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback) |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
## unsubscribe
|
||||
|
||||
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[unsubscribe](../interfaces/_types_d_.providerinterface.md#unsubscribe)*
|
||||
|
||||
*Defined in [http/index.ts:91](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L91)*
|
||||
|
||||
Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | `string` |
|
||||
| method | `string` |
|
||||
| id | `number` |
|
||||
|
||||
**Returns:** `Promise`<`boolean`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,857 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>WsProvider · Polkadot API Book</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../../api-rx/" />
|
||||
|
||||
|
||||
<link rel="prev" href="_http_index_.httpprovider.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../../">
|
||||
|
||||
<a href="../../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../../api/">
|
||||
|
||||
<a href="../../api/">
|
||||
|
||||
|
||||
api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="_http_index_.httpprovider.html">
|
||||
|
||||
<a href="_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.3.2" data-path="_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
|
||||
api-rx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../examples/">
|
||||
|
||||
<a href="../../examples/">
|
||||
|
||||
|
||||
Overview
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../examples/01_simple_connect/">
|
||||
|
||||
<a href="../../examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../../examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../examples/04_generate_account/">
|
||||
|
||||
<a href="../../examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../examples/05_read_storage/">
|
||||
|
||||
<a href="../../examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../../examples/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../../examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="../.." >WsProvider</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<p>The WebSocket Provider allows sending requests using WebSocket. Unlike the <a href="_http_index_.httpprovider.html">HttpProvider</a>, it does support subscriptions and allows listening to events such as new blocks or balance changes.</p>
|
||||
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> createApi <span class="hljs-keyword">from</span> <span class="hljs-string">'@polkadot/api'</span>;
|
||||
<span class="hljs-keyword">import</span> WsProvider <span class="hljs-keyword">from</span> <span class="hljs-string">'@polkadot/api-provider/ws'</span>;
|
||||
<span class="hljs-keyword">const</span> provider = <span class="hljs-keyword">new</span> WsProvider(<span class="hljs-string">'ws://127.0.0.1:9944'</span>);
|
||||
<span class="hljs-keyword">const</span> api = createApi(provider);
|
||||
</code></pre>
|
||||
<p><em><strong>example</strong></em>: ```javascript
|
||||
import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
const provider = new WsProvider('ws://127.0.0.1:9944');
|
||||
const api = createApi(provider);</p>
|
||||
<pre><code>
|
||||
*__see__*: [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
# Type parameters
|
||||
#### EventTypes : `string` &#124; `symbol`
|
||||
|
||||
# Hierarchy
|
||||
|
||||
`EventEmitter`
|
||||
|
||||
**↳ WsProvider**
|
||||
|
||||
# Implements
|
||||
|
||||
* `WSProviderInterface`
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new WsProvider**(endpoint: *`string`*, autoConnect?: *`boolean`*): [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
*Defined in [ws/index.ts:69](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L69)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value | Description |
|
||||
| ------ | ------ | ------ | ------ |
|
||||
| endpoint | `string` | - | The endpoint url. Usually \`ws://ip:9944\` or \`wss://ip:9944\` |
|
||||
| `Default value` autoConnect | `boolean` | true | Whether to connect automatically or not. |
|
||||
|
||||
**Returns:** [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
___
|
||||
|
||||
# Properties
|
||||
|
||||
<a id="prefixed"></a>
|
||||
|
||||
## `<Static>` prefixed
|
||||
|
||||
**● prefixed**: * `string` &#124; `boolean`
|
||||
*
|
||||
|
||||
*Inherited from EventEmitter.prefixed*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:6*
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="addlistener"></a>
|
||||
|
||||
## addListener
|
||||
|
||||
▸ **addListener**(event: *`EventTypes`*, fn: *`ListenerFn`*, context?: *`any`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.addListener*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:33*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| fn | `ListenerFn` |
|
||||
| `Optional` context | `any` |
|
||||
|
||||
**Returns:** `this`
|
||||
|
||||
___
|
||||
<a id="connect"></a>
|
||||
|
||||
## connect
|
||||
|
||||
▸ **connect**(): `void`
|
||||
|
||||
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L99)*
|
||||
|
||||
The [WsProvider](_ws_index_.wsprovider.md) connects automatically by default. if you decided otherwise, you may connect manually using this method.
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="emit"></a>
|
||||
|
||||
## emit
|
||||
|
||||
▸ **emit**(event: *`EventTypes`*, ...args: *`Array`<`any`>*): `boolean`
|
||||
|
||||
*Inherited from EventEmitter.emit*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:27*
|
||||
|
||||
Calls each of the listeners registered for a given event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| `Rest` args | `Array`<`any`> |
|
||||
|
||||
**Returns:** `boolean`
|
||||
|
||||
___
|
||||
<a id="eventnames"></a>
|
||||
|
||||
## eventNames
|
||||
|
||||
▸ **eventNames**(): `Array`<`EventTypes`>
|
||||
|
||||
*Inherited from EventEmitter.eventNames*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:12*
|
||||
|
||||
Return an array listing the events for which the emitter has registered listeners.
|
||||
|
||||
**Returns:** `Array`<`EventTypes`>
|
||||
|
||||
___
|
||||
<a id="isconnected"></a>
|
||||
|
||||
## isConnected
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L116)*
|
||||
|
||||
Whether the node is connected or not.
|
||||
|
||||
**Returns:** `boolean`
|
||||
true if connected
|
||||
|
||||
___
|
||||
<a id="listenercount"></a>
|
||||
|
||||
## listenerCount
|
||||
|
||||
▸ **listenerCount**(event: *`EventTypes`*): `number`
|
||||
|
||||
*Inherited from EventEmitter.listenerCount*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:22*
|
||||
|
||||
Return the number of listeners listening to a given event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
___
|
||||
<a id="listeners"></a>
|
||||
|
||||
## listeners
|
||||
|
||||
▸ **listeners**(event: *`EventTypes`*): `Array`<`ListenerFn`>
|
||||
|
||||
*Inherited from EventEmitter.listeners*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:17*
|
||||
|
||||
Return the listeners registered for a given event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
|
||||
**Returns:** `Array`<`ListenerFn`>
|
||||
|
||||
___
|
||||
<a id="off"></a>
|
||||
|
||||
## off
|
||||
|
||||
▸ **off**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` &#124; `false` &#124; `true`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.off*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:44*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` context | `any` |
|
||||
| `Optional` once | `undefined` &#124; `false` &#124; `true`|
|
||||
|
||||
**Returns:** `this`
|
||||
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
## on
|
||||
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb)*): `this`
|
||||
|
||||
*Overrides EventEmitter.on*
|
||||
|
||||
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L126)*
|
||||
|
||||
Listens on events after having subscribed using the [subscribe](_ws_index_.wsprovider.md#subscribe) function.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Description |
|
||||
| ------ | ------ | ------ |
|
||||
| type | [ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted) | Event |
|
||||
| sub | [ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb) | Callback |
|
||||
|
||||
**Returns:** `this`
|
||||
[description]
|
||||
|
||||
___
|
||||
<a id="once"></a>
|
||||
|
||||
## once
|
||||
|
||||
▸ **once**(event: *`EventTypes`*, fn: *`ListenerFn`*, context?: *`any`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.once*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:38*
|
||||
|
||||
Add a one-time listener for a given event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| fn | `ListenerFn` |
|
||||
| `Optional` context | `any` |
|
||||
|
||||
**Returns:** `this`
|
||||
|
||||
___
|
||||
<a id="removealllisteners"></a>
|
||||
|
||||
## removeAllListeners
|
||||
|
||||
▸ **removeAllListeners**(event?: *[EventTypes]()*): `this`
|
||||
|
||||
*Inherited from EventEmitter.removeAllListeners*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:49*
|
||||
|
||||
Remove all listeners, or those of the specified event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Optional` event | [EventTypes]() |
|
||||
|
||||
**Returns:** `this`
|
||||
|
||||
___
|
||||
<a id="removelistener"></a>
|
||||
|
||||
## removeListener
|
||||
|
||||
▸ **removeListener**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` &#124; `false` &#124; `true`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.removeListener*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:43*
|
||||
|
||||
Remove the listeners of a given event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` context | `any` |
|
||||
| `Optional` once | `undefined` &#124; `false` &#124; `true`|
|
||||
|
||||
**Returns:** `this`
|
||||
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
## send
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*, subscription?: *`SubscriptionHandler`*): `Promise`<`any`>
|
||||
|
||||
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L130)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
| `Optional` subscription | `SubscriptionHandler` |
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
## subscribe
|
||||
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, callback: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Defined in [ws/index.ts:182](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L182)*
|
||||
|
||||
Allows subscribing to a specific event.
|
||||
*__example__*: ```javascript
|
||||
const provider = new WsProvider('ws://127.0.0.1:9944')
|
||||
const api = createApi(provider)
|
||||
api.state.storage([[storage.staking.public.freeBalanceOf, <Address>]], (_, values) => {
|
||||
console.log(values)
|
||||
}).then((subscriptionId) => {
|
||||
console.log('balance changes subscription id: ', subscriptionId)
|
||||
})
|
||||
</code></pre><p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>string</code></td>
|
||||
<td>Subscription type</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
<td>Subscription method</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
<td>Parameters</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>callback</td>
|
||||
<td><a href="../modules/_types_d_.md#providerinterface_callback">ProviderInterface$Callback</a></td>
|
||||
<td>Callback</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>number</code>>
|
||||
Promise resolving to the dd of the subscription you can use with [[unsubscribe]]</p>
|
||||
<hr>
|
||||
<p><a id="unsubscribe"></a></p>
|
||||
<h2 id="unsubscribe">unsubscribe</h2>
|
||||
<p>▸ <strong>unsubscribe</strong>(type: <em><code>string</code></em>, method: <em><code>string</code></em>, id: <em><code>number</code></em>): <code>Promise</code><<code>boolean</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L191" target="_blank">ws/index.ts:191</a></em></p>
|
||||
<p>Allows unsubscribing to subscriptions made with <a href="_ws_index_.wsprovider.html#subscribe">subscribe</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>id</td>
|
||||
<td><code>number</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>boolean</code>></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="_http_index_.httpprovider.html" class="navigation navigation-prev " aria-label="Previous page: HttpProvider">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../../api-rx/" class="navigation navigation-next " aria-label="Next page: api-rx">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"WsProvider","level":"1.3.2","depth":2,"next":{"title":"api-rx","level":"1.4","depth":1,"path":"api-rx/README.md","ref":"api-rx/README.md","articles":[{"title":"ApiRx","level":"1.4.1","depth":2,"path":"api-rx/classes/_index_.rxapi.md","ref":"api-rx/classes/_index_.rxapi.md","articles":[]}]},"previous":{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/classes/_ws_index_.wsprovider.md","mtime":"2018-09-19T11:17:52.279Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook.js"></script>
|
||||
<script src="../../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+56
-92
@@ -1,8 +1,6 @@
|
||||
[Polkadot JS API](../README.md) > [WsProvider](../classes/wsprovider.md)
|
||||
|
||||
# Class: WsProvider
|
||||
|
||||
The WebSocket Provider allows sending requests using WebSocket. Unlike the [HttpProvider](httpprovider.md), it does support subscriptions and allows listening to events such as new blocks or balance changes.
|
||||
The WebSocket Provider allows sending requests using WebSocket. Unlike the [HttpProvider](_http_index_.httpprovider.md), it does support subscriptions and allows listening to events such as new blocks or balance changes.
|
||||
|
||||
```javascript
|
||||
import createApi from '@polkadot/api';
|
||||
@@ -17,64 +15,30 @@ const provider = new WsProvider('ws://127.0.0.1:9944');
|
||||
const api = createApi(provider);
|
||||
```
|
||||
|
||||
*__see__*: [HttpProvider](httpprovider.md)
|
||||
*__see__*: [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
## Type parameters
|
||||
# Type parameters
|
||||
#### EventTypes : `string` | `symbol`
|
||||
|
||||
## Hierarchy
|
||||
# Hierarchy
|
||||
|
||||
`EventEmitter`
|
||||
|
||||
**↳ WsProvider**
|
||||
|
||||
## Implements
|
||||
# Implements
|
||||
|
||||
* `WSProviderInterface`
|
||||
|
||||
## Index
|
||||
|
||||
### Modules
|
||||
|
||||
* [EventEmitter](../modules/wsprovider.eventemitter.md)
|
||||
|
||||
### Constructors
|
||||
|
||||
* [constructor](wsprovider.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
* [prefixed](wsprovider.md#prefixed)
|
||||
|
||||
### Methods
|
||||
|
||||
* [addListener](wsprovider.md#addlistener)
|
||||
* [connect](wsprovider.md#connect)
|
||||
* [emit](wsprovider.md#emit)
|
||||
* [eventNames](wsprovider.md#eventnames)
|
||||
* [isConnected](wsprovider.md#isconnected)
|
||||
* [listenerCount](wsprovider.md#listenercount)
|
||||
* [listeners](wsprovider.md#listeners)
|
||||
* [off](wsprovider.md#off)
|
||||
* [on](wsprovider.md#on)
|
||||
* [once](wsprovider.md#once)
|
||||
* [removeAllListeners](wsprovider.md#removealllisteners)
|
||||
* [removeListener](wsprovider.md#removelistener)
|
||||
* [send](wsprovider.md#send)
|
||||
* [subscribe](wsprovider.md#subscribe)
|
||||
* [unsubscribe](wsprovider.md#unsubscribe)
|
||||
|
||||
---
|
||||
|
||||
## Constructors
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
### constructor
|
||||
## constructor
|
||||
|
||||
⊕ **new WsProvider**(endpoint: *`string`*, autoConnect?: *`boolean`*): [WsProvider](wsprovider.md)
|
||||
⊕ **new WsProvider**(endpoint: *`string`*, autoConnect?: *`boolean`*): [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
*Defined in [ws/index.ts:69](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L69)*
|
||||
*Defined in [ws/index.ts:69](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L69)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -83,36 +47,36 @@ const api = createApi(provider);
|
||||
| endpoint | `string` | - | The endpoint url. Usually \`ws://ip:9944\` or \`wss://ip:9944\` |
|
||||
| `Default value` autoConnect | `boolean` | true | Whether to connect automatically or not. |
|
||||
|
||||
**Returns:** [WsProvider](wsprovider.md)
|
||||
**Returns:** [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
___
|
||||
|
||||
## Properties
|
||||
# Properties
|
||||
|
||||
<a id="prefixed"></a>
|
||||
|
||||
### `<Static>` prefixed
|
||||
## `<Static>` prefixed
|
||||
|
||||
**● prefixed**: * `string` | `boolean`
|
||||
*
|
||||
|
||||
*Inherited from EventEmitter.prefixed*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:6*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:6*
|
||||
|
||||
___
|
||||
|
||||
## Methods
|
||||
# Methods
|
||||
|
||||
<a id="addlistener"></a>
|
||||
|
||||
### addListener
|
||||
## addListener
|
||||
|
||||
▸ **addListener**(event: *`EventTypes`*, fn: *`ListenerFn`*, context?: *`any`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.addListener*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:33*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:33*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -127,26 +91,26 @@ ___
|
||||
___
|
||||
<a id="connect"></a>
|
||||
|
||||
### connect
|
||||
## connect
|
||||
|
||||
▸ **connect**(): `void`
|
||||
|
||||
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L99)*
|
||||
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L99)*
|
||||
|
||||
The [WsProvider](wsprovider.md) connects automatically by default. if you decided otherwise, you may connect manually using this method.
|
||||
The [WsProvider](_ws_index_.wsprovider.md) connects automatically by default. if you decided otherwise, you may connect manually using this method.
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="emit"></a>
|
||||
|
||||
### emit
|
||||
## emit
|
||||
|
||||
▸ **emit**(event: *`EventTypes`*, ...args: *`Array`<`any`>*): `boolean`
|
||||
|
||||
*Inherited from EventEmitter.emit*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:27*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:27*
|
||||
|
||||
Calls each of the listeners registered for a given event.
|
||||
|
||||
@@ -162,13 +126,13 @@ Calls each of the listeners registered for a given event.
|
||||
___
|
||||
<a id="eventnames"></a>
|
||||
|
||||
### eventNames
|
||||
## eventNames
|
||||
|
||||
▸ **eventNames**(): `Array`<`EventTypes`>
|
||||
|
||||
*Inherited from EventEmitter.eventNames*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:12*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:12*
|
||||
|
||||
Return an array listing the events for which the emitter has registered listeners.
|
||||
|
||||
@@ -177,11 +141,11 @@ Return an array listing the events for which the emitter has registered listener
|
||||
___
|
||||
<a id="isconnected"></a>
|
||||
|
||||
### isConnected
|
||||
## isConnected
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L116)*
|
||||
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L116)*
|
||||
|
||||
Whether the node is connected or not.
|
||||
|
||||
@@ -191,13 +155,13 @@ true if connected
|
||||
___
|
||||
<a id="listenercount"></a>
|
||||
|
||||
### listenerCount
|
||||
## listenerCount
|
||||
|
||||
▸ **listenerCount**(event: *`EventTypes`*): `number`
|
||||
|
||||
*Inherited from EventEmitter.listenerCount*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:22*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:22*
|
||||
|
||||
Return the number of listeners listening to a given event.
|
||||
|
||||
@@ -212,13 +176,13 @@ Return the number of listeners listening to a given event.
|
||||
___
|
||||
<a id="listeners"></a>
|
||||
|
||||
### listeners
|
||||
## listeners
|
||||
|
||||
▸ **listeners**(event: *`EventTypes`*): `Array`<`ListenerFn`>
|
||||
|
||||
*Inherited from EventEmitter.listeners*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:17*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:17*
|
||||
|
||||
Return the listeners registered for a given event.
|
||||
|
||||
@@ -233,20 +197,20 @@ Return the listeners registered for a given event.
|
||||
___
|
||||
<a id="off"></a>
|
||||
|
||||
### off
|
||||
## off
|
||||
|
||||
▸ **off**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` | `false` | `true`*): `this`
|
||||
▸ **off**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` | `false` | `true`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.off*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:44*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:44*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` context | `any` |
|
||||
| `Optional` once | `undefined` | `false` | `true`|
|
||||
|
||||
@@ -255,22 +219,22 @@ ___
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
### on
|
||||
## on
|
||||
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../#providerinterface_emitcb)*): `this`
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb)*): `this`
|
||||
|
||||
*Overrides EventEmitter.on*
|
||||
|
||||
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L126)*
|
||||
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L126)*
|
||||
|
||||
Listens on events after having subscribed using the [subscribe](wsprovider.md#subscribe) function.
|
||||
Listens on events after having subscribed using the [subscribe](_ws_index_.wsprovider.md#subscribe) function.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Description |
|
||||
| ------ | ------ | ------ |
|
||||
| type | [ProviderInterface$Emitted](../#providerinterface_emitted) | Event |
|
||||
| sub | [ProviderInterface$EmitCb](../#providerinterface_emitcb) | Callback |
|
||||
| type | [ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted) | Event |
|
||||
| sub | [ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb) | Callback |
|
||||
|
||||
**Returns:** `this`
|
||||
[description]
|
||||
@@ -278,13 +242,13 @@ Listens on events after having subscribed using the [subscribe](wsprovider.md#su
|
||||
___
|
||||
<a id="once"></a>
|
||||
|
||||
### once
|
||||
## once
|
||||
|
||||
▸ **once**(event: *`EventTypes`*, fn: *`ListenerFn`*, context?: *`any`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.once*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:38*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:38*
|
||||
|
||||
Add a one-time listener for a given event.
|
||||
|
||||
@@ -301,13 +265,13 @@ Add a one-time listener for a given event.
|
||||
___
|
||||
<a id="removealllisteners"></a>
|
||||
|
||||
### removeAllListeners
|
||||
## removeAllListeners
|
||||
|
||||
▸ **removeAllListeners**(event?: *[EventTypes]()*): `this`
|
||||
|
||||
*Inherited from EventEmitter.removeAllListeners*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:49*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:49*
|
||||
|
||||
Remove all listeners, or those of the specified event.
|
||||
|
||||
@@ -322,13 +286,13 @@ Remove all listeners, or those of the specified event.
|
||||
___
|
||||
<a id="removelistener"></a>
|
||||
|
||||
### removeListener
|
||||
## removeListener
|
||||
|
||||
▸ **removeListener**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` | `false` | `true`*): `this`
|
||||
▸ **removeListener**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` | `false` | `true`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.removeListener*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:43*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:43*
|
||||
|
||||
Remove the listeners of a given event.
|
||||
|
||||
@@ -337,7 +301,7 @@ Remove the listeners of a given event.
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` context | `any` |
|
||||
| `Optional` once | `undefined` | `false` | `true`|
|
||||
|
||||
@@ -346,11 +310,11 @@ Remove the listeners of a given event.
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
### send
|
||||
## send
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*, subscription?: *`SubscriptionHandler`*): `Promise`<`any`>
|
||||
|
||||
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L130)*
|
||||
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L130)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -365,11 +329,11 @@ ___
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
### subscribe
|
||||
## subscribe
|
||||
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, callback: *[ProviderInterface$Callback](../#providerinterface_callback)*): `Promise`<`number`>
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, callback: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Defined in [ws/index.ts:182](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L182)*
|
||||
*Defined in [ws/index.ts:182](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L182)*
|
||||
|
||||
Allows subscribing to a specific event.
|
||||
*__example__*: ```javascript
|
||||
@@ -389,7 +353,7 @@ api.state.storage([[storage.staking.public.freeBalanceOf, <Address>]], (_, value
|
||||
| type | `string` | Subscription type |
|
||||
| method | `string` | Subscription method |
|
||||
| params | `Array`<`any`> | Parameters |
|
||||
| callback | [ProviderInterface$Callback](../#providerinterface_callback) | Callback |
|
||||
| callback | [ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback) | Callback |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
Promise resolving to the dd of the subscription you can use with [[unsubscribe]]
|
||||
@@ -397,13 +361,13 @@ Promise resolving to the dd of the subscription you can use with [[unsubscribe]]
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
### unsubscribe
|
||||
## unsubscribe
|
||||
|
||||
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Defined in [ws/index.ts:191](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L191)*
|
||||
*Defined in [ws/index.ts:191](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L191)*
|
||||
|
||||
Allows unsubscribing to subscriptions made with [subscribe](wsprovider.md#subscribe).
|
||||
Allows unsubscribing to subscriptions made with [subscribe](_ws_index_.wsprovider.md#subscribe).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
[Polkadot JS API](../README.md) > [HttpProvider](../classes/httpprovider.md)
|
||||
|
||||
# Class: HttpProvider
|
||||
|
||||
The HTTP Provider allows sending requests using HTTP. 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](wsprovider.md).
|
||||
*__example__*: ```javascript
|
||||
import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
const provider = new WsProvider('http://127.0.0.1:9933');
|
||||
const api = createApi(provider);
|
||||
```
|
||||
|
||||
*__see__*: [WsProvider](wsprovider.md)
|
||||
|
||||
## Hierarchy
|
||||
|
||||
**HttpProvider**
|
||||
|
||||
## Implements
|
||||
|
||||
* [ProviderInterface](../interfaces/providerinterface.md)
|
||||
|
||||
## Index
|
||||
|
||||
### Constructors
|
||||
|
||||
* [constructor](httpprovider.md#constructor)
|
||||
|
||||
### Methods
|
||||
|
||||
* [isConnected](httpprovider.md#isconnected)
|
||||
* [on](httpprovider.md#on)
|
||||
* [send](httpprovider.md#send)
|
||||
* [subscribe](httpprovider.md#subscribe)
|
||||
* [unsubscribe](httpprovider.md#unsubscribe)
|
||||
|
||||
---
|
||||
|
||||
## Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
### constructor
|
||||
|
||||
⊕ **new HttpProvider**(endpoint: *`string`*): [HttpProvider](httpprovider.md)
|
||||
|
||||
*Defined in [http/index.ts:35](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L35)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| endpoint | `string` |
|
||||
|
||||
**Returns:** [HttpProvider](httpprovider.md)
|
||||
|
||||
___
|
||||
|
||||
## Methods
|
||||
|
||||
<a id="isconnected"></a>
|
||||
|
||||
### isConnected
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/providerinterface.md).[isConnected](../interfaces/providerinterface.md#isconnected)*
|
||||
|
||||
*Defined in [http/index.ts:49](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L49)*
|
||||
|
||||
Whether the node is connected or not.
|
||||
|
||||
**Returns:** `boolean`
|
||||
true if connected
|
||||
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
### on
|
||||
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../#providerinterface_emitcb)*): `void`
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/providerinterface.md).[on](../interfaces/providerinterface.md#on)*
|
||||
|
||||
*Defined in [http/index.ts:56](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L56)*
|
||||
|
||||
Events are not supported with the HttpProvider, see [WsProvider](wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | [ProviderInterface$Emitted](../#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](../#providerinterface_emitcb) |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
### send
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/providerinterface.md).[send](../interfaces/providerinterface.md#send)*
|
||||
|
||||
*Defined in [http/index.ts:60](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L60)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
### subscribe
|
||||
|
||||
▸ **subscribe**(types: *`string`*, method: *`string`*, params: *`Array`<`any`>*, cb: *[ProviderInterface$Callback](../#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/providerinterface.md).[subscribe](../interfaces/providerinterface.md#subscribe)*
|
||||
|
||||
*Defined in [http/index.ts:82](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L82)*
|
||||
|
||||
Subscriptions are not supported with the HttpProvider, see [WsProvider](wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| types | `string` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
| cb | [ProviderInterface$Callback](../#providerinterface_callback) |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
### unsubscribe
|
||||
|
||||
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/providerinterface.md).[unsubscribe](../interfaces/providerinterface.md#unsubscribe)*
|
||||
|
||||
*Defined in [http/index.ts:91](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L91)*
|
||||
|
||||
Subscriptions are not supported with the HttpProvider, see [WsProvider](wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | `string` |
|
||||
| method | `string` |
|
||||
| id | `number` |
|
||||
|
||||
**Returns:** `Promise`<`boolean`>
|
||||
|
||||
___
|
||||
|
||||
+65
-570
@@ -57,10 +57,10 @@
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../api-rx/" />
|
||||
<link rel="next" href="classes/_http_index_.httpprovider.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../api-format/" />
|
||||
<link rel="prev" href="../api/classes/_index_.api.html" />
|
||||
|
||||
|
||||
</head>
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../api/">
|
||||
|
||||
<a href="../api/">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../api-format/">
|
||||
<a href="../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="2.3" data-path="./">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.3" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../api-rx/">
|
||||
|
||||
<a href="../api-rx/">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../type-extrinsics/">
|
||||
<a href="../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../type-jsonrpc/">
|
||||
|
||||
<a href="../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../type-params/">
|
||||
|
||||
<a href="../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../type-primitives/">
|
||||
|
||||
<a href="../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../type-storage/">
|
||||
|
||||
<a href="../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../examples/">
|
||||
<li class="chapter " data-level="2.1" data-path="../examples/">
|
||||
|
||||
<a href="../examples/">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../examples/01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="../examples/01_simple_connect/">
|
||||
|
||||
<a href="../examples/01_simple_connect/">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../examples/02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../examples/02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../examples/03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../examples/04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="../examples/04_generate_account/">
|
||||
|
||||
<a href="../examples/04_generate_account/">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../examples/05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="../examples/05_read_storage/">
|
||||
|
||||
<a href="../examples/05_read_storage/">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../examples/06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../examples/06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../examples/07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../examples/07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../CONTRIBUTING.html">
|
||||
|
||||
<a href="../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -418,476 +383,6 @@
|
||||
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'clientVersion'</span>, version);
|
||||
</code></pre>
|
||||
<h2 id="index">Index</h2>
|
||||
<h3 id="classes">Classes</h3>
|
||||
<ul>
|
||||
<li><a href="classes/httpprovider.md">HttpProvider</a></li>
|
||||
<li><a href="classes/wsprovider.md">WsProvider</a></li>
|
||||
</ul>
|
||||
<h3 id="interfaces">Interfaces</h3>
|
||||
<ul>
|
||||
<li><a href="interfaces/providerinterface.md">ProviderInterface</a></li>
|
||||
</ul>
|
||||
<h3 id="type-aliases">Type aliases</h3>
|
||||
<ul>
|
||||
<li><a href="#httpstate">HttpState</a></li>
|
||||
<li><a href="#jsonrpcobject">JsonRpcObject</a></li>
|
||||
<li><a href="#jsonrpcrequest">JsonRpcRequest</a></li>
|
||||
<li><a href="#jsonrpcresponse">JsonRpcResponse</a></li>
|
||||
<li><a href="#jsonrpcresponsebase">JsonRpcResponseBase</a></li>
|
||||
<li><a href="#jsonrpcresponsebase_error">JsonRpcResponseBase$Error</a></li>
|
||||
<li><a href="#mockstate">MockState</a></li>
|
||||
<li><a href="#mockstate_requests">MockState$Requests</a></li>
|
||||
<li><a href="#mockstate_storage">MockState$Storage</a></li>
|
||||
<li><a href="#mockstate_subscription_callback">MockState$Subscription$Callback</a></li>
|
||||
<li><a href="#mockstate_subscriptions">MockState$Subscriptions</a></li>
|
||||
<li><a href="#providerinterface_callback">ProviderInterface$Callback</a></li>
|
||||
<li><a href="#providerinterface_emitcb">ProviderInterface$EmitCb</a></li>
|
||||
<li><a href="#providerinterface_emitted">ProviderInterface$Emitted</a></li>
|
||||
<li><a href="#rpccoder">RpcCoder</a></li>
|
||||
<li><a href="#rpccoderstate">RpcCoderState</a></li>
|
||||
</ul>
|
||||
<h3 id="functions">Functions</h3>
|
||||
<ul>
|
||||
<li><a href="#decoderesponse">decodeResponse</a></li>
|
||||
<li><a href="#encodejson">encodeJson</a></li>
|
||||
<li><a href="#encodeobject">encodeObject</a></li>
|
||||
<li><a href="#mockprovider">mockProvider</a></li>
|
||||
<li><a href="#mocks">mocks</a></li>
|
||||
<li><a href="#on">on</a></li>
|
||||
<li><a href="#rpccoder">rpcCoder</a></li>
|
||||
<li><a href="#send">send</a></li>
|
||||
<li><a href="#state">state</a></li>
|
||||
<li><a href="#subscribe">subscribe</a></li>
|
||||
<li><a href="#unsubscribe">unsubscribe</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2 id="type-aliases">Type aliases</h2>
|
||||
<p><a id="httpstate"></a></p>
|
||||
<h3 id="httpstate">HttpState</h3>
|
||||
<p><strong>Ƭ HttpState</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/types.d.ts#L8" target="_blank">http/types.d.ts:8</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="jsonrpcobject"></a></p>
|
||||
<h3 id="jsonrpcobject">JsonRpcObject</h3>
|
||||
<p><strong>Ƭ JsonRpcObject</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L5" target="_blank">types.d.ts:5</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="jsonrpcrequest"></a></p>
|
||||
<h3 id="jsonrpcrequest">JsonRpcRequest</h3>
|
||||
<p><strong>Ƭ JsonRpcRequest</strong>: <em> <a href="#jsonrpcobject">JsonRpcObject</a> & <code>object</code>
|
||||
</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L10" target="_blank">types.d.ts:10</a></em></p>
|
||||
<hr>
|
||||
<p><a id="jsonrpcresponse"></a></p>
|
||||
<h3 id="jsonrpcresponse">JsonRpcResponse</h3>
|
||||
<p><strong>Ƭ JsonRpcResponse</strong>: <em> <a href="#jsonrpcobject">JsonRpcObject</a> & <a href="#jsonrpcresponsebase">JsonRpcResponseBase</a>
|
||||
</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L36" target="_blank">types.d.ts:36</a></em></p>
|
||||
<hr>
|
||||
<p><a id="jsonrpcresponsebase"></a></p>
|
||||
<h3 id="jsonrpcresponsebase">JsonRpcResponseBase</h3>
|
||||
<p><strong>Ƭ JsonRpcResponseBase</strong>: <em> <code>JsonRpcResponse$Single</code> & <code>JsonRpcResponse$Subscription</code>
|
||||
</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L34" target="_blank">types.d.ts:34</a></em></p>
|
||||
<hr>
|
||||
<p><a id="jsonrpcresponsebase_error"></a></p>
|
||||
<h3 id="jsonrpcresponsebaseerror">JsonRpcResponseBase$Error</h3>
|
||||
<p><strong>Ƭ JsonRpcResponseBase$Error</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L15" target="_blank">types.d.ts:15</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="mockstate"></a></p>
|
||||
<h3 id="mockstate">MockState</h3>
|
||||
<p><strong>Ƭ MockState</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L27" target="_blank">mock/types.d.ts:27</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="mockstate_requests"></a></p>
|
||||
<h3 id="mockstaterequests">MockState$Requests</h3>
|
||||
<p><strong>Ƭ MockState$Requests</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L23" target="_blank">mock/types.d.ts:23</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(storage: <em><a href="#mockstate_storage">MockState$Storage</a></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>string</code></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>storage</td>
|
||||
<td><a href="#mockstate_storage">MockState$Storage</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>string</code></p>
|
||||
<hr>
|
||||
<p><a id="mockstate_storage"></a></p>
|
||||
<h3 id="mockstatestorage">MockState$Storage</h3>
|
||||
<p><strong>Ƭ MockState$Storage</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L19" target="_blank">mock/types.d.ts:19</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="mockstate_subscription_callback"></a></p>
|
||||
<h3 id="mockstatesubscriptioncallback">MockState$Subscription$Callback</h3>
|
||||
<p><strong>Ƭ MockState$Subscription$Callback</strong>: <em><code>function</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L8" target="_blank">mock/types.d.ts:8</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(error: <em> <code>Error</code> | <code>null</code></em>, value: <em><code>any</code></em>): <code>void</code></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>error</td>
|
||||
<td><code>Error</code> | <code>null</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>value</td>
|
||||
<td><code>any</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="mockstate_subscriptions"></a></p>
|
||||
<h3 id="mockstatesubscriptions">MockState$Subscriptions</h3>
|
||||
<p><strong>Ƭ MockState$Subscriptions</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L10" target="_blank">mock/types.d.ts:10</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="providerinterface_callback"></a></p>
|
||||
<h3 id="providerinterfacecallback">ProviderInterface$Callback</h3>
|
||||
<p><strong>Ƭ ProviderInterface$Callback</strong>: <em><code>function</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L38" target="_blank">types.d.ts:38</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(error: <em> <code>Error</code> | <code>null</code></em>, result: <em><code>any</code></em>): <code>void</code></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>error</td>
|
||||
<td><code>Error</code> | <code>null</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>result</td>
|
||||
<td><code>any</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="providerinterface_emitcb"></a></p>
|
||||
<h3 id="providerinterfaceemitcb">ProviderInterface$EmitCb</h3>
|
||||
<p><strong>Ƭ ProviderInterface$EmitCb</strong>: <em><code>function</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L42" target="_blank">types.d.ts:42</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(value?: <em><code>any</code></em>): <code>any</code></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>Optional</code> value</td>
|
||||
<td><code>any</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>any</code></p>
|
||||
<hr>
|
||||
<p><a id="providerinterface_emitted"></a></p>
|
||||
<h3 id="providerinterfaceemitted">ProviderInterface$Emitted</h3>
|
||||
<p><strong>Ƭ ProviderInterface$Emitted</strong>: <em> "connected" | "disconnected"
|
||||
</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L40" target="_blank">types.d.ts:40</a></em></p>
|
||||
<hr>
|
||||
<p><a id="rpccoder"></a></p>
|
||||
<h3 id="rpccoder">RpcCoder</h3>
|
||||
<p><strong>Ƭ RpcCoder</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/types.d.ts#L7" target="_blank">coder/json/types.d.ts:7</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="rpccoderstate"></a></p>
|
||||
<h3 id="rpccoderstate">RpcCoderState</h3>
|
||||
<p><strong>Ƭ RpcCoderState</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/types.d.ts#L14" target="_blank">coder/json/types.d.ts:14</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<h2 id="functions">Functions</h2>
|
||||
<p><a id="decoderesponse"></a></p>
|
||||
<h3 id="decoderesponse">decodeResponse</h3>
|
||||
<p>▸ <strong>decodeResponse</strong>(self: <em><a href="#rpccoderstate">RpcCoderState</a></em>, response: <em><a href="#jsonrpcresponse">JsonRpcResponse</a></em>): <code>any</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/decodeResponse.ts#L22" target="_blank">coder/json/decodeResponse.ts:22</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#rpccoderstate">RpcCoderState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>response</td>
|
||||
<td><a href="#jsonrpcresponse">JsonRpcResponse</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>any</code></p>
|
||||
<hr>
|
||||
<p><a id="encodejson"></a></p>
|
||||
<h3 id="encodejson">encodeJson</h3>
|
||||
<p>▸ <strong>encodeJson</strong>(self: <em><a href="#rpccoderstate">RpcCoderState</a></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>string</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/encodeJson.ts#L9" target="_blank">coder/json/encodeJson.ts:9</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#rpccoderstate">RpcCoderState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>string</code></p>
|
||||
<hr>
|
||||
<p><a id="encodeobject"></a></p>
|
||||
<h3 id="encodeobject">encodeObject</h3>
|
||||
<p>▸ <strong>encodeObject</strong>(self: <em><a href="#rpccoderstate">RpcCoderState</a></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <a href="#jsonrpcrequest">JsonRpcRequest</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/encodeObject.ts#L8" target="_blank">coder/json/encodeObject.ts:8</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#rpccoderstate">RpcCoderState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <a href="#jsonrpcrequest">JsonRpcRequest</a></p>
|
||||
<hr>
|
||||
<p><a id="mockprovider"></a></p>
|
||||
<h3 id="mockprovider">mockProvider</h3>
|
||||
<p>▸ <strong>mockProvider</strong>(): <a href="interfaces/providerinterface.md">ProviderInterface</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/index.ts#L18" target="_blank">mock/index.ts:18</a></em></p>
|
||||
<p>A moock provider mainly used for testing.</p>
|
||||
<p><strong>Returns:</strong> <a href="interfaces/providerinterface.md">ProviderInterface</a>
|
||||
The mock provider</p>
|
||||
<hr>
|
||||
<p><a id="mocks"></a></p>
|
||||
<h3 id="mocks">mocks</h3>
|
||||
<p>▸ <strong>mocks</strong>(__namedParameters: <em><code>object</code></em>): <code>void</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/mocks.ts#L68" target="_blank">mock/mocks.ts:68</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>__namedParameters</td>
|
||||
<td><code>object</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="on"></a></p>
|
||||
<h3 id="on">on</h3>
|
||||
<p>▸ <strong>on</strong>(self: <em><a href="#mockstate">MockState</a></em>, type: <em><a href="#providerinterface_emitted">ProviderInterface$Emitted</a></em>, sub: <em><a href="#providerinterface_emitcb">ProviderInterface$EmitCb</a></em>): <code>void</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/on.ts#L8" target="_blank">mock/on.ts:8</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#mockstate">MockState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><a href="#providerinterface_emitted">ProviderInterface$Emitted</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sub</td>
|
||||
<td><a href="#providerinterface_emitcb">ProviderInterface$EmitCb</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="rpccoder"></a></p>
|
||||
<h3 id="rpccoder">rpcCoder</h3>
|
||||
<p>▸ <strong>rpcCoder</strong>(): <a href="#rpccoder">RpcCoder</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/index.ts#L12" target="_blank">coder/json/index.ts:12</a></em></p>
|
||||
<p><strong>Returns:</strong> <a href="#rpccoder">RpcCoder</a></p>
|
||||
<hr>
|
||||
<p><a id="send"></a></p>
|
||||
<h3 id="send">send</h3>
|
||||
<p>▸ <strong>send</strong>(__namedParameters: <em><code>object</code></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>Promise</code><<code>any</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/send.ts#L7" target="_blank">mock/send.ts:7</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>__namedParameters</td>
|
||||
<td><code>object</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>any</code>></p>
|
||||
<hr>
|
||||
<p><a id="state"></a></p>
|
||||
<h3 id="state">state</h3>
|
||||
<p>▸ <strong>state</strong>(): <a href="#mockstate">MockState</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/state.ts#L38" target="_blank">mock/state.ts:38</a></em></p>
|
||||
<p><strong>Returns:</strong> <a href="#mockstate">MockState</a></p>
|
||||
<hr>
|
||||
<p><a id="subscribe"></a></p>
|
||||
<h3 id="subscribe">subscribe</h3>
|
||||
<p>▸ <strong>subscribe</strong>(self: <em><a href="#mockstate">MockState</a></em>, type: <em><code>string</code></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>Promise</code><<code>number</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/subscribe.ts#L7" target="_blank">mock/subscribe.ts:7</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#mockstate">MockState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>number</code>></p>
|
||||
<hr>
|
||||
<p><a id="unsubscribe"></a></p>
|
||||
<h3 id="unsubscribe">unsubscribe</h3>
|
||||
<p>▸ <strong>unsubscribe</strong>(self: <em><a href="#mockstate">MockState</a></em>, type: <em><code>string</code></em>, name: <em><code>string</code></em>, id: <em><code>number</code></em>): <code>Promise</code><<code>boolean</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/unsubscribe.ts#L7" target="_blank">mock/unsubscribe.ts:7</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#mockstate">MockState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>id</td>
|
||||
<td><code>number</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>boolean</code>></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</section>
|
||||
@@ -915,12 +410,12 @@ The mock provider</p>
|
||||
|
||||
|
||||
|
||||
<a href="../api-format/" class="navigation navigation-prev " aria-label="Previous page: api-format">
|
||||
<a href="../api/classes/_index_.api.html" class="navigation navigation-prev " aria-label="Previous page: Api">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../api-rx/" class="navigation navigation-next " aria-label="Next page: api-rx">
|
||||
<a href="classes/_http_index_.httpprovider.html" class="navigation navigation-next " aria-label="Next page: HttpProvider">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
@@ -931,7 +426,7 @@ The mock provider</p>
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"api-provider","level":"2.3","depth":1,"next":{"title":"api-rx","level":"2.4","depth":1,"path":"api-rx/README.md","ref":"api-rx/README.md","articles":[]},"previous":{"title":"api-format","level":"2.2","depth":1,"path":"api-format/README.md","ref":"api-format/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/README.md","mtime":"2018-09-17T12:35:52.445Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"api-provider","level":"1.3","depth":1,"next":{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},"previous":{"title":"Api","level":"1.2.1","depth":2,"path":"api/classes/_index_.api.md","ref":"api/classes/_index_.api.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/README.md","mtime":"2018-09-19T11:17:52.103Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
+19
-33
@@ -1,65 +1,51 @@
|
||||
[Polkadot JS API](../README.md) > [ProviderInterface](../interfaces/providerinterface.md)
|
||||
|
||||
# Interface: ProviderInterface
|
||||
|
||||
## Hierarchy
|
||||
# Hierarchy
|
||||
|
||||
**ProviderInterface**
|
||||
|
||||
## Implemented by
|
||||
# Implemented by
|
||||
|
||||
* [HttpProvider](../classes/httpprovider.md)
|
||||
* [HttpProvider](../classes/_http_index_.httpprovider.md)
|
||||
|
||||
## Index
|
||||
|
||||
### Methods
|
||||
|
||||
* [isConnected](providerinterface.md#isconnected)
|
||||
* [on](providerinterface.md#on)
|
||||
* [send](providerinterface.md#send)
|
||||
* [subscribe](providerinterface.md#subscribe)
|
||||
* [unsubscribe](providerinterface.md#unsubscribe)
|
||||
|
||||
---
|
||||
|
||||
## Methods
|
||||
# Methods
|
||||
|
||||
<a id="isconnected"></a>
|
||||
|
||||
### isConnected
|
||||
## isConnected
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Defined in [types.d.ts:45](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L45)*
|
||||
*Defined in [types.d.ts:45](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L45)*
|
||||
|
||||
**Returns:** `boolean`
|
||||
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
### on
|
||||
## on
|
||||
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../#providerinterface_emitcb)*): `void`
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb)*): `void`
|
||||
|
||||
*Defined in [types.d.ts:46](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L46)*
|
||||
*Defined in [types.d.ts:46](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L46)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | [ProviderInterface$Emitted](../#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](../#providerinterface_emitcb) |
|
||||
| type | [ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb) |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
### send
|
||||
## send
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Defined in [types.d.ts:47](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L47)*
|
||||
*Defined in [types.d.ts:47](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L47)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -73,11 +59,11 @@ ___
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
### subscribe
|
||||
## subscribe
|
||||
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, cb: *[ProviderInterface$Callback](../#providerinterface_callback)*): `Promise`<`number`>
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, cb: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Defined in [types.d.ts:48](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L48)*
|
||||
*Defined in [types.d.ts:48](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L48)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -86,18 +72,18 @@ ___
|
||||
| type | `string` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
| cb | [ProviderInterface$Callback](../#providerinterface_callback) |
|
||||
| cb | [ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback) |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
### unsubscribe
|
||||
## unsubscribe
|
||||
|
||||
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Defined in [types.d.ts:49](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L49)*
|
||||
*Defined in [types.d.ts:49](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L49)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**EventEmitterStatic**
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new EventEmitterStatic**<`EventTypes`>(): `EventEmitter`<`EventTypes`>
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:57*
|
||||
|
||||
**Type parameters:**
|
||||
|
||||
#### EventTypes : `string` | `symbol`
|
||||
|
||||
**Returns:** `EventEmitter`<`EventTypes`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**ListenerFn**
|
||||
|
||||
# Callable
|
||||
▸ **__call**(...args: *`Array`<`any`>*): `void`
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:53*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Rest` args | `Array`<`any`> |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
[Polkadot JS API](../README.md) > [WsProvider](../classes/wsprovider.md) > [EventEmitter](../modules/wsprovider.eventemitter.md) > [EventEmitterStatic](../interfaces/wsprovider.eventemitter.eventemitterstatic.md)
|
||||
|
||||
# Interface: EventEmitterStatic
|
||||
|
||||
## Hierarchy
|
||||
|
||||
**EventEmitterStatic**
|
||||
|
||||
## Index
|
||||
|
||||
### Constructors
|
||||
|
||||
* [constructor](wsprovider.eventemitter.eventemitterstatic.md#constructor)
|
||||
|
||||
---
|
||||
|
||||
## Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
### constructor
|
||||
|
||||
⊕ **new EventEmitterStatic**<`EventTypes`>(): `EventEmitter`<`EventTypes`>
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:57*
|
||||
|
||||
**Type parameters:**
|
||||
|
||||
#### EventTypes : `string` | `symbol`
|
||||
|
||||
**Returns:** `EventEmitter`<`EventTypes`>
|
||||
|
||||
___
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
[Polkadot JS API](../README.md) > [WsProvider](../classes/wsprovider.md) > [EventEmitter](../modules/wsprovider.eventemitter.md) > [ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md)
|
||||
|
||||
# Interface: ListenerFn
|
||||
|
||||
## Hierarchy
|
||||
|
||||
**ListenerFn**
|
||||
|
||||
## Callable
|
||||
▸ **__call**(...args: *`Array`<`any`>*): `void`
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:53*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Rest` args | `Array`<`any`> |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
## Index
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="decoderesponse"></a>
|
||||
|
||||
## decodeResponse
|
||||
|
||||
▸ **decodeResponse**(self: *[RpcCoderState](_coder_json_types_d_.md#rpccoderstate)*, response: *[JsonRpcResponse](_types_d_.md#jsonrpcresponse)*): `any`
|
||||
|
||||
*Defined in [coder/json/decodeResponse.ts:22](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/decodeResponse.ts#L22)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](_coder_json_types_d_.md#rpccoderstate) |
|
||||
| response | [JsonRpcResponse](_types_d_.md#jsonrpcresponse) |
|
||||
|
||||
**Returns:** `any`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="encodejson"></a>
|
||||
|
||||
## encodeJson
|
||||
|
||||
▸ **encodeJson**(self: *[RpcCoderState](_coder_json_types_d_.md#rpccoderstate)*, method: *`string`*, params: *`Array`<`any`>*): `string`
|
||||
|
||||
*Defined in [coder/json/encodeJson.ts:9](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/encodeJson.ts#L9)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](_coder_json_types_d_.md#rpccoderstate) |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `string`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="encodeobject"></a>
|
||||
|
||||
## encodeObject
|
||||
|
||||
▸ **encodeObject**(self: *[RpcCoderState](_coder_json_types_d_.md#rpccoderstate)*, method: *`string`*, params: *`Array`<`any`>*): [JsonRpcRequest](_types_d_.md#jsonrpcrequest)
|
||||
|
||||
*Defined in [coder/json/encodeObject.ts:8](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/encodeObject.ts#L8)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](_coder_json_types_d_.md#rpccoderstate) |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** [JsonRpcRequest](_types_d_.md#jsonrpcrequest)
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="rpccoder"></a>
|
||||
|
||||
## rpcCoder
|
||||
|
||||
▸ **rpcCoder**(): [RpcCoder](_coder_json_types_d_.md#rpccoder)
|
||||
|
||||
*Defined in [coder/json/index.ts:12](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/index.ts#L12)*
|
||||
|
||||
**Returns:** [RpcCoder](_coder_json_types_d_.md#rpccoder)
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
# Type aliases
|
||||
|
||||
<a id="rpccoder"></a>
|
||||
|
||||
## RpcCoder
|
||||
|
||||
**Ƭ RpcCoder**: *`object`*
|
||||
|
||||
*Defined in [coder/json/types.d.ts:7](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/types.d.ts#L7)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="rpccoderstate"></a>
|
||||
|
||||
## RpcCoderState
|
||||
|
||||
**Ƭ RpcCoderState**: *`object`*
|
||||
|
||||
*Defined in [coder/json/types.d.ts:14](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/types.d.ts#L14)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
# Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [HttpProvider](../classes/_http_index_.httpprovider.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
# Type aliases
|
||||
|
||||
<a id="httpstate"></a>
|
||||
|
||||
## HttpState
|
||||
|
||||
**Ƭ HttpState**: *`object`*
|
||||
|
||||
*Defined in [http/types.d.ts:8](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/types.d.ts#L8)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="mockprovider"></a>
|
||||
|
||||
## mockProvider
|
||||
|
||||
▸ **mockProvider**(): [ProviderInterface](../interfaces/_types_d_.providerinterface.md)
|
||||
|
||||
*Defined in [mock/index.ts:18](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/index.ts#L18)*
|
||||
|
||||
A moock provider mainly used for testing.
|
||||
|
||||
**Returns:** [ProviderInterface](../interfaces/_types_d_.providerinterface.md)
|
||||
The mock provider
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="mocks"></a>
|
||||
|
||||
## mocks
|
||||
|
||||
▸ **mocks**(__namedParameters: *`object`*): `void`
|
||||
|
||||
*Defined in [mock/mocks.ts:68](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/mocks.ts#L68)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="on"></a>
|
||||
|
||||
## on
|
||||
|
||||
▸ **on**(self: *[MockState](_mock_types_d_.md#mockstate)*, type: *[ProviderInterface$Emitted](_types_d_.md#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](_types_d_.md#providerinterface_emitcb)*): `void`
|
||||
|
||||
*Defined in [mock/on.ts:8](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/on.ts#L8)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](_mock_types_d_.md#mockstate) |
|
||||
| type | [ProviderInterface$Emitted](_types_d_.md#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](_types_d_.md#providerinterface_emitcb) |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="send"></a>
|
||||
|
||||
## send
|
||||
|
||||
▸ **send**(__namedParameters: *`object`*, method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Defined in [mock/send.ts:7](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/send.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="state"></a>
|
||||
|
||||
## state
|
||||
|
||||
▸ **state**(): [MockState](_mock_types_d_.md#mockstate)
|
||||
|
||||
*Defined in [mock/state.ts:38](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/state.ts#L38)*
|
||||
|
||||
**Returns:** [MockState](_mock_types_d_.md#mockstate)
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="subscribe"></a>
|
||||
|
||||
## subscribe
|
||||
|
||||
▸ **subscribe**(self: *[MockState](_mock_types_d_.md#mockstate)*, type: *`string`*, method: *`string`*, params: *`Array`<`any`>*): `Promise`<`number`>
|
||||
|
||||
*Defined in [mock/subscribe.ts:7](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/subscribe.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](_mock_types_d_.md#mockstate) |
|
||||
| type | `string` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
|
||||
# Type aliases
|
||||
|
||||
<a id="mockstate"></a>
|
||||
|
||||
## MockState
|
||||
|
||||
**Ƭ MockState**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:27](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/types.d.ts#L27)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="mockstate_requests"></a>
|
||||
|
||||
## MockState$Requests
|
||||
|
||||
**Ƭ MockState$Requests**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:23](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/types.d.ts#L23)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `function`
|
||||
|
||||
▸(storage: *[MockState$Storage](_mock_types_d_.md#mockstate_storage)*, params: *`Array`<`any`>*): `string`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| storage | [MockState$Storage](_mock_types_d_.md#mockstate_storage) |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `string`
|
||||
|
||||
___
|
||||
<a id="mockstate_storage"></a>
|
||||
|
||||
## MockState$Storage
|
||||
|
||||
**Ƭ MockState$Storage**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:19](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/types.d.ts#L19)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="mockstate_subscription_callback"></a>
|
||||
|
||||
## MockState$Subscription$Callback
|
||||
|
||||
**Ƭ MockState$Subscription$Callback**: *`function`*
|
||||
|
||||
*Defined in [mock/types.d.ts:8](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/types.d.ts#L8)*
|
||||
|
||||
#### Type declaration
|
||||
▸(error: * `Error` | `null`*, value: *`any`*): `void`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| error | `Error` | `null`|
|
||||
| value | `any` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="mockstate_subscriptions"></a>
|
||||
|
||||
## MockState$Subscriptions
|
||||
|
||||
**Ƭ MockState$Subscriptions**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:10](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/types.d.ts#L10)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `object`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
## unsubscribe
|
||||
|
||||
▸ **unsubscribe**(self: *[MockState](_mock_types_d_.md#mockstate)*, type: *`string`*, name: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Defined in [mock/unsubscribe.ts:7](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/unsubscribe.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](_mock_types_d_.md#mockstate) |
|
||||
| type | `string` |
|
||||
| name | `string` |
|
||||
| id | `number` |
|
||||
|
||||
**Returns:** `Promise`<`boolean`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
|
||||
|
||||
# Type aliases
|
||||
|
||||
<a id="jsonrpcobject"></a>
|
||||
|
||||
## JsonRpcObject
|
||||
|
||||
**Ƭ JsonRpcObject**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:5](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L5)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="jsonrpcrequest"></a>
|
||||
|
||||
## JsonRpcRequest
|
||||
|
||||
**Ƭ JsonRpcRequest**: * [JsonRpcObject](_types_d_.md#jsonrpcobject) & `object`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L10)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponse"></a>
|
||||
|
||||
## JsonRpcResponse
|
||||
|
||||
**Ƭ JsonRpcResponse**: * [JsonRpcObject](_types_d_.md#jsonrpcobject) & [JsonRpcResponseBase](_types_d_.md#jsonrpcresponsebase)
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:36](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L36)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponsebase"></a>
|
||||
|
||||
## JsonRpcResponseBase
|
||||
|
||||
**Ƭ JsonRpcResponseBase**: * `JsonRpcResponse$Single` & `JsonRpcResponse$Subscription`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:34](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L34)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponsebase_error"></a>
|
||||
|
||||
## JsonRpcResponseBase$Error
|
||||
|
||||
**Ƭ JsonRpcResponseBase$Error**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:15](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L15)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="providerinterface_callback"></a>
|
||||
|
||||
## ProviderInterface$Callback
|
||||
|
||||
**Ƭ ProviderInterface$Callback**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:38](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L38)*
|
||||
|
||||
#### Type declaration
|
||||
▸(error: * `Error` | `null`*, result: *`any`*): `void`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| error | `Error` | `null`|
|
||||
| result | `any` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="providerinterface_emitcb"></a>
|
||||
|
||||
## ProviderInterface$EmitCb
|
||||
|
||||
**Ƭ ProviderInterface$EmitCb**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:42](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L42)*
|
||||
|
||||
#### Type declaration
|
||||
▸(value?: *`any`*): `any`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Optional` value | `any` |
|
||||
|
||||
**Returns:** `any`
|
||||
|
||||
___
|
||||
<a id="providerinterface_emitted"></a>
|
||||
|
||||
## ProviderInterface$Emitted
|
||||
|
||||
**Ƭ ProviderInterface$Emitted**: * "connected" | "disconnected"
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:40](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L40)*
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
# Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [WsProvider](../classes/_ws_index_.wsprovider.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
# Index
|
||||
|
||||
### Interfaces
|
||||
|
||||
* [EventEmitterStatic](../interfaces/_ws_index_.wsprovider.eventemitter.eventemitterstatic.md)
|
||||
* [ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)
|
||||
|
||||
### Variables
|
||||
|
||||
* [EventEmitter](_ws_index_.wsprovider.eventemitter.md#eventemitter)
|
||||
|
||||
---
|
||||
|
||||
# Variables
|
||||
|
||||
<a id="eventemitter"></a>
|
||||
|
||||
## `<Const>` EventEmitter
|
||||
|
||||
**● EventEmitter**: *`EventEmitterStatic`*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:61*
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
[Polkadot JS API](../README.md) > [WsProvider](../classes/wsprovider.md) > [EventEmitter](../modules/wsprovider.eventemitter.md)
|
||||
|
||||
# Module: EventEmitter
|
||||
|
||||
## Index
|
||||
|
||||
### Interfaces
|
||||
|
||||
* [EventEmitterStatic](../interfaces/wsprovider.eventemitter.eventemitterstatic.md)
|
||||
* [ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md)
|
||||
|
||||
### Variables
|
||||
|
||||
* [EventEmitter](wsprovider.eventemitter.md#eventemitter)
|
||||
|
||||
---
|
||||
|
||||
## Variables
|
||||
|
||||
<a id="eventemitter"></a>
|
||||
|
||||
### `<Const>` EventEmitter
|
||||
|
||||
**● EventEmitter**: *`EventEmitterStatic`*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:61*
|
||||
|
||||
___
|
||||
|
||||
Reference in New Issue
Block a user