[CI Skip] 0.31.3

This commit is contained in:
Travis CI
2018-10-10 18:15:38 +00:00
parent 267411d778
commit c30c66e2de
179 changed files with 2171 additions and 2156 deletions
+15 -10
View File
@@ -1,8 +1,8 @@
[![polkadotjs](https://img.shields.io/badge/polkadot-js-orange.svg?style=flat-square)](https://polkadot.js.org) ![isc](https://img.shields.io/badge/license-ISC-lightgrey.svg?style=flat-square) [![style](https://img.shields.io/badge/code%20style-semistandard-lightgrey.svg?style=flat-square)](https://github.com/Flet/semistandard) [![npm](https://img.shields.io/npm/v/@polkadot/api.svg?style=flat-square)](https://www.npmjs.com/package/@polkadot/api) [![travis](https://img.shields.io/travis/polkadot-js/api.svg?style=flat-square)](https://travis-ci.org/polkadot-js/api) [![maintainability](https://img.shields.io/codeclimate/maintainability/polkadot-js/api.svg?style=flat-square)](https://codeclimate.com/github/polkadot-js/api/maintainability) [![coverage](https://img.shields.io/coveralls/polkadot-js/api.svg?style=flat-square)](https://coveralls.io/github/polkadot-js/api?branch=master) [![dependency](https://david-dm.org/polkadot-js/api.svg?style=flat-square&path=package/rpc-core)](https://david-dm.org/polkadot-js/api?path=package/rpc-core) [![devDependency](https://david-dm.org/polkadot-js/api/dev-status.svg?style=flat-square&path=package/rpc-core)](https://david-dm.org/polkadot-js/api?path=package/rpc-core#info=devDependencies)
@polkadot/api
=============
@polkadot/rpc-core
==================
This library provides a clean wrapper around all the methods exposed by a Polkadot network client.
@@ -12,20 +12,20 @@ Usage
Installation -
```
npm install --save @polkadot/rpc-core
yarn add @polkadot/rpc-core
```
Initialisation -
```js
import Api from '@polkadot/rpc-core';
import Rpc from '@polkadot/rpc-core';
import WsProvider from '@polkadot/rpc-provider/ws';
const provider = new WsProvider('http://127.0.0.1:9944');
const api = new Api(provider);
const api = new Rpc(provider);
```
Making calls -
Retrieving the block header object for a given block header hash (a 0x-prefixed hex string with length of 64) -
```js
api.chain
@@ -34,7 +34,7 @@ api.chain
.catch((error) => console.error(error));
```
Retrieving the best block (once-off) -
Retrieving the best block number, parent hash, state root hash, extrinsics root hash, and digest (once-off) -
```js
api.chain
@@ -43,7 +43,11 @@ api.chain
return api.chain.getHeader(headerHash);
})
.then((header) => {
console.log(`best #${header.number.toString()}`);
console.log(`best #${header.blockNumber.toString()}`);
console.log(`parentHash: ${header.parentHash.toString()}`);
console.log(`stateRoot: ${header.stateRoot.toString()}`);
console.log(`extrinsicsRoot: ${header.extrinsicsRoot.toString()}`);
console.log(`digest: ${header.digest.toString()}`);
})
.catch((error) => {
console.error('error:', error);
@@ -59,11 +63,12 @@ api.chain
console.error('error:', error);
}
console.log(`best #${header.number.toString()}`);
console.log(`best #${header.blockNumber.toString()}`);
})
.then((subscriptionId) => {
console.log(`subscriptionId: ${subscriptionId}`);
// id for the subscription, can unsubscribe via
// api.chain.newHead.unsubscribe(subscriptionId)
// api.chain.newHead.unsubscribe(subscriptionId);
})
.catch((error) => {
console.error('error subscribing:', error);
+7 -7
View File
@@ -403,7 +403,7 @@ graph LR;
<p><a id="constructor"></a></p>
<h2 id="constructor">constructor</h2>
<p>&#x2295; <strong>new Rpc</strong>(provider: <em><code>ProviderInterface</code></em>): <a href="_index_.rpc.html">Rpc</a></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L45" target="_blank">index.ts:45</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L45" target="_blank">index.ts:45</a></em></p>
<p><em><strong>constructor</strong></em>: Default constructor for the Api Object</p>
<p><strong>Parameters:</strong></p>
<table>
@@ -428,28 +428,28 @@ graph LR;
<p><a id="author"></a></p>
<h2 id="author">author</h2>
<p><strong>&#x25CF; author</strong>: <em><a href="../modules/_types_d_.md#rpcinterface_section">RpcInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L42" target="_blank">index.ts:42</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L42" target="_blank">index.ts:42</a></em></p>
<hr>
<p><a id="chain"></a></p>
<h2 id="chain">chain</h2>
<p><strong>&#x25CF; chain</strong>: <em><a href="../modules/_types_d_.md#rpcinterface_section">RpcInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L43" target="_blank">index.ts:43</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L43" target="_blank">index.ts:43</a></em></p>
<hr>
<p><a id="state"></a></p>
<h2 id="state">state</h2>
<p><strong>&#x25CF; state</strong>: <em><a href="../modules/_types_d_.md#rpcinterface_section">RpcInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L44" target="_blank">index.ts:44</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L44" target="_blank">index.ts:44</a></em></p>
<hr>
<p><a id="system"></a></p>
<h2 id="system">system</h2>
<p><strong>&#x25CF; system</strong>: <em><a href="../modules/_types_d_.md#rpcinterface_section">RpcInterface$Section</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L45" target="_blank">index.ts:45</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L45" target="_blank">index.ts:45</a></em></p>
<hr>
<h1 id="methods">Methods</h1>
<p><a id="signature"></a></p>
<h2 id="static-signature"><code>&lt;Static&gt;</code> signature</h2>
<p>&#x25B8; <strong>signature</strong>(__namedParameters: <em><code>object</code></em>): <code>string</code></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L80" target="_blank">index.ts:80</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L80" target="_blank">index.ts:80</a></em></p>
<p><em><strong>name</strong></em>: signature</p>
<p><em><strong>summary</strong></em>: Returns a string representation of the method with inputs and outputs.</p>
<p><em><strong>description</strong></em>: Formats the name, inputs and outputs into a human-readable string. This contains the input parameter names input types and output type.</p>
@@ -518,7 +518,7 @@ graph LR;
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Rpc","level":"1.2.1","depth":2,"next":{"title":"rpc-provider","level":"1.3","depth":1,"path":"rpc-provider/README.md","ref":"rpc-provider/README.md","articles":[{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"rpc-provider/classes/_http_index_.httpprovider.md","ref":"rpc-provider/classes/_http_index_.httpprovider.md","articles":[]},{"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":[]}]},"previous":{"title":"rpc-core","level":"1.2","depth":1,"path":"rpc-core/README.md","ref":"rpc-core/README.md","articles":[{"title":"Rpc","level":"1.2.1","depth":2,"path":"rpc-core/classes/_index_.rpc.md","ref":"rpc-core/classes/_index_.rpc.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":"rpc-core/classes/_index_.rpc.md","mtime":"2018-10-10T11:19:40.342Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-10T11:21:03.075Z"},"basePath":"../..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"Rpc","level":"1.2.1","depth":2,"next":{"title":"rpc-provider","level":"1.3","depth":1,"path":"rpc-provider/README.md","ref":"rpc-provider/README.md","articles":[{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"rpc-provider/classes/_http_index_.httpprovider.md","ref":"rpc-provider/classes/_http_index_.httpprovider.md","articles":[]},{"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":[]}]},"previous":{"title":"rpc-core","level":"1.2","depth":1,"path":"rpc-core/README.md","ref":"rpc-core/README.md","articles":[{"title":"Rpc","level":"1.2.1","depth":2,"path":"rpc-core/classes/_index_.rpc.md","ref":"rpc-core/classes/_index_.rpc.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":"rpc-core/classes/_index_.rpc.md","mtime":"2018-10-10T18:14:17.222Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-10T18:15:31.788Z"},"basePath":"../..","book":{"language":""}});
});
</script>
</div>
+6 -6
View File
@@ -37,7 +37,7 @@ const api = new Api(provider);
⊕ **new Rpc**(provider: *`ProviderInterface`*): [Rpc](_index_.rpc.md)
*Defined in [index.ts:45](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L45)*
*Defined in [index.ts:45](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L45)*
*__constructor__*: Default constructor for the Api Object
@@ -59,7 +59,7 @@ ___
**● author**: *[RpcInterface$Section](../modules/_types_d_.md#rpcinterface_section)*
*Defined in [index.ts:42](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L42)*
*Defined in [index.ts:42](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L42)*
___
<a id="chain"></a>
@@ -68,7 +68,7 @@ ___
**● chain**: *[RpcInterface$Section](../modules/_types_d_.md#rpcinterface_section)*
*Defined in [index.ts:43](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L43)*
*Defined in [index.ts:43](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L43)*
___
<a id="state"></a>
@@ -77,7 +77,7 @@ ___
**● state**: *[RpcInterface$Section](../modules/_types_d_.md#rpcinterface_section)*
*Defined in [index.ts:44](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L44)*
*Defined in [index.ts:44](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L44)*
___
<a id="system"></a>
@@ -86,7 +86,7 @@ ___
**● system**: *[RpcInterface$Section](../modules/_types_d_.md#rpcinterface_section)*
*Defined in [index.ts:45](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L45)*
*Defined in [index.ts:45](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L45)*
___
@@ -98,7 +98,7 @@ ___
▸ **signature**(__namedParameters: *`object`*): `string`
*Defined in [index.ts:80](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/index.ts#L80)*
*Defined in [index.ts:80](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/index.ts#L80)*
*__name__*: signature
+15 -10
View File
@@ -378,32 +378,36 @@
<section class="normal markdown-section">
<p><a href="https://polkadot.js.org" target="_blank"><img src="https://img.shields.io/badge/polkadot-js-orange.svg?style=flat-square" alt="polkadotjs"></a> <img src="https://img.shields.io/badge/license-ISC-lightgrey.svg?style=flat-square" alt="isc"> <a href="https://github.com/Flet/semistandard" target="_blank"><img src="https://img.shields.io/badge/code%20style-semistandard-lightgrey.svg?style=flat-square" alt="style"></a> <a href="https://www.npmjs.com/package/@polkadot/api" target="_blank"><img src="https://img.shields.io/npm/v/@polkadot/api.svg?style=flat-square" alt="npm"></a> <a href="https://travis-ci.org/polkadot-js/api" target="_blank"><img src="https://img.shields.io/travis/polkadot-js/api.svg?style=flat-square" alt="travis"></a> <a href="https://codeclimate.com/github/polkadot-js/api/maintainability" target="_blank"><img src="https://img.shields.io/codeclimate/maintainability/polkadot-js/api.svg?style=flat-square" alt="maintainability"></a> <a href="https://coveralls.io/github/polkadot-js/api?branch=master" target="_blank"><img src="https://img.shields.io/coveralls/polkadot-js/api.svg?style=flat-square" alt="coverage"></a> <a href="https://david-dm.org/polkadot-js/api?path=package/rpc-core" target="_blank"><img src="https://david-dm.org/polkadot-js/api.svg?style=flat-square&amp;path=package/rpc-core" alt="dependency"></a> <a href="https://david-dm.org/polkadot-js/api?path=package/rpc-core#info=devDependencies" target="_blank"><img src="https://david-dm.org/polkadot-js/api/dev-status.svg?style=flat-square&amp;path=package/rpc-core" alt="devDependency"></a></p>
<h1 id="polkadotapi">@polkadot/api</h1>
<h1 id="polkadotrpc-core">@polkadot/rpc-core</h1>
<p>This library provides a clean wrapper around all the methods exposed by a Polkadot network client.</p>
<h2 id="usage">Usage</h2>
<p>Installation -</p>
<pre><code>npm install --save @polkadot/rpc-core
<pre><code>yarn add @polkadot/rpc-core
</code></pre><p>Initialisation -</p>
<pre><code class="lang-js"><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-reservedWord">import</span>&#xA0;<span class="sunlight-ident">Api</span>&#xA0;<span class="sunlight-ident">from</span>&#xA0;<span class="sunlight-string">&apos;@polkadot/rpc-core&apos;</span><span class="sunlight-punctuation">;</span>
<pre><code class="lang-js"><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-reservedWord">import</span>&#xA0;<span class="sunlight-ident">Rpc</span>&#xA0;<span class="sunlight-ident">from</span>&#xA0;<span class="sunlight-string">&apos;@polkadot/rpc-core&apos;</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-reservedWord">import</span>&#xA0;<span class="sunlight-ident">WsProvider</span>&#xA0;<span class="sunlight-ident">from</span>&#xA0;<span class="sunlight-string">&apos;@polkadot/rpc-provider/ws&apos;</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">provider</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-keyword">new</span>&#xA0;<span class="sunlight-ident">WsProvider</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;http://127.0.0.1:9944&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">api</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-keyword">new</span>&#xA0;<span class="sunlight-ident">Api</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-reservedWord">const</span>&#xA0;<span class="sunlight-ident">api</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-keyword">new</span>&#xA0;<span class="sunlight-ident">Rpc</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">provider</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p>Making calls -</p>
<p>Retrieving the block header object for a given block header hash (a 0x-prefixed hex string with length of 64) -</p>
<pre><code class="lang-js"><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-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">chain</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">getHeader</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;0x1234567890&apos;</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">then</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">header</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">header</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-keyword">catch</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p>Retrieving the best block (once-off) -</p>
<p>Retrieving the best block number, parent hash, state root hash, extrinsics root hash, and digest (once-off) -</p>
<pre><code class="lang-js"><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-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">chain</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">getHead</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">then</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">headerHash</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-keyword">return</span>&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">chain</span><span class="sunlight-operator">.</span><span class="sunlight-ident">getHeader</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">headerHash</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">then</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">header</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">best</span>&#xA0;<span class="sunlight-punctuation">#</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">header</span><span class="sunlight-operator">.</span><span class="sunlight-ident">number</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>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">best</span>&#xA0;<span class="sunlight-punctuation">#</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">header</span><span class="sunlight-operator">.</span><span class="sunlight-ident">blockNumber</span><span class="sunlight-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>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">parentHash</span><span class="sunlight-operator">:</span>&#xA0;<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">parentHash</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>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">stateRoot</span><span class="sunlight-operator">:</span>&#xA0;<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">stateRoot</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>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">extrinsicsRoot</span><span class="sunlight-operator">:</span>&#xA0;<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">extrinsicsRoot</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>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">digest</span><span class="sunlight-operator">:</span>&#xA0;<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">digest</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>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-keyword">catch</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;error:&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">error</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
@@ -416,11 +420,12 @@
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;error:&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">error</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-punctuation">}</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">best</span>&#xA0;<span class="sunlight-punctuation">#</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">header</span><span class="sunlight-operator">.</span><span class="sunlight-ident">number</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>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">best</span>&#xA0;<span class="sunlight-punctuation">#</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">header</span><span class="sunlight-operator">.</span><span class="sunlight-ident">blockNumber</span><span class="sunlight-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>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">then</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">subscriptionId</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">subscriptionId</span><span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">subscriptionId</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;id&#xA0;for&#xA0;the&#xA0;subscription,&#xA0;can&#xA0;unsubscribe&#xA0;via</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;api.chain.newHead.unsubscribe(subscriptionId)</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;api.chain.newHead.unsubscribe(subscriptionId);</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-keyword">catch</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">error</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;error&#xA0;subscribing:&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">error</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
@@ -469,7 +474,7 @@
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"rpc-core","level":"1.2","depth":1,"next":{"title":"Rpc","level":"1.2.1","depth":2,"path":"rpc-core/classes/_index_.rpc.md","ref":"rpc-core/classes/_index_.rpc.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"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":"rpc-core/README.md","mtime":"2018-10-10T11:19:40.206Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-10T11:21:03.075Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"rpc-core","level":"1.2","depth":1,"next":{"title":"Rpc","level":"1.2.1","depth":2,"path":"rpc-core/classes/_index_.rpc.md","ref":"rpc-core/classes/_index_.rpc.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"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":"rpc-core/README.md","mtime":"2018-10-10T18:14:17.082Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-10T18:15:31.788Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>
@@ -7,7 +7,7 @@
# Callable
▸ **__call**(...params: *`Array`<`any`>*): `Promise`<`any`>
*Defined in [types.d.ts:7](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/types.d.ts#L7)*
*Defined in [types.d.ts:7](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/types.d.ts#L7)*
**Parameters:**
@@ -25,7 +25,7 @@
**● subscription**: *`string`*
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/types.d.ts#L10)*
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/types.d.ts#L10)*
___
<a id="unsubscribe"></a>
@@ -34,7 +34,7 @@ ___
**● unsubscribe**: *`function`*
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/types.d.ts#L11)*
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/types.d.ts#L11)*
#### Type declaration
▸(id: *`number`*): `Promise`<`any`>
+2 -2
View File
@@ -8,7 +8,7 @@
**Ƭ RpcInterface**: *`object`*
*Defined in [types.d.ts:18](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/types.d.ts#L18)*
*Defined in [types.d.ts:18](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/types.d.ts#L18)*
#### Type declaration
@@ -19,7 +19,7 @@ ___
**Ƭ RpcInterface$Section**: *`object`*
*Defined in [types.d.ts:14](https://github.com/polkadot-js/api/blob/bba764b/packages/rpc-core/src/types.d.ts#L14)*
*Defined in [types.d.ts:14](https://github.com/polkadot-js/api/blob/267411d/packages/rpc-core/src/types.d.ts#L14)*
#### Type declaration