diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 4b718e64..b9f0d6cb 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -1960,6 +1960,10 @@ bool simple_wallet::generate_ionic_swap_proposal(const std::vector fail_msg_writer() << "Failed to load json file with asset specification: " << args[0]; return true; } + if (proposal_info.expiration_time == 0) + { + proposal_info.expiration_time = m_wallet->get_core_runtime_config().get_core_time() + 10 * 60; + } currency::account_public_address destination_addr = AUTO_VAL_INIT(destination_addr); currency::payment_id_t integrated_payment_id; if (!m_wallet->get_transfer_address(args[1], destination_addr, integrated_payment_id)) diff --git a/src/wallet/wallet_public_structs_defs.h b/src/wallet/wallet_public_structs_defs.h index ea84d484..5ca0502e 100644 --- a/src/wallet/wallet_public_structs_defs.h +++ b/src/wallet/wallet_public_structs_defs.h @@ -256,6 +256,7 @@ namespace wallet_public for (auto& st : subtransfers) { if (st.asset_id == currency::native_coin_asset_id) + { if (st.is_income) { return st.amount; @@ -263,7 +264,8 @@ namespace wallet_public else { throw std::runtime_error("Unexpected wallet_transfer_info: native is not income type"); - } + } + } } subtransfers.push_back(wallet_sub_transfer_info()); subtransfers.back().is_income = true; diff --git a/utils/test_api_files/ionic_swap_create_draft.json b/utils/test_api_files/ionic_swap_create_draft.json new file mode 100644 index 00000000..7ce14f26 --- /dev/null +++ b/utils/test_api_files/ionic_swap_create_draft.json @@ -0,0 +1,21 @@ +{ + "jsonrpc": "2.0", + "id": "0", + "method": "ionic_swap_generate_proposal", + "params": { + "proposal": { + "to_bob": [{ + "asset_id": "e03a140b8447d2895290022b25c06bdabea514e2475ae56ce5bcbc554ab9865c", + "amount": 2000000000000 + }], + "to_alice": [{ + "asset_id": "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a", + "amount": 10000000000000 + }], + "mixins": 10, + "fee_paid_by_a": 10000000000, + "expiration_time": 0 + }, + "destination_address": "ZxDAcbaxXkyWRgYbeARBpngfmFat5TjDjjQA5NAbouB9eytwGWJqA5shAVYeCAHWPo254DF2o2X1td79PNvRr2Yc1b9Ep67ff" + } +} \ No newline at end of file