UNPKG

tomobridge-sdk

Version:
2,556 lines (747 loc) 30.4 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>BridgeJS - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <script src="scripts/nav.js" defer></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav > <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BridgeJS.html">BridgeJS</a><ul class='methods'><li data-type='method'><a href="BridgeJS.html#.setProvider">setProvider</a></li><li data-type='method'><a href="BridgeJS.html#getDepositTransaction">getDepositTransaction</a></li><li data-type='method'><a href="BridgeJS.html#getTransactions">getTransactions</a></li><li data-type='method'><a href="BridgeJS.html#getUnwrapTransactions">getUnwrapTransactions</a></li><li data-type='method'><a href="BridgeJS.html#getWithdrawTransaction">getWithdrawTransaction</a></li><li data-type='method'><a href="BridgeJS.html#getWrapTransactions">getWrapTransactions</a></li><li data-type='method'><a href="BridgeJS.html#unwrap">unwrap</a></li><li data-type='method'><a href="BridgeJS.html#unwrapWatch">unwrapWatch</a></li><li data-type='method'><a href="BridgeJS.html#wrapGetAddress">wrapGetAddress</a></li><li data-type='method'><a href="BridgeJS.html#wrapWatch">wrapWatch</a></li></ul></li></ul> </nav> <div id="main"> <h1 class="page-title">BridgeJS</h1> <section> <header> <h2> BridgeJS </h2> <div class="class-description usertext"><p>The SDK works with TomoChain protocols</p></div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="BridgeJS"><span class="type-signature"></span>new BridgeJS<span class="signature">(endpoint, pkey)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line31">line 31</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>endpoint</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The Url to the node</p></td> </tr> <tr> <td class="name"><code>pkey</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The private key of the wallet</p></td> </tr> </tbody> </table> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".setProvider"><span class="type-signature">(static) </span>setProvider<span class="signature">(endpoint<span class="signature-attributes">opt</span>, pkey<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line65">line 65</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Initial the SDK</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>endpoint</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> <code>https://bridge.tomochain.com</code> </td> <td class="description last"><p>The Url to the node</p></td> </tr> <tr> <td class="name"><code>pkey</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> <code>random</code> </td> <td class="description last"><p>The private key of the coinbase</p></td> </tr> </tbody> </table> <h4 class="name" id="getDepositTransaction"><span class="type-signature">(async) </span>getDepositTransaction<span class="signature">(wrap)</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line156">line 156</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Get latest deposit transaction</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>wrap</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The wrap information</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>tokenSymbol</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The token symbol</p></td> </tr> <tr> <td class="name"><code>userAddress</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The user address</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Transaction object(inner and outter networks)</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="getTransactions"><span class="type-signature">(async) </span>getTransactions<span class="signature">(object)</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line407">line 407</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Get depositing and withdrawal transactions filtering by tokenSymbol</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>object</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Input object</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>tokenSymbol</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>Token symbol</p></td> </tr> <tr> <td class="name"><code>limit</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>Limit number of records per page</p></td> </tr> <tr> <td class="name"><code>page</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>Page number</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Transaction object(inner and outter networks)</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="getUnwrapTransactions"><span class="type-signature">(async) </span>getUnwrapTransactions<span class="signature">(object)</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line362">line 362</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Get withdrawal transactions</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>object</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Input object</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>limit</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>Limit number of records per page</p></td> </tr> <tr> <td class="name"><code>page</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>Page number</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>wrap.userAddress</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The user address</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Transaction object(inner and outter networks)</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="getWithdrawTransaction"><span class="type-signature">(async) </span>getWithdrawTransaction<span class="signature">(unwrap)</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line194">line 194</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Get latest withdraw transaction</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>unwrap</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>The unwrap information</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>tokenSymbol</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>Token symbol</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>wrap.userAddress</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The user address</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Transaction object(inner and outter networks)</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="getWrapTransactions"><span class="type-signature">(async) </span>getWrapTransactions<span class="signature">(object)</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line317">line 317</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Get depositing transactions</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>object</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Input object</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>limit</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>Limit number of records per page</p></td> </tr> <tr> <td class="name"><code>page</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>Page number</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>wrap.userAddress</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The user address</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Transaction object(inner and outter networks)</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="unwrap"><span class="type-signature">(async) </span>unwrap<span class="signature">(unwrap)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line450">line 450</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Unwrap TRC21 TOKEN</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>unwrap</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"><p>The unwrap information</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>tokenSymbol</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The token symbol</p></td> </tr> <tr> <td class="name"><code>amount</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The amount for unwrapping</p></td> </tr> <tr> <td class="name"><code>dest</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The destination address</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h4 class="name" id="unwrapWatch"><span class="type-signature">(async) </span>unwrapWatch<span class="signature">(object)</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line273">line 273</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Watch withdrawal transaction</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>object</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Input object</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>tokenSymbol</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>Token symbol</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Transaction object(inner and outter networks)</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="wrapGetAddress"><span class="type-signature">(async) </span>wrapGetAddress<span class="signature">(wrap)</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line113">line 113</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Get depositing address</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>wrap</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"><p>The wrap information</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>tokenSymbol</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The token symbol</p></td> </tr> <tr> <td class="name"><code>userAddress</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The user address</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Depositing information object</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="wrapWatch"><span class="type-signature">(async) </span>wrapWatch<span class="signature">(object)</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="bridge.js.html">bridge.js</a>, <a href="bridge.js.html#line231">line 231</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Watch depositing transaction</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>object</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Input object</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>tokenSymbol</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>Token symbol</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Transaction object(inner and outter networks)</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.4</a> on Wed May 27 2020 05:13:37 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script>prettyPrint();</script> <script src="scripts/polyfill.js"></script> <script src="scripts/linenumber.js"></script> </body> </html>