web3 7.0.0b7__py3-none-any.whl → 7.0.0b9__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 (50) hide show
  1. ens/async_ens.py +16 -7
  2. ens/base_ens.py +3 -1
  3. ens/exceptions.py +2 -7
  4. ens/utils.py +0 -17
  5. web3/_utils/abi.py +100 -257
  6. web3/_utils/compat/__init__.py +1 -0
  7. web3/_utils/contracts.py +116 -205
  8. web3/_utils/encoding.py +4 -5
  9. web3/_utils/events.py +28 -33
  10. web3/_utils/fee_utils.py +2 -2
  11. web3/_utils/filters.py +2 -5
  12. web3/_utils/http_session_manager.py +30 -7
  13. web3/_utils/method_formatters.py +21 -3
  14. web3/_utils/module_testing/eth_module.py +61 -39
  15. web3/_utils/module_testing/module_testing_utils.py +51 -10
  16. web3/_utils/module_testing/persistent_connection_provider.py +46 -16
  17. web3/_utils/module_testing/web3_module.py +8 -8
  18. web3/_utils/normalizers.py +10 -8
  19. web3/_utils/validation.py +5 -7
  20. web3/contract/async_contract.py +18 -17
  21. web3/contract/base_contract.py +116 -80
  22. web3/contract/contract.py +16 -17
  23. web3/contract/utils.py +86 -55
  24. web3/eth/async_eth.py +1 -2
  25. web3/eth/eth.py +1 -2
  26. web3/exceptions.py +28 -9
  27. web3/gas_strategies/time_based.py +4 -0
  28. web3/manager.py +68 -23
  29. web3/middleware/filter.py +3 -3
  30. web3/middleware/signing.py +6 -1
  31. web3/module.py +1 -1
  32. web3/providers/persistent/async_ipc.py +34 -79
  33. web3/providers/persistent/persistent.py +76 -7
  34. web3/providers/persistent/persistent_connection.py +47 -5
  35. web3/providers/persistent/websocket.py +19 -59
  36. web3/types.py +5 -45
  37. web3/utils/__init__.py +48 -4
  38. web3/utils/abi.py +575 -10
  39. web3/utils/caching.py +24 -0
  40. {web3-7.0.0b7.dist-info → web3-7.0.0b9.dist-info}/METADATA +14 -8
  41. {web3-7.0.0b7.dist-info → web3-7.0.0b9.dist-info}/RECORD +45 -50
  42. {web3-7.0.0b7.dist-info → web3-7.0.0b9.dist-info}/WHEEL +1 -1
  43. web3/tools/benchmark/__init__.py +0 -0
  44. web3/tools/benchmark/main.py +0 -190
  45. web3/tools/benchmark/node.py +0 -120
  46. web3/tools/benchmark/reporting.py +0 -39
  47. web3/tools/benchmark/utils.py +0 -69
  48. /web3/_utils/{function_identifiers.py → abi_element_identifiers.py} +0 -0
  49. {web3-7.0.0b7.dist-info → web3-7.0.0b9.dist-info}/LICENSE +0 -0
  50. {web3-7.0.0b7.dist-info → web3-7.0.0b9.dist-info}/top_level.txt +0 -0
@@ -20,15 +20,23 @@ from eth_abi.exceptions import (
20
20
  InsufficientDataBytes,
21
21
  )
22
22
  from eth_typing import (
23
+ ABI,
24
+ ABIComponentIndexed,
25
+ ABIElement,
26
+ ABIEvent,
27
+ ABIFunction,
23
28
  Address,
24
29
  ChecksumAddress,
25
30
  HexStr,
26
31
  )
