This commit is contained in:
tjs 2022-12-05 21:53:59 -05:00
parent 9a18380c74
commit b62f102e3f
1 changed files with 8 additions and 5 deletions

View File

@ -322,13 +322,16 @@ const Orderbook = () => {
const set = mangoStore.getState().set const set = mangoStore.getState().set
const client = mangoStore.getState().client const client = mangoStore.getState().client
if (!market || !group) return
let previousBidInfo: AccountInfo<Buffer> | null = null let previousBidInfo: AccountInfo<Buffer> | null = null
let previousAskInfo: AccountInfo<Buffer> | null = null let previousAskInfo: AccountInfo<Buffer> | null = null
if (!market || !group) return let bidSubscriptionId: number
console.log('in orderbook WS useEffect') let askSubscriptionId: number
const bidsPk = const bidsPk =
market instanceof Market ? market['_decoded'].bids : market.bids market instanceof Market ? market['_decoded'].bids : market.bids
let bidSubscriptionId: number console.log('bidsPk', bidsPk?.toString())
if (bidsPk) { if (bidsPk) {
connection.getAccountInfo(bidsPk).then((info) => { connection.getAccountInfo(bidsPk).then((info) => {
if (!info) return if (!info) return
@ -338,7 +341,6 @@ const Orderbook = () => {
state.selectedMarket.orderbook.bids = decodeBookL2(decodedBook) state.selectedMarket.orderbook.bids = decodeBookL2(decodedBook)
}) })
}) })
console.log('bidsPk', bidsPk)
bidSubscriptionId = connection.onAccountChange( bidSubscriptionId = connection.onAccountChange(
bidsPk, bidsPk,
(info, _context) => { (info, _context) => {
@ -357,9 +359,10 @@ const Orderbook = () => {
} }
) )
} }
const asksPk = const asksPk =
market instanceof Market ? market['_decoded'].asks : market.asks market instanceof Market ? market['_decoded'].asks : market.asks
let askSubscriptionId: number console.log('asksPk', asksPk?.toString())
if (asksPk) { if (asksPk) {
connection.getAccountInfo(asksPk).then((info) => { connection.getAccountInfo(asksPk).then((info) => {
if (!info) return if (!info) return