Published 15 February 2019

TransactionsGetResult TransactionsGet(1:Address address, 2:i64 offset, 3:i64 limit)

Description

Description

Get transactions where `address` is either sender or receiver

The address field is recoded: if the address string length is 64 characters, then recode it from 16 coded representation to a new string, otherwise - calculate the public key hash using blake2 algorithm.
Define an empty transaction array.
Load the pool from storage due to the hash of the last block. While the size of the block's sequence is equal to the required size of the public key, execute:
If the number of transactions in the pool is more than zero, then:
Determine the index of the current transaction equal to the number of transactions -1;
If the wallet address matches the sender or receiver of the transaction, then:

If the input parameter “offset” is 0, then add the transaction to the transaction array, otherwise decrease the parameter “offset”;
If the number of transactions in the array is equal to the parameter “limit”, then exit from the cycle;
If the current transaction index is 0, then exit from the cycle;
Reduce the current transaction index.
If the number of transactions in the transaction array is equal to the parameter limit, then exit from the cycle;
Load the pool from the block with the previous hash.
Convert transactions from the csdb::Transaction structure to the api::Transaction structures.

Set result status - SUCCESS

Parameters

Parameters

// Wallet or smart contract address

typedef binary Address

Return

Return

struct TransactionsGetResult

{

   1: general.APIResponse status

   2: bool result

   3: i32 total_trxns_count

   4: list<SealedTransaction> transactions

}

Description of the returned structures and typedefs

Description of the returned structures and typedefs

struct APIResponse

{

// 0 for success, 1 for failure, 2 for not being implemented (currently unused)

   1: i8 code

// Explanation

   2: string message

}

// Structure for transactions that have been emplaced to the blockchain

struct SealedTransaction {

   1: TransactionId id

   2: Transaction trxn

}

Votes 0, average rating 0

Contents