@@ -99,7 +99,7 @@ export function MarketProvider({ children = null as any }) {
9999 timer = window . setTimeout ( ( ) => updateData ( ) , REFRESH_INTERVAL ) ;
100100 } ;
101101
102- const initalQuery = async ( ) => {
102+ const initialQuery = async ( ) => {
103103 const reverseSerumMarketCache = new Map < string , string > ( ) ;
104104 [ ...marketByMint . keys ( ) ] . forEach ( mint => {
105105 const m = marketByMint . get ( mint ) ;
@@ -112,28 +112,27 @@ export function MarketProvider({ children = null as any }) {
112112 return m . marketInfo . address . toBase58 ( ) ;
113113 } ) ;
114114
115- await getMultipleAccounts (
115+ const accounts = await getMultipleAccounts (
116116 connection ,
117- // only query for markets that are not in cahce
117+ // only query for markets that are not in cache
118118 allMarkets . filter ( a => cache . get ( a ) === undefined ) ,
119119 'single' ,
120- ) . then ( ( { keys, array } ) => {
121- allMarkets . forEach ( ( ) => { } ) ;
122-
123- return array . map ( ( item , index ) => {
124- const marketAddress = keys [ index ] ;
125- const mintAddress = reverseSerumMarketCache . get ( marketAddress ) ;
126- if ( mintAddress ) {
127- const market = marketByMint . get ( mintAddress ) ;
128-
129- if ( market ) {
130- const id = market . marketInfo . address ;
131- cache . add ( id , item , DexMarketParser ) ;
132- }
120+ ) ;
121+
122+ const { keys, array } = accounts ;
123+ array . forEach ( ( item , index ) => {
124+ const marketAddress = keys [ index ] ;
125+ const mintAddress = reverseSerumMarketCache . get ( marketAddress ) ;
126+ if ( mintAddress ) {
127+ const market = marketByMint . get ( mintAddress ) ;
128+
129+ if ( market ) {
130+ const id = market . marketInfo . address ;
131+ cache . add ( id , item , DexMarketParser ) ;
133132 }
133+ }
134134
135- return item ;
136- } ) ;
135+ return item ;
137136 } ) ;
138137
139138 const toQuery = new Set < string > ( ) ;
@@ -165,7 +164,7 @@ export function MarketProvider({ children = null as any }) {
165164 updateData ( ) ;
166165 } ;
167166
168- initalQuery ( ) ;
167+ initialQuery ( ) ;
169168
170169 return ( ) => {
171170 window . clearTimeout ( timer ) ;
0 commit comments