diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index 9b3282c4..a95833f3 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -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) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 4244b7ef..ec3f6b32 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -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_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, diff --git a/tests/cli/son.cpp b/tests/cli/son.cpp index 1dfd8381..5d45048a 100644 --- a/tests/cli/son.cpp +++ b/tests/cli/son.cpp @@ -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