web3 7.0.0b1__py3-none-any.whl → 7.7.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.
Files changed (261) hide show
  1. ens/__init__.py +13 -2
  2. ens/_normalization.py +4 -4
  3. ens/async_ens.py +31 -21
  4. ens/base_ens.py +3 -1
  5. ens/contract_data.py +2 -2
  6. ens/ens.py +14 -11
  7. ens/exceptions.py +16 -29
  8. ens/specs/nf.json +1 -1
  9. ens/specs/normalization_spec.json +1 -1
  10. ens/utils.py +33 -41
  11. web3/__init__.py +23 -12
  12. web3/_utils/abi.py +162 -274
  13. web3/_utils/async_transactions.py +34 -20
  14. web3/_utils/batching.py +217 -0
  15. web3/_utils/blocks.py +6 -2
  16. web3/_utils/caching/__init__.py +12 -0
  17. web3/_utils/caching/caching_utils.py +433 -0
  18. web3/_utils/caching/request_caching_validation.py +287 -0
  19. web3/_utils/compat/__init__.py +2 -3
  20. web3/_utils/contract_sources/compile_contracts.py +1 -1
  21. web3/_utils/contract_sources/contract_data/ambiguous_function_contract.py +42 -0
  22. web3/_utils/contract_sources/contract_data/arrays_contract.py +3 -3
  23. web3/_utils/contract_sources/contract_data/bytes_contracts.py +5 -5
  24. web3/_utils/contract_sources/contract_data/constructor_contracts.py +7 -7
  25. web3/_utils/contract_sources/contract_data/contract_caller_tester.py +3 -3
  26. web3/_utils/contract_sources/contract_data/emitter_contract.py +3 -3
  27. web3/_utils/contract_sources/contract_data/event_contracts.py +50 -5
  28. web3/_utils/contract_sources/contract_data/extended_resolver.py +3 -3
  29. web3/_utils/contract_sources/contract_data/fallback_function_contract.py +3 -3
  30. web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +3 -3
  31. web3/_utils/contract_sources/contract_data/math_contract.py +3 -3
  32. web3/_utils/contract_sources/contract_data/offchain_lookup.py +3 -3
  33. web3/_utils/contract_sources/contract_data/offchain_resolver.py +3 -3
  34. web3/_utils/contract_sources/contract_data/panic_errors_contract.py +3 -3
  35. web3/_utils/contract_sources/contract_data/payable_tester.py +3 -3
  36. web3/_utils/contract_sources/contract_data/receive_function_contracts.py +5 -5
  37. web3/_utils/contract_sources/contract_data/reflector_contracts.py +3 -3
  38. web3/_utils/contract_sources/contract_data/revert_contract.py +3 -3
  39. web3/_utils/contract_sources/contract_data/simple_resolver.py +3 -3
  40. web3/_utils/contract_sources/contract_data/storage_contract.py +3 -3
  41. web3/_utils/contract_sources/contract_data/string_contract.py +3 -3
  42. web3/_utils/contract_sources/contract_data/tuple_contracts.py +5 -5
  43. web3/_utils/contracts.py +172 -220
  44. web3/_utils/datatypes.py +5 -1
  45. web3/_utils/decorators.py +6 -1
  46. web3/_utils/empty.py +1 -1
  47. web3/_utils/encoding.py +16 -12
  48. web3/_utils/error_formatters_utils.py +5 -3
  49. web3/_utils/events.py +78 -72
  50. web3/_utils/fee_utils.py +1 -3
  51. web3/_utils/filters.py +24 -22
  52. web3/_utils/formatters.py +2 -2
  53. web3/_utils/http.py +8 -2
  54. web3/_utils/http_session_manager.py +314 -0
  55. web3/_utils/math.py +14 -15
  56. web3/_utils/method_formatters.py +161 -34
  57. web3/_utils/module.py +2 -1
  58. web3/_utils/module_testing/__init__.py +3 -2
  59. web3/_utils/module_testing/eth_module.py +736 -583
  60. web3/_utils/module_testing/go_ethereum_debug_module.py +128 -0
  61. web3/_utils/module_testing/module_testing_utils.py +81 -24
  62. web3/_utils/module_testing/persistent_connection_provider.py +702 -220
  63. web3/_utils/module_testing/utils.py +114 -33
  64. web3/_utils/module_testing/web3_module.py +438 -17
  65. web3/_utils/normalizers.py +13 -11
  66. web3/_utils/rpc_abi.py +10 -22
  67. web3/_utils/threads.py +8 -7
  68. web3/_utils/transactions.py +32 -25
  69. web3/_utils/type_conversion.py +5 -1
  70. web3/_utils/validation.py +20 -17
  71. web3/beacon/__init__.py +5 -0
  72. web3/beacon/api_endpoints.py +3 -0
  73. web3/beacon/async_beacon.py +29 -6
  74. web3/beacon/beacon.py +24 -6
  75. web3/contract/__init__.py +7 -0
  76. web3/contract/async_contract.py +285 -82
  77. web3/contract/base_contract.py +556 -258
  78. web3/contract/contract.py +295 -84
  79. web3/contract/utils.py +251 -55
  80. web3/datastructures.py +56 -41
  81. web3/eth/__init__.py +7 -0
  82. web3/eth/async_eth.py +89 -69
  83. web3/eth/base_eth.py +7 -3
  84. web3/eth/eth.py +43 -66
  85. web3/exceptions.py +158 -83
  86. web3/gas_strategies/time_based.py +8 -6
  87. web3/geth.py +53 -184
  88. web3/main.py +77 -43
  89. web3/manager.py +368 -101
  90. web3/method.py +43 -15
  91. web3/middleware/__init__.py +26 -8
  92. web3/middleware/attrdict.py +12 -22
  93. web3/middleware/base.py +55 -2
  94. web3/middleware/filter.py +45 -23
  95. web3/middleware/formatting.py +6 -3
  96. web3/middleware/names.py +4 -1
  97. web3/middleware/signing.py +15 -6
  98. web3/middleware/stalecheck.py +2 -1
  99. web3/module.py +62 -26
  100. web3/providers/__init__.py +21 -0
  101. web3/providers/async_base.py +93 -38
  102. web3/providers/base.py +85 -40
  103. web3/providers/eth_tester/__init__.py +5 -0
  104. web3/providers/eth_tester/defaults.py +2 -55
  105. web3/providers/eth_tester/main.py +57 -35
  106. web3/providers/eth_tester/middleware.py +16 -17
  107. web3/providers/ipc.py +42 -18
  108. web3/providers/legacy_websocket.py +27 -2
  109. web3/providers/persistent/__init__.py +7 -0
  110. web3/providers/persistent/async_ipc.py +61 -121
  111. web3/providers/persistent/persistent.py +324 -17
  112. web3/providers/persistent/persistent_connection.py +54 -5
  113. web3/providers/persistent/request_processor.py +136 -56
  114. web3/providers/persistent/subscription_container.py +56 -0
  115. web3/providers/persistent/subscription_manager.py +233 -0
  116. web3/providers/persistent/websocket.py +29 -92
  117. web3/providers/rpc/__init__.py +5 -0
  118. web3/providers/rpc/async_rpc.py +73 -18
  119. web3/providers/rpc/rpc.py +73 -30
  120. web3/providers/rpc/utils.py +1 -13
  121. web3/scripts/install_pre_releases.py +33 -0
  122. web3/scripts/parse_pygeth_version.py +16 -0
  123. web3/testing.py +4 -4
  124. web3/tracing.py +9 -5
  125. web3/types.py +141 -74
  126. web3/utils/__init__.py +64 -5
  127. web3/utils/abi.py +790 -10
  128. web3/utils/address.py +8 -0
  129. web3/utils/async_exception_handling.py +20 -11
  130. web3/utils/caching.py +34 -4
  131. web3/utils/exception_handling.py +9 -12
  132. web3/utils/subscriptions.py +285 -0
  133. {web3-7.0.0b1.dist-info → web3-7.7.0.dist-info}/LICENSE +1 -1
  134. web3-7.7.0.dist-info/METADATA +130 -0
  135. web3-7.7.0.dist-info/RECORD +171 -0
  136. {web3-7.0.0b1.dist-info → web3-7.7.0.dist-info}/WHEEL +1 -1
  137. {web3-7.0.0b1.dist-info → web3-7.7.0.dist-info}/top_level.txt +0 -1
  138. ethpm/__init__.py +0 -20
  139. ethpm/_utils/__init__.py +0 -0
  140. ethpm/_utils/backend.py +0 -93
  141. ethpm/_utils/cache.py +0 -44
  142. ethpm/_utils/chains.py +0 -119
  143. ethpm/_utils/contract.py +0 -35
  144. ethpm/_utils/deployments.py +0 -145
  145. ethpm/_utils/ipfs.py +0 -116
  146. ethpm/_utils/protobuf/__init__.py +0 -0
  147. ethpm/_utils/protobuf/ipfs_file_pb2.py +0 -33
  148. ethpm/_utils/registry.py +0 -29
  149. ethpm/assets/__init__.py +0 -0
  150. ethpm/assets/ens/v3.json +0 -1
  151. ethpm/assets/escrow/with_bytecode_v3.json +0 -1
  152. ethpm/assets/ipfs_file.proto +0 -32
  153. ethpm/assets/owned/output_v3.json +0 -1
  154. ethpm/assets/owned/with_contract_type_v3.json +0 -1
  155. ethpm/assets/registry/contracts/Authority.sol +0 -156
  156. ethpm/assets/registry/contracts/IndexedOrderedSetLib.sol +0 -106
  157. ethpm/assets/registry/contracts/PackageDB.sol +0 -225
  158. ethpm/assets/registry/contracts/PackageRegistry.sol +0 -361
  159. ethpm/assets/registry/contracts/PackageRegistryInterface.sol +0 -97
  160. ethpm/assets/registry/contracts/ReleaseDB.sol +0 -309
  161. ethpm/assets/registry/contracts/ReleaseValidator.sol +0 -152
  162. ethpm/assets/registry/solc_input.json +0 -1
  163. ethpm/assets/registry/solc_output.json +0 -1
  164. ethpm/assets/registry/v3.json +0 -1
  165. ethpm/assets/safe-math-lib/v3-strict-no-deployments.json +0 -1
  166. ethpm/assets/simple-registry/contracts/Ownable.sol +0 -63
  167. ethpm/assets/simple-registry/contracts/PackageRegistry.sol +0 -373
  168. ethpm/assets/simple-registry/contracts/PackageRegistryInterface.sol +0 -96
  169. ethpm/assets/simple-registry/solc_input.json +0 -33
  170. ethpm/assets/simple-registry/solc_output.json +0 -1
  171. ethpm/assets/simple-registry/v3.json +0 -1
  172. ethpm/assets/standard-token/output_v3.json +0 -1
  173. ethpm/assets/standard-token/with_bytecode_v3.json +0 -1
  174. ethpm/assets/vyper_registry/0.1.0.json +0 -1
  175. ethpm/assets/vyper_registry/registry.vy +0 -216
  176. ethpm/assets/vyper_registry/registry_with_delete.vy +0 -244
  177. ethpm/backends/__init__.py +0 -0
  178. ethpm/backends/base.py +0 -43
  179. ethpm/backends/http.py +0 -108
  180. ethpm/backends/ipfs.py +0 -219
  181. ethpm/backends/registry.py +0 -154
  182. ethpm/constants.py +0 -17
  183. ethpm/contract.py +0 -187
  184. ethpm/dependencies.py +0 -58
  185. ethpm/deployments.py +0 -80
  186. ethpm/ethpm-spec/examples/escrow/1.0.0-pretty.json +0 -146
  187. ethpm/ethpm-spec/examples/escrow/1.0.0.json +0 -1
  188. ethpm/ethpm-spec/examples/escrow/contracts/Escrow.sol +0 -32
  189. ethpm/ethpm-spec/examples/escrow/contracts/SafeSendLib.sol +0 -20
  190. ethpm/ethpm-spec/examples/escrow/v3-pretty.json +0 -171
  191. ethpm/ethpm-spec/examples/escrow/v3.json +0 -1
  192. ethpm/ethpm-spec/examples/owned/1.0.0-pretty.json +0 -21
  193. ethpm/ethpm-spec/examples/owned/1.0.0.json +0 -1
  194. ethpm/ethpm-spec/examples/owned/contracts/Owned.sol +0 -12
  195. ethpm/ethpm-spec/examples/owned/v3-pretty.json +0 -27
  196. ethpm/ethpm-spec/examples/owned/v3.json +0 -1
  197. ethpm/ethpm-spec/examples/piper-coin/1.0.0-pretty.json +0 -31
  198. ethpm/ethpm-spec/examples/piper-coin/1.0.0.json +0 -1
  199. ethpm/ethpm-spec/examples/piper-coin/v3-pretty.json +0 -21
  200. ethpm/ethpm-spec/examples/piper-coin/v3.json +0 -1
  201. ethpm/ethpm-spec/examples/safe-math-lib/1.0.0-pretty.json +0 -85
  202. ethpm/ethpm-spec/examples/safe-math-lib/1.0.0.json +0 -1
  203. ethpm/ethpm-spec/examples/safe-math-lib/contracts/SafeMathLib.sol +0 -24
  204. ethpm/ethpm-spec/examples/safe-math-lib/v3-pretty.json +0 -117
  205. ethpm/ethpm-spec/examples/safe-math-lib/v3.json +0 -1
  206. ethpm/ethpm-spec/examples/standard-token/1.0.0-pretty.json +0 -55
  207. ethpm/ethpm-spec/examples/standard-token/1.0.0.json +0 -1
  208. ethpm/ethpm-spec/examples/standard-token/contracts/AbstractToken.sol +0 -20
  209. ethpm/ethpm-spec/examples/standard-token/contracts/StandardToken.sol +0 -84
  210. ethpm/ethpm-spec/examples/standard-token/v3-pretty.json +0 -460
  211. ethpm/ethpm-spec/examples/standard-token/v3.json +0 -1
  212. ethpm/ethpm-spec/examples/transferable/1.0.0-pretty.json +0 -21
  213. ethpm/ethpm-spec/examples/transferable/1.0.0.json +0 -1
  214. ethpm/ethpm-spec/examples/transferable/contracts/Transferable.sol +0 -14
  215. ethpm/ethpm-spec/examples/transferable/v3-pretty.json +0 -27
  216. ethpm/ethpm-spec/examples/transferable/v3.json +0 -1
  217. ethpm/ethpm-spec/examples/wallet/1.0.0-pretty.json +0 -120
  218. ethpm/ethpm-spec/examples/wallet/1.0.0.json +0 -1
  219. ethpm/ethpm-spec/examples/wallet/contracts/Wallet.sol +0 -41
  220. ethpm/ethpm-spec/examples/wallet/v3-pretty.json +0 -181
  221. ethpm/ethpm-spec/examples/wallet/v3.json +0 -1
  222. ethpm/ethpm-spec/examples/wallet-with-send/1.0.0-pretty.json +0 -135
  223. ethpm/ethpm-spec/examples/wallet-with-send/1.0.0.json +0 -1
  224. ethpm/ethpm-spec/examples/wallet-with-send/contracts/WalletWithSend.sol +0 -18
  225. ethpm/ethpm-spec/examples/wallet-with-send/v3-pretty.json +0 -207
  226. ethpm/ethpm-spec/examples/wallet-with-send/v3.json +0 -1
  227. ethpm/ethpm-spec/spec/package.spec.json +0 -379
  228. ethpm/ethpm-spec/spec/v3.spec.json +0 -483
  229. ethpm/exceptions.py +0 -68
  230. ethpm/package.py +0 -438
  231. ethpm/tools/__init__.py +0 -4
  232. ethpm/tools/builder.py +0 -930
  233. ethpm/tools/checker.py +0 -312
  234. ethpm/tools/get_manifest.py +0 -19
  235. ethpm/uri.py +0 -141
  236. ethpm/validation/__init__.py +0 -0
  237. ethpm/validation/manifest.py +0 -146
  238. ethpm/validation/misc.py +0 -39
  239. ethpm/validation/package.py +0 -80
  240. ethpm/validation/uri.py +0 -163
  241. web3/_utils/caching.py +0 -155
  242. web3/_utils/contract_sources/contract_data/address_reflector.py +0 -29
  243. web3/_utils/module_testing/go_ethereum_personal_module.py +0 -300
  244. web3/_utils/request.py +0 -265
  245. web3/pm.py +0 -602
  246. web3/tools/__init__.py +0 -4
  247. web3/tools/benchmark/__init__.py +0 -0
  248. web3/tools/benchmark/main.py +0 -185
  249. web3/tools/benchmark/node.py +0 -126
  250. web3/tools/benchmark/reporting.py +0 -39
  251. web3/tools/benchmark/utils.py +0 -69
  252. web3/tools/pytest_ethereum/__init__.py +0 -0
  253. web3/tools/pytest_ethereum/_utils.py +0 -145
  254. web3/tools/pytest_ethereum/deployer.py +0 -48
  255. web3/tools/pytest_ethereum/exceptions.py +0 -22
  256. web3/tools/pytest_ethereum/linker.py +0 -128
  257. web3/tools/pytest_ethereum/plugins.py +0 -33
  258. web3-7.0.0b1.dist-info/METADATA +0 -114
  259. web3-7.0.0b1.dist-info/RECORD +0 -280
  260. web3-7.0.0b1.dist-info/entry_points.txt +0 -2
  261. /web3/_utils/{function_identifiers.py → abi_element_identifiers.py} +0 -0
