web3 7.0.0b1__py3-none-any.whl → 7.0.0b3__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 (149) hide show
  1. ens/async_ens.py +6 -8
  2. ens/ens.py +6 -6
  3. ens/utils.py +18 -16
  4. web3/_utils/abi.py +9 -15
  5. web3/_utils/events.py +15 -6
  6. web3/_utils/math.py +12 -14
  7. web3/_utils/method_formatters.py +7 -0
  8. web3/_utils/module_testing/eth_module.py +67 -6
  9. web3/_utils/module_testing/module_testing_utils.py +2 -2
  10. web3/_utils/request.py +1 -1
  11. web3/_utils/rpc_abi.py +1 -0
  12. web3/_utils/transactions.py +4 -0
  13. web3/contract/base_contract.py +1 -1
  14. web3/datastructures.py +7 -7
  15. web3/eth/async_eth.py +20 -2
  16. web3/eth/eth.py +13 -1
  17. web3/exceptions.py +11 -0
  18. web3/main.py +4 -30
  19. web3/manager.py +12 -13
  20. web3/middleware/__init__.py +9 -8
  21. web3/module.py +1 -1
  22. web3/providers/async_base.py +6 -6
  23. web3/providers/base.py +8 -8
  24. web3/providers/eth_tester/main.py +16 -20
  25. web3/providers/ipc.py +1 -1
  26. web3/providers/legacy_websocket.py +1 -1
  27. web3/providers/persistent/persistent.py +2 -2
  28. web3/providers/persistent/request_processor.py +3 -5
  29. web3/tools/benchmark/main.py +2 -2
  30. web3/types.py +4 -0
  31. web3/utils/caching.py +2 -4
  32. {web3-7.0.0b1.dist-info → web3-7.0.0b3.dist-info}/METADATA +3 -9
  33. web3-7.0.0b3.dist-info/RECORD +168 -0
  34. {web3-7.0.0b1.dist-info → web3-7.0.0b3.dist-info}/WHEEL +1 -1
  35. {web3-7.0.0b1.dist-info → web3-7.0.0b3.dist-info}/top_level.txt +0 -1
  36. ethpm/__init__.py +0 -20
  37. ethpm/_utils/__init__.py +0 -0
  38. ethpm/_utils/backend.py +0 -93
  39. ethpm/_utils/cache.py +0 -44
  40. ethpm/_utils/chains.py +0 -119
  41. ethpm/_utils/contract.py +0 -35
  42. ethpm/_utils/deployments.py +0 -145
  43. ethpm/_utils/ipfs.py +0 -116
  44. ethpm/_utils/protobuf/__init__.py +0 -0
  45. ethpm/_utils/protobuf/ipfs_file_pb2.py +0 -33
  46. ethpm/_utils/registry.py +0 -29
  47. ethpm/assets/__init__.py +0 -0
  48. ethpm/assets/ens/v3.json +0 -1
  49. ethpm/assets/escrow/with_bytecode_v3.json +0 -1
  50. ethpm/assets/ipfs_file.proto +0 -32
  51. ethpm/assets/owned/output_v3.json +0 -1
  52. ethpm/assets/owned/with_contract_type_v3.json +0 -1
  53. ethpm/assets/registry/contracts/Authority.sol +0 -156
  54. ethpm/assets/registry/contracts/IndexedOrderedSetLib.sol +0 -106
  55. ethpm/assets/registry/contracts/PackageDB.sol +0 -225
  56. ethpm/assets/registry/contracts/PackageRegistry.sol +0 -361
  57. ethpm/assets/registry/contracts/PackageRegistryInterface.sol +0 -97
  58. ethpm/assets/registry/contracts/ReleaseDB.sol +0 -309
  59. ethpm/assets/registry/contracts/ReleaseValidator.sol +0 -152
  60. ethpm/assets/registry/solc_input.json +0 -1
  61. ethpm/assets/registry/solc_output.json +0 -1
  62. ethpm/assets/registry/v3.json +0 -1
  63. ethpm/assets/safe-math-lib/v3-strict-no-deployments.json +0 -1
  64. ethpm/assets/simple-registry/contracts/Ownable.sol +0 -63
  65. ethpm/assets/simple-registry/contracts/PackageRegistry.sol +0 -373
  66. ethpm/assets/simple-registry/contracts/PackageRegistryInterface.sol +0 -96
  67. ethpm/assets/simple-registry/solc_input.json +0 -33
  68. ethpm/assets/simple-registry/solc_output.json +0 -1
  69. ethpm/assets/simple-registry/v3.json +0 -1
  70. ethpm/assets/standard-token/output_v3.json +0 -1
  71. ethpm/assets/standard-token/with_bytecode_v3.json +0 -1
  72. ethpm/assets/vyper_registry/0.1.0.json +0 -1
  73. ethpm/assets/vyper_registry/registry.vy +0 -216
  74. ethpm/assets/vyper_registry/registry_with_delete.vy +0 -244
  75. ethpm/backends/__init__.py +0 -0
  76. ethpm/backends/base.py +0 -43
  77. ethpm/backends/http.py +0 -108
  78. ethpm/backends/ipfs.py +0 -219
  79. ethpm/backends/registry.py +0 -154
  80. ethpm/constants.py +0 -17
  81. ethpm/contract.py +0 -187
  82. ethpm/dependencies.py +0 -58
  83. ethpm/deployments.py +0 -80
  84. ethpm/ethpm-spec/examples/escrow/1.0.0-pretty.json +0 -146
  85. ethpm/ethpm-spec/examples/escrow/1.0.0.json +0 -1
  86. ethpm/ethpm-spec/examples/escrow/contracts/Escrow.sol +0 -32
  87. ethpm/ethpm-spec/examples/escrow/contracts/SafeSendLib.sol +0 -20
  88. ethpm/ethpm-spec/examples/escrow/v3-pretty.json +0 -171
  89. ethpm/ethpm-spec/examples/escrow/v3.json +0 -1
  90. ethpm/ethpm-spec/examples/owned/1.0.0-pretty.json +0 -21
  91. ethpm/ethpm-spec/examples/owned/1.0.0.json +0 -1
  92. ethpm/ethpm-spec/examples/owned/contracts/Owned.sol +0 -12
  93. ethpm/ethpm-spec/examples/owned/v3-pretty.json +0 -27
  94. ethpm/ethpm-spec/examples/owned/v3.json +0 -1
  95. ethpm/ethpm-spec/examples/piper-coin/1.0.0-pretty.json +0 -31
  96. ethpm/ethpm-spec/examples/piper-coin/1.0.0.json +0 -1
  97. ethpm/ethpm-spec/examples/piper-coin/v3-pretty.json +0 -21
  98. ethpm/ethpm-spec/examples/piper-coin/v3.json +0 -1
  99. ethpm/ethpm-spec/examples/safe-math-lib/1.0.0-pretty.json +0 -85
  100. ethpm/ethpm-spec/examples/safe-math-lib/1.0.0.json +0 -1
  101. ethpm/ethpm-spec/examples/safe-math-lib/contracts/SafeMathLib.sol +0 -24
  102. ethpm/ethpm-spec/examples/safe-math-lib/v3-pretty.json +0 -117
  103. ethpm/ethpm-spec/examples/safe-math-lib/v3.json +0 -1
  104. ethpm/ethpm-spec/examples/standard-token/1.0.0-pretty.json +0 -55
  105. ethpm/ethpm-spec/examples/standard-token/1.0.0.json +0 -1
  106. ethpm/ethpm-spec/examples/standard-token/contracts/AbstractToken.sol +0 -20
  107. ethpm/ethpm-spec/examples/standard-token/contracts/StandardToken.sol +0 -84
  108. ethpm/ethpm-spec/examples/standard-token/v3-pretty.json +0 -460
  109. ethpm/ethpm-spec/examples/standard-token/v3.json +0 -1
  110. ethpm/ethpm-spec/examples/transferable/1.0.0-pretty.json +0 -21
  111. ethpm/ethpm-spec/examples/transferable/1.0.0.json +0 -1
  112. ethpm/ethpm-spec/examples/transferable/contracts/Transferable.sol +0 -14
  113. ethpm/ethpm-spec/examples/transferable/v3-pretty.json +0 -27
  114. ethpm/ethpm-spec/examples/transferable/v3.json +0 -1
  115. ethpm/ethpm-spec/examples/wallet/1.0.0-pretty.json +0 -120
  116. ethpm/ethpm-spec/examples/wallet/1.0.0.json +0 -1
  117. ethpm/ethpm-spec/examples/wallet/contracts/Wallet.sol +0 -41
  118. ethpm/ethpm-spec/examples/wallet/v3-pretty.json +0 -181
  119. ethpm/ethpm-spec/examples/wallet/v3.json +0 -1
  120. ethpm/ethpm-spec/examples/wallet-with-send/1.0.0-pretty.json +0 -135
  121. ethpm/ethpm-spec/examples/wallet-with-send/1.0.0.json +0 -1
  122. ethpm/ethpm-spec/examples/wallet-with-send/contracts/WalletWithSend.sol +0 -18
  123. ethpm/ethpm-spec/examples/wallet-with-send/v3-pretty.json +0 -207
  124. ethpm/ethpm-spec/examples/wallet-with-send/v3.json +0 -1
  125. ethpm/ethpm-spec/spec/package.spec.json +0 -379
  126. ethpm/ethpm-spec/spec/v3.spec.json +0 -483
  127. ethpm/exceptions.py +0 -68
  128. ethpm/package.py +0 -438
  129. ethpm/tools/__init__.py +0 -4
  130. ethpm/tools/builder.py +0 -930
  131. ethpm/tools/checker.py +0 -312
  132. ethpm/tools/get_manifest.py +0 -19
  133. ethpm/uri.py +0 -141
  134. ethpm/validation/__init__.py +0 -0
  135. ethpm/validation/manifest.py +0 -146
  136. ethpm/validation/misc.py +0 -39
  137. ethpm/validation/package.py +0 -80
  138. ethpm/validation/uri.py +0 -163
  139. web3/pm.py +0 -602
  140. web3/tools/__init__.py +0 -4
  141. web3/tools/pytest_ethereum/__init__.py +0 -0
  142. web3/tools/pytest_ethereum/_utils.py +0 -145
  143. web3/tools/pytest_ethereum/deployer.py +0 -48
  144. web3/tools/pytest_ethereum/exceptions.py +0 -22
  145. web3/tools/pytest_ethereum/linker.py +0 -128
  146. web3/tools/pytest_ethereum/plugins.py +0 -33
  147. web3-7.0.0b1.dist-info/RECORD +0 -280
  148. web3-7.0.0b1.dist-info/entry_points.txt +0 -2
  149. {web3-7.0.0b1.dist-info → web3-7.0.0b3.dist-info}/LICENSE +0 -0
