1
0
Fork 0
forked from lthn/blockchain

Fixed few complilation issues

This commit is contained in:
cryptozoidberg 2023-04-11 17:23:06 +02:00
parent 8cfeab405b
commit 03f443cf4c
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
6 changed files with 19 additions and 18 deletions

View file

@ -2162,35 +2162,35 @@ QString MainWindow::get_wallet_info(const QString& param)
return MAKE_RESPONSE(ar);
CATCH_ENTRY_FAIL_API_RESPONCE();
}
QString create_ionic_swap_proposal(const QString& param)
QString MainWindow::create_ionic_swap_proposal(const QString& param)
{
TRY_ENTRY();
LOG_API_TIMING();
PREPARE_ARG_FROM_JSON(view::create_ionic_swap_proposal_request, cispr);
PREPARE_RESPONSE(view::api_response_t<std::string>, ar);
PREPARE_RESPONSE(std::string, ar);
ar.error_code = m_backend.create_ionic_swap_proposal(cispr.wallet_id, cispr, ar.response_data);
return MAKE_RESPONSE(ar);
CATCH_ENTRY_FAIL_API_RESPONCE();
}
QString get_ionic_swap_proposal_info(const QString& param)
QString MainWindow::get_ionic_swap_proposal_info(const QString& param)
{
TRY_ENTRY();
LOG_API_TIMING();
PREPARE_ARG_FROM_JSON(view::api_request_t<std::string>, tx_raw_hex);
PREPARE_RESPONSE(view::api_response_t<std::string>, ar);
PREPARE_RESPONSE(tools::wallet_public::ionic_swap_proposal_info, ar);
ar.error_code = m_backend.get_ionic_swap_proposal_info(tx_raw_hex.wallet_id, tx_raw_hex.req_data, ar.response_data);
return MAKE_RESPONSE(ar);
CATCH_ENTRY_FAIL_API_RESPONCE();
}
QString accept_ionic_swap_proposal(const QString& param)
QString MainWindow::accept_ionic_swap_proposal(const QString& param)
{
TRY_ENTRY();
LOG_API_TIMING();
PREPARE_ARG_FROM_JSON(view::api_request_t<std::string>, tx_raw_hex);
PREPARE_RESPONSE(view::api_response_t<std::string>, ar);
PREPARE_RESPONSE(std::string, ar);
ar.error_code = m_backend.accept_ionic_swap_proposal(tx_raw_hex.wallet_id, tx_raw_hex.req_data, ar.response_data);
return MAKE_RESPONSE(ar);
CATCH_ENTRY_FAIL_API_RESPONCE();

View file

@ -409,7 +409,7 @@ public:
struct wallet_and_asset_id
{
uint64_t wallet_id = 0;
crypto::hash asset_id = currency::null_hash;
crypto::public_key asset_id = currency::null_pkey;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(wallet_id)

View file

@ -5040,8 +5040,8 @@ bool wallet2::get_ionic_swap_proposal_info(const currency::transaction tx, walle
bool r = lookup_acc_outs(m_account.get_keys(), tx, outs, tx_money_got_in_outs, derivation);
THROW_IF_FALSE_WALLET_INT_ERR_EX(r, "Failed to lookup_acc_outs for tx: " << get_transaction_hash(tx));
std::unordered_map<crypto::hash, uint64_t> ammounts_to;
std::unordered_map<crypto::hash, uint64_t> ammounts_from;
std::unordered_map<crypto::public_key, uint64_t> ammounts_to;
std::unordered_map<crypto::public_key, uint64_t> ammounts_from;
std::vector<bool> third_party_outs;
size_t i = 0;
for (const auto& o : outs)
@ -5060,7 +5060,7 @@ bool wallet2::get_ionic_swap_proposal_info(const currency::transaction tx, walle
uint64_t amount = 0;
//TODO decode output info
//get_amout_and_asset_id()
ammounts_from[asset_id] += amount;
//ammounts_from[asset_id] += amount;
}
for (const auto& a : ammounts_to)
@ -5110,7 +5110,7 @@ bool wallet2::accept_ionic_swap_proposal(const currency::transaction& tx_templat
bool r = get_ionic_swap_proposal_info(tx_template, msc.proposal);
THROW_IF_TRUE_WALLET_EX(!r, error::wallet_internal_error, "Failed to get info from proposal");
std::unordered_map<crypto::hash, wallet_public::asset_balance_entry_base> balances;
std::unordered_map<crypto::public_key, wallet_public::asset_balance_entry_base> balances;
uint64_t mined = 0;
this->balance(balances, mined);
//validate balances needed
@ -5121,7 +5121,7 @@ bool wallet2::accept_ionic_swap_proposal(const currency::transaction& tx_templat
{
return false;
}
if (item.asset_id == currency::null_hash)
if (item.asset_id == currency::native_coin_asset_id)
{
native_amount_required = item.amount;
}
@ -5132,7 +5132,7 @@ bool wallet2::accept_ionic_swap_proposal(const currency::transaction& tx_templat
if (msc.proposal.fee < m_core_runtime_config.tx_default_fee)
{
additional_fee = m_core_runtime_config.tx_default_fee - msc.proposal.fee;
if (balances[currency::null_hash].unlocked < additional_fee + native_amount_required)
if (balances[currency::native_coin_asset_id].unlocked < additional_fee + native_amount_required)
{
return false;
}

View file

@ -1183,11 +1183,11 @@ namespace wallet_public
struct asset_funds
{
crypto::hash asset_id;
crypto::public_key asset_id;
uint64_t amount;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(asset_id)
KV_SERIALIZE_POD_AS_HEX_STRING(asset_id)
KV_SERIALIZE(amount)
END_KV_SERIALIZE_MAP()
};

View file

@ -927,7 +927,7 @@ std::string wallets_manager::get_ionic_swap_proposal_info(uint64_t wallet_id, st
return API_RETURN_CODE_OK;
}
std::string wallets_manager::accept_ionic_swap_proposal(uint64_t wallet_id, std::string&raw_tx_template_hex, currency::transaction& result_tx)
std::string wallets_manager::accept_ionic_swap_proposal(uint64_t wallet_id, std::string&raw_tx_template_hex, std::string& result_raw_tx_hex)
{
GET_WALLET_OPT_BY_ID(wallet_id, wo);
try {
@ -937,11 +937,12 @@ std::string wallets_manager::accept_ionic_swap_proposal(uint64_t wallet_id, std:
{
return API_RETURN_CODE_BAD_ARG;
}
currency::transaction result_tx = AUTO_VAL_INIT(result_tx);
if (!wo.w->get()->accept_ionic_swap_proposal(raw_tx_template, result_tx))
{
return API_RETURN_CODE_FAIL;
}
result_raw_tx_hex = epee::string_tools::buff_to_hex_nodelimer(t_serializable_object_to_blob(result_tx));
}
catch (...)
{

View file

@ -138,7 +138,7 @@ public:
std::string is_wallet_password_valid(uint64_t wallet_id, const std::string& pass);
std::string create_ionic_swap_proposal(uint64_t wallet_id, const tools::wallet_public::create_ionic_swap_proposal_request& proposal, std::string& result_proposal_hex);
std::string get_ionic_swap_proposal_info(uint64_t wallet_id, std::string&raw_tx_template_hex, tools::wallet_public::ionic_swap_proposal_info& proposal);
std::string accept_ionic_swap_proposal(uint64_t wallet_id, std::string&raw_tx_template_hex, currency::transaction& result_tx);
std::string accept_ionic_swap_proposal(uint64_t wallet_id, std::string&raw_tx_template_hex, std::string& result_raw_tx);
std::string get_my_offers(const bc_services::core_offers_filter& filter, std::list<bc_services::offer_details_ex>& offers);
std::string get_fav_offers(const std::list<bc_services::offer_id>& hashes, const bc_services::core_offers_filter& filter, std::list<bc_services::offer_details_ex>& offers);
std::string get_tx_pool_info(currency::COMMAND_RPC_GET_POOL_INFO::response& res);