fix notifications, use accountsdb to fetch mango accts
This commit is contained in:
parent
577b917b48
commit
af2965098b
|
@ -35,7 +35,7 @@ export const settlePosPnl = async (
|
|||
const mangoClient = useMangoStore.getState().connection.client
|
||||
|
||||
try {
|
||||
await mangoClient.settlePosPnl(
|
||||
const txids = await mangoClient.settlePosPnl(
|
||||
mangoGroup,
|
||||
mangoCache,
|
||||
mangoAccount,
|
||||
|
@ -45,10 +45,15 @@ export const settlePosPnl = async (
|
|||
mangoAccounts
|
||||
)
|
||||
actions.reloadMangoAccount()
|
||||
notify({
|
||||
title: t('pnl-success'),
|
||||
description: '',
|
||||
})
|
||||
for (const txid of txids) {
|
||||
if (txid) {
|
||||
notify({
|
||||
title: t('pnl-success'),
|
||||
description: '',
|
||||
txid,
|
||||
})
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Error settling PNL: ', `${e}`, `${perpAccount}`)
|
||||
notify({
|
||||
|
|
|
@ -56,7 +56,7 @@ export const RedeemDropdown: React.FC = () => {
|
|||
setSettlingPosPnl(true)
|
||||
for (const p of unsettledPositivePositions) {
|
||||
console.log('settlePosPnl', p)
|
||||
await settlePosPnl([p.perpMarket], p.perpAccount, t, undefined)
|
||||
await settlePosPnl([p.perpMarket], p.perpAccount, t, null)
|
||||
}
|
||||
setSettlingPosPnl(false)
|
||||
}
|
||||
|
|
|
@ -91,8 +91,7 @@ const usePerpPositions = () => {
|
|||
const mangoGroup = useMangoStore(mangoGroupSelector)
|
||||
const mangoCache = useMangoStore(mangoCacheSelector)
|
||||
const allMarkets = useMangoStore(marketsSelector)
|
||||
const tradeHistory = useMangoStore.getState().tradeHistory.parsed
|
||||
|
||||
const tradeHistory = useMangoStore((s) => s.tradeHistory.parsed)
|
||||
useEffect(() => {
|
||||
if (
|
||||
mangoAccount &&
|
||||
|
|
Loading…
Reference in New Issue