mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
@@ -1056,10 +1056,10 @@ const AmmTablesManager = (function() {
|
|||||||
newItem.min_swap_amount = parseFloat(minSwapAmount);
|
newItem.min_swap_amount = parseFloat(minSwapAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
const amountStep = document.getElementById('add-offer-amount-step').value;
|
const amountStep = parseFloat(document.getElementById('add-offer-amount-step').value);
|
||||||
const offerAmount = parseFloat(document.getElementById('add-amm-amount').value);
|
const offerAmount = parseFloat(document.getElementById('add-amm-amount').value);
|
||||||
|
|
||||||
if (!amountStep || amountStep.trim() === '') {
|
if (!amountStep) {
|
||||||
if (window.showErrorModal) {
|
if (window.showErrorModal) {
|
||||||
window.showErrorModal('Validation Error', 'Offer Size Increment is required. This privacy feature prevents revealing your exact wallet balance.');
|
window.showErrorModal('Validation Error', 'Offer Size Increment is required. This privacy feature prevents revealing your exact wallet balance.');
|
||||||
} else {
|
} else {
|
||||||
@@ -1069,8 +1069,7 @@ const AmmTablesManager = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (/^[0-9]*\.?[0-9]*$/.test(amountStep)) {
|
if (/^[0-9]*\.?[0-9]*$/.test(amountStep)) {
|
||||||
const parsedValue = parseFloat(amountStep);
|
if (amountStep <= 0) {
|
||||||
if (parsedValue <= 0) {
|
|
||||||
if (window.showErrorModal) {
|
if (window.showErrorModal) {
|
||||||
window.showErrorModal('Validation Error', 'Offer Size Increment must be greater than zero.');
|
window.showErrorModal('Validation Error', 'Offer Size Increment must be greater than zero.');
|
||||||
} else {
|
} else {
|
||||||
@@ -1078,7 +1077,7 @@ const AmmTablesManager = (function() {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (parsedValue < 0.001) {
|
if (amountStep < 0.001) {
|
||||||
if (window.showErrorModal) {
|
if (window.showErrorModal) {
|
||||||
window.showErrorModal('Validation Error', 'Offer Size Increment must be at least 0.001.');
|
window.showErrorModal('Validation Error', 'Offer Size Increment must be at least 0.001.');
|
||||||
} else {
|
} else {
|
||||||
@@ -1086,15 +1085,15 @@ const AmmTablesManager = (function() {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (parsedValue > offerAmount) {
|
if (amountStep > offerAmount) {
|
||||||
if (window.showErrorModal) {
|
if (window.showErrorModal) {
|
||||||
window.showErrorModal('Validation Error', `Offer Size Increment (${parsedValue}) cannot be greater than the offer amount (${offerAmount}).`);
|
window.showErrorModal('Validation Error', `Offer Size Increment (${amountStep}) cannot be greater than the offer amount (${offerAmount}).`);
|
||||||
} else {
|
} else {
|
||||||
alert(`Offer Size Increment (${parsedValue}) cannot be greater than the offer amount (${offerAmount}).`);
|
alert(`Offer Size Increment (${amountStep}) cannot be greater than the offer amount (${offerAmount}).`);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newItem.amount_step = parsedValue.toString();
|
newItem.amount_step = amountStep;
|
||||||
console.log(`Offer Size Increment set to: ${newItem.amount_step}`);
|
console.log(`Offer Size Increment set to: ${newItem.amount_step}`);
|
||||||
} else {
|
} else {
|
||||||
if (window.showErrorModal) {
|
if (window.showErrorModal) {
|
||||||
@@ -1502,10 +1501,10 @@ const AmmTablesManager = (function() {
|
|||||||
updatedItem.min_swap_amount = parseFloat(minSwapAmount);
|
updatedItem.min_swap_amount = parseFloat(minSwapAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
const amountStep = document.getElementById('edit-offer-amount-step').value;
|
const amountStep = parseFloat(document.getElementById('edit-offer-amount-step').value);
|
||||||
const offerAmount = parseFloat(document.getElementById('edit-amm-amount').value);
|
const offerAmount = parseFloat(document.getElementById('edit-amm-amount').value);
|
||||||
|
|
||||||
if (!amountStep || amountStep.trim() === '') {
|
if (!amountStep) {
|
||||||
if (window.showErrorModal) {
|
if (window.showErrorModal) {
|
||||||
window.showErrorModal('Validation Error', 'Offer Size Increment is required. This privacy feature prevents revealing your exact wallet balance.');
|
window.showErrorModal('Validation Error', 'Offer Size Increment is required. This privacy feature prevents revealing your exact wallet balance.');
|
||||||
} else {
|
} else {
|
||||||
@@ -1515,8 +1514,7 @@ const AmmTablesManager = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (/^[0-9]*\.?[0-9]*$/.test(amountStep)) {
|
if (/^[0-9]*\.?[0-9]*$/.test(amountStep)) {
|
||||||
const parsedValue = parseFloat(amountStep);
|
if (amountStep <= 0) {
|
||||||
if (parsedValue <= 0) {
|
|
||||||
if (window.showErrorModal) {
|
if (window.showErrorModal) {
|
||||||
window.showErrorModal('Validation Error', 'Offer Size Increment must be greater than zero.');
|
window.showErrorModal('Validation Error', 'Offer Size Increment must be greater than zero.');
|
||||||
} else {
|
} else {
|
||||||
@@ -1524,7 +1522,7 @@ const AmmTablesManager = (function() {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (parsedValue < 0.001) {
|
if (amountStep < 0.001) {
|
||||||
if (window.showErrorModal) {
|
if (window.showErrorModal) {
|
||||||
window.showErrorModal('Validation Error', 'Offer Size Increment must be at least 0.001.');
|
window.showErrorModal('Validation Error', 'Offer Size Increment must be at least 0.001.');
|
||||||
} else {
|
} else {
|
||||||
@@ -1532,15 +1530,15 @@ const AmmTablesManager = (function() {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (parsedValue > offerAmount) {
|
if (amountStep > offerAmount) {
|
||||||
if (window.showErrorModal) {
|
if (window.showErrorModal) {
|
||||||
window.showErrorModal('Validation Error', `Offer Size Increment (${parsedValue}) cannot be greater than the offer amount (${offerAmount}).`);
|
window.showErrorModal('Validation Error', `Offer Size Increment (${amountStep}) cannot be greater than the offer amount (${offerAmount}).`);
|
||||||
} else {
|
} else {
|
||||||
alert(`Offer Size Increment (${parsedValue}) cannot be greater than the offer amount (${offerAmount}).`);
|
alert(`Offer Size Increment (${amountStep}) cannot be greater than the offer amount (${offerAmount}).`);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updatedItem.amount_step = parsedValue.toString();
|
updatedItem.amount_step = amountStep;
|
||||||
console.log(`Offer Size Increment set to: ${updatedItem.amount_step}`);
|
console.log(`Offer Size Increment set to: ${updatedItem.amount_step}`);
|
||||||
} else {
|
} else {
|
||||||
if (window.showErrorModal) {
|
if (window.showErrorModal) {
|
||||||
|
|||||||
@@ -329,8 +329,10 @@ def readConfig(args, known_coins):
|
|||||||
elif offer_template["enabled"] is not True:
|
elif offer_template["enabled"] is not True:
|
||||||
continue
|
continue
|
||||||
if "amount" not in offer_template:
|
if "amount" not in offer_template:
|
||||||
offer_template["amount"] = None
|
offer_template["amount"] = 0
|
||||||
print(f"{offer_template['name']} amount missing. Skipping offer")
|
print(f"{offer_template['name']} Offer amount missing. Skipping offer")
|
||||||
|
num_changes += 1
|
||||||
|
continue
|
||||||
elif (
|
elif (
|
||||||
offer_template["amount"] is None
|
offer_template["amount"] is None
|
||||||
or float(offer_template["amount"]) < min_swap_size
|
or float(offer_template["amount"]) < min_swap_size
|
||||||
@@ -338,6 +340,10 @@ def readConfig(args, known_coins):
|
|||||||
print(f"{offer_template['name']} Offer amount invalid. Skipping offer")
|
print(f"{offer_template['name']} Offer amount invalid. Skipping offer")
|
||||||
continue
|
continue
|
||||||
amount = float(offer_template["amount"])
|
amount = float(offer_template["amount"])
|
||||||
|
if "minrate" not in offer_template or offer_template["minrate"] is None:
|
||||||
|
offer_template["minrate"] = 0
|
||||||
|
print(f"{offer_template['name']} Offer minrate missing. Setting to 0")
|
||||||
|
num_changes += 1
|
||||||
if "amount_step" not in offer_template:
|
if "amount_step" not in offer_template:
|
||||||
print(
|
print(
|
||||||
f"Adding mandatory amount_step for {offer_template['name']} (privacy feature)"
|
f"Adding mandatory amount_step for {offer_template['name']} (privacy feature)"
|
||||||
|
|||||||
Reference in New Issue
Block a user