[SON-160] Fix create_vesting wallet_api call (#206)
* Fix create_vesting wallet_api call * change type for vesting_type in create_vesting_balance
This commit is contained in:
parent
0bbe7f63c7
commit
a0e4ac59ff
3 changed files with 21 additions and 23 deletions
|
|
@ -1429,15 +1429,17 @@ 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 vesting_type,
|
||||
string asset_symbol,
|
||||
vesting_balance_type 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)
|
||||
|
|
|
|||
|
|
@ -2107,27 +2107,21 @@ public:
|
|||
return sign_transaction( tx, broadcast );
|
||||
}
|
||||
|
||||
signed_transaction create_vesting(string owner_account,
|
||||
signed_transaction create_vesting_balance(string owner_account,
|
||||
string amount,
|
||||
string vesting_type,
|
||||
string asset_symbol,
|
||||
vesting_balance_type 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);
|
||||
if (vesting_type == "normal")
|
||||
op.balance_type = vesting_balance_type::normal;
|
||||
else if (vesting_type == "gpos")
|
||||
op.balance_type = vesting_balance_type::gpos;
|
||||
else if (vesting_type == "son")
|
||||
op.balance_type = vesting_balance_type::son;
|
||||
else
|
||||
{
|
||||
FC_ASSERT( false, "unknown vesting type value ${vt}", ("vt", vesting_type) );
|
||||
}
|
||||
op.amount = asset_obj->amount_from_string(amount);
|
||||
op.balance_type = vesting_type;
|
||||
if (op.balance_type == vesting_balance_type::son)
|
||||
op.policy = dormant_vesting_policy_initializer {};
|
||||
|
||||
|
|
@ -4271,12 +4265,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 vesting_type,
|
||||
string asset_symbol,
|
||||
vesting_balance_type 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,
|
||||
|
|
|
|||
|
|
@ -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", vesting_balance_type::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", vesting_balance_type::normal, true);
|
||||
BOOST_CHECK(fixture_.generate_block());
|
||||
|
||||
// check deposits are here
|
||||
|
|
|
|||
Loading…
Reference in a new issue