diff --git a/package.json b/package.json
index c71b9947e8..ea3df1643d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "kwenta",
- "version": "7.3.2",
+ "version": "7.3.3",
"description": "Kwenta",
"main": "index.js",
"scripts": {
diff --git a/packages/app/package.json b/packages/app/package.json
index b261f3e6f7..881e58f5f8 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -1,6 +1,6 @@
{
"name": "@kwenta/app",
- "version": "7.3.2",
+ "version": "7.3.3",
"scripts": {
"dev": "next",
"build": "next build",
diff --git a/packages/app/src/components/TVChart/TVChart.tsx b/packages/app/src/components/TVChart/TVChart.tsx
index 610bacc369..dfdc5d6d94 100644
--- a/packages/app/src/components/TVChart/TVChart.tsx
+++ b/packages/app/src/components/TVChart/TVChart.tsx
@@ -172,9 +172,9 @@ export function TVChart({
container: containerId,
library_path: libraryPath,
locale: 'en',
- enabled_features: ['hide_left_toolbar_by_default'],
disabled_features: [
'header_compare',
+ 'hide_left_toolbar_by_default',
'study_templates',
'header_symbol_search',
'display_market_status',
@@ -195,7 +195,7 @@ export function TVChart({
{ text: '12H', resolution: '5', description: '1 Day' },
{ text: '1D', resolution: '15', description: '1 Day' },
{ text: '5D', resolution: '15', description: '5 Days' },
- { text: '30D', resolution: '1H', description: '30 Days' },
+ { text: '1M', resolution: '1H', description: '1 Month' },
{ text: '3M', resolution: '1H', description: '3 Months' },
] as TimeFrameItem[],
saved_data: chartData,
diff --git a/packages/app/src/sections/futures/EditPositionModal/EditPositionMarginModal.tsx b/packages/app/src/sections/futures/EditPositionModal/EditPositionMarginModal.tsx
index c563fa3b73..4b434b88ec 100644
--- a/packages/app/src/sections/futures/EditPositionModal/EditPositionMarginModal.tsx
+++ b/packages/app/src/sections/futures/EditPositionModal/EditPositionMarginModal.tsx
@@ -32,7 +32,6 @@ import {
selectIdleMargin,
selectIsFetchingTradePreview,
selectSubmittingFuturesTx,
- selectTradePreviewError,
} from 'state/futures/selectors'
import { useAppDispatch, useAppSelector } from 'state/hooks'
@@ -50,7 +49,6 @@ export default function EditPositionMarginModal() {
const idleMargin = useAppSelector(selectIdleMargin)
const modal = useAppSelector(selectShowPositionModal)
const { market, position } = useAppSelector(selectEditPositionModalInfo)
- const previewError = useAppSelector(selectTradePreviewError)
const allowanceValid = useAppSelector(selectEditMarginAllowanceValid)
const [transferType, setTransferType] = useState(0)
@@ -96,15 +94,20 @@ export default function EditPositionMarginModal() {
[transferType, position?.position?.leverage, market?.appMaxLeverage]
)
- const orderError = useMemo(() => {
- if (previewError) return t(previewErrorI18n(previewError))
+ const previewError = useMemo(() => {
+ if (maxLeverageExceeded) return 'Max leverage exceeded'
if (preview?.showStatus) return preview?.statusMessage
return null
- }, [preview?.showStatus, preview?.statusMessage, previewError, t])
+ }, [preview?.showStatus, preview?.statusMessage, maxLeverageExceeded])
+
+ const errorMessage = useMemo(
+ () => previewError || transactionState?.error,
+ [previewError, transactionState?.error]
+ )
const submitDisabled = useMemo(() => {
- return marginWei.eq(0) || invalid || isLoading || maxLeverageExceeded || orderError
- }, [marginWei, invalid, isLoading, maxLeverageExceeded, orderError])
+ return marginWei.eq(0) || invalid || isLoading || !!previewError
+ }, [marginWei, invalid, isLoading, previewError])
const onChangeTab = (selection: number) => {
setTransferType(selection)
@@ -205,13 +208,10 @@ export default function EditPositionMarginModal() {
: t('futures.market.trade.edit-position.submit-margin-withdraw')}
- {(transactionState?.error || orderError || maxLeverageExceeded) && (
+ {errorMessage && (
<>
-
+
>
)}
diff --git a/packages/app/src/sections/futures/EditPositionModal/EditPositionSizeModal.tsx b/packages/app/src/sections/futures/EditPositionModal/EditPositionSizeModal.tsx
index ac6a9829f7..dfb604ee96 100644
--- a/packages/app/src/sections/futures/EditPositionModal/EditPositionSizeModal.tsx
+++ b/packages/app/src/sections/futures/EditPositionModal/EditPositionSizeModal.tsx
@@ -127,23 +127,28 @@ export default function EditPositionSizeModal() {
[sizeWei, maxNativeValueWithBuffer]
)
- const submitDisabled = useMemo(() => {
- return (
- sizeWei.eq(0) ||
- invalid ||
- isLoading ||
- maxLeverageExceeded ||
- (preview?.exceedsPriceProtection && !overridePriceProtection)
- )
+ const previewError = useMemo(() => {
+ if (preview?.exceedsPriceProtection && !overridePriceProtection)
+ return 'Exceeds Price Protection'
+ if (maxLeverageExceeded) return 'Max leverage exceeded'
+ if (preview?.statusMessage && preview.statusMessage !== 'Success') return preview?.statusMessage
+ return null
}, [
- sizeWei,
- invalid,
- isLoading,
- maxLeverageExceeded,
+ preview?.statusMessage,
preview?.exceedsPriceProtection,
+ maxLeverageExceeded,
overridePriceProtection,
])
+ const errorMessage = useMemo(
+ () => previewError || transactionState?.error,
+ [previewError, transactionState?.error]
+ )
+
+ const submitDisabled = useMemo(() => {
+ return sizeWei.eq(0) || invalid || isLoading || !!previewError
+ }, [sizeWei, invalid, isLoading, previewError])
+
const onClose = () => {
if (market) {
dispatch(editCrossMarginPositionSize(market.marketKey, ''))
@@ -248,18 +253,10 @@ export default function EditPositionSizeModal() {
: t('futures.market.trade.edit-position.submit-size-decrease')}
- {(transactionState?.error ||
- maxLeverageExceeded ||
- (preview?.exceedsPriceProtection && !overridePriceProtection)) && (
+ {errorMessage && (
<>
-
+
>
)}
diff --git a/packages/app/src/state/futures/selectors.ts b/packages/app/src/state/futures/selectors.ts
index 7b0ff5bb99..589fe9aa63 100644
--- a/packages/app/src/state/futures/selectors.ts
+++ b/packages/app/src/state/futures/selectors.ts
@@ -1620,7 +1620,7 @@ export const selectAverageEntryPrice = createSelector(
const existingValue = avgEntryPrice.mul(size)
const newValue = tradePreview.price.mul(tradePreview.sizeDelta.abs())
const totalValue = existingValue.add(newValue)
- return totalValue.div(tradePreview.size.abs())
+ return tradePreview.size.abs().gt(0) ? totalValue.div(tradePreview.size.abs()) : wei(0)
}
return null
}
diff --git a/packages/app/testing/e2e/.eslintrc.js b/packages/app/testing/e2e/.eslintrc.js
deleted file mode 100644
index 7bb3d23671..0000000000
--- a/packages/app/testing/e2e/.eslintrc.js
+++ /dev/null
@@ -1,15 +0,0 @@
-const path = require('path')
-
-const absoluteSynpressNodeModulesPath = path.join(
- process.cwd(),
- '/packages/app/node_modules/@synthetixio/synpress'
-)
-
-module.exports = {
- extends: `${absoluteSynpressNodeModulesPath}/.eslintrc.js`,
- rules: {
- 'ui-testing/no-css-page-layout-selector': ['warn', 'cypress'],
- 'testing-library/await-async-query': 'off',
- 'testing-library/prefer-screen-queries': 'off',
- },
-}