6 <meta name="viewport" content="width=device-width">
7 <title>Bytom Node.js SDK Module: TransactionsApi</title>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
12 <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
14 <link type="text/css" rel="stylesheet" href="styles/site.cosmo.css">
20 <div class="navbar navbar-default navbar-fixed-top ">
21 <div class="container">
22 <div class="navbar-header">
23 <a class="navbar-brand" href="index.html">Bytom Node.js SDK</a>
24 <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
25 <span class="icon-bar"></span>
26 <span class="icon-bar"></span>
27 <span class="icon-bar"></span>
30 <div class="navbar-collapse collapse" id="topNavigation">
31 <ul class="nav navbar-nav">
34 <a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a>
35 <ul class="dropdown-menu ">
36 <li><a href="module-AccessTokensApi.html">AccessTokensApi</a></li><li><a href="module-AccountsApi.html">AccountsApi</a></li><li><a href="module-AssetsApi.html">AssetsApi</a></li><li><a href="module-BalancesApi.html">BalancesApi</a></li><li><a href="module-BlockAPI.html">BlockAPI</a></li><li><a href="module-ConfigApi.html">ConfigApi</a></li><li><a href="module-KeysApi.html">KeysApi</a></li><li><a href="module-TransactionsApi.html">TransactionsApi</a></li><li><a href="module-UnspentOutputsApi.html">UnspentOutputsApi</a></li>
41 <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
42 <ul class="dropdown-menu ">
43 <li><a href="TransactionBuilder.html">TransactionBuilder</a></li>
48 <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
49 <ul class="dropdown-menu ">
50 <li><a href="global.html">Global</a></li>
56 <div class="col-sm-3 col-md-3">
57 <form class="navbar-form" role="search">
58 <div class="input-group">
59 <input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
60 <div class="input-group-btn">
61 <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
73 <div class="container" id="toc-content">
77 <div class="col-md-8">
82 <h1 class="page-title">Module: TransactionsApi</h1>
91 <div class="container-overview">
94 <div class="description"><p>API for interacting with <a href="global.html#Transaction">transactions</a>.</p></div>
154 <h3 class="subsection-title">Methods</h3>
160 <h4 class="name" id="~build"><span class="type-signature"><inner> </span>build(builderBlock)</h4>
167 <div class="description">
168 <p>Build an unsigned transaction from a set of actions.</p>
181 <table class="params table table-striped">
194 <th class="last">Description</th>
203 <td class="name"><code>builderBlock</code></td>
209 <span class="param-type"><a href="module-TransactionsApi.html#~builderCallback">module:TransactionsApi~builderCallback</a></span>
220 <td class="description last"><p>Function that adds desired actions
221 to a given builder object.</p></td>
284 <div class="param-desc">
285 <p>Unsigned transaction template, or error.</p>
296 <span class="param-type">Promise.<Object></span>
313 <h4 class="name" id="~estimateGas"><span class="type-signature"><inner> </span>estimateGas(transaction)</h4>
320 <div class="description">
321 <p>Estimate how much gas one trasaction may use.</p>
334 <table class="params table table-striped">
347 <th class="last">Description</th>
356 <td class="name"><code>transaction</code></td>
362 <span class="param-type">Object</span>
373 <td class="description last"><p>The transaction template to estimate.</p></td>
436 <div class="param-desc">
437 <p>Estimation result.</p>
448 <span class="param-type">Object</span>
465 <h4 class="name" id="~list"><span class="type-signature"><inner> </span>list(params)</h4>
472 <div class="description">
473 <p>List local transactions by id or filter condition.</p>
486 <table class="params table table-striped">
499 <th class="last">Description</th>
508 <td class="name"><code>params</code></td>
514 <span class="param-type">Object</span>
525 <td class="description last"><p>Transaction filter params.</p>
526 <h6 class="method-params-label method-subparams-label">Properties</h6>
529 <table class="params table table-striped">
542 <th class="last">Description</th>
551 <td class="name"><code>id</code></td>
557 <span class="param-type">String</span>
568 <td class="description last"><p>transaction id, hash of transaction.</p></td>
575 <td class="name"><code>account_id</code></td>
581 <span class="param-type">String</span>
592 <td class="description last"><p>id of account.</p></td>
599 <td class="name"><code>detail</code></td>
605 <span class="param-type">Boolean</span>
616 <td class="description last"><p>flag of detail transactions, default false (only return transaction summary).</p></td>
623 <td class="name"><code>unconfirmed</code></td>
629 <span class="param-type">Boolean</span>
640 <td class="description last"><p>flag of unconfirmed transactions(query result include all confirmed
641 and unconfirmed transactions), default false.</p></td>
648 <td class="name"><code>from</code></td>
654 <span class="param-type">Integer</span>
665 <td class="description last"><p>The start position of first transaction.</p></td>
672 <td class="name"><code>count</code></td>
678 <span class="param-type">Integer</span>
689 <td class="description last"><p>The number of returned.</p></td>
759 <div class="param-desc">
760 <p>The result transactions.</p>
771 <span class="param-type">Promise.<Array.<<a href="global.html#Transaction">Transaction</a>>></span>
788 <h4 class="name" id="~listAll"><span class="type-signature"><inner> </span>listAll()</h4>
795 <div class="description">
796 <p>List all local transactions.</p>
861 <div class="param-desc">
862 <p>All local transactions.</p>
873 <span class="param-type">Promise.<Array.<<a href="global.html#Transaction">Transaction</a>>></span>
890 <h4 class="name" id="~sign"><span class="type-signature"><inner> </span>sign(params)</h4>
897 <div class="description">
898 <p>Sign transaction.</p>
911 <table class="params table table-striped">
924 <th class="last">Description</th>
933 <td class="name"><code>params</code></td>
939 <span class="param-type">Object</span>
950 <td class="description last"><p>The built transaction template.</p>
951 <h6 class="method-params-label method-subparams-label">Properties</h6>
954 <table class="params table table-striped">
967 <th class="last">Description</th>
976 <td class="name"><code>password</code></td>
982 <span class="param-type">String</span>
993 <td class="description last"><p>signature of the password.</p></td>
1000 <td class="name"><code>transaction</code></td>
1006 <span class="param-type">Object</span>
1017 <td class="description last"><p>builded transaction.</p></td>
1034 <dl class="details">
1087 <div class="param-desc">
1089 <li>Sign result.</li>
1101 <span class="param-type">Promise.<<a href="module-TransactionsApi.html#~SignResult">module:TransactionsApi~SignResult</a>></span>
1118 <h4 class="name" id="~submit"><span class="type-signature"><inner> </span>submit(raw_transaction)</h4>
1125 <div class="description">
1126 <p>Submit a signed transaction to the blockchain.</p>
1136 <h5>Parameters:</h5>
1139 <table class="params table table-striped">
1152 <th class="last">Description</th>
1161 <td class="name"><code>raw_transaction</code></td>
1167 <span class="param-type">String</span>
1178 <td class="description last"><p>Encoded fully signed transaction.</p></td>
1188 <dl class="details">
1241 <div class="param-desc">
1242 <p>Submit result. It will return tx_id if submit successfully else error.</p>
1253 <span class="param-type">Promise.<Object></span>
1270 <h3 class="subsection-title">Type Definitions</h3>
1275 <dt class="name" id="~Action">
1276 <h4 id="~Action">Action</h4>
1282 <div class="description">
1283 <p>Basic unit to build a transaction.
1284 For spend transaction, either account_id or account_alias is required to specify account info.
1285 Asset info(either asset_id or asset_alias ) is required for all kinds of action.</p>
1294 <span class="param-type">Object</span>
1303 <dl class="details">
1306 <h5 class="subsection-title">Properties:</h5>
1310 <table class="props table table-striped">
1323 <th class="last">Description</th>
1332 <td class="name"><code>type</code></td>
1338 <span class="param-type">String</span>
1349 <td class="description last"><p>Currently 4 types of action is supported:</p>
1351 <li>spend_account: action to spend UTXO from account.</li>
1352 <li>issue: action to issue asset.</li>
1353 <li>retire: action to retire asset.</li>
1354 <li>control_address: action to receive asset with address.</li>
1362 <td class="name"><code>account_alias</code></td>
1368 <span class="param-type">String</span>
1379 <td class="description last"><p>The alias of the account transferring the asset (possibly null).</p></td>
1386 <td class="name"><code>account_id</code></td>
1392 <span class="param-type">String</span>
1403 <td class="description last"><p>The id of the account transferring the asset (possibly null).</p></td>
1410 <td class="name"><code>asset_id</code></td>
1416 <span class="param-type">String</span>
1427 <td class="description last"><p>The id of the asset being issued or spent (possibly null).</p></td>
1434 <td class="name"><code>asset_alias</code></td>
1440 <span class="param-type">String</span>
1451 <td class="description last"><p>The alias of the asset being issued or spent (possibly null).</p></td>
1458 <td class="name"><code>address</code></td>
1464 <span class="param-type">String</span>
1475 <td class="description last"><p>Address to receive the transfered asset(possibly null, required for control_address action).</p></td>
1528 <h4 class="name" id="~builderCallback"><span class="type-signature"></span>builderCallback(builder)</h4>
1542 <h5>Parameters:</h5>
1545 <table class="params table table-striped">
1558 <th class="last">Description</th>
1567 <td class="name"><code>builder</code></td>
1573 <span class="param-type"><a href="TransactionBuilder.html">TransactionBuilder</a></span>
1584 <td class="description last"></td>
1594 <dl class="details">
1651 <dt class="name" id="~SignResult">
1652 <h4 id="~SignResult">SignResult</h4>
1658 <div class="description">
1659 <p>Data structure <code>/sign-transaction</code> api will return.</p>
1668 <span class="param-type">Object</span>
1677 <dl class="details">
1680 <h5 class="subsection-title">Properties:</h5>
1684 <table class="props table table-striped">
1697 <th class="last">Description</th>
1706 <td class="name"><code>transaction</code></td>
1712 <span class="param-type"><a href="global.html#Transaction">Transaction</a></span>
1723 <td class="description last"><p>The signed transaction if sign success.</p></td>
1730 <td class="name"><code>sign_complete</code></td>
1736 <span class="param-type">Boolean</span>
1747 <td class="description last"><p>Whether all input actions are signed. It means this transaction can be submit if true, else not.</p></td>
1810 <div class="clearfix"></div>
1813 <div class="col-md-3">
1814 <div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
1822 <div class="modal fade" id="searchResults">
1823 <div class="modal-dialog">
1824 <div class="modal-content">
1825 <div class="modal-header">
1826 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1827 <h4 class="modal-title">Search results</h4>
1829 <div class="modal-body"></div>
1830 <div class="modal-footer">
1831 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1833 </div><!-- /.modal-content -->
1834 </div><!-- /.modal-dialog -->
1841 <span class="jsdoc-message">
1842 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
1844 on 2018-11-26T16:28:32+08:00
1846 using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
1850 <script src="scripts/docstrap.lib.js"></script>
1851 <script src="scripts/toc.js"></script>
1853 <script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
1858 $( "[id*='$']" ).each( function () {
1859 var $this = $( this );
1861 $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
1864 $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
1865 var $this = $( this );
1867 var example = $this.find( "code" );
1868 exampleText = example.html();
1869 var lang = /{@lang (.*?)}/.exec( exampleText );
1870 if ( lang && lang[1] ) {
1871 exampleText = exampleText.replace( lang[0], "" );
1872 example.html( exampleText );
1875 var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
1876 lang = langClassMatch ? langClassMatch[1] : "javascript";
1882 .addClass( "sunlight-highlight-" + lang )
1883 .addClass( "linenums" )
1884 .html( example.html() );
1889 Sunlight.highlightAll( {
1892 enableDoclinks : true
1895 $.catchAnchorLinks( {
1899 anchorName : function ( i, heading, prefix ) {
1900 return $( heading ).attr( "id" ) || ( prefix + i );
1902 selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
1903 showAndHide : false,
1904 smoothScrolling: true
1907 $( "#main span[id^='toc']" ).addClass( "toc-shim" );
1908 $( '.dropdown-toggle' ).dropdown();
1910 $( "table" ).each( function () {
1911 var $this = $( this );
1912 $this.addClass('table');
1920 <!--Navigation and Symbol Display-->
1923 <!--Google Analytics-->
1927 <script type="text/javascript">
1928 $(document).ready(function() {
1929 SearcherDisplay.init();