diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 46d763e0..fc8baa19 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -812,5 +812,20 @@ namespace graphene { namespace app { return result; } FC_CAPTURE_AND_RETHROW( (addrs) ) } + set database_api::get_required_signatures( const signed_transaction& trx, const flat_set& available_keys )const + { + return trx.get_required_signatures( available_keys, + [&]( account_id_type id ){ return &id(_db).active; }, + [&]( account_id_type id ){ return &id(_db).owner; }, + _db.get_global_properties().parameters.max_authority_depth ); + } + + bool database_api::verify_authority( const signed_transaction& trx )const + { + trx.verify_authority( [&]( account_id_type id ){ return &id(_db).active; }, + [&]( account_id_type id ){ return &id(_db).owner; }, + _db.get_global_properties().parameters.max_authority_depth ); + return true; + } } } // graphene::app diff --git a/libraries/app/include/graphene/app/api.hpp b/libraries/app/include/graphene/app/api.hpp index b0fb8b75..99d707c9 100644 --- a/libraries/app/include/graphene/app/api.hpp +++ b/libraries/app/include/graphene/app/api.hpp @@ -302,6 +302,19 @@ namespace graphene { namespace app { /** @return all unclaimed balance objects for a set of addresses */ vector get_balance_objects( const vector
& addrs )const; + + /** + * This API will take a partially signed transaction and a set of public keys that the owner has the ability to sign for + * and return the minimal subset of public keys that should add signatures to the transaction. + */ + set get_required_signatures( const signed_transaction& trx, const flat_set& available_keys )const; + + /** + * @return true of the @ref trx has all of the required signatures, otherwise throws an exception + */ + bool verify_authority( const signed_transaction& trx )const; + + private: /** called every time a block is applied to report the objects that were changed */ void on_objects_changed(const vector& ids); @@ -506,6 +519,8 @@ FC_API(graphene::app::database_api, (get_key_references) (get_margin_positions) (get_balance_objects) + (get_required_signatures) + (verify_authority) ) FC_API(graphene::app::history_api, (get_account_history)