@@ -324,18 +324,16 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
324324 )
325325
326326 // 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 ( )
339337 )
340338 }
341339
@@ -438,28 +436,31 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
438436 )
439437
440438 // 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+ }
451451
452452 // 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+ }
463464 }
464465 }
465466
0 commit comments