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();
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;
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,
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);
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 );
322 signed_transaction vote_for_witness(
string voting_account,
string witness,
bool approve,
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);
371 get_result_formatters()
const;
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";