Commit a85cab38 authored by Mariusz's avatar Mariusz Committed by Mariusz
Browse files

Introduced `legacy-format` argument in `cli_wallet`

parent baf982ff
......@@ -91,7 +91,7 @@ class wallet_api
{
public:
wallet_api( const wallet_data& initial_data, const chain_id_type& _hive_chain_id,
const fc::api< hive::plugins::wallet_bridge_api::wallet_bridge_api >& remote_api, fc::promise< int >::ptr& exit_promise, bool is_daemon, format_type _format );
const fc::api< hive::plugins::wallet_bridge_api::wallet_bridge_api >& remote_api, fc::promise< int >::ptr& exit_promise, bool is_daemon, format_type _format, bool _legacy_format );
virtual ~wallet_api();
bool copy_wallet_file( const string& destination_filename );
......
......@@ -972,9 +972,11 @@ serializer_wrapper<annotated_signed_transaction> wallet_api_impl::build_claim_ac
namespace hive { namespace wallet {
wallet_api::wallet_api(const wallet_data& initial_data, const chain_id_type& hive_chain_id,
const fc::api< hive::plugins::wallet_bridge_api::wallet_bridge_api >& remote_api, fc::promise< int >::ptr& exit_promise, bool is_daemon, format_type _format )
const fc::api< hive::plugins::wallet_bridge_api::wallet_bridge_api >& remote_api, fc::promise< int >::ptr& exit_promise, bool is_daemon, format_type _format, bool _legacy_format )
: my(new detail::wallet_api_impl(*this, initial_data, hive_chain_id, remote_api)), exit_promise(exit_promise), is_daemon(is_daemon), format(_format)
{}
{
hive::protocol::dynamic_serializer::legacy_enabled = _legacy_format;
}
wallet_api::~wallet_api(){}
......
......@@ -104,6 +104,7 @@ int main( int argc, char** argv )
("wallet-file,w", bpo::value<string>()->implicit_value("wallet.json"), "Wallet to load")
("chain-id", bpo::value< std::string >()->default_value( HIVE_CHAIN_ID ), "Chain ID to connect to")
("format-type", bpo::value< std::string >(), "Allows to change formatting for functions that require special formatting" )
("legacy-format", bpo::value< bool >()->default_value( true ), "Allows to generate JSON using legacy/non legacy format. By default is true." )
;
vector<string> allowed_ips;
......@@ -229,10 +230,12 @@ int main( int argc, char** argv )
}
};
bool _legacy_format = options["legacy-format"].as<bool>();
if( wdata.offline )
{
ilog( "Not connecting to server RPC endpoint, due to the offline option set" );
wapiptr = std::make_shared<wallet_api>( wdata, _hive_chain_id, fc::api< hive::plugins::wallet_bridge_api::wallet_bridge_api >{}, exit_promise, options.count("daemon"), get_format( options, format_type::textformat ) );
wapiptr = std::make_shared<wallet_api>( wdata, _hive_chain_id, fc::api< hive::plugins::wallet_bridge_api::wallet_bridge_api >{}, exit_promise, options.count("daemon"), get_format( options, format_type::textformat ), _legacy_format );
}
else
{
......@@ -263,7 +266,7 @@ int main( int argc, char** argv )
format = get_format( options, format_type::noformat );
else
format = get_format( options, format_type::textformat );
wapiptr = std::make_shared<wallet_api>( wdata, _hive_chain_id, remote_api, exit_promise, options.count("daemon"), format );
wapiptr = std::make_shared<wallet_api>( wdata, _hive_chain_id, remote_api, exit_promise, options.count("daemon"), format, _legacy_format );
closed_connection = con->closed.connect([=]{
cerr << "Server has disconnected us.\n";
wallet_cli->stop();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment