import xw from 'xwind' import { useBalances } from '../hooks/useBalances' import useMangoStore from '../stores/useMangoStore' import { settleAll } from '../utils/mango' import useConnection from '../hooks/useConnection' import Button from '../components/Button' const BalancesTable = () => { const balances = useBalances() const { programId, connection } = useConnection() async function handleSettleAll() { const markets = Object.values( useMangoStore.getState().selectedMangoGroup.markets ) const marginAccount = useMangoStore.getState().selectedMarginAccount.current const mangoGroup = useMangoStore.getState().selectedMangoGroup.current const wallet = useMangoStore.getState().wallet.current try { await settleAll( connection, programId, mangoGroup, marginAccount, markets, wallet ) // notify({ // message: 'Successfully settled funds', // type: 'info', // }); } catch (e) { console.warn('Error settling all:', e) if (e.message === 'No unsettled funds') { // notify({ // message: 'There are no unsettled funds', // type: 'error', // }); } else { // notify({ // message: 'Error settling funds', // description: e.message, // type: 'error', // }); } } } return (
Coin | Deposits | Borrows | In Orders | Unsettled | Net |
---|---|---|---|---|---|
{balance.coin} | {balance.marginDeposits} | {balance.borrows} | {balance.orders} | {balance.unsettled} | {balance.net} |