fix default margin account select

This commit is contained in:
Tyler Shipe 2021-06-07 16:55:10 -04:00
parent aa5355e70c
commit 330ef82a32
2 changed files with 9 additions and 10 deletions

View File

@ -282,9 +282,10 @@ export default function AccountBorrows() {
<Td
className={`px-6 py-3 whitespace-nowrap text-sm text-th-fgd-1`}
>
{selectedMangoGroup
.getUiTotalDeposit(i)
.toFixed(tokenPrecision[asset])}
{(
selectedMangoGroup.getUiTotalDeposit(i) -
selectedMangoGroup.getUiTotalBorrow(i)
).toLocaleString()}
</Td>
<Td
className={`px-6 py-3 whitespace-nowrap text-sm text-th-fgd-1`}

View File

@ -267,13 +267,11 @@ const useMangoStore = create<MangoStore>((set, get) => ({
)
} else {
const lastAccount = localStorage.getItem('lastAccountViewed')
console.log(JSON.parse(lastAccount))
state.selectedMarginAccount.current = lastAccount
? marginAccounts.find(
(ma) =>
ma.publicKey.toString() === JSON.parse(lastAccount)
)
: sortedAccounts[0]
state.selectedMarginAccount.current =
marginAccounts.find(
(ma) => ma.publicKey.toString() === JSON.parse(lastAccount)
) || sortedAccounts[0]
}
})
}