From 69e4c0616122b4d384ebb70ebfc0dc3f25b70296 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 27 Nov 2024 19:56:09 +0800 Subject: [PATCH] exclude ibc_channel if param is "" --- src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp | 7 +++++-- src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp index d0a9d1a34..30d65e064 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp @@ -46,9 +46,12 @@ namespace atomic_dex::kdf obj["params"]["amount"] = cfg.amount; obj["params"]["to"] = cfg.to; obj["params"]["max"] = cfg.max; - if (cfg.memo.has_value()) + if (cfg.ibc_source_channel.has_value()) { - obj["params"]["ibc_source_channel"] = cfg.ibc_source_channel.value(); + if (cfg.ibc_source_channel.value() != "") + { + obj["params"]["ibc_source_channel"] = cfg.ibc_source_channel.value(); + } } if (cfg.memo.has_value()) { diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp index d3e747b4c..4ff33b0eb 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp @@ -26,11 +26,11 @@ namespace atomic_dex::kdf struct withdraw_request { std::string coin; - std::string to; ///< coins will be withdraw to this address - std::string amount; ///< ignored if max is true - std::optional fees{std::nullopt}; ///< ignored if std::nullopt - std::optional memo; ///< memo for tendermint - std::optional ibc_source_channel; ///< ibc_source_channel for tendermint + std::string to; ///< coins will be withdraw to this address + std::string amount; ///< ignored if max is true + std::optional fees{std::nullopt}; ///< ignored if std::nullopt + std::optional memo{""}; ///< memo for tendermint + std::optional ibc_source_channel{""}; ///< ibc_source_channel for tendermint bool max{false}; };