File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ def get_logs(
181
181
use_subsquid = use_subsquid ,
182
182
)
183
183
184
- if use_subsquid and from_block < self .w3 .latest_seen_block - self .w3 .unstable_blocks :
184
+ if use_subsquid and self . w3 . subsquid_available and from_block < self .w3 .latest_seen_block - self .w3 .unstable_blocks :
185
185
kwargs ["use_subsquid" ] = False # make sure we only try once with Subsquid
186
186
try :
187
187
# trying to get logs from SubSquid
Original file line number Diff line number Diff line change 10
10
from .BatchRetryMiddleware import BatchRetryMiddleware
11
11
from .EthAdvanced import EthAdvanced
12
12
from .Multicall import MultiCall
13
+ from .Subsquid import get_endpoints
13
14
from .Web3ErrorHandlerPatch import patch_error_formatters
14
15
from .FastChecksumAddress import to_checksum_address
15
16
@@ -77,6 +78,7 @@ def __init__(
77
78
if not self .revert_reason_available :
78
79
print (f"RPC { self .node_url } does not return revert reasons" )
79
80
self .overwrites_available : bool = self ._check_overwrites_available ()
81
+ self .subsquid_available : bool = self ._check_subsquid_available ()
80
82
81
83
self .middleware_onion .inject (BatchRetryMiddleware , layer = 0 , name = "batch_retry" ) # split and retry batch requests
82
84
@@ -166,3 +168,17 @@ def _check_overwrites_available(self) -> bool:
166
168
print (f"RPC does not support state overwrites, got: { repr (e )} " )
167
169
return False
168
170
return response == test_value
171
+
172
+ def _check_subsquid_available (self ) -> bool :
173
+ try :
174
+ endpoints = get_endpoints ()
175
+ except Exception as e :
176
+ print (f"Could not get supported chains from SubSquid: { repr (e )} " )
177
+ return False
178
+
179
+ chain_id = self .eth .chain_id
180
+ if chain_id not in endpoints :
181
+ print (f"SubSquid does not support chain { chain_id } " )
182
+ return False
183
+
184
+ return True
Original file line number Diff line number Diff line change 1
1
from setuptools import setup , find_packages
2
2
3
- VERSION = '0.1.38 '
3
+ VERSION = '0.1.39 '
4
4
DESCRIPTION = 'IceCreamSwap Web3.py wrapper'
5
5
LONG_DESCRIPTION = 'IceCreamSwap Web3.py wrapper with automatic retries, multicall and other advanced functionality'
6
6
You can’t perform that action at this time.
0 commit comments