web3 6.20.2__py3-none-any.whl → 7.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. ens/__init__.py +13 -2
  2. ens/_normalization.py +2 -17
  3. ens/async_ens.py +33 -21
  4. ens/base_ens.py +3 -1
  5. ens/ens.py +16 -11
  6. ens/exceptions.py +16 -29
  7. ens/specs/nf.json +1 -1
  8. ens/specs/normalization_spec.json +1 -1
  9. ens/utils.py +52 -63
  10. web3/__init__.py +20 -24
  11. web3/_utils/abi.py +115 -271
  12. web3/_utils/async_transactions.py +7 -4
  13. web3/_utils/batching.py +217 -0
  14. web3/_utils/blocks.py +6 -2
  15. web3/_utils/caching.py +128 -5
  16. web3/_utils/compat/__init__.py +2 -3
  17. web3/_utils/contract_sources/compile_contracts.py +1 -1
  18. web3/_utils/contract_sources/contract_data/arrays_contract.py +3 -3
  19. web3/_utils/contract_sources/contract_data/bytes_contracts.py +5 -5
  20. web3/_utils/contract_sources/contract_data/constructor_contracts.py +7 -7
  21. web3/_utils/contract_sources/contract_data/contract_caller_tester.py +3 -3
  22. web3/_utils/contract_sources/contract_data/emitter_contract.py +3 -3
  23. web3/_utils/contract_sources/contract_data/event_contracts.py +5 -5
  24. web3/_utils/contract_sources/contract_data/extended_resolver.py +3 -3
  25. web3/_utils/contract_sources/contract_data/fallback_function_contract.py +3 -3
  26. web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +3 -3
  27. web3/_utils/contract_sources/contract_data/math_contract.py +3 -3
  28. web3/_utils/contract_sources/contract_data/offchain_lookup.py +3 -3
  29. web3/_utils/contract_sources/contract_data/offchain_resolver.py +3 -3
  30. web3/_utils/contract_sources/contract_data/panic_errors_contract.py +3 -3
  31. web3/_utils/contract_sources/contract_data/payable_tester.py +3 -3
  32. web3/_utils/contract_sources/contract_data/receive_function_contracts.py +5 -5
  33. web3/_utils/contract_sources/contract_data/reflector_contracts.py +3 -3
  34. web3/_utils/contract_sources/contract_data/revert_contract.py +3 -3
  35. web3/_utils/contract_sources/contract_data/simple_resolver.py +3 -3
  36. web3/_utils/contract_sources/contract_data/storage_contract.py +3 -3
  37. web3/_utils/contract_sources/contract_data/string_contract.py +3 -3
  38. web3/_utils/contract_sources/contract_data/tuple_contracts.py +5 -5
  39. web3/_utils/contracts.py +130 -236
  40. web3/_utils/datatypes.py +5 -1
  41. web3/_utils/decorators.py +13 -23
  42. web3/_utils/empty.py +1 -1
  43. web3/_utils/encoding.py +16 -12
  44. web3/_utils/ens.py +2 -1
  45. web3/_utils/error_formatters_utils.py +5 -3
  46. web3/_utils/events.py +66 -69
  47. web3/_utils/fee_utils.py +1 -3
  48. web3/_utils/filters.py +24 -22
  49. web3/_utils/formatters.py +2 -2
  50. web3/_utils/http.py +5 -3
  51. web3/_utils/http_session_manager.py +303 -0
  52. web3/_utils/math.py +14 -15
  53. web3/_utils/method_formatters.py +34 -36
  54. web3/_utils/module.py +2 -1
  55. web3/_utils/module_testing/__init__.py +0 -3
  56. web3/_utils/module_testing/eth_module.py +695 -643
  57. web3/_utils/module_testing/module_testing_utils.py +61 -34
  58. web3/_utils/module_testing/persistent_connection_provider.py +56 -25
  59. web3/_utils/module_testing/utils.py +258 -0
  60. web3/_utils/module_testing/web3_module.py +438 -17
  61. web3/_utils/normalizers.py +13 -11
  62. web3/_utils/rpc_abi.py +5 -32
  63. web3/_utils/threads.py +8 -7
  64. web3/_utils/transactions.py +14 -12
  65. web3/_utils/type_conversion.py +5 -1
  66. web3/_utils/validation.py +17 -17
  67. web3/auto/gethdev.py +7 -2
  68. web3/beacon/__init__.py +6 -1
  69. web3/beacon/async_beacon.py +9 -5
  70. web3/beacon/{main.py → beacon.py} +7 -5
  71. web3/contract/__init__.py +7 -0
  72. web3/contract/async_contract.py +47 -46
  73. web3/contract/base_contract.py +183 -158
  74. web3/contract/contract.py +49 -43
  75. web3/contract/utils.py +203 -59
  76. web3/datastructures.py +79 -31
  77. web3/eth/__init__.py +7 -0
  78. web3/eth/async_eth.py +39 -51
  79. web3/eth/base_eth.py +17 -10
  80. web3/eth/eth.py +30 -68
  81. web3/exceptions.py +108 -82
  82. web3/gas_strategies/time_based.py +8 -6
  83. web3/geth.py +1 -254
  84. web3/main.py +75 -122
  85. web3/manager.py +316 -146
  86. web3/method.py +38 -31
  87. web3/middleware/__init__.py +67 -89
  88. web3/middleware/attrdict.py +36 -49
  89. web3/middleware/base.py +174 -0
  90. web3/middleware/buffered_gas_estimate.py +20 -21
  91. web3/middleware/filter.py +157 -117
  92. web3/middleware/formatting.py +124 -108
  93. web3/middleware/gas_price_strategy.py +20 -32
  94. web3/middleware/names.py +29 -26
  95. web3/middleware/proof_of_authority.py +68 -0
  96. web3/middleware/pythonic.py +2 -2
  97. web3/middleware/signing.py +74 -89
  98. web3/middleware/stalecheck.py +52 -79
  99. web3/middleware/validation.py +5 -13
  100. web3/module.py +54 -10
  101. web3/providers/__init__.py +10 -6
  102. web3/providers/async_base.py +117 -39
  103. web3/providers/auto.py +3 -3
  104. web3/providers/base.py +89 -33
  105. web3/providers/eth_tester/__init__.py +5 -0
  106. web3/providers/eth_tester/defaults.py +1 -64
  107. web3/providers/eth_tester/main.py +99 -31
  108. web3/providers/eth_tester/middleware.py +45 -73
  109. web3/providers/ipc.py +42 -46
  110. web3/providers/{websocket/websocket.py → legacy_websocket.py} +32 -7
  111. web3/providers/persistent/__init__.py +22 -0
  112. web3/providers/persistent/async_ipc.py +153 -0
  113. web3/providers/{persistent.py → persistent/persistent.py} +106 -25
  114. web3/providers/persistent/persistent_connection.py +84 -0
  115. web3/providers/{websocket → persistent}/request_processor.py +94 -32
  116. web3/providers/persistent/utils.py +43 -0
  117. web3/providers/{websocket/websocket_v2.py → persistent/websocket.py} +29 -28
  118. web3/providers/rpc/__init__.py +11 -0
  119. web3/providers/rpc/async_rpc.py +171 -0
  120. web3/providers/rpc/rpc.py +179 -0
  121. web3/providers/rpc/utils.py +92 -0
  122. web3/testing.py +4 -4
  123. web3/tools/benchmark/main.py +22 -22
  124. web3/tools/benchmark/node.py +2 -8
  125. web3/tools/benchmark/reporting.py +2 -2
  126. web3/tools/benchmark/utils.py +1 -1
  127. web3/tracing.py +9 -5
  128. web3/types.py +30 -107
  129. web3/utils/__init__.py +58 -5
  130. web3/utils/abi.py +575 -10
  131. web3/utils/async_exception_handling.py +19 -7
  132. web3/utils/caching.py +32 -13
  133. web3/utils/exception_handling.py +7 -5
  134. {web3-6.20.2.dist-info → web3-7.0.0.dist-info}/LICENSE +1 -1
  135. web3-7.0.0.dist-info/METADATA +112 -0
  136. web3-7.0.0.dist-info/RECORD +167 -0
  137. {web3-6.20.2.dist-info → web3-7.0.0.dist-info}/WHEEL +1 -1
  138. {web3-6.20.2.dist-info → web3-7.0.0.dist-info}/top_level.txt +0 -1
  139. ethpm/__init__.py +0 -20
  140. ethpm/_utils/__init__.py +0 -0
  141. ethpm/_utils/backend.py +0 -93
  142. ethpm/_utils/cache.py +0 -44
  143. ethpm/_utils/chains.py +0 -119
  144. ethpm/_utils/contract.py +0 -35
  145. ethpm/_utils/deployments.py +0 -145
  146. ethpm/_utils/ipfs.py +0 -116
  147. ethpm/_utils/protobuf/__init__.py +0 -0
  148. ethpm/_utils/protobuf/ipfs_file_pb2.py +0 -33
  149. ethpm/_utils/registry.py +0 -29
  150. ethpm/assets/__init__.py +0 -0
  151. ethpm/assets/ens/v3.json +0 -1
  152. ethpm/assets/escrow/with_bytecode_v3.json +0 -1
  153. ethpm/assets/ipfs_file.proto +0 -32
  154. ethpm/assets/owned/output_v3.json +0 -1
  155. ethpm/assets/owned/with_contract_type_v3.json +0 -1
  156. ethpm/assets/registry/contracts/Authority.sol +0 -156
  157. ethpm/assets/registry/contracts/IndexedOrderedSetLib.sol +0 -106
  158. ethpm/assets/registry/contracts/PackageDB.sol +0 -225
  159. ethpm/assets/registry/contracts/PackageRegistry.sol +0 -361
  160. ethpm/assets/registry/contracts/PackageRegistryInterface.sol +0 -97
  161. ethpm/assets/registry/contracts/ReleaseDB.sol +0 -309
  162. ethpm/assets/registry/contracts/ReleaseValidator.sol +0 -152
  163. ethpm/assets/registry/solc_input.json +0 -1
  164. ethpm/assets/registry/solc_output.json +0 -1
  165. ethpm/assets/registry/v3.json +0 -1
  166. ethpm/assets/safe-math-lib/v3-strict-no-deployments.json +0 -1
  167. ethpm/assets/simple-registry/contracts/Ownable.sol +0 -63
  168. ethpm/assets/simple-registry/contracts/PackageRegistry.sol +0 -373
  169. ethpm/assets/simple-registry/contracts/PackageRegistryInterface.sol +0 -96
  170. ethpm/assets/simple-registry/solc_input.json +0 -33
  171. ethpm/assets/simple-registry/solc_output.json +0 -1
  172. ethpm/assets/simple-registry/v3.json +0 -1
  173. ethpm/assets/standard-token/output_v3.json +0 -1
  174. ethpm/assets/standard-token/with_bytecode_v3.json +0 -1
  175. ethpm/assets/vyper_registry/0.1.0.json +0 -1
  176. ethpm/assets/vyper_registry/registry.vy +0 -216
  177. ethpm/assets/vyper_registry/registry_with_delete.vy +0 -244
  178. ethpm/backends/__init__.py +0 -0
  179. ethpm/backends/base.py +0 -43
  180. ethpm/backends/http.py +0 -108
  181. ethpm/backends/ipfs.py +0 -219
  182. ethpm/backends/registry.py +0 -154
  183. ethpm/constants.py +0 -17
  184. ethpm/contract.py +0 -187
  185. ethpm/dependencies.py +0 -58
  186. ethpm/deployments.py +0 -80
  187. ethpm/ethpm-spec/examples/escrow/1.0.0-pretty.json +0 -146
  188. ethpm/ethpm-spec/examples/escrow/1.0.0.json +0 -1
  189. ethpm/ethpm-spec/examples/escrow/contracts/Escrow.sol +0 -32
  190. ethpm/ethpm-spec/examples/escrow/contracts/SafeSendLib.sol +0 -20
  191. ethpm/ethpm-spec/examples/escrow/v3-pretty.json +0 -171
  192. ethpm/ethpm-spec/examples/escrow/v3.json +0 -1
  193. ethpm/ethpm-spec/examples/owned/1.0.0-pretty.json +0 -21
  194. ethpm/ethpm-spec/examples/owned/1.0.0.json +0 -1
  195. ethpm/ethpm-spec/examples/owned/contracts/Owned.sol +0 -12
  196. ethpm/ethpm-spec/examples/owned/v3-pretty.json +0 -27
  197. ethpm/ethpm-spec/examples/owned/v3.json +0 -1
  198. ethpm/ethpm-spec/examples/piper-coin/1.0.0-pretty.json +0 -31
  199. ethpm/ethpm-spec/examples/piper-coin/1.0.0.json +0 -1
  200. ethpm/ethpm-spec/examples/piper-coin/v3-pretty.json +0 -21
  201. ethpm/ethpm-spec/examples/piper-coin/v3.json +0 -1
  202. ethpm/ethpm-spec/examples/safe-math-lib/1.0.0-pretty.json +0 -85
  203. ethpm/ethpm-spec/examples/safe-math-lib/1.0.0.json +0 -1
  204. ethpm/ethpm-spec/examples/safe-math-lib/contracts/SafeMathLib.sol +0 -24
  205. ethpm/ethpm-spec/examples/safe-math-lib/v3-pretty.json +0 -117
  206. ethpm/ethpm-spec/examples/safe-math-lib/v3.json +0 -1
  207. ethpm/ethpm-spec/examples/standard-token/1.0.0-pretty.json +0 -55
  208. ethpm/ethpm-spec/examples/standard-token/1.0.0.json +0 -1
  209. ethpm/ethpm-spec/examples/standard-token/contracts/AbstractToken.sol +0 -20
  210. ethpm/ethpm-spec/examples/standard-token/contracts/StandardToken.sol +0 -84
  211. ethpm/ethpm-spec/examples/standard-token/v3-pretty.json +0 -460
  212. ethpm/ethpm-spec/examples/standard-token/v3.json +0 -1
  213. ethpm/ethpm-spec/examples/transferable/1.0.0-pretty.json +0 -21
  214. ethpm/ethpm-spec/examples/transferable/1.0.0.json +0 -1
  215. ethpm/ethpm-spec/examples/transferable/contracts/Transferable.sol +0 -14
  216. ethpm/ethpm-spec/examples/transferable/v3-pretty.json +0 -27
  217. ethpm/ethpm-spec/examples/transferable/v3.json +0 -1
  218. ethpm/ethpm-spec/examples/wallet/1.0.0-pretty.json +0 -120
  219. ethpm/ethpm-spec/examples/wallet/1.0.0.json +0 -1
  220. ethpm/ethpm-spec/examples/wallet/contracts/Wallet.sol +0 -41
  221. ethpm/ethpm-spec/examples/wallet/v3-pretty.json +0 -181
  222. ethpm/ethpm-spec/examples/wallet/v3.json +0 -1
  223. ethpm/ethpm-spec/examples/wallet-with-send/1.0.0-pretty.json +0 -135
  224. ethpm/ethpm-spec/examples/wallet-with-send/1.0.0.json +0 -1
  225. ethpm/ethpm-spec/examples/wallet-with-send/contracts/WalletWithSend.sol +0 -18
  226. ethpm/ethpm-spec/examples/wallet-with-send/v3-pretty.json +0 -207
  227. ethpm/ethpm-spec/examples/wallet-with-send/v3.json +0 -1
  228. ethpm/ethpm-spec/spec/package.spec.json +0 -379
  229. ethpm/ethpm-spec/spec/v3.spec.json +0 -483
  230. ethpm/exceptions.py +0 -68
  231. ethpm/package.py +0 -438
  232. ethpm/tools/__init__.py +0 -4
  233. ethpm/tools/builder.py +0 -930
  234. ethpm/tools/checker.py +0 -312
  235. ethpm/tools/get_manifest.py +0 -19
  236. ethpm/uri.py +0 -141
  237. ethpm/validation/__init__.py +0 -0
  238. ethpm/validation/manifest.py +0 -146
  239. ethpm/validation/misc.py +0 -39
  240. ethpm/validation/package.py +0 -80
  241. ethpm/validation/uri.py +0 -163
  242. web3/_utils/contract_sources/contract_data/address_reflector.py +0 -29
  243. web3/_utils/miner.py +0 -88
  244. web3/_utils/module_testing/go_ethereum_personal_module.py +0 -323
  245. web3/_utils/request.py +0 -265
  246. web3/middleware/abi.py +0 -11
  247. web3/middleware/async_cache.py +0 -99
  248. web3/middleware/cache.py +0 -374
  249. web3/middleware/exception_handling.py +0 -49
  250. web3/middleware/exception_retry_request.py +0 -188
  251. web3/middleware/fixture.py +0 -190
  252. web3/middleware/geth_poa.py +0 -81
  253. web3/middleware/normalize_request_parameters.py +0 -11
  254. web3/middleware/simulate_unmined_transaction.py +0 -43
  255. web3/pm.py +0 -602
  256. web3/providers/async_rpc.py +0 -99
  257. web3/providers/rpc.py +0 -98
  258. web3/providers/websocket/__init__.py +0 -11
  259. web3/providers/websocket/websocket_connection.py +0 -42
  260. web3/tools/__init__.py +0 -4
  261. web3/tools/pytest_ethereum/__init__.py +0 -0
  262. web3/tools/pytest_ethereum/_utils.py +0 -145
  263. web3/tools/pytest_ethereum/deployer.py +0 -48
  264. web3/tools/pytest_ethereum/exceptions.py +0 -22
  265. web3/tools/pytest_ethereum/linker.py +0 -128
  266. web3/tools/pytest_ethereum/plugins.py +0 -33
  267. web3-6.20.2.dist-info/METADATA +0 -103
  268. web3-6.20.2.dist-info/RECORD +0 -283
  269. web3-6.20.2.dist-info/entry_points.txt +0 -2
  270. /web3/_utils/{function_identifiers.py → abi_element_identifiers.py} +0 -0
