@@ -21,6 +21,7 @@ import {
21
21
PRICE_FEED_OPS_KEY ,
22
22
getMessageBufferAddressForPrice ,
23
23
getMaximumNumberOfPublishers ,
24
+ isPriceStoreInitialized ,
24
25
isPriceStorePublisherInitialized ,
25
26
createDetermisticPriceStoreInitializePublisherInstruction ,
26
27
} from '@pythnetwork/xc-admin-common'
@@ -290,7 +291,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
290
291
const handleSendProposalButtonClick = async ( ) => {
291
292
if ( pythProgramClient && dataChanges && ! isMultisigLoading && squads ) {
292
293
const instructions : TransactionInstruction [ ] = [ ]
293
- const publisherInitializationsVerified : PublicKey [ ] = [ ]
294
+ const publisherInPriceStoreInitializationsVerified : PublicKey [ ] = [ ]
294
295
295
296
for ( const symbol of Object . keys ( dataChanges ) ) {
296
297
const multisigAuthority = squads . getAuthorityPDA (
@@ -301,9 +302,14 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
301
302
? mapKey ( multisigAuthority )
302
303
: multisigAuthority
303
304
304
- const initPublisher = async ( publisherKey : PublicKey ) => {
305
+ const initPublisherInPriceStore = async ( publisherKey : PublicKey ) => {
306
+ // Ignore this step if Price Store is not initialized (or not deployed)
307
+ if ( ! connection || ! ( await isPriceStoreInitialized ( connection ) ) ) {
308
+ return
309
+ }
310
+
305
311
if (
306
- publisherInitializationsVerified . every (
312
+ publisherInPriceStoreInitializationsVerified . every (
307
313
( el ) => ! el . equals ( publisherKey )
308
314
)
309
315
) {
@@ -321,7 +327,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
321
327
)
322
328
)
323
329
}
324
- publisherInitializationsVerified . push ( publisherKey )
330
+ publisherInPriceStoreInitializationsVerified . push ( publisherKey )
325
331
}
326
332
}
327
333
const { prev, new : newChanges } = dataChanges [ symbol ]
@@ -406,7 +412,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
406
412
} )
407
413
. instruction ( )
408
414
)
409
- await initPublisher ( publisherPubKey )
415
+ await initPublisherInPriceStore ( publisherPubKey )
410
416
}
411
417
412
418
// create set min publisher instruction if there are any publishers
@@ -576,7 +582,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
576
582
} )
577
583
. instruction ( )
578
584
)
579
- await initPublisher ( publisherPubKey )
585
+ await initPublisherInPriceStore ( publisherPubKey )
580
586
}
581
587
}
582
588
}
0 commit comments