[CI Skip] 0.31.20
This commit is contained in:
@@ -249,9 +249,9 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.3" data-path="../../deprecated-rpc/03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.1.3" data-path="../03_listen_to_balance_change/">
|
||||
|
||||
<a href="../../deprecated-rpc/03_listen_to_balance_change/">
|
||||
<a href="../03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
@@ -262,12 +262,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.4" data-path="../../deprecated-rpc/04_generate_account/">
|
||||
<li class="chapter " data-level="2.1.4" data-path="../05_read_storage/">
|
||||
|
||||
<a href="../../deprecated-rpc/04_generate_account/">
|
||||
<a href="../05_read_storage/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
Read chain state
|
||||
|
||||
</a>
|
||||
|
||||
@@ -275,38 +275,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.5" data-path="../../deprecated-rpc/05_read_storage/">
|
||||
<li class="chapter " data-level="2.1.5" data-path="../07_transfer_dots/">
|
||||
|
||||
<a href="../../deprecated-rpc/05_read_storage/">
|
||||
<a href="../07_transfer_dots/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.6" data-path="../../deprecated-rpc/06_craft_extrinsic/">
|
||||
|
||||
<a href="../../deprecated-rpc/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.7" data-path="../../deprecated-rpc/07_transfer_dots/">
|
||||
|
||||
<a href="../../deprecated-rpc/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
Make a transfer
|
||||
|
||||
</a>
|
||||
|
||||
@@ -377,10 +351,14 @@
|
||||
  <span class="sunlight-comment">// create the API and wait until ready</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">api</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">ApiPromise</span><span class="sunlight-operator">.</span><span class="sunlight-ident">create</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">provider</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// retrieve the chain information (rpc call)</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">chain</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <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">system</span><span class="sunlight-operator">.</span><span class="sunlight-ident">chain</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
  <span class="sunlight-comment">// retrieve the chain & node information information via rpc calls</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-punctuation">[</span><span class="sunlight-ident">chain</span><span class="sunlight-punctuation">,</span> <span class="sunlight-ident">nodeName</span><span class="sunlight-punctuation">,</span> <span class="sunlight-ident">nodeVersion</span><span class="sunlight-punctuation">]</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">Promise</span><span class="sunlight-operator">.</span><span class="sunlight-ident">all</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">[</span>
|
||||
    <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">system</span><span class="sunlight-operator">.</span><span class="sunlight-ident">chain</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">,</span>
|
||||
    <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">system</span><span class="sunlight-operator">.</span><span class="sunlight-ident">name</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">,</span>
|
||||
    <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">system</span><span class="sunlight-operator">.</span><span class="sunlight-ident">version</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">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> <span class="sunlight-ident">are</span> <span class="sunlight-ident">connected</span> <span class="sunlight-ident">to</span> <span class="sunlight-ident">chain</span><span class="sunlight-operator">:</span> <span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">chain</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">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> <span class="sunlight-ident">are</span> <span class="sunlight-ident">connected</span> <span class="sunlight-ident">to</span> <span class="sunlight-ident">chain</span> <span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">chain</span><span class="sunlight-punctuation">}</span> <span class="sunlight-ident">using</span> <span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">nodeName</span><span class="sunlight-punctuation">}</span> <span class="sunlight-ident">v$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">nodeVersion</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-operator">.</span><span class="sunlight-keyword">finally</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span> <span class="sunlight-operator">=</span><span class="sunlight-operator">></span> <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>