@@ -1,11 +1,11 @@
1
1
  """
2
2
  Generated by `compile_contracts.py` script.
3
- Compiled with Solidity v0.8.24.
3
+ Compiled with Solidity v0.8.26.
4
4
  """
5
5
 
6
6
  # source: web3/_utils/contract_sources/TupleContracts.sol:TupleContract
7
- TUPLE_CONTRACT_BYTECODE = "0x608060405234801561000f575f80fd5b50610a688061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c80638e1ae3c71461002d575b5f80fd5b6100476004803603810190610042919061064d565b61005d565b6040516100549190610a12565b60405180910390f35b61006561006d565b819050919050565b60405180606001604052805f815260200160608152602001606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100e8826100a2565b810181811067ffffffffffffffff82111715610107576101066100b2565b5b80604052505050565b5f61011961008d565b905061012582826100df565b919050565b5f80fd5b5f819050919050565b6101408161012e565b811461014a575f80fd5b50565b5f8135905061015b81610137565b92915050565b5f80fd5b5f67ffffffffffffffff82111561017f5761017e6100b2565b5b602082029050602081019050919050565b5f80fd5b5f6101a66101a184610165565b610110565b905080838252602082019050602084028301858111156101c9576101c8610190565b5b835b818110156101f257806101de888261014d565b8452602084019350506020810190506101cb565b5050509392505050565b5f82601f8301126102105761020f610161565b5b8135610220848260208601610194565b91505092915050565b5f67ffffffffffffffff821115610243576102426100b2565b5b602082029050602081019050919050565b5f819050919050565b61026681610254565b8114610270575f80fd5b50565b5f813590506102818161025d565b92915050565b5f67ffffffffffffffff8211156102a1576102a06100b2565b5b602082029050919050565b5f8115159050919050565b6102c0816102ac565b81146102ca575f80fd5b50565b5f813590506102db816102b7565b92915050565b5f6102f36102ee84610287565b610110565b9050806020840283018581111561030d5761030c610190565b5b835b81811015610336578061032288826102cd565b84526020840193505060208101905061030f565b5050509392505050565b5f82601f83011261035457610353610161565b5b60026103618482856102e1565b91505092915050565b5f67ffffffffffffffff821115610384576103836100b2565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103be82610395565b9050919050565b6103ce816103b4565b81146103d8575f80fd5b50565b5f813590506103e9816103c5565b92915050565b5f6104016103fc8461036a565b610110565b9050808382526020820190506020840283018581111561042457610423610190565b5b835b8181101561044d578061043988826103db565b845260208401935050602081019050610426565b5050509392505050565b5f82601f83011261046b5761046a610161565b5b813561047b8482602086016103ef565b91505092915050565b5f608082840312156104995761049861009e565b5b6104a36060610110565b90505f6104b284828501610273565b5f8301525060206104c584828501610340565b602083015250606082013567ffffffffffffffff8111156104e9576104e861012a565b5b6104f584828501610457565b60408301525092915050565b5f61051361050e84610229565b610110565b9050808382526020820190506020840283018581111561053657610535610190565b5b835b8181101561057d57803567ffffffffffffffff81111561055b5761055a610161565b5b8086016105688982610484565b85526020850194505050602081019050610538565b5050509392505050565b5f82601f83011261059b5761059a610161565b5b81356105ab848260208601610501565b91505092915050565b5f606082840312156105c9576105c861009e565b5b6105d36060610110565b90505f6105e28482850161014d565b5f83015250602082013567ffffffffffffffff8111156106055761060461012a565b5b610611848285016101fc565b602083015250604082013567ffffffffffffffff8111156106355761063461012a565b5b61064184828501610587565b60408301525092915050565b5f6020828403121561066257610661610096565b5b5f82013567ffffffffffffffff81111561067f5761067e61009a565b5b61068b848285016105b4565b91505092915050565b61069d8161012e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6106d78383610694565b60208301905092915050565b5f602082019050919050565b5f6106f9826106a3565b61070381856106ad565b935061070e836106bd565b805f5b8381101561073e57815161072588826106cc565b9750610730836106e3565b925050600181019050610711565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61077d81610254565b82525050565b5f60029050919050565b5f81905092915050565b5f819050919050565b6107a9816102ac565b82525050565b5f6107ba83836107a0565b60208301905092915050565b5f602082019050919050565b6107db81610783565b6107e5818461078d565b92506107f082610797565b805f5b8381101561082057815161080787826107af565b9650610812836107c6565b9250506001810190506107f3565b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61085a816103b4565b82525050565b5f61086b8383610851565b60208301905092915050565b5f602082019050919050565b5f61088d82610828565b6108978185610832565b93506108a283610842565b805f5b838110156108d25781516108b98882610860565b97506108c483610877565b9250506001810190506108a5565b5085935050505092915050565b5f608083015f8301516108f45f860182610774565b50602083015161090760208601826107d2565b506040830151848203606086015261091f8282610883565b9150508091505092915050565b5f61093783836108df565b905092915050565b5f602082019050919050565b5f6109558261074b565b61095f8185610755565b93508360208202850161097185610765565b805f5b858110156109ac578484038952815161098d858261092c565b94506109988361093f565b925060208a01995050600181019050610974565b50829750879550505050505092915050565b5f606083015f8301516109d35f860182610694565b50602083015184820360208601526109eb82826106ef565b91505060408301518482036040860152610a05828261094b565b9150508091505092915050565b5f6020820190508181035f830152610a2a81846109be565b90509291505056fea2646970667358221220807e60bb717d8a1d1cc42e3546952f8e971c459d809c0271c00091ba0ad054f564736f6c63430008180033" # noqa: E501
8
- TUPLE_CONTRACT_RUNTIME = "0x608060405234801561000f575f80fd5b5060043610610029575f3560e01c80638e1ae3c71461002d575b5f80fd5b6100476004803603810190610042919061064d565b61005d565b6040516100549190610a12565b60405180910390f35b61006561006d565b819050919050565b60405180606001604052805f815260200160608152602001606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100e8826100a2565b810181811067ffffffffffffffff82111715610107576101066100b2565b5b80604052505050565b5f61011961008d565b905061012582826100df565b919050565b5f80fd5b5f819050919050565b6101408161012e565b811461014a575f80fd5b50565b5f8135905061015b81610137565b92915050565b5f80fd5b5f67ffffffffffffffff82111561017f5761017e6100b2565b5b602082029050602081019050919050565b5f80fd5b5f6101a66101a184610165565b610110565b905080838252602082019050602084028301858111156101c9576101c8610190565b5b835b818110156101f257806101de888261014d565b8452602084019350506020810190506101cb565b5050509392505050565b5f82601f8301126102105761020f610161565b5b8135610220848260208601610194565b91505092915050565b5f67ffffffffffffffff821115610243576102426100b2565b5b602082029050602081019050919050565b5f819050919050565b61026681610254565b8114610270575f80fd5b50565b5f813590506102818161025d565b92915050565b5f67ffffffffffffffff8211156102a1576102a06100b2565b5b602082029050919050565b5f8115159050919050565b6102c0816102ac565b81146102ca575f80fd5b50565b5f813590506102db816102b7565b92915050565b5f6102f36102ee84610287565b610110565b9050806020840283018581111561030d5761030c610190565b5b835b81811015610336578061032288826102cd565b84526020840193505060208101905061030f565b5050509392505050565b5f82601f83011261035457610353610161565b5b60026103618482856102e1565b91505092915050565b5f67ffffffffffffffff821115610384576103836100b2565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103be82610395565b9050919050565b6103ce816103b4565b81146103d8575f80fd5b50565b5f813590506103e9816103c5565b92915050565b5f6104016103fc8461036a565b610110565b9050808382526020820190506020840283018581111561042457610423610190565b5b835b8181101561044d578061043988826103db565b845260208401935050602081019050610426565b5050509392505050565b5f82601f83011261046b5761046a610161565b5b813561047b8482602086016103ef565b91505092915050565b5f608082840312156104995761049861009e565b5b6104a36060610110565b90505f6104b284828501610273565b5f8301525060206104c584828501610340565b602083015250606082013567ffffffffffffffff8111156104e9576104e861012a565b5b6104f584828501610457565b60408301525092915050565b5f61051361050e84610229565b610110565b9050808382526020820190506020840283018581111561053657610535610190565b5b835b8181101561057d57803567ffffffffffffffff81111561055b5761055a610161565b5b8086016105688982610484565b85526020850194505050602081019050610538565b5050509392505050565b5f82601f83011261059b5761059a610161565b5b81356105ab848260208601610501565b91505092915050565b5f606082840312156105c9576105c861009e565b5b6105d36060610110565b90505f6105e28482850161014d565b5f83015250602082013567ffffffffffffffff8111156106055761060461012a565b5b610611848285016101fc565b602083015250604082013567ffffffffffffffff8111156106355761063461012a565b5b61064184828501610587565b60408301525092915050565b5f6020828403121561066257610661610096565b5b5f82013567ffffffffffffffff81111561067f5761067e61009a565b5b61068b848285016105b4565b91505092915050565b61069d8161012e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6106d78383610694565b60208301905092915050565b5f602082019050919050565b5f6106f9826106a3565b61070381856106ad565b935061070e836106bd565b805f5b8381101561073e57815161072588826106cc565b9750610730836106e3565b925050600181019050610711565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61077d81610254565b82525050565b5f60029050919050565b5f81905092915050565b5f819050919050565b6107a9816102ac565b82525050565b5f6107ba83836107a0565b60208301905092915050565b5f602082019050919050565b6107db81610783565b6107e5818461078d565b92506107f082610797565b805f5b8381101561082057815161080787826107af565b9650610812836107c6565b9250506001810190506107f3565b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61085a816103b4565b82525050565b5f61086b8383610851565b60208301905092915050565b5f602082019050919050565b5f61088d82610828565b6108978185610832565b93506108a283610842565b805f5b838110156108d25781516108b98882610860565b97506108c483610877565b9250506001810190506108a5565b5085935050505092915050565b5f608083015f8301516108f45f860182610774565b50602083015161090760208601826107d2565b506040830151848203606086015261091f8282610883565b9150508091505092915050565b5f61093783836108df565b905092915050565b5f602082019050919050565b5f6109558261074b565b61095f8185610755565b93508360208202850161097185610765565b805f5b858110156109ac578484038952815161098d858261092c565b94506109988361093f565b925060208a01995050600181019050610974565b50829750879550505050505092915050565b5f606083015f8301516109d35f860182610694565b50602083015184820360208601526109eb82826106ef565b91505060408301518482036040860152610a05828261094b565b9150508091505092915050565b5f6020820190508181035f830152610a2a81846109be565b90509291505056fea2646970667358221220807e60bb717d8a1d1cc42e3546952f8e971c459d809c0271c00091ba0ad054f564736f6c63430008180033" # noqa: E501
7
+ TUPLE_CONTRACT_BYTECODE = "0x6080604052348015600e575f80fd5b50610a688061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c80638e1ae3c71461002d575b5f80fd5b6100476004803603810190610042919061064d565b61005d565b6040516100549190610a12565b60405180910390f35b61006561006d565b819050919050565b60405180606001604052805f815260200160608152602001606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100e8826100a2565b810181811067ffffffffffffffff82111715610107576101066100b2565b5b80604052505050565b5f61011961008d565b905061012582826100df565b919050565b5f80fd5b5f819050919050565b6101408161012e565b811461014a575f80fd5b50565b5f8135905061015b81610137565b92915050565b5f80fd5b5f67ffffffffffffffff82111561017f5761017e6100b2565b5b602082029050602081019050919050565b5f80fd5b5f6101a66101a184610165565b610110565b905080838252602082019050602084028301858111156101c9576101c8610190565b5b835b818110156101f257806101de888261014d565b8452602084019350506020810190506101cb565b5050509392505050565b5f82601f8301126102105761020f610161565b5b8135610220848260208601610194565b91505092915050565b5f67ffffffffffffffff821115610243576102426100b2565b5b602082029050602081019050919050565b5f819050919050565b61026681610254565b8114610270575f80fd5b50565b5f813590506102818161025d565b92915050565b5f67ffffffffffffffff8211156102a1576102a06100b2565b5b602082029050919050565b5f8115159050919050565b6102c0816102ac565b81146102ca575f80fd5b50565b5f813590506102db816102b7565b92915050565b5f6102f36102ee84610287565b610110565b9050806020840283018581111561030d5761030c610190565b5b835b81811015610336578061032288826102cd565b84526020840193505060208101905061030f565b5050509392505050565b5f82601f83011261035457610353610161565b5b60026103618482856102e1565b91505092915050565b5f67ffffffffffffffff821115610384576103836100b2565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103be82610395565b9050919050565b6103ce816103b4565b81146103d8575f80fd5b50565b5f813590506103e9816103c5565b92915050565b5f6104016103fc8461036a565b610110565b9050808382526020820190506020840283018581111561042457610423610190565b5b835b8181101561044d578061043988826103db565b845260208401935050602081019050610426565b5050509392505050565b5f82601f83011261046b5761046a610161565b5b813561047b8482602086016103ef565b91505092915050565b5f608082840312156104995761049861009e565b5b6104a36060610110565b90505f6104b284828501610273565b5f8301525060206104c584828501610340565b602083015250606082013567ffffffffffffffff8111156104e9576104e861012a565b5b6104f584828501610457565b60408301525092915050565b5f61051361050e84610229565b610110565b9050808382526020820190506020840283018581111561053657610535610190565b5b835b8181101561057d57803567ffffffffffffffff81111561055b5761055a610161565b5b8086016105688982610484565b85526020850194505050602081019050610538565b5050509392505050565b5f82601f83011261059b5761059a610161565b5b81356105ab848260208601610501565b91505092915050565b5f606082840312156105c9576105c861009e565b5b6105d36060610110565b90505f6105e28482850161014d565b5f83015250602082013567ffffffffffffffff8111156106055761060461012a565b5b610611848285016101fc565b602083015250604082013567ffffffffffffffff8111156106355761063461012a565b5b61064184828501610587565b60408301525092915050565b5f6020828403121561066257610661610096565b5b5f82013567ffffffffffffffff81111561067f5761067e61009a565b5b61068b848285016105b4565b91505092915050565b61069d8161012e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6106d78383610694565b60208301905092915050565b5f602082019050919050565b5f6106f9826106a3565b61070381856106ad565b935061070e836106bd565b805f5b8381101561073e57815161072588826106cc565b9750610730836106e3565b925050600181019050610711565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61077d81610254565b82525050565b5f60029050919050565b5f81905092915050565b5f819050919050565b6107a9816102ac565b82525050565b5f6107ba83836107a0565b60208301905092915050565b5f602082019050919050565b6107db81610783565b6107e5818461078d565b92506107f082610797565b805f5b8381101561082057815161080787826107af565b9650610812836107c6565b9250506001810190506107f3565b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61085a816103b4565b82525050565b5f61086b8383610851565b60208301905092915050565b5f602082019050919050565b5f61088d82610828565b6108978185610832565b93506108a283610842565b805f5b838110156108d25781516108b98882610860565b97506108c483610877565b9250506001810190506108a5565b5085935050505092915050565b5f608083015f8301516108f45f860182610774565b50602083015161090760208601826107d2565b506040830151848203606086015261091f8282610883565b9150508091505092915050565b5f61093783836108df565b905092915050565b5f602082019050919050565b5f6109558261074b565b61095f8185610755565b93508360208202850161097185610765565b805f5b858110156109ac578484038952815161098d858261092c565b94506109988361093f565b925060208a01995050600181019050610974565b50829750879550505050505092915050565b5f606083015f8301516109d35f860182610694565b50602083015184820360208601526109eb82826106ef565b91505060408301518482036040860152610a05828261094b565b9150508091505092915050565b5f6020820190508181035f830152610a2a81846109be565b90509291505056fea2646970667358221220eceacc6d446397857f304b1ffd0804c4e890c35adcb55b79fc6febb1bba2f5e664736f6c634300081a0033" # noqa: E501
8
+ TUPLE_CONTRACT_RUNTIME = "0x608060405234801561000f575f80fd5b5060043610610029575f3560e01c80638e1ae3c71461002d575b5f80fd5b6100476004803603810190610042919061064d565b61005d565b6040516100549190610a12565b60405180910390f35b61006561006d565b819050919050565b60405180606001604052805f815260200160608152602001606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100e8826100a2565b810181811067ffffffffffffffff82111715610107576101066100b2565b5b80604052505050565b5f61011961008d565b905061012582826100df565b919050565b5f80fd5b5f819050919050565b6101408161012e565b811461014a575f80fd5b50565b5f8135905061015b81610137565b92915050565b5f80fd5b5f67ffffffffffffffff82111561017f5761017e6100b2565b5b602082029050602081019050919050565b5f80fd5b5f6101a66101a184610165565b610110565b905080838252602082019050602084028301858111156101c9576101c8610190565b5b835b818110156101f257806101de888261014d565b8452602084019350506020810190506101cb565b5050509392505050565b5f82601f8301126102105761020f610161565b5b8135610220848260208601610194565b91505092915050565b5f67ffffffffffffffff821115610243576102426100b2565b5b602082029050602081019050919050565b5f819050919050565b61026681610254565b8114610270575f80fd5b50565b5f813590506102818161025d565b92915050565b5f67ffffffffffffffff8211156102a1576102a06100b2565b5b602082029050919050565b5f8115159050919050565b6102c0816102ac565b81146102ca575f80fd5b50565b5f813590506102db816102b7565b92915050565b5f6102f36102ee84610287565b610110565b9050806020840283018581111561030d5761030c610190565b5b835b81811015610336578061032288826102cd565b84526020840193505060208101905061030f565b5050509392505050565b5f82601f83011261035457610353610161565b5b60026103618482856102e1565b91505092915050565b5f67ffffffffffffffff821115610384576103836100b2565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103be82610395565b9050919050565b6103ce816103b4565b81146103d8575f80fd5b50565b5f813590506103e9816103c5565b92915050565b5f6104016103fc8461036a565b610110565b9050808382526020820190506020840283018581111561042457610423610190565b5b835b8181101561044d578061043988826103db565b845260208401935050602081019050610426565b5050509392505050565b5f82601f83011261046b5761046a610161565b5b813561047b8482602086016103ef565b91505092915050565b5f608082840312156104995761049861009e565b5b6104a36060610110565b90505f6104b284828501610273565b5f8301525060206104c584828501610340565b602083015250606082013567ffffffffffffffff8111156104e9576104e861012a565b5b6104f584828501610457565b60408301525092915050565b5f61051361050e84610229565b610110565b9050808382526020820190506020840283018581111561053657610535610190565b5b835b8181101561057d57803567ffffffffffffffff81111561055b5761055a610161565b5b8086016105688982610484565b85526020850194505050602081019050610538565b5050509392505050565b5f82601f83011261059b5761059a610161565b5b81356105ab848260208601610501565b91505092915050565b5f606082840312156105c9576105c861009e565b5b6105d36060610110565b90505f6105e28482850161014d565b5f83015250602082013567ffffffffffffffff8111156106055761060461012a565b5b610611848285016101fc565b602083015250604082013567ffffffffffffffff8111156106355761063461012a565b5b61064184828501610587565b60408301525092915050565b5f6020828403121561066257610661610096565b5b5f82013567ffffffffffffffff81111561067f5761067e61009a565b5b61068b848285016105b4565b91505092915050565b61069d8161012e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6106d78383610694565b60208301905092915050565b5f602082019050919050565b5f6106f9826106a3565b61070381856106ad565b935061070e836106bd565b805f5b8381101561073e57815161072588826106cc565b9750610730836106e3565b925050600181019050610711565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61077d81610254565b82525050565b5f60029050919050565b5f81905092915050565b5f819050919050565b6107a9816102ac565b82525050565b5f6107ba83836107a0565b60208301905092915050565b5f602082019050919050565b6107db81610783565b6107e5818461078d565b92506107f082610797565b805f5b8381101561082057815161080787826107af565b9650610812836107c6565b9250506001810190506107f3565b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61085a816103b4565b82525050565b5f61086b8383610851565b60208301905092915050565b5f602082019050919050565b5f61088d82610828565b6108978185610832565b93506108a283610842565b805f5b838110156108d25781516108b98882610860565b97506108c483610877565b9250506001810190506108a5565b5085935050505092915050565b5f608083015f8301516108f45f860182610774565b50602083015161090760208601826107d2565b506040830151848203606086015261091f8282610883565b9150508091505092915050565b5f61093783836108df565b905092915050565b5f602082019050919050565b5f6109558261074b565b61095f8185610755565b93508360208202850161097185610765565b805f5b858110156109ac578484038952815161098d858261092c565b94506109988361093f565b925060208a01995050600181019050610974565b50829750879550505050505092915050565b5f606083015f8301516109d35f860182610694565b50602083015184820360208601526109eb82826106ef565b91505060408301518482036040860152610a05828261094b565b9150508091505092915050565b5f6020820190508181035f830152610a2a81846109be565b90509291505056fea2646970667358221220eceacc6d446397857f304b1ffd0804c4e890c35adcb55b79fc6febb1bba2f5e664736f6c634300081a0033" # noqa: E501
9
9
  TUPLE_CONTRACT_ABI = [
10
10
  {
11
11
  "inputs": [
@@ -71,8 +71,8 @@ TUPLE_CONTRACT_DATA = {
71
71
 
72
72
 
73
73
  # source: web3/_utils/contract_sources/TupleContracts.sol:NestedTupleContract
74
- NESTED_TUPLE_CONTRACT_BYTECODE = "0x608060405234801561000f575f80fd5b5061067b8061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c80632655aef11461002d575b5f80fd5b610047600480360381019061004291906103f1565b61005d565b6040516100549190610625565b60405180910390f35b61006561006d565b819050919050565b6040518060200160405280606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100db82610095565b810181811067ffffffffffffffff821117156100fa576100f96100a5565b5b80604052505050565b5f61010c610080565b905061011882826100d2565b919050565b5f80fd5b5f80fd5b5f67ffffffffffffffff82111561013f5761013e6100a5565b5b602082029050602081019050919050565b5f80fd5b5f67ffffffffffffffff82111561016e5761016d6100a5565b5b602082029050602081019050919050565b5f819050919050565b6101918161017f565b811461019b575f80fd5b50565b5f813590506101ac81610188565b92915050565b5f604082840312156101c7576101c6610091565b5b6101d16040610103565b90505f6101e08482850161019e565b5f8301525060206101f38482850161019e565b60208301525092915050565b5f61021161020c84610154565b610103565b9050808382526020820190506040840283018581111561023457610233610150565b5b835b8181101561025d578061024988826101b2565b845260208401935050604081019050610236565b5050509392505050565b5f82601f83011261027b5761027a610121565b5b813561028b8482602086016101ff565b91505092915050565b5f602082840312156102a9576102a8610091565b5b6102b36020610103565b90505f82013567ffffffffffffffff8111156102d2576102d161011d565b5b6102de84828501610267565b5f8301525092915050565b5f6102fb6102f684610125565b610103565b9050808382526020820190506020840283018581111561031e5761031d610150565b5b835b8181101561036557803567ffffffffffffffff81111561034357610342610121565b5b8086016103508982610294565b85526020850194505050602081019050610320565b5050509392505050565b5f82601f83011261038357610382610121565b5b81356103938482602086016102e9565b91505092915050565b5f602082840312156103b1576103b0610091565b5b6103bb6020610103565b90505f82013567ffffffffffffffff8111156103da576103d961011d565b5b6103e68482850161036f565b5f8301525092915050565b5f6020828403121561040657610405610089565b5b5f82013567ffffffffffffffff8111156104235761042261008d565b5b61042f8482850161039c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6104938161017f565b82525050565b604082015f8201516104ad5f85018261048a565b5060208201516104c0602085018261048a565b50505050565b5f6104d18383610499565b60408301905092915050565b5f602082019050919050565b5f6104f382610461565b6104fd818561046b565b93506105088361047b565b805f5b8381101561053857815161051f88826104c6565b975061052a836104dd565b92505060018101905061050b565b5085935050505092915050565b5f602083015f8301518482035f86015261055f82826104e9565b9150508091505092915050565b5f6105778383610545565b905092915050565b5f602082019050919050565b5f61059582610438565b61059f8185610442565b9350836020820285016105b185610452565b805f5b858110156105ec57848403895281516105cd858261056c565b94506105d88361057f565b925060208a019950506001810190506105b4565b50829750879550505050505092915050565b5f602083015f8301518482035f860152610618828261058b565b9150508091505092915050565b5f6020820190508181035f83015261063d81846105fe565b90509291505056fea2646970667358221220de1e825147976e2227ac2c0fbd97886f084224cf7b1c335d293091c7d5c3ae8464736f6c63430008180033" # noqa: E501
75
- NESTED_TUPLE_CONTRACT_RUNTIME = "0x608060405234801561000f575f80fd5b5060043610610029575f3560e01c80632655aef11461002d575b5f80fd5b610047600480360381019061004291906103f1565b61005d565b6040516100549190610625565b60405180910390f35b61006561006d565b819050919050565b6040518060200160405280606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100db82610095565b810181811067ffffffffffffffff821117156100fa576100f96100a5565b5b80604052505050565b5f61010c610080565b905061011882826100d2565b919050565b5f80fd5b5f80fd5b5f67ffffffffffffffff82111561013f5761013e6100a5565b5b602082029050602081019050919050565b5f80fd5b5f67ffffffffffffffff82111561016e5761016d6100a5565b5b602082029050602081019050919050565b5f819050919050565b6101918161017f565b811461019b575f80fd5b50565b5f813590506101ac81610188565b92915050565b5f604082840312156101c7576101c6610091565b5b6101d16040610103565b90505f6101e08482850161019e565b5f8301525060206101f38482850161019e565b60208301525092915050565b5f61021161020c84610154565b610103565b9050808382526020820190506040840283018581111561023457610233610150565b5b835b8181101561025d578061024988826101b2565b845260208401935050604081019050610236565b5050509392505050565b5f82601f83011261027b5761027a610121565b5b813561028b8482602086016101ff565b91505092915050565b5f602082840312156102a9576102a8610091565b5b6102b36020610103565b90505f82013567ffffffffffffffff8111156102d2576102d161011d565b5b6102de84828501610267565b5f8301525092915050565b5f6102fb6102f684610125565b610103565b9050808382526020820190506020840283018581111561031e5761031d610150565b5b835b8181101561036557803567ffffffffffffffff81111561034357610342610121565b5b8086016103508982610294565b85526020850194505050602081019050610320565b5050509392505050565b5f82601f83011261038357610382610121565b5b81356103938482602086016102e9565b91505092915050565b5f602082840312156103b1576103b0610091565b5b6103bb6020610103565b90505f82013567ffffffffffffffff8111156103da576103d961011d565b5b6103e68482850161036f565b5f8301525092915050565b5f6020828403121561040657610405610089565b5b5f82013567ffffffffffffffff8111156104235761042261008d565b5b61042f8482850161039c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6104938161017f565b82525050565b604082015f8201516104ad5f85018261048a565b5060208201516104c0602085018261048a565b50505050565b5f6104d18383610499565b60408301905092915050565b5f602082019050919050565b5f6104f382610461565b6104fd818561046b565b93506105088361047b565b805f5b8381101561053857815161051f88826104c6565b975061052a836104dd565b92505060018101905061050b565b5085935050505092915050565b5f602083015f8301518482035f86015261055f82826104e9565b9150508091505092915050565b5f6105778383610545565b905092915050565b5f602082019050919050565b5f61059582610438565b61059f8185610442565b9350836020820285016105b185610452565b805f5b858110156105ec57848403895281516105cd858261056c565b94506105d88361057f565b925060208a019950506001810190506105b4565b50829750879550505050505092915050565b5f602083015f8301518482035f860152610618828261058b565b9150508091505092915050565b5f6020820190508181035f83015261063d81846105fe565b90509291505056fea2646970667358221220de1e825147976e2227ac2c0fbd97886f084224cf7b1c335d293091c7d5c3ae8464736f6c63430008180033" # noqa: E501
74
+ NESTED_TUPLE_CONTRACT_BYTECODE = "0x6080604052348015600e575f80fd5b5061067b8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c80632655aef11461002d575b5f80fd5b610047600480360381019061004291906103f1565b61005d565b6040516100549190610625565b60405180910390f35b61006561006d565b819050919050565b6040518060200160405280606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100db82610095565b810181811067ffffffffffffffff821117156100fa576100f96100a5565b5b80604052505050565b5f61010c610080565b905061011882826100d2565b919050565b5f80fd5b5f80fd5b5f67ffffffffffffffff82111561013f5761013e6100a5565b5b602082029050602081019050919050565b5f80fd5b5f67ffffffffffffffff82111561016e5761016d6100a5565b5b602082029050602081019050919050565b5f819050919050565b6101918161017f565b811461019b575f80fd5b50565b5f813590506101ac81610188565b92915050565b5f604082840312156101c7576101c6610091565b5b6101d16040610103565b90505f6101e08482850161019e565b5f8301525060206101f38482850161019e565b60208301525092915050565b5f61021161020c84610154565b610103565b9050808382526020820190506040840283018581111561023457610233610150565b5b835b8181101561025d578061024988826101b2565b845260208401935050604081019050610236565b5050509392505050565b5f82601f83011261027b5761027a610121565b5b813561028b8482602086016101ff565b91505092915050565b5f602082840312156102a9576102a8610091565b5b6102b36020610103565b90505f82013567ffffffffffffffff8111156102d2576102d161011d565b5b6102de84828501610267565b5f8301525092915050565b5f6102fb6102f684610125565b610103565b9050808382526020820190506020840283018581111561031e5761031d610150565b5b835b8181101561036557803567ffffffffffffffff81111561034357610342610121565b5b8086016103508982610294565b85526020850194505050602081019050610320565b5050509392505050565b5f82601f83011261038357610382610121565b5b81356103938482602086016102e9565b91505092915050565b5f602082840312156103b1576103b0610091565b5b6103bb6020610103565b90505f82013567ffffffffffffffff8111156103da576103d961011d565b5b6103e68482850161036f565b5f8301525092915050565b5f6020828403121561040657610405610089565b5b5f82013567ffffffffffffffff8111156104235761042261008d565b5b61042f8482850161039c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6104938161017f565b82525050565b604082015f8201516104ad5f85018261048a565b5060208201516104c0602085018261048a565b50505050565b5f6104d18383610499565b60408301905092915050565b5f602082019050919050565b5f6104f382610461565b6104fd818561046b565b93506105088361047b565b805f5b8381101561053857815161051f88826104c6565b975061052a836104dd565b92505060018101905061050b565b5085935050505092915050565b5f602083015f8301518482035f86015261055f82826104e9565b9150508091505092915050565b5f6105778383610545565b905092915050565b5f602082019050919050565b5f61059582610438565b61059f8185610442565b9350836020820285016105b185610452565b805f5b858110156105ec57848403895281516105cd858261056c565b94506105d88361057f565b925060208a019950506001810190506105b4565b50829750879550505050505092915050565b5f602083015f8301518482035f860152610618828261058b565b9150508091505092915050565b5f6020820190508181035f83015261063d81846105fe565b90509291505056fea26469706673582212201f383cb73e1121ed7db5fc14b5624427a5a50460d2ff05356c6640fb19fc3c4764736f6c634300081a0033" # noqa: E501
75
+ NESTED_TUPLE_CONTRACT_RUNTIME = "0x608060405234801561000f575f80fd5b5060043610610029575f3560e01c80632655aef11461002d575b5f80fd5b610047600480360381019061004291906103f1565b61005d565b6040516100549190610625565b60405180910390f35b61006561006d565b819050919050565b6040518060200160405280606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100db82610095565b810181811067ffffffffffffffff821117156100fa576100f96100a5565b5b80604052505050565b5f61010c610080565b905061011882826100d2565b919050565b5f80fd5b5f80fd5b5f67ffffffffffffffff82111561013f5761013e6100a5565b5b602082029050602081019050919050565b5f80fd5b5f67ffffffffffffffff82111561016e5761016d6100a5565b5b602082029050602081019050919050565b5f819050919050565b6101918161017f565b811461019b575f80fd5b50565b5f813590506101ac81610188565b92915050565b5f604082840312156101c7576101c6610091565b5b6101d16040610103565b90505f6101e08482850161019e565b5f8301525060206101f38482850161019e565b60208301525092915050565b5f61021161020c84610154565b610103565b9050808382526020820190506040840283018581111561023457610233610150565b5b835b8181101561025d578061024988826101b2565b845260208401935050604081019050610236565b5050509392505050565b5f82601f83011261027b5761027a610121565b5b813561028b8482602086016101ff565b91505092915050565b5f602082840312156102a9576102a8610091565b5b6102b36020610103565b90505f82013567ffffffffffffffff8111156102d2576102d161011d565b5b6102de84828501610267565b5f8301525092915050565b5f6102fb6102f684610125565b610103565b9050808382526020820190506020840283018581111561031e5761031d610150565b5b835b8181101561036557803567ffffffffffffffff81111561034357610342610121565b5b8086016103508982610294565b85526020850194505050602081019050610320565b5050509392505050565b5f82601f83011261038357610382610121565b5b81356103938482602086016102e9565b91505092915050565b5f602082840312156103b1576103b0610091565b5b6103bb6020610103565b90505f82013567ffffffffffffffff8111156103da576103d961011d565b5b6103e68482850161036f565b5f8301525092915050565b5f6020828403121561040657610405610089565b5b5f82013567ffffffffffffffff8111156104235761042261008d565b5b61042f8482850161039c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6104938161017f565b82525050565b604082015f8201516104ad5f85018261048a565b5060208201516104c0602085018261048a565b50505050565b5f6104d18383610499565b60408301905092915050565b5f602082019050919050565b5f6104f382610461565b6104fd818561046b565b93506105088361047b565b805f5b8381101561053857815161051f88826104c6565b975061052a836104dd565b92505060018101905061050b565b5085935050505092915050565b5f602083015f8301518482035f86015261055f82826104e9565b9150508091505092915050565b5f6105778383610545565b905092915050565b5f602082019050919050565b5f61059582610438565b61059f8185610442565b9350836020820285016105b185610452565b805f5b858110156105ec57848403895281516105cd858261056c565b94506105d88361057f565b925060208a019950506001810190506105b4565b50829750879550505050505092915050565b5f602083015f8301518482035f860152610618828261058b565b9150508091505092915050565b5f6020820190508181035f83015261063d81846105fe565b90509291505056fea26469706673582212201f383cb73e1121ed7db5fc14b5624427a5a50460d2ff05356c6640fb19fc3c4764736f6c634300081a0033" # noqa: E501
76
76
  NESTED_TUPLE_CONTRACT_ABI = [
77
77
  {
78
78
  "inputs": [
web3/_utils/contracts.py CHANGED
@@ -4,10 +4,10 @@ from typing import (
4
4
  Any,
5
5
  Callable,
6
6
  Dict,
7
+ List,
7
8
  Optional,
8
9
  Sequence,
9
10
  Tuple,
10
- Type,
11
11
  Union,
12
12
  cast,
13
13
  )
@@ -19,6 +19,14 @@ from eth_abi.registry import (
19
19
  registry as default_registry,
20
20
  )
21
21
  from eth_typing import (
22
+ ABI,
23
+ ABICallable,
24
+ ABIConstructor,
25
+ ABIElement,
26
+ ABIEvent,
27
+ ABIFallback,
28
+ ABIFunction,
29
+ ABIReceive,
22
30
  ChecksumAddress,
23
31
  HexStr,
24
32
  TypeStr,
@@ -26,11 +34,9 @@ from eth_typing import (
26
34
  from eth_utils import (
27
35
  add_0x_prefix,
28
36
  encode_hex,
29
- function_abi_to_4byte_selector,
30
- is_binary_address,
31
- is_checksum_address,
32
- is_list_like,
33
- is_text,
37
+ filter_abi_by_name,
38
+ filter_abi_by_type,
39
+ get_abi_input_types,
34
40
  )
35
41
  from eth_utils.toolz import (
36
42
  pipe,
@@ -40,31 +46,20 @@ from hexbytes import (
40
46
  )
41
47
 
42
48
  from web3._utils.abi import (
43
- abi_to_signature,
44
- check_if_arguments_can_be_encoded,
45
- filter_by_argument_count,
46
49
  filter_by_argument_name,
47
- filter_by_encodability,
48
- filter_by_name,
49
- filter_by_type,
50
- get_abi_input_types,
51
- get_aligned_abi_inputs,
52
- get_fallback_func_abi,
53
- get_receive_func_abi,
54
50
  map_abi_data,
55
- merge_args_and_kwargs,
56
51
  named_tree,
57
52
  )
53
+ from web3._utils.abi_element_identifiers import (
54
+ FallbackFn,
55
+ ReceiveFn,
56
+ )
58
57
  from web3._utils.blocks import (
59
58
  is_hex_encoded_block_hash,
60
59
  )
61
60
  from web3._utils.encoding import (
62
61
  to_hex,
63
62
  )
64
- from web3._utils.function_identifiers import (
65
- FallbackFn,
66
- ReceiveFn,
67
- )
68
63
  from web3._utils.method_formatters import (
69
64
  to_integer_if_hex,
70
65
  )
@@ -75,17 +70,22 @@ from web3._utils.normalizers import (
75
70
  abi_string_to_text,
76
71
  )
77
72
  from web3.exceptions import (
78
- BlockNumberOutofRange,
73
+ BlockNumberOutOfRange,
74
+ Web3TypeError,
79
75
  Web3ValidationError,
76
+ Web3ValueError,
80
77
  )
81
78
  from web3.types import (
82
- ABI,
83
- ABIEvent,
84
- ABIFunction,
79
+ ABIElementIdentifier,
85
80
  BlockIdentifier,
86
81
  BlockNumber,
87
82
  TxParams,
88
83
  )
84
+ from web3.utils.abi import (
85
+ check_if_arguments_can_be_encoded,
86
+ get_abi_element,
87
+ get_abi_element_info,
88
+ )
89
89
 
90
90
  if TYPE_CHECKING:
91
91
  from web3 import ( # noqa: F401
@@ -94,130 +94,50 @@ if TYPE_CHECKING:
94
94
  )
95
95
 
96
96
 
97
- def extract_argument_types(*args: Sequence[Any]) -> str:
98
- """
99
- Takes a list of arguments and returns a string representation of the argument types,
100
- appropriately collapsing `tuple` types into the respective nested types.
101
- """
102
- collapsed_args = []
103
-
104
- for arg in args:
105
- if is_list_like(arg):
106
- collapsed_nested = []
107
- for nested in arg:
108
- if is_list_like(nested):
109
- collapsed_nested.append(f"({extract_argument_types(nested)})")
110
- else:
111
- collapsed_nested.append(_get_argument_readable_type(nested))
112
- collapsed_args.append(",".join(collapsed_nested))
113
- else:
114
- collapsed_args.append(_get_argument_readable_type(arg))
115
-
116
- return ",".join(collapsed_args)
117
-
118
-
119
97
  def find_matching_event_abi(
120
98
  abi: ABI,
121
99
  event_name: Optional[str] = None,
122
100
  argument_names: Optional[Sequence[str]] = None,
123
101
  ) -> ABIEvent:
124
- filters = [
125
- functools.partial(filter_by_type, "event"),
102
+ filters: List[functools.partial[Sequence[ABIElement]]] = [
103
+ functools.partial(filter_abi_by_type, "event"),
126
104
  ]
127
105
 
128
106
  if event_name is not None:
129
- filters.append(functools.partial(filter_by_name, event_name))
107
+ filters.append(functools.partial(filter_abi_by_name, event_name))
130
108
 
131
109
  if argument_names is not None:
132
110
  filters.append(functools.partial(filter_by_argument_name, argument_names))
133
111
 
134
- event_abi_candidates = pipe(abi, *filters)
112
+ event_abi_candidates: Sequence[ABIEvent] = pipe(abi, *filters)
135
113
 
136
114
  if len(event_abi_candidates) == 1:
137
115
  return event_abi_candidates[0]
138
116
  elif not event_abi_candidates:
139
- raise ValueError("No matching events found")
140
- else:
141
- raise ValueError("Multiple events found")
142
-
143
-
144
- def find_matching_fn_abi(
145
- abi: ABI,
146
- abi_codec: ABICodec,
147
- fn_identifier: Optional[Union[str, Type[FallbackFn], Type[ReceiveFn]]] = None,
148
- args: Optional[Sequence[Any]] = None,
149
- kwargs: Optional[Any] = None,
150
- ) -> ABIFunction:
151
- args = args or tuple()
152
- kwargs = kwargs or dict()
153
- num_arguments = len(args) + len(kwargs)
154
-
155
- if fn_identifier is FallbackFn:
156
- return get_fallback_func_abi(abi)
157
-
158
- if fn_identifier is ReceiveFn:
159
- return get_receive_func_abi(abi)
160
-
161
- if not is_text(fn_identifier):
162
- raise TypeError("Unsupported function identifier")
163
-
164
- name_filter = functools.partial(filter_by_name, fn_identifier)
165
- arg_count_filter = functools.partial(filter_by_argument_count, num_arguments)
166
- encoding_filter = functools.partial(filter_by_encodability, abi_codec, args, kwargs)
167
-
168
- function_candidates = pipe(abi, name_filter, arg_count_filter, encoding_filter)
169
-
170
- if len(function_candidates) == 1:
171
- return function_candidates[0]
117
+ raise Web3ValueError("No matching events found")
172
118
  else:
173
- matching_identifiers = name_filter(abi)
174
- matching_function_signatures = [
175
- abi_to_signature(func) for func in matching_identifiers
176
- ]
177
-
178
- arg_count_matches = len(arg_count_filter(matching_identifiers))
179
- encoding_matches = len(encoding_filter(matching_identifiers))
180
-
181
- if arg_count_matches == 0:
182
- diagnosis = (
183
- "\nFunction invocation failed due to improper number of arguments."
184
- )
185
- elif encoding_matches == 0:
186
- diagnosis = (
187
- "\nFunction invocation failed due to no matching argument types."
188
- )
189
- elif encoding_matches > 1:
190
- diagnosis = (
191
- "\nAmbiguous argument encoding. "
192
- "Provided arguments can be encoded to multiple functions "
193
- "matching this call."
194
- )
195
-
196
- collapsed_args = extract_argument_types(args)
197
- collapsed_kwargs = dict(
198
- {(k, extract_argument_types([v])) for k, v in kwargs.items()}
199
- )
200
- message = (
201
- f"\nCould not identify the intended function with name `{fn_identifier}`, "
202
- f"positional arguments with type(s) `{collapsed_args}` and "
203
- f"keyword arguments with type(s) `{collapsed_kwargs}`."
204
- f"\nFound {len(matching_identifiers)} function(s) with "
205
- f"the name `{fn_identifier}`: {matching_function_signatures}{diagnosis}"
206
- )
207
-
208
- raise Web3ValidationError(message)
119
+ raise Web3ValueError("Multiple events found")
209
120
 
210
121
 
211
122
  def encode_abi(
212
123
  w3: Union["AsyncWeb3", "Web3"],
213
- abi: ABIFunction,
124
+ abi: ABIElement,
214
125
  arguments: Sequence[Any],
215
126
  data: Optional[HexStr] = None,
216
127
  ) -> HexStr:
217
- argument_types = get_abi_input_types(abi)
218
-
219
- if not check_if_arguments_can_be_encoded(abi, w3.codec, arguments, {}):
220
- raise TypeError(
128
+ argument_types = []
129
+ try:
130
+ argument_types = get_abi_input_types(abi)
131
+ except ValueError:
132
+ # Use the default argument_types if the abi doesn't have inputs
133
+ pass
134
+
135
+ if not check_if_arguments_can_be_encoded(
136
+ abi,
137
+ *arguments,
138
+ abi_codec=w3.codec,
139
+ ):
140
+ raise Web3TypeError(
221
141
  "One or more arguments could not be encoded to the necessary "
222
142
  f"ABI type. Expected types are: {', '.join(argument_types)}"
223
143
  )
@@ -248,25 +168,33 @@ def encode_abi(
248
168
  def prepare_transaction(
249
169
  address: ChecksumAddress,
250
170
  w3: Union["AsyncWeb3", "Web3"],
251
- fn_identifier: Union[str, Type[FallbackFn], Type[ReceiveFn]],
171
+ abi_element_identifier: ABIElementIdentifier,
252
172
  contract_abi: Optional[ABI] = None,
253
- fn_abi: Optional[ABIFunction] = None,
173
+ abi_callable: Optional[ABICallable] = None,
254
174
  transaction: Optional[TxParams] = None,
255
175
  fn_args: Optional[Sequence[Any]] = None,
256
176
  fn_kwargs: Optional[Any] = None,
257
177
  ) -> TxParams:
258
178
  """
259
- :parameter `is_function_abi` is used to distinguish function abi from contract abi
260
179
  Returns a dictionary of the transaction that could be used to call this
261
180
  TODO: make this a public API
262
181
  TODO: add new prepare_deploy_transaction API
263
182
  """
264
- if fn_abi is None:
265
- fn_abi = find_matching_fn_abi(
266
- contract_abi, w3.codec, fn_identifier, fn_args, fn_kwargs
183
+ fn_args = fn_args or []
184
+ fn_kwargs = fn_kwargs or {}
185
+ if abi_callable is None:
186
+ abi_callable = cast(
187
+ ABICallable,
188
+ get_abi_element(
189
+ contract_abi,
190
+ abi_element_identifier,
191
+ *fn_args,
192
+ abi_codec=w3.codec,
193
+ **fn_kwargs,
194
+ ),
267
195
  )
268
196
 
269
- validate_payable(transaction, fn_abi)
197
+ validate_payable(transaction, abi_callable)
270
198
 
271
199
  if transaction is None:
272
200
  prepared_transaction: TxParams = {}
@@ -274,16 +202,16 @@ def prepare_transaction(
274
202
  prepared_transaction = cast(TxParams, dict(**transaction))
275
203
 
276
204
  if "data" in prepared_transaction:
277
- raise ValueError("Transaction parameter may not contain a 'data' key")
205
+ raise Web3ValueError("Transaction parameter may not contain a 'data' key")
278
206
 
279
207
  if address:
280
208
  prepared_transaction.setdefault("to", address)
281
209
 
282
210
  prepared_transaction["data"] = encode_transaction_data(
283
211
  w3,
284
- fn_identifier,
212
+ abi_element_identifier,
285
213
  contract_abi,
286
- fn_abi,
214
+ abi_callable,
287
215
  fn_args,
288
216
  fn_kwargs,
289
217
  )
@@ -292,34 +220,36 @@ def prepare_transaction(
292
220
 
293
221
  def encode_transaction_data(
294
222
  w3: Union["AsyncWeb3", "Web3"],
295
- fn_identifier: Union[str, Type[FallbackFn], Type[ReceiveFn]],
223
+ abi_element_identifier: ABIElementIdentifier,
296
224
  contract_abi: Optional[ABI] = None,
297
- fn_abi: Optional[ABIFunction] = None,
225
+ abi_callable: Optional[ABICallable] = None,
298
226
  args: Optional[Sequence[Any]] = None,
299
227
  kwargs: Optional[Any] = None,
300
228
  ) -> HexStr:
301
- if fn_identifier is FallbackFn:
302
- fn_abi, fn_selector, fn_arguments = get_fallback_function_info(
303
- contract_abi, fn_abi
229
+ info_abi: ABIElement
230
+ if abi_element_identifier is FallbackFn:
231
+ info_abi, info_selector, info_arguments = get_fallback_function_info(
232
+ contract_abi, cast(ABIFallback, abi_callable)
304
233
  )
305
- elif fn_identifier is ReceiveFn:
306
- fn_abi, fn_selector, fn_arguments = get_receive_function_info(
307
- contract_abi, fn_abi
234
+ elif abi_element_identifier is ReceiveFn:
235
+ info_abi, info_selector, info_arguments = get_receive_function_info(
236
+ contract_abi, cast(ABIReceive, abi_callable)
308
237
  )
309
- elif is_text(fn_identifier):
310
- fn_abi, fn_selector, fn_arguments = get_function_info(
311
- # type ignored b/c fn_id here is always str b/c FallbackFn is handled above
312
- fn_identifier, # type: ignore
313
- w3.codec,
238
+ elif isinstance(abi_element_identifier, str):
239
+ fn_info = get_abi_element_info(
314
240
  contract_abi,
315
- fn_abi,
316
- args,
317
- kwargs,
241
+ abi_element_identifier,
242
+ *args,
243
+ abi_codec=w3.codec,
244
+ **kwargs,
318
245
  )
246
+ info_abi = fn_info["abi"]
247
+ info_selector = fn_info["selector"]
248
+ info_arguments = fn_info["arguments"]
319
249
  else:
320
- raise TypeError("Unsupported function identifier")
250
+ raise Web3TypeError("Unsupported function identifier")
321
251
 
322
- return add_0x_prefix(encode_abi(w3, fn_abi, fn_arguments, fn_selector))
252
+ return add_0x_prefix(encode_abi(w3, info_abi, info_arguments, info_selector))
323
253
 
324
254
 
325
255
  def decode_transaction_data(
@@ -327,87 +257,67 @@ def decode_transaction_data(
327
257
  data: HexStr,
328
258
  normalizers: Sequence[Callable[[TypeStr, Any], Tuple[TypeStr, Any]]] = None,
329
259
  ) -> Dict[str, Any]:
330
- # type ignored b/c expects data arg to be HexBytes
331
- data = HexBytes(data) # type: ignore
260
+ data_bytes = HexBytes(data)
332
261
  types = get_abi_input_types(fn_abi)
333
262
  abi_codec = ABICodec(default_registry)
334
- decoded = abi_codec.decode(types, HexBytes(data[4:]))
263
+ decoded = abi_codec.decode(types, data_bytes[4:])
335
264
  if normalizers:
336
265
  decoded = map_abi_data(normalizers, types, decoded)
337
266
  return named_tree(fn_abi["inputs"], decoded)
338
267
 
339
268
 
340
- def get_fallback_function_info(
341
- contract_abi: Optional[ABI] = None, fn_abi: Optional[ABIFunction] = None
342
- ) -> Tuple[ABIFunction, HexStr, Tuple[Any, ...]]:
343
- if fn_abi is None:
344
- fn_abi = get_fallback_func_abi(contract_abi)
269
+ def get_constructor_function_info(
270
+ contract_abi: Optional[ABI] = None, constructor_abi: Optional[ABIConstructor] = None
271
+ ) -> Tuple[ABIConstructor, HexStr, Tuple[Any, ...]]:
272
+ if constructor_abi is None:
273
+ constructor_abi = cast(
274
+ ABIConstructor, get_abi_element(contract_abi, "constructor")
275
+ )
345
276
  fn_selector = encode_hex(b"")
346
277
  fn_arguments: Tuple[Any, ...] = tuple()
347
- return fn_abi, fn_selector, fn_arguments
278
+ return constructor_abi, fn_selector, fn_arguments
348
279
 
349
280
 
350
- def get_receive_function_info(
351
- contract_abi: Optional[ABI] = None, fn_abi: Optional[ABIFunction] = None
352
- ) -> Tuple[ABIFunction, HexStr, Tuple[Any, ...]]:
353
- if fn_abi is None:
354
- fn_abi = get_receive_func_abi(contract_abi)
281
+ def get_fallback_function_info(
282
+ contract_abi: Optional[ABI] = None, fallback_abi: Optional[ABIFallback] = None
283
+ ) -> Tuple[ABIFallback, HexStr, Tuple[Any, ...]]:
284
+ if fallback_abi is None:
285
+ fallback_abi = cast(ABIFallback, get_abi_element(contract_abi, "fallback"))
355
286
  fn_selector = encode_hex(b"")
356
287
  fn_arguments: Tuple[Any, ...] = tuple()
357
- return fn_abi, fn_selector, fn_arguments
358
-
288
+ return fallback_abi, fn_selector, fn_arguments
359
289
 
360
- def get_function_info(
361
- fn_name: str,
362
- abi_codec: ABICodec,
363
- contract_abi: Optional[ABI] = None,
364
- fn_abi: Optional[ABIFunction] = None,
365
- args: Optional[Sequence[Any]] = None,
366
- kwargs: Optional[Any] = None,
367
- ) -> Tuple[ABIFunction, HexStr, Tuple[Any, ...]]:
368
- if args is None:
369
- args = tuple()
370
- if kwargs is None:
371
- kwargs = {}
372
-
373
- if fn_abi is None:
374
- fn_abi = find_matching_fn_abi(contract_abi, abi_codec, fn_name, args, kwargs)
375
-
376
- # typed dict cannot be used w/ a normal Dict
377
- # https://github.com/python/mypy/issues/4976
378
- fn_selector = encode_hex(function_abi_to_4byte_selector(fn_abi)) # type: ignore
379
290
 
380
- fn_arguments = merge_args_and_kwargs(fn_abi, args, kwargs)
381
-
382
- _, aligned_fn_arguments = get_aligned_abi_inputs(fn_abi, fn_arguments)
383
-
384
- return fn_abi, fn_selector, aligned_fn_arguments
291
+ def get_receive_function_info(
292
+ contract_abi: Optional[ABI] = None, receive_abi: Optional[ABIReceive] = None
293
+ ) -> Tuple[ABIReceive, HexStr, Tuple[Any, ...]]:
294
+ if receive_abi is None:
295
+ receive_abi = cast(ABIReceive, get_abi_element(contract_abi, "receive"))
296
+ fn_selector = encode_hex(b"")
297
+ fn_arguments: Tuple[Any, ...] = tuple()
298
+ return receive_abi, fn_selector, fn_arguments
385
299
 
386
300
 
387
- def validate_payable(transaction: TxParams, abi: ABIFunction) -> None:
388
- """Raise Web3ValidationError if non-zero ether
301
+ def validate_payable(transaction: TxParams, abi_callable: ABICallable) -> None:
302
+ """
303
+ Raise Web3ValidationError if non-zero ether
389
304
  is sent to a non-payable function.
390
305
  """
391
- if "value" in transaction:
392
- if to_integer_if_hex(transaction["value"]) != 0:
393
- if (
394
- "payable" in abi
395
- and not abi["payable"]
396
- or "stateMutability" in abi
397
- and abi["stateMutability"] == "nonpayable"
398
- ):
399
- raise Web3ValidationError(
400
- "Sending non-zero ether to a contract function "
401
- "with payable=False. Please ensure that "
402
- "transaction's value is 0."
403
- )
404
-
405
-
406
- def _get_argument_readable_type(arg: Any) -> str:
407
- if is_checksum_address(arg) or is_binary_address(arg):
408
- return "address"
409
-
410
- return arg.__class__.__name__
306
+ if (
307
+ "value" in transaction
308
+ and to_integer_if_hex(transaction["value"]) != 0
309
+ and (
310
+ "payable" in abi_callable
311
+ and not abi_callable["payable"]
312
+ or "stateMutability" in abi_callable
313
+ and abi_callable["stateMutability"] == "nonpayable"
314
+ )
315
+ ):
316
+ raise Web3ValidationError(
317
+ "Sending non-zero ether to a contract function "
318
+ "with payable=False. Please ensure that "
319
+ "transaction's value is 0."
320
+ )
411
321
 
412
322
 
413
323
  def parse_block_identifier(
@@ -424,7 +334,7 @@ def parse_block_identifier(
424
334
  ):
425
335
  return w3.eth.get_block(block_identifier)["number"]
426
336
  else:
427
- raise BlockNumberOutofRange
337
+ raise BlockNumberOutOfRange
428
338
 
429
339
 
430
340
  def parse_block_identifier_int(w3: "Web3", block_identifier_int: int) -> BlockNumber:
@@ -434,27 +344,10 @@ def parse_block_identifier_int(w3: "Web3", block_identifier_int: int) -> BlockNu
434
344
  last_block = w3.eth.get_block("latest")["number"]
435
345
  block_num = last_block + block_identifier_int + 1
436
346
  if block_num < 0:
437
- raise BlockNumberOutofRange
347
+ raise BlockNumberOutOfRange
438
348
  return BlockNumber(block_num)
439
349
 
440
350
 
441
- def parse_block_identifier_no_extra_call(
442
- w3: Union["Web3", "AsyncWeb3"], block_identifier: BlockIdentifier
443
- ) -> BlockIdentifier:
444
- if block_identifier is None:
445
- return w3.eth.default_block
446
- elif isinstance(block_identifier, int) and block_identifier >= 0:
447
- return block_identifier
448
- elif block_identifier in ["latest", "earliest", "pending", "safe", "finalized"]:
449
- return block_identifier
450
- elif isinstance(block_identifier, bytes):
451
- return HexBytes(block_identifier)
452
- elif is_hex_encoded_block_hash(block_identifier):
453
- return HexStr(str(block_identifier))
454
- else:
455
- raise BlockNumberOutofRange
456
-
457
-
458
351
  async def async_parse_block_identifier(
459
352
  async_w3: "AsyncWeb3", block_identifier: BlockIdentifier
460
353
  ) -> BlockIdentifier:
@@ -470,7 +363,7 @@ async def async_parse_block_identifier(
470
363
  requested_block = await async_w3.eth.get_block(block_identifier)
471
364
  return requested_block["number"]
472
365
  else:
473
- raise BlockNumberOutofRange
366
+ raise BlockNumberOutOfRange
474
367
 
475
368
 
476
369
  async def async_parse_block_identifier_int(
@@ -483,5 +376,6 @@ async def async_parse_block_identifier_int(
483
376
  last_block_num = last_block["number"]
484
377
  block_num = last_block_num + block_identifier_int + 1
485
378
  if block_num < 0:
486
- raise BlockNumberOutofRange
379
+ raise BlockNumberOutOfRange
380
+ return BlockNumber(block_num)
487
381
  return BlockNumber(block_num)
web3/_utils/datatypes.py CHANGED
@@ -14,10 +14,14 @@ from eth_utils.toolz import (
14
14
  concat,
15
15
  )
16
16
 
17
+ from web3.exceptions import (
18
+ Web3AttributeError,
19
+ )
20
+
17
21
 
18
22
  def verify_attr(class_name: str, key: str, namespace: Collection[str]) -> None:
19
23
  if key not in namespace:
20
- raise AttributeError(
24
+ raise Web3AttributeError(
21
25
  f"Property {key} not found on {class_name} class. "
22
26
  f"`{class_name}.factory` only accepts keyword arguments which are "
23
27
  f"present on the {class_name} class"