@@ -576,18 +576,18 @@ if (document.readyState === 'loading') {
Rate |
{% if data.rate_negotiable == true %}
-
{% else %}
-
@@ -662,7 +662,7 @@ if (document.readyState === 'loading') {
Amount you will get:
@@ -686,7 +686,7 @@ if (document.readyState === 'loading') {
-
@@ -727,17 +727,17 @@ xhr_bid_params.onload = () => {
function lookup_rates() {
const coin_from = document.getElementById('coin_from')?.value;
const coin_to = document.getElementById('coin_to')?.value;
-
+
if (!coin_from || !coin_to || coin_from === '-1' || coin_to === '-1') {
alert('Coins from and to must be set first.');
return;
}
-
+
const ratesDisplay = document.getElementById('rates_display');
if (ratesDisplay) {
ratesDisplay.innerHTML = ' RatesUpdating... ';
}
-
+
xhr_rates.open('POST', '/json/rates');
xhr_rates.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr_rates.send(`coin_from=${coin_from}&coin_to=${coin_to}`);
@@ -785,11 +785,11 @@ function updateBidParams(value_changed) {
const amountFromInput = document.getElementById('amount_from');
const bidRateInput = document.getElementById('bid_rate');
const offerRateInput = document.getElementById('offer_rate');
-
+
if (!coin_from || !coin_to || !amt_var || !rate_var) return;
-
- const rate = rate_var === 'True' && bidRateInput ?
- parseFloat(bidRateInput.value) || 0 :
+
+ const rate = rate_var === 'True' && bidRateInput ?
+ parseFloat(bidRateInput.value) || 0 :
parseFloat(offerRateInput?.value || '0');
if (!rate) return;
@@ -826,7 +826,7 @@ function updateBidParams(value_changed) {
function validateAmountsAfterChange() {
const bidAmountSendInput = document.getElementById('bid_amount_send');
const bidAmountInput = document.getElementById('bid_amount');
-
+
if (bidAmountSendInput) {
const maxSend = parseFloat(bidAmountSendInput.getAttribute('max'));
validateMaxAmount(bidAmountSendInput, maxSend);
@@ -871,7 +871,7 @@ function updateModalValues() {
if (modalAmtReceive) {
modalAmtReceive.textContent = bidAmountInput.value;
}
-
+
const modalReceiveCurrency = document.getElementById('modal-receive-currency');
if (modalReceiveCurrency) {
modalReceiveCurrency.textContent = ' {{ data.tla_from }}';
@@ -883,7 +883,7 @@ function updateModalValues() {
if (modalAmtSend) {
modalAmtSend.textContent = bidAmountSendInput.value;
}
-
+
const modalSendCurrency = document.getElementById('modal-send-currency');
if (modalSendCurrency) {
modalSendCurrency.textContent = ' {{ data.tla_to }}';
@@ -921,7 +921,7 @@ function updateModalValues() {
function handleBidsPageAddress() {
const selectElement = document.querySelector('select[name="addr_from"]');
const STORAGE_KEY = 'lastUsedAddressBids';
-
+
if (!selectElement) return;
function loadInitialAddress() {
@@ -1003,7 +1003,7 @@ document.addEventListener('DOMContentLoaded', function() {
if (validMinsInput) {
validMinsInput.addEventListener('input', updateModalValues);
}
-
+
const addrFromSelect = document.querySelector('select[name="addr_from"]');
if (addrFromSelect) {
addrFromSelect.addEventListener('change', updateModalValues);
diff --git a/basicswap/ui/util.py b/basicswap/ui/util.py
index 8c97698..70be243 100644
--- a/basicswap/ui/util.py
+++ b/basicswap/ui/util.py
@@ -348,8 +348,8 @@ def describeBid(
if for_api
else format_timestamp(bid.expire_at, with_seconds=True)
),
- "was_sent": "True" if bid.was_sent else "False",
- "was_received": "True" if bid.was_received else "False",
+ "was_sent": bid.was_sent,
+ "was_received": bid.was_received,
"initiate_tx": getTxIdHex(bid, TxTypes.ITX, " " + ci_leader.ticker()),
"initiate_conf": (
"None"
diff --git a/tests/basicswap/selenium/test_swap_direction.py b/tests/basicswap/selenium/test_swap_direction.py
index 893eec3..557607a 100644
--- a/tests/basicswap/selenium/test_swap_direction.py
+++ b/tests/basicswap/selenium/test_swap_direction.py
@@ -239,10 +239,8 @@ def test_swap_dir(driver):
assert num_found >= 2
driver.get(f"{node1_url}/bid/{bid_1_id}")
- td_sent = driver.find_element(
- "xpath", "//td[contains(text(), 'Sent')]/following-sibling::td"
- )
- assert "False" in td_sent.get_attribute("innerHTML")
+ td_dir = driver.find_element(By.ID, "bidtype")
+ assert "Received" == td_dir.get_attribute("innerHTML")
td_ys = driver.find_element(
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
)
@@ -253,10 +251,8 @@ def test_swap_dir(driver):
assert "Monero" in td_yg.get_attribute("innerHTML")
driver.get(f"{node2_url}/bid/{bid_1_id}")
- td_sent = driver.find_element(
- "xpath", "//td[contains(text(), 'Sent')]/following-sibling::td"
- )
- assert "True" in td_sent.get_attribute("innerHTML")
+ td_dir = driver.find_element(By.ID, "bidtype")
+ assert "Sent" == td_dir.get_attribute("innerHTML")
td_ys = driver.find_element(
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
)
@@ -267,10 +263,8 @@ def test_swap_dir(driver):
assert "Particl" in td_yg.get_attribute("innerHTML")
driver.get(f"{node1_url}/bid/{bid_3_id}")
- td_sent = driver.find_element(
- "xpath", "//td[contains(text(), 'Sent')]/following-sibling::td"
- )
- assert "True" in td_sent.get_attribute("innerHTML")
+ td_dir = driver.find_element(By.ID, "bidtype")
+ assert "Sent (Transposed)" == td_dir.get_attribute("innerHTML")
td_ys = driver.find_element(
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
)
@@ -281,10 +275,8 @@ def test_swap_dir(driver):
assert "Monero" in td_yg.get_attribute("innerHTML")
driver.get(f"{node2_url}/bid/{bid_3_id}")
- td_sent = driver.find_element(
- "xpath", "//td[contains(text(), 'Sent')]/following-sibling::td"
- )
- assert "False" in td_sent.get_attribute("innerHTML")
+ td_dir = driver.find_element(By.ID, "bidtype")
+ assert "Received (Transposed)" == td_dir.get_attribute("innerHTML")
td_ys = driver.find_element(
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
)
|