diff --git a/package.json b/package.json index afee5b2..3b1ce86 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@fontsource/roboto": "^4.5.8", - "@hxronetwork/dexterity-ts": "^1.5.29", + "@hxronetwork/dexterity-ts": "^1.5.34", "@mui/material": "^5.11.12", "@mui/styled-engine-sc": "^5.11.11", "@solana/web3.js": "^1.73.3", diff --git a/src/components/ContentPage/Components/Modes/Components/Mode/index.jsx b/src/components/ContentPage/Components/Modes/Components/Mode/index.jsx index 160f01d..7a834c8 100644 --- a/src/components/ContentPage/Components/Modes/Components/Mode/index.jsx +++ b/src/components/ContentPage/Components/Modes/Components/Mode/index.jsx @@ -29,6 +29,7 @@ function Mode() { } = useWallet(); const PADDING = 1000000; const [orderType, setOrderType] = useState('Limit'); + const [isClear, setIsClear] = useState(false); const OPTION_ORDER_TYPE = ['Limit', 'ImmediateOrCancel']; @@ -57,6 +58,11 @@ function Mode() { }, [priceSelect]); const handleClickItem = (value) => { + if (isClear) { + setQtyGlobal(value); + setIsClear(false); + return; + } const newValue = Math.round(qtyGlobal * PADDING) + Math.round(value * PADDING); setQtyGlobal(`${newValue / PADDING}`); @@ -203,6 +209,7 @@ function Mode() { onClick={() => { setQtyGlobal(valueBet?.[0]); setPrice(''); + setIsClear(true); }} > Clear diff --git a/src/components/ContentPage/Components/Modes/Components/Sweep/index.jsx b/src/components/ContentPage/Components/Modes/Components/Sweep/index.jsx index a7cdc74..40f9a67 100644 --- a/src/components/ContentPage/Components/Modes/Components/Sweep/index.jsx +++ b/src/components/ContentPage/Components/Modes/Components/Sweep/index.jsx @@ -31,6 +31,7 @@ function Sweep() { const [toler, setToler] = useState('0.1'); const [price, SetPrice] = useState('-'); + const [isClear, setIsClear] = useState(false); const handleReturnProduct = (product) => { if (`${product}`.toLowerCase().includes('eth')) { @@ -51,6 +52,11 @@ function Sweep() { }, [productSelect]); const handleClickItem = (value) => { + if (isClear) { + setQtyGlobal(value); + setIsClear(false); + return; + } const newValue = Math.round(qtyGlobal * PADDING) + Math.round(value * PADDING); setQtyGlobal(`${newValue / PADDING}`); @@ -63,7 +69,11 @@ function Sweep() { if (traderFunction && traderFunction.trader && markPrice !== '-') { let newPrice = (price * toler) / 100 + price; const newOrderSend = { - price: `${(newPrice * 1).toFixed(0)}`, + price: `${productSelect}`.toLowerCase().includes('sol') + ? `${(newPrice * 1).toFixed(3)}` + : `${productSelect}`.toLowerCase().includes('eth') + ? `${(newPrice * 1).toFixed(1)}` + : `${(newPrice * 1).toFixed(0)}`, quantity: qtyGlobal, productIndex: productIndex, isIOC: true, @@ -97,7 +107,11 @@ function Sweep() { if (traderFunction && traderFunction.trader && markPrice !== '-') { let newPrice = price - (price * toler) / 100; const newOrderSend = { - price: `${(newPrice * 1).toFixed(0)}`, + price: `${productSelect}`.toLowerCase().includes('sol') + ? `${(newPrice * 1).toFixed(3)}` + : `${productSelect}`.toLowerCase().includes('eth') + ? `${(newPrice * 1).toFixed(1)}` + : `${(newPrice * 1).toFixed(0)}`, quantity: qtyGlobal, productIndex: productIndex, isIOC: true, @@ -166,6 +180,7 @@ function Sweep() { { setQtyGlobal(valueBet?.[0]); + setIsClear(true); }} > Clear diff --git a/yarn.lock b/yarn.lock index d4d8a54..53b642b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1353,10 +1353,10 @@ resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@hxronetwork/dexterity-ts@^1.5.29": - version "1.5.29" - resolved "https://registry.yarnpkg.com/@hxronetwork/dexterity-ts/-/dexterity-ts-1.5.29.tgz#4cddcc42bdd13dc51ed9a1728df60325ca15fff3" - integrity sha512-RWtTFvrTMbdN43SxFoNc87JjvUuL1z3tig99YBUeTEUtQbi4ULo87Av3FTdstDUmlOxEJLafXKwBldm6OccCuQ== +"@hxronetwork/dexterity-ts@^1.5.34": + version "1.5.34" + resolved "https://registry.yarnpkg.com/@hxronetwork/dexterity-ts/-/dexterity-ts-1.5.34.tgz#ce70ab73001f8eb83d8e55a624d129bea3c65b69" + integrity sha512-UZbylW1AuYB+4rzRQ3u5iZQdo55csuAaSmVzTQ+iL7rmTEQqMwrZm+HtsX00MXdPDbdJqU6ByFOMhSBla0T4Jg== dependencies: "@bonfida/aaob" "0.0.3" "@project-serum/anchor" "^0.24.2"