diff --git a/examples/dump.py b/examples/dump.py index af75ca6..5704b10 100644 --- a/examples/dump.py +++ b/examples/dump.py @@ -8,7 +8,7 @@ from typing import List, Any from loguru import logger -from pythclient.solana import SOLANA_DEVNET_HTTP_ENDPOINT, SOLANA_DEVNET_WS_ENDPOINT +from pythclient.solana import PYTHNET_HTTP_ENDPOINT, PYTHNET_WS_ENDPOINT sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from pythclient.pythclient import PythClient # noqa @@ -34,13 +34,13 @@ def set_to_exit(sig: Any, frame: Any): async def main(): global to_exit use_program = len(sys.argv) >= 2 and sys.argv[1] == "program" - v2_first_mapping_account_key = get_key("devnet", "mapping") - v2_program_key = get_key("devnet", "program") + v2_first_mapping_account_key = get_key("pythnet", "mapping") + v2_program_key = get_key("pythnet", "program") async with PythClient( first_mapping_account_key=v2_first_mapping_account_key, program_key=v2_program_key if use_program else None, - solana_endpoint=SOLANA_DEVNET_HTTP_ENDPOINT, # replace with the relevant cluster endpoints - solana_ws_endpoint=SOLANA_DEVNET_WS_ENDPOINT # replace with the relevant cluster endpoints + solana_endpoint=PYTHNET_HTTP_ENDPOINT, # replace with the relevant cluster endpoints + solana_ws_endpoint=PYTHNET_WS_ENDPOINT # replace with the relevant cluster endpoints ) as c: await c.refresh_all_prices() products = await c.get_products() diff --git a/examples/read_one_price_feed.py b/examples/read_one_price_feed.py index 0dea35e..0688382 100644 --- a/examples/read_one_price_feed.py +++ b/examples/read_one_price_feed.py @@ -3,12 +3,12 @@ import asyncio from pythclient.pythaccounts import PythPriceAccount, PythPriceStatus -from pythclient.solana import SolanaClient, SolanaPublicKey, SOLANA_DEVNET_HTTP_ENDPOINT, SOLANA_DEVNET_WS_ENDPOINT +from pythclient.solana import SolanaClient, SolanaPublicKey, PYTHNET_HTTP_ENDPOINT, PYTHNET_WS_ENDPOINT async def get_price(): - # devnet DOGE/USD price account key (available on pyth.network website) - account_key = SolanaPublicKey("4L6YhY8VvUgmqG5MvJkUJATtzB2rFqdrJwQCmFLv4Jzy") - solana_client = SolanaClient(endpoint=SOLANA_DEVNET_HTTP_ENDPOINT, ws_endpoint=SOLANA_DEVNET_WS_ENDPOINT) + # pythnet DOGE/USD price account key (available on pyth.network website) + account_key = SolanaPublicKey("FsSM3s38PX9K7Dn6eGzuE29S2Dsk1Sss1baytTQdCaQj") + solana_client = SolanaClient(endpoint=PYTHNET_HTTP_ENDPOINT, ws_endpoint=PYTHNET_WS_ENDPOINT) price: PythPriceAccount = PythPriceAccount(account_key, solana_client) await price.update() diff --git a/pythclient/solana.py b/pythclient/solana.py index a2b3589..e066d2f 100644 --- a/pythclient/solana.py +++ b/pythclient/solana.py @@ -19,6 +19,7 @@ DEVNET_ENDPOINT = "api.devnet.solana.com" TESTNET_ENDPOINT = "api.testnet.solana.com" MAINNET_ENDPOINT = "api.mainnet-beta.solana.com" +PYTHNET_ENDPOINT = "pythnet.rpcpool.com" SOLANA_DEVNET_WS_ENDPOINT = WS_PREFIX + "://" + DEVNET_ENDPOINT SOLANA_DEVNET_HTTP_ENDPOINT = HTTP_PREFIX + "://" + DEVNET_ENDPOINT @@ -29,6 +30,8 @@ SOLANA_MAINNET_WS_ENDPOINT = WS_PREFIX + "://" + MAINNET_ENDPOINT SOLANA_MAINNET_HTTP_ENDPOINT = HTTP_PREFIX + "://" + MAINNET_ENDPOINT +PYTHNET_WS_ENDPOINT = WS_PREFIX + "://" + PYTHNET_ENDPOINT +PYTHNET_HTTP_ENDPOINT = HTTP_PREFIX + "://" + PYTHNET_ENDPOINT class SolanaPublicKey: """ diff --git a/pythclient/utils.py b/pythclient/utils.py index 36384ff..6d6752a 100644 --- a/pythclient/utils.py +++ b/pythclient/utils.py @@ -17,6 +17,7 @@ def get_key(network: str, type: str, version: str = DEFAULT_VERSION) -> Optional devnet-program-v2.pyth.network mainnet-program-v2.pyth.network testnet-mapping-v2.pyth.network + pythnet-mapping-v2.pyth.network """ url = f"{network}-{type}-{version}.pyth.network" try: diff --git a/setup.py b/setup.py index 323be74..bde7049 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='pythclient', - version='0.1.2', + version='0.1.3', packages=['pythclient'], author='Pyth Developers', author_email='contact@pyth.network',