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.
- ens/__init__.py +13 -2
- ens/_normalization.py +2 -17
- ens/async_ens.py +33 -21
- ens/base_ens.py +3 -1
- ens/ens.py +16 -11
- ens/exceptions.py +16 -29
- ens/specs/nf.json +1 -1
- ens/specs/normalization_spec.json +1 -1
- ens/utils.py +52 -63
- web3/__init__.py +20 -24
- web3/_utils/abi.py +115 -271
- web3/_utils/async_transactions.py +7 -4
- web3/_utils/batching.py +217 -0
- web3/_utils/blocks.py +6 -2
- web3/_utils/caching.py +128 -5
- web3/_utils/compat/__init__.py +2 -3
- web3/_utils/contract_sources/compile_contracts.py +1 -1
- web3/_utils/contract_sources/contract_data/arrays_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/bytes_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/constructor_contracts.py +7 -7
- web3/_utils/contract_sources/contract_data/contract_caller_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/emitter_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/event_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/extended_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/fallback_function_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/math_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_lookup.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/panic_errors_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/payable_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/receive_function_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/reflector_contracts.py +3 -3
- web3/_utils/contract_sources/contract_data/revert_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/simple_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/storage_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/string_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/tuple_contracts.py +5 -5
- web3/_utils/contracts.py +130 -236
- web3/_utils/datatypes.py +5 -1
- web3/_utils/decorators.py +13 -23
- web3/_utils/empty.py +1 -1
- web3/_utils/encoding.py +16 -12
- web3/_utils/ens.py +2 -1
- web3/_utils/error_formatters_utils.py +5 -3
- web3/_utils/events.py +66 -69
- web3/_utils/fee_utils.py +1 -3
- web3/_utils/filters.py +24 -22
- web3/_utils/formatters.py +2 -2
- web3/_utils/http.py +5 -3
- web3/_utils/http_session_manager.py +303 -0
- web3/_utils/math.py +14 -15
- web3/_utils/method_formatters.py +34 -36
- web3/_utils/module.py +2 -1
- web3/_utils/module_testing/__init__.py +0 -3
- web3/_utils/module_testing/eth_module.py +695 -643
- web3/_utils/module_testing/module_testing_utils.py +61 -34
- web3/_utils/module_testing/persistent_connection_provider.py +56 -25
- web3/_utils/module_testing/utils.py +258 -0
- web3/_utils/module_testing/web3_module.py +438 -17
- web3/_utils/normalizers.py +13 -11
- web3/_utils/rpc_abi.py +5 -32
- web3/_utils/threads.py +8 -7
- web3/_utils/transactions.py +14 -12
- web3/_utils/type_conversion.py +5 -1
- web3/_utils/validation.py +17 -17
- web3/auto/gethdev.py +7 -2
- web3/beacon/__init__.py +6 -1
- web3/beacon/async_beacon.py +9 -5
- web3/beacon/{main.py → beacon.py} +7 -5
- web3/contract/__init__.py +7 -0
- web3/contract/async_contract.py +47 -46
- web3/contract/base_contract.py +183 -158
- web3/contract/contract.py +49 -43
- web3/contract/utils.py +203 -59
- web3/datastructures.py +79 -31
- web3/eth/__init__.py +7 -0
- web3/eth/async_eth.py +39 -51
- web3/eth/base_eth.py +17 -10
- web3/eth/eth.py +30 -68
- web3/exceptions.py +108 -82
- web3/gas_strategies/time_based.py +8 -6
- web3/geth.py +1 -254
- web3/main.py +75 -122
- web3/manager.py +316 -146
- web3/method.py +38 -31
- web3/middleware/__init__.py +67 -89
- web3/middleware/attrdict.py +36 -49
- web3/middleware/base.py +174 -0
- web3/middleware/buffered_gas_estimate.py +20 -21
- web3/middleware/filter.py +157 -117
- web3/middleware/formatting.py +124 -108
- web3/middleware/gas_price_strategy.py +20 -32
- web3/middleware/names.py +29 -26
- web3/middleware/proof_of_authority.py +68 -0
- web3/middleware/pythonic.py +2 -2
- web3/middleware/signing.py +74 -89
- web3/middleware/stalecheck.py +52 -79
- web3/middleware/validation.py +5 -13
- web3/module.py +54 -10
- web3/providers/__init__.py +10 -6
- web3/providers/async_base.py +117 -39
- web3/providers/auto.py +3 -3
- web3/providers/base.py +89 -33
- web3/providers/eth_tester/__init__.py +5 -0
- web3/providers/eth_tester/defaults.py +1 -64
- web3/providers/eth_tester/main.py +99 -31
- web3/providers/eth_tester/middleware.py +45 -73
- web3/providers/ipc.py +42 -46
- web3/providers/{websocket/websocket.py → legacy_websocket.py} +32 -7
- web3/providers/persistent/__init__.py +22 -0
- web3/providers/persistent/async_ipc.py +153 -0
- web3/providers/{persistent.py → persistent/persistent.py} +106 -25
- web3/providers/persistent/persistent_connection.py +84 -0
- web3/providers/{websocket → persistent}/request_processor.py +94 -32
- web3/providers/persistent/utils.py +43 -0
- web3/providers/{websocket/websocket_v2.py → persistent/websocket.py} +29 -28
- web3/providers/rpc/__init__.py +11 -0
- web3/providers/rpc/async_rpc.py +171 -0
- web3/providers/rpc/rpc.py +179 -0
- web3/providers/rpc/utils.py +92 -0
- web3/testing.py +4 -4
- web3/tools/benchmark/main.py +22 -22
- web3/tools/benchmark/node.py +2 -8
- web3/tools/benchmark/reporting.py +2 -2
- web3/tools/benchmark/utils.py +1 -1
- web3/tracing.py +9 -5
- web3/types.py +30 -107
- web3/utils/__init__.py +58 -5
- web3/utils/abi.py +575 -10
- web3/utils/async_exception_handling.py +19 -7
- web3/utils/caching.py +32 -13
- web3/utils/exception_handling.py +7 -5
- {web3-6.20.2.dist-info → web3-7.0.0.dist-info}/LICENSE +1 -1
- web3-7.0.0.dist-info/METADATA +112 -0
- web3-7.0.0.dist-info/RECORD +167 -0
- {web3-6.20.2.dist-info → web3-7.0.0.dist-info}/WHEEL +1 -1
- {web3-6.20.2.dist-info → web3-7.0.0.dist-info}/top_level.txt +0 -1
- ethpm/__init__.py +0 -20
- ethpm/_utils/__init__.py +0 -0
- ethpm/_utils/backend.py +0 -93
- ethpm/_utils/cache.py +0 -44
- ethpm/_utils/chains.py +0 -119
- ethpm/_utils/contract.py +0 -35
- ethpm/_utils/deployments.py +0 -145
- ethpm/_utils/ipfs.py +0 -116
- ethpm/_utils/protobuf/__init__.py +0 -0
- ethpm/_utils/protobuf/ipfs_file_pb2.py +0 -33
- ethpm/_utils/registry.py +0 -29
- ethpm/assets/__init__.py +0 -0
- ethpm/assets/ens/v3.json +0 -1
- ethpm/assets/escrow/with_bytecode_v3.json +0 -1
- ethpm/assets/ipfs_file.proto +0 -32
- ethpm/assets/owned/output_v3.json +0 -1
- ethpm/assets/owned/with_contract_type_v3.json +0 -1
- ethpm/assets/registry/contracts/Authority.sol +0 -156
- ethpm/assets/registry/contracts/IndexedOrderedSetLib.sol +0 -106
- ethpm/assets/registry/contracts/PackageDB.sol +0 -225
- ethpm/assets/registry/contracts/PackageRegistry.sol +0 -361
- ethpm/assets/registry/contracts/PackageRegistryInterface.sol +0 -97
- ethpm/assets/registry/contracts/ReleaseDB.sol +0 -309
- ethpm/assets/registry/contracts/ReleaseValidator.sol +0 -152
- ethpm/assets/registry/solc_input.json +0 -1
- ethpm/assets/registry/solc_output.json +0 -1
- ethpm/assets/registry/v3.json +0 -1
- ethpm/assets/safe-math-lib/v3-strict-no-deployments.json +0 -1
- ethpm/assets/simple-registry/contracts/Ownable.sol +0 -63
- ethpm/assets/simple-registry/contracts/PackageRegistry.sol +0 -373
- ethpm/assets/simple-registry/contracts/PackageRegistryInterface.sol +0 -96
- ethpm/assets/simple-registry/solc_input.json +0 -33
- ethpm/assets/simple-registry/solc_output.json +0 -1
- ethpm/assets/simple-registry/v3.json +0 -1
- ethpm/assets/standard-token/output_v3.json +0 -1
- ethpm/assets/standard-token/with_bytecode_v3.json +0 -1
- ethpm/assets/vyper_registry/0.1.0.json +0 -1
- ethpm/assets/vyper_registry/registry.vy +0 -216
- ethpm/assets/vyper_registry/registry_with_delete.vy +0 -244
- ethpm/backends/__init__.py +0 -0
- ethpm/backends/base.py +0 -43
- ethpm/backends/http.py +0 -108
- ethpm/backends/ipfs.py +0 -219
- ethpm/backends/registry.py +0 -154
- ethpm/constants.py +0 -17
- ethpm/contract.py +0 -187
- ethpm/dependencies.py +0 -58
- ethpm/deployments.py +0 -80
- ethpm/ethpm-spec/examples/escrow/1.0.0-pretty.json +0 -146
- ethpm/ethpm-spec/examples/escrow/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/escrow/contracts/Escrow.sol +0 -32
- ethpm/ethpm-spec/examples/escrow/contracts/SafeSendLib.sol +0 -20
- ethpm/ethpm-spec/examples/escrow/v3-pretty.json +0 -171
- ethpm/ethpm-spec/examples/escrow/v3.json +0 -1
- ethpm/ethpm-spec/examples/owned/1.0.0-pretty.json +0 -21
- ethpm/ethpm-spec/examples/owned/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/owned/contracts/Owned.sol +0 -12
- ethpm/ethpm-spec/examples/owned/v3-pretty.json +0 -27
- ethpm/ethpm-spec/examples/owned/v3.json +0 -1
- ethpm/ethpm-spec/examples/piper-coin/1.0.0-pretty.json +0 -31
- ethpm/ethpm-spec/examples/piper-coin/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/piper-coin/v3-pretty.json +0 -21
- ethpm/ethpm-spec/examples/piper-coin/v3.json +0 -1
- ethpm/ethpm-spec/examples/safe-math-lib/1.0.0-pretty.json +0 -85
- ethpm/ethpm-spec/examples/safe-math-lib/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/safe-math-lib/contracts/SafeMathLib.sol +0 -24
- ethpm/ethpm-spec/examples/safe-math-lib/v3-pretty.json +0 -117
- ethpm/ethpm-spec/examples/safe-math-lib/v3.json +0 -1
- ethpm/ethpm-spec/examples/standard-token/1.0.0-pretty.json +0 -55
- ethpm/ethpm-spec/examples/standard-token/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/standard-token/contracts/AbstractToken.sol +0 -20
- ethpm/ethpm-spec/examples/standard-token/contracts/StandardToken.sol +0 -84
- ethpm/ethpm-spec/examples/standard-token/v3-pretty.json +0 -460
- ethpm/ethpm-spec/examples/standard-token/v3.json +0 -1
- ethpm/ethpm-spec/examples/transferable/1.0.0-pretty.json +0 -21
- ethpm/ethpm-spec/examples/transferable/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/transferable/contracts/Transferable.sol +0 -14
- ethpm/ethpm-spec/examples/transferable/v3-pretty.json +0 -27
- ethpm/ethpm-spec/examples/transferable/v3.json +0 -1
- ethpm/ethpm-spec/examples/wallet/1.0.0-pretty.json +0 -120
- ethpm/ethpm-spec/examples/wallet/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/wallet/contracts/Wallet.sol +0 -41
- ethpm/ethpm-spec/examples/wallet/v3-pretty.json +0 -181
- ethpm/ethpm-spec/examples/wallet/v3.json +0 -1
- ethpm/ethpm-spec/examples/wallet-with-send/1.0.0-pretty.json +0 -135
- ethpm/ethpm-spec/examples/wallet-with-send/1.0.0.json +0 -1
- ethpm/ethpm-spec/examples/wallet-with-send/contracts/WalletWithSend.sol +0 -18
- ethpm/ethpm-spec/examples/wallet-with-send/v3-pretty.json +0 -207
- ethpm/ethpm-spec/examples/wallet-with-send/v3.json +0 -1
- ethpm/ethpm-spec/spec/package.spec.json +0 -379
- ethpm/ethpm-spec/spec/v3.spec.json +0 -483
- ethpm/exceptions.py +0 -68
- ethpm/package.py +0 -438
- ethpm/tools/__init__.py +0 -4
- ethpm/tools/builder.py +0 -930
- ethpm/tools/checker.py +0 -312
- ethpm/tools/get_manifest.py +0 -19
- ethpm/uri.py +0 -141
- ethpm/validation/__init__.py +0 -0
- ethpm/validation/manifest.py +0 -146
- ethpm/validation/misc.py +0 -39
- ethpm/validation/package.py +0 -80
- ethpm/validation/uri.py +0 -163
- web3/_utils/contract_sources/contract_data/address_reflector.py +0 -29
- web3/_utils/miner.py +0 -88
- web3/_utils/module_testing/go_ethereum_personal_module.py +0 -323
- web3/_utils/request.py +0 -265
- web3/middleware/abi.py +0 -11
- web3/middleware/async_cache.py +0 -99
- web3/middleware/cache.py +0 -374
- web3/middleware/exception_handling.py +0 -49
- web3/middleware/exception_retry_request.py +0 -188
- web3/middleware/fixture.py +0 -190
- web3/middleware/geth_poa.py +0 -81
- web3/middleware/normalize_request_parameters.py +0 -11
- web3/middleware/simulate_unmined_transaction.py +0 -43
- web3/pm.py +0 -602
- web3/providers/async_rpc.py +0 -99
- web3/providers/rpc.py +0 -98
- web3/providers/websocket/__init__.py +0 -11
- web3/providers/websocket/websocket_connection.py +0 -42
- web3/tools/__init__.py +0 -4
- web3/tools/pytest_ethereum/__init__.py +0 -0
- web3/tools/pytest_ethereum/_utils.py +0 -145
- web3/tools/pytest_ethereum/deployer.py +0 -48
- web3/tools/pytest_ethereum/exceptions.py +0 -22
- web3/tools/pytest_ethereum/linker.py +0 -128
- web3/tools/pytest_ethereum/plugins.py +0 -33
- web3-6.20.2.dist-info/METADATA +0 -103
- web3-6.20.2.dist-info/RECORD +0 -283
- web3-6.20.2.dist-info/entry_points.txt +0 -2
- /web3/_utils/{function_identifiers.py → abi_element_identifiers.py} +0 -0
web3/contract/contract.py
CHANGED
|
@@ -13,10 +13,13 @@ from typing import (
|
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
from eth_typing import (
|
|
16
|
+
ABI,
|
|
16
17
|
ChecksumAddress,
|
|
17
18
|
)
|
|
18
19
|
from eth_utils import (
|
|
19
20
|
combomethod,
|
|
21
|
+
get_abi_input_names,
|
|
22
|
+
get_all_function_abis,
|
|
20
23
|
)
|
|
21
24
|
from eth_utils.toolz import (
|
|
22
25
|
partial,
|
|
@@ -27,9 +30,12 @@ from hexbytes import (
|
|
|
27
30
|
|
|
28
31
|
from web3._utils.abi import (
|
|
29
32
|
fallback_func_abi_exists,
|
|
30
|
-
filter_by_type,
|
|
31
33
|
receive_func_abi_exists,
|
|
32
34
|
)
|
|
35
|
+
from web3._utils.abi_element_identifiers import (
|
|
36
|
+
FallbackFn,
|
|
37
|
+
ReceiveFn,
|
|
38
|
+
)
|
|
33
39
|
from web3._utils.compat import (
|
|
34
40
|
Self,
|
|
35
41
|
)
|
|
@@ -46,10 +52,6 @@ from web3._utils.events import (
|
|
|
46
52
|
from web3._utils.filters import (
|
|
47
53
|
LogFilter,
|
|
48
54
|
)
|
|
49
|
-
from web3._utils.function_identifiers import (
|
|
50
|
-
FallbackFn,
|
|
51
|
-
ReceiveFn,
|
|
52
|
-
)
|
|
53
55
|
from web3._utils.normalizers import (
|
|
54
56
|
normalize_abi,
|
|
55
57
|
normalize_address,
|
|
@@ -81,18 +83,17 @@ from web3.exceptions import (
|
|
|
81
83
|
ABIFunctionNotFound,
|
|
82
84
|
NoABIFound,
|
|
83
85
|
NoABIFunctionsFound,
|
|
86
|
+
Web3AttributeError,
|
|
87
|
+
Web3TypeError,
|
|
84
88
|
Web3ValidationError,
|
|
89
|
+
Web3ValueError,
|
|
85
90
|
)
|
|
86
91
|
from web3.types import (
|
|
87
|
-
ABI,
|
|
88
92
|
BlockIdentifier,
|
|
89
|
-
CallOverride,
|
|
90
93
|
EventData,
|
|
94
|
+
StateOverride,
|
|
91
95
|
TxParams,
|
|
92
96
|
)
|
|
93
|
-
from web3.utils import (
|
|
94
|
-
get_abi_input_names,
|
|
95
|
-
)
|
|
96
97
|
|
|
97
98
|
if TYPE_CHECKING:
|
|
98
99
|
from ens import ENS # noqa: F401
|
|
@@ -107,11 +108,12 @@ class ContractEvent(BaseContractEvent):
|
|
|
107
108
|
def get_logs(
|
|
108
109
|
self,
|
|
109
110
|
argument_filters: Optional[Dict[str, Any]] = None,
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
from_block: Optional[BlockIdentifier] = None,
|
|
112
|
+
to_block: Optional[BlockIdentifier] = None,
|
|
112
113
|
block_hash: Optional[HexBytes] = None,
|
|
113
114
|
) -> Iterable[EventData]:
|
|
114
|
-
"""
|
|
115
|
+
"""
|
|
116
|
+
Get events for this contract instance using eth_getLogs API.
|
|
115
117
|
|
|
116
118
|
This is a stateless method, as opposed to create_filter.
|
|
117
119
|
It can be safely called against nodes which do not provide
|
|
@@ -127,10 +129,10 @@ class ContractEvent(BaseContractEvent):
|
|
|
127
129
|
|
|
128
130
|
.. code-block:: python
|
|
129
131
|
|
|
130
|
-
from = max(
|
|
131
|
-
to =
|
|
132
|
+
from = max(my_contract.web3.eth.block_number - 10, 1)
|
|
133
|
+
to = my_contract.web3.eth.block_number
|
|
132
134
|
|
|
133
|
-
events =
|
|
135
|
+
events = my_contract.events.Transfer.get_logs(from_block=from, to_block=to)
|
|
134
136
|
|
|
135
137
|
for e in events:
|
|
136
138
|
print(e["args"]["from"],
|
|
@@ -156,14 +158,14 @@ class ContractEvent(BaseContractEvent):
|
|
|
156
158
|
...
|
|
157
159
|
)
|
|
158
160
|
|
|
159
|
-
See also: :func:`web3.middleware.filter.
|
|
161
|
+
See also: :func:`web3.middleware.filter.LocalFilterMiddleware`.
|
|
160
162
|
|
|
161
163
|
:param argument_filters: Filter by argument values. Indexed arguments are
|
|
162
164
|
filtered by the node while non-indexed arguments are filtered by the library.
|
|
163
|
-
:param
|
|
164
|
-
:param
|
|
165
|
+
:param from_block: block number or "latest", defaults to "latest"
|
|
166
|
+
:param to_block: block number or "latest". Defaults to "latest"
|
|
165
167
|
:param block_hash: block hash. block_hash cannot be set at the
|
|
166
|
-
same time as
|
|
168
|
+
same time as ``from_block`` or ``to_block``
|
|
167
169
|
:yield: Tuple of :class:`AttributeDict` instances
|
|
168
170
|
"""
|
|
169
171
|
event_abi = self._get_event_abi()
|
|
@@ -178,7 +180,7 @@ class ContractEvent(BaseContractEvent):
|
|
|
178
180
|
)
|
|
179
181
|
|
|
180
182
|
_filter_params = self._get_event_filter_params(
|
|
181
|
-
event_abi, argument_filters,
|
|
183
|
+
event_abi, argument_filters, from_block, to_block, block_hash
|
|
182
184
|
)
|
|
183
185
|
# call JSON-RPC API
|
|
184
186
|
logs = self.w3.eth.get_logs(_filter_params)
|
|
@@ -192,15 +194,17 @@ class ContractEvent(BaseContractEvent):
|
|
|
192
194
|
all_event_logs,
|
|
193
195
|
argument_filters,
|
|
194
196
|
)
|
|
195
|
-
|
|
197
|
+
sorted_logs = sorted(filtered_logs, key=lambda e: e["logIndex"])
|
|
198
|
+
sorted_logs = sorted(sorted_logs, key=lambda e: e["blockNumber"])
|
|
199
|
+
return sorted_logs
|
|
196
200
|
|
|
197
201
|
@combomethod
|
|
198
202
|
def create_filter(
|
|
199
203
|
self,
|
|
200
204
|
*, # PEP 3102
|
|
201
205
|
argument_filters: Optional[Dict[str, Any]] = None,
|
|
202
|
-
|
|
203
|
-
|
|
206
|
+
from_block: Optional[BlockIdentifier] = None,
|
|
207
|
+
to_block: BlockIdentifier = "latest",
|
|
204
208
|
address: Optional[ChecksumAddress] = None,
|
|
205
209
|
topics: Optional[Sequence[Any]] = None,
|
|
206
210
|
) -> LogFilter:
|
|
@@ -210,8 +214,8 @@ class ContractEvent(BaseContractEvent):
|
|
|
210
214
|
filter_builder = EventFilterBuilder(self._get_event_abi(), self.w3.codec)
|
|
211
215
|
self._set_up_filter_builder(
|
|
212
216
|
argument_filters,
|
|
213
|
-
|
|
214
|
-
|
|
217
|
+
from_block,
|
|
218
|
+
to_block,
|
|
215
219
|
address,
|
|
216
220
|
topics,
|
|
217
221
|
filter_builder,
|
|
@@ -268,7 +272,7 @@ class ContractFunction(BaseContractFunction):
|
|
|
268
272
|
self,
|
|
269
273
|
transaction: Optional[TxParams] = None,
|
|
270
274
|
block_identifier: BlockIdentifier = None,
|
|
271
|
-
state_override: Optional[
|
|
275
|
+
state_override: Optional[StateOverride] = None,
|
|
272
276
|
ccip_read_enabled: Optional[bool] = None,
|
|
273
277
|
) -> Any:
|
|
274
278
|
"""
|
|
@@ -306,7 +310,7 @@ class ContractFunction(BaseContractFunction):
|
|
|
306
310
|
self.w3,
|
|
307
311
|
self.address,
|
|
308
312
|
self._return_data_normalizers,
|
|
309
|
-
self.
|
|
313
|
+
self.abi_element_identifier,
|
|
310
314
|
call_transaction,
|
|
311
315
|
block_id,
|
|
312
316
|
self.contract_abi,
|
|
@@ -323,7 +327,7 @@ class ContractFunction(BaseContractFunction):
|
|
|
323
327
|
return transact_with_contract_function(
|
|
324
328
|
self.address,
|
|
325
329
|
self.w3,
|
|
326
|
-
self.
|
|
330
|
+
self.abi_element_identifier,
|
|
327
331
|
setup_transaction,
|
|
328
332
|
self.contract_abi,
|
|
329
333
|
self.abi,
|
|
@@ -335,13 +339,13 @@ class ContractFunction(BaseContractFunction):
|
|
|
335
339
|
self,
|
|
336
340
|
transaction: Optional[TxParams] = None,
|
|
337
341
|
block_identifier: Optional[BlockIdentifier] = None,
|
|
338
|
-
state_override: Optional[
|
|
342
|
+
state_override: Optional[StateOverride] = None,
|
|
339
343
|
) -> int:
|
|
340
344
|
setup_transaction = self._estimate_gas(transaction)
|
|
341
345
|
return estimate_gas_for_function(
|
|
342
346
|
self.address,
|
|
343
347
|
self.w3,
|
|
344
|
-
self.
|
|
348
|
+
self.abi_element_identifier,
|
|
345
349
|
setup_transaction,
|
|
346
350
|
self.contract_abi,
|
|
347
351
|
self.abi,
|
|
@@ -356,7 +360,7 @@ class ContractFunction(BaseContractFunction):
|
|
|
356
360
|
return build_transaction_for_function(
|
|
357
361
|
self.address,
|
|
358
362
|
self.w3,
|
|
359
|
-
self.
|
|
363
|
+
self.abi_element_identifier,
|
|
360
364
|
built_transaction,
|
|
361
365
|
self.contract_abi,
|
|
362
366
|
self.abi,
|
|
@@ -376,7 +380,7 @@ class ContractFunction(BaseContractFunction):
|
|
|
376
380
|
w3=w3,
|
|
377
381
|
contract_abi=abi,
|
|
378
382
|
address=address,
|
|
379
|
-
|
|
383
|
+
abi_element_identifier=FallbackFn,
|
|
380
384
|
)()
|
|
381
385
|
return cast(ContractFunction, NonExistentFallbackFunction())
|
|
382
386
|
|
|
@@ -392,7 +396,7 @@ class ContractFunction(BaseContractFunction):
|
|
|
392
396
|
w3=w3,
|
|
393
397
|
contract_abi=abi,
|
|
394
398
|
address=address,
|
|
395
|
-
|
|
399
|
+
abi_element_identifier=ReceiveFn,
|
|
396
400
|
)()
|
|
397
401
|
return cast(ContractFunction, NonExistentReceiveFunction())
|
|
398
402
|
|
|
@@ -436,11 +440,13 @@ class Contract(BaseContract):
|
|
|
436
440
|
events: ContractEvents = None
|
|
437
441
|
|
|
438
442
|
def __init__(self, address: Optional[ChecksumAddress] = None) -> None:
|
|
439
|
-
"""
|
|
440
|
-
|
|
443
|
+
"""
|
|
444
|
+
Create a new smart contract proxy object.
|
|
445
|
+
:param address: Contract address as 0x hex string
|
|
446
|
+
"""
|
|
441
447
|
_w3 = self.w3
|
|
442
448
|
if _w3 is None:
|
|
443
|
-
raise
|
|
449
|
+
raise Web3AttributeError(
|
|
444
450
|
"The `Contract` class has not been initialized. Please use the "
|
|
445
451
|
"`web3.contract` interface to create your contract class."
|
|
446
452
|
)
|
|
@@ -449,7 +455,7 @@ class Contract(BaseContract):
|
|
|
449
455
|
self.address = normalize_address(cast("ENS", _w3.ens), address)
|
|
450
456
|
|
|
451
457
|
if not self.address:
|
|
452
|
-
raise
|
|
458
|
+
raise Web3TypeError(
|
|
453
459
|
"The address argument is required to instantiate a contract."
|
|
454
460
|
)
|
|
455
461
|
|
|
@@ -526,7 +532,7 @@ class Contract(BaseContract):
|
|
|
526
532
|
:return: a contract constructor object
|
|
527
533
|
"""
|
|
528
534
|
if cls.bytecode is None:
|
|
529
|
-
raise
|
|
535
|
+
raise Web3ValueError(
|
|
530
536
|
"Cannot call constructor on a contract that does not have "
|
|
531
537
|
"'bytecode' associated with it"
|
|
532
538
|
)
|
|
@@ -575,23 +581,23 @@ class ContractCaller(BaseContractCaller):
|
|
|
575
581
|
if transaction is None:
|
|
576
582
|
transaction = {}
|
|
577
583
|
|
|
578
|
-
self._functions =
|
|
584
|
+
self._functions = get_all_function_abis(self.abi)
|
|
585
|
+
|
|
579
586
|
for func in self._functions:
|
|
580
587
|
fn = ContractFunction.factory(
|
|
581
588
|
func["name"],
|
|
582
589
|
w3=w3,
|
|
583
590
|
contract_abi=self.abi,
|
|
584
591
|
address=self.address,
|
|
585
|
-
|
|
592
|
+
abi_element_identifier=func["name"],
|
|
586
593
|
decode_tuples=decode_tuples,
|
|
587
594
|
)
|
|
588
595
|
|
|
589
|
-
block_id = parse_block_identifier(w3, block_identifier)
|
|
590
596
|
caller_method = partial(
|
|
591
597
|
self.call_function,
|
|
592
598
|
fn,
|
|
593
599
|
transaction=transaction,
|
|
594
|
-
block_identifier=
|
|
600
|
+
block_identifier=block_identifier,
|
|
595
601
|
ccip_read_enabled=ccip_read_enabled,
|
|
596
602
|
)
|
|
597
603
|
|