UNPKG

ontology-ts-sdk

Version:

Comprehensive TypeScript library for the Ontology blockchain.

824 lines 59.3 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>WebsocketClient | ontology-ts-sdk</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../assets/css/main.css"> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">ontology-ts-sdk</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> <input type="checkbox" id="tsd-filter-externals" checked /> <label class="tsd-widget" for="tsd-filter-externals">Externals</label> <input type="checkbox" id="tsd-filter-only-exported" /> <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="../globals.html">Globals</a> </li> <li> <a href="../modules/_network_websocket_websocketclient_.html">&quot;network/websocket/websocketClient&quot;</a> </li> <li> <a href="_network_websocket_websocketclient_.websocketclient.html">WebsocketClient</a> </li> </ul> <h1>Class WebsocketClient</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel tsd-comment"> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Websocket client.</p> </div> <p>TODO: correlate request and response with id, so socket can be reused.</p> </div> </section> <section class="tsd-panel tsd-hierarchy"> <h3>Hierarchy</h3> <ul class="tsd-hierarchy"> <li> <span class="target">WebsocketClient</span> </li> </ul> </section> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section "> <h3>Constructors</h3> <ul class="tsd-index-list"> <li class="tsd-kind-constructor tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#constructor" class="tsd-kind-icon">constructor</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Properties</h3> <ul class="tsd-index-list"> <li class="tsd-kind-property tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#debug" class="tsd-kind-icon">debug</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#url" class="tsd-kind-icon">url</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Methods</h3> <ul class="tsd-index-list"> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getallowance" class="tsd-kind-icon">get<wbr>Allowance</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getbalance" class="tsd-kind-icon">get<wbr>Balance</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getblock" class="tsd-kind-icon">get<wbr>Block</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getblockheight" class="tsd-kind-icon">get<wbr>Block<wbr>Height</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getblockheightbytxhash" class="tsd-kind-icon">get<wbr>Block<wbr>Height<wbr>ByTx<wbr>Hash</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getblockjson" class="tsd-kind-icon">get<wbr>Block<wbr>Json</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getcontract" class="tsd-kind-icon">get<wbr>Contract</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getcontractjson" class="tsd-kind-icon">get<wbr>Contract<wbr>Json</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getgenerateblocktime" class="tsd-kind-icon">get<wbr>Generate<wbr>Block<wbr>Time</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getmerkleproof" class="tsd-kind-icon">get<wbr>Merkle<wbr>Proof</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getnodecount" class="tsd-kind-icon">get<wbr>Node<wbr>Count</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getrawtransaction" class="tsd-kind-icon">get<wbr>Raw<wbr>Transaction</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getrawtransactionjson" class="tsd-kind-icon">get<wbr>Raw<wbr>Transaction<wbr>Json</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getsmartcodeevent" class="tsd-kind-icon">get<wbr>Smart<wbr>Code<wbr>Event</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#getstorage" class="tsd-kind-icon">get<wbr>Storage</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><a href="_network_websocket_websocketclient_.websocketclient.html#send" class="tsd-kind-icon">send</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#sendheartbeat" class="tsd-kind-icon">send<wbr>Heart<wbr>Beat</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#sendrawtransaction" class="tsd-kind-icon">send<wbr>Raw<wbr>Transaction</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="_network_websocket_websocketclient_.websocketclient.html#sendsubscribe" class="tsd-kind-icon">send<wbr>Subscribe</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Constructors</h2> <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"> <a name="constructor" class="tsd-anchor"></a> <h3>constructor</h3> <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">new <wbr>Websocket<wbr>Client<span class="tsd-signature-symbol">(</span>url<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, debug<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_network_websocket_websocketclient_.websocketclient.html" class="tsd-signature-type">WebsocketClient</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L37">network/websocket/websocketClient.ts:37</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> url: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> =&nbsp;TEST_ONT_URL.SOCKET_URL</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> debug: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> =&nbsp;false</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="_network_websocket_websocketclient_.websocketclient.html" class="tsd-signature-type">WebsocketClient</a></h4> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Properties</h2> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="debug" class="tsd-anchor"></a> <h3>debug</h3> <div class="tsd-signature tsd-kind-icon">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L37">network/websocket/websocketClient.ts:37</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Decides if the client runs in debug mode so it can print info for debug.</p> </div> </div> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="url" class="tsd-anchor"></a> <h3>url</h3> <div class="tsd-signature tsd-kind-icon">url<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L33">network/websocket/websocketClient.ts:33</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Url of blockchain node</p> </div> </div> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Methods</h2> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getallowance" class="tsd-anchor"></a> <h3>get<wbr>Allowance</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Allowance<span class="tsd-signature-symbol">(</span>asset<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, from<span class="tsd-signature-symbol">: </span><a href="_crypto_address_.address.html" class="tsd-signature-type">Address</a>, to<span class="tsd-signature-symbol">: </span><a href="_crypto_address_.address.html" class="tsd-signature-type">Address</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L226">network/websocket/websocketClient.ts:226</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get allowanece</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>asset: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Asset&#39;s type.Only ONT and ONG supported.</p> </div> </li> <li> <h5>from: <a href="_crypto_address_.address.html" class="tsd-signature-type">Address</a></h5> <div class="tsd-comment tsd-typography"> <p>Address of allowance&#39;s sender.</p> </div> </li> <li> <h5>to: <a href="_crypto_address_.address.html" class="tsd-signature-type">Address</a></h5> <div class="tsd-comment tsd-typography"> <p>Address of allowance&#39;s receiver.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getbalance" class="tsd-anchor"></a> <h3>get<wbr>Balance</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Balance<span class="tsd-signature-symbol">(</span>address<span class="tsd-signature-symbol">: </span><a href="_crypto_address_.address.html" class="tsd-signature-type">Address</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L156">network/websocket/websocketClient.ts:156</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the balance of some address. The result contains ONT and ONG.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>address: <a href="_crypto_address_.address.html" class="tsd-signature-type">Address</a></h5> <div class="tsd-comment tsd-typography"> <p>Address</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getblock" class="tsd-anchor"></a> <h3>get<wbr>Block</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Block<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L136">network/websocket/websocketClient.ts:136</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get block&#39;s info by block&#39;s height or hash. The result is hex encoded string.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>value: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Block&#39;s height or hash</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getblockheight" class="tsd-anchor"></a> <h3>get<wbr>Block<wbr>Height</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Block<wbr>Height<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L126">network/websocket/websocketClient.ts:126</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get current block height</p> </div> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getblockheightbytxhash" class="tsd-anchor"></a> <h3>get<wbr>Block<wbr>Height<wbr>ByTx<wbr>Hash</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Block<wbr>Height<wbr>ByTx<wbr>Hash<span class="tsd-signature-symbol">(</span>hash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L196">network/websocket/websocketClient.ts:196</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get block&#39;s height by transaction hash</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>hash: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Reversed transaction hash</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getblockjson" class="tsd-anchor"></a> <h3>get<wbr>Block<wbr>Json</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Block<wbr>Json<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L146">network/websocket/websocketClient.ts:146</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get block&#39;s info by block&#39;s height or hash. The result is json.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>value: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Block&#39;s height or hash</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getcontract" class="tsd-anchor"></a> <h3>get<wbr>Contract</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Contract<span class="tsd-signature-symbol">(</span>hash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L166">network/websocket/websocketClient.ts:166</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get contract info by code hash. The result is hex encoded string.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>hash: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Contract&#39;s code hash.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getcontractjson" class="tsd-anchor"></a> <h3>get<wbr>Contract<wbr>Json</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Contract<wbr>Json<span class="tsd-signature-symbol">(</span>hash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L176">network/websocket/websocketClient.ts:176</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get contract&#39;s info by code hash The result is json.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>hash: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Contract&#39;s code hash</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getgenerateblocktime" class="tsd-anchor"></a> <h3>get<wbr>Generate<wbr>Block<wbr>Time</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Generate<wbr>Block<wbr>Time<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L110">network/websocket/websocketClient.ts:110</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the generation time for each block. If the blockchain node runs in vbft, the result is null.</p> </div> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getmerkleproof" class="tsd-anchor"></a> <h3>get<wbr>Merkle<wbr>Proof</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Merkle<wbr>Proof<span class="tsd-signature-symbol">(</span>hash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L215">network/websocket/websocketClient.ts:215</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get merkle proof by transaction hash.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>hash: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Reversed transaction hash</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getnodecount" class="tsd-anchor"></a> <h3>get<wbr>Node<wbr>Count</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Node<wbr>Count<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L118">network/websocket/websocketClient.ts:118</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get Nodes count</p> </div> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getrawtransaction" class="tsd-anchor"></a> <h3>get<wbr>Raw<wbr>Transaction</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Raw<wbr>Transaction<span class="tsd-signature-symbol">(</span>txHash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L91">network/websocket/websocketClient.ts:91</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get raw transaction by transaction hash. The result is hex encoded transaction.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>txHash: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Reversed transaction hash</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getrawtransactionjson" class="tsd-anchor"></a> <h3>get<wbr>Raw<wbr>Transaction<wbr>Json</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Raw<wbr>Transaction<wbr>Json<span class="tsd-signature-symbol">(</span>txHash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L101">network/websocket/websocketClient.ts:101</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get transaction info by transaction hash. The result is json.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>txHash: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Reversed transaction hash</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getsmartcodeevent" class="tsd-anchor"></a> <h3>get<wbr>Smart<wbr>Code<wbr>Event</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Smart<wbr>Code<wbr>Event<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L187">network/websocket/websocketClient.ts:187</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get smart conde event by transaction hash or block&#39;s height. If parameter is transaction hash, the result is the event of that transaction. If parameter is block&#39;s height, the result is all the events of that block.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>value: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Reversed transaction hash or block&#39;s height</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="getstorage" class="tsd-anchor"></a> <h3>get<wbr>Storage</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Storage<span class="tsd-signature-symbol">(</span>codeHash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L206">network/websocket/websocketClient.ts:206</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get stored value in smart contract by contract&#39;s code hash and the key.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>codeHash: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Contract&#39;s code hash</p> </div> </li> <li> <h5>key: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Key of stored value</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private"> <a name="send" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagPrivate">Private</span> send</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private"> <li class="tsd-signature tsd-kind-icon">send<span class="tsd-signature-symbol">(</span>raw<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, waitNotify<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L236">network/websocket/websocketClient.ts:236</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Send msg to blockchain</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>raw: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Message to send</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> waitNotify: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> =&nbsp;false</span></h5> <div class="tsd-comment tsd-typography"> <p>Decides if need to wait for notify from blockchain</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="sendheartbeat" class="tsd-anchor"></a> <h3>send<wbr>Heart<wbr>Beat</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">send<wbr>Heart<wbr>Beat<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L47">network/websocket/websocketClient.ts:47</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Send heart beat request</p> </div> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="sendrawtransaction" class="tsd-anchor"></a> <h3>send<wbr>Raw<wbr>Transaction</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">send<wbr>Raw<wbr>Transaction<span class="tsd-signature-symbol">(</span>hexData<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, preExec<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, waitNotify<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L81">network/websocket/websocketClient.ts:81</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Send raw transaction</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>hexData: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>Hex encoded data</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> preExec: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> =&nbsp;false</span></h5> <div class="tsd-comment tsd-typography"> <p>Decides if it is a pre-executed transaction</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> waitNotify: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> =&nbsp;false</span></h5> <div class="tsd-comment tsd-typography"> <p>Decides if client waits for notify from blockchain.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="sendsubscribe" class="tsd-anchor"></a> <h3>send<wbr>Subscribe</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">send<wbr>Subscribe<span class="tsd-signature-symbol">(</span>subscribeEvent<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, subscribeJsonBlock<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, subscribeRawBlock<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, subscribeBlockTxHashes<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/MickWang/ontology-ts-sdk/blob/f203ee8/src/network/websocket/websocketClient.ts#L59">network/websocket/websocketClient.ts:59</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Send subscribe request</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> subscribeEvent: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> =&nbsp;false</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> subscribeJsonBlock: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> =&nbsp;false</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> subscribeRawBlock: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> =&nbsp;false</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> subscribeBlockTxHashes: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> =&nbsp;false</span></h5> <div class="tsd-comment tsd-typography"> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> </section> </div> <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <nav class="tsd-navigation primary"> <ul> <li class="globals "> <a href="../globals.html"><em>Globals</em></a> </li> <li class="current tsd-kind-external-module"> <a href="../modules/_network_websocket_websocketclient_.html">"network/websocket/websocket<wbr>Client"</a> </li> </ul> </nav> <nav class="tsd-navigation secondary menu-sticky"> <ul class="before-current"> </ul> <ul class="current"> <li class="current tsd-kind-class tsd-parent-kind-external-module"> <a href="_network_websocket_websocketclient_.websocketclient.html" class="tsd-kind-icon">Websocket<wbr>Client</a> <ul> <li class=" tsd-kind-constructor tsd-parent-kind-class"> <a href="_network_websocket_websocketclient_.websocketclient.html#constructor" class="tsd-kind-icon">constructor</a