@@ -297,23 +297,29 @@ 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 (f" Publisher: { name } : { component . latest_price } { component . aggregate_price } " )
317323
318324 mapping_key = mapping_account .data .next_mapping_account_key
319325
@@ -462,11 +468,9 @@ def sync(
462468 ref_permissions = parse_permissions_with_overrides (
463469 Path (permissions ), Path (overrides ), network
464470 )
465-
466471 ref_authority_permissions = parse_authority_permissions_json (
467472 Path (authority_permissions )
468473 )
469-
470474 asyncio .run (
471475 program_admin .sync (
472476 ref_products = ref_products ,
@@ -479,6 +483,35 @@ def sync(
479483 )
480484 )
481485
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+
482515
483516@click .command ()
484517@click .option ("--network" , help = "Solana network" , envvar = "NETWORK" )
@@ -578,5 +611,6 @@ def resize_price_accounts_v2(
578611cli .add_command (update_product_metadata )
579612cli .add_command (migrate_upgrade_authority )
580613cli .add_command (resize_price_accounts_v2 )
614+ cli .add_command (update_price )
581615logger .remove ()
582616logger .add (sys .stdout , serialize = (not os .environ .get ("DEV_MODE" )))
0 commit comments