Files
api/docs/api/classes/_rx_index_.apirx.html
T
2019-01-09 10:42:24 +00:00

2408 lines
98 KiB
HTML

<!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-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="../../rpc-provider/" />
<link rel="prev" href="_promise_index_.apipromise.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="../">
<a href="../">
api
</a>
<ul class="articles">
<li class="chapter " data-level="1.2.1" data-path="_promise_index_.apipromise.html">
<a href="_promise_index_.apipromise.html">
ApiPromise
</a>
</li>
<li class="chapter active" data-level="1.2.2" data-path="_rx_index_.apirx.html">
<a href="_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="chapter " data-level="1.4" data-path="../../types/">
<a href="../../types/">
types (codec implementation)
</a>
</li>
<li class="header">Interfaces</li>
<li class="chapter " 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">
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="chapter " data-level="2.4" data-path="../../METHODS_EVENTS.html">
<a href="../../METHODS_EVENTS.html">
Events (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>
<li class="chapter " data-level="3.1.6" data-path="../../examples/promise/08_system_events/">
<a href="../../examples/promise/08_system_events/">
Display system events
</a>
</li>
<li class="chapter " data-level="3.1.7" data-path="../../examples/promise/09_transfer_events/">
<a href="../../examples/promise/09_transfer_events/">
Transaction with events
</a>
</li>
<li class="chapter " data-level="3.1.8" data-path="../../examples/promise/10_upgrade_chain/">
<a href="../../examples/promise/10_upgrade_chain/">
Upgrade with upgradeKey
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li class="chapter " data-level="4.1" data-path="../../types/classes/_accountid_.accountid.html">
<a href="../../types/classes/_accountid_.accountid.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.2" data-path="../../types/classes/_accountindex_.accountindex.html">
<a href="../../types/classes/_accountindex_.accountindex.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.3" data-path="../../types/classes/_address_.address.html">
<a href="../../types/classes/_address_.address.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.4" data-path="../../types/classes/_authorityid_.authorityid.html">
<a href="../../types/classes/_authorityid_.authorityid.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.5" data-path="../../types/classes/_balance_.balance.html">
<a href="../../types/classes/_balance_.balance.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.6" data-path="../../types/classes/_bft_.bftauthoritysignature.html">
<a href="../../types/classes/_bft_.bftauthoritysignature.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.7" data-path="../../types/classes/_bft_.bfthashsignature.html">
<a href="../../types/classes/_bft_.bfthashsignature.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.8" data-path="../../types/classes/_block_.block.html">
<a href="../../types/classes/_block_.block.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.9" data-path="../../types/classes/_blocknumber_.blocknumber.html">
<a href="../../types/classes/_blocknumber_.blocknumber.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.10" data-path="../../types/classes/_bool_.bool.html">
<a href="../../types/classes/_bool_.bool.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.11" data-path="../../types/classes/_bytes_.bytes.html">
<a href="../../types/classes/_bytes_.bytes.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.12" data-path="../../types/classes/_chainproperties_.chainproperties.html">
<a href="../../types/classes/_chainproperties_.chainproperties.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.13" data-path="../../types/classes/_codec_base_.base.html">
<a href="../../types/classes/_codec_base_.base.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.14" data-path="../../types/classes/_codec_compact_.compact.html">
<a href="../../types/classes/_codec_compact_.compact.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.15" data-path="../../types/classes/_codec_enum_.enum.html">
<a href="../../types/classes/_codec_enum_.enum.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.16" data-path="../../types/classes/_codec_enumtype_.enumtype.html">
<a href="../../types/classes/_codec_enumtype_.enumtype.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.17" data-path="../../types/classes/_codec_option_.option.html">
<a href="../../types/classes/_codec_option_.option.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.18" data-path="../../types/classes/_codec_set_.set.html">
<a href="../../types/classes/_codec_set_.set.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.19" data-path="../../types/classes/_codec_struct_.struct.html">
<a href="../../types/classes/_codec_struct_.struct.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.20" data-path="../../types/classes/_codec_tuple_.tuple.html">
<a href="../../types/classes/_codec_tuple_.tuple.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.21" data-path="../../types/classes/_codec_typeregistry_.typeregistry.html">
<a href="../../types/classes/_codec_typeregistry_.typeregistry.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.22" data-path="../../types/classes/_codec_u8a_.u8a.html">
<a href="../../types/classes/_codec_u8a_.u8a.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.23" data-path="../../types/classes/_codec_u8afixed_.u8afixed.html">
<a href="../../types/classes/_codec_u8afixed_.u8afixed.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.24" data-path="../../types/classes/_codec_uint_.uint.html">
<a href="../../types/classes/_codec_uint_.uint.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.25" data-path="../../types/classes/_codec_vector_.vector.html">
<a href="../../types/classes/_codec_vector_.vector.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.26" data-path="../../types/classes/_data_.data.html">
<a href="../../types/classes/_data_.data.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.27" data-path="../../types/classes/_digest_.authoritieschange.html">
<a href="../../types/classes/_digest_.authoritieschange.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.28" data-path="../../types/classes/_digest_.changestrieroot.html">
<a href="../../types/classes/_digest_.changestrieroot.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.29" data-path="../../types/classes/_digest_.digest.html">
<a href="../../types/classes/_digest_.digest.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.30" data-path="../../types/classes/_digest_.digestitem.html">
<a href="../../types/classes/_digest_.digestitem.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.31" data-path="../../types/classes/_digest_.other.html">
<a href="../../types/classes/_digest_.other.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.32" data-path="../../types/classes/_digest_.seal.html">
<a href="../../types/classes/_digest_.seal.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.33" data-path="../../types/classes/_event_.event.html">
<a href="../../types/classes/_event_.event.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.34" data-path="../../types/classes/_event_.eventdata.html">
<a href="../../types/classes/_event_.eventdata.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.35" data-path="../../types/classes/_event_.eventindex.html">
<a href="../../types/classes/_event_.eventindex.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.36" data-path="../../types/classes/_eventrecord_.applyextrinsic.html">
<a href="../../types/classes/_eventrecord_.applyextrinsic.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.37" data-path="../../types/classes/_eventrecord_.eventrecord.html">
<a href="../../types/classes/_eventrecord_.eventrecord.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.38" data-path="../../types/classes/_eventrecord_.finalization.html">
<a href="../../types/classes/_eventrecord_.finalization.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.39" data-path="../../types/classes/_eventrecord_.phase.html">
<a href="../../types/classes/_eventrecord_.phase.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.40" data-path="../../types/classes/_extrinsic_.extrinsic.html">
<a href="../../types/classes/_extrinsic_.extrinsic.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.41" data-path="../../types/classes/_extrinsicera_.extrinsicera.html">
<a href="../../types/classes/_extrinsicera_.extrinsicera.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.42" data-path="../../types/classes/_extrinsics_.extrinsics.html">
<a href="../../types/classes/_extrinsics_.extrinsics.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.43" data-path="../../types/classes/_extrinsicsignature_.extrinsicsignature.html">
<a href="../../types/classes/_extrinsicsignature_.extrinsicsignature.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.44" data-path="../../types/classes/_extrinsicstatus_.broadcast.html">
<a href="../../types/classes/_extrinsicstatus_.broadcast.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.45" data-path="../../types/classes/_extrinsicstatus_.dropped.html">
<a href="../../types/classes/_extrinsicstatus_.dropped.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.46" data-path="../../types/classes/_extrinsicstatus_.extrinsicstatus.html">
<a href="../../types/classes/_extrinsicstatus_.extrinsicstatus.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.47" data-path="../../types/classes/_extrinsicstatus_.finalised.html">
<a href="../../types/classes/_extrinsicstatus_.finalised.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.48" data-path="../../types/classes/_extrinsicstatus_.usurped.html">
<a href="../../types/classes/_extrinsicstatus_.usurped.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.49" data-path="../../types/classes/_gas_.gas.html">
<a href="../../types/classes/_gas_.gas.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.50" data-path="../../types/classes/_h256_.h256.html">
<a href="../../types/classes/_h256_.h256.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.51" data-path="../../types/classes/_h512_.h512.html">
<a href="../../types/classes/_h512_.h512.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.52" data-path="../../types/classes/_hash_.hash.html">
<a href="../../types/classes/_hash_.hash.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.53" data-path="../../types/classes/_header_.header.html">
<a href="../../types/classes/_header_.header.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.54" data-path="../../types/classes/_justification_.justification.html">
<a href="../../types/classes/_justification_.justification.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.55" data-path="../../types/classes/_justification_.rhdjustification.html">
<a href="../../types/classes/_justification_.rhdjustification.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.56" data-path="../../types/classes/_keyvalue_.keyvalue.html">
<a href="../../types/classes/_keyvalue_.keyvalue.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.57" data-path="../../types/classes/_keyvalue_.keyvalueoption.html">
<a href="../../types/classes/_keyvalue_.keyvalueoption.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.58" data-path="../../types/classes/_metadata_.callmetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.59" data-path="../../types/classes/_metadata_.eventmetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.60" data-path="../../types/classes/_metadata_.functionargumentmetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.61" data-path="../../types/classes/_metadata_.functionmetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.62" data-path="../../types/classes/_metadata_.modulemetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.63" data-path="../../types/classes/_metadata_.outerdispatchcall.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.64" data-path="../../types/classes/_metadata_.outerdispatchmetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.65" data-path="../../types/classes/_metadata_.outereventmetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.66" data-path="../../types/classes/_metadata_.outereventmetadataevent.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.67" data-path="../../types/classes/_metadata_.runtimemetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.68" data-path="../../types/classes/_metadata_.runtimemodulemetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.69" data-path="../../types/classes/_metadata_.storagefunctionmetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.70" data-path="../../types/classes/_metadata_.storagefunctionmodifier.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.71" data-path="../../types/classes/_metadata_.storagefunctiontype.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.72" data-path="../../types/classes/_metadata_.storagefunctiontype_map.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.73" data-path="../../types/classes/_metadata_.storagemetadata.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.74" data-path="../../types/classes/_method_.method.html">
<a href="../../types/classes/_method_.method.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.75" data-path="../../types/classes/_method_.methodindex.html">
<a href="../../types/classes/_method_.methodindex.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.76" data-path="../../types/classes/_misbehaviorreport_.bftatreport.html">
<a href="../../types/classes/_misbehaviorreport_.bftatreport.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.77" data-path="../../types/classes/_misbehaviorreport_.bftdoublecommit.html">
<a href="../../types/classes/_misbehaviorreport_.bftdoublecommit.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.78" data-path="../../types/classes/_misbehaviorreport_.bftdoubleprepare.html">
<a href="../../types/classes/_misbehaviorreport_.bftdoubleprepare.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.79" data-path="../../types/classes/_misbehaviorreport_.bftdoublepropose.html">
<a href="../../types/classes/_misbehaviorreport_.bftdoublepropose.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.80" data-path="../../types/classes/_misbehaviorreport_.bftproposeoutofturn.html">
<a href="../../types/classes/_misbehaviorreport_.bftproposeoutofturn.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.81" data-path="../../types/classes/_misbehaviorreport_.misbehaviorkind.html">
<a href="../../types/classes/_misbehaviorreport_.misbehaviorkind.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.82" data-path="../../types/classes/_misbehaviorreport_.misbehaviorreport.html">
<a href="../../types/classes/_misbehaviorreport_.misbehaviorreport.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.83" data-path="../../types/classes/_moment_.moment.html">
<a href="../../types/classes/_moment_.moment.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.84" data-path="../../types/classes/_newaccountoutcome_.newaccountoutcome.html">
<a href="../../types/classes/_newaccountoutcome_.newaccountoutcome.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.85" data-path="../../types/classes/_nonce_.nonce.html">
<a href="../../types/classes/_nonce_.nonce.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.86" data-path="../../types/classes/_null_.null.html">
<a href="../../types/classes/_null_.null.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.87" data-path="../../types/classes/_origin_.origin.html">
<a href="../../types/classes/_origin_.origin.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.88" data-path="../../types/classes/_parachainid_.parachainid.md">
<span>
hidden
</a>
</li>
<li class="chapter " data-level="4.89" data-path="../../types/classes/_pendingextrinsics_.pendingextrinsics.html">
<a href="../../types/classes/_pendingextrinsics_.pendingextrinsics.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.90" data-path="../../types/classes/_perbill_.perbill.html">
<a href="../../types/classes/_perbill_.perbill.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.91" data-path="../../types/classes/_permill_.permill.html">
<a href="../../types/classes/_permill_.permill.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.92" data-path="../../types/classes/_propindex_.propindex.html">
<a href="../../types/classes/_propindex_.propindex.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.93" data-path="../../types/classes/_proposal_.proposal.html">
<a href="../../types/classes/_proposal_.proposal.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.94" data-path="../../types/classes/_proposalindex_.proposalindex.html">
<a href="../../types/classes/_proposalindex_.proposalindex.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.95" data-path="../../types/classes/_referendumindex_.referendumindex.html">
<a href="../../types/classes/_referendumindex_.referendumindex.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.96" data-path="../../types/classes/_runtimeversion_.apiid.html">
<a href="../../types/classes/_runtimeversion_.apiid.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.97" data-path="../../types/classes/_runtimeversion_.runtimeversion.html">
<a href="../../types/classes/_runtimeversion_.runtimeversion.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.98" data-path="../../types/classes/_runtimeversion_.runtimeversionapi.html">
<a href="../../types/classes/_runtimeversion_.runtimeversionapi.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.99" data-path="../../types/classes/_sessionkey_.sessionkey.html">
<a href="../../types/classes/_sessionkey_.sessionkey.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.100" data-path="../../types/classes/_signature_.signature.html">
<a href="../../types/classes/_signature_.signature.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.101" data-path="../../types/classes/_signaturepayload_.signaturepayload.html">
<a href="../../types/classes/_signaturepayload_.signaturepayload.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.102" data-path="../../types/classes/_signedblock_.signedblock.html">
<a href="../../types/classes/_signedblock_.signedblock.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.103" data-path="../../types/classes/_storagechangeset_.storagechangeset.html">
<a href="../../types/classes/_storagechangeset_.storagechangeset.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.104" data-path="../../types/classes/_storagedata_.storagedata.html">
<a href="../../types/classes/_storagedata_.storagedata.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.105" data-path="../../types/classes/_storagekey_.storagekey.html">
<a href="../../types/classes/_storagekey_.storagekey.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.106" data-path="../../types/classes/_storedpendingchange_.nextauthority.html">
<a href="../../types/classes/_storedpendingchange_.nextauthority.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.107" data-path="../../types/classes/_storedpendingchange_.storedpendingchange.html">
<a href="../../types/classes/_storedpendingchange_.storedpendingchange.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.108" data-path="../../types/classes/_text_.text.html">
<a href="../../types/classes/_text_.text.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.109" data-path="../../types/classes/_type_.type.html">
<a href="../../types/classes/_type_.type.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.110" data-path="../../types/classes/_u128_.u128.html">
<a href="../../types/classes/_u128_.u128.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.111" data-path="../../types/classes/_u16_.u16.html">
<a href="../../types/classes/_u16_.u16.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.112" data-path="../../types/classes/_u256_.u256.html">
<a href="../../types/classes/_u256_.u256.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.113" data-path="../../types/classes/_u32_.u32.html">
<a href="../../types/classes/_u32_.u32.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.114" data-path="../../types/classes/_u64_.u64.html">
<a href="../../types/classes/_u64_.u64.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.115" data-path="../../types/classes/_u8_.u8.html">
<a href="../../types/classes/_u8_.u8.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.116" data-path="../../types/classes/_validatorprefs_.validatorprefs.html">
<a href="../../types/classes/_validatorprefs_.validatorprefs.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.117" data-path="../../types/classes/_voteindex_.voteindex.html">
<a href="../../types/classes/_voteindex_.voteindex.html">
hidden
</a>
</li>
<li class="chapter " data-level="4.118" data-path="../../types/classes/_votethreshold_.votethreshold.html">
<a href="../../types/classes/_votethreshold_.votethreshold.html">
hidden
</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">
<h1 id="polkadotapirx">@polkadot/api/rx</h1>
<h2 id="overview">Overview</h2>
<p><em><strong>name</strong></em>: ApiRx</p>
<p><em><strong>description</strong></em>: ApiRx is a powerfull RxJS Observable wrapper around the RPC and interfaces on the Polkadot network. As a full Observable API, all interface calls return RxJS Observables, including the static <code>.create(...)</code>. In the same fashion and subscription-based methods return long-running Observables that update with the latest values.</p>
<p>The API is well suited to real-time applications where the latest state is needed, unlocking the subscription-based features of Polkadot (and Substrate) clients. Some familiarity with RxJS is a requirement to use the API, however just understanding <code>.subscribe</code> and <code>.pipe</code> on Observables will unlock full-scale use thereof.</p>
<p><em><strong>see</strong></em>: <a href="_promise_index_.apipromise.html">ApiPromise</a></p>
<h2 id="usage">Usage</h2>
<p>Making rpc calls - </p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-reservedWord">import</span>&#xA0;<span class="sunlight-ident">ApiRx</span>&#xA0;<span class="sunlight-ident">from</span>&#xA0;<span class="sunlight-string">&apos;@polkadot/api/rx&apos;</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-comment">//&#xA0;initialise&#xA0;via&#xA0;Promise&#xA0;&amp;&#xA0;static&#xA0;create</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">api</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">await</span>&#xA0;<span class="sunlight-ident">ApiRx</span><span class="sunlight-operator">.</span><span class="sunlight-ident">create</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toPromise</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-comment">//&#xA0;make&#xA0;a&#xA0;call&#xA0;to&#xA0;retrieve&#xA0;the&#xA0;current&#xA0;network&#xA0;head</span>
<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">rpc</span><span class="sunlight-operator">.</span><span class="sunlight-ident">chain</span><span class="sunlight-operator">.</span><span class="sunlight-ident">subscribeNewHead</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-ident">subscribe</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">header</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">Chain</span>&#xA0;<span class="sunlight-ident">is</span>&#xA0;<span class="sunlight-ident">at</span>&#xA0;<span class="sunlight-punctuation">#</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">header</span><span class="sunlight-operator">.</span><span class="sunlight-ident">blockNumber</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p>Subscribing to chain state - </p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-reservedWord">import</span>&#xA0;<span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">combineLatest</span>&#xA0;<span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-ident">from</span>&#xA0;<span class="sunlight-string">&apos;rxjs&apos;</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-reservedWord">import</span>&#xA0;<span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">ApiRx</span>&#xA0;<span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-ident">from</span>&#xA0;<span class="sunlight-string">&apos;@polkadot/api&apos;</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-reservedWord">import</span>&#xA0;<span class="sunlight-punctuation">{</span>&#xA0;<span class="sunlight-ident">WsProvider</span>&#xA0;<span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-ident">from</span>&#xA0;<span class="sunlight-string">&apos;@polkadot/rpc-provider&apos;</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-comment">//&#xA0;last&#xA0;block&#xA0;timestamp</span>
<span class="sunlight-ident">let</span>&#xA0;<span class="sunlight-ident">last</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-number">0</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-comment">//&#xA0;initialise&#xA0;a&#xA0;provider&#xA0;with&#xA0;a&#xA0;specific&#xA0;endpoint</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">provider</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-keyword">new</span>&#xA0;<span class="sunlight-ident">WsProvider</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;wss://example.com:9944&apos;</span><span class="sunlight-punctuation">)</span>
<span class="sunlight-comment">//&#xA0;initialise&#xA0;via&#xA0;isReady&#xA0;&amp;&#xA0;new&#xA0;with&#xA0;specific&#xA0;provider</span>
<span class="sunlight-keyword">new</span>&#xA0;<span class="sunlight-ident">ApiRx</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">provider</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">isReady</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">pipe</span><span class="sunlight-punctuation">(</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">switchMap</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">api</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">combineLatest</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">[</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">query</span><span class="sunlight-operator">.</span><span class="sunlight-ident">timestamp</span><span class="sunlight-operator">.</span><span class="sunlight-ident">blockPeriod</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">,</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">query</span><span class="sunlight-operator">.</span><span class="sunlight-ident">timestamp</span><span class="sunlight-operator">.</span><span class="sunlight-ident">now</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-punctuation">]</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">subscribe</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">[</span><span class="sunlight-ident">blockPeriod</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">timestamp</span><span class="sunlight-punctuation">]</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">elapsed</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">last</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-operator">?</span>&#xA0;<span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">timestamp</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toNumber</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">-</span>&#xA0;<span class="sunlight-ident">last</span><span class="sunlight-punctuation">}</span><span class="sunlight-ident">s</span>&#xA0;<span class="sunlight-ident">since</span>&#xA0;<span class="sunlight-ident">last</span><span class="sunlight-punctuation">`</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-operator">:</span>&#xA0;<span class="sunlight-string">&apos;&apos;</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">last</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">timestamp</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toNumber</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">timestamp</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">timestamp</span><span class="sunlight-punctuation">}</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">elapsed</span><span class="sunlight-punctuation">}</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">blockPeriod</span><span class="sunlight-punctuation">}</span><span class="sunlight-ident">s</span>&#xA0;<span class="sunlight-ident">target</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p>Submitting a transaction - </p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-reservedWord">import</span>&#xA0;<span class="sunlight-ident">ApiRx</span>&#xA0;<span class="sunlight-ident">from</span>&#xA0;<span class="sunlight-string">&apos;@polkadot/api/rx&apos;</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-comment">//&#xA0;get&#xA0;api&#xA0;via&#xA0;Promise</span>
<span class="sunlight-reservedWord">const</span>&#xA0;<span class="sunlight-ident">api</span>&#xA0;<span class="sunlight-operator">=</span>&#xA0;<span class="sunlight-ident">await</span>&#xA0;<span class="sunlight-ident">ApiRx</span><span class="sunlight-operator">.</span><span class="sunlight-ident">create</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toPromise</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-comment">//&#xA0;retrieve&#xA0;nonce&#xA0;for&#xA0;the&#xA0;account</span>
<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">query</span><span class="sunlight-operator">.</span><span class="sunlight-ident">system</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">accountNonce</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">keyring</span><span class="sunlight-operator">.</span><span class="sunlight-ident">alice</span><span class="sunlight-operator">.</span><span class="sunlight-ident">address</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">pipe</span><span class="sunlight-punctuation">(</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;pipe&#xA0;nonce&#xA0;into&#xA0;transfer</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">switchMap</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">nonce</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">tx</span><span class="sunlight-operator">.</span><span class="sunlight-ident">balances</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;create&#xA0;transfer</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">transfer</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">keyring</span><span class="sunlight-operator">.</span><span class="sunlight-ident">bob</span><span class="sunlight-operator">.</span><span class="sunlight-ident">address</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-number">12345</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;sign&#xA0;the&#xA0;transcation</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">sign</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">keyring</span><span class="sunlight-operator">.</span><span class="sunlight-ident">alice</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">nonce</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;send&#xA0;the&#xA0;transaction</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">send</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-comment">//&#xA0;subscribe&#xA0;to&#xA0;overall&#xA0;result</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">subscribe</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">hash</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">submitted</span>&#xA0;<span class="sunlight-keyword">with</span>&#xA0;<span class="sunlight-ident">hash</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">hash</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<h1 id="hierarchy">Hierarchy</h1>
<p> <a href="_base_.apibase.md">ApiBase</a>&lt;<code>RpcRx</code>, <a href="../interfaces/_rx_types_.queryablestorage.md">QueryableStorage</a>, <a href="../interfaces/_rx_types_.submittableextrinsics.md">SubmittableExtrinsics</a>&gt;</p>
<p><strong>&#x21B3; ApiRx</strong></p>
<h1 id="implements">Implements</h1>
<ul>
<li><a href="../interfaces/_types_.apibaseinterface.md">ApiBaseInterface</a>&lt;<code>RpcRx</code>, <a href="../interfaces/_rx_types_.queryablestorage.md">QueryableStorage</a>, <a href="../interfaces/_rx_types_.submittableextrinsics.md">SubmittableExtrinsics</a>&gt;</li>
<li><a href="../interfaces/_rx_types_.apirxinterface.md">ApiRxInterface</a></li>
</ul>
<h1 id="constructors">Constructors</h1>
<p><a id="constructor"></a></p>
<h2 id="constructor">constructor</h2>
<p>&#x2295; <strong>new ApiRx</strong>(options?: <em><a href="../interfaces/_types_.apioptions.md">ApiOptions</a> | <code>ProviderInterface</code></em>): <a href="_rx_index_.apirx.html">ApiRx</a></p>
<p><em>Overrides <a href="_base_.apibase.md">ApiBase</a>.<a href="_base_.apibase.md#constructor">constructor</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/rx/index.ts#L145" target="_blank">rx/index.ts:145</a></em></p>
<p><em><strong>description</strong></em>: Create an instance of the ApiRx class</p>
<p><em><strong>example</strong></em>: </p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-reservedWord">import</span>&#xA0;<span class="sunlight-ident">Api</span>&#xA0;<span class="sunlight-ident">from</span>&#xA0;<span class="sunlight-string">&apos;@polkadot/api/rx&apos;</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-keyword">new</span>&#xA0;<span class="sunlight-ident">Api</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-ident">isReady</span><span class="sunlight-operator">.</span><span class="sunlight-ident">subscribe</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">api</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">rpc</span><span class="sunlight-operator">.</span><span class="sunlight-ident">subscribeNewHead</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-ident">subscribe</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">header</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-keyword">new</span>&#xA0;<span class="sunlight-ident">block</span>&#xA0;<span class="sunlight-punctuation">#</span><span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">header</span><span class="sunlight-operator">.</span><span class="sunlight-ident">blockNumber</span><span class="sunlight-operator">.</span><span class="sunlight-ident">toNumber</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Optional</code> options</td>
<td><a href="../interfaces/_types_.apioptions.md">ApiOptions</a></td>
<td><code>ProviderInterface</code></td>
<td>Options to create an instance. Can be either <a href="../interfaces/_types_.apioptions.md">ApiOptions</a> or [[WsProvider]]</td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <a href="_rx_index_.apirx.html">ApiRx</a></p>
<hr>
<h1 id="accessors">Accessors</h1>
<p><a id="derive"></a></p>
<h2 id="derive">derive</h2>
<p>getderive(): <code>Derive</code></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/rx/index.ts#L181" target="_blank">rx/index.ts:181</a></em></p>
<p><strong>Returns:</strong> <code>Derive</code></p>
<hr>
<p><a id="genesishash"></a></p>
<h2 id="genesishash">genesisHash</h2>
<p>getgenesisHash(): <code>Hash</code></p>
<p><em>Inherited from <a href="_base_.apibase.md">ApiBase</a>.<a href="_base_.apibase.md#genesishash">genesisHash</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/Base.ts#L77" target="_blank">Base.ts:77</a></em></p>
<p><em><strong>description</strong></em>: Contains the genesis Hash of the attached chain. Apart from being useful to determine the actual chain, it can also be used to sign immortal transactions.</p>
<p><strong>Returns:</strong> <code>Hash</code></p>
<hr>
<p><a id="hassubscriptions"></a></p>
<h2 id="hassubscriptions">hasSubscriptions</h2>
<p>gethasSubscriptions(): <code>boolean</code></p>
<p><em>Inherited from <a href="_base_.apibase.md">ApiBase</a>.<a href="_base_.apibase.md#hassubscriptions">hasSubscriptions</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/Base.ts#L86" target="_blank">Base.ts:86</a></em></p>
<p><em><strong>description</strong></em>: <code>true</code> when subscriptions are supported</p>
<p><strong>Returns:</strong> <code>boolean</code></p>
<hr>
<p><a id="isconnected"></a></p>
<h2 id="isconnected">isConnected</h2>
<p>getisConnected(): <code>Observable</code>&lt;<code>boolean</code>&gt;</p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/rx/index.ts#L188" target="_blank">rx/index.ts:188</a></em></p>
<p><em><strong>description</strong></em>: Observable that carries the connected state for the provider. Results in a boolean flag that is true/false based on the connectivity.</p>
<p><strong>Returns:</strong> <code>Observable</code>&lt;<code>boolean</code>&gt;</p>
<hr>
<p><a id="isready"></a></p>
<h2 id="isready">isReady</h2>
<p>getisReady(): <code>Observable</code>&lt;<a href="_rx_index_.apirx.html">ApiRx</a>&gt;</p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/rx/index.ts#L195" target="_blank">rx/index.ts:195</a></em></p>
<p><em><strong>description</strong></em>: Observable that returns the first time we are connected and loaded</p>
<p><strong>Returns:</strong> <code>Observable</code>&lt;<a href="_rx_index_.apirx.html">ApiRx</a>&gt;</p>
<hr>
<p><a id="query"></a></p>
<h2 id="query">query</h2>
<p>getquery(): <a href="../interfaces/_rx_types_.queryablestorage.md">QueryableStorage</a></p>
<p><em>Inherited from <a href="_base_.apibase.md">ApiBase</a>.<a href="_base_.apibase.md#query">query</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/Base.ts#L122" target="_blank">Base.ts:122</a></em></p>
<p><em><strong>description</strong></em>: Contains all the chain state modules and their subsequent methods in the API. These are attached dynamically from the runtime metadata.</p>
<p>All calls inside the namespace, is denoted by <code>section</code>.<code>method</code> and may take an optional query parameter. As an example, <code>api.query.timestamp.now()</code> (current block timestamp) does not take parameters, while <code>api.query.system.accountNonce(&lt;accountId&gt;)</code> (retrieving the associated nonce for an account), takes the <code>AccountId</code> as a parameter.</p>
<p><em><strong>example</strong></em>: </p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">query</span><span class="sunlight-operator">.</span><span class="sunlight-ident">balances</span><span class="sunlight-operator">.</span><span class="sunlight-ident">freeBalance</span><span class="sunlight-punctuation">(</span><span class="sunlight-operator">&lt;</span><span class="sunlight-ident">accountId</span><span class="sunlight-operator">&gt;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-ident">balance</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;new&#xA0;balance&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">balance</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p><strong>Returns:</strong> <a href="../interfaces/_rx_types_.queryablestorage.md">QueryableStorage</a></p>
<hr>
<p><a id="rpc"></a></p>
<h2 id="rpc">rpc</h2>
<p>getrpc(): <code>RpcRx</code></p>
<p><em>Inherited from <a href="_base_.apibase.md">ApiBase</a>.<a href="_base_.apibase.md#rpc">rpc</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/Base.ts#L142" target="_blank">Base.ts:142</a></em></p>
<p><em><strong>description</strong></em>: Contains all the raw rpc sections and their subsequent methods in the API as defined by the jsonrpc interface definitions. Unlike the dynamic <code>api.query</code> and <code>api.tx</code> sections, these methods are fixed (although extensible with node upgrades) and not determined by the runtime.</p>
<p>RPC endpoints available here allow for the query of chain, node and system information, in addition to providing interfaces for the raw queries of state (usine known keys) and the submission of transactions.</p>
<p><em><strong>example</strong></em>: </p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">rpc</span><span class="sunlight-operator">.</span><span class="sunlight-ident">chain</span><span class="sunlight-operator">.</span><span class="sunlight-ident">subscribeNewHead</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">header</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;new&#xA0;header&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">header</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p><strong>Returns:</strong> <code>RpcRx</code></p>
<hr>
<p><a id="runtimemetadata"></a></p>
<h2 id="runtimemetadata">runtimeMetadata</h2>
<p>getruntimeMetadata(): <code>Metadata</code></p>
<p><em>Inherited from <a href="_base_.apibase.md">ApiBase</a>.<a href="_base_.apibase.md#runtimemetadata">runtimeMetadata</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/Base.ts#L93" target="_blank">Base.ts:93</a></em></p>
<p><em><strong>description</strong></em>: Yields the current attached runtime metadata. Generally this is only used to construct extrinsics &amp; storage, but is useful for current runtime inspection.</p>
<p><strong>Returns:</strong> <code>Metadata</code></p>
<hr>
<p><a id="runtimeversion"></a></p>
<h2 id="runtimeversion">runtimeVersion</h2>
<p>getruntimeVersion(): <code>RuntimeVersion</code></p>
<p><em>Inherited from <a href="_base_.apibase.md">ApiBase</a>.<a href="_base_.apibase.md#runtimeversion">runtimeVersion</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/Base.ts#L102" target="_blank">Base.ts:102</a></em></p>
<p><em><strong>description</strong></em>: Contains the version information for the current runtime.</p>
<p><strong>Returns:</strong> <code>RuntimeVersion</code></p>
<hr>
<p><a id="tx"></a></p>
<h2 id="tx">tx</h2>
<p>gettx(): <a href="../interfaces/_rx_types_.submittableextrinsics.md">SubmittableExtrinsics</a></p>
<p><em>Inherited from <a href="_base_.apibase.md">ApiBase</a>.<a href="_base_.apibase.md#tx">tx</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/Base.ts#L161" target="_blank">Base.ts:161</a></em></p>
<p><em><strong>description</strong></em>: Contains all the extrinsic modules and their subsequent methods in the API. It allows for the construction of transactions and the submission thereof. These are attached dynamically from the runtime metadata.</p>
<p><em><strong>example</strong></em>: </p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">tx</span><span class="sunlight-operator">.</span><span class="sunlight-ident">balances</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">transfer</span><span class="sunlight-punctuation">(</span><span class="sunlight-operator">&lt;</span><span class="sunlight-ident">recipientId</span><span class="sunlight-operator">&gt;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-operator">&lt;</span><span class="sunlight-ident">balance</span><span class="sunlight-operator">&gt;</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">sign</span><span class="sunlight-punctuation">(</span><span class="sunlight-operator">&lt;</span><span class="sunlight-ident">keyPair</span><span class="sunlight-operator">&gt;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-operator">&lt;</span><span class="sunlight-ident">accountNonce</span><span class="sunlight-operator">&gt;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-operator">&lt;</span><span class="sunlight-ident">blockHash</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-ident">optional</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">&gt;</span><span class="sunlight-punctuation">)</span>
&#xA0;&#xA0;<span class="sunlight-operator">.</span><span class="sunlight-ident">send</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">status</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;tx&#xA0;status&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-ident">status</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p><strong>Returns:</strong> <a href="../interfaces/_rx_types_.submittableextrinsics.md">SubmittableExtrinsics</a></p>
<hr>
<h1 id="methods">Methods</h1>
<p><a id="on"></a></p>
<h2 id="on">on</h2>
<p>&#x25B8; <strong>on</strong>(type: <em><a href="../modules/_types_.md#apiinterface_events">ApiInterface$Events</a></em>, handler: <em><code>function</code></em>): <code>this</code></p>
<p><em>Inherited from <a href="_base_.apibase.md">ApiBase</a>.<a href="_base_.apibase.md#on">on</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/Base.ts#L186" target="_blank">Base.ts:186</a></em></p>
<p><em><strong>description</strong></em>: Attach an eventemitter handler to listen to a specific event</p>
<p><em><strong>example</strong></em>: </p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">on</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;connected&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;API&#xA0;has&#xA0;been&#xA0;connected&#xA0;to&#xA0;the&#xA0;endpoint&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">on</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;disconnected&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;API&#xA0;has&#xA0;been&#xA0;disconnected&#xA0;from&#xA0;the&#xA0;endpoint&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><a href="../modules/_types_.md#apiinterface_events">ApiInterface$Events</a></td>
<td>The type of event to listen to. Available events are `connected`, `disconnected`, `ready` and `error`</td>
</tr>
<tr>
<td>handler</td>
<td><code>function</code></td>
<td>The callback to be called when the event fires. Depending on the event type, it could fire with additional arguments.</td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>this</code></p>
<hr>
<p><a id="once"></a></p>
<h2 id="once">once</h2>
<p>&#x25B8; <strong>once</strong>(type: <em><a href="../modules/_types_.md#apiinterface_events">ApiInterface$Events</a></em>, handler: <em><code>function</code></em>): <code>this</code></p>
<p><em>Inherited from <a href="_base_.apibase.md">ApiBase</a>.<a href="_base_.apibase.md#once">once</a></em></p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/Base.ts#L211" target="_blank">Base.ts:211</a></em></p>
<p><em><strong>description</strong></em>: Attach an one-time eventemitter handler to listen to a specific event</p>
<p><em><strong>example</strong></em>: </p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">once</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;connected&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;API&#xA0;has&#xA0;been&#xA0;connected&#xA0;to&#xA0;the&#xA0;endpoint&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">once</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;disconnected&apos;</span><span class="sunlight-punctuation">,</span>&#xA0;<span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-string">&apos;API&#xA0;has&#xA0;been&#xA0;disconnected&#xA0;from&#xA0;the&#xA0;endpoint&apos;</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td><a href="../modules/_types_.md#apiinterface_events">ApiInterface$Events</a></td>
<td>The type of event to listen to. Available events are `connected`, `disconnected`, `ready` and `error`</td>
</tr>
<tr>
<td>handler</td>
<td><code>function</code></td>
<td>The callback to be called when the event fires. Depending on the event type, it could fire with additional arguments.</td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>this</code></p>
<hr>
<p><a id="create"></a></p>
<h2 id="static-create"><code>&lt;Static&gt;</code> create</h2>
<p>&#x25B8; <strong>create</strong>(options?: <em><a href="../interfaces/_types_.apioptions.md">ApiOptions</a> | <code>ProviderInterface</code></em>): <code>Observable</code>&lt;<a href="_rx_index_.apirx.html">ApiRx</a>&gt;</p>
<p><em>Defined in <a href="https://github.com/polkadot-js/api/blob/887a0d3/packages/api/src/rx/index.ts#L143" target="_blank">rx/index.ts:143</a></em></p>
<p><em><strong>description</strong></em>: Creates an ApiRx instance using the supplied provider. Returns an Observable containing the actual Api instance.</p>
<p><em><strong>example</strong></em>: </p>
<pre><code class="lang-javascript"><div class="sunlight-container sunlight-theme-gitbook"><div class="sunlight-code-container"><pre class="sunlight-highlight-javascript sunlight-highlighted"><span class="sunlight-javascript"><span class="sunlight-reservedWord">import</span>&#xA0;<span class="sunlight-ident">Api</span>&#xA0;<span class="sunlight-ident">from</span>&#xA0;<span class="sunlight-string">&apos;@polkadot/api/rx&apos;</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-ident">Api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">create</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">)</span><span class="sunlight-operator">.</span><span class="sunlight-ident">subscribe</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">api</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;<span class="sunlight-ident">api</span><span class="sunlight-operator">.</span><span class="sunlight-ident">query</span><span class="sunlight-operator">.</span><span class="sunlight-ident">timestamp</span><span class="sunlight-operator">.</span><span class="sunlight-ident">now</span><span class="sunlight-operator">.</span><span class="sunlight-ident">subscribe</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">(</span><span class="sunlight-ident">timestamp</span><span class="sunlight-punctuation">)</span>&#xA0;<span class="sunlight-operator">=</span><span class="sunlight-operator">&gt;</span>&#xA0;<span class="sunlight-punctuation">{</span>
&#xA0;&#xA0;&#xA0;&#xA0;<span class="sunlight-ident">console</span><span class="sunlight-operator">.</span><span class="sunlight-ident">log</span><span class="sunlight-punctuation">(</span><span class="sunlight-punctuation">`</span><span class="sunlight-ident">lastest</span>&#xA0;<span class="sunlight-ident">block</span>&#xA0;<span class="sunlight-ident">timestamp</span>&#xA0;<span class="sunlight-ident">$</span><span class="sunlight-punctuation">{</span><span class="sunlight-ident">timestamp</span><span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">`</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
&#xA0;&#xA0;<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
<span class="sunlight-punctuation">}</span><span class="sunlight-punctuation">)</span><span class="sunlight-punctuation">;</span>
</span></pre></div></div></code></pre>
<p><strong>Parameters:</strong></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Optional</code> options</td>
<td><a href="../interfaces/_types_.apioptions.md">ApiOptions</a></td>
<td><code>ProviderInterface</code></td>
<td>options that is passed to the class contructor. Can be either <a href="../interfaces/_types_.apioptions.md">ApiOptions</a> or [[WsProvider]]</td>
</tr>
</tbody>
</table>
<p><strong>Returns:</strong> <code>Observable</code>&lt;<a href="_rx_index_.apirx.html">ApiRx</a>&gt;</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="_promise_index_.apipromise.html" class="navigation navigation-prev " aria-label="Previous page: ApiPromise">
<i class="fa fa-angle-left"></i>
</a>
<a href="../../rpc-provider/" class="navigation navigation-next " aria-label="Next page: rpc-provider">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"ApiRx","level":"1.2.2","depth":2,"next":{"title":"rpc-provider","level":"1.3","depth":1,"path":"rpc-provider/README.md","ref":"rpc-provider/README.md","articles":[{"title":"HttpProvider","level":"1.3.1","depth":2,"path":"rpc-provider/classes/_http_index_.httpprovider.md","ref":"rpc-provider/classes/_http_index_.httpprovider.md","articles":[]},{"title":"WsProvider","level":"1.3.2","depth":2,"path":"rpc-provider/classes/_ws_index_.wsprovider.md","ref":"rpc-provider/classes/_ws_index_.wsprovider.md","articles":[]}]},"previous":{"title":"ApiPromise","level":"1.2.1","depth":2,"path":"api/classes/_promise_index_.apipromise.md","ref":"api/classes/_promise_index_.apipromise.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":"api/classes/_rx_index_.apirx.md","mtime":"2019-01-09T10:40:24.282Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-09T10:41:47.915Z"},"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>