BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
wallet_debug.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cryptonomex, Inc., and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 #include "wallet_api_impl.hpp"
25 
26 namespace graphene { namespace wallet { namespace detail {
27 
28  void wallet_api_impl::dbg_make_uia(string creator, string symbol)
29  {
30  asset_options opts;
32  opts.issuer_permissions = opts.flags;
33  opts.core_exchange_rate = price(asset(1), asset(1,asset_id_type(1)));
34  create_asset(get_account(creator).name, symbol, 2, opts, {}, true);
35  }
36 
37  void wallet_api_impl::dbg_make_mia(string creator, string symbol)
38  {
39  asset_options opts;
40  opts.flags &= ~white_list;
41  opts.issuer_permissions = opts.flags;
42  opts.core_exchange_rate = price(asset(1), asset(1,asset_id_type(1)));
43  bitasset_options bopts;
44  create_asset(get_account(creator).name, symbol, 2, opts, bopts, true);
45  }
46 
47  void wallet_api_impl::dbg_push_blocks( const std::string& src_filename, uint32_t count )
48  {
49  use_debug_api();
50  (*_remote_debug)->debug_push_blocks( src_filename, count );
51  (*_remote_debug)->debug_stream_json_objects_flush();
52  }
53 
54  void wallet_api_impl::dbg_generate_blocks( const std::string& debug_wif_key, uint32_t count )
55  {
56  use_debug_api();
57  (*_remote_debug)->debug_generate_blocks( debug_wif_key, count );
58  (*_remote_debug)->debug_stream_json_objects_flush();
59  }
60 
61  void wallet_api_impl::dbg_stream_json_objects( const std::string& filename )
62  {
63  use_debug_api();
64  (*_remote_debug)->debug_stream_json_objects( filename );
65  (*_remote_debug)->debug_stream_json_objects_flush();
66  }
67 
69  {
70  use_debug_api();
71  (*_remote_debug)->debug_update_object( update );
72  (*_remote_debug)->debug_stream_json_objects_flush();
73  }
74 
76  {
77  if( _remote_debug )
78  return;
79  try
80  {
81  _remote_debug = _remote_api->debug();
82  }
83  catch( const fc::exception& e )
84  {
85  std::cerr << "\nCouldn't get debug node API. You probably are not configured\n"
86  "to access the debug API on the node you are connecting to.\n"
87  "\n"
88  "To fix this problem:\n"
89  "- Please ensure you are running debug_node, not witness_node.\n"
90  "- Please follow the instructions in README.md to set up an apiaccess file.\n"
91  "\n";
92  }
93  }
94 
95 }}} // namespace graphene::wallet::detail
void dbg_generate_blocks(const std::string &debug_wif_key, uint32_t count)
An order-perserving dictionary of variant&#39;s.
Definition: api.cpp:56
The asset_options struct contains options available on all assets in the network. ...
Definition: asset_ops.hpp:47
Used to generate a useful error report when an exception is thrown.At each level in the stack where t...
Definition: exception.hpp:56
account_object get_account(account_id_type id) const
The price struct stores asset prices in the BitShares system.
Definition: asset.hpp:114
uint16_t issuer_permissions
The flags which the issuer has permission to update. See asset_issuer_permission_flags.
Definition: asset_ops.hpp:61
accounts must be whitelisted in order to hold or transact this asset
Definition: types.hpp:141
signed_transaction create_asset(string issuer, string symbol, uint8_t precision, asset_options common, fc::optional< bitasset_options > bitasset_opts, bool broadcast=false)
allow the bitasset owner to force a global settling, permission only
Definition: types.hpp:145
uint16_t flags
The currently active flags on this permission. See asset_issuer_permission_flags. ...
Definition: asset_ops.hpp:63
optional< fc::api< graphene::debug_witness::debug_api > > _remote_debug
void dbg_make_mia(string creator, string symbol)
void dbg_push_blocks(const std::string &src_filename, uint32_t count)
void dbg_update_object(const fc::variant_object &update)
The bitasset_options struct contains configurable options available only to BitAssets.
Definition: asset_ops.hpp:109
void dbg_stream_json_objects(const std::string &filename)
void dbg_make_uia(string creator, string symbol)
cerr_t & cerr
Definition: iostream.cpp:176