web3 7.0.0b3__py3-none-any.whl → 7.0.0b5__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 (82) hide show
  1. ens/_normalization.py +1 -3
  2. ens/async_ens.py +12 -9
  3. ens/contract_data.py +2 -2
  4. ens/ens.py +8 -5
  5. ens/exceptions.py +19 -27
  6. ens/specs/nf.json +1 -1
  7. ens/specs/normalization_spec.json +1 -1
  8. ens/utils.py +17 -10
  9. web3/__init__.py +2 -7
  10. web3/_utils/abi.py +30 -29
  11. web3/_utils/async_transactions.py +7 -4
  12. web3/_utils/blocks.py +6 -2
  13. web3/_utils/caching.py +7 -3
  14. web3/_utils/compat/__init__.py +0 -3
  15. web3/_utils/contract_sources/compile_contracts.py +1 -1
  16. web3/_utils/contracts.py +17 -17
  17. web3/_utils/datatypes.py +5 -1
  18. web3/_utils/decorators.py +6 -1
  19. web3/_utils/empty.py +1 -1
  20. web3/_utils/encoding.py +15 -10
  21. web3/_utils/error_formatters_utils.py +5 -3
  22. web3/_utils/events.py +38 -36
  23. web3/_utils/fee_utils.py +2 -4
  24. web3/_utils/filters.py +23 -18
  25. web3/_utils/formatters.py +2 -2
  26. web3/_utils/math.py +3 -2
  27. web3/_utils/method_formatters.py +24 -28
  28. web3/_utils/module.py +2 -1
  29. web3/_utils/module_testing/__init__.py +0 -3
  30. web3/_utils/module_testing/eth_module.py +494 -432
  31. web3/_utils/module_testing/module_testing_utils.py +1 -3
  32. web3/_utils/module_testing/utils.py +14 -7
  33. web3/_utils/normalizers.py +3 -3
  34. web3/_utils/request.py +4 -4
  35. web3/_utils/rpc_abi.py +5 -19
  36. web3/_utils/threads.py +8 -7
  37. web3/_utils/transactions.py +14 -12
  38. web3/_utils/type_conversion.py +5 -1
  39. web3/_utils/validation.py +12 -10
  40. web3/contract/async_contract.py +23 -18
  41. web3/contract/base_contract.py +69 -74
  42. web3/contract/contract.py +25 -19
  43. web3/contract/utils.py +11 -6
  44. web3/datastructures.py +22 -12
  45. web3/eth/async_eth.py +38 -32
  46. web3/eth/base_eth.py +7 -3
  47. web3/eth/eth.py +20 -15
  48. web3/exceptions.py +83 -78
  49. web3/gas_strategies/time_based.py +2 -4
  50. web3/geth.py +1 -191
  51. web3/main.py +6 -6
  52. web3/manager.py +128 -68
  53. web3/method.py +13 -5
  54. web3/middleware/base.py +4 -2
  55. web3/middleware/filter.py +45 -23
  56. web3/middleware/formatting.py +6 -3
  57. web3/middleware/names.py +4 -1
  58. web3/middleware/signing.py +8 -4
  59. web3/middleware/stalecheck.py +2 -1
  60. web3/providers/eth_tester/defaults.py +1 -49
  61. web3/providers/eth_tester/main.py +41 -15
  62. web3/providers/eth_tester/middleware.py +13 -9
  63. web3/providers/ipc.py +7 -3
  64. web3/providers/persistent/async_ipc.py +6 -7
  65. web3/providers/persistent/persistent.py +11 -1
  66. web3/providers/persistent/request_processor.py +7 -7
  67. web3/providers/persistent/websocket.py +3 -3
  68. web3/providers/rpc/async_rpc.py +24 -7
  69. web3/providers/rpc/rpc.py +30 -17
  70. web3/providers/rpc/utils.py +1 -10
  71. web3/testing.py +4 -4
  72. web3/tools/benchmark/main.py +13 -9
  73. web3/tools/benchmark/node.py +2 -8
  74. web3/tools/benchmark/utils.py +1 -1
  75. web3/tracing.py +9 -5
  76. web3/types.py +20 -23
  77. {web3-7.0.0b3.dist-info → web3-7.0.0b5.dist-info}/METADATA +13 -28
  78. {web3-7.0.0b3.dist-info → web3-7.0.0b5.dist-info}/RECORD +81 -82
  79. web3/_utils/module_testing/go_ethereum_personal_module.py +0 -300
  80. {web3-7.0.0b3.dist-info → web3-7.0.0b5.dist-info}/LICENSE +0 -0
  81. {web3-7.0.0b3.dist-info → web3-7.0.0b5.dist-info}/WHEEL +0 -0
  82. {web3-7.0.0b3.dist-info → web3-7.0.0b5.dist-info}/top_level.txt +0 -0
