@@ -115,11 +115,12 @@ class Subtensor(SubtensorMixin):
115
115
def __init__ (
116
116
self ,
117
117
network : Optional [str ] = None ,
118
- config : Optional [" Config" ] = None ,
118
+ config : Optional [Config ] = None ,
119
119
log_verbose : bool = False ,
120
120
fallback_endpoints : Optional [list [str ]] = None ,
121
121
retry_forever : bool = False ,
122
122
_mock : bool = False ,
123
+ archive_endpoints : Optional [list [str ]] = None ,
123
124
):
124
125
"""
125
126
Initializes an instance of the Subtensor class.
@@ -128,9 +129,13 @@ def __init__(
128
129
network: The network name or type to connect to.
129
130
config: Configuration object for the AsyncSubtensor instance.
130
131
log_verbose: Enables or disables verbose logging.
131
- fallback_endpoints: List of fallback endpoints to use if default or provided network is not available. Defaults to `None`.
132
+ fallback_endpoints: List of fallback endpoints to use if default or provided network is not available.
133
+ Defaults to `None`.
132
134
retry_forever: Whether to retry forever on connection errors. Defaults to `False`.
133
135
_mock: Whether this is a mock instance. Mainly just for use in testing.
136
+ archive_endpoints: Similar to fallback_endpoints, but specifically only archive nodes. Will be used in cases
137
+ where you are requesting a block that is too old for your current (presumably lite) node. Defaults to
138
+ `None`
134
139
135
140
Raises:
136
141
Any exceptions raised during the setup, configuration, or connection process.
@@ -151,6 +156,7 @@ def __init__(
151
156
fallback_endpoints = fallback_endpoints ,
152
157
retry_forever = retry_forever ,
153
158
_mock = _mock ,
159
+ archive_endpoints = archive_endpoints ,
154
160
)
155
161
if self .log_verbose :
156
162
logging .info (
@@ -172,18 +178,23 @@ def _get_substrate(
172
178
fallback_endpoints : Optional [list [str ]] = None ,
173
179
retry_forever : bool = False ,
174
180
_mock : bool = False ,
181
+ archive_endpoints : Optional [list [str ]] = None ,
175
182
) -> Union [SubstrateInterface , RetrySyncSubstrate ]:
176
183
"""Creates the Substrate instance based on provided arguments.
177
184
178
185
Arguments:
179
- fallback_endpoints: List of fallback chains endpoints to use if main network isn't available. Defaults to `None`.
186
+ fallback_endpoints: List of fallback chains endpoints to use if main network isn't available. Defaults to
187
+ `None`.
180
188
retry_forever: Whether to retry forever on connection errors. Defaults to `False`.
181
189
_mock: Whether this is a mock instance. Mainly just for use in testing.
190
+ archive_endpoints: Similar to fallback_endpoints, but specifically only archive nodes. Will be used in cases
191
+ where you are requesting a block that is too old for your current (presumably lite) node. Defaults to
192
+ `None`
182
193
183
194
Returns:
184
195
the instance of the SubstrateInterface or RetrySyncSubstrate class.
185
196
"""
186
- if fallback_endpoints or retry_forever :
197
+ if fallback_endpoints or retry_forever or archive_endpoints :
187
198
return RetrySyncSubstrate (
188
199
url = self .chain_endpoint ,
189
200
ss58_format = SS58_FORMAT ,
@@ -193,6 +204,7 @@ def _get_substrate(
193
204
fallback_chains = fallback_endpoints ,
194
205
retry_forever = retry_forever ,
195
206
_mock = _mock ,
207
+ archive_endpoints = archive_endpoints ,
196
208
)
197
209
return SubstrateInterface (
198
210
url = self .chain_endpoint ,
0 commit comments