web3 7.5.0__py3-none-any.whl → 7.6.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.
- web3/_utils/abi.py +59 -1
- web3/_utils/contract_sources/contract_data/event_contracts.py +49 -4
- web3/_utils/contracts.py +48 -7
- web3/_utils/method_formatters.py +1 -0
- web3/_utils/module_testing/eth_module.py +11 -0
- web3/_utils/rpc_abi.py +1 -0
- web3/_utils/validation.py +3 -0
- web3/contract/async_contract.py +159 -52
- web3/contract/base_contract.py +138 -102
- web3/contract/contract.py +154 -47
- web3/contract/utils.py +3 -2
- web3/eth/async_eth.py +11 -0
- web3/eth/eth.py +11 -0
- web3/providers/eth_tester/defaults.py +1 -0
- web3/utils/abi.py +308 -76
- {web3-7.5.0.dist-info → web3-7.6.0.dist-info}/METADATA +2 -2
- {web3-7.5.0.dist-info → web3-7.6.0.dist-info}/RECORD +20 -20
- {web3-7.5.0.dist-info → web3-7.6.0.dist-info}/LICENSE +0 -0
- {web3-7.5.0.dist-info → web3-7.6.0.dist-info}/WHEEL +0 -0
- {web3-7.5.0.dist-info → web3-7.6.0.dist-info}/top_level.txt +0 -0
web3/_utils/abi.py
CHANGED
|
@@ -63,6 +63,7 @@ from eth_utils import (
|
|
|
63
63
|
decode_hex,
|
|
64
64
|
filter_abi_by_type,
|
|
65
65
|
get_abi_input_names,
|
|
66
|
+
get_abi_input_types,
|
|
66
67
|
is_bytes,
|
|
67
68
|
is_list_like,
|
|
68
69
|
is_string,
|
|
@@ -76,6 +77,10 @@ from eth_utils.toolz import (
|
|
|
76
77
|
pipe,
|
|
77
78
|
)
|
|
78
79
|
|
|
80
|
+
from web3._utils.abi_element_identifiers import (
|
|
81
|
+
FallbackFn,
|
|
82
|
+
ReceiveFn,
|
|
83
|
+
)
|
|
79
84
|
from web3._utils.decorators import (
|
|
80
85
|
reject_recursive_repeats,
|
|
81
86
|
)
|
|
@@ -92,6 +97,7 @@ from web3.exceptions import (
|
|
|
92
97
|
Web3ValueError,
|
|
93
98
|
)
|
|
94
99
|
from web3.types import (
|
|
100
|
+
ABIElementIdentifier,
|
|
95
101
|
TReturn,
|
|
96
102
|
)
|
|
97
103
|
|
|
@@ -117,9 +123,13 @@ def exclude_indexed_event_inputs(event_abi: ABIEvent) -> Sequence[ABIComponentIn
|
|
|
117
123
|
return [arg for arg in event_abi["inputs"] if arg["indexed"] is False]
|
|
118
124
|
|
|
119
125
|
|
|
126
|
+
def filter_by_types(types: Collection[str], contract_abi: ABI) -> Sequence[ABIElement]:
|
|
127
|
+
return [abi_element for abi_element in contract_abi if abi_element["type"] in types]
|
|
128
|
+
|
|
129
|
+
|
|
120
130
|
def filter_by_argument_name(
|
|
121
131
|
argument_names: Collection[str], contract_abi: ABI
|
|
122
|
-
) ->
|
|
132
|
+
) -> Sequence[ABIElement]:
|
|
123
133
|
"""
|
|
124
134
|
Return a list of each ``ABIElement`` which contain arguments matching provided
|
|
125
135
|
names.
|
|
@@ -139,6 +149,54 @@ def filter_by_argument_name(
|
|
|
139
149
|
return abis_with_matching_args
|
|
140
150
|
|
|
141
151
|
|
|
152
|
+
def filter_by_argument_type(
|
|
153
|
+
argument_types: Collection[str], contract_abi: ABI
|
|
154
|
+
) -> List[ABIElement]:
|
|
155
|
+
"""
|
|
156
|
+
Return a list of each ``ABIElement`` which contain arguments matching provided
|
|
157
|
+
types.
|
|
158
|
+
"""
|
|
159
|
+
abis_with_matching_args = []
|
|
160
|
+
for abi_element in contract_abi:
|
|
161
|
+
try:
|
|
162
|
+
abi_arg_types = get_abi_input_types(abi_element)
|
|
163
|
+
|
|
164
|
+
if set(argument_types).intersection(abi_arg_types) == set(argument_types):
|
|
165
|
+
abis_with_matching_args.append(abi_element)
|
|
166
|
+
except ValueError:
|
|
167
|
+
# fallback or receive functions do not have arguments
|
|
168
|
+
# proceed to next ABIElement
|
|
169
|
+
continue
|
|
170
|
+
|
|
171
|
+
return abis_with_matching_args
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def get_name_from_abi_element_identifier(
|
|
175
|
+
abi_element_identifier: ABIElementIdentifier,
|
|
176
|
+
) -> str:
|
|
177
|
+
if abi_element_identifier in ["fallback", FallbackFn]:
|
|
178
|
+
return "fallback"
|
|
179
|
+
elif abi_element_identifier in ["receive", ReceiveFn]:
|
|
180
|
+
return "receive"
|
|
181
|
+
elif is_text(abi_element_identifier):
|
|
182
|
+
return str(abi_element_identifier).split("(")[0]
|
|
183
|
+
else:
|
|
184
|
+
raise Web3TypeError("Unsupported function identifier")
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def get_abi_element_signature(
|
|
188
|
+
abi_element_identifier: ABIElementIdentifier,
|
|
189
|
+
abi_element_argument_types: Optional[Sequence[str]] = None,
|
|
190
|
+
) -> str:
|
|
191
|
+
element_name = get_name_from_abi_element_identifier(abi_element_identifier)
|
|
192
|
+
argument_types = ",".join(abi_element_argument_types or [])
|
|
193
|
+
|
|
194
|
+
if element_name in ["fallback", "receive"]:
|
|
195
|
+
return element_name
|
|
196
|
+
|
|
197
|
+
return f"{element_name}({argument_types})"
|
|
198
|
+
|
|
199
|
+
|
|
142
200
|
class AddressEncoder(encoding.AddressEncoder):
|
|
143
201
|
@classmethod
|
|
144
202
|
def validate_value(cls, value: Any) -> None:
|
|
@@ -4,8 +4,8 @@ Compiled with Solidity v0.8.28.
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
# source: web3/_utils/contract_sources/EventContracts.sol:EventContract
|
|
7
|
-
EVENT_CONTRACT_BYTECODE = "
|
|
8
|
-
EVENT_CONTRACT_RUNTIME = "
|
|
7
|
+
EVENT_CONTRACT_BYTECODE = "0x6080604052348015600e575f5ffd5b5061017a8061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80635818fad71461002d575b5f5ffd5b610047600480360381019061004291906100f1565b610049565b005b7ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1581604051610078919061012b565b60405180910390a17f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4816040516100af919061012b565b60405180910390a150565b5f5ffd5b5f819050919050565b6100d0816100be565b81146100da575f5ffd5b50565b5f813590506100eb816100c7565b92915050565b5f60208284031215610106576101056100ba565b5b5f610113848285016100dd565b91505092915050565b610125816100be565b82525050565b5f60208201905061013e5f83018461011c565b9291505056fea26469706673582212200e015f231e61081fe45f12e0f685c07278b70c9a1af144d2c6a7a0c7b6e61bab64736f6c634300081c0033" # noqa: E501
|
|
8
|
+
EVENT_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80635818fad71461002d575b5f5ffd5b610047600480360381019061004291906100f1565b610049565b005b7ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1581604051610078919061012b565b60405180910390a17f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4816040516100af919061012b565b60405180910390a150565b5f5ffd5b5f819050919050565b6100d0816100be565b81146100da575f5ffd5b50565b5f813590506100eb816100c7565b92915050565b5f60208284031215610106576101056100ba565b5b5f610113848285016100dd565b91505092915050565b610125816100be565b82525050565b5f60208201905061013e5f83018461011c565b9291505056fea26469706673582212200e015f231e61081fe45f12e0f685c07278b70c9a1af144d2c6a7a0c7b6e61bab64736f6c634300081c0033" # noqa: E501
|
|
9
9
|
EVENT_CONTRACT_ABI = [
|
|
10
10
|
{
|
|
11
11
|
"anonymous": False,
|
|
@@ -49,8 +49,8 @@ EVENT_CONTRACT_DATA = {
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
# source: web3/_utils/contract_sources/EventContracts.sol:IndexedEventContract
|
|
52
|
-
INDEXED_EVENT_CONTRACT_BYTECODE = "
|
|
53
|
-
INDEXED_EVENT_CONTRACT_RUNTIME = "
|
|
52
|
+
INDEXED_EVENT_CONTRACT_BYTECODE = "0x6080604052348015600e575f5ffd5b506101708061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80635818fad71461002d575b5f5ffd5b610047600480360381019061004291906100e7565b610049565b005b807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a27f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4816040516100a59190610121565b60405180910390a150565b5f5ffd5b5f819050919050565b6100c6816100b4565b81146100d0575f5ffd5b50565b5f813590506100e1816100bd565b92915050565b5f602082840312156100fc576100fb6100b0565b5b5f610109848285016100d3565b91505092915050565b61011b816100b4565b82525050565b5f6020820190506101345f830184610112565b9291505056fea264697066735822122038d1b44cbd4d6a31971aab3eaac7933f03b5db859486e34c7a6fd33fb9b2091e64736f6c634300081c0033" # noqa: E501
|
|
53
|
+
INDEXED_EVENT_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80635818fad71461002d575b5f5ffd5b610047600480360381019061004291906100e7565b610049565b005b807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a27f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4816040516100a59190610121565b60405180910390a150565b5f5ffd5b5f819050919050565b6100c6816100b4565b81146100d0575f5ffd5b50565b5f813590506100e1816100bd565b92915050565b5f602082840312156100fc576100fb6100b0565b5b5f610109848285016100d3565b91505092915050565b61011b816100b4565b82525050565b5f6020820190506101345f830184610112565b9291505056fea264697066735822122038d1b44cbd4d6a31971aab3eaac7933f03b5db859486e34c7a6fd33fb9b2091e64736f6c634300081c0033" # noqa: E501
|
|
54
54
|
INDEXED_EVENT_CONTRACT_ABI = [
|
|
55
55
|
{
|
|
56
56
|
"anonymous": False,
|
|
@@ -91,3 +91,48 @@ INDEXED_EVENT_CONTRACT_DATA = {
|
|
|
91
91
|
"bytecode_runtime": INDEXED_EVENT_CONTRACT_RUNTIME,
|
|
92
92
|
"abi": INDEXED_EVENT_CONTRACT_ABI,
|
|
93
93
|
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# source: web3/_utils/contract_sources/EventContracts.sol:AmbiguousEventNameContract
|
|
97
|
+
AMBIGUOUS_EVENT_NAME_CONTRACT_BYTECODE = "0x6080604052348015600e575f5ffd5b506102728061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80635818fad71461002d575b5f5ffd5b61004760048036038101906100429190610119565b610049565b005b7f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4816040516100789190610153565b60405180910390a17fe466ad4edc182e32048f6e723b179ae20d1030f298fcfa1e9ad4a759b5a63112816040516020016100b29190610153565b6040516020818303038152906040526100ca906101ae565b6040516100d79190610223565b60405180910390a150565b5f5ffd5b5f819050919050565b6100f8816100e6565b8114610102575f5ffd5b50565b5f81359050610113816100ef565b92915050565b5f6020828403121561012e5761012d6100e2565b5b5f61013b84828501610105565b91505092915050565b61014d816100e6565b82525050565b5f6020820190506101665f830184610144565b92915050565b5f81519050919050565b5f819050602082019050919050565b5f819050919050565b5f6101998251610185565b80915050919050565b5f82821b905092915050565b5f6101b88261016c565b826101c284610176565b90506101cd8161018e565b9250602082101561020d576102087fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026101a2565b831692505b5050919050565b61021d81610185565b82525050565b5f6020820190506102365f830184610214565b9291505056fea2646970667358221220b00fa945245be24cc68c14582f357e7d83cfa8fcd440eabf93e87592563e3df064736f6c634300081c0033" # noqa: E501
|
|
98
|
+
AMBIGUOUS_EVENT_NAME_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80635818fad71461002d575b5f5ffd5b61004760048036038101906100429190610119565b610049565b005b7f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4816040516100789190610153565b60405180910390a17fe466ad4edc182e32048f6e723b179ae20d1030f298fcfa1e9ad4a759b5a63112816040516020016100b29190610153565b6040516020818303038152906040526100ca906101ae565b6040516100d79190610223565b60405180910390a150565b5f5ffd5b5f819050919050565b6100f8816100e6565b8114610102575f5ffd5b50565b5f81359050610113816100ef565b92915050565b5f6020828403121561012e5761012d6100e2565b5b5f61013b84828501610105565b91505092915050565b61014d816100e6565b82525050565b5f6020820190506101665f830184610144565b92915050565b5f81519050919050565b5f819050602082019050919050565b5f819050919050565b5f6101998251610185565b80915050919050565b5f82821b905092915050565b5f6101b88261016c565b826101c284610176565b90506101cd8161018e565b9250602082101561020d576102087fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026101a2565b831692505b5050919050565b61021d81610185565b82525050565b5f6020820190506102365f830184610214565b9291505056fea2646970667358221220b00fa945245be24cc68c14582f357e7d83cfa8fcd440eabf93e87592563e3df064736f6c634300081c0033" # noqa: E501
|
|
99
|
+
AMBIGUOUS_EVENT_NAME_CONTRACT_ABI = [
|
|
100
|
+
{
|
|
101
|
+
"anonymous": False,
|
|
102
|
+
"inputs": [
|
|
103
|
+
{
|
|
104
|
+
"indexed": False,
|
|
105
|
+
"internalType": "uint256",
|
|
106
|
+
"name": "arg0",
|
|
107
|
+
"type": "uint256",
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"name": "LogSingleArg",
|
|
111
|
+
"type": "event",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"anonymous": False,
|
|
115
|
+
"inputs": [
|
|
116
|
+
{
|
|
117
|
+
"indexed": False,
|
|
118
|
+
"internalType": "bytes32",
|
|
119
|
+
"name": "arg0",
|
|
120
|
+
"type": "bytes32",
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"name": "LogSingleArg",
|
|
124
|
+
"type": "event",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"inputs": [{"internalType": "uint256", "name": "_arg0", "type": "uint256"}],
|
|
128
|
+
"name": "logTwoEvents",
|
|
129
|
+
"outputs": [],
|
|
130
|
+
"stateMutability": "nonpayable",
|
|
131
|
+
"type": "function",
|
|
132
|
+
},
|
|
133
|
+
]
|
|
134
|
+
AMBIGUOUS_EVENT_NAME_CONTRACT_DATA = {
|
|
135
|
+
"bytecode": AMBIGUOUS_EVENT_NAME_CONTRACT_BYTECODE,
|
|
136
|
+
"bytecode_runtime": AMBIGUOUS_EVENT_NAME_CONTRACT_RUNTIME,
|
|
137
|
+
"abi": AMBIGUOUS_EVENT_NAME_CONTRACT_ABI,
|
|
138
|
+
}
|
web3/_utils/contracts.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import copy
|
|
1
2
|
import functools
|
|
2
3
|
from typing import (
|
|
3
4
|
TYPE_CHECKING,
|
|
@@ -47,13 +48,11 @@ from hexbytes import (
|
|
|
47
48
|
|
|
48
49
|
from web3._utils.abi import (
|
|
49
50
|
filter_by_argument_name,
|
|
51
|
+
get_abi_element_signature,
|
|
52
|
+
get_name_from_abi_element_identifier,
|
|
50
53
|
map_abi_data,
|
|
51
54
|
named_tree,
|
|
52
55
|
)
|
|
53
|
-
from web3._utils.abi_element_identifiers import (
|
|
54
|
-
FallbackFn,
|
|
55
|
-
ReceiveFn,
|
|
56
|
-
)
|
|
57
56
|
from web3._utils.blocks import (
|
|
58
57
|
is_hex_encoded_block_hash,
|
|
59
58
|
)
|
|
@@ -79,6 +78,8 @@ from web3.types import (
|
|
|
79
78
|
ABIElementIdentifier,
|
|
80
79
|
BlockIdentifier,
|
|
81
80
|
BlockNumber,
|
|
81
|
+
TContractEvent,
|
|
82
|
+
TContractFn,
|
|
82
83
|
TxParams,
|
|
83
84
|
)
|
|
84
85
|
from web3.utils.abi import (
|
|
@@ -182,6 +183,18 @@ def prepare_transaction(
|
|
|
182
183
|
"""
|
|
183
184
|
fn_args = fn_args or []
|
|
184
185
|
fn_kwargs = fn_kwargs or {}
|
|
186
|
+
|
|
187
|
+
if not fn_args and not fn_kwargs and "(" not in str(abi_element_identifier):
|
|
188
|
+
abi_element_identifier = get_abi_element_signature(abi_element_identifier)
|
|
189
|
+
|
|
190
|
+
if abi_element_identifier in [
|
|
191
|
+
"fallback()",
|
|
192
|
+
"receive()",
|
|
193
|
+
]:
|
|
194
|
+
abi_element_identifier = get_name_from_abi_element_identifier(
|
|
195
|
+
abi_element_identifier
|
|
196
|
+
)
|
|
197
|
+
|
|
185
198
|
if abi_callable is None:
|
|
186
199
|
abi_callable = cast(
|
|
187
200
|
ABICallable,
|
|
@@ -227,11 +240,12 @@ def encode_transaction_data(
|
|
|
227
240
|
kwargs: Optional[Any] = None,
|
|
228
241
|
) -> HexStr:
|
|
229
242
|
info_abi: ABIElement
|
|
230
|
-
|
|
243
|
+
abi_element_name = get_name_from_abi_element_identifier(abi_element_identifier)
|
|
244
|
+
if abi_element_name == "fallback":
|
|
231
245
|
info_abi, info_selector, info_arguments = get_fallback_function_info(
|
|
232
246
|
contract_abi, cast(ABIFallback, abi_callable)
|
|
233
247
|
)
|
|
234
|
-
elif
|
|
248
|
+
elif abi_element_name == "receive":
|
|
235
249
|
info_abi, info_selector, info_arguments = get_receive_function_info(
|
|
236
250
|
contract_abi, cast(ABIReceive, abi_callable)
|
|
237
251
|
)
|
|
@@ -378,4 +392,31 @@ async def async_parse_block_identifier_int(
|
|
|
378
392
|
if block_num < 0:
|
|
379
393
|
raise BlockNumberOutOfRange
|
|
380
394
|
return BlockNumber(block_num)
|
|
381
|
-
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
def copy_contract_function(
|
|
398
|
+
contract_function: TContractFn, *args: Any, **kwargs: Any
|
|
399
|
+
) -> TContractFn:
|
|
400
|
+
"""
|
|
401
|
+
Copy a contract function instance.
|
|
402
|
+
"""
|
|
403
|
+
clone = copy.copy(contract_function)
|
|
404
|
+
clone.args = args or tuple()
|
|
405
|
+
clone.kwargs = kwargs or dict()
|
|
406
|
+
|
|
407
|
+
clone._set_function_info()
|
|
408
|
+
return clone
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def copy_contract_event(
|
|
412
|
+
contract_event: TContractEvent, *args: Any, **kwargs: Any
|
|
413
|
+
) -> TContractEvent:
|
|
414
|
+
"""
|
|
415
|
+
Copy a contract function instance.
|
|
416
|
+
"""
|
|
417
|
+
clone = copy.copy(contract_event)
|
|
418
|
+
clone.args = args or tuple()
|
|
419
|
+
clone.kwargs = kwargs or dict()
|
|
420
|
+
|
|
421
|
+
clone._set_event_info()
|
|
422
|
+
return clone
|
web3/_utils/method_formatters.py
CHANGED
|
@@ -836,6 +836,7 @@ def subscription_formatter(value: Any) -> Union[HexBytes, HexStr, Dict[str, Any]
|
|
|
836
836
|
PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
837
837
|
# Eth
|
|
838
838
|
RPC.eth_accounts: apply_list_to_array_formatter(to_checksum_address),
|
|
839
|
+
RPC.eth_blobBaseFee: to_integer_if_hex,
|
|
839
840
|
RPC.eth_blockNumber: to_integer_if_hex,
|
|
840
841
|
RPC.eth_chainId: to_integer_if_hex,
|
|
841
842
|
RPC.eth_call: HexBytes,
|
|
@@ -1841,6 +1841,12 @@ class AsyncEthModuleTest:
|
|
|
1841
1841
|
assert len(accounts) != 0
|
|
1842
1842
|
assert all(is_checksum_address(account) for account in accounts)
|
|
1843
1843
|
|
|
1844
|
+
@pytest.mark.asyncio
|
|
1845
|
+
async def test_async_eth_blob_base_fee(self, async_w3: "AsyncWeb3") -> None:
|
|
1846
|
+
blob_base_fee = await async_w3.eth.blob_base_fee
|
|
1847
|
+
assert is_integer(blob_base_fee)
|
|
1848
|
+
assert blob_base_fee >= 0
|
|
1849
|
+
|
|
1844
1850
|
@pytest.mark.asyncio
|
|
1845
1851
|
async def test_async_eth_get_logs_without_logs(
|
|
1846
1852
|
self, async_w3: "AsyncWeb3", async_block_with_txn_with_log: BlockData
|
|
@@ -2613,6 +2619,11 @@ class EthModuleTest:
|
|
|
2613
2619
|
assert len(accounts) != 0
|
|
2614
2620
|
assert all(is_checksum_address(account) for account in accounts)
|
|
2615
2621
|
|
|
2622
|
+
def test_eth_blob_base_fee(self, w3: "Web3") -> None:
|
|
2623
|
+
blob_base_fee = w3.eth.blob_base_fee
|
|
2624
|
+
assert is_integer(blob_base_fee)
|
|
2625
|
+
assert blob_base_fee >= 0
|
|
2626
|
+
|
|
2616
2627
|
def test_eth_block_number(self, w3: "Web3") -> None:
|
|
2617
2628
|
block_number = w3.eth.block_number
|
|
2618
2629
|
assert is_integer(block_number)
|
web3/_utils/rpc_abi.py
CHANGED
|
@@ -48,6 +48,7 @@ class RPC:
|
|
|
48
48
|
|
|
49
49
|
# eth
|
|
50
50
|
eth_accounts = RPCEndpoint("eth_accounts")
|
|
51
|
+
eth_blobBaseFee = RPCEndpoint("eth_blobBaseFee")
|
|
51
52
|
eth_blockNumber = RPCEndpoint("eth_blockNumber")
|
|
52
53
|
eth_call = RPCEndpoint("eth_call")
|
|
53
54
|
eth_createAccessList = RPCEndpoint("eth_createAccessList")
|
web3/_utils/validation.py
CHANGED
|
@@ -79,6 +79,9 @@ def validate_abi(abi: ABI) -> None:
|
|
|
79
79
|
if not all(is_dict(e) for e in abi):
|
|
80
80
|
raise Web3ValueError("'abi' is not a list of dictionaries")
|
|
81
81
|
|
|
82
|
+
if not all("type" in e for e in abi):
|
|
83
|
+
raise Web3ValueError("'abi' must contain a list of elements each with a type")
|
|
84
|
+
|
|
82
85
|
functions = filter_abi_by_type("function", abi)
|
|
83
86
|
selectors = groupby(compose(encode_hex, function_abi_to_4byte_selector), functions)
|
|
84
87
|
duplicates = valfilter(lambda funcs: len(funcs) > 1, selectors)
|