web3 7.14.1__py3-none-any.whl → 8.0.0b1__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/_normalization.py +23 -29
- ens/async_ens.py +30 -24
- ens/base_ens.py +2 -3
- ens/ens.py +18 -20
- ens/utils.py +6 -10
- web3/__init__.py +0 -4
- web3/_utils/abi.py +38 -40
- web3/_utils/async_transactions.py +6 -9
- web3/_utils/batching.py +11 -15
- web3/_utils/blocks.py +1 -2
- web3/_utils/caching/caching_utils.py +12 -17
- web3/_utils/caching/request_caching_validation.py +7 -9
- web3/_utils/compat/__init__.py +2 -2
- web3/_utils/contract_sources/compile_contracts.py +4 -6
- web3/_utils/contracts.py +25 -29
- web3/_utils/datatypes.py +6 -10
- web3/_utils/decorators.py +1 -3
- web3/_utils/encoding.py +10 -14
- web3/_utils/ens.py +4 -5
- web3/_utils/events.py +19 -24
- web3/_utils/filters.py +23 -29
- web3/_utils/formatters.py +8 -13
- web3/_utils/http_session_manager.py +11 -22
- web3/_utils/math.py +1 -2
- web3/_utils/method_formatters.py +41 -43
- web3/_utils/module.py +3 -6
- web3/_utils/module_testing/eth_module.py +7 -9
- web3/_utils/module_testing/go_ethereum_admin_module.py +1 -2
- web3/_utils/module_testing/module_testing_utils.py +9 -5
- web3/_utils/module_testing/persistent_connection_provider.py +3 -7
- web3/_utils/module_testing/utils.py +32 -21
- web3/_utils/normalizers.py +21 -24
- web3/_utils/rpc_abi.py +8 -11
- web3/_utils/threads.py +3 -4
- web3/_utils/transactions.py +3 -6
- web3/_utils/type_conversion.py +2 -6
- web3/_utils/utility_methods.py +5 -7
- web3/_utils/validation.py +6 -8
- web3/_utils/windows.py +1 -4
- web3/beacon/async_beacon.py +50 -54
- web3/beacon/beacon.py +50 -54
- web3/contract/async_contract.py +38 -46
- web3/contract/base_contract.py +70 -75
- web3/contract/contract.py +39 -43
- web3/contract/utils.py +47 -51
- web3/datastructures.py +10 -15
- web3/eth/async_eth.py +64 -70
- web3/eth/base_eth.py +40 -44
- web3/eth/eth.py +50 -66
- web3/exceptions.py +8 -13
- web3/gas_strategies/rpc.py +1 -7
- web3/gas_strategies/time_based.py +2 -3
- web3/geth.py +17 -17
- web3/main.py +43 -52
- web3/manager.py +32 -35
- web3/method.py +22 -29
- web3/middleware/base.py +5 -8
- web3/middleware/filter.py +41 -46
- web3/middleware/formatting.py +5 -6
- web3/middleware/names.py +1 -3
- web3/middleware/signing.py +3 -4
- web3/middleware/stalecheck.py +1 -2
- web3/middleware/validation.py +1 -2
- web3/module.py +11 -14
- web3/providers/__init__.py +0 -4
- web3/providers/async_base.py +21 -27
- web3/providers/auto.py +9 -20
- web3/providers/base.py +12 -17
- web3/providers/eth_tester/defaults.py +4 -8
- web3/providers/eth_tester/main.py +4 -8
- web3/providers/eth_tester/middleware.py +2 -4
- web3/providers/ipc.py +6 -10
- web3/providers/persistent/async_ipc.py +4 -7
- web3/providers/persistent/persistent.py +22 -25
- web3/providers/persistent/persistent_connection.py +2 -4
- web3/providers/persistent/request_processor.py +11 -32
- web3/providers/persistent/subscription_container.py +5 -8
- web3/providers/persistent/subscription_manager.py +13 -19
- web3/providers/persistent/websocket.py +15 -12
- web3/providers/rpc/async_rpc.py +10 -16
- web3/providers/rpc/rpc.py +17 -20
- web3/providers/rpc/utils.py +2 -3
- web3/scripts/release/test_package.py +1 -4
- web3/testing.py +1 -5
- web3/tracing.py +9 -13
- web3/types.py +51 -58
- web3/utils/abi.py +28 -33
- web3/utils/async_exception_handling.py +1 -2
- web3/utils/caching.py +6 -10
- web3/utils/exception_handling.py +1 -2
- web3/utils/subscriptions.py +30 -34
- {web3-7.14.1.dist-info → web3-8.0.0b1.dist-info}/METADATA +10 -9
- web3-8.0.0b1.dist-info/RECORD +170 -0
- {web3-7.14.1.dist-info → web3-8.0.0b1.dist-info}/WHEEL +1 -1
- ens/specs/.DS_Store +0 -0
- web3/providers/legacy_websocket.py +0 -159
- web3-7.14.1.dist-info/RECORD +0 -172
- {web3-7.14.1.dist-info → web3-8.0.0b1.dist-info}/licenses/LICENSE +0 -0
- {web3-7.14.1.dist-info → web3-8.0.0b1.dist-info}/top_level.txt +0 -0
web3/beacon/async_beacon.py
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Any,
|
|
3
|
-
Dict,
|
|
4
|
-
List,
|
|
5
|
-
Optional,
|
|
6
|
-
Union,
|
|
7
3
|
)
|
|
8
4
|
|
|
9
5
|
from aiohttp import (
|
|
@@ -77,16 +73,16 @@ class AsyncBeacon:
|
|
|
77
73
|
self._request_session_manager = HTTPSessionManager()
|
|
78
74
|
|
|
79
75
|
async def _async_make_get_request(
|
|
80
|
-
self, endpoint_uri: str, params:
|
|
81
|
-
) ->
|
|
76
|
+
self, endpoint_uri: str, params: dict[str, str] | None = None
|
|
77
|
+
) -> dict[str, Any]:
|
|
82
78
|
uri = URI(self.base_url + endpoint_uri)
|
|
83
79
|
return await self._request_session_manager.async_json_make_get_request(
|
|
84
80
|
uri, params=params, timeout=ClientTimeout(self.request_timeout)
|
|
85
81
|
)
|
|
86
82
|
|
|
87
83
|
async def _async_make_post_request(
|
|
88
|
-
self, endpoint_uri: str, body:
|
|
89
|
-
) ->
|
|
84
|
+
self, endpoint_uri: str, body: list[str] | dict[str, Any]
|
|
85
|
+
) -> dict[str, Any]:
|
|
90
86
|
uri = URI(self.base_url + endpoint_uri)
|
|
91
87
|
return await self._request_session_manager.async_json_make_post_request(
|
|
92
88
|
uri, json=body, timeout=ClientTimeout(self.request_timeout)
|
|
@@ -96,141 +92,141 @@ class AsyncBeacon:
|
|
|
96
92
|
|
|
97
93
|
# states
|
|
98
94
|
|
|
99
|
-
async def get_genesis(self) ->
|
|
95
|
+
async def get_genesis(self) -> dict[str, Any]:
|
|
100
96
|
return await self._async_make_get_request(GET_GENESIS)
|
|
101
97
|
|
|
102
|
-
async def get_hash_root(self, state_id: str = "head") ->
|
|
98
|
+
async def get_hash_root(self, state_id: str = "head") -> dict[str, Any]:
|
|
103
99
|
return await self._async_make_get_request(GET_HASH_ROOT.format(state_id))
|
|
104
100
|
|
|
105
|
-
async def get_fork_data(self, state_id: str = "head") ->
|
|
101
|
+
async def get_fork_data(self, state_id: str = "head") -> dict[str, Any]:
|
|
106
102
|
return await self._async_make_get_request(GET_FORK_DATA.format(state_id))
|
|
107
103
|
|
|
108
|
-
async def get_finality_checkpoint(self, state_id: str = "head") ->
|
|
104
|
+
async def get_finality_checkpoint(self, state_id: str = "head") -> dict[str, Any]:
|
|
109
105
|
return await self._async_make_get_request(
|
|
110
106
|
GET_FINALITY_CHECKPOINT.format(state_id)
|
|
111
107
|
)
|
|
112
108
|
|
|
113
|
-
async def get_validators(self, state_id: str = "head") ->
|
|
109
|
+
async def get_validators(self, state_id: str = "head") -> dict[str, Any]:
|
|
114
110
|
return await self._async_make_get_request(GET_VALIDATORS.format(state_id))
|
|
115
111
|
|
|
116
112
|
async def get_validator(
|
|
117
113
|
self, validator_id: str, state_id: str = "head"
|
|
118
|
-
) ->
|
|
114
|
+
) -> dict[str, Any]:
|
|
119
115
|
return await self._async_make_get_request(
|
|
120
116
|
GET_VALIDATOR.format(state_id, validator_id)
|
|
121
117
|
)
|
|
122
118
|
|
|
123
|
-
async def get_validator_balances(self, state_id: str = "head") ->
|
|
119
|
+
async def get_validator_balances(self, state_id: str = "head") -> dict[str, Any]:
|
|
124
120
|
return await self._async_make_get_request(
|
|
125
121
|
GET_VALIDATOR_BALANCES.format(state_id)
|
|
126
122
|
)
|
|
127
123
|
|
|
128
|
-
async def get_epoch_committees(self, state_id: str = "head") ->
|
|
124
|
+
async def get_epoch_committees(self, state_id: str = "head") -> dict[str, Any]:
|
|
129
125
|
return await self._async_make_get_request(GET_EPOCH_COMMITTEES.format(state_id))
|
|
130
126
|
|
|
131
|
-
async def get_epoch_sync_committees(self, state_id: str = "head") ->
|
|
127
|
+
async def get_epoch_sync_committees(self, state_id: str = "head") -> dict[str, Any]:
|
|
132
128
|
return await self._async_make_get_request(
|
|
133
129
|
GET_EPOCH_SYNC_COMMITTEES.format(state_id)
|
|
134
130
|
)
|
|
135
131
|
|
|
136
|
-
async def get_epoch_randao(self, state_id: str = "head") ->
|
|
132
|
+
async def get_epoch_randao(self, state_id: str = "head") -> dict[str, Any]:
|
|
137
133
|
return await self._async_make_get_request(GET_EPOCH_RANDAO.format(state_id))
|
|
138
134
|
|
|
139
135
|
# headers
|
|
140
136
|
|
|
141
|
-
async def get_block_headers(self) ->
|
|
137
|
+
async def get_block_headers(self) -> dict[str, Any]:
|
|
142
138
|
return await self._async_make_get_request(GET_BLOCK_HEADERS)
|
|
143
139
|
|
|
144
|
-
async def get_block_header(self, block_id: str) ->
|
|
140
|
+
async def get_block_header(self, block_id: str) -> dict[str, Any]:
|
|
145
141
|
return await self._async_make_get_request(GET_BLOCK_HEADER.format(block_id))
|
|
146
142
|
|
|
147
143
|
# block
|
|
148
144
|
|
|
149
|
-
async def get_block(self, block_id: str) ->
|
|
145
|
+
async def get_block(self, block_id: str) -> dict[str, Any]:
|
|
150
146
|
return await self._async_make_get_request(GET_BLOCK.format(block_id))
|
|
151
147
|
|
|
152
|
-
async def get_block_root(self, block_id: str) ->
|
|
148
|
+
async def get_block_root(self, block_id: str) -> dict[str, Any]:
|
|
153
149
|
return await self._async_make_get_request(GET_BLOCK_ROOT.format(block_id))
|
|
154
150
|
|
|
155
|
-
async def get_block_attestations(self, block_id: str) ->
|
|
151
|
+
async def get_block_attestations(self, block_id: str) -> dict[str, Any]:
|
|
156
152
|
return await self._async_make_get_request(
|
|
157
153
|
GET_BLOCK_ATTESTATIONS.format(block_id)
|
|
158
154
|
)
|
|
159
155
|
|
|
160
|
-
async def get_blinded_blocks(self, block_id: str) ->
|
|
156
|
+
async def get_blinded_blocks(self, block_id: str) -> dict[str, Any]:
|
|
161
157
|
return await self._async_make_get_request(GET_BLINDED_BLOCKS.format(block_id))
|
|
162
158
|
|
|
163
159
|
# rewards
|
|
164
160
|
|
|
165
|
-
async def get_rewards(self, block_id: str) ->
|
|
161
|
+
async def get_rewards(self, block_id: str) -> dict[str, Any]:
|
|
166
162
|
return await self._async_make_get_request(GET_REWARDS.format(block_id))
|
|
167
163
|
|
|
168
164
|
# light client (untested but follows spec)
|
|
169
165
|
|
|
170
166
|
async def get_light_client_bootstrap_structure(
|
|
171
167
|
self, block_root: HexStr
|
|
172
|
-
) ->
|
|
168
|
+
) -> dict[str, Any]:
|
|
173
169
|
return await self._async_make_get_request(
|
|
174
170
|
GET_LIGHT_CLIENT_BOOTSTRAP_STRUCTURE.format(block_root)
|
|
175
171
|
)
|
|
176
172
|
|
|
177
|
-
async def get_light_client_updates(self) ->
|
|
173
|
+
async def get_light_client_updates(self) -> dict[str, Any]:
|
|
178
174
|
return await self._async_make_get_request(GET_LIGHT_CLIENT_UPDATES)
|
|
179
175
|
|
|
180
|
-
async def get_light_client_finality_update(self) ->
|
|
176
|
+
async def get_light_client_finality_update(self) -> dict[str, Any]:
|
|
181
177
|
return await self._async_make_get_request(GET_LIGHT_CLIENT_FINALITY_UPDATE)
|
|
182
178
|
|
|
183
|
-
async def get_light_client_optimistic_update(self) ->
|
|
179
|
+
async def get_light_client_optimistic_update(self) -> dict[str, Any]:
|
|
184
180
|
return await self._async_make_get_request(GET_LIGHT_CLIENT_OPTIMISTIC_UPDATE)
|
|
185
181
|
|
|
186
182
|
# pool
|
|
187
183
|
|
|
188
|
-
async def get_attestations(self) ->
|
|
184
|
+
async def get_attestations(self) -> dict[str, Any]:
|
|
189
185
|
return await self._async_make_get_request(GET_ATTESTATIONS)
|
|
190
186
|
|
|
191
|
-
async def get_attester_slashings(self) ->
|
|
187
|
+
async def get_attester_slashings(self) -> dict[str, Any]:
|
|
192
188
|
return await self._async_make_get_request(GET_ATTESTER_SLASHINGS)
|
|
193
189
|
|
|
194
|
-
async def get_proposer_slashings(self) ->
|
|
190
|
+
async def get_proposer_slashings(self) -> dict[str, Any]:
|
|
195
191
|
return await self._async_make_get_request(GET_PROPOSER_SLASHINGS)
|
|
196
192
|
|
|
197
|
-
async def get_voluntary_exits(self) ->
|
|
193
|
+
async def get_voluntary_exits(self) -> dict[str, Any]:
|
|
198
194
|
return await self._async_make_get_request(GET_VOLUNTARY_EXITS)
|
|
199
195
|
|
|
200
|
-
async def get_bls_to_execution_changes(self) ->
|
|
196
|
+
async def get_bls_to_execution_changes(self) -> dict[str, Any]:
|
|
201
197
|
return await self._async_make_get_request(GET_BLS_TO_EXECUTION_CHANGES)
|
|
202
198
|
|
|
203
199
|
# [ CONFIG endpoints ]
|
|
204
200
|
|
|
205
|
-
async def get_fork_schedule(self) ->
|
|
201
|
+
async def get_fork_schedule(self) -> dict[str, Any]:
|
|
206
202
|
return await self._async_make_get_request(GET_FORK_SCHEDULE)
|
|
207
203
|
|
|
208
|
-
async def get_spec(self) ->
|
|
204
|
+
async def get_spec(self) -> dict[str, Any]:
|
|
209
205
|
return await self._async_make_get_request(GET_SPEC)
|
|
210
206
|
|
|
211
|
-
async def get_deposit_contract(self) ->
|
|
207
|
+
async def get_deposit_contract(self) -> dict[str, Any]:
|
|
212
208
|
return await self._async_make_get_request(GET_DEPOSIT_CONTRACT)
|
|
213
209
|
|
|
214
210
|
# [ DEBUG endpoints ]
|
|
215
211
|
|
|
216
|
-
async def get_beacon_state(self, state_id: str = "head") ->
|
|
212
|
+
async def get_beacon_state(self, state_id: str = "head") -> dict[str, Any]:
|
|
217
213
|
return await self._async_make_get_request(GET_BEACON_STATE.format(state_id))
|
|
218
214
|
|
|
219
|
-
async def get_beacon_heads(self) ->
|
|
215
|
+
async def get_beacon_heads(self) -> dict[str, Any]:
|
|
220
216
|
return await self._async_make_get_request(GET_BEACON_HEADS)
|
|
221
217
|
|
|
222
218
|
# [ NODE endpoints ]
|
|
223
219
|
|
|
224
|
-
async def get_node_identity(self) ->
|
|
220
|
+
async def get_node_identity(self) -> dict[str, Any]:
|
|
225
221
|
return await self._async_make_get_request(GET_NODE_IDENTITY)
|
|
226
222
|
|
|
227
|
-
async def get_peers(self) ->
|
|
223
|
+
async def get_peers(self) -> dict[str, Any]:
|
|
228
224
|
return await self._async_make_get_request(GET_PEERS)
|
|
229
225
|
|
|
230
|
-
async def get_peer(self, peer_id: str) ->
|
|
226
|
+
async def get_peer(self, peer_id: str) -> dict[str, Any]:
|
|
231
227
|
return await self._async_make_get_request(GET_PEER.format(peer_id))
|
|
232
228
|
|
|
233
|
-
async def get_peer_count(self) ->
|
|
229
|
+
async def get_peer_count(self) -> dict[str, Any]:
|
|
234
230
|
return await self._async_make_get_request(GET_PEER_COUNT)
|
|
235
231
|
|
|
236
232
|
async def get_health(self) -> int:
|
|
@@ -240,17 +236,17 @@ class AsyncBeacon:
|
|
|
240
236
|
)
|
|
241
237
|
return response.status
|
|
242
238
|
|
|
243
|
-
async def get_version(self) ->
|
|
239
|
+
async def get_version(self) -> dict[str, Any]:
|
|
244
240
|
return await self._async_make_get_request(GET_VERSION)
|
|
245
241
|
|
|
246
|
-
async def get_syncing(self) ->
|
|
242
|
+
async def get_syncing(self) -> dict[str, Any]:
|
|
247
243
|
return await self._async_make_get_request(GET_SYNCING)
|
|
248
244
|
|
|
249
245
|
# [ BLOB endpoints ]
|
|
250
246
|
|
|
251
247
|
async def get_blob_sidecars(
|
|
252
|
-
self, block_id: str, indices:
|
|
253
|
-
) ->
|
|
248
|
+
self, block_id: str, indices: list[int] | None = None
|
|
249
|
+
) -> dict[str, Any]:
|
|
254
250
|
indices_param = {"indices": ",".join(map(str, indices))} if indices else None
|
|
255
251
|
return await self._async_make_get_request(
|
|
256
252
|
GET_BLOB_SIDECARS.format(block_id),
|
|
@@ -260,20 +256,20 @@ class AsyncBeacon:
|
|
|
260
256
|
# [ VALIDATOR endpoints ]
|
|
261
257
|
|
|
262
258
|
async def get_attester_duties(
|
|
263
|
-
self, epoch: str, validator_indices:
|
|
264
|
-
) ->
|
|
259
|
+
self, epoch: str, validator_indices: list[str]
|
|
260
|
+
) -> dict[str, Any]:
|
|
265
261
|
return await self._async_make_post_request(
|
|
266
262
|
GET_ATTESTER_DUTIES.format(epoch), validator_indices
|
|
267
263
|
)
|
|
268
264
|
|
|
269
|
-
async def get_block_proposer_duties(self, epoch: str) ->
|
|
265
|
+
async def get_block_proposer_duties(self, epoch: str) -> dict[str, Any]:
|
|
270
266
|
return await self._async_make_get_request(
|
|
271
267
|
GET_BLOCK_PROPOSERS_DUTIES.format(epoch)
|
|
272
268
|
)
|
|
273
269
|
|
|
274
270
|
async def get_sync_committee_duties(
|
|
275
|
-
self, epoch: str, validator_indices:
|
|
276
|
-
) ->
|
|
271
|
+
self, epoch: str, validator_indices: list[str]
|
|
272
|
+
) -> dict[str, Any]:
|
|
277
273
|
return await self._async_make_post_request(
|
|
278
274
|
GET_SYNC_COMMITTEE_DUTIES.format(epoch), validator_indices
|
|
279
275
|
)
|
|
@@ -281,8 +277,8 @@ class AsyncBeacon:
|
|
|
281
277
|
# [ REWARDS endpoints ]
|
|
282
278
|
|
|
283
279
|
async def get_attestations_rewards(
|
|
284
|
-
self, epoch: str, validator_indices:
|
|
285
|
-
) ->
|
|
280
|
+
self, epoch: str, validator_indices: list[str]
|
|
281
|
+
) -> dict[str, Any]:
|
|
286
282
|
return await self._async_make_post_request(
|
|
287
283
|
GET_ATTESTATIONS_REWARDS.format(epoch), validator_indices
|
|
288
284
|
)
|
web3/beacon/beacon.py
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Any,
|
|
3
|
-
Dict,
|
|
4
|
-
List,
|
|
5
|
-
Optional,
|
|
6
|
-
Union,
|
|
7
3
|
)
|
|
8
4
|
|
|
9
5
|
from eth_typing import (
|
|
@@ -72,16 +68,16 @@ class Beacon:
|
|
|
72
68
|
self._request_session_manager = HTTPSessionManager()
|
|
73
69
|
|
|
74
70
|
def _make_get_request(
|
|
75
|
-
self, endpoint_url: str, params:
|
|
76
|
-
) ->
|
|
71
|
+
self, endpoint_url: str, params: dict[str, str] | None = None
|
|
72
|
+
) -> dict[str, Any]:
|
|
77
73
|
uri = URI(self.base_url + endpoint_url)
|
|
78
74
|
return self._request_session_manager.json_make_get_request(
|
|
79
75
|
uri, params=params, timeout=self.request_timeout
|
|
80
76
|
)
|
|
81
77
|
|
|
82
78
|
def _make_post_request(
|
|
83
|
-
self, endpoint_url: str, body:
|
|
84
|
-
) ->
|
|
79
|
+
self, endpoint_url: str, body: list[str] | dict[str, Any]
|
|
80
|
+
) -> dict[str, Any]:
|
|
85
81
|
uri = URI(self.base_url + endpoint_url)
|
|
86
82
|
return self._request_session_manager.json_make_post_request(
|
|
87
83
|
uri, json=body, timeout=self.request_timeout
|
|
@@ -91,131 +87,131 @@ class Beacon:
|
|
|
91
87
|
|
|
92
88
|
# states
|
|
93
89
|
|
|
94
|
-
def get_genesis(self) ->
|
|
90
|
+
def get_genesis(self) -> dict[str, Any]:
|
|
95
91
|
return self._make_get_request(GET_GENESIS)
|
|
96
92
|
|
|
97
|
-
def get_hash_root(self, state_id: str = "head") ->
|
|
93
|
+
def get_hash_root(self, state_id: str = "head") -> dict[str, Any]:
|
|
98
94
|
return self._make_get_request(GET_HASH_ROOT.format(state_id))
|
|
99
95
|
|
|
100
|
-
def get_fork_data(self, state_id: str = "head") ->
|
|
96
|
+
def get_fork_data(self, state_id: str = "head") -> dict[str, Any]:
|
|
101
97
|
return self._make_get_request(GET_FORK_DATA.format(state_id))
|
|
102
98
|
|
|
103
|
-
def get_finality_checkpoint(self, state_id: str = "head") ->
|
|
99
|
+
def get_finality_checkpoint(self, state_id: str = "head") -> dict[str, Any]:
|
|
104
100
|
return self._make_get_request(GET_FINALITY_CHECKPOINT.format(state_id))
|
|
105
101
|
|
|
106
|
-
def get_validators(self, state_id: str = "head") ->
|
|
102
|
+
def get_validators(self, state_id: str = "head") -> dict[str, Any]:
|
|
107
103
|
return self._make_get_request(GET_VALIDATORS.format(state_id))
|
|
108
104
|
|
|
109
105
|
def get_validator(
|
|
110
106
|
self, validator_id: str, state_id: str = "head"
|
|
111
|
-
) ->
|
|
107
|
+
) -> dict[str, Any]:
|
|
112
108
|
return self._make_get_request(GET_VALIDATOR.format(state_id, validator_id))
|
|
113
109
|
|
|
114
|
-
def get_validator_balances(self, state_id: str = "head") ->
|
|
110
|
+
def get_validator_balances(self, state_id: str = "head") -> dict[str, Any]:
|
|
115
111
|
return self._make_get_request(GET_VALIDATOR_BALANCES.format(state_id))
|
|
116
112
|
|
|
117
|
-
def get_epoch_committees(self, state_id: str = "head") ->
|
|
113
|
+
def get_epoch_committees(self, state_id: str = "head") -> dict[str, Any]:
|
|
118
114
|
return self._make_get_request(GET_EPOCH_COMMITTEES.format(state_id))
|
|
119
115
|
|
|
120
|
-
def get_epoch_sync_committees(self, state_id: str = "head") ->
|
|
116
|
+
def get_epoch_sync_committees(self, state_id: str = "head") -> dict[str, Any]:
|
|
121
117
|
return self._make_get_request(GET_EPOCH_SYNC_COMMITTEES.format(state_id))
|
|
122
118
|
|
|
123
|
-
def get_epoch_randao(self, state_id: str = "head") ->
|
|
119
|
+
def get_epoch_randao(self, state_id: str = "head") -> dict[str, Any]:
|
|
124
120
|
return self._make_get_request(GET_EPOCH_RANDAO.format(state_id))
|
|
125
121
|
|
|
126
122
|
# headers
|
|
127
123
|
|
|
128
|
-
def get_block_headers(self) ->
|
|
124
|
+
def get_block_headers(self) -> dict[str, Any]:
|
|
129
125
|
return self._make_get_request(GET_BLOCK_HEADERS)
|
|
130
126
|
|
|
131
|
-
def get_block_header(self, block_id: str) ->
|
|
127
|
+
def get_block_header(self, block_id: str) -> dict[str, Any]:
|
|
132
128
|
return self._make_get_request(GET_BLOCK_HEADER.format(block_id))
|
|
133
129
|
|
|
134
130
|
# blocks
|
|
135
131
|
|
|
136
|
-
def get_block(self, block_id: str) ->
|
|
132
|
+
def get_block(self, block_id: str) -> dict[str, Any]:
|
|
137
133
|
return self._make_get_request(GET_BLOCK.format(block_id))
|
|
138
134
|
|
|
139
|
-
def get_block_root(self, block_id: str) ->
|
|
135
|
+
def get_block_root(self, block_id: str) -> dict[str, Any]:
|
|
140
136
|
return self._make_get_request(GET_BLOCK_ROOT.format(block_id))
|
|
141
137
|
|
|
142
|
-
def get_block_attestations(self, block_id: str) ->
|
|
138
|
+
def get_block_attestations(self, block_id: str) -> dict[str, Any]:
|
|
143
139
|
return self._make_get_request(GET_BLOCK_ATTESTATIONS.format(block_id))
|
|
144
140
|
|
|
145
|
-
def get_blinded_blocks(self, block_id: str) ->
|
|
141
|
+
def get_blinded_blocks(self, block_id: str) -> dict[str, Any]:
|
|
146
142
|
return self._make_get_request(GET_BLINDED_BLOCKS.format(block_id))
|
|
147
143
|
|
|
148
144
|
# rewards
|
|
149
145
|
|
|
150
|
-
def get_rewards(self, block_id: str) ->
|
|
146
|
+
def get_rewards(self, block_id: str) -> dict[str, Any]:
|
|
151
147
|
return self._make_get_request(GET_REWARDS.format(block_id))
|
|
152
148
|
|
|
153
149
|
# light client (untested but follows spec)
|
|
154
150
|
|
|
155
151
|
def get_light_client_bootstrap_structure(
|
|
156
152
|
self, block_root: HexStr
|
|
157
|
-
) ->
|
|
153
|
+
) -> dict[str, Any]:
|
|
158
154
|
return self._make_get_request(
|
|
159
155
|
GET_LIGHT_CLIENT_BOOTSTRAP_STRUCTURE.format(block_root)
|
|
160
156
|
)
|
|
161
157
|
|
|
162
|
-
def get_light_client_updates(self) ->
|
|
158
|
+
def get_light_client_updates(self) -> dict[str, Any]:
|
|
163
159
|
return self._make_get_request(GET_LIGHT_CLIENT_UPDATES)
|
|
164
160
|
|
|
165
|
-
def get_light_client_finality_update(self) ->
|
|
161
|
+
def get_light_client_finality_update(self) -> dict[str, Any]:
|
|
166
162
|
return self._make_get_request(GET_LIGHT_CLIENT_FINALITY_UPDATE)
|
|
167
163
|
|
|
168
|
-
def get_light_client_optimistic_update(self) ->
|
|
164
|
+
def get_light_client_optimistic_update(self) -> dict[str, Any]:
|
|
169
165
|
return self._make_get_request(GET_LIGHT_CLIENT_OPTIMISTIC_UPDATE)
|
|
170
166
|
|
|
171
167
|
# pool
|
|
172
168
|
|
|
173
|
-
def get_attestations(self) ->
|
|
169
|
+
def get_attestations(self) -> dict[str, Any]:
|
|
174
170
|
return self._make_get_request(GET_ATTESTATIONS)
|
|
175
171
|
|
|
176
|
-
def get_attester_slashings(self) ->
|
|
172
|
+
def get_attester_slashings(self) -> dict[str, Any]:
|
|
177
173
|
return self._make_get_request(GET_ATTESTER_SLASHINGS)
|
|
178
174
|
|
|
179
|
-
def get_proposer_slashings(self) ->
|
|
175
|
+
def get_proposer_slashings(self) -> dict[str, Any]:
|
|
180
176
|
return self._make_get_request(GET_PROPOSER_SLASHINGS)
|
|
181
177
|
|
|
182
|
-
def get_voluntary_exits(self) ->
|
|
178
|
+
def get_voluntary_exits(self) -> dict[str, Any]:
|
|
183
179
|
return self._make_get_request(GET_VOLUNTARY_EXITS)
|
|
184
180
|
|
|
185
|
-
def get_bls_to_execution_changes(self) ->
|
|
181
|
+
def get_bls_to_execution_changes(self) -> dict[str, Any]:
|
|
186
182
|
return self._make_get_request(GET_BLS_TO_EXECUTION_CHANGES)
|
|
187
183
|
|
|
188
184
|
# [ CONFIG endpoints ]
|
|
189
185
|
|
|
190
|
-
def get_fork_schedule(self) ->
|
|
186
|
+
def get_fork_schedule(self) -> dict[str, Any]:
|
|
191
187
|
return self._make_get_request(GET_FORK_SCHEDULE)
|
|
192
188
|
|
|
193
|
-
def get_spec(self) ->
|
|
189
|
+
def get_spec(self) -> dict[str, Any]:
|
|
194
190
|
return self._make_get_request(GET_SPEC)
|
|
195
191
|
|
|
196
|
-
def get_deposit_contract(self) ->
|
|
192
|
+
def get_deposit_contract(self) -> dict[str, Any]:
|
|
197
193
|
return self._make_get_request(GET_DEPOSIT_CONTRACT)
|
|
198
194
|
|
|
199
195
|
# [ DEBUG endpoints ]
|
|
200
196
|
|
|
201
|
-
def get_beacon_state(self, state_id: str = "head") ->
|
|
197
|
+
def get_beacon_state(self, state_id: str = "head") -> dict[str, Any]:
|
|
202
198
|
return self._make_get_request(GET_BEACON_STATE.format(state_id))
|
|
203
199
|
|
|
204
|
-
def get_beacon_heads(self) ->
|
|
200
|
+
def get_beacon_heads(self) -> dict[str, Any]:
|
|
205
201
|
return self._make_get_request(GET_BEACON_HEADS)
|
|
206
202
|
|
|
207
203
|
# [ NODE endpoints ]
|
|
208
204
|
|
|
209
|
-
def get_node_identity(self) ->
|
|
205
|
+
def get_node_identity(self) -> dict[str, Any]:
|
|
210
206
|
return self._make_get_request(GET_NODE_IDENTITY)
|
|
211
207
|
|
|
212
|
-
def get_peers(self) ->
|
|
208
|
+
def get_peers(self) -> dict[str, Any]:
|
|
213
209
|
return self._make_get_request(GET_PEERS)
|
|
214
210
|
|
|
215
|
-
def get_peer(self, peer_id: str) ->
|
|
211
|
+
def get_peer(self, peer_id: str) -> dict[str, Any]:
|
|
216
212
|
return self._make_get_request(GET_PEER.format(peer_id))
|
|
217
213
|
|
|
218
|
-
def get_peer_count(self) ->
|
|
214
|
+
def get_peer_count(self) -> dict[str, Any]:
|
|
219
215
|
return self._make_get_request(GET_PEER_COUNT)
|
|
220
216
|
|
|
221
217
|
def get_health(self) -> int:
|
|
@@ -223,17 +219,17 @@ class Beacon:
|
|
|
223
219
|
response = self._request_session_manager.get_response_from_get_request(url)
|
|
224
220
|
return response.status_code
|
|
225
221
|
|
|
226
|
-
def get_version(self) ->
|
|
222
|
+
def get_version(self) -> dict[str, Any]:
|
|
227
223
|
return self._make_get_request(GET_VERSION)
|
|
228
224
|
|
|
229
|
-
def get_syncing(self) ->
|
|
225
|
+
def get_syncing(self) -> dict[str, Any]:
|
|
230
226
|
return self._make_get_request(GET_SYNCING)
|
|
231
227
|
|
|
232
228
|
# [ BLOB endpoints ]
|
|
233
229
|
|
|
234
230
|
def get_blob_sidecars(
|
|
235
|
-
self, block_id: str, indices:
|
|
236
|
-
) ->
|
|
231
|
+
self, block_id: str, indices: list[int] | None = None
|
|
232
|
+
) -> dict[str, Any]:
|
|
237
233
|
indices_param = {"indices": ",".join(map(str, indices))} if indices else None
|
|
238
234
|
return self._make_get_request(
|
|
239
235
|
GET_BLOB_SIDECARS.format(block_id),
|
|
@@ -243,18 +239,18 @@ class Beacon:
|
|
|
243
239
|
# [ VALIDATOR endpoints ]
|
|
244
240
|
|
|
245
241
|
def get_attester_duties(
|
|
246
|
-
self, epoch: str, validator_indices:
|
|
247
|
-
) ->
|
|
242
|
+
self, epoch: str, validator_indices: list[str]
|
|
243
|
+
) -> dict[str, Any]:
|
|
248
244
|
return self._make_post_request(
|
|
249
245
|
GET_ATTESTER_DUTIES.format(epoch), validator_indices
|
|
250
246
|
)
|
|
251
247
|
|
|
252
|
-
def get_block_proposer_duties(self, epoch: str) ->
|
|
248
|
+
def get_block_proposer_duties(self, epoch: str) -> dict[str, Any]:
|
|
253
249
|
return self._make_get_request(GET_BLOCK_PROPOSERS_DUTIES.format(epoch))
|
|
254
250
|
|
|
255
251
|
def get_sync_committee_duties(
|
|
256
|
-
self, epoch: str, validator_indices:
|
|
257
|
-
) ->
|
|
252
|
+
self, epoch: str, validator_indices: list[str]
|
|
253
|
+
) -> dict[str, Any]:
|
|
258
254
|
return self._make_post_request(
|
|
259
255
|
GET_SYNC_COMMITTEE_DUTIES.format(epoch), validator_indices
|
|
260
256
|
)
|
|
@@ -262,8 +258,8 @@ class Beacon:
|
|
|
262
258
|
# [ REWARDS endpoints ]
|
|
263
259
|
|
|
264
260
|
def get_attestations_rewards(
|
|
265
|
-
self, epoch: str, validator_indices:
|
|
266
|
-
) ->
|
|
261
|
+
self, epoch: str, validator_indices: list[str]
|
|
262
|
+
) -> dict[str, Any]:
|
|
267
263
|
return self._make_post_request(
|
|
268
264
|
GET_ATTESTATIONS_REWARDS.format(epoch), validator_indices
|
|
269
265
|
)
|