API for interacting with transactions.
Methods
-
<inner> 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.<Object>
-
<inner> 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
-
<inner> 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.<Array.<Transaction>>
-
<inner> listAll()
-
List all local transactions.
Returns:
All local transactions.
- Type
- Promise.<Array.<Transaction>>
-
<inner> 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.<module:TransactionsApi~SignResult>
-
<inner> 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.<Object>
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
- 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.
Properties:
Name Type Description type
String Currently 4 types of action is supported:
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.