refresh open orders after canceling a differentmarket

This commit is contained in:
Tyler Shipe 2021-07-19 20:42:55 -04:00
parent c330b895a4
commit 9b110bc507
4 changed files with 27 additions and 6 deletions

View File

@ -50,6 +50,7 @@ const OpenOrdersTable = () => {
order as PerpOrder
)
}
actions.updateOpenOrders()
actions.fetchMangoAccounts()
} catch (e) {
notify({

View File

@ -46,7 +46,7 @@ const UserInfoTabs = ({ activeTab, setActiveTab }) => {
<a
key={tabName}
onClick={() => handleTabChange(tabName)}
className={`whitespace-nowrap py-4 px-1 border-b-2 font-semibold cursor-pointer default-transition hover:opacity-100
className={`whitespace-nowrap pt-2 pb-4 px-1 border-b-2 font-semibold cursor-pointer default-transition hover:opacity-100
${
activeTab === tabName
? `border-th-primary text-th-primary`

View File

@ -160,7 +160,7 @@ interface MangoStore extends State {
tradeHistory: any[]
set: (x: any) => void
actions: {
[key: string]: () => void
[key: string]: (args?) => void
}
}
@ -392,6 +392,26 @@ const useMangoStore = create<MangoStore>((set, get) => ({
// state.tradeHistory = results
// })
},
async updateOpenOrders() {
const set = get().set
const mangoGroupConfig = get().selectedMangoGroup.config
const allMarketConfigs = getAllMarkets(mangoGroupConfig)
const allBidsAndAsksPks = allMarketConfigs
.map((m) => [m.bidsKey, m.asksKey])
.flat()
const allBidsAndAsksAccountInfos = await getMultipleAccounts(
DEFAULT_CONNECTION,
allBidsAndAsksPks
)
set((state) => {
allBidsAndAsksAccountInfos.forEach(({ publicKey, accountInfo }) => {
state.accountInfos[publicKey.toBase58()] = accountInfo
})
})
},
},
}))

View File

@ -988,7 +988,7 @@
"@blockworks-foundation/mango-client@git+https://github.com/blockworks-foundation/mango-client-v3.git":
version "3.0.1"
resolved "git+https://github.com/blockworks-foundation/mango-client-v3.git#a4d7668527ffa62738c21e3a4cc0b69305b3e482"
resolved "git+https://github.com/blockworks-foundation/mango-client-v3.git#f129ebc0d2ae89f6018df9316131e147fab4f773"
dependencies:
"@project-serum/serum" "^0.13.45"
"@project-serum/sol-wallet-adapter" "^0.2.0"
@ -1938,9 +1938,9 @@
integrity sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw==
"@types/ws@^7.4.4":
version "7.4.6"
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.6.tgz#c4320845e43d45a7129bb32905e28781c71c1fff"
integrity sha512-ijZ1vzRawI7QoWnTNL8KpHixd2b2XVb9I9HAqI3triPsh1EC0xH0Eg6w2O3TKbDCgiNNlJqfrof6j4T2I+l9vw==
version "7.4.7"
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.7.tgz#f7c390a36f7a0679aa69de2d501319f4f8d9b702"
integrity sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==
dependencies:
"@types/node" "*"