fetch open orders on wallet connect
This commit is contained in:
parent
d310e0b66f
commit
724bb77ef4
|
@ -104,6 +104,7 @@ export default function useWallet() {
|
||||||
})
|
})
|
||||||
// set connected before fetching data
|
// set connected before fetching data
|
||||||
await actions.fetchMangoAccounts()
|
await actions.fetchMangoAccounts()
|
||||||
|
actions.reloadOrders()
|
||||||
actions.fetchTradeHistory()
|
actions.fetchTradeHistory()
|
||||||
actions.fetchWalletTokens()
|
actions.fetchWalletTokens()
|
||||||
notify({
|
notify({
|
||||||
|
|
|
@ -440,7 +440,15 @@ const useMangoStore = create<MangoStore>((set, get) => {
|
||||||
const connection = get().connection.current
|
const connection = get().connection.current
|
||||||
|
|
||||||
const reloadedMangoAccount = await mangoAccount.reload(connection)
|
const reloadedMangoAccount = await mangoAccount.reload(connection)
|
||||||
|
await get().actions.reloadOrders()
|
||||||
|
|
||||||
|
set((state) => {
|
||||||
|
state.selectedMangoAccount.current = reloadedMangoAccount
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async reloadOrders() {
|
||||||
|
const mangoAccount = get().selectedMangoAccount.current
|
||||||
|
const connection = get().connection.current
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
mangoAccount.loadOpenOrders(
|
mangoAccount.loadOpenOrders(
|
||||||
connection,
|
connection,
|
||||||
|
@ -448,10 +456,6 @@ const useMangoStore = create<MangoStore>((set, get) => {
|
||||||
),
|
),
|
||||||
mangoAccount.loadAdvancedOrders(connection),
|
mangoAccount.loadAdvancedOrders(connection),
|
||||||
])
|
])
|
||||||
|
|
||||||
set((state) => {
|
|
||||||
state.selectedMangoAccount.current = reloadedMangoAccount
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
async _updateOpenOrders() {
|
async _updateOpenOrders() {
|
||||||
|
|
Loading…
Reference in New Issue