BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
31 namespace graphene {
namespace wallet {
namespace detail {
36 htlc_hash wallet_api_impl::do_hash(
const string& algorithm,
const std::string& hash )
39 std::transform( algorithm.begin(), algorithm.end(), std::back_inserter(name_upper), ::toupper);
40 if( name_upper ==
"RIPEMD160" )
42 if( name_upper ==
"SHA256" )
44 if( name_upper ==
"SHA1" )
46 if( name_upper ==
"HASH160" )
48 FC_THROW_EXCEPTION( fc::invalid_arg_exception,
"Unknown algorithm '${a}'", (
"a",algorithm) );
52 string asset_symbol,
string memo,
bool broadcast )
56 FC_ASSERT(asset_obj,
"Could not find asset matching ${asset}", (
"asset", asset_symbol));
60 account_id_type from_id = from_account.
get_id();
61 account_id_type to_id = to_account.
get_id();
65 xfer_op.
from = from_id;
87 const string& amount,
const string& asset_symbol,
const string& hash_algorithm,
88 const string& preimage_hash, uint32_t preimage_size,
89 uint32_t claim_period_seconds,
const string& memo,
bool broadcast )
95 FC_ASSERT(asset_obj,
"Could not find asset matching ${asset}", (
"asset", asset_symbol));
104 create_op.
preimage_hash = do_hash( hash_algorithm, preimage_hash );
123 (preimage_hash)(preimage_size)(claim_period_seconds)(broadcast) )
127 const std::vector<char>& preimage,
bool broadcast )
133 FC_ASSERT(htlc_obj,
"Could not find HTLC matching ${htlc}", (
"htlc", htlc_id));
152 uint32_t seconds_to_add,
bool broadcast )
158 FC_ASSERT(htlc_obj,
"Could not find HTLC matching ${htlc}", (
"htlc", htlc_id));
179 if ( !obj.is_null() )
187 string symbol_to_sell,
string min_to_receive,
string symbol_to_receive,
188 uint32_t timeout_sec,
bool fill_or_kill,
bool broadcast )
209 string asset_symbol,
string amount_of_collateral,
215 auto collateral =
get_asset(
get_object(*mia.bitasset_data_id).options.short_backing_asset);
219 op.
delta_debt = mia.amount_from_string(amount_to_borrow);
249 auto asset_obj =
get_asset( asset_symbol );
262 vesting_balance_withdraw_op.
owner = vbo.
owner;
263 vesting_balance_withdraw_op.
amount = asset_obj.amount_from_string(amount);
266 tx.
operations.push_back( vesting_balance_withdraw_op );
vector< operation > operations
#define FC_CAPTURE_AND_RETHROW(...)
asset amount
The amount of asset to transfer from from to to.
asset delta_debt
the amount of the debt to be paid off, may be negative to issue new debt
Withdraw from a vesting balance.
extended_asset_object get_asset(asset_id_type id) const
vesting_balance_id_type vesting_balance
fc::ecc::private_key get_private_key(const public_key_type &id) const
std::vector< char > preimage
fc::api< database_api > _remote_db
signed_transaction sign_transaction(signed_transaction tx, bool broadcast=false)
void set_operation_fees(signed_transaction &tx, const fee_schedule &s) const
signed_transaction htlc_redeem(const htlc_id_type &htlc_id, const string &issuer, const std::vector< char > &preimage, bool broadcast)
asset delta_collateral
the amount of collateral to add to the margin position
optional< vesting_balance_id_type > pay_vb
asset amount_from_string(string amount_string) const
microseconds seconds(int64_t s)
account_object get_account(account_id_type id) const
fc::optional< htlc_object > get_htlc(const htlc_id_type &htlc_id) const
adds a signature to a transaction
witness_object get_witness(string owner_account)
account_id_type owner
Must be vesting_balance.owner.
account_id_type update_issuer
This class represents an account on the object graph.
signed_transaction htlc_extend(const htlc_id_type &htlc_id, const string &issuer, uint32_t seconds_to_add, bool broadcast)
Transfers an amount of one asset from one account to another.
signed_transaction cancel_order(const limit_order_id_type &order_id, bool broadcast=false)
extensions_type extensions
time_point_sec expiration
account_id_type to
Account to transfer asset to.
account_id_type from
Account to transfer asset from.
typename impl::transform< List, Transformer >::type transform
Transform elements of a typelist.
signed_transaction withdraw_vesting(string witness_name, string amount, string asset_symbol, bool broadcast=false)
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
void set_message(const fc::ecc::private_key &priv, const fc::ecc::public_key &pub, const string &msg, uint64_t custom_nonce=0)
virtual void validate() const
signed_transaction transfer(string from, string to, string amount, string asset_symbol, string memo, bool broadcast=false)
graphene::db::object_downcast_t< const ID & > get_object(const ID &id) const
#define GRAPHENE_MAX_NESTED_OBJECTS
account_id_type fee_paying_account
limit_order_id_type order
instructs the blockchain to attempt to sell one asset for another
defines the keys used to derive the shared secret
object_id< SpaceID, TypeID > get_id() const
account_id_type owner
Account which owns and may withdraw from this vesting balance.
provides stack-based nullable value similar to boost::optional
optional< memo_data > memo
User provided data encrypted to the memo key of the "to" account.
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
bool fill_or_kill
If this flag is set the entire order must be filled or the operation is rejected.
signed_transaction htlc_create(const string &source, const string &destination, const string &amount, const string &asset_symbol, const string &hash_algorithm, const string &preimage_hash, uint32_t preimage_size, uint32_t claim_period_seconds, const string &memo, bool broadcast=false)
extension< additional_options_type > extensions
account_id_type funding_account
pays fee, collateral, and cover
signed_transaction borrow_asset_ext(string seller_name, string amount_to_borrow, string asset_symbol, string amount_of_collateral, call_order_update_operation::extensions_type extensions, bool broadcast=false)
signed_transaction sell_asset(string seller_account, string amount_to_sell, string symbol_to_sell, string min_to_receive, string symbol_to_receive, uint32_t timeout_sec=0, bool fill_or_kill=false, bool broadcast=false)
uint32_t claim_period_seconds