Fix create_vesting wallet_api call

This commit is contained in:
gladcow 2019-10-30 16:25:26 +03:00
parent 0bbe7f63c7
commit 5457577ec9
3 changed files with 17 additions and 10 deletions

View file

@ -1429,14 +1429,16 @@ class wallet_api
/** Creates a vesting deposit owned by the given account.
*
* @param owner_account the name or id of the account
* @param amount the amount to deposit
* @param owner_account vesting balance owner and creator (the name or id)
* @param amount amount to vest
* @param asset_symbol the symbol of the asset to vest
* @param vesting_type "normal", "gpos" or "son"
* @param broadcast true to broadcast the transaction on the network
* @returns the signed transaction registering a vesting object
*/
signed_transaction create_vesting(string owner_account,
signed_transaction create_vesting_balance(string owner_account,
string amount,
string asset_symbol,
string vesting_type,
bool broadcast = false);
@ -2118,7 +2120,7 @@ FC_API( graphene::wallet::wallet_api,
(update_witness)
(create_worker)
(update_worker_votes)
(create_vesting)
(create_vesting_balance)
(get_vesting_balances)
(withdraw_vesting)
(vote_for_committee_member)

View file

@ -2107,17 +2107,20 @@ public:
return sign_transaction( tx, broadcast );
}
signed_transaction create_vesting(string owner_account,
signed_transaction create_vesting_balance(string owner_account,
string amount,
string asset_symbol,
string vesting_type,
bool broadcast /* = false */)
{ try {
account_object son_account = get_account(owner_account);
fc::optional<asset_object> asset_obj = get_asset(asset_symbol);
FC_ASSERT(asset_obj, "Invalid asset symbol {asst}", ("asst", asset_symbol));
vesting_balance_create_operation op;
op.creator = son_account.get_id();
op.owner = son_account.get_id();
op.amount = asset_object().amount_from_string(amount);
op.amount = asset_obj->amount_from_string(amount);
if (vesting_type == "normal")
op.balance_type = vesting_balance_type::normal;
else if (vesting_type == "gpos")
@ -4271,12 +4274,13 @@ committee_member_object wallet_api::get_committee_member(string owner_account)
return my->get_committee_member(owner_account);
}
signed_transaction wallet_api::create_vesting(string owner_account,
signed_transaction wallet_api::create_vesting_balance(string owner_account,
string amount,
string asset_symbol,
string vesting_type,
bool broadcast /* = false */)
{
return my->create_vesting(owner_account, amount, vesting_type, broadcast);
return my->create_vesting_balance(owner_account, amount, asset_symbol, vesting_type, broadcast);
}
signed_transaction wallet_api::create_son(string owner_account,

View file

@ -78,11 +78,12 @@ public:
BOOST_CHECK(fixture_.generate_block());
// create deposit vesting
fixture_.con.wallet_api_ptr->create_vesting(account_name, "50000000", "son", true);
fixture_.con.wallet_api_ptr->create_vesting_balance(account_name,
"50", "1.3.0", "son", true);
BOOST_CHECK(fixture_.generate_block());
// create pay_vb vesting
fixture_.con.wallet_api_ptr->create_vesting(account_name, "1000000", "normal", true);
fixture_.con.wallet_api_ptr->create_vesting_balance(account_name, "1", "1.3.0", "normal", true);
BOOST_CHECK(fixture_.generate_block());
// check deposits are here