web3 6.20.3__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.3.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.3.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.3.dist-info/METADATA +0 -104
- web3-6.20.3.dist-info/RECORD +0 -283
- web3-6.20.3.dist-info/entry_points.txt +0 -2
- /web3/_utils/{function_identifiers.py → abi_element_identifiers.py} +0 -0
- {web3-6.20.3.dist-info → web3-7.0.0.dist-info}/WHEEL +0 -0
web3/_utils/method_formatters.py
CHANGED
|
@@ -32,8 +32,6 @@ from eth_utils.curried import (
|
|
|
32
32
|
is_integer,
|
|
33
33
|
is_null,
|
|
34
34
|
is_string,
|
|
35
|
-
remove_0x_prefix,
|
|
36
|
-
text_if_str,
|
|
37
35
|
to_checksum_address,
|
|
38
36
|
to_list,
|
|
39
37
|
to_tuple,
|
|
@@ -52,10 +50,6 @@ from hexbytes import (
|
|
|
52
50
|
from web3._utils.abi import (
|
|
53
51
|
is_length,
|
|
54
52
|
)
|
|
55
|
-
from web3._utils.encoding import (
|
|
56
|
-
hexstr_if_str,
|
|
57
|
-
to_hex,
|
|
58
|
-
)
|
|
59
53
|
from web3._utils.error_formatters_utils import (
|
|
60
54
|
raise_contract_logic_error_on_revert,
|
|
61
55
|
raise_transaction_indexing_error_if_indexing,
|
|
@@ -99,12 +93,14 @@ from web3.datastructures import (
|
|
|
99
93
|
from web3.exceptions import (
|
|
100
94
|
BlockNotFound,
|
|
101
95
|
TransactionNotFound,
|
|
96
|
+
Web3TypeError,
|
|
97
|
+
Web3ValueError,
|
|
102
98
|
)
|
|
103
99
|
from web3.types import (
|
|
104
100
|
BlockIdentifier,
|
|
105
|
-
CallOverrideParams,
|
|
106
101
|
Formatters,
|
|
107
102
|
RPCEndpoint,
|
|
103
|
+
StateOverrideParams,
|
|
108
104
|
TReturn,
|
|
109
105
|
TxParams,
|
|
110
106
|
_Hash32,
|
|
@@ -136,7 +132,7 @@ def to_hexbytes(
|
|
|
136
132
|
if isinstance(val, (str, int, bytes)):
|
|
137
133
|
result = HexBytes(val)
|
|
138
134
|
else:
|
|
139
|
-
raise
|
|
135
|
+
raise Web3TypeError(f"Cannot convert {val!r} to HexBytes")
|
|
140
136
|
|
|
141
137
|
extra_bytes = len(result) - num_bytes
|
|
142
138
|
if extra_bytes == 0 or (variable_length and extra_bytes < 0):
|
|
@@ -144,7 +140,7 @@ def to_hexbytes(
|
|
|
144
140
|
elif all(byte == 0 for byte in result[:extra_bytes]):
|
|
145
141
|
return HexBytes(result[extra_bytes:])
|
|
146
142
|
else:
|
|
147
|
-
raise
|
|
143
|
+
raise Web3ValueError(
|
|
148
144
|
f"The value {result!r} is {len(result)} bytes, but should be {num_bytes}"
|
|
149
145
|
)
|
|
150
146
|
|
|
@@ -177,9 +173,9 @@ def type_aware_apply_formatters_to_dict_keys_and_values(
|
|
|
177
173
|
"""
|
|
178
174
|
Preserve ``AttributeDict`` types if original ``value`` was an ``AttributeDict``.
|
|
179
175
|
"""
|
|
180
|
-
formatted_dict =
|
|
181
|
-
|
|
182
|
-
|
|
176
|
+
formatted_dict = {
|
|
177
|
+
key_formatters(k): value_formatters(v) for k, v in dict_like_object.items()
|
|
178
|
+
}
|
|
183
179
|
return (
|
|
184
180
|
AttributeDict.recursive(formatted_dict)
|
|
185
181
|
if is_attrdict(dict_like_object)
|
|
@@ -191,10 +187,28 @@ def apply_list_to_array_formatter(formatter: Any) -> Callable[..., Any]:
|
|
|
191
187
|
return to_list(apply_formatter_to_array(formatter))
|
|
192
188
|
|
|
193
189
|
|
|
190
|
+
def storage_key_to_hexstr(value: Union[bytes, int, str]) -> HexStr:
|
|
191
|
+
if not isinstance(value, (bytes, int, str)):
|
|
192
|
+
raise Web3ValueError(
|
|
193
|
+
f"Storage key must be one of bytes, int, str, got {type(value)}"
|
|
194
|
+
)
|
|
195
|
+
if isinstance(value, str):
|
|
196
|
+
if value.startswith("0x") and len(value) == 66:
|
|
197
|
+
return HexStr(value)
|
|
198
|
+
elif len(value) == 64:
|
|
199
|
+
return HexStr(f"0x{value}")
|
|
200
|
+
elif isinstance(value, bytes):
|
|
201
|
+
if len(value) == 32:
|
|
202
|
+
return cast(HexStr, HexBytes(value).to_0x_hex())
|
|
203
|
+
elif isinstance(value, int):
|
|
204
|
+
return storage_key_to_hexstr(hex(value))
|
|
205
|
+
raise Web3ValueError(f"Storage key must be a 32-byte value, got {value!r}")
|
|
206
|
+
|
|
207
|
+
|
|
194
208
|
ACCESS_LIST_FORMATTER = type_aware_apply_formatters_to_dict(
|
|
195
209
|
{
|
|
196
210
|
"address": to_checksum_address,
|
|
197
|
-
"storageKeys": apply_list_to_array_formatter(
|
|
211
|
+
"storageKeys": apply_list_to_array_formatter(storage_key_to_hexstr),
|
|
198
212
|
}
|
|
199
213
|
)
|
|
200
214
|
|
|
@@ -410,8 +424,8 @@ ACCOUNT_PROOF_FORMATTERS = {
|
|
|
410
424
|
proof_formatter = type_aware_apply_formatters_to_dict(ACCOUNT_PROOF_FORMATTERS)
|
|
411
425
|
|
|
412
426
|
FILTER_PARAMS_FORMATTERS = {
|
|
413
|
-
"fromBlock":
|
|
414
|
-
"toBlock":
|
|
427
|
+
"fromBlock": to_hex_if_integer,
|
|
428
|
+
"toBlock": to_hex_if_integer,
|
|
415
429
|
}
|
|
416
430
|
|
|
417
431
|
|
|
@@ -461,7 +475,7 @@ CALL_OVERRIDE_FORMATTERS = {
|
|
|
461
475
|
"code": to_hex_if_bytes,
|
|
462
476
|
}
|
|
463
477
|
call_with_override: Callable[
|
|
464
|
-
[Tuple[TxParams, BlockIdentifier,
|
|
478
|
+
[Tuple[TxParams, BlockIdentifier, StateOverrideParams]],
|
|
465
479
|
Tuple[Dict[str, Any], int, Dict[str, Any]],
|
|
466
480
|
] = apply_formatters_to_sequence(
|
|
467
481
|
[
|
|
@@ -493,7 +507,7 @@ ESTIMATE_GAS_OVERRIDE_FORMATTERS = {
|
|
|
493
507
|
"code": to_hex_if_bytes,
|
|
494
508
|
}
|
|
495
509
|
estimate_gas_with_override: Callable[
|
|
496
|
-
[Tuple[Dict[str, Any], BlockIdentifier,
|
|
510
|
+
[Tuple[Dict[str, Any], BlockIdentifier, StateOverrideParams]],
|
|
497
511
|
Tuple[Dict[str, Any], int, Dict[str, Any]],
|
|
498
512
|
] = apply_formatters_to_sequence(
|
|
499
513
|
[
|
|
@@ -537,6 +551,7 @@ PYTHONIC_REQUEST_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
537
551
|
),
|
|
538
552
|
RPC.eth_getBalance: apply_formatter_at_index(to_hex_if_integer, 1),
|
|
539
553
|
RPC.eth_getBlockByNumber: apply_formatter_at_index(to_hex_if_integer, 0),
|
|
554
|
+
RPC.eth_getBlockReceipts: apply_formatter_at_index(to_hex_if_integer, 0),
|
|
540
555
|
RPC.eth_getBlockTransactionCountByNumber: apply_formatter_at_index(
|
|
541
556
|
to_hex_if_integer,
|
|
542
557
|
0,
|
|
@@ -580,16 +595,6 @@ PYTHONIC_REQUEST_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
580
595
|
RPC.eth_sendTransaction: apply_formatter_at_index(transaction_param_formatter, 0),
|
|
581
596
|
RPC.eth_signTransaction: apply_formatter_at_index(transaction_param_formatter, 0),
|
|
582
597
|
RPC.eth_getProof: apply_formatter_at_index(to_hex_if_integer, 2),
|
|
583
|
-
# personal
|
|
584
|
-
RPC.personal_importRawKey: apply_formatter_at_index(
|
|
585
|
-
compose(remove_0x_prefix, hexstr_if_str(to_hex)),
|
|
586
|
-
0,
|
|
587
|
-
),
|
|
588
|
-
RPC.personal_sign: apply_formatter_at_index(text_if_str(to_hex), 0),
|
|
589
|
-
RPC.personal_ecRecover: apply_formatter_at_index(text_if_str(to_hex), 0),
|
|
590
|
-
RPC.personal_sendTransaction: apply_formatter_at_index(
|
|
591
|
-
transaction_param_formatter, 0
|
|
592
|
-
),
|
|
593
598
|
# Snapshot and Revert
|
|
594
599
|
RPC.evm_revert: apply_formatter_at_index(integer_to_hex, 0),
|
|
595
600
|
# tracing
|
|
@@ -734,7 +739,6 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
734
739
|
RPC.eth_accounts: apply_list_to_array_formatter(to_checksum_address),
|
|
735
740
|
RPC.eth_blockNumber: to_integer_if_hex,
|
|
736
741
|
RPC.eth_chainId: to_integer_if_hex,
|
|
737
|
-
RPC.eth_coinbase: to_checksum_address,
|
|
738
742
|
RPC.eth_call: HexBytes,
|
|
739
743
|
RPC.eth_createAccessList: ACCESS_LIST_RESPONSE_FORMATTER,
|
|
740
744
|
RPC.eth_estimateGas: to_integer_if_hex,
|
|
@@ -744,6 +748,7 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
744
748
|
RPC.eth_getBalance: to_integer_if_hex,
|
|
745
749
|
RPC.eth_getBlockByHash: apply_formatter_if(is_not_null, block_formatter),
|
|
746
750
|
RPC.eth_getBlockByNumber: apply_formatter_if(is_not_null, block_formatter),
|
|
751
|
+
RPC.eth_getBlockReceipts: apply_formatter_to_array(receipt_formatter),
|
|
747
752
|
RPC.eth_getBlockTransactionCountByHash: to_integer_if_hex,
|
|
748
753
|
RPC.eth_getBlockTransactionCountByNumber: to_integer_if_hex,
|
|
749
754
|
RPC.eth_getCode: HexBytes,
|
|
@@ -773,7 +778,6 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
773
778
|
),
|
|
774
779
|
RPC.eth_getUncleCountByBlockHash: to_integer_if_hex,
|
|
775
780
|
RPC.eth_getUncleCountByBlockNumber: to_integer_if_hex,
|
|
776
|
-
RPC.eth_hashrate: to_integer_if_hex,
|
|
777
781
|
RPC.eth_protocolVersion: compose(
|
|
778
782
|
apply_formatter_if(is_0x_prefixed, to_integer_if_hex),
|
|
779
783
|
apply_formatter_if(is_integer, str),
|
|
@@ -784,13 +788,6 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
784
788
|
RPC.eth_signTransaction: apply_formatter_if(is_not_null, signed_tx_formatter),
|
|
785
789
|
RPC.eth_signTypedData: HexBytes,
|
|
786
790
|
RPC.eth_syncing: apply_formatter_if(is_not_false, syncing_formatter),
|
|
787
|
-
# personal
|
|
788
|
-
RPC.personal_importRawKey: to_checksum_address,
|
|
789
|
-
RPC.personal_listAccounts: apply_list_to_array_formatter(to_checksum_address),
|
|
790
|
-
RPC.personal_listWallets: apply_list_to_array_formatter(geth_wallets_formatter),
|
|
791
|
-
RPC.personal_newAccount: to_checksum_address,
|
|
792
|
-
RPC.personal_sendTransaction: to_hexbytes(32),
|
|
793
|
-
RPC.personal_signTypedData: HexBytes,
|
|
794
791
|
# Transaction Pool
|
|
795
792
|
RPC.txpool_content: transaction_pool_content_formatter,
|
|
796
793
|
RPC.txpool_inspect: transaction_pool_inspect_formatter,
|
|
@@ -921,6 +918,7 @@ def raise_transaction_not_found_with_index(
|
|
|
921
918
|
NULL_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
922
919
|
RPC.eth_getBlockByHash: raise_block_not_found,
|
|
923
920
|
RPC.eth_getBlockByNumber: raise_block_not_found,
|
|
921
|
+
RPC.eth_getBlockReceipts: raise_block_not_found,
|
|
924
922
|
RPC.eth_getBlockTransactionCountByHash: raise_block_not_found,
|
|
925
923
|
RPC.eth_getBlockTransactionCountByNumber: raise_block_not_found,
|
|
926
924
|
RPC.eth_getUncleCountByBlockHash: raise_block_not_found,
|
web3/_utils/module.py
CHANGED
|
@@ -13,6 +13,7 @@ from typing import (
|
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
from web3.exceptions import (
|
|
16
|
+
Web3AttributeError,
|
|
16
17
|
Web3ValidationError,
|
|
17
18
|
)
|
|
18
19
|
from web3.module import (
|
|
@@ -50,7 +51,7 @@ def attach_modules(
|
|
|
50
51
|
module_class = module_info[0] if module_info_is_list_like else module_info
|
|
51
52
|
|
|
52
53
|
if hasattr(parent_module, module_name):
|
|
53
|
-
raise
|
|
54
|
+
raise Web3AttributeError(
|
|
54
55
|
f"Cannot set {parent_module} module named '{module_name}'. "
|
|
55
56
|
" The web3 object already has an attribute with that name"
|
|
56
57
|
)
|
|
@@ -5,9 +5,6 @@ from .eth_module import (
|
|
|
5
5
|
from .go_ethereum_admin_module import (
|
|
6
6
|
GoEthereumAdminModuleTest,
|
|
7
7
|
)
|
|
8
|
-
from .go_ethereum_personal_module import (
|
|
9
|
-
GoEthereumPersonalModuleTest,
|
|
10
|
-
)
|
|
11
8
|
from .go_ethereum_txpool_module import (
|
|
12
9
|
GoEthereumAsyncTxPoolModuleTest,
|
|
13
10
|
GoEthereumTxPoolModuleTest,
|