@@ -297,23 +297,29 @@ def list_accounts(network, rpc_endpoint, program_key, keys, publishers, commitme
297
297
298
298
for product_key in mapping_account .data .product_account_keys :
299
299
product_account = program_admin .get_product_account (product_key )
300
+ print (f" Product Public Key: { product_account .public_key } " )
300
301
print (f" Product: { product_account .data .metadata ['symbol' ]} " )
301
302
302
303
if product_account .data .first_price_account_key != PublicKey (0 ):
303
304
price_account = program_admin .get_price_account (
304
305
product_account .data .first_price_account_key
305
306
)
307
+ print (f" Price Account: { price_account .public_key } " )
306
308
print (
307
309
f" Price: { price_account .data .exponent } exponent ({ price_account .data .components_count } components)"
308
310
)
311
+ print (f" numPublishers: { price_account .data .components_count } " )
312
+ print (f" numPrices: { price_account .data .quoters_count } " )
313
+ print (f" numComponents: { len (price_account .data .price_components )} " )
314
+ print (f" Aggregate: { price_account .data .aggregate } " )
309
315
310
316
for component in price_account .data .price_components :
311
317
try :
312
318
name = publishers_map ["names" ][component .publisher_key ]
313
319
except KeyError :
314
320
name = f"??? ({ component .publisher_key } )"
315
321
316
- print (f" Publisher: { name } " )
322
+ print (f" Publisher: { name } : { component . latest_price } { component . aggregate_price } " )
317
323
318
324
mapping_key = mapping_account .data .next_mapping_account_key
319
325
@@ -462,11 +468,9 @@ def sync(
462
468
ref_permissions = parse_permissions_with_overrides (
463
469
Path (permissions ), Path (overrides ), network
464
470
)
465
-
466
471
ref_authority_permissions = parse_authority_permissions_json (
467
472
Path (authority_permissions )
468
473
)
469
-
470
474
asyncio .run (
471
475
program_admin .sync (
472
476
ref_products = ref_products ,
@@ -479,6 +483,35 @@ def sync(
479
483
)
480
484
)
481
485
486
+ @click .command ()
487
+ @click .option ("--network" , help = "Solana network" , envvar = "NETWORK" )
488
+ @click .option ("--rpc-endpoint" , help = "Solana RPC endpoint" , envvar = "RPC_ENDPOINT" )
489
+ @click .option ("--program-key" , help = "Pyth program key" , envvar = "PROGRAM_KEY" )
490
+ @click .option ("--keys" , help = "Path to keys directory" , envvar = "KEYS" )
491
+ @click .option ("--publisher" , help = "key file of the publisher" )
492
+ @click .option ("--price-account" , help = "Public key of the price account" )
493
+ @click .option ("--price" , help = "Price to set" )
494
+ @click .option ("--price-slot" , help = "Price slot to set" )
495
+ def update_price (network , rpc_endpoint , program_key , keys , publisher , price_account , price , price_slot ):
496
+ program_admin = ProgramAdmin (
497
+ network = network ,
498
+ rpc_endpoint = rpc_endpoint ,
499
+ key_dir = keys ,
500
+ program_key = program_key ,
501
+ price_store_key = None ,
502
+ commitment = "confirmed" ,
503
+ )
504
+ publisher_keypair = load_keypair (publisher , key_dir = keys )
505
+ price_account = PublicKey (price_account )
506
+ (instructions , signers , ) = program_admin .update_price_instructions (
507
+ publisher_keypair ,
508
+ price_account ,
509
+ int (price ),
510
+ 100 ,
511
+ int (price_slot )
512
+ )
513
+ asyncio .run (program_admin .send_transaction (instructions , signers ))
514
+
482
515
483
516
@click .command ()
484
517
@click .option ("--network" , help = "Solana network" , envvar = "NETWORK" )
@@ -578,5 +611,6 @@ def resize_price_accounts_v2(
578
611
cli .add_command (update_product_metadata )
579
612
cli .add_command (migrate_upgrade_authority )
580
613
cli .add_command (resize_price_accounts_v2 )
614
+ cli .add_command (update_price )
581
615
logger .remove ()
582
616
logger .add (sys .stdout , serialize = (not os .environ .get ("DEV_MODE" )))
0 commit comments