@@ -1,80 +0,0 @@
1
- import re
2
- from typing import (
3
- Any,
4
- Dict,
5
- )
6
-
7
- from eth_utils import (
8
- is_text,
9
- )
10
-
11
- from ethpm._utils.ipfs import (
12
- is_ipfs_uri,
13
- )
14
- from ethpm.constants import (
15
- PACKAGE_NAME_REGEX,
16
- )
17
- from ethpm.exceptions import (
18
- EthPMValidationError,
19
- InsufficientAssetsError,
20
- )
21
-
22
-
23
- def validate_minimal_contract_factory_data(contract_data: Dict[str, str]) -> None:
24
- """
25
- Validate that contract data in a package contains at least an "abi" and
26
- "deploymentBytecode" necessary to generate a deployable contract factory.
27
- """
28
- if not all(key in contract_data.keys() for key in ("abi", "deploymentBytecode")):
29
- raise InsufficientAssetsError(
30
- "Minimum required contract data to generate a deployable "
31
- "contract factory (abi & deploymentBytecode) not found."
32
- )
33
-
34
-
35
- def validate_package_version(version: Any) -> None:
36
- """
37
- Validates that a package version is of text type.
38
- """
39
- if not is_text(version):
40
- raise EthPMValidationError(
41
- f"Expected a version of text type, instead received {type(version)}."
42
- )
43
-
44
-
45
- def validate_package_name(pkg_name: str) -> None:
46
- """
47
- Raise an exception if the value is not a valid package name
48
- as defined in the EthPM-Spec.
49
- """
50
- if not bool(re.match(PACKAGE_NAME_REGEX, pkg_name)):
51
- raise EthPMValidationError(f"{pkg_name} is not a valid package name.")
52
-
53
-
54
- def validate_manifest_version(version: str) -> None:
55
- """
56
- Raise an exception if the version is not "ethpm/3".
57
- """
58
- if not version == "ethpm/3":
59
- raise EthPMValidationError(
60
- f"Py-EthPM does not support the provided specification version: {version}"
61
- )
62
-
63
-
64
- def validate_build_dependency(key: str, uri: str) -> None:
65
- """
66
- Raise an exception if the key in dependencies is not a valid package name,
67
- or if the value is not a valid IPFS URI.
68
- """
69
- validate_package_name(key)
70
- # validate is supported content-addressed uri
71
- if not is_ipfs_uri(uri):
72
- raise EthPMValidationError(f"URI: {uri} is not a valid IPFS URI.")
73
-
74
-
75
- CONTRACT_NAME_REGEX = re.compile("^[a-zA-Z][-a-zA-Z0-9_]{0,255}$")
76
-
77
-
78
- def validate_contract_name(name: str) -> None:
79
- if not CONTRACT_NAME_REGEX.match(name):
80
- raise EthPMValidationError(f"Contract name: {name} is not valid.")
ethpm/validation/uri.py DELETED
@@ -1,163 +0,0 @@
1
- import hashlib
2
- from typing import (
3
- TYPE_CHECKING,
4
- List,
5
- )
6
- from urllib import (
7
- parse,
8
- )
9
-
10
- from eth_utils import (
11
- is_checksum_address,
12
- to_bytes,
13
- to_int,
14
- to_text,
15
- )
16
-
17
- from ethpm._utils.chains import (
18
- is_supported_chain_id,
19
- )
20
- from ethpm._utils.ipfs import (
21
- is_ipfs_uri,
22
- )
23
- from ethpm._utils.registry import (
24
- is_ens_domain,
25
- )
26
- from ethpm.constants import (
27
- REGISTRY_URI_SCHEMES,
28
- )
29
- from ethpm.exceptions import (
30
- EthPMValidationError,
31
- )
32
- from ethpm.validation.misc import (
33
- validate_escaped_string,
34
- )
35
- from ethpm.validation.package import (
36
- validate_package_name,
37
- )
38
-
39
- if TYPE_CHECKING:
40
- from web3 import Web3 # noqa: F401
41
-
42
-
43
- def validate_ipfs_uri(uri: str) -> None:
44
- """
45
- Raise an exception if the provided URI is not a valid IPFS URI.
46
- """
47
- if not is_ipfs_uri(uri):
48
- raise EthPMValidationError(f"URI: {uri} is not a valid IPFS URI.")
49
-
50
-
51
- def validate_registry_uri(uri: str) -> None:
52
- """
53
- Raise an exception if the URI does not conform to the registry URI scheme.
54
- """
55
- parsed = parse.urlparse(uri)
56
- scheme, authority, pkg_path = (
57
- parsed.scheme,
58
- parsed.netloc,
59
- parsed.path,
60
- )
61
- pkg_id = pkg_path.strip("/")
62
-
63
- if "@" in pkg_id:
64
- if len(pkg_id.split("@")) != 2:
65
- raise EthPMValidationError("Registry URI: {pkg_id} is not properly escaped")
66
- pkg_name, pkg_version = pkg_id.split("@")
67
- else:
68
- pkg_name, pkg_version = (pkg_id, None)
69
-
70
- validate_registry_uri_scheme(scheme)
71
- validate_registry_uri_authority(authority)
72
- if pkg_name:
73
- validate_package_name(pkg_name)
74
- if not pkg_name and pkg_version:
75
- raise EthPMValidationError(
76
- "Registry URIs cannot provide a version without a package name."
77
- )
78
- if pkg_version:
79
- validate_escaped_string(pkg_version)
80
-
81
-
82
- def validate_registry_uri_authority(auth: str) -> None:
83
- """
84
- Raise an exception if the authority is not a valid ENS domain
85
- or a valid checksummed contract address.
86
- """
87
- if ":" in auth:
88
- if len(auth.split(":")) != 2:
89
- raise EthPMValidationError(
90
- f"{auth} is not a valid registry URI authority. "
91
- "Please try again with a valid registry URI."
92
- )
93
- address, chain_id = auth.split(":")
94
- else:
95
- address, chain_id = auth, "1"
96
-
97
- if is_ens_domain(address) is False and not is_checksum_address(address):
98
- raise EthPMValidationError(
99
- f"{address} is not a valid registry address. "
100
- "Please try again with a valid registry URI."
101
- )
102
-
103
- if not is_supported_chain_id(to_int(text=chain_id)):
104
- raise EthPMValidationError(
105
- f"Chain ID: {chain_id} is not supported. Supported chain ids include: "
106
- "1 (mainnet), 5 (goerli), and 11155111 (sepolia)."
107
- "Please try again with a valid registry URI."
108
- )
109
-
110
-
111
- def validate_registry_uri_scheme(scheme: str) -> None:
112
- """
113
- Raise an exception if the scheme is not a valid registry URI scheme:
114
- - 'erc1319'
115
- - 'ethpm'
116
- """
117
- if scheme not in REGISTRY_URI_SCHEMES:
118
- raise EthPMValidationError(
119
- f"{scheme} is not a valid registry URI scheme. "
120
- f"Valid schemes include: {REGISTRY_URI_SCHEMES}"
121
- )
122
-
123
-
124
- def validate_single_matching_uri(all_blockchain_uris: List[str], w3: "Web3") -> str:
125
- """
126
- Return a single block URI after validating that it is the *only* URI in
127
- all_blockchain_uris that matches the w3 instance.
128
- """
129
- from ethpm.uri import (
130
- check_if_chain_matches_chain_uri,
131
- )
132
-
133
- matching_uris = [
134
- uri for uri in all_blockchain_uris if check_if_chain_matches_chain_uri(w3, uri)
135
- ]
136
-
137
- if not matching_uris:
138
- raise EthPMValidationError("Package has no matching URIs on chain.")
139
- elif len(matching_uris) != 1:
140
- raise EthPMValidationError(
141
- f"Package has too many ({len(matching_uris)}) "
142
- "matching URIs: {matching_uris}."
143
- )
144
- return matching_uris[0]
145
-
146
-
147
- def validate_blob_uri_contents(contents: bytes, blob_uri: str) -> None:
148
- """
149
- Raises an exception if the sha1 hash of the contents does not match the
150
- hash found in the blob_uri. Formula for how git calculates the hash
151
- found here: http://alblue.bandlem.com/2011/08/git-tip-of-week-objects.html
152
- """
153
- blob_path = parse.urlparse(blob_uri).path
154
- blob_hash = blob_path.split("/")[-1]
155
- contents_str = to_text(contents)
156
- content_length = len(contents_str)
157
- hashable_contents = "blob " + str(content_length) + "\0" + contents_str
158
- hash_object = hashlib.sha1(to_bytes(text=hashable_contents))
159
- if hash_object.hexdigest() != blob_hash:
160
- raise EthPMValidationError(
161
- f"Hash of contents fetched from {blob_uri} do not "
162
- f"match its hash: {blob_hash}."
163
- )