web3 7.0.0b9__py3-none-any.whl → 7.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- web3/_utils/http.py +5 -2
- web3/_utils/module_testing/eth_module.py +40 -0
- web3/beacon/api_endpoints.py +3 -0
- web3/beacon/async_beacon.py +18 -2
- web3/beacon/beacon.py +18 -2
- web3/contract/async_contract.py +8 -8
- web3/contract/contract.py +10 -8
- web3/datastructures.py +21 -11
- web3/middleware/base.py +8 -0
- web3/middleware/signing.py +2 -2
- web3/providers/rpc/async_rpc.py +10 -2
- web3/providers/rpc/rpc.py +11 -2
- web3/scripts/install_pre_releases.py +33 -0
- web3/scripts/parse_pygeth_version.py +16 -0
- {web3-7.0.0b9.dist-info → web3-7.2.0.dist-info}/METADATA +6 -8
- {web3-7.0.0b9.dist-info → web3-7.2.0.dist-info}/RECORD +19 -17
- {web3-7.0.0b9.dist-info → web3-7.2.0.dist-info}/WHEEL +1 -1
- {web3-7.0.0b9.dist-info → web3-7.2.0.dist-info}/LICENSE +0 -0
- {web3-7.0.0b9.dist-info → web3-7.2.0.dist-info}/top_level.txt +0 -0
web3/_utils/http.py
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
DEFAULT_HTTP_TIMEOUT = 30.0
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def construct_user_agent(
|
|
4
|
+
def construct_user_agent(
|
|
5
|
+
module: str,
|
|
6
|
+
class_name: str,
|
|
7
|
+
) -> str:
|
|
5
8
|
from web3 import (
|
|
6
9
|
__version__ as web3_version,
|
|
7
10
|
)
|
|
8
11
|
|
|
9
|
-
return f"web3.py/{web3_version}/{
|
|
12
|
+
return f"web3.py/{web3_version}/{module}.{class_name}"
|
|
@@ -88,6 +88,7 @@ from web3.exceptions import (
|
|
|
88
88
|
)
|
|
89
89
|
from web3.middleware import (
|
|
90
90
|
ExtraDataToPOAMiddleware,
|
|
91
|
+
SignAndSendRawMiddlewareBuilder,
|
|
91
92
|
)
|
|
92
93
|
from web3.types import (
|
|
93
94
|
ENS,
|
|
@@ -725,6 +726,26 @@ class AsyncEthModuleTest:
|
|
|
725
726
|
txn_hash = await async_w3.eth.send_raw_transaction(signed.raw_transaction)
|
|
726
727
|
assert txn_hash == HexBytes(signed.hash)
|
|
727
728
|
|
|
729
|
+
@pytest.mark.asyncio
|
|
730
|
+
async def test_async_sign_and_send_raw_middleware(
|
|
731
|
+
self, async_w3: "AsyncWeb3", keyfile_account_pkey: HexStr
|
|
732
|
+
) -> None:
|
|
733
|
+
keyfile_account = async_w3.eth.account.from_key(keyfile_account_pkey)
|
|
734
|
+
txn: TxParams = {
|
|
735
|
+
"from": keyfile_account.address,
|
|
736
|
+
"to": keyfile_account.address,
|
|
737
|
+
"value": Wei(0),
|
|
738
|
+
"gas": 21000,
|
|
739
|
+
}
|
|
740
|
+
async_w3.middleware_onion.add(
|
|
741
|
+
SignAndSendRawMiddlewareBuilder.build(keyfile_account), "signing"
|
|
742
|
+
)
|
|
743
|
+
txn_hash = await async_w3.eth.send_transaction(txn)
|
|
744
|
+
assert isinstance(txn_hash, HexBytes)
|
|
745
|
+
|
|
746
|
+
# clean up
|
|
747
|
+
async_w3.middleware_onion.remove("signing")
|
|
748
|
+
|
|
728
749
|
@pytest.mark.asyncio
|
|
729
750
|
async def test_GasPriceStrategyMiddleware(
|
|
730
751
|
self,
|
|
@@ -3716,6 +3737,25 @@ class EthModuleTest:
|
|
|
3716
3737
|
txn_hash = w3.eth.send_raw_transaction(signed.raw_transaction)
|
|
3717
3738
|
assert txn_hash == HexBytes(signed.hash)
|
|
3718
3739
|
|
|
3740
|
+
def test_sign_and_send_raw_middleware(
|
|
3741
|
+
self, w3: "Web3", keyfile_account_pkey: HexStr
|
|
3742
|
+
) -> None:
|
|
3743
|
+
keyfile_account = w3.eth.account.from_key(keyfile_account_pkey)
|
|
3744
|
+
txn: TxParams = {
|
|
3745
|
+
"from": keyfile_account.address,
|
|
3746
|
+
"to": keyfile_account.address,
|
|
3747
|
+
"value": Wei(0),
|
|
3748
|
+
"gas": 21000,
|
|
3749
|
+
}
|
|
3750
|
+
w3.middleware_onion.add(
|
|
3751
|
+
SignAndSendRawMiddlewareBuilder.build(keyfile_account), "signing"
|
|
3752
|
+
)
|
|
3753
|
+
txn_hash = w3.eth.send_transaction(txn)
|
|
3754
|
+
assert isinstance(txn_hash, HexBytes)
|
|
3755
|
+
|
|
3756
|
+
# cleanup
|
|
3757
|
+
w3.middleware_onion.remove("signing")
|
|
3758
|
+
|
|
3719
3759
|
def test_eth_call(self, w3: "Web3", math_contract: "Contract") -> None:
|
|
3720
3760
|
txn_params = math_contract._prepare_transaction(
|
|
3721
3761
|
abi_element_identifier="add",
|
web3/beacon/api_endpoints.py
CHANGED
|
@@ -26,6 +26,9 @@ GET_BLINDED_BLOCKS = "/eth/v1/beacon/blinded_blocks/{0}"
|
|
|
26
26
|
# rewards
|
|
27
27
|
GET_REWARDS = "/eth/v1/beacon/rewards/blocks/{0}"
|
|
28
28
|
|
|
29
|
+
# blobs
|
|
30
|
+
GET_BLOB_SIDECARS = "/eth/v1/beacon/blob_sidecars/{0}"
|
|
31
|
+
|
|
29
32
|
# light client
|
|
30
33
|
GET_LIGHT_CLIENT_BOOTSTRAP_STRUCTURE = "/eth/v1/beacon/light_client/bootstrap/{0}"
|
|
31
34
|
GET_LIGHT_CLIENT_UPDATES = "/eth/v1/beacon/light_client/updates"
|
web3/beacon/async_beacon.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Any,
|
|
3
3
|
Dict,
|
|
4
|
+
List,
|
|
5
|
+
Optional,
|
|
4
6
|
)
|
|
5
7
|
|
|
6
8
|
from eth_typing import (
|
|
@@ -17,6 +19,7 @@ from web3.beacon.api_endpoints import (
|
|
|
17
19
|
GET_BEACON_HEADS,
|
|
18
20
|
GET_BEACON_STATE,
|
|
19
21
|
GET_BLINDED_BLOCKS,
|
|
22
|
+
GET_BLOB_SIDECARS,
|
|
20
23
|
GET_BLOCK,
|
|
21
24
|
GET_BLOCK_ATTESTATIONS,
|
|
22
25
|
GET_BLOCK_HEADER,
|
|
@@ -64,10 +67,12 @@ class AsyncBeacon:
|
|
|
64
67
|
self.request_timeout = request_timeout
|
|
65
68
|
self._request_session_manager = HTTPSessionManager()
|
|
66
69
|
|
|
67
|
-
async def _async_make_get_request(
|
|
70
|
+
async def _async_make_get_request(
|
|
71
|
+
self, endpoint_uri: str, params: Optional[Dict[str, str]] = None
|
|
72
|
+
) -> Dict[str, Any]:
|
|
68
73
|
uri = URI(self.base_url + endpoint_uri)
|
|
69
74
|
return await self._request_session_manager.async_json_make_get_request(
|
|
70
|
-
uri, timeout=self.request_timeout
|
|
75
|
+
uri, params=params, timeout=self.request_timeout
|
|
71
76
|
)
|
|
72
77
|
|
|
73
78
|
# [ BEACON endpoints ]
|
|
@@ -220,3 +225,14 @@ class AsyncBeacon:
|
|
|
220
225
|
|
|
221
226
|
async def get_syncing(self) -> Dict[str, Any]:
|
|
222
227
|
return await self._async_make_get_request(GET_SYNCING)
|
|
228
|
+
|
|
229
|
+
# [ BLOB endpoints ]
|
|
230
|
+
|
|
231
|
+
async def get_blob_sidecars(
|
|
232
|
+
self, block_id: str, indices: Optional[List[int]] = None
|
|
233
|
+
) -> Dict[str, Any]:
|
|
234
|
+
indices_param = {"indices": ",".join(map(str, indices))} if indices else None
|
|
235
|
+
return await self._async_make_get_request(
|
|
236
|
+
GET_BLOB_SIDECARS.format(block_id),
|
|
237
|
+
params=indices_param,
|
|
238
|
+
)
|
web3/beacon/beacon.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Any,
|
|
3
3
|
Dict,
|
|
4
|
+
List,
|
|
5
|
+
Optional,
|
|
4
6
|
)
|
|
5
7
|
|
|
6
8
|
from eth_typing import (
|
|
@@ -17,6 +19,7 @@ from web3.beacon.api_endpoints import (
|
|
|
17
19
|
GET_BEACON_HEADS,
|
|
18
20
|
GET_BEACON_STATE,
|
|
19
21
|
GET_BLINDED_BLOCKS,
|
|
22
|
+
GET_BLOB_SIDECARS,
|
|
20
23
|
GET_BLOCK,
|
|
21
24
|
GET_BLOCK_ATTESTATIONS,
|
|
22
25
|
GET_BLOCK_HEADER,
|
|
@@ -62,10 +65,12 @@ class Beacon:
|
|
|
62
65
|
self.request_timeout = request_timeout
|
|
63
66
|
self._request_session_manager = HTTPSessionManager()
|
|
64
67
|
|
|
65
|
-
def _make_get_request(
|
|
68
|
+
def _make_get_request(
|
|
69
|
+
self, endpoint_url: str, params: Optional[Dict[str, str]] = None
|
|
70
|
+
) -> Dict[str, Any]:
|
|
66
71
|
uri = URI(self.base_url + endpoint_url)
|
|
67
72
|
return self._request_session_manager.json_make_get_request(
|
|
68
|
-
uri, timeout=self.request_timeout
|
|
73
|
+
uri, params=params, timeout=self.request_timeout
|
|
69
74
|
)
|
|
70
75
|
|
|
71
76
|
# [ BEACON endpoints ]
|
|
@@ -206,3 +211,14 @@ class Beacon:
|
|
|
206
211
|
|
|
207
212
|
def get_syncing(self) -> Dict[str, Any]:
|
|
208
213
|
return self._make_get_request(GET_SYNCING)
|
|
214
|
+
|
|
215
|
+
# [ BLOB endpoints ]
|
|
216
|
+
|
|
217
|
+
def get_blob_sidecars(
|
|
218
|
+
self, block_id: str, indices: Optional[List[int]] = None
|
|
219
|
+
) -> Dict[str, Any]:
|
|
220
|
+
indices_param = {"indices": ",".join(map(str, indices))} if indices else None
|
|
221
|
+
return self._make_get_request(
|
|
222
|
+
GET_BLOB_SIDECARS.format(block_id),
|
|
223
|
+
params=indices_param,
|
|
224
|
+
)
|
web3/contract/async_contract.py
CHANGED
|
@@ -319,8 +319,8 @@ class AsyncContractFunction(BaseContractFunction):
|
|
|
319
319
|
state_override,
|
|
320
320
|
ccip_read_enabled,
|
|
321
321
|
self.decode_tuples,
|
|
322
|
-
*self.args,
|
|
323
|
-
**self.kwargs,
|
|
322
|
+
*self.args or (),
|
|
323
|
+
**self.kwargs or {},
|
|
324
324
|
)
|
|
325
325
|
|
|
326
326
|
async def transact(self, transaction: Optional[TxParams] = None) -> HexBytes:
|
|
@@ -332,8 +332,8 @@ class AsyncContractFunction(BaseContractFunction):
|
|
|
332
332
|
setup_transaction,
|
|
333
333
|
self.contract_abi,
|
|
334
334
|
self.abi,
|
|
335
|
-
*self.args,
|
|
336
|
-
**self.kwargs,
|
|
335
|
+
*self.args or (),
|
|
336
|
+
**self.kwargs or {},
|
|
337
337
|
)
|
|
338
338
|
|
|
339
339
|
async def estimate_gas(
|
|
@@ -352,8 +352,8 @@ class AsyncContractFunction(BaseContractFunction):
|
|
|
352
352
|
self.abi,
|
|
353
353
|
block_identifier,
|
|
354
354
|
state_override,
|
|
355
|
-
*self.args,
|
|
356
|
-
**self.kwargs,
|
|
355
|
+
*self.args or (),
|
|
356
|
+
**self.kwargs or {},
|
|
357
357
|
)
|
|
358
358
|
|
|
359
359
|
async def build_transaction(
|
|
@@ -367,8 +367,8 @@ class AsyncContractFunction(BaseContractFunction):
|
|
|
367
367
|
built_transaction,
|
|
368
368
|
self.contract_abi,
|
|
369
369
|
self.abi,
|
|
370
|
-
*self.args,
|
|
371
|
-
**self.kwargs,
|
|
370
|
+
*self.args or (),
|
|
371
|
+
**self.kwargs or {},
|
|
372
372
|
)
|
|
373
373
|
|
|
374
374
|
@staticmethod
|
web3/contract/contract.py
CHANGED
|
@@ -318,12 +318,13 @@ class ContractFunction(BaseContractFunction):
|
|
|
318
318
|
state_override,
|
|
319
319
|
ccip_read_enabled,
|
|
320
320
|
self.decode_tuples,
|
|
321
|
-
*self.args,
|
|
322
|
-
**self.kwargs,
|
|
321
|
+
*self.args or (),
|
|
322
|
+
**self.kwargs or {},
|
|
323
323
|
)
|
|
324
324
|
|
|
325
325
|
def transact(self, transaction: Optional[TxParams] = None) -> HexBytes:
|
|
326
326
|
setup_transaction = self._transact(transaction)
|
|
327
|
+
|
|
327
328
|
return transact_with_contract_function(
|
|
328
329
|
self.address,
|
|
329
330
|
self.w3,
|
|
@@ -331,8 +332,8 @@ class ContractFunction(BaseContractFunction):
|
|
|
331
332
|
setup_transaction,
|
|
332
333
|
self.contract_abi,
|
|
333
334
|
self.abi,
|
|
334
|
-
*self.args,
|
|
335
|
-
**self.kwargs,
|
|
335
|
+
*self.args or (),
|
|
336
|
+
**self.kwargs or {},
|
|
336
337
|
)
|
|
337
338
|
|
|
338
339
|
def estimate_gas(
|
|
@@ -351,12 +352,13 @@ class ContractFunction(BaseContractFunction):
|
|
|
351
352
|
self.abi,
|
|
352
353
|
block_identifier,
|
|
353
354
|
state_override,
|
|
354
|
-
*self.args,
|
|
355
|
-
**self.kwargs,
|
|
355
|
+
*self.args or (),
|
|
356
|
+
**self.kwargs or {},
|
|
356
357
|
)
|
|
357
358
|
|
|
358
359
|
def build_transaction(self, transaction: Optional[TxParams] = None) -> TxParams:
|
|
359
360
|
built_transaction = self._build_transaction(transaction)
|
|
361
|
+
|
|
360
362
|
return build_transaction_for_function(
|
|
361
363
|
self.address,
|
|
362
364
|
self.w3,
|
|
@@ -364,8 +366,8 @@ class ContractFunction(BaseContractFunction):
|
|
|
364
366
|
built_transaction,
|
|
365
367
|
self.contract_abi,
|
|
366
368
|
self.abi,
|
|
367
|
-
*self.args,
|
|
368
|
-
**self.kwargs,
|
|
369
|
+
*self.args or (),
|
|
370
|
+
**self.kwargs or {},
|
|
369
371
|
)
|
|
370
372
|
|
|
371
373
|
@staticmethod
|
web3/datastructures.py
CHANGED
|
@@ -182,7 +182,7 @@ class NamedElementOnion(Mapping[TKey, TValue]):
|
|
|
182
182
|
if name is None:
|
|
183
183
|
name = cast(TKey, element)
|
|
184
184
|
|
|
185
|
-
name = self.
|
|
185
|
+
name = self._build_name(name)
|
|
186
186
|
|
|
187
187
|
if name in self._queue:
|
|
188
188
|
if name is element:
|
|
@@ -219,7 +219,7 @@ class NamedElementOnion(Mapping[TKey, TValue]):
|
|
|
219
219
|
if name is None:
|
|
220
220
|
name = cast(TKey, element)
|
|
221
221
|
|
|
222
|
-
name = self.
|
|
222
|
+
name = self._build_name(name)
|
|
223
223
|
|
|
224
224
|
self._queue.move_to_end(name, last=False)
|
|
225
225
|
elif layer == len(self._queue):
|
|
@@ -233,7 +233,7 @@ class NamedElementOnion(Mapping[TKey, TValue]):
|
|
|
233
233
|
self._queue.clear()
|
|
234
234
|
|
|
235
235
|
def replace(self, old: TKey, new: TKey) -> TValue:
|
|
236
|
-
old_name = self.
|
|
236
|
+
old_name = self._build_name(old)
|
|
237
237
|
|
|
238
238
|
if old_name not in self._queue:
|
|
239
239
|
raise Web3ValueError(
|
|
@@ -248,15 +248,25 @@ class NamedElementOnion(Mapping[TKey, TValue]):
|
|
|
248
248
|
self._queue[old_name] = new
|
|
249
249
|
return to_be_replaced
|
|
250
250
|
|
|
251
|
-
|
|
251
|
+
@staticmethod
|
|
252
|
+
def _build_name(value: TKey) -> TKey:
|
|
252
253
|
try:
|
|
253
254
|
value.__hash__()
|
|
255
|
+
return value
|
|
254
256
|
except TypeError:
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
# unhashable, unnamed elements
|
|
258
|
+
if not callable(value):
|
|
259
|
+
raise Web3TypeError(
|
|
260
|
+
f"Expected a callable or hashable type, got {type(value)}"
|
|
261
|
+
)
|
|
262
|
+
# This will either be ``Web3Middleware`` class or the ``build`` method of a
|
|
263
|
+
# ``Web3MiddlewareBuilder``. Instantiate with empty ``Web3`` and use a
|
|
264
|
+
# unique identifier with the ``__hash__()`` as the name.
|
|
265
|
+
v = value(None)
|
|
266
|
+
return cast(TKey, f"{v.__class__}<{v.__hash__()}>")
|
|
257
267
|
|
|
258
268
|
def remove(self, old: TKey) -> None:
|
|
259
|
-
old_name = self.
|
|
269
|
+
old_name = self._build_name(old)
|
|
260
270
|
if old_name not in self._queue:
|
|
261
271
|
raise Web3ValueError("You can only remove something that has been added")
|
|
262
272
|
del self._queue[old_name]
|
|
@@ -270,8 +280,8 @@ class NamedElementOnion(Mapping[TKey, TValue]):
|
|
|
270
280
|
return [(val, key) for key, val in reversed(self._queue.items())]
|
|
271
281
|
|
|
272
282
|
def _replace_with_new_name(self, old: TKey, new: TKey) -> None:
|
|
273
|
-
old_name = self.
|
|
274
|
-
new_name = self.
|
|
283
|
+
old_name = self._build_name(old)
|
|
284
|
+
new_name = self._build_name(new)
|
|
275
285
|
|
|
276
286
|
self._queue[new_name] = new
|
|
277
287
|
found_old = False
|
|
@@ -293,11 +303,11 @@ class NamedElementOnion(Mapping[TKey, TValue]):
|
|
|
293
303
|
return NamedElementOnion(cast(List[Any], combined.items()))
|
|
294
304
|
|
|
295
305
|
def __contains__(self, element: Any) -> bool:
|
|
296
|
-
element_name = self.
|
|
306
|
+
element_name = self._build_name(element)
|
|
297
307
|
return element_name in self._queue
|
|
298
308
|
|
|
299
309
|
def __getitem__(self, element: TKey) -> TValue:
|
|
300
|
-
element_name = self.
|
|
310
|
+
element_name = self._build_name(element)
|
|
301
311
|
return self._queue[element_name]
|
|
302
312
|
|
|
303
313
|
def __len__(self) -> int:
|
web3/middleware/base.py
CHANGED
|
@@ -40,6 +40,14 @@ class Web3Middleware:
|
|
|
40
40
|
def __init__(self, w3: Union["AsyncWeb3", "Web3"]) -> None:
|
|
41
41
|
self._w3 = w3
|
|
42
42
|
|
|
43
|
+
def __hash__(self) -> int:
|
|
44
|
+
return hash(f"{self.__class__.__name__}({str(self.__dict__)})")
|
|
45
|
+
|
|
46
|
+
def __eq__(self, other: Any) -> bool:
|
|
47
|
+
if not isinstance(other, Web3Middleware):
|
|
48
|
+
return False
|
|
49
|
+
return self.__hash__() == other.__hash__()
|
|
50
|
+
|
|
43
51
|
# -- sync -- #
|
|
44
52
|
|
|
45
53
|
def wrap_make_request(self, make_request: "MakeRequestFn") -> "MakeRequestFn":
|
web3/middleware/signing.py
CHANGED
|
@@ -189,7 +189,7 @@ class SignAndSendRawMiddlewareBuilder(Web3MiddlewareBuilder):
|
|
|
189
189
|
|
|
190
190
|
return (
|
|
191
191
|
RPCEndpoint("eth_sendRawTransaction"),
|
|
192
|
-
[raw_tx.
|
|
192
|
+
[raw_tx.to_0x_hex()],
|
|
193
193
|
)
|
|
194
194
|
|
|
195
195
|
# -- async -- #
|
|
@@ -220,5 +220,5 @@ class SignAndSendRawMiddlewareBuilder(Web3MiddlewareBuilder):
|
|
|
220
220
|
|
|
221
221
|
return (
|
|
222
222
|
RPCEndpoint("eth_sendRawTransaction"),
|
|
223
|
-
[raw_tx.
|
|
223
|
+
[raw_tx.to_0x_hex()],
|
|
224
224
|
)
|
web3/providers/rpc/async_rpc.py
CHANGED
|
@@ -19,6 +19,7 @@ from eth_typing import (
|
|
|
19
19
|
URI,
|
|
20
20
|
)
|
|
21
21
|
from eth_utils import (
|
|
22
|
+
combomethod,
|
|
22
23
|
to_dict,
|
|
23
24
|
)
|
|
24
25
|
|
|
@@ -108,10 +109,17 @@ class AsyncHTTPProvider(AsyncJSONBaseProvider):
|
|
|
108
109
|
yield "headers", self.get_request_headers()
|
|
109
110
|
yield from self._request_kwargs.items()
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
@combomethod
|
|
113
|
+
def get_request_headers(cls) -> Dict[str, str]:
|
|
114
|
+
if isinstance(cls, AsyncHTTPProvider):
|
|
115
|
+
cls_name = cls.__class__.__name__
|
|
116
|
+
else:
|
|
117
|
+
cls_name = cls.__name__
|
|
118
|
+
module = cls.__module__
|
|
119
|
+
|
|
112
120
|
return {
|
|
113
121
|
"Content-Type": "application/json",
|
|
114
|
-
"User-Agent": construct_user_agent(
|
|
122
|
+
"User-Agent": construct_user_agent(module, cls_name),
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
async def _make_request(self, method: RPCEndpoint, request_data: bytes) -> bytes:
|
web3/providers/rpc/rpc.py
CHANGED
|
@@ -16,6 +16,7 @@ from eth_typing import (
|
|
|
16
16
|
URI,
|
|
17
17
|
)
|
|
18
18
|
from eth_utils import (
|
|
19
|
+
combomethod,
|
|
19
20
|
to_dict,
|
|
20
21
|
)
|
|
21
22
|
import requests
|
|
@@ -116,10 +117,18 @@ class HTTPProvider(JSONBaseProvider):
|
|
|
116
117
|
yield "headers", self.get_request_headers()
|
|
117
118
|
yield from self._request_kwargs.items()
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
@combomethod
|
|
121
|
+
def get_request_headers(cls) -> Dict[str, str]:
|
|
122
|
+
if isinstance(cls, HTTPProvider):
|
|
123
|
+
cls_name = cls.__class__.__name__
|
|
124
|
+
else:
|
|
125
|
+
cls_name = cls.__name__
|
|
126
|
+
|
|
127
|
+
module = cls.__module__
|
|
128
|
+
|
|
120
129
|
return {
|
|
121
130
|
"Content-Type": "application/json",
|
|
122
|
-
"User-Agent": construct_user_agent(
|
|
131
|
+
"User-Agent": construct_user_agent(module, cls_name),
|
|
123
132
|
}
|
|
124
133
|
|
|
125
134
|
def _make_request(self, method: RPCEndpoint, request_data: bytes) -> bytes:
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The goal of this script is to install the latest versions, including pre-releases, for
|
|
3
|
+
libraries that we maintain (and therefore control the release process) during our CI
|
|
4
|
+
runs. This helps us test pre-releases before they cause any issues once stable versions
|
|
5
|
+
are released.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import subprocess
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
ETHEREUM_LIBRARIES = [
|
|
12
|
+
"eth-account",
|
|
13
|
+
"eth-abi",
|
|
14
|
+
"eth-account",
|
|
15
|
+
"eth-hash[pycryptodome]",
|
|
16
|
+
"eth-typing",
|
|
17
|
+
"eth-utils",
|
|
18
|
+
"hexbytes",
|
|
19
|
+
"eth-tester[py-evm]",
|
|
20
|
+
"py-geth",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def install_eth_pre_releases() -> None:
|
|
25
|
+
for lib in ETHEREUM_LIBRARIES:
|
|
26
|
+
print(f"Installing {lib} with `--pre` and `-U`")
|
|
27
|
+
subprocess.check_call(
|
|
28
|
+
[sys.executable, "-m", "pip", "install", "--pre", "-U", lib]
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if __name__ == "__main__":
|
|
33
|
+
install_eth_pre_releases()
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def get_pygeth_version() -> str:
|
|
5
|
+
with open("setup.py") as f:
|
|
6
|
+
setup_contents = f.read()
|
|
7
|
+
version_match = re.search(r"py-geth\s*([><=~!]+)\s*([\d.]+)", setup_contents)
|
|
8
|
+
if version_match:
|
|
9
|
+
return "".join(version_match.group(1, 2))
|
|
10
|
+
else:
|
|
11
|
+
raise ValueError("py-geth not found in setup.py")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
version = get_pygeth_version()
|
|
16
|
+
print(version)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: web3
|
|
3
|
-
Version: 7.0
|
|
3
|
+
Version: 7.2.0
|
|
4
4
|
Summary: web3: A Python library for interacting with Ethereum
|
|
5
5
|
Home-page: https://github.com/ethereum/web3.py
|
|
6
6
|
Author: The Ethereum Foundation
|
|
@@ -20,13 +20,13 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
20
20
|
Requires-Python: >=3.8, <4
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: aiohttp >=3.7.4.post0
|
|
24
23
|
Requires-Dist: eth-abi >=5.0.1
|
|
25
24
|
Requires-Dist: eth-account >=0.13.1
|
|
26
25
|
Requires-Dist: eth-hash[pycryptodome] >=0.5.1
|
|
27
|
-
Requires-Dist: eth-typing >=5.0.
|
|
28
|
-
Requires-Dist: eth-utils >=5.0.
|
|
26
|
+
Requires-Dist: eth-typing >=5.0.0
|
|
27
|
+
Requires-Dist: eth-utils >=5.0.0
|
|
29
28
|
Requires-Dist: hexbytes >=1.2.0
|
|
29
|
+
Requires-Dist: aiohttp >=3.7.4.post0
|
|
30
30
|
Requires-Dist: pydantic >=2.4.0
|
|
31
31
|
Requires-Dist: requests >=2.23.0
|
|
32
32
|
Requires-Dist: typing-extensions >=4.0.1
|
|
@@ -53,9 +53,8 @@ Requires-Dist: sphinx >=6.0.0 ; extra == 'dev'
|
|
|
53
53
|
Requires-Dist: sphinx-autobuild >=2021.3.14 ; extra == 'dev'
|
|
54
54
|
Requires-Dist: sphinx-rtd-theme >=1.0.0 ; extra == 'dev'
|
|
55
55
|
Requires-Dist: towncrier <22,>=21 ; extra == 'dev'
|
|
56
|
-
Requires-Dist: eth-account >=0.13.0 ; extra == 'dev'
|
|
57
56
|
Requires-Dist: eth-tester[py-evm] <0.13.0b1,>=0.11.0b1 ; extra == 'dev'
|
|
58
|
-
Requires-Dist: py-geth >=5.0.
|
|
57
|
+
Requires-Dist: py-geth >=5.0.0 ; extra == 'dev'
|
|
59
58
|
Requires-Dist: pytest-asyncio <0.23,>=0.18.1 ; extra == 'dev'
|
|
60
59
|
Requires-Dist: pytest-xdist >=2.4.0 ; extra == 'dev'
|
|
61
60
|
Requires-Dist: pytest >=7.0.0 ; extra == 'dev'
|
|
@@ -64,10 +63,9 @@ Requires-Dist: sphinx >=6.0.0 ; extra == 'docs'
|
|
|
64
63
|
Requires-Dist: sphinx-autobuild >=2021.3.14 ; extra == 'docs'
|
|
65
64
|
Requires-Dist: sphinx-rtd-theme >=1.0.0 ; extra == 'docs'
|
|
66
65
|
Requires-Dist: towncrier <22,>=21 ; extra == 'docs'
|
|
67
|
-
Requires-Dist: eth-account >=0.13.0 ; extra == 'docs'
|
|
68
66
|
Provides-Extra: test
|
|
69
67
|
Requires-Dist: eth-tester[py-evm] <0.13.0b1,>=0.11.0b1 ; extra == 'test'
|
|
70
|
-
Requires-Dist: py-geth >=5.0.
|
|
68
|
+
Requires-Dist: py-geth >=5.0.0 ; extra == 'test'
|
|
71
69
|
Requires-Dist: pytest-asyncio <0.23,>=0.18.1 ; extra == 'test'
|
|
72
70
|
Requires-Dist: pytest-mock >=1.10 ; extra == 'test'
|
|
73
71
|
Requires-Dist: pytest-xdist >=2.4.0 ; extra == 'test'
|
|
@@ -13,7 +13,7 @@ ens/specs/nf.json,sha256=kGZcTE_UxTl3WZwMUP6m8KbQQOKdw7PWzmuW7ewQSUs,48403
|
|
|
13
13
|
ens/specs/normalization_spec.json,sha256=xn3N9a-6KHMLu3MeCBsmOxSzIzUQykzE9EscKK1a3w8,3115334
|
|
14
14
|
web3/__init__.py,sha256=P11QAEV_GYoZq9ij8gDzFx5tKzJY2aMXG-keg2Lg1xs,1277
|
|
15
15
|
web3/constants.py,sha256=eQLRQVMFPbgpOjjkPTMHkY-syncJuO-sPX5UrCSRjzQ,564
|
|
16
|
-
web3/datastructures.py,sha256=
|
|
16
|
+
web3/datastructures.py,sha256=LbUsfE0icgRRTXsC_LATR-LtmO7MAYwYB5D-6LCX1jE,11366
|
|
17
17
|
web3/exceptions.py,sha256=5Yc-tUdmcnwGv1dxg45iD3Tor3IKMfedA9U_xZ4AR3M,9081
|
|
18
18
|
web3/geth.py,sha256=IQYeqiVSqcskuXWgDR35UBuVsD-whhvTpDltO4vvCvE,5867
|
|
19
19
|
web3/logs.py,sha256=ROs-mDMH_ZOecE7hfbWA5yp27G38FbLjX4lO_WtlZxQ,198
|
|
@@ -45,7 +45,7 @@ web3/_utils/events.py,sha256=sVAXWUMmWKwYguWzk_jqra3rI6NZ55T3XfDp4_aDa-8,17044
|
|
|
45
45
|
web3/_utils/fee_utils.py,sha256=MFt27R9E3qFP-Hf87-Lzv0JAiuYRE_qqafyTmzctAYA,2145
|
|
46
46
|
web3/_utils/filters.py,sha256=1WX2Vgmat8QKj0WNm_GoRcVp4iJ0BhaIpM_RbcZlBzs,11860
|
|
47
47
|
web3/_utils/formatters.py,sha256=RfRZU0aXC99s6OoLMY7D-fcYJyVAYBEwdbw-JIDjbZE,3067
|
|
48
|
-
web3/_utils/http.py,sha256=
|
|
48
|
+
web3/_utils/http.py,sha256=2R3UOeZmwiQGc3ladf78R9AnufbGaTXAntqf-ZQlZPI,230
|
|
49
49
|
web3/_utils/http_session_manager.py,sha256=Q5K9qJVOAjpO6490McC5kdO4lgjt-c-zxkp0kyDY2pI,11520
|
|
50
50
|
web3/_utils/hypothesis.py,sha256=4Cm4iOWv-uP9irg_Pv63kYNDYUAGhnUH6fOPWRw3A0g,209
|
|
51
51
|
web3/_utils/math.py,sha256=4oU5YdbQBXElxK00CxmUZ94ApXFu9QT_TrO0Kho1HTs,1083
|
|
@@ -86,7 +86,7 @@ web3/_utils/contract_sources/contract_data/storage_contract.py,sha256=vP1Qaekjld
|
|
|
86
86
|
web3/_utils/contract_sources/contract_data/string_contract.py,sha256=y6EFnum4zDrrRUmuXExCGr2bhZMrerbMiqJiamUU2Tw,11210
|
|
87
87
|
web3/_utils/contract_sources/contract_data/tuple_contracts.py,sha256=QuqPfv3BxjqDjeLScnxJDEPtPZMAB4jwHxsAOeVd6kk,23176
|
|
88
88
|
web3/_utils/module_testing/__init__.py,sha256=tPFAaX7xOR50CPTq24UeY-1CX1LQxxmEOPr0-tIRkoE,376
|
|
89
|
-
web3/_utils/module_testing/eth_module.py,sha256=
|
|
89
|
+
web3/_utils/module_testing/eth_module.py,sha256=0Ke5-Ayh2MJuzT8-zL3jlUy4WbHvE7nYi2fBM__FcmM,187661
|
|
90
90
|
web3/_utils/module_testing/go_ethereum_admin_module.py,sha256=_c-6SyzZkfAJ-7ySXUpw9FEr4cg-ShRdAGSAHWanCtY,3406
|
|
91
91
|
web3/_utils/module_testing/go_ethereum_txpool_module.py,sha256=5f8XL8-2x3keyGRaITxMQYl9oQzjgqGn8zobB-j9BPs,1176
|
|
92
92
|
web3/_utils/module_testing/module_testing_utils.py,sha256=koDvLoR5q8wFOz_8o9oRpEpjbuvU8cUbBe1PM39LjG0,7304
|
|
@@ -97,13 +97,13 @@ web3/_utils/module_testing/web3_module.py,sha256=7c6penGbHn381fPTYY6DsXKv56xGQpY
|
|
|
97
97
|
web3/auto/__init__.py,sha256=ZbzAiCZMdt_tCTTPvH6t8NCVNroKKkt7TSVBBNR74Is,44
|
|
98
98
|
web3/auto/gethdev.py,sha256=MuWD2gxv0xDv_SzPsp9mSkS1oG4P54xFK83qw9NvswA,438
|
|
99
99
|
web3/beacon/__init__.py,sha256=Ac6YiNgU8D8Ynnh5RwSCx2NwPyjnpFjpXeHuSssFbaU,113
|
|
100
|
-
web3/beacon/api_endpoints.py,sha256=
|
|
101
|
-
web3/beacon/async_beacon.py,sha256=
|
|
102
|
-
web3/beacon/beacon.py,sha256=
|
|
100
|
+
web3/beacon/api_endpoints.py,sha256=0mHrYFYAWHfF9OGzrFdg012L_ocU2nGDXUTU1isOo7o,2272
|
|
101
|
+
web3/beacon/async_beacon.py,sha256=9-V-rfPwj-SbksHKSYs2Quk8frE2AJXjH908cbSM8v0,8098
|
|
102
|
+
web3/beacon/beacon.py,sha256=tPA9ABPm6MyzbzutiphkhFzOAxLresmftG5UjWkuNyY,7236
|
|
103
103
|
web3/contract/__init__.py,sha256=qeZRtTw9xriwoD82w6vePDuPBZ35-CMVdkzViBSH3Qs,293
|
|
104
|
-
web3/contract/async_contract.py,sha256=
|
|
104
|
+
web3/contract/async_contract.py,sha256=KYB-e1GCTZINTRu0Y1f2IIp4LWg2UvKIRFFSIrsjfUs,20593
|
|
105
105
|
web3/contract/base_contract.py,sha256=qfYzMC-PlefkAQVGplXwdYi5I37DwEe5Slbp5-oOc6U,38053
|
|
106
|
-
web3/contract/contract.py,sha256=
|
|
106
|
+
web3/contract/contract.py,sha256=wB5g6H7PoAyp4wN__3GGXMrDCvEYuj6crZL4Q2ipTRE,20174
|
|
107
107
|
web3/contract/utils.py,sha256=bonHXESnb9xhvMzJoi271qppwpy2D6yaHtUwt56wEJc,17853
|
|
108
108
|
web3/eth/__init__.py,sha256=qDLxOcHHIzzPD7xzwy6Wcs0lLPQieB7WN0Ax25ctit8,197
|
|
109
109
|
web3/eth/async_eth.py,sha256=elPH3Atkayk3afwepDRP3ibB7EK8MziK0fPikpKCLxI,23176
|
|
@@ -114,7 +114,7 @@ web3/gas_strategies/rpc.py,sha256=3Va-32jdmHkX7tzQCmh17ms2D6te5zZcqHP1326BdpY,35
|
|
|
114
114
|
web3/gas_strategies/time_based.py,sha256=oGk6nBUD4iMC8wl1vzf-nhURaqyPWYdPvNU0C3RIs8g,9071
|
|
115
115
|
web3/middleware/__init__.py,sha256=fSmPCYJOO8Qp5p-Vm_Z4XPJATu2qN7KJRypYNSO6_uM,2830
|
|
116
116
|
web3/middleware/attrdict.py,sha256=NY5yxlFOfLBBmcIjl8R-uP2dTz9ITIyTttG8-QcJWCI,2259
|
|
117
|
-
web3/middleware/base.py,sha256=
|
|
117
|
+
web3/middleware/base.py,sha256=aHBUWc5pSohLUZ7zcCgrVqp_H_1PTqh31x2n6vWqzuY,5376
|
|
118
118
|
web3/middleware/buffered_gas_estimate.py,sha256=EmxUd-uO959UVroPsPKkl7oDa8Tw6N8BQLB6Urng5Eo,1647
|
|
119
119
|
web3/middleware/filter.py,sha256=I09sSE_q_dhWX5_24KVWhVXZNevwViI7wucJBP4TZl4,22221
|
|
120
120
|
web3/middleware/formatting.py,sha256=hqe5XQE1n5Fmj6riJp7i3oIoZkd-4ChQc7UK8f3HB6I,7567
|
|
@@ -122,7 +122,7 @@ web3/middleware/gas_price_strategy.py,sha256=ZjZ6pe3z0mDGLZHYoFXp4_fZIePqukljEh9
|
|
|
122
122
|
web3/middleware/names.py,sha256=OBpsvCmcTItth4TcvUNUvcYmINnudtCHq3n6YO_BkNs,4309
|
|
123
123
|
web3/middleware/proof_of_authority.py,sha256=0AT4jr5CmTdrvl8Jiy-WYy8IFDYBOEaesgHDwpn0c7M,1429
|
|
124
124
|
web3/middleware/pythonic.py,sha256=awc8I6lLzVc2Iv138sps2uf6dMQipskLRBTdvTEEIgQ,348
|
|
125
|
-
web3/middleware/signing.py,sha256=
|
|
125
|
+
web3/middleware/signing.py,sha256=1DOYxpmCra-Qq5r42237q3b54uDO-QHjMVMulxVpLVQ,5899
|
|
126
126
|
web3/middleware/stalecheck.py,sha256=oWRA69BGIbNGjHSnUVOBnoxOYJZYjzRzlqqL5RRlnzk,2680
|
|
127
127
|
web3/middleware/validation.py,sha256=QxActrJk_zsXXiwpadP2MUjZBS5E50OJOtUwVrm9XVo,4280
|
|
128
128
|
web3/providers/__init__.py,sha256=YkcSzE9AubvSp-UfvJjyCrdepvziysbqeq2LT0ImDoc,936
|
|
@@ -143,10 +143,12 @@ web3/providers/persistent/request_processor.py,sha256=E1jJwsvrPBTbufCy2LeNvMdRXf
|
|
|
143
143
|
web3/providers/persistent/utils.py,sha256=gfY7w1HB8xuE7OujSrbwWYjQuQ8nzRBoxoL8ESinqWM,1140
|
|
144
144
|
web3/providers/persistent/websocket.py,sha256=2EuBOdkEBTp6ge53UlJbjV0eAUJ143TkmqrOLTQl9kk,4231
|
|
145
145
|
web3/providers/rpc/__init__.py,sha256=mObsuwjr7xyHnnRlwzsmbp2JgZdn2NXSSctvpye4AuQ,149
|
|
146
|
-
web3/providers/rpc/async_rpc.py,sha256=
|
|
147
|
-
web3/providers/rpc/rpc.py,sha256=
|
|
146
|
+
web3/providers/rpc/async_rpc.py,sha256=fRZh36q735OI7HFt_QsueFC4zgSSkm3MsYMh9C4b3ds,5824
|
|
147
|
+
web3/providers/rpc/rpc.py,sha256=9_ju2UZX3Ew2HhmyRWnXGhRW9NTvW0roFQ9BI2JzuI0,5866
|
|
148
148
|
web3/providers/rpc/utils.py,sha256=_mtoZMMIoZpPA8J8U5DfRxaNQmi8bw0ZVUiqn1Nz4co,2154
|
|
149
149
|
web3/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
150
|
+
web3/scripts/install_pre_releases.py,sha256=uVxsZk239640yxiqlPhfXxZKSsh3858pURKppi9kM5U,821
|
|
151
|
+
web3/scripts/parse_pygeth_version.py,sha256=BZjWOsJmYuFbAnFuB1jec9Rl6z0tJJNFFV38sJvDfGo,416
|
|
150
152
|
web3/scripts/release/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
151
153
|
web3/scripts/release/test_package.py,sha256=DH0AryllcF4zfpWSd0NLPSQGHNoC-Qng5WYYbS5_4c8,1534
|
|
152
154
|
web3/utils/__init__.py,sha256=XwpyVR4EBkfqV5SHBH3maNyNBy624EwqujRgetLc7PU,1781
|
|
@@ -155,8 +157,8 @@ web3/utils/address.py,sha256=KC_IpEbixSCuMhaW6V2QCyyJTYKYGS9c8QtI9_aH7zQ,967
|
|
|
155
157
|
web3/utils/async_exception_handling.py,sha256=GZWSBFC0-Wmwz1tpTie-1AKRbIQH7JkmBpf5bXrUTzY,3320
|
|
156
158
|
web3/utils/caching.py,sha256=IG_IxW-jyiRklrIyUgjOj3GQvcXrok0KLDX3ch_6wuA,2390
|
|
157
159
|
web3/utils/exception_handling.py,sha256=k31JROfUyKIm9PoEWOtYSkIq9wL8SOBwQfnSLNQyfnM,3097
|
|
158
|
-
web3-7.0.
|
|
159
|
-
web3-7.0.
|
|
160
|
-
web3-7.0.
|
|
161
|
-
web3-7.0.
|
|
162
|
-
web3-7.0.
|
|
160
|
+
web3-7.2.0.dist-info/LICENSE,sha256=ScEyLx1vWrB0ybKiZKKTXm5QhVksHCEUtTp4lwYV45I,1095
|
|
161
|
+
web3-7.2.0.dist-info/METADATA,sha256=gKCHrOjfTAYhnhPMuMatLqkhL2cBlKrpnHuuPsWOaUo,4986
|
|
162
|
+
web3-7.2.0.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
|
163
|
+
web3-7.2.0.dist-info/top_level.txt,sha256=iwupuJh7wgypXrpk_awszyri3TahRr5vxSphNyvt1bU,9
|
|
164
|
+
web3-7.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|