update oracle component with last price after switching mkts
This commit is contained in:
parent
004964bde4
commit
cfa95dfd9c
|
@ -63,11 +63,10 @@ const OraclePrice = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
const coder = new BorshAccountsCoder(client.program.idl)
|
const coder = new BorshAccountsCoder(client.program.idl)
|
||||||
|
setPrice(stalePrice)
|
||||||
const subId = connection.onAccountChange(
|
const subId = connection.onAccountChange(
|
||||||
marketOrBank.oracle,
|
marketOrBank.oracle,
|
||||||
async (info, context) => {
|
async (info, context) => {
|
||||||
// selectedMarket = mangoStore.getState().selectedMarket.current
|
|
||||||
// if (!(selectedMarket instanceof PerpMarket)) return
|
|
||||||
const { price, uiPrice, lastUpdatedSlot } =
|
const { price, uiPrice, lastUpdatedSlot } =
|
||||||
await group.decodePriceFromOracleAi(
|
await group.decodePriceFromOracleAi(
|
||||||
coder,
|
coder,
|
||||||
|
@ -122,7 +121,14 @@ const OraclePrice = ({
|
||||||
connection.removeAccountChangeListener(subId)
|
connection.removeAccountChangeListener(subId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [connection, selectedMarket])
|
}, [
|
||||||
|
connection,
|
||||||
|
selectedMarket,
|
||||||
|
serumOrPerpMarket,
|
||||||
|
setChangePrice,
|
||||||
|
quoteBank,
|
||||||
|
stalePrice,
|
||||||
|
])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
Loading…
Reference in New Issue