Gitbook rendering updates (#159)
* Add .nodoc for in-flux packages * Start with clean-slate for re-generation * Update with working (although manual) config
This commit is contained in:
+435
-248
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Contributing guide · Polkadot API Book</title>
|
||||
<title>Contributing · 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">
|
||||
@@ -58,8 +58,6 @@
|
||||
|
||||
|
||||
|
||||
<link rel="prev" href="examples/07_transfer_dots/" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
@@ -85,16 +83,28 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="./">
|
||||
<li class="chapter " data-level="1.1" >
|
||||
|
||||
<a href="./">
|
||||
<span>
|
||||
|
||||
|
||||
Introduction
|
||||
api-rx
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1" data-path="api-rx/SUMMARY.html">
|
||||
|
||||
<a href="api-rx/SUMMARY.html">
|
||||
|
||||
|
||||
"defaults"
|
||||
|
||||
</a>
|
||||
|
||||
@@ -102,55 +112,40 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="api/">
|
||||
<li class="chapter " data-level="1.1.2" >
|
||||
|
||||
<a href="api/">
|
||||
<span>
|
||||
|
||||
|
||||
api
|
||||
classes
|
||||
|
||||
</a>
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="api-format/">
|
||||
<li class="chapter " data-level="1.1.3" >
|
||||
|
||||
<a href="api-format/">
|
||||
<span>
|
||||
|
||||
|
||||
api-format
|
||||
modules
|
||||
|
||||
</a>
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="api-provider/">
|
||||
|
||||
<a href="api-provider/">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="api-rx/">
|
||||
<li class="chapter " data-level="1.2" data-path="SUMMARY.html">
|
||||
|
||||
<a href="api-rx/">
|
||||
<a href="SUMMARY.html">
|
||||
|
||||
|
||||
api-rx
|
||||
@@ -161,12 +156,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="type-extrinsics/">
|
||||
<li class="chapter " data-level="1.3" data-path="SUMMARY.original.html">
|
||||
|
||||
<a href="type-extrinsics/">
|
||||
<a href="SUMMARY.original.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
Packages
|
||||
|
||||
</a>
|
||||
|
||||
@@ -174,12 +169,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="type-jsonrpc/">
|
||||
<li class="chapter " data-level="1.4" data-path="./">
|
||||
|
||||
<a href="type-jsonrpc/">
|
||||
<a href="./">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
Polkadot Javascript API
|
||||
|
||||
</a>
|
||||
|
||||
@@ -187,12 +182,26 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="type-params/">
|
||||
<li class="chapter " data-level="1.5" >
|
||||
|
||||
<a href="type-params/">
|
||||
<span>
|
||||
|
||||
|
||||
type-params
|
||||
api-provider
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.5.1" data-path="api-provider/SUMMARY.html">
|
||||
|
||||
<a href="api-provider/SUMMARY.html">
|
||||
|
||||
|
||||
"coder/json/decodeResponse"
|
||||
|
||||
</a>
|
||||
|
||||
@@ -200,12 +209,56 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="type-primitives/">
|
||||
<li class="chapter " data-level="1.5.2" >
|
||||
|
||||
<a href="type-primitives/">
|
||||
<span>
|
||||
|
||||
|
||||
type-primitives
|
||||
classes
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
modules
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.5.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
interfaces
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.6" data-path="CONTRIBUTING.html">
|
||||
|
||||
<a href="CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing
|
||||
|
||||
</a>
|
||||
|
||||
@@ -213,105 +266,35 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="type-storage/">
|
||||
<li class="chapter " data-level="1.7" >
|
||||
|
||||
<a href="type-storage/">
|
||||
<span>
|
||||
|
||||
|
||||
type-storage
|
||||
examples
|
||||
|
||||
</a>
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="examples/">
|
||||
<li class="chapter " data-level="1.7.1" >
|
||||
|
||||
<a href="examples/">
|
||||
<span>
|
||||
|
||||
|
||||
Overview
|
||||
06_craft_extrinsic
|
||||
|
||||
</a>
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="examples/01_simple_connect/">
|
||||
|
||||
<a href="examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="examples/04_generate_account/">
|
||||
|
||||
<a href="examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="examples/05_read_storage/">
|
||||
|
||||
<a href="examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="examples/06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="1.7.1.1" data-path="examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="examples/06_craft_extrinsic/">
|
||||
|
||||
@@ -324,12 +307,31 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="examples/07_transfer_dots/">
|
||||
|
||||
</ul>
|
||||
|
||||
<a href="examples/07_transfer_dots/">
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
03_listen_to_balance_change
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.2.1" data-path="examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance changes
|
||||
|
||||
</a>
|
||||
|
||||
@@ -338,18 +340,30 @@
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter active" data-level="4.1" data-path="CONTRIBUTING.html">
|
||||
</ul>
|
||||
|
||||
<a href="CONTRIBUTING.html">
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
Contributing guide
|
||||
05_read_storage
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.3.1" data-path="examples/05_read_storage/">
|
||||
|
||||
<a href="examples/05_read_storage/">
|
||||
|
||||
|
||||
Read storage
|
||||
|
||||
</a>
|
||||
|
||||
@@ -358,6 +372,260 @@
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
04_generate_account
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.4.1" data-path="examples/04_generate_account/">
|
||||
|
||||
<a href="examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.5" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
01_simple_connect
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.5.1" data-path="examples/01_simple_connect/">
|
||||
|
||||
<a href="examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple Connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.6" data-path="examples/">
|
||||
|
||||
<a href="examples/">
|
||||
|
||||
|
||||
Examples
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.7" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
02_listen_to_blocks
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.7.1" data-path="examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to new blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.7.8" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
07_transfer_dots
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.7.8.1" data-path="examples/07_transfer_dots/">
|
||||
|
||||
<a href="examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Tranfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
api
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.8.1" data-path="api/SUMMARY.html">
|
||||
|
||||
<a href="api/SUMMARY.html">
|
||||
|
||||
|
||||
"index"
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8.2" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
classes
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8.3" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
modules
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.8.4" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
interfaces
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.9" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
gitbook
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.9.1" >
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
fonts
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
@@ -387,7 +655,7 @@
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="." >Contributing guide</a>
|
||||
<a href="." >Contributing</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
@@ -403,113 +671,36 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="contributing">Contributing</h1>
|
||||
<div class="sect1">
|
||||
<h2 id="_what">What?</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<h2 id="what">What?</h2>
|
||||
<p>Individuals making significant and valuable contributions are given commit-access to a project to contribute as they see fit.
|
||||
A project is more like an open wiki than a standard guarded open source project.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_rules">Rules</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<h2 id="rules">Rules</h2>
|
||||
<p>There are a few basic ground-rules for contributors (including the maintainer(s) of the project):</p>
|
||||
</div>
|
||||
<div class="olist arabic">
|
||||
<ol class="arabic">
|
||||
<li>
|
||||
<p><strong>No <code>--force</code> pushes</strong> or modifying the Git history in any way. If you need to rebase, ensure you do it in your own repo.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Non-master branches</strong>, prefixed with a short name moniker (e.g. <code>gav-my-feature</code>) must be used for ongoing work.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>All modifications</strong> must be made in a <strong>pull-request</strong> to solicit feedback from other contributors.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>A pull-request <strong>must not be merged until CI</strong> has finished successfully.</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>. <strong>No <code>--force</code> pushes</strong> or modifying the Git history in any way. If you need to rebase, ensure you do it in your own repo.
|
||||
. <strong>Non-master branches</strong>, prefixed with a short name moniker (e.g. <code><initials>-<feature></code>) must be used for ongoing work.
|
||||
. <strong>All modifications</strong> must be made in a <strong>pull-request</strong> to solicit feedback from other contributors.
|
||||
. A pull-request <em>must not be merged until CI</em> has finished successfully.</p>
|
||||
<p>Merging pull requests once CI is successful:</p>
|
||||
</div>
|
||||
<div class="olist arabic">
|
||||
<ol class="arabic">
|
||||
<li>
|
||||
<p>A pull request with no large change to logic that is an urgent fix may be merged after a non-author contributor has reviewed it well.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>No PR should be merged until all reviews' comments are addressed.</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<div class="title">Reviewing pull requests:</div>
|
||||
<p>When reviewing a pull request, the end-goal is to suggest useful changes to the author. Reviews should finish with approval unless there are issues that would result in:</p>
|
||||
</div>
|
||||
<div class="olist arabic">
|
||||
<ol class="arabic">
|
||||
<li>
|
||||
<p>Buggy behaviour.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Undue maintenance burden.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Breaking with house coding style.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Pessimisation (i.e. reduction of speed as measured in the projects benchmarks).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Feature reduction (i.e. it removes some aspect of functionality that a significant minority of users rely on).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Uselessness (i.e. it does not strictly add a feature or fix a known issue).</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="olist arabic">
|
||||
<div class="title">Reviews may not be used as an effective veto for a PR because:</div>
|
||||
<ol class="arabic">
|
||||
<li>
|
||||
<p>There exists a somewhat cleaner/better/faster way of accomplishing the same feature/fix.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>It does not fit well with some other contributors' longer-term vision for the project.</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_releases">Releases</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>. A pull request with no large change to logic that is an urgent fix may be merged after a non-author contributor has reviewed it well.
|
||||
. No PR should be merged until all reviews' comments are addressed.</p>
|
||||
<p>.Reviewing pull requests:
|
||||
When reviewing a pull request, the end-goal is to suggest useful changes to the author. Reviews should finish with approval unless there are issues that would result in:</p>
|
||||
<p>. Buggy behaviour.
|
||||
. Undue maintenance burden.
|
||||
. Breaking with house coding style.
|
||||
. Pessimisation (i.e. reduction of speed as measured in the projects benchmarks).
|
||||
. Feature reduction (i.e. it removes some aspect of functionality that a significant minority of users rely on).
|
||||
. Uselessness (i.e. it does not strictly add a feature or fix a known issue).</p>
|
||||
<p>.Reviews may not be used as an effective veto for a PR because:
|
||||
. There exists a somewhat cleaner/better/faster way of accomplishing the same feature/fix.
|
||||
. It does not fit well with some other contributors' longer-term vision for the project.</p>
|
||||
<h2 id="releases">Releases</h2>
|
||||
<p>Declaring formal releases remains the prerogative of the project maintainer(s).</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_changes_to_this_arrangement">Changes to this arrangement</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<h2 id="changes-to-this-arrangement">Changes to this arrangement</h2>
|
||||
<p>This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_heritage">Heritage</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>These contributing guidelines are modified from the "OPEN Open Source Project" guidelines for the Level project: <a href="https://github.com/Level/community/blob/master/CONTRIBUTING.md" class="bare" target="_blank">https://github.com/Level/community/blob/master/CONTRIBUTING.md</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2 id="heritage">Heritage</h2>
|
||||
<p>These contributing guidelines are modified from the "OPEN Open Source Project" guidelines for the Level project: <a href="https://github.com/Level/community/blob/master/CONTRIBUTING.md" target="_blank">https://github.com/Level/community/blob/master/CONTRIBUTING.md</a></p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@@ -536,10 +727,6 @@ A project is more like an open wiki than a standard guarded open source project.
|
||||
|
||||
|
||||
|
||||
<a href="examples/07_transfer_dots/" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Transfer DOTs">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -548,7 +735,7 @@ A project is more like an open wiki than a standard guarded open source project.
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Contributing guide","level":"4.1","depth":1,"previous":{"title":"Transfer DOTs","level":"3.8","depth":1,"path":"examples/07_transfer_dots/README.adoc","ref":"examples/07_transfer_dots/README.adoc","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"CONTRIBUTING.adoc","mtime":"2018-09-17T12:30:32.109Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":".","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Contributing","level":"1.6","depth":1,"next":{"title":"examples","level":"1.7","depth":1,"ref":"","articles":[{"title":"06_craft_extrinsic","level":"1.7.1","depth":2,"ref":"","articles":[{"title":"Craft Extrinsic","level":"1.7.1.1","depth":3,"path":"examples/06_craft_extrinsic/README.md","ref":"./examples/06_craft_extrinsic/README.md","articles":[]}]},{"title":"03_listen_to_balance_change","level":"1.7.2","depth":2,"ref":"","articles":[{"title":"Listen to balance changes","level":"1.7.2.1","depth":3,"path":"examples/03_listen_to_balance_change/README.md","ref":"./examples/03_listen_to_balance_change/README.md","articles":[]}]},{"title":"05_read_storage","level":"1.7.3","depth":2,"ref":"","articles":[{"title":"Read storage","level":"1.7.3.1","depth":3,"path":"examples/05_read_storage/README.md","ref":"./examples/05_read_storage/README.md","articles":[]}]},{"title":"04_generate_account","level":"1.7.4","depth":2,"ref":"","articles":[{"title":"Generate accounts","level":"1.7.4.1","depth":3,"path":"examples/04_generate_account/README.md","ref":"./examples/04_generate_account/README.md","articles":[]}]},{"title":"01_simple_connect","level":"1.7.5","depth":2,"ref":"","articles":[{"title":"Simple Connect","level":"1.7.5.1","depth":3,"path":"examples/01_simple_connect/README.md","ref":"./examples/01_simple_connect/README.md","articles":[]}]},{"title":"Examples","level":"1.7.6","depth":2,"path":"examples/README.md","ref":"./examples/README.md","articles":[]},{"title":"02_listen_to_blocks","level":"1.7.7","depth":2,"ref":"","articles":[{"title":"Listen to new blocks","level":"1.7.7.1","depth":3,"path":"examples/02_listen_to_blocks/README.md","ref":"./examples/02_listen_to_blocks/README.md","articles":[]}]},{"title":"07_transfer_dots","level":"1.7.8","depth":2,"ref":"","articles":[{"title":"Tranfer DOTs","level":"1.7.8.1","depth":3,"path":"examples/07_transfer_dots/README.md","ref":"./examples/07_transfer_dots/README.md","articles":[]}]}]},"previous":{"title":"interfaces","level":"1.5.4","depth":2,"ref":"","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"CONTRIBUTING.md","mtime":"2018-09-19T09:57:54.523Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T10:00:13.183Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
= Contributing
|
||||
# Contributing
|
||||
|
||||
== What?
|
||||
## What?
|
||||
|
||||
Individuals making significant and valuable contributions are given commit-access to a project to contribute as they see fit.
|
||||
A project is more like an open wiki than a standard guarded open source project.
|
||||
|
||||
== Rules
|
||||
## Rules
|
||||
|
||||
There are a few basic ground-rules for contributors (including the maintainer(s) of the project):
|
||||
|
||||
. **No `--force` pushes** or modifying the Git history in any way. If you need to rebase, ensure you do it in your own repo.
|
||||
. **Non-master branches**, prefixed with a short name moniker (e.g. `gav-my-feature`) must be used for ongoing work.
|
||||
. **Non-master branches**, prefixed with a short name moniker (e.g. `<initials>-<feature>`) must be used for ongoing work.
|
||||
. **All modifications** must be made in a **pull-request** to solicit feedback from other contributors.
|
||||
. A pull-request *must not be merged until CI* has finished successfully.
|
||||
|
||||
@@ -33,14 +33,14 @@ When reviewing a pull request, the end-goal is to suggest useful changes to the
|
||||
. There exists a somewhat cleaner/better/faster way of accomplishing the same feature/fix.
|
||||
. It does not fit well with some other contributors' longer-term vision for the project.
|
||||
|
||||
== Releases
|
||||
## Releases
|
||||
|
||||
Declaring formal releases remains the prerogative of the project maintainer(s).
|
||||
|
||||
== Changes to this arrangement
|
||||
## Changes to this arrangement
|
||||
|
||||
This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change.
|
||||
|
||||
== Heritage
|
||||
## Heritage
|
||||
|
||||
These contributing guidelines are modified from the "OPEN Open Source Project" guidelines for the Level project: https://github.com/Level/community/blob/master/CONTRIBUTING.md
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
== DOT
|
||||
|
||||
some def
|
||||
|
||||
== Another term
|
||||
|
||||
some explanation
|
||||
+64
-112
@@ -83,7 +83,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -100,14 +100,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="api/">
|
||||
<li class="chapter " data-level="1.2" data-path="api/">
|
||||
|
||||
<a href="api/">
|
||||
|
||||
@@ -118,14 +111,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="api/classes/_index_.api.html">
|
||||
|
||||
<a href="api-format/">
|
||||
<a href="api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -133,7 +127,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="api-provider/">
|
||||
|
||||
<a href="api-provider/">
|
||||
|
||||
@@ -144,9 +143,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="api-rx/">
|
||||
|
||||
<a href="api-rx/">
|
||||
|
||||
@@ -157,14 +188,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="type-extrinsics/">
|
||||
<a href="api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -172,55 +204,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="type-jsonrpc/">
|
||||
|
||||
<a href="type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="type-params/">
|
||||
|
||||
<a href="type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="type-primitives/">
|
||||
|
||||
<a href="type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="type-storage/">
|
||||
|
||||
<a href="type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -231,7 +216,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="examples/">
|
||||
<li class="chapter " data-level="2.1" data-path="examples/">
|
||||
|
||||
<a href="examples/">
|
||||
|
||||
@@ -244,7 +229,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="examples/01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="examples/01_simple_connect/">
|
||||
|
||||
<a href="examples/01_simple_connect/">
|
||||
|
||||
@@ -257,7 +242,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="examples/02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="examples/02_listen_to_blocks/">
|
||||
|
||||
@@ -270,7 +255,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="examples/03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="examples/03_listen_to_balance_change/">
|
||||
|
||||
@@ -283,7 +268,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="examples/04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="examples/04_generate_account/">
|
||||
|
||||
<a href="examples/04_generate_account/">
|
||||
|
||||
@@ -296,7 +281,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="examples/05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="examples/05_read_storage/">
|
||||
|
||||
<a href="examples/05_read_storage/">
|
||||
|
||||
@@ -309,7 +294,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="examples/06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="examples/06_craft_extrinsic/">
|
||||
|
||||
@@ -322,7 +307,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="examples/07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="examples/07_transfer_dots/">
|
||||
|
||||
<a href="examples/07_transfer_dots/">
|
||||
|
||||
@@ -337,26 +322,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="CONTRIBUTING.html">
|
||||
|
||||
<a href="CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -400,22 +365,9 @@
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<div class="sect1">
|
||||
<h2 id="_dot">DOT</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>some def</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_another_term">Another term</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>some explanation</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2 id="dot">DOT</h2>
|
||||
<p>The native unit for operation on the Polkadot network.</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@@ -450,7 +402,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"GLOSSARY.adoc","mtime":"2018-09-17T12:30:32.109Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":".","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"GLOSSARY.md","mtime":"2018-09-19T08:31:13.544Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
## DOT
|
||||
|
||||
The native unit for operation on the Polkadot network.
|
||||
@@ -1,13 +1,14 @@
|
||||
= Polkadot Javascript API
|
||||
:toc:
|
||||
# Polkadot Javascript API
|
||||
|
||||
You can query a node and interact with the Polkadot network using Javascript. This guide describes the Polkadot Javascript API.
|
||||
|
||||
== The Polkadot Project
|
||||
{% include "SUMMARY.md" %}
|
||||
|
||||
## The Polkadot Project
|
||||
|
||||
You can read more about the Polkadot Network at https://polkadot.network/
|
||||
|
||||
== Github repositories
|
||||
## Github repositories
|
||||
|
||||
You can find the Polkadot repositories at:
|
||||
|
||||
@@ -17,8 +18,6 @@ You can find the Polkadot repositories at:
|
||||
|
||||
This documentation is generated from https://github.com/polkadot-js/api
|
||||
|
||||
== Contributing
|
||||
|
||||
Contribution to the Polkadot JS API are more than welcome. You can https://github.com/polkadot-js/api/issues/new[report issues] and https://github.com/polkadot-js/api/issues/new[feature requests].
|
||||
|
||||
## Contributing
|
||||
|
||||
Contribution to the Polkadot JS API are more than welcome. You can [report issues](https://github.com/polkadot-js/api/issues/new) and [log feature requests](https://github.com/polkadot-js/api/issues/new).
|
||||
@@ -1,37 +0,0 @@
|
||||
= Summary
|
||||
|
||||
== Intro
|
||||
|
||||
// Leave this emtpy, the README.adoc will be linked here.
|
||||
|
||||
== API
|
||||
|
||||
- link:api/README.md[api]
|
||||
- link:api-format/README.md[api-format]
|
||||
- link:api-provider/README.md[api-provider]
|
||||
- link:api-rx/README.md[api-rx]
|
||||
- link:type-extrinsics/README.md[type-extrinsics]
|
||||
- link:type-jsonrpc/README.md[type-jsonrpc]
|
||||
- link:type-params/README.md[type-params]
|
||||
- link:type-primitives/README.md[type-primitives]
|
||||
- link:type-storage/README.md[type-storage]
|
||||
|
||||
== Examples
|
||||
|
||||
- link:examples/README.adoc[Overview]
|
||||
- link:examples/01_simple_connect/README.adoc[Simple connect]
|
||||
- link:examples/02_listen_to_blocks/README.adoc[Listen to blocks]
|
||||
- link:examples/03_listen_to_balance_change/README.adoc[Listen to balance change]
|
||||
- link:examples/04_generate_account/README.adoc[Generate Accounts]
|
||||
- link:examples/05_read_storage/README.adoc[Read Storage]
|
||||
- link:examples/06_craft_extrinsic/README.adoc[Craft Extrinsic]
|
||||
- link:examples/07_transfer_dots/README.adoc[Transfer DOTs]
|
||||
|
||||
// Making this section ready for the upcoming guides
|
||||
// == Guides
|
||||
|
||||
// - link:guides/create_api.adoc[Create API]
|
||||
|
||||
== Contributing
|
||||
|
||||
- link:CONTRIBUTING.adoc[Contributing guide]
|
||||
@@ -0,0 +1,20 @@
|
||||
## Packages
|
||||
|
||||
- [api](api/README.md)
|
||||
- [Api](api/classes/_index_.api.md)
|
||||
- [api-provider](api-provider/README.md)
|
||||
- [HttpProvider](api-provider/classes/_http_index_.httpprovider.md)
|
||||
- [WsProvider](api-provider/classes/_ws_index_.wsprovider.md)
|
||||
- [api-rx](api-rx/README.md)
|
||||
- [ApiRx](api-rx/classes/_index_.rxapi.md)
|
||||
|
||||
## Examples
|
||||
|
||||
- [Overview](examples/README.md)
|
||||
- [Simple connect](examples/01_simple_connect/README.md)
|
||||
- [Listen to blocks](examples/02_listen_to_blocks/README.md)
|
||||
- [Listen to balance change](examples/03_listen_to_balance_change/README.md)
|
||||
- [Generate Accounts](examples/04_generate_account/README.md)
|
||||
- [Read Storage](examples/05_read_storage/README.md)
|
||||
- [Craft Extrinsic](examples/06_craft_extrinsic/README.md)
|
||||
- [Transfer DOTs](examples/07_transfer_dots/README.md)
|
||||
@@ -1,133 +0,0 @@
|
||||
|
||||
[](https://polkadot.js.org)  [](https://github.com/Flet/semistandard) [](https://www.npmjs.com/package/@polkadot/api-format) [](https://travis-ci.org/polkadot-js/api) [](https://codeclimate.com/github/polkadot-js/api/maintainability) [](https://coveralls.io/github/polkadot-js/api?branch=master) [](https://david-dm.org/polkadot-js/api?path=packages/api-format) [](https://david-dm.org/polkadot-js/api?path=packages/api-format#info=devDependencies)
|
||||
|
||||
@polkadot/api-format
|
||||
====================
|
||||
|
||||
Formatters that are used by the application API interface, taking care of transparently formatting parameters (inputs) and the results (output) for requests made over the client RPC interfaces.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Installation -
|
||||
|
||||
```
|
||||
npm install --save @polkadot/api-format
|
||||
```
|
||||
|
||||
## Index
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [FormatterFunction](#formatterfunction)
|
||||
|
||||
### Functions
|
||||
|
||||
* [echo](#echo)
|
||||
* [format](#format)
|
||||
* [formatInputs](#formatinputs)
|
||||
* [formatOutput](#formatoutput)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="formatterfunction"></a>
|
||||
|
||||
### FormatterFunction
|
||||
|
||||
**Ƭ FormatterFunction**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-format/src/types.d.ts#L7)*
|
||||
|
||||
#### Type declaration
|
||||
▸(value: *`any`*): `any`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| value | `any` |
|
||||
|
||||
**Returns:** `any`
|
||||
|
||||
___
|
||||
|
||||
## Functions
|
||||
|
||||
<a id="echo"></a>
|
||||
|
||||
### echo
|
||||
|
||||
▸ **echo**(value: *`any`*): `any`
|
||||
|
||||
*Defined in [echo.ts:10](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-format/src/echo.ts#L10)*
|
||||
|
||||
A function returning any value passed to it
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Description |
|
||||
| ------ | ------ | ------ |
|
||||
| value | `any` | The input value |
|
||||
|
||||
**Returns:** `any`
|
||||
The value passed as input
|
||||
|
||||
___
|
||||
<a id="format"></a>
|
||||
|
||||
### format
|
||||
|
||||
▸ **format**(formatters: *`FormattersFunctionMap`*, types: *`Array`<`Param$Types`>*, values: *`Array`<`any`>*): `Array`<`any`>
|
||||
|
||||
*Defined in [format.ts:49](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-format/src/format.ts#L49)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| formatters | `FormattersFunctionMap` |
|
||||
| types | `Array`<`Param$Types`> |
|
||||
| values | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Array`<`any`>
|
||||
|
||||
___
|
||||
<a id="formatinputs"></a>
|
||||
|
||||
### formatInputs
|
||||
|
||||
▸ **formatInputs**(params: *`Params`*, values: *`Array`<`any`>*): `Array`<`any`>
|
||||
|
||||
*Defined in [input.ts:22](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-format/src/input.ts#L22)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| params | `Params` |
|
||||
| values | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Array`<`any`>
|
||||
|
||||
___
|
||||
<a id="formatoutput"></a>
|
||||
|
||||
### formatOutput
|
||||
|
||||
▸ **formatOutput**(type: *`Param$Types`*, value?: *`any`*): `any` | `null`
|
||||
|
||||
*Defined in [output.ts:30](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-format/src/output.ts#L30)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | `Param$Types` |
|
||||
| `Optional` value | `any` |
|
||||
|
||||
**Returns:** `any` | `null`
|
||||
|
||||
___
|
||||
|
||||
@@ -1,634 +0,0 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>api-format · 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-highlight/website.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="../api-provider/" />
|
||||
|
||||
|
||||
<link rel="prev" href="../api/" />
|
||||
|
||||
|
||||
</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">Intro</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../api/">
|
||||
|
||||
<a href="../api/">
|
||||
|
||||
|
||||
api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="2.2" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
api-format
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../api-provider/">
|
||||
|
||||
<a href="../api-provider/">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../api-rx/">
|
||||
|
||||
<a href="../api-rx/">
|
||||
|
||||
|
||||
api-rx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../type-extrinsics/">
|
||||
|
||||
<a href="../type-extrinsics/">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../type-jsonrpc/">
|
||||
|
||||
<a href="../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../type-params/">
|
||||
|
||||
<a href="../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../type-primitives/">
|
||||
|
||||
<a href="../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../type-storage/">
|
||||
|
||||
<a href="../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../examples/">
|
||||
|
||||
<a href="../examples/">
|
||||
|
||||
|
||||
Overview
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../examples/01_simple_connect/">
|
||||
|
||||
<a href="../examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../examples/04_generate_account/">
|
||||
|
||||
<a href="../examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../examples/05_read_storage/">
|
||||
|
||||
<a href="../examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../examples/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../CONTRIBUTING.html">
|
||||
|
||||
<a href="../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</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=".." >api-format</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">
|
||||
|
||||
<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-format" target="_blank"><img src="https://img.shields.io/npm/v/@polkadot/api-format.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=packages/api-format" target="_blank"><img src="https://david-dm.org/polkadot-js/api.svg?style=flat-square&path=packages/api-format" alt="dependency"></a> <a href="https://david-dm.org/polkadot-js/api?path=packages/api-format#info=devDependencies" target="_blank"><img src="https://david-dm.org/polkadot-js/api/dev-status.svg?style=flat-square&path=packages/api-format" alt="devDependency"></a></p>
|
||||
<h1 id="polkadotapi-format">@polkadot/api-format</h1>
|
||||
<p>Formatters that are used by the application API interface, taking care of transparently formatting parameters (inputs) and the results (output) for requests made over the client RPC interfaces.</p>
|
||||
<h2 id="usage">Usage</h2>
|
||||
<p>Installation -</p>
|
||||
<pre><code>npm install --save @polkadot/api-format
|
||||
</code></pre><h2 id="index">Index</h2>
|
||||
<h3 id="type-aliases">Type aliases</h3>
|
||||
<ul>
|
||||
<li><a href="#formatterfunction">FormatterFunction</a></li>
|
||||
</ul>
|
||||
<h3 id="functions">Functions</h3>
|
||||
<ul>
|
||||
<li><a href="#echo">echo</a></li>
|
||||
<li><a href="#format">format</a></li>
|
||||
<li><a href="#formatinputs">formatInputs</a></li>
|
||||
<li><a href="#formatoutput">formatOutput</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2 id="type-aliases">Type aliases</h2>
|
||||
<p><a id="formatterfunction"></a></p>
|
||||
<h3 id="formatterfunction">FormatterFunction</h3>
|
||||
<p><strong>Ƭ FormatterFunction</strong>: <em><code>function</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-format/src/types.d.ts#L7" target="_blank">types.d.ts:7</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(value: <em><code>any</code></em>): <code>any</code></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>value</td>
|
||||
<td><code>any</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>any</code></p>
|
||||
<hr>
|
||||
<h2 id="functions">Functions</h2>
|
||||
<p><a id="echo"></a></p>
|
||||
<h3 id="echo">echo</h3>
|
||||
<p>▸ <strong>echo</strong>(value: <em><code>any</code></em>): <code>any</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-format/src/echo.ts#L10" target="_blank">echo.ts:10</a></em></p>
|
||||
<p>A function returning any value passed to it</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>value</td>
|
||||
<td><code>any</code></td>
|
||||
<td>The input value</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>any</code>
|
||||
The value passed as input</p>
|
||||
<hr>
|
||||
<p><a id="format"></a></p>
|
||||
<h3 id="format">format</h3>
|
||||
<p>▸ <strong>format</strong>(formatters: <em><code>FormattersFunctionMap</code></em>, types: <em><code>Array</code><<code>Param$Types</code>></em>, values: <em><code>Array</code><<code>any</code>></em>): <code>Array</code><<code>any</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-format/src/format.ts#L49" target="_blank">format.ts:49</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>formatters</td>
|
||||
<td><code>FormattersFunctionMap</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>types</td>
|
||||
<td><code>Array</code><<code>Param$Types</code>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>values</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Array</code><<code>any</code>></p>
|
||||
<hr>
|
||||
<p><a id="formatinputs"></a></p>
|
||||
<h3 id="formatinputs">formatInputs</h3>
|
||||
<p>▸ <strong>formatInputs</strong>(params: <em><code>Params</code></em>, values: <em><code>Array</code><<code>any</code>></em>): <code>Array</code><<code>any</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-format/src/input.ts#L22" target="_blank">input.ts:22</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Params</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>values</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Array</code><<code>any</code>></p>
|
||||
<hr>
|
||||
<p><a id="formatoutput"></a></p>
|
||||
<h3 id="formatoutput">formatOutput</h3>
|
||||
<p>▸ <strong>formatOutput</strong>(type: <em><code>Param$Types</code></em>, value?: <em><code>any</code></em>): <code>any</code> | <code>null</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-format/src/output.ts#L30" target="_blank">output.ts:30</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>Param$Types</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Optional</code> value</td>
|
||||
<td><code>any</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>any</code> | <code>null</code></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</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="../api/" class="navigation navigation-prev " aria-label="Previous page: api">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../api-provider/" class="navigation navigation-next " aria-label="Next page: api-provider">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"api-format","level":"2.2","depth":1,"next":{"title":"api-provider","level":"2.3","depth":1,"path":"api-provider/README.md","ref":"api-provider/README.md","articles":[]},"previous":{"title":"api","level":"2.1","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-format/README.md","mtime":"2018-09-17T12:35:34.689Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.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>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -26,460 +26,3 @@ const version = await provider.send('client_version', []);
|
||||
console.log('clientVersion', version);
|
||||
```
|
||||
|
||||
## Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [HttpProvider](classes/httpprovider.md)
|
||||
* [WsProvider](classes/wsprovider.md)
|
||||
|
||||
### Interfaces
|
||||
|
||||
* [ProviderInterface](interfaces/providerinterface.md)
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [HttpState](#httpstate)
|
||||
* [JsonRpcObject](#jsonrpcobject)
|
||||
* [JsonRpcRequest](#jsonrpcrequest)
|
||||
* [JsonRpcResponse](#jsonrpcresponse)
|
||||
* [JsonRpcResponseBase](#jsonrpcresponsebase)
|
||||
* [JsonRpcResponseBase$Error](#jsonrpcresponsebase_error)
|
||||
* [MockState](#mockstate)
|
||||
* [MockState$Requests](#mockstate_requests)
|
||||
* [MockState$Storage](#mockstate_storage)
|
||||
* [MockState$Subscription$Callback](#mockstate_subscription_callback)
|
||||
* [MockState$Subscriptions](#mockstate_subscriptions)
|
||||
* [ProviderInterface$Callback](#providerinterface_callback)
|
||||
* [ProviderInterface$EmitCb](#providerinterface_emitcb)
|
||||
* [ProviderInterface$Emitted](#providerinterface_emitted)
|
||||
* [RpcCoder](#rpccoder)
|
||||
* [RpcCoderState](#rpccoderstate)
|
||||
|
||||
### Functions
|
||||
|
||||
* [decodeResponse](#decoderesponse)
|
||||
* [encodeJson](#encodejson)
|
||||
* [encodeObject](#encodeobject)
|
||||
* [mockProvider](#mockprovider)
|
||||
* [mocks](#mocks)
|
||||
* [on](#on)
|
||||
* [rpcCoder](#rpccoder)
|
||||
* [send](#send)
|
||||
* [state](#state)
|
||||
* [subscribe](#subscribe)
|
||||
* [unsubscribe](#unsubscribe)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="httpstate"></a>
|
||||
|
||||
### HttpState
|
||||
|
||||
**Ƭ HttpState**: *`object`*
|
||||
|
||||
*Defined in [http/types.d.ts:8](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/types.d.ts#L8)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="jsonrpcobject"></a>
|
||||
|
||||
### JsonRpcObject
|
||||
|
||||
**Ƭ JsonRpcObject**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:5](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L5)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="jsonrpcrequest"></a>
|
||||
|
||||
### JsonRpcRequest
|
||||
|
||||
**Ƭ JsonRpcRequest**: * [JsonRpcObject](#jsonrpcobject) & `object`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L10)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponse"></a>
|
||||
|
||||
### JsonRpcResponse
|
||||
|
||||
**Ƭ JsonRpcResponse**: * [JsonRpcObject](#jsonrpcobject) & [JsonRpcResponseBase](#jsonrpcresponsebase)
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:36](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L36)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponsebase"></a>
|
||||
|
||||
### JsonRpcResponseBase
|
||||
|
||||
**Ƭ JsonRpcResponseBase**: * `JsonRpcResponse$Single` & `JsonRpcResponse$Subscription`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:34](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L34)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponsebase_error"></a>
|
||||
|
||||
### JsonRpcResponseBase$Error
|
||||
|
||||
**Ƭ JsonRpcResponseBase$Error**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:15](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L15)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="mockstate"></a>
|
||||
|
||||
### MockState
|
||||
|
||||
**Ƭ MockState**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:27](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L27)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="mockstate_requests"></a>
|
||||
|
||||
### MockState$Requests
|
||||
|
||||
**Ƭ MockState$Requests**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:23](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L23)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `function`
|
||||
|
||||
▸(storage: *[MockState$Storage](#mockstate_storage)*, params: *`Array`<`any`>*): `string`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| storage | [MockState$Storage](#mockstate_storage) |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `string`
|
||||
|
||||
___
|
||||
<a id="mockstate_storage"></a>
|
||||
|
||||
### MockState$Storage
|
||||
|
||||
**Ƭ MockState$Storage**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:19](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L19)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="mockstate_subscription_callback"></a>
|
||||
|
||||
### MockState$Subscription$Callback
|
||||
|
||||
**Ƭ MockState$Subscription$Callback**: *`function`*
|
||||
|
||||
*Defined in [mock/types.d.ts:8](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L8)*
|
||||
|
||||
#### Type declaration
|
||||
▸(error: * `Error` | `null`*, value: *`any`*): `void`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| error | `Error` | `null`|
|
||||
| value | `any` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="mockstate_subscriptions"></a>
|
||||
|
||||
### MockState$Subscriptions
|
||||
|
||||
**Ƭ MockState$Subscriptions**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:10](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L10)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `object`
|
||||
|
||||
___
|
||||
<a id="providerinterface_callback"></a>
|
||||
|
||||
### ProviderInterface$Callback
|
||||
|
||||
**Ƭ ProviderInterface$Callback**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:38](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L38)*
|
||||
|
||||
#### Type declaration
|
||||
▸(error: * `Error` | `null`*, result: *`any`*): `void`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| error | `Error` | `null`|
|
||||
| result | `any` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="providerinterface_emitcb"></a>
|
||||
|
||||
### ProviderInterface$EmitCb
|
||||
|
||||
**Ƭ ProviderInterface$EmitCb**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:42](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L42)*
|
||||
|
||||
#### Type declaration
|
||||
▸(value?: *`any`*): `any`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Optional` value | `any` |
|
||||
|
||||
**Returns:** `any`
|
||||
|
||||
___
|
||||
<a id="providerinterface_emitted"></a>
|
||||
|
||||
### ProviderInterface$Emitted
|
||||
|
||||
**Ƭ ProviderInterface$Emitted**: * "connected" | "disconnected"
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:40](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L40)*
|
||||
|
||||
___
|
||||
<a id="rpccoder"></a>
|
||||
|
||||
### RpcCoder
|
||||
|
||||
**Ƭ RpcCoder**: *`object`*
|
||||
|
||||
*Defined in [coder/json/types.d.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/types.d.ts#L7)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="rpccoderstate"></a>
|
||||
|
||||
### RpcCoderState
|
||||
|
||||
**Ƭ RpcCoderState**: *`object`*
|
||||
|
||||
*Defined in [coder/json/types.d.ts:14](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/types.d.ts#L14)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
|
||||
## Functions
|
||||
|
||||
<a id="decoderesponse"></a>
|
||||
|
||||
### decodeResponse
|
||||
|
||||
▸ **decodeResponse**(self: *[RpcCoderState](#rpccoderstate)*, response: *[JsonRpcResponse](#jsonrpcresponse)*): `any`
|
||||
|
||||
*Defined in [coder/json/decodeResponse.ts:22](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/decodeResponse.ts#L22)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](#rpccoderstate) |
|
||||
| response | [JsonRpcResponse](#jsonrpcresponse) |
|
||||
|
||||
**Returns:** `any`
|
||||
|
||||
___
|
||||
<a id="encodejson"></a>
|
||||
|
||||
### encodeJson
|
||||
|
||||
▸ **encodeJson**(self: *[RpcCoderState](#rpccoderstate)*, method: *`string`*, params: *`Array`<`any`>*): `string`
|
||||
|
||||
*Defined in [coder/json/encodeJson.ts:9](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/encodeJson.ts#L9)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](#rpccoderstate) |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `string`
|
||||
|
||||
___
|
||||
<a id="encodeobject"></a>
|
||||
|
||||
### encodeObject
|
||||
|
||||
▸ **encodeObject**(self: *[RpcCoderState](#rpccoderstate)*, method: *`string`*, params: *`Array`<`any`>*): [JsonRpcRequest](#jsonrpcrequest)
|
||||
|
||||
*Defined in [coder/json/encodeObject.ts:8](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/encodeObject.ts#L8)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](#rpccoderstate) |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** [JsonRpcRequest](#jsonrpcrequest)
|
||||
|
||||
___
|
||||
<a id="mockprovider"></a>
|
||||
|
||||
### mockProvider
|
||||
|
||||
▸ **mockProvider**(): [ProviderInterface](interfaces/providerinterface.md)
|
||||
|
||||
*Defined in [mock/index.ts:18](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/index.ts#L18)*
|
||||
|
||||
A moock provider mainly used for testing.
|
||||
|
||||
**Returns:** [ProviderInterface](interfaces/providerinterface.md)
|
||||
The mock provider
|
||||
|
||||
___
|
||||
<a id="mocks"></a>
|
||||
|
||||
### mocks
|
||||
|
||||
▸ **mocks**(__namedParameters: *`object`*): `void`
|
||||
|
||||
*Defined in [mock/mocks.ts:68](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/mocks.ts#L68)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
### on
|
||||
|
||||
▸ **on**(self: *[MockState](#mockstate)*, type: *[ProviderInterface$Emitted](#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](#providerinterface_emitcb)*): `void`
|
||||
|
||||
*Defined in [mock/on.ts:8](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/on.ts#L8)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](#mockstate) |
|
||||
| type | [ProviderInterface$Emitted](#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](#providerinterface_emitcb) |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="rpccoder"></a>
|
||||
|
||||
### rpcCoder
|
||||
|
||||
▸ **rpcCoder**(): [RpcCoder](#rpccoder)
|
||||
|
||||
*Defined in [coder/json/index.ts:12](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/index.ts#L12)*
|
||||
|
||||
**Returns:** [RpcCoder](#rpccoder)
|
||||
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
### send
|
||||
|
||||
▸ **send**(__namedParameters: *`object`*, method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Defined in [mock/send.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/send.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
___
|
||||
<a id="state"></a>
|
||||
|
||||
### state
|
||||
|
||||
▸ **state**(): [MockState](#mockstate)
|
||||
|
||||
*Defined in [mock/state.ts:38](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/state.ts#L38)*
|
||||
|
||||
**Returns:** [MockState](#mockstate)
|
||||
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
### subscribe
|
||||
|
||||
▸ **subscribe**(self: *[MockState](#mockstate)*, type: *`string`*, method: *`string`*, params: *`Array`<`any`>*): `Promise`<`number`>
|
||||
|
||||
*Defined in [mock/subscribe.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/subscribe.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](#mockstate) |
|
||||
| type | `string` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
### unsubscribe
|
||||
|
||||
▸ **unsubscribe**(self: *[MockState](#mockstate)*, type: *`string`*, name: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Defined in [mock/unsubscribe.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/unsubscribe.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](#mockstate) |
|
||||
| type | `string` |
|
||||
| name | `string` |
|
||||
| id | `number` |
|
||||
|
||||
**Returns:** `Promise`<`boolean`>
|
||||
|
||||
___
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
* ["coder/json/decodeResponse"](modules/_coder_json_decoderesponse_.md)
|
||||
* ["coder/json/encodeJson"](modules/_coder_json_encodejson_.md)
|
||||
* ["coder/json/encodeObject"](modules/_coder_json_encodeobject_.md)
|
||||
* ["coder/json/index"](modules/_coder_json_index_.md)
|
||||
* ["coder/json/types.d"](modules/_coder_json_types_d_.md)
|
||||
* ["http/index"](modules/_http_index_.md)
|
||||
* [HttpProvider](classes/_http_index_.httpprovider.md)
|
||||
* ["http/polyfill"](modules/_http_polyfill_.md)
|
||||
* ["http/types.d"](modules/_http_types_d_.md)
|
||||
* ["index"](modules/_index_.md)
|
||||
* ["mock/index"](modules/_mock_index_.md)
|
||||
* ["mock/mocks"](modules/_mock_mocks_.md)
|
||||
* ["mock/on"](modules/_mock_on_.md)
|
||||
* ["mock/send"](modules/_mock_send_.md)
|
||||
* ["mock/state"](modules/_mock_state_.md)
|
||||
* ["mock/subscribe"](modules/_mock_subscribe_.md)
|
||||
* ["mock/types.d"](modules/_mock_types_d_.md)
|
||||
* ["mock/unsubscribe"](modules/_mock_unsubscribe_.md)
|
||||
* ["types.d"](modules/_types_d_.md)
|
||||
* [ProviderInterface](interfaces/_types_d_.providerinterface.md)
|
||||
* ["ws/index"](modules/_ws_index_.md)
|
||||
* [WsProvider](classes/_ws_index_.wsprovider.md)
|
||||
* ["ws/polyfill"](modules/_ws_polyfill_.md)
|
||||
@@ -0,0 +1,615 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>HttpProvider · 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-highlight/website.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="_ws_index_.wsprovider.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../" />
|
||||
|
||||
|
||||
</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/_index_.api.html">
|
||||
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.3.1" data-path="_http_index_.httpprovider.html">
|
||||
|
||||
<a href="_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
|
||||
api-rx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../examples/">
|
||||
|
||||
<a href="../../examples/">
|
||||
|
||||
|
||||
Overview
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../examples/01_simple_connect/">
|
||||
|
||||
<a href="../../examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../../examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../examples/04_generate_account/">
|
||||
|
||||
<a href="../../examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../examples/05_read_storage/">
|
||||
|
||||
<a href="../../examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../../examples/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../../examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</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="../.." >HttpProvider</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">
|
||||
|
||||
<p>The HTTP Provider allows sending requests using HTTP. it does not support subscriptions so you won´t be able to listen to events such as new blocks or balance changes. It is usually preferrable using the <a href="_ws_index_.wsprovider.html">WsProvider</a>.
|
||||
<em><strong>example</strong></em>: <code>javascript
|
||||
import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
const provider = new WsProvider('http://127.0.0.1:9933');
|
||||
const api = createApi(provider);</code></p>
|
||||
<p><em><strong>see</strong></em>: <a href="_ws_index_.wsprovider.html">WsProvider</a></p>
|
||||
<h1 id="hierarchy">Hierarchy</h1>
|
||||
<p><strong>HttpProvider</strong></p>
|
||||
<h1 id="implements">Implements</h1>
|
||||
<ul>
|
||||
<li><a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a></li>
|
||||
</ul>
|
||||
<h1 id="constructors">Constructors</h1>
|
||||
<p><a id="constructor"></a></p>
|
||||
<h2 id="constructor">constructor</h2>
|
||||
<p>⊕ <strong>new HttpProvider</strong>(endpoint: <em><code>string</code></em>): <a href="_http_index_.httpprovider.html">HttpProvider</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L35" target="_blank">http/index.ts:35</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>endpoint</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <a href="_http_index_.httpprovider.html">HttpProvider</a></p>
|
||||
<hr>
|
||||
<h1 id="methods">Methods</h1>
|
||||
<p><a id="isconnected"></a></p>
|
||||
<h2 id="isconnected">isConnected</h2>
|
||||
<p>▸ <strong>isConnected</strong>(): <code>boolean</code></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#isconnected">isConnected</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L49" target="_blank">http/index.ts:49</a></em></p>
|
||||
<p>Whether the node is connected or not.</p>
|
||||
<p><strong>Returns:</strong> <code>boolean</code>
|
||||
true if connected</p>
|
||||
<hr>
|
||||
<p><a id="on"></a></p>
|
||||
<h2 id="on">on</h2>
|
||||
<p>▸ <strong>on</strong>(type: <em><a href="../modules/_types_d_.md#providerinterface_emitted">ProviderInterface$Emitted</a></em>, sub: <em><a href="../modules/_types_d_.md#providerinterface_emitcb">ProviderInterface$EmitCb</a></em>): <code>void</code></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#on">on</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L56" target="_blank">http/index.ts:56</a></em></p>
|
||||
<p>Events are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><a href="../modules/_types_d_.md#providerinterface_emitted">ProviderInterface$Emitted</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sub</td>
|
||||
<td><a href="../modules/_types_d_.md#providerinterface_emitcb">ProviderInterface$EmitCb</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="send"></a></p>
|
||||
<h2 id="send">send</h2>
|
||||
<p>▸ <strong>send</strong>(method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>Promise</code><<code>any</code>></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#send">send</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L60" target="_blank">http/index.ts:60</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>any</code>></p>
|
||||
<hr>
|
||||
<p><a id="subscribe"></a></p>
|
||||
<h2 id="subscribe">subscribe</h2>
|
||||
<p>▸ <strong>subscribe</strong>(types: <em><code>string</code></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>, cb: <em><a href="../modules/_types_d_.md#providerinterface_callback">ProviderInterface$Callback</a></em>): <code>Promise</code><<code>number</code>></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#subscribe">subscribe</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L82" target="_blank">http/index.ts:82</a></em></p>
|
||||
<p>Subscriptions are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>types</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cb</td>
|
||||
<td><a href="../modules/_types_d_.md#providerinterface_callback">ProviderInterface$Callback</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>number</code>></p>
|
||||
<hr>
|
||||
<p><a id="unsubscribe"></a></p>
|
||||
<h2 id="unsubscribe">unsubscribe</h2>
|
||||
<p>▸ <strong>unsubscribe</strong>(type: <em><code>string</code></em>, method: <em><code>string</code></em>, id: <em><code>number</code></em>): <code>Promise</code><<code>boolean</code>></p>
|
||||
<p><em>Implementation of <a href="../interfaces/_types_d_.providerinterface.md">ProviderInterface</a>.<a href="../interfaces/_types_d_.providerinterface.md#unsubscribe">unsubscribe</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L91" target="_blank">http/index.ts:91</a></em></p>
|
||||
<p>Subscriptions are not supported with the HttpProvider, see <a href="_ws_index_.wsprovider.html">WsProvider</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>id</td>
|
||||
<td><code>number</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>boolean</code>></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</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="../" class="navigation navigation-prev " aria-label="Previous page: api-provider">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="_ws_index_.wsprovider.html" class="navigation navigation-next " aria-label="Next page: WsProvider">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"HttpProvider","level":"1.3.1","depth":2,"next":{"title":"WsProvider","level":"1.3.2","depth":2,"path":"api-provider/classes/_ws_index_.wsprovider.md","ref":"api-provider/classes/_ws_index_.wsprovider.md","articles":[]},"previous":{"title":"api-provider","level":"1.3","depth":1,"path":"api-provider/README.md","ref":"api-provider/README.md","articles":[{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},{"title":"WsProvider","level":"1.3.2","depth":2,"path":"api-provider/classes/_ws_index_.wsprovider.md","ref":"api-provider/classes/_ws_index_.wsprovider.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/classes/_http_index_.httpprovider.md","mtime":"2018-09-19T11:17:52.197Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook.js"></script>
|
||||
<script src="../../gitbook/theme.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>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
|
||||
|
||||
The HTTP Provider allows sending requests using HTTP. it does not support subscriptions so you won´t be able to listen to events such as new blocks or balance changes. It is usually preferrable using the [WsProvider](_ws_index_.wsprovider.md).
|
||||
*__example__*: ```javascript
|
||||
import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
const provider = new WsProvider('http://127.0.0.1:9933');
|
||||
const api = createApi(provider);
|
||||
```
|
||||
|
||||
*__see__*: [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**HttpProvider**
|
||||
|
||||
# Implements
|
||||
|
||||
* [ProviderInterface](../interfaces/_types_d_.providerinterface.md)
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new HttpProvider**(endpoint: *`string`*): [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
*Defined in [http/index.ts:35](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L35)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| endpoint | `string` |
|
||||
|
||||
**Returns:** [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="isconnected"></a>
|
||||
|
||||
## isConnected
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[isConnected](../interfaces/_types_d_.providerinterface.md#isconnected)*
|
||||
|
||||
*Defined in [http/index.ts:49](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L49)*
|
||||
|
||||
Whether the node is connected or not.
|
||||
|
||||
**Returns:** `boolean`
|
||||
true if connected
|
||||
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
## on
|
||||
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb)*): `void`
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[on](../interfaces/_types_d_.providerinterface.md#on)*
|
||||
|
||||
*Defined in [http/index.ts:56](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L56)*
|
||||
|
||||
Events are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | [ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb) |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
## send
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[send](../interfaces/_types_d_.providerinterface.md#send)*
|
||||
|
||||
*Defined in [http/index.ts:60](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L60)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
## subscribe
|
||||
|
||||
▸ **subscribe**(types: *`string`*, method: *`string`*, params: *`Array`<`any`>*, cb: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[subscribe](../interfaces/_types_d_.providerinterface.md#subscribe)*
|
||||
|
||||
*Defined in [http/index.ts:82](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L82)*
|
||||
|
||||
Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| types | `string` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
| cb | [ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback) |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
## unsubscribe
|
||||
|
||||
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/_types_d_.providerinterface.md).[unsubscribe](../interfaces/_types_d_.providerinterface.md#unsubscribe)*
|
||||
|
||||
*Defined in [http/index.ts:91](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/index.ts#L91)*
|
||||
|
||||
Subscriptions are not supported with the HttpProvider, see [WsProvider](_ws_index_.wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | `string` |
|
||||
| method | `string` |
|
||||
| id | `number` |
|
||||
|
||||
**Returns:** `Promise`<`boolean`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,857 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>WsProvider · 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-highlight/website.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="../../api-rx/" />
|
||||
|
||||
|
||||
<link rel="prev" href="_http_index_.httpprovider.html" />
|
||||
|
||||
|
||||
</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/_index_.api.html">
|
||||
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="_http_index_.httpprovider.html">
|
||||
|
||||
<a href="_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.3.2" data-path="_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
|
||||
api-rx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../examples/">
|
||||
|
||||
<a href="../../examples/">
|
||||
|
||||
|
||||
Overview
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../examples/01_simple_connect/">
|
||||
|
||||
<a href="../../examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../../examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../examples/04_generate_account/">
|
||||
|
||||
<a href="../../examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../examples/05_read_storage/">
|
||||
|
||||
<a href="../../examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../../examples/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../../examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</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="../.." >WsProvider</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">
|
||||
|
||||
<p>The WebSocket Provider allows sending requests using WebSocket. Unlike the <a href="_http_index_.httpprovider.html">HttpProvider</a>, it does support subscriptions and allows listening to events such as new blocks or balance changes.</p>
|
||||
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> createApi <span class="hljs-keyword">from</span> <span class="hljs-string">'@polkadot/api'</span>;
|
||||
<span class="hljs-keyword">import</span> WsProvider <span class="hljs-keyword">from</span> <span class="hljs-string">'@polkadot/api-provider/ws'</span>;
|
||||
<span class="hljs-keyword">const</span> provider = <span class="hljs-keyword">new</span> WsProvider(<span class="hljs-string">'ws://127.0.0.1:9944'</span>);
|
||||
<span class="hljs-keyword">const</span> api = createApi(provider);
|
||||
</code></pre>
|
||||
<p><em><strong>example</strong></em>: ```javascript
|
||||
import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
const provider = new WsProvider('ws://127.0.0.1:9944');
|
||||
const api = createApi(provider);</p>
|
||||
<pre><code>
|
||||
*__see__*: [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
# Type parameters
|
||||
#### EventTypes : `string` &#124; `symbol`
|
||||
|
||||
# Hierarchy
|
||||
|
||||
`EventEmitter`
|
||||
|
||||
**↳ WsProvider**
|
||||
|
||||
# Implements
|
||||
|
||||
* `WSProviderInterface`
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new WsProvider**(endpoint: *`string`*, autoConnect?: *`boolean`*): [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
*Defined in [ws/index.ts:69](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L69)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value | Description |
|
||||
| ------ | ------ | ------ | ------ |
|
||||
| endpoint | `string` | - | The endpoint url. Usually \`ws://ip:9944\` or \`wss://ip:9944\` |
|
||||
| `Default value` autoConnect | `boolean` | true | Whether to connect automatically or not. |
|
||||
|
||||
**Returns:** [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
___
|
||||
|
||||
# Properties
|
||||
|
||||
<a id="prefixed"></a>
|
||||
|
||||
## `<Static>` prefixed
|
||||
|
||||
**● prefixed**: * `string` &#124; `boolean`
|
||||
*
|
||||
|
||||
*Inherited from EventEmitter.prefixed*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:6*
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="addlistener"></a>
|
||||
|
||||
## addListener
|
||||
|
||||
▸ **addListener**(event: *`EventTypes`*, fn: *`ListenerFn`*, context?: *`any`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.addListener*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:33*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| fn | `ListenerFn` |
|
||||
| `Optional` context | `any` |
|
||||
|
||||
**Returns:** `this`
|
||||
|
||||
___
|
||||
<a id="connect"></a>
|
||||
|
||||
## connect
|
||||
|
||||
▸ **connect**(): `void`
|
||||
|
||||
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L99)*
|
||||
|
||||
The [WsProvider](_ws_index_.wsprovider.md) connects automatically by default. if you decided otherwise, you may connect manually using this method.
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="emit"></a>
|
||||
|
||||
## emit
|
||||
|
||||
▸ **emit**(event: *`EventTypes`*, ...args: *`Array`<`any`>*): `boolean`
|
||||
|
||||
*Inherited from EventEmitter.emit*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:27*
|
||||
|
||||
Calls each of the listeners registered for a given event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| `Rest` args | `Array`<`any`> |
|
||||
|
||||
**Returns:** `boolean`
|
||||
|
||||
___
|
||||
<a id="eventnames"></a>
|
||||
|
||||
## eventNames
|
||||
|
||||
▸ **eventNames**(): `Array`<`EventTypes`>
|
||||
|
||||
*Inherited from EventEmitter.eventNames*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:12*
|
||||
|
||||
Return an array listing the events for which the emitter has registered listeners.
|
||||
|
||||
**Returns:** `Array`<`EventTypes`>
|
||||
|
||||
___
|
||||
<a id="isconnected"></a>
|
||||
|
||||
## isConnected
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L116)*
|
||||
|
||||
Whether the node is connected or not.
|
||||
|
||||
**Returns:** `boolean`
|
||||
true if connected
|
||||
|
||||
___
|
||||
<a id="listenercount"></a>
|
||||
|
||||
## listenerCount
|
||||
|
||||
▸ **listenerCount**(event: *`EventTypes`*): `number`
|
||||
|
||||
*Inherited from EventEmitter.listenerCount*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:22*
|
||||
|
||||
Return the number of listeners listening to a given event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
___
|
||||
<a id="listeners"></a>
|
||||
|
||||
## listeners
|
||||
|
||||
▸ **listeners**(event: *`EventTypes`*): `Array`<`ListenerFn`>
|
||||
|
||||
*Inherited from EventEmitter.listeners*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:17*
|
||||
|
||||
Return the listeners registered for a given event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
|
||||
**Returns:** `Array`<`ListenerFn`>
|
||||
|
||||
___
|
||||
<a id="off"></a>
|
||||
|
||||
## off
|
||||
|
||||
▸ **off**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` &#124; `false` &#124; `true`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.off*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:44*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` context | `any` |
|
||||
| `Optional` once | `undefined` &#124; `false` &#124; `true`|
|
||||
|
||||
**Returns:** `this`
|
||||
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
## on
|
||||
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb)*): `this`
|
||||
|
||||
*Overrides EventEmitter.on*
|
||||
|
||||
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L126)*
|
||||
|
||||
Listens on events after having subscribed using the [subscribe](_ws_index_.wsprovider.md#subscribe) function.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Description |
|
||||
| ------ | ------ | ------ |
|
||||
| type | [ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted) | Event |
|
||||
| sub | [ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb) | Callback |
|
||||
|
||||
**Returns:** `this`
|
||||
[description]
|
||||
|
||||
___
|
||||
<a id="once"></a>
|
||||
|
||||
## once
|
||||
|
||||
▸ **once**(event: *`EventTypes`*, fn: *`ListenerFn`*, context?: *`any`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.once*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:38*
|
||||
|
||||
Add a one-time listener for a given event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| fn | `ListenerFn` |
|
||||
| `Optional` context | `any` |
|
||||
|
||||
**Returns:** `this`
|
||||
|
||||
___
|
||||
<a id="removealllisteners"></a>
|
||||
|
||||
## removeAllListeners
|
||||
|
||||
▸ **removeAllListeners**(event?: *[EventTypes]()*): `this`
|
||||
|
||||
*Inherited from EventEmitter.removeAllListeners*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:49*
|
||||
|
||||
Remove all listeners, or those of the specified event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Optional` event | [EventTypes]() |
|
||||
|
||||
**Returns:** `this`
|
||||
|
||||
___
|
||||
<a id="removelistener"></a>
|
||||
|
||||
## removeListener
|
||||
|
||||
▸ **removeListener**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` &#124; `false` &#124; `true`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.removeListener*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:43*
|
||||
|
||||
Remove the listeners of a given event.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` context | `any` |
|
||||
| `Optional` once | `undefined` &#124; `false` &#124; `true`|
|
||||
|
||||
**Returns:** `this`
|
||||
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
## send
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*, subscription?: *`SubscriptionHandler`*): `Promise`<`any`>
|
||||
|
||||
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L130)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
| `Optional` subscription | `SubscriptionHandler` |
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
## subscribe
|
||||
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, callback: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Defined in [ws/index.ts:182](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L182)*
|
||||
|
||||
Allows subscribing to a specific event.
|
||||
*__example__*: ```javascript
|
||||
const provider = new WsProvider('ws://127.0.0.1:9944')
|
||||
const api = createApi(provider)
|
||||
api.state.storage([[storage.staking.public.freeBalanceOf, <Address>]], (_, values) => {
|
||||
console.log(values)
|
||||
}).then((subscriptionId) => {
|
||||
console.log('balance changes subscription id: ', subscriptionId)
|
||||
})
|
||||
</code></pre><p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>string</code></td>
|
||||
<td>Subscription type</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
<td>Subscription method</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
<td>Parameters</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>callback</td>
|
||||
<td><a href="../modules/_types_d_.md#providerinterface_callback">ProviderInterface$Callback</a></td>
|
||||
<td>Callback</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>number</code>>
|
||||
Promise resolving to the dd of the subscription you can use with [[unsubscribe]]</p>
|
||||
<hr>
|
||||
<p><a id="unsubscribe"></a></p>
|
||||
<h2 id="unsubscribe">unsubscribe</h2>
|
||||
<p>▸ <strong>unsubscribe</strong>(type: <em><code>string</code></em>, method: <em><code>string</code></em>, id: <em><code>number</code></em>): <code>Promise</code><<code>boolean</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L191" target="_blank">ws/index.ts:191</a></em></p>
|
||||
<p>Allows unsubscribing to subscriptions made with <a href="_ws_index_.wsprovider.html#subscribe">subscribe</a>.</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>id</td>
|
||||
<td><code>number</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>boolean</code>></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</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="_http_index_.httpprovider.html" class="navigation navigation-prev " aria-label="Previous page: HttpProvider">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../../api-rx/" class="navigation navigation-next " aria-label="Next page: api-rx">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"WsProvider","level":"1.3.2","depth":2,"next":{"title":"api-rx","level":"1.4","depth":1,"path":"api-rx/README.md","ref":"api-rx/README.md","articles":[{"title":"ApiRx","level":"1.4.1","depth":2,"path":"api-rx/classes/_index_.rxapi.md","ref":"api-rx/classes/_index_.rxapi.md","articles":[]}]},"previous":{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/classes/_ws_index_.wsprovider.md","mtime":"2018-09-19T11:17:52.279Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook.js"></script>
|
||||
<script src="../../gitbook/theme.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>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+56
-92
@@ -1,8 +1,6 @@
|
||||
[Polkadot JS API](../README.md) > [WsProvider](../classes/wsprovider.md)
|
||||
|
||||
# Class: WsProvider
|
||||
|
||||
The WebSocket Provider allows sending requests using WebSocket. Unlike the [HttpProvider](httpprovider.md), it does support subscriptions and allows listening to events such as new blocks or balance changes.
|
||||
The WebSocket Provider allows sending requests using WebSocket. Unlike the [HttpProvider](_http_index_.httpprovider.md), it does support subscriptions and allows listening to events such as new blocks or balance changes.
|
||||
|
||||
```javascript
|
||||
import createApi from '@polkadot/api';
|
||||
@@ -17,64 +15,30 @@ const provider = new WsProvider('ws://127.0.0.1:9944');
|
||||
const api = createApi(provider);
|
||||
```
|
||||
|
||||
*__see__*: [HttpProvider](httpprovider.md)
|
||||
*__see__*: [HttpProvider](_http_index_.httpprovider.md)
|
||||
|
||||
## Type parameters
|
||||
# Type parameters
|
||||
#### EventTypes : `string` | `symbol`
|
||||
|
||||
## Hierarchy
|
||||
# Hierarchy
|
||||
|
||||
`EventEmitter`
|
||||
|
||||
**↳ WsProvider**
|
||||
|
||||
## Implements
|
||||
# Implements
|
||||
|
||||
* `WSProviderInterface`
|
||||
|
||||
## Index
|
||||
|
||||
### Modules
|
||||
|
||||
* [EventEmitter](../modules/wsprovider.eventemitter.md)
|
||||
|
||||
### Constructors
|
||||
|
||||
* [constructor](wsprovider.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
* [prefixed](wsprovider.md#prefixed)
|
||||
|
||||
### Methods
|
||||
|
||||
* [addListener](wsprovider.md#addlistener)
|
||||
* [connect](wsprovider.md#connect)
|
||||
* [emit](wsprovider.md#emit)
|
||||
* [eventNames](wsprovider.md#eventnames)
|
||||
* [isConnected](wsprovider.md#isconnected)
|
||||
* [listenerCount](wsprovider.md#listenercount)
|
||||
* [listeners](wsprovider.md#listeners)
|
||||
* [off](wsprovider.md#off)
|
||||
* [on](wsprovider.md#on)
|
||||
* [once](wsprovider.md#once)
|
||||
* [removeAllListeners](wsprovider.md#removealllisteners)
|
||||
* [removeListener](wsprovider.md#removelistener)
|
||||
* [send](wsprovider.md#send)
|
||||
* [subscribe](wsprovider.md#subscribe)
|
||||
* [unsubscribe](wsprovider.md#unsubscribe)
|
||||
|
||||
---
|
||||
|
||||
## Constructors
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
### constructor
|
||||
## constructor
|
||||
|
||||
⊕ **new WsProvider**(endpoint: *`string`*, autoConnect?: *`boolean`*): [WsProvider](wsprovider.md)
|
||||
⊕ **new WsProvider**(endpoint: *`string`*, autoConnect?: *`boolean`*): [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
*Defined in [ws/index.ts:69](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L69)*
|
||||
*Defined in [ws/index.ts:69](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L69)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -83,36 +47,36 @@ const api = createApi(provider);
|
||||
| endpoint | `string` | - | The endpoint url. Usually \`ws://ip:9944\` or \`wss://ip:9944\` |
|
||||
| `Default value` autoConnect | `boolean` | true | Whether to connect automatically or not. |
|
||||
|
||||
**Returns:** [WsProvider](wsprovider.md)
|
||||
**Returns:** [WsProvider](_ws_index_.wsprovider.md)
|
||||
|
||||
___
|
||||
|
||||
## Properties
|
||||
# Properties
|
||||
|
||||
<a id="prefixed"></a>
|
||||
|
||||
### `<Static>` prefixed
|
||||
## `<Static>` prefixed
|
||||
|
||||
**● prefixed**: * `string` | `boolean`
|
||||
*
|
||||
|
||||
*Inherited from EventEmitter.prefixed*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:6*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:6*
|
||||
|
||||
___
|
||||
|
||||
## Methods
|
||||
# Methods
|
||||
|
||||
<a id="addlistener"></a>
|
||||
|
||||
### addListener
|
||||
## addListener
|
||||
|
||||
▸ **addListener**(event: *`EventTypes`*, fn: *`ListenerFn`*, context?: *`any`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.addListener*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:33*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:33*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -127,26 +91,26 @@ ___
|
||||
___
|
||||
<a id="connect"></a>
|
||||
|
||||
### connect
|
||||
## connect
|
||||
|
||||
▸ **connect**(): `void`
|
||||
|
||||
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L99)*
|
||||
*Defined in [ws/index.ts:99](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L99)*
|
||||
|
||||
The [WsProvider](wsprovider.md) connects automatically by default. if you decided otherwise, you may connect manually using this method.
|
||||
The [WsProvider](_ws_index_.wsprovider.md) connects automatically by default. if you decided otherwise, you may connect manually using this method.
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="emit"></a>
|
||||
|
||||
### emit
|
||||
## emit
|
||||
|
||||
▸ **emit**(event: *`EventTypes`*, ...args: *`Array`<`any`>*): `boolean`
|
||||
|
||||
*Inherited from EventEmitter.emit*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:27*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:27*
|
||||
|
||||
Calls each of the listeners registered for a given event.
|
||||
|
||||
@@ -162,13 +126,13 @@ Calls each of the listeners registered for a given event.
|
||||
___
|
||||
<a id="eventnames"></a>
|
||||
|
||||
### eventNames
|
||||
## eventNames
|
||||
|
||||
▸ **eventNames**(): `Array`<`EventTypes`>
|
||||
|
||||
*Inherited from EventEmitter.eventNames*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:12*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:12*
|
||||
|
||||
Return an array listing the events for which the emitter has registered listeners.
|
||||
|
||||
@@ -177,11 +141,11 @@ Return an array listing the events for which the emitter has registered listener
|
||||
___
|
||||
<a id="isconnected"></a>
|
||||
|
||||
### isConnected
|
||||
## isConnected
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L116)*
|
||||
*Defined in [ws/index.ts:116](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L116)*
|
||||
|
||||
Whether the node is connected or not.
|
||||
|
||||
@@ -191,13 +155,13 @@ true if connected
|
||||
___
|
||||
<a id="listenercount"></a>
|
||||
|
||||
### listenerCount
|
||||
## listenerCount
|
||||
|
||||
▸ **listenerCount**(event: *`EventTypes`*): `number`
|
||||
|
||||
*Inherited from EventEmitter.listenerCount*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:22*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:22*
|
||||
|
||||
Return the number of listeners listening to a given event.
|
||||
|
||||
@@ -212,13 +176,13 @@ Return the number of listeners listening to a given event.
|
||||
___
|
||||
<a id="listeners"></a>
|
||||
|
||||
### listeners
|
||||
## listeners
|
||||
|
||||
▸ **listeners**(event: *`EventTypes`*): `Array`<`ListenerFn`>
|
||||
|
||||
*Inherited from EventEmitter.listeners*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:17*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:17*
|
||||
|
||||
Return the listeners registered for a given event.
|
||||
|
||||
@@ -233,20 +197,20 @@ Return the listeners registered for a given event.
|
||||
___
|
||||
<a id="off"></a>
|
||||
|
||||
### off
|
||||
## off
|
||||
|
||||
▸ **off**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` | `false` | `true`*): `this`
|
||||
▸ **off**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` | `false` | `true`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.off*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:44*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:44*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` context | `any` |
|
||||
| `Optional` once | `undefined` | `false` | `true`|
|
||||
|
||||
@@ -255,22 +219,22 @@ ___
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
### on
|
||||
## on
|
||||
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../#providerinterface_emitcb)*): `this`
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb)*): `this`
|
||||
|
||||
*Overrides EventEmitter.on*
|
||||
|
||||
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L126)*
|
||||
*Defined in [ws/index.ts:126](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L126)*
|
||||
|
||||
Listens on events after having subscribed using the [subscribe](wsprovider.md#subscribe) function.
|
||||
Listens on events after having subscribed using the [subscribe](_ws_index_.wsprovider.md#subscribe) function.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Description |
|
||||
| ------ | ------ | ------ |
|
||||
| type | [ProviderInterface$Emitted](../#providerinterface_emitted) | Event |
|
||||
| sub | [ProviderInterface$EmitCb](../#providerinterface_emitcb) | Callback |
|
||||
| type | [ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted) | Event |
|
||||
| sub | [ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb) | Callback |
|
||||
|
||||
**Returns:** `this`
|
||||
[description]
|
||||
@@ -278,13 +242,13 @@ Listens on events after having subscribed using the [subscribe](wsprovider.md#su
|
||||
___
|
||||
<a id="once"></a>
|
||||
|
||||
### once
|
||||
## once
|
||||
|
||||
▸ **once**(event: *`EventTypes`*, fn: *`ListenerFn`*, context?: *`any`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.once*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:38*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:38*
|
||||
|
||||
Add a one-time listener for a given event.
|
||||
|
||||
@@ -301,13 +265,13 @@ Add a one-time listener for a given event.
|
||||
___
|
||||
<a id="removealllisteners"></a>
|
||||
|
||||
### removeAllListeners
|
||||
## removeAllListeners
|
||||
|
||||
▸ **removeAllListeners**(event?: *[EventTypes]()*): `this`
|
||||
|
||||
*Inherited from EventEmitter.removeAllListeners*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:49*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:49*
|
||||
|
||||
Remove all listeners, or those of the specified event.
|
||||
|
||||
@@ -322,13 +286,13 @@ Remove all listeners, or those of the specified event.
|
||||
___
|
||||
<a id="removelistener"></a>
|
||||
|
||||
### removeListener
|
||||
## removeListener
|
||||
|
||||
▸ **removeListener**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` | `false` | `true`*): `this`
|
||||
▸ **removeListener**(event: *`EventTypes`*, fn?: *[ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)*, context?: *`any`*, once?: * `undefined` | `false` | `true`*): `this`
|
||||
|
||||
*Inherited from EventEmitter.removeListener*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:43*
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:43*
|
||||
|
||||
Remove the listeners of a given event.
|
||||
|
||||
@@ -337,7 +301,7 @@ Remove the listeners of a given event.
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| event | `EventTypes` |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` fn | [ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md) |
|
||||
| `Optional` context | `any` |
|
||||
| `Optional` once | `undefined` | `false` | `true`|
|
||||
|
||||
@@ -346,11 +310,11 @@ Remove the listeners of a given event.
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
### send
|
||||
## send
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*, subscription?: *`SubscriptionHandler`*): `Promise`<`any`>
|
||||
|
||||
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L130)*
|
||||
*Defined in [ws/index.ts:130](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L130)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -365,11 +329,11 @@ ___
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
### subscribe
|
||||
## subscribe
|
||||
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, callback: *[ProviderInterface$Callback](../#providerinterface_callback)*): `Promise`<`number`>
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, callback: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Defined in [ws/index.ts:182](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L182)*
|
||||
*Defined in [ws/index.ts:182](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L182)*
|
||||
|
||||
Allows subscribing to a specific event.
|
||||
*__example__*: ```javascript
|
||||
@@ -389,7 +353,7 @@ api.state.storage([[storage.staking.public.freeBalanceOf, <Address>]], (_, value
|
||||
| type | `string` | Subscription type |
|
||||
| method | `string` | Subscription method |
|
||||
| params | `Array`<`any`> | Parameters |
|
||||
| callback | [ProviderInterface$Callback](../#providerinterface_callback) | Callback |
|
||||
| callback | [ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback) | Callback |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
Promise resolving to the dd of the subscription you can use with [[unsubscribe]]
|
||||
@@ -397,13 +361,13 @@ Promise resolving to the dd of the subscription you can use with [[unsubscribe]]
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
### unsubscribe
|
||||
## unsubscribe
|
||||
|
||||
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Defined in [ws/index.ts:191](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/ws/index.ts#L191)*
|
||||
*Defined in [ws/index.ts:191](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/ws/index.ts#L191)*
|
||||
|
||||
Allows unsubscribing to subscriptions made with [subscribe](wsprovider.md#subscribe).
|
||||
Allows unsubscribing to subscriptions made with [subscribe](_ws_index_.wsprovider.md#subscribe).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
[Polkadot JS API](../README.md) > [HttpProvider](../classes/httpprovider.md)
|
||||
|
||||
# Class: HttpProvider
|
||||
|
||||
The HTTP Provider allows sending requests using HTTP. it does not support subscriptions so you won´t be able to listen to events such as new blocks or balance changes. It is usually preferrable using the [WsProvider](wsprovider.md).
|
||||
*__example__*: ```javascript
|
||||
import createApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
const provider = new WsProvider('http://127.0.0.1:9933');
|
||||
const api = createApi(provider);
|
||||
```
|
||||
|
||||
*__see__*: [WsProvider](wsprovider.md)
|
||||
|
||||
## Hierarchy
|
||||
|
||||
**HttpProvider**
|
||||
|
||||
## Implements
|
||||
|
||||
* [ProviderInterface](../interfaces/providerinterface.md)
|
||||
|
||||
## Index
|
||||
|
||||
### Constructors
|
||||
|
||||
* [constructor](httpprovider.md#constructor)
|
||||
|
||||
### Methods
|
||||
|
||||
* [isConnected](httpprovider.md#isconnected)
|
||||
* [on](httpprovider.md#on)
|
||||
* [send](httpprovider.md#send)
|
||||
* [subscribe](httpprovider.md#subscribe)
|
||||
* [unsubscribe](httpprovider.md#unsubscribe)
|
||||
|
||||
---
|
||||
|
||||
## Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
### constructor
|
||||
|
||||
⊕ **new HttpProvider**(endpoint: *`string`*): [HttpProvider](httpprovider.md)
|
||||
|
||||
*Defined in [http/index.ts:35](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L35)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| endpoint | `string` |
|
||||
|
||||
**Returns:** [HttpProvider](httpprovider.md)
|
||||
|
||||
___
|
||||
|
||||
## Methods
|
||||
|
||||
<a id="isconnected"></a>
|
||||
|
||||
### isConnected
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/providerinterface.md).[isConnected](../interfaces/providerinterface.md#isconnected)*
|
||||
|
||||
*Defined in [http/index.ts:49](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L49)*
|
||||
|
||||
Whether the node is connected or not.
|
||||
|
||||
**Returns:** `boolean`
|
||||
true if connected
|
||||
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
### on
|
||||
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../#providerinterface_emitcb)*): `void`
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/providerinterface.md).[on](../interfaces/providerinterface.md#on)*
|
||||
|
||||
*Defined in [http/index.ts:56](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L56)*
|
||||
|
||||
Events are not supported with the HttpProvider, see [WsProvider](wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | [ProviderInterface$Emitted](../#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](../#providerinterface_emitcb) |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
### send
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/providerinterface.md).[send](../interfaces/providerinterface.md#send)*
|
||||
|
||||
*Defined in [http/index.ts:60](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L60)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
### subscribe
|
||||
|
||||
▸ **subscribe**(types: *`string`*, method: *`string`*, params: *`Array`<`any`>*, cb: *[ProviderInterface$Callback](../#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/providerinterface.md).[subscribe](../interfaces/providerinterface.md#subscribe)*
|
||||
|
||||
*Defined in [http/index.ts:82](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L82)*
|
||||
|
||||
Subscriptions are not supported with the HttpProvider, see [WsProvider](wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| types | `string` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
| cb | [ProviderInterface$Callback](../#providerinterface_callback) |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
### unsubscribe
|
||||
|
||||
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Implementation of [ProviderInterface](../interfaces/providerinterface.md).[unsubscribe](../interfaces/providerinterface.md#unsubscribe)*
|
||||
|
||||
*Defined in [http/index.ts:91](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/index.ts#L91)*
|
||||
|
||||
Subscriptions are not supported with the HttpProvider, see [WsProvider](wsprovider.md).
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | `string` |
|
||||
| method | `string` |
|
||||
| id | `number` |
|
||||
|
||||
**Returns:** `Promise`<`boolean`>
|
||||
|
||||
___
|
||||
|
||||
+65
-570
@@ -57,10 +57,10 @@
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../api-rx/" />
|
||||
<link rel="next" href="classes/_http_index_.httpprovider.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../api-format/" />
|
||||
<link rel="prev" href="../api/classes/_index_.api.html" />
|
||||
|
||||
|
||||
</head>
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../api/">
|
||||
|
||||
<a href="../api/">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../api-format/">
|
||||
<a href="../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="2.3" data-path="./">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.3" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../api-rx/">
|
||||
|
||||
<a href="../api-rx/">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../type-extrinsics/">
|
||||
<a href="../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../type-jsonrpc/">
|
||||
|
||||
<a href="../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../type-params/">
|
||||
|
||||
<a href="../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../type-primitives/">
|
||||
|
||||
<a href="../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../type-storage/">
|
||||
|
||||
<a href="../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../examples/">
|
||||
<li class="chapter " data-level="2.1" data-path="../examples/">
|
||||
|
||||
<a href="../examples/">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../examples/01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="../examples/01_simple_connect/">
|
||||
|
||||
<a href="../examples/01_simple_connect/">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../examples/02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../examples/02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../examples/03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../examples/04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="../examples/04_generate_account/">
|
||||
|
||||
<a href="../examples/04_generate_account/">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../examples/05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="../examples/05_read_storage/">
|
||||
|
||||
<a href="../examples/05_read_storage/">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../examples/06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../examples/06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../examples/07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../examples/07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../CONTRIBUTING.html">
|
||||
|
||||
<a href="../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -418,476 +383,6 @@
|
||||
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'clientVersion'</span>, version);
|
||||
</code></pre>
|
||||
<h2 id="index">Index</h2>
|
||||
<h3 id="classes">Classes</h3>
|
||||
<ul>
|
||||
<li><a href="classes/httpprovider.md">HttpProvider</a></li>
|
||||
<li><a href="classes/wsprovider.md">WsProvider</a></li>
|
||||
</ul>
|
||||
<h3 id="interfaces">Interfaces</h3>
|
||||
<ul>
|
||||
<li><a href="interfaces/providerinterface.md">ProviderInterface</a></li>
|
||||
</ul>
|
||||
<h3 id="type-aliases">Type aliases</h3>
|
||||
<ul>
|
||||
<li><a href="#httpstate">HttpState</a></li>
|
||||
<li><a href="#jsonrpcobject">JsonRpcObject</a></li>
|
||||
<li><a href="#jsonrpcrequest">JsonRpcRequest</a></li>
|
||||
<li><a href="#jsonrpcresponse">JsonRpcResponse</a></li>
|
||||
<li><a href="#jsonrpcresponsebase">JsonRpcResponseBase</a></li>
|
||||
<li><a href="#jsonrpcresponsebase_error">JsonRpcResponseBase$Error</a></li>
|
||||
<li><a href="#mockstate">MockState</a></li>
|
||||
<li><a href="#mockstate_requests">MockState$Requests</a></li>
|
||||
<li><a href="#mockstate_storage">MockState$Storage</a></li>
|
||||
<li><a href="#mockstate_subscription_callback">MockState$Subscription$Callback</a></li>
|
||||
<li><a href="#mockstate_subscriptions">MockState$Subscriptions</a></li>
|
||||
<li><a href="#providerinterface_callback">ProviderInterface$Callback</a></li>
|
||||
<li><a href="#providerinterface_emitcb">ProviderInterface$EmitCb</a></li>
|
||||
<li><a href="#providerinterface_emitted">ProviderInterface$Emitted</a></li>
|
||||
<li><a href="#rpccoder">RpcCoder</a></li>
|
||||
<li><a href="#rpccoderstate">RpcCoderState</a></li>
|
||||
</ul>
|
||||
<h3 id="functions">Functions</h3>
|
||||
<ul>
|
||||
<li><a href="#decoderesponse">decodeResponse</a></li>
|
||||
<li><a href="#encodejson">encodeJson</a></li>
|
||||
<li><a href="#encodeobject">encodeObject</a></li>
|
||||
<li><a href="#mockprovider">mockProvider</a></li>
|
||||
<li><a href="#mocks">mocks</a></li>
|
||||
<li><a href="#on">on</a></li>
|
||||
<li><a href="#rpccoder">rpcCoder</a></li>
|
||||
<li><a href="#send">send</a></li>
|
||||
<li><a href="#state">state</a></li>
|
||||
<li><a href="#subscribe">subscribe</a></li>
|
||||
<li><a href="#unsubscribe">unsubscribe</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2 id="type-aliases">Type aliases</h2>
|
||||
<p><a id="httpstate"></a></p>
|
||||
<h3 id="httpstate">HttpState</h3>
|
||||
<p><strong>Ƭ HttpState</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/http/types.d.ts#L8" target="_blank">http/types.d.ts:8</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="jsonrpcobject"></a></p>
|
||||
<h3 id="jsonrpcobject">JsonRpcObject</h3>
|
||||
<p><strong>Ƭ JsonRpcObject</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L5" target="_blank">types.d.ts:5</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="jsonrpcrequest"></a></p>
|
||||
<h3 id="jsonrpcrequest">JsonRpcRequest</h3>
|
||||
<p><strong>Ƭ JsonRpcRequest</strong>: <em> <a href="#jsonrpcobject">JsonRpcObject</a> & <code>object</code>
|
||||
</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L10" target="_blank">types.d.ts:10</a></em></p>
|
||||
<hr>
|
||||
<p><a id="jsonrpcresponse"></a></p>
|
||||
<h3 id="jsonrpcresponse">JsonRpcResponse</h3>
|
||||
<p><strong>Ƭ JsonRpcResponse</strong>: <em> <a href="#jsonrpcobject">JsonRpcObject</a> & <a href="#jsonrpcresponsebase">JsonRpcResponseBase</a>
|
||||
</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L36" target="_blank">types.d.ts:36</a></em></p>
|
||||
<hr>
|
||||
<p><a id="jsonrpcresponsebase"></a></p>
|
||||
<h3 id="jsonrpcresponsebase">JsonRpcResponseBase</h3>
|
||||
<p><strong>Ƭ JsonRpcResponseBase</strong>: <em> <code>JsonRpcResponse$Single</code> & <code>JsonRpcResponse$Subscription</code>
|
||||
</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L34" target="_blank">types.d.ts:34</a></em></p>
|
||||
<hr>
|
||||
<p><a id="jsonrpcresponsebase_error"></a></p>
|
||||
<h3 id="jsonrpcresponsebaseerror">JsonRpcResponseBase$Error</h3>
|
||||
<p><strong>Ƭ JsonRpcResponseBase$Error</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L15" target="_blank">types.d.ts:15</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="mockstate"></a></p>
|
||||
<h3 id="mockstate">MockState</h3>
|
||||
<p><strong>Ƭ MockState</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L27" target="_blank">mock/types.d.ts:27</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="mockstate_requests"></a></p>
|
||||
<h3 id="mockstaterequests">MockState$Requests</h3>
|
||||
<p><strong>Ƭ MockState$Requests</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L23" target="_blank">mock/types.d.ts:23</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(storage: <em><a href="#mockstate_storage">MockState$Storage</a></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>string</code></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>storage</td>
|
||||
<td><a href="#mockstate_storage">MockState$Storage</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>string</code></p>
|
||||
<hr>
|
||||
<p><a id="mockstate_storage"></a></p>
|
||||
<h3 id="mockstatestorage">MockState$Storage</h3>
|
||||
<p><strong>Ƭ MockState$Storage</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L19" target="_blank">mock/types.d.ts:19</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="mockstate_subscription_callback"></a></p>
|
||||
<h3 id="mockstatesubscriptioncallback">MockState$Subscription$Callback</h3>
|
||||
<p><strong>Ƭ MockState$Subscription$Callback</strong>: <em><code>function</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L8" target="_blank">mock/types.d.ts:8</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(error: <em> <code>Error</code> | <code>null</code></em>, value: <em><code>any</code></em>): <code>void</code></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>error</td>
|
||||
<td><code>Error</code> | <code>null</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>value</td>
|
||||
<td><code>any</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="mockstate_subscriptions"></a></p>
|
||||
<h3 id="mockstatesubscriptions">MockState$Subscriptions</h3>
|
||||
<p><strong>Ƭ MockState$Subscriptions</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/types.d.ts#L10" target="_blank">mock/types.d.ts:10</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="providerinterface_callback"></a></p>
|
||||
<h3 id="providerinterfacecallback">ProviderInterface$Callback</h3>
|
||||
<p><strong>Ƭ ProviderInterface$Callback</strong>: <em><code>function</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L38" target="_blank">types.d.ts:38</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(error: <em> <code>Error</code> | <code>null</code></em>, result: <em><code>any</code></em>): <code>void</code></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>error</td>
|
||||
<td><code>Error</code> | <code>null</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>result</td>
|
||||
<td><code>any</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="providerinterface_emitcb"></a></p>
|
||||
<h3 id="providerinterfaceemitcb">ProviderInterface$EmitCb</h3>
|
||||
<p><strong>Ƭ ProviderInterface$EmitCb</strong>: <em><code>function</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L42" target="_blank">types.d.ts:42</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(value?: <em><code>any</code></em>): <code>any</code></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>Optional</code> value</td>
|
||||
<td><code>any</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>any</code></p>
|
||||
<hr>
|
||||
<p><a id="providerinterface_emitted"></a></p>
|
||||
<h3 id="providerinterfaceemitted">ProviderInterface$Emitted</h3>
|
||||
<p><strong>Ƭ ProviderInterface$Emitted</strong>: <em> "connected" | "disconnected"
|
||||
</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L40" target="_blank">types.d.ts:40</a></em></p>
|
||||
<hr>
|
||||
<p><a id="rpccoder"></a></p>
|
||||
<h3 id="rpccoder">RpcCoder</h3>
|
||||
<p><strong>Ƭ RpcCoder</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/types.d.ts#L7" target="_blank">coder/json/types.d.ts:7</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="rpccoderstate"></a></p>
|
||||
<h3 id="rpccoderstate">RpcCoderState</h3>
|
||||
<p><strong>Ƭ RpcCoderState</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/types.d.ts#L14" target="_blank">coder/json/types.d.ts:14</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<h2 id="functions">Functions</h2>
|
||||
<p><a id="decoderesponse"></a></p>
|
||||
<h3 id="decoderesponse">decodeResponse</h3>
|
||||
<p>▸ <strong>decodeResponse</strong>(self: <em><a href="#rpccoderstate">RpcCoderState</a></em>, response: <em><a href="#jsonrpcresponse">JsonRpcResponse</a></em>): <code>any</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/decodeResponse.ts#L22" target="_blank">coder/json/decodeResponse.ts:22</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#rpccoderstate">RpcCoderState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>response</td>
|
||||
<td><a href="#jsonrpcresponse">JsonRpcResponse</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>any</code></p>
|
||||
<hr>
|
||||
<p><a id="encodejson"></a></p>
|
||||
<h3 id="encodejson">encodeJson</h3>
|
||||
<p>▸ <strong>encodeJson</strong>(self: <em><a href="#rpccoderstate">RpcCoderState</a></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>string</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/encodeJson.ts#L9" target="_blank">coder/json/encodeJson.ts:9</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#rpccoderstate">RpcCoderState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>string</code></p>
|
||||
<hr>
|
||||
<p><a id="encodeobject"></a></p>
|
||||
<h3 id="encodeobject">encodeObject</h3>
|
||||
<p>▸ <strong>encodeObject</strong>(self: <em><a href="#rpccoderstate">RpcCoderState</a></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <a href="#jsonrpcrequest">JsonRpcRequest</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/encodeObject.ts#L8" target="_blank">coder/json/encodeObject.ts:8</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#rpccoderstate">RpcCoderState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <a href="#jsonrpcrequest">JsonRpcRequest</a></p>
|
||||
<hr>
|
||||
<p><a id="mockprovider"></a></p>
|
||||
<h3 id="mockprovider">mockProvider</h3>
|
||||
<p>▸ <strong>mockProvider</strong>(): <a href="interfaces/providerinterface.md">ProviderInterface</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/index.ts#L18" target="_blank">mock/index.ts:18</a></em></p>
|
||||
<p>A moock provider mainly used for testing.</p>
|
||||
<p><strong>Returns:</strong> <a href="interfaces/providerinterface.md">ProviderInterface</a>
|
||||
The mock provider</p>
|
||||
<hr>
|
||||
<p><a id="mocks"></a></p>
|
||||
<h3 id="mocks">mocks</h3>
|
||||
<p>▸ <strong>mocks</strong>(__namedParameters: <em><code>object</code></em>): <code>void</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/mocks.ts#L68" target="_blank">mock/mocks.ts:68</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>__namedParameters</td>
|
||||
<td><code>object</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="on"></a></p>
|
||||
<h3 id="on">on</h3>
|
||||
<p>▸ <strong>on</strong>(self: <em><a href="#mockstate">MockState</a></em>, type: <em><a href="#providerinterface_emitted">ProviderInterface$Emitted</a></em>, sub: <em><a href="#providerinterface_emitcb">ProviderInterface$EmitCb</a></em>): <code>void</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/on.ts#L8" target="_blank">mock/on.ts:8</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#mockstate">MockState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><a href="#providerinterface_emitted">ProviderInterface$Emitted</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sub</td>
|
||||
<td><a href="#providerinterface_emitcb">ProviderInterface$EmitCb</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>void</code></p>
|
||||
<hr>
|
||||
<p><a id="rpccoder"></a></p>
|
||||
<h3 id="rpccoder">rpcCoder</h3>
|
||||
<p>▸ <strong>rpcCoder</strong>(): <a href="#rpccoder">RpcCoder</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/coder/json/index.ts#L12" target="_blank">coder/json/index.ts:12</a></em></p>
|
||||
<p><strong>Returns:</strong> <a href="#rpccoder">RpcCoder</a></p>
|
||||
<hr>
|
||||
<p><a id="send"></a></p>
|
||||
<h3 id="send">send</h3>
|
||||
<p>▸ <strong>send</strong>(__namedParameters: <em><code>object</code></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>Promise</code><<code>any</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/send.ts#L7" target="_blank">mock/send.ts:7</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>__namedParameters</td>
|
||||
<td><code>object</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>any</code>></p>
|
||||
<hr>
|
||||
<p><a id="state"></a></p>
|
||||
<h3 id="state">state</h3>
|
||||
<p>▸ <strong>state</strong>(): <a href="#mockstate">MockState</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/state.ts#L38" target="_blank">mock/state.ts:38</a></em></p>
|
||||
<p><strong>Returns:</strong> <a href="#mockstate">MockState</a></p>
|
||||
<hr>
|
||||
<p><a id="subscribe"></a></p>
|
||||
<h3 id="subscribe">subscribe</h3>
|
||||
<p>▸ <strong>subscribe</strong>(self: <em><a href="#mockstate">MockState</a></em>, type: <em><code>string</code></em>, method: <em><code>string</code></em>, params: <em><code>Array</code><<code>any</code>></em>): <code>Promise</code><<code>number</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/subscribe.ts#L7" target="_blank">mock/subscribe.ts:7</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#mockstate">MockState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>method</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>number</code>></p>
|
||||
<hr>
|
||||
<p><a id="unsubscribe"></a></p>
|
||||
<h3 id="unsubscribe">unsubscribe</h3>
|
||||
<p>▸ <strong>unsubscribe</strong>(self: <em><a href="#mockstate">MockState</a></em>, type: <em><code>string</code></em>, name: <em><code>string</code></em>, id: <em><code>number</code></em>): <code>Promise</code><<code>boolean</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/mock/unsubscribe.ts#L7" target="_blank">mock/unsubscribe.ts:7</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>self</td>
|
||||
<td><a href="#mockstate">MockState</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td><code>string</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>id</td>
|
||||
<td><code>number</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Promise</code><<code>boolean</code>></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</section>
|
||||
@@ -915,12 +410,12 @@ The mock provider</p>
|
||||
|
||||
|
||||
|
||||
<a href="../api-format/" class="navigation navigation-prev " aria-label="Previous page: api-format">
|
||||
<a href="../api/classes/_index_.api.html" class="navigation navigation-prev " aria-label="Previous page: Api">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../api-rx/" class="navigation navigation-next " aria-label="Next page: api-rx">
|
||||
<a href="classes/_http_index_.httpprovider.html" class="navigation navigation-next " aria-label="Next page: HttpProvider">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
@@ -931,7 +426,7 @@ The mock provider</p>
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"api-provider","level":"2.3","depth":1,"next":{"title":"api-rx","level":"2.4","depth":1,"path":"api-rx/README.md","ref":"api-rx/README.md","articles":[]},"previous":{"title":"api-format","level":"2.2","depth":1,"path":"api-format/README.md","ref":"api-format/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/README.md","mtime":"2018-09-17T12:35:52.445Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"api-provider","level":"1.3","depth":1,"next":{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},"previous":{"title":"Api","level":"1.2.1","depth":2,"path":"api/classes/_index_.api.md","ref":"api/classes/_index_.api.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-provider/README.md","mtime":"2018-09-19T11:17:52.103Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
+19
-33
@@ -1,65 +1,51 @@
|
||||
[Polkadot JS API](../README.md) > [ProviderInterface](../interfaces/providerinterface.md)
|
||||
|
||||
# Interface: ProviderInterface
|
||||
|
||||
## Hierarchy
|
||||
# Hierarchy
|
||||
|
||||
**ProviderInterface**
|
||||
|
||||
## Implemented by
|
||||
# Implemented by
|
||||
|
||||
* [HttpProvider](../classes/httpprovider.md)
|
||||
* [HttpProvider](../classes/_http_index_.httpprovider.md)
|
||||
|
||||
## Index
|
||||
|
||||
### Methods
|
||||
|
||||
* [isConnected](providerinterface.md#isconnected)
|
||||
* [on](providerinterface.md#on)
|
||||
* [send](providerinterface.md#send)
|
||||
* [subscribe](providerinterface.md#subscribe)
|
||||
* [unsubscribe](providerinterface.md#unsubscribe)
|
||||
|
||||
---
|
||||
|
||||
## Methods
|
||||
# Methods
|
||||
|
||||
<a id="isconnected"></a>
|
||||
|
||||
### isConnected
|
||||
## isConnected
|
||||
|
||||
▸ **isConnected**(): `boolean`
|
||||
|
||||
*Defined in [types.d.ts:45](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L45)*
|
||||
*Defined in [types.d.ts:45](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L45)*
|
||||
|
||||
**Returns:** `boolean`
|
||||
|
||||
___
|
||||
<a id="on"></a>
|
||||
|
||||
### on
|
||||
## on
|
||||
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../#providerinterface_emitcb)*): `void`
|
||||
▸ **on**(type: *[ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb)*): `void`
|
||||
|
||||
*Defined in [types.d.ts:46](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L46)*
|
||||
*Defined in [types.d.ts:46](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L46)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | [ProviderInterface$Emitted](../#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](../#providerinterface_emitcb) |
|
||||
| type | [ProviderInterface$Emitted](../modules/_types_d_.md#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](../modules/_types_d_.md#providerinterface_emitcb) |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="send"></a>
|
||||
|
||||
### send
|
||||
## send
|
||||
|
||||
▸ **send**(method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Defined in [types.d.ts:47](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L47)*
|
||||
*Defined in [types.d.ts:47](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L47)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -73,11 +59,11 @@ ___
|
||||
___
|
||||
<a id="subscribe"></a>
|
||||
|
||||
### subscribe
|
||||
## subscribe
|
||||
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, cb: *[ProviderInterface$Callback](../#providerinterface_callback)*): `Promise`<`number`>
|
||||
▸ **subscribe**(type: *`string`*, method: *`string`*, params: *`Array`<`any`>*, cb: *[ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback)*): `Promise`<`number`>
|
||||
|
||||
*Defined in [types.d.ts:48](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L48)*
|
||||
*Defined in [types.d.ts:48](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L48)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -86,18 +72,18 @@ ___
|
||||
| type | `string` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
| cb | [ProviderInterface$Callback](../#providerinterface_callback) |
|
||||
| cb | [ProviderInterface$Callback](../modules/_types_d_.md#providerinterface_callback) |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
### unsubscribe
|
||||
## unsubscribe
|
||||
|
||||
▸ **unsubscribe**(type: *`string`*, method: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Defined in [types.d.ts:49](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-provider/src/types.d.ts#L49)*
|
||||
*Defined in [types.d.ts:49](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L49)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**EventEmitterStatic**
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new EventEmitterStatic**<`EventTypes`>(): `EventEmitter`<`EventTypes`>
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:57*
|
||||
|
||||
**Type parameters:**
|
||||
|
||||
#### EventTypes : `string` | `symbol`
|
||||
|
||||
**Returns:** `EventEmitter`<`EventTypes`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**ListenerFn**
|
||||
|
||||
# Callable
|
||||
▸ **__call**(...args: *`Array`<`any`>*): `void`
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:53*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Rest` args | `Array`<`any`> |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
[Polkadot JS API](../README.md) > [WsProvider](../classes/wsprovider.md) > [EventEmitter](../modules/wsprovider.eventemitter.md) > [EventEmitterStatic](../interfaces/wsprovider.eventemitter.eventemitterstatic.md)
|
||||
|
||||
# Interface: EventEmitterStatic
|
||||
|
||||
## Hierarchy
|
||||
|
||||
**EventEmitterStatic**
|
||||
|
||||
## Index
|
||||
|
||||
### Constructors
|
||||
|
||||
* [constructor](wsprovider.eventemitter.eventemitterstatic.md#constructor)
|
||||
|
||||
---
|
||||
|
||||
## Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
### constructor
|
||||
|
||||
⊕ **new EventEmitterStatic**<`EventTypes`>(): `EventEmitter`<`EventTypes`>
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:57*
|
||||
|
||||
**Type parameters:**
|
||||
|
||||
#### EventTypes : `string` | `symbol`
|
||||
|
||||
**Returns:** `EventEmitter`<`EventTypes`>
|
||||
|
||||
___
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
[Polkadot JS API](../README.md) > [WsProvider](../classes/wsprovider.md) > [EventEmitter](../modules/wsprovider.eventemitter.md) > [ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md)
|
||||
|
||||
# Interface: ListenerFn
|
||||
|
||||
## Hierarchy
|
||||
|
||||
**ListenerFn**
|
||||
|
||||
## Callable
|
||||
▸ **__call**(...args: *`Array`<`any`>*): `void`
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:53*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Rest` args | `Array`<`any`> |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
## Index
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="decoderesponse"></a>
|
||||
|
||||
## decodeResponse
|
||||
|
||||
▸ **decodeResponse**(self: *[RpcCoderState](_coder_json_types_d_.md#rpccoderstate)*, response: *[JsonRpcResponse](_types_d_.md#jsonrpcresponse)*): `any`
|
||||
|
||||
*Defined in [coder/json/decodeResponse.ts:22](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/decodeResponse.ts#L22)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](_coder_json_types_d_.md#rpccoderstate) |
|
||||
| response | [JsonRpcResponse](_types_d_.md#jsonrpcresponse) |
|
||||
|
||||
**Returns:** `any`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="encodejson"></a>
|
||||
|
||||
## encodeJson
|
||||
|
||||
▸ **encodeJson**(self: *[RpcCoderState](_coder_json_types_d_.md#rpccoderstate)*, method: *`string`*, params: *`Array`<`any`>*): `string`
|
||||
|
||||
*Defined in [coder/json/encodeJson.ts:9](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/encodeJson.ts#L9)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](_coder_json_types_d_.md#rpccoderstate) |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `string`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="encodeobject"></a>
|
||||
|
||||
## encodeObject
|
||||
|
||||
▸ **encodeObject**(self: *[RpcCoderState](_coder_json_types_d_.md#rpccoderstate)*, method: *`string`*, params: *`Array`<`any`>*): [JsonRpcRequest](_types_d_.md#jsonrpcrequest)
|
||||
|
||||
*Defined in [coder/json/encodeObject.ts:8](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/encodeObject.ts#L8)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [RpcCoderState](_coder_json_types_d_.md#rpccoderstate) |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** [JsonRpcRequest](_types_d_.md#jsonrpcrequest)
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="rpccoder"></a>
|
||||
|
||||
## rpcCoder
|
||||
|
||||
▸ **rpcCoder**(): [RpcCoder](_coder_json_types_d_.md#rpccoder)
|
||||
|
||||
*Defined in [coder/json/index.ts:12](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/index.ts#L12)*
|
||||
|
||||
**Returns:** [RpcCoder](_coder_json_types_d_.md#rpccoder)
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
# Type aliases
|
||||
|
||||
<a id="rpccoder"></a>
|
||||
|
||||
## RpcCoder
|
||||
|
||||
**Ƭ RpcCoder**: *`object`*
|
||||
|
||||
*Defined in [coder/json/types.d.ts:7](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/types.d.ts#L7)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="rpccoderstate"></a>
|
||||
|
||||
## RpcCoderState
|
||||
|
||||
**Ƭ RpcCoderState**: *`object`*
|
||||
|
||||
*Defined in [coder/json/types.d.ts:14](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/coder/json/types.d.ts#L14)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
# Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [HttpProvider](../classes/_http_index_.httpprovider.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
# Type aliases
|
||||
|
||||
<a id="httpstate"></a>
|
||||
|
||||
## HttpState
|
||||
|
||||
**Ƭ HttpState**: *`object`*
|
||||
|
||||
*Defined in [http/types.d.ts:8](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/http/types.d.ts#L8)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="mockprovider"></a>
|
||||
|
||||
## mockProvider
|
||||
|
||||
▸ **mockProvider**(): [ProviderInterface](../interfaces/_types_d_.providerinterface.md)
|
||||
|
||||
*Defined in [mock/index.ts:18](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/index.ts#L18)*
|
||||
|
||||
A moock provider mainly used for testing.
|
||||
|
||||
**Returns:** [ProviderInterface](../interfaces/_types_d_.providerinterface.md)
|
||||
The mock provider
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="mocks"></a>
|
||||
|
||||
## mocks
|
||||
|
||||
▸ **mocks**(__namedParameters: *`object`*): `void`
|
||||
|
||||
*Defined in [mock/mocks.ts:68](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/mocks.ts#L68)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="on"></a>
|
||||
|
||||
## on
|
||||
|
||||
▸ **on**(self: *[MockState](_mock_types_d_.md#mockstate)*, type: *[ProviderInterface$Emitted](_types_d_.md#providerinterface_emitted)*, sub: *[ProviderInterface$EmitCb](_types_d_.md#providerinterface_emitcb)*): `void`
|
||||
|
||||
*Defined in [mock/on.ts:8](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/on.ts#L8)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](_mock_types_d_.md#mockstate) |
|
||||
| type | [ProviderInterface$Emitted](_types_d_.md#providerinterface_emitted) |
|
||||
| sub | [ProviderInterface$EmitCb](_types_d_.md#providerinterface_emitcb) |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="send"></a>
|
||||
|
||||
## send
|
||||
|
||||
▸ **send**(__namedParameters: *`object`*, method: *`string`*, params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Defined in [mock/send.ts:7](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/send.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="state"></a>
|
||||
|
||||
## state
|
||||
|
||||
▸ **state**(): [MockState](_mock_types_d_.md#mockstate)
|
||||
|
||||
*Defined in [mock/state.ts:38](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/state.ts#L38)*
|
||||
|
||||
**Returns:** [MockState](_mock_types_d_.md#mockstate)
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="subscribe"></a>
|
||||
|
||||
## subscribe
|
||||
|
||||
▸ **subscribe**(self: *[MockState](_mock_types_d_.md#mockstate)*, type: *`string`*, method: *`string`*, params: *`Array`<`any`>*): `Promise`<`number`>
|
||||
|
||||
*Defined in [mock/subscribe.ts:7](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/subscribe.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](_mock_types_d_.md#mockstate) |
|
||||
| type | `string` |
|
||||
| method | `string` |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Promise`<`number`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
|
||||
# Type aliases
|
||||
|
||||
<a id="mockstate"></a>
|
||||
|
||||
## MockState
|
||||
|
||||
**Ƭ MockState**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:27](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/types.d.ts#L27)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="mockstate_requests"></a>
|
||||
|
||||
## MockState$Requests
|
||||
|
||||
**Ƭ MockState$Requests**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:23](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/types.d.ts#L23)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `function`
|
||||
|
||||
▸(storage: *[MockState$Storage](_mock_types_d_.md#mockstate_storage)*, params: *`Array`<`any`>*): `string`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| storage | [MockState$Storage](_mock_types_d_.md#mockstate_storage) |
|
||||
| params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `string`
|
||||
|
||||
___
|
||||
<a id="mockstate_storage"></a>
|
||||
|
||||
## MockState$Storage
|
||||
|
||||
**Ƭ MockState$Storage**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:19](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/types.d.ts#L19)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="mockstate_subscription_callback"></a>
|
||||
|
||||
## MockState$Subscription$Callback
|
||||
|
||||
**Ƭ MockState$Subscription$Callback**: *`function`*
|
||||
|
||||
*Defined in [mock/types.d.ts:8](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/types.d.ts#L8)*
|
||||
|
||||
#### Type declaration
|
||||
▸(error: * `Error` | `null`*, value: *`any`*): `void`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| error | `Error` | `null`|
|
||||
| value | `any` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="mockstate_subscriptions"></a>
|
||||
|
||||
## MockState$Subscriptions
|
||||
|
||||
**Ƭ MockState$Subscriptions**: *`object`*
|
||||
|
||||
*Defined in [mock/types.d.ts:10](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/types.d.ts#L10)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `object`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
## unsubscribe
|
||||
|
||||
▸ **unsubscribe**(self: *[MockState](_mock_types_d_.md#mockstate)*, type: *`string`*, name: *`string`*, id: *`number`*): `Promise`<`boolean`>
|
||||
|
||||
*Defined in [mock/unsubscribe.ts:7](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/mock/unsubscribe.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| self | [MockState](_mock_types_d_.md#mockstate) |
|
||||
| type | `string` |
|
||||
| name | `string` |
|
||||
| id | `number` |
|
||||
|
||||
**Returns:** `Promise`<`boolean`>
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
|
||||
|
||||
# Type aliases
|
||||
|
||||
<a id="jsonrpcobject"></a>
|
||||
|
||||
## JsonRpcObject
|
||||
|
||||
**Ƭ JsonRpcObject**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:5](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L5)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="jsonrpcrequest"></a>
|
||||
|
||||
## JsonRpcRequest
|
||||
|
||||
**Ƭ JsonRpcRequest**: * [JsonRpcObject](_types_d_.md#jsonrpcobject) & `object`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L10)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponse"></a>
|
||||
|
||||
## JsonRpcResponse
|
||||
|
||||
**Ƭ JsonRpcResponse**: * [JsonRpcObject](_types_d_.md#jsonrpcobject) & [JsonRpcResponseBase](_types_d_.md#jsonrpcresponsebase)
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:36](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L36)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponsebase"></a>
|
||||
|
||||
## JsonRpcResponseBase
|
||||
|
||||
**Ƭ JsonRpcResponseBase**: * `JsonRpcResponse$Single` & `JsonRpcResponse$Subscription`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:34](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L34)*
|
||||
|
||||
___
|
||||
<a id="jsonrpcresponsebase_error"></a>
|
||||
|
||||
## JsonRpcResponseBase$Error
|
||||
|
||||
**Ƭ JsonRpcResponseBase$Error**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:15](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L15)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="providerinterface_callback"></a>
|
||||
|
||||
## ProviderInterface$Callback
|
||||
|
||||
**Ƭ ProviderInterface$Callback**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:38](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L38)*
|
||||
|
||||
#### Type declaration
|
||||
▸(error: * `Error` | `null`*, result: *`any`*): `void`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| error | `Error` | `null`|
|
||||
| result | `any` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="providerinterface_emitcb"></a>
|
||||
|
||||
## ProviderInterface$EmitCb
|
||||
|
||||
**Ƭ ProviderInterface$EmitCb**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:42](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L42)*
|
||||
|
||||
#### Type declaration
|
||||
▸(value?: *`any`*): `any`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Optional` value | `any` |
|
||||
|
||||
**Returns:** `any`
|
||||
|
||||
___
|
||||
<a id="providerinterface_emitted"></a>
|
||||
|
||||
## ProviderInterface$Emitted
|
||||
|
||||
**Ƭ ProviderInterface$Emitted**: * "connected" | "disconnected"
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:40](https://github.com/polkadot-js/api/blob/01435c1/packages/api-provider/src/types.d.ts#L40)*
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
# Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [WsProvider](../classes/_ws_index_.wsprovider.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
# Index
|
||||
|
||||
### Interfaces
|
||||
|
||||
* [EventEmitterStatic](../interfaces/_ws_index_.wsprovider.eventemitter.eventemitterstatic.md)
|
||||
* [ListenerFn](../interfaces/_ws_index_.wsprovider.eventemitter.listenerfn.md)
|
||||
|
||||
### Variables
|
||||
|
||||
* [EventEmitter](_ws_index_.wsprovider.eventemitter.md#eventemitter)
|
||||
|
||||
---
|
||||
|
||||
# Variables
|
||||
|
||||
<a id="eventemitter"></a>
|
||||
|
||||
## `<Const>` EventEmitter
|
||||
|
||||
**● EventEmitter**: *`EventEmitterStatic`*
|
||||
|
||||
*Defined in /Users/jacogreeff/Projects/polkadot/api/node_modules/eventemitter3/index.d.ts:61*
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
[Polkadot JS API](../README.md) > [WsProvider](../classes/wsprovider.md) > [EventEmitter](../modules/wsprovider.eventemitter.md)
|
||||
|
||||
# Module: EventEmitter
|
||||
|
||||
## Index
|
||||
|
||||
### Interfaces
|
||||
|
||||
* [EventEmitterStatic](../interfaces/wsprovider.eventemitter.eventemitterstatic.md)
|
||||
* [ListenerFn](../interfaces/wsprovider.eventemitter.listenerfn.md)
|
||||
|
||||
### Variables
|
||||
|
||||
* [EventEmitter](wsprovider.eventemitter.md#eventemitter)
|
||||
|
||||
---
|
||||
|
||||
## Variables
|
||||
|
||||
<a id="eventemitter"></a>
|
||||
|
||||
### `<Const>` EventEmitter
|
||||
|
||||
**● EventEmitter**: *`EventEmitterStatic`*
|
||||
|
||||
*Defined in /home/travis/build/polkadot-js/api/node_modules/eventemitter3/index.d.ts:61*
|
||||
|
||||
___
|
||||
|
||||
@@ -6,63 +6,3 @@
|
||||
|
||||
An RxJs wrapper around the [@polkadot/api](../api).
|
||||
|
||||
## Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [RxApi](classes/rxapi.md)
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [RxApiInterface](#rxapiinterface)
|
||||
* [RxApiInterface$Method](#rxapiinterface_method)
|
||||
* [RxApiInterface$Section](#rxapiinterface_section)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="rxapiinterface"></a>
|
||||
|
||||
### RxApiInterface
|
||||
|
||||
**Ƭ RxApiInterface**: * `RxApiInterface$Keys` & `object`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:19](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/types.d.ts#L19)*
|
||||
|
||||
___
|
||||
<a id="rxapiinterface_method"></a>
|
||||
|
||||
### RxApiInterface$Method
|
||||
|
||||
**Ƭ RxApiInterface$Method**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:9](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/types.d.ts#L9)*
|
||||
|
||||
#### Type declaration
|
||||
▸(...params: *`Array`<`any`>*): `Observable`<`any`> | `BehaviorSubject`<`any`>
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Rest` params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Observable`<`any`> | `BehaviorSubject`<`any`>
|
||||
|
||||
___
|
||||
<a id="rxapiinterface_section"></a>
|
||||
|
||||
### RxApiInterface$Section
|
||||
|
||||
**Ƭ RxApiInterface$Section**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/types.d.ts#L11)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: [RxApiInterface$Method](#rxapiinterface_method)
|
||||
|
||||
___
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
* ["defaults"](modules/_defaults_.md)
|
||||
* ["index"](modules/_index_.md)
|
||||
* [RxApi](classes/_index_.rxapi.md)
|
||||
* ["types.d"](modules/_types_d_.md)
|
||||
@@ -0,0 +1,518 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>ApiRx · 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-highlight/website.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="../../examples/" />
|
||||
|
||||
|
||||
<link rel="prev" href="../" />
|
||||
|
||||
|
||||
</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/_index_.api.html">
|
||||
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../api-provider/">
|
||||
|
||||
<a href="../../api-provider/">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
api-rx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.4.1" data-path="_index_.rxapi.html">
|
||||
|
||||
<a href="_index_.rxapi.html">
|
||||
|
||||
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../examples/">
|
||||
|
||||
<a href="../../examples/">
|
||||
|
||||
|
||||
Overview
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../examples/01_simple_connect/">
|
||||
|
||||
<a href="../../examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../../examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../examples/04_generate_account/">
|
||||
|
||||
<a href="../../examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../examples/05_read_storage/">
|
||||
|
||||
<a href="../../examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../../examples/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../../examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</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="../.." >ApiRx</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">
|
||||
|
||||
<p>An RxJs wrapper around the [[api]].
|
||||
<em><strong>example</strong></em>: ```javascript
|
||||
import RxApi from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';</p>
|
||||
<p>const provider = new WsProvider('<a href="http://127.0.0.1:9944" target="_blank">http://127.0.0.1:9944</a>');
|
||||
const rxapi = new RxApi(provider);
|
||||
```</p>
|
||||
<h1 id="hierarchy">Hierarchy</h1>
|
||||
<p><strong>RxApi</strong></p>
|
||||
<h1 id="implements">Implements</h1>
|
||||
<ul>
|
||||
<li><code>object</code> & <code>object</code></li>
|
||||
</ul>
|
||||
<h1 id="constructors">Constructors</h1>
|
||||
<p><a id="constructor"></a></p>
|
||||
<h2 id="constructor">constructor</h2>
|
||||
<p>⊕ <strong>new RxApi</strong>(provider?: <em><code>ProviderInterface</code></em>): <a href="_index_.rxapi.html">RxApi</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L43" target="_blank">index.ts:43</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
<th>Default value</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>Default value</code> provider</td>
|
||||
<td><code>ProviderInterface</code></td>
|
||||
<td>new Ws(defaults.WS_URL)</td>
|
||||
<td>An API provider using HTTP or WebSocket</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <a href="_index_.rxapi.html">RxApi</a></p>
|
||||
<hr>
|
||||
<h1 id="properties">Properties</h1>
|
||||
<p><a id="author"></a></p>
|
||||
<h2 id="author">author</h2>
|
||||
<p><strong>● author</strong>: <em><a href="../modules/_types_d_.md#rxapiinterface_section">RxApiInterface$Section</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L40" target="_blank">index.ts:40</a></em></p>
|
||||
<hr>
|
||||
<p><a id="chain"></a></p>
|
||||
<h2 id="chain">chain</h2>
|
||||
<p><strong>● chain</strong>: <em><a href="../modules/_types_d_.md#rxapiinterface_section">RxApiInterface$Section</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L41" target="_blank">index.ts:41</a></em></p>
|
||||
<hr>
|
||||
<p><a id="state"></a></p>
|
||||
<h2 id="state">state</h2>
|
||||
<p><strong>● state</strong>: <em><a href="../modules/_types_d_.md#rxapiinterface_section">RxApiInterface$Section</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L42" target="_blank">index.ts:42</a></em></p>
|
||||
<hr>
|
||||
<p><a id="system"></a></p>
|
||||
<h2 id="system">system</h2>
|
||||
<p><strong>● system</strong>: <em><a href="../modules/_types_d_.md#rxapiinterface_section">RxApiInterface$Section</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L43" target="_blank">index.ts:43</a></em></p>
|
||||
<hr>
|
||||
<h1 id="methods">Methods</h1>
|
||||
<p><a id="isconnected"></a></p>
|
||||
<h2 id="isconnected">isConnected</h2>
|
||||
<p>▸ <strong>isConnected</strong>(): <code>BehaviorSubject</code><<code>boolean</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L62" target="_blank">index.ts:62</a></em></p>
|
||||
<p><strong>Returns:</strong> <code>BehaviorSubject</code><<code>boolean</code>></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</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="../" class="navigation navigation-prev " aria-label="Previous page: api-rx">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../../examples/" class="navigation navigation-next " aria-label="Next page: Overview">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"ApiRx","level":"1.4.1","depth":2,"next":{"title":"Overview","level":"2.1","depth":1,"path":"examples/README.md","ref":"examples/README.md","articles":[]},"previous":{"title":"api-rx","level":"1.4","depth":1,"path":"api-rx/README.md","ref":"api-rx/README.md","articles":[{"title":"ApiRx","level":"1.4.1","depth":2,"path":"api-rx/classes/_index_.rxapi.md","ref":"api-rx/classes/_index_.rxapi.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-rx/classes/_index_.rxapi.md","mtime":"2018-09-19T11:17:57.471Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook.js"></script>
|
||||
<script src="../../gitbook/theme.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>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
[Polkadot JS API](../README.md) > [RxApi](../classes/rxapi.md)
|
||||
|
||||
# Class: RxApi
|
||||
|
||||
An RxJs wrapper around the \[\[api\]\].
|
||||
*__example__*: ```javascript
|
||||
@@ -11,42 +9,23 @@ const provider = new WsProvider('http://127.0.0.1:9944');
|
||||
const rxapi = new RxApi(provider);
|
||||
```
|
||||
|
||||
## Hierarchy
|
||||
# Hierarchy
|
||||
|
||||
**RxApi**
|
||||
|
||||
## Implements
|
||||
# Implements
|
||||
|
||||
* `object` & `object`
|
||||
|
||||
## Index
|
||||
|
||||
### Constructors
|
||||
|
||||
* [constructor](rxapi.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
* [author](rxapi.md#author)
|
||||
* [chain](rxapi.md#chain)
|
||||
* [state](rxapi.md#state)
|
||||
* [system](rxapi.md#system)
|
||||
|
||||
### Methods
|
||||
|
||||
* [isConnected](rxapi.md#isconnected)
|
||||
|
||||
---
|
||||
|
||||
## Constructors
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
### constructor
|
||||
## constructor
|
||||
|
||||
⊕ **new RxApi**(provider?: *`ProviderInterface`*): [RxApi](rxapi.md)
|
||||
⊕ **new RxApi**(provider?: *`ProviderInterface`*): [RxApi](_index_.rxapi.md)
|
||||
|
||||
*Defined in [index.ts:43](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/index.ts#L43)*
|
||||
*Defined in [index.ts:43](https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L43)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -54,58 +33,58 @@ const rxapi = new RxApi(provider);
|
||||
| ------ | ------ | ------ | ------ |
|
||||
| `Default value` provider | `ProviderInterface` | new Ws(defaults.WS_URL) | An API provider using HTTP or WebSocket |
|
||||
|
||||
**Returns:** [RxApi](rxapi.md)
|
||||
**Returns:** [RxApi](_index_.rxapi.md)
|
||||
|
||||
___
|
||||
|
||||
## Properties
|
||||
# Properties
|
||||
|
||||
<a id="author"></a>
|
||||
|
||||
### author
|
||||
## author
|
||||
|
||||
**● author**: *[RxApiInterface$Section](../#rxapiinterface_section)*
|
||||
**● author**: *[RxApiInterface$Section](../modules/_types_d_.md#rxapiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:40](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/index.ts#L40)*
|
||||
*Defined in [index.ts:40](https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L40)*
|
||||
|
||||
___
|
||||
<a id="chain"></a>
|
||||
|
||||
### chain
|
||||
## chain
|
||||
|
||||
**● chain**: *[RxApiInterface$Section](../#rxapiinterface_section)*
|
||||
**● chain**: *[RxApiInterface$Section](../modules/_types_d_.md#rxapiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:41](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/index.ts#L41)*
|
||||
*Defined in [index.ts:41](https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L41)*
|
||||
|
||||
___
|
||||
<a id="state"></a>
|
||||
|
||||
### state
|
||||
## state
|
||||
|
||||
**● state**: *[RxApiInterface$Section](../#rxapiinterface_section)*
|
||||
**● state**: *[RxApiInterface$Section](../modules/_types_d_.md#rxapiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:42](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/index.ts#L42)*
|
||||
*Defined in [index.ts:42](https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L42)*
|
||||
|
||||
___
|
||||
<a id="system"></a>
|
||||
|
||||
### system
|
||||
## system
|
||||
|
||||
**● system**: *[RxApiInterface$Section](../#rxapiinterface_section)*
|
||||
**● system**: *[RxApiInterface$Section](../modules/_types_d_.md#rxapiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:43](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/index.ts#L43)*
|
||||
*Defined in [index.ts:43](https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L43)*
|
||||
|
||||
___
|
||||
|
||||
## Methods
|
||||
# Methods
|
||||
|
||||
<a id="isconnected"></a>
|
||||
|
||||
### isConnected
|
||||
## isConnected
|
||||
|
||||
▸ **isConnected**(): `BehaviorSubject`<`boolean`>
|
||||
|
||||
*Defined in [index.ts:62](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/index.ts#L62)*
|
||||
*Defined in [index.ts:62](https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/index.ts#L62)*
|
||||
|
||||
**Returns:** `BehaviorSubject`<`boolean`>
|
||||
|
||||
+65
-148
@@ -57,10 +57,10 @@
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../type-extrinsics/" />
|
||||
<link rel="next" href="classes/_index_.rxapi.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../api-provider/" />
|
||||
<link rel="prev" href="../api-provider/classes/_ws_index_.wsprovider.html" />
|
||||
|
||||
|
||||
</head>
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../api/">
|
||||
|
||||
<a href="../api/">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../api-format/">
|
||||
<a href="../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../api-provider/">
|
||||
|
||||
<a href="../api-provider/">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="2.4" data-path="./">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.4" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../type-extrinsics/">
|
||||
<a href="classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../type-jsonrpc/">
|
||||
|
||||
<a href="../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../type-params/">
|
||||
|
||||
<a href="../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../type-primitives/">
|
||||
|
||||
<a href="../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../type-storage/">
|
||||
|
||||
<a href="../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../examples/">
|
||||
<li class="chapter " data-level="2.1" data-path="../examples/">
|
||||
|
||||
<a href="../examples/">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../examples/01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="../examples/01_simple_connect/">
|
||||
|
||||
<a href="../examples/01_simple_connect/">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../examples/02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../examples/02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../examples/03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../examples/04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="../examples/04_generate_account/">
|
||||
|
||||
<a href="../examples/04_generate_account/">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../examples/05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="../examples/05_read_storage/">
|
||||
|
||||
<a href="../examples/05_read_storage/">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../examples/06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../examples/06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../examples/07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../examples/07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../CONTRIBUTING.html">
|
||||
|
||||
<a href="../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -407,54 +372,6 @@
|
||||
<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-rx" target="_blank"><img src="https://img.shields.io/npm/v/@polkadot/api-rx.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=packages/api-rx" target="_blank"><img src="https://david-dm.org/polkadot-js/api.svg?style=flat-square&path=packages/api-rx" alt="dependency"></a> <a href="https://david-dm.org/polkadot-js/api?path=packages/api-rx#info=devDependencies" target="_blank"><img src="https://david-dm.org/polkadot-js/api/dev-status.svg?style=flat-square&path=packages/api-rx" alt="devDependency"></a></p>
|
||||
<h1 id="polkadotapi-rx">@polkadot/api-rx</h1>
|
||||
<p>An RxJs wrapper around the <a href="../api">@polkadot/api</a>.</p>
|
||||
<h2 id="index">Index</h2>
|
||||
<h3 id="classes">Classes</h3>
|
||||
<ul>
|
||||
<li><a href="classes/rxapi.md">RxApi</a></li>
|
||||
</ul>
|
||||
<h3 id="type-aliases">Type aliases</h3>
|
||||
<ul>
|
||||
<li><a href="#rxapiinterface">RxApiInterface</a></li>
|
||||
<li><a href="#rxapiinterface_method">RxApiInterface$Method</a></li>
|
||||
<li><a href="#rxapiinterface_section">RxApiInterface$Section</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2 id="type-aliases">Type aliases</h2>
|
||||
<p><a id="rxapiinterface"></a></p>
|
||||
<h3 id="rxapiinterface">RxApiInterface</h3>
|
||||
<p><strong>Ƭ RxApiInterface</strong>: <em> <code>RxApiInterface$Keys</code> & <code>object</code>
|
||||
</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/types.d.ts#L19" target="_blank">types.d.ts:19</a></em></p>
|
||||
<hr>
|
||||
<p><a id="rxapiinterface_method"></a></p>
|
||||
<h3 id="rxapiinterfacemethod">RxApiInterface$Method</h3>
|
||||
<p><strong>Ƭ RxApiInterface$Method</strong>: <em><code>function</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/types.d.ts#L9" target="_blank">types.d.ts:9</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(...params: <em><code>Array</code><<code>any</code>></em>): <code>Observable</code><<code>any</code>> | <code>BehaviorSubject</code><<code>any</code>></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>Rest</code> params</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Observable</code><<code>any</code>> | <code>BehaviorSubject</code><<code>any</code>></p>
|
||||
<hr>
|
||||
<p><a id="rxapiinterface_section"></a></p>
|
||||
<h3 id="rxapiinterfacesection">RxApiInterface$Section</h3>
|
||||
<p><strong>Ƭ RxApiInterface$Section</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api-rx/src/types.d.ts#L11" target="_blank">types.d.ts:11</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
|
||||
|
||||
</section>
|
||||
@@ -482,12 +399,12 @@
|
||||
|
||||
|
||||
|
||||
<a href="../api-provider/" class="navigation navigation-prev " aria-label="Previous page: api-provider">
|
||||
<a href="../api-provider/classes/_ws_index_.wsprovider.html" class="navigation navigation-prev " aria-label="Previous page: WsProvider">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../type-extrinsics/" class="navigation navigation-next " aria-label="Next page: type-extrinsics">
|
||||
<a href="classes/_index_.rxapi.html" class="navigation navigation-next " aria-label="Next page: ApiRx">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
@@ -498,7 +415,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"api-rx","level":"2.4","depth":1,"next":{"title":"type-extrinsics","level":"2.5","depth":1,"path":"type-extrinsics/README.md","ref":"type-extrinsics/README.md","articles":[]},"previous":{"title":"api-provider","level":"2.3","depth":1,"path":"api-provider/README.md","ref":"api-provider/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-rx/README.md","mtime":"2018-09-17T12:36:09.858Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"api-rx","level":"1.4","depth":1,"next":{"title":"ApiRx","level":"1.4.1","depth":2,"path":"api-rx/classes/_index_.rxapi.md","ref":"api-rx/classes/_index_.rxapi.md","articles":[]},"previous":{"title":"WsProvider","level":"1.3.2","depth":2,"path":"api-provider/classes/_ws_index_.wsprovider.md","ref":"api-provider/classes/_ws_index_.wsprovider.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api-rx/README.md","mtime":"2018-09-19T11:17:57.409Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
# Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [RxApi](../classes/_index_.rxapi.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
|
||||
# Type aliases
|
||||
|
||||
<a id="rxapiinterface"></a>
|
||||
|
||||
## RxApiInterface
|
||||
|
||||
**Ƭ RxApiInterface**: * `RxApiInterface$Keys` & `object`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:19](https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/types.d.ts#L19)*
|
||||
|
||||
___
|
||||
<a id="rxapiinterface_method"></a>
|
||||
|
||||
## RxApiInterface$Method
|
||||
|
||||
**Ƭ RxApiInterface$Method**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:9](https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/types.d.ts#L9)*
|
||||
|
||||
#### Type declaration
|
||||
▸(...params: *`Array`<`any`>*): `Observable`<`any`> | `BehaviorSubject`<`any`>
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Rest` params | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Observable`<`any`> | `BehaviorSubject`<`any`>
|
||||
|
||||
___
|
||||
<a id="rxapiinterface_section"></a>
|
||||
|
||||
## RxApiInterface$Section
|
||||
|
||||
**Ƭ RxApiInterface$Section**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/01435c1/packages/api-rx/src/types.d.ts#L11)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: [RxApiInterface$Method](_types_d_.md#rxapiinterface_method)
|
||||
|
||||
___
|
||||
|
||||
+1
-47
@@ -4,9 +4,7 @@
|
||||
@polkadot/api
|
||||
=============
|
||||
|
||||
Warning - currently this does not actually do all that much, it is an attempt to put into code some thoughts about how to maintain the endpoints. This library provides a clean wrapper around all the methods exposed by a Polkadot network client.
|
||||
|
||||
Methods are auto-generated for the [JsonRPC interface definitions](https://github.com/polkadot-js/api/packages/type-jsonrpc), containing a full list of all sections and the methods contained within.
|
||||
This library provides a clean wrapper around all the methods exposed by a Polkadot network client.
|
||||
|
||||
Usage
|
||||
-----
|
||||
@@ -72,47 +70,3 @@ api.chain
|
||||
});
|
||||
```
|
||||
|
||||
## Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [Api](classes/api.md)
|
||||
|
||||
### Interfaces
|
||||
|
||||
* [ApiInterface$Section$Method](interfaces/apiinterface_section_method.md)
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [ApiInterface](#apiinterface)
|
||||
* [ApiInterface$Section](#apiinterface_section)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="apiinterface"></a>
|
||||
|
||||
### ApiInterface
|
||||
|
||||
**Ƭ ApiInterface**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:18](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/types.d.ts#L18)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="apiinterface_section"></a>
|
||||
|
||||
### ApiInterface$Section
|
||||
|
||||
**Ƭ ApiInterface$Section**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:14](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/types.d.ts#L14)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: [ApiInterface$Section$Method](interfaces/apiinterface_section_method.md)
|
||||
|
||||
___
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
* ["index"](modules/_index_.md)
|
||||
* [Api](classes/_index_.api.md)
|
||||
* ["types.d"](modules/_types_d_.md)
|
||||
* [ApiInterface$Section$Method](interfaces/_types_d_.apiinterface_section_method.md)
|
||||
@@ -0,0 +1,509 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Api · 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-highlight/website.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="../../api-provider/" />
|
||||
|
||||
|
||||
<link rel="prev" href="../" />
|
||||
|
||||
|
||||
</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="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.2.1" data-path="_index_.api.html">
|
||||
|
||||
<a href="_index_.api.html">
|
||||
|
||||
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../api-provider/">
|
||||
|
||||
<a href="../../api-provider/">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
|
||||
api-rx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../examples/">
|
||||
|
||||
<a href="../../examples/">
|
||||
|
||||
|
||||
Overview
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../examples/01_simple_connect/">
|
||||
|
||||
<a href="../../examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../../examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../../examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../examples/04_generate_account/">
|
||||
|
||||
<a href="../../examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../examples/05_read_storage/">
|
||||
|
||||
<a href="../../examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../../examples/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../../examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</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="../.." >Api</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">
|
||||
|
||||
<p><em><strong>example</strong></em>: ```javascript
|
||||
import Api from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';</p>
|
||||
<p>const provider = new WsProvider('<a href="http://127.0.0.1:9944" target="_blank">http://127.0.0.1:9944</a>');
|
||||
const api = new Api(provider);
|
||||
```</p>
|
||||
<h1 id="hierarchy">Hierarchy</h1>
|
||||
<p><strong>Api</strong></p>
|
||||
<h1 id="implements">Implements</h1>
|
||||
<ul>
|
||||
<li><code>object</code></li>
|
||||
</ul>
|
||||
<h1 id="constructors">Constructors</h1>
|
||||
<p><a id="constructor"></a></p>
|
||||
<h2 id="constructor">constructor</h2>
|
||||
<p>⊕ <strong>new Api</strong>(provider: <em><code>ProviderInterface</code></em>): <a href="_index_.api.html">Api</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/index.ts#L37" target="_blank">index.ts:37</a></em></p>
|
||||
<p><em><strong>constructor</strong></em>: Default constructor for the Api Object</p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>provider</td>
|
||||
<td><code>ProviderInterface</code></td>
|
||||
<td>An API provider using HTTP or WebSocket</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <a href="_index_.api.html">Api</a></p>
|
||||
<hr>
|
||||
<h1 id="properties">Properties</h1>
|
||||
<p><a id="author"></a></p>
|
||||
<h2 id="author">author</h2>
|
||||
<p><strong>● author</strong>: <em><a href="../modules/_types_d_.md#apiinterface_section">ApiInterface$Section</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/index.ts#L34" target="_blank">index.ts:34</a></em></p>
|
||||
<hr>
|
||||
<p><a id="chain"></a></p>
|
||||
<h2 id="chain">chain</h2>
|
||||
<p><strong>● chain</strong>: <em><a href="../modules/_types_d_.md#apiinterface_section">ApiInterface$Section</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/index.ts#L35" target="_blank">index.ts:35</a></em></p>
|
||||
<hr>
|
||||
<p><a id="state"></a></p>
|
||||
<h2 id="state">state</h2>
|
||||
<p><strong>● state</strong>: <em><a href="../modules/_types_d_.md#apiinterface_section">ApiInterface$Section</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/index.ts#L36" target="_blank">index.ts:36</a></em></p>
|
||||
<hr>
|
||||
<p><a id="system"></a></p>
|
||||
<h2 id="system">system</h2>
|
||||
<p><strong>● system</strong>: <em><a href="../modules/_types_d_.md#apiinterface_section">ApiInterface$Section</a></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/index.ts#L37" target="_blank">index.ts:37</a></em></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</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="../" class="navigation navigation-prev " aria-label="Previous page: api">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../../api-provider/" class="navigation navigation-next " aria-label="Next page: api-provider">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Api","level":"1.2.1","depth":2,"next":{"title":"api-provider","level":"1.3","depth":1,"path":"api-provider/README.md","ref":"api-provider/README.md","articles":[{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"api-provider/classes/_http_index_.httpprovider.md","ref":"api-provider/classes/_http_index_.httpprovider.md","articles":[]},{"title":"WsProvider","level":"1.3.2","depth":2,"path":"api-provider/classes/_ws_index_.wsprovider.md","ref":"api-provider/classes/_ws_index_.wsprovider.md","articles":[]}]},"previous":{"title":"api","level":"1.2","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[{"title":"Api","level":"1.2.1","depth":2,"path":"api/classes/_index_.api.md","ref":"api/classes/_index_.api.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api/classes/_index_.api.md","mtime":"2018-09-19T11:17:46.733Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../../gitbook/gitbook.js"></script>
|
||||
<script src="../../gitbook/theme.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>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
|
||||
|
||||
*__example__*: ```javascript
|
||||
import Api from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
|
||||
const provider = new WsProvider('http://127.0.0.1:9944');
|
||||
const api = new Api(provider);
|
||||
```
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**Api**
|
||||
|
||||
# Implements
|
||||
|
||||
* `object`
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new Api**(provider: *`ProviderInterface`*): [Api](_index_.api.md)
|
||||
|
||||
*Defined in [index.ts:37](https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/index.ts#L37)*
|
||||
|
||||
*__constructor__*: Default constructor for the Api Object
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Description |
|
||||
| ------ | ------ | ------ |
|
||||
| provider | `ProviderInterface` | An API provider using HTTP or WebSocket |
|
||||
|
||||
**Returns:** [Api](_index_.api.md)
|
||||
|
||||
___
|
||||
|
||||
# Properties
|
||||
|
||||
<a id="author"></a>
|
||||
|
||||
## author
|
||||
|
||||
**● author**: *[ApiInterface$Section](../modules/_types_d_.md#apiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:34](https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/index.ts#L34)*
|
||||
|
||||
___
|
||||
<a id="chain"></a>
|
||||
|
||||
## chain
|
||||
|
||||
**● chain**: *[ApiInterface$Section](../modules/_types_d_.md#apiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:35](https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/index.ts#L35)*
|
||||
|
||||
___
|
||||
<a id="state"></a>
|
||||
|
||||
## state
|
||||
|
||||
**● state**: *[ApiInterface$Section](../modules/_types_d_.md#apiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:36](https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/index.ts#L36)*
|
||||
|
||||
___
|
||||
<a id="system"></a>
|
||||
|
||||
## system
|
||||
|
||||
**● system**: *[ApiInterface$Section](../modules/_types_d_.md#apiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:37](https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/index.ts#L37)*
|
||||
|
||||
___
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
[Polkadot JS API](../README.md) > [Api](../classes/api.md)
|
||||
|
||||
# Class: Api
|
||||
|
||||
*__example__*: ```javascript
|
||||
import Api from '@polkadot/api';
|
||||
import WsProvider from '@polkadot/api-provider/ws';
|
||||
|
||||
const provider = new WsProvider('http://127.0.0.1:9944');
|
||||
const api = new Api(provider);
|
||||
```
|
||||
|
||||
## Hierarchy
|
||||
|
||||
**Api**
|
||||
|
||||
## Implements
|
||||
|
||||
* `object`
|
||||
|
||||
## Index
|
||||
|
||||
### Constructors
|
||||
|
||||
* [constructor](api.md#constructor)
|
||||
|
||||
### Properties
|
||||
|
||||
* [author](api.md#author)
|
||||
* [chain](api.md#chain)
|
||||
* [state](api.md#state)
|
||||
* [system](api.md#system)
|
||||
|
||||
---
|
||||
|
||||
## Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
### constructor
|
||||
|
||||
⊕ **new Api**(provider: *`ProviderInterface`*): [Api](api.md)
|
||||
|
||||
*Defined in [index.ts:37](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/index.ts#L37)*
|
||||
|
||||
*__constructor__*: Default constructor for the Api Object
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Description |
|
||||
| ------ | ------ | ------ |
|
||||
| provider | `ProviderInterface` | An API provider using HTTP or WebSocket |
|
||||
|
||||
**Returns:** [Api](api.md)
|
||||
|
||||
___
|
||||
|
||||
## Properties
|
||||
|
||||
<a id="author"></a>
|
||||
|
||||
### author
|
||||
|
||||
**● author**: *[ApiInterface$Section](../#apiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:34](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/index.ts#L34)*
|
||||
|
||||
___
|
||||
<a id="chain"></a>
|
||||
|
||||
### chain
|
||||
|
||||
**● chain**: *[ApiInterface$Section](../#apiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:35](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/index.ts#L35)*
|
||||
|
||||
___
|
||||
<a id="state"></a>
|
||||
|
||||
### state
|
||||
|
||||
**● state**: *[ApiInterface$Section](../#apiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:36](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/index.ts#L36)*
|
||||
|
||||
___
|
||||
<a id="system"></a>
|
||||
|
||||
### system
|
||||
|
||||
**● system**: *[ApiInterface$Section](../#apiinterface_section)*
|
||||
|
||||
*Defined in [index.ts:37](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/index.ts#L37)*
|
||||
|
||||
___
|
||||
|
||||
+64
-128
@@ -57,7 +57,7 @@
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../api-format/" />
|
||||
<link rel="next" href="classes/_index_.api.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../" />
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter active" data-level="2.1" data-path="./">
|
||||
<li class="chapter active" data-level="1.2" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="classes/_index_.api.html">
|
||||
|
||||
<a href="../api-format/">
|
||||
<a href="classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../api-provider/">
|
||||
|
||||
<a href="../api-provider/">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../api-rx/">
|
||||
|
||||
<a href="../api-rx/">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../type-extrinsics/">
|
||||
<a href="../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../type-jsonrpc/">
|
||||
|
||||
<a href="../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../type-params/">
|
||||
|
||||
<a href="../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../type-primitives/">
|
||||
|
||||
<a href="../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../type-storage/">
|
||||
|
||||
<a href="../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../examples/">
|
||||
<li class="chapter " data-level="2.1" data-path="../examples/">
|
||||
|
||||
<a href="../examples/">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../examples/01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="../examples/01_simple_connect/">
|
||||
|
||||
<a href="../examples/01_simple_connect/">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../examples/02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../examples/02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../examples/03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../examples/04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="../examples/04_generate_account/">
|
||||
|
||||
<a href="../examples/04_generate_account/">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../examples/05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="../examples/05_read_storage/">
|
||||
|
||||
<a href="../examples/05_read_storage/">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../examples/06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../examples/06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../examples/07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../examples/07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../CONTRIBUTING.html">
|
||||
|
||||
<a href="../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -406,8 +371,7 @@
|
||||
|
||||
<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=packages/api" target="_blank"><img src="https://david-dm.org/polkadot-js/api.svg?style=flat-square&path=packages/api" alt="dependency"></a> <a href="https://david-dm.org/polkadot-js/api?path=packages/api#info=devDependencies" target="_blank"><img src="https://david-dm.org/polkadot-js/api/dev-status.svg?style=flat-square&path=packages/api" alt="devDependency"></a></p>
|
||||
<h1 id="polkadotapi">@polkadot/api</h1>
|
||||
<p>Warning - currently this does not actually do all that much, it is an attempt to put into code some thoughts about how to maintain the endpoints. This library provides a clean wrapper around all the methods exposed by a Polkadot network client.</p>
|
||||
<p>Methods are auto-generated for the <a href="https://github.com/polkadot-js/api/packages/type-jsonrpc" target="_blank">JsonRPC interface definitions</a>, containing a full list of all sections and the methods contained within.</p>
|
||||
<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/api
|
||||
@@ -454,34 +418,6 @@
|
||||
<span class="hljs-built_in">console</span>.error(<span class="hljs-string">'error subscribing:'</span>, error);
|
||||
});
|
||||
</code></pre>
|
||||
<h2 id="index">Index</h2>
|
||||
<h3 id="classes">Classes</h3>
|
||||
<ul>
|
||||
<li><a href="classes/api.md">Api</a></li>
|
||||
</ul>
|
||||
<h3 id="interfaces">Interfaces</h3>
|
||||
<ul>
|
||||
<li><a href="interfaces/apiinterface_section_method.md">ApiInterface$Section$Method</a></li>
|
||||
</ul>
|
||||
<h3 id="type-aliases">Type aliases</h3>
|
||||
<ul>
|
||||
<li><a href="#apiinterface">ApiInterface</a></li>
|
||||
<li><a href="#apiinterface_section">ApiInterface$Section</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2 id="type-aliases">Type aliases</h2>
|
||||
<p><a id="apiinterface"></a></p>
|
||||
<h3 id="apiinterface">ApiInterface</h3>
|
||||
<p><strong>Ƭ ApiInterface</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/types.d.ts#L18" target="_blank">types.d.ts:18</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="apiinterface_section"></a></p>
|
||||
<h3 id="apiinterfacesection">ApiInterface$Section</h3>
|
||||
<p><strong>Ƭ ApiInterface$Section</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/types.d.ts#L14" target="_blank">types.d.ts:14</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
|
||||
|
||||
</section>
|
||||
@@ -514,7 +450,7 @@
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../api-format/" class="navigation navigation-next " aria-label="Next page: api-format">
|
||||
<a href="classes/_index_.api.html" class="navigation navigation-next " aria-label="Next page: Api">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
@@ -525,7 +461,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"api","level":"2.1","depth":1,"next":{"title":"api-format","level":"2.2","depth":1,"path":"api-format/README.md","ref":"api-format/README.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.adoc","ref":"README.adoc","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api/README.md","mtime":"2018-09-17T12:34:28.968Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"api","level":"1.2","depth":1,"next":{"title":"Api","level":"1.2.1","depth":2,"path":"api/classes/_index_.api.md","ref":"api/classes/_index_.api.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"api/README.md","mtime":"2018-09-19T11:17:46.675Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
+8
-19
@@ -1,15 +1,13 @@
|
||||
[Polkadot JS API](../README.md) > [ApiInterface$Section$Method](../interfaces/apiinterface_section_method.md)
|
||||
|
||||
# Interface: ApiInterface$Section$Method
|
||||
|
||||
## Hierarchy
|
||||
# Hierarchy
|
||||
|
||||
**ApiInterface$Section$Method**
|
||||
|
||||
## Callable
|
||||
# Callable
|
||||
▸ **__call**(...params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Defined in [types.d.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/types.d.ts#L7)*
|
||||
*Defined in [types.d.ts:7](https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/types.d.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -19,33 +17,24 @@
|
||||
|
||||
**Returns:** `Promise`<`any`>
|
||||
|
||||
## Index
|
||||
|
||||
### Properties
|
||||
|
||||
* [subscription](apiinterface_section_method.md#subscription)
|
||||
* [unsubscribe](apiinterface_section_method.md#unsubscribe)
|
||||
|
||||
---
|
||||
|
||||
## Properties
|
||||
# Properties
|
||||
|
||||
<a id="subscription"></a>
|
||||
|
||||
### subscription
|
||||
## subscription
|
||||
|
||||
**● subscription**: *`string`*
|
||||
|
||||
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/types.d.ts#L10)*
|
||||
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/types.d.ts#L10)*
|
||||
|
||||
___
|
||||
<a id="unsubscribe"></a>
|
||||
|
||||
### unsubscribe
|
||||
## unsubscribe
|
||||
|
||||
**● unsubscribe**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/f5b0e23/packages/api/src/types.d.ts#L11)*
|
||||
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/types.d.ts#L11)*
|
||||
|
||||
#### Type declaration
|
||||
▸(id: *`number`*): `Promise`<`any`>
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
# Index
|
||||
|
||||
### Classes
|
||||
|
||||
* [Api](../classes/_index_.api.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
|
||||
# Type aliases
|
||||
|
||||
<a id="apiinterface"></a>
|
||||
|
||||
## ApiInterface
|
||||
|
||||
**Ƭ ApiInterface**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:18](https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/types.d.ts#L18)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="apiinterface_section"></a>
|
||||
|
||||
## ApiInterface$Section
|
||||
|
||||
**Ƭ ApiInterface$Section**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:14](https://github.com/polkadot-js/api/blob/01435c1/packages/api/src/types.d.ts#L14)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: [ApiInterface$Section$Method](../interfaces/_types_d_.apiinterface_section_method.md)
|
||||
|
||||
___
|
||||
|
||||
+2
-5
@@ -1,8 +1,5 @@
|
||||
= Simple Connect
|
||||
# Simple Connect
|
||||
|
||||
The following example shows how to instantiate a Polkadot API object and use it to connect to a node.
|
||||
|
||||
[source, javascript]
|
||||
----
|
||||
include::index.js[]
|
||||
----
|
||||
[include](index.js)
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../../api/">
|
||||
|
||||
<a href="../../api/">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../../api-format/">
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../api-provider/">
|
||||
|
||||
<a href="../../api-provider/">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../type-extrinsics/">
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../type-jsonrpc/">
|
||||
|
||||
<a href="../../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../type-params/">
|
||||
|
||||
<a href="../../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../type-primitives/">
|
||||
|
||||
<a href="../../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../../type-storage/">
|
||||
|
||||
<a href="../../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../">
|
||||
<li class="chapter " data-level="2.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="3.2" data-path="./">
|
||||
<li class="chapter active" data-level="2.2" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="../02_listen_to_blocks/">
|
||||
|
||||
<a href="../02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="../03_listen_to_balance_change/">
|
||||
|
||||
<a href="../03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="../04_generate_account/">
|
||||
|
||||
<a href="../04_generate_account/">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="../05_read_storage/">
|
||||
|
||||
<a href="../05_read_storage/">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="../06_craft_extrinsic/">
|
||||
|
||||
<a href="../06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="../07_transfer_dots/">
|
||||
|
||||
<a href="../07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../../CONTRIBUTING.html">
|
||||
|
||||
<a href="../../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -405,12 +370,8 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="simple-connect">Simple Connect</h1>
|
||||
<div class="paragraph">
|
||||
<p>The following example shows how to instantiate a Polkadot API object and use it to connect to a node.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-javascript" data-lang="javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api-provider/ws'</span>).default
|
||||
<span class="hljs-keyword">const</span> provider = <span class="hljs-keyword">new</span> WsProvider(<span class="hljs-string">'ws://127.0.0.1:9944'</span>)
|
||||
<span class="hljs-keyword">const</span> api = <span class="hljs-keyword">new</span> Api(provider)
|
||||
@@ -421,12 +382,13 @@
|
||||
|
||||
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span> (<span class="hljs-params"></span>) </span>{
|
||||
<span class="hljs-keyword">const</span> chain = <span class="hljs-keyword">await</span> getChain()
|
||||
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'You are connected to chain:'</span>, chain)
|
||||
}
|
||||
|
||||
main().finally(_ => process.exit())</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
main().finally(_ => process.exit())
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@@ -469,7 +431,7 @@ main().finally(_ => process.exit())</code></pre>
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Simple connect","level":"3.2","depth":1,"next":{"title":"Listen to blocks","level":"3.3","depth":1,"path":"examples/02_listen_to_blocks/README.adoc","ref":"examples/02_listen_to_blocks/README.adoc","articles":[]},"previous":{"title":"Overview","level":"3.1","depth":1,"path":"examples/README.adoc","ref":"examples/README.adoc","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/01_simple_connect/README.adoc","mtime":"2018-09-17T12:30:32.113Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Simple connect","level":"2.2","depth":1,"next":{"title":"Listen to blocks","level":"2.3","depth":1,"path":"examples/02_listen_to_blocks/README.md","ref":"examples/02_listen_to_blocks/README.md","articles":[]},"previous":{"title":"Overview","level":"2.1","depth":1,"path":"examples/README.md","ref":"examples/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/01_simple_connect/README.md","mtime":"2018-09-19T09:57:54.543Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@ async function getChain () {
|
||||
|
||||
async function main () {
|
||||
const chain = await getChain()
|
||||
|
||||
console.log('You are connected to chain:', chain)
|
||||
}
|
||||
|
||||
|
||||
+2
-5
@@ -1,4 +1,4 @@
|
||||
= Listen to new blocks
|
||||
# Listen to new blocks
|
||||
|
||||
This example shows how to subscribe to new blocks.
|
||||
|
||||
@@ -6,7 +6,4 @@ It displays the block number every time a new block is seen by the node you are
|
||||
|
||||
NOTE: The example runs until you stop it wit CTRL+C
|
||||
|
||||
[source, javascript]
|
||||
----
|
||||
include::index.js[]
|
||||
----
|
||||
[include](index.js)
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../../api/">
|
||||
|
||||
<a href="../../api/">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../../api-format/">
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../api-provider/">
|
||||
|
||||
<a href="../../api-provider/">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../type-extrinsics/">
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../type-jsonrpc/">
|
||||
|
||||
<a href="../../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../type-params/">
|
||||
|
||||
<a href="../../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../type-primitives/">
|
||||
|
||||
<a href="../../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../../type-storage/">
|
||||
|
||||
<a href="../../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../">
|
||||
<li class="chapter " data-level="2.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="../01_simple_connect/">
|
||||
|
||||
<a href="../01_simple_connect/">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="3.3" data-path="./">
|
||||
<li class="chapter active" data-level="2.3" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="../03_listen_to_balance_change/">
|
||||
|
||||
<a href="../03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="../04_generate_account/">
|
||||
|
||||
<a href="../04_generate_account/">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="../05_read_storage/">
|
||||
|
||||
<a href="../05_read_storage/">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="../06_craft_extrinsic/">
|
||||
|
||||
<a href="../06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="../07_transfer_dots/">
|
||||
|
||||
<a href="../07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../../CONTRIBUTING.html">
|
||||
|
||||
<a href="../../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -405,27 +370,10 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="listen-to-new-blocks">Listen to new blocks</h1>
|
||||
<div class="paragraph">
|
||||
<p>This example shows how to subscribe to new blocks.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>It displays the block number every time a new block is seen by the node you are connected to.</p>
|
||||
</div>
|
||||
<div class="admonitionblock note">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<div class="title">Note</div>
|
||||
</td>
|
||||
<td class="content">
|
||||
The example runs until you stop it wit CTRL+C
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-javascript" data-lang="javascript"><span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">'bn.js'</span>)
|
||||
<p>NOTE: The example runs until you stop it wit CTRL+C</p>
|
||||
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">'bn.js'</span>)
|
||||
<span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api-provider/ws'</span>).default
|
||||
<span class="hljs-keyword">const</span> provider = <span class="hljs-keyword">new</span> WsProvider(<span class="hljs-string">'ws://127.0.0.1:9944'</span>)
|
||||
@@ -435,13 +383,14 @@ The example runs until you stop it wit CTRL+C
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Blocks will be shown as they come in, CTRL+C to stop:'</span>)
|
||||
api.chain.newHead((_, header) => {
|
||||
<span class="hljs-keyword">const</span> bnBlockNumber = <span class="hljs-keyword">new</span> BN(header.number, <span class="hljs-number">16</span>)
|
||||
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'#'</span> + bnBlockNumber.toString(<span class="hljs-number">10</span>))
|
||||
})
|
||||
}
|
||||
|
||||
main()</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
main()
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@@ -484,7 +433,7 @@ main()</code></pre>
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Listen to blocks","level":"3.3","depth":1,"next":{"title":"Listen to balance change","level":"3.4","depth":1,"path":"examples/03_listen_to_balance_change/README.adoc","ref":"examples/03_listen_to_balance_change/README.adoc","articles":[]},"previous":{"title":"Simple connect","level":"3.2","depth":1,"path":"examples/01_simple_connect/README.adoc","ref":"examples/01_simple_connect/README.adoc","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/02_listen_to_blocks/README.adoc","mtime":"2018-09-17T12:30:32.113Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Listen to blocks","level":"2.3","depth":1,"next":{"title":"Listen to balance change","level":"2.4","depth":1,"path":"examples/03_listen_to_balance_change/README.md","ref":"examples/03_listen_to_balance_change/README.md","articles":[]},"previous":{"title":"Simple connect","level":"2.2","depth":1,"path":"examples/01_simple_connect/README.md","ref":"examples/01_simple_connect/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/02_listen_to_blocks/README.md","mtime":"2018-09-19T09:57:54.545Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ function main () {
|
||||
console.log('Blocks will be shown as they come in, CTRL+C to stop:')
|
||||
api.chain.newHead((_, header) => {
|
||||
const bnBlockNumber = new BN(header.number, 16)
|
||||
|
||||
console.log('#' + bnBlockNumber.toString(10))
|
||||
})
|
||||
}
|
||||
|
||||
+2
-5
@@ -1,8 +1,5 @@
|
||||
= Listen to balance changes
|
||||
# Listen to balance changes
|
||||
|
||||
This example shows how to instantiate a Polkadot API object and use it to connect to a node.
|
||||
|
||||
[source, javascript]
|
||||
----
|
||||
include::index.js[]
|
||||
----
|
||||
[include](index.js)
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../../api/">
|
||||
|
||||
<a href="../../api/">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../../api-format/">
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../api-provider/">
|
||||
|
||||
<a href="../../api-provider/">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../type-extrinsics/">
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../type-jsonrpc/">
|
||||
|
||||
<a href="../../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../type-params/">
|
||||
|
||||
<a href="../../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../type-primitives/">
|
||||
|
||||
<a href="../../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../../type-storage/">
|
||||
|
||||
<a href="../../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../">
|
||||
<li class="chapter " data-level="2.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="../01_simple_connect/">
|
||||
|
||||
<a href="../01_simple_connect/">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="../02_listen_to_blocks/">
|
||||
|
||||
<a href="../02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="3.4" data-path="./">
|
||||
<li class="chapter active" data-level="2.4" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="../04_generate_account/">
|
||||
|
||||
<a href="../04_generate_account/">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="../05_read_storage/">
|
||||
|
||||
<a href="../05_read_storage/">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="../06_craft_extrinsic/">
|
||||
|
||||
<a href="../06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="../07_transfer_dots/">
|
||||
|
||||
<a href="../07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../../CONTRIBUTING.html">
|
||||
|
||||
<a href="../../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -405,12 +370,8 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="listen-to-balance-changes">Listen to balance changes</h1>
|
||||
<div class="paragraph">
|
||||
<p>This example shows how to instantiate a Polkadot API object and use it to connect to a node.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-javascript" data-lang="javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api-provider/ws'</span>).default
|
||||
<span class="hljs-keyword">const</span> storage = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/storage'</span>).default
|
||||
<span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">'bn.js'</span>)
|
||||
@@ -419,13 +380,16 @@
|
||||
<span class="hljs-keyword">const</span> Alice = <span class="hljs-string">'5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'</span>
|
||||
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'You may let this example running and start the example 06 or send DOTs to '</span> + Alice)
|
||||
api.state.storage([[storage.staking.public.freeBalanceOf, Alice]], (_, values) => {
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Balance of <span class="hljs-subst">${Alice}</span>: <span class="hljs-subst">${new BN(values[0]).toString(10)}</span> DOTs`</span>)
|
||||
}).then((subscriptionId) => {
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Balance changes subscription id:'</span>, subscriptionId)
|
||||
})</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
api.state
|
||||
.storage([[storage.staking.public.freeBalanceOf, Alice]], (_, values) => {
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Balance of <span class="hljs-subst">${Alice}</span>: <span class="hljs-subst">${new BN(values[0]).toString(10)}</span> DOTs`</span>)
|
||||
})
|
||||
.then((subscriptionId) => {
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Balance changes subscription id:'</span>, subscriptionId)
|
||||
})
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@@ -468,7 +432,7 @@ api.state.storage([[storage.staking.public.freeBalanceOf, Alice]], (_, values) =
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Listen to balance change","level":"3.4","depth":1,"next":{"title":"Generate Accounts","level":"3.5","depth":1,"path":"examples/04_generate_account/README.adoc","ref":"examples/04_generate_account/README.adoc","articles":[]},"previous":{"title":"Listen to blocks","level":"3.3","depth":1,"path":"examples/02_listen_to_blocks/README.adoc","ref":"examples/02_listen_to_blocks/README.adoc","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/03_listen_to_balance_change/README.adoc","mtime":"2018-09-17T12:30:32.113Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Listen to balance change","level":"2.4","depth":1,"next":{"title":"Generate Accounts","level":"2.5","depth":1,"path":"examples/04_generate_account/README.md","ref":"examples/04_generate_account/README.md","articles":[]},"previous":{"title":"Listen to blocks","level":"2.3","depth":1,"path":"examples/02_listen_to_blocks/README.md","ref":"examples/02_listen_to_blocks/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/03_listen_to_balance_change/README.md","mtime":"2018-09-19T09:57:54.539Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -7,8 +7,11 @@ const api = new Api(provider)
|
||||
const Alice = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'
|
||||
|
||||
console.log('You may let this example running and start the example 06 or send DOTs to ' + Alice)
|
||||
api.state.storage([[storage.staking.public.freeBalanceOf, Alice]], (_, values) => {
|
||||
console.log(`Balance of ${Alice}: ${new BN(values[0]).toString(10)} DOTs`)
|
||||
}).then((subscriptionId) => {
|
||||
console.log('Balance changes subscription id:', subscriptionId)
|
||||
})
|
||||
|
||||
api.state
|
||||
.storage([[storage.staking.public.freeBalanceOf, Alice]], (_, values) => {
|
||||
console.log(`Balance of ${Alice}: ${new BN(values[0]).toString(10)} DOTs`)
|
||||
})
|
||||
.then((subscriptionId) => {
|
||||
console.log('Balance changes subscription id:', subscriptionId)
|
||||
})
|
||||
|
||||
+2
-5
@@ -1,8 +1,5 @@
|
||||
= Generate accounts
|
||||
# Generate accounts
|
||||
|
||||
If you want to develop a wallet or a program that will accept payments in DOTs, you likely will need to generate addresses. This sample shows you how to generate accounts in several ways.
|
||||
|
||||
[source, javascript]
|
||||
----
|
||||
include::index.js[]
|
||||
----
|
||||
[include](index.js)
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../../api/">
|
||||
|
||||
<a href="../../api/">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../../api-format/">
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../api-provider/">
|
||||
|
||||
<a href="../../api-provider/">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../type-extrinsics/">
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../type-jsonrpc/">
|
||||
|
||||
<a href="../../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../type-params/">
|
||||
|
||||
<a href="../../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../type-primitives/">
|
||||
|
||||
<a href="../../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../../type-storage/">
|
||||
|
||||
<a href="../../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../">
|
||||
<li class="chapter " data-level="2.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="../01_simple_connect/">
|
||||
|
||||
<a href="../01_simple_connect/">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="../02_listen_to_blocks/">
|
||||
|
||||
<a href="../02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="../03_listen_to_balance_change/">
|
||||
|
||||
<a href="../03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="3.5" data-path="./">
|
||||
<li class="chapter active" data-level="2.5" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="../05_read_storage/">
|
||||
|
||||
<a href="../05_read_storage/">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="../06_craft_extrinsic/">
|
||||
|
||||
<a href="../06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="../07_transfer_dots/">
|
||||
|
||||
<a href="../07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../../CONTRIBUTING.html">
|
||||
|
||||
<a href="../../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -405,20 +370,17 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="generate-accounts">Generate accounts</h1>
|
||||
<div class="paragraph">
|
||||
<p>If you want to develop a wallet or a program that will accept payments in DOTs, you likely will need to generate addresses. This sample shows you how to generate accounts in several ways.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-javascript" data-lang="javascript"><span class="hljs-keyword">const</span> Keyring = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/util-keyring'</span>).default
|
||||
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Keyring = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/util-keyring'</span>).default
|
||||
<span class="hljs-keyword">const</span> u8aToHex = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/util/u8a/toHex'</span>).default
|
||||
<span class="hljs-keyword">const</span> Encoder = <span class="hljs-keyword">new</span> TextEncoder() <span class="hljs-comment">// always utf-8</span>
|
||||
<span class="hljs-keyword">const</span> crypto = <span class="hljs-built_in">require</span>(<span class="hljs-string">'crypto'</span>)
|
||||
|
||||
<span class="hljs-comment">// A fixed seed from an array</span>
|
||||
<span class="hljs-keyword">const</span> SEED1 = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Uint8Array</span>(
|
||||
[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>, <span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>, <span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>,
|
||||
<span class="hljs-number">22</span>, <span class="hljs-number">23</span>, <span class="hljs-number">24</span>, <span class="hljs-number">25</span>, <span class="hljs-number">26</span>, <span class="hljs-number">27</span>, <span class="hljs-number">28</span>, <span class="hljs-number">29</span>, <span class="hljs-number">30</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>])
|
||||
<span class="hljs-keyword">const</span> SEED1 = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Uint8Array</span>([
|
||||
<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>, <span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>, <span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>,
|
||||
<span class="hljs-number">22</span>, <span class="hljs-number">23</span>, <span class="hljs-number">24</span>, <span class="hljs-number">25</span>, <span class="hljs-number">26</span>, <span class="hljs-number">27</span>, <span class="hljs-number">28</span>, <span class="hljs-number">29</span>, <span class="hljs-number">30</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>
|
||||
])
|
||||
|
||||
<span class="hljs-comment">// A fixed seed from a 32 chars string</span>
|
||||
<span class="hljs-keyword">const</span> SEED2 = Encoder.encode(<span class="hljs-string">'correct horse battery and staple'</span>)
|
||||
@@ -433,14 +395,16 @@
|
||||
|
||||
<span class="hljs-comment">// A random seed</span>
|
||||
<span class="hljs-keyword">const</span> SEED = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Uint8Array</span>(<span class="hljs-number">32</span>)
|
||||
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Random Addresses (random for each run):'</span>)
|
||||
|
||||
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">3</span>; i < <span class="hljs-number">13</span>; i++) {
|
||||
Buffer.from(crypto.randomFillSync(SEED))
|
||||
<span class="hljs-keyword">const</span> pair3 = keyring.addFromSeed(SEED)
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Address <span class="hljs-subst">${i}</span>\t <span class="hljs-subst">${pair3.address()}</span>\t Seed: <span class="hljs-subst">${u8aToHex(SEED)}</span>`</span>)
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@@ -483,7 +447,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Generate Accounts","level":"3.5","depth":1,"next":{"title":"Read Storage","level":"3.6","depth":1,"path":"examples/05_read_storage/README.adoc","ref":"examples/05_read_storage/README.adoc","articles":[]},"previous":{"title":"Listen to balance change","level":"3.4","depth":1,"path":"examples/03_listen_to_balance_change/README.adoc","ref":"examples/03_listen_to_balance_change/README.adoc","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/04_generate_account/README.adoc","mtime":"2018-09-17T12:30:32.113Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Generate Accounts","level":"2.5","depth":1,"next":{"title":"Read Storage","level":"2.6","depth":1,"path":"examples/05_read_storage/README.md","ref":"examples/05_read_storage/README.md","articles":[]},"previous":{"title":"Listen to balance change","level":"2.4","depth":1,"path":"examples/03_listen_to_balance_change/README.md","ref":"examples/03_listen_to_balance_change/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/04_generate_account/README.md","mtime":"2018-09-19T09:57:54.541Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -4,9 +4,10 @@ const Encoder = new TextEncoder() // always utf-8
|
||||
const crypto = require('crypto')
|
||||
|
||||
// A fixed seed from an array
|
||||
const SEED1 = new Uint8Array(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 0, 0])
|
||||
const SEED1 = new Uint8Array([
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 0, 0
|
||||
])
|
||||
|
||||
// A fixed seed from a 32 chars string
|
||||
const SEED2 = Encoder.encode('correct horse battery and staple')
|
||||
@@ -21,7 +22,9 @@ console.log(`Address 2\t ${pair2.address()}\t Seed: ${u8aToHex(SEED2)}`)
|
||||
|
||||
// A random seed
|
||||
const SEED = new Uint8Array(32)
|
||||
|
||||
console.log('Random Addresses (random for each run):')
|
||||
|
||||
for (var i = 3; i < 13; i++) {
|
||||
Buffer.from(crypto.randomFillSync(SEED))
|
||||
const pair3 = keyring.addFromSeed(SEED)
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
= Read storage
|
||||
# Read storage
|
||||
|
||||
Many important variable are available through the storage API. This example shows how to call a few of those APIs.
|
||||
|
||||
[source, javascript]
|
||||
----
|
||||
include::index.js[]
|
||||
----
|
||||
[include](index.js)
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../../api/">
|
||||
|
||||
<a href="../../api/">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../../api-format/">
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../api-provider/">
|
||||
|
||||
<a href="../../api-provider/">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../type-extrinsics/">
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../type-jsonrpc/">
|
||||
|
||||
<a href="../../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../type-params/">
|
||||
|
||||
<a href="../../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../type-primitives/">
|
||||
|
||||
<a href="../../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../../type-storage/">
|
||||
|
||||
<a href="../../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../">
|
||||
<li class="chapter " data-level="2.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="../01_simple_connect/">
|
||||
|
||||
<a href="../01_simple_connect/">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="../02_listen_to_blocks/">
|
||||
|
||||
<a href="../02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="../03_listen_to_balance_change/">
|
||||
|
||||
<a href="../03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="../04_generate_account/">
|
||||
|
||||
<a href="../04_generate_account/">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="3.6" data-path="./">
|
||||
<li class="chapter active" data-level="2.6" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="../06_craft_extrinsic/">
|
||||
|
||||
<a href="../06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="../07_transfer_dots/">
|
||||
|
||||
<a href="../07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../../CONTRIBUTING.html">
|
||||
|
||||
<a href="../../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -405,12 +370,8 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="read-storage">Read storage</h1>
|
||||
<div class="paragraph">
|
||||
<p>Many important variable are available through the storage API. This example shows how to call a few of those APIs.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-javascript" data-lang="javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api-provider/ws'</span>).default
|
||||
<span class="hljs-keyword">const</span> storage = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/storage'</span>).default
|
||||
<span class="hljs-keyword">const</span> BN = <span class="hljs-built_in">require</span>(<span class="hljs-string">'bn.js'</span>)
|
||||
@@ -433,18 +394,17 @@
|
||||
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span> (<span class="hljs-params"></span>) </span>{
|
||||
<span class="hljs-keyword">const</span> address = <span class="hljs-string">'5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'</span>
|
||||
<span class="hljs-keyword">const</span> validators = <span class="hljs-keyword">await</span> getValidators()
|
||||
<span class="hljs-keyword">const</span> bn = <span class="hljs-keyword">await</span> getAccountIndex(address)
|
||||
<span class="hljs-keyword">const</span> index = <span class="hljs-keyword">await</span> getAccountIndex(address)
|
||||
<span class="hljs-keyword">const</span> blockPeriod = <span class="hljs-keyword">await</span> getBlockPeriod()
|
||||
|
||||
<span class="hljs-keyword">const</span> index = <span class="hljs-keyword">new</span> BN(bn)
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`BlockPeriod: <span class="hljs-subst">${new BN(blockPeriod).toString(10)}</span> seconds`</span>)
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Account Index of <span class="hljs-subst">${address}</span>: <span class="hljs-subst">${index.toString(10)}</span>`</span>)
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Current validators'</span>, validators)
|
||||
}
|
||||
|
||||
main().finally(_ => process.exit())</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
main().finally(_ => process.exit())
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@@ -487,7 +447,7 @@ main().finally(_ => process.exit())</code></pre>
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Read Storage","level":"3.6","depth":1,"next":{"title":"Craft Extrinsic","level":"3.7","depth":1,"path":"examples/06_craft_extrinsic/README.adoc","ref":"examples/06_craft_extrinsic/README.adoc","articles":[]},"previous":{"title":"Generate Accounts","level":"3.5","depth":1,"path":"examples/04_generate_account/README.adoc","ref":"examples/04_generate_account/README.adoc","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/05_read_storage/README.adoc","mtime":"2018-09-17T12:30:32.113Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Read Storage","level":"2.6","depth":1,"next":{"title":"Craft Extrinsic","level":"2.7","depth":1,"path":"examples/06_craft_extrinsic/README.md","ref":"examples/06_craft_extrinsic/README.md","articles":[]},"previous":{"title":"Generate Accounts","level":"2.5","depth":1,"path":"examples/04_generate_account/README.md","ref":"examples/04_generate_account/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/05_read_storage/README.md","mtime":"2018-09-19T09:57:54.540Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -21,10 +21,9 @@ async function getBlockPeriod () {
|
||||
async function main () {
|
||||
const address = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'
|
||||
const validators = await getValidators()
|
||||
const bn = await getAccountIndex(address)
|
||||
const index = await getAccountIndex(address)
|
||||
const blockPeriod = await getBlockPeriod()
|
||||
|
||||
const index = new BN(bn)
|
||||
console.log(`BlockPeriod: ${new BN(blockPeriod).toString(10)} seconds`)
|
||||
console.log(`Account Index of ${address}: ${index.toString(10)}`)
|
||||
console.log('Current validators', validators)
|
||||
|
||||
+2
-5
@@ -1,8 +1,5 @@
|
||||
= Craft Extrinsic
|
||||
# Craft Extrinsic
|
||||
|
||||
In the current version, crafting an extrinsic is a rather cumbersome process. This sample guides you though it and shows how to tranfer DOTs from an account to another.
|
||||
|
||||
[source, javascript]
|
||||
----
|
||||
include::index.js[]
|
||||
----
|
||||
[include](index.js)
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../../api/">
|
||||
|
||||
<a href="../../api/">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../../api-format/">
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../api-provider/">
|
||||
|
||||
<a href="../../api-provider/">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../type-extrinsics/">
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../type-jsonrpc/">
|
||||
|
||||
<a href="../../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../type-params/">
|
||||
|
||||
<a href="../../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../type-primitives/">
|
||||
|
||||
<a href="../../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../../type-storage/">
|
||||
|
||||
<a href="../../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../">
|
||||
<li class="chapter " data-level="2.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="../01_simple_connect/">
|
||||
|
||||
<a href="../01_simple_connect/">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="../02_listen_to_blocks/">
|
||||
|
||||
<a href="../02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="../03_listen_to_balance_change/">
|
||||
|
||||
<a href="../03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="../04_generate_account/">
|
||||
|
||||
<a href="../04_generate_account/">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="../05_read_storage/">
|
||||
|
||||
<a href="../05_read_storage/">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="3.7" data-path="./">
|
||||
<li class="chapter active" data-level="2.7" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="../07_transfer_dots/">
|
||||
|
||||
<a href="../07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../../CONTRIBUTING.html">
|
||||
|
||||
<a href="../../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -405,12 +370,8 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="craft-extrinsic">Craft Extrinsic</h1>
|
||||
<div class="paragraph">
|
||||
<p>In the current version, crafting an extrinsic is a rather cumbersome process. This sample guides you though it and shows how to tranfer DOTs from an account to another.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-javascript" data-lang="javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api-provider/ws'</span>).default
|
||||
<span class="hljs-keyword">const</span> extrinsics = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/extrinsics'</span>).default
|
||||
<span class="hljs-keyword">const</span> encodeExtrinsic = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/extrinsics/codec/encode'</span>).default
|
||||
@@ -430,6 +391,7 @@
|
||||
|
||||
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">transfer</span> (<span class="hljs-params">keyRingFrom, addressTo, amount</span>) </span>{
|
||||
<span class="hljs-keyword">const</span> accountIndex = <span class="hljs-keyword">await</span> getAccountIndex(keyRingFrom.address())
|
||||
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Current accountIndex: <span class="hljs-subst">${accountIndex}</span>`</span>)
|
||||
|
||||
<span class="hljs-comment">// encode the call for signing</span>
|
||||
@@ -460,13 +422,17 @@
|
||||
<span class="hljs-keyword">const</span> amount = <span class="hljs-keyword">new</span> BN(<span class="hljs-number">999</span>) <span class="hljs-comment">// on dev chain, the fee is 1, that makes it a round 1000</span>
|
||||
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Crafting and sending an extrinsic for Alice to send Bob <span class="hljs-subst">${amount}</span> DOTs`</span>)
|
||||
|
||||
transfer(Alice, addressBob, amount)
|
||||
.then(() => <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Sent'</span>))
|
||||
.catch((e) => <span class="hljs-built_in">console</span>.log(
|
||||
<span class="hljs-string">'HINT: Make sure you wait for the storage to update before sending the next extrinsic'</span>, e))
|
||||
.finally(_ => process.exit(<span class="hljs-number">0</span>))</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
.then(() =>
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Sent'</span>)
|
||||
)
|
||||
.catch((e) =>
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'HINT: Make sure you wait for the storage to update before sending the next extrinsic'</span>, e)
|
||||
)
|
||||
.finally(_ => process.exit(<span class="hljs-number">0</span>))
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@@ -509,7 +475,7 @@ transfer(Alice, addressBob, amount)
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Craft Extrinsic","level":"3.7","depth":1,"next":{"title":"Transfer DOTs","level":"3.8","depth":1,"path":"examples/07_transfer_dots/README.adoc","ref":"examples/07_transfer_dots/README.adoc","articles":[]},"previous":{"title":"Read Storage","level":"3.6","depth":1,"path":"examples/05_read_storage/README.adoc","ref":"examples/05_read_storage/README.adoc","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/06_craft_extrinsic/README.adoc","mtime":"2018-09-17T12:30:32.113Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Craft Extrinsic","level":"2.7","depth":1,"next":{"title":"Transfer DOTs","level":"2.8","depth":1,"path":"examples/07_transfer_dots/README.md","ref":"examples/07_transfer_dots/README.md","articles":[]},"previous":{"title":"Read Storage","level":"2.6","depth":1,"path":"examples/05_read_storage/README.md","ref":"examples/05_read_storage/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/06_craft_extrinsic/README.md","mtime":"2018-09-19T09:57:54.537Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -18,6 +18,7 @@ async function getAccountIndex (address) {
|
||||
|
||||
async function transfer (keyRingFrom, addressTo, amount) {
|
||||
const accountIndex = await getAccountIndex(keyRingFrom.address())
|
||||
|
||||
console.log(`Current accountIndex: ${accountIndex}`)
|
||||
|
||||
// encode the call for signing
|
||||
@@ -48,8 +49,12 @@ const addressBob = '5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE'
|
||||
const amount = new BN(999) // on dev chain, the fee is 1, that makes it a round 1000
|
||||
|
||||
console.log(`Crafting and sending an extrinsic for Alice to send Bob ${amount} DOTs`)
|
||||
|
||||
transfer(Alice, addressBob, amount)
|
||||
.then(() => console.log('Sent'))
|
||||
.catch((e) => console.log(
|
||||
'HINT: Make sure you wait for the storage to update before sending the next extrinsic', e))
|
||||
.then(() =>
|
||||
console.log('Sent')
|
||||
)
|
||||
.catch((e) =>
|
||||
console.log('HINT: Make sure you wait for the storage to update before sending the next extrinsic', e)
|
||||
)
|
||||
.finally(_ => process.exit(0))
|
||||
|
||||
+2
-5
@@ -1,8 +1,5 @@
|
||||
= Tranfer DOTs
|
||||
# Tranfer DOTs
|
||||
|
||||
This sample is more 'straight to the point' and shows the easiest way to transfer DOTs from an account to another.
|
||||
|
||||
[source, javascript]
|
||||
----
|
||||
include::index.js[]
|
||||
----
|
||||
[include](index.js)
|
||||
@@ -57,8 +57,6 @@
|
||||
<link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../../CONTRIBUTING.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="../06_craft_extrinsic/" />
|
||||
|
||||
@@ -87,7 +85,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +102,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../../api/">
|
||||
|
||||
<a href="../../api/">
|
||||
|
||||
@@ -122,14 +113,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../../api-format/">
|
||||
<a href="../../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +129,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../../api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../../api-provider/">
|
||||
|
||||
<a href="../../api-provider/">
|
||||
|
||||
@@ -148,9 +145,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../../api-rx/">
|
||||
|
||||
<a href="../../api-rx/">
|
||||
|
||||
@@ -161,14 +190,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../../type-extrinsics/">
|
||||
<a href="../../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +206,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../../type-jsonrpc/">
|
||||
|
||||
<a href="../../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../../type-params/">
|
||||
|
||||
<a href="../../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../../type-primitives/">
|
||||
|
||||
<a href="../../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../../type-storage/">
|
||||
|
||||
<a href="../../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +218,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../">
|
||||
<li class="chapter " data-level="2.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
@@ -248,7 +231,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="../01_simple_connect/">
|
||||
|
||||
<a href="../01_simple_connect/">
|
||||
|
||||
@@ -261,7 +244,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="../02_listen_to_blocks/">
|
||||
|
||||
<a href="../02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +257,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="../03_listen_to_balance_change/">
|
||||
|
||||
<a href="../03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +270,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="../04_generate_account/">
|
||||
|
||||
<a href="../04_generate_account/">
|
||||
|
||||
@@ -300,7 +283,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="../05_read_storage/">
|
||||
|
||||
<a href="../05_read_storage/">
|
||||
|
||||
@@ -313,7 +296,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="../06_craft_extrinsic/">
|
||||
|
||||
<a href="../06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +309,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="3.8" data-path="./">
|
||||
<li class="chapter active" data-level="2.8" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -341,26 +324,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../../CONTRIBUTING.html">
|
||||
|
||||
<a href="../../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -405,12 +368,8 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="tranfer-dots">Tranfer DOTs</h1>
|
||||
<div class="paragraph">
|
||||
<p>This sample is more 'straight to the point' and shows the easiest way to transfer DOTs from an account to another.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code class="language-javascript" data-lang="javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Api = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api'</span>).default
|
||||
<span class="hljs-keyword">const</span> WsProvider = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/api-provider/ws'</span>).default
|
||||
<span class="hljs-keyword">const</span> extrinsics = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/extrinsics'</span>).default
|
||||
<span class="hljs-keyword">const</span> encodeExtrinsic = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@polkadot/extrinsics/codec/encode/uncheckedLength'</span>).default
|
||||
@@ -448,12 +407,13 @@
|
||||
<span class="hljs-keyword">const</span> amount = <span class="hljs-keyword">new</span> BN(<span class="hljs-number">999</span>) <span class="hljs-comment">// on dev chain, the fee is 1, that makes it a round 1000</span>
|
||||
|
||||
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Crafting and sending an extrinsic for Alice to send Bob <span class="hljs-subst">${amount}</span> DOTs`</span>)
|
||||
|
||||
transfer(Alice, addressBob, amount)
|
||||
.then(() => <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Done'</span>))
|
||||
.catch((e) => <span class="hljs-built_in">console</span>.log(e))
|
||||
.finally(_ => process.exit(<span class="hljs-number">0</span>))</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
.finally(_ => process.exit(<span class="hljs-number">0</span>))
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@@ -480,15 +440,11 @@ transfer(Alice, addressBob, amount)
|
||||
|
||||
|
||||
|
||||
<a href="../06_craft_extrinsic/" class="navigation navigation-prev " aria-label="Previous page: Craft Extrinsic">
|
||||
<a href="../06_craft_extrinsic/" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Craft Extrinsic">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../../CONTRIBUTING.html" class="navigation navigation-next " aria-label="Next page: Contributing guide">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
@@ -496,7 +452,7 @@ transfer(Alice, addressBob, amount)
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Transfer DOTs","level":"3.8","depth":1,"next":{"title":"Contributing guide","level":"4.1","depth":1,"path":"CONTRIBUTING.adoc","ref":"CONTRIBUTING.adoc","articles":[]},"previous":{"title":"Craft Extrinsic","level":"3.7","depth":1,"path":"examples/06_craft_extrinsic/README.adoc","ref":"examples/06_craft_extrinsic/README.adoc","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/07_transfer_dots/README.adoc","mtime":"2018-09-17T12:30:32.113Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"../..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Transfer DOTs","level":"2.8","depth":1,"previous":{"title":"Craft Extrinsic","level":"2.7","depth":1,"path":"examples/06_craft_extrinsic/README.md","ref":"examples/06_craft_extrinsic/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/07_transfer_dots/README.md","mtime":"2018-09-19T09:57:54.547Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"../..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -36,6 +36,7 @@ const addressBob = '5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE'
|
||||
const amount = new BN(999) // on dev chain, the fee is 1, that makes it a round 1000
|
||||
|
||||
console.log(`Crafting and sending an extrinsic for Alice to send Bob ${amount} DOTs`)
|
||||
|
||||
transfer(Alice, addressBob, amount)
|
||||
.then(() => console.log('Done'))
|
||||
.catch((e) => console.log(e))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= Examples
|
||||
# Examples
|
||||
|
||||
For the following examples, you need a local node. It is usually convenient testing with:
|
||||
|
||||
@@ -15,11 +15,11 @@ Those accounts are easy to add if you don´t have/see them. The seed of Alice´s
|
||||
|
||||
NOTE: Note the spaces padding Alice´s key up to 32 chars.
|
||||
|
||||
== Install
|
||||
## Install
|
||||
|
||||
From each folder, run `yarn` to install the required dependencies
|
||||
|
||||
== Running the examples
|
||||
## Running the examples
|
||||
|
||||
From each folder, run:
|
||||
```
|
||||
+73
-154
@@ -60,7 +60,7 @@
|
||||
<link rel="next" href="01_simple_connect/" />
|
||||
|
||||
|
||||
<link rel="prev" href="../type-storage/" />
|
||||
<link rel="prev" href="../api-rx/classes/_index_.rxapi.html" />
|
||||
|
||||
|
||||
</head>
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../api/">
|
||||
<li class="chapter " data-level="1.2" data-path="../api/">
|
||||
|
||||
<a href="../api/">
|
||||
|
||||
@@ -122,14 +115,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="../api/classes/_index_.api.html">
|
||||
|
||||
<a href="../api-format/">
|
||||
<a href="../api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -137,7 +131,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="../api-provider/">
|
||||
|
||||
<a href="../api-provider/">
|
||||
|
||||
@@ -148,9 +147,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="../api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="../api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="../api-rx/">
|
||||
|
||||
<a href="../api-rx/">
|
||||
|
||||
@@ -161,14 +192,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="../type-extrinsics/">
|
||||
<a href="../api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -176,55 +208,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../type-jsonrpc/">
|
||||
|
||||
<a href="../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../type-params/">
|
||||
|
||||
<a href="../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../type-primitives/">
|
||||
|
||||
<a href="../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../type-storage/">
|
||||
|
||||
<a href="../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -235,7 +220,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter active" data-level="3.1" data-path="./">
|
||||
<li class="chapter active" data-level="2.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
@@ -248,7 +233,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="01_simple_connect/">
|
||||
|
||||
<a href="01_simple_connect/">
|
||||
|
||||
@@ -261,7 +246,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="02_listen_to_blocks/">
|
||||
|
||||
<a href="02_listen_to_blocks/">
|
||||
|
||||
@@ -274,7 +259,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="03_listen_to_balance_change/">
|
||||
|
||||
<a href="03_listen_to_balance_change/">
|
||||
|
||||
@@ -287,7 +272,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="04_generate_account/">
|
||||
|
||||
<a href="04_generate_account/">
|
||||
|
||||
@@ -300,7 +285,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="05_read_storage/">
|
||||
|
||||
<a href="05_read_storage/">
|
||||
|
||||
@@ -313,7 +298,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="06_craft_extrinsic/">
|
||||
|
||||
<a href="06_craft_extrinsic/">
|
||||
|
||||
@@ -326,7 +311,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="07_transfer_dots/">
|
||||
|
||||
<a href="07_transfer_dots/">
|
||||
|
||||
@@ -341,26 +326,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../CONTRIBUTING.html">
|
||||
|
||||
<a href="../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -405,67 +370,21 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="examples">Examples</h1>
|
||||
<div id="preamble">
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>For the following examples, you need a local node. It is usually convenient testing with:</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code>polkadot --dev</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Some of the examples use the following accounts:</p>
|
||||
</div>
|
||||
<div class="ulist">
|
||||
<pre><code>polkadot --dev
|
||||
</code></pre><p>Some of the examples use the following accounts:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Alice: <code>5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Bob: <code>5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE</code></p>
|
||||
</li>
|
||||
<li>Alice: <code>5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ</code></li>
|
||||
<li>Bob: <code>5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE</code></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Those accounts are easy to add if you don´t have/see them. The seed of Alice´s account is <code>Alice␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣</code> and the seed of Bob is…​ well you guess…​</p>
|
||||
</div>
|
||||
<div class="admonitionblock note">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<div class="title">Note</div>
|
||||
</td>
|
||||
<td class="content">
|
||||
Note the spaces padding Alice´s key up to 32 chars.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_install">Install</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>Those accounts are easy to add if you don´t have/see them. The seed of Alice´s account is <code>Alice␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣</code> and the seed of Bob is... well you guess...</p>
|
||||
<p>NOTE: Note the spaces padding Alice´s key up to 32 chars.</p>
|
||||
<h2 id="install">Install</h2>
|
||||
<p>From each folder, run <code>yarn</code> to install the required dependencies</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_running_the_examples">Running the examples</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<h2 id="running-the-examples">Running the examples</h2>
|
||||
<p>From each folder, run:</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre class="highlight"><code>yarn start</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<pre><code>yarn start
|
||||
</code></pre>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -492,7 +411,7 @@ Note the spaces padding Alice´s key up to 32 chars.
|
||||
|
||||
|
||||
|
||||
<a href="../type-storage/" class="navigation navigation-prev " aria-label="Previous page: type-storage">
|
||||
<a href="../api-rx/classes/_index_.rxapi.html" class="navigation navigation-prev " aria-label="Previous page: ApiRx">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
@@ -508,7 +427,7 @@ Note the spaces padding Alice´s key up to 32 chars.
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Overview","level":"3.1","depth":1,"next":{"title":"Simple connect","level":"3.2","depth":1,"path":"examples/01_simple_connect/README.adoc","ref":"examples/01_simple_connect/README.adoc","articles":[]},"previous":{"title":"type-storage","level":"2.9","depth":1,"path":"type-storage/README.md","ref":"type-storage/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/README.adoc","mtime":"2018-09-17T12:30:32.113Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"..","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Overview","level":"2.1","depth":1,"next":{"title":"Simple connect","level":"2.2","depth":1,"path":"examples/01_simple_connect/README.md","ref":"examples/01_simple_connect/README.md","articles":[]},"previous":{"title":"ApiRx","level":"1.4.1","depth":2,"path":"api-rx/classes/_index_.rxapi.md","ref":"api-rx/classes/_index_.rxapi.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"examples/README.md","mtime":"2018-09-19T09:57:54.544Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
+96
-145
@@ -85,7 +85,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="header">Intro</li>
|
||||
<li class="header">Packages</li>
|
||||
|
||||
|
||||
|
||||
@@ -102,14 +102,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="api/">
|
||||
<li class="chapter " data-level="1.2" data-path="api/">
|
||||
|
||||
<a href="api/">
|
||||
|
||||
@@ -120,14 +113,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="api-format/">
|
||||
<li class="chapter " data-level="1.2.1" data-path="api/classes/_index_.api.html">
|
||||
|
||||
<a href="api-format/">
|
||||
<a href="api/classes/_index_.api.html">
|
||||
|
||||
|
||||
api-format
|
||||
Api
|
||||
|
||||
</a>
|
||||
|
||||
@@ -135,7 +129,12 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="api-provider/">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3" data-path="api-provider/">
|
||||
|
||||
<a href="api-provider/">
|
||||
|
||||
@@ -146,9 +145,41 @@
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.1" data-path="api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
<a href="api-provider/classes/_http_index_.httpprovider.html">
|
||||
|
||||
|
||||
HttpProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="api-rx/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
<a href="api-provider/classes/_ws_index_.wsprovider.html">
|
||||
|
||||
|
||||
WsProvider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.4" data-path="api-rx/">
|
||||
|
||||
<a href="api-rx/">
|
||||
|
||||
@@ -159,14 +190,15 @@
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="type-extrinsics/">
|
||||
<li class="chapter " data-level="1.4.1" data-path="api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
<a href="type-extrinsics/">
|
||||
<a href="api-rx/classes/_index_.rxapi.html">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
ApiRx
|
||||
|
||||
</a>
|
||||
|
||||
@@ -174,55 +206,8 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="type-jsonrpc/">
|
||||
|
||||
<a href="type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="type-params/">
|
||||
|
||||
<a href="type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="type-primitives/">
|
||||
|
||||
<a href="type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="type-storage/">
|
||||
|
||||
<a href="type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
@@ -233,7 +218,7 @@
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="examples/">
|
||||
<li class="chapter " data-level="2.1" data-path="examples/">
|
||||
|
||||
<a href="examples/">
|
||||
|
||||
@@ -246,7 +231,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="examples/01_simple_connect/">
|
||||
<li class="chapter " data-level="2.2" data-path="examples/01_simple_connect/">
|
||||
|
||||
<a href="examples/01_simple_connect/">
|
||||
|
||||
@@ -259,7 +244,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="examples/02_listen_to_blocks/">
|
||||
<li class="chapter " data-level="2.3" data-path="examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="examples/02_listen_to_blocks/">
|
||||
|
||||
@@ -272,7 +257,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="examples/03_listen_to_balance_change/">
|
||||
<li class="chapter " data-level="2.4" data-path="examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="examples/03_listen_to_balance_change/">
|
||||
|
||||
@@ -285,7 +270,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="examples/04_generate_account/">
|
||||
<li class="chapter " data-level="2.5" data-path="examples/04_generate_account/">
|
||||
|
||||
<a href="examples/04_generate_account/">
|
||||
|
||||
@@ -298,7 +283,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="examples/05_read_storage/">
|
||||
<li class="chapter " data-level="2.6" data-path="examples/05_read_storage/">
|
||||
|
||||
<a href="examples/05_read_storage/">
|
||||
|
||||
@@ -311,7 +296,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="examples/06_craft_extrinsic/">
|
||||
<li class="chapter " data-level="2.7" data-path="examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="examples/06_craft_extrinsic/">
|
||||
|
||||
@@ -324,7 +309,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="examples/07_transfer_dots/">
|
||||
<li class="chapter " data-level="2.8" data-path="examples/07_transfer_dots/">
|
||||
|
||||
<a href="examples/07_transfer_dots/">
|
||||
|
||||
@@ -339,26 +324,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="CONTRIBUTING.html">
|
||||
|
||||
<a href="CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
@@ -403,61 +368,47 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="polkadot-javascript-api">Polkadot Javascript API</h1>
|
||||
<div id="toc" class="toc">
|
||||
<div id="toctitle">Table of Contents</div>
|
||||
<ul class="sectlevel1">
|
||||
<li><a href="#_the_polkadot_project">The Polkadot Project</a></li>
|
||||
<li><a href="#_github_repositories">Github repositories</a></li>
|
||||
<li><a href="#_contributing">Contributing</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="preamble">
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>You can query a node and interact with the Polkadot network using Javascript. This guide describes the Polkadot Javascript API.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_the_polkadot_project">The Polkadot Project</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>You can read more about the Polkadot Network at <a href="https://polkadot.network/" class="bare" target="_blank">https://polkadot.network/</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_github_repositories">Github repositories</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>You can find the Polkadot repositories at:</p>
|
||||
</div>
|
||||
<div class="ulist">
|
||||
<h2 id="packages">Packages</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="https://github.com/polkadot-js" class="bare" target="_blank">https://github.com/polkadot-js</a></p>
|
||||
<li><a href="api/">api</a><ul>
|
||||
<li><a href="api/classes/_index_.api.html">Api</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://github.com/paritytech/polkadot" class="bare" target="_blank">https://github.com/paritytech/polkadot</a></p>
|
||||
<li><a href="api-provider/">api-provider</a><ul>
|
||||
<li><a href="api-provider/classes/_http_index_.httpprovider.html">HttpProvider</a></li>
|
||||
<li><a href="api-provider/classes/_ws_index_.wsprovider.html">WsProvider</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://github.com/paritytech/substrate" class="bare" target="_blank">https://github.com/paritytech/substrate</a></p>
|
||||
<li><a href="api-rx/">api-rx</a><ul>
|
||||
<li><a href="api-rx/classes/_index_.rxapi.html">ApiRx</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>This documentation is generated from <a href="https://github.com/polkadot-js/api" class="bare" target="_blank">https://github.com/polkadot-js/api</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_contributing">Contributing</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>Contribution to the Polkadot JS API are more than welcome. You can <a href="https://github.com/polkadot-js/api/issues/new" target="_blank">report issues</a> and <a href="https://github.com/polkadot-js/api/issues/new" target="_blank">feature requests</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2 id="examples">Examples</h2>
|
||||
<ul>
|
||||
<li><a href="examples/">Overview</a></li>
|
||||
<li><a href="examples/01_simple_connect/">Simple connect</a></li>
|
||||
<li><a href="examples/02_listen_to_blocks/">Listen to blocks</a></li>
|
||||
<li><a href="examples/03_listen_to_balance_change/">Listen to balance change</a></li>
|
||||
<li><a href="examples/04_generate_account/">Generate Accounts</a></li>
|
||||
<li><a href="examples/05_read_storage/">Read Storage</a></li>
|
||||
<li><a href="examples/06_craft_extrinsic/">Craft Extrinsic</a></li>
|
||||
<li><a href="examples/07_transfer_dots/">Transfer DOTs</a></li>
|
||||
</ul>
|
||||
<h2 id="the-polkadot-project">The Polkadot Project</h2>
|
||||
<p>You can read more about the Polkadot Network at <a href="https://polkadot.network/" target="_blank">https://polkadot.network/</a></p>
|
||||
<h2 id="github-repositories">Github repositories</h2>
|
||||
<p>You can find the Polkadot repositories at:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/polkadot-js" target="_blank">https://github.com/polkadot-js</a></li>
|
||||
<li><a href="https://github.com/paritytech/polkadot" target="_blank">https://github.com/paritytech/polkadot</a></li>
|
||||
<li><a href="https://github.com/paritytech/substrate" target="_blank">https://github.com/paritytech/substrate</a></li>
|
||||
</ul>
|
||||
<p>This documentation is generated from <a href="https://github.com/polkadot-js/api" target="_blank">https://github.com/polkadot-js/api</a></p>
|
||||
<h2 id="contributing">Contributing</h2>
|
||||
<p>Contribution to the Polkadot JS API are more than welcome. You can <a href="https://github.com/polkadot-js/api/issues/new" target="_blank">report issues</a> and <a href="https://github.com/polkadot-js/api/issues/new" target="_blank">log feature requests</a>.</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@@ -496,7 +447,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"api","level":"2.1","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"README.adoc","mtime":"2018-09-17T12:30:32.109Z","type":"asciidoc"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":".","book":{"language":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"api","level":"1.2","depth":1,"path":"api/README.md","ref":"api/README.md","articles":[{"title":"Api","level":"1.2.1","depth":2,"path":"api/classes/_index_.api.md","ref":"api/classes/_index_.api.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"README.md","mtime":"2018-09-19T10:15:30.638Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-19T11:17:59.884Z"},"basePath":".","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,215 +0,0 @@
|
||||
|
||||
@polkadot/extrinsics
|
||||
====================
|
||||
|
||||
## Index
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [Extrinsic$Sections](#extrinsic_sections)
|
||||
* [ExtrinsicUnchecked](#extrinsicunchecked)
|
||||
* [ExtrinsicWithAccount](#extrinsicwithaccount)
|
||||
* [ExtrinsicWithIndex](#extrinsicwithindex)
|
||||
* [Extrinsics](#extrinsics)
|
||||
|
||||
### Functions
|
||||
|
||||
* [decodeLength](#decodelength)
|
||||
* [encode](#encode)
|
||||
* [encodeCall](#encodecall)
|
||||
* [encodeExtrinsic](#encodeextrinsic)
|
||||
* [encodeLength](#encodelength)
|
||||
* [unchecked](#unchecked)
|
||||
* [uncheckedLength](#uncheckedlength)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="extrinsic_sections"></a>
|
||||
|
||||
### Extrinsic$Sections
|
||||
|
||||
**Ƭ Extrinsic$Sections**: *`keyof Extrinsics`*
|
||||
|
||||
*Defined in [types.d.ts:21](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/types.d.ts#L21)*
|
||||
|
||||
___
|
||||
<a id="extrinsicunchecked"></a>
|
||||
|
||||
### ExtrinsicUnchecked
|
||||
|
||||
**Ƭ ExtrinsicUnchecked**: *`Uint8Array`*
|
||||
|
||||
*Defined in [codec/types.d.ts:9](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/types.d.ts#L9)*
|
||||
|
||||
___
|
||||
<a id="extrinsicwithaccount"></a>
|
||||
|
||||
### ExtrinsicWithAccount
|
||||
|
||||
**Ƭ ExtrinsicWithAccount**: *`Uint8Array`*
|
||||
|
||||
*Defined in [codec/types.d.ts:5](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/types.d.ts#L5)*
|
||||
|
||||
___
|
||||
<a id="extrinsicwithindex"></a>
|
||||
|
||||
### ExtrinsicWithIndex
|
||||
|
||||
**Ƭ ExtrinsicWithIndex**: *`Uint8Array`*
|
||||
|
||||
*Defined in [codec/types.d.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/types.d.ts#L7)*
|
||||
|
||||
___
|
||||
<a id="extrinsics"></a>
|
||||
|
||||
### Extrinsics
|
||||
|
||||
**Ƭ Extrinsics**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/types.d.ts#L7)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
|
||||
## Functions
|
||||
|
||||
<a id="decodelength"></a>
|
||||
|
||||
### decodeLength
|
||||
|
||||
▸ **decodeLength**(unchecked: *`Uint8Array`*): `UncheckedRaw`
|
||||
|
||||
*Defined in [codec/decode/length.ts:9](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/decode/length.ts#L9)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| unchecked | `Uint8Array` |
|
||||
|
||||
**Returns:** `UncheckedRaw`
|
||||
|
||||
___
|
||||
<a id="encode"></a>
|
||||
|
||||
### encode
|
||||
|
||||
▸ **encode**(publicKey: *`Uint8Array`*, index: * `number` | `BN`*, extrinsic: *`SectionItem`<[Extrinsics](#extrinsics)>*, values: *`Array`<`any`>*, version: *`EncodingVersions`*): [ExtrinsicWithAccount](#extrinsicwithaccount)
|
||||
|
||||
*Defined in [codec/encode/index.ts:13](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/index.ts#L13)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| publicKey | `Uint8Array` |
|
||||
| index | `number` | `BN`|
|
||||
| extrinsic | `SectionItem`<[Extrinsics](#extrinsics)> |
|
||||
| values | `Array`<`any`> |
|
||||
| version | `EncodingVersions` |
|
||||
|
||||
**Returns:** [ExtrinsicWithAccount](#extrinsicwithaccount)
|
||||
|
||||
___
|
||||
<a id="encodecall"></a>
|
||||
|
||||
### encodeCall
|
||||
|
||||
▸ **encodeCall**(publicKey: *`Uint8Array`*, nonce: * `number` | `BN`*, data: *[ExtrinsicWithIndex](#extrinsicwithindex)*, version: *`EncodingVersions`*): [ExtrinsicWithAccount](#extrinsicwithaccount)
|
||||
|
||||
*Defined in [codec/encode/call.ts:14](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/call.ts#L14)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| publicKey | `Uint8Array` |
|
||||
| nonce | `number` | `BN`|
|
||||
| data | [ExtrinsicWithIndex](#extrinsicwithindex) |
|
||||
| version | `EncodingVersions` |
|
||||
|
||||
**Returns:** [ExtrinsicWithAccount](#extrinsicwithaccount)
|
||||
|
||||
___
|
||||
<a id="encodeextrinsic"></a>
|
||||
|
||||
### encodeExtrinsic
|
||||
|
||||
▸ **encodeExtrinsic**(extrinsic: *`SectionItem`<[Extrinsics](#extrinsics)>*, values: *`Array`<`any`>*, version: *`EncodingVersions`*): [ExtrinsicWithIndex](#extrinsicwithindex)
|
||||
|
||||
*Defined in [codec/encode/extrinsic.ts:12](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/extrinsic.ts#L12)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| extrinsic | `SectionItem`<[Extrinsics](#extrinsics)> |
|
||||
| values | `Array`<`any`> |
|
||||
| version | `EncodingVersions` |
|
||||
|
||||
**Returns:** [ExtrinsicWithIndex](#extrinsicwithindex)
|
||||
|
||||
___
|
||||
<a id="encodelength"></a>
|
||||
|
||||
### encodeLength
|
||||
|
||||
▸ **encodeLength**(...values: *`Array`<`Uint8Array`>*): `Uint8Array`
|
||||
|
||||
*Defined in [codec/encode/length.ts:8](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/length.ts#L8)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Rest` values | `Array`<`Uint8Array`> |
|
||||
|
||||
**Returns:** `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="unchecked"></a>
|
||||
|
||||
### unchecked
|
||||
|
||||
▸ **unchecked**(pair: *`KeyringPair`*, index: * `number` | `BN`*, extrinsic: *`SectionItem`<[Extrinsics](#extrinsics)>*, values: *`Array`<`any`>*, version?: *`EncodingVersions`*): `UncheckedRaw`
|
||||
|
||||
*Defined in [codec/encode/unchecked.ts:16](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/unchecked.ts#L16)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value |
|
||||
| ------ | ------ | ------ |
|
||||
| pair | `KeyringPair` | - |
|
||||
| index | `number` | `BN`| - |
|
||||
| extrinsic | `SectionItem`<[Extrinsics](#extrinsics)> | - |
|
||||
| values | `Array`<`any`> | - |
|
||||
| `Default value` version | `EncodingVersions` | "latest" |
|
||||
|
||||
**Returns:** `UncheckedRaw`
|
||||
|
||||
___
|
||||
<a id="uncheckedlength"></a>
|
||||
|
||||
### uncheckedLength
|
||||
|
||||
▸ **uncheckedLength**(pair: *`KeyringPair`*, index: * `number` | `BN`*, extrinsic: *`SectionItem`<[Extrinsics](#extrinsics)>*, values: *`Array`<`any`>*, version?: *`EncodingVersions`*): `UncheckedRaw`
|
||||
|
||||
*Defined in [codec/encode/uncheckedLength.ts:14](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/uncheckedLength.ts#L14)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value |
|
||||
| ------ | ------ | ------ |
|
||||
| pair | `KeyringPair` | - |
|
||||
| index | `number` | `BN`| - |
|
||||
| extrinsic | `SectionItem`<[Extrinsics](#extrinsics)> | - |
|
||||
| values | `Array`<`any`> | - |
|
||||
| `Default value` version | `EncodingVersions` | "latest" |
|
||||
|
||||
**Returns:** `UncheckedRaw`
|
||||
|
||||
___
|
||||
|
||||
@@ -1,762 +0,0 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>type-extrinsics · 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-highlight/website.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="../type-jsonrpc/" />
|
||||
|
||||
|
||||
<link rel="prev" href="../api-rx/" />
|
||||
|
||||
|
||||
</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">Intro</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../api/">
|
||||
|
||||
<a href="../api/">
|
||||
|
||||
|
||||
api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../api-format/">
|
||||
|
||||
<a href="../api-format/">
|
||||
|
||||
|
||||
api-format
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../api-provider/">
|
||||
|
||||
<a href="../api-provider/">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../api-rx/">
|
||||
|
||||
<a href="../api-rx/">
|
||||
|
||||
|
||||
api-rx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="2.5" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../type-jsonrpc/">
|
||||
|
||||
<a href="../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../type-params/">
|
||||
|
||||
<a href="../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../type-primitives/">
|
||||
|
||||
<a href="../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../type-storage/">
|
||||
|
||||
<a href="../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../examples/">
|
||||
|
||||
<a href="../examples/">
|
||||
|
||||
|
||||
Overview
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../examples/01_simple_connect/">
|
||||
|
||||
<a href="../examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../examples/04_generate_account/">
|
||||
|
||||
<a href="../examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../examples/05_read_storage/">
|
||||
|
||||
<a href="../examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../examples/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../CONTRIBUTING.html">
|
||||
|
||||
<a href="../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</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=".." >type-extrinsics</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="polkadotextrinsics">@polkadot/extrinsics</h1>
|
||||
<h2 id="index">Index</h2>
|
||||
<h3 id="type-aliases">Type aliases</h3>
|
||||
<ul>
|
||||
<li><a href="#extrinsic_sections">Extrinsic$Sections</a></li>
|
||||
<li><a href="#extrinsicunchecked">ExtrinsicUnchecked</a></li>
|
||||
<li><a href="#extrinsicwithaccount">ExtrinsicWithAccount</a></li>
|
||||
<li><a href="#extrinsicwithindex">ExtrinsicWithIndex</a></li>
|
||||
<li><a href="#extrinsics">Extrinsics</a></li>
|
||||
</ul>
|
||||
<h3 id="functions">Functions</h3>
|
||||
<ul>
|
||||
<li><a href="#decodelength">decodeLength</a></li>
|
||||
<li><a href="#encode">encode</a></li>
|
||||
<li><a href="#encodecall">encodeCall</a></li>
|
||||
<li><a href="#encodeextrinsic">encodeExtrinsic</a></li>
|
||||
<li><a href="#encodelength">encodeLength</a></li>
|
||||
<li><a href="#unchecked">unchecked</a></li>
|
||||
<li><a href="#uncheckedlength">uncheckedLength</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2 id="type-aliases">Type aliases</h2>
|
||||
<p><a id="extrinsic_sections"></a></p>
|
||||
<h3 id="extrinsicsections">Extrinsic$Sections</h3>
|
||||
<p><strong>Ƭ Extrinsic$Sections</strong>: <em><code>keyof Extrinsics</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/types.d.ts#L21" target="_blank">types.d.ts:21</a></em></p>
|
||||
<hr>
|
||||
<p><a id="extrinsicunchecked"></a></p>
|
||||
<h3 id="extrinsicunchecked">ExtrinsicUnchecked</h3>
|
||||
<p><strong>Ƭ ExtrinsicUnchecked</strong>: <em><code>Uint8Array</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/types.d.ts#L9" target="_blank">codec/types.d.ts:9</a></em></p>
|
||||
<hr>
|
||||
<p><a id="extrinsicwithaccount"></a></p>
|
||||
<h3 id="extrinsicwithaccount">ExtrinsicWithAccount</h3>
|
||||
<p><strong>Ƭ ExtrinsicWithAccount</strong>: <em><code>Uint8Array</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/types.d.ts#L5" target="_blank">codec/types.d.ts:5</a></em></p>
|
||||
<hr>
|
||||
<p><a id="extrinsicwithindex"></a></p>
|
||||
<h3 id="extrinsicwithindex">ExtrinsicWithIndex</h3>
|
||||
<p><strong>Ƭ ExtrinsicWithIndex</strong>: <em><code>Uint8Array</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/types.d.ts#L7" target="_blank">codec/types.d.ts:7</a></em></p>
|
||||
<hr>
|
||||
<p><a id="extrinsics"></a></p>
|
||||
<h3 id="extrinsics">Extrinsics</h3>
|
||||
<p><strong>Ƭ Extrinsics</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/types.d.ts#L7" target="_blank">types.d.ts:7</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<h2 id="functions">Functions</h2>
|
||||
<p><a id="decodelength"></a></p>
|
||||
<h3 id="decodelength">decodeLength</h3>
|
||||
<p>▸ <strong>decodeLength</strong>(unchecked: <em><code>Uint8Array</code></em>): <code>UncheckedRaw</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/decode/length.ts#L9" target="_blank">codec/decode/length.ts:9</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>unchecked</td>
|
||||
<td><code>Uint8Array</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>UncheckedRaw</code></p>
|
||||
<hr>
|
||||
<p><a id="encode"></a></p>
|
||||
<h3 id="encode">encode</h3>
|
||||
<p>▸ <strong>encode</strong>(publicKey: <em><code>Uint8Array</code></em>, index: <em> <code>number</code> | <code>BN</code></em>, extrinsic: <em><code>SectionItem</code><<a href="#extrinsics">Extrinsics</a>></em>, values: <em><code>Array</code><<code>any</code>></em>, version: <em><code>EncodingVersions</code></em>): <a href="#extrinsicwithaccount">ExtrinsicWithAccount</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/index.ts#L13" target="_blank">codec/encode/index.ts:13</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>publicKey</td>
|
||||
<td><code>Uint8Array</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>index</td>
|
||||
<td><code>number</code> | <code>BN</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>extrinsic</td>
|
||||
<td><code>SectionItem</code><<a href="#extrinsics">Extrinsics</a>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>values</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>version</td>
|
||||
<td><code>EncodingVersions</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <a href="#extrinsicwithaccount">ExtrinsicWithAccount</a></p>
|
||||
<hr>
|
||||
<p><a id="encodecall"></a></p>
|
||||
<h3 id="encodecall">encodeCall</h3>
|
||||
<p>▸ <strong>encodeCall</strong>(publicKey: <em><code>Uint8Array</code></em>, nonce: <em> <code>number</code> | <code>BN</code></em>, data: <em><a href="#extrinsicwithindex">ExtrinsicWithIndex</a></em>, version: <em><code>EncodingVersions</code></em>): <a href="#extrinsicwithaccount">ExtrinsicWithAccount</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/call.ts#L14" target="_blank">codec/encode/call.ts:14</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>publicKey</td>
|
||||
<td><code>Uint8Array</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>nonce</td>
|
||||
<td><code>number</code> | <code>BN</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>data</td>
|
||||
<td><a href="#extrinsicwithindex">ExtrinsicWithIndex</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>version</td>
|
||||
<td><code>EncodingVersions</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <a href="#extrinsicwithaccount">ExtrinsicWithAccount</a></p>
|
||||
<hr>
|
||||
<p><a id="encodeextrinsic"></a></p>
|
||||
<h3 id="encodeextrinsic">encodeExtrinsic</h3>
|
||||
<p>▸ <strong>encodeExtrinsic</strong>(extrinsic: <em><code>SectionItem</code><<a href="#extrinsics">Extrinsics</a>></em>, values: <em><code>Array</code><<code>any</code>></em>, version: <em><code>EncodingVersions</code></em>): <a href="#extrinsicwithindex">ExtrinsicWithIndex</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/extrinsic.ts#L12" target="_blank">codec/encode/extrinsic.ts:12</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>extrinsic</td>
|
||||
<td><code>SectionItem</code><<a href="#extrinsics">Extrinsics</a>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>values</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>version</td>
|
||||
<td><code>EncodingVersions</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <a href="#extrinsicwithindex">ExtrinsicWithIndex</a></p>
|
||||
<hr>
|
||||
<p><a id="encodelength"></a></p>
|
||||
<h3 id="encodelength">encodeLength</h3>
|
||||
<p>▸ <strong>encodeLength</strong>(...values: <em><code>Array</code><<code>Uint8Array</code>></em>): <code>Uint8Array</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/length.ts#L8" target="_blank">codec/encode/length.ts:8</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>Rest</code> values</td>
|
||||
<td><code>Array</code><<code>Uint8Array</code>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Uint8Array</code></p>
|
||||
<hr>
|
||||
<p><a id="unchecked"></a></p>
|
||||
<h3 id="unchecked">unchecked</h3>
|
||||
<p>▸ <strong>unchecked</strong>(pair: <em><code>KeyringPair</code></em>, index: <em> <code>number</code> | <code>BN</code></em>, extrinsic: <em><code>SectionItem</code><<a href="#extrinsics">Extrinsics</a>></em>, values: <em><code>Array</code><<code>any</code>></em>, version?: <em><code>EncodingVersions</code></em>): <code>UncheckedRaw</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/unchecked.ts#L16" target="_blank">codec/encode/unchecked.ts:16</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
<th>Default value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>pair</td>
|
||||
<td><code>KeyringPair</code></td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>index</td>
|
||||
<td><code>number</code> | <code>BN</code></td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>extrinsic</td>
|
||||
<td><code>SectionItem</code><<a href="#extrinsics">Extrinsics</a>></td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>values</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Default value</code> version</td>
|
||||
<td><code>EncodingVersions</code></td>
|
||||
<td>"latest"</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>UncheckedRaw</code></p>
|
||||
<hr>
|
||||
<p><a id="uncheckedlength"></a></p>
|
||||
<h3 id="uncheckedlength">uncheckedLength</h3>
|
||||
<p>▸ <strong>uncheckedLength</strong>(pair: <em><code>KeyringPair</code></em>, index: <em> <code>number</code> | <code>BN</code></em>, extrinsic: <em><code>SectionItem</code><<a href="#extrinsics">Extrinsics</a>></em>, values: <em><code>Array</code><<code>any</code>></em>, version?: <em><code>EncodingVersions</code></em>): <code>UncheckedRaw</code></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-extrinsics/src/codec/encode/uncheckedLength.ts#L14" target="_blank">codec/encode/uncheckedLength.ts:14</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
<th>Default value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>pair</td>
|
||||
<td><code>KeyringPair</code></td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>index</td>
|
||||
<td><code>number</code> | <code>BN</code></td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>extrinsic</td>
|
||||
<td><code>SectionItem</code><<a href="#extrinsics">Extrinsics</a>></td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>values</td>
|
||||
<td><code>Array</code><<code>any</code>></td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Default value</code> version</td>
|
||||
<td><code>EncodingVersions</code></td>
|
||||
<td>"latest"</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>UncheckedRaw</code></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</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="../api-rx/" class="navigation navigation-prev " aria-label="Previous page: api-rx">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../type-jsonrpc/" class="navigation navigation-next " aria-label="Next page: type-jsonrpc">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"type-extrinsics","level":"2.5","depth":1,"next":{"title":"type-jsonrpc","level":"2.6","depth":1,"path":"type-jsonrpc/README.md","ref":"type-jsonrpc/README.md","articles":[]},"previous":{"title":"api-rx","level":"2.4","depth":1,"path":"api-rx/README.md","ref":"api-rx/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"type-extrinsics/README.md","mtime":"2018-09-17T12:36:23.490Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.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>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
|
||||
[](https://polkadot.js.org)  [](https://github.com/Flet/semistandard) [](https://www.npmjs.com/package/@polkadot/jsonrpc) [](https://travis-ci.org/polkadot-js/api) [](https://codeclimate.com/github/polkadot-js/api/maintainability) [](https://coveralls.io/github/polkadot-js/api?branch=master) [](https://david-dm.org/polkadot-js/api?path=packages/type-jsonrpc) [](https://david-dm.org/polkadot-js/api?path=packages/type-jsonrpc#info=devDependencies)
|
||||
|
||||
@polkadot/jsonrpc
|
||||
=================
|
||||
|
||||
A defintion of all the methods exposed in a general Polkadot client application. These are used not only to provide a comprehensive code-generated document of the available methods, but are also used in the API to auto-generate endpoints with the required type-checking.
|
||||
|
||||
For a list of currently exposed methods, see the [method documentation](docs/README.md).
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Installation -
|
||||
|
||||
```
|
||||
npm install --save @polkadot/jsonrpc
|
||||
```
|
||||
|
||||
Adding methods
|
||||
--------------
|
||||
|
||||
As methods are added, simply adding the name, inputs & output will prepare it for use.
|
||||
|
||||
* Add the method to the correct file in [src/rpc/](src/rpc/) (Input/Output types as cross-referenced from the canonical implementation and match one-to-one)
|
||||
* Should a new type be required, add it to the type list, [src/types.js](src/types.js) (Required for flow type checking)
|
||||
|
||||
## Index
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [Interface$Sections](#interface_sections)
|
||||
* [Interfaces](#interfaces)
|
||||
* [PrivateMethods](#privatemethods)
|
||||
* [PublicMethods](#publicmethods)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="interface_sections"></a>
|
||||
|
||||
### Interface$Sections
|
||||
|
||||
**Ƭ Interface$Sections**: *`keyof Interfaces`*
|
||||
|
||||
*Defined in [types.d.ts:18](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/types.d.ts#L18)*
|
||||
|
||||
___
|
||||
<a id="interfaces"></a>
|
||||
|
||||
### Interfaces
|
||||
|
||||
**Ƭ Interfaces**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/types.d.ts#L11)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="privatemethods"></a>
|
||||
|
||||
### PrivateMethods
|
||||
|
||||
**Ƭ PrivateMethods**: *`object`*
|
||||
|
||||
*Defined in [chain.ts:50](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/chain.ts#L50)*
|
||||
*Defined in [state.ts:99](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/state.ts#L99)*
|
||||
*Defined in [system.ts:34](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/system.ts#L34)*
|
||||
*Defined in [author.ts:32](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/author.ts#L32)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `CreateItemOptions`
|
||||
|
||||
___
|
||||
<a id="publicmethods"></a>
|
||||
|
||||
### PublicMethods
|
||||
|
||||
**Ƭ PublicMethods**: *`object`*
|
||||
|
||||
*Defined in [chain.ts:49](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/chain.ts#L49)*
|
||||
*Defined in [state.ts:100](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/state.ts#L100)*
|
||||
*Defined in [system.ts:35](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/system.ts#L35)*
|
||||
*Defined in [author.ts:33](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/author.ts#L33)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: `CreateItemOptions`
|
||||
|
||||
___
|
||||
|
||||
@@ -1,538 +0,0 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>type-jsonrpc · 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-highlight/website.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="../type-params/" />
|
||||
|
||||
|
||||
<link rel="prev" href="../type-extrinsics/" />
|
||||
|
||||
|
||||
</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">Intro</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../api/">
|
||||
|
||||
<a href="../api/">
|
||||
|
||||
|
||||
api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../api-format/">
|
||||
|
||||
<a href="../api-format/">
|
||||
|
||||
|
||||
api-format
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../api-provider/">
|
||||
|
||||
<a href="../api-provider/">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../api-rx/">
|
||||
|
||||
<a href="../api-rx/">
|
||||
|
||||
|
||||
api-rx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../type-extrinsics/">
|
||||
|
||||
<a href="../type-extrinsics/">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="2.6" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../type-params/">
|
||||
|
||||
<a href="../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../type-primitives/">
|
||||
|
||||
<a href="../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.9" data-path="../type-storage/">
|
||||
|
||||
<a href="../type-storage/">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../examples/">
|
||||
|
||||
<a href="../examples/">
|
||||
|
||||
|
||||
Overview
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../examples/01_simple_connect/">
|
||||
|
||||
<a href="../examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../examples/04_generate_account/">
|
||||
|
||||
<a href="../examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../examples/05_read_storage/">
|
||||
|
||||
<a href="../examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../examples/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../CONTRIBUTING.html">
|
||||
|
||||
<a href="../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</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=".." >type-jsonrpc</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">
|
||||
|
||||
<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/jsonrpc" target="_blank"><img src="https://img.shields.io/npm/v/@polkadot/jsonrpc.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=packages/type-jsonrpc" target="_blank"><img src="https://david-dm.org/polkadot-js/api.svg?style=flat-square&path=packages/type-jsonrpc" alt="dependency"></a> <a href="https://david-dm.org/polkadot-js/api?path=packages/type-jsonrpc#info=devDependencies" target="_blank"><img src="https://david-dm.org/polkadot-js/api/dev-status.svg?style=flat-square&path=packages/type-jsonrpc" alt="devDependency"></a></p>
|
||||
<h1 id="polkadotjsonrpc">@polkadot/jsonrpc</h1>
|
||||
<p>A defintion of all the methods exposed in a general Polkadot client application. These are used not only to provide a comprehensive code-generated document of the available methods, but are also used in the API to auto-generate endpoints with the required type-checking.</p>
|
||||
<p>For a list of currently exposed methods, see the <a href="docs/README.md">method documentation</a>.</p>
|
||||
<h2 id="usage">Usage</h2>
|
||||
<p>Installation -</p>
|
||||
<pre><code>npm install --save @polkadot/jsonrpc
|
||||
</code></pre><h2 id="adding-methods">Adding methods</h2>
|
||||
<p>As methods are added, simply adding the name, inputs & output will prepare it for use.</p>
|
||||
<ul>
|
||||
<li>Add the method to the correct file in <a href="src/rpc">src/rpc/</a> (Input/Output types as cross-referenced from the canonical implementation and match one-to-one)</li>
|
||||
<li>Should a new type be required, add it to the type list, <a href="src/types.js">src/types.js</a> (Required for flow type checking)</li>
|
||||
</ul>
|
||||
<h2 id="index">Index</h2>
|
||||
<h3 id="type-aliases">Type aliases</h3>
|
||||
<ul>
|
||||
<li><a href="#interface_sections">Interface$Sections</a></li>
|
||||
<li><a href="#interfaces">Interfaces</a></li>
|
||||
<li><a href="#privatemethods">PrivateMethods</a></li>
|
||||
<li><a href="#publicmethods">PublicMethods</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2 id="type-aliases">Type aliases</h2>
|
||||
<p><a id="interface_sections"></a></p>
|
||||
<h3 id="interfacesections">Interface$Sections</h3>
|
||||
<p><strong>Ƭ Interface$Sections</strong>: <em><code>keyof Interfaces</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/types.d.ts#L18" target="_blank">types.d.ts:18</a></em></p>
|
||||
<hr>
|
||||
<p><a id="interfaces"></a></p>
|
||||
<h3 id="interfaces">Interfaces</h3>
|
||||
<p><strong>Ƭ Interfaces</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/types.d.ts#L11" target="_blank">types.d.ts:11</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="privatemethods"></a></p>
|
||||
<h3 id="privatemethods">PrivateMethods</h3>
|
||||
<p><strong>Ƭ PrivateMethods</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/chain.ts#L50" target="_blank">chain.ts:50</a></em>
|
||||
<em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/state.ts#L99" target="_blank">state.ts:99</a></em>
|
||||
<em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/system.ts#L34" target="_blank">system.ts:34</a></em>
|
||||
<em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/author.ts#L32" target="_blank">author.ts:32</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<p><a id="publicmethods"></a></p>
|
||||
<h3 id="publicmethods">PublicMethods</h3>
|
||||
<p><strong>Ƭ PublicMethods</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/chain.ts#L49" target="_blank">chain.ts:49</a></em>
|
||||
<em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/state.ts#L100" target="_blank">state.ts:100</a></em>
|
||||
<em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/system.ts#L35" target="_blank">system.ts:35</a></em>
|
||||
<em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-jsonrpc/src/author.ts#L33" target="_blank">author.ts:33</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
|
||||
|
||||
</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="../type-extrinsics/" class="navigation navigation-prev " aria-label="Previous page: type-extrinsics">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../type-params/" class="navigation navigation-next " aria-label="Next page: type-params">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"type-jsonrpc","level":"2.6","depth":1,"next":{"title":"type-params","level":"2.7","depth":1,"path":"type-params/README.md","ref":"type-params/README.md","articles":[]},"previous":{"title":"type-extrinsics","level":"2.5","depth":1,"path":"type-extrinsics/README.md","ref":"type-extrinsics/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"type-jsonrpc/README.md","mtime":"2018-09-17T12:36:37.730Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.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>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,918 +0,0 @@
|
||||
|
||||
[](https://polkadot.js.org)  [](https://github.com/Flet/semistandard) [](https://www.npmjs.com/package/@polkadot/primitives) [](https://travis-ci.org/polkadot-js/api) [](https://codeclimate.com/github/polkadot-js/api/maintainability) [](https://coveralls.io/github/polkadot-js/api?branch=master) [](https://david-dm.org/polkadot-js/api?path=packages/type-params) [](https://david-dm.org/polkadot-js/api?path=packages/type-params#info=devDependencies)
|
||||
|
||||
## Index
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [BlockDecoded](#blockdecoded)
|
||||
* [BlockExtrinsicDecoded](#blockextrinsicdecoded)
|
||||
* [BlockJustificationDecoded](#blockjustificationdecoded)
|
||||
* [CreateItem](#createitem)
|
||||
* [CreateItemOptions](#createitemoptions)
|
||||
* [CreateItemOptionsMap](#createitemoptionsmap)
|
||||
* [CreateItems](#createitems)
|
||||
* [CreateSection](#createsection)
|
||||
* [CreateSectionOptions](#createsectionoptions)
|
||||
* [CreateSectionOptions$Fn](#createsectionoptions_fn)
|
||||
* [CreateSectionOptions$Only](#createsectionoptions_only)
|
||||
* [Decoder](#decoder)
|
||||
* [EncodingVersions](#encodingversions)
|
||||
* [ExtrinsicDecoded](#extrinsicdecoded)
|
||||
* [KeyValue](#keyvalue)
|
||||
* [Param](#param)
|
||||
* [Param$Decoded](#param_decoded)
|
||||
* [Param$Options](#param_options)
|
||||
* [Param$Type](#param_type)
|
||||
* [Param$Type$Array](#param_type_array)
|
||||
* [Param$Types](#param_types)
|
||||
* [Param$Value](#param_value)
|
||||
* [Param$Value$Array](#param_value_array)
|
||||
* [Param$Values](#param_values)
|
||||
* [Params](#params)
|
||||
* [Section](#section)
|
||||
* [SectionItem](#sectionitem)
|
||||
* [SectionItems](#sectionitems)
|
||||
* [Sections](#sections)
|
||||
|
||||
### Functions
|
||||
|
||||
* [accountId](#accountid)
|
||||
* [bn](#bn)
|
||||
* [bool](#bool)
|
||||
* [byte](#byte)
|
||||
* [bytes](#bytes)
|
||||
* [call](#call)
|
||||
* [code](#code)
|
||||
* [createMethod](#createmethod)
|
||||
* [createParam](#createparam)
|
||||
* [createSection](#createsection)
|
||||
* [decode](#decode)
|
||||
* [decodeValue](#decodevalue)
|
||||
* [digest](#digest)
|
||||
* [encodeParam](#encodeparam)
|
||||
* [encodeParams](#encodeparams)
|
||||
* [encodeType](#encodetype)
|
||||
* [header](#header)
|
||||
* [keyValue](#keyvalue)
|
||||
* [misbehavior](#misbehavior)
|
||||
* [passThrough](#passthrough)
|
||||
* [signature](#signature)
|
||||
* [storageKey](#storagekey)
|
||||
* [string](#string)
|
||||
* [time](#time)
|
||||
* [typeToString](#typetostring)
|
||||
* [u8a](#u8a)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="blockdecoded"></a>
|
||||
|
||||
### BlockDecoded
|
||||
|
||||
**Ƭ BlockDecoded**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:45](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L45)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="blockextrinsicdecoded"></a>
|
||||
|
||||
### BlockExtrinsicDecoded
|
||||
|
||||
**Ƭ BlockExtrinsicDecoded**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:28](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L28)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="blockjustificationdecoded"></a>
|
||||
|
||||
### BlockJustificationDecoded
|
||||
|
||||
**Ƭ BlockJustificationDecoded**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:36](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L36)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="createitem"></a>
|
||||
|
||||
### CreateItem
|
||||
|
||||
**Ƭ CreateItem**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:127](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L127)*
|
||||
|
||||
#### Type declaration
|
||||
▸(options: *[CreateItemOptions](#createitemoptions)*): [SectionItem](#sectionitem)<`T`>
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| options | [CreateItemOptions](#createitemoptions) |
|
||||
|
||||
**Returns:** [SectionItem](#sectionitem)<`T`>
|
||||
|
||||
___
|
||||
<a id="createitemoptions"></a>
|
||||
|
||||
### CreateItemOptions
|
||||
|
||||
**Ƭ CreateItemOptions**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:111](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L111)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="createitemoptionsmap"></a>
|
||||
|
||||
### CreateItemOptionsMap
|
||||
|
||||
**Ƭ CreateItemOptionsMap**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:123](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L123)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
[index: `string`]: [CreateItemOptions](#createitemoptions)
|
||||
|
||||
___
|
||||
<a id="createitems"></a>
|
||||
|
||||
### CreateItems
|
||||
|
||||
**Ƭ CreateItems**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:129](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L129)*
|
||||
|
||||
#### Type declaration
|
||||
▸(name: *`string`*, index?: * `undefined` | `number`*): [CreateItem](#createitem)<`T`>
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| name | `string` |
|
||||
| `Optional` index | `undefined` | `number`|
|
||||
|
||||
**Returns:** [CreateItem](#createitem)<`T`>
|
||||
|
||||
___
|
||||
<a id="createsection"></a>
|
||||
|
||||
### CreateSection
|
||||
|
||||
**Ƭ CreateSection**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:143](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L143)*
|
||||
|
||||
#### Type declaration
|
||||
▸(options: *[CreateSectionOptions](#createsectionoptions)<`T`, `Priv`, `Pub`>*): [Section](#section)<`T`, `Priv`, `Pub`>
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| options | [CreateSectionOptions](#createsectionoptions)<`T`, `Priv`, `Pub`> |
|
||||
|
||||
**Returns:** [Section](#section)<`T`, `Priv`, `Pub`>
|
||||
|
||||
___
|
||||
<a id="createsectionoptions"></a>
|
||||
|
||||
### CreateSectionOptions
|
||||
|
||||
**Ƭ CreateSectionOptions**: * [CreateSectionOptions$Only](#createsectionoptions_only)<`T`, `Priv`, `Pub`> | [CreateSectionOptions$Fn](#createsectionoptions_fn)<`T`, `Priv`, `Pub`>
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:141](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L141)*
|
||||
|
||||
___
|
||||
<a id="createsectionoptions_fn"></a>
|
||||
|
||||
### CreateSectionOptions$Fn
|
||||
|
||||
**Ƭ CreateSectionOptions$Fn**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:139](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L139)*
|
||||
|
||||
#### Type declaration
|
||||
▸(method: *[CreateItems](#createitems)<`T`>*): [CreateSectionOptions$Only](#createsectionoptions_only)<`T`, `Priv`, `Pub`>
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| method | [CreateItems](#createitems)<`T`> |
|
||||
|
||||
**Returns:** [CreateSectionOptions$Only](#createsectionoptions_only)<`T`, `Priv`, `Pub`>
|
||||
|
||||
___
|
||||
<a id="createsectionoptions_only"></a>
|
||||
|
||||
### CreateSectionOptions$Only
|
||||
|
||||
**Ƭ CreateSectionOptions$Only**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:131](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L131)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="decoder"></a>
|
||||
|
||||
### Decoder
|
||||
|
||||
**Ƭ Decoder**: *`function`*
|
||||
|
||||
*Defined in [decode/types.d.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/types.d.ts#L7)*
|
||||
|
||||
#### Type declaration
|
||||
▸(type: *[Param$Types](#param_types)*, input: *`Uint8Array`*, version: *[EncodingVersions](#encodingversions)*, isStorage: *`boolean`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | [Param$Types](#param_types) |
|
||||
| input | `Uint8Array` |
|
||||
| version | [EncodingVersions](#encodingversions) |
|
||||
| isStorage | `boolean` |
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="encodingversions"></a>
|
||||
|
||||
### EncodingVersions
|
||||
|
||||
**Ƭ EncodingVersions**: * "poc-1" | "latest"
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:11](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L11)*
|
||||
|
||||
___
|
||||
<a id="extrinsicdecoded"></a>
|
||||
|
||||
### ExtrinsicDecoded
|
||||
|
||||
**Ƭ ExtrinsicDecoded**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:23](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L23)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="keyvalue"></a>
|
||||
|
||||
### KeyValue
|
||||
|
||||
**Ƭ KeyValue**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:51](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L51)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="param"></a>
|
||||
|
||||
### Param
|
||||
|
||||
**Ƭ Param**: * [Param$Options](#param_options) & `object`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:71](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L71)*
|
||||
|
||||
___
|
||||
<a id="param_decoded"></a>
|
||||
|
||||
### Param$Decoded
|
||||
|
||||
**Ƭ Param$Decoded**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:62](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L62)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="param_options"></a>
|
||||
|
||||
### Param$Options
|
||||
|
||||
**Ƭ Param$Options**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:67](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L67)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="param_type"></a>
|
||||
|
||||
### Param$Type
|
||||
|
||||
**Ƭ Param$Type**: * "AccountId" | "AccountIndex" | "Balance" | "BlockNumber" | "bool" | "Bytes" | "Call" | "CandidateReceipt" | "Code" | "Digest" | "Gas" | "Hash" | "Header" | "KeyValue" | "MisbehaviorReport" | "ParachainId" | "PrendingExtrinsics" | "PropIndex" | "Proposal" | "ReferendumIndex" | "SessionKey" | "Signature" | "SignedBlock" | "StorageKey" | "StorageKeyValue" | "StorageResult" | "StorageResultSet" | "String" | "Timestamp" | "u32" | "u64" | "u128" | "VoteIndex" | "VoteThreshold"
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:17](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L17)*
|
||||
|
||||
___
|
||||
<a id="param_type_array"></a>
|
||||
|
||||
### Param$Type$Array
|
||||
|
||||
**Ƭ Param$Type$Array**: *`Array`< [Param$Type](#param_type) | `Array`< [Param$Type](#param_type) | `Array`<[Param$Type](#param_type)>>>*
|
||||
|
||||
*Defined in [types.d.ts:19](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L19)*
|
||||
|
||||
___
|
||||
<a id="param_types"></a>
|
||||
|
||||
### Param$Types
|
||||
|
||||
**Ƭ Param$Types**: * [Param$Type](#param_type) | [Param$Type$Array](#param_type_array)
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:21](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L21)*
|
||||
|
||||
___
|
||||
<a id="param_value"></a>
|
||||
|
||||
### Param$Value
|
||||
|
||||
**Ƭ Param$Value**: * `Digest` | `Header` | [KeyValue](#keyvalue) | `MisbehaviorReport` | [ExtrinsicDecoded](#extrinsicdecoded) | `BN` | `Date` | `Uint8Array` | `boolean` | `number` | `string` | `null`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:56](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L56)*
|
||||
|
||||
___
|
||||
<a id="param_value_array"></a>
|
||||
|
||||
### Param$Value$Array
|
||||
|
||||
**Ƭ Param$Value$Array**: *`Array`< [Param$Value](#param_value) | `Array`< [Param$Value](#param_value) | `Array`<[Param$Value](#param_value)>>>*
|
||||
|
||||
*Defined in [types.d.ts:58](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L58)*
|
||||
|
||||
___
|
||||
<a id="param_values"></a>
|
||||
|
||||
### Param$Values
|
||||
|
||||
**Ƭ Param$Values**: * [Param$Value](#param_value) | [Param$Value$Array](#param_value_array)
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:60](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L60)*
|
||||
|
||||
___
|
||||
<a id="params"></a>
|
||||
|
||||
### Params
|
||||
|
||||
**Ƭ Params**: *`Array`<[Param](#param)>*
|
||||
|
||||
*Defined in [types.d.ts:76](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L76)*
|
||||
|
||||
___
|
||||
<a id="section"></a>
|
||||
|
||||
### Section
|
||||
|
||||
**Ƭ Section**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:99](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L99)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="sectionitem"></a>
|
||||
|
||||
### SectionItem
|
||||
|
||||
**Ƭ SectionItem**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:79](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L79)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="sectionitems"></a>
|
||||
|
||||
### SectionItems
|
||||
|
||||
**Ƭ SectionItems**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:95](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L95)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
<a id="sections"></a>
|
||||
|
||||
### Sections
|
||||
|
||||
**Ƭ Sections**: *`Map`<`T`, [Section](#section)<`T`, `Priv`, `Pub`>>*
|
||||
|
||||
*Defined in [types.d.ts:109](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/types.d.ts#L109)*
|
||||
|
||||
___
|
||||
|
||||
## Functions
|
||||
|
||||
<a id="accountid"></a>
|
||||
|
||||
### accountId
|
||||
|
||||
▸ **accountId**(input: * `Uint8Array` | `null` | `undefined`*, version: *[EncodingVersions](#encodingversions)*, isStorage: *`boolean`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/accountId.ts:13](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/accountId.ts#L13)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
| version | [EncodingVersions](#encodingversions) |
|
||||
| isStorage | `boolean` |
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="bn"></a>
|
||||
|
||||
### bn
|
||||
|
||||
▸ **bn**(input: * `Uint8Array` | `null` | `undefined`*, bitLength: * `32` | `64` | `128`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/bn.ts:10](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/bn.ts#L10)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
| bitLength | `32` | `64` | `128`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="bool"></a>
|
||||
|
||||
### bool
|
||||
|
||||
▸ **bool**(input: * `Uint8Array` | `null` | `undefined`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/bool.ts:10](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/bool.ts#L10)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="byte"></a>
|
||||
|
||||
### byte
|
||||
|
||||
▸ **byte**(input: * `Uint8Array` | `null` | `undefined`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/byte.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/byte.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="bytes"></a>
|
||||
|
||||
### bytes
|
||||
|
||||
▸ **bytes**(input: * `Uint8Array` | `null` | `undefined`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/bytes.ts:9](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/bytes.ts#L9)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="call"></a>
|
||||
|
||||
### call
|
||||
|
||||
▸ **call**(decode: *[Decoder](#decoder)*, input: * `Uint8Array` | `null` | `undefined`*, isPublic: *`boolean`*, version: *[EncodingVersions](#encodingversions)*, isStorage: *`boolean`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/method.ts:19](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/method.ts#L19)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| decode | [Decoder](#decoder) |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
| isPublic | `boolean` |
|
||||
| version | [EncodingVersions](#encodingversions) |
|
||||
| isStorage | `boolean` |
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="code"></a>
|
||||
|
||||
### code
|
||||
|
||||
▸ **code**(input: * `Uint8Array` | `null` | `undefined`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/code.ts:9](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/code.ts#L9)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="createmethod"></a>
|
||||
|
||||
### createMethod
|
||||
|
||||
▸ **createMethod**<`T`>(section: *`keyof T`*, sectionIndex: *`Uint8Array`*): [CreateItems](#createitems)<`T`>
|
||||
|
||||
*Defined in [method.ts:11](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/method.ts#L11)*
|
||||
|
||||
**Type parameters:**
|
||||
|
||||
#### T
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| section | `keyof T` |
|
||||
| sectionIndex | `Uint8Array` |
|
||||
|
||||
**Returns:** [CreateItems](#createitems)<`T`>
|
||||
|
||||
___
|
||||
<a id="createparam"></a>
|
||||
|
||||
### createParam
|
||||
|
||||
▸ **createParam**(name: *`string`*, type: *[Param$Types](#param_types)*, __namedParameters?: *`object`*): [Param](#param)
|
||||
|
||||
*Defined in [param.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/param.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value |
|
||||
| ------ | ------ | ------ |
|
||||
| name | `string` | - |
|
||||
| type | [Param$Types](#param_types) | - |
|
||||
| `Default value` __namedParameters | `object` | { isOptional: false } |
|
||||
|
||||
**Returns:** [Param](#param)
|
||||
|
||||
___
|
||||
<a id="createsection"></a>
|
||||
|
||||
### createSection
|
||||
|
||||
▸ **createSection**<`T`>(name: *`keyof T`*, _index?: *`number`*): [CreateSection](#createsection)<`T`, `any`, `any`>
|
||||
|
||||
*Defined in [section.ts:11](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/section.ts#L11)*
|
||||
|
||||
**Type parameters:**
|
||||
|
||||
#### T
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value |
|
||||
| ------ | ------ | ------ |
|
||||
| name | `keyof T` | - |
|
||||
| `Default value` _index | `number` | 0 |
|
||||
|
||||
**Returns:** [CreateSection](#createsection)<`T`, `any`, `any`>
|
||||
|
||||
___
|
||||
<a id="decode"></a>
|
||||
|
||||
### decode
|
||||
|
||||
▸ **decode**(type: *[Param$Types](#param_types)*, _input: * `Uint8Array` | `string` | `null` | `undefined`*, version: *[EncodingVersions](#encodingversions)*, isStorage?: *`boolean`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/index.ts:65](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/index.ts#L65)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value |
|
||||
| ------ | ------ | ------ |
|
||||
| type | [Param$Types](#param_types) | - |
|
||||
| _input | `Uint8Array` | `string` | `null` | `undefined`| - |
|
||||
| version | [EncodingVersions](#encodingversions) | - |
|
||||
| `Default value` isStorage | `boolean` | false |
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="decodevalue"></a>
|
||||
|
||||
### decodeValue
|
||||
|
||||
▸ **decodeValue**(decode: *[Decoder](#decoder)*, type: *[Param$Type](#param_type)*, _input: * `Uint8Array` | `string` | `null` | `undefined`*, version: *[EncodingVersions](#encodingversions)*, isStorage: *`boolean`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/index.ts:30](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/index.ts#L30)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| decode | [Decoder](#decoder) |
|
||||
| type | [Param$Type](#param_type) |
|
||||
| _input | `Uint8Array` | `string` | `null` | `undefined`|
|
||||
| version | [EncodingVersions](#encodingversions) |
|
||||
| isStorage | `boolean` |
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="digest"></a>
|
||||
|
||||
### digest
|
||||
|
||||
▸ **digest**(input: * `Uint8Array` | `null` | `undefined`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/digest.ts:12](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/digest.ts#L12)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="encodeparam"></a>
|
||||
|
||||
### encodeParam
|
||||
|
||||
▸ **encodeParam**(param: *[Param](#param)*, value: *`any`*, version?: *[EncodingVersions](#encodingversions)*): `Uint8Array`
|
||||
|
||||
*Defined in [encode/param.ts:14](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/encode/param.ts#L14)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value |
|
||||
| ------ | ------ | ------ |
|
||||
| param | [Param](#param) | - |
|
||||
| value | `any` | - |
|
||||
| `Default value` version | [EncodingVersions](#encodingversions) | "latest" |
|
||||
|
||||
**Returns:** `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="encodeparams"></a>
|
||||
|
||||
### encodeParams
|
||||
|
||||
▸ **encodeParams**(params: *[Params](#params)*, values: *`Array`<`any`>*, version: *[EncodingVersions](#encodingversions)*): `Uint8Array`
|
||||
|
||||
*Defined in [encode/index.ts:12](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/encode/index.ts#L12)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| params | [Params](#params) |
|
||||
| values | `Array`<`any`> |
|
||||
| version | [EncodingVersions](#encodingversions) |
|
||||
|
||||
**Returns:** `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="encodetype"></a>
|
||||
|
||||
### encodeType
|
||||
|
||||
▸ **encodeType**(type: *[Param$Type](#param_type)*, value: *`any`*, version: *[EncodingVersions](#encodingversions)*): `Uint8Array`
|
||||
|
||||
*Defined in [encode/type/index.ts:19](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/encode/type/index.ts#L19)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | [Param$Type](#param_type) |
|
||||
| value | `any` |
|
||||
| version | [EncodingVersions](#encodingversions) |
|
||||
|
||||
**Returns:** `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="header"></a>
|
||||
|
||||
### header
|
||||
|
||||
▸ **header**(input: * `Uint8Array` | `null` | `undefined`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/header.ts:9](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/header.ts#L9)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="keyvalue"></a>
|
||||
|
||||
### keyValue
|
||||
|
||||
▸ **keyValue**(__namedParameters: *`object`*): `Uint8Array`
|
||||
|
||||
*Defined in [encode/type/keyValue.ts:12](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/encode/type/keyValue.ts#L12)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
|
||||
**Returns:** `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="misbehavior"></a>
|
||||
|
||||
### misbehavior
|
||||
|
||||
▸ **misbehavior**(input: * `Uint8Array` | `null` | `undefined`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/misbehavior.ts:21](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/misbehavior.ts#L21)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="passthrough"></a>
|
||||
|
||||
### passThrough
|
||||
|
||||
▸ **passThrough**(input: * `Uint8Array` | `null` | `undefined`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/passThrough.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/passThrough.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="signature"></a>
|
||||
|
||||
### signature
|
||||
|
||||
▸ **signature**<`T`>(__namedParameters: *`object`*): `string`
|
||||
|
||||
*Defined in [signature.ts:20](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/signature.ts#L20)*
|
||||
|
||||
*__name__*: signature
|
||||
|
||||
*__signature__*: jsonrpcSignature (method: InterfaceMethodDefinition): string
|
||||
|
||||
*__summary__*: Returns a string representation of the method with inputs and outputs.
|
||||
|
||||
*__description__*: Formats the name, inputs and outputs into a human-readable string. This contains the input parameter names input types and output type.
|
||||
|
||||
*__example__*: import signature from '@polkadot/params/signature';
|
||||
|
||||
signature({ name: 'test\_method', params: \[ { name: 'dest', type: 'Address' } \], type: 'Address' }); // => test\_method (dest: Address): Address
|
||||
|
||||
**Type parameters:**
|
||||
|
||||
#### T
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
|
||||
**Returns:** `string`
|
||||
|
||||
___
|
||||
<a id="storagekey"></a>
|
||||
|
||||
### storageKey
|
||||
|
||||
▸ **storageKey**(__namedParameters: *[`object`, `Array`]*): `Uint8Array`
|
||||
|
||||
*Defined in [encode/type/storageKey.ts:10](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/encode/type/storageKey.ts#L10)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | [`object`, `Array`] |
|
||||
|
||||
**Returns:** `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="string"></a>
|
||||
|
||||
### string
|
||||
|
||||
▸ **string**(input: * `Uint8Array` | `null` | `undefined`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/string.ts:12](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/string.ts#L12)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="time"></a>
|
||||
|
||||
### time
|
||||
|
||||
▸ **time**(input: * `Uint8Array` | `null` | `undefined`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/time.ts:9](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/time.ts#L9)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
<a id="typetostring"></a>
|
||||
|
||||
### typeToString
|
||||
|
||||
▸ **typeToString**(type: *[Param$Types](#param_types)*): `string`
|
||||
|
||||
*Defined in [typeToString.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/typeToString.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | [Param$Types](#param_types) |
|
||||
|
||||
**Returns:** `string`
|
||||
|
||||
___
|
||||
<a id="u8a"></a>
|
||||
|
||||
### u8a
|
||||
|
||||
▸ **u8a**(input: * `Uint8Array` | `null` | `undefined`*, bitLength: *`number`*, offset: *`number`*): [Param$Decoded](#param_decoded)
|
||||
|
||||
*Defined in [decode/value/u8a.ts:7](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-params/src/decode/value/u8a.ts#L7)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| input | `Uint8Array` | `null` | `undefined`|
|
||||
| bitLength | `number` |
|
||||
| offset | `number` |
|
||||
|
||||
**Returns:** [Param$Decoded](#param_decoded)
|
||||
|
||||
___
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,118 +0,0 @@
|
||||
|
||||
[](https://polkadot.js.org)  [](https://github.com/Flet/semistandard) [](https://www.npmjs.com/package/@polkadot/storage) [](https://travis-ci.org/polkadot-js/api) [](https://codeclimate.com/github/polkadot-js/api/maintainability) [](https://coveralls.io/github/polkadot-js/api?branch=master) [](https://david-dm.org/polkadot-js/api?path=packages/type-storage) [](https://david-dm.org/polkadot-js/api?path=packages/type-storage#info=devDependencies)
|
||||
|
||||
@polkadot/storage
|
||||
=================
|
||||
|
||||
An base interface to the storage layer
|
||||
|
||||
## Index
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [Keygen](#keygen)
|
||||
* [Storage$Key$Value](#storage_key_value)
|
||||
* [Storage$Sections](#storage_sections)
|
||||
* [Storages](#storages)
|
||||
|
||||
### Functions
|
||||
|
||||
* [bindKey](#bindkey)
|
||||
* [formatParams](#formatparams)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="keygen"></a>
|
||||
|
||||
### Keygen
|
||||
|
||||
**Ƭ Keygen**: *`function`*
|
||||
|
||||
*Defined in [key/index.ts:14](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/key/index.ts#L14)*
|
||||
|
||||
#### Type declaration
|
||||
▸(...keyParams: *`Array`<[Storage$Key$Value](#storage_key_value)>*): `Uint8Array`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Rest` keyParams | `Array`<[Storage$Key$Value](#storage_key_value)> |
|
||||
|
||||
**Returns:** `Uint8Array`
|
||||
|
||||
___
|
||||
<a id="storage_key_value"></a>
|
||||
|
||||
### Storage$Key$Value
|
||||
|
||||
**Ƭ Storage$Key$Value**: * `number` | `BN` | `Uint8Array` | `string`
|
||||
*
|
||||
|
||||
*Defined in [types.d.ts:8](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/types.d.ts#L8)*
|
||||
|
||||
___
|
||||
<a id="storage_sections"></a>
|
||||
|
||||
### Storage$Sections
|
||||
|
||||
**Ƭ Storage$Sections**: *`keyof Storages`*
|
||||
|
||||
*Defined in [types.d.ts:23](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/types.d.ts#L23)*
|
||||
|
||||
___
|
||||
<a id="storages"></a>
|
||||
|
||||
### Storages
|
||||
|
||||
**Ƭ Storages**: *`object`*
|
||||
|
||||
*Defined in [types.d.ts:10](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/types.d.ts#L10)*
|
||||
|
||||
#### Type declaration
|
||||
|
||||
___
|
||||
|
||||
## Functions
|
||||
|
||||
<a id="bindkey"></a>
|
||||
|
||||
### bindKey
|
||||
|
||||
▸ **bindKey**<`T`>(__namedParameters: *`object`*): [Keygen](#keygen)
|
||||
|
||||
*Defined in [key/index.ts:16](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/key/index.ts#L16)*
|
||||
|
||||
**Type parameters:**
|
||||
|
||||
#### T
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| __namedParameters | `object` |
|
||||
|
||||
**Returns:** [Keygen](#keygen)
|
||||
|
||||
___
|
||||
<a id="formatparams"></a>
|
||||
|
||||
### formatParams
|
||||
|
||||
▸ **formatParams**(params: *`Params`*, values?: *[Storage$Key$Value](#storage_key_value)[]*): `Array`<`Uint8Array`>
|
||||
|
||||
*Defined in [key/params.ts:15](https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/key/params.ts#L15)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value |
|
||||
| ------ | ------ | ------ |
|
||||
| params | `Params` | - |
|
||||
| `Default value` values | [Storage$Key$Value](#storage_key_value)[] | [] |
|
||||
|
||||
**Returns:** `Array`<`Uint8Array`>
|
||||
|
||||
___
|
||||
|
||||
@@ -1,596 +0,0 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>type-storage · 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-highlight/website.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="../examples/" />
|
||||
|
||||
|
||||
<link rel="prev" href="../type-primitives/" />
|
||||
|
||||
|
||||
</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">Intro</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">API</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="../api/">
|
||||
|
||||
<a href="../api/">
|
||||
|
||||
|
||||
api
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="../api-format/">
|
||||
|
||||
<a href="../api-format/">
|
||||
|
||||
|
||||
api-format
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="../api-provider/">
|
||||
|
||||
<a href="../api-provider/">
|
||||
|
||||
|
||||
api-provider
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.4" data-path="../api-rx/">
|
||||
|
||||
<a href="../api-rx/">
|
||||
|
||||
|
||||
api-rx
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.5" data-path="../type-extrinsics/">
|
||||
|
||||
<a href="../type-extrinsics/">
|
||||
|
||||
|
||||
type-extrinsics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.6" data-path="../type-jsonrpc/">
|
||||
|
||||
<a href="../type-jsonrpc/">
|
||||
|
||||
|
||||
type-jsonrpc
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.7" data-path="../type-params/">
|
||||
|
||||
<a href="../type-params/">
|
||||
|
||||
|
||||
type-params
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.8" data-path="../type-primitives/">
|
||||
|
||||
<a href="../type-primitives/">
|
||||
|
||||
|
||||
type-primitives
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="2.9" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
type-storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Examples</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="../examples/">
|
||||
|
||||
<a href="../examples/">
|
||||
|
||||
|
||||
Overview
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="../examples/01_simple_connect/">
|
||||
|
||||
<a href="../examples/01_simple_connect/">
|
||||
|
||||
|
||||
Simple connect
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="../examples/02_listen_to_blocks/">
|
||||
|
||||
<a href="../examples/02_listen_to_blocks/">
|
||||
|
||||
|
||||
Listen to blocks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="../examples/03_listen_to_balance_change/">
|
||||
|
||||
<a href="../examples/03_listen_to_balance_change/">
|
||||
|
||||
|
||||
Listen to balance change
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="../examples/04_generate_account/">
|
||||
|
||||
<a href="../examples/04_generate_account/">
|
||||
|
||||
|
||||
Generate Accounts
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.6" data-path="../examples/05_read_storage/">
|
||||
|
||||
<a href="../examples/05_read_storage/">
|
||||
|
||||
|
||||
Read Storage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.7" data-path="../examples/06_craft_extrinsic/">
|
||||
|
||||
<a href="../examples/06_craft_extrinsic/">
|
||||
|
||||
|
||||
Craft Extrinsic
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.8" data-path="../examples/07_transfer_dots/">
|
||||
|
||||
<a href="../examples/07_transfer_dots/">
|
||||
|
||||
|
||||
Transfer DOTs
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="header">Contributing</li>
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="4.1" data-path="../CONTRIBUTING.html">
|
||||
|
||||
<a href="../CONTRIBUTING.html">
|
||||
|
||||
|
||||
Contributing guide
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</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=".." >type-storage</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">
|
||||
|
||||
<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/storage" target="_blank"><img src="https://img.shields.io/npm/v/@polkadot/storage.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=packages/type-storage" target="_blank"><img src="https://david-dm.org/polkadot-js/api.svg?style=flat-square&path=packages/type-storage" alt="dependency"></a> <a href="https://david-dm.org/polkadot-js/api?path=packages/type-storage#info=devDependencies" target="_blank"><img src="https://david-dm.org/polkadot-js/api/dev-status.svg?style=flat-square&path=packages/type-storage" alt="devDependency"></a></p>
|
||||
<h1 id="polkadotstorage">@polkadot/storage</h1>
|
||||
<p>An base interface to the storage layer</p>
|
||||
<h2 id="index">Index</h2>
|
||||
<h3 id="type-aliases">Type aliases</h3>
|
||||
<ul>
|
||||
<li><a href="#keygen">Keygen</a></li>
|
||||
<li><a href="#storage_key_value">Storage$Key$Value</a></li>
|
||||
<li><a href="#storage_sections">Storage$Sections</a></li>
|
||||
<li><a href="#storages">Storages</a></li>
|
||||
</ul>
|
||||
<h3 id="functions">Functions</h3>
|
||||
<ul>
|
||||
<li><a href="#bindkey">bindKey</a></li>
|
||||
<li><a href="#formatparams">formatParams</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2 id="type-aliases">Type aliases</h2>
|
||||
<p><a id="keygen"></a></p>
|
||||
<h3 id="keygen">Keygen</h3>
|
||||
<p><strong>Ƭ Keygen</strong>: <em><code>function</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/key/index.ts#L14" target="_blank">key/index.ts:14</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<p>▸(...keyParams: <em><code>Array</code><<a href="#storage_key_value">Storage$Key$Value</a>></em>): <code>Uint8Array</code></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>Rest</code> keyParams</td>
|
||||
<td><code>Array</code><<a href="#storage_key_value">Storage$Key$Value</a>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Uint8Array</code></p>
|
||||
<hr>
|
||||
<p><a id="storage_key_value"></a></p>
|
||||
<h3 id="storagekeyvalue">Storage$Key$Value</h3>
|
||||
<p><strong>Ƭ Storage$Key$Value</strong>: <em> <code>number</code> | <code>BN</code> | <code>Uint8Array</code> | <code>string</code>
|
||||
</em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/types.d.ts#L8" target="_blank">types.d.ts:8</a></em></p>
|
||||
<hr>
|
||||
<p><a id="storage_sections"></a></p>
|
||||
<h3 id="storagesections">Storage$Sections</h3>
|
||||
<p><strong>Ƭ Storage$Sections</strong>: <em><code>keyof Storages</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/types.d.ts#L23" target="_blank">types.d.ts:23</a></em></p>
|
||||
<hr>
|
||||
<p><a id="storages"></a></p>
|
||||
<h3 id="storages">Storages</h3>
|
||||
<p><strong>Ƭ Storages</strong>: <em><code>object</code></em></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/types.d.ts#L10" target="_blank">types.d.ts:10</a></em></p>
|
||||
<h4 id="type-declaration">Type declaration</h4>
|
||||
<hr>
|
||||
<h2 id="functions">Functions</h2>
|
||||
<p><a id="bindkey"></a></p>
|
||||
<h3 id="bindkey">bindKey</h3>
|
||||
<p>▸ <strong>bindKey</strong><<code>T</code>>(__namedParameters: <em><code>object</code></em>): <a href="#keygen">Keygen</a></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/key/index.ts#L16" target="_blank">key/index.ts:16</a></em></p>
|
||||
<p><strong>Type parameters:</strong></p>
|
||||
<h4 id="t">T</h4>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>__namedParameters</td>
|
||||
<td><code>object</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <a href="#keygen">Keygen</a></p>
|
||||
<hr>
|
||||
<p><a id="formatparams"></a></p>
|
||||
<h3 id="formatparams">formatParams</h3>
|
||||
<p>▸ <strong>formatParams</strong>(params: <em><code>Params</code></em>, values?: <em><a href="#storage_key_value">Storage$Key$Value</a>[]</em>): <code>Array</code><<code>Uint8Array</code>></p>
|
||||
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/f5b0e23/packages/type-storage/src/key/params.ts#L15" target="_blank">key/params.ts:15</a></em></p>
|
||||
<p><strong>Parameters:</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Param</th>
|
||||
<th>Type</th>
|
||||
<th>Default value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>params</td>
|
||||
<td><code>Params</code></td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>Default value</code> values</td>
|
||||
<td><a href="#storage_key_value">Storage$Key$Value</a>[]</td>
|
||||
<td>[]</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><strong>Returns:</strong> <code>Array</code><<code>Uint8Array</code>></p>
|
||||
<hr>
|
||||
|
||||
|
||||
</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="../type-primitives/" class="navigation navigation-prev " aria-label="Previous page: type-primitives">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../examples/" class="navigation navigation-next " aria-label="Next page: Overview">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"type-storage","level":"2.9","depth":1,"next":{"title":"Overview","level":"3.1","depth":1,"path":"examples/README.adoc","ref":"examples/README.adoc","articles":[]},"previous":{"title":"type-primitives","level":"2.8","depth":1,"path":"type-primitives/README.md","ref":"type-primitives/README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["asciidoc-include"],"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":{"asciidoc-include":{"syntax":"asciidoc"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"type-storage/README.md","mtime":"2018-09-17T12:37:25.299Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-17T12:37:27.221Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.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>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user