From f5743a4d79c07946002a541ecd3212c87218bcce Mon Sep 17 00:00:00 2001 From: Hossein Date: Mon, 30 Dec 2024 14:54:26 +0330 Subject: [PATCH 1/2] #244 fix: Corrected minimum order amount display in buy/sell components --- .../components/EasyOrder/EasyOrder.js | 35 +++++++++++++------ src/store/sagas/global.js | 20 +++++------ 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/main/Browser/Pages/EasyTrading/components/EasyOrder/EasyOrder.js b/src/main/Browser/Pages/EasyTrading/components/EasyOrder/EasyOrder.js index 0b144b65..4d8c4d53 100644 --- a/src/main/Browser/Pages/EasyTrading/components/EasyOrder/EasyOrder.js +++ b/src/main/Browser/Pages/EasyTrading/components/EasyOrder/EasyOrder.js @@ -30,6 +30,8 @@ const EasyOrder = () => { totalPrice: null, }); + + const [order, setOrder] = useState({ tradeFee: new BN(0), stopLimit: false, @@ -76,6 +78,12 @@ const EasyOrder = () => { type: selected?.type ==="ask" ? "bid" : "ask" }) + setAlert({ + submit: false, + reqAmount: null, + totalPrice: null, + }) + } const [options, setOptions] = useState({ @@ -99,6 +107,7 @@ const EasyOrder = () => { pricePerUnit: new BN(bestPrice) }) } + useEffect(() => { bestPriceHandler() }, [orderBook, selected]) @@ -110,11 +119,12 @@ const EasyOrder = () => { const reqAmount = new BN(value); let range = "baseRange" if (selected.type === "bid") range = "quoteRange" + if (reqAmount.isZero() && reqAmount.isLessThan(selected.pair[range].min)) { newAlert = @@ -147,18 +157,17 @@ const EasyOrder = () => { newAlert = } - if (!totalPrice.mod(selected.pair[range].step).isZero()) { newAlert = } setAlert({...alert, totalPrice: newAlert}); @@ -262,6 +271,11 @@ const EasyOrder = () => { pricePerUnit: new BN(0), totalPrice: new BN(0), }) + setAlert({ + submit: false, + reqAmount: null, + totalPrice: null, + }) } const sellOnChangeHandler = (e) => { const newSell = e.value; @@ -281,6 +295,11 @@ const EasyOrder = () => { pricePerUnit: new BN(0), totalPrice: new BN(0), }) + setAlert({ + submit: false, + reqAmount: null, + totalPrice: null, + }) } const showBestPrice = () => { if (order.pricePerUnit.isZero()) return 0 @@ -288,18 +307,14 @@ const EasyOrder = () => { return new BN(1).dividedBy(order.pricePerUnit).decimalPlaces(selected.pair?.baseAssetPrecision).toFormat() } - useEffect(() => { +/* useEffect(() => { if (order.totalPrice.isGreaterThan(userAccount?.wallets[selected?.sell]?.free)) { return setAlert({ ...alert, totalPrice: t('orders.notEnoughBalance') }) } - return setAlert({ - ...alert, - totalPrice: null - }) - }, [order.totalPrice]) + }, [order.totalPrice])*/ return ( diff --git a/src/store/sagas/global.js b/src/store/sagas/global.js index e370348f..3bf4294c 100644 --- a/src/store/sagas/global.js +++ b/src/store/sagas/global.js @@ -185,16 +185,16 @@ export function* loadConfig(action) { } const assetsScope = { - TBTC: {min: 0.0000001, step: 0.0000001}, - BTC: {min: 0.0000001, step: 0.0000001}, - TETH: {min: 0.0000001, step: 0.0000001}, - ETH: {min: 0.0000001, step: 0.0000001}, - TBNB: {min: 0.00001, step: 0.00001}, - BNB: {min: 0.00001, step: 0.00001}, + TBTC: {min: 0.000001, step: 0.000001}, + BTC: {min: 0.000001, step: 0.000001}, + TETH: {min: 0.000001, step: 0.000001}, + ETH: {min: 0.000001, step: 0.000001}, + TBNB: {min: 0.0001, step: 0.0001}, + BNB: {min: 0.0001, step: 0.0001}, USDT: {min: 0.01, step: 0.01}, IRT: {min: 50000, step: 1000}, - TRX: {min: 0.0000001, step: 0.0000001}, - SOL: {min: 0.000001, step: 0.000001}, - TON: {min: 0.00001, step: 0.00001}, - DOGE: {min: 0.00001, step: 0.00001}, + TRX: {min: 0.000001, step: 0.000001}, + SOL: {min: 0.00001, step: 0.00001}, + TON: {min: 0.0001, step: 0.0001}, + DOGE: {min: 0.0001, step: 0.0001}, } \ No newline at end of file From 71890c7337c02108b863842b35b50f9c936d3bf3 Mon Sep 17 00:00:00 2001 From: Hossein Date: Mon, 30 Dec 2024 15:01:23 +0330 Subject: [PATCH 2/2] #244 Fix divisibility in order component --- .../Browser/Pages/EasyTrading/components/EasyOrder/EasyOrder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/Browser/Pages/EasyTrading/components/EasyOrder/EasyOrder.js b/src/main/Browser/Pages/EasyTrading/components/EasyOrder/EasyOrder.js index 4d8c4d53..8ae33257 100644 --- a/src/main/Browser/Pages/EasyTrading/components/EasyOrder/EasyOrder.js +++ b/src/main/Browser/Pages/EasyTrading/components/EasyOrder/EasyOrder.js @@ -133,7 +133,7 @@ const EasyOrder = () => { if (!reqAmount.mod(selected.pair[range].step).isZero()) { newAlert = } setAlert({...alert, reqAmount: newAlert});