adding get_transaction api call

This commit is contained in:
Daniel Larimer 2015-06-29 18:48:47 -04:00
parent 873cf4dcf8
commit 8b546cbf60
2 changed files with 14 additions and 0 deletions

View file

@ -59,6 +59,13 @@ namespace graphene { namespace app {
{
return _db.fetch_block_by_number(block_num);
}
processed_transaction database_api::get_transaction(uint32_t block_num, uint32_t trx_num)const
{
auto opt_block = _db.fetch_block_by_number(block_num);
FC_ASSERT( opt_block );
FC_ASSERT( opt_block->transactions.size() > trx_num );
return opt_block->transactions[trx_num];
}
vector<optional<account_object>> database_api::lookup_account_names(const vector<string>& account_names)const
{

View file

@ -73,6 +73,12 @@ namespace graphene { namespace app {
* @return the referenced block, or null if no matching block was found
*/
optional<signed_block> get_block(uint32_t block_num)const;
/**
* @brief used to fetch an individual transaction.
*/
processed_transaction get_transaction( uint32_t block_num, uint32_t trx_in_block )const;
/**
* @brief Retrieve the current @ref global_property_object
*/
@ -372,6 +378,7 @@ FC_API(graphene::app::database_api,
(get_objects)
(get_block_header)
(get_block)
(get_transaction)
(get_global_properties)
(get_dynamic_global_properties)
(get_keys)