removed fee discount tab and sol retain deposit
This commit is contained in:
parent
7a110f9ea5
commit
329a2cd302
|
@ -3,6 +3,7 @@ import {
|
|||
nativeToUi,
|
||||
sleep,
|
||||
} from '@blockworks-foundation/mango-client/lib/utils'
|
||||
import { WRAPPED_SOL_MINT } from '@project-serum/serum/lib/token-instructions'
|
||||
import Modal from './Modal'
|
||||
import Input from './Input'
|
||||
import AccountSelect from './AccountSelect'
|
||||
|
@ -43,10 +44,9 @@ const DepositModal = ({ isOpen, onClose }) => {
|
|||
const getBalanceForAccount = (account) => {
|
||||
const mintAddress = account?.account.mint.toString()
|
||||
const balance = nativeToUi(
|
||||
account?.account?.amount,
|
||||
(account?.account.mint.equals(WRAPPED_SOL_MINT)) ? Math.max(account?.account?.amount - (0.05 * 1e9), 0) : account?.account?.amount,
|
||||
mintDecimals[getTokenIndex(mintAddress)]
|
||||
)
|
||||
|
||||
return balance.toString()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
import { useCallback, useState } from 'react'
|
||||
import { percentFormat } from '../utils/index'
|
||||
import useSrmAccount from '../hooks/useSrmAccount'
|
||||
import useMangoStore from '../stores/useMangoStore'
|
||||
import Button from './Button'
|
||||
import DepositSrmModal from './DepositSrmModal'
|
||||
import WithdrawSrmModal from './WithdrawSrmModal'
|
||||
import { SRM_DECIMALS } from '@project-serum/serum/lib/token-instructions'
|
||||
|
||||
const FeeDiscountsTable = () => {
|
||||
const [showDeposit, setShowDeposit] = useState(false)
|
||||
const [showWithdraw, setShowWithdraw] = useState(false)
|
||||
const { totalSrm, rates } = useSrmAccount()
|
||||
const connected = useMangoStore((s) => s.wallet.connected)
|
||||
const contributedSrm = useMangoStore((s) => s.wallet.contributedSrm)
|
||||
|
||||
const handleCloseDeposit = useCallback(() => {
|
||||
setShowDeposit(false)
|
||||
}, [])
|
||||
|
||||
const handleCloseWithdraw = useCallback(() => {
|
||||
setShowWithdraw(false)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`flex flex-col items-center bg-th-bkg-1 py-6 mt-4 rounded-md`}
|
||||
>
|
||||
{connected ? (
|
||||
<div className="mb-6">
|
||||
<div className="bg-th-bkg-2 p-6 rounded">
|
||||
<div className="text-th-fgd-4 text-center">
|
||||
Your SRM contribution
|
||||
<div className="text-2xl font-semibold text-th-fgd-1">
|
||||
{contributedSrm}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex space-x-4 mt-4">
|
||||
<Button onClick={() => setShowDeposit(true)}>Deposit</Button>
|
||||
<Button
|
||||
onClick={() => setShowWithdraw(true)}
|
||||
disabled={!(contributedSrm > 0)}
|
||||
>
|
||||
Withdraw
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<div
|
||||
className={`flex flex-col sm:flex-row justify-between text-th-fgd-4 text-center`}
|
||||
>
|
||||
<div className="px-4">
|
||||
<div>Total SRM in Mango</div>
|
||||
<div className="text-th-fgd-1 text-lg font-semibold">
|
||||
{totalSrm.toLocaleString(undefined, {
|
||||
maximumFractionDigits: SRM_DECIMALS,
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-4 mt-4 sm:mt-0">
|
||||
<div>Maker Fee</div>
|
||||
<div className="text-th-fgd-1 text-lg font-semibold">
|
||||
{rates ? percentFormat.format(rates.maker) : null}
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-4 mt-4 sm:mt-0">
|
||||
<div>Taker Fee</div>
|
||||
<div className="text-th-fgd-1 text-lg font-semibold">
|
||||
{rates ? percentFormat.format(rates.taker) : null}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{showDeposit && (
|
||||
<DepositSrmModal isOpen={showDeposit} onClose={handleCloseDeposit} />
|
||||
)}
|
||||
{showWithdraw && (
|
||||
<WithdrawSrmModal isOpen={showWithdraw} onClose={handleCloseWithdraw} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default FeeDiscountsTable
|
|
@ -2,10 +2,9 @@ import { useState } from 'react'
|
|||
import FloatingElement from './FloatingElement'
|
||||
import OpenOrdersTable from './OpenOrdersTable'
|
||||
import BalancesTable from './BalancesTable'
|
||||
import FeeDiscountsTable from './FeeDiscountsTable'
|
||||
import TradeHistoryTable from './TradeHistoryTable'
|
||||
|
||||
const TABS = ['Open Orders', 'Balances', 'Fee Discounts', 'Trade History']
|
||||
const TABS = ['Open Orders', 'Balances', 'Trade History']
|
||||
|
||||
const UserInfoTabs = ({ activeTab, setActiveTab }) => {
|
||||
const handleTabChange = (tabName) => {
|
||||
|
@ -62,8 +61,6 @@ const TabContent = ({ activeTab }) => {
|
|||
return <OpenOrdersTable />
|
||||
case 'Balances':
|
||||
return <BalancesTable />
|
||||
case 'Fee Discounts':
|
||||
return <FeeDiscountsTable />
|
||||
case 'Trade History':
|
||||
return <TradeHistoryTable />
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue