This commit is contained in:
Adrian Brzeziński 2023-01-11 23:42:42 +01:00
parent 4627c0e070
commit 5f1a52ea7e
1 changed files with 2 additions and 12 deletions

View File

@ -6,7 +6,7 @@ import Button from '../shared/Button'
import { useTranslation } from 'next-i18next'
import { useEffect, useState } from 'react'
import BounceLoader from '../shared/BounceLoader'
import { MangoAccount } from '@blockworks-foundation/mango-v4'
import { MangoAccount, TokenPosition } from '@blockworks-foundation/mango-v4'
import { TrashIcon } from '@heroicons/react/20/solid'
import useUnsettledPerpPositions from 'hooks/useUnsettledPerpPositions'
@ -72,22 +72,12 @@ const CloseAccountModal = ({ isOpen, onClose }: ModalProps) => {
mangoAccount.current
?.tokensActive()
.filter(
(token) =>
(token: TokenPosition) =>
token.balanceUi(
group.getFirstBankByTokenIndex(token.tokenIndex)
) < 0
).length
) {
console.log(
mangoAccount.current
?.tokensActive()
.map((token) => ({
...token,
balance: token.balanceUi(
group.getFirstBankByTokenIndex(token.tokenIndex)
),
}))
)
setHasBorrows(true)
}
if (openPerpPositions.length || unsettledPerpPositions.length) {