From fd1911729f891050a15b8177c8d02eb9396a6a97 Mon Sep 17 00:00:00 2001 From: abel Date: Tue, 22 Aug 2023 16:07:39 -0300 Subject: [PATCH 1/2] (fix) Fix testnet URLs --- pyinjective/constant.py | 136 ++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/pyinjective/constant.py b/pyinjective/constant.py index 4a263be5..57001ee3 100644 --- a/pyinjective/constant.py +++ b/pyinjective/constant.py @@ -6,13 +6,13 @@ MAX_MEMO_CHARACTERS = 256 devnet_config = ConfigParser() -devnet_config.read(os.path.join(os.path.dirname(__file__), 'denoms_devnet.ini')) +devnet_config.read(os.path.join(os.path.dirname(__file__), "denoms_devnet.ini")) testnet_config = ConfigParser() -testnet_config.read(os.path.join(os.path.dirname(__file__), 'denoms_testnet.ini')) +testnet_config.read(os.path.join(os.path.dirname(__file__), "denoms_testnet.ini")) mainnet_config = ConfigParser() -mainnet_config.read(os.path.join(os.path.dirname(__file__), 'denoms_mainnet.ini')) +mainnet_config.read(os.path.join(os.path.dirname(__file__), "denoms_mainnet.ini")) class Denom: def __init__( @@ -31,32 +31,32 @@ def __init__( @classmethod def load_market(cls, network, market_id): - if network == 'devnet': + if network == "devnet": config = devnet_config - elif network == 'testnet': + elif network == "testnet": config = testnet_config else: config =mainnet_config return cls( - description=config[market_id]['description'], - base=int(config[market_id]['base']), - quote=int(config[market_id]['quote']), - min_price_tick_size=float(config[market_id]['min_price_tick_size']), - min_quantity_tick_size=float(config[market_id]['min_quantity_tick_size']), + description=config[market_id]["description"], + base=int(config[market_id]["base"]), + quote=int(config[market_id]["quote"]), + min_price_tick_size=float(config[market_id]["min_price_tick_size"]), + min_quantity_tick_size=float(config[market_id]["min_quantity_tick_size"]), ) @classmethod def load_peggy_denom(cls, network, symbol): - if network == 'devnet': + if network == "devnet": config = devnet_config - elif network == 'local': + elif network == "local": config = devnet_config - elif network == 'testnet': + elif network == "testnet": config = testnet_config else: config = mainnet_config - return config[symbol]['peggy_denom'], int(config[symbol]['decimals']) + return config[symbol]["peggy_denom"], int(config[symbol]["decimals"]) class Network: @@ -83,14 +83,14 @@ def __init__( @classmethod def devnet(cls): return cls( - lcd_endpoint='https://devnet.lcd.injective.dev', - tm_websocket_endpoint='wss://devnet.tm.injective.dev/websocket', - grpc_endpoint='devnet.injective.dev:9900', - grpc_exchange_endpoint='devnet.injective.dev:9910', - grpc_explorer_endpoint='devnet.injective.dev:9911', - chain_id='injective-777', - fee_denom='inj', - env='devnet' + lcd_endpoint="https://devnet.lcd.injective.dev", + tm_websocket_endpoint="wss://devnet.tm.injective.dev/websocket", + grpc_endpoint="devnet.injective.dev:9900", + grpc_exchange_endpoint="devnet.injective.dev:9910", + grpc_explorer_endpoint="devnet.injective.dev:9911", + chain_id="injective-777", + fee_denom="inj", + env="devnet" ) @classmethod @@ -100,20 +100,20 @@ def testnet(cls, node="lb"): "sentry", ] if node not in nodes: - raise ValueError('Must be one of {}'.format(nodes)) - - if node == 'lb': - lcd_endpoint = 'https://k8s.testnet.lcd.injective.network', - tm_websocket_endpoint = 'wss://k8s.testnet.tm.injective.network/websocket', - grpc_endpoint = 'k8s.testnet.chain.grpc.injective.network:443', - grpc_exchange_endpoint = 'k8s.testnet.exchange.grpc.injective.network:443', - grpc_explorer_endpoint = 'k8s.testnet.explorer.grpc.injective.network:443', + raise ValueError("Must be one of {}".format(nodes)) + + if node == "lb": + lcd_endpoint = "https://k8s.testnet.lcd.injective.network" + tm_websocket_endpoint = "wss://k8s.testnet.tm.injective.network/websocket" + grpc_endpoint = "k8s.testnet.chain.grpc.injective.network:443" + grpc_exchange_endpoint = "k8s.testnet.exchange.grpc.injective.network:443" + grpc_explorer_endpoint = "k8s.testnet.explorer.grpc.injective.network:443" else: - lcd_endpoint = 'https://testnet.lcd.injective.network' - tm_websocket_endpoint = 'wss://testnet.tm.injective.network/websocket' - grpc_endpoint = 'testnet.chain.grpc.injective.network' - grpc_exchange_endpoint = 'testnet.exchange.grpc.injective.network' - grpc_explorer_endpoint = 'testnet.explorer.grpc.injective.network' + lcd_endpoint = "https://testnet.lcd.injective.network" + tm_websocket_endpoint = "wss://testnet.tm.injective.network/websocket" + grpc_endpoint = "testnet.chain.grpc.injective.network" + grpc_exchange_endpoint = "testnet.exchange.grpc.injective.network" + grpc_explorer_endpoint = "testnet.explorer.grpc.injective.network" return cls( lcd_endpoint=lcd_endpoint, @@ -121,34 +121,34 @@ def testnet(cls, node="lb"): grpc_endpoint=grpc_endpoint, grpc_exchange_endpoint=grpc_exchange_endpoint, grpc_explorer_endpoint=grpc_explorer_endpoint, - chain_id='injective-888', - fee_denom='inj', - env='testnet' + chain_id="injective-888", + fee_denom="inj", + env="testnet" ) @classmethod - def mainnet(cls, node='lb'): + def mainnet(cls, node="lb"): nodes = [ - 'lb', # us, asia, prod - 'sentry0', # ca, prod - 'sentry1', # ca, prod - 'sentry3', # us, prod + "lb", # us, asia, prod + "sentry0", # ca, prod + "sentry1", # ca, prod + "sentry3", # us, prod ] if node not in nodes: - raise ValueError('Must be one of {}'.format(nodes)) - - if node == 'lb': - lcd_endpoint = 'https://k8s.global.mainnet.lcd.injective.network:443' - tm_websocket_endpoint = 'wss://k8s.global.mainnet.tm.injective.network:443/websocket' - grpc_endpoint = 'k8s.global.mainnet.chain.grpc.injective.network:443' - grpc_exchange_endpoint = 'k8s.global.mainnet.exchange.grpc.injective.network:443' - grpc_explorer_endpoint = 'k8s.global.mainnet.explorer.grpc.injective.network:443' + raise ValueError("Must be one of {}".format(nodes)) + + if node == "lb": + lcd_endpoint = "https://k8s.global.mainnet.lcd.injective.network:443" + tm_websocket_endpoint = "wss://k8s.global.mainnet.tm.injective.network:443/websocket" + grpc_endpoint = "k8s.global.mainnet.chain.grpc.injective.network:443" + grpc_exchange_endpoint = "k8s.global.mainnet.exchange.grpc.injective.network:443" + grpc_explorer_endpoint = "k8s.global.mainnet.explorer.grpc.injective.network:443" else: - lcd_endpoint=f'http://{node}.injective.network:10337' - tm_websocket_endpoint=f'ws://{node}.injective.network:26657/websocket' - grpc_endpoint=f'{node}.injective.network:9900' - grpc_exchange_endpoint=f'{node}.injective.network:9910' - grpc_explorer_endpoint=f'{node}.injective.network:9911' + lcd_endpoint = f"http://{node}.injective.network:10337" + tm_websocket_endpoint = f"ws://{node}.injective.network:26657/websocket" + grpc_endpoint = f"{node}.injective.network:9900" + grpc_exchange_endpoint = f"{node}.injective.network:9910" + grpc_explorer_endpoint = f"{node}.injective.network:9911" return cls( lcd_endpoint=lcd_endpoint, @@ -156,22 +156,22 @@ def mainnet(cls, node='lb'): grpc_endpoint=grpc_endpoint, grpc_exchange_endpoint=grpc_exchange_endpoint, grpc_explorer_endpoint=grpc_explorer_endpoint, - chain_id='injective-1', - fee_denom='inj', - env='mainnet' + chain_id="injective-1", + fee_denom="inj", + env="mainnet" ) @classmethod def local(cls): return cls( - lcd_endpoint='http://localhost:10337', - tm_websocket_endpoint='ws://localhost:26657/websocket', - grpc_endpoint='localhost:9900', - grpc_exchange_endpoint='localhost:9910', - grpc_explorer_endpoint='localhost:9911', - chain_id='injective-1', - fee_denom='inj', - env='local' + lcd_endpoint="http://localhost:10337", + tm_websocket_endpoint="ws://localhost:26657/websocket", + grpc_endpoint="localhost:9900", + grpc_exchange_endpoint="localhost:9910", + grpc_explorer_endpoint="localhost:9911", + chain_id="injective-1", + fee_denom="inj", + env="local" ) @classmethod @@ -183,7 +183,7 @@ def custom(cls, lcd_endpoint, tm_websocket_endpoint, grpc_endpoint, grpc_exchang grpc_exchange_endpoint=grpc_exchange_endpoint, grpc_explorer_endpoint=grpc_explorer_endpoint, chain_id=chain_id, - fee_denom='inj', + fee_denom="inj", env=env ) From 2fb5da405fcecc5b251c3906bb65f5c7da54231c Mon Sep 17 00:00:00 2001 From: abel Date: Tue, 22 Aug 2023 16:15:45 -0300 Subject: [PATCH 2/2] (fix) Updated library version number and README file --- README.md | 3 +++ setup.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b4669a3f..b77cf52a 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,9 @@ make tests ``` ### Changelogs +**0.7.1.1** +* Fixed Testnet network URLs + **0.7.1** * Include implementation of the MessageBroadcaster, to simplify the transaction creation and broadcasting process. diff --git a/setup.py b/setup.py index 34a68556..4060de98 100755 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ EMAIL = "achilleas@injectivelabs.com" AUTHOR = "Injective Labs" REQUIRES_PYTHON = ">=3.9" -VERSION = "0.7.1" +VERSION = "0.7.1.1" REQUIRED = [ "aiohttp",