1
0
Fork 0
forked from lthn/blockchain

changed ionic swap proposal command arguments to more suitable

This commit is contained in:
cryptozoidberg 2023-09-05 16:40:15 +02:00
parent a47b3ca0a5
commit 9eefffd872
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC

View file

@ -317,8 +317,8 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("remove_custom_asset_id", boost::bind(&simple_wallet::remove_custom_asset_id, this, ph::_1), "Cancel previously made approval for asset id");
m_cmd_binder.set_handler("generate_ionic_swap_proposal", boost::bind(&simple_wallet::generate_ionic_swap_proposal, this, ph::_1), "generate_ionic_swap_proposal <proposal_config.json> <destination_addr>- Generates ionic_swap proposal with given conditions");
m_cmd_binder.set_handler("get_ionic_swap_proposal_info", boost::bind(&simple_wallet::get_ionic_swap_proposal_info, this, ph::_1), "get_ionic_swap_proposal_info <hex_encoded_raw_proposal> - Extracts and display information from ionic_swap proposal raw data");
m_cmd_binder.set_handler("accept_ionic_swap_proposal", boost::bind(&simple_wallet::accept_ionic_swap_proposal, this, ph::_1), "accept_ionic_swap_proposal <hex_encoded_raw_proposal> - Accept ionic_swap proposal and generates exchange transaction");
m_cmd_binder.set_handler("get_ionic_swap_proposal_info", boost::bind(&simple_wallet::get_ionic_swap_proposal_info, this, ph::_1), "get_ionic_swap_proposal_info <hex_encoded_raw_proposal.txt> - Extracts and display information from ionic_swap proposal raw data");
m_cmd_binder.set_handler("accept_ionic_swap_proposal", boost::bind(&simple_wallet::accept_ionic_swap_proposal, this, ph::_1), "accept_ionic_swap_proposal <hex_encoded_raw_proposal.txt> - Accept ionic_swap proposal and generates exchange transaction");
}
//----------------------------------------------------------------------------------------------------
@ -2159,8 +2159,16 @@ bool simple_wallet::get_ionic_swap_proposal_info(const std::vector<std::string>
return true;
}
std::string raw_hex_proposal;
bool r = epee::file_io_utils::load_file_to_string(args[0], raw_hex_proposal);
if (!r)
{
fail_msg_writer() << "Failed to load proposal hex from file";
return true;
}
std::string raw_proposal;
bool r = epee::string_tools::parse_hexstr_to_binbuff(args[0], raw_proposal);
r = epee::string_tools::parse_hexstr_to_binbuff(raw_hex_proposal, raw_proposal);
if (!r)
{
fail_msg_writer() << "Failed to parse proposal hex to raw data";
@ -2192,8 +2200,17 @@ bool simple_wallet::accept_ionic_swap_proposal(const std::vector<std::string> &a
return true;
}
std::string raw_hex_proposal;
bool r = epee::file_io_utils::load_file_to_string(args[0], raw_hex_proposal);
if (!r)
{
fail_msg_writer() << "Failed to load proposal hex from file";
return true;
}
std::string raw_proposal;
bool r = epee::string_tools::parse_hexstr_to_binbuff(args[0], raw_proposal);
r = epee::string_tools::parse_hexstr_to_binbuff(raw_hex_proposal, raw_proposal);
if (!r)
{
fail_msg_writer() << "Failed to parse proposal hex to raw data";