Skip to content

Commit

Permalink
CLI: Wallet-RPC command to sign transactions with specified keys
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelSantos committed Nov 11, 2019
1 parent 422b9e4 commit 06b08c5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions libraries/wallet/include/graphene/wallet/wallet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,21 @@ class wallet_api
*/
signed_transaction sign_transaction(signed_transaction tx, bool broadcast = false);

/** Signs a transaction.
*
* Given a fully-formed transaction that is only lacking signatures, this signs
* the transaction with the inferred necessary keys and the explicitly provided keys,
* and optionally broadcasts the transaction
* @param tx the unsigned transaction
* @param signing_keys Keys that must be used when signing the transaction
* @param broadcast true if you wish to broadcast the transaction
* @return the signed version of the transaction
*/
signed_transaction sign_transaction2(signed_transaction tx,
const vector<public_key_type>& signing_keys = vector<public_key_type>(),
bool broadcast = true);


/** Get transaction signers.
*
* Returns information about who signed the transaction, specifically,
Expand Down Expand Up @@ -1857,6 +1872,7 @@ FC_API( graphene::wallet::wallet_api,
(save_wallet_file)
(serialize_transaction)
(sign_transaction)
(sign_transaction2)
(add_transaction_signature)
(get_transaction_signers)
(get_key_references)
Expand Down
6 changes: 6 additions & 0 deletions libraries/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,12 @@ signed_transaction wallet_api::sign_transaction(signed_transaction tx, bool broa
return my->sign_transaction( tx, broadcast);
} FC_CAPTURE_AND_RETHROW( (tx) ) }

signed_transaction wallet_api::sign_transaction2(signed_transaction tx, const vector<public_key_type>& signing_keys,
bool broadcast /* = false */)
{ try {
return my->sign_transaction2( tx, signing_keys, broadcast);
} FC_CAPTURE_AND_RETHROW( (tx) ) }

flat_set<public_key_type> wallet_api::get_transaction_signers(const signed_transaction &tx) const
{ try {
return my->get_transaction_signers(tx);
Expand Down

0 comments on commit 06b08c5

Please sign in to comment.