@@ -297,23 +297,31 @@ def list_accounts(network, rpc_endpoint, program_key, keys, publishers, commitme
297297
298298 for product_key in mapping_account .data .product_account_keys :
299299 product_account = program_admin .get_product_account (product_key )
300+ print (f" Product Public Key: { product_account .public_key } " )
300301 print (f" Product: { product_account .data .metadata ['symbol' ]} " )
301302
302303 if product_account .data .first_price_account_key != PublicKey (0 ):
303304 price_account = program_admin .get_price_account (
304305 product_account .data .first_price_account_key
305306 )
307+ print (f" Price Account: { price_account .public_key } " )
306308 print (
307309 f" Price: { price_account .data .exponent } exponent ({ price_account .data .components_count } components)"
308310 )
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 } " )
309315
310316 for component in price_account .data .price_components :
311317 try :
312318 name = publishers_map ["names" ][component .publisher_key ]
313319 except KeyError :
314320 name = f"??? ({ component .publisher_key } )"
315321
316- print (f" Publisher: { name } " )
322+ print (
323+ f" Publisher: { name } : { component .latest_price } { component .aggregate_price } "
324+ )
317325
318326 mapping_key = mapping_account .data .next_mapping_account_key
319327
@@ -462,11 +470,9 @@ def sync(
462470 ref_permissions = parse_permissions_with_overrides (
463471 Path (permissions ), Path (overrides ), network
464472 )
465-
466473 ref_authority_permissions = parse_authority_permissions_json (
467474 Path (authority_permissions )
468475 )
469-
470476 asyncio .run (
471477 program_admin .sync (
472478 ref_products = ref_products ,
@@ -480,6 +486,41 @@ def sync(
480486 )
481487
482488
489+ @click .command ()
490+ @click .option ("--network" , help = "Solana network" , envvar = "NETWORK" )
491+ @click .option ("--rpc-endpoint" , help = "Solana RPC endpoint" , envvar = "RPC_ENDPOINT" )
492+ @click .option ("--program-key" , help = "Pyth program key" , envvar = "PROGRAM_KEY" )
493+ @click .option ("--keys" , help = "Path to keys directory" , envvar = "KEYS" )
494+ @click .option ("--publisher" , help = "key file of the publisher" )
495+ @click .option ("--price-account" , help = "Public key of the price account" )
496+ @click .option ("--price" , help = "Price to set" )
497+ @click .option ("--price-slot" , help = "Price slot to set" )
498+ def update_price (
499+ network ,
500+ rpc_endpoint ,
501+ program_key ,
502+ keys ,
503+ publisher ,
504+ price_account ,
505+ price ,
506+ price_slot ,
507+ ):
508+ program_admin = ProgramAdmin (
509+ network = network ,
510+ rpc_endpoint = rpc_endpoint ,
511+ key_dir = keys ,
512+ program_key = program_key ,
513+ price_store_key = None ,
514+ commitment = "confirmed" ,
515+ )
516+ publisher_keypair = load_keypair (publisher , key_dir = keys )
517+ price_account = PublicKey (price_account )
518+ (instructions , signers ,) = program_admin .update_price_instructions (
519+ publisher_keypair , price_account , int (price ), 100 , int (price_slot )
520+ )
521+ asyncio .run (program_admin .send_transaction (instructions , signers ))
522+
523+
483524@click .command ()
484525@click .option ("--network" , help = "Solana network" , envvar = "NETWORK" )
485526@click .option ("--rpc-endpoint" , help = "Solana RPC endpoint" , envvar = "RPC_ENDPOINT" )
@@ -578,5 +619,6 @@ def resize_price_accounts_v2(
578619cli .add_command (update_product_metadata )
579620cli .add_command (migrate_upgrade_authority )
580621cli .add_command (resize_price_accounts_v2 )
622+ cli .add_command (update_price )
581623logger .remove ()
582624logger .add (sys .stdout , serialize = (not os .environ .get ("DEV_MODE" )))
0 commit comments