From 7d5f7e0936f3ee45d8911946d6803107975bd9cb Mon Sep 17 00:00:00 2001 From: Gerlof van Ek Date: Mon, 10 Mar 2025 22:06:10 +0100 Subject: [PATCH] Swaps in Progress update + various fixes. (#278) * Swaps in Progress fixes. * Fixes. * Edit bid only in debug. * Set edit button in debug_ui --- basicswap/js_server.py | 7 ++++++- basicswap/static/js/active.js | 25 +++++++++++++------------ basicswap/templates/active.html | 24 ++++++++++++------------ basicswap/templates/bid.html | 4 +++- basicswap/templates/bid_xmr.html | 2 ++ 5 files changed, 36 insertions(+), 26 deletions(-) diff --git a/basicswap/js_server.py b/basicswap/js_server.py index db6f091..194b846 100644 --- a/basicswap/js_server.py +++ b/basicswap/js_server.py @@ -996,12 +996,16 @@ def js_active(self, url_split, post_string, is_json) -> bytes: "received", ] all_bids = [] + processed_bid_ids = set() try: received_bids = swap_client.listBids(filters=filters) sent_bids = swap_client.listBids(sent=True, filters=filters) for bid in received_bids + sent_bids: try: + bid_id_hex = bid[2].hex() + if bid_id_hex in processed_bid_ids: + continue bid_state = strBidState(bid[5]) tx_state_a = strTxState(bid[7]) tx_state_b = strTxState(bid[8]) @@ -1011,7 +1015,7 @@ def js_active(self, url_split, post_string, is_json) -> bytes: if not offer: continue swap_data = { - "bid_id": bid[2].hex(), + "bid_id": bid_id_hex, "offer_id": bid[3].hex(), "created_at": bid[0], "bid_state": bid_state, @@ -1031,6 +1035,7 @@ def js_active(self, url_split, post_string, is_json) -> bytes: }, } all_bids.append(swap_data) + processed_bid_ids.add(bid_id_hex) except Exception: continue except Exception: diff --git a/basicswap/static/js/active.js b/basicswap/static/js/active.js index 5c4b82f..2189979 100644 --- a/basicswap/static/js/active.js +++ b/basicswap/static/js/active.js @@ -575,14 +575,13 @@ const createSwapTableRow = async (swap) => { - + +
-
-
${fromAmount.toFixed(8)}
-
${fromSymbol}
-
+
${toAmount.toFixed(8)}
+
${toSymbol}
@@ -593,8 +592,8 @@ const createSwapTableRow = async (swap) => {
${swap.coin_from} @@ -602,20 +601,22 @@ const createSwapTableRow = async (swap) => { ${swap.coin_to}
- +
-
${toAmount.toFixed(8)}
-
${toSymbol}
+
+
${fromAmount.toFixed(8)}
+
${fromSymbol}
+
diff --git a/basicswap/templates/active.html b/basicswap/templates/active.html index d6e1c34..8630183 100644 --- a/basicswap/templates/active.html +++ b/basicswap/templates/active.html @@ -42,21 +42,21 @@ Details - +
- You Send -
- - -
- Swap -
- - -
You Receive
- + + +
+ Swap +
+ + +
+ You Send +
+
Status diff --git a/basicswap/templates/bid.html b/basicswap/templates/bid.html index 36d788d..d96d504 100644 --- a/basicswap/templates/bid.html +++ b/basicswap/templates/bid.html @@ -532,10 +532,12 @@
{% endif %} + {% if debug_ui_mode == true %}
{% endif %} + {% endif %} {% if data.can_abandon == true and not edit_bid %}
@@ -569,4 +571,4 @@
{% include 'footer.html' %} - \ No newline at end of file + diff --git a/basicswap/templates/bid_xmr.html b/basicswap/templates/bid_xmr.html index f64dc3a..2d083a7 100644 --- a/basicswap/templates/bid_xmr.html +++ b/basicswap/templates/bid_xmr.html @@ -808,10 +808,12 @@ {% endif %} + {% if debug_ui_mode == true %}
{% endif %} + {% endif %} {% if data.can_abandon == true %}