From 329a2cd302f971ca65b342dd6eacd979ec74f1ab Mon Sep 17 00:00:00 2001 From: Ralfs Date: Fri, 21 May 2021 23:58:01 +0300 Subject: [PATCH] removed fee discount tab and sol retain deposit --- components/DepositModal.tsx | 4 +- components/FeeDiscountsTable.tsx | 84 -------------------------------- components/UserInfo.tsx | 5 +- 3 files changed, 3 insertions(+), 90 deletions(-) delete mode 100644 components/FeeDiscountsTable.tsx diff --git a/components/DepositModal.tsx b/components/DepositModal.tsx index 3d60f47..d86e012 100644 --- a/components/DepositModal.tsx +++ b/components/DepositModal.tsx @@ -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() } diff --git a/components/FeeDiscountsTable.tsx b/components/FeeDiscountsTable.tsx deleted file mode 100644 index 9116760..0000000 --- a/components/FeeDiscountsTable.tsx +++ /dev/null @@ -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 ( -
- {connected ? ( -
-
-
- Your SRM contribution -
- {contributedSrm} -
-
-
- - -
-
-
- ) : null} -
-
-
Total SRM in Mango
-
- {totalSrm.toLocaleString(undefined, { - maximumFractionDigits: SRM_DECIMALS, - })} -
-
-
-
Maker Fee
-
- {rates ? percentFormat.format(rates.maker) : null} -
-
-
-
Taker Fee
-
- {rates ? percentFormat.format(rates.taker) : null} -
-
-
- {showDeposit && ( - - )} - {showWithdraw && ( - - )} -
- ) -} - -export default FeeDiscountsTable diff --git a/components/UserInfo.tsx b/components/UserInfo.tsx index 80f9fed..2ef6d32 100644 --- a/components/UserInfo.tsx +++ b/components/UserInfo.tsx @@ -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 case 'Balances': return - case 'Fee Discounts': - return case 'Trade History': return default: