web3 7.5.0__tar.gz → 7.6.0__tar.gz

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 (353) hide show
  1. {web3-7.5.0/web3.egg-info → web3-7.6.0}/PKG-INFO +2 -2
  2. {web3-7.5.0 → web3-7.6.0}/setup.py +2 -2
  3. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/conftest.py +58 -2
  4. web3-7.6.0/tests/core/contracts/test_contract_ambiguous_events.py +259 -0
  5. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_ambiguous_functions.py +157 -34
  6. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_attributes.py +5 -0
  7. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_call_interface.py +222 -77
  8. web3-7.6.0/tests/core/contracts/test_contract_class_construction.py +146 -0
  9. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_method_to_argument_matching.py +57 -3
  10. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_abi.py +202 -14
  11. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_event_interface.py +2 -1
  12. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_http_session_manager.py +1 -1
  13. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_validation.py +1 -0
  14. {web3-7.5.0 → web3-7.6.0}/web3/_utils/abi.py +59 -1
  15. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/event_contracts.py +49 -4
  16. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contracts.py +48 -7
  17. {web3-7.5.0 → web3-7.6.0}/web3/_utils/method_formatters.py +1 -0
  18. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module_testing/eth_module.py +11 -0
  19. {web3-7.5.0 → web3-7.6.0}/web3/_utils/rpc_abi.py +1 -0
  20. {web3-7.5.0 → web3-7.6.0}/web3/_utils/validation.py +3 -0
  21. {web3-7.5.0 → web3-7.6.0}/web3/contract/async_contract.py +159 -52
  22. {web3-7.5.0 → web3-7.6.0}/web3/contract/base_contract.py +138 -102
  23. {web3-7.5.0 → web3-7.6.0}/web3/contract/contract.py +154 -47
  24. {web3-7.5.0 → web3-7.6.0}/web3/contract/utils.py +3 -2
  25. {web3-7.5.0 → web3-7.6.0}/web3/eth/async_eth.py +11 -0
  26. {web3-7.5.0 → web3-7.6.0}/web3/eth/eth.py +11 -0
  27. {web3-7.5.0 → web3-7.6.0}/web3/providers/eth_tester/defaults.py +1 -0
  28. {web3-7.5.0 → web3-7.6.0}/web3/utils/abi.py +308 -76
  29. {web3-7.5.0 → web3-7.6.0/web3.egg-info}/PKG-INFO +2 -2
  30. {web3-7.5.0 → web3-7.6.0}/web3.egg-info/SOURCES.txt +1 -0
  31. {web3-7.5.0 → web3-7.6.0}/web3.egg-info/requires.txt +1 -1
  32. web3-7.5.0/tests/core/contracts/test_contract_class_construction.py +0 -88
  33. {web3-7.5.0 → web3-7.6.0}/LICENSE +0 -0
  34. {web3-7.5.0 → web3-7.6.0}/MANIFEST.in +0 -0
  35. {web3-7.5.0 → web3-7.6.0}/README.md +0 -0
  36. {web3-7.5.0 → web3-7.6.0}/ens/__init__.py +0 -0
  37. {web3-7.5.0 → web3-7.6.0}/ens/_normalization.py +0 -0
  38. {web3-7.5.0 → web3-7.6.0}/ens/abis.py +0 -0
  39. {web3-7.5.0 → web3-7.6.0}/ens/async_ens.py +0 -0
  40. {web3-7.5.0 → web3-7.6.0}/ens/auto.py +0 -0
  41. {web3-7.5.0 → web3-7.6.0}/ens/base_ens.py +0 -0
  42. {web3-7.5.0 → web3-7.6.0}/ens/constants.py +0 -0
  43. {web3-7.5.0 → web3-7.6.0}/ens/contract_data.py +0 -0
  44. {web3-7.5.0 → web3-7.6.0}/ens/ens.py +0 -0
  45. {web3-7.5.0 → web3-7.6.0}/ens/exceptions.py +0 -0
  46. {web3-7.5.0 → web3-7.6.0}/ens/specs/nf.json +0 -0
  47. {web3-7.5.0 → web3-7.6.0}/ens/specs/normalization_spec.json +0 -0
  48. {web3-7.5.0 → web3-7.6.0}/ens/utils.py +0 -0
  49. {web3-7.5.0 → web3-7.6.0}/pyproject.toml +0 -0
  50. {web3-7.5.0 → web3-7.6.0}/setup.cfg +0 -0
  51. {web3-7.5.0 → web3-7.6.0}/tests/__init__.py +0 -0
  52. {web3-7.5.0 → web3-7.6.0}/tests/beacon/test_async_beacon.py +0 -0
  53. {web3-7.5.0 → web3-7.6.0}/tests/beacon/test_beacon.py +0 -0
  54. {web3-7.5.0 → web3-7.6.0}/tests/conftest.py +0 -0
  55. {web3-7.5.0 → web3-7.6.0}/tests/core/admin-module/test_admin_addPeer.py +0 -0
  56. {web3-7.5.0 → web3-7.6.0}/tests/core/admin-module/test_admin_nodeInfo.py +0 -0
  57. {web3-7.5.0 → web3-7.6.0}/tests/core/admin-module/test_admin_peers.py +0 -0
  58. {web3-7.5.0 → web3-7.6.0}/tests/core/block-utils/test_select_method_for_block_identifier.py +0 -0
  59. {web3-7.5.0 → web3-7.6.0}/tests/core/caching-utils/test_generate_cache_key.py +0 -0
  60. {web3-7.5.0 → web3-7.6.0}/tests/core/caching-utils/test_request_caching.py +0 -0
  61. {web3-7.5.0 → web3-7.6.0}/tests/core/conftest.py +0 -0
  62. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_build_transaction.py +0 -0
  63. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_caller_interface.py +0 -0
  64. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_constructor.py +0 -0
  65. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_constructor_encoding.py +0 -0
  66. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_deployment.py +0 -0
  67. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_estimate_gas.py +0 -0
  68. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_events.py +0 -0
  69. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_events_build_filter.py +0 -0
  70. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_example.py +0 -0
  71. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_init.py +0 -0
  72. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_method_abi_decoding.py +0 -0
  73. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_method_abi_encoding.py +0 -0
  74. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_panic_errors.py +0 -0
  75. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_transact_interface.py +0 -0
  76. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_contract_util_functions.py +0 -0
  77. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_extracting_event_data.py +0 -0
  78. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_extracting_event_data_old.py +0 -0
  79. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/test_offchain_lookup.py +0 -0
  80. {web3-7.5.0 → web3-7.6.0}/tests/core/contracts/utils.py +0 -0
  81. {web3-7.5.0 → web3-7.6.0}/tests/core/datastructures/test_datastructures.py +0 -0
  82. {web3-7.5.0 → web3-7.6.0}/tests/core/empty-object/test_empty_object_is_falsy.py +0 -0
  83. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/conftest.py +0 -0
  84. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/test_accounts.py +0 -0
  85. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/test_block_api.py +0 -0
  86. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/test_default_account_api.py +0 -0
  87. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/test_eth_contract.py +0 -0
  88. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/test_eth_fee_history.py +0 -0
  89. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/test_eth_filter.py +0 -0
  90. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/test_eth_properties.py +0 -0
  91. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/test_gas_pricing.py +0 -0
  92. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/test_poa.py +0 -0
  93. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-module/test_transactions.py +0 -0
  94. {web3-7.5.0 → web3-7.6.0}/tests/core/eth-tester-api/test_withdrawals.py +0 -0
  95. {web3-7.5.0 → web3-7.6.0}/tests/core/exceptions/test_exceptions.py +0 -0
  96. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/conftest.py +0 -0
  97. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_basic_filter_tests.py +0 -0
  98. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_contract_create_filter_topic_merging.py +0 -0
  99. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_contract_data_filters.py +0 -0
  100. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_contract_get_logs.py +0 -0
  101. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_contract_on_event_filtering.py +0 -0
  102. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_contract_past_event_filtering.py +0 -0
  103. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_contract_topic_filters.py +0 -0
  104. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_existing_filter_instance.py +0 -0
  105. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_filter_against_latest_blocks.py +0 -0
  106. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_filter_against_pending_transactions.py +0 -0
  107. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_filter_against_transaction_logs.py +0 -0
  108. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_filters_against_many_blocks.py +0 -0
  109. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/test_utils_functions.py +0 -0
  110. {web3-7.5.0 → web3-7.6.0}/tests/core/filtering/utils.py +0 -0
  111. {web3-7.5.0 → web3-7.6.0}/tests/core/gas-strategies/test_rpc_gas_pricing_strategies.py +0 -0
  112. {web3-7.5.0 → web3-7.6.0}/tests/core/gas-strategies/test_time_based_gas_price_strategy.py +0 -0
  113. {web3-7.5.0 → web3-7.6.0}/tests/core/manager/conftest.py +0 -0
  114. {web3-7.5.0 → web3-7.6.0}/tests/core/manager/test_default_middlewares.py +0 -0
  115. {web3-7.5.0 → web3-7.6.0}/tests/core/manager/test_middleware_can_be_stateful.py +0 -0
  116. {web3-7.5.0 → web3-7.6.0}/tests/core/manager/test_middleware_onion_api.py +0 -0
  117. {web3-7.5.0 → web3-7.6.0}/tests/core/manager/test_provider_property.py +0 -0
  118. {web3-7.5.0 → web3-7.6.0}/tests/core/manager/test_provider_request_wrapping.py +0 -0
  119. {web3-7.5.0 → web3-7.6.0}/tests/core/manager/test_response_formatters.py +0 -0
  120. {web3-7.5.0 → web3-7.6.0}/tests/core/method-class/test_method.py +0 -0
  121. {web3-7.5.0 → web3-7.6.0}/tests/core/method-class/test_result_formatters.py +0 -0
  122. {web3-7.5.0 → web3-7.6.0}/tests/core/middleware/test_attrdict_middleware.py +0 -0
  123. {web3-7.5.0 → web3-7.6.0}/tests/core/middleware/test_eth_tester_middleware.py +0 -0
  124. {web3-7.5.0 → web3-7.6.0}/tests/core/middleware/test_filter_middleware.py +0 -0
  125. {web3-7.5.0 → web3-7.6.0}/tests/core/middleware/test_formatting_middleware.py +0 -0
  126. {web3-7.5.0 → web3-7.6.0}/tests/core/middleware/test_gas_price_strategy.py +0 -0
  127. {web3-7.5.0 → web3-7.6.0}/tests/core/middleware/test_middleware.py +0 -0
  128. {web3-7.5.0 → web3-7.6.0}/tests/core/middleware/test_name_to_address_middleware.py +0 -0
  129. {web3-7.5.0 → web3-7.6.0}/tests/core/middleware/test_stalecheck.py +0 -0
  130. {web3-7.5.0 → web3-7.6.0}/tests/core/middleware/test_transaction_signing.py +0 -0
  131. {web3-7.5.0 → web3-7.6.0}/tests/core/module-class/test_module.py +0 -0
  132. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_async_http_provider.py +0 -0
  133. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_async_ipc_provider.py +0 -0
  134. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_async_tester_provider.py +0 -0
  135. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_auto_provider.py +0 -0
  136. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_base_provider.py +0 -0
  137. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_http_provider.py +0 -0
  138. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_http_request_retry.py +0 -0
  139. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_ipc_provider.py +0 -0
  140. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_legacy_websocket_provider.py +0 -0
  141. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_provider_init.py +0 -0
  142. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_tester_provider.py +0 -0
  143. {web3-7.5.0 → web3-7.6.0}/tests/core/providers/test_websocket_provider.py +0 -0
  144. {web3-7.5.0 → web3-7.6.0}/tests/core/test_library_files.py +0 -0
  145. {web3-7.5.0 → web3-7.6.0}/tests/core/testing-module/test_testing_mine.py +0 -0
  146. {web3-7.5.0 → web3-7.6.0}/tests/core/testing-module/test_testing_snapshot_and_revert.py +0 -0
  147. {web3-7.5.0 → web3-7.6.0}/tests/core/testing-module/test_testing_timeTravel.py +0 -0
  148. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/__init__.py +0 -0
  149. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/conftest.py +0 -0
  150. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_abi_filtering_by_argument_name.py +0 -0
  151. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_abi_is_encodable.py +0 -0
  152. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_abi_named_tree.py +0 -0
  153. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_address.py +0 -0
  154. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_async_transaction.py +0 -0
  155. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_attach_modules.py +0 -0
  156. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_attributedict.py +0 -0
  157. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_caching_utils.py +0 -0
  158. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_construct_event_data_set.py +0 -0
  159. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_construct_event_filter_params.py +0 -0
  160. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_construct_event_topics.py +0 -0
  161. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_datatypes.py +0 -0
  162. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_decorators.py +0 -0
  163. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_encoding.py +0 -0
  164. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_event_filter_builder.py +0 -0
  165. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_fee_utils.py +0 -0
  166. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_formatters.py +0 -0
  167. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_is_predefined_block_number.py +0 -0
  168. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_is_probably_enum.py +0 -0
  169. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_is_recognized_type.py +0 -0
  170. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_math.py +0 -0
  171. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_method_formatters.py +0 -0
  172. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_prepare_transaction_replacement.py +0 -0
  173. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_select_filter_method.py +0 -0
  174. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_threads.py +0 -0
  175. {web3-7.5.0 → web3-7.6.0}/tests/core/utilities/test_valid_transaction_params.py +0 -0
  176. {web3-7.5.0 → web3-7.6.0}/tests/core/web3-module/test_api.py +0 -0
  177. {web3-7.5.0 → web3-7.6.0}/tests/core/web3-module/test_attach_modules.py +0 -0
  178. {web3-7.5.0 → web3-7.6.0}/tests/core/web3-module/test_client_version.py +0 -0
  179. {web3-7.5.0 → web3-7.6.0}/tests/core/web3-module/test_conversions.py +0 -0
  180. {web3-7.5.0 → web3-7.6.0}/tests/core/web3-module/test_import_and_version.py +0 -0
  181. {web3-7.5.0 → web3-7.6.0}/tests/core/web3-module/test_keccak.py +0 -0
  182. {web3-7.5.0 → web3-7.6.0}/tests/core/web3-module/test_providers.py +0 -0
  183. {web3-7.5.0 → web3-7.6.0}/tests/core/web3-module/test_strict_bytes_type_checking.py +0 -0
  184. {web3-7.5.0 → web3-7.6.0}/tests/core/web3-module/test_web3_inheritance.py +0 -0
  185. {web3-7.5.0 → web3-7.6.0}/tests/ens/conftest.py +0 -0
  186. {web3-7.5.0 → web3-7.6.0}/tests/ens/normalization/normalization_tests.json +0 -0
  187. {web3-7.5.0 → web3-7.6.0}/tests/ens/normalization/test_normalize_name_ensip15.py +0 -0
  188. {web3-7.5.0 → web3-7.6.0}/tests/ens/test_ens.py +0 -0
  189. {web3-7.5.0 → web3-7.6.0}/tests/ens/test_get_registry.py +0 -0
  190. {web3-7.5.0 → web3-7.6.0}/tests/ens/test_get_text.py +0 -0
  191. {web3-7.5.0 → web3-7.6.0}/tests/ens/test_nameprep.py +0 -0
  192. {web3-7.5.0 → web3-7.6.0}/tests/ens/test_offchain_resolution.py +0 -0
  193. {web3-7.5.0 → web3-7.6.0}/tests/ens/test_setup_address.py +0 -0
  194. {web3-7.5.0 → web3-7.6.0}/tests/ens/test_setup_name.py +0 -0
  195. {web3-7.5.0 → web3-7.6.0}/tests/ens/test_utils.py +0 -0
  196. {web3-7.5.0 → web3-7.6.0}/tests/ens/test_wildcard_resolution.py +0 -0
  197. {web3-7.5.0 → web3-7.6.0}/tests/integration/README.md +0 -0
  198. {web3-7.5.0 → web3-7.6.0}/tests/integration/common.py +0 -0
  199. {web3-7.5.0 → web3-7.6.0}/tests/integration/conftest.py +0 -0
  200. {web3-7.5.0 → web3-7.6.0}/tests/integration/generate_fixtures/common.py +0 -0
  201. {web3-7.5.0 → web3-7.6.0}/tests/integration/generate_fixtures/go_ethereum.py +0 -0
  202. {web3-7.5.0 → web3-7.6.0}/tests/integration/geth-1.14.5-fixture.zip +0 -0
  203. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/__init__.py +0 -0
  204. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/common.py +0 -0
  205. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/conftest.py +0 -0
  206. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/test_goethereum_http.py +0 -0
  207. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/test_goethereum_ipc.py +0 -0
  208. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/test_goethereum_legacy_ws.py +0 -0
  209. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/test_goethereum_ws/__init__.py +0 -0
  210. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/test_goethereum_ws/conftest.py +0 -0
  211. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_await_w3.py +0 -0
  212. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_ctx_manager_w3.py +0 -0
  213. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_iterator_w3.py +0 -0
  214. {web3-7.5.0 → web3-7.6.0}/tests/integration/go_ethereum/utils.py +0 -0
  215. {web3-7.5.0 → web3-7.6.0}/tests/integration/test_ethereum_tester.py +0 -0
  216. {web3-7.5.0 → web3-7.6.0}/tests/utils.py +0 -0
  217. {web3-7.5.0 → web3-7.6.0}/web3/__init__.py +0 -0
  218. {web3-7.5.0 → web3-7.6.0}/web3/_utils/__init__.py +0 -0
  219. {web3-7.5.0 → web3-7.6.0}/web3/_utils/abi_element_identifiers.py +0 -0
  220. {web3-7.5.0 → web3-7.6.0}/web3/_utils/async_caching.py +0 -0
  221. {web3-7.5.0 → web3-7.6.0}/web3/_utils/async_transactions.py +0 -0
  222. {web3-7.5.0 → web3-7.6.0}/web3/_utils/batching.py +0 -0
  223. {web3-7.5.0 → web3-7.6.0}/web3/_utils/blocks.py +0 -0
  224. {web3-7.5.0 → web3-7.6.0}/web3/_utils/caching/__init__.py +0 -0
  225. {web3-7.5.0 → web3-7.6.0}/web3/_utils/caching/caching_utils.py +0 -0
  226. {web3-7.5.0 → web3-7.6.0}/web3/_utils/caching/request_caching_validation.py +0 -0
  227. {web3-7.5.0 → web3-7.6.0}/web3/_utils/compat/__init__.py +0 -0
  228. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/__init__.py +0 -0
  229. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/compile_contracts.py +0 -0
  230. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/__init__.py +0 -0
  231. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/_custom_contract_data.py +0 -0
  232. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/arrays_contract.py +0 -0
  233. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/bytes_contracts.py +0 -0
  234. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/constructor_contracts.py +0 -0
  235. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/contract_caller_tester.py +0 -0
  236. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/emitter_contract.py +0 -0
  237. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/extended_resolver.py +0 -0
  238. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/fallback_function_contract.py +0 -0
  239. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +0 -0
  240. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/math_contract.py +0 -0
  241. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/offchain_lookup.py +0 -0
  242. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/offchain_resolver.py +0 -0
  243. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/panic_errors_contract.py +0 -0
  244. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/payable_tester.py +0 -0
  245. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/receive_function_contracts.py +0 -0
  246. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/reflector_contracts.py +0 -0
  247. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/revert_contract.py +0 -0
  248. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/simple_resolver.py +0 -0
  249. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/storage_contract.py +0 -0
  250. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/string_contract.py +0 -0
  251. {web3-7.5.0 → web3-7.6.0}/web3/_utils/contract_sources/contract_data/tuple_contracts.py +0 -0
  252. {web3-7.5.0 → web3-7.6.0}/web3/_utils/datatypes.py +0 -0
  253. {web3-7.5.0 → web3-7.6.0}/web3/_utils/decorators.py +0 -0
  254. {web3-7.5.0 → web3-7.6.0}/web3/_utils/empty.py +0 -0
  255. {web3-7.5.0 → web3-7.6.0}/web3/_utils/encoding.py +0 -0
  256. {web3-7.5.0 → web3-7.6.0}/web3/_utils/ens.py +0 -0
  257. {web3-7.5.0 → web3-7.6.0}/web3/_utils/error_formatters_utils.py +0 -0
  258. {web3-7.5.0 → web3-7.6.0}/web3/_utils/events.py +0 -0
  259. {web3-7.5.0 → web3-7.6.0}/web3/_utils/fee_utils.py +0 -0
  260. {web3-7.5.0 → web3-7.6.0}/web3/_utils/filters.py +0 -0
  261. {web3-7.5.0 → web3-7.6.0}/web3/_utils/formatters.py +0 -0
  262. {web3-7.5.0 → web3-7.6.0}/web3/_utils/http.py +0 -0
  263. {web3-7.5.0 → web3-7.6.0}/web3/_utils/http_session_manager.py +0 -0
  264. {web3-7.5.0 → web3-7.6.0}/web3/_utils/hypothesis.py +0 -0
  265. {web3-7.5.0 → web3-7.6.0}/web3/_utils/math.py +0 -0
  266. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module.py +0 -0
  267. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module_testing/__init__.py +0 -0
  268. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module_testing/go_ethereum_admin_module.py +0 -0
  269. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module_testing/go_ethereum_debug_module.py +0 -0
  270. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module_testing/go_ethereum_txpool_module.py +0 -0
  271. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module_testing/module_testing_utils.py +0 -0
  272. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module_testing/net_module.py +0 -0
  273. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module_testing/persistent_connection_provider.py +0 -0
  274. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module_testing/utils.py +0 -0
  275. {web3-7.5.0 → web3-7.6.0}/web3/_utils/module_testing/web3_module.py +0 -0
  276. {web3-7.5.0 → web3-7.6.0}/web3/_utils/normalizers.py +0 -0
  277. {web3-7.5.0 → web3-7.6.0}/web3/_utils/threads.py +0 -0
  278. {web3-7.5.0 → web3-7.6.0}/web3/_utils/transactions.py +0 -0
  279. {web3-7.5.0 → web3-7.6.0}/web3/_utils/type_conversion.py +0 -0
  280. {web3-7.5.0 → web3-7.6.0}/web3/_utils/utility_methods.py +0 -0
  281. {web3-7.5.0 → web3-7.6.0}/web3/_utils/windows.py +0 -0
  282. {web3-7.5.0 → web3-7.6.0}/web3/auto/__init__.py +0 -0
  283. {web3-7.5.0 → web3-7.6.0}/web3/auto/gethdev.py +0 -0
  284. {web3-7.5.0 → web3-7.6.0}/web3/beacon/__init__.py +0 -0
  285. {web3-7.5.0 → web3-7.6.0}/web3/beacon/api_endpoints.py +0 -0
  286. {web3-7.5.0 → web3-7.6.0}/web3/beacon/async_beacon.py +0 -0
  287. {web3-7.5.0 → web3-7.6.0}/web3/beacon/beacon.py +0 -0
  288. {web3-7.5.0 → web3-7.6.0}/web3/constants.py +0 -0
  289. {web3-7.5.0 → web3-7.6.0}/web3/contract/__init__.py +0 -0
  290. {web3-7.5.0 → web3-7.6.0}/web3/datastructures.py +0 -0
  291. {web3-7.5.0 → web3-7.6.0}/web3/eth/__init__.py +0 -0
  292. {web3-7.5.0 → web3-7.6.0}/web3/eth/base_eth.py +0 -0
  293. {web3-7.5.0 → web3-7.6.0}/web3/exceptions.py +0 -0
  294. {web3-7.5.0 → web3-7.6.0}/web3/gas_strategies/__init__.py +0 -0
  295. {web3-7.5.0 → web3-7.6.0}/web3/gas_strategies/rpc.py +0 -0
  296. {web3-7.5.0 → web3-7.6.0}/web3/gas_strategies/time_based.py +0 -0
  297. {web3-7.5.0 → web3-7.6.0}/web3/geth.py +0 -0
  298. {web3-7.5.0 → web3-7.6.0}/web3/logs.py +0 -0
  299. {web3-7.5.0 → web3-7.6.0}/web3/main.py +0 -0
  300. {web3-7.5.0 → web3-7.6.0}/web3/manager.py +0 -0
  301. {web3-7.5.0 → web3-7.6.0}/web3/method.py +0 -0
  302. {web3-7.5.0 → web3-7.6.0}/web3/middleware/__init__.py +0 -0
  303. {web3-7.5.0 → web3-7.6.0}/web3/middleware/attrdict.py +0 -0
  304. {web3-7.5.0 → web3-7.6.0}/web3/middleware/base.py +0 -0
  305. {web3-7.5.0 → web3-7.6.0}/web3/middleware/buffered_gas_estimate.py +0 -0
  306. {web3-7.5.0 → web3-7.6.0}/web3/middleware/filter.py +0 -0
  307. {web3-7.5.0 → web3-7.6.0}/web3/middleware/formatting.py +0 -0
  308. {web3-7.5.0 → web3-7.6.0}/web3/middleware/gas_price_strategy.py +0 -0
  309. {web3-7.5.0 → web3-7.6.0}/web3/middleware/names.py +0 -0
  310. {web3-7.5.0 → web3-7.6.0}/web3/middleware/proof_of_authority.py +0 -0
  311. {web3-7.5.0 → web3-7.6.0}/web3/middleware/pythonic.py +0 -0
  312. {web3-7.5.0 → web3-7.6.0}/web3/middleware/signing.py +0 -0
  313. {web3-7.5.0 → web3-7.6.0}/web3/middleware/stalecheck.py +0 -0
  314. {web3-7.5.0 → web3-7.6.0}/web3/middleware/validation.py +0 -0
  315. {web3-7.5.0 → web3-7.6.0}/web3/module.py +0 -0
  316. {web3-7.5.0 → web3-7.6.0}/web3/net.py +0 -0
  317. {web3-7.5.0 → web3-7.6.0}/web3/providers/__init__.py +0 -0
  318. {web3-7.5.0 → web3-7.6.0}/web3/providers/async_base.py +0 -0
  319. {web3-7.5.0 → web3-7.6.0}/web3/providers/auto.py +0 -0
  320. {web3-7.5.0 → web3-7.6.0}/web3/providers/base.py +0 -0
  321. {web3-7.5.0 → web3-7.6.0}/web3/providers/eth_tester/__init__.py +0 -0
  322. {web3-7.5.0 → web3-7.6.0}/web3/providers/eth_tester/main.py +0 -0
  323. {web3-7.5.0 → web3-7.6.0}/web3/providers/eth_tester/middleware.py +0 -0
  324. {web3-7.5.0 → web3-7.6.0}/web3/providers/ipc.py +0 -0
  325. {web3-7.5.0 → web3-7.6.0}/web3/providers/legacy_websocket.py +0 -0
  326. {web3-7.5.0 → web3-7.6.0}/web3/providers/persistent/__init__.py +0 -0
  327. {web3-7.5.0 → web3-7.6.0}/web3/providers/persistent/async_ipc.py +0 -0
  328. {web3-7.5.0 → web3-7.6.0}/web3/providers/persistent/persistent.py +0 -0
  329. {web3-7.5.0 → web3-7.6.0}/web3/providers/persistent/persistent_connection.py +0 -0
  330. {web3-7.5.0 → web3-7.6.0}/web3/providers/persistent/request_processor.py +0 -0
  331. {web3-7.5.0 → web3-7.6.0}/web3/providers/persistent/utils.py +0 -0
  332. {web3-7.5.0 → web3-7.6.0}/web3/providers/persistent/websocket.py +0 -0
  333. {web3-7.5.0 → web3-7.6.0}/web3/providers/rpc/__init__.py +0 -0
  334. {web3-7.5.0 → web3-7.6.0}/web3/providers/rpc/async_rpc.py +0 -0
  335. {web3-7.5.0 → web3-7.6.0}/web3/providers/rpc/rpc.py +0 -0
  336. {web3-7.5.0 → web3-7.6.0}/web3/providers/rpc/utils.py +0 -0
  337. {web3-7.5.0 → web3-7.6.0}/web3/py.typed +0 -0
  338. {web3-7.5.0 → web3-7.6.0}/web3/scripts/__init__.py +0 -0
  339. {web3-7.5.0 → web3-7.6.0}/web3/scripts/install_pre_releases.py +0 -0
  340. {web3-7.5.0 → web3-7.6.0}/web3/scripts/parse_pygeth_version.py +0 -0
  341. {web3-7.5.0 → web3-7.6.0}/web3/scripts/release/__init__.py +0 -0
  342. {web3-7.5.0 → web3-7.6.0}/web3/scripts/release/test_package.py +0 -0
  343. {web3-7.5.0 → web3-7.6.0}/web3/testing.py +0 -0
  344. {web3-7.5.0 → web3-7.6.0}/web3/tracing.py +0 -0
  345. {web3-7.5.0 → web3-7.6.0}/web3/types.py +0 -0
  346. {web3-7.5.0 → web3-7.6.0}/web3/utils/__init__.py +0 -0
  347. {web3-7.5.0 → web3-7.6.0}/web3/utils/address.py +0 -0
  348. {web3-7.5.0 → web3-7.6.0}/web3/utils/async_exception_handling.py +0 -0
  349. {web3-7.5.0 → web3-7.6.0}/web3/utils/caching.py +0 -0
  350. {web3-7.5.0 → web3-7.6.0}/web3/utils/exception_handling.py +0 -0
  351. {web3-7.5.0 → web3-7.6.0}/web3.egg-info/dependency_links.txt +0 -0
  352. {web3-7.5.0 → web3-7.6.0}/web3.egg-info/not-zip-safe +0 -0
  353. {web3-7.5.0 → web3-7.6.0}/web3.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: web3
3
- Version: 7.5.0
3
+ Version: 7.6.0
4
4
  Summary: web3: A Python library for interacting with Ethereum
5
5
  Home-page: https://github.com/ethereum/web3.py
6
6
  Author: The Ethereum Foundation
@@ -33,7 +33,7 @@ Requires-Dist: pywin32>=223; platform_system == "Windows"
33
33
  Requires-Dist: requests>=2.23.0
34
34
  Requires-Dist: typing-extensions>=4.0.1
35
35
  Requires-Dist: types-requests>=2.0.0
36
- Requires-Dist: websockets>=10.0.0
36
+ Requires-Dist: websockets<14.0.0,>=10.0.0
37
37
  Requires-Dist: pyunormalize>=15.0.0
38
38
  Provides-Extra: tester
39
39
  Requires-Dist: eth-tester[py-evm]<0.13.0b1,>=0.11.0b1; extra == "tester"
@@ -55,7 +55,7 @@ with open("./README.md") as readme:
55
55
  setup(
56
56
  name="web3",
57
57
  # *IMPORTANT*: Don't manually change the version here. Use `make bump`, as described in readme
58
- version="7.5.0",
58
+ version="7.6.0",
59
59
  description="""web3: A Python library for interacting with Ethereum""",
60
60
  long_description=long_description,
61
61
  long_description_content_type="text/markdown",
@@ -78,7 +78,7 @@ setup(
78
78
  "requests>=2.23.0",
79
79
  "typing-extensions>=4.0.1",
80
80
  "types-requests>=2.0.0",
81
- "websockets>=10.0.0",
81
+ "websockets>=10.0.0,<14.0.0",
82
82
  "pyunormalize>=15.0.0",
83
83
  ],
84
84
  python_requires=">=3.8, <4",
@@ -10,6 +10,9 @@ from tests.core.contracts.utils import (
10
10
  from tests.utils import (
11
11
  async_partial,
12
12
  )
13
+ from web3._utils.abi import (
14
+ get_abi_element_signature,
15
+ )
13
16
  from web3._utils.contract_sources.contract_data.arrays_contract import (
14
17
  ARRAYS_CONTRACT_DATA,
15
18
  )
@@ -22,6 +25,7 @@ from web3._utils.contract_sources.contract_data.contract_caller_tester import (
22
25
  CONTRACT_CALLER_TESTER_DATA,
23
26
  )
24
27
  from web3._utils.contract_sources.contract_data.event_contracts import (
28
+ AMBIGUOUS_EVENT_NAME_CONTRACT_DATA,
25
29
  EVENT_CONTRACT_DATA,
26
30
  INDEXED_EVENT_CONTRACT_DATA,
27
31
  )
@@ -61,6 +65,10 @@ from web3._utils.contract_sources.contract_data.tuple_contracts import (
61
65
  from web3.exceptions import (
62
66
  Web3ValueError,
63
67
  )
68
+ from web3.utils.abi import (
69
+ abi_to_signature,
70
+ get_abi_element,
71
+ )
64
72
 
65
73
  # --- function name tester contract --- #
66
74
 
@@ -283,6 +291,30 @@ def indexed_event_contract(
283
291
  return indexed_event_contract
284
292
 
285
293
 
294
+ @pytest.fixture
295
+ def ambiguous_event_contract(
296
+ w3, wait_for_block, wait_for_transaction, address_conversion_func
297
+ ):
298
+ wait_for_block(w3)
299
+
300
+ ambiguous_event_contract_factory = w3.eth.contract(
301
+ **AMBIGUOUS_EVENT_NAME_CONTRACT_DATA
302
+ )
303
+ deploy_txn_hash = ambiguous_event_contract_factory.constructor().transact(
304
+ {"gas": 1000000}
305
+ )
306
+ deploy_receipt = wait_for_transaction(w3, deploy_txn_hash)
307
+ contract_address = address_conversion_func(deploy_receipt["contractAddress"])
308
+
309
+ bytecode = w3.eth.get_code(contract_address)
310
+ assert bytecode == ambiguous_event_contract_factory.bytecode_runtime
311
+ ambiguous_event_name_contract = ambiguous_event_contract_factory(
312
+ address=contract_address
313
+ )
314
+ assert ambiguous_event_name_contract.address == contract_address
315
+ return ambiguous_event_name_contract
316
+
317
+
286
318
  # --- arrays contract --- #
287
319
 
288
320
 
@@ -470,6 +502,11 @@ def invoke_contract(
470
502
  func_kwargs=None,
471
503
  tx_params=None,
472
504
  ):
505
+ function_signature = contract_function
506
+ function_arg_count = len(func_args or ()) + len(func_kwargs or {})
507
+ if function_arg_count == 0:
508
+ function_signature = get_abi_element_signature(contract_function)
509
+
473
510
  if func_args is None:
474
511
  func_args = []
475
512
  if func_kwargs is None:
@@ -482,7 +519,14 @@ def invoke_contract(
482
519
  f"allowable_invoke_method must be one of: {allowable_call_desig}"
483
520
  )
484
521
 
485
- function = contract.functions[contract_function]
522
+ fn_abi = get_abi_element(
523
+ contract.abi,
524
+ function_signature,
525
+ *func_args,
526
+ abi_codec=contract.w3.codec,
527
+ **func_kwargs,
528
+ )
529
+ function = contract.functions[abi_to_signature(fn_abi)]
486
530
  result = getattr(function(*func_args, **func_kwargs), api_call_desig)(tx_params)
487
531
 
488
532
  return result
@@ -744,6 +788,11 @@ async def async_invoke_contract(
744
788
  func_kwargs=None,
745
789
  tx_params=None,
746
790
  ):
791
+ function_signature = contract_function
792
+ function_arg_count = len(func_args or ()) + len(func_kwargs or {})
793
+ if function_arg_count == 0:
794
+ function_signature = get_abi_element_signature(contract_function)
795
+
747
796
  if func_args is None:
748
797
  func_args = []
749
798
  if func_kwargs is None:
@@ -756,7 +805,14 @@ async def async_invoke_contract(
756
805
  f"allowable_invoke_method must be one of: {allowable_call_desig}"
757
806
  )
758
807
 
759
- function = contract.functions[contract_function]
808
+ fn_abi = get_abi_element(
809
+ contract.abi,
810
+ function_signature,
811
+ *func_args,
812
+ abi_codec=contract.w3.codec,
813
+ **func_kwargs,
814
+ )
815
+ function = contract.functions[abi_to_signature(fn_abi)]
760
816
  result = await getattr(function(*func_args, **func_kwargs), api_call_desig)(
761
817
  tx_params
762
818
  )
@@ -0,0 +1,259 @@
1
+ import pytest
2
+ from typing import (
3
+ cast,
4
+ )
5
+
6
+ from eth_typing import (
7
+ ABI,
8
+ )
9
+
10
+ from web3.contract.contract import (
11
+ Contract,
12
+ ContractEvent,
13
+ )
14
+ from web3.exceptions import (
15
+ MismatchedABI,
16
+ )
17
+ from web3.main import (
18
+ Web3,
19
+ )
20
+ from web3.utils.abi import (
21
+ get_abi_element,
22
+ )
23
+
24
+ ABI_EVENT_TRANSFER = {
25
+ "anonymous": False,
26
+ "inputs": [
27
+ {
28
+ "indexed": True,
29
+ "internalType": "address",
30
+ "name": "from",
31
+ "type": "address",
32
+ },
33
+ {
34
+ "indexed": True,
35
+ "internalType": "address",
36
+ "name": "to",
37
+ "type": "address",
38
+ },
39
+ {
40
+ "indexed": False,
41
+ "internalType": "uint256",
42
+ "name": "value",
43
+ "type": "uint256",
44
+ },
45
+ ],
46
+ "name": "Transfer",
47
+ "type": "event",
48
+ }
49
+ ABI_EVENT_DEPOSIT_WITH_TUPLE = {
50
+ "anonymous": False,
51
+ "inputs": [
52
+ {
53
+ "indexed": True,
54
+ "internalType": "address",
55
+ "name": "from",
56
+ "type": "address",
57
+ },
58
+ {
59
+ "indexed": True,
60
+ "internalType": "bytes32",
61
+ "name": "id",
62
+ "type": "bytes32",
63
+ },
64
+ {
65
+ "components": [
66
+ {"internalType": "uint256", "name": "x", "type": "uint256"},
67
+ {"internalType": "uint256", "name": "y", "type": "uint256"},
68
+ ],
69
+ "indexed": False,
70
+ "internalType": "struct DepositEventContract.T",
71
+ "name": "value",
72
+ "type": "tuple",
73
+ },
74
+ ],
75
+ "name": "Deposit",
76
+ "type": "event",
77
+ }
78
+
79
+ ABI_EVENT_DEPOSIT = {
80
+ "anonymous": False,
81
+ "inputs": [
82
+ {
83
+ "indexed": True,
84
+ "internalType": "address",
85
+ "name": "from",
86
+ "type": "address",
87
+ },
88
+ {
89
+ "indexed": True,
90
+ "internalType": "bytes32",
91
+ "name": "id",
92
+ "type": "bytes32",
93
+ },
94
+ {
95
+ "indexed": False,
96
+ "internalType": "uint256",
97
+ "name": "value",
98
+ "type": "uint256",
99
+ },
100
+ ],
101
+ "name": "Deposit",
102
+ "type": "event",
103
+ }
104
+ ABI_FUNCTION_DEPOSIT_STRUCT = {
105
+ "inputs": [{"internalType": "bytes32", "name": "id", "type": "bytes32"}],
106
+ "name": "depositStruct",
107
+ "outputs": [],
108
+ "stateMutability": "payable",
109
+ "type": "function",
110
+ }
111
+ ABI_FUNCTION_DEPOSIT_VALUE = {
112
+ "inputs": [{"internalType": "bytes32", "name": "id", "type": "bytes32"}],
113
+ "name": "depositValue",
114
+ "outputs": [],
115
+ "stateMutability": "payable",
116
+ "type": "function",
117
+ }
118
+ AMBIGUOUS_EVENT_WITH_TUPLE_CONTRACT_ABI = [
119
+ ABI_EVENT_DEPOSIT_WITH_TUPLE,
120
+ ABI_EVENT_DEPOSIT,
121
+ ABI_EVENT_TRANSFER,
122
+ ABI_FUNCTION_DEPOSIT_STRUCT,
123
+ ABI_FUNCTION_DEPOSIT_VALUE,
124
+ ]
125
+
126
+
127
+ def test_get_abi_from_event(ambiguous_event_contract: "Contract") -> None:
128
+ expected_event_abi = {
129
+ "anonymous": False,
130
+ "inputs": [
131
+ {
132
+ "indexed": False,
133
+ "internalType": "uint256",
134
+ "name": "arg0",
135
+ "type": "uint256",
136
+ }
137
+ ],
138
+ "name": "LogSingleArg",
139
+ "type": "event",
140
+ }
141
+
142
+ event_get_abi_result = ambiguous_event_contract.events["LogSingleArg(uint256)"].abi
143
+ assert expected_event_abi == event_get_abi_result
144
+
145
+
146
+ def test_get_abi_element_for_ambiguous_tuple_events() -> None:
147
+ event_abi = get_abi_element(
148
+ cast(ABI, AMBIGUOUS_EVENT_WITH_TUPLE_CONTRACT_ABI),
149
+ "Deposit",
150
+ *[
151
+ "0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7",
152
+ b"0x0",
153
+ ],
154
+ **{"value": {"x": 1, "y": 2}},
155
+ )
156
+
157
+ assert event_abi == ABI_EVENT_DEPOSIT_WITH_TUPLE
158
+
159
+ event_abi = get_abi_element(
160
+ cast(ABI, AMBIGUOUS_EVENT_WITH_TUPLE_CONTRACT_ABI),
161
+ "Deposit",
162
+ *[
163
+ "0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7",
164
+ b"0x0",
165
+ 1,
166
+ ],
167
+ )
168
+
169
+ assert event_abi == ABI_EVENT_DEPOSIT
170
+
171
+
172
+ def test_get_abi_element_with_signature_for_ambiguous_tuple_events() -> None:
173
+ event_abi = get_abi_element(
174
+ cast(ABI, AMBIGUOUS_EVENT_WITH_TUPLE_CONTRACT_ABI),
175
+ "Deposit(address,bytes32,(uint256,uint256))",
176
+ )
177
+
178
+ assert event_abi == ABI_EVENT_DEPOSIT_WITH_TUPLE
179
+
180
+ event_abi = get_abi_element(
181
+ cast(ABI, AMBIGUOUS_EVENT_WITH_TUPLE_CONTRACT_ABI),
182
+ "Deposit(address,bytes32,uint256)",
183
+ )
184
+
185
+ assert event_abi == ABI_EVENT_DEPOSIT
186
+
187
+
188
+ def test_get_abi_element_by_name_and_arguments_errors(
189
+ ambiguous_event_contract: "Contract",
190
+ ) -> None:
191
+ with pytest.raises(
192
+ MismatchedABI,
193
+ match=r"ABI Not Found!\nNo element named `NotAnEvent` with 0 argument\(s\).",
194
+ ):
195
+ get_abi_element(ambiguous_event_contract.abi, "NotAnEvent")
196
+
197
+
198
+ def test_contract_event_methods(
199
+ w3: "Web3", ambiguous_event_contract: "Contract"
200
+ ) -> None:
201
+ log_arg_event = cast(
202
+ ContractEvent, ambiguous_event_contract.events["LogSingleArg(uint256)"]
203
+ )
204
+
205
+ assert log_arg_event.abi == {
206
+ "anonymous": False,
207
+ "inputs": [
208
+ {
209
+ "indexed": False,
210
+ "internalType": "uint256",
211
+ "name": "arg0",
212
+ "type": "uint256",
213
+ }
214
+ ],
215
+ "name": "LogSingleArg",
216
+ "type": "event",
217
+ }
218
+ assert log_arg_event.event_name == "LogSingleArg"
219
+ assert log_arg_event.abi_element_identifier == "LogSingleArg(uint256)"
220
+ assert log_arg_event.get_logs() == []
221
+
222
+ filter_builder = log_arg_event.build_filter()
223
+ filter_builder.from_block = "latest"
224
+ filter_builder.to_block = "latest"
225
+ filter_builder.args.arg0.match_single(1)
226
+ filter_instance = filter_builder.deploy(w3)
227
+
228
+ assert filter_instance.filter_params == {
229
+ "fromBlock": "latest",
230
+ "toBlock": "latest",
231
+ "address": ambiguous_event_contract.address,
232
+ "topics": (
233
+ "0x56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4",
234
+ ),
235
+ }
236
+
237
+ log_filter = log_arg_event.create_filter(from_block="latest")
238
+ log_entry = {
239
+ "address": ambiguous_event_contract.address,
240
+ "topics": (
241
+ "0x56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4",
242
+ ),
243
+ "data": "0x0000000000000000000000000000000000000000000000000000000000000005",
244
+ "logIndex": 0,
245
+ "transactionIndex": 0,
246
+ "transactionHash": "0x0",
247
+ "blockHash": "0x0",
248
+ "blockNumber": 0,
249
+ }
250
+ assert log_filter.log_entry_formatter(log_entry) == {
251
+ "args": {"arg0": 5},
252
+ "event": "LogSingleArg",
253
+ "logIndex": 0,
254
+ "transactionIndex": 0,
255
+ "transactionHash": "0x0",
256
+ "address": ambiguous_event_contract.address,
257
+ "blockHash": "0x0",
258
+ "blockNumber": 0,
259
+ }
@@ -1,5 +1,11 @@
1
1
  import pytest
2
+ from typing import (
3
+ cast,
4
+ )
2
5
 
6
+ from eth_typing import (
7
+ ABI,
8
+ )
3
9
  from eth_utils.toolz import (
4
10
  compose,
5
11
  curry,
@@ -11,41 +17,63 @@ from hexbytes import (
11
17
  from web3.exceptions import (
12
18
  Web3ValueError,
13
19
  )
20
+ from web3.utils.abi import (
21
+ get_abi_element,
22
+ )
23
+
24
+ BLOCK_HASH_ABI = {
25
+ "constant": False,
26
+ "inputs": [{"name": "input", "type": "uint256"}],
27
+ "name": "blockHashAmphithyronVersify",
28
+ "outputs": [{"name": "", "type": "uint256"}],
29
+ "payable": False,
30
+ "stateMutability": "nonpayable",
31
+ "type": "function",
32
+ }
33
+
34
+ IDENTITY_WITH_UINT_ABI = {
35
+ "constant": False,
36
+ "inputs": [
37
+ {"name": "input", "type": "uint256"},
38
+ {"name": "uselessFlag", "type": "bool"},
39
+ ],
40
+ "name": "identity",
41
+ "outputs": [{"name": "", "type": "uint256"}],
42
+ "payable": False,
43
+ "stateMutability": "nonpayable",
44
+ "type": "function",
45
+ }
46
+
47
+ IDENTITY_WITH_INT_ABI = {
48
+ "constant": False,
49
+ "inputs": [
50
+ {"name": "input", "type": "int256"},
51
+ {"name": "uselessFlag", "type": "bool"},
52
+ ],
53
+ "name": "identity",
54
+ "outputs": [{"name": "", "type": "int256"}],
55
+ "payable": False,
56
+ "stateMutability": "nonpayable",
57
+ "type": "function",
58
+ }
59
+
60
+ IDENTITY_WITH_BOOL_ABI = {
61
+ "constant": False,
62
+ "inputs": [
63
+ {"name": "valid", "type": "bool"},
64
+ ],
65
+ "name": "identity",
66
+ "outputs": [{"name": "valid", "type": "bool"}],
67
+ "payable": False,
68
+ "stateMutability": "nonpayable",
69
+ "type": "function",
70
+ }
14
71
 
15
72
  AMBIGUOUS_CONTRACT_ABI = [
16
- {
17
- "constant": False,
18
- "inputs": [{"name": "input", "type": "uint256"}],
19
- "name": "blockHashAmphithyronVersify",
20
- "outputs": [{"name": "", "type": "uint256"}],
21
- "payable": False,
22
- "stateMutability": "nonpayable",
23
- "type": "function",
24
- },
25
- {
26
- "constant": False,
27
- "inputs": [
28
- {"name": "input", "type": "uint256"},
29
- {"name": "uselessFlag", "type": "bool"},
30
- ],
31
- "name": "identity",
32
- "outputs": [{"name": "", "type": "uint256"}],
33
- "payable": False,
34
- "stateMutability": "nonpayable",
35
- "type": "function",
36
- },
37
- {
38
- "constant": False,
39
- "inputs": [
40
- {"name": "input", "type": "int256"},
41
- {"name": "uselessFlag", "type": "bool"},
42
- ],
43
- "name": "identity",
44
- "outputs": [{"name": "", "type": "int256"}],
45
- "payable": False,
46
- "stateMutability": "nonpayable",
47
- "type": "function",
48
- },
73
+ BLOCK_HASH_ABI,
74
+ IDENTITY_WITH_UINT_ABI,
75
+ IDENTITY_WITH_INT_ABI,
76
+ IDENTITY_WITH_BOOL_ABI,
49
77
  ]
50
78
 
51
79
 
@@ -75,6 +103,7 @@ map_repr = compose(list, curry(map, repr))
75
103
  "<Function blockHashAmphithyronVersify(uint256)>",
76
104
  "<Function identity(uint256,bool)>",
77
105
  "<Function identity(int256,bool)>",
106
+ "<Function identity(bool)>",
78
107
  ],
79
108
  ),
80
109
  (
@@ -83,11 +112,21 @@ map_repr = compose(list, curry(map, repr))
83
112
  repr,
84
113
  "<Function identity(uint256,bool)>",
85
114
  ),
115
+ (
116
+ "get_function_by_signature",
117
+ ("identity(int256,bool)",),
118
+ repr,
119
+ "<Function identity(int256,bool)>",
120
+ ),
86
121
  (
87
122
  "find_functions_by_name",
88
123
  ("identity",),
89
124
  map_repr,
90
- ["<Function identity(uint256,bool)>", "<Function identity(int256,bool)>"],
125
+ [
126
+ "<Function identity(uint256,bool)>",
127
+ "<Function identity(int256,bool)>",
128
+ "<Function identity(bool)>",
129
+ ],
91
130
  ),
92
131
  (
93
132
  "get_function_by_name",
@@ -227,6 +266,32 @@ def test_functions_error_messages(w3, method, args, expected_message, expected_e
227
266
  getattr(contract, method)(*args)
228
267
 
229
268
 
269
+ def test_ambiguous_functions_abi_element_identifier(w3):
270
+ abi = [
271
+ {
272
+ "name": "isValidSignature",
273
+ "type": "function",
274
+ "inputs": [
275
+ {"internalType": "bytes32", "name": "id", "type": "bytes32"},
276
+ {"internalType": "bytes", "name": "id", "type": "bytes"},
277
+ ],
278
+ },
279
+ {
280
+ "name": "isValidSignature",
281
+ "type": "function",
282
+ "inputs": [
283
+ {"internalType": "bytes", "name": "id", "type": "bytes"},
284
+ {"internalType": "bytes", "name": "id", "type": "bytes"},
285
+ ],
286
+ },
287
+ ]
288
+ contract = w3.eth.contract(abi=abi)
289
+ fn_bytes = contract.get_function_by_signature("isValidSignature(bytes,bytes)")
290
+ assert fn_bytes.abi_element_identifier == "isValidSignature(bytes,bytes)"
291
+ fn_bytes32 = contract.get_function_by_signature("isValidSignature(bytes32,bytes)")
292
+ assert fn_bytes32.abi_element_identifier == "isValidSignature(bytes32,bytes)"
293
+
294
+
230
295
  def test_contract_function_methods(string_contract):
231
296
  set_value_func = string_contract.get_function_by_signature("setValue(string)")
232
297
  get_value_func = string_contract.get_function_by_signature("getValue()")
@@ -242,3 +307,61 @@ def test_diff_between_fn_and_fn_called(string_contract):
242
307
  assert get_value_func is not get_value_func_called
243
308
  assert repr(get_value_func) == "<Function getValue()>"
244
309
  assert repr(get_value_func_called) == "<Function getValue() bound to ()>"
310
+
311
+
312
+ def test_get_abi_element_for_ambiguous_functions() -> None:
313
+ function_abi = get_abi_element(
314
+ cast(ABI, AMBIGUOUS_CONTRACT_ABI),
315
+ "identity",
316
+ *[
317
+ 2**256 - 1, # uint256 maximum
318
+ False,
319
+ ],
320
+ )
321
+
322
+ assert function_abi == IDENTITY_WITH_UINT_ABI
323
+
324
+ function_abi = get_abi_element(
325
+ cast(ABI, AMBIGUOUS_CONTRACT_ABI),
326
+ "identity",
327
+ *[
328
+ -1,
329
+ True,
330
+ ],
331
+ )
332
+
333
+ assert function_abi == IDENTITY_WITH_INT_ABI
334
+
335
+ function_abi = get_abi_element(
336
+ cast(ABI, AMBIGUOUS_CONTRACT_ABI),
337
+ "identity",
338
+ *[
339
+ False,
340
+ ],
341
+ )
342
+
343
+ assert function_abi == IDENTITY_WITH_BOOL_ABI
344
+
345
+
346
+ def test_get_abi_element_for_ambiguous_function_arguments():
347
+ function_abi = get_abi_element(
348
+ cast(ABI, AMBIGUOUS_CONTRACT_ABI),
349
+ "identity(int256,bool)",
350
+ *[
351
+ 1,
352
+ False,
353
+ ],
354
+ )
355
+
356
+ assert function_abi == IDENTITY_WITH_INT_ABI
357
+
358
+ function_abi = get_abi_element(
359
+ cast(ABI, AMBIGUOUS_CONTRACT_ABI),
360
+ "identity(uint256,bool)",
361
+ *[
362
+ 1,
363
+ False,
364
+ ],
365
+ )
366
+
367
+ assert function_abi == IDENTITY_WITH_UINT_ABI
@@ -11,6 +11,11 @@ def abi():
11
11
  return """[{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Increased","type":"function"}, {"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Increased","type":"event"}]""" # noqa: E501
12
12
 
13
13
 
14
+ @pytest.fixture()
15
+ def ambiguous_abis():
16
+ return """[{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Increased","type":"function"}, {"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"bytes32"}],"name":"Increased","type":"function"}, {"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Increased","type":"event"}, {"anonymous":false,"inputs":[],"name":"Increased","type":"event"}]""" # noqa: E501
17
+
18
+
14
19
  @pytest.mark.parametrize("attribute", ("functions", "events", "caller"))
15
20
  def test_getattr(w3, abi, attribute):
16
21
  contract = w3.eth.contract(abi=abi)