@@ -9,6 +9,7 @@ from typing import (
9
9
  Iterable,
10
10
  NoReturn,
11
11
  Tuple,
12
+ TypeVar,
12
13
  Union,
13
14
  cast,
14
15
  )
@@ -32,8 +33,6 @@ from eth_utils.curried import (
32
33
  is_integer,
33
34
  is_null,
34
35
  is_string,
35
- remove_0x_prefix,
36
- text_if_str,
37
36
  to_checksum_address,
38
37
  to_list,
39
38
  to_tuple,
@@ -52,10 +51,6 @@ from hexbytes import (
52
51
  from web3._utils.abi import (
53
52
  is_length,
54
53
  )
55
- from web3._utils.encoding import (
56
- hexstr_if_str,
57
- to_hex,
58
- )
59
54
  from web3._utils.error_formatters_utils import (
60
55
  raise_contract_logic_error_on_revert,
61
56
  raise_transaction_indexing_error_if_indexing,
@@ -99,6 +94,8 @@ from web3.datastructures import (
99
94
  from web3.exceptions import (
100
95
  BlockNotFound,
101
96
  TransactionNotFound,
97
+ Web3TypeError,
98
+ Web3ValueError,
102
99
  )
103
100
  from web3.types import (
104
101
  BlockIdentifier,
@@ -115,6 +112,8 @@ if TYPE_CHECKING:
115
112
  from web3.eth import Eth # noqa: F401
116
113
  from web3.module import Module # noqa: F401
117
114
 
115
+ TValue = TypeVar("TValue")
116
+
118
117
 
119
118
  def bytes_to_ascii(value: bytes) -> str:
120
119
  return codecs.decode(value, "ascii")
@@ -136,7 +135,7 @@ def to_hexbytes(
136
135
  if isinstance(val, (str, int, bytes)):
137
136
  result = HexBytes(val)
138
137
  else:
139
- raise TypeError(f"Cannot convert {val!r} to HexBytes")
138
+ raise Web3TypeError(f"Cannot convert {val!r} to HexBytes")
140
139
 
141
140
  extra_bytes = len(result) - num_bytes
142
141
  if extra_bytes == 0 or (variable_length and extra_bytes < 0):
@@ -144,7 +143,7 @@ def to_hexbytes(
144
143
  elif all(byte == 0 for byte in result[:extra_bytes]):
145
144
  return HexBytes(result[extra_bytes:])
146
145
  else:
147
- raise ValueError(
146
+ raise Web3ValueError(
148
147
  f"The value {result!r} is {len(result)} bytes, but should be {num_bytes}"
149
148
  )
150
149
 
@@ -177,9 +176,9 @@ def type_aware_apply_formatters_to_dict_keys_and_values(
177
176
  """
178
177
  Preserve ``AttributeDict`` types if original ``value`` was an ``AttributeDict``.
179
178
  """
180
- formatted_dict = dict(
181
- (key_formatters(k), value_formatters(v)) for k, v in dict_like_object.items()
182
- )
179
+ formatted_dict = {
180
+ key_formatters(k): value_formatters(v) for k, v in dict_like_object.items()
181
+ }
183
182
  return (
184
183
  AttributeDict.recursive(formatted_dict)
185
184
  if is_attrdict(dict_like_object)
@@ -191,10 +190,28 @@ def apply_list_to_array_formatter(formatter: Any) -> Callable[..., Any]:
191
190
  return to_list(apply_formatter_to_array(formatter))
192
191
 
193
192
 
193
+ def storage_key_to_hexstr(value: Union[bytes, int, str]) -> HexStr:
194
+ if not isinstance(value, (bytes, int, str)):
195
+ raise Web3ValueError(
196
+ f"Storage key must be one of bytes, int, str, got {type(value)}"
197
+ )
198
+ if isinstance(value, str):
199
+ if value.startswith("0x") and len(value) == 66:
200
+ return HexStr(value)
201
+ elif len(value) == 64:
202
+ return HexStr(f"0x{value}")
203
+ elif isinstance(value, bytes):
204
+ if len(value) == 32:
205
+ return cast(HexStr, HexBytes(value).to_0x_hex())
206
+ elif isinstance(value, int):
207
+ return storage_key_to_hexstr(hex(value))
208
+ raise Web3ValueError(f"Storage key must be a 32-byte value, got {value!r}")
209
+
210
+
194
211
  ACCESS_LIST_FORMATTER = type_aware_apply_formatters_to_dict(
195
212
  {
196
213
  "address": to_checksum_address,
197
- "storageKeys": apply_list_to_array_formatter(to_hexbytes(64)),
214
+ "storageKeys": apply_list_to_array_formatter(storage_key_to_hexstr),
198
215
  }
199
216
  )
200
217
 
@@ -233,6 +250,10 @@ TRANSACTION_RESULT_FORMATTERS = {
233
250
  ),
234
251
  "input": HexBytes,
235
252
  "data": HexBytes, # Nethermind, for example, returns both `input` and `data`
253
+ "maxFeePerBlobGas": to_integer_if_hex,
254
+ "blobVersionedHashes": apply_formatter_if(
255
+ is_not_null, apply_formatter_to_array(to_hexbytes(32))
256
+ ),
236
257
  }
237
258
 
238
259
 
@@ -281,6 +302,8 @@ RECEIPT_FORMATTERS = {
281
302
  "to": apply_formatter_if(is_address, to_checksum_address),
282
303
  "effectiveGasPrice": to_integer_if_hex,
283
304
  "type": to_integer_if_hex,
305
+ "blobGasPrice": to_integer_if_hex,
306
+ "blobGasUsed": to_integer_if_hex,
284
307
  }
285
308
 
286
309
 
@@ -404,8 +427,8 @@ ACCOUNT_PROOF_FORMATTERS = {
404
427
  proof_formatter = type_aware_apply_formatters_to_dict(ACCOUNT_PROOF_FORMATTERS)
405
428
 
406
429
  FILTER_PARAMS_FORMATTERS = {
407
- "fromBlock": apply_formatter_if(is_integer, integer_to_hex),
408
- "toBlock": apply_formatter_if(is_integer, integer_to_hex),
430
+ "fromBlock": to_hex_if_integer,
431
+ "toBlock": to_hex_if_integer,
409
432
  }
410
433
 
411
434
 
@@ -419,7 +442,22 @@ filter_result_formatter = apply_one_of_formatters(
419
442
  )
420
443
  )
421
444
 
445
+ ACCESS_LIST_REQUEST_FORMATTER = type_aware_apply_formatters_to_dict(
446
+ {
447
+ "accessList": apply_formatter_if(
448
+ is_not_null,
449
+ apply_list_to_array_formatter(
450
+ apply_formatters_to_dict(
451
+ {
452
+ "storageKeys": apply_list_to_array_formatter(to_hex_if_bytes),
453
+ }
454
+ )
455
+ ),
456
+ ),
457
+ }
458
+ )
422
459
  transaction_param_formatter = compose(
460
+ ACCESS_LIST_REQUEST_FORMATTER,
423
461
  remove_key_if("to", lambda txn: txn["to"] in {"", b"", None}),
424
462
  remove_key_if("gasPrice", lambda txn: txn["gasPrice"] in {"", b"", None}),
425
463
  )
@@ -516,6 +554,7 @@ PYTHONIC_REQUEST_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
516
554
  ),
517
555
  RPC.eth_getBalance: apply_formatter_at_index(to_hex_if_integer, 1),
518
556
  RPC.eth_getBlockByNumber: apply_formatter_at_index(to_hex_if_integer, 0),
557
+ RPC.eth_getBlockReceipts: apply_formatter_at_index(to_hex_if_integer, 0),
519
558
  RPC.eth_getBlockTransactionCountByNumber: apply_formatter_at_index(
520
559
  to_hex_if_integer,
521
560
  0,
@@ -559,16 +598,6 @@ PYTHONIC_REQUEST_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
559
598
  RPC.eth_sendTransaction: apply_formatter_at_index(transaction_param_formatter, 0),
560
599
  RPC.eth_signTransaction: apply_formatter_at_index(transaction_param_formatter, 0),
561
600
  RPC.eth_getProof: apply_formatter_at_index(to_hex_if_integer, 2),
562
- # personal
563
- RPC.personal_importRawKey: apply_formatter_at_index(
564
- compose(remove_0x_prefix, hexstr_if_str(to_hex)),
565
- 0,
566
- ),
567
- RPC.personal_sign: apply_formatter_at_index(text_if_str(to_hex), 0),
568
- RPC.personal_ecRecover: apply_formatter_at_index(text_if_str(to_hex), 0),
569
- RPC.personal_sendTransaction: apply_formatter_at_index(
570
- transaction_param_formatter, 0
571
- ),
572
601
  # Snapshot and Revert
573
602
  RPC.evm_revert: apply_formatter_at_index(integer_to_hex, 0),
574
603
  # tracing
@@ -581,6 +610,102 @@ PYTHONIC_REQUEST_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
581
610
  }
582
611
 
583
612
  # --- Result Formatters --- #
613
+ # -- debug -- #
614
+ DEBUG_CALLTRACE_LOG_ENTRY_FORMATTERS = apply_formatter_if(
615
+ is_not_null,
616
+ type_aware_apply_formatters_to_dict(
617
+ {
618
+ "address": to_checksum_address,
619
+ "topics": apply_list_to_array_formatter(to_hexbytes(32)),
620
+ "data": HexBytes,
621
+ "position": to_integer_if_hex,
622
+ }
623
+ ),
624
+ )
625
+
626
+
627
+ debug_calltrace_log_list_result_formatter: Callable[
628
+ [Formatters], Any
629
+ ] = apply_formatter_to_array(DEBUG_CALLTRACE_LOG_ENTRY_FORMATTERS)
630
+
631
+
632
+ PRETRACE_INNER_FORMATTERS = {
633
+ "balance": to_integer_if_hex,
634
+ "nonce": to_integer_if_hex,
635
+ }
636
+
637
+
638
+ def has_pretrace_keys(val: Any) -> bool:
639
+ if isinstance(val, dict) or isinstance(val, AttributeDict):
640
+ return (
641
+ val.get("balance")
642
+ or val.get("nonce")
643
+ or val.get("code")
644
+ or val.get("storage")
645
+ )
646
+ return False
647
+
648
+
649
+ @curry
650
+ def pretrace_formatter(
651
+ resp: Union[AttributeDict[str, Any], Dict[str, Any]],
652
+ ) -> Union[ReadableAttributeDict[str, Any], Dict[str, Any]]:
653
+ return type_aware_apply_formatters_to_dict_keys_and_values(
654
+ apply_formatter_if(is_address, to_checksum_address),
655
+ apply_formatter_if(
656
+ has_pretrace_keys,
657
+ type_aware_apply_formatters_to_dict(PRETRACE_INNER_FORMATTERS),
658
+ ),
659
+ resp,
660
+ )
661
+
662
+
663
+ DEBUG_PRESTATE_DIFFMODE_FORMATTERS = {
664
+ "pre": pretrace_formatter,
665
+ "post": pretrace_formatter,
666
+ }
667
+
668
+
669
+ DEBUG_CALLTRACE_FORMATTERS = {
670
+ "from": to_checksum_address,
671
+ "to": to_checksum_address,
672
+ "value": to_integer_if_hex,
673
+ "gas": to_integer_if_hex,
674
+ "gasUsed": to_integer_if_hex,
675
+ "input": HexBytes,
676
+ "output": HexBytes,
677
+ "calls": lambda calls: debug_calltrace_list_result_formatter(calls),
678
+ "logs": debug_calltrace_log_list_result_formatter,
679
+ }
680
+
681
+
682
+ OPCODE_TRACE_FORMATTERS = {
683
+ "pc": to_integer_if_hex,
684
+ "gas": to_integer_if_hex,
685
+ "gasCost": to_integer_if_hex,
686
+ "refund": to_integer_if_hex,
687
+ }
688
+
689
+
690
+ DEBUG_TRACE_FORMATTERS = {
691
+ **DEBUG_CALLTRACE_FORMATTERS,
692
+ **OPCODE_TRACE_FORMATTERS,
693
+ **DEBUG_PRESTATE_DIFFMODE_FORMATTERS,
694
+ }
695
+
696
+
697
+ trace_result_formatters = type_aware_apply_formatters_to_dict(DEBUG_TRACE_FORMATTERS)
698
+
699
+
700
+ debug_calltrace_result_formatter = type_aware_apply_formatters_to_dict(
701
+ DEBUG_CALLTRACE_FORMATTERS
702
+ )
703
+
704
+
705
+ debug_calltrace_list_result_formatter: Callable[
706
+ [Formatters], Any
707
+ ] = apply_formatter_to_array(debug_calltrace_result_formatter)
708
+
584
709
 
585
710
  # -- tracing -- #
586
711
 
@@ -620,7 +745,7 @@ TRACE_RESULT_FORMATTERS = apply_formatter_if(
620
745
  )
621
746
 
622
747
  # result formatters for the trace field
623
- TRACE_FORMATTERS = apply_formatter_if(
748
+ TRACE_FORMATTERS: Callable[[TValue], Union[Any, TValue]] = apply_formatter_if(
624
749
  is_not_null,
625
750
  type_aware_apply_formatters_to_dict(
626
751
  {
@@ -711,9 +836,9 @@ def subscription_formatter(value: Any) -> Union[HexBytes, HexStr, Dict[str, Any]
711
836
  PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
712
837
  # Eth
713
838
  RPC.eth_accounts: apply_list_to_array_formatter(to_checksum_address),
839
+ RPC.eth_blobBaseFee: to_integer_if_hex,
714
840
  RPC.eth_blockNumber: to_integer_if_hex,
715
841
  RPC.eth_chainId: to_integer_if_hex,
716
- RPC.eth_coinbase: to_checksum_address,
717
842
  RPC.eth_call: HexBytes,
718
843
  RPC.eth_createAccessList: ACCESS_LIST_RESPONSE_FORMATTER,
719
844
  RPC.eth_estimateGas: to_integer_if_hex,
@@ -723,6 +848,7 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
723
848
  RPC.eth_getBalance: to_integer_if_hex,
724
849
  RPC.eth_getBlockByHash: apply_formatter_if(is_not_null, block_formatter),
725
850
  RPC.eth_getBlockByNumber: apply_formatter_if(is_not_null, block_formatter),
851
+ RPC.eth_getBlockReceipts: apply_formatter_to_array(receipt_formatter),
726
852
  RPC.eth_getBlockTransactionCountByHash: to_integer_if_hex,
727
853
  RPC.eth_getBlockTransactionCountByNumber: to_integer_if_hex,
728
854
  RPC.eth_getCode: HexBytes,
@@ -752,7 +878,6 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
752
878
  ),
753
879
  RPC.eth_getUncleCountByBlockHash: to_integer_if_hex,
754
880
  RPC.eth_getUncleCountByBlockNumber: to_integer_if_hex,
755
- RPC.eth_hashrate: to_integer_if_hex,
756
881
  RPC.eth_protocolVersion: compose(
757
882
  apply_formatter_if(is_0x_prefixed, to_integer_if_hex),
758
883
  apply_formatter_if(is_integer, str),
@@ -763,13 +888,6 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
763
888
  RPC.eth_signTransaction: apply_formatter_if(is_not_null, signed_tx_formatter),
764
889
  RPC.eth_signTypedData: HexBytes,
765
890
  RPC.eth_syncing: apply_formatter_if(is_not_false, syncing_formatter),
766
- # personal
767
- RPC.personal_importRawKey: to_checksum_address,
768
- RPC.personal_listAccounts: apply_list_to_array_formatter(to_checksum_address),
769
- RPC.personal_listWallets: apply_list_to_array_formatter(geth_wallets_formatter),
770
- RPC.personal_newAccount: to_checksum_address,
771
- RPC.personal_sendTransaction: to_hexbytes(32),
772
- RPC.personal_signTypedData: HexBytes,
773
891
  # Transaction Pool
774
892
  RPC.txpool_content: transaction_pool_content_formatter,
775
893
  RPC.txpool_inspect: transaction_pool_inspect_formatter,
@@ -777,6 +895,14 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
777
895
  RPC.evm_snapshot: hex_to_integer,
778
896
  # Net
779
897
  RPC.net_peerCount: to_integer_if_hex,
898
+ # Debug
899
+ RPC.debug_traceTransaction: apply_formatter_if(
900
+ is_not_null,
901
+ compose(
902
+ pretrace_formatter,
903
+ trace_result_formatters,
904
+ ),
905
+ ),
780
906
  # tracing
781
907
  RPC.trace_block: trace_list_result_formatter,
782
908
  RPC.trace_call: common_tracing_result_formatter,
@@ -900,6 +1026,7 @@ def raise_transaction_not_found_with_index(
900
1026
  NULL_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
901
1027
  RPC.eth_getBlockByHash: raise_block_not_found,
902
1028
  RPC.eth_getBlockByNumber: raise_block_not_found,
1029
+ RPC.eth_getBlockReceipts: raise_block_not_found,
903
1030
  RPC.eth_getBlockTransactionCountByHash: raise_block_not_found,
904
1031
  RPC.eth_getBlockTransactionCountByNumber: raise_block_not_found,
905
1032
  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 AttributeError(
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,8 +5,9 @@ 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,
8
+ from .go_ethereum_debug_module import (
9
+ GoEthereumAsyncDebugModuleTest,
10
+ GoEthereumDebugModuleTest,
10
11
  )
11
12
  from .go_ethereum_txpool_module import (
12
13
  GoEthereumAsyncTxPoolModuleTest,