web3 7.0.0b6__py3-none-any.whl → 7.0.0b8__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/__init__.py +13 -2
- web3/__init__.py +21 -5
- 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 +5 -5
- 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/http.py +3 -0
- web3/_utils/http_session_manager.py +280 -0
- web3/_utils/method_formatters.py +19 -3
- web3/_utils/module_testing/eth_module.py +84 -111
- web3/_utils/module_testing/module_testing_utils.py +22 -18
- web3/_utils/module_testing/persistent_connection_provider.py +45 -16
- web3/_utils/rpc_abi.py +0 -3
- web3/beacon/__init__.py +5 -0
- web3/beacon/async_beacon.py +9 -5
- web3/beacon/beacon.py +7 -5
- web3/contract/__init__.py +7 -0
- web3/contract/base_contract.py +10 -1
- web3/eth/__init__.py +7 -0
- web3/eth/async_eth.py +0 -33
- web3/eth/eth.py +2 -53
- web3/exceptions.py +6 -0
- web3/manager.py +34 -11
- web3/middleware/__init__.py +17 -0
- web3/module.py +1 -1
- web3/providers/__init__.py +21 -0
- web3/providers/eth_tester/__init__.py +5 -0
- web3/providers/eth_tester/defaults.py +0 -6
- web3/providers/eth_tester/middleware.py +3 -8
- web3/providers/persistent/__init__.py +7 -0
- web3/providers/persistent/async_ipc.py +34 -79
- web3/providers/persistent/persistent.py +76 -7
- web3/providers/persistent/persistent_connection.py +47 -5
- web3/providers/persistent/websocket.py +19 -59
- web3/providers/rpc/__init__.py +5 -0
- web3/providers/rpc/async_rpc.py +16 -12
- web3/providers/rpc/rpc.py +16 -12
- web3/providers/rpc/utils.py +0 -3
- web3/tools/benchmark/main.py +7 -6
- web3/tools/benchmark/node.py +1 -1
- web3/utils/__init__.py +14 -5
- web3/utils/async_exception_handling.py +19 -7
- web3/utils/caching.py +24 -0
- web3/utils/exception_handling.py +7 -5
- {web3-7.0.0b6.dist-info → web3-7.0.0b8.dist-info}/METADATA +14 -8
- {web3-7.0.0b6.dist-info → web3-7.0.0b8.dist-info}/RECORD +66 -67
- {web3-7.0.0b6.dist-info → web3-7.0.0b8.dist-info}/WHEEL +1 -1
- web3/_utils/contract_sources/contract_data/address_reflector.py +0 -29
- web3/_utils/request.py +0 -265
- {web3-7.0.0b6.dist-info → web3-7.0.0b8.dist-info}/LICENSE +0 -0
- {web3-7.0.0b6.dist-info → web3-7.0.0b8.dist-info}/top_level.txt +0 -0
web3/_utils/rpc_abi.py
CHANGED
|
@@ -52,7 +52,6 @@ class RPC:
|
|
|
52
52
|
eth_call = RPCEndpoint("eth_call")
|
|
53
53
|
eth_createAccessList = RPCEndpoint("eth_createAccessList")
|
|
54
54
|
eth_chainId = RPCEndpoint("eth_chainId")
|
|
55
|
-
eth_coinbase = RPCEndpoint("eth_coinbase")
|
|
56
55
|
eth_estimateGas = RPCEndpoint("eth_estimateGas")
|
|
57
56
|
eth_feeHistory = RPCEndpoint("eth_feeHistory")
|
|
58
57
|
eth_maxPriorityFeePerGas = RPCEndpoint("eth_maxPriorityFeePerGas")
|
|
@@ -94,8 +93,6 @@ class RPC:
|
|
|
94
93
|
eth_getUncleCountByBlockHash = RPCEndpoint("eth_getUncleCountByBlockHash")
|
|
95
94
|
eth_getUncleCountByBlockNumber = RPCEndpoint("eth_getUncleCountByBlockNumber")
|
|
96
95
|
eth_getWork = RPCEndpoint("eth_getWork")
|
|
97
|
-
eth_hashrate = RPCEndpoint("eth_hashrate")
|
|
98
|
-
eth_mining = RPCEndpoint("eth_mining")
|
|
99
96
|
eth_newBlockFilter = RPCEndpoint("eth_newBlockFilter")
|
|
100
97
|
eth_newFilter = RPCEndpoint("eth_newFilter")
|
|
101
98
|
eth_newPendingTransactionFilter = RPCEndpoint("eth_newPendingTransactionFilter")
|
web3/beacon/__init__.py
CHANGED
web3/beacon/async_beacon.py
CHANGED
|
@@ -8,9 +8,8 @@ from eth_typing import (
|
|
|
8
8
|
HexStr,
|
|
9
9
|
)
|
|
10
10
|
|
|
11
|
-
from web3._utils.
|
|
12
|
-
|
|
13
|
-
async_json_make_get_request,
|
|
11
|
+
from web3._utils.http_session_manager import (
|
|
12
|
+
HTTPSessionManager,
|
|
14
13
|
)
|
|
15
14
|
from web3.beacon.api_endpoints import (
|
|
16
15
|
GET_ATTESTATIONS,
|
|
@@ -63,10 +62,13 @@ class AsyncBeacon:
|
|
|
63
62
|
) -> None:
|
|
64
63
|
self.base_url = base_url
|
|
65
64
|
self.request_timeout = request_timeout
|
|
65
|
+
self._request_session_manager = HTTPSessionManager()
|
|
66
66
|
|
|
67
67
|
async def _async_make_get_request(self, endpoint_uri: str) -> Dict[str, Any]:
|
|
68
68
|
uri = URI(self.base_url + endpoint_uri)
|
|
69
|
-
return await async_json_make_get_request(
|
|
69
|
+
return await self._request_session_manager.async_json_make_get_request(
|
|
70
|
+
uri, timeout=self.request_timeout
|
|
71
|
+
)
|
|
70
72
|
|
|
71
73
|
# [ BEACON endpoints ]
|
|
72
74
|
|
|
@@ -208,7 +210,9 @@ class AsyncBeacon:
|
|
|
208
210
|
|
|
209
211
|
async def get_health(self) -> int:
|
|
210
212
|
url = URI(self.base_url + GET_HEALTH)
|
|
211
|
-
response =
|
|
213
|
+
response = (
|
|
214
|
+
await self._request_session_manager.async_get_response_from_get_request(url)
|
|
215
|
+
)
|
|
212
216
|
return response.status
|
|
213
217
|
|
|
214
218
|
async def get_version(self) -> Dict[str, Any]:
|
web3/beacon/beacon.py
CHANGED
|
@@ -8,9 +8,8 @@ from eth_typing import (
|
|
|
8
8
|
HexStr,
|
|
9
9
|
)
|
|
10
10
|
|
|
11
|
-
from web3._utils.
|
|
12
|
-
|
|
13
|
-
json_make_get_request,
|
|
11
|
+
from web3._utils.http_session_manager import (
|
|
12
|
+
HTTPSessionManager,
|
|
14
13
|
)
|
|
15
14
|
from web3.beacon.api_endpoints import (
|
|
16
15
|
GET_ATTESTATIONS,
|
|
@@ -61,10 +60,13 @@ class Beacon:
|
|
|
61
60
|
) -> None:
|
|
62
61
|
self.base_url = base_url
|
|
63
62
|
self.request_timeout = request_timeout
|
|
63
|
+
self._request_session_manager = HTTPSessionManager()
|
|
64
64
|
|
|
65
65
|
def _make_get_request(self, endpoint_url: str) -> Dict[str, Any]:
|
|
66
66
|
uri = URI(self.base_url + endpoint_url)
|
|
67
|
-
return json_make_get_request(
|
|
67
|
+
return self._request_session_manager.json_make_get_request(
|
|
68
|
+
uri, timeout=self.request_timeout
|
|
69
|
+
)
|
|
68
70
|
|
|
69
71
|
# [ BEACON endpoints ]
|
|
70
72
|
|
|
@@ -196,7 +198,7 @@ class Beacon:
|
|
|
196
198
|
|
|
197
199
|
def get_health(self) -> int:
|
|
198
200
|
url = URI(self.base_url + GET_HEALTH)
|
|
199
|
-
response = get_response_from_get_request(url)
|
|
201
|
+
response = self._request_session_manager.get_response_from_get_request(url)
|
|
200
202
|
return response.status_code
|
|
201
203
|
|
|
202
204
|
def get_version(self) -> Dict[str, Any]:
|
web3/contract/__init__.py
CHANGED
web3/contract/base_contract.py
CHANGED
|
@@ -16,6 +16,9 @@ from typing import (
|
|
|
16
16
|
)
|
|
17
17
|
import warnings
|
|
18
18
|
|
|
19
|
+
from eth_abi.exceptions import (
|
|
20
|
+
InsufficientDataBytes,
|
|
21
|
+
)
|
|
19
22
|
from eth_typing import (
|
|
20
23
|
Address,
|
|
21
24
|
ChecksumAddress,
|
|
@@ -174,7 +177,13 @@ class BaseContractEvent:
|
|
|
174
177
|
for log in txn_receipt["logs"]:
|
|
175
178
|
try:
|
|
176
179
|
rich_log = get_event_data(self.w3.codec, self.abi, log)
|
|
177
|
-
except (
|
|
180
|
+
except (
|
|
181
|
+
MismatchedABI,
|
|
182
|
+
LogTopicError,
|
|
183
|
+
InvalidEventABI,
|
|
184
|
+
TypeError,
|
|
185
|
+
InsufficientDataBytes,
|
|
186
|
+
) as e:
|
|
178
187
|
if errors == DISCARD:
|
|
179
188
|
continue
|
|
180
189
|
elif errors == IGNORE:
|
web3/eth/__init__.py
CHANGED
web3/eth/async_eth.py
CHANGED
|
@@ -127,17 +127,6 @@ class AsyncEth(BaseEth):
|
|
|
127
127
|
async def accounts(self) -> Tuple[ChecksumAddress]:
|
|
128
128
|
return await self._accounts()
|
|
129
129
|
|
|
130
|
-
# eth_hashrate
|
|
131
|
-
|
|
132
|
-
_hashrate: Method[Callable[[], Awaitable[int]]] = Method(
|
|
133
|
-
RPC.eth_hashrate,
|
|
134
|
-
is_property=True,
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
@property
|
|
138
|
-
async def hashrate(self) -> int:
|
|
139
|
-
return await self._hashrate()
|
|
140
|
-
|
|
141
130
|
# eth_blockNumber
|
|
142
131
|
|
|
143
132
|
get_block_number: Method[Callable[[], Awaitable[BlockNumber]]] = Method(
|
|
@@ -160,17 +149,6 @@ class AsyncEth(BaseEth):
|
|
|
160
149
|
async def chain_id(self) -> int:
|
|
161
150
|
return await self._chain_id()
|
|
162
151
|
|
|
163
|
-
# eth_coinbase
|
|
164
|
-
|
|
165
|
-
_coinbase: Method[Callable[[], Awaitable[ChecksumAddress]]] = Method(
|
|
166
|
-
RPC.eth_coinbase,
|
|
167
|
-
is_property=True,
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
@property
|
|
171
|
-
async def coinbase(self) -> ChecksumAddress:
|
|
172
|
-
return await self._coinbase()
|
|
173
|
-
|
|
174
152
|
# eth_gasPrice
|
|
175
153
|
|
|
176
154
|
_gas_price: Method[Callable[[], Awaitable[Wei]]] = Method(
|
|
@@ -206,17 +184,6 @@ class AsyncEth(BaseEth):
|
|
|
206
184
|
)
|
|
207
185
|
return await async_fee_history_priority_fee(self)
|
|
208
186
|
|
|
209
|
-
# eth_mining
|
|
210
|
-
|
|
211
|
-
_mining: Method[Callable[[], Awaitable[bool]]] = Method(
|
|
212
|
-
RPC.eth_mining,
|
|
213
|
-
is_property=True,
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
@property
|
|
217
|
-
async def mining(self) -> bool:
|
|
218
|
-
return await self._mining()
|
|
219
|
-
|
|
220
187
|
# eth_syncing
|
|
221
188
|
|
|
222
189
|
_syncing: Method[Callable[[], Awaitable[Union[SyncStatus, bool]]]] = Method(
|
web3/eth/eth.py
CHANGED
|
@@ -119,17 +119,6 @@ class Eth(BaseEth):
|
|
|
119
119
|
def accounts(self) -> Tuple[ChecksumAddress]:
|
|
120
120
|
return self._accounts()
|
|
121
121
|
|
|
122
|
-
# eth_hashrate
|
|
123
|
-
|
|
124
|
-
_hashrate: Method[Callable[[], int]] = Method(
|
|
125
|
-
RPC.eth_hashrate,
|
|
126
|
-
is_property=True,
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
@property
|
|
130
|
-
def hashrate(self) -> int:
|
|
131
|
-
return self._hashrate()
|
|
132
|
-
|
|
133
122
|
# eth_blockNumber
|
|
134
123
|
|
|
135
124
|
get_block_number: Method[Callable[[], BlockNumber]] = Method(
|
|
@@ -152,17 +141,6 @@ class Eth(BaseEth):
|
|
|
152
141
|
def chain_id(self) -> int:
|
|
153
142
|
return self._chain_id()
|
|
154
143
|
|
|
155
|
-
# eth_coinbase
|
|
156
|
-
|
|
157
|
-
_coinbase: Method[Callable[[], ChecksumAddress]] = Method(
|
|
158
|
-
RPC.eth_coinbase,
|
|
159
|
-
is_property=True,
|
|
160
|
-
)
|
|
161
|
-
|
|
162
|
-
@property
|
|
163
|
-
def coinbase(self) -> ChecksumAddress:
|
|
164
|
-
return self._coinbase()
|
|
165
|
-
|
|
166
144
|
# eth_gasPrice
|
|
167
145
|
|
|
168
146
|
_gas_price: Method[Callable[[], Wei]] = Method(
|
|
@@ -198,17 +176,6 @@ class Eth(BaseEth):
|
|
|
198
176
|
)
|
|
199
177
|
return fee_history_priority_fee(self)
|
|
200
178
|
|
|
201
|
-
# eth_mining
|
|
202
|
-
|
|
203
|
-
_mining: Method[Callable[[], bool]] = Method(
|
|
204
|
-
RPC.eth_mining,
|
|
205
|
-
is_property=True,
|
|
206
|
-
)
|
|
207
|
-
|
|
208
|
-
@property
|
|
209
|
-
def mining(self) -> bool:
|
|
210
|
-
return self._mining()
|
|
211
|
-
|
|
212
179
|
# eth_syncing
|
|
213
180
|
|
|
214
181
|
_syncing: Method[Callable[[], Union[SyncStatus, bool]]] = Method(
|
|
@@ -285,7 +252,8 @@ class Eth(BaseEth):
|
|
|
285
252
|
return self._call(transaction, block_identifier, state_override)
|
|
286
253
|
except OffchainLookup as offchain_lookup:
|
|
287
254
|
durin_calldata = handle_offchain_lookup(
|
|
288
|
-
offchain_lookup.payload,
|
|
255
|
+
offchain_lookup.payload,
|
|
256
|
+
transaction,
|
|
289
257
|
)
|
|
290
258
|
transaction["data"] = durin_calldata
|
|
291
259
|
|
|
@@ -660,25 +628,6 @@ class Eth(BaseEth):
|
|
|
660
628
|
mungers=[default_root_munger],
|
|
661
629
|
)
|
|
662
630
|
|
|
663
|
-
# eth_submitHashrate
|
|
664
|
-
|
|
665
|
-
submit_hashrate: Method[Callable[[int, _Hash32], bool]] = Method(
|
|
666
|
-
RPC.eth_submitHashrate,
|
|
667
|
-
mungers=[default_root_munger],
|
|
668
|
-
)
|
|
669
|
-
|
|
670
|
-
# eth_getWork, eth_submitWork
|
|
671
|
-
|
|
672
|
-
get_work: Method[Callable[[], List[HexBytes]]] = Method(
|
|
673
|
-
RPC.eth_getWork,
|
|
674
|
-
is_property=True,
|
|
675
|
-
)
|
|
676
|
-
|
|
677
|
-
submit_work: Method[Callable[[int, _Hash32, _Hash32], bool]] = Method(
|
|
678
|
-
RPC.eth_submitWork,
|
|
679
|
-
mungers=[default_root_munger],
|
|
680
|
-
)
|
|
681
|
-
|
|
682
631
|
@overload
|
|
683
632
|
# type error: Overloaded function signatures 1 and 2 overlap with incompatible return types # noqa: E501
|
|
684
633
|
def contract(self, address: None = None, **kwargs: Any) -> Type[Contract]: # type: ignore[overload-overlap] # noqa: E501
|
web3/exceptions.py
CHANGED
|
@@ -327,6 +327,12 @@ class TaskNotRunning(Web3Exception):
|
|
|
327
327
|
super().__init__(message)
|
|
328
328
|
|
|
329
329
|
|
|
330
|
+
class PersistentConnectionClosedOK(Web3Exception):
|
|
331
|
+
"""
|
|
332
|
+
Raised when a persistent connection is closed gracefully by the server.
|
|
333
|
+
"""
|
|
334
|
+
|
|
335
|
+
|
|
330
336
|
class Web3RPCError(Web3Exception):
|
|
331
337
|
"""
|
|
332
338
|
Raised when a JSON-RPC response contains an error field.
|
web3/manager.py
CHANGED
|
@@ -20,9 +20,6 @@ from eth_utils.toolz import (
|
|
|
20
20
|
from hexbytes import (
|
|
21
21
|
HexBytes,
|
|
22
22
|
)
|
|
23
|
-
from websockets.exceptions import (
|
|
24
|
-
ConnectionClosedOK,
|
|
25
|
-
)
|
|
26
23
|
|
|
27
24
|
from web3._utils.batching import (
|
|
28
25
|
RequestBatcher,
|
|
@@ -472,22 +469,50 @@ class RequestManager:
|
|
|
472
469
|
|
|
473
470
|
# -- persistent connection -- #
|
|
474
471
|
|
|
475
|
-
async def
|
|
472
|
+
async def socket_request(self, method: RPCEndpoint, params: Any) -> RPCResponse:
|
|
476
473
|
provider = cast(PersistentConnectionProvider, self._provider)
|
|
477
474
|
request_func = await provider.request_func(
|
|
478
475
|
cast("AsyncWeb3", self.w3), cast("MiddlewareOnion", self.middleware_onion)
|
|
479
476
|
)
|
|
480
477
|
self.logger.debug(
|
|
481
|
-
"Making request to open socket connection: "
|
|
478
|
+
"Making request to open socket connection and waiting for response: "
|
|
482
479
|
f"{provider.get_endpoint_uri_or_ipc_path()}, method: {method}"
|
|
483
480
|
)
|
|
484
481
|
response = await request_func(method, params)
|
|
485
482
|
return await self._process_response(response)
|
|
486
483
|
|
|
484
|
+
async def send(self, method: RPCEndpoint, params: Any) -> None:
|
|
485
|
+
provider = cast(PersistentConnectionProvider, self._provider)
|
|
486
|
+
# run through the request processors of the middleware
|
|
487
|
+
for mw_class in self.middleware_onion.as_tuple_of_middleware():
|
|
488
|
+
mw = mw_class(self.w3)
|
|
489
|
+
method, params = mw.request_processor(method, params)
|
|
490
|
+
|
|
491
|
+
self.logger.debug(
|
|
492
|
+
"Sending request to open socket connection: "
|
|
493
|
+
f"{provider.get_endpoint_uri_or_ipc_path()}, method: {method}"
|
|
494
|
+
)
|
|
495
|
+
await provider.socket_send(provider.encode_rpc_request(method, params))
|
|
496
|
+
|
|
497
|
+
async def recv(self) -> RPCResponse:
|
|
498
|
+
provider = cast(PersistentConnectionProvider, self._provider)
|
|
499
|
+
self.logger.debug(
|
|
500
|
+
"Getting next response from open socket connection: "
|
|
501
|
+
f"{provider.get_endpoint_uri_or_ipc_path()}"
|
|
502
|
+
)
|
|
503
|
+
# pop from the queue since the listener task is responsible for reading
|
|
504
|
+
# directly from the socket
|
|
505
|
+
request_response_cache = self._request_processor._request_response_cache
|
|
506
|
+
_key, response = await request_response_cache.async_await_and_popitem(
|
|
507
|
+
last=False,
|
|
508
|
+
timeout=provider.request_timeout,
|
|
509
|
+
)
|
|
510
|
+
return await self._process_response(response)
|
|
511
|
+
|
|
487
512
|
def _persistent_message_stream(self) -> "_AsyncPersistentMessageStream":
|
|
488
513
|
return _AsyncPersistentMessageStream(self)
|
|
489
514
|
|
|
490
|
-
async def _get_next_message(self) ->
|
|
515
|
+
async def _get_next_message(self) -> RPCResponse:
|
|
491
516
|
return await self._message_stream().__anext__()
|
|
492
517
|
|
|
493
518
|
async def _message_stream(self) -> AsyncGenerator[RPCResponse, None]:
|
|
@@ -515,12 +540,13 @@ class RequestManager:
|
|
|
515
540
|
# if response is an active subscription response, process it
|
|
516
541
|
yield await self._process_response(response)
|
|
517
542
|
except TaskNotRunning:
|
|
543
|
+
await asyncio.sleep(0)
|
|
518
544
|
self._provider._handle_listener_task_exceptions()
|
|
519
545
|
self.logger.error(
|
|
520
546
|
"Message listener background task has stopped unexpectedly. "
|
|
521
547
|
"Stopping message stream."
|
|
522
548
|
)
|
|
523
|
-
|
|
549
|
+
return
|
|
524
550
|
|
|
525
551
|
async def _process_response(self, response: RPCResponse) -> RPCResponse:
|
|
526
552
|
provider = cast(PersistentConnectionProvider, self._provider)
|
|
@@ -586,7 +612,4 @@ class _AsyncPersistentMessageStream:
|
|
|
586
612
|
return self
|
|
587
613
|
|
|
588
614
|
async def __anext__(self) -> RPCResponse:
|
|
589
|
-
|
|
590
|
-
return await self.manager._get_next_message()
|
|
591
|
-
except ConnectionClosedOK:
|
|
592
|
-
raise StopAsyncIteration
|
|
615
|
+
return await self.manager._get_next_message()
|
web3/middleware/__init__.py
CHANGED
|
@@ -92,3 +92,20 @@ async def async_combine_middleware(
|
|
|
92
92
|
initialized = mw(async_w3)
|
|
93
93
|
accumulator_fn = await initialized.async_wrap_make_request(accumulator_fn)
|
|
94
94
|
return accumulator_fn
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
__all__ = [
|
|
98
|
+
"AttributeDictMiddleware",
|
|
99
|
+
"Middleware",
|
|
100
|
+
"Web3Middleware",
|
|
101
|
+
"BufferedGasEstimateMiddleware",
|
|
102
|
+
"LocalFilterMiddleware",
|
|
103
|
+
"FormattingMiddlewareBuilder",
|
|
104
|
+
"GasPriceStrategyMiddleware",
|
|
105
|
+
"ENSNameToAddressMiddleware",
|
|
106
|
+
"ExtraDataToPOAMiddleware",
|
|
107
|
+
"PythonicMiddleware",
|
|
108
|
+
"SignAndSendRawMiddlewareBuilder",
|
|
109
|
+
"StalecheckMiddlewareBuilder",
|
|
110
|
+
"ValidationMiddleware",
|
|
111
|
+
]
|
web3/module.py
CHANGED
|
@@ -138,7 +138,7 @@ def retrieve_async_method_call_fn(
|
|
|
138
138
|
|
|
139
139
|
try:
|
|
140
140
|
method_str = cast(RPCEndpoint, method_str)
|
|
141
|
-
return await async_w3.manager.
|
|
141
|
+
return await async_w3.manager.socket_request(method_str, params)
|
|
142
142
|
except Exception as e:
|
|
143
143
|
if (
|
|
144
144
|
cache_key is not None
|
web3/providers/__init__.py
CHANGED
|
@@ -8,6 +8,10 @@ from .base import (
|
|
|
8
8
|
BaseProvider,
|
|
9
9
|
JSONBaseProvider,
|
|
10
10
|
)
|
|
11
|
+
from .eth_tester import (
|
|
12
|
+
AsyncEthereumTesterProvider,
|
|
13
|
+
EthereumTesterProvider,
|
|
14
|
+
)
|
|
11
15
|
from .ipc import (
|
|
12
16
|
IPCProvider,
|
|
13
17
|
)
|
|
@@ -26,3 +30,20 @@ from .persistent import (
|
|
|
26
30
|
from .auto import (
|
|
27
31
|
AutoProvider,
|
|
28
32
|
)
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"AsyncBaseProvider",
|
|
36
|
+
"AsyncEthereumTesterProvider",
|
|
37
|
+
"AsyncHTTPProvider",
|
|
38
|
+
"AsyncIPCProvider",
|
|
39
|
+
"AutoProvider",
|
|
40
|
+
"BaseProvider",
|
|
41
|
+
"EthereumTesterProvider",
|
|
42
|
+
"HTTPProvider",
|
|
43
|
+
"IPCProvider",
|
|
44
|
+
"JSONBaseProvider",
|
|
45
|
+
"LegacyWebSocketProvider",
|
|
46
|
+
"PersistentConnection",
|
|
47
|
+
"PersistentConnectionProvider",
|
|
48
|
+
"WebSocketProvider",
|
|
49
|
+
]
|
|
@@ -243,12 +243,6 @@ API_ENDPOINTS = {
|
|
|
243
243
|
"eth": {
|
|
244
244
|
"protocolVersion": static_return(63),
|
|
245
245
|
"syncing": static_return(False),
|
|
246
|
-
"coinbase": compose(
|
|
247
|
-
operator.itemgetter(0),
|
|
248
|
-
call_eth_tester("get_accounts"),
|
|
249
|
-
),
|
|
250
|
-
"mining": static_return(False),
|
|
251
|
-
"hashrate": static_return(0),
|
|
252
246
|
"chainId": static_return(131277322940537), # from fixture generation file
|
|
253
247
|
"feeHistory": call_eth_tester("get_fee_history"),
|
|
254
248
|
"maxPriorityFeePerGas": static_return(10**9),
|
|
@@ -59,7 +59,7 @@ if TYPE_CHECKING:
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
def is_named_block(value: Any) -> bool:
|
|
62
|
-
return value in {"latest", "earliest", "
|
|
62
|
+
return value in {"latest", "earliest", "safe", "finalized"}
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
def is_hexstr(value: Any) -> bool:
|
|
@@ -334,9 +334,7 @@ result_formatters: Optional[Dict[RPCEndpoint, Callable[..., Any]]] = {
|
|
|
334
334
|
|
|
335
335
|
|
|
336
336
|
def guess_from(w3: "Web3", _: TxParams) -> ChecksumAddress:
|
|
337
|
-
if w3.eth.
|
|
338
|
-
return w3.eth.coinbase
|
|
339
|
-
elif w3.eth.accounts and len(w3.eth.accounts) > 0:
|
|
337
|
+
if w3.eth.accounts and len(w3.eth.accounts) > 0:
|
|
340
338
|
return w3.eth.accounts[0]
|
|
341
339
|
|
|
342
340
|
return None
|
|
@@ -360,11 +358,8 @@ def fill_default(
|
|
|
360
358
|
async def async_guess_from(
|
|
361
359
|
async_w3: "AsyncWeb3", _: TxParams
|
|
362
360
|
) -> Optional[ChecksumAddress]:
|
|
363
|
-
coinbase = await async_w3.eth.coinbase
|
|
364
361
|
accounts = await async_w3.eth.accounts
|
|
365
|
-
if
|
|
366
|
-
return coinbase
|
|
367
|
-
elif accounts is not None and len(accounts) > 0:
|
|
362
|
+
if accounts is not None and len(accounts) > 0:
|
|
368
363
|
return accounts[0]
|
|
369
364
|
return None
|
|
370
365
|
|