Improve auto-accept

This commit is contained in:
tecnovert
2024-11-26 14:11:20 +02:00
parent 26de907185
commit 08df0ceae0
9 changed files with 211 additions and 74 deletions

View File

@@ -25,6 +25,7 @@ from basicswap.basicswap_util import (
BidStates,
SwapTypes,
DebugTypes,
canAcceptBidState,
strTxState,
strBidState,
)
@@ -124,7 +125,7 @@ def page_bid(self, url_split, post_string):
if len(data["addr_from_label"]) > 0:
data["addr_from_label"] = "(" + data["addr_from_label"] + ")"
data["can_accept_bid"] = True if bid.state == BidStates.BID_RECEIVED else False
data["can_accept_bid"] = True if canAcceptBidState(bid.state) else False
if swap_client.debug_ui:
data["bid_actions"] = [

View File

@@ -20,6 +20,7 @@ from basicswap.basicswap_util import (
ActionTypes,
BidStates,
DebugTypes,
canAcceptBidState,
getLastBidState,
strBidState,
strTxState,
@@ -258,7 +259,7 @@ def describeBid(
if bid.state == BidStates.BID_RECEIVING:
# Offerer receiving bid from bidder
state_description = "Waiting for bid to be fully received"
elif bid.state == BidStates.BID_RECEIVED:
elif canAcceptBidState(bid.state):
# Offerer received bid from bidder
# TODO: Manual vs automatic
state_description = "Bid must be accepted"
@@ -270,7 +271,7 @@ def describeBid(
)
elif bid.state == BidStates.SWAP_DELAYING:
last_state = getLastBidState(bid.states)
if last_state == BidStates.BID_RECEIVED:
if canAcceptBidState(last_state):
state_description = "Delaying before accepting bid"
elif last_state == BidStates.BID_RECEIVING_ACC:
state_description = "Delaying before responding to accepted bid"