Skip to content

Commit 952f788

Browse files
author
Roman
committed
update SubtensorApi init and strings
1 parent 0cd1d27 commit 952f788

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

bittensor/core/subtensor_api/__init__.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class SubtensorApi:
2525
network: The network to connect to. Defaults to `None` -> "finney".
2626
config: Bittensor configuration object. Defaults to `None`.
2727
legacy_methods: If `True`, all methods from the Subtensor class will be added to the root level of this class.
28-
fallback_chains (list): List of fallback chains to use if no network is specified. Defaults to `None`.
29-
retry_forever (bool): Whether to retry forever on connection errors. Defaults to `False`.
30-
log_verbose (bool): Enables or disables verbose logging.
28+
fallback_endpoints: List of fallback endpoints to use if default or provided network is not available. Defaults to `None`.
29+
retry_forever: Whether to retry forever on connection errors. Defaults to `False`.
30+
log_verbose: Enables or disables verbose logging.
3131
mock: Whether this is a mock instance. Mainly just for use in testing.
3232
3333
Example:
@@ -54,10 +54,15 @@ class SubtensorApi:
5454
subtensor = bt.SubtensorApi(legacy_methods=True)
5555
print(subtensor.bonds(0))
5656
57-
# using `fallback_chains` or `retry_forever`
57+
# using `fallback_endpoints` or `retry_forever`
5858
import bittensor as bt
5959
60-
60+
subtensor = bt.SubtensorApi(
61+
network="finney",
62+
fallback_endpoints=["wss://localhost:9945", "wss://some-other-endpoint:9945"],
63+
retry_forever=True,
64+
)
65+
print(subtensor.block)
6166
"""
6267

6368
def __init__(
@@ -66,13 +71,13 @@ def __init__(
6671
config: Optional["Config"] = None,
6772
async_subtensor: bool = False,
6873
legacy_methods: bool = False,
69-
fallback_chains: Optional[list[str]] = None,
74+
fallback_endpoints: Optional[list[str]] = None,
7075
retry_forever: bool = False,
7176
log_verbose: bool = False,
7277
mock: bool = False,
7378
):
7479
self.network = network
75-
self._fallback_chains = fallback_chains
80+
self._fallback_endpoints = fallback_endpoints
7681
self._retry_forever = retry_forever
7782
self._mock = mock
7883
self.log_verbose = log_verbose
@@ -111,7 +116,7 @@ def _get_subtensor(self) -> Union["_Subtensor", "_AsyncSubtensor"]:
111116
network=self.network,
112117
config=self._config,
113118
log_verbose=self.log_verbose,
114-
fallback_chains=self._fallback_chains,
119+
fallback_endpoints=self._fallback_endpoints,
115120
retry_forever=self._retry_forever,
116121
_mock=self._mock,
117122
)
@@ -122,7 +127,7 @@ def _get_subtensor(self) -> Union["_Subtensor", "_AsyncSubtensor"]:
122127
network=self.network,
123128
config=self._config,
124129
log_verbose=self.log_verbose,
125-
fallback_chains=self._fallback_chains,
130+
fallback_endpoints=self._fallback_endpoints,
126131
retry_forever=self._retry_forever,
127132
_mock=self._mock,
128133
)

0 commit comments

Comments
 (0)