@@ -13,6 +13,7 @@ from web3.exceptions import (
13
13
  ContractPanicError,
14
14
  OffchainLookup,
15
15
  TransactionIndexingInProgress,
16
+ Web3ValueError,
16
17
  )
17
18
  from web3.types import (
18
19
  RPCResponse,
@@ -76,7 +77,9 @@ def _parse_error_with_reverted_prefix(data: str) -> str:
76
77
  try:
77
78
  error = bytes.fromhex(error).decode("utf8")
78
79
  except UnicodeDecodeError:
79
- warnings.warn("Could not decode revert reason as UTF-8", RuntimeWarning)
80
+ warnings.warn(
81
+ "Could not decode revert reason as UTF-8", RuntimeWarning, stacklevel=2
82
+ )
80
83
  raise ContractLogicError("execution reverted", data=data)
81
84
 
82
85
  return error
@@ -140,7 +143,7 @@ def raise_contract_logic_error_on_revert(response: RPCResponse) -> RPCResponse:
140
143
  """
141
144
  error = response.get("error")
142
145
  if error is None or isinstance(error, str):
143
- raise ValueError(error)
146
+ raise Web3ValueError(error)
144
147
 
145
148
  message = error.get("message")
146
149
  message_present = message is not None and message != ""
@@ -172,7 +175,6 @@ def raise_transaction_indexing_error_if_indexing(response: RPCResponse) -> RPCRe
172
175
  Raise an error if ``eth_getTransactionReceipt`` returns an error indicating that
173
176
  transactions are still being indexed.
174
177
  """
175
-
176
178
  error = response.get("error")
177
179
  if not isinstance(error, str) and error is not None:
178
180
  message = error.get("message")
web3/_utils/events.py CHANGED
@@ -76,6 +76,7 @@ from web3.exceptions import (
76
76
  InvalidEventABI,
77
77
  LogTopicError,
78
78
  MismatchedABI,
79
+ Web3ValueError,
79
80
  )
80
81
  from web3.types import (
81
82
  ABIEvent,
@@ -115,7 +116,7 @@ def construct_event_topic_set(
115
116
  arguments = {}
116
117
  if isinstance(arguments, (list, tuple)):
117
118
  if len(arguments) != len(event_abi["inputs"]):
118
- raise ValueError(
119
+ raise Web3ValueError(
119
120
  "When passing an argument list, the number of arguments must "
120
121
  "match the event constructor."
121
122
  )
@@ -130,9 +131,7 @@ def construct_event_topic_set(
130
131
  for key, value in arguments.items() # type: ignore
131
132
  }
132
133
 
133
- # typed dict cannot be used w/ a normal Dict
134
- # https://github.com/python/mypy/issues/4976
135
- event_topic = encode_hex(event_abi_to_log_topic(event_abi)) # type: ignore
134
+ event_topic = encode_hex(event_abi_to_log_topic(event_abi))
136
135
  indexed_args = get_indexed_event_inputs(event_abi)
137
136
  zipped_abi_and_args = [
138
137
  (arg, normalized_args.get(arg["name"], [None])) for arg in indexed_args
@@ -162,7 +161,7 @@ def construct_event_data_set(
162
161
  arguments = {}
163
162
  if isinstance(arguments, (list, tuple)):
164
163
  if len(arguments) != len(event_abi["inputs"]):
165
- raise ValueError(
164
+ raise Web3ValueError(
166
165
  "When passing an argument list, the number of arguments must "
167
166
  "match the event constructor."
168
167
  )
@@ -341,8 +340,8 @@ is_not_indexed = complement(is_indexed)
341
340
 
342
341
  class BaseEventFilterBuilder:
343
342
  formatter = None
344
- _fromBlock = None
345
- _toBlock = None
343
+ _from_block = None
344
+ _to_block = None
346
345
  _address = None
347
346
  _immutable = False
348
347
 
@@ -362,30 +361,30 @@ class BaseEventFilterBuilder:
362
361
  self._ordered_arg_names = tuple(arg["name"] for arg in event_abi["inputs"])
363
362
 
364
363
  @property
365
- def fromBlock(self) -> BlockIdentifier:
366
- return self._fromBlock
364
+ def from_block(self) -> BlockIdentifier:
365
+ return self._from_block
367
366
 
368
- @fromBlock.setter
369
- def fromBlock(self, value: BlockIdentifier) -> None:
370
- if self._fromBlock is None and not self._immutable:
371
- self._fromBlock = value
367
+ @from_block.setter
368
+ def from_block(self, value: BlockIdentifier) -> None:
369
+ if self._from_block is None and not self._immutable:
370
+ self._from_block = value
372
371
  else:
373
- raise ValueError(
374
- f"fromBlock is already set to {self._fromBlock!r}. "
372
+ raise Web3ValueError(
373
+ f"from_block is already set to {self._from_block!r}. "
375
374
  "Resetting filter parameters is not permitted"
376
375
  )
377
376
 
378
377
  @property
379
- def toBlock(self) -> BlockIdentifier:
380
- return self._toBlock
378
+ def to_block(self) -> BlockIdentifier:
379
+ return self._to_block
381
380
 
382
- @toBlock.setter
383
- def toBlock(self, value: BlockIdentifier) -> None:
384
- if self._toBlock is None and not self._immutable:
385
- self._toBlock = value
381
+ @to_block.setter
382
+ def to_block(self, value: BlockIdentifier) -> None:
383
+ if self._to_block is None and not self._immutable:
384
+ self._to_block = value
386
385
  else:
387
- raise ValueError(
388
- f"toBlock is already set to {self._toBlock!r}. "
386
+ raise Web3ValueError(
387
+ f"toBlock is already set to {self._to_block!r}. "
389
388
  "Resetting filter parameters is not permitted"
390
389
  )
391
390
 
@@ -398,7 +397,7 @@ class BaseEventFilterBuilder:
398
397
  if self._address is None and not self._immutable:
399
398
  self._address = value
400
399
  else:
401
- raise ValueError(
400
+ raise Web3ValueError(
402
401
  f"address is already set to {self.address!r}. "
403
402
  "Resetting filter parameters is not permitted"
404
403
  )
@@ -433,8 +432,8 @@ class BaseEventFilterBuilder:
433
432
  def filter_params(self) -> FilterParams:
434
433
  params = {
435
434
  "topics": self.topics,
436
- "fromBlock": self.fromBlock,
437
- "toBlock": self.toBlock,
435
+ "fromBlock": self.from_block,
436
+ "toBlock": self.to_block,
438
437
  "address": self.address,
439
438
  }
440
439
  return valfilter(lambda x: x is not None, params)
@@ -443,9 +442,9 @@ class BaseEventFilterBuilder:
443
442
  class EventFilterBuilder(BaseEventFilterBuilder):
444
443
  def deploy(self, w3: "Web3") -> "LogFilter":
445
444
  if not isinstance(w3, web3.Web3):
446
- raise ValueError(f"Invalid web3 argument: got: {w3!r}")
445
+ raise Web3ValueError(f"Invalid web3 argument: got: {w3!r}")
447
446
 
448
- for arg in AttributeDict.values(self.args): # type: ignore[arg-type]
447
+ for arg in AttributeDict.values(self.args):
449
448
  arg._immutable = True # type: ignore[attr-defined]
450
449
  self._immutable = True
451
450
 
@@ -461,9 +460,9 @@ class EventFilterBuilder(BaseEventFilterBuilder):
461
460
  class AsyncEventFilterBuilder(BaseEventFilterBuilder):
462
461
  async def deploy(self, async_w3: "AsyncWeb3") -> "AsyncLogFilter":
463
462
  if not isinstance(async_w3, web3.AsyncWeb3):
464
- raise ValueError(f"Invalid web3 argument: got: {async_w3!r}")
463
+ raise Web3ValueError(f"Invalid web3 argument: got: {async_w3!r}")
465
464
 
466
- for arg in AttributeDict.values(self.args): # type: ignore[arg-type]
465
+ for arg in AttributeDict.values(self.args):
467
466
  arg._immutable = True # type: ignore[attr-defined]
468
467
  self._immutable = True
469
468
 
@@ -479,8 +478,7 @@ class AsyncEventFilterBuilder(BaseEventFilterBuilder):
479
478
 
480
479
  def initialize_event_topics(event_abi: ABIEvent) -> Union[bytes, List[Any]]:
481
480
  if event_abi["anonymous"] is False:
482
- # https://github.com/python/mypy/issues/4976
483
- return event_abi_to_log_topic(event_abi) # type: ignore
481
+ return event_abi_to_log_topic(event_abi)
484
482
  else:
485
483
  return list()
486
484
 
@@ -519,19 +517,23 @@ class BaseArgumentFilter(ABC):
519
517
 
520
518
  def match_single(self, value: Any) -> None:
521
519
  if self._immutable:
522
- raise ValueError("Setting values is forbidden after filter is deployed.")
520
+ raise Web3ValueError(
521
+ "Setting values is forbidden after filter is deployed."
522
+ )
523
523
  if self._match_values is None:
524
524
  self._match_values = _normalize_match_values((value,))
525
525
  else:
526
- raise ValueError("An argument match value/s has already been set.")
526
+ raise Web3ValueError("An argument match value/s has already been set.")
527
527
 
528
528
  def match_any(self, *values: Collection[Any]) -> None:
529
529
  if self._immutable:
530
- raise ValueError("Setting values is forbidden after filter is deployed.")
530
+ raise Web3ValueError(
531
+ "Setting values is forbidden after filter is deployed."
532
+ )
531
533
  if self._match_values is None:
532
534
  self._match_values = _normalize_match_values(values)
533
535
  else:
534
- raise ValueError("An argument match value/s has already been set.")
536
+ raise Web3ValueError("An argument match value/s has already been set.")
535
537
 
536
538
  @property
537
539
  @abstractmethod
web3/_utils/fee_utils.py CHANGED
@@ -45,7 +45,7 @@ def fee_history_priority_fee(eth: "Eth") -> Wei:
45
45
  # This is a tested internal call so no need for type hinting. We can keep
46
46
  # better consistency between the sync and async calls by unpacking
47
47
  # PRIORITY_FEE_HISTORY_PARAMS as constants here.
48
- fee_history = eth.fee_history(*PRIORITY_FEE_HISTORY_PARAMS) # type: ignore
48
+ fee_history = eth.fee_history(*PRIORITY_FEE_HISTORY_PARAMS)
49
49
  return _fee_history_priority_fee_estimate(fee_history)
50
50
 
51
51
 
@@ -53,7 +53,5 @@ async def async_fee_history_priority_fee(async_eth: "AsyncEth") -> Wei:
53
53
  # This is a tested internal call so no need for type hinting. We can keep
54
54
  # better consistency between the sync and async calls by unpacking
55
55
  # PRIORITY_FEE_HISTORY_PARAMS as constants here.
56
- fee_history = await async_eth.fee_history(
57
- *PRIORITY_FEE_HISTORY_PARAMS # type: ignore
58
- )
56
+ fee_history = await async_eth.fee_history(*PRIORITY_FEE_HISTORY_PARAMS)
59
57
  return _fee_history_priority_fee_estimate(fee_history)
web3/_utils/filters.py CHANGED
@@ -50,7 +50,9 @@ from web3._utils.validation import (
50
50
  validate_address,
51
51
  )
52
52
  from web3.exceptions import (
53
+ Web3TypeError,
53
54
  Web3ValidationError,
55
+ Web3ValueError,
54
56
  )
55
57
  from web3.types import (
56
58
  ABIEvent,
@@ -71,8 +73,8 @@ def construct_event_filter_params(
71
73
  contract_address: Optional[ChecksumAddress] = None,
72
74
  argument_filters: Optional[Dict[str, Any]] = None,
73
75
  topics: Optional[Sequence[HexStr]] = None,
74
- fromBlock: Optional[BlockIdentifier] = None,
75
- toBlock: Optional[BlockIdentifier] = None,
76
+ from_block: Optional[BlockIdentifier] = None,
77
+ to_block: Optional[BlockIdentifier] = None,
76
78
  address: Optional[ChecksumAddress] = None,
77
79
  ) -> Tuple[List[List[Optional[HexStr]]], FilterParams]:
78
80
  filter_params: FilterParams = {}
@@ -82,15 +84,14 @@ def construct_event_filter_params(
82
84
 
83
85
  if topics is not None:
84
86
  if len(topic_set) > 1:
85
- raise TypeError(
87
+ raise Web3TypeError(
86
88
  "Merging the topics argument with topics generated "
87
89
  "from argument_filters is not supported."
88
90
  )
89
91
  topic_set = topics
90
92
 
91
93
  if len(topic_set) == 1 and is_list_like(topic_set[0]):
92
- # type ignored b/c list-like check on line 88
93
- filter_params["topics"] = topic_set[0] # type: ignore
94
+ filter_params["topics"] = topic_set[0]
94
95
  else:
95
96
  filter_params["topics"] = topic_set
96
97
 
@@ -104,7 +105,7 @@ def construct_event_filter_params(
104
105
  else [address]
105
106
  )
106
107
  else:
107
- raise ValueError(
108
+ raise Web3ValueError(
108
109
  f"Unsupported type for `address` parameter: {type(address)}"
109
110
  )
110
111
  elif address:
@@ -120,11 +121,11 @@ def construct_event_filter_params(
120
121
  else:
121
122
  validate_address(filter_params["address"])
122
123
 
123
- if fromBlock is not None:
124
- filter_params["fromBlock"] = fromBlock
124
+ if from_block is not None:
125
+ filter_params["fromBlock"] = from_block
125
126
 
126
- if toBlock is not None:
127
- filter_params["toBlock"] = toBlock
127
+ if to_block is not None:
128
+ filter_params["toBlock"] = to_block
128
129
 
129
130
  data_filters_set = construct_event_data_set(event_abi, abi_codec, argument_filters)
130
131
 
@@ -178,7 +179,7 @@ class BaseFilter:
178
179
  class Filter(BaseFilter):
179
180
  def __init__(self, filter_id: HexStr, eth_module: "Eth") -> None:
180
181
  self.eth_module = eth_module
181
- super(Filter, self).__init__(filter_id)
182
+ super().__init__(filter_id)
182
183
 
183
184
  def get_new_entries(self) -> List[LogReceipt]:
184
185
  log_entries = self._filter_valid_entries(
@@ -196,7 +197,7 @@ class Filter(BaseFilter):
196
197
  class AsyncFilter(BaseFilter):
197
198
  def __init__(self, filter_id: HexStr, eth_module: "AsyncEth") -> None:
198
199
  self.eth_module = eth_module
199
- super(AsyncFilter, self).__init__(filter_id)
200
+ super().__init__(filter_id)
200
201
 
201
202
  async def get_new_entries(self) -> List[LogReceipt]:
202
203
  filter_changes = await self.eth_module.get_filter_changes(self.filter_id)
@@ -250,7 +251,8 @@ class LogFilter(Filter):
250
251
  def set_data_filters(
251
252
  self, data_filter_set: Collection[Tuple[TypeStr, Any]]
252
253
  ) -> None:
253
- """Sets the data filters (non indexed argument filters)
254
+ """
255
+ Sets the data filters (non indexed argument filters)
254
256
 
255
257
  Expects a set of tuples with the type and value, e.g.:
256
258
  (('uint256', [12345, 54321]), ('string', ('a-single-string',)))
@@ -292,7 +294,8 @@ class AsyncLogFilter(AsyncFilter):
292
294
  def set_data_filters(
293
295
  self, data_filter_set: Collection[Tuple[TypeStr, Any]]
294
296
  ) -> None:
295
- """Sets the data filters (non indexed argument filters)
297
+ """
298
+ Sets the data filters (non indexed argument filters)
296
299
 
297
300
  Expects a set of tuples with the type and value, e.g.:
298
301
  (('uint256', [12345, 54321]), ('string', ('a-single-string',)))
@@ -318,7 +321,8 @@ normalize_to_text = apply_formatter_if(not_text, decode_utf8_bytes)
318
321
 
319
322
 
320
323
  def normalize_data_values(type_string: TypeStr, data_value: Any) -> Any:
321
- """Decodes utf-8 bytes to strings for abi string values.
324
+ """
325
+ Decodes utf-8 bytes to strings for abi string values.
322
326
 
323
327
  eth-abi v1 returns utf-8 bytes for string values.
324
328
  This can be removed once eth-abi v2 is required.
@@ -326,7 +330,7 @@ def normalize_data_values(type_string: TypeStr, data_value: Any) -> Any:
326
330
  _type = parse_type_string(type_string)
327
331
  if _type.base == "string":
328
332
  if _type.arrlist is not None:
329
- return tuple((normalize_to_text(value) for value in data_value))
333
+ return tuple(normalize_to_text(value) for value in data_value)
330
334
  else:
331
335
  return normalize_to_text(data_value)
332
336
  return data_value
@@ -336,7 +340,8 @@ def normalize_data_values(type_string: TypeStr, data_value: Any) -> Any:
336
340
  def match_fn(
337
341
  codec: ABICodec, match_values_and_abi: Collection[Tuple[str, Any]], data: Any
338
342
  ) -> bool:
339
- """Match function used for filtering non-indexed event arguments.
343
+ """
344
+ Match function used for filtering non-indexed event arguments.
340
345
 
341
346
  Values provided through the match_values_and_abi parameter are
342
347
  compared to the abi decoded log data.
@@ -352,7 +357,7 @@ def match_fn(
352
357
  normalized_data = normalize_data_values(abi_type, data_value)
353
358
  for value in match_values:
354
359
  if not codec.is_encodable(abi_type, value):
355
- raise ValueError(
360
+ raise Web3ValueError(
356
361
  f"Value {value} is of the wrong abi type. "
357
362
  f"Expected {abi_type} typed value."
358
363
  )
web3/_utils/formatters.py CHANGED
@@ -114,13 +114,13 @@ def apply_key_map(
114
114
  def is_array_of_strings(value: Any) -> bool:
115
115
  if not is_list_like(value):
116
116
  return False
117
- return all((is_string(item) for item in value))
117
+ return all(is_string(item) for item in value)
118
118
 
119
119
 
120
120
  def is_array_of_dicts(value: Any) -> bool:
121
121
  if not is_list_like(value):
122
122
  return False
123
- return all((is_dict(item) for item in value))
123
+ return all(is_dict(item) for item in value)
124
124
 
125
125
 
126
126
  @curry
web3/_utils/math.py CHANGED
@@ -5,6 +5,7 @@ from typing import (
5
5
 
6
6
  from web3.exceptions import (
7
7
  InsufficientData,
8
+ Web3ValueError,
8
9
  )
9
10
 
10
11
 
@@ -17,9 +18,9 @@ def percentile(
17
18
  f"Expected a sequence of at least 1 integers, got {values!r}"
18
19
  )
19
20
  if percentile is None:
20
- raise ValueError(f"Expected a percentile choice, got {percentile}")
21
+ raise Web3ValueError(f"Expected a percentile choice, got {percentile}")
21
22
  if percentile < 0 or percentile > 100:
22
- raise ValueError("percentile must be in the range [0, 100]")
23
+ raise Web3ValueError("percentile must be in the range [0, 100]")
23
24
 
24
25
  sorted_values = sorted(values)
25
26
 
@@ -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,6 +93,8 @@ 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,
@@ -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 TypeError(f"Cannot convert {val!r} to HexBytes")
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 ValueError(
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 = dict(
181
- (key_formatters(k), value_formatters(v)) for k, v in dict_like_object.items()
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)
@@ -285,6 +281,8 @@ RECEIPT_FORMATTERS = {
285
281
  "to": apply_formatter_if(is_address, to_checksum_address),
286
282
  "effectiveGasPrice": to_integer_if_hex,
287
283
  "type": to_integer_if_hex,
284
+ "blobGasPrice": to_integer_if_hex,
285
+ "blobGasUsed": to_integer_if_hex,
288
286
  }
289
287
 
290
288
 
@@ -423,7 +421,22 @@ filter_result_formatter = apply_one_of_formatters(
423
421
  )
424
422
  )
425
423
 
424
+ ACCESS_LIST_REQUEST_FORMATTER = type_aware_apply_formatters_to_dict(
425
+ {
426
+ "accessList": apply_formatter_if(
427
+ is_not_null,
428
+ apply_list_to_array_formatter(
429
+ apply_formatters_to_dict(
430
+ {
431
+ "storageKeys": apply_list_to_array_formatter(to_hex_if_bytes),
432
+ }
433
+ )
434
+ ),
435
+ ),
436
+ }
437
+ )
426
438
  transaction_param_formatter = compose(
439
+ ACCESS_LIST_REQUEST_FORMATTER,
427
440
  remove_key_if("to", lambda txn: txn["to"] in {"", b"", None}),
428
441
  remove_key_if("gasPrice", lambda txn: txn["gasPrice"] in {"", b"", None}),
429
442
  )
@@ -564,16 +577,6 @@ PYTHONIC_REQUEST_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
564
577
  RPC.eth_sendTransaction: apply_formatter_at_index(transaction_param_formatter, 0),
565
578
  RPC.eth_signTransaction: apply_formatter_at_index(transaction_param_formatter, 0),
566
579
  RPC.eth_getProof: apply_formatter_at_index(to_hex_if_integer, 2),
567
- # personal
568
- RPC.personal_importRawKey: apply_formatter_at_index(
569
- compose(remove_0x_prefix, hexstr_if_str(to_hex)),
570
- 0,
571
- ),
572
- RPC.personal_sign: apply_formatter_at_index(text_if_str(to_hex), 0),
573
- RPC.personal_ecRecover: apply_formatter_at_index(text_if_str(to_hex), 0),
574
- RPC.personal_sendTransaction: apply_formatter_at_index(
575
- transaction_param_formatter, 0
576
- ),
577
580
  # Snapshot and Revert
578
581
  RPC.evm_revert: apply_formatter_at_index(integer_to_hex, 0),
579
582
  # tracing
@@ -769,13 +772,6 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
769
772
  RPC.eth_signTransaction: apply_formatter_if(is_not_null, signed_tx_formatter),
770
773
  RPC.eth_signTypedData: HexBytes,
771
774
  RPC.eth_syncing: apply_formatter_if(is_not_false, syncing_formatter),
772
- # personal
773
- RPC.personal_importRawKey: to_checksum_address,
774
- RPC.personal_listAccounts: apply_list_to_array_formatter(to_checksum_address),
775
- RPC.personal_listWallets: apply_list_to_array_formatter(geth_wallets_formatter),
776
- RPC.personal_newAccount: to_checksum_address,
777
- RPC.personal_sendTransaction: to_hexbytes(32),
778
- RPC.personal_signTypedData: HexBytes,
779
775
  # Transaction Pool
780
776
  RPC.txpool_content: transaction_pool_content_formatter,
781
777
  RPC.txpool_inspect: transaction_pool_inspect_formatter,
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,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,