Merge pull request #28 from hyle-team/staging

merge staging
This commit is contained in:
Dmitrii Kolpakov 2025-09-18 18:52:57 +07:00 committed by GitHub
commit 91629c40b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,6 +67,11 @@ function InputPanelItem(props: InputPanelItemProps) {
setRangeInputValue('50');
}
const numericBalance = Number(balance);
const numericZanoBalance = Number(zanoBalance);
const hasValidAssetBalance = Number.isFinite(numericBalance);
const hasValidZanoBalance = Number.isFinite(numericZanoBalance);
async function postOrder() {
const price = new Decimal(priceState);
const amount = new Decimal(amountState);
@ -81,22 +86,21 @@ function InputPanelItem(props: InputPanelItemProps) {
if (!isFull) return;
const assetAmount = new Decimal(hasValidAssetBalance ? String(numericBalance) : '0');
const zanoAmount = new Decimal(hasValidZanoBalance ? String(numericZanoBalance) : '0');
if (isBuy) {
const zanoAmount = new Decimal(zanoBalance);
if (zanoAmount.lessThan(total)) {
setAlertState('error');
setAlertSubtitle('Insufficient ZANO balance');
setTimeout(() => setAlertState(null), 3000);
return;
}
} else {
const assetAmount = new Decimal(balance);
if (assetAmount.lessThan(amount)) {
setAlertState('error');
setAlertSubtitle(`Insufficient ${firstCurrencyName} balance`);
setTimeout(() => setAlertState(null), 3000);
return;
}
} else if (assetAmount.lessThan(amount)) {
setAlertState('error');
setAlertSubtitle(`Insufficient ${firstCurrencyName} balance`);
setTimeout(() => setAlertState(null), 3000);
return;
}
const orderData: CreateOrderData = {