Published 15 October 2018

TransactionGet

Getting transaction content with transactionId.

Parameters

Parameters:

1: TransactionId transactionId

Type of result: TransactionGetResult

Operation algorithm

Operation algorithm:

We start from dividing the transactionId string into hash and index. Then we get transaction from storage based on its ID structure. Unless the pool hash is empty, we believe that the transaction has been found. We convert the transaction from the csdb::Transaction structure to the api::Transaction structure. The result status we set is SUCCESS.

Data structure

The following structures are used for marshalling purposes:

TransactionGetResult - transaction get result

typedef list<Transaction>Transactions

APIResponse status

status

i8 code //status code

string message //status communication

bool found

transaction found boolean flag

Transaction transaction

transaction structure

TransactionInnerId innerId //transaction inner ID

Address source //source address

Address target //destination address

Amount amount

transaction amount

i32 integral //the integral

i64 fraction //the fraction

Amount balance

balance

i32 integral //the integral

i64 fraction //the fraction

Currency currency

transaction currency code

SmartContract smartContract

smart contract structure

required string address //smart contract address

string sourceCode //smart contract's source code

binary byteCode //smart contract's byte code

binary contractState //smart contract state

string hashState //smart contract hash state

string method //smart contract method

list<string>params //set of smart contract parameters

Example

Example

/** TransactionGet begin */

 

TransactionId                 tr_id = "";

TransactionGetResult    tg_res;

 

try

{

         api->TransactionGet(tg_res, tr_id);

}

catch (...)

{

         return 1;

}

 

tg_res.printTo(std::cout);

std::cout << std::endl << std::endl;

 

/** TransactionGet end */

 

/** TransactionsGet begin */

 

Address                           addrs = "4xyjk5LNjDfUxQVe72QvB7LFkfUXsxbj3Yty9ESMNJKN";

TransactionsGetResult    tsg_res;

 

try

{

         api->TransactionsGet(tsg_res, addrs, 0, 10);

}

catch (...)

{

         return 1;

}

 

tsg_res.printTo(std::cout);

std::cout << std::endl << std::endl;

 

/** TransactionsGet end */

18 Useful article

Contents