diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index 3ebfe0f1..49cb5b71 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -1086,6 +1086,19 @@ class wallet_api string url, bool broadcast = false); + /** + * Update a witness object owned by the given account. + * + * @param witness The name of the witness's owner account. Also accepts the ID of the owner account or the ID of the witness. + * @param url Same as for create_witness. The empty string makes it remain the same. + * @param block_signing_key The new block signing public key. The empty string makes it remain the same. + * @param broadcast true if you wish to broadcast the transaction. + */ + signed_transaction update_witness(string witness_name, + string url, + string block_signing_key, + bool broadcast = false); + /** Vote for a given committee_member. * * An account can publish a list of all committee_memberes they approve of. This @@ -1364,6 +1377,7 @@ FC_API( graphene::wallet::wallet_api, (list_witnesses) (list_committee_members) (create_witness) + (update_witness) (vote_for_committee_member) (vote_for_witness) (set_voting_proxy) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index c0231841..655685bc 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -1318,6 +1318,31 @@ public: return sign_transaction( tx, broadcast ); } FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) } + signed_transaction update_witness(string witness_name, + string url, + string block_signing_key, + bool broadcast /* = false */) + { try { + witness_object witness = get_witness(witness_name); + account_object witness_account = get_account( witness.witness_account ); + fc::ecc::private_key active_private_key = get_private_key_for_account(witness_account); + + witness_update_operation witness_update_op; + witness_update_op.witness = witness.id; + witness_update_op.witness_account = witness_account.id; + if( url != "" ) + witness_update_op.new_url = url; + if( block_signing_key != "" ) + witness_update_op.new_signing_key = public_key_type( block_signing_key ); + + signed_transaction tx; + tx.operations.push_back( witness_update_op ); + set_operation_fees( tx, _remote_db->get_global_properties().parameters.current_fees ); + tx.validate(); + + return sign_transaction( tx, broadcast ); + } FC_CAPTURE_AND_RETHROW( (witness_name)(url)(block_signing_key)(broadcast) ) } + signed_transaction vote_for_committee_member(string voting_account, string committee_member, bool approve, @@ -2546,6 +2571,15 @@ signed_transaction wallet_api::create_witness(string owner_account, return my->create_witness(owner_account, url, broadcast); } +signed_transaction wallet_api::update_witness( + string witness_name, + string url, + string block_signing_key, + bool broadcast /* = false */) +{ + return my->update_witness(witness_name, url, block_signing_key, broadcast); +} + signed_transaction wallet_api::vote_for_committee_member(string voting_account, string witness, bool approve,