[CI Skip] 0.29.11

This commit is contained in:
Travis CI
2018-09-26 05:30:33 +00:00
parent f399bb6fd6
commit 7eb2b29201
56 changed files with 292 additions and 298 deletions
+1 -1
View File
@@ -402,7 +402,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"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":"GLOSSARY.md","mtime":"2018-09-25T16:22:52.650Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":".","book":{"language":""}});
gitbook.page.hasChanged({"page":{"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":"GLOSSARY.md","mtime":"2018-09-26T05:25:07.923Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>
@@ -370,11 +370,12 @@
<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>: <code>javascript
<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;http://127.0.0.1:9933&apos;);
const api = createApi(provider);</code></p>
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>
<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>
@@ -386,7 +387,7 @@ const api = createApi(provider);</code></p>
<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/964bf84/packages/api-provider/src/http/index.ts#L35" target="_blank">http/index.ts:35</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L36" target="_blank">http/index.ts:36</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
@@ -409,7 +410,7 @@ const api = createApi(provider);</code></p>
<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/964bf84/packages/api-provider/src/http/index.ts#L49" target="_blank">http/index.ts:49</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L50" target="_blank">http/index.ts:50</a></em></p>
<p>Whether the node is connected or not.</p>
<p><strong>Returns:</strong> <code>boolean</code>
true if connected</p>
@@ -418,7 +419,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/964bf84/packages/api-provider/src/http/index.ts#L56" target="_blank">http/index.ts:56</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L57" target="_blank">http/index.ts:57</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>
@@ -445,7 +446,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/964bf84/packages/api-provider/src/http/index.ts#L60" target="_blank">http/index.ts:60</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L61" target="_blank">http/index.ts:61</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
@@ -471,7 +472,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/964bf84/packages/api-provider/src/http/index.ts#L82" target="_blank">http/index.ts:82</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L83" target="_blank">http/index.ts:83</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>
@@ -506,7 +507,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/964bf84/packages/api-provider/src/http/index.ts#L91" target="_blank">http/index.ts:91</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L92" target="_blank">http/index.ts:92</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>
@@ -576,7 +577,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-25T16:26:54.232Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"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-26T05:29:48.632Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
@@ -1,10 +1,7 @@
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
*__example__*: ```javascript
import createApi from '@polkadot/api';
import WsProvider from '@polkadot/api-provider/ws';
@@ -30,7 +27,7 @@ const api = createApi(provider);
⊕ **new HttpProvider**(endpoint: *`string`*): [HttpProvider](_http_index_.httpprovider.md)
*Defined in [http/index.ts:35](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/http/index.ts#L35)*
*Defined in [http/index.ts:36](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L36)*
**Parameters:**
@@ -52,7 +49,7 @@ ___
*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/964bf84/packages/api-provider/src/http/index.ts#L49)*
*Defined in [http/index.ts:50](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L50)*
Whether the node is connected or not.
@@ -68,7 +65,7 @@ ___
*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/964bf84/packages/api-provider/src/http/index.ts#L56)*
*Defined in [http/index.ts:57](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L57)*
Events are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
@@ -90,7 +87,7 @@ ___
*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/964bf84/packages/api-provider/src/http/index.ts#L60)*
*Defined in [http/index.ts:61](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L61)*
**Parameters:**
@@ -110,7 +107,7 @@ ___
*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/964bf84/packages/api-provider/src/http/index.ts#L82)*
*Defined in [http/index.ts:83](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L83)*
Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
@@ -134,7 +131,7 @@ ___
*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/964bf84/packages/api-provider/src/http/index.ts#L91)*
*Defined in [http/index.ts:92](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/http/index.ts#L92)*
Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
@@ -372,10 +372,12 @@
<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
<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;);
@@ -404,7 +406,7 @@ const api = createApi(provider);</p>
&#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/964bf84/packages/api-provider/src/ws/index.ts#L69)*
*Defined in [ws/index.ts:69](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L69)*
**Parameters:**
@@ -461,7 +463,7 @@ ___
&#x25B8; **connect**(): `void`
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/ws/index.ts#L99)*
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/f399bb6/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.
@@ -511,7 +513,7 @@ ___
&#x25B8; **isConnected**(): `boolean`
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/ws/index.ts#L116)*
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L116)*
Whether the node is connected or not.
@@ -591,7 +593,7 @@ ___
*Overrides EventEmitter.on*
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/ws/index.ts#L126)*
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L126)*
Listens on events after having subscribed using the [subscribe](_ws_index_.wsprovider.md#subscribe) function.
@@ -680,7 +682,7 @@ ___
&#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/964bf84/packages/api-provider/src/ws/index.ts#L130)*
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L130)*
**Parameters:**
@@ -699,12 +701,13 @@ ___
&#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:182](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/ws/index.ts#L182)*
*Defined in [ws/index.ts:183](https://github.com/polkadot-js/api/blob/f399bb6/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)
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; {
@@ -743,12 +746,12 @@ api.state.storage([[storage.staking.public.freeBalanceOf, &lt;Address&gt;]], (_,
</tbody>
</table>
<p><strong>Returns:</strong> <code>Promise</code>&lt;<code>number</code>&gt;
Promise resolving to the dd of the subscription you can use with [[unsubscribe]]</p>
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>&#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/964bf84/packages/api-provider/src/ws/index.ts#L191" target="_blank">ws/index.ts:191</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L192" target="_blank">ws/index.ts:192</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>
@@ -818,7 +821,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-25T16:26:54.348Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"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-26T05:29:48.904Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
@@ -2,8 +2,6 @@
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.
*__example__*:
```javascript
import createApi from '@polkadot/api';
import WsProvider from '@polkadot/api-provider/ws';
@@ -12,6 +10,14 @@ 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);
```
*__see__*: [HttpProvider](_http_index_.httpprovider.md)
# Type parameters
@@ -35,7 +41,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/964bf84/packages/api-provider/src/ws/index.ts#L69)*
*Defined in [ws/index.ts:69](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L69)*
**Parameters:**
@@ -59,7 +65,7 @@ ___
*Inherited from EventEmitter.prefixed*
*Defined in [index.d.ts:6](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L6)*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:6*
___
@@ -73,7 +79,7 @@ ___
*Inherited from EventEmitter.addListener*
*Defined in [index.d.ts:33](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L33)*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:33*
**Parameters:**
@@ -92,7 +98,7 @@ ___
▸ **connect**(): `void`
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/ws/index.ts#L99)*
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/f399bb6/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.
@@ -107,7 +113,7 @@ ___
*Inherited from EventEmitter.emit*
*Defined in [index.d.ts:27](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L27)*
*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.
@@ -129,7 +135,7 @@ ___
*Inherited from EventEmitter.eventNames*
*Defined in [index.d.ts:12](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L12)*
*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.
@@ -142,7 +148,7 @@ ___
▸ **isConnected**(): `boolean`
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/ws/index.ts#L116)*
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L116)*
Whether the node is connected or not.
@@ -158,7 +164,7 @@ ___
*Inherited from EventEmitter.listenerCount*
*Defined in [index.d.ts:22](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L22)*
*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.
@@ -179,7 +185,7 @@ ___
*Inherited from EventEmitter.listeners*
*Defined in [index.d.ts:17](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L17)*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:17*
Return the listeners registered for a given event.
@@ -200,7 +206,7 @@ ___
*Inherited from EventEmitter.off*
*Defined in [index.d.ts:44](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L44)*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:44*
**Parameters:**
@@ -222,7 +228,7 @@ ___
*Overrides EventEmitter.on*
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/ws/index.ts#L126)*
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L126)*
Listens on events after having subscribed using the [subscribe](_ws_index_.wsprovider.md#subscribe) function.
@@ -245,7 +251,7 @@ ___
*Inherited from EventEmitter.once*
*Defined in [index.d.ts:38](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L38)*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:38*
Add a one-time listener for a given event.
@@ -268,7 +274,7 @@ ___
*Inherited from EventEmitter.removeAllListeners*
*Defined in [index.d.ts:49](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L49)*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:49*
Remove all listeners, or those of the specified event.
@@ -289,7 +295,7 @@ ___
*Inherited from EventEmitter.removeListener*
*Defined in [index.d.ts:43](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L43)*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:43*
Remove the listeners of a given event.
@@ -311,7 +317,7 @@ ___
▸ **send**(method: *`string`*, params: *`Array`<`any`>*, subscription?: *`SubscriptionHandler`*): `Promise`<`any`>
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/ws/index.ts#L130)*
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L130)*
**Parameters:**
@@ -330,13 +336,10 @@ ___
▸ **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/964bf84/packages/api-provider/src/ws/index.ts#L182)*
*Defined in [ws/index.ts:183](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L183)*
Allows subscribing to a specific event.
*__example__*:
```javascript
*__example__*: ```javascript
const provider = new WsProvider('ws://127.0.0.1:9944');
const api = createApi(provider);
@@ -357,7 +360,7 @@ api.state.storage([[storage.staking.public.freeBalanceOf, <Address>]], (_, value
| 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]]
Promise resolving to the dd of the subscription you can use with [[unsubscribe]].
___
<a id="unsubscribe"></a>
@@ -366,7 +369,7 @@ ___
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
*Defined in [ws/index.ts:191](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/ws/index.ts#L191)*
*Defined in [ws/index.ts:192](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/ws/index.ts#L192)*
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-25T16:26:54.052Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"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-26T05:29:48.448Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>
@@ -16,7 +16,7 @@
▸ **isConnected**(): `boolean`
*Defined in [types.d.ts:45](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/types.d.ts#L45)*
*Defined in [types.d.ts:45](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L46)*
*Defined in [types.d.ts:46](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L47)*
*Defined in [types.d.ts:47](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L48)*
*Defined in [types.d.ts:48](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L49)*
*Defined in [types.d.ts:49](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/types.d.ts#L49)*
**Parameters:**
@@ -12,7 +12,7 @@
⊕ **new EventEmitterStatic**<`EventTypes`>(): `EventEmitter`<`EventTypes`>
*Defined in [index.d.ts:57](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L57)*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:57*
**Type parameters:**
@@ -7,7 +7,7 @@
# Callable
▸ **__call**(...args: *`Array`<`any`>*): `void`
*Defined in [index.d.ts:53](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L53)*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:53*
**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/964bf84/packages/api-provider/src/coder/json/decodeResponse.ts#L22)*
*Defined in [coder/json/decodeResponse.ts:22](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/coder/json/encodeJson.ts#L9)*
*Defined in [coder/json/encodeJson.ts:9](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/coder/json/encodeObject.ts#L8)*
*Defined in [coder/json/encodeObject.ts:8](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/coder/json/index.ts#L12)*
*Defined in [coder/json/index.ts:12](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/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/f399bb6/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/964bf84/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/f399bb6/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/964bf84/packages/api-provider/src/http/types.d.ts#L8)*
*Defined in [http/types.d.ts:8](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/mock/index.ts#L18)*
*Defined in [mock/index.ts:18](https://github.com/polkadot-js/api/blob/f399bb6/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:68](https://github.com/polkadot-js/api/blob/964bf84/packages/api-provider/src/mock/mocks.ts#L68)*
*Defined in [mock/mocks.ts:68](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/mock/mocks.ts#L68)*
**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/964bf84/packages/api-provider/src/mock/on.ts#L8)*
*Defined in [mock/on.ts:8](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/mock/send.ts#L7)*
*Defined in [mock/send.ts:7](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/mock/state.ts#L38)*
*Defined in [mock/state.ts:38](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/mock/subscribe.ts#L7)*
*Defined in [mock/subscribe.ts:7](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/mock/types.d.ts#L27)*
*Defined in [mock/types.d.ts:27](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/mock/types.d.ts#L23)*
*Defined in [mock/types.d.ts:23](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/mock/types.d.ts#L19)*
*Defined in [mock/types.d.ts:19](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/mock/types.d.ts#L8)*
*Defined in [mock/types.d.ts:8](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/mock/types.d.ts#L10)*
*Defined in [mock/types.d.ts:10](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/mock/unsubscribe.ts#L7)*
*Defined in [mock/unsubscribe.ts:7](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L5)*
*Defined in [types.d.ts:5](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L10)*
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L36)*
*Defined in [types.d.ts:36](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L34)*
*Defined in [types.d.ts:34](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L15)*
*Defined in [types.d.ts:15](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L38)*
*Defined in [types.d.ts:38](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L42)*
*Defined in [types.d.ts:42](https://github.com/polkadot-js/api/blob/f399bb6/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/964bf84/packages/api-provider/src/types.d.ts#L40)*
*Defined in [types.d.ts:40](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-provider/src/types.d.ts#L40)*
___
@@ -21,7 +21,7 @@
**● EventEmitter**: *`EventEmitterStatic`*
*Defined in [index.d.ts:57](https://github.com/primus/eventemitter3/blob/master/index.d.ts#L57)*
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:61*
___
+7 -7
View File
@@ -386,7 +386,7 @@ const rxapi = new RxApi(provider);
<p><a id="constructor"></a></p>
<h2 id="constructor">constructor</h2>
<p>&#x2295; <strong>new RxApi</strong>(provider?: <em><code>ProviderInterface</code></em>): <a href="_index_.rxapi.html">RxApi</a></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L43" target="_blank">index.ts:43</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L43" target="_blank">index.ts:43</a></em></p>
<p><strong>Parameters:</strong></p>
<table>
<thead>
@@ -412,28 +412,28 @@ const rxapi = new RxApi(provider);
<p><a id="author"></a></p>
<h2 id="author">author</h2>
<p><strong>&#x25CF; author</strong>: <em><a href="../modules/_types_d_.md#rxapiinterface_section">RxApiInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L40" target="_blank">index.ts:40</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L40" target="_blank">index.ts:40</a></em></p>
<hr>
<p><a id="chain"></a></p>
<h2 id="chain">chain</h2>
<p><strong>&#x25CF; chain</strong>: <em><a href="../modules/_types_d_.md#rxapiinterface_section">RxApiInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L41" target="_blank">index.ts:41</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L41" target="_blank">index.ts:41</a></em></p>
<hr>
<p><a id="state"></a></p>
<h2 id="state">state</h2>
<p><strong>&#x25CF; state</strong>: <em><a href="../modules/_types_d_.md#rxapiinterface_section">RxApiInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L42" target="_blank">index.ts:42</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L42" target="_blank">index.ts:42</a></em></p>
<hr>
<p><a id="system"></a></p>
<h2 id="system">system</h2>
<p><strong>&#x25CF; system</strong>: <em><a href="../modules/_types_d_.md#rxapiinterface_section">RxApiInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L43" target="_blank">index.ts:43</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L43" target="_blank">index.ts:43</a></em></p>
<hr>
<h1 id="methods">Methods</h1>
<p><a id="isconnected"></a></p>
<h2 id="isconnected">isConnected</h2>
<p>&#x25B8; <strong>isConnected</strong>(): <code>BehaviorSubject</code>&lt;<code>boolean</code>&gt;</p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L62" target="_blank">index.ts:62</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L62" target="_blank">index.ts:62</a></em></p>
<p><strong>Returns:</strong> <code>BehaviorSubject</code>&lt;<code>boolean</code>&gt;</p>
<hr>
@@ -479,7 +479,7 @@ const rxapi = new RxApi(provider);
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"ApiRx","level":"1.4.1","depth":2,"next":{"title":"Overview","level":"2.1","depth":1,"path":"examples/README.md","ref":"examples/README.md","articles":[]},"previous":{"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":[]}]},"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-rx/classes/_index_.rxapi.md","mtime":"2018-09-25T16:27:04.340Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"ApiRx","level":"1.4.1","depth":2,"next":{"title":"Overview","level":"2.1","depth":1,"path":"examples/README.md","ref":"examples/README.md","articles":[]},"previous":{"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":[]}]},"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-rx/classes/_index_.rxapi.md","mtime":"2018-09-26T05:29:57.264Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
+8 -11
View File
@@ -1,10 +1,7 @@
An RxJs wrapper around the \[\[api\]\].
*__example__*:
```javascript
*__example__*: ```javascript
import RxApi from '@polkadot/api';
import WsProvider from '@polkadot/api-provider/ws';
@@ -28,13 +25,13 @@ const rxapi = new RxApi(provider);
⊕ **new RxApi**(provider?: *`ProviderInterface`*): [RxApi](_index_.rxapi.md)
*Defined in [index.ts:43](https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L43)*
*Defined in [index.ts:43](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L43)*
**Parameters:**
| Param | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `Default value` provider | `ProviderInterface` | `new Ws(defaults.WS_URL)` | An API provider using HTTP or WebSocket |
| `Default value` provider | `ProviderInterface` | new Ws(defaults.WS_URL) | An API provider using HTTP or WebSocket |
**Returns:** [RxApi](_index_.rxapi.md)
@@ -48,7 +45,7 @@ ___
**● author**: *[RxApiInterface$Section](../modules/_types_d_.md#rxapiinterface_section)*
*Defined in [index.ts:40](https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L40)*
*Defined in [index.ts:40](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L40)*
___
<a id="chain"></a>
@@ -57,7 +54,7 @@ ___
**● chain**: *[RxApiInterface$Section](../modules/_types_d_.md#rxapiinterface_section)*
*Defined in [index.ts:41](https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L41)*
*Defined in [index.ts:41](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L41)*
___
<a id="state"></a>
@@ -66,7 +63,7 @@ ___
**● state**: *[RxApiInterface$Section](../modules/_types_d_.md#rxapiinterface_section)*
*Defined in [index.ts:42](https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L42)*
*Defined in [index.ts:42](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L42)*
___
<a id="system"></a>
@@ -75,7 +72,7 @@ ___
**● system**: *[RxApiInterface$Section](../modules/_types_d_.md#rxapiinterface_section)*
*Defined in [index.ts:43](https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L43)*
*Defined in [index.ts:43](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L43)*
___
@@ -87,7 +84,7 @@ ___
▸ **isConnected**(): `BehaviorSubject`<`boolean`>
*Defined in [index.ts:62](https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/index.ts#L62)*
*Defined in [index.ts:62](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/index.ts#L62)*
**Returns:** `BehaviorSubject`<`boolean`>
+1 -1
View File
@@ -415,7 +415,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"api-rx","level":"1.4","depth":1,"next":{"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":"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-rx/README.md","mtime":"2018-09-25T16:27:04.208Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"api-rx","level":"1.4","depth":1,"next":{"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":"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-rx/README.md","mtime":"2018-09-26T05:29:57.164Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>
+3 -3
View File
@@ -9,7 +9,7 @@
**Ƭ RxApiInterface**: * `RxApiInterface$Keys` & `object`
*
*Defined in [types.d.ts:19](https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/types.d.ts#L19)*
*Defined in [types.d.ts:19](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/types.d.ts#L19)*
___
<a id="rxapiinterface_method"></a>
@@ -18,7 +18,7 @@ ___
**Ƭ RxApiInterface$Method**: *`function`*
*Defined in [types.d.ts:9](https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/types.d.ts#L9)*
*Defined in [types.d.ts:9](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/types.d.ts#L9)*
#### Type declaration
▸(...params: *`Array`<`any`>*): `Observable`<`any`> &#124; `BehaviorSubject`<`any`>
@@ -38,7 +38,7 @@ ___
**Ƭ RxApiInterface$Section**: *`object`*
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/964bf84/packages/api-rx/src/types.d.ts#L11)*
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/f399bb6/packages/api-rx/src/types.d.ts#L11)*
#### Type declaration
+6 -6
View File
@@ -385,7 +385,7 @@ const api = new Api(provider);
<p><a id="constructor"></a></p>
<h2 id="constructor">constructor</h2>
<p>&#x2295; <strong>new Api</strong>(provider: <em><code>ProviderInterface</code></em>): <a href="_index_.api.html">Api</a></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/index.ts#L37" target="_blank">index.ts:37</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/index.ts#L37" target="_blank">index.ts:37</a></em></p>
<p><em><strong>constructor</strong></em>: Default constructor for the Api Object</p>
<p><strong>Parameters:</strong></p>
<table>
@@ -410,22 +410,22 @@ const api = new Api(provider);
<p><a id="author"></a></p>
<h2 id="author">author</h2>
<p><strong>&#x25CF; author</strong>: <em><a href="../modules/_types_d_.md#apiinterface_section">ApiInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/index.ts#L34" target="_blank">index.ts:34</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/index.ts#L34" target="_blank">index.ts:34</a></em></p>
<hr>
<p><a id="chain"></a></p>
<h2 id="chain">chain</h2>
<p><strong>&#x25CF; chain</strong>: <em><a href="../modules/_types_d_.md#apiinterface_section">ApiInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/index.ts#L35" target="_blank">index.ts:35</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/index.ts#L35" target="_blank">index.ts:35</a></em></p>
<hr>
<p><a id="state"></a></p>
<h2 id="state">state</h2>
<p><strong>&#x25CF; state</strong>: <em><a href="../modules/_types_d_.md#apiinterface_section">ApiInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/index.ts#L36" target="_blank">index.ts:36</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/index.ts#L36" target="_blank">index.ts:36</a></em></p>
<hr>
<p><a id="system"></a></p>
<h2 id="system">system</h2>
<p><strong>&#x25CF; system</strong>: <em><a href="../modules/_types_d_.md#apiinterface_section">ApiInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/index.ts#L37" target="_blank">index.ts:37</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/index.ts#L37" target="_blank">index.ts:37</a></em></p>
<hr>
@@ -470,7 +470,7 @@ const api = new Api(provider);
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Api","level":"1.2.1","depth":2,"next":{"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":[]}]},"previous":{"title":"api","level":"1.2","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[{"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/classes/_index_.api.md","mtime":"2018-09-25T16:26:44.855Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Api","level":"1.2.1","depth":2,"next":{"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":[]}]},"previous":{"title":"api","level":"1.2","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[{"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/classes/_index_.api.md","mtime":"2018-09-26T05:29:39.544Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
+6 -8
View File
@@ -1,8 +1,6 @@
*__example__*:
```javascript
*__example__*: ```javascript
import Api from '@polkadot/api';
import WsProvider from '@polkadot/api-provider/ws';
@@ -26,7 +24,7 @@ const api = new Api(provider);
⊕ **new Api**(provider: *`ProviderInterface`*): [Api](_index_.api.md)
*Defined in [index.ts:37](https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/index.ts#L37)*
*Defined in [index.ts:37](https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/index.ts#L37)*
*__constructor__*: Default constructor for the Api Object
@@ -48,7 +46,7 @@ ___
**● author**: *[ApiInterface$Section](../modules/_types_d_.md#apiinterface_section)*
*Defined in [index.ts:34](https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/index.ts#L34)*
*Defined in [index.ts:34](https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/index.ts#L34)*
___
<a id="chain"></a>
@@ -57,7 +55,7 @@ ___
**● chain**: *[ApiInterface$Section](../modules/_types_d_.md#apiinterface_section)*
*Defined in [index.ts:35](https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/index.ts#L35)*
*Defined in [index.ts:35](https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/index.ts#L35)*
___
<a id="state"></a>
@@ -66,7 +64,7 @@ ___
**● state**: *[ApiInterface$Section](../modules/_types_d_.md#apiinterface_section)*
*Defined in [index.ts:36](https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/index.ts#L36)*
*Defined in [index.ts:36](https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/index.ts#L36)*
___
<a id="system"></a>
@@ -75,7 +73,7 @@ ___
**● system**: *[ApiInterface$Section](../modules/_types_d_.md#apiinterface_section)*
*Defined in [index.ts:37](https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/index.ts#L37)*
*Defined in [index.ts:37](https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/index.ts#L37)*
___
+1 -1
View File
@@ -461,7 +461,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"api","level":"1.2","depth":1,"next":{"title":"Api","level":"1.2.1","depth":2,"path":"api/classes/_index_.api.md","ref":"api/classes/_index_.api.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.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/README.md","mtime":"2018-09-25T16:26:44.715Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"api","level":"1.2","depth":1,"next":{"title":"Api","level":"1.2.1","depth":2,"path":"api/classes/_index_.api.md","ref":"api/classes/_index_.api.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.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/README.md","mtime":"2018-09-26T05:29:39.400Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>
@@ -7,7 +7,7 @@
# Callable
▸ **__call**(...params: *`Array`<`any`>*): `Promise`<`any`>
*Defined in [types.d.ts:7](https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/types.d.ts#L7)*
*Defined in [types.d.ts:7](https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/types.d.ts#L7)*
**Parameters:**
@@ -25,7 +25,7 @@
**● subscription**: *`string`*
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/types.d.ts#L10)*
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/types.d.ts#L10)*
___
<a id="unsubscribe"></a>
@@ -34,7 +34,7 @@ ___
**● unsubscribe**: *`function`*
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/types.d.ts#L11)*
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/types.d.ts#L11)*
#### Type declaration
▸(id: *`number`*): `Promise`<`any`>
+2 -2
View File
@@ -8,7 +8,7 @@
**Ƭ ApiInterface**: *`object`*
*Defined in [types.d.ts:18](https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/types.d.ts#L18)*
*Defined in [types.d.ts:18](https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/types.d.ts#L18)*
#### Type declaration
@@ -19,7 +19,7 @@ ___
**Ƭ ApiInterface$Section**: *`object`*
*Defined in [types.d.ts:14](https://github.com/polkadot-js/api/blob/964bf84/packages/api/src/types.d.ts#L14)*
*Defined in [types.d.ts:14](https://github.com/polkadot-js/api/blob/f399bb6/packages/api/src/types.d.ts#L14)*
#### Type declaration
+9 -9
View File
@@ -371,22 +371,22 @@
<h1 id="simple-connect">Simple Connect</h1>
<p>The following example shows how to instantiate a Polkadot API object and use it to connect to a node.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default
<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 = <span class="hljs-keyword">new</span> Api(provider)
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default;
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default;
<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 = <span class="hljs-keyword">new</span> Api(provider);
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getChain</span> (<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">return</span> api.system.chain()
<span class="hljs-keyword">return</span> api.system.chain();
}
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span> (<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">const</span> chain = <span class="hljs-keyword">await</span> getChain()
<span class="hljs-keyword">const</span> chain = <span class="hljs-keyword">await</span> getChain();
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;You are connected to chain:&apos;</span>, chain)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;You are connected to chain:&apos;</span>, chain);
}
main().finally(_ =&gt; process.exit())
main().finally(_ =&gt; process.exit());
</code></pre>
@@ -431,7 +431,7 @@ main().finally(_ =&gt; process.exit())
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Simple connect","level":"2.2","depth":1,"next":{"title":"Listen to blocks","level":"2.3","depth":1,"path":"examples/02_listen_to_blocks/README.md","ref":"examples/02_listen_to_blocks/README.md","articles":[]},"previous":{"title":"Overview","level":"2.1","depth":1,"path":"examples/README.md","ref":"examples/README.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":"examples/01_simple_connect/README.md","mtime":"2018-09-25T16:22:52.654Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Simple connect","level":"2.2","depth":1,"next":{"title":"Listen to blocks","level":"2.3","depth":1,"path":"examples/02_listen_to_blocks/README.md","ref":"examples/02_listen_to_blocks/README.md","articles":[]},"previous":{"title":"Overview","level":"2.1","depth":1,"path":"examples/README.md","ref":"examples/README.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":"examples/01_simple_connect/README.md","mtime":"2018-09-26T05:25:07.927Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
+12 -12
View File
@@ -372,23 +372,23 @@
<h1 id="listen-to-new-blocks">Listen to new blocks</h1>
<p>This example shows how to subscribe to new blocks.</p>
<p>It displays the block number every time a new block is seen by the node you are connected to.</p>
<p>NOTE: The example runs until you stop it wit CTRL+C</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;bn.js&apos;</span>)
<span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default
<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 = <span class="hljs-keyword">new</span> Api(provider)
<p>NOTE: The example runs until you stop it with CTRL+C</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;bn.js&apos;</span>);
<span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default;
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default;
<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 = <span class="hljs-keyword">new</span> Api(provider);
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span> (<span class="hljs-params"></span>) </span>{
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Blocks will be shown as they come in, CTRL+C to stop:&apos;</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Blocks will be shown as they come in, CTRL+C to stop:&apos;</span>);
api.chain.newHead((_, header) =&gt; {
<span class="hljs-keyword">const</span> bnBlockNumber = <span class="hljs-keyword">new</span> BN(header.number, <span class="hljs-number">16</span>)
<span class="hljs-keyword">const</span> bnBlockNumber = <span class="hljs-keyword">new</span> BN(header.number, <span class="hljs-number">16</span>);
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;#&apos;</span> + bnBlockNumber.toString(<span class="hljs-number">10</span>))
})
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;#&apos;</span> + bnBlockNumber.toString(<span class="hljs-number">10</span>));
});
}
main()
main();
</code></pre>
@@ -433,7 +433,7 @@ main()
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Listen to blocks","level":"2.3","depth":1,"next":{"title":"Listen to balance change","level":"2.4","depth":1,"path":"examples/03_listen_to_balance_change/README.md","ref":"examples/03_listen_to_balance_change/README.md","articles":[]},"previous":{"title":"Simple connect","level":"2.2","depth":1,"path":"examples/01_simple_connect/README.md","ref":"examples/01_simple_connect/README.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":"examples/02_listen_to_blocks/README.md","mtime":"2018-09-25T16:22:52.658Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Listen to blocks","level":"2.3","depth":1,"next":{"title":"Listen to balance change","level":"2.4","depth":1,"path":"examples/03_listen_to_balance_change/README.md","ref":"examples/03_listen_to_balance_change/README.md","articles":[]},"previous":{"title":"Simple connect","level":"2.2","depth":1,"path":"examples/01_simple_connect/README.md","ref":"examples/01_simple_connect/README.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":"examples/02_listen_to_blocks/README.md","mtime":"2018-09-26T05:25:07.927Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
@@ -371,23 +371,23 @@
<h1 id="listen-to-balance-changes">Listen to balance changes</h1>
<p>This example shows how to instantiate a Polkadot API object and use it to connect to a node.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default
<span class="hljs-keyword">const</span> storage = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/storage&apos;</span>).default
<span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;bn.js&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 = <span class="hljs-keyword">new</span> Api(provider)
<span class="hljs-keyword">const</span> Alice = <span class="hljs-string">&apos;5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ&apos;</span>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;bn.js&apos;</span>);
<span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default;
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default;
<span class="hljs-keyword">const</span> storage = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/storage&apos;</span>).default;
<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 = <span class="hljs-keyword">new</span> Api(provider);
<span class="hljs-keyword">const</span> Alice = <span class="hljs-string">&apos;5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ&apos;</span>;
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;You may let this example running and start the example 06 or send DOTs to &apos;</span> + Alice)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;You may leave this example running and start example 06 or send DOTs to &apos;</span> + Alice);
api.state
.storage([[storage.staking.public.freeBalanceOf, Alice]], (_, values) =&gt; {
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Balance of <span class="hljs-subst">${Alice}</span>: <span class="hljs-subst">${new BN(values[0]).toString(10)}</span> DOTs`</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Balance of <span class="hljs-subst">${Alice}</span>: <span class="hljs-subst">${new BN(values[0]).toString(10)}</span> DOTs`</span>);
})
.then((subscriptionId) =&gt; {
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Balance changes subscription id:&apos;</span>, subscriptionId)
})
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Balance changes subscription id:&apos;</span>, subscriptionId);
});
</code></pre>
@@ -432,7 +432,7 @@ api.state
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Listen to balance change","level":"2.4","depth":1,"next":{"title":"Generate Accounts","level":"2.5","depth":1,"path":"examples/04_generate_account/README.md","ref":"examples/04_generate_account/README.md","articles":[]},"previous":{"title":"Listen to blocks","level":"2.3","depth":1,"path":"examples/02_listen_to_blocks/README.md","ref":"examples/02_listen_to_blocks/README.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":"examples/03_listen_to_balance_change/README.md","mtime":"2018-09-25T16:22:52.658Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Listen to balance change","level":"2.4","depth":1,"next":{"title":"Generate Accounts","level":"2.5","depth":1,"path":"examples/04_generate_account/README.md","ref":"examples/04_generate_account/README.md","articles":[]},"previous":{"title":"Listen to blocks","level":"2.3","depth":1,"path":"examples/02_listen_to_blocks/README.md","ref":"examples/02_listen_to_blocks/README.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":"examples/03_listen_to_balance_change/README.md","mtime":"2018-09-26T05:25:07.927Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
+19 -19
View File
@@ -371,37 +371,37 @@
<h1 id="generate-accounts">Generate accounts</h1>
<p>If you want to develop a wallet or a program that will accept payments in DOTs, you likely will need to generate addresses. This sample shows you how to generate accounts in several ways.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Keyring = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/util-keyring&apos;</span>).default
<span class="hljs-keyword">const</span> u8aToHex = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/util/u8a/toHex&apos;</span>).default
<span class="hljs-keyword">const</span> Encoder = <span class="hljs-keyword">new</span> TextEncoder() <span class="hljs-comment">// always utf-8</span>
<span class="hljs-keyword">const</span> crypto = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;crypto&apos;</span>)
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> crypto = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;crypto&apos;</span>);
<span class="hljs-keyword">const</span> Keyring = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/util-keyring&apos;</span>).default;
<span class="hljs-keyword">const</span> u8aToHex = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/util/u8a/toHex&apos;</span>).default;
<span class="hljs-keyword">const</span> Encoder = <span class="hljs-keyword">new</span> TextEncoder(); <span class="hljs-comment">// always utf-8</span>
<span class="hljs-comment">// A fixed seed from an array</span>
<span class="hljs-keyword">const</span> SEED1 = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Uint8Array</span>([
<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>, <span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>, <span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>,
<span class="hljs-number">22</span>, <span class="hljs-number">23</span>, <span class="hljs-number">24</span>, <span class="hljs-number">25</span>, <span class="hljs-number">26</span>, <span class="hljs-number">27</span>, <span class="hljs-number">28</span>, <span class="hljs-number">29</span>, <span class="hljs-number">30</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>
])
<span class="hljs-number">22</span>, <span class="hljs-number">23</span>, <span class="hljs-number">24</span>, <span class="hljs-number">25</span>, <span class="hljs-number">26</span>, <span class="hljs-number">27</span>, <span class="hljs-number">28</span>, <span class="hljs-number">29</span>, <span class="hljs-number">30</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>
]);
<span class="hljs-comment">// A fixed seed from a 32 chars string</span>
<span class="hljs-keyword">const</span> SEED2 = Encoder.encode(<span class="hljs-string">&apos;correct horse battery and staple&apos;</span>)
<span class="hljs-keyword">const</span> SEED2 = Encoder.encode(<span class="hljs-string">&apos;correct horse battery and staple&apos;</span>);
<span class="hljs-keyword">const</span> keyring = <span class="hljs-keyword">new</span> Keyring()
<span class="hljs-keyword">const</span> pair1 = keyring.addFromSeed(SEED1)
<span class="hljs-keyword">const</span> pair2 = keyring.addFromSeed(SEED2)
<span class="hljs-keyword">const</span> keyring = <span class="hljs-keyword">new</span> Keyring();
<span class="hljs-keyword">const</span> pair1 = keyring.addFromSeed(SEED1);
<span class="hljs-keyword">const</span> pair2 = keyring.addFromSeed(SEED2);
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Deterministic addresses (same for each run):&apos;</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Address 1\t <span class="hljs-subst">${pair1.address()}</span>\t Seed: <span class="hljs-subst">${u8aToHex(SEED1)}</span>`</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Address 2\t <span class="hljs-subst">${pair2.address()}</span>\t Seed: <span class="hljs-subst">${u8aToHex(SEED2)}</span>`</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Deterministic addresses (same for each run):&apos;</span>);
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Address 1\t <span class="hljs-subst">${pair1.address()}</span>\t Seed: <span class="hljs-subst">${u8aToHex(SEED1)}</span>`</span>);
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Address 2\t <span class="hljs-subst">${pair2.address()}</span>\t Seed: <span class="hljs-subst">${u8aToHex(SEED2)}</span>`</span>);
<span class="hljs-comment">// A random seed</span>
<span class="hljs-keyword">const</span> SEED = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Uint8Array</span>(<span class="hljs-number">32</span>)
<span class="hljs-keyword">const</span> SEED = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Uint8Array</span>(<span class="hljs-number">32</span>);
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Random Addresses (random for each run):&apos;</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Random Addresses (random for each run):&apos;</span>);
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">3</span>; i &lt; <span class="hljs-number">13</span>; i++) {
Buffer.from(crypto.randomFillSync(SEED))
<span class="hljs-keyword">const</span> pair3 = keyring.addFromSeed(SEED)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Address <span class="hljs-subst">${i}</span>\t <span class="hljs-subst">${pair3.address()}</span>\t Seed: <span class="hljs-subst">${u8aToHex(SEED)}</span>`</span>)
Buffer.from(crypto.randomFillSync(SEED));
<span class="hljs-keyword">const</span> pair3 = keyring.addFromSeed(SEED);
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Address <span class="hljs-subst">${i}</span>\t <span class="hljs-subst">${pair3.address()}</span>\t Seed: <span class="hljs-subst">${u8aToHex(SEED)}</span>`</span>);
}
</code></pre>
@@ -447,7 +447,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Generate Accounts","level":"2.5","depth":1,"next":{"title":"Read Storage","level":"2.6","depth":1,"path":"examples/05_read_storage/README.md","ref":"examples/05_read_storage/README.md","articles":[]},"previous":{"title":"Listen to balance change","level":"2.4","depth":1,"path":"examples/03_listen_to_balance_change/README.md","ref":"examples/03_listen_to_balance_change/README.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":"examples/04_generate_account/README.md","mtime":"2018-09-25T16:22:52.658Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Generate Accounts","level":"2.5","depth":1,"next":{"title":"Read Storage","level":"2.6","depth":1,"path":"examples/05_read_storage/README.md","ref":"examples/05_read_storage/README.md","articles":[]},"previous":{"title":"Listen to balance change","level":"2.4","depth":1,"path":"examples/03_listen_to_balance_change/README.md","ref":"examples/03_listen_to_balance_change/README.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":"examples/04_generate_account/README.md","mtime":"2018-09-26T05:25:07.927Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
+19 -19
View File
@@ -370,39 +370,39 @@
<section class="normal markdown-section">
<h1 id="read-storage">Read storage</h1>
<p>Many important variable are available through the storage API. This example shows how to call a few of those APIs.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default
<span class="hljs-keyword">const</span> storage = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/storage&apos;</span>).default
<span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;bn.js&apos;</span>)
<p>Many important variables are available through the storage API. This example shows how to call a few of those APIs.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;bn.js&apos;</span>);
<span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default;
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default;
<span class="hljs-keyword">const</span> storage = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/storage&apos;</span>).default;
<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 = <span class="hljs-keyword">new</span> Api(provider)
<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 = <span class="hljs-keyword">new</span> Api(provider);
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getAccountIndex</span> (<span class="hljs-params">address</span>) </span>{
<span class="hljs-keyword">return</span> api.state.getStorage([storage.system.public.accountIndexOf, address])
<span class="hljs-keyword">return</span> api.state.getStorage([storage.system.public.accountIndexOf, address]);
}
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getValidators</span> (<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">return</span> api.state.getStorage([storage.session.public.validators])
<span class="hljs-keyword">return</span> api.state.getStorage([storage.session.public.validators]);
}
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getBlockPeriod</span> (<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">return</span> api.state.getStorage([storage.timestamp.public.blockPeriod])
<span class="hljs-keyword">return</span> api.state.getStorage([storage.timestamp.public.blockPeriod]);
}
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span> (<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">const</span> address = <span class="hljs-string">&apos;5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ&apos;</span>
<span class="hljs-keyword">const</span> validators = <span class="hljs-keyword">await</span> getValidators()
<span class="hljs-keyword">const</span> index = <span class="hljs-keyword">await</span> getAccountIndex(address)
<span class="hljs-keyword">const</span> blockPeriod = <span class="hljs-keyword">await</span> getBlockPeriod()
<span class="hljs-keyword">const</span> address = <span class="hljs-string">&apos;5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ&apos;</span>;
<span class="hljs-keyword">const</span> validators = <span class="hljs-keyword">await</span> getValidators();
<span class="hljs-keyword">const</span> index = <span class="hljs-keyword">await</span> getAccountIndex(address);
<span class="hljs-keyword">const</span> blockPeriod = <span class="hljs-keyword">await</span> getBlockPeriod();
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`BlockPeriod: <span class="hljs-subst">${new BN(blockPeriod).toString(10)}</span> seconds`</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Account Index of <span class="hljs-subst">${address}</span>: <span class="hljs-subst">${index.toString(10)}</span>`</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Current validators&apos;</span>, validators)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`BlockPeriod: <span class="hljs-subst">${new BN(blockPeriod).toString(10)}</span> seconds`</span>);
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Account Index of <span class="hljs-subst">${address}</span>: <span class="hljs-subst">${index.toString(10)}</span>`</span>);
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Current validators&apos;</span>, validators);
}
main().finally(_ =&gt; process.exit())
main().finally(_ =&gt; process.exit());
</code></pre>
@@ -447,7 +447,7 @@ main().finally(_ =&gt; process.exit())
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Read Storage","level":"2.6","depth":1,"next":{"title":"Craft Extrinsic","level":"2.7","depth":1,"path":"examples/06_craft_extrinsic/README.md","ref":"examples/06_craft_extrinsic/README.md","articles":[]},"previous":{"title":"Generate Accounts","level":"2.5","depth":1,"path":"examples/04_generate_account/README.md","ref":"examples/04_generate_account/README.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":"examples/05_read_storage/README.md","mtime":"2018-09-25T16:22:52.658Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Read Storage","level":"2.6","depth":1,"next":{"title":"Craft Extrinsic","level":"2.7","depth":1,"path":"examples/06_craft_extrinsic/README.md","ref":"examples/06_craft_extrinsic/README.md","articles":[]},"previous":{"title":"Generate Accounts","level":"2.5","depth":1,"path":"examples/04_generate_account/README.md","ref":"examples/04_generate_account/README.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":"examples/05_read_storage/README.md","mtime":"2018-09-26T05:25:07.927Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
+28 -32
View File
@@ -370,29 +370,29 @@
<section class="normal markdown-section">
<h1 id="craft-extrinsic">Craft Extrinsic</h1>
<p>In the current version, crafting an extrinsic is a rather cumbersome process. This sample guides you though it and shows how to tranfer DOTs from an account to another.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default
<span class="hljs-keyword">const</span> extrinsics = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics&apos;</span>).default
<span class="hljs-keyword">const</span> encodeExtrinsic = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics/codec/encode&apos;</span>).default
<span class="hljs-keyword">const</span> encodeLength = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics/codec/encode/length&apos;</span>).default
<span class="hljs-keyword">const</span> Keyring = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/util-keyring&apos;</span>).default
<span class="hljs-keyword">const</span> storage = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/storage&apos;</span>).default
<span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;bn.js&apos;</span>)
<p>In the current version, crafting an extrinsic is a rather cumbersome process. This sample guides you through it and shows how to tranfer DOTs from one an account to another.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;bn.js&apos;</span>);
<span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default;
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default;
<span class="hljs-keyword">const</span> extrinsics = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics&apos;</span>).default;
<span class="hljs-keyword">const</span> encodeExtrinsic = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics/codec/encode&apos;</span>).default;
<span class="hljs-keyword">const</span> encodeLength = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics/codec/encode/length&apos;</span>).default;
<span class="hljs-keyword">const</span> Keyring = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/util-keyring&apos;</span>).default;
<span class="hljs-keyword">const</span> storage = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/storage&apos;</span>).default;
<span class="hljs-keyword">const</span> Encoder = <span class="hljs-keyword">new</span> TextEncoder()
<span class="hljs-keyword">const</span> keyring = <span class="hljs-keyword">new</span> Keyring()
<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 = <span class="hljs-keyword">new</span> Api(provider)
<span class="hljs-keyword">const</span> Encoder = <span class="hljs-keyword">new</span> TextEncoder();
<span class="hljs-keyword">const</span> keyring = <span class="hljs-keyword">new</span> Keyring();
<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 = <span class="hljs-keyword">new</span> Api(provider);
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getAccountIndex</span> (<span class="hljs-params">address</span>) </span>{
<span class="hljs-keyword">return</span> api.state.getStorage([storage.system.public.accountIndexOf, address])
<span class="hljs-keyword">return</span> api.state.getStorage([storage.system.public.accountIndexOf, address]);
}
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">transfer</span> (<span class="hljs-params">keyRingFrom, addressTo, amount</span>) </span>{
<span class="hljs-keyword">const</span> accountIndex = <span class="hljs-keyword">await</span> getAccountIndex(keyRingFrom.address())
<span class="hljs-keyword">const</span> accountIndex = <span class="hljs-keyword">await</span> getAccountIndex(keyRingFrom.address());
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Current accountIndex: <span class="hljs-subst">${accountIndex}</span>`</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Current accountIndex: <span class="hljs-subst">${accountIndex}</span>`</span>);
<span class="hljs-comment">// encode the call for signing</span>
<span class="hljs-keyword">const</span> message = encodeExtrinsic(
@@ -400,10 +400,10 @@
accountIndex,
extrinsics.staking.public.transfer,
[addressTo, amount]
)
);
<span class="hljs-comment">// get the signature</span>
<span class="hljs-keyword">const</span> signature = keyRingFrom.sign(message)
<span class="hljs-keyword">const</span> signature = keyRingFrom.sign(message);
<span class="hljs-comment">// encode the extrinsic for submission, adding the length (prefix) and the</span>
<span class="hljs-comment">// signature (postfix)R&#xF6;dl</span>
@@ -412,25 +412,21 @@
<span class="hljs-keyword">new</span> <span class="hljs-built_in">Uint8Array</span>([<span class="hljs-number">0xff</span>]),
message,
signature
)
);
<span class="hljs-keyword">return</span> api.author.submitExtrinsic(encoded)
<span class="hljs-keyword">return</span> api.author.submitExtrinsic(encoded);
}
<span class="hljs-keyword">const</span> Alice = keyring.addFromSeed(Encoder.encode(<span class="hljs-string">&apos;Alice &apos;</span>))
<span class="hljs-keyword">const</span> addressBob = <span class="hljs-string">&apos;5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE&apos;</span>
<span class="hljs-keyword">const</span> amount = <span class="hljs-keyword">new</span> BN(<span class="hljs-number">999</span>) <span class="hljs-comment">// on dev chain, the fee is 1, that makes it a round 1000</span>
<span class="hljs-keyword">const</span> Alice = keyring.addFromSeed(Encoder.encode(<span class="hljs-string">&apos;Alice &apos;</span>));
<span class="hljs-keyword">const</span> addressBob = <span class="hljs-string">&apos;5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE&apos;</span>;
<span class="hljs-keyword">const</span> amount = <span class="hljs-keyword">new</span> BN(<span class="hljs-number">999</span>); <span class="hljs-comment">// on dev chain, the fee is 1, that makes it a round 1000</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Crafting and sending an extrinsic for Alice to send Bob <span class="hljs-subst">${amount}</span> DOTs`</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Crafting and sending an extrinsic for Alice to send Bob <span class="hljs-subst">${amount}</span> DOTs`</span>);
transfer(Alice, addressBob, amount)
.then(() =&gt;
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Sent&apos;</span>)
)
.catch((e) =&gt;
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;HINT: Make sure you wait for the storage to update before sending the next extrinsic&apos;</span>, e)
)
.finally(_ =&gt; process.exit(<span class="hljs-number">0</span>))
.then(() =&gt; <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Sent&apos;</span>))
.catch((error) =&gt; <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;HINT: Make sure you wait for the storage to update before sending the next extrinsic&apos;</span>, error))
.finally(_ =&gt; process.exit(<span class="hljs-number">0</span>));
</code></pre>
@@ -475,7 +471,7 @@ transfer(Alice, addressBob, amount)
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Craft Extrinsic","level":"2.7","depth":1,"next":{"title":"Transfer DOTs","level":"2.8","depth":1,"path":"examples/07_transfer_dots/README.md","ref":"examples/07_transfer_dots/README.md","articles":[]},"previous":{"title":"Read Storage","level":"2.6","depth":1,"path":"examples/05_read_storage/README.md","ref":"examples/05_read_storage/README.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":"examples/06_craft_extrinsic/README.md","mtime":"2018-09-25T16:22:52.658Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Craft Extrinsic","level":"2.7","depth":1,"next":{"title":"Transfer DOTs","level":"2.8","depth":1,"path":"examples/07_transfer_dots/README.md","ref":"examples/07_transfer_dots/README.md","articles":[]},"previous":{"title":"Read Storage","level":"2.6","depth":1,"path":"examples/05_read_storage/README.md","ref":"examples/05_read_storage/README.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":"examples/06_craft_extrinsic/README.md","mtime":"2018-09-26T05:25:07.927Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
+23 -24
View File
@@ -368,27 +368,26 @@
<section class="normal markdown-section">
<h1 id="tranfer-dots">Tranfer DOTs</h1>
<p>This sample is more &apos;straight to the point&apos; and shows the easiest way to transfer DOTs from an account to another.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default
<span class="hljs-keyword">const</span> extrinsics = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics&apos;</span>).default
<span class="hljs-keyword">const</span> encodeExtrinsic = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics/codec/encode/uncheckedLength&apos;</span>).default
<span class="hljs-keyword">const</span> encodeLength = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics/codec/encode/length&apos;</span>).default
<span class="hljs-keyword">const</span> Keyring = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/util-keyring&apos;</span>).default
<span class="hljs-keyword">const</span> storage = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/storage&apos;</span>).default
<span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;bn.js&apos;</span>)
<p>This sample is more &apos;straight to the point&apos; and shows the easiest way to transfer DOTs from one an account to another.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;bn.js&apos;</span>);
<span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api&apos;</span>).default;
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/api-provider/ws&apos;</span>).default;
<span class="hljs-keyword">const</span> extrinsics = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics&apos;</span>).default;
<span class="hljs-keyword">const</span> encodeExtrinsic = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/extrinsics/codec/encode/uncheckedLength&apos;</span>).default;
<span class="hljs-keyword">const</span> Keyring = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/util-keyring&apos;</span>).default;
<span class="hljs-keyword">const</span> storage = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;@polkadot/storage&apos;</span>).default;
<span class="hljs-keyword">const</span> Encoder = <span class="hljs-keyword">new</span> TextEncoder()
<span class="hljs-keyword">const</span> keyring = <span class="hljs-keyword">new</span> Keyring()
<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 = <span class="hljs-keyword">new</span> Api(provider)
<span class="hljs-keyword">const</span> Encoder = <span class="hljs-keyword">new</span> TextEncoder();
<span class="hljs-keyword">const</span> keyring = <span class="hljs-keyword">new</span> Keyring();
<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 = <span class="hljs-keyword">new</span> Api(provider);
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getAccountIndex</span> (<span class="hljs-params">address</span>) </span>{
<span class="hljs-keyword">return</span> api.state.getStorage([storage.system.public.accountIndexOf, address])
<span class="hljs-keyword">return</span> api.state.getStorage([storage.system.public.accountIndexOf, address]);
}
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">transfer</span> (<span class="hljs-params">keyRingFrom, addressTo, amount</span>) </span>{
<span class="hljs-keyword">const</span> nextAccountIndex = <span class="hljs-keyword">await</span> getAccountIndex(keyRingFrom.address())
<span class="hljs-keyword">const</span> nextAccountIndex = <span class="hljs-keyword">await</span> getAccountIndex(keyRingFrom.address());
<span class="hljs-comment">// encode the call for signing</span>
<span class="hljs-keyword">const</span> encoded = encodeExtrinsic(
@@ -396,22 +395,22 @@
nextAccountIndex,
extrinsics.staking.public.transfer,
[addressTo, amount]
)
);
<span class="hljs-keyword">await</span> api.author.submitExtrinsic(encoded)
.catch(e =&gt; <span class="hljs-built_in">console</span>.log)
.catch(e =&gt; <span class="hljs-built_in">console</span>.log);
}
<span class="hljs-keyword">const</span> Alice = keyring.addFromSeed(Encoder.encode(<span class="hljs-string">&apos;Alice &apos;</span>))
<span class="hljs-keyword">const</span> addressBob = <span class="hljs-string">&apos;5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE&apos;</span>
<span class="hljs-keyword">const</span> amount = <span class="hljs-keyword">new</span> BN(<span class="hljs-number">999</span>) <span class="hljs-comment">// on dev chain, the fee is 1, that makes it a round 1000</span>
<span class="hljs-keyword">const</span> Alice = keyring.addFromSeed(Encoder.encode(<span class="hljs-string">&apos;Alice &apos;</span>));
<span class="hljs-keyword">const</span> addressBob = <span class="hljs-string">&apos;5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE&apos;</span>;
<span class="hljs-keyword">const</span> amount = <span class="hljs-keyword">new</span> BN(<span class="hljs-number">999</span>); <span class="hljs-comment">// on dev chain, the fee is 1, that makes it a round 1000</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Crafting and sending an extrinsic for Alice to send Bob <span class="hljs-subst">${amount}</span> DOTs`</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Crafting and sending an extrinsic for Alice to send Bob <span class="hljs-subst">${amount}</span> DOTs`</span>);
transfer(Alice, addressBob, amount)
.then(() =&gt; <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Done&apos;</span>))
.catch((e) =&gt; <span class="hljs-built_in">console</span>.log(e))
.finally(_ =&gt; process.exit(<span class="hljs-number">0</span>))
.catch((error) =&gt; <span class="hljs-built_in">console</span>.log(error))
.finally(_ =&gt; process.exit(<span class="hljs-number">0</span>));
</code></pre>
@@ -452,7 +451,7 @@ transfer(Alice, addressBob, amount)
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Transfer DOTs","level":"2.8","depth":1,"previous":{"title":"Craft Extrinsic","level":"2.7","depth":1,"path":"examples/06_craft_extrinsic/README.md","ref":"examples/06_craft_extrinsic/README.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":"examples/07_transfer_dots/README.md","mtime":"2018-09-25T16:22:52.658Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Transfer DOTs","level":"2.8","depth":1,"previous":{"title":"Craft Extrinsic","level":"2.7","depth":1,"path":"examples/06_craft_extrinsic/README.md","ref":"examples/06_craft_extrinsic/README.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":"examples/07_transfer_dots/README.md","mtime":"2018-09-26T05:25:07.927Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
+3 -3
View File
@@ -377,8 +377,8 @@
<li>Alice: <code>5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ</code></li>
<li>Bob: <code>5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE</code></li>
</ul>
<p>Those accounts are easy to add if you don&#xB4;t have/see them. The seed of Alice&#xB4;s account is <code>Alice&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;</code> and the seed of Bob is... well you guess...</p>
<p>NOTE: Note the spaces padding Alice&#xB4;s key up to 32 chars.</p>
<p>Those accounts are easy to add if you don&apos;t have/see them. The seed of Alice&apos;s account is <code>Alice&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;&#x2423;</code> and the seed of Bob is... well you guess...</p>
<p>NOTE: Note the spaces padding Alice&apos;s key up to 32 chars.</p>
<h2 id="install">Install</h2>
<p>From each folder, run <code>yarn</code> to install the required dependencies</p>
<h2 id="running-the-examples">Running the examples</h2>
@@ -427,7 +427,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Overview","level":"2.1","depth":1,"next":{"title":"Simple connect","level":"2.2","depth":1,"path":"examples/01_simple_connect/README.md","ref":"examples/01_simple_connect/README.md","articles":[]},"previous":{"title":"ApiRx","level":"1.4.1","depth":2,"path":"api-rx/classes/_index_.rxapi.md","ref":"api-rx/classes/_index_.rxapi.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":"examples/README.md","mtime":"2018-09-25T16:22:52.658Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Overview","level":"2.1","depth":1,"next":{"title":"Simple connect","level":"2.2","depth":1,"path":"examples/01_simple_connect/README.md","ref":"examples/01_simple_connect/README.md","articles":[]},"previous":{"title":"ApiRx","level":"1.4.1","depth":2,"path":"api-rx/classes/_index_.rxapi.md","ref":"api-rx/classes/_index_.rxapi.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":"examples/README.md","mtime":"2018-09-26T05:25:07.927Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>
+1 -1
View File
@@ -447,7 +447,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"api","level":"1.2","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[{"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":"README.md","mtime":"2018-09-25T16:22:52.650Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-25T16:27:51.734Z"},"basePath":".","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"api","level":"1.2","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[{"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":"README.md","mtime":"2018-09-26T05:25:07.923Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-26T05:30:25.997Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>
File diff suppressed because one or more lines are too long