1
0
mirror of https://github.com/Bytom/bytom-node-sdk.git synced 2020-06-03 17:14:54 +00:00
bytom-node-sdk/docs/quicksearch.html
2018-11-26 17:02:52 +08:00

32 lines
36 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
</head>
<body style="background: transparent;">
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/lunr.min.js"></script>
<script src="scripts/fulltext-search.js"></script>
<script type="text/x-docstrap-searchdb">
{"global.html":{"id":"global.html","title":"Global","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Global Type Definitions AccessToken Access tokens are name:secret-token pairs that are granted authorization for accessing Bytom Core features. Type: Object Properties: Name Type Description id String User specified, unique identifier. token String Only returned in the response from AccessTokensApi~create. created_at String Timestamp of token creation, RFC3339 formatted. Account An account is an object in Bytom that tracks ownership of assets on a blockchain. Type: Object Properties: Name Type Description id String Unique account identifier in one Bytom node. alias String User specified, unique identifier in one Bytom node. keys Array.&lt;Key&gt; The list of keys used to create control programs under the account. Signatures from these keys are required for spending funds held in the account. key_index Number The index of keys. quorum Number The number of keys required to sign transactions for the account. Asset An asset is a type of value that can be issued on a blockchain. All units of a given asset are fungible. Units of an asset can be transacted directly between parties without the involvement of the issuer. Type: Object Properties: Name Type Description id String Globally unique identifier of the asset. Asset specifies the asset id as the hash of: the asset's issuance program the core's VM version the hash of asset definition alias String User specified, unique identifier in one Bytom node. issuanceProgram String keys Array.&lt;Key&gt; The list of keys used to issue units of the asset. quorum Number The number of signatures required to issue new units of the asset. defintion Object User-specified, arbitrary/unstructured data visible across Bytom blockchain networks. assets specify the definition in their issuance programs, rendering the definition immutable. Balance Any balance on the blockchain is simply a summation of unspent outputs. Type: Object Properties: Name Type Description amount Number Sum of the unspent outputs. account_alias String Account alias. account_id String Account id. asset_id String Asset id. asset_alias String Asset alias. asset_definition Object Asset definition BlockInfo Type: Object Properties: Name Type Description hash String hash of block. size Integer size of block. version Integer version of block. height Integer height of block. previous_block_hash String previous block hash. timestamp Integer timestamp of block. nonce Integer nonce value. bits Integer bits of difficulty. difficulty String difficulty value(String type). transaction_merkle_root String merkle root of transaction. transaction_status_hash String merkle root of transaction status. transactions Array.&lt;Object&gt; transaction object: Properties Name Type Description id String transaction id, hash of the transaction. version Integer version of transaction. size Integer size of transaction. time_range Integer the unix timestamp for when the requst was responsed. status_fail Boolean whether the state of the request has failed. mux_id String the previous transaction mux id(source id of utxo). inputs Array.&lt;Object&gt; object of inputs for the transaction. Properties Name Type Description type String the type of input action, available option include: 'spend', 'issue', 'coinbase'. asset_id String asset id. asset_alias String name of asset. asset_definition Object definition of asset(json object). amount Integer amount of asset. issuance_program Object issuance program, it only exist when type is 'issue'. control_program Object control program of account, it only exist when type is 'spend'. address String address of account, it only exist when type is 'spend'. spent_output_id String the front of outputID to be spent in this input, it only exist when type is 'spend'. account_id String account id. account_alias String name of account. arbitrary Object arbitrary infomation can be set by miner, it only exist when type is 'coinbase'. input_id String hash of input action. witness_arguments Array.&lt;String&gt; witness arguments. outputs Array.&lt;Object&gt; object of outputs for the transaction. Properties Name Type Description type String the type of output action, available option include: 'retire', 'control'. id String outputid related to utxo. position Integer position of outputs. asset_id String asset id. asset_alias String name of asset. asset_definition Object definition of asset(json object). amount Integer amount of asset. account_id String account id. account_alias String name of account. control_program Object control program of account. address String address of account. CoreInfo Basic information about the configuration of Bytom Core, as well as any errors encountered when updating the local state of the blockchain More info: {} Type: Object Properties: Name Type Description listening Boolean whether the node is listening. syncing Boolean whether the node is syncing. mining Boolean whether the node is mining. peer_count Integer current count of connected peers. current_block Integer current block height in the node's blockchain. highest_block Integer current highest block of the connected peers. network_id String network id. version_info Object bytomd version information: version String current version of the running bytomd. update uint16 whether there exists an update. 0: no update; 1: small update; 2: significant update. new_version String the newest version of bytomd if there is one. Key Cryptographic private keys are the primary authorization mechanism on a blockchain. Type: Object Properties: Name Type Description alias String User specified, unique identifier of the key. xpub String Hex-encoded string representation of the key. Receiver A receiver is an object that wraps an account control program with the corresponding address. Type: Object Properties: Name Type Description control_program String The underlying control program that will be used in transactions paying to the address. address String The target address one transaction can pay UTXO to. Transaction A blockchain consists of an immutable set of cryptographically linked transactions. Each transaction contains one or more actions. Type: Object Properties: Name Type Description tx_id String Unique transaction identifier. block_time String Time of transaction. inputs Array.&lt;TransactionInput&gt; List of specified inputs for a transaction. outputs Array.&lt;TransactionOutput&gt; List of specified outputs for a transaction. TransactionInput Type: Object Properties: Name Type Description type String The type of the input. Possible values are &quot;issue&quot;, &quot;spend&quot;. asset_id String The id of the asset being issued or spent. asset_alias String The alias of the asset being issued or spent (possibly null). asset_definition Hash The definition of the asset being issued or spent (possibly null). amount Integer The number of units of the asset being issued or spent. spentOutputId String The id of the output consumed by this input. ID is nil if this is an issuance input. account_id String The id of the account transferring the asset (possibly null if the input is an issuance or an unspent output is specified). account_alias String The alias of the account transferring the asset (possibly null if the input is an issuance or an unspent output is specified). issuance_program String A program specifying a predicate for issuing an asset (possibly null if input is not an issuance). control_program String A UTXO control program. address String The UTXO address. TransactionOutput Each new transaction in the blockchain consumes some unspent outputs and creates others. An output is considered unspent when it has not yet been used as an input to a new transaction. All asset units on a blockchain exist in the unspent output set. Type: Object Properties: Name Type Description id String The id of the output. type String The type of the output. Possible values are &quot;control&quot; and &quot;retire&quot;. transaction_id String Id of the transaction. position Number The output's position in a transaction's list of outputs. asset_id String The id of the asset being issued or spent. asset_alias String The alias of the asset being issued or spent (possibly null). asset_definition Hash The definition of the asset being issued or spent (possibly null). amount Integer The number of units of the asset being issued or spent. account_id String The id of the account transferring the asset (possibly null). account_alias String The alias of the account transferring the asset (possibly null). control_program String The control program which must be satisfied to transfer this output. UnspentOutput Each new transaction in the blockchain consumes some unspent outputs and creates others. An output is considered unspent when it has not yet been used as an input to a new transaction. All asset units on a blockchain exist in the unspent output set. Type: Object Properties: Name Type Description account_alias String The alias of the account transferring the asset (possibly null). account_id String The id of the account transferring the asset (possibly null). address String The output address. id String Unique transaction identifier. amount Number The number of units of the asset being issued or spent. asset_alias String The alias of the asset being issued or spent (possibly null). asset_id String The id of the asset being issued or spent. source_pos Number The output's position in a transaction's list of outputs. change Boolean Whether this output is asset change of one spend. control_program_index Number Control program index. program String The control program which must be satisfied to transfer this output. source_id String The source unspent output id. valid_height Number It means coinbase utxo if valid_height &gt; 0. × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"modules.list.html":{"id":"modules.list.html","title":"Modules","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Modules Classes TransactionBuilder × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"classes.list.html":{"id":"classes.list.html","title":"Classes","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Classes Classes TransactionBuilder × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"index.html":{"id":"index.html","title":"Index","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Bytom Node.js SDKTerminologyKeysCryptographic keys are the primary authorization mechanism on a blockchain. To create accounts or assets, xpub of keys are required. With this sdk, we can create/delete/listAll/resetPassword/checkPassword the key. Please check the API doc if you want to operate with keys. AccountAn account is an object in Bytom that tracks ownership of assets on a blockchain. It's defined under one Bytom node created with one or serveral keys. Related API AssetAn asset is a type of value that can be issued on a blockchain. All units of a given asset are fungible. Units of an asset can be transacted directly between parties without the involvement of the issuer. Related API TransactionBlockchain is chain of blocks, while block consists of numbers of transactions. Related API Unspent Output(UTXO)Bytom is UTXO based blockchain. One transaction spend some UTXOs, and produces new UTXOs. Related API BalanceAny balance on the blockchain is simply a summation of UTXOs. In one bytomd, balance means summation of UTXOs of one account. Related API Block A block is a container data structure that aggregates transactions for inclusion in the public ledger, the blockchain. It is made of a header, containing metadata, followed by a long list of transactions that make up the bulk of its size. Each block references to the previous block, and all the blocks are linked from the back to the front to grow a blockchain. Related API ConfigConfig contain the network information that you wanted to know. Related API UsageIn your codeconst bytom = require('bytom-sdk') const url = 'http://localhost:9888' // access token is required when client is not in same origin // with the request bytom node const accessToken = '' const client = new bytom.Client(url, accessToken)Interaction with bytomWe will walk you through the process to issue some assets. Step 1: create a keyconst keyPromise = client.keys.create({ alias:'key', password: 'password' })It will create a key whose alias is 'alias' while password is 'password'. Step 2: create a accountconst accountPromise = keyPromise.then(key =&gt; { client.accounts.create({ alias: 'account', root_xpubs: [key.xpub], quorum: 1 }) })Step 3: create account addressconst addressPromise = accountPromise.then(account =&gt; { return client.accounts.createReceiver({ account_alias: account.alias }) })Step 4: create assetconst definition = { name: &quot;GOLD&quot;, symbol: &quot;GOLD&quot;, decimals: 8, description: {} } const assetPromise = keyPromise.then(key =&gt; { return client.assets.create( { alias: 'asset', definition, root_xpubs: [key.xpub], quorum: 1 }) })Step 5: issue assetFirst, build the transactionconst buildPromise = Promise.all([ accountPromise, addressPromise, assetPromise] ).then(([account, address, asset]) =&gt; { const issueAction = { amount: 100000000, asset_alias: asset.alias, } const gasAction = { account_alias: account.alias, asset_alias: 'BTM', amount: 50000000 } const controlAction = { amount: 100000000, asset_alias: asset.alias, address: address.address } return client.transactions.build(builder =&gt; { builder.issue(issueAction) builder.spendFromAccount(gasAction) builder.controlWithAddress(controlAction) }) }) Second, sign the transactionconst signPromise = buildPromise.then(transactionTemplate =&gt; { return client.transactions.sign({ transaction: transactionTemplate, password: 'password' }) })Finally, submit the signed transaction to the bytom networksignPromise.then(signed =&gt; { return client.transactions.submit(signed.transaction.raw_transaction) }) × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"module-AccessTokensApi.html":{"id":"module-AccessTokensApi.html","title":"Module: AccessTokensApi","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Module: AccessTokensApi API for interacting with access tokens. Methods &lt;inner&gt; check(params) Check the target access token. Parameters: Name Type Description params Object Parameters for access token check. Properties Name Type Description id String The to be deleted token id. secret String secret of token, the second part of the colon division for token. &lt;inner&gt; create(params) Create a new access token. Parameters: Name Type Description params Object Access Token Object. Properties Name Type Description id String User specified, unique identifier. type String type of token. Returns: Newly created access token. Type Promise.&lt;AccessToken&gt; &lt;inner&gt; delete(id) Delete the target access token. Parameters: Name Type Description id String The to be deleted token id. &lt;inner&gt; listAll() Get all access tokens. Returns: All access tokens. Type Promise.&lt;Array.&lt;AccessToken&gt;&gt; × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"module-AccountsApi.html":{"id":"module-AccountsApi.html","title":"Module: AccountsApi","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Module: AccountsApi API for interacting with accounts. Methods &lt;inner&gt; create(params) Create a new account. Parameters: Name Type Description params module:AccountsApi~createRequest Parameters for account creation. Returns: Newly created account response. Type Promise.&lt;Account&gt; &lt;inner&gt; createReceiver(params) Create account receiver. Parameters: Name Type Description params module:AccountsApi~createReceiverRequest Parameters for receiver creation. Returns: Target receiver. Type Promise.&lt;Receiver&gt; &lt;inner&gt; delete(params) Delete account. Parameters: Name Type Description params Object Deletion information. Properties Name Type Description account_id String Account id. account_alias String Account alias. &lt;inner&gt; list(params) List accounts whose id is the given one. Parameters: Name Type Description params Object Filter and pagination information. Properties Name Type Description id String Account id. alias String Account alias. Returns: Target accounts promise. Type Promise.&lt;Array.&lt;Account&gt;&gt; &lt;inner&gt; listAddresses(params) List all addresses for one account. Parameters: Name Type Description params Object Filter and pagination information. Properties Name Type Description account_alias String alias of account. account_id String id of account. from Number the start position of first address count Number the number of returned. Returns: target addresses response. Type Promise.&lt;module:AccountApi~AddressInfo&gt; &lt;inner&gt; listAll() List all accounts in the target Bytom node. Returns: All accounts promise. Type Promise.&lt;Array.&lt;Account&gt;&gt; &lt;inner&gt; updateAlias(params) Update account alias. Parameters: Name Type Description params object Parameters for account update. Properties Name Type Description account_id String id of account. account_alias String alias of account. new_alias String new alias of account. &lt;inner&gt; validateAddresses(address) Validate an address for one account. Parameters: Name Type Description address string Filter and pagination information. Returns: weather the address is local and is valid. Type Promise.&lt;Object&gt; Type Definitions AddressInfo Type: Object Properties: Name Type Description account_alias String account_id String adddress String change Boolean Indicate whether this address is for change UTXO. alias User specified, unique identifier. Type: String createReceiverRequest Type: Object Properties: Name Type Argument Description account_alias String &lt;optional&gt; The unique alias of the account. accountAlias or accountId must be provided. account_id String &lt;optional&gt; The unique ID of the account. accountAlias or accountId must be provided. createRequest Type: Object Properties: Name Type Argument Description alias String &lt;optional&gt; User specified, unique identifier. root_xpubs Array.&lt;String&gt; The list of keys used to create control programs under the account. quorum Number The number of keys required to sign transactions for the account. id Unique account identifier in one Bytom node. Type: String quorum The number of keys required to sign transactions for the account. Type: Number xpubs The list of keys used to create control programs under the account. Type: Array.&lt;String&gt; × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"module-AssetsApi.html":{"id":"module-AssetsApi.html","title":"Module: AssetsApi","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Module: AssetsApi API for interacting with assets. Methods &lt;inner&gt; create(params) Create a new asset. Parameters: Name Type Description params module:AssetsApi~createRequest Parameters for asset creation. Returns: Newly created asset. Type Promise.&lt;Asset&gt; &lt;inner&gt; list(id) Get asset by the asset id. Parameters: Name Type Description id module:AssetsApi~id Asset id. Returns: target asset. Type Promise.&lt;Asset&gt; &lt;inner&gt; listAll() List all assets in one Bytom node. Returns: target assets. Type Promise.&lt;Array.&lt;Asset&gt;&gt; &lt;inner&gt; updateAlias(params) Update asset alias. Parameters: Name Type Description params object Parameters for asset update. Properties Name Type Description id String id of asset. alias String new alias of asset. Type Definitions createRequest Type: Object Properties: Name Type Argument Description alias String &lt;optional&gt; User specified, unique identifier. defintion Object &lt;optional&gt; User-specified, arbitrary/unstructured data visible across blockchain networks. root_xpubs Array.&lt;String&gt; Optional. The list of keys used to create the asset. quorum Number Optional. the default value is 1, threshold of keys that must sign a transaction to spend asset units controlled by the account. issuance_program String &lt;optional&gt; Optional. User-specified, contract program. × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"module-BalancesApi.html":{"id":"module-BalancesApi.html","title":"Module: BalancesApi","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Module: BalancesApi API for interacting with balances. Methods &lt;inner&gt; list(params) Get asset balances by account. Parameters: Name Type Description params Object Filter and pagination information. Properties Name Type Description account_id String account id. account_alias String name of account. Returns: The result balances. Type Promise.&lt;Array.&lt;Balance&gt;&gt; &lt;inner&gt; listAll() List all assets Balances in one Bytom node. Returns: The result balances. Type Promise.&lt;Array.&lt;Balance&gt;&gt; × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"module-BlockAPI.html":{"id":"module-BlockAPI.html","title":"Module: BlockAPI","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Module: BlockAPI API for interacting with blocks. Methods &lt;inner&gt; getBlock(params) Returns the detail block by block height or block hash. Parameters: Name Type Description params Object Properties Name Type Description block_hash String hash of block. block_height Integer height of block. Returns: Type Promise.&lt;BlockInfo&gt; &lt;inner&gt; getBlockCount() Returns the current block height for blockchain. Returns: Promise resolved on success with block_count returned. Type Promise.&lt;Object&gt; &lt;inner&gt; getBlockHash() Returns the current block hash for blockchain. Returns: Requested info of specified Bytom Core with block_hash returned. Type Promise.&lt;Object&gt; &lt;inner&gt; getBlockHeader(params) Returns the detail block header by block height or block hash. Parameters: Name Type Description params Object Properties Name Type Description block_hash String hash of block. block_height Integer height of block. Returns: Type Promise.&lt;Object&gt; &lt;inner&gt; getDifficulty(params) Returns the block difficulty by block height or block hash. Parameters: Name Type Description params Object Properties Name Type Description block_hash String hash of block. block_height Integer height of block. Returns: Type Promise.&lt;Object&gt; &lt;inner&gt; getHashRate(params) Returns the block hash rate by block height or block hash, it returns the current block hash rate when request is empty. Parameters: Name Type Description params Object Properties Name Type Description block_hash String hash of block. block_height Integer height of block. Returns: Type Promise.&lt;Object&gt; × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"module-ConfigApi.html":{"id":"module-ConfigApi.html","title":"Module: ConfigApi","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Module: ConfigApi Bytom Core can be configured as a new blockchain network, or as a node in an existing blockchain network. More info: {} API for interacting with configs. Methods &lt;inner&gt; gasRate() get gas rate Returns: Promise resolved with gas rate on success. Type Promise &lt;inner&gt; netInfo() Get info on specified Bytom Core. Returns: Requested Net Info of specified Bytom Core. Type Promise.&lt;CoreInfo&gt; &lt;inner&gt; verifyMessage(params) Parameters: Name Type Description params Properties Name Type Description address String address for account. derived_xpub String derived xpub. message String message for signature by derived_xpub. signature String signature for message. Returns: [Boolean] result, verify result. Type Promise.&lt;Object&gt; × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"module-KeysApi.html":{"id":"module-KeysApi.html","title":"Module: KeysApi","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Module: KeysApi API for interacting with keys. Methods &lt;inner&gt; checkPassword(params) Reset key password. Parameters: Name Type Description params Object Password checking information. Properties Name Type Description xpub String Hex-encoded string representation of the key. password String password. &lt;inner&gt; create(params) Create a new key. Parameters: Name Type Description params module:KeysApi~createRequest Parameters for asset creation. Returns: Newly created key. Type Promise.&lt;Key&gt; &lt;inner&gt; delete(params) Parameters: Name Type Description params Object Deletion information. Properties Name Type Description xpub String Hex-encoded string representation of the key. password String Key password. &lt;inner&gt; listAll() Got all the keys in one Bytom node. Returns: All keys. Type Promise.&lt;Array.&lt;Key&gt;&gt; &lt;inner&gt; resetPassword(params) Reset key password. Parameters: Name Type Description params Object Key password reset information. Properties Name Type Description xpub String Hex-encoded string representation of the key. oldPassword String Old password. newPassword String New password. Type Definitions createRequest Type: Object Properties: Name Type Argument Description alias String &lt;optional&gt; User specified, unique identifier. password String &lt;optional&gt; password of the key. language String &lt;optional&gt; mnemonic language of the key. × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"module-TransactionsApi.html":{"id":"module-TransactionsApi.html","title":"Module: TransactionsApi","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Module: TransactionsApi API for interacting with transactions. Methods &lt;inner&gt; build(builderBlock) Build an unsigned transaction from a set of actions. Parameters: Name Type Description builderBlock module:TransactionsApi~builderCallback Function that adds desired actions to a given builder object. Returns: Unsigned transaction template, or error. Type Promise.&lt;Object&gt; &lt;inner&gt; estimateGas(transaction) Estimate how much gas one trasaction may use. Parameters: Name Type Description transaction Object The transaction template to estimate. Returns: Estimation result. Type Object &lt;inner&gt; list(params) List local transactions by id or filter condition. Parameters: Name Type Description params Object Transaction filter params. Properties Name Type Description id String transaction id, hash of transaction. account_id String id of account. detail Boolean flag of detail transactions, default false (only return transaction summary). unconfirmed Boolean flag of unconfirmed transactions(query result include all confirmed and unconfirmed transactions), default false. from Integer The start position of first transaction. count Integer The number of returned. Returns: The result transactions. Type Promise.&lt;Array.&lt;Transaction&gt;&gt; &lt;inner&gt; listAll() List all local transactions. Returns: All local transactions. Type Promise.&lt;Array.&lt;Transaction&gt;&gt; &lt;inner&gt; sign(params) Sign transaction. Parameters: Name Type Description params Object The built transaction template. Properties Name Type Description password String signature of the password. transaction Object builded transaction. Returns: Sign result. Type Promise.&lt;module:TransactionsApi~SignResult&gt; &lt;inner&gt; submit(raw_transaction) Submit a signed transaction to the blockchain. Parameters: Name Type Description raw_transaction String Encoded fully signed transaction. Returns: Submit result. It will return tx_id if submit successfully else error. Type Promise.&lt;Object&gt; Type Definitions Action Basic unit to build a transaction. For spend transaction, either account_id or account_alias is required to specify account info. Asset info(either asset_id or asset_alias ) is required for all kinds of action. Type: Object Properties: Name Type Description type String Currently 4 types of action is supported: spend_account: action to spend UTXO from account. issue: action to issue asset. retire: action to retire asset. control_address: action to receive asset with address. account_alias String The alias of the account transferring the asset (possibly null). account_id String The id of the account transferring the asset (possibly null). asset_id String The id of the asset being issued or spent (possibly null). asset_alias String The alias of the asset being issued or spent (possibly null). address String Address to receive the transfered asset(possibly null, required for control_address action). builderCallback(builder) Parameters: Name Type Description builder TransactionBuilder SignResult Data structure /sign-transaction api will return. Type: Object Properties: Name Type Description transaction Transaction The signed transaction if sign success. sign_complete Boolean Whether all input actions are signed. It means this transaction can be submit if true, else not. × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"module-UnspentOutputsApi.html":{"id":"module-UnspentOutputsApi.html","title":"Module: UnspentOutputsApi","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Module: UnspentOutputsApi API for interacting with unspent outputs. Methods &lt;inner&gt; list(params) Get target unspent outputs. Parameters: Name Type Description params Object Filter and pagination information. Properties Name Type Description id String Unspent output id. unconfirmed Boolean is include unconfirmed utxo smart_contract Boolean is contract utxo from Integer the start position of first utxo count Integer the number of returned account_id String account id. account_alias String name of account. Returns: Target unspent outputs. Type Promise.&lt;Array.&lt;UnspentOutput&gt;&gt; &lt;inner&gt; listAll() Get all unspent outputs. Returns: Target unspent outputs. Type Promise.&lt;Array.&lt;UnspentOutput&gt;&gt; × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "},"TransactionBuilder.html":{"id":"TransactionBuilder.html","title":"Class: TransactionBuilder","body":" Bytom Node.js SDK Modules AccessTokensApiAccountsApiAssetsApiBalancesApiBlockAPIConfigApiKeysApiTransactionsApiUnspentOutputsApi Classes TransactionBuilder Global Global Class: TransactionBuilder TransactionBuilder A convenience class for building transaction template objects. new TransactionBuilder() constructor - return a new object used for constructing a transaction. Members baseTransaction :Object Base data for the transaction, default is null. Type: Object ttl :Integer Integer of the time to live in milliseconds, it means utxo will be reserved(locked) for builded transaction in this time range, if the transaction will not to be submitted into block, it will be auto unlocked for build transaction again after this ttl time. it will be set to 5 minutes(300 seconds) defaultly when ttl is 0. Type: Integer Methods controlWithAddress(params) Add an action that controls assets with an account specified by identifier. Parameters: Name Type Description params Object Action parameters. Properties Name Type Description asset_alias String Asset alias specifying the asset to be controlled. You must specify either an ID or an alias. asset_id String Asset ID specifying the account controlling the asset. You must specify either an ID or an alias. address String Account address specifying the account controlling the asset. You must specify either an ID or an alias. amount Number Amount of the asset to be controlled. controlWithControlProgram(params) Add an action that controls assets with a receiver. Parameters: Name Type Description params Object Action parameters. Properties Name Type Description control_program Object The receiver object in which assets will be controlled. asset_id String Asset ID specifying the asset to be controlled. You must specify either an ID or an alias. asset_alias String Asset alias specifying the asset to be controlled. You must specify either an ID or an alias. amount Number Amount of the asset to be controlled. issue(params) Add an action that issues assets. Parameters: Name Type Description params Object Action parameters. Properties Name Type Description assetId String Asset ID specifying the asset to be issued. You must specify either an ID or an alias. assetAlias String Asset alias specifying the asset to be issued. You must specify either an ID or an alias. amount String Amount of the asset to be issued. retire(params) Add an action that retires units of an asset. Parameters: Name Type Description params Object Action parameters. Properties Name Type Description asset_id String Asset ID specifying the asset to be retired. You must specify either an ID or an alias. asset_alias String Asset alias specifying the asset to be retired. You must specify either an ID or an alias. amount Number Amount of the asset to be retired. spendAccountUnspentOutput(params) Add an action that spends an account unspent output. Parameters: Name Type Description params Object Action parameters. Properties Name Type Description output_id String ID of the transaction output to be spent. spendFromAccount(params) Add an action that spends assets from an account specified by identifier. Parameters: Name Type Description params Object Action parameters. Properties Name Type Description asset_id String Asset ID specifying the asset to be spent. You must specify either an ID or an alias. asset_alias String Asset alias specifying the asset to be spent. You must specify either an ID or an alias. account_id String Account ID specifying the account spending the asset. You must specify either an ID or an alias. account_alias String Account alias specifying the account spending the asset. You must specify either an ID or an alias. amount Number Amount of the asset to be spent. × Search results Close Documentation generated by JSDoc 3.5.5 on 2018-11-26T16:28:32+08:00 using the DocStrap template. "}}
</script>
<script type="text/javascript">
$(document).ready(function() {
Searcher.init();
});
$(window).on("message", function(msg) {
var msgData = msg.originalEvent.data;
if (msgData.msgid != "docstrap.quicksearch.start") {
return;
}
var results = Searcher.search(msgData.searchTerms);
window.parent.postMessage({"results": results, "msgid": "docstrap.quicksearch.done"}, "*");
});
</script>
</body>
</html>