@@ -271,17 +271,17 @@ async function main() {
271271
272272 const messageBufferKeys = priceIds . map ( ( priceId ) => {
273273 return {
274- messageBufferKey : getMessageBufferPubkey (
274+ messageBuffer : getMessageBufferPubkey (
275275 pythOracleCpiAuth ,
276276 priceId ,
277277 messageBufferPid
278278 ) ,
279- priceAccountKey : priceId ,
279+ priceAccount : priceId ,
280280 } ;
281281 } ) ;
282282
283283 let accounts = await messageBufferProgram . account . messageBuffer . fetchMultiple (
284- messageBufferKeys . map ( ( k ) => k . messageBufferKey )
284+ messageBufferKeys . map ( ( k ) => k . messageBuffer )
285285 ) ;
286286
287287 const msgBufferKeysAndData = messageBufferKeys . map ( ( k , i ) => {
@@ -291,31 +291,35 @@ async function main() {
291291 } ;
292292 } ) ;
293293
294- alreadyInitializedAccounts = msgBufferKeysAndData . filter ( ( idAndAccount ) => {
295- return idAndAccount . messageBufferData !== null ;
296- } ) ;
294+ alreadyInitializedAccounts = msgBufferKeysAndData
295+ . filter ( ( idAndAccount ) => {
296+ return idAndAccount . messageBufferData !== null ;
297+ } )
298+ . map ( ( v ) => {
299+ return {
300+ priceAccount : v . priceAccount . toString ( ) ,
301+ messageBuffer : v . messageBuffer . toString ( ) ,
302+ } ;
303+ } ) ;
297304
298305 console . log ( `
299- ${
300- alreadyInitializedAccounts . length
301- } message buffer accounts already initialized.
302- alreadyInitializedAccounts: ${ JSON . stringify ( alreadyInitializedAccounts ) } ` ) ;
306+ ${ alreadyInitializedAccounts . length } message buffer accounts already initialized` ) ;
307+ console . table ( alreadyInitializedAccounts ) ;
303308
304309 const priceAccountPubkeysForNewlyInitializedMessageBuffers =
305310 msgBufferKeysAndData . filter ( ( idAndAccount ) => {
306311 return idAndAccount . messageBufferData === null ;
307312 } ) ;
308313
309314 if ( priceAccountPubkeysForNewlyInitializedMessageBuffers . length === 0 ) {
310- console . info ( `no new message buffers to initialize. exiting...` ) ;
311- process . exit ( 1 ) ;
315+ console . info ( `no new message buffers to initialize` ) ;
312316 }
313317 // TODO: optimize with batching
314318 await Promise . all (
315319 priceAccountPubkeysForNewlyInitializedMessageBuffers . map (
316320 async ( idAndAccount ) => {
317- const priceId = idAndAccount . priceAccountKey ;
318- const messageBufferPda = idAndAccount . messageBufferKey ;
321+ const priceId = idAndAccount . priceAccount ;
322+ const messageBufferPda = idAndAccount . messageBuffer ;
319323 const msgBufferPdaMetas = [
320324 {
321325 pubkey : messageBufferPda ,
@@ -360,6 +364,7 @@ async function main() {
360364 console . info ( `Accounts with errors: ${ JSON . stringify ( errorAccounts ) } ` ) ;
361365 }
362366 console . log ( `Initialized ${ newlyInitializedAccounts . length } accounts` ) ;
367+ console . table ( newlyInitializedAccounts ) ;
363368
364369 // Update whitelist admin at the end otherwise all the message buffer PDAs
365370 // will have to be initialized by the whitelist admin (which could be the multisig)
0 commit comments