import TokenSelect from './TokenSelect' import NumberFormat, { NumberFormatValues, SourceInfo, } from 'react-number-format' import { formatCurrencyValue } from 'utils/numbers' import { useTranslation } from 'react-i18next' import { Dispatch, SetStateAction } from 'react' import mangoStore from '@store/mangoStore' import useMangoGroup from 'hooks/useMangoGroup' import { INPUT_TOKEN_DEFAULT } from 'utils/constants' import { NUMBER_FORMAT_CLASSNAMES, withValueLimit } from './MarketSwapForm' import InlineNotification from '@components/shared/InlineNotification' import { SwapFormTokenListType } from './SwapFormTokenList' import MaxAmountButton from '@components/shared/MaxAmountButton' const WalletSellTokenInput = ({ handleAmountInChange, setShowTokenSelect, handleMax, max, className, error, }: { handleAmountInChange: (e: NumberFormatValues, info: SourceInfo) => void setShowTokenSelect: Dispatch> handleMax: (amountIn: string) => void max: string className?: string error?: string }) => { const { t } = useTranslation('common') const { group } = useMangoGroup() const { inputBank, amountIn: amountInFormValue } = mangoStore((s) => s.swap) return (

{t('sell')}

{inputBank ? ( handleMax(max)} value={max} /> ) : null}
{!isNaN(Number(amountInFormValue)) ? ( {inputBank ? formatCurrencyValue( inputBank.uiPrice * Number(amountInFormValue), ) : '–'} ) : null}
{error ? (
) : null}
) } export default WalletSellTokenInput