Fix #206, adding api to return available vesting balance

This commit is contained in:
Daniel Larimer 2015-07-24 17:28:58 -04:00
parent 67bd517d5e
commit 662dd04e45
2 changed files with 13 additions and 0 deletions

View file

@ -1062,6 +1062,16 @@ namespace graphene { namespace app {
} FC_CAPTURE_AND_RETHROW( (id) ) }
vector<asset> database_api::get_vested_balances( const vector<balance_id_type>& objs )const
{ try {
vector<asset> result;
result.reserve( objs.size() );
auto now = _db.head_block_time();
for( auto obj : objs )
result.push_back( obj(_db).available( now ) );
return result;
} FC_CAPTURE_AND_RETHROW( (objs) ) }
vector<balance_object> database_api::get_balance_objects( const vector<address>& addrs )const
{ try {
const auto& bal_idx = _db.get_index_type<balance_index>();

View file

@ -307,6 +307,8 @@ namespace graphene { namespace app {
/** @return all unclaimed balance objects for a set of addresses */
vector<balance_object> get_balance_objects( const vector<address>& addrs )const;
vector<asset> get_vested_balances( const vector<balance_id_type>& objs )const;
/**
* This API will take a partially signed transaction and a set of public keys that the owner has the ability to sign for
@ -535,6 +537,7 @@ FC_API(graphene::app::database_api,
(get_key_references)
(get_margin_positions)
(get_balance_objects)
(get_vested_balances)
(get_required_signatures)
(verify_authority)
(get_blinded_balances)