From 5b26a4310e3d67c06c6537e693d1ba21a6b3f0c3 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Thu, 1 Sep 2022 17:17:12 -0400 Subject: [PATCH] add check to add ws:// if needed --- bittensor/_subtensor/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bittensor/_subtensor/__init__.py b/bittensor/_subtensor/__init__.py index a994c1e79a..8c0be7c88f 100644 --- a/bittensor/_subtensor/__init__.py +++ b/bittensor/_subtensor/__init__.py @@ -137,11 +137,16 @@ def __new__( config.subtensor.chain_endpoint = subtensor.determine_chain_endpoint( bittensor.defaults.subtensor.network ) config.subtensor.network = bittensor.defaults.subtensor.network + # make sure it's wss:// or ws:// + endpoint_url: str = config.subtensor.chain_endpoint + if endpoint_url[0:6] != "wss://" and endpoint_url[0:5] != "ws://": + endpoint_url = "ws://{}".format(endpoint_url) + substrate = SubstrateInterface( ss58_format = bittensor.__ss58_format__, type_registry_preset='substrate-node-template', type_registry = __type_registery__, - url = "ws://{}".format(config.subtensor.chain_endpoint), + url = endpoint_url, use_remote_preset=True )