34 namespace graphene {
namespace wallet {
44 static const string ENC_HEADER(
"-----BEGIN BITSHARES SIGNED MESSAGE-----\n" );
45 static const string ENC_META(
"-----BEGIN META-----\n" );
46 static const string ENC_SIG(
"-----BEGIN SIGNATURE-----\n" );
47 static const string ENC_FOOTER(
"-----END BITSHARES SIGNED MESSAGE-----" );
52 if( std::isdigit( name_or_id.front() ) )
76 flat_map< std::string, graphene::protocol::operation >&
name2op;
80 flat_map< std::string, graphene::protocol::operation >& _prototype_ops
81 ):t(_t), name2op(_prototype_ops) {}
83 template<
typename Type>
87 size_t p = name.rfind(
':');
88 if( p != string::npos )
89 name = name.substr( p+1 );
90 name2op[ name ] = Type();
113 void on_block_applied(
const variant& block_id );
121 bool copy_wallet_file(
string destination_filename );
126 bool is_locked()
const;
128 template<
typename ID>
131 auto ob = _remote_db->get_objects({
object_id_type(
id)}, {}).front();
150 variant_object about()
const;
158 account_id_type get_account_id(
string account_name_or_id)
const;
160 std::string asset_id_to_string(asset_id_type
id)
const;
162 optional<extended_asset_object> find_asset(asset_id_type
id)
const;
164 optional<extended_asset_object> find_asset(
string asset_symbol_or_id)
const;
172 asset_id_type get_asset_id(
const string& asset_symbol_or_id)
const;
174 string get_wallet_filename()
const;
184 bool import_key(
string account_name_or_id,
string wif_key);
186 vector< signed_transaction > import_balance(
string name_or_id,
const vector<string>& wif_keys,
bool broadcast );
188 bool load_wallet_file(
string wallet_filename =
"");
206 bool erase_existing_sigs =
true);
213 void save_wallet_file(
string wallet_filename =
"");
218 uint32_t operation_index,
const operation& new_op);
223 const vector<public_key_type>& signing_keys = vector<public_key_type>(),
bool broadcast =
true);
225 pair<transaction_id_type,signed_transaction> broadcast_transaction(
signed_transaction tx);
229 uint32_t review_period_seconds = 0,
bool broadcast =
true);
233 uint32_t review_period_seconds = 0,
bool broadcast =
true);
238 string registrar_account,
string referrer_account, uint32_t referrer_percent,
239 bool broadcast =
false);
244 string account_name,
string registrar_account,
string referrer_account,
245 bool broadcast =
false,
bool save_wallet =
true);
247 signed_transaction create_account_with_brain_key(
string brain_key,
string account_name,
string registrar_account,
248 string referrer_account,
bool broadcast =
false,
bool save_wallet =
true);
256 signed_transaction update_asset_issuer(
string symbol,
string new_issuer,
bool broadcast );
260 signed_transaction update_asset_feed_producers(
string symbol, flat_set<string> new_feed_producers,
266 signed_transaction fund_asset_fee_pool(
string from,
string symbol,
string amount,
bool broadcast );
268 signed_transaction claim_asset_fee_pool(
string symbol,
string amount,
bool broadcast );
270 signed_transaction reserve_asset(
string from,
string amount,
string symbol,
bool broadcast );
274 signed_transaction settle_asset(
string account_to_settle,
string amount_to_settle,
string symbol,
277 signed_transaction bid_collateral(
string bidder_name,
string debt_amount,
string debt_symbol,
278 string additional_collateral,
bool broadcast );
280 signed_transaction whitelist_account(
string authorizing_account,
string account_to_list,
283 signed_transaction create_committee_member(
string owner_account,
string url,
bool broadcast );
291 signed_transaction update_witness(
string witness_name,
string url,
string block_signing_key,
294 signed_transaction create_worker(
string owner_account, time_point_sec work_begin_date,
295 time_point_sec work_end_date,
share_type daily_pay,
string name,
string url,
296 variant worker_settings,
bool broadcast );
301 const string& amount,
const string& asset_symbol,
const string& hash_algorithm,
302 const string& preimage_hash, uint32_t preimage_size,
303 uint32_t claim_period_seconds,
const string& memo,
bool broadcast =
false);
306 const std::vector<char>& preimage,
bool broadcast );
309 uint32_t seconds_to_add,
bool broadcast);
312 flat_map<
string, optional<string>> key_values,
bool broadcast);
314 vector< vesting_balance_object_with_info > get_vesting_balances(
string account_name );
316 signed_transaction withdraw_vesting(
string witness_name,
string amount,
string asset_symbol,
317 bool broadcast =
false );
319 signed_transaction vote_for_committee_member(
string voting_account,
string committee_member,
320 bool approve,
bool broadcast );
325 signed_transaction set_voting_proxy(
string account_to_modify, optional<string> voting_account,
328 signed_transaction set_desired_witness_and_committee_member_count(
string account_to_modify,
329 uint16_t desired_number_of_witnesses, uint16_t desired_number_of_committee_members,
334 const vector<public_key_type>& signing_keys = vector<public_key_type>(),
335 bool broadcast =
false);
337 flat_set<public_key_type> get_transaction_signers(
const signed_transaction &tx)
const;
339 vector<flat_set<account_id_type>> get_key_references(
const vector<public_key_type> &keys)
const;
341 memo_data sign_memo(
string from,
string to,
string memo);
347 bool verify_message(
const string& message,
const string& account, int32_t block,
const string& msg_time,
352 bool verify_encapsulated_message(
const string& message );
354 signed_transaction sell_asset(
string seller_account,
string amount_to_sell,
string symbol_to_sell,
355 string min_to_receive,
string symbol_to_receive, uint32_t timeout_sec = 0,
356 bool fill_or_kill =
false,
bool broadcast =
false);
358 signed_transaction borrow_asset_ext(
string seller_name,
string amount_to_borrow,
string asset_symbol,
360 bool broadcast =
false);
362 signed_transaction cancel_order(
const limit_order_id_type& order_id,
bool broadcast =
false);
365 string asset_symbol,
string memo,
bool broadcast =
false);
368 string memo,
bool broadcast =
false);
370 std::map< string, std::function< string( const fc::variant&, const fc::variants& ) >, std::less<> >
371 get_result_formatters()
const;
374 const variant_object& changed_values,
bool broadcast =
false);
377 const variant_object& changed_fees,
bool broadcast =
false);
379 signed_transaction approve_proposal(
const string& fee_paying_account,
const string& proposal_id,
382 void dbg_make_uia(
string creator,
string symbol);
384 void dbg_make_mia(
string creator,
string symbol);
386 void dbg_push_blocks(
const std::string& src_filename, uint32_t count );
388 void dbg_generate_blocks(
const std::string& debug_wif_key, uint32_t count );
390 void dbg_stream_json_objects(
const std::string& filename );
394 void use_network_node_api();
396 void use_debug_api();
398 void network_add_nodes(
const vector<string>& nodes );
400 vector< variant > network_get_connected_peers();
402 void flood_network(
string prefix, uint32_t number_of_transactions);
404 operation get_prototype_operation(
string operation_name );
426 static htlc_hash do_hash(
const string& algorithm,
const std::string& hash );
428 void enable_umask_protection();
430 void disable_umask_protection();
442 void claim_registered_witness(
const std::string& witness_name);
447 void init_prototype_ops();
449 map<transaction_handle_type, signed_transaction> _builder_transactions;
457 struct recently_generated_transaction_record
462 struct timestamp_index{};
463 typedef boost::multi_index_container<
464 recently_generated_transaction_record,
465 boost::multi_index::indexed_by<
466 boost::multi_index::hashed_unique<
467 boost::multi_index::member<
468 recently_generated_transaction_record,
470 &recently_generated_transaction_record::transaction_id
472 std::hash<graphene::chain::transaction_id_type>
474 boost::multi_index::ordered_non_unique<
475 boost::multi_index::tag<timestamp_index>,
476 boost::multi_index::member<
477 recently_generated_transaction_record,
479 &recently_generated_transaction_record::generation_time
483 > recently_generated_transaction_set_type;
484 recently_generated_transaction_set_type _recently_generated_transactions;
489 const string _wallet_filename_extension =
".wallet";
fc::optional< T > maybe_id(const string &name_or_id)
flat_map< std::string, graphene::protocol::operation > & name2op
string address_to_shorthash(const graphene::protocol::address &addr)
microseconds minutes(int64_t m)
fc::api< custom_operations_api > _custom_operations
#define GRAPHENE_MAX_NESTED_OBJECTS
contains all of the parameters necessary to calculate the fee for any operation
This class represents an account on the object graphAccounts are the primary unit of authority on the...
Maintains global state information (committee_member list, current fees)This is an implementation det...
An order-perserving dictionary of variant's.
The asset_options struct contains options available on all assets in the network. ...
Used to generate a useful error report when an exception is thrown.At each level in the stack where t...
flat_map< string, operation > _prototype_ops
fc::api< history_api > _remote_hist
fc::static_variant< transfer_operation, limit_order_create_operation, limit_order_cancel_operation, call_order_update_operation, fill_order_operation, account_create_operation, account_update_operation, account_whitelist_operation, account_upgrade_operation, account_transfer_operation, asset_create_operation, asset_update_operation, asset_update_bitasset_operation, asset_update_feed_producers_operation, asset_issue_operation, asset_reserve_operation, asset_fund_fee_pool_operation, asset_settle_operation, asset_global_settle_operation, asset_publish_feed_operation, witness_create_operation, witness_update_operation, proposal_create_operation, proposal_update_operation, proposal_delete_operation, withdraw_permission_create_operation, withdraw_permission_update_operation, withdraw_permission_claim_operation, withdraw_permission_delete_operation, committee_member_create_operation, committee_member_update_operation, committee_member_update_global_parameters_operation, vesting_balance_create_operation, vesting_balance_withdraw_operation, worker_create_operation, custom_operation, assert_operation, balance_claim_operation, override_transfer_operation, transfer_to_blind_operation, blind_transfer_operation, transfer_from_blind_operation, asset_settle_cancel_operation, asset_claim_fees_operation, fba_distribute_operation, bid_collateral_operation, execute_bid_operation, asset_claim_pool_operation, asset_update_issuer_operation, htlc_create_operation, htlc_redeem_operation, htlc_redeemed_operation, htlc_extend_operation, htlc_refund_operation, custom_authority_create_operation, custom_authority_update_operation, custom_authority_delete_operation, ticket_create_operation, ticket_update_operation, liquidity_pool_create_operation, liquidity_pool_delete_operation, liquidity_pool_deposit_operation, liquidity_pool_withdraw_operation, liquidity_pool_exchange_operation, samet_fund_create_operation, samet_fund_delete_operation, samet_fund_update_operation, samet_fund_borrow_operation, samet_fund_repay_operation, credit_offer_create_operation, credit_offer_delete_operation, credit_offer_update_operation, credit_offer_accept_operation, credit_deal_repay_operation, credit_deal_expired_operation >
groups operations that should be applied atomically
fc::api< network_broadcast_api > _remote_net_broadcast
provides stack-based nullable value similar to boost::optional
optional< fc::api< network_node_api > > _remote_net_node
result_type operator()(const Type &op) const
fc::ecc::private_key derive_private_key(const std::string &prefix_string, int sequence_number)
fc::api< database_api > _remote_db
The price struct stores asset prices in the BitShares system.
T as(uint32_t max_depth) const
adds a signature to a transaction
fc::api< login_api > _remote_api
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
string normalize_brain_key(string s)
graphene::db::object_downcast_t< const ID & > get_object(const ID &id) const
typename object_downcast< ObjectID >::type object_downcast_t
defines market parameters for margin positions
map< public_key_type, string > _keys
Maintains global state information (committee_member list, current fees)This is an implementation det...
a 160 bit hash of a public key
optional< fc::api< graphene::debug_witness::debug_api > > _remote_debug
an elliptic curve private key.
uint32_t transaction_handle_type
fc::ripemd160 transaction_id_type
tracks information about a committee_member account.A committee_member is responsible for setting blo...
op_prototype_visitor(int _t, flat_map< std::string, graphene::protocol::operation > &_prototype_ops)
api_documentation method_documentation
The bitasset_options struct contains configurable options available only to BitAssets.
defines the keys used to derive the shared secret