web3 7.10.0__py3-none-any.whl → 7.11.1__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.
- ens/exceptions.py +1 -1
- web3/_utils/batching.py +42 -1
- web3/_utils/contract_sources/contract_data/ambiguous_function_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/arrays_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/bytes_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/constructor_contracts.py +7 -7
- web3/_utils/contract_sources/contract_data/contract_caller_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/emitter_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/event_contracts.py +7 -7
- web3/_utils/contract_sources/contract_data/extended_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/fallback_function_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/math_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_lookup.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/panic_errors_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/payable_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/receive_function_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/reflector_contracts.py +3 -3
- web3/_utils/contract_sources/contract_data/revert_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/simple_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/storage_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/string_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/tuple_contracts.py +5 -5
- web3/_utils/decorators.py +2 -2
- web3/_utils/encoding.py +8 -0
- web3/_utils/ens.py +9 -1
- web3/_utils/error_formatters_utils.py +17 -0
- web3/_utils/filters.py +39 -28
- web3/_utils/method_formatters.py +58 -7
- web3/_utils/module_testing/eth_module.py +218 -80
- web3/_utils/module_testing/module_testing_utils.py +0 -12
- web3/_utils/module_testing/persistent_connection_provider.py +3 -3
- web3/_utils/normalizers.py +1 -1
- web3/_utils/rpc_abi.py +5 -4
- web3/_utils/utility_methods.py +8 -6
- web3/eth/async_eth.py +4 -0
- web3/eth/eth.py +15 -2
- web3/method.py +10 -2
- web3/providers/async_base.py +5 -6
- web3/providers/base.py +5 -5
- web3/providers/eth_tester/middleware.py +20 -0
- web3/providers/ipc.py +2 -0
- web3/providers/legacy_websocket.py +2 -0
- web3/providers/persistent/async_ipc.py +3 -1
- web3/providers/persistent/persistent.py +15 -10
- web3/providers/persistent/request_processor.py +10 -1
- web3/providers/persistent/subscription_manager.py +1 -0
- web3/providers/rpc/async_rpc.py +2 -0
- web3/providers/rpc/rpc.py +2 -0
- web3/types.py +27 -0
- web3/utils/abi.py +1 -1
- web3/utils/caching.py +8 -5
- {web3-7.10.0.dist-info → web3-7.11.1.dist-info}/METADATA +56 -69
- {web3-7.10.0.dist-info → web3-7.11.1.dist-info}/RECORD +58 -58
- {web3-7.10.0.dist-info → web3-7.11.1.dist-info}/WHEEL +1 -1
- {web3-7.10.0.dist-info/licenses → web3-7.11.1.dist-info}/LICENSE +0 -0
- {web3-7.10.0.dist-info → web3-7.11.1.dist-info}/top_level.txt +0 -0
web3/eth/async_eth.py
CHANGED
|
@@ -39,6 +39,9 @@ from web3._utils.blocks import (
|
|
|
39
39
|
from web3._utils.compat import (
|
|
40
40
|
Unpack,
|
|
41
41
|
)
|
|
42
|
+
from web3._utils.decorators import (
|
|
43
|
+
deprecated_for,
|
|
44
|
+
)
|
|
42
45
|
from web3._utils.fee_utils import (
|
|
43
46
|
async_fee_history_priority_fee,
|
|
44
47
|
)
|
|
@@ -669,6 +672,7 @@ class AsyncEth(BaseEth):
|
|
|
669
672
|
mungers=[default_root_munger],
|
|
670
673
|
)
|
|
671
674
|
|
|
675
|
+
@deprecated_for("all get_uncle* methods will be removed in v8")
|
|
672
676
|
async def get_uncle_count(self, block_identifier: BlockIdentifier) -> int:
|
|
673
677
|
return await self._get_uncle_count(block_identifier)
|
|
674
678
|
|
web3/eth/eth.py
CHANGED
|
@@ -69,6 +69,7 @@ from web3.exceptions import (
|
|
|
69
69
|
Web3ValueError,
|
|
70
70
|
)
|
|
71
71
|
from web3.method import (
|
|
72
|
+
DeprecatedMethod,
|
|
72
73
|
Method,
|
|
73
74
|
default_root_munger,
|
|
74
75
|
)
|
|
@@ -566,7 +567,7 @@ class Eth(BaseEth):
|
|
|
566
567
|
# eth_getUncleCountByBlockHash
|
|
567
568
|
# eth_getUncleCountByBlockNumber
|
|
568
569
|
|
|
569
|
-
|
|
570
|
+
_get_uncle_count: Method[Callable[[BlockIdentifier], int]] = Method(
|
|
570
571
|
method_choice_depends_on_args=select_method_for_block_identifier(
|
|
571
572
|
if_predefined=RPC.eth_getUncleCountByBlockNumber,
|
|
572
573
|
if_hash=RPC.eth_getUncleCountByBlockHash,
|
|
@@ -574,11 +575,17 @@ class Eth(BaseEth):
|
|
|
574
575
|
),
|
|
575
576
|
mungers=[default_root_munger],
|
|
576
577
|
)
|
|
578
|
+
get_uncle_count = DeprecatedMethod(
|
|
579
|
+
_get_uncle_count,
|
|
580
|
+
old_name="_get_uncle_count",
|
|
581
|
+
new_name="get_uncle_count",
|
|
582
|
+
msg="All get_uncle* methods have been deprecated",
|
|
583
|
+
)
|
|
577
584
|
|
|
578
585
|
# eth_getUncleByBlockHashAndIndex
|
|
579
586
|
# eth_getUncleByBlockNumberAndIndex
|
|
580
587
|
|
|
581
|
-
|
|
588
|
+
_get_uncle_by_block: Method[Callable[[BlockIdentifier, int], Uncle]] = Method(
|
|
582
589
|
method_choice_depends_on_args=select_method_for_block_identifier(
|
|
583
590
|
if_predefined=RPC.eth_getUncleByBlockNumberAndIndex,
|
|
584
591
|
if_hash=RPC.eth_getUncleByBlockHashAndIndex,
|
|
@@ -586,6 +593,12 @@ class Eth(BaseEth):
|
|
|
586
593
|
),
|
|
587
594
|
mungers=[default_root_munger],
|
|
588
595
|
)
|
|
596
|
+
get_uncle_by_block = DeprecatedMethod(
|
|
597
|
+
_get_uncle_by_block,
|
|
598
|
+
old_name="_get_uncle_by_block",
|
|
599
|
+
new_name="get_uncle_by_block",
|
|
600
|
+
msg="All get_uncle* methods have been deprecated",
|
|
601
|
+
)
|
|
589
602
|
|
|
590
603
|
def replace_transaction(
|
|
591
604
|
self, transaction_hash: _Hash32, new_transaction: TxParams
|
web3/method.py
CHANGED
|
@@ -241,17 +241,25 @@ class Method(Generic[TFunc]):
|
|
|
241
241
|
|
|
242
242
|
class DeprecatedMethod:
|
|
243
243
|
def __init__(
|
|
244
|
-
self,
|
|
244
|
+
self,
|
|
245
|
+
method: Method[Callable[..., Any]],
|
|
246
|
+
old_name: Optional[str] = None,
|
|
247
|
+
new_name: Optional[str] = None,
|
|
248
|
+
msg: Optional[str] = None,
|
|
245
249
|
) -> None:
|
|
246
250
|
self.method = method
|
|
247
251
|
self.old_name = old_name
|
|
248
252
|
self.new_name = new_name
|
|
253
|
+
self.msg = msg
|
|
249
254
|
|
|
250
255
|
def __get__(
|
|
251
256
|
self, obj: Optional["Module"] = None, obj_type: Optional[Type["Module"]] = None
|
|
252
257
|
) -> Any:
|
|
258
|
+
message = f"{self.old_name} is deprecated in favor of {self.new_name}"
|
|
259
|
+
if self.msg is not None:
|
|
260
|
+
message = self.msg
|
|
253
261
|
warnings.warn(
|
|
254
|
-
|
|
262
|
+
message,
|
|
255
263
|
category=DeprecationWarning,
|
|
256
264
|
stacklevel=2,
|
|
257
265
|
)
|
web3/providers/async_base.py
CHANGED
|
@@ -75,12 +75,6 @@ class AsyncBaseProvider:
|
|
|
75
75
|
Tuple[Middleware, ...], Callable[..., Coroutine[Any, Any, RPCResponse]]
|
|
76
76
|
] = (None, None)
|
|
77
77
|
|
|
78
|
-
_is_batching: bool = False
|
|
79
|
-
_batch_request_func_cache: Tuple[
|
|
80
|
-
Tuple[Middleware, ...],
|
|
81
|
-
Callable[..., Coroutine[Any, Any, Union[List[RPCResponse], RPCResponse]]],
|
|
82
|
-
] = (None, None)
|
|
83
|
-
|
|
84
78
|
is_async = True
|
|
85
79
|
has_persistent_connection = False
|
|
86
80
|
global_ccip_read_enabled: bool = True
|
|
@@ -100,6 +94,11 @@ class AsyncBaseProvider:
|
|
|
100
94
|
self.cache_allowed_requests = cache_allowed_requests
|
|
101
95
|
self.cacheable_requests = cacheable_requests or CACHEABLE_REQUESTS
|
|
102
96
|
self.request_cache_validation_threshold = request_cache_validation_threshold
|
|
97
|
+
self._is_batching: bool = False
|
|
98
|
+
self._batch_request_func_cache: Tuple[
|
|
99
|
+
Tuple[Middleware, ...],
|
|
100
|
+
Callable[..., Coroutine[Any, Any, Union[List[RPCResponse], RPCResponse]]],
|
|
101
|
+
] = (None, None)
|
|
103
102
|
|
|
104
103
|
async def request_func(
|
|
105
104
|
self, async_w3: "AsyncWeb3", middleware_onion: MiddlewareOnion
|
web3/providers/base.py
CHANGED
|
@@ -116,15 +116,15 @@ class BaseProvider:
|
|
|
116
116
|
class JSONBaseProvider(BaseProvider):
|
|
117
117
|
logger = logging.getLogger("web3.providers.base.JSONBaseProvider")
|
|
118
118
|
|
|
119
|
-
_is_batching: bool = False
|
|
120
|
-
_batch_request_func_cache: Tuple[
|
|
121
|
-
Tuple[Middleware, ...], Callable[..., Union[List[RPCResponse], RPCResponse]]
|
|
122
|
-
] = (None, None)
|
|
123
|
-
|
|
124
119
|
def __init__(self, **kwargs: Any) -> None:
|
|
125
120
|
super().__init__(**kwargs)
|
|
126
121
|
self.request_counter = itertools.count()
|
|
127
122
|
|
|
123
|
+
self._is_batching: bool = False
|
|
124
|
+
self._batch_request_func_cache: Tuple[
|
|
125
|
+
Tuple[Middleware, ...], Callable[..., Union[List[RPCResponse], RPCResponse]]
|
|
126
|
+
] = (None, None)
|
|
127
|
+
|
|
128
128
|
def encode_rpc_request(self, method: RPCEndpoint, params: Any) -> bytes:
|
|
129
129
|
rpc_dict = {
|
|
130
130
|
"jsonrpc": "2.0",
|
|
@@ -78,6 +78,7 @@ TRANSACTION_REQUEST_KEY_MAPPING = {
|
|
|
78
78
|
"maxFeePerGas": "max_fee_per_gas",
|
|
79
79
|
"maxPriorityFeePerGas": "max_priority_fee_per_gas",
|
|
80
80
|
"accessList": "access_list",
|
|
81
|
+
"authorizationList": "authorization_list",
|
|
81
82
|
"chainId": "chain_id",
|
|
82
83
|
}
|
|
83
84
|
transaction_request_remapper = apply_key_map(TRANSACTION_REQUEST_KEY_MAPPING)
|
|
@@ -94,6 +95,20 @@ TRANSACTION_REQUEST_FORMATTERS = {
|
|
|
94
95
|
"accessList": apply_list_to_array_formatter(
|
|
95
96
|
apply_key_map({"storageKeys": "storage_keys"})
|
|
96
97
|
),
|
|
98
|
+
"authorizationList": apply_list_to_array_formatter(
|
|
99
|
+
compose(
|
|
100
|
+
apply_formatters_to_dict(
|
|
101
|
+
{
|
|
102
|
+
"chain_id": to_integer_if_hex,
|
|
103
|
+
"nonce": to_integer_if_hex,
|
|
104
|
+
"y_parity": to_integer_if_hex,
|
|
105
|
+
"r": to_integer_if_hex,
|
|
106
|
+
"s": to_integer_if_hex,
|
|
107
|
+
},
|
|
108
|
+
),
|
|
109
|
+
apply_key_map({"chainId": "chain_id", "yParity": "y_parity"}),
|
|
110
|
+
)
|
|
111
|
+
),
|
|
97
112
|
}
|
|
98
113
|
transaction_request_formatter = apply_formatters_to_dict(TRANSACTION_REQUEST_FORMATTERS)
|
|
99
114
|
|
|
@@ -125,6 +140,7 @@ filter_request_transformer = compose(
|
|
|
125
140
|
|
|
126
141
|
TRANSACTION_RESULT_KEY_MAPPING = {
|
|
127
142
|
"access_list": "accessList",
|
|
143
|
+
"authorization_list": "authorizationList",
|
|
128
144
|
"blob_versioned_hashes": "blobVersionedHashes",
|
|
129
145
|
"block_hash": "blockHash",
|
|
130
146
|
"block_number": "blockNumber",
|
|
@@ -145,6 +161,9 @@ TRANSACTION_RESULT_FORMATTERS = {
|
|
|
145
161
|
"access_list": apply_list_to_array_formatter(
|
|
146
162
|
apply_key_map({"storage_keys": "storageKeys"}),
|
|
147
163
|
),
|
|
164
|
+
"authorization_list": apply_list_to_array_formatter(
|
|
165
|
+
apply_key_map({"chain_id": "chainId", "y_parity": "yParity"}),
|
|
166
|
+
),
|
|
148
167
|
}
|
|
149
168
|
transaction_result_formatter = apply_formatters_to_dict(TRANSACTION_RESULT_FORMATTERS)
|
|
150
169
|
|
|
@@ -195,6 +214,7 @@ BLOCK_RESULT_KEY_MAPPING = {
|
|
|
195
214
|
"parent_beacon_block_root": "parentBeaconBlockRoot",
|
|
196
215
|
"blob_gas_used": "blobGasUsed",
|
|
197
216
|
"excess_blob_gas": "excessBlobGas",
|
|
217
|
+
"requests_hash": "requestsHash",
|
|
198
218
|
}
|
|
199
219
|
block_result_remapper = apply_key_map(BLOCK_RESULT_KEY_MAPPING)
|
|
200
220
|
|
web3/providers/ipc.py
CHANGED
|
@@ -30,6 +30,7 @@ from web3.types import (
|
|
|
30
30
|
)
|
|
31
31
|
|
|
32
32
|
from .._utils.batching import (
|
|
33
|
+
batching_context,
|
|
33
34
|
sort_batch_response_by_response_ids,
|
|
34
35
|
)
|
|
35
36
|
from .._utils.caching import (
|
|
@@ -201,6 +202,7 @@ class IPCProvider(JSONBaseProvider):
|
|
|
201
202
|
request = self.encode_rpc_request(method, params)
|
|
202
203
|
return self._make_request(request)
|
|
203
204
|
|
|
205
|
+
@batching_context
|
|
204
206
|
def make_batch_request(
|
|
205
207
|
self, requests: List[Tuple[RPCEndpoint, Any]]
|
|
206
208
|
) -> List[RPCResponse]:
|
|
@@ -27,6 +27,7 @@ from websockets.legacy.client import (
|
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
from web3._utils.batching import (
|
|
30
|
+
batching_context,
|
|
30
31
|
sort_batch_response_by_response_ids,
|
|
31
32
|
)
|
|
32
33
|
from web3._utils.caching import (
|
|
@@ -143,6 +144,7 @@ class LegacyWebSocketProvider(JSONBaseProvider):
|
|
|
143
144
|
)
|
|
144
145
|
return future.result()
|
|
145
146
|
|
|
147
|
+
@batching_context
|
|
146
148
|
def make_batch_request(
|
|
147
149
|
self, requests: List[Tuple[RPCEndpoint, Any]]
|
|
148
150
|
) -> List[RPCResponse]:
|
|
@@ -110,7 +110,9 @@ class AsyncIPCProvider(PersistentConnectionProvider):
|
|
|
110
110
|
raise
|
|
111
111
|
|
|
112
112
|
if not data:
|
|
113
|
-
raise PersistentConnectionClosedOK(
|
|
113
|
+
raise PersistentConnectionClosedOK(
|
|
114
|
+
user_message="Socket reader received end of stream."
|
|
115
|
+
)
|
|
114
116
|
return self.decode_rpc_response(data)
|
|
115
117
|
|
|
116
118
|
# -- private methods -- #
|
|
@@ -24,6 +24,7 @@ from websockets import (
|
|
|
24
24
|
|
|
25
25
|
from web3._utils.batching import (
|
|
26
26
|
BATCH_REQUEST_ID,
|
|
27
|
+
async_batching_context,
|
|
27
28
|
sort_batch_response_by_response_ids,
|
|
28
29
|
)
|
|
29
30
|
from web3._utils.caching import (
|
|
@@ -87,12 +88,14 @@ class PersistentConnectionProvider(AsyncJSONBaseProvider, ABC):
|
|
|
87
88
|
subscription_response_queue_size: int = 500,
|
|
88
89
|
silence_listener_task_exceptions: bool = False,
|
|
89
90
|
max_connection_retries: int = 5,
|
|
91
|
+
request_information_cache_size: int = 500,
|
|
90
92
|
**kwargs: Any,
|
|
91
93
|
) -> None:
|
|
92
94
|
super().__init__(**kwargs)
|
|
93
95
|
self._request_processor = RequestProcessor(
|
|
94
96
|
self,
|
|
95
97
|
subscription_response_queue_size=subscription_response_queue_size,
|
|
98
|
+
request_information_cache_size=request_information_cache_size,
|
|
96
99
|
)
|
|
97
100
|
self._message_listener_task: Optional["asyncio.Task[None]"] = None
|
|
98
101
|
self._batch_request_counter: Optional[int] = None
|
|
@@ -235,14 +238,17 @@ class PersistentConnectionProvider(AsyncJSONBaseProvider, ABC):
|
|
|
235
238
|
rpc_request = await self.send_request(method, params)
|
|
236
239
|
return await self.recv_for_request(rpc_request)
|
|
237
240
|
|
|
241
|
+
@async_batching_context
|
|
238
242
|
async def make_batch_request(
|
|
239
243
|
self, requests: List[Tuple[RPCEndpoint, Any]]
|
|
240
244
|
) -> List[RPCResponse]:
|
|
241
245
|
request_data = self.encode_batch_rpc_request(requests)
|
|
242
246
|
await self.socket_send(request_data)
|
|
243
247
|
|
|
248
|
+
# breakpoint()
|
|
244
249
|
response = cast(
|
|
245
|
-
List[RPCResponse],
|
|
250
|
+
List[RPCResponse],
|
|
251
|
+
await self._get_response_for_request_id(BATCH_REQUEST_ID),
|
|
246
252
|
)
|
|
247
253
|
return response
|
|
248
254
|
|
|
@@ -318,17 +324,16 @@ class PersistentConnectionProvider(AsyncJSONBaseProvider, ABC):
|
|
|
318
324
|
for (
|
|
319
325
|
response
|
|
320
326
|
) in self._request_processor._request_response_cache._data.values():
|
|
321
|
-
|
|
322
|
-
self._request_processor._request_information_cache.get_cache_entry(
|
|
327
|
+
if isinstance(response, dict):
|
|
328
|
+
request = self._request_processor._request_information_cache.get_cache_entry( # noqa: E501
|
|
323
329
|
generate_cache_key(response["id"])
|
|
324
330
|
)
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
)
|
|
331
|
+
if "error" in response and request is None:
|
|
332
|
+
# if we find an error response in the cache without a
|
|
333
|
+
# corresponding request, raise the error
|
|
334
|
+
validate_rpc_response_and_raise_if_error(
|
|
335
|
+
cast(RPCResponse, response), None, logger=self.logger
|
|
336
|
+
)
|
|
332
337
|
|
|
333
338
|
async def _message_listener(self) -> None:
|
|
334
339
|
self.logger.info(
|
|
@@ -85,9 +85,12 @@ class RequestProcessor:
|
|
|
85
85
|
self,
|
|
86
86
|
provider: "PersistentConnectionProvider",
|
|
87
87
|
subscription_response_queue_size: int = 500,
|
|
88
|
+
request_information_cache_size: int = 500,
|
|
88
89
|
) -> None:
|
|
89
90
|
self._provider = provider
|
|
90
|
-
self._request_information_cache: SimpleCache = SimpleCache(
|
|
91
|
+
self._request_information_cache: SimpleCache = SimpleCache(
|
|
92
|
+
request_information_cache_size
|
|
93
|
+
)
|
|
91
94
|
self._request_response_cache: SimpleCache = SimpleCache(500)
|
|
92
95
|
self._subscription_response_queue: TaskReliantQueue[
|
|
93
96
|
Union[RPCResponse, TaskNotRunning]
|
|
@@ -152,6 +155,12 @@ class RequestProcessor:
|
|
|
152
155
|
cache_key,
|
|
153
156
|
request_info,
|
|
154
157
|
)
|
|
158
|
+
if self._request_information_cache.is_full():
|
|
159
|
+
self._provider.logger.warning(
|
|
160
|
+
"Request information cache is full. This may result in unexpected "
|
|
161
|
+
"behavior. Consider increasing the ``request_information_cache_size`` "
|
|
162
|
+
"on the provider."
|
|
163
|
+
)
|
|
155
164
|
return cache_key
|
|
156
165
|
|
|
157
166
|
def pop_cached_request_information(
|
|
@@ -298,6 +298,7 @@ class SubscriptionManager:
|
|
|
298
298
|
"Message listener background task for the provider has stopped "
|
|
299
299
|
"unexpectedly. Stopping subscription handling."
|
|
300
300
|
)
|
|
301
|
+
break
|
|
301
302
|
|
|
302
303
|
# no active handler subscriptions, clear the handler subscription queue
|
|
303
304
|
self._provider._request_processor._reset_handler_subscription_queue()
|
web3/providers/rpc/async_rpc.py
CHANGED
|
@@ -36,6 +36,7 @@ from web3.types import (
|
|
|
36
36
|
)
|
|
37
37
|
|
|
38
38
|
from ..._utils.batching import (
|
|
39
|
+
async_batching_context,
|
|
39
40
|
sort_batch_response_by_response_ids,
|
|
40
41
|
)
|
|
41
42
|
from ..._utils.caching import (
|
|
@@ -166,6 +167,7 @@ class AsyncHTTPProvider(AsyncJSONBaseProvider):
|
|
|
166
167
|
)
|
|
167
168
|
return response
|
|
168
169
|
|
|
170
|
+
@async_batching_context
|
|
169
171
|
async def make_batch_request(
|
|
170
172
|
self, batch_requests: List[Tuple[RPCEndpoint, Any]]
|
|
171
173
|
) -> Union[List[RPCResponse], RPCResponse]:
|
web3/providers/rpc/rpc.py
CHANGED
|
@@ -34,6 +34,7 @@ from web3.types import (
|
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
from ..._utils.batching import (
|
|
37
|
+
batching_context,
|
|
37
38
|
sort_batch_response_by_response_ids,
|
|
38
39
|
)
|
|
39
40
|
from ..._utils.caching import (
|
|
@@ -174,6 +175,7 @@ class HTTPProvider(JSONBaseProvider):
|
|
|
174
175
|
)
|
|
175
176
|
return response
|
|
176
177
|
|
|
178
|
+
@batching_context
|
|
177
179
|
def make_batch_request(
|
|
178
180
|
self, batch_requests: List[Tuple[RPCEndpoint, Any]]
|
|
179
181
|
) -> Union[List[RPCResponse], RPCResponse]:
|
web3/types.py
CHANGED
|
@@ -16,6 +16,9 @@ from typing import (
|
|
|
16
16
|
Union,
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
+
from eth_account.datastructures import (
|
|
20
|
+
SignedSetCodeAuthorization,
|
|
21
|
+
)
|
|
19
22
|
from eth_typing import (
|
|
20
23
|
Address,
|
|
21
24
|
BlockNumber,
|
|
@@ -94,11 +97,21 @@ class RPCError(TypedDict):
|
|
|
94
97
|
data: NotRequired[str]
|
|
95
98
|
|
|
96
99
|
|
|
100
|
+
class SetCodeAuthorizationData(TypedDict):
|
|
101
|
+
chainId: int
|
|
102
|
+
address: ChecksumAddress
|
|
103
|
+
nonce: Nonce
|
|
104
|
+
yParity: int
|
|
105
|
+
r: HexBytes
|
|
106
|
+
s: HexBytes
|
|
107
|
+
|
|
108
|
+
|
|
97
109
|
# syntax b/c "from" keyword not allowed w/ class construction
|
|
98
110
|
TxData = TypedDict(
|
|
99
111
|
"TxData",
|
|
100
112
|
{
|
|
101
113
|
"accessList": AccessList,
|
|
114
|
+
"authorizationList": Sequence[SetCodeAuthorizationData],
|
|
102
115
|
"blobVersionedHashes": Sequence[HexBytes],
|
|
103
116
|
"blockHash": HexBytes,
|
|
104
117
|
"blockNumber": BlockNumber,
|
|
@@ -125,11 +138,24 @@ TxData = TypedDict(
|
|
|
125
138
|
total=False,
|
|
126
139
|
)
|
|
127
140
|
|
|
141
|
+
|
|
142
|
+
class SetCodeAuthorizationParams(TypedDict):
|
|
143
|
+
chainId: int
|
|
144
|
+
address: Union[Address, ChecksumAddress, str]
|
|
145
|
+
nonce: Nonce
|
|
146
|
+
y_parity: int
|
|
147
|
+
r: int
|
|
148
|
+
s: int
|
|
149
|
+
|
|
150
|
+
|
|
128
151
|
# syntax b/c "from" keyword not allowed w/ class construction
|
|
129
152
|
TxParams = TypedDict(
|
|
130
153
|
"TxParams",
|
|
131
154
|
{
|
|
132
155
|
"accessList": AccessList,
|
|
156
|
+
"authorizationList": Sequence[
|
|
157
|
+
Union[SetCodeAuthorizationParams, SignedSetCodeAuthorization]
|
|
158
|
+
],
|
|
133
159
|
"blobVersionedHashes": Sequence[Union[str, HexStr, bytes, HexBytes]],
|
|
134
160
|
"chainId": int,
|
|
135
161
|
"data": Union[bytes, HexStr],
|
|
@@ -186,6 +212,7 @@ class BlockData(TypedDict, total=False):
|
|
|
186
212
|
parentBeaconBlockRoot: HexBytes
|
|
187
213
|
blobGasUsed: int
|
|
188
214
|
excessBlobGas: int
|
|
215
|
+
requestsHash: HexBytes
|
|
189
216
|
|
|
190
217
|
# ExtraDataToPOAMiddleware replaces extraData w/ proofOfAuthorityData
|
|
191
218
|
proofOfAuthorityData: HexBytes
|
web3/utils/abi.py
CHANGED
web3/utils/caching.py
CHANGED
|
@@ -25,6 +25,12 @@ class SimpleCache:
|
|
|
25
25
|
self._size = size
|
|
26
26
|
self._data: OrderedDict[str, Any] = OrderedDict()
|
|
27
27
|
|
|
28
|
+
def __contains__(self, key: str) -> bool:
|
|
29
|
+
return key in self._data
|
|
30
|
+
|
|
31
|
+
def __len__(self) -> int:
|
|
32
|
+
return len(self._data)
|
|
33
|
+
|
|
28
34
|
def cache(self, key: str, value: Any) -> Tuple[Any, Dict[str, Any]]:
|
|
29
35
|
evicted_items = {}
|
|
30
36
|
# If the key is already in the OrderedDict just update it
|
|
@@ -59,11 +65,8 @@ class SimpleCache:
|
|
|
59
65
|
def popitem(self, last: bool = True) -> Tuple[str, Any]:
|
|
60
66
|
return self._data.popitem(last=last)
|
|
61
67
|
|
|
62
|
-
def
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
def __len__(self) -> int:
|
|
66
|
-
return len(self._data)
|
|
68
|
+
def is_full(self) -> bool:
|
|
69
|
+
return len(self._data) >= self._size
|
|
67
70
|
|
|
68
71
|
# -- async utility methods -- #
|
|
69
72
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: web3
|
|
3
|
-
Version: 7.
|
|
3
|
+
Version: 7.11.1
|
|
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
|
|
@@ -21,76 +21,63 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
21
21
|
Requires-Python: >=3.8, <4
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: eth-abi>=5.0.1
|
|
25
|
-
Requires-Dist: eth-account>=0.13.
|
|
26
|
-
Requires-Dist: eth-hash[pycryptodome]>=0.5.1
|
|
27
|
-
Requires-Dist: eth-typing>=5.0.0
|
|
28
|
-
Requires-Dist: eth-utils>=5.0.0
|
|
29
|
-
Requires-Dist: hexbytes>=1.2.0
|
|
30
|
-
Requires-Dist: aiohttp>=3.7.4.post0
|
|
31
|
-
Requires-Dist: pydantic>=2.4.0
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist:
|
|
36
|
-
Requires-Dist:
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Provides-Extra: tester
|
|
39
|
-
Requires-Dist: eth-tester[py-evm]<0.13.0b1,>=0.12.0b1; extra == "tester"
|
|
40
|
-
Requires-Dist: py-geth>=5.1.0; extra == "tester"
|
|
24
|
+
Requires-Dist: eth-abi >=5.0.1
|
|
25
|
+
Requires-Dist: eth-account >=0.13.6
|
|
26
|
+
Requires-Dist: eth-hash[pycryptodome] >=0.5.1
|
|
27
|
+
Requires-Dist: eth-typing >=5.0.0
|
|
28
|
+
Requires-Dist: eth-utils >=5.0.0
|
|
29
|
+
Requires-Dist: hexbytes >=1.2.0
|
|
30
|
+
Requires-Dist: aiohttp >=3.7.4.post0
|
|
31
|
+
Requires-Dist: pydantic >=2.4.0
|
|
32
|
+
Requires-Dist: requests >=2.23.0
|
|
33
|
+
Requires-Dist: typing-extensions >=4.0.1
|
|
34
|
+
Requires-Dist: types-requests >=2.0.0
|
|
35
|
+
Requires-Dist: websockets <16.0.0,>=10.0.0
|
|
36
|
+
Requires-Dist: pyunormalize >=15.0.0
|
|
37
|
+
Requires-Dist: pywin32 >=223 ; platform_system == "Windows"
|
|
41
38
|
Provides-Extra: dev
|
|
42
|
-
Requires-Dist: build>=0.9.0; extra ==
|
|
43
|
-
Requires-Dist:
|
|
44
|
-
Requires-Dist: ipython; extra ==
|
|
45
|
-
Requires-Dist: setuptools>=38.6.0; extra ==
|
|
46
|
-
Requires-Dist: tqdm>4.32; extra ==
|
|
47
|
-
Requires-Dist: twine>=1.13; extra ==
|
|
48
|
-
Requires-Dist: wheel; extra ==
|
|
49
|
-
Requires-Dist: sphinx>=6.0.0; extra ==
|
|
50
|
-
Requires-Dist: sphinx-autobuild>=2021.3.14; extra ==
|
|
51
|
-
Requires-Dist:
|
|
52
|
-
Requires-Dist: towncrier<25,>=24; extra ==
|
|
53
|
-
Requires-Dist: pytest-asyncio<0.23,>=0.18.1; extra ==
|
|
54
|
-
Requires-Dist: pytest-mock>=1.10; extra ==
|
|
55
|
-
Requires-Dist: pytest-xdist>=2.4.0; extra ==
|
|
56
|
-
Requires-Dist: pytest>=7.0.0; extra ==
|
|
57
|
-
Requires-Dist: flaky>=3.7.0; extra ==
|
|
58
|
-
Requires-Dist: hypothesis>=3.31.2; extra ==
|
|
59
|
-
Requires-Dist: tox>=4.0.0; extra ==
|
|
60
|
-
Requires-Dist: mypy==1.10.0; extra ==
|
|
61
|
-
Requires-Dist: pre-commit>=3.4.0; extra ==
|
|
62
|
-
Requires-Dist: eth-tester[py-evm]<0.
|
|
63
|
-
Requires-Dist: py-geth>=5.1.0; extra ==
|
|
39
|
+
Requires-Dist: build >=0.9.0 ; extra == 'dev'
|
|
40
|
+
Requires-Dist: bump-my-version >=0.19.0 ; extra == 'dev'
|
|
41
|
+
Requires-Dist: ipython ; extra == 'dev'
|
|
42
|
+
Requires-Dist: setuptools >=38.6.0 ; extra == 'dev'
|
|
43
|
+
Requires-Dist: tqdm >4.32 ; extra == 'dev'
|
|
44
|
+
Requires-Dist: twine >=1.13 ; extra == 'dev'
|
|
45
|
+
Requires-Dist: wheel ; extra == 'dev'
|
|
46
|
+
Requires-Dist: sphinx >=6.0.0 ; extra == 'dev'
|
|
47
|
+
Requires-Dist: sphinx-autobuild >=2021.3.14 ; extra == 'dev'
|
|
48
|
+
Requires-Dist: sphinx-rtd-theme >=1.0.0 ; extra == 'dev'
|
|
49
|
+
Requires-Dist: towncrier <25,>=24 ; extra == 'dev'
|
|
50
|
+
Requires-Dist: pytest-asyncio <0.23,>=0.18.1 ; extra == 'dev'
|
|
51
|
+
Requires-Dist: pytest-mock >=1.10 ; extra == 'dev'
|
|
52
|
+
Requires-Dist: pytest-xdist >=2.4.0 ; extra == 'dev'
|
|
53
|
+
Requires-Dist: pytest >=7.0.0 ; extra == 'dev'
|
|
54
|
+
Requires-Dist: flaky >=3.7.0 ; extra == 'dev'
|
|
55
|
+
Requires-Dist: hypothesis >=3.31.2 ; extra == 'dev'
|
|
56
|
+
Requires-Dist: tox >=4.0.0 ; extra == 'dev'
|
|
57
|
+
Requires-Dist: mypy ==1.10.0 ; extra == 'dev'
|
|
58
|
+
Requires-Dist: pre-commit >=3.4.0 ; extra == 'dev'
|
|
59
|
+
Requires-Dist: eth-tester[py-evm] <0.14.0b1,>=0.13.0b1 ; extra == 'dev'
|
|
60
|
+
Requires-Dist: py-geth >=5.1.0 ; extra == 'dev'
|
|
64
61
|
Provides-Extra: docs
|
|
65
|
-
Requires-Dist: sphinx>=6.0.0; extra ==
|
|
66
|
-
Requires-Dist: sphinx-autobuild>=2021.3.14; extra ==
|
|
67
|
-
Requires-Dist:
|
|
68
|
-
Requires-Dist: towncrier<25,>=24; extra ==
|
|
62
|
+
Requires-Dist: sphinx >=6.0.0 ; extra == 'docs'
|
|
63
|
+
Requires-Dist: sphinx-autobuild >=2021.3.14 ; extra == 'docs'
|
|
64
|
+
Requires-Dist: sphinx-rtd-theme >=1.0.0 ; extra == 'docs'
|
|
65
|
+
Requires-Dist: towncrier <25,>=24 ; extra == 'docs'
|
|
69
66
|
Provides-Extra: test
|
|
70
|
-
Requires-Dist: pytest-asyncio<0.23,>=0.18.1; extra ==
|
|
71
|
-
Requires-Dist: pytest-mock>=1.10; extra ==
|
|
72
|
-
Requires-Dist: pytest-xdist>=2.4.0; extra ==
|
|
73
|
-
Requires-Dist: pytest>=7.0.0; extra ==
|
|
74
|
-
Requires-Dist: flaky>=3.7.0; extra ==
|
|
75
|
-
Requires-Dist: hypothesis>=3.31.2; extra ==
|
|
76
|
-
Requires-Dist: tox>=4.0.0; extra ==
|
|
77
|
-
Requires-Dist: mypy==1.10.0; extra ==
|
|
78
|
-
Requires-Dist: pre-commit>=3.4.0; extra ==
|
|
79
|
-
Requires-Dist: eth-tester[py-evm]<0.
|
|
80
|
-
Requires-Dist: py-geth>=5.1.0; extra ==
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Dynamic: description
|
|
85
|
-
Dynamic: description-content-type
|
|
86
|
-
Dynamic: home-page
|
|
87
|
-
Dynamic: keywords
|
|
88
|
-
Dynamic: license
|
|
89
|
-
Dynamic: license-file
|
|
90
|
-
Dynamic: provides-extra
|
|
91
|
-
Dynamic: requires-dist
|
|
92
|
-
Dynamic: requires-python
|
|
93
|
-
Dynamic: summary
|
|
67
|
+
Requires-Dist: pytest-asyncio <0.23,>=0.18.1 ; extra == 'test'
|
|
68
|
+
Requires-Dist: pytest-mock >=1.10 ; extra == 'test'
|
|
69
|
+
Requires-Dist: pytest-xdist >=2.4.0 ; extra == 'test'
|
|
70
|
+
Requires-Dist: pytest >=7.0.0 ; extra == 'test'
|
|
71
|
+
Requires-Dist: flaky >=3.7.0 ; extra == 'test'
|
|
72
|
+
Requires-Dist: hypothesis >=3.31.2 ; extra == 'test'
|
|
73
|
+
Requires-Dist: tox >=4.0.0 ; extra == 'test'
|
|
74
|
+
Requires-Dist: mypy ==1.10.0 ; extra == 'test'
|
|
75
|
+
Requires-Dist: pre-commit >=3.4.0 ; extra == 'test'
|
|
76
|
+
Requires-Dist: eth-tester[py-evm] <0.14.0b1,>=0.13.0b1 ; extra == 'test'
|
|
77
|
+
Requires-Dist: py-geth >=5.1.0 ; extra == 'test'
|
|
78
|
+
Provides-Extra: tester
|
|
79
|
+
Requires-Dist: eth-tester[py-evm] <0.14.0b1,>=0.13.0b1 ; extra == 'tester'
|
|
80
|
+
Requires-Dist: py-geth >=5.1.0 ; extra == 'tester'
|
|
94
81
|
|
|
95
82
|
# web3.py
|
|
96
83
|
|