mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 10:28:10 +01:00
api: Add "message_nets" field to bids and offers.
This commit is contained in:
@@ -416,6 +416,7 @@ def js_offers(self, url_split, post_string, is_json, sent=False) -> bytes:
|
||||
"is_revoked": True if o.active_ind == 2 else False,
|
||||
"is_public": o.addr_to == swap_client.network_addr
|
||||
or o.addr_to.strip() == "",
|
||||
"message_nets": o.message_nets,
|
||||
}
|
||||
offer_data["auto_accept_type"] = getattr(o, "auto_accept_type", 0)
|
||||
if with_extra_info:
|
||||
@@ -433,7 +434,6 @@ def js_offers(self, url_split, post_string, is_json, sent=False) -> bytes:
|
||||
offer_data["feerate_to"] = o.to_feerate
|
||||
|
||||
offer_data["automation_strat_id"] = getattr(o, "auto_accept_type", 0)
|
||||
offer_data["auto_accept_type"] = getattr(o, "auto_accept_type", 0)
|
||||
|
||||
if o.was_sent:
|
||||
try:
|
||||
|
||||
@@ -367,6 +367,7 @@ def describeBid(
|
||||
"events": bid_events,
|
||||
"debug_ui": swap_client.debug_ui,
|
||||
"reverse_bid": reverse_bid,
|
||||
"message_nets": bid.message_nets,
|
||||
}
|
||||
|
||||
if edit_bid:
|
||||
|
||||
@@ -39,6 +39,9 @@ from tests.basicswap.common import (
|
||||
wait_for_bid,
|
||||
wait_for_offer,
|
||||
)
|
||||
from tests.basicswap.util import (
|
||||
read_json_api,
|
||||
)
|
||||
from tests.basicswap.test_xmr import test_delay_event
|
||||
from tests.basicswap.extended.test_simplex import (
|
||||
TestSimplex2,
|
||||
@@ -317,6 +320,9 @@ class Test(TestSimplex2):
|
||||
coin_from, coin_to, swap_value, rate_swap, swap_value, SwapTypes.XMR_SWAP
|
||||
)
|
||||
|
||||
rv = read_json_api(1802, f"offers/{offer_id.hex()}")
|
||||
assert "smsg" in rv[0]["message_nets"] and "simplex" in rv[0]["message_nets"]
|
||||
|
||||
bid_ids = []
|
||||
wait_for_offer(test_delay_event, swap_clients[0], offer_id)
|
||||
offer = swap_clients[0].getOffer(offer_id)
|
||||
@@ -325,6 +331,12 @@ class Test(TestSimplex2):
|
||||
wait_for_offer(test_delay_event, swap_clients[1], offer_id)
|
||||
bid_ids.append(swap_clients[1].postBid(offer_id, offer.amount_from))
|
||||
|
||||
bid_0 = read_json_api(1800, f"bids/{bid_ids[0].hex()}")
|
||||
assert bid_0["message_nets"] == "simplex"
|
||||
|
||||
bid_1 = read_json_api(1801, f"bids/{bid_ids[1].hex()}")
|
||||
assert bid_1["message_nets"] == "smsg"
|
||||
|
||||
for bid_id in bid_ids:
|
||||
wait_for_bid(
|
||||
test_delay_event,
|
||||
|
||||
Reference in New Issue
Block a user