Skip to content

Commit

Permalink
CLI: Wallet-RPC command to sign builder 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 06b08c5 commit bb1cfce
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libraries/wallet/include/graphene/wallet/wallet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,19 @@ class wallet_api
*/
signed_transaction sign_builder_transaction(transaction_handle_type transaction_handle, bool broadcast = true);

/**
* @ingroup Transaction Builder API
*
* Sign the transaction in a transaction builder and optionally broadcast to the network.
* @param transaction_handle handle of the transaction builder
* @param signing_keys Keys that must be used when signing the transaction
* @param broadcast whether to broadcast the signed transaction to the network
* @return a signed transaction
*/
signed_transaction sign_builder_transaction2(transaction_handle_type transaction_handle,
const vector<public_key_type>& signing_keys = vector<public_key_type>(),
bool broadcast = true);

/** Broadcast signed transaction
* @param tx signed transaction
* @returns the transaction ID along with the signed transaction.
Expand Down Expand Up @@ -1784,6 +1797,7 @@ FC_API( graphene::wallet::wallet_api,
(set_fees_on_builder_transaction)
(preview_builder_transaction)
(sign_builder_transaction)
(sign_builder_transaction2)
(broadcast_transaction)
(propose_builder_transaction)
(propose_builder_transaction2)
Expand Down
7 changes: 7 additions & 0 deletions libraries/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,13 @@ signed_transaction wallet_api::sign_builder_transaction(transaction_handle_type
return my->sign_builder_transaction(transaction_handle, broadcast);
}

signed_transaction wallet_api::sign_builder_transaction2(transaction_handle_type transaction_handle,
const vector<public_key_type>& explicit_keys,
bool broadcast)
{
return my->sign_builder_transaction2(transaction_handle, explicit_keys, broadcast);
}

pair<transaction_id_type,signed_transaction> wallet_api::broadcast_transaction(signed_transaction tx)
{
return my->broadcast_transaction(tx);
Expand Down
3 changes: 3 additions & 0 deletions libraries/wallet/wallet_api_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ class wallet_api_impl
asset set_fees_on_builder_transaction(transaction_handle_type handle, string fee_asset = GRAPHENE_SYMBOL);
transaction preview_builder_transaction(transaction_handle_type handle);
signed_transaction sign_builder_transaction(transaction_handle_type transaction_handle, bool broadcast = true);
signed_transaction sign_builder_transaction2(transaction_handle_type transaction_handle,
const vector<public_key_type>& signing_keys = vector<public_key_type>(),
bool broadcast = true);

pair<transaction_id_type,signed_transaction> broadcast_transaction(signed_transaction tx);

Expand Down
9 changes: 9 additions & 0 deletions libraries/wallet/wallet_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ namespace graphene { namespace wallet { namespace detail {
sign_transaction(_builder_transactions[transaction_handle], broadcast);
}

signed_transaction wallet_api_impl::sign_builder_transaction2(transaction_handle_type
transaction_handle, const vector<public_key_type>& signing_keys, bool broadcast)
{
FC_ASSERT(_builder_transactions.count(transaction_handle));

return _builder_transactions[transaction_handle] =
sign_transaction2(_builder_transactions[transaction_handle], signing_keys, broadcast);
}

signed_transaction wallet_api_impl::propose_builder_transaction( transaction_handle_type handle,
time_point_sec expiration, uint32_t review_period_seconds, bool broadcast)
{
Expand Down

0 comments on commit bb1cfce

Please sign in to comment.