disable free collateral warning for now, might be not 100% correct

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2023-09-18 19:30:13 +02:00
parent 5133f00dcf
commit 8a7ce380e4
3 changed files with 4 additions and 23 deletions

View File

@ -371,7 +371,6 @@ const SwapFormSubmitButton = ({
const disabled =
connected &&
!showInsufficientBalance &&
freeCollateral > 0 &&
(!amountIn.toNumber() ||
!amountOut ||
!selectedRoute ||

View File

@ -5,7 +5,7 @@ import NumberFormat, {
} from 'react-number-format'
import { formatCurrencyValue } from 'utils/numbers'
import { useTranslation } from 'react-i18next'
import { Dispatch, SetStateAction, useMemo } from 'react'
import { Dispatch, SetStateAction } from 'react'
import mangoStore from '@store/mangoStore'
import useMangoGroup from 'hooks/useMangoGroup'
import { INPUT_TOKEN_DEFAULT } from 'utils/constants'
@ -14,7 +14,6 @@ import MaxSwapAmount from './MaxSwapAmount'
import useUnownedAccount from 'hooks/useUnownedAccount'
import InlineNotification from '@components/shared/InlineNotification'
import useMangoAccount from 'hooks/useMangoAccount'
import { toUiDecimalsForQuote } from '@blockworks-foundation/mango-v4'
import { SwapFormTokenListType } from './SwapFormTokenList'
import { useAbsInputPosition } from './useTokenMax'
@ -43,14 +42,6 @@ const ReduceInputTokenInput = ({
amountIn: amountInFormValue,
} = mangoStore((s) => s.swap)
const freeCollateral = useMemo(() => {
const group = mangoStore.getState().group
const mangoAccount = mangoStore.getState().mangoAccount.current
return group && mangoAccount
? toUiDecimalsForQuote(mangoAccount.getCollateralValue(group))
: 10
}, [mangoAccountAddress])
return (
<div
className={`grid grid-cols-2 rounded-t-xl bg-th-bkg-2 p-3 pb-2 ${className}`}
@ -99,7 +90,7 @@ const ReduceInputTokenInput = ({
</span>
) : null}
</div>
{mangoAccountAddress && freeCollateral <= 0 ? (
{mangoAccountAddress ? (
<div className="col-span-2 mt-1 flex justify-center">
<InlineNotification
type="warning"

View File

@ -5,7 +5,7 @@ import NumberFormat, {
} from 'react-number-format'
import { formatCurrencyValue } from 'utils/numbers'
import { useTranslation } from 'react-i18next'
import { Dispatch, SetStateAction, useMemo } from 'react'
import { Dispatch, SetStateAction } from 'react'
import mangoStore from '@store/mangoStore'
import useMangoGroup from 'hooks/useMangoGroup'
import { INPUT_TOKEN_DEFAULT } from 'utils/constants'
@ -14,7 +14,6 @@ import MaxSwapAmount from './MaxSwapAmount'
import useUnownedAccount from 'hooks/useUnownedAccount'
import InlineNotification from '@components/shared/InlineNotification'
import useMangoAccount from 'hooks/useMangoAccount'
import { toUiDecimalsForQuote } from '@blockworks-foundation/mango-v4'
import { SwapFormTokenListType } from './SwapFormTokenList'
import { useTokenMax } from './useTokenMax'
@ -43,14 +42,6 @@ const SellTokenInput = ({
amountIn: amountInFormValue,
} = mangoStore((s) => s.swap)
const freeCollateral = useMemo(() => {
const group = mangoStore.getState().group
const mangoAccount = mangoStore.getState().mangoAccount.current
return group && mangoAccount
? toUiDecimalsForQuote(mangoAccount.getCollateralValue(group))
: 10
}, [mangoAccountAddress])
return (
<div
className={`grid grid-cols-2 rounded-t-xl bg-th-bkg-2 p-3 pb-2 ${className}`}
@ -99,7 +90,7 @@ const SellTokenInput = ({
</span>
) : null}
</div>
{mangoAccountAddress && freeCollateral <= 0 ? (
{mangoAccountAddress ? (
<div className="col-span-2 mt-1 flex justify-center">
<InlineNotification
type="warning"