create_vesting call in wallet_api
This commit is contained in:
parent
e98b462cde
commit
9fd7613d4a
2 changed files with 54 additions and 0 deletions
|
|
@ -1423,6 +1423,19 @@ class wallet_api
|
||||||
bool broadcast = false
|
bool broadcast = false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** 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 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,
|
||||||
|
string amount,
|
||||||
|
string vesting_type,
|
||||||
|
bool broadcast = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get information about a vesting balance object.
|
* Get information about a vesting balance object.
|
||||||
*
|
*
|
||||||
|
|
@ -2101,6 +2114,7 @@ FC_API( graphene::wallet::wallet_api,
|
||||||
(update_witness)
|
(update_witness)
|
||||||
(create_worker)
|
(create_worker)
|
||||||
(update_worker_votes)
|
(update_worker_votes)
|
||||||
|
(create_vesting)
|
||||||
(get_vesting_balances)
|
(get_vesting_balances)
|
||||||
(withdraw_vesting)
|
(withdraw_vesting)
|
||||||
(vote_for_committee_member)
|
(vote_for_committee_member)
|
||||||
|
|
|
||||||
|
|
@ -2102,6 +2102,38 @@ public:
|
||||||
return sign_transaction( tx, broadcast );
|
return sign_transaction( tx, broadcast );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signed_transaction create_vesting(string owner_account,
|
||||||
|
string amount,
|
||||||
|
string vesting_type,
|
||||||
|
bool broadcast /* = false */)
|
||||||
|
{ try {
|
||||||
|
account_object son_account = get_account(owner_account);
|
||||||
|
|
||||||
|
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) );
|
||||||
|
}
|
||||||
|
if (op.balance_type == vesting_balance_type::son)
|
||||||
|
op.policy = dormant_vesting_policy_initializer {};
|
||||||
|
|
||||||
|
signed_transaction tx;
|
||||||
|
tx.operations.push_back( op );
|
||||||
|
set_operation_fees( tx, _remote_db->get_global_properties().parameters.current_fees);
|
||||||
|
tx.validate();
|
||||||
|
|
||||||
|
return sign_transaction( tx, broadcast );
|
||||||
|
} FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) }
|
||||||
|
|
||||||
vector< vesting_balance_object_with_info > get_vesting_balances( string account_name )
|
vector< vesting_balance_object_with_info > get_vesting_balances( string account_name )
|
||||||
{ try {
|
{ try {
|
||||||
fc::optional<vesting_balance_id_type> vbid = maybe_id<vesting_balance_id_type>( account_name );
|
fc::optional<vesting_balance_id_type> vbid = maybe_id<vesting_balance_id_type>( account_name );
|
||||||
|
|
@ -4234,6 +4266,14 @@ committee_member_object wallet_api::get_committee_member(string owner_account)
|
||||||
return my->get_committee_member(owner_account);
|
return my->get_committee_member(owner_account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signed_transaction wallet_api::create_vesting(string owner_account,
|
||||||
|
string amount,
|
||||||
|
string vesting_type,
|
||||||
|
bool broadcast /* = false */)
|
||||||
|
{
|
||||||
|
return my->create_vesting(owner_account, amount, vesting_type, broadcast);
|
||||||
|
}
|
||||||
|
|
||||||
signed_transaction wallet_api::create_son(string owner_account,
|
signed_transaction wallet_api::create_son(string owner_account,
|
||||||
string url,
|
string url,
|
||||||
bool broadcast /* = false */)
|
bool broadcast /* = false */)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue