update unsettled balances when open orders are updated
This commit is contained in:
parent
fdd0d9a020
commit
1cb810a2f4
|
@ -34,6 +34,7 @@ const HydrateStore = () => {
|
|||
useEffect(() => {
|
||||
const connection = mangoStore.getState().connection
|
||||
const client = mangoStore.getState().client
|
||||
const set = mangoStore.getState().set
|
||||
|
||||
if (!mangoAccount) return
|
||||
|
||||
|
@ -68,12 +69,9 @@ const HydrateStore = () => {
|
|||
// newMangoAccount.spotOpenOrdersAccounts =
|
||||
// mangoAccount.spotOpenOrdersAccounts
|
||||
// newMangoAccount.advancedOrders = mangoAccount.advancedOrders
|
||||
mangoStore.setState({
|
||||
mangoAccount: {
|
||||
...mangoStore.getState().mangoAccount,
|
||||
current: newMangoAccount,
|
||||
lastSlot: context.slot,
|
||||
},
|
||||
set((s) => {
|
||||
s.mangoAccount.current = newMangoAccount
|
||||
s.mangoAccount.lastSlot = context.slot
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -939,6 +939,10 @@ const mangoStore = create<MangoStore>()(
|
|||
)
|
||||
|
||||
mangoStore.subscribe((state) => state.mangoAccount.current, spotBalancesUpdater)
|
||||
mangoStore.subscribe(
|
||||
(state) => state.mangoAccount.openOrderAccounts,
|
||||
spotBalancesUpdater
|
||||
)
|
||||
mangoStore.subscribe(
|
||||
(state) => state.mangoAccount.current,
|
||||
perpPositionsUpdater
|
||||
|
|
Loading…
Reference in New Issue