1 #include <graphene/utilities/git_revision.hpp>
2 #include <graphene/utilities/key_conversion.hpp>
29 #include <boost/version.hpp>
30 #include <boost/lexical_cast.hpp>
31 #include <boost/algorithm/string/replace.hpp>
33 #include <boost/range/adaptor/map.hpp>
34 #include <boost/range/algorithm_ext/erase.hpp>
35 #include <boost/range/algorithm/unique.hpp>
36 #include <boost/range/algorithm/sort.hpp>
38 #include <boost/multi_index_container.hpp>
39 #include <boost/multi_index/ordered_index.hpp>
40 #include <boost/multi_index/mem_fun.hpp>
41 #include <boost/multi_index/member.hpp>
42 #include <boost/multi_index/random_access_index.hpp>
43 #include <boost/multi_index/tag.hpp>
44 #include <boost/multi_index/sequenced_index.hpp>
45 #include <boost/multi_index/hashed_index.hpp>
47 #include <fc/container/deque.hpp>
48 #include <fc/git_revision.hpp>
49 #include <fc/io/fstream.hpp>
50 #include <fc/io/json.hpp>
51 #include <fc/io/stdio.hpp>
52 #include <fc/network/http/websocket.hpp>
53 #include <fc/rpc/websocket_api.hpp>
54 #include <fc/crypto/aes.hpp>
55 #include <fc/crypto/hex.hpp>
56 #include <fc/thread/mutex.hpp>
57 #include <fc/thread/scoped_lock.hpp>
58 #include <fc/smart_ref_impl.hpp>
61 #include <sys/types.h>
65 #include <scorum/cli/formatter.hpp>
70 using namespace graphene::utilities;
74 template <
class T> optional<T>
maybe_id(
const std::string& name_or_id)
76 if (std::isdigit(name_or_id.front()))
80 return fc::variant(name_or_id).as<T>();
82 catch (
const fc::exception&)
92 flat_map<std::string, operation>&
name2op;
96 , name2op(_prototype_ops)
100 template <
typename Type>
void operator()(
const Type& op)
const
102 std::string name = fc::get_typename<Type>::name();
103 size_t p = name.rfind(
':');
104 if (p != std::string::npos)
105 name = name.substr(p + 1);
106 name2op[name] = Type();
116 void enable_umask_protection()
119 _old_umask = umask(S_IRWXG | S_IRWXO);
123 void disable_umask_protection()
130 void init_prototype_ops()
133 for (
int t = 0; t < op.count(); t++)
136 op.visit(op_prototype_visitor(t, _prototype_ops));
144 , _chain_id(initial_data.chain_id)
150 init_prototype_ops();
153 if (remote_chain_id != _chain_id)
155 FC_THROW(
"Remote server gave us an unexpected chain_id",
156 (
"remote_chain_id", remote_chain_id)(
"chain_id", _chain_id));
159 _wallet.ws_server = initial_data.
ws_server;
160 _wallet.ws_user = initial_data.
ws_user;
162 _wallet.chain_id = initial_data.
chain_id;
176 auto plain_txt = fc::raw::pack(data);
177 _wallet.cipher_keys = fc::aes_encrypt(data.
checksum, plain_txt);
183 fc::path src_path = get_wallet_filename();
184 if (!fc::exists(src_path))
186 fc::path dest_path = destination_filename + _wallet_filename_extension;
188 while (fc::exists(dest_path))
191 dest_path = destination_filename +
"-" + std::to_string(suffix) + _wallet_filename_extension;
193 wlog(
"backing up wallet ${src} to ${dest}", (
"src", src_path)(
"dest", dest_path));
195 fc::path dest_parent = fc::absolute(dest_path).parent_path();
198 enable_umask_protection();
199 if (!fc::exists(dest_parent))
200 fc::create_directories(dest_parent);
201 fc::copy(src_path, dest_path);
202 disable_umask_protection();
206 disable_umask_protection();
214 return _checksum == fc::sha512();
219 auto dynamic_props = _remote_db->get_dynamic_global_properties();
221 fc::mutable_variant_object
result = fc::variant(dynamic_props).get_object();
223 result[
"witness_majority_version"] = fc::string(dynamic_props.majority_version);
224 result[
"hardfork_version"] = fc::string(_chain_api->get_chain_properties().hf_version);
226 result[
"chain_properties"] = fc::variant(dynamic_props.median_chain_props).get_object();
228 result[
"chain_id"] = _chain_id;
230 = fc::get_approximate_relative_time_string(dynamic_props.time, time_point_sec(time_point::now()),
" old");
232 result[
"participation"] = (100 * dynamic_props.recent_slots_filled.popcount()) / 128.0;
239 std::string client_version(graphene::utilities::git_revision_description);
240 const size_t pos = client_version.find(
'/');
241 if (pos != std::string::npos && client_version.size() > pos)
242 client_version = client_version.substr(pos + 1);
244 fc::mutable_variant_object
result;
246 result[
"client_version"] = client_version;
247 result[
"scorum_revision"] = graphene::utilities::git_revision_sha;
248 result[
"scorum_revision_age"] = fc::get_approximate_relative_time_string(
249 fc::time_point_sec(graphene::utilities::git_revision_unix_timestamp));
250 result[
"fc_revision"] = fc::git_revision_sha;
252 = fc::get_approximate_relative_time_string(fc::time_point_sec(fc::git_revision_unix_timestamp));
253 result[
"compile_date"] =
"compiled on " __DATE__
" at " __TIME__;
254 result[
"boost_version"] = boost::replace_all_copy(std::string(BOOST_LIB_VERSION),
"_",
".");
255 result[
"openssl_version"] = OPENSSL_VERSION_TEXT;
257 std::string bitness = boost::lexical_cast<std::string>(8 *
sizeof(
int*)) +
"-bit";
258 #if defined(__APPLE__)
259 std::string os =
"osx";
260 #elif defined(__linux__)
261 std::string os =
"linux";
262 #elif defined(_MSC_VER)
263 std::string os =
"win32";
265 std::string os =
"other";
267 result[
"build"] = os +
" " + bitness;
271 auto v = _remote_api->get_version();
272 result[
"server_blockchain_version"] = v.blockchain_version;
273 result[
"server_scorum_revision"] = v.scorum_revision;
274 result[
"server_fc_revision"] = v.fc_revision;
276 catch (fc::exception&)
278 result[
"server"] =
"could not retrieve server version information";
286 auto accounts = _remote_db->get_accounts({ account_name });
287 FC_ASSERT(!accounts.empty(),
"Unknown account");
288 return accounts.front();
293 return _wallet_filename;
298 auto it = _keys.find(
id);
299 if (it != _keys.end())
300 return wif_to_key(it->second);
301 return optional<fc::ecc::private_key>();
306 auto has_key = try_get_private_key(
id);
313 std::vector<public_key_type> active_keys = account.
active.
get_keys();
314 if (active_keys.size() != 1)
315 FC_THROW(
"Expecting a simple authority with one active key");
316 return get_private_key(active_keys.front());
325 fc::optional<fc::ecc::private_key> optional_private_key = wif_to_key(wif_key);
326 if (!optional_private_key)
327 FC_THROW(
"Invalid private key");
330 _keys[wif_pub_key] = wif_key;
339 if (wallet_filename ==
"")
340 wallet_filename = _wallet_filename;
342 if (!fc::exists(wallet_filename))
345 _wallet = fc::json::from_file(wallet_filename).as<
wallet_data>();
362 if (wallet_filename ==
"")
363 wallet_filename = _wallet_filename;
365 wlog(
"saving wallet to file ${fn}", (
"fn", wallet_filename));
367 std::string data = fc::json::to_pretty_string(_wallet);
370 enable_umask_protection();
377 fc::ofstream outfile{ fc::path(wallet_filename) };
378 outfile.write(data.c_str(), data.length());
381 disable_umask_protection();
385 disable_umask_protection();
396 int first_unused_index = 0;
397 int number_of_consecutive_unused_keys = 0;
398 for (
int key_index = 0;; ++key_index)
400 fc::ecc::private_key derived_private_key =
derive_private_key(key_to_wif(parent_key), key_index);
402 if (_keys.find(derived_public_key) == _keys.end())
404 if (number_of_consecutive_unused_keys)
406 ++number_of_consecutive_unused_keys;
407 if (number_of_consecutive_unused_keys > 5)
408 return first_unused_index;
412 first_unused_index = key_index;
413 number_of_consecutive_unused_keys = 1;
419 first_unused_index = 0;
420 number_of_consecutive_unused_keys = 0;
426 const std::string& account_name,
427 const std::string& creator_account_name,
428 bool broadcast =
false,
429 bool save_wallet =
true)
433 int active_key_index = find_first_unused_derived_key_index(owner_privkey);
434 fc::ecc::private_key active_privkey =
derive_private_key(key_to_wif(owner_privkey), active_key_index);
436 int memo_key_index = find_first_unused_derived_key_index(active_privkey);
437 fc::ecc::private_key memo_privkey =
derive_private_key(key_to_wif(active_privkey), memo_key_index);
445 account_create_op.
creator = creator_account_name;
447 account_create_op.
fee = _chain_api->get_chain_properties().median_chain_props.account_creation_fee;
450 account_create_op.
memo_key = memo_pubkey;
462 auto result = _remote_net_broadcast->broadcast_transaction_synchronous(tx);
466 FC_CAPTURE_AND_RETHROW((account_name)(creator_account_name)(broadcast)(save_wallet))
470 set_voting_proxy(
const std::string& account_to_modify,
const std::string& proxy,
bool broadcast )
475 op.
account = account_to_modify;
482 return sign_transaction(tx, broadcast);
484 FC_CAPTURE_AND_RETHROW((account_to_modify)(proxy)(broadcast))
487 optional<witness_api_obj>
get_witness(
const std::string& owner_account)
489 return _remote_db->get_witness_by_account(owner_account);
495 _tx_expiration_seconds = tx_expiration_seconds;
500 flat_set<account_name_type> req_active_approvals;
501 flat_set<account_name_type> req_owner_approvals;
502 flat_set<account_name_type> req_posting_approvals;
503 std::vector<authority> other_auths;
507 for (
const auto& auth : other_auths)
508 for (
const auto& a : auth.account_auths)
509 req_active_approvals.insert(a.first);
514 std::vector<std::string> v_approving_account_names;
515 std::merge(req_active_approvals.begin(), req_active_approvals.end(), req_owner_approvals.begin(),
516 req_owner_approvals.end(), std::back_inserter(v_approving_account_names));
518 for (
const auto& a : req_posting_approvals)
519 v_approving_account_names.push_back(a);
523 auto approving_account_objects = _remote_db->get_accounts(v_approving_account_names);
527 FC_ASSERT(approving_account_objects.size() == v_approving_account_names.size(),
"",
528 (
"aco.size:", approving_account_objects.size())(
"acn", v_approving_account_names.size()));
530 flat_map<std::string, account_api_obj> approving_account_lut;
532 for (
const optional<account_api_obj> approving_acct : approving_account_objects)
534 if (!approving_acct.valid())
536 wlog(
"operation_get_required_auths said approval of non-existing account ${name} was needed",
537 (
"name", v_approving_account_names[i]));
541 approving_account_lut[approving_acct->name] = *approving_acct;
545 flat_set<public_key_type> approving_key_set;
548 const auto it = approving_account_lut.find(acct_name);
549 if (it == approving_account_lut.end())
552 std::vector<public_key_type> v_approving_keys = acct.
active.
get_keys();
553 wdump((v_approving_keys));
556 wdump((approving_key));
557 approving_key_set.insert(approving_key);
563 const auto it = approving_account_lut.find(acct_name);
564 if (it == approving_account_lut.end())
567 std::vector<public_key_type> v_approving_keys = acct.
posting.
get_keys();
568 wdump((v_approving_keys));
571 wdump((approving_key));
572 approving_key_set.insert(approving_key);
578 const auto it = approving_account_lut.find(acct_name);
579 if (it == approving_account_lut.end())
582 std::vector<public_key_type> v_approving_keys = acct.
owner.
get_keys();
585 wdump((approving_key));
586 approving_key_set.insert(approving_key);
591 for (
const auto& k : a.key_auths)
594 approving_key_set.insert(k.first);
598 auto dyn_props = _remote_db->get_dynamic_global_properties();
600 tx.
set_expiration(dyn_props.time + fc::seconds(_tx_expiration_seconds));
604 flat_set<public_key_type> available_keys;
605 flat_map<public_key_type, fc::ecc::private_key> available_private_keys;
608 auto it = _keys.find(key);
609 if (it != _keys.end())
611 fc::optional<fc::ecc::private_key> privkey = wif_to_key(it->second);
612 FC_ASSERT(privkey.valid(),
"Malformed private key in _keys");
613 available_keys.insert(key);
614 available_private_keys[key] = *privkey;
618 auto get_account_from_lut = [&](
const std::string& name) ->
const account_api_obj& {
619 auto it = approving_account_lut.find(name);
620 FC_ASSERT(it != approving_account_lut.end());
625 _chain_id, available_keys,
626 [&](
const std::string& account_name) ->
const authority& {
627 return (get_account_from_lut(account_name).
active);
629 [&](
const std::string& account_name) ->
const authority& {
630 return (get_account_from_lut(account_name).
owner);
632 [&](
const std::string& account_name) ->
const authority& {
633 return (get_account_from_lut(account_name).posting);
635 SCORUM_MAX_SIG_CHECK_DEPTH);
639 auto it = available_private_keys.find(k);
640 FC_ASSERT(it != available_private_keys.end());
641 tx.
sign(it->second, _chain_id);
648 auto result = _remote_net_broadcast->broadcast_transaction_synchronous(tx);
654 catch (
const fc::exception& e)
656 elog(
"Caught exception while broadcasting tx ${id}: ${e}",
657 (
"id", tx.
id().str())(
"e", e.to_detail_string()));
669 p.print_field(
"SECRET: ", secret);
682 p.print_raw(
"INITIATION CONTRACT");
686 p.print_raw(
"* PARTICIPATION CONTRACT");
690 p.print_field(
"From: ", rt.
owner);
691 p.print_field(
"To: ", rt.
to);
692 p.print_field(
"Amount: ", rt.
amount);
696 p.print_field(
"Locktime: ", rt.
deadline.to_iso_string());
699 now -= fc::time_point::now().sec_since_epoch();
700 int h = now.sec_since_epoch() / 3600;
701 int m = now.sec_since_epoch() % 3600 / 60;
702 int s = now.sec_since_epoch() % 60;
703 p.print_field(
"Locktime reached in: ", p.print_sequence2str(h,
'h', m,
'm', s,
's'));
708 p.print_raw(print_atomicswap_secret2str(rt.
secret));
717 p.print_field(
"Metadata: ", rt.
metadata);
725 std::map<std::string, std::function<std::string(fc::variant,
const fc::variants&)>> m;
726 m[
"help"] = [](variant
result,
const fc::variants& a) {
return result.get_string(); };
728 m[
"gethelp"] = [](variant
result,
const fc::variants& a) {
return result.get_string(); };
730 m[
"list_my_accounts"] = [](variant
result,
const fc::variants& a) {
731 auto accounts =
result.as<std::vector<account_api_obj>>();
738 FC_ASSERT(p.create_table(16, 20, 10, 20));
740 for (
const auto& a : accounts)
742 total_scorum += a.balance;
743 total_vest += a.scorumpower;
744 p.print_cell(a.name);
745 p.print_cell(a.balance);
747 p.print_cell(a.scorumpower);
750 p.print_line(
'-', accounts.empty());
751 p.print_cell(
"TOTAL");
752 p.print_cell(total_scorum);
754 p.print_cell(total_vest);
758 m[
"get_account_balance"] = [](variant
result,
const fc::variants& a) -> std::string {
763 FC_ASSERT(p.create_table(16, 20, 10, 20));
766 p.print_cell(
"Scorums:");
767 p.print_cell(rt.balance);
768 p.print_cell(
"Vests:");
769 p.print_cell(rt.scorumpower);
774 auto history_formatter = [](variant
result,
const fc::variants& a) {
775 const auto& results =
result.get_array();
779 FC_ASSERT(p.create_table(5, 10, 15, 20, 50));
782 p.print_cell(
"BLOCK #");
783 p.print_cell(
"TRX ID");
784 p.print_cell(
"OPERATION");
785 p.print_cell(
"DETAILS");
787 p.print_line(
'-',
false);
789 for (
const auto& item : results)
791 p.print_cell(item.get_array()[0].as_string());
792 const auto& op = item.get_array()[1].get_object();
793 p.print_cell(op[
"block"].as_string());
794 p.print_cell(op[
"trx_id"].as_string());
795 const auto& opop = op[
"op"].get_array();
796 p.print_cell(opop[0].as_string());
797 p.print_cell(fc::json::to_string(opop[1]));
802 m[
"get_account_history"] = history_formatter;
803 m[
"get_account_scr_to_scr_transfers"] = history_formatter;
804 m[
"get_account_scr_to_sp_transfers"] = history_formatter;
805 m[
"get_account_sp_to_scr_transfers"] = history_formatter;
807 m[
"get_devcommittee_history"] = history_formatter;
808 m[
"get_devcommittee_scr_to_scr_transfers"] = history_formatter;
809 m[
"get_devcommittee_sp_to_scr_transfers"] = history_formatter;
811 m[
"get_withdraw_routes"] = [](variant
result,
const fc::variants& a) {
812 auto routes =
result.as<std::vector<withdraw_route>>();
816 FC_ASSERT(p.create_table(20, 20, 8, 9));
818 p.print_cell(
"From");
820 p.print_cell(
"Percent");
821 p.print_cell(
"Auto-Vest");
823 p.print_line(
'=',
false);
825 for (
auto r : routes)
827 p.print_cell(r.from_account);
828 p.print_cell(r.to_account);
829 std::stringstream tmp;
830 tmp << std::setprecision(2) << std::fixed << double(r.percent) / 100;
831 p.print_cell(tmp.str());
832 p.print_cell((r.auto_vest ?
"true" :
"false"));
837 m[
"atomicswap_initiate"] = [
this](variant
result,
const fc::variants& a) -> std::string {
845 return print_atomicswap_contract2str(rt.obj);
848 m[
"atomicswap_participate"] = [
this](variant
result,
const fc::variants& a) -> std::string {
856 return print_atomicswap_contract2str(rt.obj);
859 m[
"atomicswap_auditcontract"] = [
this](variant
result,
const fc::variants& a) -> std::string {
863 return "Nothing to audit.";
867 return print_atomicswap_contract2str(rt);
870 m[
"atomicswap_extractsecret"] = [
this](variant
result,
const fc::variants& a) -> std::string {
871 auto secret =
result.as<std::string>();
878 return print_atomicswap_secret2str(secret);
887 if (_remote_net_node)
891 _remote_net_node = _remote_api->get_api_by_name(
"network_node_api")->as<
network_node_api>();
893 catch (
const fc::exception& e)
895 elog(
"Couldn't get network_node_api");
902 if (_remote_account_by_key_api.valid())
907 _remote_account_by_key_api
910 catch (
const fc::exception& e)
912 elog(
"Couldn't get account_by_key_api");
919 if (_remote_account_history_api.valid())
924 _remote_account_history_api
927 catch (
const fc::exception& e)
929 elog(
"Couldn't get account_history_api");
936 if (_remote_devcommittee_history_api.valid())
944 catch (
const fc::exception& e)
946 elog(
"Couldn't get devcommittee_history_api");
953 if (_remote_blockchain_history_api.valid())
961 catch (
const fc::exception& e)
963 elog(
"Couldn't get blockchain_history_api");
970 use_network_node_api();
971 for (
const std::string& node_address : nodes)
973 (*_remote_net_node)->add_node(fc::ip::endpoint::from_string(node_address));
979 use_network_node_api();
980 const auto peers = (*_remote_net_node)->get_connected_peers();
981 std::vector<variant>
result;
982 result.reserve(peers.size());
983 for (
const auto& peer : peers)
994 auto it = _prototype_ops.find(operation_name);
995 if (it == _prototype_ops.end())
996 FC_THROW(
"Unsupported operation: \"${operation_name}\"", (
"operation_name", operation_name));
1003 std::map<public_key_type, std::string>
_keys;
1018 uint32_t _tx_expiration_seconds = 30;
1027 const std::string _wallet_filename_extension =
".wallet";
1033 : my(new detail::wallet_api_impl(*this, initial_data, rapi))
1034 , exit_func([]() { FC_ASSERT(
false,
"Operation valid only in console mode."); })
1049 return my->copy_wallet_file(destination_filename);
1054 my->use_remote_blockchain_history_api();
1056 return (*my->_remote_blockchain_history_api)->get_block_header(num);
1061 my->use_remote_blockchain_history_api();
1063 return (*my->_remote_blockchain_history_api)->get_block(num);
1068 my->use_remote_blockchain_history_api();
1070 return (*my->_remote_blockchain_history_api)->get_block_headers_history(num, limit);
1075 my->use_remote_blockchain_history_api();
1077 return (*my->_remote_blockchain_history_api)->get_blocks_history(num, limit);
1083 my->use_remote_blockchain_history_api();
1085 return (*my->_remote_blockchain_history_api)->get_ops_in_block(block_num, type_of_operation);
1088 std::map<uint32_t, applied_operation>
1091 my->use_remote_blockchain_history_api();
1093 return (*my->_remote_blockchain_history_api)->get_ops_history(from_op, limit, type_of_operation);
1097 const fc::time_point_sec& to,
1099 uint32_t limit)
const
1101 my->use_remote_blockchain_history_api();
1103 return (*my->_remote_blockchain_history_api)->get_ops_history_by_time(from, to, from_op, limit);
1108 my->use_remote_blockchain_history_api();
1110 return (*my->_remote_blockchain_history_api)->get_blocks(from, limit);
1115 FC_ASSERT(!
is_locked(),
"Wallet must be unlocked to list accounts");
1116 std::vector<account_api_obj>
result;
1118 my->use_remote_account_by_key_api();
1120 std::vector<public_key_type> pub_keys;
1121 pub_keys.reserve(my->_keys.size());
1123 for (
const auto& item : my->_keys)
1124 pub_keys.push_back(item.first);
1126 auto refs = (*my->_remote_account_by_key_api)->get_key_references(pub_keys);
1127 std::set<std::string> names;
1128 for (
const auto& item : refs)
1129 for (
const auto& name : item)
1132 result.reserve(names.size());
1133 for (
const auto& name : names)
1141 return my->_remote_db->lookup_accounts(lowerbound, limit);
1146 return my->_remote_db->get_active_witnesses();
1151 return fc::to_hex(fc::raw::pack(tx));
1156 return my->get_wallet_filename();
1161 return my->get_account(account_name);
1166 return my->get_account(account_name);
1173 fc::optional<fc::ecc::private_key> optional_private_key = wif_to_key(wif_key);
1174 if (!optional_private_key)
1175 FC_THROW(
"Invalid private key");
1179 if (my->import_key(wif_key))
1205 return my->_remote_db->lookup_witness_accounts(lowerbound, limit);
1210 return my->get_witness(owner_account);
1214 const std::string& voting_account,
1217 return my->set_voting_proxy(account_to_modify, voting_account, broadcast);
1222 my->_wallet_filename = wallet_filename;
1234 return my->sign_transaction(tx, broadcast);
1236 FC_CAPTURE_AND_RETHROW((tx))
1241 return my->get_prototype_operation(operation_name);
1246 my->network_add_nodes(nodes);
1251 return my->network_get_connected_peers();
1256 std::vector<std::string> method_names = my->method_documentation.get_method_names();
1257 std::stringstream ss;
1258 for (
const std::string& method_name : method_names)
1262 ss << my->method_documentation.get_brief_description(method_name);
1264 catch (
const fc::key_not_found_exception&)
1266 ss << method_name <<
" (no help available)\n";
1274 fc::api<wallet_api> tmp;
1275 std::stringstream ss;
1278 std::string doxygenHelpString = my->method_documentation.get_detailed_description(method);
1279 if (!doxygenHelpString.empty())
1280 ss << doxygenHelpString;
1282 ss <<
"No help defined for method " << method <<
"\n";
1289 return my->load_wallet_file(wallet_filename);
1294 my->save_wallet_file(wallet_filename);
1297 std::map<std::string, std::function<std::string(fc::variant,
const fc::variants&)>>
1300 return my->get_result_formatters();
1305 return my->is_locked();
1309 return my->_wallet.cipher_keys.size() == 0;
1323 for (
auto key : my->_keys)
1324 key.second = key_to_wif(fc::ecc::private_key());
1326 my->_checksum = fc::sha512();
1327 my->self.lock_changed(
true);
1329 FC_CAPTURE_AND_RETHROW()
1336 FC_ASSERT(password.size() > 0);
1337 auto pw = fc::sha512::hash(password.c_str(), password.size());
1338 std::vector<char> decrypted = fc::aes_decrypt(pw, my->_wallet.cipher_keys);
1339 auto pk = fc::raw::unpack<plain_keys>(decrypted);
1340 FC_ASSERT(pk.checksum == pw);
1341 my->_keys = std::move(pk.keys);
1342 my->_checksum = pk.checksum;
1343 my->self.lock_changed(
false);
1345 FC_CAPTURE_AND_RETHROW()
1351 FC_ASSERT(!
is_locked(),
"The wallet must be unlocked before the password can be set");
1352 my->_checksum = fc::sha512::hash(password.c_str(), password.size());
1364 return key_to_wif(my->get_private_key(pubkey));
1368 const std::string& role,
1369 const std::string& password)
const
1371 auto seed = account + role + password;
1372 FC_ASSERT(seed.size());
1373 auto secret = fc::sha256::hash(seed.c_str(), seed.size());
1374 auto priv = fc::ecc::private_key::regenerate(secret);
1375 return std::make_pair(
public_key_type(priv.get_public_key()), key_to_wif(priv));
1384 const std::string& newname,
1385 const std::string& json_meta,
1390 bool broadcast)
const
1403 op.
fee = my->_chain_api->get_chain_properties().median_chain_props.account_creation_fee
1410 return my->sign_transaction(tx, broadcast);
1412 FC_CAPTURE_AND_RETHROW((creator)(newname)(json_meta)(
owner)(
active)(
posting)(memo)(broadcast))
1421 const asset& scorum_fee,
1422 const asset& delegated_scorumpower,
1423 const std::string& newname,
1424 const std::string& json_meta,
1429 bool broadcast)
const
1442 op.
fee = scorum_fee;
1449 return my->sign_transaction(tx, broadcast);
1451 FC_CAPTURE_AND_RETHROW((creator)(newname)(json_meta)(
owner)(
active)(
posting)(memo)(broadcast))
1455 const std::string& newname,
1456 const std::string& json_meta,
1461 bool broadcast)
const
1479 return my->sign_transaction(tx, broadcast);
1481 FC_CAPTURE_AND_RETHROW((creator)(newname)(json_meta)(
owner)(
active)(
posting)(memo)(broadcast))
1489 const std::string& newname,
1490 const std::string& json_meta,
1506 posting.pub_key, memo.pub_key, broadcast);
1508 FC_CAPTURE_AND_RETHROW((creator)(newname)(json_meta))
1512 const std::string& account_to_recover,
1526 return my->sign_transaction(tx, broadcast);
1545 return my->sign_transaction(tx, broadcast);
1561 return my->sign_transaction(tx, broadcast);
1566 return my->_remote_db->get_owner_history(account);
1570 const std::string& json_meta,
1575 bool broadcast)
const
1593 return my->sign_transaction(tx, broadcast);
1595 FC_CAPTURE_AND_RETHROW((account_name)(json_meta)(
owner)(
active)(
posting)(memo)(broadcast))
1606 auto accounts = my->_remote_db->get_accounts({ account_name });
1607 FC_ASSERT(accounts.size() == 1,
"Account does not exist");
1608 FC_ASSERT(account_name == accounts[0].name,
"Account name doesn't match?");
1612 op.
memo_key = accounts[0].memo_key;
1620 new_auth = accounts[0].
owner;
1623 new_auth = accounts[0].
active;
1626 new_auth = accounts[0].
posting;
1643 FC_ASSERT(
false,
"Owner authority change would render account irrecoverable.");
1646 wlog(
"Authority is now impossible.");
1652 op.
owner = new_auth;
1666 return my->sign_transaction(tx, broadcast);
1671 const std::string& auth_account,
1677 auto accounts = my->_remote_db->get_accounts({ account_name });
1678 FC_ASSERT(accounts.size() == 1,
"Account does not exist");
1679 FC_ASSERT(account_name == accounts[0].name,
"Account name doesn't match?");
1683 op.
memo_key = accounts[0].memo_key;
1691 new_auth = accounts[0].
owner;
1694 new_auth = accounts[0].
active;
1697 new_auth = accounts[0].
posting;
1714 FC_ASSERT(
false,
"Owner authority change would render account irrecoverable.");
1717 wlog(
"Authority is now impossible.");
1723 op.
owner = new_auth;
1737 return my->sign_transaction(tx, broadcast);
1747 auto accounts = my->_remote_db->get_accounts({ account_name });
1748 FC_ASSERT(accounts.size() == 1,
"Account does not exist");
1749 FC_ASSERT(account_name == accounts[0].name,
"Account name doesn't match?");
1750 FC_ASSERT(threshold != 0,
"Authority is implicitly satisfied");
1754 op.
memo_key = accounts[0].memo_key;
1762 new_auth = accounts[0].
owner;
1765 new_auth = accounts[0].
active;
1768 new_auth = accounts[0].
posting;
1778 FC_ASSERT(
false,
"Owner authority change would render account irrecoverable.");
1781 wlog(
"Authority is now impossible.");
1787 op.
owner = new_auth;
1801 return my->sign_transaction(tx, broadcast);
1809 auto accounts = my->_remote_db->get_accounts({ account_name });
1810 FC_ASSERT(accounts.size() == 1,
"Account does not exist");
1811 FC_ASSERT(account_name == accounts[0].name,
"Account name doesn't match?");
1815 op.
memo_key = accounts[0].memo_key;
1822 return my->sign_transaction(tx, broadcast);
1830 auto accounts = my->_remote_db->get_accounts({ account_name });
1831 FC_ASSERT(accounts.size() == 1,
"Account does not exist");
1832 FC_ASSERT(account_name == accounts[0].name,
"Account name doesn't match?");
1843 return my->sign_transaction(tx, broadcast);
1847 const std::string& delegatee,
1848 const asset& scorumpower,
1853 auto accounts = my->_remote_db->get_accounts({ delegator, delegatee });
1854 FC_ASSERT(accounts.size() == 2,
"One or more of the accounts specified do not exist.");
1855 FC_ASSERT(delegator == accounts[0].name,
"Delegator account is not right?");
1856 FC_ASSERT(delegatee == accounts[1].name,
"Delegatee account is not right?");
1867 return my->sign_transaction(tx, broadcast);
1871 const std::string& delegatee,
1872 const asset& scorumpower,
1877 auto accounts = my->_remote_db->get_accounts({ reg_committee_member, delegatee });
1878 FC_ASSERT(accounts.size() == 2,
"One or more of the accounts specified do not exist.");
1879 FC_ASSERT(reg_committee_member == accounts[0].name,
"Registration committee member account is not right?");
1880 FC_ASSERT(delegatee == accounts[1].name,
"Delegatee account is not right?");
1891 return my->sign_transaction(tx, broadcast);
1899 const std::string& newname,
1900 const std::string& json_meta,
1915 memo.pub_key, broadcast);
1917 FC_CAPTURE_AND_RETHROW((creator)(newname)(json_meta))
1925 const asset& scorum_fee,
1926 const asset& delegated_scorumpower,
1927 const std::string& newname,
1928 const std::string& json_meta,
1946 FC_CAPTURE_AND_RETHROW((creator)(newname)(json_meta))
1950 const std::string& url,
1959 fc::optional<witness_api_obj> wit = my->_remote_db->get_witness_by_account(witness_account_name);
1966 FC_ASSERT(wit->owner == witness_account_name);
1972 op.
owner = witness_account_name;
1980 return my->sign_transaction(tx, broadcast);
1984 const std::string& witness_to_vote_for,
1993 op.
witness = witness_to_vote_for;
2000 return my->sign_transaction(tx, broadcast);
2002 FC_CAPTURE_AND_RETHROW((voting_account)(witness_to_vote_for)(approve)(broadcast))
2007 std::vector<public_key_type> keys;
2012 keys.push_back(fc::ecc::extended_private_key::from_base58(memo).get_public_key());
2014 catch (fc::parse_error_exception&)
2017 catch (fc::assert_exception&)
2022 std::string owner_seed = account.
name +
"owner" + memo;
2023 auto owner_secret = fc::sha256::hash(owner_seed.c_str(), owner_seed.size());
2024 keys.push_back(fc::ecc::private_key::regenerate(owner_secret).get_public_key());
2026 std::string active_seed = account.
name +
"active" + memo;
2027 auto active_secret = fc::sha256::hash(active_seed.c_str(), active_seed.size());
2028 keys.push_back(fc::ecc::private_key::regenerate(active_secret).get_public_key());
2030 std::string posting_seed = account.
name +
"posting" + memo;
2031 auto posting_secret = fc::sha256::hash(posting_seed.c_str(), posting_seed.size());
2032 keys.push_back(fc::ecc::private_key::regenerate(posting_secret).get_public_key());
2037 for (
auto& key : keys)
2038 FC_ASSERT(key_weight_pair.first != key,
2039 "Detected private owner key in memo field. Cancelling transaction.");
2044 for (
auto& key : keys)
2045 FC_ASSERT(key_weight_pair.first != key,
2046 "Detected private active key in memo field. Cancelling transaction.");
2051 for (
auto& key : keys)
2052 FC_ASSERT(key_weight_pair.first != key,
2053 "Detected private posting key in memo field. Cancelling transaction.");
2056 const auto& memo_key = account.
memo_key;
2057 for (
auto& key : keys)
2058 FC_ASSERT(memo_key != key,
"Detected private memo key in memo field. Cancelling transaction.");
2061 for (
auto& key_pair : my->_keys)
2063 for (
auto& key : keys)
2064 FC_ASSERT(key != key_pair.first,
"Detected imported private key in memo field. Cancelling trasanction.");
2071 if (memo.size() > 0 && memo[0] ==
'#')
2078 m.
from = from_account.memo_key;
2079 m.
to = to_account.memo_key;
2080 m.
nonce = fc::time_point::now().time_since_epoch().count();
2082 auto from_priv = my->get_private_key(m.
from);
2083 auto shared_secret = from_priv.get_shared_secret(m.
to);
2085 fc::sha512::encoder enc;
2086 fc::raw::pack(enc, m.
nonce);
2087 fc::raw::pack(enc, shared_secret);
2088 auto encrypt_key = enc.result();
2090 m.
encrypted = fc::aes_encrypt(encrypt_key, fc::raw::pack(memo.substr(1)));
2091 m.
check = fc::sha256::hash(encrypt_key)._hash[0];
2101 const std::string& from,
const std::string& to,
const asset& amount,
const std::string& memo,
bool broadcast)
2118 return my->sign_transaction(tx, broadcast);
2120 FC_CAPTURE_AND_RETHROW((from)(to)(amount)(memo)(broadcast))
2124 const std::string& to,
2125 const std::string& agent,
2127 const asset& scorum_amount,
2129 time_point_sec ratification_deadline,
2130 time_point_sec escrow_expiration,
2131 const std::string& json_meta,
2150 return my->sign_transaction(tx, broadcast);
2154 const std::string& to,
2155 const std::string& agent,
2156 const std::string& who,
2173 return my->sign_transaction(tx, broadcast);
2177 const std::string& to,
2178 const std::string& agent,
2179 const std::string& who,
2195 return my->sign_transaction(tx, broadcast);
2199 const std::string& to,
2200 const std::string& agent,
2201 const std::string& who,
2202 const std::string& receiver,
2204 const asset& scorum_amount,
2220 return my->sign_transaction(tx, broadcast);
2229 op.
to = (to == from ?
"" : to);
2236 return my->sign_transaction(tx, broadcast);
2251 return my->sign_transaction(tx, broadcast);
2255 const std::string& from,
const std::string& to, uint16_t percent,
bool auto_vest,
bool broadcast)
2268 return my->sign_transaction(tx, broadcast);
2274 return encrypted_memo;
2276 if (encrypted_memo.size() && encrypted_memo[0] ==
'#')
2281 fc::sha512 shared_secret;
2282 auto from_key = my->try_get_private_key(m->from);
2285 auto to_key = my->try_get_private_key(m->to);
2287 return encrypted_memo;
2288 shared_secret = to_key->get_shared_secret(m->from);
2292 shared_secret = from_key->get_shared_secret(m->to);
2294 fc::sha512::encoder enc;
2295 fc::raw::pack(enc, m->nonce);
2296 fc::raw::pack(enc, shared_secret);
2297 auto encryption_key = enc.result();
2299 uint32_t check = fc::sha256::hash(encryption_key)._hash[0];
2300 if (check != m->check)
2301 return encrypted_memo;
2305 std::vector<char> decrypted = fc::aes_decrypt(encryption_key, m->encrypted);
2306 return fc::raw::unpack<std::string>(decrypted);
2313 return encrypted_memo;
2327 return my->sign_transaction(tx, broadcast);
2330 std::map<uint32_t, applied_operation>
2333 FC_ASSERT(!
is_locked(),
"Wallet must be unlocked to get account history");
2335 std::map<uint32_t, applied_operation>
result;
2337 my->use_remote_account_history_api();
2341 for (
auto& item :
result)
2343 if (item.second.op.which() == operation::tag<transfer_operation>::value)
2353 std::map<uint32_t, applied_operation>
2356 FC_ASSERT(!
is_locked(),
"Wallet must be unlocked to get account history");
2358 std::map<uint32_t, applied_operation>
result;
2360 my->use_remote_account_history_api();
2364 for (
auto& item :
result)
2372 std::map<uint32_t, applied_operation>
2375 FC_ASSERT(!
is_locked(),
"Wallet must be unlocked to get account history");
2377 std::map<uint32_t, applied_operation>
result;
2379 my->use_remote_account_history_api();
2383 for (
auto& item :
result)
2391 std::map<uint32_t, applied_withdraw_operation>
2394 FC_ASSERT(!
is_locked(),
"Wallet must be unlocked to get account history");
2395 my->use_remote_account_history_api();
2399 for (
auto& item :
result)
2409 FC_ASSERT(!
is_locked(),
"Wallet must be unlocked to get devcommittee history");
2410 my->use_remote_devcommittee_history_api();
2412 auto result = (*my->_remote_devcommittee_history_api)->get_history(from, limit);
2419 FC_ASSERT(!
is_locked(),
"Wallet must be unlocked to get devcommittee history");
2420 my->use_remote_devcommittee_history_api();
2422 auto result = (*my->_remote_devcommittee_history_api)->get_scr_to_scr_transfers(from, limit);
2429 FC_ASSERT(!
is_locked(),
"Wallet must be unlocked to get devcommittee history");
2430 my->use_remote_devcommittee_history_api();
2432 auto result = (*my->_remote_devcommittee_history_api)->get_sp_to_scr_transfers(from, limit);
2439 return my->_remote_db->get_withdraw_routes(account, type);
2443 const std::string& permlink,
2444 const std::string& parent_author,
2445 const std::string& parent_permlink,
2446 const std::string& title,
2447 const std::string& body,
2448 const std::string& json,
2465 return my->sign_transaction(tx, broadcast);
2469 const std::string& voter,
const std::string& author,
const std::string& permlink, int16_t weight,
bool broadcast)
2472 FC_ASSERT(abs(weight) <= 10000,
"Weight must be between -10 000 and 10 000 and not 0");
2484 return my->sign_transaction(tx, broadcast);
2489 my->set_transaction_expiration(seconds);
2496 FC_ASSERT(
false,
"Challenge is disabled");
2525 return my->sign_transaction(tx, broadcast);
2530 my->use_remote_blockchain_history_api();
2532 return (*my->_remote_blockchain_history_api)->get_transaction(
id);
2539 my->use_remote_account_by_key_api();
2541 std::vector<public_key_type> pub_keys;
2542 pub_keys.reserve(my->_keys.size());
2544 for (
const auto& item : my->_keys)
2545 pub_keys.push_back(item.first);
2547 auto refs = (*my->_remote_account_by_key_api)->get_key_references(pub_keys);
2548 std::set<std::string> names;
2549 for (
const auto& item : refs)
2550 for (
const auto& name : item)
2553 std::vector<budget_api_obj> ret;
2557 std::copy(budgets.begin(), budgets.end(), std::back_inserter(ret));
2560 auto budgets = my->_remote_db->get_budgets(budget_type::banner, names);
2561 std::copy(budgets.begin(), budgets.end(), std::back_inserter(ret));
2569 return my->_remote_db->lookup_budget_owners(
budget_type::post, lowerbound, limit);
2574 return my->_remote_db->lookup_budget_owners(budget_type::banner, lowerbound, limit);
2588 return my->_remote_db->get_budgets(budget_type::banner, { account_name });
2593 const std::string& json_metadata,
2594 const asset& balance,
2595 const time_point_sec& start,
2596 const time_point_sec& deadline,
2597 const bool broadcast)
2615 return my->sign_transaction(tx, broadcast);
2620 const std::string& json_metadata,
2621 const asset& balance,
2622 const time_point_sec& start,
2623 const time_point_sec& deadline,
2624 const bool broadcast)
2630 op.
type = budget_type::banner;
2642 return my->sign_transaction(tx, broadcast);
2645 template <budget_type budget_type_v>
2652 op.
type = budget_type_v;
2663 const std::string& json_metadata,
2664 const bool broadcast)
2666 auto tx = update_budget<budget_type::banner>(
owner, uuid, json_metadata);
2667 return my->sign_transaction(tx, broadcast);
2672 const std::string& json_metadata,
2673 const bool broadcast)
2675 auto tx = update_budget<budget_type::post>(
owner, uuid, json_metadata);
2676 return my->sign_transaction(tx, broadcast);
2694 return my->sign_transaction(tx, broadcast);
2704 op.
type = budget_type::banner;
2712 return my->sign_transaction(tx, broadcast);
2716 const std::string& moderator,
2717 const bool broadcast)
2731 return my->sign_transaction(tx, broadcast);
2735 const std::string& moderator,
2736 const bool broadcast)
2742 op.
type = budget_type::banner;
2750 return my->sign_transaction(tx, broadcast);
2753 template <
typename T,
typename C>
2771 annotated_signed_transaction
2782 return my->sign_transaction(tx, broadcast);
2786 const std::string& invitee,
2787 uint32_t lifetime_sec,
2793 = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) { o.account_name = invitee; });
2795 return my->sign_transaction(tx, broadcast);
2799 const std::string& dropout,
2800 uint32_t lifetime_sec,
2806 = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) { o.account_name = dropout; });
2808 return my->sign_transaction(tx, broadcast);
2813 return my->_remote_db->lookup_registration_committee_members(lowerbound, limit);
2818 return my->_remote_db->get_registration_committee();
2823 return my->_remote_db->lookup_proposals();
2827 uint64_t quorum_percent,
2828 uint32_t lifetime_sec,
2833 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
2834 o.quorum = quorum_percent;
2838 return my->sign_transaction(tx, broadcast);
2842 const std::string& initiator, uint64_t quorum_percent, uint32_t lifetime_sec,
bool broadcast)
2846 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
2847 o.quorum = quorum_percent;
2851 return my->sign_transaction(tx, broadcast);
2855 uint64_t quorum_percent,
2856 uint32_t lifetime_sec,
2861 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
2862 o.quorum = quorum_percent;
2866 return my->sign_transaction(tx, broadcast);
2870 const std::string& invitee,
2871 uint32_t lifetime_sec,
2877 = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) { o.account_name = invitee; });
2879 return my->sign_transaction(tx, broadcast);
2883 const std::string& dropout,
2884 uint32_t lifetime_sec,
2890 = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) { o.account_name = dropout; });
2892 return my->sign_transaction(tx, broadcast);
2897 return my->_remote_db->lookup_development_committee_members(lowerbound, limit);
2901 uint64_t quorum_percent,
2902 uint32_t lifetime_sec,
2907 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
2908 o.quorum = quorum_percent;
2912 return my->sign_transaction(tx, broadcast);
2916 const std::string& initiator, uint64_t quorum_percent, uint32_t lifetime_sec,
bool broadcast)
2920 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
2921 o.quorum = quorum_percent;
2925 return my->sign_transaction(tx, broadcast);
2929 uint64_t quorum_percent,
2930 uint32_t lifetime_sec,
2935 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
2936 o.quorum = quorum_percent;
2940 return my->sign_transaction(tx, broadcast);
2944 uint64_t quorum_percent,
2945 uint32_t lifetime_sec,
2950 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
2951 o.quorum = quorum_percent;
2955 return my->sign_transaction(tx, broadcast);
2959 const std::string& initiator, uint64_t quorum_percent, uint32_t lifetime_sec,
bool broadcast)
2963 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
2964 o.quorum = quorum_percent;
2968 return my->sign_transaction(tx, broadcast);
2972 const std::string& initiator, uint64_t quorum_percent, uint32_t lifetime_sec,
bool broadcast)
2976 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
2977 o.quorum = quorum_percent;
2981 return my->sign_transaction(tx, broadcast);
2985 const std::string& initiator, uint64_t quorum_percent, uint32_t lifetime_sec,
bool broadcast)
2989 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
2990 o.quorum = quorum_percent;
2994 return my->sign_transaction(tx, broadcast);
2998 const std::string& initiator,
const std::string& moderator, uint32_t lifetime_sec,
bool broadcast)
3003 = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) { o.account = moderator; });
3005 return my->sign_transaction(tx, broadcast);
3009 const std::string& moderator,
3010 uint32_t lifetime_sec,
3016 = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) { o.account = moderator; });
3018 return my->sign_transaction(tx, broadcast);
3022 const std::string& initiator, uint32_t delay_sec, uint32_t lifetime_sec,
bool broadcast)
3027 = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) { o.delay_sec = delay_sec; });
3029 return my->sign_transaction(tx, broadcast);
3033 const std::string& initiator,
const std::string& to_account,
asset amount, uint32_t lifetime_sec,
bool broadcast)
3037 signed_transaction tx = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) {
3038 o.to_account = to_account;
3042 return my->sign_transaction(tx, broadcast);
3047 uint32_t lifetime_sec,
3053 = proposal<operation_type>(initiator, lifetime_sec, [&](operation_type& o) { o.vesting_shares = amount; });
3055 return my->sign_transaction(tx, broadcast);
3060 const std::vector<percent_type>& auction_coefficients,
3061 uint32_t lifetime_sec,
3067 initiator, lifetime_sec, [&](operation_type& o) { o.auction_coefficients = auction_coefficients; });
3069 return my->sign_transaction(tx, broadcast);
3074 const std::vector<percent_type>& auction_coefficients,
3075 uint32_t lifetime_sec,
3081 initiator, lifetime_sec, [&](operation_type& o) { o.auction_coefficients = auction_coefficients; });
3083 return my->sign_transaction(tx, broadcast);
3088 return my->_remote_db->get_development_committee();
3092 const std::string& participant,
3093 const asset& amount,
3094 const std::string& metadata,
3095 const uint8_t secret_length,
3096 const bool broadcast)
3110 op.
owner = initiator;
3120 auto ret = my->sign_transaction(tx, broadcast);
3126 const std::string& participant,
3127 const std::string& initiator,
3128 const asset& amount,
3129 const std::string& metadata,
3130 const bool broadcast)
3137 op.
owner = participant;
3147 auto ret = my->sign_transaction(tx, broadcast);
3153 const std::string& to,
3154 const std::string& secret,
3155 const bool broadcast)
3169 return my->sign_transaction(tx, broadcast);
3175 return my->_remote_db->get_atomicswap_contract(from, to, secret_hash);
3184 FC_ASSERT(!contract_info.
secret.empty(),
"Contract is not redeemed.");
3186 return contract_info.
secret;
3190 const std::string& initiator,
3191 const std::string& secret_hash,
3192 const bool broadcast)
3206 return my->sign_transaction(tx, broadcast);
3211 std::vector<atomicswap_contract_api_obj>
result;
3213 result = my->_remote_db->get_atomicswap_contracts(
owner);
3220 const std::string& json_metadata,
3221 fc::time_point_sec start_time,
3222 uint32_t auto_resolve_delay_sec,
3224 const std::vector<market_type>& markets,
3225 const bool broadcast)
3244 ret = my->sign_transaction(tx, broadcast);
3263 ret = my->sign_transaction(tx, broadcast);
3270 const std::vector<market_type>& markets,
3271 const bool broadcast)
3286 ret = my->sign_transaction(tx, broadcast);
3293 fc::time_point_sec start_time,
3294 const bool broadcast)
3309 ret = my->sign_transaction(tx, broadcast);
3316 const std::vector<wincase_type>& wincases,
3317 const bool broadcast)
3332 ret = my->sign_transaction(tx, broadcast);
3344 const bool broadcast)
3362 return my->sign_transaction(tx, broadcast);
3379 return my->sign_transaction(tx, broadcast);
3389 return my->_chain_api->get_chain_capital();
3478 const std::string& name,
3479 int32_t initial_power,
3480 const std::string& json_meta,
3481 const bool broadcast)
const
3496 return my->sign_transaction(tx, broadcast);
3501 const std::string& json_meta,
3502 const bool broadcast)
const
3515 return my->sign_transaction(tx, broadcast);
3521 bool broadcast)
const
3534 return my->sign_transaction(tx, broadcast);
3539 const std::string& name,
3540 const bool broadcast)
const
3553 return my->sign_transaction(tx, broadcast);
3582 const std::string& verification_key,
3583 const std::string& seed,
3584 const bool broadcast)
const
3598 return my->sign_transaction(tx, broadcast);
3603 const std::string& proof,
3604 const std::string& vrf,
3606 const bool broadcast)
const
3621 return my->sign_transaction(tx, broadcast);
#define API_ACCOUNT_HISTORY
#define API_BLOCKCHAIN_HISTORY
The chain_api class shows blockchain entrails.
The network_broadcast_api class allows broadcasting of transactions.
The network_node_api class allows maintenance of p2p connections.
std::map< std::string, std::function< std::string(fc::variant, const fc::variants &)> > get_result_formatters() const
std::vector< variant > network_get_connected_peers()
optional< witness_api_obj > get_witness(const std::string &owner_account)
signed_transaction create_account_with_private_key(fc::ecc::private_key owner_privkey, const std::string &account_name, const std::string &creator_account_name, bool broadcast=false, bool save_wallet=true)
virtual ~wallet_api_impl()
optional< fc::api< network_node_api > > _remote_net_node
optional< fc::api< account_by_key::account_by_key_api > > _remote_account_by_key_api
operation get_prototype_operation(const std::string &operation_name)
std::map< public_key_type, std::string > _keys
bool import_key(const std::string &wif_key)
variant_object about() const
std::string print_atomicswap_secret2str(const std::string &secret) const
void use_remote_account_by_key_api()
signed_transaction set_voting_proxy(const std::string &account_to_modify, const std::string &proxy, bool broadcast)
optional< fc::ecc::private_key > try_get_private_key(const public_key_type &id) const
void use_remote_blockchain_history_api()
void use_remote_devcommittee_history_api()
bool copy_wallet_file(const std::string &destination_filename)
fc::ecc::private_key get_private_key_for_account(const account_api_obj &account) const
wallet_api_impl(wallet_api &s, const wallet_data &initial_data, fc::api< login_api > rapi)
int find_first_unused_derived_key_index(const fc::ecc::private_key &parent_key)
optional< fc::api< blockchain_history::blockchain_history_api > > _remote_blockchain_history_api
std::string get_wallet_filename() const
optional< fc::api< blockchain_history::account_history_api > > _remote_account_history_api
void use_remote_account_history_api()
void save_wallet_file(std::string wallet_filename="")
fc::api< database_api > _remote_db
annotated_signed_transaction sign_transaction(signed_transaction tx, bool broadcast=false)
fc::api< chain_api > _chain_api
std::string _wallet_filename
flat_map< std::string, operation > _prototype_ops
std::string print_atomicswap_contract2str(const atomicswap_contract_info_api_obj &rt) const
api_documentation method_documentation
fc::api< network_broadcast_api > _remote_net_broadcast
fc::ecc::private_key get_private_key(const public_key_type &id) const
bool load_wallet_file(std::string wallet_filename="")
void network_add_nodes(const std::vector< std::string > &nodes)
void use_network_node_api()
fc::api< login_api > _remote_api
account_api_obj get_account(const std::string &account_name) const
optional< fc::api< blockchain_history::devcommittee_history_api > > _remote_devcommittee_history_api
void set_transaction_expiration(uint32_t tx_expiration_seconds)
std::function< void()> exit_func_type
std::map< std::string, std::function< std::string(fc::variant, const fc::variants &)> > get_result_formatters() const
void set_exit_func(exit_func_type)
void check_memo(const std::string &memo, const account_api_obj &account) const
bool copy_wallet_file(const std::string &destination_filename)
wallet_api(const wallet_data &initial_data, fc::api< login_api > rapi)
#define SCORUM_CREATE_ACCOUNT_WITH_SCORUM_MODIFIER
#define SCORUM_BLOCKCHAIN_VERSION
#define SCORUM_MAX_TIME_UNTIL_EXPIRATION
#define API_DEVCOMMITTEE_HISTORY
std::vector< pending_bet_api_object > lookup_pending_bets(chain::pending_bet_id_type from, uint32_t limit) const
Return pending bets.
std::vector< winner_api_object > get_game_winners(const uuid_type &game_uuid) const
Returns all winners for particular game.
std::vector< pending_bet_api_object > get_game_pending_bets(const uuid_type &uuid) const
Return pending bets for game.
std::vector< pending_bet_api_object > get_pending_bets(const std::vector< uuid_type > &uuids) const
Return pending bets.
std::vector< matched_bet_api_object > get_game_returns(const uuid_type &game_uuid) const
Returns bets with draw status.
std::vector< matched_bet_api_object > lookup_matched_bets(chain::matched_bet_id_type from, uint32_t limit) const
Returns matched bets.
betting_property_api_object get_betting_properties() const
Return betting properties.
std::vector< game_api_object > lookup_games_by_id(chain::game_id_type from, uint32_t limit) const
Returns games.
std::vector< game_api_object > get_games_by_uuids(const std::vector< uuid_type > &uuids) const
Returns games.
std::vector< matched_bet_api_object > get_game_matched_bets(const uuid_type &uuid) const
Returns matched bets for game.
std::vector< game_api_object > get_games_by_status(const fc::flat_set< chain::game_status > &filter) const
Returns games.
std::vector< matched_bet_api_object > get_matched_bets(const std::vector< uuid_type > &uuids) const
Returns matched bets.
std::vector< nft_api_obj > lookup_nft(int64_t from, uint32_t limit) const
Retrieve list of NFT objects in range [from, from+limit-1].
game_round_api_obj get_game_round_by_uuid(const uuid_type &uuid) const
Get game round by uuid object.
nft_api_obj get_nft_by_name(const account_name_type &name) const
Get NFT object by name.
nft_api_obj get_nft_by_id(int64_t id) const
Get NFT object by id.
nft_api_obj get_nft_by_uuid(const uuid_type &uuid) const
Get NFT object by uuid.
std::vector< game_round_api_obj > lookup_game_round(int64_t id, uint32_t limit) const
Retrieve list of game rounds in range [from, from+limit-1].
annotated_signed_transaction close_budget_for_post_by_moderator(const uuid_type &uuid, const std::string &moderator, bool broadcast)
annotated_signed_transaction create_budget_for_banner(const std::string &owner, const uuid_type &uuid, const std::string &json_metadata, const asset &balance, const time_point_sec &start, const time_point_sec &deadline, bool broadcast)
annotated_signed_transaction close_budget_for_banner_by_moderator(const uuid_type &uuid, const std::string &moderator, bool broadcast)
annotated_signed_transaction update_budget_for_post(const std::string &owner, const uuid_type &uuid, const std::string &json_metadata, bool broadcast)
std::vector< budget_api_obj > list_my_budgets()
annotated_signed_transaction close_budget_for_post(const uuid_type &uuid, const std::string &owner, bool broadcast)
annotated_signed_transaction close_budget_for_banner(const uuid_type &uuid, const std::string &owner, bool broadcast)
std::vector< budget_api_obj > get_banner_budgets(const std::string &account_name)
std::vector< budget_api_obj > get_post_budgets(const std::string &account_name)
annotated_signed_transaction create_budget_for_post(const std::string &owner, const uuid_type &uuid, const std::string &json_metadata, const asset &balance, const time_point_sec &start, const time_point_sec &deadline, bool broadcast)
std::set< std::string > list_post_budget_owners(const std::string &lowerbound, uint32_t limit)
annotated_signed_transaction update_budget_for_banner(const std::string &owner, const uuid_type &uuid, const std::string &json_metadata, bool broadcast)
std::set< std::string > list_banner_budget_owners(const std::string &lowerbound, uint32_t limit)
atomicswap_contract_result_api_obj atomicswap_initiate(const std::string &initiator, const std::string &participant, const asset &amount, const std::string &metadata, const uint8_t secret_length, bool broadcast)
atomicswap_contract_info_api_obj atomicswap_auditcontract(const std::string &from, const std::string &to, const std::string &secret_hash)
annotated_signed_transaction atomicswap_redeem(const std::string &from, const std::string &to, const std::string &secret, bool broadcast)
std::vector< atomicswap_contract_api_obj > get_atomicswap_contracts(const std::string &owner)
atomicswap_contract_result_api_obj atomicswap_participate(const std::string &secret_hash, const std::string &participant, const std::string &initiator, const asset &amount, const std::string &metadata, bool broadcast)
annotated_signed_transaction atomicswap_refund(const std::string &participant, const std::string &initiator, const std::string &secret_hash, bool broadcast)
std::string atomicswap_extractsecret(const std::string &from, const std::string &to, const std::string &secret_hash)
std::vector< winner_api_object > get_game_winners(const uuid_type &game_uuid) const
std::vector< pending_bet_api_object > get_game_pending_bets(const uuid_type &uuid) const
annotated_signed_transaction cancel_pending_bets(account_name_type better, const std::vector< uuid_type > &bet_uuids, bool broadcast)
annotated_signed_transaction cancel_game(uuid_type uuid, account_name_type moderator, bool broadcast)
std::vector< pending_bet_api_object > get_pending_bets(const std::vector< uuid_type > &uuids) const
std::vector< matched_bet_api_object > get_game_returns(const uuid_type &game_uuid) const
annotated_signed_transaction update_game_markets(uuid_type uuid, account_name_type moderator, const std::vector< market_type > &markets, bool broadcast)
annotated_signed_transaction post_bet(uuid_type uuid, account_name_type better, uuid_type game_uuid, wincase_type wincase, odds_input odds, asset stake, bool is_live, bool broadcast)
std::vector< pending_bet_api_object > lookup_pending_bets(pending_bet_id_type from, int64_t limit) const
annotated_signed_transaction update_game_start_time(uuid_type uuid, account_name_type moderator, fc::time_point_sec start_time, bool broadcast)
std::vector< matched_bet_api_object > get_matched_bets(const std::vector< uuid_type > &uuids) const
betting_property_api_object get_betting_properties() const
std::vector< matched_bet_api_object > lookup_matched_bets(matched_bet_id_type from, int64_t limit) const
std::vector< game_api_object > get_games_by_uuids(const std::vector< uuid_type > &uuids) const
annotated_signed_transaction create_game(uuid_type uuid, account_name_type moderator, const std::string &json_metadata, fc::time_point_sec start_time, uint32_t auto_resolve_delay_sec, game_type game, const std::vector< market_type > &markets, bool broadcast)
std::vector< matched_bet_api_object > get_game_matched_bets(const uuid_type &uuid) const
std::vector< game_api_object > get_games_by_status(const fc::flat_set< game_status > &filter) const
std::vector< game_api_object > lookup_games_by_id(game_id_type from, uint32_t limit) const
annotated_signed_transaction post_game_results(uuid_type uuid, account_name_type moderator, const std::vector< wincase_type > &wincases, bool broadcast)
std::vector< applied_operation > get_devcommittee_history(uint64_t from, uint32_t limit)
annotated_signed_transaction development_committee_change_base_quorum(const std::string &creator, uint64_t quorum_percent, uint32_t lifetime_sec, bool broadcast)
registration_committee_api_obj get_registration_committee()
annotated_signed_transaction registration_committee_change_exclude_member_quorum(const std::string &creator, uint64_t quorum_percent, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction development_committee_empower_betting_moderator(const std::string &initiator, const std::string &moderator, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction development_committee_add_member(const std::string &initiator, const std::string &invitee, uint32_t lifetime_sec, bool broadcast)
development_committee_api_obj get_development_committee()
annotated_signed_transaction development_committee_change_add_member_quorum(const std::string &creator, uint64_t quorum_percent, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction development_committee_change_betting_moderator_quorum(const std::string &creator, uint64_t quorum_percent, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction vote_for_committee_proposal(const std::string &account_to_vote_with, int64_t proposal_id, bool broadcast)
annotated_signed_transaction registration_committee_change_add_member_quorum(const std::string &creator, uint64_t quorum_percent, uint32_t lifetime_sec, bool broadcast)
std::set< account_name_type > list_registration_committee(const std::string &lowerbound, uint32_t limit)
annotated_signed_transaction development_committee_change_transfer_quorum(const std::string &creator, uint64_t quorum_percent, uint32_t lifetime_sec, bool broadcast)
std::vector< applied_withdraw_operation > get_devcommittee_sp_to_scr_transfers(uint64_t from, uint32_t limit)
annotated_signed_transaction development_committee_change_betting_resolve_delay(const std::string &initiator, uint32_t delay_sec, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction development_committee_change_advertising_moderator_quorum(const std::string &creator, uint64_t quorum_percent, uint32_t lifetime_sec, bool broadcast)
std::vector< applied_operation > get_devcommittee_scr_to_scr_transfers(uint64_t from, uint32_t limit)
annotated_signed_transaction development_committee_change_budget_auction_properties_quorum(const std::string &creator, uint64_t quorum_percent, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction registration_committee_exclude_member(const std::string &initiator, const std::string &dropout, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction registration_committee_change_base_quorum(const std::string &creator, uint64_t quorum_percent, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction development_committee_change_exclude_member_quorum(const std::string &creator, uint64_t quorum_percent, uint32_t lifetime_sec, bool broadcast)
std::set< account_name_type > list_development_committee(const std::string &lowerbound, uint32_t limit)
annotated_signed_transaction development_committee_empower_advertising_moderator(const std::string &initiator, const std::string &moderator, uint32_t lifetime_sec, bool broadcast)
std::vector< proposal_api_obj > list_proposals()
annotated_signed_transaction development_pool_transfer(const std::string &initiator, const std::string &to_account, asset amount, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction registration_committee_add_member(const std::string &inviter, const std::string &invitee, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction development_committee_exclude_member(const std::string &initiator, const std::string &dropout, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction development_pool_withdraw_vesting(const std::string &initiator, asset amount, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction development_pool_post_budgets_auction_properties(const std::string &initiator, const std::vector< percent_type > &, uint32_t lifetime_sec, bool broadcast)
annotated_signed_transaction development_pool_banner_budgets_auction_properties(const std::string &initiator, const std::vector< percent_type > &, uint32_t lifetime_sec, bool broadcast)
void set_transaction_expiration(uint32_t seconds)
annotated_signed_transaction sign_transaction(const signed_transaction &tx, bool broadcast=false)
operation get_prototype_operation(const std::string &operation_type)
std::string serialize_transaction(const signed_transaction &tx) const
void network_add_nodes(const std::vector< std::string > &nodes)
std::vector< variant > network_get_connected_peers()
std::map< uint32_t, applied_operation > get_ops_in_block(uint32_t block_num, applied_operation_type type_of_operation) const
std::map< uint32_t, block_header > get_block_headers_history(uint32_t num, uint32_t limit) const
std::vector< block_api_object > get_blocks(uint32_t from, uint32_t limit) const
std::map< uint32_t, applied_operation > get_ops_history_by_time(const fc::time_point_sec &from, const fc::time_point_sec &to, uint32_t from_op, uint32_t limit) const
std::map< uint32_t, signed_block_api_obj > get_blocks_history(uint32_t num, uint32_t limit) const
std::map< uint32_t, applied_operation > get_ops_history(uint32_t from_op, uint32_t limit, applied_operation_type type_of_operation) const
optional< block_header > get_block_header(uint32_t num) const
optional< signed_block_api_obj > get_block(uint32_t num) const
bool import_key(const std::string &wif_key)
brain_key_info suggest_brain_key() const
std::map< public_key_type, std::string > list_keys()
std::pair< public_key_type, std::string > get_private_key_from_password(const std::string &account, const std::string &role, const std::string &password) const
std::string get_private_key(const public_key_type &pubkey) const
std::string normalize_brain_key(const std::string &s) const
std::map< uint32_t, applied_operation > get_account_scr_to_sp_transfers(const std::string &account, uint64_t from, uint32_t limit)
annotated_signed_transaction withdraw_scorumpower(const std::string &from, const asset &scorumpower, bool broadcast=false)
optional< witness_api_obj > get_witness(const std::string &owner_account)
annotated_signed_transaction challenge(const std::string &challenger, const std::string &challenged, bool broadcast)
annotated_signed_transaction decline_voting_rights(const std::string &account, bool decline, bool broadcast)
annotated_signed_transaction update_account_memo_key(const std::string &account_name, const public_key_type &key, bool broadcast)
annotated_signed_transaction change_recovery_account(const std::string &owner, const std::string &new_recovery_account, bool broadcast)
annotated_signed_transaction escrow_release(const std::string &from, const std::string &to, const std::string &agent, const std::string &who, const std::string &receiver, uint32_t escrow_id, const asset &scorum_amount, bool broadcast=false)
account_api_obj get_account(const std::string &account_name) const
annotated_signed_transaction vote(const std::string &voter, const std::string &author, const std::string &permlink, int16_t weight, bool broadcast)
annotated_signed_transaction create_account_with_keys(const std::string &creator, const std::string &newname, const std::string &json_meta, const public_key_type &owner, const public_key_type &active, const public_key_type &posting, const public_key_type &memo, bool broadcast) const
annotated_signed_transaction get_transaction(transaction_id_type trx_id) const
std::map< uint32_t, applied_withdraw_operation > get_account_sp_to_scr_transfers(const std::string &account, uint64_t from, uint32_t limit)
annotated_signed_transaction create_account_with_keys_delegated(const std::string &creator, const asset &scorum_fee, const asset &delegated_scorumpower, const std::string &newname, const std::string &json_meta, const public_key_type &owner, const public_key_type &active, const public_key_type &posting, const public_key_type &memo, bool broadcast) const
std::map< uint32_t, applied_operation > get_account_history(const std::string &account, uint64_t from, uint32_t limit)
annotated_signed_transaction create_account(const std::string &creator, const std::string &newname, const std::string &json_meta, bool broadcast)
std::vector< withdraw_route > get_withdraw_routes(const std::string &account, withdraw_route_type type=all) const
annotated_signed_transaction update_account(const std::string &accountname, const std::string &json_meta, const public_key_type &owner, const public_key_type &active, const public_key_type &posting, const public_key_type &memo, bool broadcast) const
annotated_signed_transaction create_account_delegated(const std::string &creator, const asset &scorum_fee, const asset &delegated_scorumpower, const std::string &new_account_name, const std::string &json_meta, bool broadcast)
annotated_signed_transaction escrow_dispute(const std::string &from, const std::string &to, const std::string &agent, const std::string &who, uint32_t escrow_id, bool broadcast=false)
annotated_signed_transaction transfer_to_scorumpower(const std::string &from, const std::string &to, const asset &amount, bool broadcast=false)
annotated_signed_transaction update_account_auth_key(const std::string &account_name, const authority_type &type, const public_key_type &key, authority_weight_type weight, bool broadcast)
annotated_signed_transaction update_witness(const std::string &witness_name, const std::string &url, const public_key_type &block_signing_key, const chain_properties &props, bool broadcast=false)
std::set< std::string > list_accounts(const std::string &lowerbound, uint32_t limit)
annotated_signed_transaction update_account_meta(const std::string &account_name, const std::string &json_meta, bool broadcast)
annotated_signed_transaction post_comment(const std::string &author, const std::string &permlink, const std::string &parent_author, const std::string &parent_permlink, const std::string &title, const std::string &body, const std::string &json, bool broadcast)
std::vector< owner_authority_history_api_obj > get_owner_history(const std::string &account) const
Get the owner history object.
annotated_signed_transaction update_account_auth_threshold(const std::string &account_name, authority_type type, uint32_t threshold, bool broadcast)
annotated_signed_transaction request_account_recovery(const std::string &recovery_account, const std::string &account_to_recover, const authority &new_authority, bool broadcast)
annotated_signed_transaction set_voting_proxy(const std::string &account_to_modify, const std::string &proxy, bool broadcast=false)
annotated_signed_transaction create_account_by_committee_with_keys(const std::string &creator, const std::string &newname, const std::string &json_meta, const public_key_type &owner, const public_key_type &active, const public_key_type &posting, const public_key_type &memo, bool broadcast) const
std::vector< account_api_obj > list_my_accounts()
chain_capital_api_obj get_chain_capital() const
annotated_signed_transaction delegate_scorumpower_from_reg_pool(const std::string ®_committee_member, const std::string &delegatee, const asset &scorumpower, bool broadcast)
annotated_signed_transaction prove(const std::string &challenged, bool broadcast)
annotated_signed_transaction set_withdraw_scorumpower_route(const std::string &from, const std::string &to, uint16_t percent, bool auto_vest, bool broadcast=false)
annotated_signed_transaction create_account_by_committee(const std::string &creator, const std::string &newname, const std::string &json_meta, bool broadcast)
std::string decrypt_memo(const std::string &memo)
annotated_signed_transaction recover_account(const std::string &account_to_recover, const authority &recent_authority, const authority &new_authority, bool broadcast)
std::map< uint32_t, applied_operation > get_account_scr_to_scr_transfers(const std::string &account, uint64_t from, uint32_t limit)
account_balance_info_api_obj get_account_balance(const std::string &account_name) const
annotated_signed_transaction vote_for_witness(const std::string &account_to_vote_with, const std::string &witness_to_vote_for, bool approve=true, bool broadcast=false)
annotated_signed_transaction escrow_approve(const std::string &from, const std::string &to, const std::string &agent, const std::string &who, uint32_t escrow_id, bool approve, bool broadcast=false)
annotated_signed_transaction delegate_scorumpower(const std::string &delegator, const std::string &delegatee, const asset &scorumpower, bool broadcast)
annotated_signed_transaction transfer(const std::string &from, const std::string &to, const asset &amount, const std::string &memo, bool broadcast=false)
annotated_signed_transaction update_account_auth_account(const std::string &account_name, authority_type type, const std::string &auth_account, authority_weight_type weight, bool broadcast)
std::vector< account_name_type > get_active_witnesses() const
std::string get_encrypted_memo(const std::string &from, const std::string &to, const std::string &memo)
std::set< account_name_type > list_witnesses(const std::string &lowerbound, uint32_t limit)
annotated_signed_transaction escrow_transfer(const std::string &from, const std::string &to, const std::string &agent, uint32_t escrow_id, const asset &scorum_amount, const asset &fee, time_point_sec ratification_deadline, time_point_sec escrow_expiration, const std::string &json_meta, bool broadcast=false)
void unlock(const std::string &password)
std::string gethelp(const std::string &method) const
void set_password(const std::string &password)
void save_wallet_file(const std::string &wallet_filename="")
std::string get_wallet_filename() const
bool load_wallet_file(const std::string &wallet_filename="")
void set_wallet_filename(const std::string &wallet_filename)
variant_object about() const
nft_api_obj get_nft_by_id(int64_t id) const
annotated_signed_transaction update_nft_name(const std::string &moderator, const uuid_type &uuid, const std::string &name, bool broadcast) const
std::vector< game_round_api_obj > lookup_game_round(int64_t from, uint32_t limit) const
annotated_signed_transaction adjust_nft_experience(const std::string &moderator, const uuid_type &uuid, int32_t experience, bool broadcast) const
annotated_signed_transaction update_game_round_result(const std::string &owner, const uuid_type &uuid, const std::string &proof, const std::string &vrf, int32_t result, bool broadcast) const
nft_api_obj get_nft_by_uuid(const uuid_type &uuid) const
game_round_api_obj get_game_round_by_uuid(const uuid_type &uuid) const
annotated_signed_transaction create_game_round(const std::string &owner, const uuid_type &uuid, const std::string &verification_key, const std::string &seed, bool broadcast) const
std::vector< nft_api_obj > lookup_nft(int64_t from, uint32_t limit) const
annotated_signed_transaction update_nft_meta(const std::string &moderator, const uuid_type &uuid, const std::string &json_meta, bool broadcast) const
annotated_signed_transaction create_nft(const std::string &owner, const uuid_type &uuid, const std::string &name, int32_t initial_power, const std::string &json_meta, bool broadcast) const
nft_api_obj get_nft_by_name(const account_name_type &name) const
void to_variant(const game_type &game, fc::variant &var)
std::string get_secret_hash(const std::string &secret_hex)
std::string get_secret_hex(const std::string &secret, const uint8_t secret_length)
development_committee_change_budgets_auction_properties_operation< budget_type::banner > development_committee_change_banner_budgets_auction_properties_operation
fc::ripemd160 transaction_id_type
fc::static_variant< vote_operation, comment_operation, transfer_operation, transfer_to_scorumpower_operation, withdraw_scorumpower_operation, account_create_by_committee_operation, account_create_operation, account_create_with_delegation_operation, account_update_operation, witness_update_operation, account_witness_vote_operation, account_witness_proxy_operation, delete_comment_operation, comment_options_operation, set_withdraw_scorumpower_route_to_account_operation, set_withdraw_scorumpower_route_to_dev_pool_operation, prove_authority_operation, request_account_recovery_operation, recover_account_operation, change_recovery_account_operation, escrow_approve_operation, escrow_dispute_operation, escrow_release_operation, escrow_transfer_operation, decline_voting_rights_operation, delegate_scorumpower_operation, create_budget_operation, close_budget_operation, proposal_vote_operation, proposal_create_operation, atomicswap_initiate_operation, atomicswap_redeem_operation, atomicswap_refund_operation, close_budget_by_advertising_moderator_operation, update_budget_operation, create_game_operation, cancel_game_operation, update_game_markets_operation, update_game_start_time_operation, post_game_results_operation, post_bet_operation, cancel_pending_bets_operation, delegate_sp_from_reg_pool_operation, create_nft_operation, update_nft_meta_operation, create_game_round_operation, update_game_round_result_operation, adjust_nft_experience_operation, update_nft_name_operation, author_reward_operation, comment_benefficiary_reward_operation, comment_payout_update_operation, comment_reward_operation, curation_reward_operation, hardfork_operation, producer_reward_operation, active_sp_holders_reward_operation, return_scorumpower_delegation_operation, shutdown_witness_operation, witness_miss_block_operation, expired_contract_refund_operation, acc_finished_vesting_withdraw_operation, devpool_finished_vesting_withdraw_operation, acc_to_acc_vesting_withdraw_operation, devpool_to_acc_vesting_withdraw_operation, acc_to_devpool_vesting_withdraw_operation, devpool_to_devpool_vesting_withdraw_operation, proposal_virtual_operation, budget_outgo_operation, budget_owner_income_operation, active_sp_holders_reward_legacy_operation, budget_closing_operation, bets_matched_operation, game_status_changed_operation, bet_resolved_operation, bet_cancelled_operation, bet_restored_operation, bet_updated_operation > operation
fc::fixed_string_16 account_name_type
uint16_t authority_weight_type
fc::static_variant< result_home::yes, result_home::no, result_draw::yes, result_draw::no, result_away::yes, result_away::no, round_home::yes, round_home::no, handicap::over, handicap::under, correct_score_home::yes, correct_score_home::no, correct_score_draw::yes, correct_score_draw::no, correct_score_away::yes, correct_score_away::no, correct_score::yes, correct_score::no, goal_home::yes, goal_home::no, goal_both::yes, goal_both::no, goal_away::yes, goal_away::no, total::over, total::under, total_goals_home::over, total_goals_home::under, total_goals_away::over, total_goals_away::under > wincase_type
@ betting_moderator_quorum
@ advertising_moderator_quorum
@ budgets_auction_properties_quorum
void validate_account_name(const std::string &name)
development_committee_change_budgets_auction_properties_operation< budget_type::post > development_committee_change_post_budgets_auction_properties_operation
fc::static_variant< soccer_game, hockey_game > game_type
optional< T > maybe_id(const std::string &name_or_id)
signed_transaction update_budget(const std::string &owner, uuid_type uuid, const std::string &json_metadata)
fc::ecc::private_key derive_private_key(const std::string &prefix_string, int sequence_number)
brain_key_info suggest_brain_key()
signed_transaction proposal(const std::string &initiator, uint32_t lifetime_sec, C &&constructor)
std::string normalize_brain_key(const std::string &s)
boost::uuids::uuid uuid_type
Creates new account by registration committee.
account_name_type new_account_name
std::string json_metadata
account_name_type creator
account_name_type new_account_name
std::string json_metadata
account_name_type creator
Creates new account with delegation.
account_name_type new_account_name
account_name_type creator
std::string json_metadata
Updates account keys or/and metadata.
account_name_type account
optional< authority > owner
optional< authority > active
std::string json_metadata
optional< authority > posting
Sets witness proxy for account.
account_name_type account
account_name_type account
account_name_type witness
This operation adjust NFT experience.
account_name_type moderator
Initiates atomicswap operation.
account_name_type recipient
Redeems atomicswap operation.
Refunds atomicswap operation.
account_name_type initiator
account_name_type participant
account_authority_map account_auths
uint32_t weight_threshold
bool is_impossible() const
key_authority_map key_auths
void add_authority(const public_key_type &k, authority_weight_type w)
std::vector< public_key_type > get_keys() const
This operation canceling game.
uuid_type uuid
Universal Unique Identifier which is specified during game creation.
account_name_type moderator
moderator account name
This operation cancel unmatched bets by id.
std::vector< uuid_type > bet_uuids
bets list that is being canceling
account_name_type better
owner
Changes recovery account. Will be changed in 30 days.
account_name_type new_recovery_account
The account that creates the recover request.
account_name_type account_to_recover
The account that would be recovered in case of compromise.
Closes advertising budget by moderator, remaining funds will be returned to creator.
account_name_type moderator
Closes advertising budget, remaining funds will be returned to creator.
Creates advertising budget.
std::string json_metadata
fc::time_point_sec deadline
This operation creates game object.
game_type game
game type (soccer, hockey, etc ...)
std::vector< market_type > markets
list of markets
uuid_type uuid
Universal Unique Identifier which is unique for each game.
account_name_type moderator
moderator account name
time_point_sec start_time
game start time
std::string json_metadata
JSON metadata.
uint32_t auto_resolve_delay_sec
delay starting from start after which all bets are automatically resolved if game results weren't pro...
This operation create new game round.
std::string verification_key
This operation create new NFT.
std::string json_metadata
account_name_type account
Delegates scorumpower from one account to the other.
asset scorumpower
The amount of scorumpower delegated.
account_name_type delegatee
The account receiving scorumpower.
account_name_type delegator
The account delegating scorumpower.
account_name_type delegatee
account_name_type reg_committee_member
Approves escrow transaction.
Releases escrow transaction.
asset scorum_amount
the amount of scorum to release
account_name_type to
the original 'to'
account_name_type who
the account that is attempting to release the funds, determines valid 'receiver'
account_name_type receiver
the account that should receive funds (might be from, might be to)
time_point_sec ratification_deadline
time_point_sec escrow_expiration
This operation creates bet.
bool live
is this bet is active in live
uuid_type game_uuid
Universal Unique Identifier which is specified during game creation.
account_name_type better
owner for new bet
asset stake
stake amount in SCR
uuid_type uuid
Universal Unique Identifier which is unique for each bet.
wincase_type wincase
wincase
odds_input odds
odds - rational coefficient that define potential result (p). p = odds * stake
With this operation moderator provides game results(wincases)
account_name_type moderator
moderator account name
uuid_type uuid
Universal Unique Identifier which is specified during game creation.
std::vector< wincase_type > wincases
list of wincases
Creates new committee proposal.
account_name_type creator
proposal_operation operation
Votes for committee proposal.
account_name_type voting_account
Proves authority to remove challenge.
account_name_type challenged
Recovers an account to a new authority using a previous authority.
account_name_type account_to_recover
The account to be recovered.
authority new_owner_authority
The new owner authority as specified in the request account recovery operation.
authority recent_owner_authority
Requests account recovery.
account_name_type account_to_recover
The account to recover. This is likely due to a compromised owner authority.
account_name_type recovery_account
The recovery account is listed as the recovery account on the account to recover.
authority new_owner_authority
known by the account to recover and will be confirmed in a recover_account_operation
Setup a versting withdraw to another account.
account_name_type from_account
account_name_type to_account
const signature_type & sign(const private_key_type &key, const chain_id_type &chain_id)
std::set< public_key_type > minimize_required_signatures(const chain_id_type &chain_id, const flat_set< public_key_type > &available_keys, const authority_getter &get_active, const authority_getter &get_owner, const authority_getter &get_posting, uint32_t max_recursion=SCORUM_MAX_SIG_CHECK_DEPTH) const
std::vector< signature_type > signatures
transaction_id_type id() const
std::vector< operation > operations
void get_required_authorities(flat_set< account_name_type > &active, flat_set< account_name_type > &owner, flat_set< account_name_type > &posting, std::vector< authority > &other) const
void set_reference_block(const block_id_type &reference_block)
void set_expiration(fc::time_point_sec expiration_time)
Transfers SCR from one account to another.
account_name_type to
Account to transfer asset to.
asset amount
The amount of asset to transfer from from to to.
account_name_type to
if null, then same as from
Updates advertising budget metadata.
std::string json_metadata
This operation updates game markets list.
uuid_type uuid
Universal Unique Identifier which is specified during game creation.
account_name_type moderator
moderator account name
std::vector< market_type > markets
list of markets
This operation update game round results.
This operation updates game start time.
time_point_sec start_time
game start time
account_name_type moderator
moderator account name
uuid_type uuid
Universal Unique Identifier which is specified during game creation.
This operation update NFT name.
account_name_type moderator
account_name_type account
Updates account to witness.
public_key_type block_signing_key
chain_properties proposed_chain_props
std::string brain_priv_key
flat_map< std::string, operation > & name2op
op_prototype_visitor(int _t, flat_map< std::string, operation > &_prototype_ops)
void operator()(const Type &op) const
static optional< memo_data > from_string(const std::string &str)
std::vector< char > encrypted
std::map< public_key_type, std::string > keys