[CI Skip] 0.30.2

This commit is contained in:
Travis CI
2018-09-28 13:48:04 +00:00
parent 74737b6367
commit 62ed0a7b3f
52 changed files with 514 additions and 532 deletions
@@ -370,12 +370,8 @@
<section class="normal markdown-section">
<p>The HTTP Provider allows sending requests using HTTP. it does not support subscriptions so you won&#xB4;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>: ```javascript
import createApi from &apos;@polkadot/api&apos;;
import WsProvider from &apos;@polkadot/api-provider/ws&apos;;</p>
<p>const provider = new WsProvider(&apos;<a href="http://127.0.0.1:9933" target="_blank">http://127.0.0.1:9933</a>&apos;);
const api = createApi(provider);
```</p>
<em><strong>example</strong></em>: import createApi from &apos;@polkadot/api&apos;; import WsProvider from &apos;@polkadot/api-provider/ws&apos;;</p>
<p>const provider = new WsProvider(&apos;<a href="http://127.0.0.1:9933&apos;" target="_blank">http://127.0.0.1:9933&apos;)</a>); const api = createApi(provider);</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>
@@ -387,7 +383,7 @@ const api = createApi(provider);
<p><a id="constructor"></a></p>
<h2 id="constructor">constructor</h2>
<p>&#x2295; <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/170c337/packages/api-provider/src/http/index.ts#L36" target="_blank">http/index.ts:36</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/http/index.ts#L35" target="_blank">http/index.ts:35</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
@@ -410,7 +406,7 @@ const api = createApi(provider);
<h2 id="isconnected">isConnected</h2>
<p>&#x25B8; <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/170c337/packages/api-provider/src/http/index.ts#L50" target="_blank">http/index.ts:50</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/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>
@@ -419,7 +415,7 @@ true if connected</p>
<h2 id="on">on</h2>
<p>&#x25B8; <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/170c337/packages/api-provider/src/http/index.ts#L57" target="_blank">http/index.ts:57</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/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>
@@ -446,7 +442,7 @@ true if connected</p>
<h2 id="send">send</h2>
<p>&#x25B8; <strong>send</strong>(method: <em><code>string</code></em>, params: <em><code>Array</code>&lt;<code>any</code>&gt;</em>): <code>Promise</code>&lt;<code>any</code>&gt;</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/170c337/packages/api-provider/src/http/index.ts#L61" target="_blank">http/index.ts:61</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/http/index.ts#L60" target="_blank">http/index.ts:60</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
@@ -472,7 +468,7 @@ true if connected</p>
<h2 id="subscribe">subscribe</h2>
<p>&#x25B8; <strong>subscribe</strong>(types: <em><code>string</code></em>, method: <em><code>string</code></em>, params: <em><code>Array</code>&lt;<code>any</code>&gt;</em>, cb: <em><a href="../modules/_types_d_.md#providerinterface_callback">ProviderInterface$Callback</a></em>): <code>Promise</code>&lt;<code>number</code>&gt;</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/170c337/packages/api-provider/src/http/index.ts#L83" target="_blank">http/index.ts:83</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/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>
@@ -507,7 +503,7 @@ true if connected</p>
<h2 id="unsubscribe">unsubscribe</h2>
<p>&#x25B8; <strong>unsubscribe</strong>(type: <em><code>string</code></em>, method: <em><code>string</code></em>, id: <em><code>number</code></em>): <code>Promise</code>&lt;<code>boolean</code>&gt;</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/170c337/packages/api-provider/src/http/index.ts#L92" target="_blank">http/index.ts:92</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/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>
@@ -577,7 +573,7 @@ true if connected</p>
<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-27T11:17:01.801Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-27T11:17:41.057Z"},"basePath":"../..","book":{"language":""}});
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-28T13:47:08.449Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-28T13:47:55.661Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
@@ -1,13 +1,9 @@
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';
*__example__*: 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);
```
const provider = new WsProvider('[http://127.0.0.1:9933')](http://127.0.0.1:9933')); const api = createApi(provider);
*__see__*: [WsProvider](_ws_index_.wsprovider.md)
@@ -27,7 +23,7 @@ const api = createApi(provider);
⊕ **new HttpProvider**(endpoint: *`string`*): [HttpProvider](_http_index_.httpprovider.md)
*Defined in [http/index.ts:36](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/http/index.ts#L36)*
*Defined in [http/index.ts:35](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/http/index.ts#L35)*
**Parameters:**
@@ -49,7 +45,7 @@ ___
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[isConnected](../interfaces/_types_d_.providerinterface.md#isconnected)*
*Defined in [http/index.ts:50](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/http/index.ts#L50)*
*Defined in [http/index.ts:49](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/http/index.ts#L49)*
Whether the node is connected or not.
@@ -65,7 +61,7 @@ ___
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[on](../interfaces/_types_d_.providerinterface.md#on)*
*Defined in [http/index.ts:57](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/http/index.ts#L57)*
*Defined in [http/index.ts:56](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/http/index.ts#L56)*
Events are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
@@ -87,7 +83,7 @@ ___
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[send](../interfaces/_types_d_.providerinterface.md#send)*
*Defined in [http/index.ts:61](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/http/index.ts#L61)*
*Defined in [http/index.ts:60](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/http/index.ts#L60)*
**Parameters:**
@@ -107,7 +103,7 @@ ___
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[subscribe](../interfaces/_types_d_.providerinterface.md#subscribe)*
*Defined in [http/index.ts:83](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/http/index.ts#L83)*
*Defined in [http/index.ts:82](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/http/index.ts#L82)*
Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
@@ -131,7 +127,7 @@ ___
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[unsubscribe](../interfaces/_types_d_.providerinterface.md#unsubscribe)*
*Defined in [http/index.ts:92](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/http/index.ts#L92)*
*Defined in [http/index.ts:91](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/http/index.ts#L91)*
Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
@@ -369,351 +369,377 @@
<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">&apos;@polkadot/api&apos;</span>;
<span class="hljs-keyword">import</span> WsProvider <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>;
<span class="hljs-keyword">const</span> provider = <span class="hljs-keyword">new</span> WsProvider(<span class="hljs-string">&apos;ws://127.0.0.1:9944&apos;</span>);
<span class="hljs-keyword">const</span> api = createApi(provider);
</code></pre>
<p>.
<em><strong>example</strong></em>: ```javascript
import createApi from &apos;@polkadot/api&apos;;
import WsProvider from &apos;@polkadot/api-provider/ws&apos;;
const provider = new WsProvider(&apos;ws://127.0.0.1:9944&apos;);
const api = createApi(provider);</p>
<pre><code>
*__see__*: [HttpProvider](_http_index_.httpprovider.md)
# Type parameters
#### EventTypes : `string` &amp;#124; `symbol`
# Hierarchy
`EventEmitter`
**&#x21B3; WsProvider**
# Implements
* `WSProviderInterface`
# Constructors
&lt;a id=&quot;constructor&quot;&gt;&lt;/a&gt;
## constructor
&#x2295; **new WsProvider**(endpoint: *`string`*, autoConnect?: *`boolean`*): [WsProvider](_ws_index_.wsprovider.md)
*Defined in [ws/index.ts:69](https://github.com/polkadot-js/api/blob/170c337/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
&lt;a id=&quot;prefixed&quot;&gt;&lt;/a&gt;
## `&lt;Static&gt;` prefixed
**&#x25CF; prefixed**: * `string` &amp;#124; `boolean`
*
*Inherited from EventEmitter.prefixed*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:6*
___
# Methods
&lt;a id=&quot;addlistener&quot;&gt;&lt;/a&gt;
## addListener
&#x25B8; **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*
**Parameters:**
| Param | Type |
| ------ | ------ |
| event | `EventTypes` |
| fn | `ListenerFn` |
| `Optional` context | `any` |
**Returns:** `this`
___
&lt;a id=&quot;connect&quot;&gt;&lt;/a&gt;
## connect
&#x25B8; **connect**(): `void`
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/170c337/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`
___
&lt;a id=&quot;emit&quot;&gt;&lt;/a&gt;
## emit
&#x25B8; **emit**(event: *`EventTypes`*, ...args: *`Array`&lt;`any`&gt;*): `boolean`
*Inherited from EventEmitter.emit*
*Defined in /home/travis/build/polkadot-js/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`&lt;`any`&gt; |
**Returns:** `boolean`
___
&lt;a id=&quot;eventnames&quot;&gt;&lt;/a&gt;
## eventNames
&#x25B8; **eventNames**(): `Array`&lt;`EventTypes`&gt;
*Inherited from EventEmitter.eventNames*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:12*
Return an array listing the events for which the emitter has registered listeners.
**Returns:** `Array`&lt;`EventTypes`&gt;
___
&lt;a id=&quot;isconnected&quot;&gt;&lt;/a&gt;
## isConnected
&#x25B8; **isConnected**(): `boolean`
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L116)*
Whether the node is connected or not.
**Returns:** `boolean`
true if connected
___
&lt;a id=&quot;listenercount&quot;&gt;&lt;/a&gt;
## listenerCount
&#x25B8; **listenerCount**(event: *`EventTypes`*): `number`
*Inherited from EventEmitter.listenerCount*
*Defined in /home/travis/build/polkadot-js/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`
___
&lt;a id=&quot;listeners&quot;&gt;&lt;/a&gt;
## listeners
&#x25B8; **listeners**(event: *`EventTypes`*): `Array`&lt;`ListenerFn`&gt;
*Inherited from EventEmitter.listeners*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:17*
Return the listeners registered for a given event.
**Parameters:**
| Param | Type |
| ------ | ------ |
| event | `EventTypes` |
**Returns:** `Array`&lt;`ListenerFn`&gt;
___
&lt;a id=&quot;off&quot;&gt;&lt;/a&gt;
## off
&#x25B8; **off**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` &amp;#124; `false` &amp;#124; `true`*): `this`
*Inherited from EventEmitter.off*
*Defined in /home/travis/build/polkadot-js/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` &amp;#124; `false` &amp;#124; `true`|
**Returns:** `this`
___
&lt;a id=&quot;on&quot;&gt;&lt;/a&gt;
## on
&#x25B8; **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/170c337/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]
___
&lt;a id=&quot;once&quot;&gt;&lt;/a&gt;
## once
&#x25B8; **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*
Add a one-time listener for a given event.
**Parameters:**
| Param | Type |
| ------ | ------ |
| event | `EventTypes` |
| fn | `ListenerFn` |
| `Optional` context | `any` |
**Returns:** `this`
___
&lt;a id=&quot;removealllisteners&quot;&gt;&lt;/a&gt;
## removeAllListeners
&#x25B8; **removeAllListeners**(event?: *[EventTypes]()*): `this`
*Inherited from EventEmitter.removeAllListeners*
*Defined in /home/travis/build/polkadot-js/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`
___
&lt;a id=&quot;removelistener&quot;&gt;&lt;/a&gt;
## removeListener
&#x25B8; **removeListener**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` &amp;#124; `false` &amp;#124; `true`*): `this`
*Inherited from EventEmitter.removeListener*
*Defined in /home/travis/build/polkadot-js/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` &amp;#124; `false` &amp;#124; `true`|
**Returns:** `this`
___
&lt;a id=&quot;send&quot;&gt;&lt;/a&gt;
## send
&#x25B8; **send**(method: *`string`*, params: *`Array`&lt;`any`&gt;*, subscription?: *`SubscriptionHandler`*): `Promise`&lt;`any`&gt;
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L130)*
**Parameters:**
| Param | Type |
| ------ | ------ |
| method | `string` |
| params | `Array`&lt;`any`&gt; |
| `Optional` subscription | `SubscriptionHandler` |
**Returns:** `Promise`&lt;`any`&gt;
___
&lt;a id=&quot;subscribe&quot;&gt;&lt;/a&gt;
## subscribe
&#x25B8; **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`&lt;`any`&gt;*, callback: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`&lt;`number`&gt;
*Defined in [ws/index.ts:183](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L183)*
Allows subscribing to a specific event.
*__example__*: ```javascript
const provider = new WsProvider(&apos;ws://127.0.0.1:9944&apos;);
const api = createApi(provider);
api.state.storage([[storage.staking.public.freeBalanceOf, &lt;Address&gt;]], (_, values) =&gt; {
console.log(values)
}).then((subscriptionId) =&gt; {
console.log(&apos;balance changes subscription id: &apos;, subscriptionId)
})
</code></pre><p><strong>Parameters:</strong></p>
<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.
<em><strong>example</strong></em>: import createApi from &apos;@polkadot/api&apos;; import WsProvider from &apos;@polkadot/api-provider/ws&apos;; const provider = new WsProvider(&apos;ws://127.0.0.1:9944&apos;); const api = createApi(provider);</p>
<p><em><strong>see</strong></em>: <a href="_http_index_.httpprovider.html">HttpProvider</a></p>
<h1 id="type-parameters">Type parameters</h1>
<h4 id="eventtypes----string--symbol">EventTypes : <code>string</code> | <code>symbol</code></h4>
<h1 id="hierarchy">Hierarchy</h1>
<p> <code>EventEmitter</code></p>
<p><strong>&#x21B3; WsProvider</strong></p>
<h1 id="implements">Implements</h1>
<ul>
<li><code>WSProviderInterface</code></li>
</ul>
<h1 id="constructors">Constructors</h1>
<p><a id="constructor"></a></p>
<h2 id="constructor">constructor</h2>
<p>&#x2295; <strong>new WsProvider</strong>(endpoint: <em><code>string</code></em>, autoConnect?: <em><code>boolean</code></em>): <a href="_ws_index_.wsprovider.html">WsProvider</a></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L67" target="_blank">ws/index.ts:67</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Default value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>endpoint</td>
<td><code>string</code></td>
<td>-</td>
<td>The endpoint url. Usually `ws://ip:9944` or `wss://ip:9944`</td>
</tr>
<tr>
<td><code>Default value</code> autoConnect</td>
<td><code>boolean</code></td>
<td>true</td>
<td>Whether to connect automatically or not.</td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <a href="_ws_index_.wsprovider.html">WsProvider</a></p>
<hr>
<h1 id="properties">Properties</h1>
<p><a id="prefixed"></a></p>
<h2 id="static-prefixed"><code>&lt;Static&gt;</code> prefixed</h2>
<p><strong>&#x25CF; prefixed</strong>: <em> <code>string</code> | <code>boolean</code>
</em></p>
<p><em>Inherited from EventEmitter.prefixed</em></p>
<p><em>Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:6</em></p>
<hr>
<h1 id="methods">Methods</h1>
<p><a id="addlistener"></a></p>
<h2 id="addlistener">addListener</h2>
<p>&#x25B8; <strong>addListener</strong>(event: <em><code>EventTypes</code></em>, fn: <em><code>ListenerFn</code></em>, context?: <em><code>any</code></em>): <code>this</code></p>
<p><em>Inherited from EventEmitter.addListener</em></p>
<p><em>Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:33</em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>event</td>
<td><code>EventTypes</code></td>
</tr>
<tr>
<td>fn</td>
<td><code>ListenerFn</code></td>
</tr>
<tr>
<td><code>Optional</code> context</td>
<td><code>any</code></td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>this</code></p>
<hr>
<p><a id="connect"></a></p>
<h2 id="connect">connect</h2>
<p>&#x25B8; <strong>connect</strong>(): <code>void</code></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L97" target="_blank">ws/index.ts:97</a></em></p>
<p>The <a href="_ws_index_.wsprovider.html">WsProvider</a> connects automatically by default. if you decided otherwise, you may connect manually using this method.</p>
<p><strong>Returns:</strong> <code>void</code></p>
<hr>
<p><a id="emit"></a></p>
<h2 id="emit">emit</h2>
<p>&#x25B8; <strong>emit</strong>(event: <em><code>EventTypes</code></em>, ...args: <em><code>Array</code>&lt;<code>any</code>&gt;</em>): <code>boolean</code></p>
<p><em>Inherited from EventEmitter.emit</em></p>
<p><em>Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:27</em></p>
<p>Calls each of the listeners registered for a given event.</p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>event</td>
<td><code>EventTypes</code></td>
</tr>
<tr>
<td><code>Rest</code> args</td>
<td><code>Array</code>&lt;<code>any</code>&gt;</td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>boolean</code></p>
<hr>
<p><a id="eventnames"></a></p>
<h2 id="eventnames">eventNames</h2>
<p>&#x25B8; <strong>eventNames</strong>(): <code>Array</code>&lt;<code>EventTypes</code>&gt;</p>
<p><em>Inherited from EventEmitter.eventNames</em></p>
<p><em>Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:12</em></p>
<p>Return an array listing the events for which the emitter has registered listeners.</p>
<p><strong>Returns:</strong> <code>Array</code>&lt;<code>EventTypes</code>&gt;</p>
<hr>
<p><a id="isconnected"></a></p>
<h2 id="isconnected">isConnected</h2>
<p>&#x25B8; <strong>isConnected</strong>(): <code>boolean</code></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L114" target="_blank">ws/index.ts:114</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="listenercount"></a></p>
<h2 id="listenercount">listenerCount</h2>
<p>&#x25B8; <strong>listenerCount</strong>(event: <em><code>EventTypes</code></em>): <code>number</code></p>
<p><em>Inherited from EventEmitter.listenerCount</em></p>
<p><em>Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:22</em></p>
<p>Return the number of listeners listening to a given event.</p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>event</td>
<td><code>EventTypes</code></td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>number</code></p>
<hr>
<p><a id="listeners"></a></p>
<h2 id="listeners">listeners</h2>
<p>&#x25B8; <strong>listeners</strong>(event: <em><code>EventTypes</code></em>): <code>Array</code>&lt;<code>ListenerFn</code>&gt;</p>
<p><em>Inherited from EventEmitter.listeners</em></p>
<p><em>Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:17</em></p>
<p>Return the listeners registered for a given event.</p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>event</td>
<td><code>EventTypes</code></td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>Array</code>&lt;<code>ListenerFn</code>&gt;</p>
<hr>
<p><a id="off"></a></p>
<h2 id="off">off</h2>
<p>&#x25B8; <strong>off</strong>(event: <em><code>EventTypes</code></em>, fn?: <em><a href="../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md">ListenerFn</a></em>, context?: <em><code>any</code></em>, once?: <em> <code>undefined</code> | <code>false</code> | <code>true</code></em>): <code>this</code></p>
<p><em>Inherited from EventEmitter.off</em></p>
<p><em>Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:44</em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>event</td>
<td><code>EventTypes</code></td>
</tr>
<tr>
<td><code>Optional</code> fn</td>
<td><a href="../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md">ListenerFn</a></td>
</tr>
<tr>
<td><code>Optional</code> context</td>
<td><code>any</code></td>
</tr>
<tr>
<td><code>Optional</code> once</td>
<td><code>undefined</code> | <code>false</code> | <code>true</code></td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>this</code></p>
<hr>
<p><a id="on"></a></p>
<h2 id="on">on</h2>
<p>&#x25B8; <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>this</code></p>
<p><em>Overrides EventEmitter.on</em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L124" target="_blank">ws/index.ts:124</a></em></p>
<p>Listens on events after having subscribed using the <a href="_ws_index_.wsprovider.html#subscribe">subscribe</a> function.</p>
<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><a href="../modules/_types_d_.md#providerinterface_emitted">ProviderInterface$Emitted</a></td>
<td>Event</td>
</tr>
<tr>
<td>sub</td>
<td><a href="../modules/_types_d_.md#providerinterface_emitcb">ProviderInterface$EmitCb</a></td>
<td>Callback</td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>this</code>
[description]</p>
<hr>
<p><a id="once"></a></p>
<h2 id="once">once</h2>
<p>&#x25B8; <strong>once</strong>(event: <em><code>EventTypes</code></em>, fn: <em><code>ListenerFn</code></em>, context?: <em><code>any</code></em>): <code>this</code></p>
<p><em>Inherited from EventEmitter.once</em></p>
<p><em>Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:38</em></p>
<p>Add a one-time listener for a given event.</p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>event</td>
<td><code>EventTypes</code></td>
</tr>
<tr>
<td>fn</td>
<td><code>ListenerFn</code></td>
</tr>
<tr>
<td><code>Optional</code> context</td>
<td><code>any</code></td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>this</code></p>
<hr>
<p><a id="removealllisteners"></a></p>
<h2 id="removealllisteners">removeAllListeners</h2>
<p>&#x25B8; <strong>removeAllListeners</strong>(event?: <em><a href="">EventTypes</a></em>): <code>this</code></p>
<p><em>Inherited from EventEmitter.removeAllListeners</em></p>
<p><em>Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:49</em></p>
<p>Remove all listeners, or those of the specified event.</p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Optional</code> event</td>
<td><a href="">EventTypes</a></td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>this</code></p>
<hr>
<p><a id="removelistener"></a></p>
<h2 id="removelistener">removeListener</h2>
<p>&#x25B8; <strong>removeListener</strong>(event: <em><code>EventTypes</code></em>, fn?: <em><a href="../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md">ListenerFn</a></em>, context?: <em><code>any</code></em>, once?: <em> <code>undefined</code> | <code>false</code> | <code>true</code></em>): <code>this</code></p>
<p><em>Inherited from EventEmitter.removeListener</em></p>
<p><em>Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:43</em></p>
<p>Remove the listeners of a given event.</p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Param</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>event</td>
<td><code>EventTypes</code></td>
</tr>
<tr>
<td><code>Optional</code> fn</td>
<td><a href="../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md">ListenerFn</a></td>
</tr>
<tr>
<td><code>Optional</code> context</td>
<td><code>any</code></td>
</tr>
<tr>
<td><code>Optional</code> once</td>
<td><code>undefined</code> | <code>false</code> | <code>true</code></td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>this</code></p>
<hr>
<p><a id="send"></a></p>
<h2 id="send">send</h2>
<p>&#x25B8; <strong>send</strong>(method: <em><code>string</code></em>, params: <em><code>Array</code>&lt;<code>any</code>&gt;</em>, subscription?: <em><code>SubscriptionHandler</code></em>): <code>Promise</code>&lt;<code>any</code>&gt;</p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L128" target="_blank">ws/index.ts:128</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>&lt;<code>any</code>&gt;</td>
</tr>
<tr>
<td><code>Optional</code> subscription</td>
<td><code>SubscriptionHandler</code></td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>Promise</code>&lt;<code>any</code>&gt;</p>
<hr>
<p><a id="subscribe"></a></p>
<h2 id="subscribe">subscribe</h2>
<p>&#x25B8; <strong>subscribe</strong>(type: <em><code>string</code></em>, method: <em><code>string</code></em>, params: <em><code>Array</code>&lt;<code>any</code>&gt;</em>, callback: <em><a href="../modules/_types_d_.md#providerinterface_callback">ProviderInterface$Callback</a></em>): <code>Promise</code>&lt;<code>number</code>&gt;</p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L179" target="_blank">ws/index.ts:179</a></em></p>
<p>Allows subscribing to a specific event.
<em><strong>example</strong></em>: const provider = new WsProvider(&apos;ws://127.0.0.1:9944&apos;); const api = createApi(provider);</p>
<p>api.state.storage([[storage.balances.freeBalance,</p>
<p>]], (_, values) =&gt; { console.log(values) }).then((subscriptionId) =&gt; { console.log(&apos;balance changes subscription id: &apos;, subscriptionId) })</p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
@@ -751,7 +777,7 @@ Promise resolving to the dd of the subscription you can use with [[unsubscribe]]
<p><a id="unsubscribe"></a></p>
<h2 id="unsubscribe">unsubscribe</h2>
<p>&#x25B8; <strong>unsubscribe</strong>(type: <em><code>string</code></em>, method: <em><code>string</code></em>, id: <em><code>number</code></em>): <code>Promise</code>&lt;<code>boolean</code>&gt;</p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L192" target="_blank">ws/index.ts:192</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L188" target="_blank">ws/index.ts:188</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>
@@ -821,7 +847,7 @@ Promise resolving to the dd of the subscription you can use with [[unsubscribe]]
<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-27T11:17:01.905Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-27T11:17:41.057Z"},"basePath":"../..","book":{"language":""}});
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-28T13:47:08.533Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-28T13:47:55.661Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
@@ -1,22 +1,7 @@
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';
import WsProvider from '@polkadot/api-provider/ws';
const provider = new WsProvider('ws://127.0.0.1:9944');
const api = createApi(provider);
```
.
*__example__*: ```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);
```
*__example__*: 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);
*__see__*: [HttpProvider](_http_index_.httpprovider.md)
@@ -41,7 +26,7 @@ const api = createApi(provider);
⊕ **new WsProvider**(endpoint: *`string`*, autoConnect?: *`boolean`*): [WsProvider](_ws_index_.wsprovider.md)
*Defined in [ws/index.ts:69](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L69)*
*Defined in [ws/index.ts:67](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L67)*
**Parameters:**
@@ -98,7 +83,7 @@ ___
▸ **connect**(): `void`
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L99)*
*Defined in [ws/index.ts:97](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L97)*
The [WsProvider](_ws_index_.wsprovider.md) connects automatically by default. if you decided otherwise, you may connect manually using this method.
@@ -148,7 +133,7 @@ ___
▸ **isConnected**(): `boolean`
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L116)*
*Defined in [ws/index.ts:114](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L114)*
Whether the node is connected or not.
@@ -228,7 +213,7 @@ ___
*Overrides EventEmitter.on*
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L126)*
*Defined in [ws/index.ts:124](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L124)*
Listens on events after having subscribed using the [subscribe](_ws_index_.wsprovider.md#subscribe) function.
@@ -317,7 +302,7 @@ ___
▸ **send**(method: *`string`*, params: *`Array`<`any`>*, subscription?: *`SubscriptionHandler`*): `Promise`<`any`>
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L130)*
*Defined in [ws/index.ts:128](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L128)*
**Parameters:**
@@ -336,19 +321,14 @@ ___
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, callback: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`<`number`>
*Defined in [ws/index.ts:183](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L183)*
*Defined in [ws/index.ts:179](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L179)*
Allows subscribing to a specific event.
*__example__*: ```javascript
const provider = new WsProvider('ws://127.0.0.1:9944');
const api = createApi(provider);
*__example__*: 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)
})
```
api.state.storage(\[\[storage.balances.freeBalance,
\]\], (_, values) => { console.log(values) }).then((subscriptionId) => { console.log('balance changes subscription id: ', subscriptionId) })
**Parameters:**
@@ -369,7 +349,7 @@ ___
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
*Defined in [ws/index.ts:192](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/ws/index.ts#L192)*
*Defined in [ws/index.ts:188](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/ws/index.ts#L188)*
Allows unsubscribing to subscriptions made with [subscribe](_ws_index_.wsprovider.md#subscribe).
+1 -1
View File
@@ -426,7 +426,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
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-27T11:17:01.629Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-27T11:17:41.057Z"},"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-28T13:47:08.309Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-28T13:47:55.661Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>
@@ -16,7 +16,7 @@
▸ **isConnected**(): `boolean`
*Defined in [types.d.ts:45](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L45)*
*Defined in [types.d.ts:45](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L45)*
**Returns:** `boolean`
@@ -27,7 +27,7 @@ ___
▸ **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/170c337/packages/api-provider/src/types.d.ts#L46)*
*Defined in [types.d.ts:46](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L46)*
**Parameters:**
@@ -45,7 +45,7 @@ ___
▸ **send**(method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
*Defined in [types.d.ts:47](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L47)*
*Defined in [types.d.ts:47](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L47)*
**Parameters:**
@@ -63,7 +63,7 @@ ___
▸ **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/170c337/packages/api-provider/src/types.d.ts#L48)*
*Defined in [types.d.ts:48](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L48)*
**Parameters:**
@@ -83,7 +83,7 @@ ___
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
*Defined in [types.d.ts:49](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L49)*
*Defined in [types.d.ts:49](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L49)*
**Parameters:**
@@ -8,7 +8,7 @@
▸ **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/170c337/packages/api-provider/src/coder/json/decodeResponse.ts#L22)*
*Defined in [coder/json/decodeResponse.ts:22](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/coder/json/decodeResponse.ts#L22)*
**Parameters:**
@@ -8,7 +8,7 @@
▸ **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/170c337/packages/api-provider/src/coder/json/encodeJson.ts#L9)*
*Defined in [coder/json/encodeJson.ts:9](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/coder/json/encodeJson.ts#L9)*
**Parameters:**
@@ -8,7 +8,7 @@
▸ **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/170c337/packages/api-provider/src/coder/json/encodeObject.ts#L8)*
*Defined in [coder/json/encodeObject.ts:8](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/coder/json/encodeObject.ts#L8)*
**Parameters:**
@@ -8,7 +8,7 @@
▸ **rpcCoder**(): [RpcCoder](_coder_json_types_d_.md#rpccoder)
*Defined in [coder/json/index.ts:12](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/coder/json/index.ts#L12)*
*Defined in [coder/json/index.ts:12](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/coder/json/index.ts#L12)*
**Returns:** [RpcCoder](_coder_json_types_d_.md#rpccoder)
@@ -8,7 +8,7 @@
**Ƭ RpcCoder**: *`object`*
*Defined in [coder/json/types.d.ts:7](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/coder/json/types.d.ts#L7)*
*Defined in [coder/json/types.d.ts:7](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/coder/json/types.d.ts#L7)*
#### Type declaration
@@ -19,7 +19,7 @@ ___
**Ƭ RpcCoderState**: *`object`*
*Defined in [coder/json/types.d.ts:14](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/coder/json/types.d.ts#L14)*
*Defined in [coder/json/types.d.ts:14](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/coder/json/types.d.ts#L14)*
#### Type declaration
+1 -1
View File
@@ -8,7 +8,7 @@
**Ƭ HttpState**: *`object`*
*Defined in [http/types.d.ts:8](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/http/types.d.ts#L8)*
*Defined in [http/types.d.ts:8](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/http/types.d.ts#L8)*
#### Type declaration
+1 -1
View File
@@ -8,7 +8,7 @@
▸ **mockProvider**(): [ProviderInterface](../interfaces/_types_d_.providerinterface.md)
*Defined in [mock/index.ts:18](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/mock/index.ts#L18)*
*Defined in [mock/index.ts:18](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/index.ts#L18)*
A moock provider mainly used for testing.
+1 -1
View File
@@ -8,7 +8,7 @@
▸ **mocks**(__namedParameters: *`object`*): `void`
*Defined in [mock/mocks.ts:69](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/mock/mocks.ts#L69)*
*Defined in [mock/mocks.ts:69](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/mocks.ts#L69)*
**Parameters:**
+1 -1
View File
@@ -8,7 +8,7 @@
▸ **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/170c337/packages/api-provider/src/mock/on.ts#L8)*
*Defined in [mock/on.ts:8](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/on.ts#L8)*
**Parameters:**
+1 -1
View File
@@ -8,7 +8,7 @@
▸ **send**(__namedParameters: *`object`*, method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
*Defined in [mock/send.ts:7](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/mock/send.ts#L7)*
*Defined in [mock/send.ts:7](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/send.ts#L7)*
**Parameters:**
+1 -1
View File
@@ -8,7 +8,7 @@
▸ **state**(): [MockState](_mock_types_d_.md#mockstate)
*Defined in [mock/state.ts:38](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/mock/state.ts#L38)*
*Defined in [mock/state.ts:38](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/state.ts#L38)*
**Returns:** [MockState](_mock_types_d_.md#mockstate)
@@ -8,7 +8,7 @@
▸ **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/170c337/packages/api-provider/src/mock/subscribe.ts#L7)*
*Defined in [mock/subscribe.ts:7](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/subscribe.ts#L7)*
**Parameters:**
+5 -5
View File
@@ -8,7 +8,7 @@
**Ƭ MockState**: *`object`*
*Defined in [mock/types.d.ts:27](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/mock/types.d.ts#L27)*
*Defined in [mock/types.d.ts:27](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/types.d.ts#L27)*
#### Type declaration
@@ -19,7 +19,7 @@ ___
**Ƭ MockState$Requests**: *`object`*
*Defined in [mock/types.d.ts:23](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/mock/types.d.ts#L23)*
*Defined in [mock/types.d.ts:23](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/types.d.ts#L23)*
#### Type declaration
@@ -43,7 +43,7 @@ ___
**Ƭ MockState$Storage**: *`object`*
*Defined in [mock/types.d.ts:19](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/mock/types.d.ts#L19)*
*Defined in [mock/types.d.ts:19](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/types.d.ts#L19)*
#### Type declaration
@@ -56,7 +56,7 @@ ___
**Ƭ MockState$Subscription$Callback**: *`function`*
*Defined in [mock/types.d.ts:8](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/mock/types.d.ts#L8)*
*Defined in [mock/types.d.ts:8](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/types.d.ts#L8)*
#### Type declaration
▸(error: * `Error` &#124; `null`*, value: *`any`*): `void`
@@ -77,7 +77,7 @@ ___
**Ƭ MockState$Subscriptions**: *`object`*
*Defined in [mock/types.d.ts:10](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/mock/types.d.ts#L10)*
*Defined in [mock/types.d.ts:10](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/types.d.ts#L10)*
#### Type declaration
@@ -8,7 +8,7 @@
▸ **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/170c337/packages/api-provider/src/mock/unsubscribe.ts#L7)*
*Defined in [mock/unsubscribe.ts:7](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/mock/unsubscribe.ts#L7)*
**Parameters:**
+8 -8
View File
@@ -8,7 +8,7 @@
**Ƭ JsonRpcObject**: *`object`*
*Defined in [types.d.ts:5](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L5)*
*Defined in [types.d.ts:5](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L5)*
#### Type declaration
@@ -20,7 +20,7 @@ ___
**Ƭ JsonRpcRequest**: * [JsonRpcObject](_types_d_.md#jsonrpcobject) & `object`
*
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L10)*
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L10)*
___
<a id="jsonrpcresponse"></a>
@@ -30,7 +30,7 @@ ___
**Ƭ JsonRpcResponse**: * [JsonRpcObject](_types_d_.md#jsonrpcobject) & [JsonRpcResponseBase](_types_d_.md#jsonrpcresponsebase)
*
*Defined in [types.d.ts:36](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L36)*
*Defined in [types.d.ts:36](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L36)*
___
<a id="jsonrpcresponsebase"></a>
@@ -40,7 +40,7 @@ ___
**Ƭ JsonRpcResponseBase**: * `JsonRpcResponse$Single` & `JsonRpcResponse$Subscription`
*
*Defined in [types.d.ts:34](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L34)*
*Defined in [types.d.ts:34](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L34)*
___
<a id="jsonrpcresponsebase_error"></a>
@@ -49,7 +49,7 @@ ___
**Ƭ JsonRpcResponseBase$Error**: *`object`*
*Defined in [types.d.ts:15](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L15)*
*Defined in [types.d.ts:15](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L15)*
#### Type declaration
@@ -60,7 +60,7 @@ ___
**Ƭ ProviderInterface$Callback**: *`function`*
*Defined in [types.d.ts:38](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L38)*
*Defined in [types.d.ts:38](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L38)*
#### Type declaration
▸(error: * `Error` &#124; `null`*, result: *`any`*): `void`
@@ -81,7 +81,7 @@ ___
**Ƭ ProviderInterface$EmitCb**: *`function`*
*Defined in [types.d.ts:42](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L42)*
*Defined in [types.d.ts:42](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L42)*
#### Type declaration
▸(value?: *`any`*): `any`
@@ -102,7 +102,7 @@ ___
**Ƭ ProviderInterface$Emitted**: * "connected" &#124; "disconnected"
*
*Defined in [types.d.ts:40](https://github.com/polkadot-js/api/blob/170c337/packages/api-provider/src/types.d.ts#L40)*
*Defined in [types.d.ts:40](https://github.com/polkadot-js/api/blob/74737b6/packages/api-provider/src/types.d.ts#L40)*
___