mirror of https://github.com/certusone/oyster.git
working on fixing dex market init
This commit is contained in:
parent
4580be5514
commit
f811d7a4d0
|
@ -99,7 +99,7 @@ export function MarketProvider({ children = null as any }) {
|
|||
timer = window.setTimeout(() => updateData(), REFRESH_INTERVAL);
|
||||
};
|
||||
|
||||
const initalQuery = async () => {
|
||||
const initialQuery = async () => {
|
||||
const reverseSerumMarketCache = new Map<string, string>();
|
||||
[...marketByMint.keys()].forEach(mint => {
|
||||
const m = marketByMint.get(mint);
|
||||
|
@ -112,15 +112,15 @@ export function MarketProvider({ children = null as any }) {
|
|||
return m.marketInfo.address.toBase58();
|
||||
});
|
||||
|
||||
await getMultipleAccounts(
|
||||
const accounts = await getMultipleAccounts(
|
||||
connection,
|
||||
// only query for markets that are not in cahce
|
||||
// only query for markets that are not in cache
|
||||
allMarkets.filter(a => cache.get(a) === undefined),
|
||||
'single',
|
||||
).then(({ keys, array }) => {
|
||||
allMarkets.forEach(() => {});
|
||||
);
|
||||
|
||||
return array.map((item, index) => {
|
||||
const { keys, array } = accounts;
|
||||
array.forEach((item, index) => {
|
||||
const marketAddress = keys[index];
|
||||
const mintAddress = reverseSerumMarketCache.get(marketAddress);
|
||||
if (mintAddress) {
|
||||
|
@ -134,7 +134,6 @@ export function MarketProvider({ children = null as any }) {
|
|||
|
||||
return item;
|
||||
});
|
||||
});
|
||||
|
||||
const toQuery = new Set<string>();
|
||||
allMarkets.forEach(m => {
|
||||
|
@ -165,7 +164,7 @@ export function MarketProvider({ children = null as any }) {
|
|||
updateData();
|
||||
};
|
||||
|
||||
initalQuery();
|
||||
initialQuery();
|
||||
|
||||
return () => {
|
||||
window.clearTimeout(timer);
|
||||
|
|
Loading…
Reference in New Issue