Files
api/docs/METHODS_RPC.html
T
2018-10-15 20:59:02 +00:00

580 lines
18 KiB
HTML

<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>RPC · 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-insert-logo-link/plugin.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-sunlight-highlighter/sunlight.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
<link rel="stylesheet" href="styles/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="METHODS_STORAGE.html" />
<link rel="prev" href="rpc-provider/classes/_ws_index_.wsprovider.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/_promise_index_.apipromise.html">
<a href="api/classes/_promise_index_.apipromise.html">
ApiPromise
</a>
</li>
<li class="chapter " data-level="1.2.2" data-path="api/classes/_rx_index_.apirx.html">
<a href="api/classes/_rx_index_.apirx.html">
ApiRx
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.3" data-path="rpc-provider/">
<a href="rpc-provider/">
rpc-provider
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.1" data-path="rpc-provider/classes/_http_index_.httpprovider.html">
<a href="rpc-provider/classes/_http_index_.httpprovider.html">
HttpProvider
</a>
</li>
<li class="chapter " data-level="1.3.2" data-path="rpc-provider/classes/_ws_index_.wsprovider.html">
<a href="rpc-provider/classes/_ws_index_.wsprovider.html">
WsProvider
</a>
</li>
</ul>
</li>
<li class="header">Node Interfaces</li>
<li class="chapter active" data-level="2.1" data-path="METHODS_RPC.html">
<a href="METHODS_RPC.html">
RPC
</a>
</li>
<li class="chapter " data-level="2.2" data-path="METHODS_STORAGE.html">
<a href="METHODS_STORAGE.html">
Storage chain state (runtime)
</a>
</li>
<li class="chapter " data-level="2.3" data-path="METHODS_EXTRINSICS.html">
<a href="METHODS_EXTRINSICS.html">
Extrinsics (runtime)
</a>
</li>
<li class="header">Examples</li>
<li class="chapter " data-level="3.1" data-path="examples/promise/">
<a href="examples/promise/">
ApiPromise
</a>
<ul class="articles">
<li class="chapter " data-level="3.1.1" data-path="examples/promise/01_simple_connect/">
<a href="examples/promise/01_simple_connect/">
Simple connect
</a>
</li>
<li class="chapter " data-level="3.1.2" data-path="examples/promise/02_listen_to_blocks/">
<a href="examples/promise/02_listen_to_blocks/">
Listen to blocks
</a>
</li>
<li class="chapter " data-level="3.1.3" data-path="examples/promise/03_listen_to_balance_change/">
<a href="examples/promise/03_listen_to_balance_change/">
Listen to balance change
</a>
</li>
<li class="chapter " data-level="3.1.4" data-path="examples/promise/05_read_storage/">
<a href="examples/promise/05_read_storage/">
Read chain state
</a>
</li>
<li class="chapter " data-level="3.1.5" data-path="examples/promise/07_transfer_dots/">
<a href="examples/promise/07_transfer_dots/">
Make a transfer
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="." >RPC</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">
<h2 id="json-rpc">JSON-RPC</h2>
<p><em>The following RPC methods are the Remote Calls that are available by default and allow you to interact with the actual node, query, and submit. The RPCs are provided by Substrate itself. The RPCs are never exposed by the runtime.</em></p>
<hr>
<h3 id="author">author</h3>
<p><em>Authoring of network items</em></p>
<p>&#x25B8; <strong>pendingExtrinsics</strong>(): <code>PendingExtrinsics</code></p>
<ul>
<li><strong>summary</strong>: Returns all pending extrinsics, potentially grouped by sender</li>
</ul>
<p>&#x25B8; <strong>submitExtrinsic</strong>(extrinsic: <code>Extrinsic</code>): <code>Hash</code></p>
<ul>
<li><strong>summary</strong>: Submit a fully formatted extrinsic for block inclusion</li>
</ul>
<p>&#x25B8; <strong>submitAndWatchExtrinsic</strong>(extinsic: <code>Extrinsic</code>)<strong>.subscribe</strong>(CALLBACK): <code>ExtrinsicStatus</code></p>
<ul>
<li><strong>summary</strong>: Subscribe and watch an extrinsic until unsubscribed</li>
</ul>
<hr>
<h3 id="chain">chain</h3>
<p><em>Retrieval of chain data</em></p>
<p>&#x25B8; <strong>getBlock</strong>(hash?: <code>Hash</code>): <code>SignedBlock</code></p>
<ul>
<li><strong>summary</strong>: Get header and body of a relay chain block</li>
</ul>
<p>&#x25B8; <strong>getBlockHash</strong>(blockNumber?: <code>BlockNumber</code>): <code>Hash</code></p>
<ul>
<li><strong>summary</strong>: Get the block hash for a specific block</li>
</ul>
<p>&#x25B8; <strong>getHead</strong>(): <code>Hash</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the best headerHash</li>
</ul>
<p>&#x25B8; <strong>getHeader</strong>(hash?: <code>Hash</code>): <code>Header</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the header for a specific block</li>
</ul>
<p>&#x25B8; <strong>getRuntimeVersion</strong>(hash?: <code>Hash</code>): <code>RuntimeVersion</code></p>
<ul>
<li><strong>summary</strong>: Get the runtime version</li>
</ul>
<p>&#x25B8; <strong>subscribeNewHead</strong>()<strong>.subscribe</strong>(CALLBACK): <code>Header</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the best header via subscription</li>
</ul>
<hr>
<h3 id="state">state</h3>
<p><em>Query of state</em></p>
<p>&#x25B8; <strong>call</strong>(method: <code>Text</code>, data: <code>Bytes</code>): <code>Bytes</code></p>
<ul>
<li><strong>summary</strong>: Perform a call to a builtin on the chain</li>
</ul>
<p>&#x25B8; <strong>callAt</strong>(method: <code>Text</code>, data: <code>Bytes</code>, block: <code>Hash</code>): <code>Bytes</code></p>
<ul>
<li><strong>summary</strong>: Perform a call to a builtin on the chain (At block)</li>
</ul>
<p>&#x25B8; <strong>getMetadata</strong>(block?: <code>Hash</code>): <code>Metadata</code></p>
<ul>
<li><strong>summary</strong>: Returns the runtime metadata</li>
</ul>
<p>&#x25B8; <strong>getStorage</strong>(key: <code>StorageKey</code>): <code>StorageData</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the storage for a key</li>
</ul>
<p>&#x25B8; <strong>getStorageAt</strong>(key: <code>Bytes</code>, block: <code>Hash</code>): <code>Bytes</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the storage for a key at a specific block</li>
</ul>
<p>&#x25B8; <strong>getStorageHash</strong>(key: <code>Bytes</code>): <code>Hash</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the storage hash</li>
</ul>
<p>&#x25B8; <strong>getStorageHashAt</strong>(key: <code>Bytes</code>, block: <code>Hash</code>): <code>Hash</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the storage hash at a specific block</li>
</ul>
<p>&#x25B8; <strong>getStorageSize</strong>(key: <code>Bytes</code>): <code>u64</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the storage size</li>
</ul>
<p>&#x25B8; <strong>getStorageSizeAt</strong>(key: <code>Bytes</code>, block: <code>Hash</code>): <code>u64</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the storage size at a specific block</li>
</ul>
<p>&#x25B8; <strong>queryStorage</strong>(keys: <code>Vec&lt;StorageKey&gt;</code>, startBlock: <code>Hash</code>, block?: <code>Hash</code>): <code>Vec&lt;StorageChangeSet&gt;</code></p>
<ul>
<li><strong>summary</strong>: Query historical storage entries (by key) starting from a start block</li>
</ul>
<p>&#x25B8; <strong>subscribeStorage</strong>(keys: <code>Vec&lt;StorageKey&gt;</code>)<strong>.subscribe</strong>(CALLBACK): <code>StorageChangeSet</code></p>
<ul>
<li><strong>summary</strong>: Subscribes to storage changes for the provided keys</li>
</ul>
<hr>
<h3 id="system">system</h3>
<p><em>Methods to retrieve system info</em></p>
<p>&#x25B8; <strong>chain</strong>(): <code>Text</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the chain</li>
</ul>
<p>&#x25B8; <strong>name</strong>(): <code>Text</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the node name</li>
</ul>
<p>&#x25B8; <strong>version</strong>(): <code>Text</code></p>
<ul>
<li><strong>summary</strong>: Retrieves the version of the node</li>
</ul>
</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="rpc-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="METHODS_STORAGE.html" class="navigation navigation-next " aria-label="Next page: Storage chain state (runtime)">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"RPC","level":"2.1","depth":1,"next":{"title":"Storage chain state (runtime)","level":"2.2","depth":1,"path":"METHODS_STORAGE.md","ref":"METHODS_STORAGE.md","articles":[]},"previous":{"title":"WsProvider","level":"1.3.2","depth":2,"path":"rpc-provider/classes/_ws_index_.wsprovider.md","ref":"rpc-provider/classes/_ws_index_.wsprovider.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","insert-logo-link","mermaid-gb3","-highlight","sunlight-highlighter"],"root":"docs","styles":{"website":"styles/website.css"},"pluginsConfig":{"insert-logo-link":{"src":"/api/logo.png","url":"https://polkadot.js.org"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"include-codeblock":{"check":false,"edit":false,"lang":"","fixlang":false,"template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"sunlight-highlighter":{"theme":"gitbook","lineNumbers":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Polkadot API Book","gitbook":">=2.4.0"},"file":{"path":"METHODS_RPC.md","mtime":"2018-10-15T20:56:53.601Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-15T20:58:54.421Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>
<script src="gitbook/gitbook.js"></script>
<script src="gitbook/theme.js"></script>
<script src="gitbook/gitbook-plugin-insert-logo-link/plugin.js"></script>
<script src="gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="gitbook/gitbook-plugin-search/search.js"></script>
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
<script src="gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>
</body>
</html>