From 06065958b76a62e386e737c5062dd7e52512f7fe Mon Sep 17 00:00:00 2001 From: tecnovert Date: Tue, 21 Feb 2023 00:08:18 +0200 Subject: [PATCH] ui: Fix xmr svg path, edit offer automation strategy. --- basicswap/basicswap.py | 27 ++++++++++++++ basicswap/templates/bid_xmr.html | 4 +-- basicswap/templates/offer.html | 45 ++++++++++++++++++++++-- basicswap/ui/page_offers.py | 14 ++++++-- doc/release-notes.md | 1 + scripts/createoffers.py | 26 ++++++++++---- tests/basicswap/extended/test_scripts.py | 15 +++++++- 7 files changed, 117 insertions(+), 15 deletions(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index a285fb3..51265c8 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -1587,6 +1587,33 @@ class BasicSwap(BaseApp): finally: self.closeSession(session) + def editOffer(self, offer_id, data) -> None: + self.log.info('Editing offer %s', offer_id.hex()) + session = self.openSession() + try: + offer = session.query(Offer).filter_by(offer_id=offer_id).first() + if 'automation_strat_id' in data: + new_automation_strat_id = data['automation_strat_id'] + link = session.query(AutomationLink).filter_by(linked_type=Concepts.OFFER, linked_id=offer.offer_id).first() + if not link: + if new_automation_strat_id > 0: + link = AutomationLink( + active_ind=1, + linked_type=Concepts.OFFER, + linked_id=offer_id, + strategy_id=new_automation_strat_id, + created_at=int(time.time())) + session.add(link) + else: + if new_automation_strat_id < 1: + link.active_ind = 0 + else: + link.strategy_id = new_automation_strat_id + link.active_ind = 1 + session.add(link) + finally: + self.closeSession(session) + def grindForEd25519Key(self, coin_type, evkey, key_path_base) -> bytes: ci = self.ci(coin_type) nonce = 1 diff --git a/basicswap/templates/bid_xmr.html b/basicswap/templates/bid_xmr.html index 241889c..2e9cc34 100644 --- a/basicswap/templates/bid_xmr.html +++ b/basicswap/templates/bid_xmr.html @@ -411,7 +411,7 @@
-
+
@@ -427,7 +427,7 @@
-
+
diff --git a/basicswap/templates/offer.html b/basicswap/templates/offer.html index 874c0a7..edf8c81 100644 --- a/basicswap/templates/offer.html +++ b/basicswap/templates/offer.html @@ -256,7 +256,45 @@
- {% if data.show_bid_form %} + {% if data.show_edit_form %} +
+
+
+

Edit Offer

+
+
+
+
+ + + + + +
Auto Accept Strategy: + +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+ {% elif data.show_bid_form %}
@@ -398,8 +436,11 @@ {% if data.was_revoked != true %}
-
+
{% endif %} +
+ +