web3 6.20.2__py3-none-any.whl → 7.0.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.
- ens/__init__.py +13 -2
- ens/_normalization.py +2 -17
- ens/async_ens.py +33 -21
- ens/base_ens.py +3 -1
- ens/ens.py +16 -11
- ens/exceptions.py +16 -29
- ens/specs/nf.json +1 -1
- ens/specs/normalization_spec.json +1 -1
- ens/utils.py +52 -63
- web3/__init__.py +20 -24
- web3/_utils/abi.py +115 -271
- web3/_utils/async_transactions.py +7 -4
- web3/_utils/batching.py +217 -0
- web3/_utils/blocks.py +6 -2
- web3/_utils/caching.py +128 -5
- web3/_utils/compat/__init__.py +2 -3
- web3/_utils/contract_sources/compile_contracts.py +1 -1
- 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/contracts.py +130 -236
- web3/_utils/datatypes.py +5 -1
- web3/_utils/decorators.py +13 -23
- web3/_utils/empty.py +1 -1
- web3/_utils/encoding.py +16 -12
- web3/_utils/ens.py +2 -1
- web3/_utils/error_formatters_utils.py +5 -3
- web3/_utils/events.py +66 -69
- web3/_utils/fee_utils.py +1 -3
- web3/_utils/filters.py +24 -22
- web3/_utils/formatters.py +2 -2
- web3/_utils/http.py +5 -3
- web3/_utils/http_session_manager.py +303 -0
- web3/_utils/math.py +14 -15
- web3/_utils/method_formatters.py +34 -36
- web3/_utils/module.py +2 -1
- web3/_utils/module_testing/__init__.py +0 -3
- web3/_utils/module_testing/eth_module.py +695 -643
- web3/_utils/module_testing/module_testing_utils.py +61 -34
- web3/_utils/module_testing/persistent_connection_provider.py +56 -25
- web3/_utils/module_testing/utils.py +258 -0
- web3/_utils/module_testing/web3_module.py +438 -17
- web3/_utils/normalizers.py +13 -11
- web3/_utils/rpc_abi.py +5 -32
- web3/_utils/threads.py +8 -7
- web3/_utils/transactions.py +14 -12
- web3/_utils/type_conversion.py +5 -1
- web3/_utils/validation.py +17 -17
- web3/auto/gethdev.py +7 -2
- web3/beacon/__init__.py +6 -1
- web3/beacon/async_beacon.py +9 -5
- web3/beacon/{main.py → beacon.py} +7 -5
- web3/contract/__init__.py +7 -0
- web3/contract/async_contract.py +47 -46
- web3/contract/base_contract.py +183 -158
- web3/contract/contract.py +49 -43
- web3/contract/utils.py +203 -59
- web3/datastructures.py +79 -31
- web3/eth/__init__.py +7 -0
- web3/eth/async_eth.py +39 -51
- web3/eth/base_eth.py +17 -10
- web3/eth/eth.py +30 -68
- web3/exceptions.py +108 -82
- web3/gas_strategies/time_based.py +8 -6
- web3/geth.py +1 -254
- web3/main.py +75 -122
- web3/manager.py +316 -146
- web3/method.py +38 -31
- web3/middleware/__init__.py +67 -89
- web3/middleware/attrdict.py +36 -49
- web3/middleware/base.py +174 -0
- web3/middleware/buffered_gas_estimate.py +20 -21
- web3/middleware/filter.py +157 -117
- web3/middleware/formatting.py +124 -108
- web3/middleware/gas_price_strategy.py +20 -32
- web3/middleware/names.py +29 -26
- web3/middleware/proof_of_authority.py +68 -0
- web3/middleware/pythonic.py +2 -2
- web3/middleware/signing.py +74 -89
- web3/middleware/stalecheck.py +52 -79
- web3/middleware/validation.py +5 -13
- web3/module.py +54 -10
- web3/providers/__init__.py +10 -6
- web3/providers/async_base.py +117 -39
- web3/providers/auto.py +3 -3
- web3/providers/base.py +89 -33
- web3/providers/eth_tester/__init__.py +5 -0
- web3/providers/eth_tester/defaults.py +1 -64
- web3/providers/eth_tester/main.py +99 -31
- web3/providers/eth_tester/middleware.py +45 -73
- web3/providers/ipc.py +42 -46
- web3/providers/{websocket/websocket.py → legacy_websocket.py} +32 -7
- web3/providers/persistent/__init__.py +22 -0
- web3/providers/persistent/async_ipc.py +153 -0
- web3/providers/{persistent.py → persistent/persistent.py} +106 -25
- web3/providers/persistent/persistent_connection.py +84 -0
- web3/providers/{websocket → persistent}/request_processor.py +94 -32
- web3/providers/persistent/utils.py +43 -0
- web3/providers/{websocket/websocket_v2.py → persistent/websocket.py} +29 -28
- web3/providers/rpc/__init__.py +11 -0
- web3/providers/rpc/async_rpc.py +171 -0
- web3/providers/rpc/rpc.py +179 -0
- web3/providers/rpc/utils.py +92 -0
- web3/testing.py +4 -4
- web3/tools/benchmark/main.py +22 -22
- web3/tools/benchmark/node.py +2 -8
- web3/tools/benchmark/reporting.py +2 -2
- web3/tools/benchmark/utils.py +1 -1
- web3/tracing.py +9 -5
- web3/types.py +30 -107
- web3/utils/__init__.py +58 -5
- web3/utils/abi.py +575 -10
- web3/utils/async_exception_handling.py +19 -7
- web3/utils/caching.py +32 -13
- web3/utils/exception_handling.py +7 -5
- {web3-6.20.2.dist-info → web3-7.0.0.dist-info}/LICENSE +1 -1
- web3-7.0.0.dist-info/METADATA +112 -0
- web3-7.0.0.dist-info/RECORD +167 -0
- {web3-6.20.2.dist-info → web3-7.0.0.dist-info}/WHEEL +1 -1
- {web3-6.20.2.dist-info → web3-7.0.0.dist-info}/top_level.txt +0 -1
- ethpm/__init__.py +0 -20
- ethpm/_utils/__init__.py +0 -0
- ethpm/_utils/backend.py +0 -93
- ethpm/_utils/cache.py +0 -44
- ethpm/_utils/chains.py +0 -119
- ethpm/_utils/contract.py +0 -35
- ethpm/_utils/deployments.py +0 -145
- ethpm/_utils/ipfs.py +0 -116
- ethpm/_utils/protobuf/__init__.py +0 -0
- ethpm/_utils/protobuf/ipfs_file_pb2.py +0 -33
- ethpm/_utils/registry.py +0 -29
- ethpm/assets/__init__.py +0 -0
- ethpm/assets/ens/v3.json +0 -1
- ethpm/assets/escrow/with_bytecode_v3.json +0 -1
- ethpm/assets/ipfs_file.proto +0 -32
- ethpm/assets/owned/output_v3.json +0 -1
- ethpm/assets/owned/with_contract_type_v3.json +0 -1
- ethpm/assets/registry/contracts/Authority.sol +0 -156
- ethpm/assets/registry/contracts/IndexedOrderedSetLib.sol +0 -106
- ethpm/assets/registry/contracts/PackageDB.sol +0 -225
- ethpm/assets/registry/contracts/PackageRegistry.sol +0 -361
- ethpm/assets/registry/contracts/PackageRegistryInterface.sol +0 -97
- ethpm/assets/registry/contracts/ReleaseDB.sol +0 -309
- ethpm/assets/registry/contracts/ReleaseValidator.sol +0 -152
- ethpm/assets/registry/solc_input.json +0 -1
- ethpm/assets/registry/solc_output.json +0 -1
- ethpm/assets/registry/v3.json +0 -1
- ethpm/assets/safe-math-lib/v3-strict-no-deployments.json +0 -1
- ethpm/assets/simple-registry/contracts/Ownable.sol +0 -63
- ethpm/assets/simple-registry/contracts/PackageRegistry.sol +0 -373
- ethpm/assets/simple-registry/contracts/PackageRegistryInterface.sol +0 -96
- ethpm/assets/simple-registry/solc_input.json +0 -33
- ethpm/assets/simple-registry/solc_output.json +0 -1
- ethpm/assets/simple-registry/v3.json +0 -1
- ethpm/assets/standard-token/output_v3.json +0 -1
- ethpm/assets/standard-token/with_bytecode_v3.json +0 -1
- ethpm/assets/vyper_registry/0.1.0.json +0 -1
- ethpm/assets/vyper_registry/registry.vy +0 -216
- ethpm/assets/vyper_registry/registry_with_delete.vy +0 -244
- ethpm/backends/__init__.py +0 -0
- ethpm/backends/base.py +0 -43
- ethpm/backends/http.py +0 -108
- ethpm/backends/ipfs.py +0 -219
- ethpm/backends/registry.py +0 -154
- ethpm/constants.py +0 -17
- ethpm/contract.py +0 -187
- ethpm/dependencies.py +0 -58
- ethpm/deployments.py +0 -80
- ethpm/ethpm-spec/examples/escrow/1.0.0-pretty.json +0 -146
- ethpm/ethpm-spec/examples/escrow/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/escrow/contracts/Escrow.sol +0 -32
- ethpm/ethpm-spec/examples/escrow/contracts/SafeSendLib.sol +0 -20
- ethpm/ethpm-spec/examples/escrow/v3-pretty.json +0 -171
- ethpm/ethpm-spec/examples/escrow/v3.json +0 -1
- ethpm/ethpm-spec/examples/owned/1.0.0-pretty.json +0 -21
- ethpm/ethpm-spec/examples/owned/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/owned/contracts/Owned.sol +0 -12
- ethpm/ethpm-spec/examples/owned/v3-pretty.json +0 -27
- ethpm/ethpm-spec/examples/owned/v3.json +0 -1
- ethpm/ethpm-spec/examples/piper-coin/1.0.0-pretty.json +0 -31
- ethpm/ethpm-spec/examples/piper-coin/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/piper-coin/v3-pretty.json +0 -21
- ethpm/ethpm-spec/examples/piper-coin/v3.json +0 -1
- ethpm/ethpm-spec/examples/safe-math-lib/1.0.0-pretty.json +0 -85
- ethpm/ethpm-spec/examples/safe-math-lib/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/safe-math-lib/contracts/SafeMathLib.sol +0 -24
- ethpm/ethpm-spec/examples/safe-math-lib/v3-pretty.json +0 -117
- ethpm/ethpm-spec/examples/safe-math-lib/v3.json +0 -1
- ethpm/ethpm-spec/examples/standard-token/1.0.0-pretty.json +0 -55
- ethpm/ethpm-spec/examples/standard-token/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/standard-token/contracts/AbstractToken.sol +0 -20
- ethpm/ethpm-spec/examples/standard-token/contracts/StandardToken.sol +0 -84
- ethpm/ethpm-spec/examples/standard-token/v3-pretty.json +0 -460
- ethpm/ethpm-spec/examples/standard-token/v3.json +0 -1
- ethpm/ethpm-spec/examples/transferable/1.0.0-pretty.json +0 -21
- ethpm/ethpm-spec/examples/transferable/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/transferable/contracts/Transferable.sol +0 -14
- ethpm/ethpm-spec/examples/transferable/v3-pretty.json +0 -27
- ethpm/ethpm-spec/examples/transferable/v3.json +0 -1
- ethpm/ethpm-spec/examples/wallet/1.0.0-pretty.json +0 -120
- ethpm/ethpm-spec/examples/wallet/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/wallet/contracts/Wallet.sol +0 -41
- ethpm/ethpm-spec/examples/wallet/v3-pretty.json +0 -181
- ethpm/ethpm-spec/examples/wallet/v3.json +0 -1
- ethpm/ethpm-spec/examples/wallet-with-send/1.0.0-pretty.json +0 -135
- ethpm/ethpm-spec/examples/wallet-with-send/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/wallet-with-send/contracts/WalletWithSend.sol +0 -18
- ethpm/ethpm-spec/examples/wallet-with-send/v3-pretty.json +0 -207
- ethpm/ethpm-spec/examples/wallet-with-send/v3.json +0 -1
- ethpm/ethpm-spec/spec/package.spec.json +0 -379
- ethpm/ethpm-spec/spec/v3.spec.json +0 -483
- ethpm/exceptions.py +0 -68
- ethpm/package.py +0 -438
- ethpm/tools/__init__.py +0 -4
- ethpm/tools/builder.py +0 -930
- ethpm/tools/checker.py +0 -312
- ethpm/tools/get_manifest.py +0 -19
- ethpm/uri.py +0 -141
- ethpm/validation/__init__.py +0 -0
- ethpm/validation/manifest.py +0 -146
- ethpm/validation/misc.py +0 -39
- ethpm/validation/package.py +0 -80
- ethpm/validation/uri.py +0 -163
- web3/_utils/contract_sources/contract_data/address_reflector.py +0 -29
- web3/_utils/miner.py +0 -88
- web3/_utils/module_testing/go_ethereum_personal_module.py +0 -323
- web3/_utils/request.py +0 -265
- web3/middleware/abi.py +0 -11
- web3/middleware/async_cache.py +0 -99
- web3/middleware/cache.py +0 -374
- web3/middleware/exception_handling.py +0 -49
- web3/middleware/exception_retry_request.py +0 -188
- web3/middleware/fixture.py +0 -190
- web3/middleware/geth_poa.py +0 -81
- web3/middleware/normalize_request_parameters.py +0 -11
- web3/middleware/simulate_unmined_transaction.py +0 -43
- web3/pm.py +0 -602
- web3/providers/async_rpc.py +0 -99
- web3/providers/rpc.py +0 -98
- web3/providers/websocket/__init__.py +0 -11
- web3/providers/websocket/websocket_connection.py +0 -42
- web3/tools/__init__.py +0 -4
- web3/tools/pytest_ethereum/__init__.py +0 -0
- web3/tools/pytest_ethereum/_utils.py +0 -145
- web3/tools/pytest_ethereum/deployer.py +0 -48
- web3/tools/pytest_ethereum/exceptions.py +0 -22
- web3/tools/pytest_ethereum/linker.py +0 -128
- web3/tools/pytest_ethereum/plugins.py +0 -33
- web3-6.20.2.dist-info/METADATA +0 -103
- web3-6.20.2.dist-info/RECORD +0 -283
- web3-6.20.2.dist-info/entry_points.txt +0 -2
- /web3/_utils/{function_identifiers.py → abi_element_identifiers.py} +0 -0
|
@@ -24,6 +24,9 @@ from web3._utils.utility_methods import (
|
|
|
24
24
|
from web3.constants import (
|
|
25
25
|
DYNAMIC_FEE_TXN_PARAMS,
|
|
26
26
|
)
|
|
27
|
+
from web3.exceptions import (
|
|
28
|
+
Web3ValueError,
|
|
29
|
+
)
|
|
27
30
|
from web3.types import (
|
|
28
31
|
BlockIdentifier,
|
|
29
32
|
TxData,
|
|
@@ -87,7 +90,7 @@ async def get_buffered_gas_estimate(
|
|
|
87
90
|
gas_limit = await get_block_gas_limit(async_w3.eth)
|
|
88
91
|
|
|
89
92
|
if gas_estimate > gas_limit:
|
|
90
|
-
raise
|
|
93
|
+
raise Web3ValueError(
|
|
91
94
|
"Contract does not appear to be deployable within the "
|
|
92
95
|
f"current network gas limits. Estimated: {gas_estimate}. "
|
|
93
96
|
f"Current gas limit: {gas_limit}"
|
|
@@ -110,7 +113,7 @@ async def async_fill_transaction_defaults(
|
|
|
110
113
|
async_w3: "AsyncWeb3", transaction: TxParams
|
|
111
114
|
) -> TxParams:
|
|
112
115
|
"""
|
|
113
|
-
|
|
116
|
+
If async_w3 is None, fill as much as possible while offline
|
|
114
117
|
"""
|
|
115
118
|
strategy_based_gas_price = async_w3.eth.generate_gas_price(transaction)
|
|
116
119
|
|
|
@@ -134,7 +137,7 @@ async def async_fill_transaction_defaults(
|
|
|
134
137
|
|
|
135
138
|
if callable(default_getter):
|
|
136
139
|
if async_w3 is None:
|
|
137
|
-
raise
|
|
140
|
+
raise Web3ValueError(
|
|
138
141
|
f"You must specify a '{key}' value in the transaction"
|
|
139
142
|
)
|
|
140
143
|
if key == "gasPrice":
|
|
@@ -155,7 +158,7 @@ async def async_get_required_transaction(
|
|
|
155
158
|
) -> TxData:
|
|
156
159
|
current_transaction = await async_w3.eth.get_transaction(transaction_hash)
|
|
157
160
|
if not current_transaction:
|
|
158
|
-
raise
|
|
161
|
+
raise Web3ValueError(
|
|
159
162
|
f"Supplied transaction with hash {transaction_hash!r} does not exist"
|
|
160
163
|
)
|
|
161
164
|
return current_transaction
|
web3/_utils/batching.py
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
from copy import (
|
|
2
|
+
copy,
|
|
3
|
+
)
|
|
4
|
+
from types import (
|
|
5
|
+
TracebackType,
|
|
6
|
+
)
|
|
7
|
+
from typing import (
|
|
8
|
+
TYPE_CHECKING,
|
|
9
|
+
Any,
|
|
10
|
+
Callable,
|
|
11
|
+
Coroutine,
|
|
12
|
+
Dict,
|
|
13
|
+
Generic,
|
|
14
|
+
List,
|
|
15
|
+
Sequence,
|
|
16
|
+
Tuple,
|
|
17
|
+
Type,
|
|
18
|
+
Union,
|
|
19
|
+
cast,
|
|
20
|
+
)
|
|
21
|
+
import warnings
|
|
22
|
+
|
|
23
|
+
from web3._utils.compat import (
|
|
24
|
+
Self,
|
|
25
|
+
)
|
|
26
|
+
from web3.contract.async_contract import (
|
|
27
|
+
AsyncContractFunction,
|
|
28
|
+
)
|
|
29
|
+
from web3.contract.contract import (
|
|
30
|
+
ContractFunction,
|
|
31
|
+
)
|
|
32
|
+
from web3.exceptions import (
|
|
33
|
+
Web3ValueError,
|
|
34
|
+
)
|
|
35
|
+
from web3.types import (
|
|
36
|
+
TFunc,
|
|
37
|
+
TReturn,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
if TYPE_CHECKING:
|
|
41
|
+
from web3 import ( # noqa: F401
|
|
42
|
+
AsyncWeb3,
|
|
43
|
+
Web3,
|
|
44
|
+
)
|
|
45
|
+
from web3.method import ( # noqa: F401
|
|
46
|
+
Method,
|
|
47
|
+
)
|
|
48
|
+
from web3.providers import ( # noqa: F401
|
|
49
|
+
PersistentConnectionProvider,
|
|
50
|
+
)
|
|
51
|
+
from web3.providers.async_base import ( # noqa: F401
|
|
52
|
+
AsyncJSONBaseProvider,
|
|
53
|
+
)
|
|
54
|
+
from web3.providers.base import ( # noqa: F401
|
|
55
|
+
JSONBaseProvider,
|
|
56
|
+
)
|
|
57
|
+
from web3.types import ( # noqa: F401
|
|
58
|
+
RPCEndpoint,
|
|
59
|
+
RPCResponse,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
BATCH_REQUEST_ID = "batch_request" # for use as the cache key for batch requests
|
|
64
|
+
|
|
65
|
+
BatchRequestInformation = Tuple[Tuple["RPCEndpoint", Any], Sequence[Any]]
|
|
66
|
+
RPC_METHODS_UNSUPPORTED_DURING_BATCH = {
|
|
67
|
+
"eth_subscribe",
|
|
68
|
+
"eth_unsubscribe",
|
|
69
|
+
"eth_sendRawTransaction",
|
|
70
|
+
"eth_sendTransaction",
|
|
71
|
+
"eth_signTransaction",
|
|
72
|
+
"eth_sign",
|
|
73
|
+
"eth_signTypedData",
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class RequestBatcher(Generic[TFunc]):
|
|
78
|
+
def __init__(self, web3: Union["AsyncWeb3", "Web3"]) -> None:
|
|
79
|
+
self.web3 = web3
|
|
80
|
+
self._requests_info: List[BatchRequestInformation] = []
|
|
81
|
+
self._async_requests_info: List[
|
|
82
|
+
Coroutine[Any, Any, BatchRequestInformation]
|
|
83
|
+
] = []
|
|
84
|
+
self._initialize_batching()
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def _provider(self) -> Union["JSONBaseProvider", "AsyncJSONBaseProvider"]:
|
|
88
|
+
return (
|
|
89
|
+
cast("AsyncJSONBaseProvider", self.web3.provider)
|
|
90
|
+
if self.web3.provider.is_async
|
|
91
|
+
else cast("JSONBaseProvider", self.web3.provider)
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
def _validate_is_batching(self) -> None:
|
|
95
|
+
if not self._provider._is_batching:
|
|
96
|
+
raise Web3ValueError(
|
|
97
|
+
"Batch has already been executed or cancelled. Create a new batch to "
|
|
98
|
+
"issue batched requests."
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
def _initialize_batching(self) -> None:
|
|
102
|
+
self._provider._is_batching = True
|
|
103
|
+
self.clear()
|
|
104
|
+
|
|
105
|
+
def _end_batching(self) -> None:
|
|
106
|
+
self.clear()
|
|
107
|
+
self._provider._is_batching = False
|
|
108
|
+
if self._provider.has_persistent_connection:
|
|
109
|
+
provider = cast("PersistentConnectionProvider", self._provider)
|
|
110
|
+
provider._batch_request_counter = None
|
|
111
|
+
|
|
112
|
+
def add(self, batch_payload: TReturn) -> None:
|
|
113
|
+
self._validate_is_batching()
|
|
114
|
+
|
|
115
|
+
if isinstance(batch_payload, (ContractFunction, AsyncContractFunction)):
|
|
116
|
+
batch_payload = batch_payload.call() # type: ignore
|
|
117
|
+
|
|
118
|
+
# When batching, we don't make a request. Instead, we will get the request
|
|
119
|
+
# information and store it in the `_requests_info` list. So we have to cast the
|
|
120
|
+
# apparent "request" into the BatchRequestInformation type.
|
|
121
|
+
if self._provider.is_async:
|
|
122
|
+
self._async_requests_info.append(
|
|
123
|
+
cast(Coroutine[Any, Any, BatchRequestInformation], batch_payload)
|
|
124
|
+
)
|
|
125
|
+
else:
|
|
126
|
+
self._requests_info.append(cast(BatchRequestInformation, batch_payload))
|
|
127
|
+
|
|
128
|
+
def add_mapping(
|
|
129
|
+
self,
|
|
130
|
+
batch_payload: Dict[
|
|
131
|
+
Union[
|
|
132
|
+
"Method[Callable[..., Any]]",
|
|
133
|
+
Callable[..., Any],
|
|
134
|
+
ContractFunction,
|
|
135
|
+
AsyncContractFunction,
|
|
136
|
+
],
|
|
137
|
+
List[Any],
|
|
138
|
+
],
|
|
139
|
+
) -> None:
|
|
140
|
+
self._validate_is_batching()
|
|
141
|
+
for method, params in batch_payload.items():
|
|
142
|
+
for param in params:
|
|
143
|
+
self.add(method(param))
|
|
144
|
+
|
|
145
|
+
def execute(self) -> List["RPCResponse"]:
|
|
146
|
+
self._validate_is_batching()
|
|
147
|
+
responses = self.web3.manager._make_batch_request(self._requests_info)
|
|
148
|
+
self._end_batching()
|
|
149
|
+
return responses
|
|
150
|
+
|
|
151
|
+
def clear(self) -> None:
|
|
152
|
+
self._requests_info = []
|
|
153
|
+
self._async_requests_info = []
|
|
154
|
+
if self._provider.has_persistent_connection:
|
|
155
|
+
provider = cast("PersistentConnectionProvider", self._provider)
|
|
156
|
+
provider._batch_request_counter = next(copy(provider.request_counter))
|
|
157
|
+
|
|
158
|
+
def cancel(self) -> None:
|
|
159
|
+
self._end_batching()
|
|
160
|
+
|
|
161
|
+
# -- context manager -- #
|
|
162
|
+
|
|
163
|
+
def __enter__(self) -> Self:
|
|
164
|
+
self._initialize_batching()
|
|
165
|
+
return self
|
|
166
|
+
|
|
167
|
+
def __exit__(
|
|
168
|
+
self,
|
|
169
|
+
exc_type: Type[BaseException],
|
|
170
|
+
exc_val: BaseException,
|
|
171
|
+
exc_tb: TracebackType,
|
|
172
|
+
) -> None:
|
|
173
|
+
self._end_batching()
|
|
174
|
+
|
|
175
|
+
# -- async -- #
|
|
176
|
+
|
|
177
|
+
async def async_execute(self) -> List["RPCResponse"]:
|
|
178
|
+
self._validate_is_batching()
|
|
179
|
+
responses = await self.web3.manager._async_make_batch_request(
|
|
180
|
+
self._async_requests_info
|
|
181
|
+
)
|
|
182
|
+
self._end_batching()
|
|
183
|
+
return responses
|
|
184
|
+
|
|
185
|
+
# -- async context manager -- #
|
|
186
|
+
|
|
187
|
+
async def __aenter__(self) -> Self:
|
|
188
|
+
self._initialize_batching()
|
|
189
|
+
return self
|
|
190
|
+
|
|
191
|
+
async def __aexit__(
|
|
192
|
+
self,
|
|
193
|
+
exc_type: Type[BaseException],
|
|
194
|
+
exc_val: BaseException,
|
|
195
|
+
exc_tb: TracebackType,
|
|
196
|
+
) -> None:
|
|
197
|
+
self._end_batching()
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def sort_batch_response_by_response_ids(
|
|
201
|
+
responses: List["RPCResponse"],
|
|
202
|
+
) -> List["RPCResponse"]:
|
|
203
|
+
if all(response.get("id") is not None for response in responses):
|
|
204
|
+
# If all responses have an `id`, sort them by `id, since the JSON-RPC 2.0 spec
|
|
205
|
+
# doesn't guarantee order.
|
|
206
|
+
return sorted(responses, key=lambda response: response["id"])
|
|
207
|
+
else:
|
|
208
|
+
# If any response is missing an `id`, which should only happen on particular
|
|
209
|
+
# errors, return them in the order they were received and hope that the
|
|
210
|
+
# provider is returning them in order. Issue a warning.
|
|
211
|
+
warnings.warn(
|
|
212
|
+
"Received batch response with missing `id` for one or more responses. "
|
|
213
|
+
"Relying on provider to return these responses in order.",
|
|
214
|
+
RuntimeWarning,
|
|
215
|
+
stacklevel=2,
|
|
216
|
+
)
|
|
217
|
+
return responses
|
web3/_utils/blocks.py
CHANGED
|
@@ -15,6 +15,10 @@ from eth_utils.toolz import (
|
|
|
15
15
|
curry,
|
|
16
16
|
)
|
|
17
17
|
|
|
18
|
+
from web3.exceptions import (
|
|
19
|
+
Web3TypeError,
|
|
20
|
+
Web3ValueError,
|
|
21
|
+
)
|
|
18
22
|
from web3.types import (
|
|
19
23
|
RPCEndpoint,
|
|
20
24
|
)
|
|
@@ -32,7 +36,7 @@ def is_predefined_block_number(value: Any) -> bool:
|
|
|
32
36
|
elif is_integer(value):
|
|
33
37
|
return False
|
|
34
38
|
else:
|
|
35
|
-
raise
|
|
39
|
+
raise Web3TypeError(f"unrecognized block reference: {value!r}")
|
|
36
40
|
|
|
37
41
|
return value_text in {"latest", "pending", "earliest", "safe", "finalized"}
|
|
38
42
|
|
|
@@ -70,6 +74,6 @@ def select_method_for_block_identifier(
|
|
|
70
74
|
elif is_hex_encoded_block_number(value):
|
|
71
75
|
return if_number
|
|
72
76
|
else:
|
|
73
|
-
raise
|
|
77
|
+
raise Web3ValueError(
|
|
74
78
|
f"Value did not match any of the recognized block identifiers: {value}"
|
|
75
79
|
)
|
web3/_utils/caching.py
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import collections
|
|
2
2
|
import hashlib
|
|
3
|
+
import threading
|
|
3
4
|
from typing import (
|
|
4
5
|
TYPE_CHECKING,
|
|
5
6
|
Any,
|
|
6
7
|
Callable,
|
|
8
|
+
Coroutine,
|
|
9
|
+
Dict,
|
|
7
10
|
List,
|
|
11
|
+
Set,
|
|
8
12
|
Tuple,
|
|
13
|
+
TypeVar,
|
|
14
|
+
Union,
|
|
15
|
+
cast,
|
|
9
16
|
)
|
|
10
17
|
|
|
11
18
|
from eth_utils import (
|
|
@@ -19,12 +26,27 @@ from eth_utils import (
|
|
|
19
26
|
to_bytes,
|
|
20
27
|
)
|
|
21
28
|
|
|
29
|
+
from web3.exceptions import (
|
|
30
|
+
Web3TypeError,
|
|
31
|
+
)
|
|
32
|
+
|
|
22
33
|
if TYPE_CHECKING:
|
|
23
|
-
from web3.
|
|
34
|
+
from web3.providers import ( # noqa: F401
|
|
35
|
+
AsyncBaseProvider,
|
|
36
|
+
BaseProvider,
|
|
37
|
+
)
|
|
38
|
+
from web3.types import ( # noqa: F401
|
|
39
|
+
AsyncMakeRequestFn,
|
|
40
|
+
MakeRequestFn,
|
|
24
41
|
RPCEndpoint,
|
|
42
|
+
RPCResponse,
|
|
25
43
|
)
|
|
26
44
|
|
|
27
45
|
|
|
46
|
+
SYNC_PROVIDER_TYPE = TypeVar("SYNC_PROVIDER_TYPE", bound="BaseProvider")
|
|
47
|
+
ASYNC_PROVIDER_TYPE = TypeVar("ASYNC_PROVIDER_TYPE", bound="AsyncBaseProvider")
|
|
48
|
+
|
|
49
|
+
|
|
28
50
|
def generate_cache_key(value: Any) -> str:
|
|
29
51
|
"""
|
|
30
52
|
Generates a cache key for the *args and **kwargs
|
|
@@ -36,11 +58,11 @@ def generate_cache_key(value: Any) -> str:
|
|
|
36
58
|
elif is_boolean(value) or is_null(value) or is_number(value):
|
|
37
59
|
return generate_cache_key(repr(value))
|
|
38
60
|
elif is_dict(value):
|
|
39
|
-
return generate_cache_key((
|
|
61
|
+
return generate_cache_key((key, value[key]) for key in sorted(value.keys()))
|
|
40
62
|
elif is_list_like(value) or isinstance(value, collections.abc.Generator):
|
|
41
|
-
return generate_cache_key("".join(
|
|
63
|
+
return generate_cache_key("".join(generate_cache_key(item) for item in value))
|
|
42
64
|
else:
|
|
43
|
-
raise
|
|
65
|
+
raise Web3TypeError(
|
|
44
66
|
f"Cannot generate cache key for value {value} of type {type(value)}"
|
|
45
67
|
)
|
|
46
68
|
|
|
@@ -50,7 +72,11 @@ class RequestInformation:
|
|
|
50
72
|
self,
|
|
51
73
|
method: "RPCEndpoint",
|
|
52
74
|
params: Any,
|
|
53
|
-
response_formatters: Tuple[
|
|
75
|
+
response_formatters: Tuple[
|
|
76
|
+
Union[Dict[str, Callable[..., Any]], Callable[..., Any]],
|
|
77
|
+
Callable[..., Any],
|
|
78
|
+
Callable[..., Any],
|
|
79
|
+
],
|
|
54
80
|
subscription_id: str = None,
|
|
55
81
|
):
|
|
56
82
|
self.method = method
|
|
@@ -58,3 +84,100 @@ class RequestInformation:
|
|
|
58
84
|
self.response_formatters = response_formatters
|
|
59
85
|
self.subscription_id = subscription_id
|
|
60
86
|
self.middleware_response_processors: List[Callable[..., Any]] = []
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def is_cacheable_request(
|
|
90
|
+
provider: Union[ASYNC_PROVIDER_TYPE, SYNC_PROVIDER_TYPE], method: "RPCEndpoint"
|
|
91
|
+
) -> bool:
|
|
92
|
+
if provider.cache_allowed_requests and method in provider.cacheable_requests:
|
|
93
|
+
return True
|
|
94
|
+
return False
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# -- request caching -- #
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
CACHEABLE_REQUESTS = cast(
|
|
101
|
+
Set["RPCEndpoint"],
|
|
102
|
+
(
|
|
103
|
+
"eth_chainId",
|
|
104
|
+
"eth_getBlockByHash",
|
|
105
|
+
"eth_getBlockTransactionCountByHash",
|
|
106
|
+
"eth_getRawTransactionByHash",
|
|
107
|
+
"eth_getTransactionByBlockHashAndIndex",
|
|
108
|
+
"eth_getTransactionByHash",
|
|
109
|
+
"eth_getUncleByBlockHashAndIndex",
|
|
110
|
+
"eth_getUncleCountByBlockHash",
|
|
111
|
+
"net_version",
|
|
112
|
+
"web3_clientVersion",
|
|
113
|
+
),
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def _should_cache_response(response: "RPCResponse") -> bool:
|
|
118
|
+
return (
|
|
119
|
+
"error" not in response
|
|
120
|
+
and "result" in response
|
|
121
|
+
and not is_null(response["result"])
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def handle_request_caching(
|
|
126
|
+
func: Callable[[SYNC_PROVIDER_TYPE, "RPCEndpoint", Any], "RPCResponse"]
|
|
127
|
+
) -> Callable[..., "RPCResponse"]:
|
|
128
|
+
def wrapper(
|
|
129
|
+
provider: SYNC_PROVIDER_TYPE, method: "RPCEndpoint", params: Any
|
|
130
|
+
) -> "RPCResponse":
|
|
131
|
+
if is_cacheable_request(provider, method):
|
|
132
|
+
request_cache = provider._request_cache
|
|
133
|
+
cache_key = generate_cache_key(
|
|
134
|
+
f"{threading.get_ident()}:{(method, params)}"
|
|
135
|
+
)
|
|
136
|
+
cache_result = request_cache.get_cache_entry(cache_key)
|
|
137
|
+
if cache_result is not None:
|
|
138
|
+
return cache_result
|
|
139
|
+
else:
|
|
140
|
+
response = func(provider, method, params)
|
|
141
|
+
if _should_cache_response(response):
|
|
142
|
+
with provider._request_cache_lock:
|
|
143
|
+
request_cache.cache(cache_key, response)
|
|
144
|
+
return response
|
|
145
|
+
else:
|
|
146
|
+
return func(provider, method, params)
|
|
147
|
+
|
|
148
|
+
# save a reference to the decorator on the wrapped function
|
|
149
|
+
wrapper._decorator = handle_request_caching # type: ignore
|
|
150
|
+
return wrapper
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
# -- async -- #
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def async_handle_request_caching(
|
|
157
|
+
func: Callable[
|
|
158
|
+
[ASYNC_PROVIDER_TYPE, "RPCEndpoint", Any], Coroutine[Any, Any, "RPCResponse"]
|
|
159
|
+
],
|
|
160
|
+
) -> Callable[..., Coroutine[Any, Any, "RPCResponse"]]:
|
|
161
|
+
async def wrapper(
|
|
162
|
+
provider: ASYNC_PROVIDER_TYPE, method: "RPCEndpoint", params: Any
|
|
163
|
+
) -> "RPCResponse":
|
|
164
|
+
if is_cacheable_request(provider, method):
|
|
165
|
+
request_cache = provider._request_cache
|
|
166
|
+
cache_key = generate_cache_key(
|
|
167
|
+
f"{threading.get_ident()}:{(method, params)}"
|
|
168
|
+
)
|
|
169
|
+
cache_result = request_cache.get_cache_entry(cache_key)
|
|
170
|
+
if cache_result is not None:
|
|
171
|
+
return cache_result
|
|
172
|
+
else:
|
|
173
|
+
response = await func(provider, method, params)
|
|
174
|
+
if _should_cache_response(response):
|
|
175
|
+
async with provider._request_cache_lock:
|
|
176
|
+
request_cache.cache(cache_key, response)
|
|
177
|
+
return response
|
|
178
|
+
else:
|
|
179
|
+
return await func(provider, method, params)
|
|
180
|
+
|
|
181
|
+
# save a reference to the decorator on the wrapped function
|
|
182
|
+
wrapper._decorator = async_handle_request_caching # type: ignore
|
|
183
|
+
return wrapper
|
web3/_utils/compat/__init__.py
CHANGED
|
@@ -116,7 +116,7 @@ contracts_in_file = {}
|
|
|
116
116
|
|
|
117
117
|
def compile_files(file_list: List[str]) -> None:
|
|
118
118
|
for filename in file_list:
|
|
119
|
-
with open(os.path.join(os.getcwd(), filename)
|
|
119
|
+
with open(os.path.join(os.getcwd(), filename)) as f:
|
|
120
120
|
dot_sol_file = f.readlines()
|
|
121
121
|
|
|
122
122
|
contract_names = []
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Generated by `compile_contracts.py` script.
|
|
3
|
-
Compiled with Solidity v0.8.
|
|
3
|
+
Compiled with Solidity v0.8.26.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
# source: web3/_utils/contract_sources/ArraysContract.sol:ArraysContract
|
|
7
|
-
ARRAYS_CONTRACT_BYTECODE = "
|
|
8
|
-
ARRAYS_CONTRACT_RUNTIME = "
|
|
7
|
+
ARRAYS_CONTRACT_BYTECODE = "0x608060405260405180604001604052807f03783fac2efed8fbc9ad443e592ee30e61d65f471140c10ca155e937b435b76081526020017f1f675bff07515f5df96737194ea945c36c41e7b4fcef307b7cd4d0e602a691118152506001906002610069929190610199565b5060405180604001604052805f7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020017f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681525060039060026101379291906101e4565b50348015610143575f80fd5b5060405161128238038061128283398181016040528101906101659190610652565b815f908051906020019061017a929190610286565b5080600290805190602001906101919291906102d1565b5050506106c8565b828054828255905f5260205f209081019282156101d3579160200282015b828111156101d25782518255916020019190600101906101b7565b5b5090506101e09190610373565b5090565b828054828255905f5260205f2090601f01602090048101928215610275579160200282015f5b8382111561024757835183826101000a81548160ff021916908360f81c021790555092602001926001016020815f0104928301926001030261020a565b80156102735782816101000a81549060ff02191690556001016020815f01049283019260010302610247565b505b509050610282919061038e565b5090565b828054828255905f5260205f209081019282156102c0579160200282015b828111156102bf5782518255916020019190600101906102a4565b5b5090506102cd9190610373565b5090565b828054828255905f5260205f2090601f01602090048101928215610362579160200282015f5b8382111561033457835183826101000a81548160ff021916908360f81c021790555092602001926001016020815f010492830192600103026102f7565b80156103605782816101000a81549060ff02191690556001016020815f01049283019260010302610334565b505b50905061036f919061038e565b5090565b5b8082111561038a575f815f905550600101610374565b5090565b5b808211156103a5575f815f90555060010161038f565b5090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610404826103be565b810181811067ffffffffffffffff82111715610423576104226103ce565b5b80604052505050565b5f6104356103a9565b905061044182826103fb565b919050565b5f67ffffffffffffffff8211156104605761045f6103ce565b5b602082029050602081019050919050565b5f80fd5b5f819050919050565b61048781610475565b8114610491575f80fd5b50565b5f815190506104a28161047e565b92915050565b5f6104ba6104b584610446565b61042c565b905080838252602082019050602084028301858111156104dd576104dc610471565b5b835b8181101561050657806104f28882610494565b8452602084019350506020810190506104df565b5050509392505050565b5f82601f830112610524576105236103ba565b5b81516105348482602086016104a8565b91505092915050565b5f67ffffffffffffffff821115610557576105566103ce565b5b602082029050602081019050919050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b61059c81610568565b81146105a6575f80fd5b50565b5f815190506105b781610593565b92915050565b5f6105cf6105ca8461053d565b61042c565b905080838252602082019050602084028301858111156105f2576105f1610471565b5b835b8181101561061b578061060788826105a9565b8452602084019350506020810190506105f4565b5050509392505050565b5f82601f830112610639576106386103ba565b5b81516106498482602086016105bd565b91505092915050565b5f8060408385031215610668576106676103b2565b5b5f83015167ffffffffffffffff811115610685576106846103b6565b5b61069185828601610510565b925050602083015167ffffffffffffffff8111156106b2576106b16103b6565b5b6106be85828601610625565b9150509250929050565b610bad806106d55f395ff3fe608060405234801561000f575f80fd5b506004361061009c575f3560e01c8063542d83de11610064578063542d83de14610158578063605ba271146101885780638abe51fd146101a6578063962e450c146101c4578063bb69679b146101f45761009c565b80630afe5e33146100a057806312c9dcc8146100be5780631579bf66146100ee5780633ddcea2f1461010c57806351b4878814610128575b5f80fd5b6100a8610210565b6040516100b591906106a4565b60405180910390f35b6100d860048036038101906100d39190610708565b610266565b6040516100e5919061076d565b60405180910390f35b6100f6610297565b604051610103919061083d565b60405180910390f35b610126600480360381019061012191906109d7565b610330565b005b610142600480360381019061013d9190610708565b61034a565b60405161014f9190610a2d565b60405180910390f35b610172600480360381019061016d9190610708565b61036a565b60405161017f9190610a2d565b60405180910390f35b610190610389565b60405161019d91906106a4565b60405180910390f35b6101ae6103de565b6040516101bb919061083d565b60405180910390f35b6101de60048036038101906101d99190610708565b610477565b6040516101eb919061076d565b60405180910390f35b61020e60048036038101906102099190610b30565b6104a8565b005b6060600180548060200260200160405190810160405280929190818152602001828054801561025c57602002820191905f5260205f20905b815481526020019060010190808311610248575b5050505050905090565b60028181548110610275575f80fd5b905f5260205f209060209182820401919006915054906101000a900460f81b81565b6060600380548060200260200160405190810160405280929190818152602001828054801561032657602002820191905f5260205f20905f905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020825f010492830192600103820291508084116102d15790505b5050505050905090565b80600290805190602001906103469291906104c1565b5050565b60018181548110610359575f80fd5b905f5260205f20015f915090505481565b5f8181548110610378575f80fd5b905f5260205f20015f915090505481565b60605f8054806020026020016040519081016040528092919081815260200182805480156103d457602002820191905f5260205f20905b8154815260200190600101908083116103c0575b5050505050905090565b6060600280548060200260200160405190810160405280929190818152602001828054801561046d57602002820191905f5260205f20905f905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020825f010492830192600103820291508084116104185790505b5050505050905090565b60038181548110610486575f80fd5b905f5260205f209060209182820401919006915054906101000a900460f81b81565b805f90805190602001906104bd929190610563565b5050565b828054828255905f5260205f2090601f01602090048101928215610552579160200282015f5b8382111561052457835183826101000a81548160ff021916908360f81c021790555092602001926001016020815f010492830192600103026104e7565b80156105505782816101000a81549060ff02191690556001016020815f01049283019260010302610524565b505b50905061055f91906105ae565b5090565b828054828255905f5260205f2090810192821561059d579160200282015b8281111561059c578251825591602001919060010190610581565b5b5090506105aa91906105c9565b5090565b5b808211156105c5575f815f9055506001016105af565b5090565b5b808211156105e0575f815f9055506001016105ca565b5090565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f819050919050565b61061f8161060d565b82525050565b5f6106308383610616565b60208301905092915050565b5f602082019050919050565b5f610652826105e4565b61065c81856105ee565b9350610667836105fe565b805f5b8381101561069757815161067e8882610625565b97506106898361063c565b92505060018101905061066a565b5085935050505092915050565b5f6020820190508181035f8301526106bc8184610648565b905092915050565b5f604051905090565b5f80fd5b5f80fd5b5f819050919050565b6106e7816106d5565b81146106f1575f80fd5b50565b5f81359050610702816106de565b92915050565b5f6020828403121561071d5761071c6106cd565b5b5f61072a848285016106f4565b91505092915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b61076781610733565b82525050565b5f6020820190506107805f83018461075e565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6107b881610733565b82525050565b5f6107c983836107af565b60208301905092915050565b5f602082019050919050565b5f6107eb82610786565b6107f58185610790565b9350610800836107a0565b805f5b8381101561083057815161081788826107be565b9750610822836107d5565b925050600181019050610803565b5085935050505092915050565b5f6020820190508181035f83015261085581846107e1565b905092915050565b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6108a782610861565b810181811067ffffffffffffffff821117156108c6576108c5610871565b5b80604052505050565b5f6108d86106c4565b90506108e4828261089e565b919050565b5f67ffffffffffffffff82111561090357610902610871565b5b602082029050602081019050919050565b5f80fd5b61092181610733565b811461092b575f80fd5b50565b5f8135905061093c81610918565b92915050565b5f61095461094f846108e9565b6108cf565b9050808382526020820190506020840283018581111561097757610976610914565b5b835b818110156109a0578061098c888261092e565b845260208401935050602081019050610979565b5050509392505050565b5f82601f8301126109be576109bd61085d565b5b81356109ce848260208601610942565b91505092915050565b5f602082840312156109ec576109eb6106cd565b5b5f82013567ffffffffffffffff811115610a0957610a086106d1565b5b610a15848285016109aa565b91505092915050565b610a278161060d565b82525050565b5f602082019050610a405f830184610a1e565b92915050565b5f67ffffffffffffffff821115610a6057610a5f610871565b5b602082029050602081019050919050565b610a7a8161060d565b8114610a84575f80fd5b50565b5f81359050610a9581610a71565b92915050565b5f610aad610aa884610a46565b6108cf565b90508083825260208201905060208402830185811115610ad057610acf610914565b5b835b81811015610af95780610ae58882610a87565b845260208401935050602081019050610ad2565b5050509392505050565b5f82601f830112610b1757610b1661085d565b5b8135610b27848260208601610a9b565b91505092915050565b5f60208284031215610b4557610b446106cd565b5b5f82013567ffffffffffffffff811115610b6257610b616106d1565b5b610b6e84828501610b03565b9150509291505056fea264697066735822122035b4ca065fb4b2225e9da7d552026e146f1eadfb8571c9eaeddbfffdf9f7c68d64736f6c634300081a0033" # noqa: E501
|
|
8
|
+
ARRAYS_CONTRACT_RUNTIME = "0x608060405234801561000f575f80fd5b506004361061009c575f3560e01c8063542d83de11610064578063542d83de14610158578063605ba271146101885780638abe51fd146101a6578063962e450c146101c4578063bb69679b146101f45761009c565b80630afe5e33146100a057806312c9dcc8146100be5780631579bf66146100ee5780633ddcea2f1461010c57806351b4878814610128575b5f80fd5b6100a8610210565b6040516100b591906106a4565b60405180910390f35b6100d860048036038101906100d39190610708565b610266565b6040516100e5919061076d565b60405180910390f35b6100f6610297565b604051610103919061083d565b60405180910390f35b610126600480360381019061012191906109d7565b610330565b005b610142600480360381019061013d9190610708565b61034a565b60405161014f9190610a2d565b60405180910390f35b610172600480360381019061016d9190610708565b61036a565b60405161017f9190610a2d565b60405180910390f35b610190610389565b60405161019d91906106a4565b60405180910390f35b6101ae6103de565b6040516101bb919061083d565b60405180910390f35b6101de60048036038101906101d99190610708565b610477565b6040516101eb919061076d565b60405180910390f35b61020e60048036038101906102099190610b30565b6104a8565b005b6060600180548060200260200160405190810160405280929190818152602001828054801561025c57602002820191905f5260205f20905b815481526020019060010190808311610248575b5050505050905090565b60028181548110610275575f80fd5b905f5260205f209060209182820401919006915054906101000a900460f81b81565b6060600380548060200260200160405190810160405280929190818152602001828054801561032657602002820191905f5260205f20905f905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020825f010492830192600103820291508084116102d15790505b5050505050905090565b80600290805190602001906103469291906104c1565b5050565b60018181548110610359575f80fd5b905f5260205f20015f915090505481565b5f8181548110610378575f80fd5b905f5260205f20015f915090505481565b60605f8054806020026020016040519081016040528092919081815260200182805480156103d457602002820191905f5260205f20905b8154815260200190600101908083116103c0575b5050505050905090565b6060600280548060200260200160405190810160405280929190818152602001828054801561046d57602002820191905f5260205f20905f905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020825f010492830192600103820291508084116104185790505b5050505050905090565b60038181548110610486575f80fd5b905f5260205f209060209182820401919006915054906101000a900460f81b81565b805f90805190602001906104bd929190610563565b5050565b828054828255905f5260205f2090601f01602090048101928215610552579160200282015f5b8382111561052457835183826101000a81548160ff021916908360f81c021790555092602001926001016020815f010492830192600103026104e7565b80156105505782816101000a81549060ff02191690556001016020815f01049283019260010302610524565b505b50905061055f91906105ae565b5090565b828054828255905f5260205f2090810192821561059d579160200282015b8281111561059c578251825591602001919060010190610581565b5b5090506105aa91906105c9565b5090565b5b808211156105c5575f815f9055506001016105af565b5090565b5b808211156105e0575f815f9055506001016105ca565b5090565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f819050919050565b61061f8161060d565b82525050565b5f6106308383610616565b60208301905092915050565b5f602082019050919050565b5f610652826105e4565b61065c81856105ee565b9350610667836105fe565b805f5b8381101561069757815161067e8882610625565b97506106898361063c565b92505060018101905061066a565b5085935050505092915050565b5f6020820190508181035f8301526106bc8184610648565b905092915050565b5f604051905090565b5f80fd5b5f80fd5b5f819050919050565b6106e7816106d5565b81146106f1575f80fd5b50565b5f81359050610702816106de565b92915050565b5f6020828403121561071d5761071c6106cd565b5b5f61072a848285016106f4565b91505092915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b61076781610733565b82525050565b5f6020820190506107805f83018461075e565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6107b881610733565b82525050565b5f6107c983836107af565b60208301905092915050565b5f602082019050919050565b5f6107eb82610786565b6107f58185610790565b9350610800836107a0565b805f5b8381101561083057815161081788826107be565b9750610822836107d5565b925050600181019050610803565b5085935050505092915050565b5f6020820190508181035f83015261085581846107e1565b905092915050565b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6108a782610861565b810181811067ffffffffffffffff821117156108c6576108c5610871565b5b80604052505050565b5f6108d86106c4565b90506108e4828261089e565b919050565b5f67ffffffffffffffff82111561090357610902610871565b5b602082029050602081019050919050565b5f80fd5b61092181610733565b811461092b575f80fd5b50565b5f8135905061093c81610918565b92915050565b5f61095461094f846108e9565b6108cf565b9050808382526020820190506020840283018581111561097757610976610914565b5b835b818110156109a0578061098c888261092e565b845260208401935050602081019050610979565b5050509392505050565b5f82601f8301126109be576109bd61085d565b5b81356109ce848260208601610942565b91505092915050565b5f602082840312156109ec576109eb6106cd565b5b5f82013567ffffffffffffffff811115610a0957610a086106d1565b5b610a15848285016109aa565b91505092915050565b610a278161060d565b82525050565b5f602082019050610a405f830184610a1e565b92915050565b5f67ffffffffffffffff821115610a6057610a5f610871565b5b602082029050602081019050919050565b610a7a8161060d565b8114610a84575f80fd5b50565b5f81359050610a9581610a71565b92915050565b5f610aad610aa884610a46565b6108cf565b90508083825260208201905060208402830185811115610ad057610acf610914565b5b835b81811015610af95780610ae58882610a87565b845260208401935050602081019050610ad2565b5050509392505050565b5f82601f830112610b1757610b1661085d565b5b8135610b27848260208601610a9b565b91505092915050565b5f60208284031215610b4557610b446106cd565b5b5f82013567ffffffffffffffff811115610b6257610b616106d1565b5b610b6e84828501610b03565b9150509291505056fea264697066735822122035b4ca065fb4b2225e9da7d552026e146f1eadfb8571c9eaeddbfffdf9f7c68d64736f6c634300081a0033" # noqa: E501
|
|
9
9
|
ARRAYS_CONTRACT_ABI = [
|
|
10
10
|
{
|
|
11
11
|
"inputs": [
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Generated by `compile_contracts.py` script.
|
|
3
|
-
Compiled with Solidity v0.8.
|
|
3
|
+
Compiled with Solidity v0.8.26.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
# source: web3/_utils/contract_sources/BytesContracts.sol:BytesContract
|
|
7
|
-
BYTES_CONTRACT_BYTECODE = "
|
|
8
|
-
BYTES_CONTRACT_RUNTIME = "
|
|
7
|
+
BYTES_CONTRACT_BYTECODE = "0x60806040526040518060400160405280600281526020017f01230000000000000000000000000000000000000000000000000000000000008152505f908161004791906102c5565b50348015610053575f80fd5b50604051610cca380380610cca833981810160405281019061007591906104b4565b80600190816100849190610505565b50506105d4565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061010657607f821691505b602082108103610119576101186100c2565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261017b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610140565b6101858683610140565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6101c96101c46101bf8461019d565b6101a6565b61019d565b9050919050565b5f819050919050565b6101e2836101af565b6101f66101ee826101d0565b84845461014c565b825550505050565b5f90565b61020a6101fe565b6102158184846101d9565b505050565b5b818110156102385761022d5f82610202565b60018101905061021b565b5050565b601f82111561027d5761024e8161011f565b61025784610131565b81016020851015610266578190505b61027a61027285610131565b83018261021a565b50505b505050565b5f82821c905092915050565b5f61029d5f1984600802610282565b1980831691505092915050565b5f6102b5838361028e565b9150826002028217905092915050565b6102ce8261008b565b67ffffffffffffffff8111156102e7576102e6610095565b5b6102f182546100ef565b6102fc82828561023c565b5f60209050601f83116001811461032d575f841561031b578287015190505b61032585826102aa565b86555061038c565b601f19841661033b8661011f565b5f5b828110156103625784890151825560018201915060208501945060208101905061033d565b8683101561037f578489015161037b601f89168261028e565b8355505b6001600288020188555050505b505050505050565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b6103c6826103ad565b810181811067ffffffffffffffff821117156103e5576103e4610095565b5b80604052505050565b5f6103f7610394565b905061040382826103bd565b919050565b5f67ffffffffffffffff82111561042257610421610095565b5b61042b826103ad565b9050602081019050919050565b8281835e5f83830152505050565b5f61045861045384610408565b6103ee565b905082815260208101848484011115610474576104736103a9565b5b61047f848285610438565b509392505050565b5f82601f83011261049b5761049a6103a5565b5b81516104ab848260208601610446565b91505092915050565b5f602082840312156104c9576104c861039d565b5b5f82015167ffffffffffffffff8111156104e6576104e56103a1565b5b6104f284828501610487565b91505092915050565b5f81519050919050565b61050e826104fb565b67ffffffffffffffff81111561052757610526610095565b5b61053182546100ef565b61053c82828561023c565b5f60209050601f83116001811461056d575f841561055b578287015190505b61056585826102aa565b8655506105cc565b601f19841661057b8661011f565b5f5b828110156105a25784890151825560018201915060208501945060208101905061057d565b868310156105bf57848901516105bb601f89168261028e565b8355505b6001600288020188555050505b505050505050565b6106e9806105e15f395ff3fe608060405234801561000f575f80fd5b506004361061003f575f3560e01c8063209652551461004357806330de3cee14610061578063439970aa1461007f575b5f80fd5b61004b61009b565b604051610058919061023d565b60405180910390f35b61006961012b565b604051610076919061023d565b60405180910390f35b6100996004803603810190610094919061039a565b6101ba565b005b6060600180546100aa9061040e565b80601f01602080910402602001604051908101604052809291908181526020018280546100d69061040e565b80156101215780601f106100f857610100808354040283529160200191610121565b820191905f5260205f20905b81548152906001019060200180831161010457829003601f168201915b5050505050905090565b60605f80546101399061040e565b80601f01602080910402602001604051908101604052809291908181526020018280546101659061040e565b80156101b05780601f10610187576101008083540402835291602001916101b0565b820191905f5260205f20905b81548152906001019060200180831161019357829003601f168201915b5050505050905090565b80600190816101c991906105e4565b5050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61020f826101cd565b61021981856101d7565b93506102298185602086016101e7565b610232816101f5565b840191505092915050565b5f6020820190508181035f8301526102558184610205565b905092915050565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6102ac826101f5565b810181811067ffffffffffffffff821117156102cb576102ca610276565b5b80604052505050565b5f6102dd61025d565b90506102e982826102a3565b919050565b5f67ffffffffffffffff82111561030857610307610276565b5b610311826101f5565b9050602081019050919050565b828183375f83830152505050565b5f61033e610339846102ee565b6102d4565b90508281526020810184848401111561035a57610359610272565b5b61036584828561031e565b509392505050565b5f82601f8301126103815761038061026e565b5b813561039184826020860161032c565b91505092915050565b5f602082840312156103af576103ae610266565b5b5f82013567ffffffffffffffff8111156103cc576103cb61026a565b5b6103d88482850161036d565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061042557607f821691505b602082108103610438576104376103e1565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261049a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261045f565b6104a4868361045f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6104e86104e36104de846104bc565b6104c5565b6104bc565b9050919050565b5f819050919050565b610501836104ce565b61051561050d826104ef565b84845461046b565b825550505050565b5f90565b61052961051d565b6105348184846104f8565b505050565b5b818110156105575761054c5f82610521565b60018101905061053a565b5050565b601f82111561059c5761056d8161043e565b61057684610450565b81016020851015610585578190505b61059961059185610450565b830182610539565b50505b505050565b5f82821c905092915050565b5f6105bc5f19846008026105a1565b1980831691505092915050565b5f6105d483836105ad565b9150826002028217905092915050565b6105ed826101cd565b67ffffffffffffffff81111561060657610605610276565b5b610610825461040e565b61061b82828561055b565b5f60209050601f83116001811461064c575f841561063a578287015190505b61064485826105c9565b8655506106ab565b601f19841661065a8661043e565b5f5b828110156106815784890151825560018201915060208501945060208101905061065c565b8683101561069e578489015161069a601f8916826105ad565b8355505b6001600288020188555050505b50505050505056fea2646970667358221220a6c92a686a51b0a95e8e482b40c49ad38e5f53e3cf9d7707add973666333801a64736f6c634300081a0033" # noqa: E501
|
|
8
|
+
BYTES_CONTRACT_RUNTIME = "0x608060405234801561000f575f80fd5b506004361061003f575f3560e01c8063209652551461004357806330de3cee14610061578063439970aa1461007f575b5f80fd5b61004b61009b565b604051610058919061023d565b60405180910390f35b61006961012b565b604051610076919061023d565b60405180910390f35b6100996004803603810190610094919061039a565b6101ba565b005b6060600180546100aa9061040e565b80601f01602080910402602001604051908101604052809291908181526020018280546100d69061040e565b80156101215780601f106100f857610100808354040283529160200191610121565b820191905f5260205f20905b81548152906001019060200180831161010457829003601f168201915b5050505050905090565b60605f80546101399061040e565b80601f01602080910402602001604051908101604052809291908181526020018280546101659061040e565b80156101b05780601f10610187576101008083540402835291602001916101b0565b820191905f5260205f20905b81548152906001019060200180831161019357829003601f168201915b5050505050905090565b80600190816101c991906105e4565b5050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61020f826101cd565b61021981856101d7565b93506102298185602086016101e7565b610232816101f5565b840191505092915050565b5f6020820190508181035f8301526102558184610205565b905092915050565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6102ac826101f5565b810181811067ffffffffffffffff821117156102cb576102ca610276565b5b80604052505050565b5f6102dd61025d565b90506102e982826102a3565b919050565b5f67ffffffffffffffff82111561030857610307610276565b5b610311826101f5565b9050602081019050919050565b828183375f83830152505050565b5f61033e610339846102ee565b6102d4565b90508281526020810184848401111561035a57610359610272565b5b61036584828561031e565b509392505050565b5f82601f8301126103815761038061026e565b5b813561039184826020860161032c565b91505092915050565b5f602082840312156103af576103ae610266565b5b5f82013567ffffffffffffffff8111156103cc576103cb61026a565b5b6103d88482850161036d565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061042557607f821691505b602082108103610438576104376103e1565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261049a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261045f565b6104a4868361045f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6104e86104e36104de846104bc565b6104c5565b6104bc565b9050919050565b5f819050919050565b610501836104ce565b61051561050d826104ef565b84845461046b565b825550505050565b5f90565b61052961051d565b6105348184846104f8565b505050565b5b818110156105575761054c5f82610521565b60018101905061053a565b5050565b601f82111561059c5761056d8161043e565b61057684610450565b81016020851015610585578190505b61059961059185610450565b830182610539565b50505b505050565b5f82821c905092915050565b5f6105bc5f19846008026105a1565b1980831691505092915050565b5f6105d483836105ad565b9150826002028217905092915050565b6105ed826101cd565b67ffffffffffffffff81111561060657610605610276565b5b610610825461040e565b61061b82828561055b565b5f60209050601f83116001811461064c575f841561063a578287015190505b61064485826105c9565b8655506106ab565b601f19841661065a8661043e565b5f5b828110156106815784890151825560018201915060208501945060208101905061065c565b8683101561069e578489015161069a601f8916826105ad565b8355505b6001600288020188555050505b50505050505056fea2646970667358221220a6c92a686a51b0a95e8e482b40c49ad38e5f53e3cf9d7707add973666333801a64736f6c634300081a0033" # noqa: E501
|
|
9
9
|
BYTES_CONTRACT_ABI = [
|
|
10
10
|
{
|
|
11
11
|
"inputs": [{"internalType": "bytes", "name": "_value", "type": "bytes"}],
|
|
@@ -42,8 +42,8 @@ BYTES_CONTRACT_DATA = {
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
# source: web3/_utils/contract_sources/BytesContracts.sol:Bytes32Contract
|
|
45
|
-
BYTES32_CONTRACT_BYTECODE = "
|
|
46
|
-
BYTES32_CONTRACT_RUNTIME = "
|
|
45
|
+
BYTES32_CONTRACT_BYTECODE = "0x60806040527f01230123012301230123012301230123012301230123012301230123012301235f553480156031575f80fd5b50604051610238380380610238833981810160405281019060519190608f565b806001819055505060b5565b5f80fd5b5f819050919050565b6071816061565b8114607a575f80fd5b50565b5f81519050608981606a565b92915050565b5f6020828403121560a15760a0605d565b5b5f60ac84828501607d565b91505092915050565b610176806100c25f395ff3fe608060405234801561000f575f80fd5b506004361061003f575f3560e01c8063209652551461004357806330de3cee1461006157806358825b101461007f575b5f80fd5b61004b61009b565b60405161005891906100ce565b60405180910390f35b6100696100a4565b60405161007691906100ce565b60405180910390f35b61009960048036038101906100949190610115565b6100ac565b005b5f600154905090565b5f8054905090565b8060018190555050565b5f819050919050565b6100c8816100b6565b82525050565b5f6020820190506100e15f8301846100bf565b92915050565b5f80fd5b6100f4816100b6565b81146100fe575f80fd5b50565b5f8135905061010f816100eb565b92915050565b5f6020828403121561012a576101296100e7565b5b5f61013784828501610101565b9150509291505056fea2646970667358221220f5df63e706898be26203c255d363a1f473d469bc9089fea69b6d723150b63a9764736f6c634300081a0033" # noqa: E501
|
|
46
|
+
BYTES32_CONTRACT_RUNTIME = "0x608060405234801561000f575f80fd5b506004361061003f575f3560e01c8063209652551461004357806330de3cee1461006157806358825b101461007f575b5f80fd5b61004b61009b565b60405161005891906100ce565b60405180910390f35b6100696100a4565b60405161007691906100ce565b60405180910390f35b61009960048036038101906100949190610115565b6100ac565b005b5f600154905090565b5f8054905090565b8060018190555050565b5f819050919050565b6100c8816100b6565b82525050565b5f6020820190506100e15f8301846100bf565b92915050565b5f80fd5b6100f4816100b6565b81146100fe575f80fd5b50565b5f8135905061010f816100eb565b92915050565b5f6020828403121561012a576101296100e7565b5b5f61013784828501610101565b9150509291505056fea2646970667358221220f5df63e706898be26203c255d363a1f473d469bc9089fea69b6d723150b63a9764736f6c634300081a0033" # noqa: E501
|
|
47
47
|
BYTES32_CONTRACT_ABI = [
|
|
48
48
|
{
|
|
49
49
|
"inputs": [{"internalType": "bytes32", "name": "_value", "type": "bytes32"}],
|