Merge pull request #313 from blockworks-foundation/unsettled-close-account
add unsettled balances to close account
This commit is contained in:
commit
434f4c10c1
|
@ -54,6 +54,11 @@ const CloseAccountModal: FunctionComponent<CloseAccountModalProps> = ({
|
|||
const openOrders = useMangoStore((s) => s.selectedMangoAccount.openOrders)
|
||||
const setMangoStore = useMangoStore((s) => s.set)
|
||||
const activeAlerts = useMangoStore((s) => s.alerts.activeAlerts)
|
||||
const spotBalances = useMangoStore((s) => s.selectedMangoAccount.spotBalances)
|
||||
|
||||
const unsettledBalances = spotBalances.filter(
|
||||
(bal) => bal.unsettled && bal.unsettled > 0
|
||||
)
|
||||
|
||||
const fetchTotalAccountSOL = useCallback(async () => {
|
||||
if (!mangoAccount) {
|
||||
|
@ -162,7 +167,10 @@ const CloseAccountModal: FunctionComponent<CloseAccountModalProps> = ({
|
|||
}
|
||||
|
||||
const isDisabled =
|
||||
(openOrders && openOrders.length > 0) || hasBorrows || hasOpenPositions
|
||||
(openOrders && openOrders.length > 0) ||
|
||||
hasBorrows ||
|
||||
hasOpenPositions ||
|
||||
!!unsettledBalances.length
|
||||
|
||||
return (
|
||||
<Modal onClose={onClose} isOpen={isOpen && mangoAccount !== undefined}>
|
||||
|
@ -240,6 +248,12 @@ const CloseAccountModal: FunctionComponent<CloseAccountModalProps> = ({
|
|||
{t('close-account:close-open-orders')}
|
||||
</div>
|
||||
) : null}
|
||||
{unsettledBalances.length ? (
|
||||
<div className="flex items-center text-th-fgd-2">
|
||||
<ExclamationCircleIcon className="mr-1.5 h-4 w-4 text-th-red" />
|
||||
{t('close-account:settle-balances')}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
"close-account": "Close Account",
|
||||
"close-all-borrows": "Close all borrows",
|
||||
"close-open-orders": "Close all open orders",
|
||||
"close-perp-positions": "Close and settle all Perp positons",
|
||||
"close-perp-positions": "Close and settle all futures positons",
|
||||
"closing-account-will": "Closing your Mango Account will:",
|
||||
"delete-your-account": "Delete your Mango account",
|
||||
"error-deleting-account": "Error deleting account",
|
||||
"delete-your-account": "Delete your Mango Account",
|
||||
"error-deleting-account": "Error deleting your Mango Account",
|
||||
"goodbye": "Until next time 👋",
|
||||
"recover-x-sol": "Recover {{amount}} SOL (rent for your account)",
|
||||
"settle-balances": "Settle all balances",
|
||||
"transaction-confirmed": "Transaction Confirmed",
|
||||
"withdraw-assets-worth": "Withdraw assets worth {{value}}"
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
"error-deleting-account": "Error deleting account",
|
||||
"goodbye": "Until next time 👋",
|
||||
"recover-x-sol": "Recover {{amount}} SOL (rent for your account)",
|
||||
"settle-balances": "Settle all balances",
|
||||
"transaction-confirmed": "Transaction Confirmed",
|
||||
"withdraw-assets-worth": "Withdraw assets worth {{value}}"
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
"error-deleting-account": "删除帐户出错",
|
||||
"goodbye": "再见 👋",
|
||||
"recover-x-sol": "收回{{amount}}SOL(帐户租金)",
|
||||
"settle-balances": "Settle all balances",
|
||||
"transaction-confirmed": "交易成功",
|
||||
"withdraw-assets-worth": "将总价值{{value}}提出到您的钱包"
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
"error-deleting-account": "刪除帳戶出錯",
|
||||
"goodbye": "再見 👋",
|
||||
"recover-x-sol": "收回{{amount}}SOL(帳戶租金)",
|
||||
"settle-balances": "Settle all balances",
|
||||
"transaction-confirmed": "交易成功",
|
||||
"withdraw-assets-worth": "將總價值{{value}}提出到您的錢包"
|
||||
}
|
Loading…
Reference in New Issue