|
||||
@@ -428,7 +406,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Simple connect","level":"2.1.1","depth":2,"next":{"title":"Listen to blocks","level":"2.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":"2.1","depth":1,"path":"examples/promise/README.md","ref":"examples/promise/README.md","articles":[{"title":"Simple connect","level":"2.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":"2.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":"2.1.3","depth":2,"path":"examples/deprecated-rpc/03_listen_to_balance_change/README.md","ref":"examples/deprecated-rpc/03_listen_to_balance_change/README.md","articles":[]},{"title":"Generate Accounts","level":"2.1.4","depth":2,"path":"examples/deprecated-rpc/04_generate_account/README.md","ref":"examples/deprecated-rpc/04_generate_account/README.md","articles":[]},{"title":"Read Storage","level":"2.1.5","depth":2,"path":"examples/deprecated-rpc/05_read_storage/README.md","ref":"examples/deprecated-rpc/05_read_storage/README.md","articles":[]},{"title":"Craft Extrinsic","level":"2.1.6","depth":2,"path":"examples/deprecated-rpc/06_craft_extrinsic/README.md","ref":"examples/deprecated-rpc/06_craft_extrinsic/README.md","articles":[]},{"title":"Transfer DOTs","level":"2.1.7","depth":2,"path":"examples/deprecated-rpc/07_transfer_dots/README.md","ref":"examples/deprecated-rpc/07_transfer_dots/README.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"sunlight-highlighter":{"theme":"gitbook","lineNumbers":false},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"mermaid-gb3":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/promise/01_simple_connect/README.md","mtime":"2018-10-12T12:48:26.267Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-12T12:51:56.287Z"},"basePath":"../../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Simple connect","level":"2.1.1","depth":2,"next":{"title":"Listen to blocks","level":"2.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":"2.1","depth":1,"path":"examples/promise/README.md","ref":"examples/promise/README.md","articles":[{"title":"Simple connect","level":"2.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":"2.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":"2.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":"2.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":"2.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","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"sunlight-highlighter":{"theme":"gitbook","lineNumbers":false},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"mermaid-gb3":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/promise/01_simple_connect/README.md","mtime":"2018-10-12T12:53:32.464Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-12T12:57:01.121Z"},"basePath":"../../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../../deprecated-rpc/03_listen_to_balance_change/" />
|
||||
<link rel="next" href="../03_listen_to_balance_change/" />
|
||||
|
||||
|
||||
<link rel="prev" href="../01_simple_connect/" />
|
||||
@@ -249,9 +249,9 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.3" data-path="../../deprecated-rpc/03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.1.3" data-path="../03_listen_to_balance_change/">
|
||||
|
||||
<a href="../../deprecated-rpc/03_listen_to_balance_change/">
|
||||
<a href="../03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
@@ -262,12 +262,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.4" data-path="../../deprecated-rpc/04_generate_account/">
|
||||
<li class="chapter " data-level="2.1.4" data-path="../05_read_storage/">
|
||||
|
||||
<a href="../../deprecated-rpc/04_generate_account/">
|
||||
<a href="../05_read_storage/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
Read chain state
|
||||
|
||||
</a>
|
||||
|
||||
@@ -275,38 +275,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.5" data-path="../../deprecated-rpc/05_read_storage/">
|
||||
<li class="chapter " data-level="2.1.5" data-path="../07_transfer_dots/">
|
||||
|
||||
<a href="../../deprecated-rpc/05_read_storage/">
|
||||
<a href="../07_transfer_dots/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.6" data-path="../../deprecated-rpc/06_craft_extrinsic/">
|
||||
|
||||
<a href="../../deprecated-rpc/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.7" data-path="../../deprecated-rpc/07_transfer_dots/">
|
||||
|
||||
<a href="../../deprecated-rpc/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
Make a transfer
|
||||
|
||||
</a>
|
||||
|
||||
@@ -375,13 +349,13 @@
|
||||
  <span class="sunlight-comment">// Here we don't pass the (optional) provider, connecting directly to the default</span>
|
||||
  <span class="sunlight-comment">// node/port, i.e. `ws://127.0.0.1:9944`. Await for the isReady promise to ensure</span>
|
||||
  <span class="sunlight-comment">// the API has connected to the node and completed the initialisation process</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">api</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-keyword">new</span> <span class="sunlight-ident">ApiPromise</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-ident">isReady</span><span class="sunlight-punctuation">;</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">api</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">ApiPromise</span><span class="sunlight-operator">.</span><span class="sunlight-ident">create</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// Subscribe to the new headers on-chain. The callback is fired when new headers</span>
|
||||
  <span class="sunlight-comment">// are found, the call itself returns a promise with a subscription that can be</span>
|
||||
  <span class="sunlight-comment">// used to unsubscribe from the newHead subscription</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">subsciptionId</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <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">newHead</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">header</span><span class="sunlight-punctuation">)</span> <span class="sunlight-operator">=</span><span class="sunlight-operator">></span> <span class="sunlight-punctuation">{</span>
|
||||
    <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> <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-operator">.</span><span class="sunlight-ident">toString</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-punctuation">;</span>
|
||||
    <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> <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>
|
||||
  <span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// id for the subscription, we can cleanup and unsubscribe via</span>
|
||||
@@ -423,7 +397,7 @@
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../../deprecated-rpc/03_listen_to_balance_change/" class="navigation navigation-next " aria-label="Next page: Listen to balance change">
|
||||
<a href="../03_listen_to_balance_change/" class="navigation navigation-next " aria-label="Next page: Listen to balance change">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
@@ -434,7 +408,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Listen to blocks","level":"2.1.2","depth":2,"next":{"title":"Listen to balance change","level":"2.1.3","depth":2,"path":"examples/deprecated-rpc/03_listen_to_balance_change/README.md","ref":"examples/deprecated-rpc/03_listen_to_balance_change/README.md","articles":[]},"previous":{"title":"Simple connect","level":"2.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","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"sunlight-highlighter":{"theme":"gitbook","lineNumbers":false},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"mermaid-gb3":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/promise/02_listen_to_blocks/README.md","mtime":"2018-10-12T12:48:26.267Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-12T12:51:56.287Z"},"basePath":"../../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Listen to blocks","level":"2.1.2","depth":2,"next":{"title":"Listen to balance change","level":"2.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":"2.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","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"sunlight-highlighter":{"theme":"gitbook","lineNumbers":false},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"mermaid-gb3":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/promise/02_listen_to_blocks/README.md","mtime":"2018-10-12T12:53:32.464Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-12T12:57:01.121Z"},"basePath":"../../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,465 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Listen to balance change · Polkadot API Book</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-sunlight-highlighter/sunlight.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../05_read_storage/" />
|
||||
|
||||
|
||||
<link rel="prev" href="../02_listen_to_blocks/" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../../../">
|
||||
|
||||
<a href="../../../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../../../api/">
|
||||
|
||||
<a href="../../../api/">
|
||||
|
||||
|
||||
api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../../api/classes/_promise_index_.apipromise.html">
|
||||
|
||||
<a href="../../../api/classes/_promise_index_.apipromise.html">
|
||||
|
||||
|
||||
ApiPromise
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../../../api/classes/_rx_index_.apirx.html">
|
||||
|
||||
<a href="../../../api/classes/_rx_index_.apirx.html">
|
||||
|
||||
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../../rpc-provider/">
|
||||
|
||||
<a href="../../../rpc-provider/">
|
||||
|
||||
|
||||
rpc-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../../rpc-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../../rpc-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../../rpc-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../../rpc-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
ApiPromise
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1.1" data-path="../01_simple_connect/">
|
||||
|
||||
<a href="../01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.2" data-path="../02_listen_to_blocks/">
|
||||
|
||||
<a href="../02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="2.1.3" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.4" data-path="../05_read_storage/">
|
||||
|
||||
<a href="../05_read_storage/">
|
||||
|
||||
|
||||
Read chain state
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.5" data-path="../07_transfer_dots/">
|
||||
|
||||
<a href="../07_transfer_dots/">
|
||||
|
||||
|
||||
Make a transfer
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="../../.." >Listen to balance change</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<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">// import the Api</span>
|
||||
<span class="sunlight-reservedWord">const</span> <span class="sunlight-punctuation">{</span> <span class="sunlight-ident">ApiPromise</span> <span class="sunlight-punctuation">}</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">'@polkadot/api'</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
<span class="sunlight-comment">// the known account we want to use (available on dev chain, with funds)</span>
|
||||
<span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">Alice</span> <span class="sunlight-operator">=</span> <span class="sunlight-string">'5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
<span class="sunlight-ident">async</span> <span class="sunlight-keyword">function</span> <span class="sunlight-named-ident">main</span> <span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span> <span class="sunlight-punctuation">{</span>
|
||||
  <span class="sunlight-comment">// Create an wait for the API</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">api</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">ApiPromise</span><span class="sunlight-operator">.</span><span class="sunlight-ident">create</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// Retrieve the initial balance. Since the call has no callback, it is simply a promise</span>
|
||||
  <span class="sunlight-comment">// the resolves to the current on-chain value</span>
|
||||
  <span class="sunlight-ident">let</span> <span class="sunlight-ident">previous</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">st</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>
|
||||
|
||||
  <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> <span class="sunlight-ident">has</span> <span class="sunlight-ident">an</span> <span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">previous</span><span class="sunlight-punctuation">}</span> <span class="sunlight-ident">balance</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
  <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> <span class="sunlight-ident">may</span> <span class="sunlight-ident">leave</span> <span class="sunlight-keyword">this</span> <span class="sunlight-ident">example</span> <span class="sunlight-ident">running</span> <span class="sunlight-ident">and</span> <span class="sunlight-ident">start</span> <span class="sunlight-ident">example</span> <span class="sunlight-number">06</span> <span class="sunlight-ident">or</span> <span class="sunlight-ident">transfer</span> <span class="sunlight-ident">any</span> <span class="sunlight-ident">value</span> <span class="sunlight-ident">to</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><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// Here we subscribe to any balance changes and updates the on-screen value</span>
|
||||
  <span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">st</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><span class="sunlight-ident">current</span><span class="sunlight-punctuation">)</span> <span class="sunlight-operator">=</span><span class="sunlight-operator">></span> <span class="sunlight-punctuation">{</span>
|
||||
    <span class="sunlight-comment">// Calculate the delta</span>
|
||||
    <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">change</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">current</span><span class="sunlight-operator">.</span><span class="sunlight-ident">sub</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-comment">// Only display positive value changes (Since we are pulling previous above already,</span>
|
||||
    <span class="sunlight-comment">// the intiial balance change will also be zero)</span>
|
||||
    <span class="sunlight-keyword">if</span> <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> <span class="sunlight-punctuation">{</span>
|
||||
      <span class="sunlight-keyword">return</span><span class="sunlight-punctuation">;</span>
|
||||
    <span class="sunlight-punctuation">}</span>
|
||||
|
||||
    <span class="sunlight-ident">previous</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">current</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
    <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> <span class="sunlight-ident">of</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-operator">:</span> <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> <span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">change</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><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>
|
||||
</span></pre></div></div></code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../02_listen_to_blocks/" class="navigation navigation-prev " aria-label="Previous page: Listen to blocks">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../05_read_storage/" class="navigation navigation-next " aria-label="Next page: Read chain state">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Listen to balance change","level":"2.1.3","depth":2,"next":{"title":"Read chain state","level":"2.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":"2.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","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"sunlight-highlighter":{"theme":"gitbook","lineNumbers":false},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"mermaid-gb3":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/promise/03_listen_to_balance_change/README.md","mtime":"2018-10-12T12:53:32.464Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-12T12:57:01.121Z"},"basePath":"../../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook.js"></script>
|
||||
<script src="../../../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,464 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Read chain state · Polkadot API Book</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-sunlight-highlighter/sunlight.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../07_transfer_dots/" />
|
||||
|
||||
|
||||
<link rel="prev" href="../03_listen_to_balance_change/" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../../../">
|
||||
|
||||
<a href="../../../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../../../api/">
|
||||
|
||||
<a href="../../../api/">
|
||||
|
||||
|
||||
api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../../api/classes/_promise_index_.apipromise.html">
|
||||
|
||||
<a href="../../../api/classes/_promise_index_.apipromise.html">
|
||||
|
||||
|
||||
ApiPromise
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../../../api/classes/_rx_index_.apirx.html">
|
||||
|
||||
<a href="../../../api/classes/_rx_index_.apirx.html">
|
||||
|
||||
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../../rpc-provider/">
|
||||
|
||||
<a href="../../../rpc-provider/">
|
||||
|
||||
|
||||
rpc-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../../rpc-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../../rpc-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../../rpc-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../../rpc-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
ApiPromise
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1.1" data-path="../01_simple_connect/">
|
||||
|
||||
<a href="../01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.2" data-path="../02_listen_to_blocks/">
|
||||
|
||||
<a href="../02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.3" data-path="../03_listen_to_balance_change/">
|
||||
|
||||
<a href="../03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="2.1.4" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Read chain state
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.5" data-path="../07_transfer_dots/">
|
||||
|
||||
<a href="../07_transfer_dots/">
|
||||
|
||||
|
||||
Make a transfer
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="../../.." >Read chain state</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="read-storage">Read storage</h1>
|
||||
<p>Many important variables are available through the storage API. This example shows how to call a few of those APIs.</p>
|
||||
<pre><code class="lang-javascript"><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">// Import the ApiPromise</span>
|
||||
<span class="sunlight-reservedWord">const</span> <span class="sunlight-punctuation">{</span> <span class="sunlight-ident">ApiPromise</span> <span class="sunlight-punctuation">}</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">'@polkadot/api'</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
<span class="sunlight-comment">// Our address for Alice on the dev chain</span>
|
||||
<span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">Alice</span> <span class="sunlight-operator">=</span> <span class="sunlight-string">'5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
<span class="sunlight-ident">async</span> <span class="sunlight-keyword">function</span> <span class="sunlight-named-ident">main</span> <span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span> <span class="sunlight-punctuation">{</span>
|
||||
  <span class="sunlight-comment">// Create out API with a default connection to the local node</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">api</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">ApiPromise</span><span class="sunlight-operator">.</span><span class="sunlight-ident">create</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// Make our basic chain state/storage queries, all in one go</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-punctuation">[</span><span class="sunlight-ident">accountNonce</span><span class="sunlight-punctuation">,</span> <span class="sunlight-ident">blockPeriod</span><span class="sunlight-punctuation">,</span> <span class="sunlight-ident">validators</span><span class="sunlight-punctuation">]</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">Promise</span><span class="sunlight-operator">.</span><span class="sunlight-ident">all</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">[</span>
|
||||
    <span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">st</span><span class="sunlight-operator">.</span><span class="sunlight-ident">system</span><span class="sunlight-operator">.</span><span class="sunlight-ident">accountNonce</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-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">st</span><span class="sunlight-operator">.</span><span class="sunlight-ident">timestamp</span><span class="sunlight-operator">.</span><span class="sunlight-ident">blockPeriod</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">,</span>
|
||||
    <span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">st</span><span class="sunlight-operator">.</span><span class="sunlight-ident">session</span><span class="sunlight-operator">.</span><span class="sunlight-ident">validators</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">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> <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>
|
||||
  <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> <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> <span class="sunlight-ident">seconds</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// get the balances for all validators</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">validatorBalances</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">Promise</span><span class="sunlight-operator">.</span><span class="sunlight-ident">all</span><span class="sunlight-punctuation">(</span>
|
||||
    <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> <span class="sunlight-operator">=</span><span class="sunlight-operator">></span>
|
||||
      <span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">st</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>
|
||||
    <span class="sunlight-punctuation">)</span>
|
||||
  <span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <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">'validators'</span><span class="sunlight-punctuation">,</span> <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> <span class="sunlight-ident">index</span><span class="sunlight-punctuation">)</span> <span class="sunlight-operator">=</span><span class="sunlight-operator">></span> <span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">{</span>
|
||||
    <span class="sunlight-ident">address</span><span class="sunlight-operator">:</span> <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>
|
||||
    <span class="sunlight-ident">balance</span><span class="sunlight-operator">:</span> <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>
|
||||
  <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-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> <span class="sunlight-operator">=</span><span class="sunlight-operator">></span> <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>
|
||||
</span></pre></div></div></code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../03_listen_to_balance_change/" class="navigation navigation-prev " aria-label="Previous page: Listen to balance change">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../07_transfer_dots/" class="navigation navigation-next " aria-label="Next page: Make a transfer">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Read chain state","level":"2.1.4","depth":2,"next":{"title":"Make a transfer","level":"2.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":"2.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","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"sunlight-highlighter":{"theme":"gitbook","lineNumbers":false},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"mermaid-gb3":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/promise/05_read_storage/README.md","mtime":"2018-10-12T12:53:32.464Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-12T12:57:01.121Z"},"basePath":"../../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook.js"></script>
|
||||
<script src="../../../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,460 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Make a transfer · Polkadot API Book</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-sunlight-highlighter/sunlight.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
|
||||
<link rel="prev" href="../05_read_storage/" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../../../">
|
||||
|
||||
<a href="../../../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../../../api/">
|
||||
|
||||
<a href="../../../api/">
|
||||
|
||||
|
||||
api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../../api/classes/_promise_index_.apipromise.html">
|
||||
|
||||
<a href="../../../api/classes/_promise_index_.apipromise.html">
|
||||
|
||||
|
||||
ApiPromise
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2.2" data-path="../../../api/classes/_rx_index_.apirx.html">
|
||||
|
||||
<a href="../../../api/classes/_rx_index_.apirx.html">
|
||||
|
||||
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../../rpc-provider/">
|
||||
|
||||
<a href="../../../rpc-provider/">
|
||||
|
||||
|
||||
rpc-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../../rpc-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../../rpc-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../../rpc-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../../rpc-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
ApiPromise
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1.1" data-path="../01_simple_connect/">
|
||||
|
||||
<a href="../01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.2" data-path="../02_listen_to_blocks/">
|
||||
|
||||
<a href="../02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.3" data-path="../03_listen_to_balance_change/">
|
||||
|
||||
<a href="../03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.4" data-path="../05_read_storage/">
|
||||
|
||||
<a href="../05_read_storage/">
|
||||
|
||||
|
||||
Read chain state
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="2.1.5" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Make a transfer
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="../../.." >Make a transfer</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="tranfer-dots">Tranfer DOTs</h1>
|
||||
<p>This sample shows how to create a transaction to make a transfer from one an account to another.</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">// Import our API, Keyring and some utility functions</span>
|
||||
<span class="sunlight-reservedWord">const</span> <span class="sunlight-punctuation">{</span> <span class="sunlight-ident">ApiPromise</span> <span class="sunlight-punctuation">}</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">'@polkadot/api'</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
<span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">Keyring</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">'@polkadot/util-keyring'</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-keyword">default</span><span class="sunlight-punctuation">;</span>
|
||||
<span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">u8aFromUtf8</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">require</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">'@polkadot/util/u8a/fromUtf8'</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-keyword">default</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
<span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">ALICE_SEED</span> <span class="sunlight-operator">=</span> <span class="sunlight-string">'Alice'</span><span class="sunlight-operator">.</span><span class="sunlight-ident">padEnd</span><span class="sunlight-punctuation">(</span><span class="sunlight-number">32</span><span class="sunlight-punctuation">,</span> <span class="sunlight-string">' '</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
<span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">BOB_ADDR</span> <span class="sunlight-operator">=</span> <span class="sunlight-string">'5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE'</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
<span class="sunlight-ident">async</span> <span class="sunlight-keyword">function</span> <span class="sunlight-named-ident">main</span> <span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span> <span class="sunlight-punctuation">{</span>
|
||||
  <span class="sunlight-comment">// create an instance of the keyring</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">keyring</span> <span class="sunlight-operator">=</span> <span class="sunlight-keyword">new</span> <span class="sunlight-ident">Keyring</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// Add Alice to our keyring (with the known seed for the account)</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">alice</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">keyring</span><span class="sunlight-operator">.</span><span class="sunlight-ident">addFromSeed</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">u8aFromUtf8</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">ALICE_SEED</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// instantiate the API</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">api</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">ApiPromise</span><span class="sunlight-operator">.</span><span class="sunlight-ident">create</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// retrieve the nonce for Alice, used to sign the transaction</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">aliceNonce</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">st</span><span class="sunlight-operator">.</span><span class="sunlight-ident">system</span><span class="sunlight-operator">.</span><span class="sunlight-ident">accountNonce</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">alice</span><span class="sunlight-operator">.</span><span class="sunlight-ident">address</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// Create a extrinsic, transferring 12345 units to Bob. We can also create,</span>
|
||||
  <span class="sunlight-comment">// sign and send in one operation (as per the samples in the Api documentation),</span>
|
||||
  <span class="sunlight-comment">// here we split it out for the sake of readability</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">transfer</span> <span class="sunlight-operator">=</span> <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">balances</span><span class="sunlight-operator">.</span><span class="sunlight-ident">transfer</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">BOB_ADDR</span><span class="sunlight-punctuation">,</span> <span class="sunlight-number">12345</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// sign the transaction using our account</span>
|
||||
  <span class="sunlight-ident">transfer</span><span class="sunlight-operator">.</span><span class="sunlight-ident">sign</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">alice</span><span class="sunlight-punctuation">,</span> <span class="sunlight-ident">aliceNonce</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
|
||||
|
||||
  <span class="sunlight-comment">// send the transaction and retrieve the resulting Hash</span>
|
||||
  <span class="sunlight-reservedWord">const</span> <span class="sunlight-ident">hash</span> <span class="sunlight-operator">=</span> <span class="sunlight-ident">await</span> <span class="sunlight-ident">transfer</span><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>
|
||||
|
||||
  <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">transfer</span> <span class="sunlight-number">12345</span> <span class="sunlight-ident">to</span> <span class="sunlight-ident">Bob</span> <span class="sunlight-keyword">with</span> <span class="sunlight-ident">hash</span> <span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">hash</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-operator">.</span><span class="sunlight-keyword">finally</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">_</span> <span class="sunlight-operator">=</span><span class="sunlight-operator">></span> <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>
|
||||
</span></pre></div></div></code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="../05_read_storage/" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Read chain state">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Make a transfer","level":"2.1.5","depth":2,"previous":{"title":"Read chain state","level":"2.1.4","depth":2,"path":"examples/promise/05_read_storage/README.md","ref":"examples/promise/05_read_storage/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"sunlight-highlighter":{"theme":"gitbook","lineNumbers":false},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"mermaid-gb3":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/promise/07_transfer_dots/README.md","mtime":"2018-10-12T12:53:32.464Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-12T12:57:01.121Z"},"basePath":"../../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook.js"></script>
|
||||
<script src="../../../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -249,9 +249,9 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.3" data-path="../deprecated-rpc/03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.1.3" data-path="03_listen_to_balance_change/">
|
||||
|
||||
<a href="../deprecated-rpc/03_listen_to_balance_change/">
|
||||
<a href="03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
@@ -262,12 +262,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.4" data-path="../deprecated-rpc/04_generate_account/">
|
||||
<li class="chapter " data-level="2.1.4" data-path="05_read_storage/">
|
||||
|
||||
<a href="../deprecated-rpc/04_generate_account/">
|
||||
<a href="05_read_storage/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
Read chain state
|
||||
|
||||
</a>
|
||||
|
||||
@@ -275,38 +275,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.5" data-path="../deprecated-rpc/05_read_storage/">
|
||||
<li class="chapter " data-level="2.1.5" data-path="07_transfer_dots/">
|
||||
|
||||
<a href="../deprecated-rpc/05_read_storage/">
|
||||
<a href="07_transfer_dots/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.6" data-path="../deprecated-rpc/06_craft_extrinsic/">
|
||||
|
||||
<a href="../deprecated-rpc/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.1.7" data-path="../deprecated-rpc/07_transfer_dots/">
|
||||
|
||||
<a href="../deprecated-rpc/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
Make a transfer
|
||||
|
||||
</a>
|
||||
|
||||
@@ -422,7 +396,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"ApiPromise","level":"2.1","depth":1,"next":{"title":"Simple connect","level":"2.1.1","depth":2,"path":"examples/promise/01_simple_connect/README.md","ref":"examples/promise/01_simple_connect/README.md","articles":[]},"previous":{"title":"WsProvider","level":"1.3.2","depth":2,"path":"rpc-provider/classes/_ws_index_.wsprovider.md","ref":"rpc-provider/classes/_ws_index_.wsprovider.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"sunlight-highlighter":{"theme":"gitbook","lineNumbers":false},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"mermaid-gb3":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/promise/README.md","mtime":"2018-10-12T12:48:26.267Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-12T12:51:56.287Z"},"basePath":"../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"ApiPromise","level":"2.1","depth":1,"next":{"title":"Simple connect","level":"2.1.1","depth":2,"path":"examples/promise/01_simple_connect/README.md","ref":"examples/promise/01_simple_connect/README.md","articles":[]},"previous":{"title":"WsProvider","level":"1.3.2","depth":2,"path":"rpc-provider/classes/_ws_index_.wsprovider.md","ref":"rpc-provider/classes/_ws_index_.wsprovider.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"sunlight-highlighter":{"theme":"gitbook","lineNumbers":false},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"mermaid-gb3":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/promise/README.md","mtime":"2018-10-12T12:53:32.464Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-12T12:57:01.121Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user