@@ -324,18 +324,16 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
324
324
)
325
325
326
326
// create add publisher instruction if there are any publishers
327
- if ( newChanges . priceAccounts [ 0 ] . publishers . length > 0 ) {
328
- newChanges . priceAccounts [ 0 ] . publishers . forEach (
329
- ( publisherKey : string ) => {
330
- pythProgramClient . methods
331
- . addPublisher ( new PublicKey ( publisherKey ) )
332
- . accounts ( {
333
- fundingAccount,
334
- priceAccount : priceAccountKey ,
335
- } )
336
- . instruction ( )
337
- . then ( ( instruction ) => instructions . push ( instruction ) )
338
- }
327
+
328
+ for ( let publisherKey of newChanges . priceAccounts [ 0 ] . publishers ) {
329
+ instructions . push (
330
+ await pythProgramClient . methods
331
+ . addPublisher ( new PublicKey ( publisherKey ) )
332
+ . accounts ( {
333
+ fundingAccount,
334
+ priceAccount : priceAccountKey ,
335
+ } )
336
+ . instruction ( )
339
337
)
340
338
}
341
339
@@ -438,28 +436,31 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
438
436
)
439
437
440
438
// add instructions to remove publishers
441
- publisherKeysToRemove . forEach ( ( publisherKey : string ) => {
442
- pythProgramClient . methods
443
- . delPublisher ( new PublicKey ( publisherKey ) )
444
- . accounts ( {
445
- fundingAccount,
446
- priceAccount : new PublicKey ( prev . priceAccounts [ 0 ] . address ) ,
447
- } )
448
- . instruction ( )
449
- . then ( ( instruction ) => instructions . push ( instruction ) )
450
- } )
439
+
440
+ for ( let publisherKey of publisherKeysToRemove ) {
441
+ instructions . push (
442
+ await pythProgramClient . methods
443
+ . delPublisher ( new PublicKey ( publisherKey ) )
444
+ . accounts ( {
445
+ fundingAccount,
446
+ priceAccount : new PublicKey ( prev . priceAccounts [ 0 ] . address ) ,
447
+ } )
448
+ . instruction ( )
449
+ )
450
+ }
451
451
452
452
// add instructions to add new publishers
453
- publisherKeysToAdd . forEach ( ( publisherKey : string ) => {
454
- pythProgramClient . methods
455
- . addPublisher ( new PublicKey ( publisherKey ) )
456
- . accounts ( {
457
- fundingAccount,
458
- priceAccount : new PublicKey ( prev . priceAccounts [ 0 ] . address ) ,
459
- } )
460
- . instruction ( )
461
- . then ( ( instruction ) => instructions . push ( instruction ) )
462
- } )
453
+ for ( let publisherKey of publisherKeysToAdd ) {
454
+ instructions . push (
455
+ await pythProgramClient . methods
456
+ . addPublisher ( new PublicKey ( publisherKey ) )
457
+ . accounts ( {
458
+ fundingAccount,
459
+ priceAccount : new PublicKey ( prev . priceAccounts [ 0 ] . address ) ,
460
+ } )
461
+ . instruction ( )
462
+ )
463
+ }
463
464
}
464
465
}
465
466
0 commit comments