27
32
  from eth_utils import (
33
+ abi_to_signature,
28
34
  add_0x_prefix,
29
35
  combomethod,
30
36
  encode_hex,
37
+ filter_abi_by_type,
31
38
  function_abi_to_4byte_selector,
39
+ get_normalized_abi_inputs,
32
40
  is_list_like,
33
41
  is_text,
34
42
  to_tuple,
@@ -38,21 +46,18 @@ from hexbytes import (
38
46
  )
39
47
 
40
48
  from web3._utils.abi import (
41
- abi_to_signature,
42
- check_if_arguments_can_be_encoded,
43
49
  fallback_func_abi_exists,
44
- filter_by_type,
45
- get_constructor_abi,
50
+ find_constructor_abi_element_by_type,
46
51
  is_array_type,
47
- merge_args_and_kwargs,
48
52
  receive_func_abi_exists,
49
53
  )
54
+ from web3._utils.abi_element_identifiers import (
55
+ FallbackFn,
56
+ ReceiveFn,
57
+ )
50
58
  from web3._utils.contracts import (
51
59
  decode_transaction_data,
52
60
  encode_abi,
53
- find_matching_event_abi,
54
- find_matching_fn_abi,
55
- get_function_info,
56
61
  prepare_transaction,
57
62
  )
58
63
  from web3._utils.datatypes import (
@@ -74,10 +79,6 @@ from web3._utils.events import (
74
79
  from web3._utils.filters import (
75
80
  construct_event_filter_params,
76
81
  )
77
- from web3._utils.function_identifiers import (
78
- FallbackFn,
79
- ReceiveFn,
80
- )
81
82
  from web3._utils.normalizers import (
82
83
  BASE_RETURN_NORMALIZERS,
83
84
  )
@@ -86,9 +87,10 @@ from web3.datastructures import (
86
87
  MutableAttributeDict,
87
88
  )
88
89
  from web3.exceptions import (
89
- ABIEventFunctionNotFound,
90
+ ABIEventNotFound,
91
+ ABIFallbackNotFound,
90
92
  ABIFunctionNotFound,
91
- FallbackNotFound,
93
+ ABIReceiveNotFound,
92
94
  InvalidEventABI,
93
95
  LogTopicError,
94
96
  MismatchedABI,
@@ -108,17 +110,20 @@ from web3.logs import (
108
110
  EventLogErrorFlags,
109
111
  )
110
112
  from web3.types import (
111
- ABI,
112
- ABIEvent,
113
- ABIFunction,
113
+ ABIElementIdentifier,
114
114
  BlockIdentifier,
115
115
  EventData,
116
116
  FilterParams,
117
- FunctionIdentifier,
118
117
  TContractFn,
119
118
  TxParams,
120
119
  TxReceipt,
121
120
  )
121
+ from web3.utils.abi import (
122
+ check_if_arguments_can_be_encoded,
123
+ get_abi_element,
124
+ get_abi_element_info,
125
+ get_event_abi,
126
+ )
122
127
 
123
128
  if TYPE_CHECKING:
124
129
  from web3 import ( # noqa: F401
@@ -155,7 +160,7 @@ class BaseContractEvent:
155
160
 
156
161
  @classmethod
157
162
  def _get_event_abi(cls) -> ABIEvent:
158
- return find_matching_event_abi(cls.contract_abi, event_name=cls.event_name)
163
+ return get_event_abi(cls.contract_abi, event_name=cls.event_name)
159
164
 
160
165
  @combomethod
161
166
  def process_receipt(
@@ -290,7 +295,7 @@ class BaseContractEvent:
290
295
  # if no non-indexed args in argument filters, since indexed args are
291
296
  # filtered pre-call to ``eth_getLogs`` by building specific ``topics``.
292
297
  not any(
293
- not arg["indexed"]
298
+ not cast(ABIComponentIndexed, arg)["indexed"]
294
299
  for arg in event_abi["inputs"]
295
300
  if arg["name"] in argument_filters
296
301
  )
@@ -415,7 +420,7 @@ class BaseContractEvents:
415
420
  ) -> None:
416
421
  if abi:
417
422
  self.abi = abi
418
- self._events = filter_by_type("event", self.abi)
423
+ self._events = filter_abi_by_type("event", self.abi)
419
424
  for event in self._events:
420
425
  setattr(
421
426
  self,
@@ -436,7 +441,7 @@ class BaseContractEvents:
436
441
  "Are you sure you provided the correct contract abi?",
437
442
  )
438
443
  elif event_name not in self.__dict__["_events"]:
439
- raise ABIEventFunctionNotFound(
444
+ raise ABIEventNotFound(
440
445
  f"The event '{event_name}' was not found in this contract's abi. ",
441
446
  "Are you sure you provided the correct contract abi?",
442
447
  )
@@ -458,7 +463,7 @@ class BaseContractEvents:
458
463
  def __hasattr__(self, event_name: str) -> bool:
459
464
  try:
460
465
  return event_name in self.__dict__["_events"]
461
- except ABIEventFunctionNotFound:
466
+ except ABIEventNotFound:
462
467
  return False
463
468
 
464
469
 
@@ -471,7 +476,7 @@ class BaseContractFunction:
471
476
  """
472
477
 
473
478
  address: ChecksumAddress = None
474
- function_identifier: FunctionIdentifier = None
479
+ abi_element_identifier: ABIElementIdentifier = None
475
480
  w3: Union["Web3", "AsyncWeb3"] = None
476
481
  contract_abi: ABI = None
477
482
  abi: ABIFunction = None
@@ -487,21 +492,36 @@ class BaseContractFunction:
487
492
 
488
493
  def _set_function_info(self) -> None:
489
494
  if not self.abi:
490
- self.abi = find_matching_fn_abi(
491
- self.contract_abi,
492
- self.w3.codec,
493
- self.function_identifier,
494
- self.args,
495
- self.kwargs,
495
+ self.abi = cast(
496
+ ABIFunction,
497
+ get_abi_element(
498
+ self.contract_abi,
499
+ self.abi_element_identifier,
500
+ *self.args,
501
+ abi_codec=self.w3.codec,
502
+ **self.kwargs,
503
+ ),
496
504
  )
497
- if self.function_identifier in [FallbackFn, ReceiveFn]:
505
+
506
+ if self.abi_element_identifier in [
507
+ FallbackFn,
508
+ ReceiveFn,
509
+ ]:
498
510
  self.selector = encode_hex(b"")
499
- elif is_text(self.function_identifier):
511
+ elif is_text(self.abi_element_identifier):
500
512
  self.selector = encode_hex(function_abi_to_4byte_selector(self.abi))
501
513
  else:
502
514
  raise Web3TypeError("Unsupported function identifier")
503
515
 
504
- self.arguments = merge_args_and_kwargs(self.abi, self.args, self.kwargs)
516
+ if self.abi_element_identifier in [
517
+ FallbackFn,
518
+ ReceiveFn,
519
+ ]:
520
+ self.arguments = None
521
+ else:
522
+ self.arguments = get_normalized_abi_inputs(
523
+ self.abi, *self.args, **self.kwargs
524
+ )
505
525
 
506
526
  def _get_call_txparams(self, transaction: Optional[TxParams] = None) -> TxParams:
507
527
  if transaction is None:
@@ -517,7 +537,7 @@ class BaseContractFunction:
517
537
  if self.w3.eth.default_account is not empty:
518
538
  call_transaction.setdefault(
519
539
  "from",
520
- self.w3.eth.default_account,
540
+ cast(ChecksumAddress, self.w3.eth.default_account),
521
541
  )
522
542
 
523
543
  if "to" not in call_transaction:
@@ -546,7 +566,9 @@ class BaseContractFunction:
546
566
  if self.address is not None:
547
567
  transact_transaction.setdefault("to", self.address)
548
568
  if self.w3.eth.default_account is not empty:
549
- transact_transaction.setdefault("from", self.w3.eth.default_account)
569
+ transact_transaction.setdefault(
570
+ "from", cast(ChecksumAddress, self.w3.eth.default_account)
571
+ )
550
572
 
551
573
  if "to" not in transact_transaction:
552
574
  if isinstance(self, type):
@@ -574,7 +596,9 @@ class BaseContractFunction:
574
596
  if self.address:
575
597
  estimate_gas_transaction.setdefault("to", self.address)
576
598
  if self.w3.eth.default_account is not empty:
577
- estimate_gas_transaction.setdefault("from", self.w3.eth.default_account)
599
+ estimate_gas_transaction.setdefault(
600
+ "from", cast(ChecksumAddress, self.w3.eth.default_account)
601
+ )
578
602
 
579
603
  if "to" not in estimate_gas_transaction:
580
604
  if isinstance(self, type):
@@ -656,7 +680,7 @@ class BaseContractFunctions:
656
680
  self.address = address
657
681
 
658
682
  if self.abi:
659
- self._functions = filter_by_type("function", self.abi)
683
+ self._functions = filter_abi_by_type("function", self.abi)
660
684
  for func in self._functions:
661
685
  setattr(
662
686
  self,
@@ -667,7 +691,7 @@ class BaseContractFunctions:
667
691
  contract_abi=self.abi,
668
692
  address=self.address,
669
693
  decode_tuples=decode_tuples,
670
- function_identifier=func["name"],
694
+ abi_element_identifier=func["name"],
671
695
  ),
672
696
  )
673
697
 
@@ -736,7 +760,7 @@ class BaseContract:
736
760
  @combomethod
737
761
  def encode_abi(
738
762
  cls,
739
- fn_name: str,
763
+ abi_element_identifier: str,
740
764
  args: Optional[Any] = None,
741
765
  kwargs: Optional[Any] = None,
742
766
  data: Optional[HexStr] = None,
@@ -747,18 +771,21 @@ class BaseContract:
747
771
 
748
772
  :param data: defaults to function selector
749
773
  """
750
- fn_abi, fn_selector, fn_arguments = get_function_info(
751
- fn_name,
752
- cls.w3.codec,
753
- contract_abi=cls.abi,
754
- args=args,
755
- kwargs=kwargs,
774
+ args = args or tuple()
775
+ kwargs = kwargs or {}
776
+
777
+ element_info = get_abi_element_info(
778
+ cls.abi,
779
+ abi_element_identifier,
780
+ *args,
781
+ abi_codec=cls.w3.codec,
782
+ **kwargs,
756
783
  )
757
784
 
758
785
  if data is None:
759
- data = fn_selector
786
+ data = element_info["selector"]
760
787
 
761
- return encode_abi(cls.w3, fn_abi, fn_arguments, data)
788
+ return encode_abi(cls.w3, element_info["abi"], element_info["arguments"], data)
762
789
 
763
790
  @combomethod
764
791
  def all_functions(
@@ -816,8 +843,7 @@ class BaseContract:
816
843
  def decode_function_input(
817
844
  self, data: HexStr
818
845
  ) -> Tuple["BaseContractFunction", Dict[str, Any]]:
819
- data = HexBytes(data)
820
- func = self.get_function_by_selector(data[:4])
846
+ func = self.get_function_by_selector(HexBytes(data)[:4])
821
847
  arguments = decode_transaction_data(
822
848
  func.abi, data, normalizers=BASE_RETURN_NORMALIZERS
823
849
  )
@@ -827,7 +853,10 @@ class BaseContract:
827
853
  def find_functions_by_args(self, *args: Any) -> "BaseContractFunction":
828
854
  def callable_check(fn_abi: ABIFunction) -> bool:
829
855
  return check_if_arguments_can_be_encoded(
830
- fn_abi, self.w3.codec, args=args, kwargs={}
856
+ fn_abi,
857
+ *args,
858
+ abi_codec=self.w3.codec,
859
+ **{},
831
860
  )
832
861
 
833
862
  return self.find_functions_by_identifier(
@@ -847,7 +876,7 @@ class BaseContract:
847
876
  @classmethod
848
877
  def _prepare_transaction(
849
878
  cls,
850
- fn_name: str,
879
+ abi_element_identifier: ABIElementIdentifier,
851
880
  fn_args: Optional[Any] = None,
852
881
  fn_kwargs: Optional[Any] = None,
853
882
  transaction: Optional[TxParams] = None,
@@ -855,7 +884,7 @@ class BaseContract:
855
884
  return prepare_transaction(
856
885
  cls.address,
857
886
  cls.w3,
858
- fn_identifier=fn_name,
887
+ abi_element_identifier=abi_element_identifier,
859
888
  contract_abi=cls.abi,
860
889
  transaction=transaction,
861
890
  fn_args=fn_args,
@@ -865,43 +894,42 @@ class BaseContract:
865
894
  @classmethod
866
895
  def _find_matching_fn_abi(
867
896
  cls,
868
- fn_identifier: Optional[str] = None,
869
- args: Optional[Any] = None,
870
- kwargs: Optional[Any] = None,
871
- ) -> ABIFunction:
872
- return find_matching_fn_abi(
873
- cls.abi, cls.w3.codec, fn_identifier=fn_identifier, args=args, kwargs=kwargs
897
+ fn_identifier: Optional[ABIElementIdentifier] = None,
898
+ *args: Sequence[Any],
899
+ **kwargs: Dict[str, Any],
900
+ ) -> ABIElement:
901
+ return get_abi_element(
902
+ cls.abi,
903
+ fn_identifier,
904
+ *args,
905
+ abi_codec=cls.w3.codec,
906
+ **kwargs,
874
907
  )
875
908
 
876
909
  @classmethod
877
- def _find_matching_event_abi(
910
+ def _get_event_abi(
878
911
  cls,
879
912
  event_name: Optional[str] = None,
880
913
  argument_names: Optional[Sequence[str]] = None,
881
914
  ) -> ABIEvent:
882
- return find_matching_event_abi(
915
+ return get_event_abi(
883
916
  abi=cls.abi, event_name=event_name, argument_names=argument_names
884
917
  )
885
918
 
886
919
  @combomethod
887
920
  def _encode_constructor_data(
888
- cls, args: Optional[Any] = None, kwargs: Optional[Any] = None
921
+ cls, *args: Sequence[Any], **kwargs: Dict[str, Any]
889
922
  ) -> HexStr:
890
- constructor_abi = get_constructor_abi(cls.abi)
923
+ constructor_abi = find_constructor_abi_element_by_type(cls.abi)
891
924
 
892
925
  if constructor_abi:
893
- if args is None:
894
- args = tuple()
895
- if kwargs is None:
896
- kwargs = {}
897
-
898
- arguments = merge_args_and_kwargs(constructor_abi, args, kwargs)
926
+ arguments = get_normalized_abi_inputs(constructor_abi, *args, **kwargs)
899
927
 
900
928
  deploy_data = add_0x_prefix(
901
929
  encode_abi(cls.w3, constructor_abi, arguments, data=cls.bytecode)
902
930
  )
903
931
  else:
904
- if args is not None or kwargs is not None:
932
+ if args or kwargs:
905
933
  msg = "Constructor args were provided, but no constructor function was provided." # noqa: E501
906
934
  raise Web3TypeError(msg)
907
935
 
@@ -942,7 +970,7 @@ class BaseContract:
942
970
  w3=w3,
943
971
  contract_abi=abi,
944
972
  address=address,
945
- function_identifier=FallbackFn,
973
+ abi_element_identifier=FallbackFn,
946
974
  )()
947
975
 
948
976
  return cast(function_type, NonExistentFallbackFunction()) # type: ignore
@@ -960,7 +988,7 @@ class BaseContract:
960
988
  w3=w3,
961
989
  contract_abi=abi,
962
990
  address=address,
963
- function_identifier=ReceiveFn,
991
+ abi_element_identifier=ReceiveFn,
964
992
  )()
965
993
 
966
994
  return cast(function_type, NonExistentReceiveFunction()) # type: ignore
@@ -990,7 +1018,7 @@ class BaseContractCaller:
990
1018
  """
991
1019
 
992
1020
  # mypy types
993
- _functions: List[Union[ABIFunction, ABIEvent]]
1021
+ _functions: Sequence[ABIFunction]
994
1022
 
995
1023
  def __init__(
996
1024
  self,
@@ -1006,6 +1034,9 @@ class BaseContractCaller:
1006
1034
  self._functions = []
1007
1035
 
1008
1036
  def __getattr__(self, function_name: str) -> Any:
1037
+ function_names = [
1038
+ fn["name"] for fn in self._functions if fn.get("type") == "function"
1039
+ ]
1009
1040
  if self.abi is None:
1010
1041
  raise NoABIFound(
1011
1042
  "There is no ABI found for this contract.",
@@ -1015,8 +1046,8 @@ class BaseContractCaller:
1015
1046
  "The ABI for this contract contains no function definitions. ",
1016
1047
  "Are you sure you provided the correct contract ABI?",
1017
1048
  )
1018
- elif function_name not in {fn["name"] for fn in self._functions}:
1019
- functions_available = ", ".join([fn["name"] for fn in self._functions])
1049
+ elif function_name not in function_names:
1050
+ functions_available = ", ".join(function_names)
1020
1051
  raise ABIFunctionNotFound(
1021
1052
  f"The function '{function_name}' was not found in this contract's ABI.",
1022
1053
  " Here is a list of all of the function names found: ",
@@ -1070,7 +1101,7 @@ class BaseContractConstructor:
1070
1101
 
1071
1102
  @combomethod
1072
1103
  def _encode_data_in_transaction(self, *args: Any, **kwargs: Any) -> HexStr:
1073
- constructor_abi = get_constructor_abi(self.abi)
1104
+ constructor_abi = find_constructor_abi_element_by_type(self.abi)
1074
1105
 
1075
1106
  if constructor_abi:
1076
1107
  if not args:
@@ -1078,7 +1109,8 @@ class BaseContractConstructor:
1078
1109
  if not kwargs:
1079
1110
  kwargs = {}
1080
1111
 
1081
- arguments = merge_args_and_kwargs(constructor_abi, args, kwargs)
1112
+ arguments = get_normalized_abi_inputs(constructor_abi, *args, **kwargs)
1113
+
1082
1114
  data = add_0x_prefix(
1083
1115
  encode_abi(self.w3, constructor_abi, arguments, data=self.bytecode)
1084
1116
  )
@@ -1098,7 +1130,9 @@ class BaseContractConstructor:
1098
1130
  )
1099
1131
 
1100
1132
  if self.w3.eth.default_account is not empty:
1101
- estimate_gas_transaction.setdefault("from", self.w3.eth.default_account)
1133
+ estimate_gas_transaction.setdefault(
1134
+ "from", cast(ChecksumAddress, self.w3.eth.default_account)
1135
+ )
1102
1136
 
1103
1137
  estimate_gas_transaction["data"] = self.data_in_transaction
1104
1138
 
@@ -1114,7 +1148,9 @@ class BaseContractConstructor:
1114
1148
  )
1115
1149
 
1116
1150
  if self.w3.eth.default_account is not empty:
1117
- transact_transaction.setdefault("from", self.w3.eth.default_account)
1151
+ transact_transaction.setdefault(
1152
+ "from", cast(ChecksumAddress, self.w3.eth.default_account)
1153
+ )
1118
1154
 
1119
1155
  transact_transaction["data"] = self.data_in_transaction
1120
1156
 
@@ -1140,7 +1176,7 @@ class BaseContractConstructor:
1140
1176
  class NonExistentFallbackFunction:
1141
1177
  @staticmethod
1142
1178
  def _raise_exception() -> NoReturn:
1143
- raise FallbackNotFound("No fallback function was found in the contract ABI.")
1179
+ raise ABIFallbackNotFound("No fallback function was found in the contract ABI.")
1144
1180
 
1145
1181
  def __getattr__(self, attr: Any) -> Callable[[], None]:
1146
1182
  return self._raise_exception
@@ -1149,7 +1185,7 @@ class NonExistentFallbackFunction:
1149
1185
  class NonExistentReceiveFunction:
1150
1186
  @staticmethod
1151
1187
  def _raise_exception() -> NoReturn:
1152
- raise FallbackNotFound("No receive function was found in the contract ABI.")
1188
+ raise ABIReceiveNotFound("No receive function was found in the contract ABI.")
1153
1189
 
1154
1190
  def __getattr__(self, attr: Any) -> Callable[[], None]:
1155
1191
  return self._raise_exception
web3/contract/contract.py CHANGED
@@ -13,10 +13,13 @@ from typing import (
13
13
  )
14
14
 
15
15
  from eth_typing import (
16
+ ABI,
16
17
  ChecksumAddress,
17
18
  )
18
19
  from eth_utils import (
19
20
  combomethod,
21
+ get_abi_input_names,
22
+ get_all_function_abis,
20
23
  )
21
24
  from eth_utils.toolz import (
22
25
  partial,
@@ -27,9 +30,12 @@ from hexbytes import (
27
30
 
28
31
  from web3._utils.abi import (
29
32
  fallback_func_abi_exists,
30
- filter_by_type,
31
33
  receive_func_abi_exists,
32
34
  )
35
+ from web3._utils.abi_element_identifiers import (
36
+ FallbackFn,
37
+ ReceiveFn,
38
+ )
33
39
  from web3._utils.compat import (
34
40
  Self,
35
41
  )
@@ -46,10 +52,6 @@ from web3._utils.events import (
46
52
  from web3._utils.filters import (
47
53
  LogFilter,
48
54
  )
49
- from web3._utils.function_identifiers import (
50
- FallbackFn,
51
- ReceiveFn,
52
- )
53
55
  from web3._utils.normalizers import (
54
56
  normalize_abi,
55
57
  normalize_address,
@@ -87,15 +89,11 @@ from web3.exceptions import (
87
89
  Web3ValueError,
88
90
  )
89
91
  from web3.types import (
90
- ABI,
91
92
  BlockIdentifier,
92
93
  EventData,
93
94
  StateOverride,
94
95
  TxParams,
95
96
  )
96
- from web3.utils import (
97
- get_abi_input_names,
98
- )
99
97
 
100
98
  if TYPE_CHECKING:
101
99
  from ens import ENS # noqa: F401
@@ -312,7 +310,7 @@ class ContractFunction(BaseContractFunction):
312
310
  self.w3,
313
311
  self.address,
314
312
  self._return_data_normalizers,
315
- self.function_identifier,
313
+ self.abi_element_identifier,
316
314
  call_transaction,
317
315
  block_id,
318
316
  self.contract_abi,
@@ -329,7 +327,7 @@ class ContractFunction(BaseContractFunction):
329
327
  return transact_with_contract_function(
330
328
  self.address,
331
329
  self.w3,
332
- self.function_identifier,
330
+ self.abi_element_identifier,
333
331
  setup_transaction,
334
332
  self.contract_abi,
335
333
  self.abi,
@@ -347,7 +345,7 @@ class ContractFunction(BaseContractFunction):
347
345
  return estimate_gas_for_function(
348
346
  self.address,
349
347
  self.w3,
350
- self.function_identifier,
348
+ self.abi_element_identifier,
351
349
  setup_transaction,
352
350
  self.contract_abi,
353
351
  self.abi,
@@ -362,7 +360,7 @@ class ContractFunction(BaseContractFunction):
362
360
  return build_transaction_for_function(
363
361
  self.address,
364
362
  self.w3,
365
- self.function_identifier,
363
+ self.abi_element_identifier,
366
364
  built_transaction,
367
365
  self.contract_abi,
368
366
  self.abi,
@@ -382,7 +380,7 @@ class ContractFunction(BaseContractFunction):
382
380
  w3=w3,
383
381
  contract_abi=abi,
384
382
  address=address,
385
- function_identifier=FallbackFn,
383
+ abi_element_identifier=FallbackFn,
386
384
  )()
387
385
  return cast(ContractFunction, NonExistentFallbackFunction())
388
386
 
@@ -398,7 +396,7 @@ class ContractFunction(BaseContractFunction):
398
396
  w3=w3,
399
397
  contract_abi=abi,
400
398
  address=address,
401
- function_identifier=ReceiveFn,
399
+ abi_element_identifier=ReceiveFn,
402
400
  )()
403
401
  return cast(ContractFunction, NonExistentReceiveFunction())
404
402
 
@@ -583,14 +581,15 @@ class ContractCaller(BaseContractCaller):
583
581
  if transaction is None:
584
582
  transaction = {}
585
583
 
586
- self._functions = filter_by_type("function", self.abi)
584
+ self._functions = get_all_function_abis(self.abi)
585
+
587
586
  for func in self._functions:
588
587
  fn = ContractFunction.factory(
589
588
  func["name"],
590
589
  w3=w3,
591
590
  contract_abi=self.abi,
592
591
  address=self.address,
593
- function_identifier=func["name"],
592
+ abi_element_identifier=func["name"],
594
593
  decode_tuples=decode_tuples,
595
594
  )
596
595