disable free collateral warning for now, might be not 100% correct
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
5133f00dcf
commit
8a7ce380e4
|
@ -371,7 +371,6 @@ const SwapFormSubmitButton = ({
|
||||||
const disabled =
|
const disabled =
|
||||||
connected &&
|
connected &&
|
||||||
!showInsufficientBalance &&
|
!showInsufficientBalance &&
|
||||||
freeCollateral > 0 &&
|
|
||||||
(!amountIn.toNumber() ||
|
(!amountIn.toNumber() ||
|
||||||
!amountOut ||
|
!amountOut ||
|
||||||
!selectedRoute ||
|
!selectedRoute ||
|
||||||
|
|
|
@ -5,7 +5,7 @@ import NumberFormat, {
|
||||||
} from 'react-number-format'
|
} from 'react-number-format'
|
||||||
import { formatCurrencyValue } from 'utils/numbers'
|
import { formatCurrencyValue } from 'utils/numbers'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Dispatch, SetStateAction, useMemo } from 'react'
|
import { Dispatch, SetStateAction } from 'react'
|
||||||
import mangoStore from '@store/mangoStore'
|
import mangoStore from '@store/mangoStore'
|
||||||
import useMangoGroup from 'hooks/useMangoGroup'
|
import useMangoGroup from 'hooks/useMangoGroup'
|
||||||
import { INPUT_TOKEN_DEFAULT } from 'utils/constants'
|
import { INPUT_TOKEN_DEFAULT } from 'utils/constants'
|
||||||
|
@ -14,7 +14,6 @@ import MaxSwapAmount from './MaxSwapAmount'
|
||||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||||
import InlineNotification from '@components/shared/InlineNotification'
|
import InlineNotification from '@components/shared/InlineNotification'
|
||||||
import useMangoAccount from 'hooks/useMangoAccount'
|
import useMangoAccount from 'hooks/useMangoAccount'
|
||||||
import { toUiDecimalsForQuote } from '@blockworks-foundation/mango-v4'
|
|
||||||
import { SwapFormTokenListType } from './SwapFormTokenList'
|
import { SwapFormTokenListType } from './SwapFormTokenList'
|
||||||
import { useAbsInputPosition } from './useTokenMax'
|
import { useAbsInputPosition } from './useTokenMax'
|
||||||
|
|
||||||
|
@ -43,14 +42,6 @@ const ReduceInputTokenInput = ({
|
||||||
amountIn: amountInFormValue,
|
amountIn: amountInFormValue,
|
||||||
} = mangoStore((s) => s.swap)
|
} = 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 (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`grid grid-cols-2 rounded-t-xl bg-th-bkg-2 p-3 pb-2 ${className}`}
|
className={`grid grid-cols-2 rounded-t-xl bg-th-bkg-2 p-3 pb-2 ${className}`}
|
||||||
|
@ -99,7 +90,7 @@ const ReduceInputTokenInput = ({
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
{mangoAccountAddress && freeCollateral <= 0 ? (
|
{mangoAccountAddress ? (
|
||||||
<div className="col-span-2 mt-1 flex justify-center">
|
<div className="col-span-2 mt-1 flex justify-center">
|
||||||
<InlineNotification
|
<InlineNotification
|
||||||
type="warning"
|
type="warning"
|
||||||
|
|
|
@ -5,7 +5,7 @@ import NumberFormat, {
|
||||||
} from 'react-number-format'
|
} from 'react-number-format'
|
||||||
import { formatCurrencyValue } from 'utils/numbers'
|
import { formatCurrencyValue } from 'utils/numbers'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Dispatch, SetStateAction, useMemo } from 'react'
|
import { Dispatch, SetStateAction } from 'react'
|
||||||
import mangoStore from '@store/mangoStore'
|
import mangoStore from '@store/mangoStore'
|
||||||
import useMangoGroup from 'hooks/useMangoGroup'
|
import useMangoGroup from 'hooks/useMangoGroup'
|
||||||
import { INPUT_TOKEN_DEFAULT } from 'utils/constants'
|
import { INPUT_TOKEN_DEFAULT } from 'utils/constants'
|
||||||
|
@ -14,7 +14,6 @@ import MaxSwapAmount from './MaxSwapAmount'
|
||||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||||
import InlineNotification from '@components/shared/InlineNotification'
|
import InlineNotification from '@components/shared/InlineNotification'
|
||||||
import useMangoAccount from 'hooks/useMangoAccount'
|
import useMangoAccount from 'hooks/useMangoAccount'
|
||||||
import { toUiDecimalsForQuote } from '@blockworks-foundation/mango-v4'
|
|
||||||
import { SwapFormTokenListType } from './SwapFormTokenList'
|
import { SwapFormTokenListType } from './SwapFormTokenList'
|
||||||
import { useTokenMax } from './useTokenMax'
|
import { useTokenMax } from './useTokenMax'
|
||||||
|
|
||||||
|
@ -43,14 +42,6 @@ const SellTokenInput = ({
|
||||||
amountIn: amountInFormValue,
|
amountIn: amountInFormValue,
|
||||||
} = mangoStore((s) => s.swap)
|
} = 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 (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`grid grid-cols-2 rounded-t-xl bg-th-bkg-2 p-3 pb-2 ${className}`}
|
className={`grid grid-cols-2 rounded-t-xl bg-th-bkg-2 p-3 pb-2 ${className}`}
|
||||||
|
@ -99,7 +90,7 @@ const SellTokenInput = ({
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
{mangoAccountAddress && freeCollateral <= 0 ? (
|
{mangoAccountAddress ? (
|
||||||
<div className="col-span-2 mt-1 flex justify-center">
|
<div className="col-span-2 mt-1 flex justify-center">
|
||||||
<InlineNotification
|
<InlineNotification
|
||||||
type="warning"
|
type="warning"
|
||||||
|
|
Loading…
Reference in New Issue