add create_vesting_balance command to cli wallet

This commit is contained in:
Alfredo 2019-01-22 16:19:13 -03:00
parent b914a7dc0b
commit 610266481b
2 changed files with 46 additions and 0 deletions

View file

@ -1795,6 +1795,20 @@ class wallet_api
rock_paper_scissors_gesture gesture,
bool broadcast);
/** Create a vesting balance including gpos vesting balance after HARDFORK_GPOS_TIME
* @param owner vesting balance owner and creator
* @param amount amount to vest
* @param asset_symbol the symbol of the asset to vest
* @param is_gpos True if the balance is of gpos type
* @param broadcast true if you wish to broadcast the transaction
* @return the signed version of the transaction
*/
signed_transaction create_vesting_balance(string owner,
string amount,
string asset_symbol,
bool is_gpos,
bool broadcast);
void dbg_make_uia(string creator, string symbol);
void dbg_make_mia(string creator, string symbol);
void dbg_push_blocks( std::string src_filename, uint32_t count );
@ -2031,6 +2045,7 @@ FC_API( graphene::wallet::wallet_api,
(tournament_join)
(tournament_leave)
(rps_throw)
(create_vesting_balance)
(get_upcoming_tournaments)
(get_tournaments)
(get_tournaments_by_state)

View file

@ -5756,6 +5756,37 @@ signed_transaction wallet_api::rps_throw(game_id_type game_id,
return my->sign_transaction( tx, broadcast );
}
signed_transaction wallet_api::create_vesting_balance(string owner,
string amount,
string asset_symbol,
bool is_gpos,
bool broadcast)
{
FC_ASSERT( !is_locked() );
account_object owner_account = get_account(owner);
account_id_type owner_id = owner_account.id;
fc::optional<asset_object> asset_obj = get_asset(asset_symbol);
auto type = vesting_balance_type::unspecified;
if(is_gpos)
type = vesting_balance_type::gpos;
vesting_balance_create_operation op;
op.creator = owner_id;
op.owner = owner_id;
op.amount = asset_obj->amount_from_string(amount);
op.balance_type = type;
signed_transaction trx;
trx.operations.push_back(op);
my->set_operation_fees( trx, my->_remote_db->get_global_properties().parameters.current_fees );
trx.validate();
return my->sign_transaction( trx, broadcast );
}
// default ctor necessary for FC_REFLECT
signed_block_with_info::signed_block_with_info()
{