1010from loguru import logger
1111
1212sys .path .insert (0 , os .path .dirname (os .path .dirname (os .path .abspath (__file__ ))))
13- from pythclient .pythclient import PythClient , V2_PROGRAM_KEY , V2_FIRST_MAPPING_ACCOUNT_KEY # noqa
13+ from pythclient .pythclient import PythClient # noqa
1414from pythclient .ratelimit import RateLimit # noqa
1515from pythclient .pythaccounts import PythPriceAccount # noqa
16+ from pythclient .utils import get_key # noqa
1617
1718logger .enable ("pythclient" )
1819
@@ -32,9 +33,11 @@ def set_to_exit(sig: Any, frame: Any):
3233async def main ():
3334 global to_exit
3435 use_program = len (sys .argv ) >= 2 and sys .argv [1 ] == "program"
36+ v2_first_mapping_account_key = get_key ("devnet" , "mapping" )
37+ v2_program_key = get_key ("devnet" , "program" )
3538 async with PythClient (
36- first_mapping_account_key = V2_FIRST_MAPPING_ACCOUNT_KEY ,
37- program_key = V2_PROGRAM_KEY if use_program else None ,
39+ first_mapping_account_key = v2_first_mapping_account_key ,
40+ program_key = v2_program_key if use_program else None ,
3841 ) as c :
3942 await c .refresh_all_prices ()
4043 products = await c .get_products ()
@@ -57,7 +60,7 @@ async def main():
5760 await ws .connect ()
5861 if use_program :
5962 print ("Subscribing to program account" )
60- await ws .program_subscribe (V2_PROGRAM_KEY , await c .get_all_accounts ())
63+ await ws .program_subscribe (v2_program_key , await c .get_all_accounts ())
6164 else :
6265 print ("Subscribing to all prices" )
6366 for account in all_prices :
@@ -88,7 +91,7 @@ async def main():
8891
8992 print ("Unsubscribing..." )
9093 if use_program :
91- await ws .program_unsubscribe (V2_PROGRAM_KEY )
94+ await ws .program_unsubscribe (v2_program_key )
9295 else :
9396 for account in all_prices :
9497 await ws .unsubscribe (account )
0 commit comments