[CI Skip] 0.40.17

This commit is contained in:
Travis CI
2019-01-22 22:18:30 +00:00
parent 9373e5d6d7
commit 14b174473e
383 changed files with 50088 additions and 3886 deletions
@@ -330,7 +330,20 @@
</li>
<li class="chapter " data-level="3.1.4" data-path="../05_read_storage/">
<li class="chapter " data-level="3.1.4" data-path="../04_unsubscribe/">
<a href="../04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.1.5" data-path="../05_read_storage/">
<a href="../05_read_storage/">
@@ -343,9 +356,9 @@
</li>
<li class="chapter " data-level="3.1.5" data-path="../07_transfer_dots/">
<li class="chapter " data-level="3.1.6" data-path="../06_make_transfer/">
<a href="../07_transfer_dots/">
<a href="../06_make_transfer/">
Make a transfer
@@ -356,7 +369,7 @@
</li>
<li class="chapter " data-level="3.1.6" data-path="../08_system_events/">
<li class="chapter " data-level="3.1.7" data-path="../08_system_events/">
<a href="../08_system_events/">
@@ -369,7 +382,7 @@
</li>
<li class="chapter " data-level="3.1.7" data-path="../09_transfer_events/">
<li class="chapter " data-level="3.1.8" data-path="../09_transfer_events/">
<a href="../09_transfer_events/">
@@ -382,7 +395,7 @@
</li>
<li class="chapter " data-level="3.1.8" data-path="../10_upgrade_chain/">
<li class="chapter " data-level="3.1.9" data-path="../10_upgrade_chain/">
<a href="../10_upgrade_chain/">
@@ -393,6 +406,142 @@
</li>
</ul>
</li>
<li class="chapter " data-level="3.2" data-path="../../rx/">
<a href="../../rx/">
ApiRx
</a>
<ul class="articles">
<li class="chapter " data-level="3.2.1" data-path="../../rx/01_simple_connect/">
<a href="../../rx/01_simple_connect/">
Simple connect
</a>
</li>
<li class="chapter " data-level="3.2.2" data-path="../../rx/02_listen_to_blocks/">
<a href="../../rx/02_listen_to_blocks/">
Listen to blocks
</a>
</li>
<li class="chapter " data-level="3.2.3" data-path="../../rx/03_listen_to_balance_change/">
<a href="../../rx/03_listen_to_balance_change/">
Listen to balance change
</a>
</li>
<li class="chapter " data-level="3.2.4" data-path="../../rx/04_unsubscribe/">
<a href="../../rx/04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.2.5" data-path="../../rx/05_read_storage/">
<a href="../../rx/05_read_storage/">
Read chain state
</a>
</li>
<li class="chapter " data-level="3.2.6" data-path="../../rx/06_make_transfer/">
<a href="../../rx/06_make_transfer/">
Make a transfer
</a>
</li>
<li class="chapter " data-level="3.2.7" data-path="../../rx/08_system_events/">
<a href="../../rx/08_system_events/">
Display system events
</a>
</li>
<li class="chapter " data-level="3.2.8" data-path="../../rx/09_transfer_events/">
<a href="../../rx/09_transfer_events/">
Transaction with events
</a>
</li>
<li class="chapter " data-level="3.2.9" data-path="../../rx/10_upgrade_chain/">
<a href="../../rx/10_upgrade_chain/">
Upgrade via sudo
</a>
</li>
@@ -1987,7 +2136,7 @@
<section class="normal markdown-section">
<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>
<p>The following example shows how to instantiate a Polkadot API object and use it to connect to a node using ApiPromise.</p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-comment">//&#xA0;Required&#xA0;imports</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">ApiPromise</span>&#xA0;<span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;@polkadot/api&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">WsProvider</span>&#xA0;<span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;@polkadot/rpc-provider&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
@@ -2054,7 +2203,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Simple connect","level":"3.1.1","depth":2,"next":{"title":"Listen to blocks","level":"3.1.2","depth":2,"path":"examples/promise/02_listen_to_blocks/README.md","ref":"examples/promise/02_listen_to_blocks/README.md","articles":[]},"previous":{"title":"ApiPromise","level":"3.1","depth":1,"path":"examples/promise/README.md","ref":"examples/promise/README.md","articles":[{"title":"Simple connect","level":"3.1.1","depth":2,"path":"examples/promise/01_simple_connect/README.md","ref":"examples/promise/01_simple_connect/README.md","articles":[]},{"title":"Listen to blocks","level":"3.1.2","depth":2,"path":"examples/promise/02_listen_to_blocks/README.md","ref":"examples/promise/02_listen_to_blocks/README.md","articles":[]},{"title":"Listen to balance change","level":"3.1.3","depth":2,"path":"examples/promise/03_listen_to_balance_change/README.md","ref":"examples/promise/03_listen_to_balance_change/README.md","articles":[]},{"title":"Read chain state","level":"3.1.4","depth":2,"path":"examples/promise/05_read_storage/README.md","ref":"examples/promise/05_read_storage/README.md","articles":[]},{"title":"Make a transfer","level":"3.1.5","depth":2,"path":"examples/promise/07_transfer_dots/README.md","ref":"examples/promise/07_transfer_dots/README.md","articles":[]},{"title":"Display system events","level":"3.1.6","depth":2,"path":"examples/promise/08_system_events/README.md","ref":"examples/promise/08_system_events/README.md","articles":[]},{"title":"Transaction with events","level":"3.1.7","depth":2,"path":"examples/promise/09_transfer_events/README.md","ref":"examples/promise/09_transfer_events/README.md","articles":[]},{"title":"Upgrade via sudo","level":"3.1.8","depth":2,"path":"examples/promise/10_upgrade_chain/README.md","ref":"examples/promise/10_upgrade_chain/README.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/01_simple_connect/README.md","mtime":"2019-01-17T16:15:44.321Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-17T16:19:54.997Z"},"basePath":"../../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Simple connect","level":"3.1.1","depth":2,"next":{"title":"Listen to blocks","level":"3.1.2","depth":2,"path":"examples/promise/02_listen_to_blocks/README.md","ref":"examples/promise/02_listen_to_blocks/README.md","articles":[]},"previous":{"title":"ApiPromise","level":"3.1","depth":1,"path":"examples/promise/README.md","ref":"examples/promise/README.md","articles":[{"title":"Simple connect","level":"3.1.1","depth":2,"path":"examples/promise/01_simple_connect/README.md","ref":"examples/promise/01_simple_connect/README.md","articles":[]},{"title":"Listen to blocks","level":"3.1.2","depth":2,"path":"examples/promise/02_listen_to_blocks/README.md","ref":"examples/promise/02_listen_to_blocks/README.md","articles":[]},{"title":"Listen to balance change","level":"3.1.3","depth":2,"path":"examples/promise/03_listen_to_balance_change/README.md","ref":"examples/promise/03_listen_to_balance_change/README.md","articles":[]},{"title":"Unsubscribe from listening","level":"3.1.4","depth":2,"path":"examples/promise/04_unsubscribe/README.md","ref":"examples/promise/04_unsubscribe/README.md","articles":[]},{"title":"Read chain state","level":"3.1.5","depth":2,"path":"examples/promise/05_read_storage/README.md","ref":"examples/promise/05_read_storage/README.md","articles":[]},{"title":"Make a transfer","level":"3.1.6","depth":2,"path":"examples/promise/06_make_transfer/README.md","ref":"examples/promise/06_make_transfer/README.md","articles":[]},{"title":"Display system events","level":"3.1.7","depth":2,"path":"examples/promise/08_system_events/README.md","ref":"examples/promise/08_system_events/README.md","articles":[]},{"title":"Transaction with events","level":"3.1.8","depth":2,"path":"examples/promise/09_transfer_events/README.md","ref":"examples/promise/09_transfer_events/README.md","articles":[]},{"title":"Upgrade via sudo","level":"3.1.9","depth":2,"path":"examples/promise/10_upgrade_chain/README.md","ref":"examples/promise/10_upgrade_chain/README.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/01_simple_connect/README.md","mtime":"2019-01-22T22:13:44.152Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-22T22:17:48.947Z"},"basePath":"../../..","book":{"language":""}});
});
</script>
</div>
@@ -330,7 +330,20 @@
</li>
<li class="chapter " data-level="3.1.4" data-path="../05_read_storage/">
<li class="chapter " data-level="3.1.4" data-path="../04_unsubscribe/">
<a href="../04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.1.5" data-path="../05_read_storage/">
<a href="../05_read_storage/">
@@ -343,9 +356,9 @@
</li>
<li class="chapter " data-level="3.1.5" data-path="../07_transfer_dots/">
<li class="chapter " data-level="3.1.6" data-path="../06_make_transfer/">
<a href="../07_transfer_dots/">
<a href="../06_make_transfer/">
Make a transfer
@@ -356,7 +369,7 @@
</li>
<li class="chapter " data-level="3.1.6" data-path="../08_system_events/">
<li class="chapter " data-level="3.1.7" data-path="../08_system_events/">
<a href="../08_system_events/">
@@ -369,7 +382,7 @@
</li>
<li class="chapter " data-level="3.1.7" data-path="../09_transfer_events/">
<li class="chapter " data-level="3.1.8" data-path="../09_transfer_events/">
<a href="../09_transfer_events/">
@@ -382,7 +395,7 @@
</li>
<li class="chapter " data-level="3.1.8" data-path="../10_upgrade_chain/">
<li class="chapter " data-level="3.1.9" data-path="../10_upgrade_chain/">
<a href="../10_upgrade_chain/">
@@ -393,6 +406,142 @@
</li>
</ul>
</li>
<li class="chapter " data-level="3.2" data-path="../../rx/">
<a href="../../rx/">
ApiRx
</a>
<ul class="articles">
<li class="chapter " data-level="3.2.1" data-path="../../rx/01_simple_connect/">
<a href="../../rx/01_simple_connect/">
Simple connect
</a>
</li>
<li class="chapter " data-level="3.2.2" data-path="../../rx/02_listen_to_blocks/">
<a href="../../rx/02_listen_to_blocks/">
Listen to blocks
</a>
</li>
<li class="chapter " data-level="3.2.3" data-path="../../rx/03_listen_to_balance_change/">
<a href="../../rx/03_listen_to_balance_change/">
Listen to balance change
</a>
</li>
<li class="chapter " data-level="3.2.4" data-path="../../rx/04_unsubscribe/">
<a href="../../rx/04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.2.5" data-path="../../rx/05_read_storage/">
<a href="../../rx/05_read_storage/">
Read chain state
</a>
</li>
<li class="chapter " data-level="3.2.6" data-path="../../rx/06_make_transfer/">
<a href="../../rx/06_make_transfer/">
Make a transfer
</a>
</li>
<li class="chapter " data-level="3.2.7" data-path="../../rx/08_system_events/">
<a href="../../rx/08_system_events/">
Display system events
</a>
</li>
<li class="chapter " data-level="3.2.8" data-path="../../rx/09_transfer_events/">
<a href="../../rx/09_transfer_events/">
Transaction with events
</a>
</li>
<li class="chapter " data-level="3.2.9" data-path="../../rx/10_upgrade_chain/">
<a href="../../rx/10_upgrade_chain/">
Upgrade via sudo
</a>
</li>
@@ -2002,13 +2151,9 @@
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;Subscribe&#xA0;to&#xA0;the&#xA0;new&#xA0;headers&#xA0;on-chain.&#xA0;The&#xA0;callback&#xA0;is&#xA0;fired&#xA0;when&#xA0;new&#xA0;headers</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;are&#xA0;found,&#xA0;the&#xA0;call&#xA0;itself&#xA0;returns&#xA0;a&#xA0;promise&#xA0;with&#xA0;a&#xA0;subscription&#xA0;that&#xA0;can&#xA0;be</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;used&#xA0;to&#xA0;unsubscribe&#xA0;from&#xA0;the&#xA0;newHead&#xA0;subscription</span>
&#xA0;&#xA0;<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">subscriptionId</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">await</span>&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">rpc</span><span class="sunlight-operator">.</span><span class="sunlight-ident">chain</span><span class="sunlight-operator">.</span><span class="sunlight-ident">subscribeNewHead</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">header</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">best</span>&#xA0;<span class="sunlight-punctuation">#</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">header</span><span class="sunlight-operator">.</span><span class="sunlight-ident">blockNumber</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">unsubscribe</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">await</span>&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">rpc</span><span class="sunlight-operator">.</span><span class="sunlight-ident">chain</span><span class="sunlight-operator">.</span><span class="sunlight-ident">subscribeNewHead</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">header</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">Chain</span>&#xA0;<span class="sunlight-ident">is</span>&#xA0;<span class="sunlight-ident">at</span>&#xA0;<span class="sunlight-ident">block</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-punctuation">#</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">header</span><span class="sunlight-operator">.</span><span class="sunlight-ident">blockNumber</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;Id&#xA0;for&#xA0;the&#xA0;subscription,&#xA0;we&#xA0;can&#xA0;cleanup&#xA0;and&#xA0;unsubscribe&#xA0;via</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;`api.chain.newHead.unsubscribe(subscriptionId)`</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">subsciptionId</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">subscriptionId</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span>
<span class="sunlight-ident">main</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-keyword">catch</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
@@ -2056,7 +2201,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Listen to blocks","level":"3.1.2","depth":2,"next":{"title":"Listen to balance change","level":"3.1.3","depth":2,"path":"examples/promise/03_listen_to_balance_change/README.md","ref":"examples/promise/03_listen_to_balance_change/README.md","articles":[]},"previous":{"title":"Simple connect","level":"3.1.1","depth":2,"path":"examples/promise/01_simple_connect/README.md","ref":"examples/promise/01_simple_connect/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/02_listen_to_blocks/README.md","mtime":"2019-01-17T16:15:44.321Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-17T16:19:54.997Z"},"basePath":"../../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Listen to blocks","level":"3.1.2","depth":2,"next":{"title":"Listen to balance change","level":"3.1.3","depth":2,"path":"examples/promise/03_listen_to_balance_change/README.md","ref":"examples/promise/03_listen_to_balance_change/README.md","articles":[]},"previous":{"title":"Simple connect","level":"3.1.1","depth":2,"path":"examples/promise/01_simple_connect/README.md","ref":"examples/promise/01_simple_connect/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/02_listen_to_blocks/README.md","mtime":"2019-01-22T22:13:44.152Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-22T22:17:48.947Z"},"basePath":"../../..","book":{"language":""}});
});
</script>
</div>
@@ -61,7 +61,7 @@
<link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="../05_read_storage/" />
<link rel="next" href="../04_unsubscribe/" />
<link rel="prev" href="../02_listen_to_blocks/" />
@@ -330,7 +330,20 @@
</li>
<li class="chapter " data-level="3.1.4" data-path="../05_read_storage/">
<li class="chapter " data-level="3.1.4" data-path="../04_unsubscribe/">
<a href="../04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.1.5" data-path="../05_read_storage/">
<a href="../05_read_storage/">
@@ -343,9 +356,9 @@
</li>
<li class="chapter " data-level="3.1.5" data-path="../07_transfer_dots/">
<li class="chapter " data-level="3.1.6" data-path="../06_make_transfer/">
<a href="../07_transfer_dots/">
<a href="../06_make_transfer/">
Make a transfer
@@ -356,7 +369,7 @@
</li>
<li class="chapter " data-level="3.1.6" data-path="../08_system_events/">
<li class="chapter " data-level="3.1.7" data-path="../08_system_events/">
<a href="../08_system_events/">
@@ -369,7 +382,7 @@
</li>
<li class="chapter " data-level="3.1.7" data-path="../09_transfer_events/">
<li class="chapter " data-level="3.1.8" data-path="../09_transfer_events/">
<a href="../09_transfer_events/">
@@ -382,7 +395,7 @@
</li>
<li class="chapter " data-level="3.1.8" data-path="../10_upgrade_chain/">
<li class="chapter " data-level="3.1.9" data-path="../10_upgrade_chain/">
<a href="../10_upgrade_chain/">
@@ -393,6 +406,142 @@
</li>
</ul>
</li>
<li class="chapter " data-level="3.2" data-path="../../rx/">
<a href="../../rx/">
ApiRx
</a>
<ul class="articles">
<li class="chapter " data-level="3.2.1" data-path="../../rx/01_simple_connect/">
<a href="../../rx/01_simple_connect/">
Simple connect
</a>
</li>
<li class="chapter " data-level="3.2.2" data-path="../../rx/02_listen_to_blocks/">
<a href="../../rx/02_listen_to_blocks/">
Listen to blocks
</a>
</li>
<li class="chapter " data-level="3.2.3" data-path="../../rx/03_listen_to_balance_change/">
<a href="../../rx/03_listen_to_balance_change/">
Listen to balance change
</a>
</li>
<li class="chapter " data-level="3.2.4" data-path="../../rx/04_unsubscribe/">
<a href="../../rx/04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.2.5" data-path="../../rx/05_read_storage/">
<a href="../../rx/05_read_storage/">
Read chain state
</a>
</li>
<li class="chapter " data-level="3.2.6" data-path="../../rx/06_make_transfer/">
<a href="../../rx/06_make_transfer/">
Make a transfer
</a>
</li>
<li class="chapter " data-level="3.2.7" data-path="../../rx/08_system_events/">
<a href="../../rx/08_system_events/">
Display system events
</a>
</li>
<li class="chapter " data-level="3.2.8" data-path="../../rx/09_transfer_events/">
<a href="../../rx/09_transfer_events/">
Transaction with events
</a>
</li>
<li class="chapter " data-level="3.2.9" data-path="../../rx/10_upgrade_chain/">
<a href="../../rx/10_upgrade_chain/">
Upgrade via sudo
</a>
</li>
@@ -1988,7 +2137,7 @@
<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 and retrieve balance updates.</p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-comment">//&#xA0;Import&#xA0;the&#xA0;Api</span>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-comment">//&#xA0;Import&#xA0;the&#xA0;API</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">ApiPromise</span>&#xA0;<span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;@polkadot/api&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-comment">//&#xA0;Known&#xA0;account&#xA0;we&#xA0;want&#xA0;to&#xA0;use&#xA0;(available&#xA0;on&#xA0;dev&#xA0;chain,&#xA0;with&#xA0;funds)</span>
@@ -2002,7 +2151,7 @@
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;that&#xA0;resolves&#xA0;to&#xA0;the&#xA0;current&#xA0;on-chain&#xA0;value</span>
&#xA0;&#xA0;<span class="sunlight-ident">let</span>&#xA0;<span class="sunlight-ident">previous</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">await</span>&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">query</span><span class="sunlight-operator">.</span><span class="sunlight-ident">balances</span><span class="sunlight-operator">.</span><span class="sunlight-ident">freeBalance</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">Alice</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">Alice</span><span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-ident">has</span>&#xA0;<span class="sunlight-ident">a</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">previous</span><span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-ident">balance</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">Alice</span><span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-ident">has</span>&#xA0;<span class="sunlight-ident">a</span>&#xA0;<span class="sunlight-ident">balance</span>&#xA0;<span class="sunlight-ident">of</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">previous</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">You</span>&#xA0;<span class="sunlight-ident">may</span>&#xA0;<span class="sunlight-ident">leave</span>&#xA0;<span class="sunlight-keyword">this</span>&#xA0;<span class="sunlight-ident">example</span>&#xA0;<span class="sunlight-ident">running</span>&#xA0;<span class="sunlight-ident">and</span>&#xA0;<span class="sunlight-ident">start</span>&#xA0;<span class="sunlight-ident">example</span>&#xA0;<span class="sunlight-number">06</span>&#xA0;<span class="sunlight-ident">or</span>&#xA0;<span class="sunlight-ident">transfer</span>&#xA0;<span class="sunlight-ident">any</span>&#xA0;<span class="sunlight-ident">value</span>&#xA0;<span class="sunlight-ident">to</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">Alice</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;Here&#xA0;we&#xA0;subscribe&#xA0;to&#xA0;any&#xA0;balance&#xA0;changes&#xA0;and&#xA0;update&#xA0;the&#xA0;on-screen&#xA0;value</span>
@@ -2012,13 +2161,10 @@
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;Only&#xA0;display&#xA0;positive&#xA0;value&#xA0;changes&#xA0;(Since&#xA0;we&#xA0;are&#xA0;pulling&#xA0;`previous`&#xA0;above&#xA0;already,</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;the&#xA0;initial&#xA0;balance&#xA0;change&#xA0;will&#xA0;also&#xA0;be&#xA0;zero)</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-keyword">if</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-ident">change</span><span class="sunlight-operator">.</span><span class="sunlight-ident">isZero</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-keyword">return</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-keyword">if</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-operator">!</span><span class="sunlight-ident">change</span><span class="sunlight-operator">.</span><span class="sunlight-ident">isZero</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">previous</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">current</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">New</span>&#xA0;<span class="sunlight-ident">balance</span>&#xA0;<span class="sunlight-ident">change</span>&#xA0;<span class="sunlight-ident">of</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">change</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-punctuation">}</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">previous</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">current</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">Balance</span>&#xA0;<span class="sunlight-ident">of</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">Alice</span><span class="sunlight-punctuation">}</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">current</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">change</span><span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-ident">change</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span>
@@ -2056,7 +2202,7 @@
</a>
<a href="../05_read_storage/" class="navigation navigation-next " aria-label="Next page: Read chain state">
<a href="../04_unsubscribe/" class="navigation navigation-next " aria-label="Next page: Unsubscribe from listening">
<i class="fa fa-angle-right"></i>
</a>
@@ -2067,7 +2213,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Listen to balance change","level":"3.1.3","depth":2,"next":{"title":"Read chain state","level":"3.1.4","depth":2,"path":"examples/promise/05_read_storage/README.md","ref":"examples/promise/05_read_storage/README.md","articles":[]},"previous":{"title":"Listen to blocks","level":"3.1.2","depth":2,"path":"examples/promise/02_listen_to_blocks/README.md","ref":"examples/promise/02_listen_to_blocks/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/03_listen_to_balance_change/README.md","mtime":"2019-01-17T16:15:44.321Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-17T16:19:54.997Z"},"basePath":"../../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Listen to balance change","level":"3.1.3","depth":2,"next":{"title":"Unsubscribe from listening","level":"3.1.4","depth":2,"path":"examples/promise/04_unsubscribe/README.md","ref":"examples/promise/04_unsubscribe/README.md","articles":[]},"previous":{"title":"Listen to blocks","level":"3.1.2","depth":2,"path":"examples/promise/02_listen_to_blocks/README.md","ref":"examples/promise/02_listen_to_blocks/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/03_listen_to_balance_change/README.md","mtime":"2019-01-22T22:13:44.152Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-22T22:17:48.947Z"},"basePath":"../../..","book":{"language":""}});
});
</script>
</div>
File diff suppressed because it is too large Load Diff
+173 -21
View File
@@ -61,10 +61,10 @@
<link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="../07_transfer_dots/" />
<link rel="next" href="../06_make_transfer/" />
<link rel="prev" href="../03_listen_to_balance_change/" />
<link rel="prev" href="../04_unsubscribe/" />
</head>
@@ -330,7 +330,20 @@
</li>
<li class="chapter active" data-level="3.1.4" data-path="./">
<li class="chapter " data-level="3.1.4" data-path="../04_unsubscribe/">
<a href="../04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter active" data-level="3.1.5" data-path="./">
<a href="./">
@@ -343,9 +356,9 @@
</li>
<li class="chapter " data-level="3.1.5" data-path="../07_transfer_dots/">
<li class="chapter " data-level="3.1.6" data-path="../06_make_transfer/">
<a href="../07_transfer_dots/">
<a href="../06_make_transfer/">
Make a transfer
@@ -356,7 +369,7 @@
</li>
<li class="chapter " data-level="3.1.6" data-path="../08_system_events/">
<li class="chapter " data-level="3.1.7" data-path="../08_system_events/">
<a href="../08_system_events/">
@@ -369,7 +382,7 @@
</li>
<li class="chapter " data-level="3.1.7" data-path="../09_transfer_events/">
<li class="chapter " data-level="3.1.8" data-path="../09_transfer_events/">
<a href="../09_transfer_events/">
@@ -382,7 +395,7 @@
</li>
<li class="chapter " data-level="3.1.8" data-path="../10_upgrade_chain/">
<li class="chapter " data-level="3.1.9" data-path="../10_upgrade_chain/">
<a href="../10_upgrade_chain/">
@@ -393,6 +406,142 @@
</li>
</ul>
</li>
<li class="chapter " data-level="3.2" data-path="../../rx/">
<a href="../../rx/">
ApiRx
</a>
<ul class="articles">
<li class="chapter " data-level="3.2.1" data-path="../../rx/01_simple_connect/">
<a href="../../rx/01_simple_connect/">
Simple connect
</a>
</li>
<li class="chapter " data-level="3.2.2" data-path="../../rx/02_listen_to_blocks/">
<a href="../../rx/02_listen_to_blocks/">
Listen to blocks
</a>
</li>
<li class="chapter " data-level="3.2.3" data-path="../../rx/03_listen_to_balance_change/">
<a href="../../rx/03_listen_to_balance_change/">
Listen to balance change
</a>
</li>
<li class="chapter " data-level="3.2.4" data-path="../../rx/04_unsubscribe/">
<a href="../../rx/04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.2.5" data-path="../../rx/05_read_storage/">
<a href="../../rx/05_read_storage/">
Read chain state
</a>
</li>
<li class="chapter " data-level="3.2.6" data-path="../../rx/06_make_transfer/">
<a href="../../rx/06_make_transfer/">
Make a transfer
</a>
</li>
<li class="chapter " data-level="3.2.7" data-path="../../rx/08_system_events/">
<a href="../../rx/08_system_events/">
Display system events
</a>
</li>
<li class="chapter " data-level="3.2.8" data-path="../../rx/09_transfer_events/">
<a href="../../rx/09_transfer_events/">
Transaction with events
</a>
</li>
<li class="chapter " data-level="3.2.9" data-path="../../rx/10_upgrade_chain/">
<a href="../../rx/10_upgrade_chain/">
Upgrade via sudo
</a>
</li>
@@ -2008,17 +2157,20 @@
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">accountNonce</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">Alice</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">accountNonce</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">blockPeriod</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">blockPeriod</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toNumber</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-ident">seconds</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;Retrieve&#xA0;the&#xA0;balances&#xA0;for&#xA0;all&#xA0;validators</span>
&#xA0;&#xA0;<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">validatorBalances</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">await</span>&#xA0;<span class="sunlight-ident">Promise</span><span class="sunlight-operator">.</span><span class="sunlight-ident">all</span><span class="sunlight-punctuation">(</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">validators</span><span class="sunlight-operator">.</span><span class="sunlight-ident">map</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">authorityId</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">query</span><span class="sunlight-operator">.</span><span class="sunlight-ident">balances</span><span class="sunlight-operator">.</span><span class="sunlight-ident">freeBalance</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">authorityId</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-keyword">if</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-ident">validators</span>&#xA0;<span class="sunlight-operator">&amp;&amp;</span>&#xA0;<span class="sunlight-ident">validators</span><span class="sunlight-operator">.</span><span class="sunlight-ident">length</span>&#xA0;<span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-number">0</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;Retrieve&#xA0;the&#xA0;balances&#xA0;for&#xA0;all&#xA0;validators</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">validatorBalances</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">await</span>&#xA0;<span class="sunlight-ident">Promise</span><span class="sunlight-operator">.</span><span class="sunlight-ident">all</span><span class="sunlight-punctuation">(</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">validators</span><span class="sunlight-operator">.</span><span class="sunlight-ident">map</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">authorityId</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">query</span><span class="sunlight-operator">.</span><span class="sunlight-ident">balances</span><span class="sunlight-operator">.</span><span class="sunlight-ident">freeBalance</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">authorityId</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;validators&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">validators</span><span class="sunlight-operator">.</span><span class="sunlight-ident">map</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">authorityId</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">index</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">address</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-ident">authorityId</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toString</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">,</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">balance</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-ident">validatorBalances</span><span class="sunlight-punctuation">[</span><span class="sunlight-ident">index</span><span class="sunlight-punctuation">]</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toString</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;Print&#xA0;out&#xA0;the&#xA0;authorityIds&#xA0;and&#xA0;balances&#xA0;of&#xA0;all&#xA0;validators</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;validators&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">validators</span><span class="sunlight-operator">.</span><span class="sunlight-ident">map</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">authorityId</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">index</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">address</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-ident">authorityId</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toString</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">,</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">balance</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-ident">validatorBalances</span><span class="sunlight-punctuation">[</span><span class="sunlight-ident">index</span><span class="sunlight-punctuation">]</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toString</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span>
<span class="sunlight-punctuation">}</span>
<span class="sunlight-ident">main</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-keyword">catch</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-keyword">finally</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">_</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-ident">process</span><span class="sunlight-operator">.</span><span class="sunlight-ident">exit</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
@@ -2050,12 +2202,12 @@
<a href="../03_listen_to_balance_change/" class="navigation navigation-prev " aria-label="Previous page: Listen to balance change">
<a href="../04_unsubscribe/" class="navigation navigation-prev " aria-label="Previous page: Unsubscribe from listening">
<i class="fa fa-angle-left"></i>
</a>
<a href="../07_transfer_dots/" class="navigation navigation-next " aria-label="Next page: Make a transfer">
<a href="../06_make_transfer/" class="navigation navigation-next " aria-label="Next page: Make a transfer">
<i class="fa fa-angle-right"></i>
</a>
@@ -2066,7 +2218,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Read chain state","level":"3.1.4","depth":2,"next":{"title":"Make a transfer","level":"3.1.5","depth":2,"path":"examples/promise/07_transfer_dots/README.md","ref":"examples/promise/07_transfer_dots/README.md","articles":[]},"previous":{"title":"Listen to balance change","level":"3.1.3","depth":2,"path":"examples/promise/03_listen_to_balance_change/README.md","ref":"examples/promise/03_listen_to_balance_change/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/05_read_storage/README.md","mtime":"2019-01-17T16:15:44.321Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-17T16:19:54.997Z"},"basePath":"../../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Read chain state","level":"3.1.5","depth":2,"next":{"title":"Make a transfer","level":"3.1.6","depth":2,"path":"examples/promise/06_make_transfer/README.md","ref":"examples/promise/06_make_transfer/README.md","articles":[]},"previous":{"title":"Unsubscribe from listening","level":"3.1.4","depth":2,"path":"examples/promise/04_unsubscribe/README.md","ref":"examples/promise/04_unsubscribe/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/05_read_storage/README.md","mtime":"2019-01-22T22:13:44.152Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-22T22:17:48.947Z"},"basePath":"../../..","book":{"language":""}});
});
</script>
</div>
File diff suppressed because it is too large Load Diff
@@ -64,7 +64,7 @@
<link rel="next" href="../09_transfer_events/" />
<link rel="prev" href="../07_transfer_dots/" />
<link rel="prev" href="../06_make_transfer/" />
</head>
@@ -330,7 +330,20 @@
</li>
<li class="chapter " data-level="3.1.4" data-path="../05_read_storage/">
<li class="chapter " data-level="3.1.4" data-path="../04_unsubscribe/">
<a href="../04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.1.5" data-path="../05_read_storage/">
<a href="../05_read_storage/">
@@ -343,9 +356,9 @@
</li>
<li class="chapter " data-level="3.1.5" data-path="../07_transfer_dots/">
<li class="chapter " data-level="3.1.6" data-path="../06_make_transfer/">
<a href="../07_transfer_dots/">
<a href="../06_make_transfer/">
Make a transfer
@@ -356,7 +369,7 @@
</li>
<li class="chapter active" data-level="3.1.6" data-path="./">
<li class="chapter active" data-level="3.1.7" data-path="./">
<a href="./">
@@ -369,7 +382,7 @@
</li>
<li class="chapter " data-level="3.1.7" data-path="../09_transfer_events/">
<li class="chapter " data-level="3.1.8" data-path="../09_transfer_events/">
<a href="../09_transfer_events/">
@@ -382,7 +395,7 @@
</li>
<li class="chapter " data-level="3.1.8" data-path="../10_upgrade_chain/">
<li class="chapter " data-level="3.1.9" data-path="../10_upgrade_chain/">
<a href="../10_upgrade_chain/">
@@ -393,6 +406,142 @@
</li>
</ul>
</li>
<li class="chapter " data-level="3.2" data-path="../../rx/">
<a href="../../rx/">
ApiRx
</a>
<ul class="articles">
<li class="chapter " data-level="3.2.1" data-path="../../rx/01_simple_connect/">
<a href="../../rx/01_simple_connect/">
Simple connect
</a>
</li>
<li class="chapter " data-level="3.2.2" data-path="../../rx/02_listen_to_blocks/">
<a href="../../rx/02_listen_to_blocks/">
Listen to blocks
</a>
</li>
<li class="chapter " data-level="3.2.3" data-path="../../rx/03_listen_to_balance_change/">
<a href="../../rx/03_listen_to_balance_change/">
Listen to balance change
</a>
</li>
<li class="chapter " data-level="3.2.4" data-path="../../rx/04_unsubscribe/">
<a href="../../rx/04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.2.5" data-path="../../rx/05_read_storage/">
<a href="../../rx/05_read_storage/">
Read chain state
</a>
</li>
<li class="chapter " data-level="3.2.6" data-path="../../rx/06_make_transfer/">
<a href="../../rx/06_make_transfer/">
Make a transfer
</a>
</li>
<li class="chapter " data-level="3.2.7" data-path="../../rx/08_system_events/">
<a href="../../rx/08_system_events/">
Display system events
</a>
</li>
<li class="chapter " data-level="3.2.8" data-path="../../rx/09_transfer_events/">
<a href="../../rx/09_transfer_events/">
Transaction with events
</a>
</li>
<li class="chapter " data-level="3.2.9" data-path="../../rx/10_upgrade_chain/">
<a href="../../rx/10_upgrade_chain/">
Upgrade via sudo
</a>
</li>
@@ -2049,7 +2198,7 @@
<a href="../07_transfer_dots/" class="navigation navigation-prev " aria-label="Previous page: Make a transfer">
<a href="../06_make_transfer/" class="navigation navigation-prev " aria-label="Previous page: Make a transfer">
<i class="fa fa-angle-left"></i>
</a>
@@ -2065,7 +2214,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Display system events","level":"3.1.6","depth":2,"next":{"title":"Transaction with events","level":"3.1.7","depth":2,"path":"examples/promise/09_transfer_events/README.md","ref":"examples/promise/09_transfer_events/README.md","articles":[]},"previous":{"title":"Make a transfer","level":"3.1.5","depth":2,"path":"examples/promise/07_transfer_dots/README.md","ref":"examples/promise/07_transfer_dots/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/08_system_events/README.md","mtime":"2019-01-17T16:15:44.321Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-17T16:19:54.997Z"},"basePath":"../../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Display system events","level":"3.1.7","depth":2,"next":{"title":"Transaction with events","level":"3.1.8","depth":2,"path":"examples/promise/09_transfer_events/README.md","ref":"examples/promise/09_transfer_events/README.md","articles":[]},"previous":{"title":"Make a transfer","level":"3.1.6","depth":2,"path":"examples/promise/06_make_transfer/README.md","ref":"examples/promise/06_make_transfer/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/08_system_events/README.md","mtime":"2019-01-22T22:13:44.156Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-22T22:17:48.947Z"},"basePath":"../../..","book":{"language":""}});
});
</script>
</div>
@@ -330,7 +330,20 @@
</li>
<li class="chapter " data-level="3.1.4" data-path="../05_read_storage/">
<li class="chapter " data-level="3.1.4" data-path="../04_unsubscribe/">
<a href="../04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.1.5" data-path="../05_read_storage/">
<a href="../05_read_storage/">
@@ -343,9 +356,9 @@
</li>
<li class="chapter " data-level="3.1.5" data-path="../07_transfer_dots/">
<li class="chapter " data-level="3.1.6" data-path="../06_make_transfer/">
<a href="../07_transfer_dots/">
<a href="../06_make_transfer/">
Make a transfer
@@ -356,7 +369,7 @@
</li>
<li class="chapter " data-level="3.1.6" data-path="../08_system_events/">
<li class="chapter " data-level="3.1.7" data-path="../08_system_events/">
<a href="../08_system_events/">
@@ -369,7 +382,7 @@
</li>
<li class="chapter active" data-level="3.1.7" data-path="./">
<li class="chapter active" data-level="3.1.8" data-path="./">
<a href="./">
@@ -382,7 +395,7 @@
</li>
<li class="chapter " data-level="3.1.8" data-path="../10_upgrade_chain/">
<li class="chapter " data-level="3.1.9" data-path="../10_upgrade_chain/">
<a href="../10_upgrade_chain/">
@@ -393,6 +406,142 @@
</li>
</ul>
</li>
<li class="chapter " data-level="3.2" data-path="../../rx/">
<a href="../../rx/">
ApiRx
</a>
<ul class="articles">
<li class="chapter " data-level="3.2.1" data-path="../../rx/01_simple_connect/">
<a href="../../rx/01_simple_connect/">
Simple connect
</a>
</li>
<li class="chapter " data-level="3.2.2" data-path="../../rx/02_listen_to_blocks/">
<a href="../../rx/02_listen_to_blocks/">
Listen to blocks
</a>
</li>
<li class="chapter " data-level="3.2.3" data-path="../../rx/03_listen_to_balance_change/">
<a href="../../rx/03_listen_to_balance_change/">
Listen to balance change
</a>
</li>
<li class="chapter " data-level="3.2.4" data-path="../../rx/04_unsubscribe/">
<a href="../../rx/04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.2.5" data-path="../../rx/05_read_storage/">
<a href="../../rx/05_read_storage/">
Read chain state
</a>
</li>
<li class="chapter " data-level="3.2.6" data-path="../../rx/06_make_transfer/">
<a href="../../rx/06_make_transfer/">
Make a transfer
</a>
</li>
<li class="chapter " data-level="3.2.7" data-path="../../rx/08_system_events/">
<a href="../../rx/08_system_events/">
Display system events
</a>
</li>
<li class="chapter " data-level="3.2.8" data-path="../../rx/09_transfer_events/">
<a href="../../rx/09_transfer_events/">
Transaction with events
</a>
</li>
<li class="chapter " data-level="3.2.9" data-path="../../rx/10_upgrade_chain/">
<a href="../../rx/10_upgrade_chain/">
Upgrade via sudo
</a>
</li>
@@ -2003,6 +2152,8 @@
<span class="sunlight-ident">async</span>&#xA0;<span class="sunlight-keyword">function</span>&#xA0;<span class="sunlight-named-ident">main</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;create&#xA0;an&#xA0;instance&#xA0;of&#xA0;our&#xA0;testign&#xA0;keyring</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;If&#xA0;you&apos;re&#xA0;using&#xA0;ES6&#xA0;module&#xA0;imports&#xA0;instead&#xA0;of&#xA0;require,&#xA0;just&#xA0;change&#xA0;this&#xA0;line&#xA0;to:</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;const&#xA0;keyring&#xA0;=&#xA0;testKeyring();</span>
&#xA0;&#xA0;<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">keyring</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">testKeyring</span><span class="sunlight-operator">.</span><span class="sunlight-keyword">default</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;Create&#xA0;the&#xA0;API&#xA0;and&#xA0;wait&#xA0;until&#xA0;ready</span>
@@ -2027,7 +2178,7 @@
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;Transaction&#xA0;status:&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">type</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-keyword">if</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-ident">type</span>&#xA0;<span class="sunlight-operator">===</span>&#xA0;<span class="sunlight-string">&apos;Finalised&apos;</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;Completed&#xA0;at&#xA0;block&#xA0;hash&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">status</span><span class="sunlight-operator">.</span><span class="sunlight-ident">value</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toHex</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;Completed&#xA0;at&#xA0;block&#xA0;hash&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">status</span><span class="sunlight-operator">.</span><span class="sunlight-ident">asFinalised</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toHex</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;Events:&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">events</span><span class="sunlight-operator">.</span><span class="sunlight-ident">forEach</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">phase</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">event</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">data</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">method</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">section</span>&#xA0;<span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
@@ -2084,7 +2235,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Transaction with events","level":"3.1.7","depth":2,"next":{"title":"Upgrade via sudo","level":"3.1.8","depth":2,"path":"examples/promise/10_upgrade_chain/README.md","ref":"examples/promise/10_upgrade_chain/README.md","articles":[]},"previous":{"title":"Display system events","level":"3.1.6","depth":2,"path":"examples/promise/08_system_events/README.md","ref":"examples/promise/08_system_events/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/09_transfer_events/README.md","mtime":"2019-01-17T16:15:44.325Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-17T16:19:54.997Z"},"basePath":"../../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Transaction with events","level":"3.1.8","depth":2,"next":{"title":"Upgrade via sudo","level":"3.1.9","depth":2,"path":"examples/promise/10_upgrade_chain/README.md","ref":"examples/promise/10_upgrade_chain/README.md","articles":[]},"previous":{"title":"Display system events","level":"3.1.7","depth":2,"path":"examples/promise/08_system_events/README.md","ref":"examples/promise/08_system_events/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/09_transfer_events/README.md","mtime":"2019-01-22T22:13:44.156Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-22T22:17:48.947Z"},"basePath":"../../..","book":{"language":""}});
});
</script>
</div>
+161 -16
View File
@@ -61,7 +61,7 @@
<link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="../../../types/classes/_accountid_.accountid.html" />
<link rel="next" href="../../rx/" />
<link rel="prev" href="../09_transfer_events/" />
@@ -330,7 +330,20 @@
</li>
<li class="chapter " data-level="3.1.4" data-path="../05_read_storage/">
<li class="chapter " data-level="3.1.4" data-path="../04_unsubscribe/">
<a href="../04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.1.5" data-path="../05_read_storage/">
<a href="../05_read_storage/">
@@ -343,9 +356,9 @@
</li>
<li class="chapter " data-level="3.1.5" data-path="../07_transfer_dots/">
<li class="chapter " data-level="3.1.6" data-path="../06_make_transfer/">
<a href="../07_transfer_dots/">
<a href="../06_make_transfer/">
Make a transfer
@@ -356,7 +369,7 @@
</li>
<li class="chapter " data-level="3.1.6" data-path="../08_system_events/">
<li class="chapter " data-level="3.1.7" data-path="../08_system_events/">
<a href="../08_system_events/">
@@ -369,7 +382,7 @@
</li>
<li class="chapter " data-level="3.1.7" data-path="../09_transfer_events/">
<li class="chapter " data-level="3.1.8" data-path="../09_transfer_events/">
<a href="../09_transfer_events/">
@@ -382,7 +395,7 @@
</li>
<li class="chapter active" data-level="3.1.8" data-path="./">
<li class="chapter active" data-level="3.1.9" data-path="./">
<a href="./">
@@ -393,6 +406,142 @@
</li>
</ul>
</li>
<li class="chapter " data-level="3.2" data-path="../../rx/">
<a href="../../rx/">
ApiRx
</a>
<ul class="articles">
<li class="chapter " data-level="3.2.1" data-path="../../rx/01_simple_connect/">
<a href="../../rx/01_simple_connect/">
Simple connect
</a>
</li>
<li class="chapter " data-level="3.2.2" data-path="../../rx/02_listen_to_blocks/">
<a href="../../rx/02_listen_to_blocks/">
Listen to blocks
</a>
</li>
<li class="chapter " data-level="3.2.3" data-path="../../rx/03_listen_to_balance_change/">
<a href="../../rx/03_listen_to_balance_change/">
Listen to balance change
</a>
</li>
<li class="chapter " data-level="3.2.4" data-path="../../rx/04_unsubscribe/">
<a href="../../rx/04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.2.5" data-path="../../rx/05_read_storage/">
<a href="../../rx/05_read_storage/">
Read chain state
</a>
</li>
<li class="chapter " data-level="3.2.6" data-path="../../rx/06_make_transfer/">
<a href="../../rx/06_make_transfer/">
Make a transfer
</a>
</li>
<li class="chapter " data-level="3.2.7" data-path="../../rx/08_system_events/">
<a href="../../rx/08_system_events/">
Display system events
</a>
</li>
<li class="chapter " data-level="3.2.8" data-path="../../rx/09_transfer_events/">
<a href="../../rx/09_transfer_events/">
Transaction with events
</a>
</li>
<li class="chapter " data-level="3.2.9" data-path="../../rx/10_upgrade_chain/">
<a href="../../rx/10_upgrade_chain/">
Upgrade via sudo
</a>
</li>
@@ -1995,9 +2144,6 @@
<span class="sunlight-comment">//&#xA0;import&#xA0;the&#xA0;test&#xA0;keyring&#xA0;(already&#xA0;has&#xA0;dev&#xA0;keys&#xA0;for&#xA0;Alice,&#xA0;Bob,&#xA0;Charlie,&#xA0;Eve&#xA0;&amp;&#xA0;Ferdie)</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">testKeyring</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;@polkadot/keyring/testing&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-comment">//&#xA0;utility&#xA0;functions</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">compactAddLength</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">hexToU8a</span>&#xA0;<span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;@polkadot/util&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">fs</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;fs&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-ident">async</span>&#xA0;<span class="sunlight-keyword">function</span>&#xA0;<span class="sunlight-named-ident">main</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-punctuation">{</span>
@@ -2028,14 +2174,13 @@
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;preform&#xA0;the&#xA0;actual&#xA0;chain&#xA0;upgrade&#xA0;via&#xA0;the&#xA0;sudo&#xA0;module</span>
&#xA0;&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">tx</span><span class="sunlight-operator">.</span><span class="sunlight-ident">sudo</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">sudo</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">proposal</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">sign</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">adminPair</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">adminNonce</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">send</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">events</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-punctuation">[</span><span class="sunlight-punctuation">]</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">status</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">type</span>&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;Transaction&#xA0;status:&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">type</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">signAndSend</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">adminPair</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">events</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-punctuation">[</span><span class="sunlight-punctuation">]</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">status</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">type</span>&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;Proposal&#xA0;status:&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">type</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-keyword">if</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-ident">type</span>&#xA0;<span class="sunlight-operator">===</span>&#xA0;<span class="sunlight-string">&apos;Finalised&apos;</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;You&#xA0;have&#xA0;just&#xA0;upgraded&#xA0;your&#xA0;chain&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;Completed&#xA0;at&#xA0;block&#xA0;hash&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">status</span><span class="sunlight-operator">.</span><span class="sunlight-ident">value</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toHex</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;Completed&#xA0;at&#xA0;block&#xA0;hash&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">status</span><span class="sunlight-operator">.</span><span class="sunlight-ident">asFinalised</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toHex</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;Events:&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">events</span><span class="sunlight-operator">.</span><span class="sunlight-ident">forEach</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">phase</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">event</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">data</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">method</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">section</span>&#xA0;<span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
@@ -2084,7 +2229,7 @@
</a>
<a href="../../../types/classes/_accountid_.accountid.html" class="navigation navigation-next " aria-label="Next page: hidden">
<a href="../../rx/" class="navigation navigation-next " aria-label="Next page: ApiRx">
<i class="fa fa-angle-right"></i>
</a>
@@ -2095,7 +2240,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Upgrade via sudo","level":"3.1.8","depth":2,"next":{"title":"hidden","level":"4.1","depth":1,"path":"types/classes/_accountid_.accountid.md","ref":"types/classes/_accountid_.accountid.md","articles":[]},"previous":{"title":"Transaction with events","level":"3.1.7","depth":2,"path":"examples/promise/09_transfer_events/README.md","ref":"examples/promise/09_transfer_events/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/10_upgrade_chain/README.md","mtime":"2019-01-17T16:15:44.325Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-17T16:19:54.997Z"},"basePath":"../../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Upgrade via sudo","level":"3.1.9","depth":2,"next":{"title":"ApiRx","level":"3.2","depth":1,"path":"examples/rx/README.md","ref":"examples/rx/README.md","articles":[{"title":"Simple connect","level":"3.2.1","depth":2,"path":"examples/rx/01_simple_connect/README.md","ref":"examples/rx/01_simple_connect/README.md","articles":[]},{"title":"Listen to blocks","level":"3.2.2","depth":2,"path":"examples/rx/02_listen_to_blocks/README.md","ref":"examples/rx/02_listen_to_blocks/README.md","articles":[]},{"title":"Listen to balance change","level":"3.2.3","depth":2,"path":"examples/rx/03_listen_to_balance_change/README.md","ref":"examples/rx/03_listen_to_balance_change/README.md","articles":[]},{"title":"Unsubscribe from listening","level":"3.2.4","depth":2,"path":"examples/rx/04_unsubscribe/README.md","ref":"examples/rx/04_unsubscribe/README.md","articles":[]},{"title":"Read chain state","level":"3.2.5","depth":2,"path":"examples/rx/05_read_storage/README.md","ref":"examples/rx/05_read_storage/README.md","articles":[]},{"title":"Make a transfer","level":"3.2.6","depth":2,"path":"examples/rx/06_make_transfer/README.md","ref":"examples/rx/06_make_transfer/README.md","articles":[]},{"title":"Display system events","level":"3.2.7","depth":2,"path":"examples/rx/08_system_events/README.md","ref":"examples/rx/08_system_events/README.md","articles":[]},{"title":"Transaction with events","level":"3.2.8","depth":2,"path":"examples/rx/09_transfer_events/README.md","ref":"examples/rx/09_transfer_events/README.md","articles":[]},{"title":"Upgrade via sudo","level":"3.2.9","depth":2,"path":"examples/rx/10_upgrade_chain/README.md","ref":"examples/rx/10_upgrade_chain/README.md","articles":[]}]},"previous":{"title":"Transaction with events","level":"3.1.8","depth":2,"path":"examples/promise/09_transfer_events/README.md","ref":"examples/promise/09_transfer_events/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/10_upgrade_chain/README.md","mtime":"2019-01-22T22:13:44.156Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-22T22:17:48.947Z"},"basePath":"../../..","book":{"language":""}});
});
</script>
</div>
+156 -7
View File
@@ -330,7 +330,20 @@
</li>
<li class="chapter " data-level="3.1.4" data-path="05_read_storage/">
<li class="chapter " data-level="3.1.4" data-path="04_unsubscribe/">
<a href="04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.1.5" data-path="05_read_storage/">
<a href="05_read_storage/">
@@ -343,9 +356,9 @@
</li>
<li class="chapter " data-level="3.1.5" data-path="07_transfer_dots/">
<li class="chapter " data-level="3.1.6" data-path="06_make_transfer/">
<a href="07_transfer_dots/">
<a href="06_make_transfer/">
Make a transfer
@@ -356,7 +369,7 @@
</li>
<li class="chapter " data-level="3.1.6" data-path="08_system_events/">
<li class="chapter " data-level="3.1.7" data-path="08_system_events/">
<a href="08_system_events/">
@@ -369,7 +382,7 @@
</li>
<li class="chapter " data-level="3.1.7" data-path="09_transfer_events/">
<li class="chapter " data-level="3.1.8" data-path="09_transfer_events/">
<a href="09_transfer_events/">
@@ -382,7 +395,7 @@
</li>
<li class="chapter " data-level="3.1.8" data-path="10_upgrade_chain/">
<li class="chapter " data-level="3.1.9" data-path="10_upgrade_chain/">
<a href="10_upgrade_chain/">
@@ -393,6 +406,142 @@
</li>
</ul>
</li>
<li class="chapter " data-level="3.2" data-path="../rx/">
<a href="../rx/">
ApiRx
</a>
<ul class="articles">
<li class="chapter " data-level="3.2.1" data-path="../rx/01_simple_connect/">
<a href="../rx/01_simple_connect/">
Simple connect
</a>
</li>
<li class="chapter " data-level="3.2.2" data-path="../rx/02_listen_to_blocks/">
<a href="../rx/02_listen_to_blocks/">
Listen to blocks
</a>
</li>
<li class="chapter " data-level="3.2.3" data-path="../rx/03_listen_to_balance_change/">
<a href="../rx/03_listen_to_balance_change/">
Listen to balance change
</a>
</li>
<li class="chapter " data-level="3.2.4" data-path="../rx/04_unsubscribe/">
<a href="../rx/04_unsubscribe/">
Unsubscribe from listening
</a>
</li>
<li class="chapter " data-level="3.2.5" data-path="../rx/05_read_storage/">
<a href="../rx/05_read_storage/">
Read chain state
</a>
</li>
<li class="chapter " data-level="3.2.6" data-path="../rx/06_make_transfer/">
<a href="../rx/06_make_transfer/">
Make a transfer
</a>
</li>
<li class="chapter " data-level="3.2.7" data-path="../rx/08_system_events/">
<a href="../rx/08_system_events/">
Display system events
</a>
</li>
<li class="chapter " data-level="3.2.8" data-path="../rx/09_transfer_events/">
<a href="../rx/09_transfer_events/">
Transaction with events
</a>
</li>
<li class="chapter " data-level="3.2.9" data-path="../rx/10_upgrade_chain/">
<a href="../rx/10_upgrade_chain/">
Upgrade via sudo
</a>
</li>
@@ -2044,7 +2193,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"ApiPromise","level":"3.1","depth":1,"next":{"title":"Simple connect","level":"3.1.1","depth":2,"path":"examples/promise/01_simple_connect/README.md","ref":"examples/promise/01_simple_connect/README.md","articles":[]},"previous":{"title":"Events (runtime)","level":"2.4","depth":1,"path":"METHODS_EVENTS.md","ref":"METHODS_EVENTS.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/README.md","mtime":"2019-01-17T16:15:44.329Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-17T16:19:54.997Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"ApiPromise","level":"3.1","depth":1,"next":{"title":"Simple connect","level":"3.1.1","depth":2,"path":"examples/promise/01_simple_connect/README.md","ref":"examples/promise/01_simple_connect/README.md","articles":[]},"previous":{"title":"Events (runtime)","level":"2.4","depth":1,"path":"METHODS_EVENTS.md","ref":"METHODS_EVENTS.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"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},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":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/promise/README.md","mtime":"2019-01-22T22:13:44.160Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-22T22:17:48.947Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff