web3 7.12.0__py3-none-any.whl → 7.12.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/specs/.DS_Store +0 -0
- web3/_utils/module_testing/eth_module.py +14 -40
- web3/manager.py +3 -3
- web3/providers/auto.py +28 -6
- web3/providers/ipc.py +2 -2
- {web3-7.12.0.dist-info → web3-7.12.1.dist-info}/METADATA +1 -1
- {web3-7.12.0.dist-info → web3-7.12.1.dist-info}/RECORD +10 -9
- {web3-7.12.0.dist-info → web3-7.12.1.dist-info}/WHEEL +1 -1
- {web3-7.12.0.dist-info → web3-7.12.1.dist-info}/licenses/LICENSE +0 -0
- {web3-7.12.0.dist-info → web3-7.12.1.dist-info}/top_level.txt +0 -0
ens/specs/.DS_Store
ADDED
|
Binary file
|
|
@@ -724,8 +724,6 @@ class AsyncEthModuleTest:
|
|
|
724
724
|
keyfile_account_pkey: HexStr,
|
|
725
725
|
async_math_contract: "AsyncContract",
|
|
726
726
|
) -> None:
|
|
727
|
-
# TODO: remove blockNumber block_id from eth_call and eth_getCode calls once
|
|
728
|
-
# geth behavior for "latest" seems stable again.
|
|
729
727
|
keyfile_account = async_w3.eth.account.from_key(keyfile_account_pkey)
|
|
730
728
|
|
|
731
729
|
chain_id = await async_w3.eth.chain_id
|
|
@@ -757,13 +755,9 @@ class AsyncEthModuleTest:
|
|
|
757
755
|
signed = keyfile_account.sign_transaction(txn)
|
|
758
756
|
tx_hash = await async_w3.eth.send_raw_transaction(signed.raw_transaction)
|
|
759
757
|
get_tx = await async_w3.eth.get_transaction(tx_hash)
|
|
760
|
-
|
|
761
|
-
tx_hash, timeout=10
|
|
762
|
-
)
|
|
758
|
+
await async_w3.eth.wait_for_transaction_receipt(tx_hash)
|
|
763
759
|
|
|
764
|
-
code = await async_w3.eth.get_code(
|
|
765
|
-
keyfile_account.address, block_identifier=tx_receipt["blockNumber"]
|
|
766
|
-
)
|
|
760
|
+
code = await async_w3.eth.get_code(keyfile_account.address)
|
|
767
761
|
assert code.to_0x_hex() == f"0xef0100{async_math_contract.address[2:].lower()}"
|
|
768
762
|
delegated = async_w3.eth.contract(
|
|
769
763
|
address=keyfile_account.address, abi=async_math_contract.abi
|
|
@@ -772,7 +766,7 @@ class AsyncEthModuleTest:
|
|
|
772
766
|
# assert the math counter is increased by 1337 only in delegated acct
|
|
773
767
|
assert await async_math_contract.functions.counter().call() == math_counter
|
|
774
768
|
delegated_call = await delegated.functions.counter().call(
|
|
775
|
-
block_identifier=
|
|
769
|
+
block_identifier="latest"
|
|
776
770
|
)
|
|
777
771
|
assert delegated_call == math_counter + 1337
|
|
778
772
|
|
|
@@ -803,13 +797,9 @@ class AsyncEthModuleTest:
|
|
|
803
797
|
|
|
804
798
|
# test eth_sendTransaction
|
|
805
799
|
reset_tx_hash = await async_w3.eth.send_transaction(reset_code_txn)
|
|
806
|
-
|
|
807
|
-
reset_tx_hash, timeout=10
|
|
808
|
-
)
|
|
800
|
+
await async_w3.eth.wait_for_transaction_receipt(reset_tx_hash, timeout=10)
|
|
809
801
|
|
|
810
|
-
reset_code = await async_w3.eth.get_code(
|
|
811
|
-
keyfile_account.address, reset_tx_receipt["blockNumber"]
|
|
812
|
-
)
|
|
802
|
+
reset_code = await async_w3.eth.get_code(keyfile_account.address)
|
|
813
803
|
assert reset_code == HexBytes("0x")
|
|
814
804
|
|
|
815
805
|
@pytest.mark.asyncio
|
|
@@ -3875,8 +3865,6 @@ class EthModuleTest:
|
|
|
3875
3865
|
def test_sign_authorization_send_raw_and_send_set_code_transactions(
|
|
3876
3866
|
self, w3: "Web3", keyfile_account_pkey: HexStr, math_contract: "Contract"
|
|
3877
3867
|
) -> None:
|
|
3878
|
-
# TODO: remove blockNumber block_id from eth_call and eth_getCode calls once
|
|
3879
|
-
# geth behavior for "latest" seems stable again.
|
|
3880
3868
|
keyfile_account = w3.eth.account.from_key(keyfile_account_pkey)
|
|
3881
3869
|
|
|
3882
3870
|
chain_id = w3.eth.chain_id
|
|
@@ -3906,28 +3894,18 @@ class EthModuleTest:
|
|
|
3906
3894
|
|
|
3907
3895
|
# test eth_sendRawTransaction
|
|
3908
3896
|
signed = keyfile_account.sign_transaction(txn)
|
|
3909
|
-
|
|
3910
|
-
get_tx = w3.eth.get_transaction(
|
|
3911
|
-
|
|
3897
|
+
w3.eth.send_raw_transaction(signed.raw_transaction)
|
|
3898
|
+
get_tx = w3.eth.get_transaction(signed.hash)
|
|
3899
|
+
w3.eth.wait_for_transaction_receipt(signed.hash)
|
|
3912
3900
|
|
|
3913
|
-
code = w3.eth.get_code(
|
|
3914
|
-
keyfile_account.address, block_identifier=receipt["blockNumber"]
|
|
3915
|
-
)
|
|
3901
|
+
code = w3.eth.get_code(keyfile_account.address)
|
|
3916
3902
|
assert code.to_0x_hex() == f"0xef0100{math_contract.address[2:].lower()}"
|
|
3917
3903
|
delegated = w3.eth.contract(
|
|
3918
3904
|
address=keyfile_account.address, abi=math_contract.abi
|
|
3919
3905
|
)
|
|
3920
3906
|
# assert the math counter is increased by 1337 only in delegated acct
|
|
3921
|
-
assert (
|
|
3922
|
-
|
|
3923
|
-
block_identifier=receipt["blockNumber"]
|
|
3924
|
-
)
|
|
3925
|
-
== math_counter
|
|
3926
|
-
)
|
|
3927
|
-
assert (
|
|
3928
|
-
delegated.functions.counter().call(block_identifier=receipt["blockNumber"])
|
|
3929
|
-
== math_counter + 1337
|
|
3930
|
-
)
|
|
3907
|
+
assert math_contract.functions.counter().call() == math_counter
|
|
3908
|
+
assert delegated.functions.counter().call() == math_counter + 1337
|
|
3931
3909
|
|
|
3932
3910
|
assert len(get_tx["authorizationList"]) == 1
|
|
3933
3911
|
get_auth = get_tx["authorizationList"][0]
|
|
@@ -3938,7 +3916,7 @@ class EthModuleTest:
|
|
|
3938
3916
|
assert isinstance(get_auth["r"], HexBytes)
|
|
3939
3917
|
assert isinstance(get_auth["s"], HexBytes)
|
|
3940
3918
|
|
|
3941
|
-
# reset
|
|
3919
|
+
# reset code
|
|
3942
3920
|
reset_auth = {
|
|
3943
3921
|
"chainId": chain_id,
|
|
3944
3922
|
"address": "0x" + ("00" * 20),
|
|
@@ -3956,13 +3934,9 @@ class EthModuleTest:
|
|
|
3956
3934
|
|
|
3957
3935
|
# test eth_sendTransaction
|
|
3958
3936
|
reset_tx_hash = w3.eth.send_transaction(reset_code_txn)
|
|
3959
|
-
|
|
3960
|
-
reset_tx_hash, timeout=10
|
|
3961
|
-
)
|
|
3937
|
+
w3.eth.wait_for_transaction_receipt(reset_tx_hash)
|
|
3962
3938
|
|
|
3963
|
-
reset_code = w3.eth.get_code(
|
|
3964
|
-
keyfile_account.address, block_identifier=reset_tx_receipt["blockNumber"]
|
|
3965
|
-
)
|
|
3939
|
+
reset_code = w3.eth.get_code(keyfile_account.address)
|
|
3966
3940
|
assert reset_code == HexBytes("0x")
|
|
3967
3941
|
|
|
3968
3942
|
def test_eth_call(self, w3: "Web3", math_contract: "Contract") -> None:
|
web3/manager.py
CHANGED
|
@@ -254,9 +254,9 @@ class RequestManager:
|
|
|
254
254
|
"""
|
|
255
255
|
Context manager for making batch requests
|
|
256
256
|
"""
|
|
257
|
-
if isinstance(
|
|
258
|
-
self.provider
|
|
259
|
-
|
|
257
|
+
if not isinstance(
|
|
258
|
+
self.provider, (AsyncJSONBaseProvider, JSONBaseProvider, AutoProvider)
|
|
259
|
+
):
|
|
260
260
|
raise Web3TypeError("Batch requests are not supported by this provider.")
|
|
261
261
|
return RequestBatcher(self.w3)
|
|
262
262
|
|
web3/providers/auto.py
CHANGED
|
@@ -3,6 +3,7 @@ from typing import (
|
|
|
3
3
|
Any,
|
|
4
4
|
Callable,
|
|
5
5
|
Dict,
|
|
6
|
+
List,
|
|
6
7
|
Optional,
|
|
7
8
|
Sequence,
|
|
8
9
|
Tuple,
|
|
@@ -21,9 +22,9 @@ from web3.exceptions import (
|
|
|
21
22
|
CannotHandleRequest,
|
|
22
23
|
)
|
|
23
24
|
from web3.providers import (
|
|
24
|
-
BaseProvider,
|
|
25
25
|
HTTPProvider,
|
|
26
26
|
IPCProvider,
|
|
27
|
+
JSONBaseProvider,
|
|
27
28
|
LegacyWebSocketProvider,
|
|
28
29
|
)
|
|
29
30
|
from web3.types import (
|
|
@@ -35,7 +36,7 @@ HTTP_SCHEMES = {"http", "https"}
|
|
|
35
36
|
WS_SCHEMES = {"ws", "wss"}
|
|
36
37
|
|
|
37
38
|
|
|
38
|
-
def load_provider_from_environment() ->
|
|
39
|
+
def load_provider_from_environment() -> Optional[JSONBaseProvider]:
|
|
39
40
|
uri_string = URI(os.environ.get("WEB3_PROVIDER_URI", ""))
|
|
40
41
|
if not uri_string:
|
|
41
42
|
return None
|
|
@@ -45,7 +46,7 @@ def load_provider_from_environment() -> BaseProvider:
|
|
|
45
46
|
|
|
46
47
|
def load_provider_from_uri(
|
|
47
48
|
uri_string: URI, headers: Optional[Dict[str, Tuple[str, str]]] = None
|
|
48
|
-
) ->
|
|
49
|
+
) -> JSONBaseProvider:
|
|
49
50
|
uri = urlparse(uri_string)
|
|
50
51
|
if uri.scheme == "file":
|
|
51
52
|
return IPCProvider(uri.path)
|
|
@@ -60,7 +61,7 @@ def load_provider_from_uri(
|
|
|
60
61
|
)
|
|
61
62
|
|
|
62
63
|
|
|
63
|
-
class AutoProvider(
|
|
64
|
+
class AutoProvider(JSONBaseProvider):
|
|
64
65
|
default_providers = (
|
|
65
66
|
load_provider_from_environment,
|
|
66
67
|
IPCProvider,
|
|
@@ -72,7 +73,7 @@ class AutoProvider(BaseProvider):
|
|
|
72
73
|
def __init__(
|
|
73
74
|
self,
|
|
74
75
|
potential_providers: Optional[
|
|
75
|
-
Sequence[Union[Callable[...,
|
|
76
|
+
Sequence[Union[Callable[..., JSONBaseProvider], Type[JSONBaseProvider]]]
|
|
76
77
|
] = None,
|
|
77
78
|
) -> None:
|
|
78
79
|
"""
|
|
@@ -83,6 +84,7 @@ class AutoProvider(BaseProvider):
|
|
|
83
84
|
in an attempt to find an active node. The list will default to
|
|
84
85
|
:attribute:`default_providers`.
|
|
85
86
|
"""
|
|
87
|
+
super().__init__()
|
|
86
88
|
if potential_providers:
|
|
87
89
|
self._potential_providers = potential_providers
|
|
88
90
|
else:
|
|
@@ -94,6 +96,14 @@ class AutoProvider(BaseProvider):
|
|
|
94
96
|
except OSError:
|
|
95
97
|
return self._proxy_request(method, params, use_cache=False)
|
|
96
98
|
|
|
99
|
+
def make_batch_request(
|
|
100
|
+
self, requests: List[Tuple[RPCEndpoint, Any]]
|
|
101
|
+
) -> Union[List[RPCResponse], RPCResponse]:
|
|
102
|
+
try:
|
|
103
|
+
return self._proxy_batch_request(requests)
|
|
104
|
+
except OSError:
|
|
105
|
+
return self._proxy_batch_request(requests, use_cache=False)
|
|
106
|
+
|
|
97
107
|
def is_connected(self, show_traceback: bool = False) -> bool:
|
|
98
108
|
provider = self._get_active_provider(use_cache=True)
|
|
99
109
|
return provider is not None and provider.is_connected(show_traceback)
|
|
@@ -110,7 +120,19 @@ class AutoProvider(BaseProvider):
|
|
|
110
120
|
|
|
111
121
|
return provider.make_request(method, params)
|
|
112
122
|
|
|
113
|
-
def
|
|
123
|
+
def _proxy_batch_request(
|
|
124
|
+
self, requests: List[Tuple[RPCEndpoint, Any]], use_cache: bool = True
|
|
125
|
+
) -> Union[List[RPCResponse], RPCResponse]:
|
|
126
|
+
provider = self._get_active_provider(use_cache)
|
|
127
|
+
if provider is None:
|
|
128
|
+
raise CannotHandleRequest(
|
|
129
|
+
"Could not discover provider while making batch request: "
|
|
130
|
+
f"requests:{requests}\n"
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
return provider.make_batch_request(requests)
|
|
134
|
+
|
|
135
|
+
def _get_active_provider(self, use_cache: bool) -> Optional[JSONBaseProvider]:
|
|
114
136
|
if use_cache and self._active_provider is not None:
|
|
115
137
|
return self._active_provider
|
|
116
138
|
|
web3/providers/ipc.py
CHANGED
|
@@ -59,7 +59,7 @@ def get_ipc_socket(ipc_path: str, timeout: float = 2.0) -> socket.socket:
|
|
|
59
59
|
return sock
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
class
|
|
62
|
+
class PersistentSocket:
|
|
63
63
|
sock = None
|
|
64
64
|
|
|
65
65
|
def __init__(self, ipc_path: str) -> None:
|
|
@@ -157,7 +157,7 @@ class IPCProvider(JSONBaseProvider):
|
|
|
157
157
|
|
|
158
158
|
self.timeout = timeout
|
|
159
159
|
self._lock = threading.Lock()
|
|
160
|
-
self._socket =
|
|
160
|
+
self._socket = PersistentSocket(self.ipc_path)
|
|
161
161
|
|
|
162
162
|
def __str__(self) -> str:
|
|
163
163
|
return f"<{self.__class__.__name__} {self.ipc_path}>"
|
|
@@ -9,6 +9,7 @@ ens/contract_data.py,sha256=CZa7Uxzq6rT-KonwHHM_wo-5ry0j1DMbikgEaP27Uy8,148602
|
|
|
9
9
|
ens/ens.py,sha256=-avaYLLwUAPj8cYxP5fcH5h9aVabG5xuvBkwh5yTbMQ,21722
|
|
10
10
|
ens/exceptions.py,sha256=5h-t3G-lwYchYe4JgHaxD_a_llh56sS6qzo9Rpa0S0o,2442
|
|
11
11
|
ens/utils.py,sha256=ql6Kqe_dmbr4K6p0YO5Gr8b9XdfMRLe9dnjNv1mrWYI,9318
|
|
12
|
+
ens/specs/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
|
12
13
|
ens/specs/nf.json,sha256=tPXKzdhgu9gqNi0UhKC1kzPqSBgy4yHm5TL19RQHBqU,49038
|
|
13
14
|
ens/specs/normalization_spec.json,sha256=8mmjBj4OoYCn7pD4P7hqKP_qy6rpYzpyRinSH3CCP9M,3171499
|
|
14
15
|
web3/__init__.py,sha256=P11QAEV_GYoZq9ij8gDzFx5tKzJY2aMXG-keg2Lg1xs,1277
|
|
@@ -18,7 +19,7 @@ web3/exceptions.py,sha256=GMIrWTkYDR0jtvtdOlgl_s6fctTibW4Ytw4So5BY4uE,9584
|
|
|
18
19
|
web3/geth.py,sha256=xVBZWSksBo2ipesAN9V5hzDc_te7kU8ueicFdvpkSO4,7370
|
|
19
20
|
web3/logs.py,sha256=ROs-mDMH_ZOecE7hfbWA5yp27G38FbLjX4lO_WtlZxQ,198
|
|
20
21
|
web3/main.py,sha256=eVdSh7m_iBMf3au0Aj49TZ7NSaRbN1Ccsng9Fuu8dME,16162
|
|
21
|
-
web3/manager.py,sha256=
|
|
22
|
+
web3/manager.py,sha256=hzIrl70WWIupgEbBBQlB11l89uHHU1xCKowKgBngkqU,22689
|
|
22
23
|
web3/method.py,sha256=BCYend146F5Q149VB2VN11_Z3x8y0lJZH8ShF_VxwV4,8682
|
|
23
24
|
web3/module.py,sha256=CDlnDrrWzkCJtd3gzHZ972l-6En6IyFEWwB7TXkHHLM,5617
|
|
24
25
|
web3/net.py,sha256=Y3vPzHWVFkfHEZoJxjDOt4tp5ERmZrMuyi4ZFOLmIeA,1562
|
|
@@ -89,7 +90,7 @@ web3/_utils/contract_sources/contract_data/storage_contract.py,sha256=ARz6J3Gmsn
|
|
|
89
90
|
web3/_utils/contract_sources/contract_data/string_contract.py,sha256=sk6TWvzH7GkRxwioXFm2a7J99riySqipn2EQhfYdzLY,11228
|
|
90
91
|
web3/_utils/contract_sources/contract_data/tuple_contracts.py,sha256=7RlKfKRVXhjJN1j7D4YlQM6BswK3c0VaSxcnPVwAgcg,23176
|
|
91
92
|
web3/_utils/module_testing/__init__.py,sha256=Xr_S46cjr0mypD_Y4ZbeF1EJ-XWfNxWUks5ykhzN10c,485
|
|
92
|
-
web3/_utils/module_testing/eth_module.py,sha256=
|
|
93
|
+
web3/_utils/module_testing/eth_module.py,sha256=g4NW9m6jU5IXjWxp0Cl3UoVB3mC1FrHLt3ljztpZx4I,196504
|
|
93
94
|
web3/_utils/module_testing/go_ethereum_admin_module.py,sha256=_c-6SyzZkfAJ-7ySXUpw9FEr4cg-ShRdAGSAHWanCtY,3406
|
|
94
95
|
web3/_utils/module_testing/go_ethereum_debug_module.py,sha256=BP1UjK-5ewkYMilvW9jtZX5Mc9BGh3QlJWPXqDNWizU,4144
|
|
95
96
|
web3/_utils/module_testing/go_ethereum_txpool_module.py,sha256=5f8XL8-2x3keyGRaITxMQYl9oQzjgqGn8zobB-j9BPs,1176
|
|
@@ -131,9 +132,9 @@ web3/middleware/stalecheck.py,sha256=oWRA69BGIbNGjHSnUVOBnoxOYJZYjzRzlqqL5RRlnzk
|
|
|
131
132
|
web3/middleware/validation.py,sha256=QxActrJk_zsXXiwpadP2MUjZBS5E50OJOtUwVrm9XVo,4280
|
|
132
133
|
web3/providers/__init__.py,sha256=YkcSzE9AubvSp-UfvJjyCrdepvziysbqeq2LT0ImDoc,936
|
|
133
134
|
web3/providers/async_base.py,sha256=vCx4SAHPSACrRps4KZ36xgjAMQxKXqXsYB8jACodwWo,8241
|
|
134
|
-
web3/providers/auto.py,sha256=
|
|
135
|
+
web3/providers/auto.py,sha256=9Jacts6375zHEG969lm5LOdmnhG4kJFnh4jMYOySQWU,4300
|
|
135
136
|
web3/providers/base.py,sha256=mTLfK5gZzykzfjVkb6QHROFAAeE6ZdS6J6IPfqZr_e4,6876
|
|
136
|
-
web3/providers/ipc.py,sha256=
|
|
137
|
+
web3/providers/ipc.py,sha256=Rc0x4cW3NietQz0BjOygs78GzVGqgz0fHFZM6HalpVg,6518
|
|
137
138
|
web3/providers/legacy_websocket.py,sha256=uQb5SmoFPFI809q_2iRhDEo5SkSW3T9tYXuf48stp9A,4744
|
|
138
139
|
web3/providers/eth_tester/__init__.py,sha256=UggyBQdeAyjy1awATW1933jkJcpqqaUYUQEFAQnA2o0,163
|
|
139
140
|
web3/providers/eth_tester/defaults.py,sha256=QQUdqqrkcN1AKW7WEY1A5RiPc_fmlHCLmdgB-5iY7Dc,12622
|
|
@@ -164,8 +165,8 @@ web3/utils/async_exception_handling.py,sha256=OoKbLNwWcY9dxLCbOfxcQPSB1OxWraNqcw
|
|
|
164
165
|
web3/utils/caching.py,sha256=miulUjLOjlOfTux8HWBklpRIa6_fVNTVFHIWcbZt27o,2591
|
|
165
166
|
web3/utils/exception_handling.py,sha256=n-MtO5LNzJDVzHTzO6olzfb2_qEVtVRvink0ixswg-Y,2917
|
|
166
167
|
web3/utils/subscriptions.py,sha256=RnqwQL3ekkMyCrbx-jVf6EaEkihyXTbb1LBonBHAJ_g,8617
|
|
167
|
-
web3-7.12.
|
|
168
|
-
web3-7.12.
|
|
169
|
-
web3-7.12.
|
|
170
|
-
web3-7.12.
|
|
171
|
-
web3-7.12.
|
|
168
|
+
web3-7.12.1.dist-info/licenses/LICENSE,sha256=ENGC4gSn0kYaC_mlaXOEwCKmA6W7Z9MeSemc5O2k-h0,1095
|
|
169
|
+
web3-7.12.1.dist-info/METADATA,sha256=00yj0K9jQg20LN-vIHDfMORXEzT8hQJOrl8VCIGjLq8,5621
|
|
170
|
+
web3-7.12.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
171
|
+
web3-7.12.1.dist-info/top_level.txt,sha256=iwupuJh7wgypXrpk_awszyri3TahRr5vxSphNyvt1bU,9
|
|
172
|
+
web3-7.12.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|