aiochainscan 0.2.1__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.
- aiochainscan/__init__.py +2818 -0
- aiochainscan/adapters/__init__.py +6 -0
- aiochainscan/adapters/aiohttp_client.py +70 -0
- aiochainscan/adapters/aiohttp_graphql_client.py +48 -0
- aiochainscan/adapters/blockscout_graphql_builder.py +267 -0
- aiochainscan/adapters/endpoint_builder_urlbuilder.py +51 -0
- aiochainscan/adapters/memory_cache.py +36 -0
- aiochainscan/adapters/noop_telemetry.py +16 -0
- aiochainscan/adapters/retry_exponential.py +31 -0
- aiochainscan/adapters/simple_provider_federator.py +33 -0
- aiochainscan/adapters/simple_rate_limiter.py +55 -0
- aiochainscan/adapters/structlog_telemetry.py +45 -0
- aiochainscan/aiochainscan_fastabi.pyi +14 -0
- aiochainscan/capabilities.py +95 -0
- aiochainscan/cli.py +259 -0
- aiochainscan/client.py +123 -0
- aiochainscan/common.py +209 -0
- aiochainscan/config.py +593 -0
- aiochainscan/core/__init__.py +8 -0
- aiochainscan/core/client.py +264 -0
- aiochainscan/core/endpoint.py +142 -0
- aiochainscan/core/method.py +62 -0
- aiochainscan/decode.py +522 -0
- aiochainscan/domain/__init__.py +12 -0
- aiochainscan/domain/dto.py +164 -0
- aiochainscan/domain/models.py +77 -0
- aiochainscan/exceptions.py +64 -0
- aiochainscan/fastabi/Cargo.lock +4174 -0
- aiochainscan/fastabi/Cargo.toml +31 -0
- aiochainscan/fastabi/src/lib.rs +861 -0
- aiochainscan/modules/account.py +305 -0
- aiochainscan/modules/base.py +136 -0
- aiochainscan/modules/block.py +258 -0
- aiochainscan/modules/contract.py +240 -0
- aiochainscan/modules/extra/links.py +20 -0
- aiochainscan/modules/extra/utils.py +643 -0
- aiochainscan/modules/gas_tracker.py +185 -0
- aiochainscan/modules/logs.py +101 -0
- aiochainscan/modules/proxy.py +343 -0
- aiochainscan/modules/stats.py +422 -0
- aiochainscan/modules/token.py +292 -0
- aiochainscan/modules/transaction.py +95 -0
- aiochainscan/network.py +216 -0
- aiochainscan/ports/__init__.py +5 -0
- aiochainscan/ports/cache.py +19 -0
- aiochainscan/ports/endpoint_builder.py +26 -0
- aiochainscan/ports/graphql_client.py +22 -0
- aiochainscan/ports/graphql_query_builder.py +68 -0
- aiochainscan/ports/http_client.py +27 -0
- aiochainscan/ports/provider_federator.py +23 -0
- aiochainscan/ports/rate_limiter.py +20 -0
- aiochainscan/ports/telemetry.py +16 -0
- aiochainscan/py.typed +0 -0
- aiochainscan/scanners/__init__.py +90 -0
- aiochainscan/scanners/_etherscan_like.py +163 -0
- aiochainscan/scanners/base.py +172 -0
- aiochainscan/scanners/basescan_v1.py +40 -0
- aiochainscan/scanners/blockscout_v1.py +177 -0
- aiochainscan/scanners/etherscan_v2.py +99 -0
- aiochainscan/scanners/moralis_v1.py +188 -0
- aiochainscan/scanners/routscan_v1.py +202 -0
- aiochainscan/services/__init__.py +53 -0
- aiochainscan/services/_executor.py +65 -0
- aiochainscan/services/account.py +1350 -0
- aiochainscan/services/block.py +286 -0
- aiochainscan/services/constants.py +21 -0
- aiochainscan/services/contract.py +397 -0
- aiochainscan/services/fetch_all.py +873 -0
- aiochainscan/services/gas.py +166 -0
- aiochainscan/services/logs.py +469 -0
- aiochainscan/services/pagination.py +30 -0
- aiochainscan/services/paging_engine.py +496 -0
- aiochainscan/services/proxy.py +707 -0
- aiochainscan/services/stats.py +965 -0
- aiochainscan/services/token.py +397 -0
- aiochainscan/services/transaction.py +269 -0
- aiochainscan/services/unified_fetch.py +377 -0
- aiochainscan/url_builder.py +198 -0
- aiochainscan/utils/__init__.py +7 -0
- aiochainscan/utils/date.py +33 -0
- aiochainscan-0.2.1.dist-info/METADATA +738 -0
- aiochainscan-0.2.1.dist-info/RECORD +85 -0
- aiochainscan-0.2.1.dist-info/WHEEL +5 -0
- aiochainscan-0.2.1.dist-info/entry_points.txt +2 -0
- aiochainscan-0.2.1.dist-info/top_level.txt +1 -0
aiochainscan/__init__.py
ADDED
|
@@ -0,0 +1,2818 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from datetime import date
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
__version__ = '0.2.1'
|
|
6
|
+
|
|
7
|
+
from aiochainscan.adapters.aiohttp_client import AiohttpClient
|
|
8
|
+
from aiochainscan.adapters.endpoint_builder_urlbuilder import UrlBuilderEndpoint
|
|
9
|
+
from aiochainscan.adapters.retry_exponential import ExponentialBackoffRetry
|
|
10
|
+
from aiochainscan.adapters.simple_rate_limiter import SimpleRateLimiter
|
|
11
|
+
from aiochainscan.adapters.structlog_telemetry import StructlogTelemetry
|
|
12
|
+
from aiochainscan.capabilities import FEATURE_SUPPORT as _FEATURE_SUPPORT_SRC
|
|
13
|
+
from aiochainscan.capabilities import (
|
|
14
|
+
get_supported_features as _caps_get_supported_features,
|
|
15
|
+
)
|
|
16
|
+
from aiochainscan.capabilities import (
|
|
17
|
+
get_supported_scanners as _caps_get_supported_scanners,
|
|
18
|
+
)
|
|
19
|
+
from aiochainscan.capabilities import (
|
|
20
|
+
is_feature_supported as _caps_is_feature_supported,
|
|
21
|
+
)
|
|
22
|
+
from aiochainscan.client import Client # noqa: F401
|
|
23
|
+
from aiochainscan.config import ChainScanConfig, ScannerConfig, config # noqa: F401
|
|
24
|
+
from aiochainscan.config import config_manager as _config_manager
|
|
25
|
+
from aiochainscan.core.client import ChainscanClient # unified client export
|
|
26
|
+
from aiochainscan.domain.dto import (
|
|
27
|
+
AddressBalanceDTO,
|
|
28
|
+
BeaconWithdrawalDTO,
|
|
29
|
+
BlockDTO,
|
|
30
|
+
DailySeriesDTO,
|
|
31
|
+
EthPriceDTO,
|
|
32
|
+
GasOracleDTO,
|
|
33
|
+
InternalTxDTO,
|
|
34
|
+
LogEntryDTO,
|
|
35
|
+
MinedBlockDTO,
|
|
36
|
+
NormalTxDTO,
|
|
37
|
+
ProxyTxDTO,
|
|
38
|
+
TokenTransferDTO,
|
|
39
|
+
TransactionDTO,
|
|
40
|
+
)
|
|
41
|
+
from aiochainscan.domain.models import Address, BlockNumber, Page, TxHash # re-export domain VOs
|
|
42
|
+
from aiochainscan.ports.cache import Cache
|
|
43
|
+
from aiochainscan.ports.endpoint_builder import EndpointBuilder
|
|
44
|
+
from aiochainscan.ports.http_client import HttpClient
|
|
45
|
+
from aiochainscan.ports.rate_limiter import RateLimiter, RetryPolicy
|
|
46
|
+
from aiochainscan.ports.telemetry import Telemetry
|
|
47
|
+
from aiochainscan.services.account import (
|
|
48
|
+
get_account_balance_by_blockno as get_account_balance_by_blockno_service,
|
|
49
|
+
)
|
|
50
|
+
from aiochainscan.services.account import (
|
|
51
|
+
get_address_balance, # facade use-case
|
|
52
|
+
normalize_address_balances,
|
|
53
|
+
normalize_beacon_withdrawals,
|
|
54
|
+
normalize_internal_txs,
|
|
55
|
+
normalize_mined_blocks,
|
|
56
|
+
normalize_normal_txs,
|
|
57
|
+
normalize_token_transfers,
|
|
58
|
+
)
|
|
59
|
+
from aiochainscan.services.account import (
|
|
60
|
+
get_address_balances as get_address_balances_service,
|
|
61
|
+
)
|
|
62
|
+
from aiochainscan.services.account import (
|
|
63
|
+
get_all_internal_transactions_optimized as get_all_internal_transactions_optimized_service,
|
|
64
|
+
)
|
|
65
|
+
from aiochainscan.services.account import (
|
|
66
|
+
get_all_transactions_optimized as get_all_transactions_optimized_service,
|
|
67
|
+
)
|
|
68
|
+
from aiochainscan.services.account import (
|
|
69
|
+
get_beacon_chain_withdrawals as get_beacon_chain_withdrawals_service,
|
|
70
|
+
)
|
|
71
|
+
from aiochainscan.services.account import (
|
|
72
|
+
get_internal_transactions as get_internal_transactions_service,
|
|
73
|
+
)
|
|
74
|
+
from aiochainscan.services.account import (
|
|
75
|
+
get_mined_blocks as get_mined_blocks_service,
|
|
76
|
+
)
|
|
77
|
+
from aiochainscan.services.account import (
|
|
78
|
+
get_normal_transactions as get_normal_transactions_service,
|
|
79
|
+
)
|
|
80
|
+
from aiochainscan.services.account import (
|
|
81
|
+
get_token_transfers as get_token_transfers_service,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
# service function + normalization
|
|
85
|
+
from aiochainscan.services.block import (
|
|
86
|
+
get_block_by_number, # facade use-case
|
|
87
|
+
normalize_block,
|
|
88
|
+
)
|
|
89
|
+
from aiochainscan.services.contract import (
|
|
90
|
+
check_proxy_contract_verification as check_proxy_contract_verification_service,
|
|
91
|
+
)
|
|
92
|
+
from aiochainscan.services.contract import (
|
|
93
|
+
check_verification_status as check_verification_status_service,
|
|
94
|
+
)
|
|
95
|
+
from aiochainscan.services.contract import get_contract_abi as get_contract_abi_service
|
|
96
|
+
from aiochainscan.services.contract import get_contract_creation as get_contract_creation_service
|
|
97
|
+
from aiochainscan.services.contract import (
|
|
98
|
+
get_contract_source_code as get_contract_source_code_service,
|
|
99
|
+
)
|
|
100
|
+
from aiochainscan.services.contract import (
|
|
101
|
+
verify_contract_source_code as verify_contract_source_code_service,
|
|
102
|
+
)
|
|
103
|
+
from aiochainscan.services.contract import (
|
|
104
|
+
verify_proxy_contract as verify_proxy_contract_service,
|
|
105
|
+
)
|
|
106
|
+
from aiochainscan.services.gas import get_gas_oracle as get_gas_oracle_service
|
|
107
|
+
from aiochainscan.services.gas import normalize_gas_oracle
|
|
108
|
+
from aiochainscan.services.logs import get_logs_page as get_logs_page_service
|
|
109
|
+
from aiochainscan.services.logs import normalize_log_entry, normalize_logs
|
|
110
|
+
from aiochainscan.services.proxy import estimate_gas as estimate_gas_service
|
|
111
|
+
from aiochainscan.services.proxy import eth_call as eth_call_service
|
|
112
|
+
from aiochainscan.services.proxy import get_block_number as get_block_number_service
|
|
113
|
+
from aiochainscan.services.proxy import (
|
|
114
|
+
get_block_tx_count_by_number as get_block_tx_count_by_number_service,
|
|
115
|
+
)
|
|
116
|
+
from aiochainscan.services.proxy import get_code as get_code_service
|
|
117
|
+
from aiochainscan.services.proxy import get_gas_price as get_gas_price_service
|
|
118
|
+
from aiochainscan.services.proxy import get_storage_at as get_storage_at_service
|
|
119
|
+
from aiochainscan.services.proxy import (
|
|
120
|
+
get_tx_by_block_number_and_index as get_tx_by_block_number_and_index_service,
|
|
121
|
+
)
|
|
122
|
+
from aiochainscan.services.proxy import get_tx_count as get_tx_count_service
|
|
123
|
+
from aiochainscan.services.proxy import get_tx_receipt as get_tx_receipt_service
|
|
124
|
+
from aiochainscan.services.proxy import (
|
|
125
|
+
get_uncle_by_block_number_and_index as get_uncle_by_block_number_and_index_service,
|
|
126
|
+
)
|
|
127
|
+
from aiochainscan.services.proxy import normalize_proxy_tx
|
|
128
|
+
from aiochainscan.services.proxy import send_raw_tx as send_raw_tx_service
|
|
129
|
+
from aiochainscan.services.stats import (
|
|
130
|
+
normalize_daily_average_block_size,
|
|
131
|
+
normalize_daily_average_block_time,
|
|
132
|
+
normalize_daily_average_gas_limit,
|
|
133
|
+
normalize_daily_average_gas_price,
|
|
134
|
+
normalize_daily_average_network_difficulty,
|
|
135
|
+
normalize_daily_average_network_hash_rate,
|
|
136
|
+
normalize_daily_block_count,
|
|
137
|
+
normalize_daily_block_rewards,
|
|
138
|
+
normalize_daily_network_tx_fee,
|
|
139
|
+
normalize_daily_network_utilization,
|
|
140
|
+
normalize_daily_new_address_count,
|
|
141
|
+
normalize_daily_total_gas_used,
|
|
142
|
+
normalize_daily_transaction_count,
|
|
143
|
+
normalize_daily_uncle_block_count,
|
|
144
|
+
normalize_eth_price,
|
|
145
|
+
normalize_ether_historical_daily_market_cap,
|
|
146
|
+
normalize_ether_historical_price,
|
|
147
|
+
)
|
|
148
|
+
from aiochainscan.services.token import TokenBalanceDTO, normalize_token_balance
|
|
149
|
+
|
|
150
|
+
# service functions
|
|
151
|
+
from aiochainscan.services.token import get_token_balance as get_token_balance_service
|
|
152
|
+
from aiochainscan.services.transaction import (
|
|
153
|
+
get_transaction_by_hash, # facade use-case
|
|
154
|
+
normalize_transaction,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
__all__ = [
|
|
158
|
+
'Client',
|
|
159
|
+
'ChainscanClient',
|
|
160
|
+
'ChainScanConfig',
|
|
161
|
+
'ScannerConfig',
|
|
162
|
+
'config',
|
|
163
|
+
# Domain VOs
|
|
164
|
+
'Address',
|
|
165
|
+
'BlockNumber',
|
|
166
|
+
'TxHash',
|
|
167
|
+
'Page',
|
|
168
|
+
# Services (facade)
|
|
169
|
+
'get_address_balance',
|
|
170
|
+
'get_address_balances',
|
|
171
|
+
'get_normal_transactions',
|
|
172
|
+
'get_all_transactions_optimized',
|
|
173
|
+
'get_all_transactions_optimized_typed',
|
|
174
|
+
'get_all_internal_transactions_optimized',
|
|
175
|
+
'get_all_logs_optimized',
|
|
176
|
+
'get_internal_transactions',
|
|
177
|
+
'get_token_transfers',
|
|
178
|
+
'get_mined_blocks',
|
|
179
|
+
'get_beacon_chain_withdrawals',
|
|
180
|
+
'get_account_balance_by_blockno',
|
|
181
|
+
'get_block_by_number',
|
|
182
|
+
'get_transaction_by_hash',
|
|
183
|
+
'get_token_balance',
|
|
184
|
+
'get_gas_oracle',
|
|
185
|
+
'normalize_gas_oracle',
|
|
186
|
+
'normalize_token_balance',
|
|
187
|
+
'TokenBalanceDTO',
|
|
188
|
+
'normalize_block',
|
|
189
|
+
'normalize_transaction',
|
|
190
|
+
'normalize_log_entry',
|
|
191
|
+
'normalize_logs',
|
|
192
|
+
'normalize_eth_price',
|
|
193
|
+
'normalize_daily_transaction_count',
|
|
194
|
+
'normalize_daily_new_address_count',
|
|
195
|
+
'normalize_daily_network_tx_fee',
|
|
196
|
+
'normalize_daily_network_utilization',
|
|
197
|
+
'normalize_daily_average_block_size',
|
|
198
|
+
'normalize_daily_block_rewards',
|
|
199
|
+
'normalize_daily_average_block_time',
|
|
200
|
+
'normalize_daily_uncle_block_count',
|
|
201
|
+
'normalize_daily_average_gas_limit',
|
|
202
|
+
'normalize_daily_total_gas_used',
|
|
203
|
+
'normalize_daily_average_gas_price',
|
|
204
|
+
'normalize_daily_block_count',
|
|
205
|
+
'normalize_daily_average_network_hash_rate',
|
|
206
|
+
'normalize_daily_average_network_difficulty',
|
|
207
|
+
'normalize_ether_historical_daily_market_cap',
|
|
208
|
+
'normalize_ether_historical_price',
|
|
209
|
+
'DailySeriesDTO',
|
|
210
|
+
'ProxyTxDTO',
|
|
211
|
+
'LogEntryDTO',
|
|
212
|
+
'BlockDTO',
|
|
213
|
+
'TransactionDTO',
|
|
214
|
+
'GasOracleDTO',
|
|
215
|
+
# Adapters (public DI helpers)
|
|
216
|
+
'AiohttpClient',
|
|
217
|
+
'UrlBuilderEndpoint',
|
|
218
|
+
'StructlogTelemetry',
|
|
219
|
+
'SimpleRateLimiter',
|
|
220
|
+
'ExponentialBackoffRetry',
|
|
221
|
+
# New facade helpers
|
|
222
|
+
'get_daily_average_block_size',
|
|
223
|
+
'get_daily_block_rewards',
|
|
224
|
+
'get_daily_average_block_time',
|
|
225
|
+
'get_daily_uncle_block_count',
|
|
226
|
+
'get_daily_average_gas_limit',
|
|
227
|
+
'get_daily_total_gas_used',
|
|
228
|
+
'get_daily_average_gas_price',
|
|
229
|
+
'get_daily_block_count',
|
|
230
|
+
'get_daily_average_network_hash_rate',
|
|
231
|
+
'get_daily_average_network_difficulty',
|
|
232
|
+
'get_ether_historical_daily_market_cap',
|
|
233
|
+
'get_ether_historical_price',
|
|
234
|
+
'get_block_number',
|
|
235
|
+
'get_gas_price',
|
|
236
|
+
'get_tx_count',
|
|
237
|
+
'get_code',
|
|
238
|
+
'eth_call',
|
|
239
|
+
'get_storage_at',
|
|
240
|
+
'get_block_tx_count_by_number',
|
|
241
|
+
'get_tx_by_block_number_and_index',
|
|
242
|
+
'get_uncle_by_block_number_and_index',
|
|
243
|
+
'estimate_gas',
|
|
244
|
+
'send_raw_tx',
|
|
245
|
+
'get_tx_receipt',
|
|
246
|
+
'normalize_proxy_tx',
|
|
247
|
+
# Account DTOs/normalizers
|
|
248
|
+
'NormalTxDTO',
|
|
249
|
+
'InternalTxDTO',
|
|
250
|
+
'TokenTransferDTO',
|
|
251
|
+
'MinedBlockDTO',
|
|
252
|
+
'BeaconWithdrawalDTO',
|
|
253
|
+
'AddressBalanceDTO',
|
|
254
|
+
'normalize_normal_txs',
|
|
255
|
+
'normalize_internal_txs',
|
|
256
|
+
'normalize_token_transfers',
|
|
257
|
+
'normalize_mined_blocks',
|
|
258
|
+
'normalize_beacon_withdrawals',
|
|
259
|
+
'normalize_address_balances',
|
|
260
|
+
# Contract facade
|
|
261
|
+
'get_contract_abi',
|
|
262
|
+
'get_contract_source_code',
|
|
263
|
+
'verify_contract_source_code',
|
|
264
|
+
'check_verification_status',
|
|
265
|
+
'verify_proxy_contract',
|
|
266
|
+
'check_proxy_contract_verification',
|
|
267
|
+
'get_contract_creation',
|
|
268
|
+
# Context helper
|
|
269
|
+
'open_default_session',
|
|
270
|
+
# Typed facade helpers (experimental, non-breaking)
|
|
271
|
+
'get_block_typed',
|
|
272
|
+
'get_transaction_typed',
|
|
273
|
+
'get_logs_typed',
|
|
274
|
+
'get_token_transfers_page_typed',
|
|
275
|
+
'get_address_transactions_page_typed',
|
|
276
|
+
'get_token_balance_typed',
|
|
277
|
+
'get_gas_oracle_typed',
|
|
278
|
+
'get_daily_transaction_count_typed',
|
|
279
|
+
'get_daily_new_address_count_typed',
|
|
280
|
+
'get_daily_network_tx_fee_typed',
|
|
281
|
+
'get_daily_network_utilization_typed',
|
|
282
|
+
'get_daily_average_block_size_typed',
|
|
283
|
+
'get_daily_block_rewards_typed',
|
|
284
|
+
'get_daily_average_block_time_typed',
|
|
285
|
+
'get_daily_uncle_block_count_typed',
|
|
286
|
+
'get_daily_average_gas_limit_typed',
|
|
287
|
+
'get_daily_total_gas_used_typed',
|
|
288
|
+
'get_daily_average_gas_price_typed',
|
|
289
|
+
'get_eth_price_typed',
|
|
290
|
+
'get_daily_block_count_typed',
|
|
291
|
+
'get_daily_average_network_hash_rate_typed',
|
|
292
|
+
'get_daily_average_network_difficulty_typed',
|
|
293
|
+
'get_ether_historical_daily_market_cap_typed',
|
|
294
|
+
'get_ether_historical_price_typed',
|
|
295
|
+
# Capabilities facade (read-only)
|
|
296
|
+
'list_feature_matrix',
|
|
297
|
+
'is_feature_supported',
|
|
298
|
+
'get_supported_scanners_for_feature',
|
|
299
|
+
'get_supported_features_for',
|
|
300
|
+
'get_logs_page_typed',
|
|
301
|
+
'get_capabilities_overview',
|
|
302
|
+
]
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
async def get_balance(
|
|
306
|
+
*,
|
|
307
|
+
address: str,
|
|
308
|
+
api_kind: str,
|
|
309
|
+
network: str,
|
|
310
|
+
api_key: str,
|
|
311
|
+
http: HttpClient | None = None,
|
|
312
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
313
|
+
rate_limiter: RateLimiter | None = None,
|
|
314
|
+
retry: RetryPolicy | None = None,
|
|
315
|
+
cache: Cache | None = None,
|
|
316
|
+
telemetry: Telemetry | None = None,
|
|
317
|
+
) -> int:
|
|
318
|
+
"""Fetch address balance using the default aiohttp adapter.
|
|
319
|
+
|
|
320
|
+
Convenience facade for simple use without manual client wiring.
|
|
321
|
+
"""
|
|
322
|
+
|
|
323
|
+
http = http or AiohttpClient()
|
|
324
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
325
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
326
|
+
try:
|
|
327
|
+
return await get_address_balance(
|
|
328
|
+
address=Address(address),
|
|
329
|
+
api_kind=api_kind,
|
|
330
|
+
network=network,
|
|
331
|
+
api_key=api_key,
|
|
332
|
+
http=http,
|
|
333
|
+
_endpoint_builder=endpoint,
|
|
334
|
+
_cache=cache,
|
|
335
|
+
_rate_limiter=rate_limiter,
|
|
336
|
+
_retry=retry,
|
|
337
|
+
_telemetry=telemetry,
|
|
338
|
+
)
|
|
339
|
+
finally:
|
|
340
|
+
await http.aclose()
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
# --- Capabilities read-only facade ---
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
def list_feature_matrix() -> dict[str, set[tuple[str, str]]]:
|
|
347
|
+
"""Return a read-only snapshot of feature→(scanner, network) matrix.
|
|
348
|
+
|
|
349
|
+
Source-of-truth: `aiochainscan.capabilities.FEATURE_SUPPORT`.
|
|
350
|
+
"""
|
|
351
|
+
|
|
352
|
+
return {feature: set(pairs) for feature, pairs in _FEATURE_SUPPORT_SRC.items()}
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def is_feature_supported(feature: str, scanner_id: str, network: str) -> bool:
|
|
356
|
+
"""Check if a feature is supported by (scanner_id, network)."""
|
|
357
|
+
|
|
358
|
+
return _caps_is_feature_supported(feature, scanner_id, network)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
def get_supported_scanners_for_feature(feature: str) -> set[tuple[str, str]]:
|
|
362
|
+
"""Get all (scanner_id, network) pairs supporting a feature."""
|
|
363
|
+
|
|
364
|
+
return _caps_get_supported_scanners(feature)
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
def get_supported_features_for(scanner_id: str, network: str) -> set[str]:
|
|
368
|
+
"""Get all features supported by (scanner_id, network)."""
|
|
369
|
+
|
|
370
|
+
return _caps_get_supported_features(scanner_id, network)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
def get_capabilities_overview() -> dict[str, Any]:
|
|
374
|
+
"""Return merged read-only overview of capabilities and scanner configs.
|
|
375
|
+
|
|
376
|
+
- features: a copy of feature->(scanner, network) pairs
|
|
377
|
+
- scanners: metadata from configuration manager (name, domain, networks, etc.)
|
|
378
|
+
"""
|
|
379
|
+
|
|
380
|
+
return {
|
|
381
|
+
'features': {feature: set(pairs) for feature, pairs in _FEATURE_SUPPORT_SRC.items()},
|
|
382
|
+
'scanners': _config_manager.list_all_configurations(),
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
async def get_block(
|
|
387
|
+
*,
|
|
388
|
+
tag: int | str,
|
|
389
|
+
full: bool,
|
|
390
|
+
api_kind: str,
|
|
391
|
+
network: str,
|
|
392
|
+
api_key: str,
|
|
393
|
+
http: HttpClient | None = None,
|
|
394
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
395
|
+
rate_limiter: RateLimiter | None = None,
|
|
396
|
+
retry: RetryPolicy | None = None,
|
|
397
|
+
cache: Cache | None = None,
|
|
398
|
+
telemetry: Telemetry | None = None,
|
|
399
|
+
) -> dict[str, Any]:
|
|
400
|
+
"""Fetch block by number via default adapter."""
|
|
401
|
+
|
|
402
|
+
http = http or AiohttpClient()
|
|
403
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
404
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
405
|
+
try:
|
|
406
|
+
return await get_block_by_number(
|
|
407
|
+
tag=tag,
|
|
408
|
+
full=full,
|
|
409
|
+
api_kind=api_kind,
|
|
410
|
+
network=network,
|
|
411
|
+
api_key=api_key,
|
|
412
|
+
http=http,
|
|
413
|
+
_endpoint_builder=endpoint,
|
|
414
|
+
_cache=cache,
|
|
415
|
+
_rate_limiter=rate_limiter,
|
|
416
|
+
_retry=retry,
|
|
417
|
+
_telemetry=telemetry,
|
|
418
|
+
)
|
|
419
|
+
finally:
|
|
420
|
+
await http.aclose()
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
# --- Typed facade helpers (non-breaking, return DTOs) ---
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
async def get_block_typed(
|
|
427
|
+
*,
|
|
428
|
+
tag: int | str,
|
|
429
|
+
full: bool,
|
|
430
|
+
api_kind: str,
|
|
431
|
+
network: str,
|
|
432
|
+
api_key: str,
|
|
433
|
+
http: HttpClient | None = None,
|
|
434
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
435
|
+
rate_limiter: RateLimiter | None = None,
|
|
436
|
+
retry: RetryPolicy | None = None,
|
|
437
|
+
cache: Cache | None = None,
|
|
438
|
+
telemetry: Telemetry | None = None,
|
|
439
|
+
) -> BlockDTO:
|
|
440
|
+
data = await get_block(
|
|
441
|
+
tag=tag,
|
|
442
|
+
full=full,
|
|
443
|
+
api_kind=api_kind,
|
|
444
|
+
network=network,
|
|
445
|
+
api_key=api_key,
|
|
446
|
+
http=http,
|
|
447
|
+
endpoint_builder=endpoint_builder,
|
|
448
|
+
rate_limiter=rate_limiter,
|
|
449
|
+
retry=retry,
|
|
450
|
+
cache=cache,
|
|
451
|
+
telemetry=telemetry,
|
|
452
|
+
)
|
|
453
|
+
return normalize_block(data)
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
async def get_eth_price_typed(
|
|
457
|
+
*,
|
|
458
|
+
api_kind: str,
|
|
459
|
+
network: str,
|
|
460
|
+
api_key: str,
|
|
461
|
+
http: HttpClient | None = None,
|
|
462
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
463
|
+
rate_limiter: RateLimiter | None = None,
|
|
464
|
+
retry: RetryPolicy | None = None,
|
|
465
|
+
cache: Cache | None = None,
|
|
466
|
+
telemetry: Telemetry | None = None,
|
|
467
|
+
) -> EthPriceDTO:
|
|
468
|
+
data = await get_eth_price(
|
|
469
|
+
api_kind=api_kind,
|
|
470
|
+
network=network,
|
|
471
|
+
api_key=api_key,
|
|
472
|
+
http=http,
|
|
473
|
+
endpoint_builder=endpoint_builder,
|
|
474
|
+
rate_limiter=rate_limiter,
|
|
475
|
+
retry=retry,
|
|
476
|
+
cache=cache,
|
|
477
|
+
telemetry=telemetry,
|
|
478
|
+
)
|
|
479
|
+
return normalize_eth_price(data)
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
async def get_transaction_typed(
|
|
483
|
+
*,
|
|
484
|
+
txhash: str,
|
|
485
|
+
api_kind: str,
|
|
486
|
+
network: str,
|
|
487
|
+
api_key: str,
|
|
488
|
+
http: HttpClient | None = None,
|
|
489
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
490
|
+
rate_limiter: RateLimiter | None = None,
|
|
491
|
+
retry: RetryPolicy | None = None,
|
|
492
|
+
cache: Cache | None = None,
|
|
493
|
+
telemetry: Telemetry | None = None,
|
|
494
|
+
) -> TransactionDTO:
|
|
495
|
+
data = await get_transaction(
|
|
496
|
+
txhash=txhash,
|
|
497
|
+
api_kind=api_kind,
|
|
498
|
+
network=network,
|
|
499
|
+
api_key=api_key,
|
|
500
|
+
http=http,
|
|
501
|
+
endpoint_builder=endpoint_builder,
|
|
502
|
+
rate_limiter=rate_limiter,
|
|
503
|
+
retry=retry,
|
|
504
|
+
cache=cache,
|
|
505
|
+
telemetry=telemetry,
|
|
506
|
+
)
|
|
507
|
+
return normalize_transaction(data)
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
async def get_logs_typed(
|
|
511
|
+
*,
|
|
512
|
+
start_block: int | str,
|
|
513
|
+
end_block: int | str,
|
|
514
|
+
address: str,
|
|
515
|
+
api_kind: str,
|
|
516
|
+
network: str,
|
|
517
|
+
api_key: str,
|
|
518
|
+
topics: list[str] | None = None,
|
|
519
|
+
topic_operators: list[str] | None = None,
|
|
520
|
+
page: int | str | None = None,
|
|
521
|
+
offset: int | str | None = None,
|
|
522
|
+
http: HttpClient | None = None,
|
|
523
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
524
|
+
rate_limiter: RateLimiter | None = None,
|
|
525
|
+
retry: RetryPolicy | None = None,
|
|
526
|
+
telemetry: Telemetry | None = None,
|
|
527
|
+
) -> list[LogEntryDTO]:
|
|
528
|
+
items = await get_logs(
|
|
529
|
+
start_block=start_block,
|
|
530
|
+
end_block=end_block,
|
|
531
|
+
address=address,
|
|
532
|
+
api_kind=api_kind,
|
|
533
|
+
network=network,
|
|
534
|
+
api_key=api_key,
|
|
535
|
+
topics=topics,
|
|
536
|
+
topic_operators=topic_operators,
|
|
537
|
+
page=page,
|
|
538
|
+
offset=offset,
|
|
539
|
+
http=http,
|
|
540
|
+
endpoint_builder=endpoint_builder,
|
|
541
|
+
rate_limiter=rate_limiter,
|
|
542
|
+
retry=retry,
|
|
543
|
+
telemetry=telemetry,
|
|
544
|
+
)
|
|
545
|
+
return normalize_logs(items)
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
async def get_logs_page_typed(
|
|
549
|
+
*,
|
|
550
|
+
start_block: int | str,
|
|
551
|
+
end_block: int | str,
|
|
552
|
+
address: str,
|
|
553
|
+
api_kind: str,
|
|
554
|
+
network: str,
|
|
555
|
+
api_key: str,
|
|
556
|
+
topics: list[str] | None = None,
|
|
557
|
+
topic_operators: list[str] | None = None,
|
|
558
|
+
page: int | str | None = None,
|
|
559
|
+
offset: int | str | None = None,
|
|
560
|
+
cursor: str | None = None,
|
|
561
|
+
page_size: int | None = None,
|
|
562
|
+
http: HttpClient | None = None,
|
|
563
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
564
|
+
rate_limiter: RateLimiter | None = None,
|
|
565
|
+
retry: RetryPolicy | None = None,
|
|
566
|
+
telemetry: Telemetry | None = None,
|
|
567
|
+
gql_headers: Mapping[str, str] | None = None,
|
|
568
|
+
) -> Page[LogEntryDTO]:
|
|
569
|
+
"""GraphQL-capable typed facade returning Page[LogEntryDTO].
|
|
570
|
+
|
|
571
|
+
Uses GraphQL when available and configured via a simple federator; falls back
|
|
572
|
+
to REST and encodes pagination state into an opaque cursor.
|
|
573
|
+
"""
|
|
574
|
+
from aiochainscan.adapters.aiohttp_graphql_client import AiohttpGraphQLClient
|
|
575
|
+
from aiochainscan.adapters.blockscout_graphql_builder import (
|
|
576
|
+
BlockscoutGraphQLBuilder,
|
|
577
|
+
)
|
|
578
|
+
from aiochainscan.adapters.simple_provider_federator import SimpleProviderFederator
|
|
579
|
+
|
|
580
|
+
http = http or AiohttpClient()
|
|
581
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
582
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
583
|
+
gql = AiohttpGraphQLClient()
|
|
584
|
+
gql_builder = BlockscoutGraphQLBuilder()
|
|
585
|
+
federator = SimpleProviderFederator()
|
|
586
|
+
try:
|
|
587
|
+
items, next_cursor = await get_logs_page_service(
|
|
588
|
+
start_block=start_block,
|
|
589
|
+
end_block=end_block,
|
|
590
|
+
address=address,
|
|
591
|
+
api_kind=api_kind,
|
|
592
|
+
network=network,
|
|
593
|
+
api_key=api_key,
|
|
594
|
+
http=http,
|
|
595
|
+
_endpoint_builder=endpoint,
|
|
596
|
+
topics=topics,
|
|
597
|
+
topic_operators=topic_operators,
|
|
598
|
+
page=page,
|
|
599
|
+
offset=offset,
|
|
600
|
+
cursor=cursor,
|
|
601
|
+
page_size=page_size,
|
|
602
|
+
_rate_limiter=rate_limiter,
|
|
603
|
+
_retry=retry,
|
|
604
|
+
_telemetry=telemetry,
|
|
605
|
+
_gql=gql,
|
|
606
|
+
_gql_builder=gql_builder,
|
|
607
|
+
_federator=federator,
|
|
608
|
+
gql_headers=gql_headers,
|
|
609
|
+
)
|
|
610
|
+
return Page(items=normalize_logs(items), next_cursor=next_cursor)
|
|
611
|
+
finally:
|
|
612
|
+
await http.aclose()
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
async def get_token_transfers_page_typed(
|
|
616
|
+
*,
|
|
617
|
+
address: str | None = None,
|
|
618
|
+
token_contract: str | None = None,
|
|
619
|
+
api_kind: str,
|
|
620
|
+
network: str,
|
|
621
|
+
api_key: str,
|
|
622
|
+
first: int | None = None,
|
|
623
|
+
after: str | None = None,
|
|
624
|
+
http: HttpClient | None = None,
|
|
625
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
626
|
+
rate_limiter: RateLimiter | None = None,
|
|
627
|
+
retry: RetryPolicy | None = None,
|
|
628
|
+
telemetry: Telemetry | None = None,
|
|
629
|
+
) -> Page[TokenTransferDTO]:
|
|
630
|
+
"""GraphQL-capable typed facade returning Page[TokenTransferDTO]."""
|
|
631
|
+
from aiochainscan.adapters.aiohttp_graphql_client import AiohttpGraphQLClient
|
|
632
|
+
from aiochainscan.adapters.blockscout_graphql_builder import (
|
|
633
|
+
BlockscoutGraphQLBuilder,
|
|
634
|
+
)
|
|
635
|
+
from aiochainscan.adapters.simple_provider_federator import SimpleProviderFederator
|
|
636
|
+
from aiochainscan.services.account import normalize_token_transfers
|
|
637
|
+
|
|
638
|
+
http = http or AiohttpClient()
|
|
639
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
640
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
641
|
+
gql = AiohttpGraphQLClient()
|
|
642
|
+
gql_builder = BlockscoutGraphQLBuilder()
|
|
643
|
+
federator = SimpleProviderFederator()
|
|
644
|
+
try:
|
|
645
|
+
# GraphQL path when token_contract or address available
|
|
646
|
+
items: list[dict[str, Any]] = []
|
|
647
|
+
next_cursor: str | None = None
|
|
648
|
+
if federator.should_use_graphql('token_transfers', api_kind=api_kind, network=network):
|
|
649
|
+
base = endpoint.open(
|
|
650
|
+
api_key=api_key, api_kind=api_kind, network=network
|
|
651
|
+
).base_url.rstrip('/')
|
|
652
|
+
candidates = [
|
|
653
|
+
f'{base}/api/v1/graphql',
|
|
654
|
+
f'{base}/api/graphql',
|
|
655
|
+
f'{base}/graphql',
|
|
656
|
+
f'{base}/graphiql',
|
|
657
|
+
]
|
|
658
|
+
query, variables = gql_builder.build_token_transfers_query(
|
|
659
|
+
address=address,
|
|
660
|
+
token_contract=token_contract,
|
|
661
|
+
after_cursor=after,
|
|
662
|
+
first=first,
|
|
663
|
+
)
|
|
664
|
+
_, headers = endpoint.open(
|
|
665
|
+
api_key=api_key, api_kind=api_kind, network=network
|
|
666
|
+
).filter_and_sign(params=None, headers=None)
|
|
667
|
+
for u in candidates:
|
|
668
|
+
try:
|
|
669
|
+
data = await gql.execute(u, query, variables, headers)
|
|
670
|
+
items, next_cursor = gql_builder.map_token_transfers_response(data)
|
|
671
|
+
break
|
|
672
|
+
except Exception:
|
|
673
|
+
continue
|
|
674
|
+
if not items:
|
|
675
|
+
# Fallback: REST page (page/offset → not cursor). Return opaque cursors as None.
|
|
676
|
+
items = await get_token_transfers_service(
|
|
677
|
+
address=address,
|
|
678
|
+
contract_address=token_contract,
|
|
679
|
+
start_block=None,
|
|
680
|
+
end_block=None,
|
|
681
|
+
sort=None,
|
|
682
|
+
page=None,
|
|
683
|
+
offset=None,
|
|
684
|
+
token_standard='erc20',
|
|
685
|
+
api_kind=api_kind,
|
|
686
|
+
network=network,
|
|
687
|
+
api_key=api_key,
|
|
688
|
+
http=http,
|
|
689
|
+
_endpoint_builder=endpoint,
|
|
690
|
+
)
|
|
691
|
+
return Page(items=normalize_token_transfers(items), next_cursor=next_cursor)
|
|
692
|
+
finally:
|
|
693
|
+
await http.aclose()
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
async def get_address_transactions_page_typed(
|
|
697
|
+
*,
|
|
698
|
+
address: str,
|
|
699
|
+
api_kind: str,
|
|
700
|
+
network: str,
|
|
701
|
+
api_key: str,
|
|
702
|
+
first: int | None = None,
|
|
703
|
+
after: str | None = None,
|
|
704
|
+
http: HttpClient | None = None,
|
|
705
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
706
|
+
rate_limiter: RateLimiter | None = None,
|
|
707
|
+
retry: RetryPolicy | None = None,
|
|
708
|
+
telemetry: Telemetry | None = None,
|
|
709
|
+
) -> Page[NormalTxDTO]:
|
|
710
|
+
from aiochainscan.adapters.aiohttp_graphql_client import AiohttpGraphQLClient
|
|
711
|
+
from aiochainscan.adapters.blockscout_graphql_builder import BlockscoutGraphQLBuilder
|
|
712
|
+
from aiochainscan.adapters.simple_provider_federator import SimpleProviderFederator
|
|
713
|
+
from aiochainscan.services.account import normalize_normal_txs
|
|
714
|
+
|
|
715
|
+
http = http or AiohttpClient()
|
|
716
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
717
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
718
|
+
gql = AiohttpGraphQLClient()
|
|
719
|
+
gql_builder = BlockscoutGraphQLBuilder()
|
|
720
|
+
federator = SimpleProviderFederator()
|
|
721
|
+
try:
|
|
722
|
+
items: list[dict[str, Any]] = []
|
|
723
|
+
next_cursor: str | None = None
|
|
724
|
+
if federator.should_use_graphql(
|
|
725
|
+
'address_transactions', api_kind=api_kind, network=network
|
|
726
|
+
):
|
|
727
|
+
base = endpoint.open(
|
|
728
|
+
api_key=api_key, api_kind=api_kind, network=network
|
|
729
|
+
).base_url.rstrip('/')
|
|
730
|
+
candidates = [
|
|
731
|
+
f'{base}/api/v1/graphql',
|
|
732
|
+
f'{base}/api/graphql',
|
|
733
|
+
f'{base}/graphql',
|
|
734
|
+
f'{base}/graphiql',
|
|
735
|
+
]
|
|
736
|
+
query, variables = gql_builder.build_address_transactions_query(
|
|
737
|
+
address=address, after_cursor=after, first=first
|
|
738
|
+
)
|
|
739
|
+
_, headers = endpoint.open(
|
|
740
|
+
api_key=api_key, api_kind=api_kind, network=network
|
|
741
|
+
).filter_and_sign(params=None, headers=None)
|
|
742
|
+
for u in candidates:
|
|
743
|
+
try:
|
|
744
|
+
data = await gql.execute(u, query, variables, headers)
|
|
745
|
+
items, next_cursor = gql_builder.map_address_transactions_response(data)
|
|
746
|
+
break
|
|
747
|
+
except Exception:
|
|
748
|
+
continue
|
|
749
|
+
if not items:
|
|
750
|
+
# fallback: REST txlist page; opaque cursor=N/A
|
|
751
|
+
from aiochainscan.services.account import (
|
|
752
|
+
get_normal_transactions as get_normal_transactions_service,
|
|
753
|
+
)
|
|
754
|
+
|
|
755
|
+
items = await get_normal_transactions_service(
|
|
756
|
+
address=address,
|
|
757
|
+
start_block=None,
|
|
758
|
+
end_block=None,
|
|
759
|
+
sort=None,
|
|
760
|
+
page=None,
|
|
761
|
+
offset=None,
|
|
762
|
+
api_kind=api_kind,
|
|
763
|
+
network=network,
|
|
764
|
+
api_key=api_key,
|
|
765
|
+
http=http,
|
|
766
|
+
_endpoint_builder=endpoint,
|
|
767
|
+
)
|
|
768
|
+
return Page(items=normalize_normal_txs(items), next_cursor=next_cursor)
|
|
769
|
+
finally:
|
|
770
|
+
await http.aclose()
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
async def get_token_balance_typed(
|
|
774
|
+
*,
|
|
775
|
+
holder: str,
|
|
776
|
+
token_contract: str,
|
|
777
|
+
api_kind: str,
|
|
778
|
+
network: str,
|
|
779
|
+
api_key: str,
|
|
780
|
+
http: HttpClient | None = None,
|
|
781
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
782
|
+
rate_limiter: RateLimiter | None = None,
|
|
783
|
+
retry: RetryPolicy | None = None,
|
|
784
|
+
cache: Cache | None = None,
|
|
785
|
+
telemetry: Telemetry | None = None,
|
|
786
|
+
) -> TokenBalanceDTO:
|
|
787
|
+
value = await get_token_balance(
|
|
788
|
+
holder=holder,
|
|
789
|
+
token_contract=token_contract,
|
|
790
|
+
api_kind=api_kind,
|
|
791
|
+
network=network,
|
|
792
|
+
api_key=api_key,
|
|
793
|
+
http=http,
|
|
794
|
+
endpoint_builder=endpoint_builder,
|
|
795
|
+
rate_limiter=rate_limiter,
|
|
796
|
+
retry=retry,
|
|
797
|
+
cache=cache,
|
|
798
|
+
telemetry=telemetry,
|
|
799
|
+
)
|
|
800
|
+
return normalize_token_balance(
|
|
801
|
+
holder=Address(holder), token_contract=Address(token_contract), value=value
|
|
802
|
+
)
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
async def get_gas_oracle_typed(
|
|
806
|
+
*,
|
|
807
|
+
api_kind: str,
|
|
808
|
+
network: str,
|
|
809
|
+
api_key: str,
|
|
810
|
+
http: HttpClient | None = None,
|
|
811
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
812
|
+
rate_limiter: RateLimiter | None = None,
|
|
813
|
+
retry: RetryPolicy | None = None,
|
|
814
|
+
cache: Cache | None = None,
|
|
815
|
+
telemetry: Telemetry | None = None,
|
|
816
|
+
) -> GasOracleDTO:
|
|
817
|
+
data = await get_gas_oracle(
|
|
818
|
+
api_kind=api_kind,
|
|
819
|
+
network=network,
|
|
820
|
+
api_key=api_key,
|
|
821
|
+
http=http,
|
|
822
|
+
endpoint_builder=endpoint_builder,
|
|
823
|
+
rate_limiter=rate_limiter,
|
|
824
|
+
retry=retry,
|
|
825
|
+
cache=cache,
|
|
826
|
+
telemetry=telemetry,
|
|
827
|
+
)
|
|
828
|
+
return normalize_gas_oracle(data)
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
async def get_daily_transaction_count_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
832
|
+
items = await get_daily_transaction_count(**kwargs)
|
|
833
|
+
return normalize_daily_transaction_count(items)
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
async def get_daily_new_address_count_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
837
|
+
items = await get_daily_new_address_count(**kwargs)
|
|
838
|
+
return normalize_daily_new_address_count(items)
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
async def get_daily_network_tx_fee_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
842
|
+
items = await get_daily_network_tx_fee(**kwargs)
|
|
843
|
+
return normalize_daily_network_tx_fee(items)
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
async def get_daily_network_utilization_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
847
|
+
items = await get_daily_network_utilization(**kwargs)
|
|
848
|
+
return normalize_daily_network_utilization(items)
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
async def get_daily_average_block_size_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
852
|
+
items = await get_daily_average_block_size(**kwargs)
|
|
853
|
+
return normalize_daily_average_block_size(items)
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
async def get_daily_block_rewards_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
857
|
+
items = await get_daily_block_rewards(**kwargs)
|
|
858
|
+
return normalize_daily_block_rewards(items)
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
async def get_daily_average_block_time_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
862
|
+
items = await get_daily_average_block_time(**kwargs)
|
|
863
|
+
return normalize_daily_average_block_time(items)
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
async def get_daily_uncle_block_count_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
867
|
+
items = await get_daily_uncle_block_count(**kwargs)
|
|
868
|
+
return normalize_daily_uncle_block_count(items)
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
async def get_daily_average_gas_limit_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
872
|
+
items = await get_daily_average_gas_limit(**kwargs)
|
|
873
|
+
return normalize_daily_average_gas_limit(items)
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
async def get_daily_total_gas_used_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
877
|
+
items = await get_daily_total_gas_used(**kwargs)
|
|
878
|
+
return normalize_daily_total_gas_used(items)
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
async def get_daily_average_gas_price_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
882
|
+
items = await get_daily_average_gas_price(**kwargs)
|
|
883
|
+
return normalize_daily_average_gas_price(items)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
async def get_daily_block_count_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
887
|
+
items = await get_daily_block_count(**kwargs)
|
|
888
|
+
return normalize_daily_block_count(items)
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
async def get_daily_average_network_hash_rate_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
892
|
+
items = await get_daily_average_network_hash_rate(**kwargs)
|
|
893
|
+
return normalize_daily_average_network_hash_rate(items)
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
async def get_daily_average_network_difficulty_typed(
|
|
897
|
+
**kwargs: Any,
|
|
898
|
+
) -> list[DailySeriesDTO]:
|
|
899
|
+
items = await get_daily_average_network_difficulty(**kwargs)
|
|
900
|
+
return normalize_daily_average_network_difficulty(items)
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
async def get_ether_historical_daily_market_cap_typed(
|
|
904
|
+
**kwargs: Any,
|
|
905
|
+
) -> list[DailySeriesDTO]:
|
|
906
|
+
items = await get_ether_historical_daily_market_cap(**kwargs)
|
|
907
|
+
return normalize_ether_historical_daily_market_cap(items)
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
async def get_ether_historical_price_typed(**kwargs: Any) -> list[DailySeriesDTO]:
|
|
911
|
+
items = await get_ether_historical_price(**kwargs)
|
|
912
|
+
return normalize_ether_historical_price(items)
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
async def get_address_balances(
|
|
916
|
+
*,
|
|
917
|
+
addresses: list[str],
|
|
918
|
+
tag: str,
|
|
919
|
+
api_kind: str,
|
|
920
|
+
network: str,
|
|
921
|
+
api_key: str,
|
|
922
|
+
http: HttpClient | None = None,
|
|
923
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
924
|
+
rate_limiter: RateLimiter | None = None,
|
|
925
|
+
retry: RetryPolicy | None = None,
|
|
926
|
+
telemetry: Telemetry | None = None,
|
|
927
|
+
) -> list[dict[str, Any]]:
|
|
928
|
+
http = http or AiohttpClient()
|
|
929
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
930
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
931
|
+
try:
|
|
932
|
+
return await get_address_balances_service(
|
|
933
|
+
addresses=addresses,
|
|
934
|
+
tag=tag,
|
|
935
|
+
api_kind=api_kind,
|
|
936
|
+
network=network,
|
|
937
|
+
api_key=api_key,
|
|
938
|
+
http=http,
|
|
939
|
+
_endpoint_builder=endpoint,
|
|
940
|
+
_rate_limiter=rate_limiter,
|
|
941
|
+
_retry=retry,
|
|
942
|
+
_telemetry=telemetry,
|
|
943
|
+
)
|
|
944
|
+
finally:
|
|
945
|
+
await http.aclose()
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
async def get_normal_transactions(
|
|
949
|
+
*,
|
|
950
|
+
address: str,
|
|
951
|
+
start_block: int | None = None,
|
|
952
|
+
end_block: int | None = None,
|
|
953
|
+
sort: str | None = None,
|
|
954
|
+
page: int | None = None,
|
|
955
|
+
offset: int | None = None,
|
|
956
|
+
api_kind: str,
|
|
957
|
+
network: str,
|
|
958
|
+
api_key: str,
|
|
959
|
+
http: HttpClient | None = None,
|
|
960
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
961
|
+
rate_limiter: RateLimiter | None = None,
|
|
962
|
+
retry: RetryPolicy | None = None,
|
|
963
|
+
telemetry: Telemetry | None = None,
|
|
964
|
+
) -> list[dict[str, Any]]:
|
|
965
|
+
http = http or AiohttpClient()
|
|
966
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
967
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
968
|
+
try:
|
|
969
|
+
return await get_normal_transactions_service(
|
|
970
|
+
address=address,
|
|
971
|
+
start_block=start_block,
|
|
972
|
+
end_block=end_block,
|
|
973
|
+
sort=sort,
|
|
974
|
+
page=page,
|
|
975
|
+
offset=offset,
|
|
976
|
+
api_kind=api_kind,
|
|
977
|
+
network=network,
|
|
978
|
+
api_key=api_key,
|
|
979
|
+
http=http,
|
|
980
|
+
_endpoint_builder=endpoint,
|
|
981
|
+
_rate_limiter=rate_limiter,
|
|
982
|
+
_retry=retry,
|
|
983
|
+
_telemetry=telemetry,
|
|
984
|
+
)
|
|
985
|
+
finally:
|
|
986
|
+
await http.aclose()
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
async def get_all_transactions_optimized(
|
|
990
|
+
*,
|
|
991
|
+
address: str,
|
|
992
|
+
start_block: int | None = None,
|
|
993
|
+
end_block: int | None = None,
|
|
994
|
+
max_concurrent: int = 5,
|
|
995
|
+
max_offset: int = 10_000,
|
|
996
|
+
api_kind: str,
|
|
997
|
+
network: str,
|
|
998
|
+
api_key: str,
|
|
999
|
+
http: HttpClient | None = None,
|
|
1000
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1001
|
+
rate_limiter: RateLimiter | None = None,
|
|
1002
|
+
retry: RetryPolicy | None = None,
|
|
1003
|
+
telemetry: Telemetry | None = None,
|
|
1004
|
+
min_range_width: int = 1_000,
|
|
1005
|
+
max_attempts_per_range: int = 3,
|
|
1006
|
+
prefer_paging: bool | None = None,
|
|
1007
|
+
stats: dict[str, int] | None = None,
|
|
1008
|
+
) -> list[dict[str, Any]]:
|
|
1009
|
+
"""Optimized fetch of all normal transactions via services layer.
|
|
1010
|
+
|
|
1011
|
+
Uses range splitting + priority queue under the hood, respects rate limits
|
|
1012
|
+
and works with Blockscout without API key.
|
|
1013
|
+
"""
|
|
1014
|
+
http = http or AiohttpClient()
|
|
1015
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1016
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1017
|
+
try:
|
|
1018
|
+
return await get_all_transactions_optimized_service(
|
|
1019
|
+
address=address,
|
|
1020
|
+
start_block=start_block,
|
|
1021
|
+
end_block=end_block,
|
|
1022
|
+
max_concurrent=max_concurrent,
|
|
1023
|
+
max_offset=max_offset,
|
|
1024
|
+
api_kind=api_kind,
|
|
1025
|
+
network=network,
|
|
1026
|
+
api_key=api_key,
|
|
1027
|
+
http=http,
|
|
1028
|
+
_endpoint_builder=endpoint,
|
|
1029
|
+
_rate_limiter=rate_limiter,
|
|
1030
|
+
_retry=retry,
|
|
1031
|
+
_telemetry=telemetry,
|
|
1032
|
+
min_range_width=min_range_width,
|
|
1033
|
+
max_attempts_per_range=max_attempts_per_range,
|
|
1034
|
+
prefer_paging=prefer_paging,
|
|
1035
|
+
stats=stats,
|
|
1036
|
+
)
|
|
1037
|
+
finally:
|
|
1038
|
+
await http.aclose()
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
async def get_all_transactions_optimized_typed(
|
|
1042
|
+
*,
|
|
1043
|
+
address: str,
|
|
1044
|
+
start_block: int | None = None,
|
|
1045
|
+
end_block: int | None = None,
|
|
1046
|
+
max_concurrent: int = 5,
|
|
1047
|
+
max_offset: int = 10_000,
|
|
1048
|
+
api_kind: str,
|
|
1049
|
+
network: str,
|
|
1050
|
+
api_key: str,
|
|
1051
|
+
http: HttpClient | None = None,
|
|
1052
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1053
|
+
rate_limiter: RateLimiter | None = None,
|
|
1054
|
+
retry: RetryPolicy | None = None,
|
|
1055
|
+
telemetry: Telemetry | None = None,
|
|
1056
|
+
min_range_width: int = 1_000,
|
|
1057
|
+
max_attempts_per_range: int = 3,
|
|
1058
|
+
) -> list[NormalTxDTO]:
|
|
1059
|
+
items = await get_all_transactions_optimized(
|
|
1060
|
+
address=address,
|
|
1061
|
+
start_block=start_block,
|
|
1062
|
+
end_block=end_block,
|
|
1063
|
+
max_concurrent=max_concurrent,
|
|
1064
|
+
max_offset=max_offset,
|
|
1065
|
+
api_kind=api_kind,
|
|
1066
|
+
network=network,
|
|
1067
|
+
api_key=api_key,
|
|
1068
|
+
http=http,
|
|
1069
|
+
endpoint_builder=endpoint_builder,
|
|
1070
|
+
rate_limiter=rate_limiter,
|
|
1071
|
+
retry=retry,
|
|
1072
|
+
telemetry=telemetry,
|
|
1073
|
+
min_range_width=min_range_width,
|
|
1074
|
+
max_attempts_per_range=max_attempts_per_range,
|
|
1075
|
+
)
|
|
1076
|
+
return normalize_normal_txs(items)
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
async def get_all_internal_transactions_optimized(
|
|
1080
|
+
*,
|
|
1081
|
+
address: str,
|
|
1082
|
+
start_block: int | None = None,
|
|
1083
|
+
end_block: int | None = None,
|
|
1084
|
+
max_concurrent: int = 5,
|
|
1085
|
+
max_offset: int = 10_000,
|
|
1086
|
+
api_kind: str,
|
|
1087
|
+
network: str,
|
|
1088
|
+
api_key: str,
|
|
1089
|
+
http: HttpClient | None = None,
|
|
1090
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1091
|
+
rate_limiter: RateLimiter | None = None,
|
|
1092
|
+
retry: RetryPolicy | None = None,
|
|
1093
|
+
telemetry: Telemetry | None = None,
|
|
1094
|
+
min_range_width: int = 1_000,
|
|
1095
|
+
max_attempts_per_range: int = 3,
|
|
1096
|
+
stats: dict[str, int] | None = None,
|
|
1097
|
+
) -> list[dict[str, Any]]:
|
|
1098
|
+
http = http or AiohttpClient()
|
|
1099
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1100
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1101
|
+
try:
|
|
1102
|
+
return await get_all_internal_transactions_optimized_service(
|
|
1103
|
+
address=address,
|
|
1104
|
+
start_block=start_block,
|
|
1105
|
+
end_block=end_block,
|
|
1106
|
+
max_concurrent=max_concurrent,
|
|
1107
|
+
max_offset=max_offset,
|
|
1108
|
+
api_kind=api_kind,
|
|
1109
|
+
network=network,
|
|
1110
|
+
api_key=api_key,
|
|
1111
|
+
http=http,
|
|
1112
|
+
_endpoint_builder=endpoint,
|
|
1113
|
+
_rate_limiter=rate_limiter,
|
|
1114
|
+
_retry=retry,
|
|
1115
|
+
_telemetry=telemetry,
|
|
1116
|
+
min_range_width=min_range_width,
|
|
1117
|
+
max_attempts_per_range=max_attempts_per_range,
|
|
1118
|
+
stats=stats,
|
|
1119
|
+
)
|
|
1120
|
+
finally:
|
|
1121
|
+
await http.aclose()
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
async def get_all_logs_optimized(
|
|
1125
|
+
*,
|
|
1126
|
+
address: str,
|
|
1127
|
+
start_block: int | None = None,
|
|
1128
|
+
end_block: int | None = None,
|
|
1129
|
+
max_concurrent: int = 3,
|
|
1130
|
+
max_offset: int = 1_000,
|
|
1131
|
+
api_kind: str,
|
|
1132
|
+
network: str,
|
|
1133
|
+
api_key: str,
|
|
1134
|
+
topics: list[str] | None = None,
|
|
1135
|
+
topic_operators: list[str] | None = None,
|
|
1136
|
+
http: HttpClient | None = None,
|
|
1137
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1138
|
+
rate_limiter: RateLimiter | None = None,
|
|
1139
|
+
retry: RetryPolicy | None = None,
|
|
1140
|
+
telemetry: Telemetry | None = None,
|
|
1141
|
+
min_range_width: int = 1_000,
|
|
1142
|
+
max_attempts_per_range: int = 3,
|
|
1143
|
+
stats: dict[str, int] | None = None,
|
|
1144
|
+
) -> list[dict[str, Any]]:
|
|
1145
|
+
http = http or AiohttpClient()
|
|
1146
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1147
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1148
|
+
try:
|
|
1149
|
+
from aiochainscan.services.logs import (
|
|
1150
|
+
get_all_logs_optimized as get_all_logs_optimized_service,
|
|
1151
|
+
)
|
|
1152
|
+
|
|
1153
|
+
return await get_all_logs_optimized_service(
|
|
1154
|
+
address=address,
|
|
1155
|
+
start_block=start_block,
|
|
1156
|
+
end_block=end_block,
|
|
1157
|
+
max_concurrent=max_concurrent,
|
|
1158
|
+
max_offset=max_offset,
|
|
1159
|
+
api_kind=api_kind,
|
|
1160
|
+
network=network,
|
|
1161
|
+
api_key=api_key,
|
|
1162
|
+
http=http,
|
|
1163
|
+
_endpoint_builder=endpoint,
|
|
1164
|
+
topics=topics,
|
|
1165
|
+
topic_operators=topic_operators,
|
|
1166
|
+
_rate_limiter=rate_limiter,
|
|
1167
|
+
_retry=retry,
|
|
1168
|
+
_telemetry=telemetry,
|
|
1169
|
+
min_range_width=min_range_width,
|
|
1170
|
+
max_attempts_per_range=max_attempts_per_range,
|
|
1171
|
+
stats=stats,
|
|
1172
|
+
)
|
|
1173
|
+
finally:
|
|
1174
|
+
await http.aclose()
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
async def get_internal_transactions(
|
|
1178
|
+
*,
|
|
1179
|
+
address: str | None = None,
|
|
1180
|
+
start_block: int | None = None,
|
|
1181
|
+
end_block: int | None = None,
|
|
1182
|
+
sort: str | None = None,
|
|
1183
|
+
page: int | None = None,
|
|
1184
|
+
offset: int | None = None,
|
|
1185
|
+
txhash: str | None = None,
|
|
1186
|
+
api_kind: str,
|
|
1187
|
+
network: str,
|
|
1188
|
+
api_key: str,
|
|
1189
|
+
http: HttpClient | None = None,
|
|
1190
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1191
|
+
rate_limiter: RateLimiter | None = None,
|
|
1192
|
+
retry: RetryPolicy | None = None,
|
|
1193
|
+
telemetry: Telemetry | None = None,
|
|
1194
|
+
) -> list[dict[str, Any]]:
|
|
1195
|
+
http = http or AiohttpClient()
|
|
1196
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1197
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1198
|
+
try:
|
|
1199
|
+
return await get_internal_transactions_service(
|
|
1200
|
+
address=address,
|
|
1201
|
+
start_block=start_block,
|
|
1202
|
+
end_block=end_block,
|
|
1203
|
+
sort=sort,
|
|
1204
|
+
page=page,
|
|
1205
|
+
offset=offset,
|
|
1206
|
+
txhash=txhash,
|
|
1207
|
+
api_kind=api_kind,
|
|
1208
|
+
network=network,
|
|
1209
|
+
api_key=api_key,
|
|
1210
|
+
http=http,
|
|
1211
|
+
_endpoint_builder=endpoint,
|
|
1212
|
+
_rate_limiter=rate_limiter,
|
|
1213
|
+
_retry=retry,
|
|
1214
|
+
_telemetry=telemetry,
|
|
1215
|
+
)
|
|
1216
|
+
finally:
|
|
1217
|
+
await http.aclose()
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
async def get_token_transfers(
|
|
1221
|
+
*,
|
|
1222
|
+
address: str | None = None,
|
|
1223
|
+
contract_address: str | None = None,
|
|
1224
|
+
start_block: int | None = None,
|
|
1225
|
+
end_block: int | None = None,
|
|
1226
|
+
sort: str | None = None,
|
|
1227
|
+
page: int | None = None,
|
|
1228
|
+
offset: int | None = None,
|
|
1229
|
+
token_standard: str = 'erc20',
|
|
1230
|
+
api_kind: str,
|
|
1231
|
+
network: str,
|
|
1232
|
+
api_key: str,
|
|
1233
|
+
http: HttpClient | None = None,
|
|
1234
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1235
|
+
rate_limiter: RateLimiter | None = None,
|
|
1236
|
+
retry: RetryPolicy | None = None,
|
|
1237
|
+
telemetry: Telemetry | None = None,
|
|
1238
|
+
) -> list[dict[str, Any]]:
|
|
1239
|
+
http = http or AiohttpClient()
|
|
1240
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1241
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1242
|
+
try:
|
|
1243
|
+
return await get_token_transfers_service(
|
|
1244
|
+
address=address,
|
|
1245
|
+
contract_address=contract_address,
|
|
1246
|
+
start_block=start_block,
|
|
1247
|
+
end_block=end_block,
|
|
1248
|
+
sort=sort,
|
|
1249
|
+
page=page,
|
|
1250
|
+
offset=offset,
|
|
1251
|
+
token_standard=token_standard,
|
|
1252
|
+
api_kind=api_kind,
|
|
1253
|
+
network=network,
|
|
1254
|
+
api_key=api_key,
|
|
1255
|
+
http=http,
|
|
1256
|
+
_endpoint_builder=endpoint,
|
|
1257
|
+
_rate_limiter=rate_limiter,
|
|
1258
|
+
_retry=retry,
|
|
1259
|
+
_telemetry=telemetry,
|
|
1260
|
+
)
|
|
1261
|
+
finally:
|
|
1262
|
+
await http.aclose()
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
async def get_mined_blocks(
|
|
1266
|
+
*,
|
|
1267
|
+
address: str,
|
|
1268
|
+
blocktype: str = 'blocks',
|
|
1269
|
+
page: int | None = None,
|
|
1270
|
+
offset: int | None = None,
|
|
1271
|
+
api_kind: str,
|
|
1272
|
+
network: str,
|
|
1273
|
+
api_key: str,
|
|
1274
|
+
http: HttpClient | None = None,
|
|
1275
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1276
|
+
rate_limiter: RateLimiter | None = None,
|
|
1277
|
+
retry: RetryPolicy | None = None,
|
|
1278
|
+
telemetry: Telemetry | None = None,
|
|
1279
|
+
) -> list[dict[str, Any]]:
|
|
1280
|
+
http = http or AiohttpClient()
|
|
1281
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1282
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1283
|
+
try:
|
|
1284
|
+
return await get_mined_blocks_service(
|
|
1285
|
+
address=address,
|
|
1286
|
+
blocktype=blocktype,
|
|
1287
|
+
page=page,
|
|
1288
|
+
offset=offset,
|
|
1289
|
+
api_kind=api_kind,
|
|
1290
|
+
network=network,
|
|
1291
|
+
api_key=api_key,
|
|
1292
|
+
http=http,
|
|
1293
|
+
_endpoint_builder=endpoint,
|
|
1294
|
+
_rate_limiter=rate_limiter,
|
|
1295
|
+
_retry=retry,
|
|
1296
|
+
_telemetry=telemetry,
|
|
1297
|
+
)
|
|
1298
|
+
finally:
|
|
1299
|
+
await http.aclose()
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
async def get_beacon_chain_withdrawals(
|
|
1303
|
+
*,
|
|
1304
|
+
address: str,
|
|
1305
|
+
start_block: int | None = None,
|
|
1306
|
+
end_block: int | None = None,
|
|
1307
|
+
sort: str | None = None,
|
|
1308
|
+
page: int | None = None,
|
|
1309
|
+
offset: int | None = None,
|
|
1310
|
+
api_kind: str,
|
|
1311
|
+
network: str,
|
|
1312
|
+
api_key: str,
|
|
1313
|
+
http: HttpClient | None = None,
|
|
1314
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1315
|
+
rate_limiter: RateLimiter | None = None,
|
|
1316
|
+
retry: RetryPolicy | None = None,
|
|
1317
|
+
telemetry: Telemetry | None = None,
|
|
1318
|
+
) -> list[dict[str, Any]]:
|
|
1319
|
+
http = http or AiohttpClient()
|
|
1320
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1321
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1322
|
+
try:
|
|
1323
|
+
return await get_beacon_chain_withdrawals_service(
|
|
1324
|
+
address=address,
|
|
1325
|
+
start_block=start_block,
|
|
1326
|
+
end_block=end_block,
|
|
1327
|
+
sort=sort,
|
|
1328
|
+
page=page,
|
|
1329
|
+
offset=offset,
|
|
1330
|
+
api_kind=api_kind,
|
|
1331
|
+
network=network,
|
|
1332
|
+
api_key=api_key,
|
|
1333
|
+
http=http,
|
|
1334
|
+
_endpoint_builder=endpoint,
|
|
1335
|
+
_rate_limiter=rate_limiter,
|
|
1336
|
+
_retry=retry,
|
|
1337
|
+
_telemetry=telemetry,
|
|
1338
|
+
)
|
|
1339
|
+
finally:
|
|
1340
|
+
await http.aclose()
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
async def get_account_balance_by_blockno(
|
|
1344
|
+
*,
|
|
1345
|
+
address: str,
|
|
1346
|
+
blockno: int,
|
|
1347
|
+
api_kind: str,
|
|
1348
|
+
network: str,
|
|
1349
|
+
api_key: str,
|
|
1350
|
+
http: HttpClient | None = None,
|
|
1351
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1352
|
+
rate_limiter: RateLimiter | None = None,
|
|
1353
|
+
retry: RetryPolicy | None = None,
|
|
1354
|
+
telemetry: Telemetry | None = None,
|
|
1355
|
+
) -> str:
|
|
1356
|
+
http = http or AiohttpClient()
|
|
1357
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1358
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1359
|
+
try:
|
|
1360
|
+
return await get_account_balance_by_blockno_service(
|
|
1361
|
+
address=address,
|
|
1362
|
+
blockno=blockno,
|
|
1363
|
+
api_kind=api_kind,
|
|
1364
|
+
network=network,
|
|
1365
|
+
api_key=api_key,
|
|
1366
|
+
http=http,
|
|
1367
|
+
_endpoint_builder=endpoint,
|
|
1368
|
+
_rate_limiter=rate_limiter,
|
|
1369
|
+
_retry=retry,
|
|
1370
|
+
_telemetry=telemetry,
|
|
1371
|
+
)
|
|
1372
|
+
finally:
|
|
1373
|
+
await http.aclose()
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
async def get_transaction(
|
|
1377
|
+
*,
|
|
1378
|
+
txhash: str,
|
|
1379
|
+
api_kind: str,
|
|
1380
|
+
network: str,
|
|
1381
|
+
api_key: str,
|
|
1382
|
+
http: HttpClient | None = None,
|
|
1383
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1384
|
+
rate_limiter: RateLimiter | None = None,
|
|
1385
|
+
retry: RetryPolicy | None = None,
|
|
1386
|
+
cache: Cache | None = None,
|
|
1387
|
+
telemetry: Telemetry | None = None,
|
|
1388
|
+
) -> dict[str, Any]:
|
|
1389
|
+
"""Fetch transaction by hash via default adapter."""
|
|
1390
|
+
|
|
1391
|
+
http = http or AiohttpClient()
|
|
1392
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1393
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1394
|
+
try:
|
|
1395
|
+
return await get_transaction_by_hash(
|
|
1396
|
+
txhash=TxHash(txhash),
|
|
1397
|
+
api_kind=api_kind,
|
|
1398
|
+
network=network,
|
|
1399
|
+
api_key=api_key,
|
|
1400
|
+
http=http,
|
|
1401
|
+
_endpoint_builder=endpoint,
|
|
1402
|
+
_cache=cache,
|
|
1403
|
+
_rate_limiter=rate_limiter,
|
|
1404
|
+
_retry=retry,
|
|
1405
|
+
_telemetry=telemetry,
|
|
1406
|
+
)
|
|
1407
|
+
finally:
|
|
1408
|
+
await http.aclose()
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
async def get_token_balance(
|
|
1412
|
+
*,
|
|
1413
|
+
holder: str,
|
|
1414
|
+
token_contract: str,
|
|
1415
|
+
api_kind: str,
|
|
1416
|
+
network: str,
|
|
1417
|
+
api_key: str,
|
|
1418
|
+
http: HttpClient | None = None,
|
|
1419
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1420
|
+
rate_limiter: RateLimiter | None = None,
|
|
1421
|
+
retry: RetryPolicy | None = None,
|
|
1422
|
+
cache: Cache | None = None,
|
|
1423
|
+
telemetry: Telemetry | None = None,
|
|
1424
|
+
) -> int:
|
|
1425
|
+
"""Fetch ERC-20 token balance via default adapter."""
|
|
1426
|
+
|
|
1427
|
+
http = http or AiohttpClient()
|
|
1428
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1429
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1430
|
+
try:
|
|
1431
|
+
return await get_token_balance_service(
|
|
1432
|
+
holder=Address(holder),
|
|
1433
|
+
token_contract=Address(token_contract),
|
|
1434
|
+
api_kind=api_kind,
|
|
1435
|
+
network=network,
|
|
1436
|
+
api_key=api_key,
|
|
1437
|
+
http=http,
|
|
1438
|
+
_endpoint_builder=endpoint,
|
|
1439
|
+
_cache=cache,
|
|
1440
|
+
_rate_limiter=rate_limiter,
|
|
1441
|
+
_retry=retry,
|
|
1442
|
+
_telemetry=telemetry,
|
|
1443
|
+
)
|
|
1444
|
+
finally:
|
|
1445
|
+
await http.aclose()
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
# Backward-compatible alias
|
|
1449
|
+
get_token_balance_facade = get_token_balance
|
|
1450
|
+
|
|
1451
|
+
|
|
1452
|
+
async def get_gas_oracle(
|
|
1453
|
+
*,
|
|
1454
|
+
api_kind: str,
|
|
1455
|
+
network: str,
|
|
1456
|
+
api_key: str,
|
|
1457
|
+
http: HttpClient | None = None,
|
|
1458
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1459
|
+
rate_limiter: RateLimiter | None = None,
|
|
1460
|
+
retry: RetryPolicy | None = None,
|
|
1461
|
+
cache: Cache | None = None,
|
|
1462
|
+
telemetry: Telemetry | None = None,
|
|
1463
|
+
) -> dict[str, Any]:
|
|
1464
|
+
"""Fetch gas oracle via default adapter."""
|
|
1465
|
+
|
|
1466
|
+
http = http or AiohttpClient()
|
|
1467
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1468
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1469
|
+
try:
|
|
1470
|
+
return await get_gas_oracle_service(
|
|
1471
|
+
api_kind=api_kind,
|
|
1472
|
+
network=network,
|
|
1473
|
+
api_key=api_key,
|
|
1474
|
+
http=http,
|
|
1475
|
+
_endpoint_builder=endpoint,
|
|
1476
|
+
_cache=cache,
|
|
1477
|
+
_rate_limiter=rate_limiter,
|
|
1478
|
+
_retry=retry,
|
|
1479
|
+
_telemetry=telemetry,
|
|
1480
|
+
)
|
|
1481
|
+
finally:
|
|
1482
|
+
await http.aclose()
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
# Backward-compatible alias
|
|
1486
|
+
get_gas_oracle_facade = get_gas_oracle
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
async def get_logs(
|
|
1490
|
+
*,
|
|
1491
|
+
start_block: int | str,
|
|
1492
|
+
end_block: int | str,
|
|
1493
|
+
address: str,
|
|
1494
|
+
api_kind: str,
|
|
1495
|
+
network: str,
|
|
1496
|
+
api_key: str,
|
|
1497
|
+
topics: list[str] | None = None,
|
|
1498
|
+
topic_operators: list[str] | None = None,
|
|
1499
|
+
page: int | str | None = None,
|
|
1500
|
+
offset: int | str | None = None,
|
|
1501
|
+
http: HttpClient | None = None,
|
|
1502
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1503
|
+
rate_limiter: RateLimiter | None = None,
|
|
1504
|
+
retry: RetryPolicy | None = None,
|
|
1505
|
+
telemetry: Telemetry | None = None,
|
|
1506
|
+
) -> list[dict[str, Any]]:
|
|
1507
|
+
"""Fetch logs via default adapter."""
|
|
1508
|
+
|
|
1509
|
+
from aiochainscan.services.logs import get_logs as get_logs_service
|
|
1510
|
+
|
|
1511
|
+
http = http or AiohttpClient()
|
|
1512
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1513
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1514
|
+
try:
|
|
1515
|
+
return await get_logs_service(
|
|
1516
|
+
start_block=start_block,
|
|
1517
|
+
end_block=end_block,
|
|
1518
|
+
address=address,
|
|
1519
|
+
api_kind=api_kind,
|
|
1520
|
+
network=network,
|
|
1521
|
+
api_key=api_key,
|
|
1522
|
+
http=http,
|
|
1523
|
+
_endpoint_builder=endpoint,
|
|
1524
|
+
topics=topics,
|
|
1525
|
+
topic_operators=topic_operators,
|
|
1526
|
+
page=page,
|
|
1527
|
+
offset=offset,
|
|
1528
|
+
_rate_limiter=rate_limiter,
|
|
1529
|
+
_retry=retry,
|
|
1530
|
+
_telemetry=telemetry,
|
|
1531
|
+
)
|
|
1532
|
+
finally:
|
|
1533
|
+
await http.aclose()
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
async def get_eth_price(
|
|
1537
|
+
*,
|
|
1538
|
+
api_kind: str,
|
|
1539
|
+
network: str,
|
|
1540
|
+
api_key: str,
|
|
1541
|
+
http: HttpClient | None = None,
|
|
1542
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1543
|
+
rate_limiter: RateLimiter | None = None,
|
|
1544
|
+
retry: RetryPolicy | None = None,
|
|
1545
|
+
cache: Cache | None = None,
|
|
1546
|
+
telemetry: Telemetry | None = None,
|
|
1547
|
+
) -> dict[str, Any]:
|
|
1548
|
+
"""Fetch ETH price via default adapter."""
|
|
1549
|
+
|
|
1550
|
+
from aiochainscan.services.stats import get_eth_price as get_eth_price_service
|
|
1551
|
+
|
|
1552
|
+
http = http or AiohttpClient()
|
|
1553
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1554
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1555
|
+
try:
|
|
1556
|
+
return await get_eth_price_service(
|
|
1557
|
+
api_kind=api_kind,
|
|
1558
|
+
network=network,
|
|
1559
|
+
api_key=api_key,
|
|
1560
|
+
http=http,
|
|
1561
|
+
_endpoint_builder=endpoint,
|
|
1562
|
+
_cache=cache,
|
|
1563
|
+
_rate_limiter=rate_limiter,
|
|
1564
|
+
_retry=retry,
|
|
1565
|
+
_telemetry=telemetry,
|
|
1566
|
+
)
|
|
1567
|
+
finally:
|
|
1568
|
+
await http.aclose()
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
async def get_daily_transaction_count(
|
|
1572
|
+
*,
|
|
1573
|
+
start_date: date,
|
|
1574
|
+
end_date: date,
|
|
1575
|
+
api_kind: str,
|
|
1576
|
+
network: str,
|
|
1577
|
+
api_key: str,
|
|
1578
|
+
sort: str | None = None,
|
|
1579
|
+
http: HttpClient | None = None,
|
|
1580
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1581
|
+
rate_limiter: RateLimiter | None = None,
|
|
1582
|
+
retry: RetryPolicy | None = None,
|
|
1583
|
+
telemetry: Telemetry | None = None,
|
|
1584
|
+
) -> list[dict[str, Any]]:
|
|
1585
|
+
"""Fetch daily transaction count via default adapter."""
|
|
1586
|
+
|
|
1587
|
+
from aiochainscan.services.stats import (
|
|
1588
|
+
get_daily_transaction_count as get_daily_transaction_count_service,
|
|
1589
|
+
)
|
|
1590
|
+
|
|
1591
|
+
http = http or AiohttpClient()
|
|
1592
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1593
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1594
|
+
try:
|
|
1595
|
+
return await get_daily_transaction_count_service(
|
|
1596
|
+
start_date=start_date,
|
|
1597
|
+
end_date=end_date,
|
|
1598
|
+
api_kind=api_kind,
|
|
1599
|
+
network=network,
|
|
1600
|
+
api_key=api_key,
|
|
1601
|
+
http=http,
|
|
1602
|
+
_endpoint_builder=endpoint,
|
|
1603
|
+
sort=sort,
|
|
1604
|
+
_rate_limiter=rate_limiter,
|
|
1605
|
+
_retry=retry,
|
|
1606
|
+
_telemetry=telemetry,
|
|
1607
|
+
)
|
|
1608
|
+
finally:
|
|
1609
|
+
await http.aclose()
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
async def get_daily_new_address_count(
|
|
1613
|
+
*,
|
|
1614
|
+
start_date: date,
|
|
1615
|
+
end_date: date,
|
|
1616
|
+
api_kind: str,
|
|
1617
|
+
network: str,
|
|
1618
|
+
api_key: str,
|
|
1619
|
+
sort: str | None = None,
|
|
1620
|
+
http: HttpClient | None = None,
|
|
1621
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1622
|
+
rate_limiter: RateLimiter | None = None,
|
|
1623
|
+
retry: RetryPolicy | None = None,
|
|
1624
|
+
telemetry: Telemetry | None = None,
|
|
1625
|
+
) -> list[dict[str, Any]]:
|
|
1626
|
+
"""Fetch daily new address count via default adapter."""
|
|
1627
|
+
|
|
1628
|
+
from aiochainscan.services.stats import (
|
|
1629
|
+
get_daily_new_address_count as get_daily_new_address_count_service,
|
|
1630
|
+
)
|
|
1631
|
+
|
|
1632
|
+
http = http or AiohttpClient()
|
|
1633
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1634
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1635
|
+
try:
|
|
1636
|
+
return await get_daily_new_address_count_service(
|
|
1637
|
+
start_date=start_date,
|
|
1638
|
+
end_date=end_date,
|
|
1639
|
+
api_kind=api_kind,
|
|
1640
|
+
network=network,
|
|
1641
|
+
api_key=api_key,
|
|
1642
|
+
http=http,
|
|
1643
|
+
_endpoint_builder=endpoint,
|
|
1644
|
+
sort=sort,
|
|
1645
|
+
_rate_limiter=rate_limiter,
|
|
1646
|
+
_retry=retry,
|
|
1647
|
+
_telemetry=telemetry,
|
|
1648
|
+
)
|
|
1649
|
+
finally:
|
|
1650
|
+
await http.aclose()
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
async def get_daily_network_tx_fee(
|
|
1654
|
+
*,
|
|
1655
|
+
start_date: date,
|
|
1656
|
+
end_date: date,
|
|
1657
|
+
api_kind: str,
|
|
1658
|
+
network: str,
|
|
1659
|
+
api_key: str,
|
|
1660
|
+
sort: str | None = None,
|
|
1661
|
+
http: HttpClient | None = None,
|
|
1662
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1663
|
+
rate_limiter: RateLimiter | None = None,
|
|
1664
|
+
retry: RetryPolicy | None = None,
|
|
1665
|
+
telemetry: Telemetry | None = None,
|
|
1666
|
+
) -> list[dict[str, Any]]:
|
|
1667
|
+
"""Fetch daily network transaction fee via default adapter."""
|
|
1668
|
+
|
|
1669
|
+
from aiochainscan.services.stats import (
|
|
1670
|
+
get_daily_network_tx_fee as get_daily_network_tx_fee_service,
|
|
1671
|
+
)
|
|
1672
|
+
|
|
1673
|
+
http = http or AiohttpClient()
|
|
1674
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1675
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1676
|
+
try:
|
|
1677
|
+
return await get_daily_network_tx_fee_service(
|
|
1678
|
+
start_date=start_date,
|
|
1679
|
+
end_date=end_date,
|
|
1680
|
+
api_kind=api_kind,
|
|
1681
|
+
network=network,
|
|
1682
|
+
api_key=api_key,
|
|
1683
|
+
http=http,
|
|
1684
|
+
_endpoint_builder=endpoint,
|
|
1685
|
+
sort=sort,
|
|
1686
|
+
_rate_limiter=rate_limiter,
|
|
1687
|
+
_retry=retry,
|
|
1688
|
+
_telemetry=telemetry,
|
|
1689
|
+
)
|
|
1690
|
+
finally:
|
|
1691
|
+
await http.aclose()
|
|
1692
|
+
|
|
1693
|
+
|
|
1694
|
+
async def get_daily_network_utilization(
|
|
1695
|
+
*,
|
|
1696
|
+
start_date: date,
|
|
1697
|
+
end_date: date,
|
|
1698
|
+
api_kind: str,
|
|
1699
|
+
network: str,
|
|
1700
|
+
api_key: str,
|
|
1701
|
+
sort: str | None = None,
|
|
1702
|
+
http: HttpClient | None = None,
|
|
1703
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1704
|
+
rate_limiter: RateLimiter | None = None,
|
|
1705
|
+
retry: RetryPolicy | None = None,
|
|
1706
|
+
telemetry: Telemetry | None = None,
|
|
1707
|
+
) -> list[dict[str, Any]]:
|
|
1708
|
+
"""Fetch daily network utilization via default adapter."""
|
|
1709
|
+
|
|
1710
|
+
from aiochainscan.services.stats import (
|
|
1711
|
+
get_daily_network_utilization as get_daily_network_utilization_service,
|
|
1712
|
+
)
|
|
1713
|
+
|
|
1714
|
+
http = http or AiohttpClient()
|
|
1715
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1716
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1717
|
+
try:
|
|
1718
|
+
return await get_daily_network_utilization_service(
|
|
1719
|
+
start_date=start_date,
|
|
1720
|
+
end_date=end_date,
|
|
1721
|
+
api_kind=api_kind,
|
|
1722
|
+
network=network,
|
|
1723
|
+
api_key=api_key,
|
|
1724
|
+
http=http,
|
|
1725
|
+
_endpoint_builder=endpoint,
|
|
1726
|
+
sort=sort,
|
|
1727
|
+
_rate_limiter=rate_limiter,
|
|
1728
|
+
_retry=retry,
|
|
1729
|
+
_telemetry=telemetry,
|
|
1730
|
+
)
|
|
1731
|
+
finally:
|
|
1732
|
+
await http.aclose()
|
|
1733
|
+
|
|
1734
|
+
|
|
1735
|
+
# Additional facade helpers for remaining daily series
|
|
1736
|
+
async def get_daily_average_block_size(
|
|
1737
|
+
*,
|
|
1738
|
+
start_date: date,
|
|
1739
|
+
end_date: date,
|
|
1740
|
+
api_kind: str,
|
|
1741
|
+
network: str,
|
|
1742
|
+
api_key: str,
|
|
1743
|
+
sort: str | None = None,
|
|
1744
|
+
http: HttpClient | None = None,
|
|
1745
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1746
|
+
rate_limiter: RateLimiter | None = None,
|
|
1747
|
+
retry: RetryPolicy | None = None,
|
|
1748
|
+
telemetry: Telemetry | None = None,
|
|
1749
|
+
) -> list[dict[str, Any]]:
|
|
1750
|
+
from aiochainscan.services.stats import get_daily_average_block_size as svc
|
|
1751
|
+
|
|
1752
|
+
http = http or AiohttpClient()
|
|
1753
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1754
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1755
|
+
try:
|
|
1756
|
+
return await svc(
|
|
1757
|
+
start_date=start_date,
|
|
1758
|
+
end_date=end_date,
|
|
1759
|
+
api_kind=api_kind,
|
|
1760
|
+
network=network,
|
|
1761
|
+
api_key=api_key,
|
|
1762
|
+
http=http,
|
|
1763
|
+
_endpoint_builder=endpoint,
|
|
1764
|
+
sort=sort,
|
|
1765
|
+
_rate_limiter=rate_limiter,
|
|
1766
|
+
_retry=retry,
|
|
1767
|
+
_telemetry=telemetry,
|
|
1768
|
+
)
|
|
1769
|
+
finally:
|
|
1770
|
+
await http.aclose()
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
async def get_daily_block_rewards(
|
|
1774
|
+
*,
|
|
1775
|
+
start_date: date,
|
|
1776
|
+
end_date: date,
|
|
1777
|
+
api_kind: str,
|
|
1778
|
+
network: str,
|
|
1779
|
+
api_key: str,
|
|
1780
|
+
sort: str | None = None,
|
|
1781
|
+
http: HttpClient | None = None,
|
|
1782
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1783
|
+
rate_limiter: RateLimiter | None = None,
|
|
1784
|
+
retry: RetryPolicy | None = None,
|
|
1785
|
+
telemetry: Telemetry | None = None,
|
|
1786
|
+
) -> list[dict[str, Any]]:
|
|
1787
|
+
from aiochainscan.services.stats import get_daily_block_rewards as svc
|
|
1788
|
+
|
|
1789
|
+
http = http or AiohttpClient()
|
|
1790
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1791
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1792
|
+
try:
|
|
1793
|
+
return await svc(
|
|
1794
|
+
start_date=start_date,
|
|
1795
|
+
end_date=end_date,
|
|
1796
|
+
api_kind=api_kind,
|
|
1797
|
+
network=network,
|
|
1798
|
+
api_key=api_key,
|
|
1799
|
+
http=http,
|
|
1800
|
+
_endpoint_builder=endpoint,
|
|
1801
|
+
sort=sort,
|
|
1802
|
+
_rate_limiter=rate_limiter,
|
|
1803
|
+
_retry=retry,
|
|
1804
|
+
_telemetry=telemetry,
|
|
1805
|
+
)
|
|
1806
|
+
finally:
|
|
1807
|
+
await http.aclose()
|
|
1808
|
+
|
|
1809
|
+
|
|
1810
|
+
async def get_daily_average_block_time(
|
|
1811
|
+
*,
|
|
1812
|
+
start_date: date,
|
|
1813
|
+
end_date: date,
|
|
1814
|
+
api_kind: str,
|
|
1815
|
+
network: str,
|
|
1816
|
+
api_key: str,
|
|
1817
|
+
sort: str | None = None,
|
|
1818
|
+
http: HttpClient | None = None,
|
|
1819
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1820
|
+
rate_limiter: RateLimiter | None = None,
|
|
1821
|
+
retry: RetryPolicy | None = None,
|
|
1822
|
+
telemetry: Telemetry | None = None,
|
|
1823
|
+
) -> list[dict[str, Any]]:
|
|
1824
|
+
from aiochainscan.services.stats import get_daily_average_block_time as svc
|
|
1825
|
+
|
|
1826
|
+
http = http or AiohttpClient()
|
|
1827
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1828
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1829
|
+
try:
|
|
1830
|
+
return await svc(
|
|
1831
|
+
start_date=start_date,
|
|
1832
|
+
end_date=end_date,
|
|
1833
|
+
api_kind=api_kind,
|
|
1834
|
+
network=network,
|
|
1835
|
+
api_key=api_key,
|
|
1836
|
+
http=http,
|
|
1837
|
+
_endpoint_builder=endpoint,
|
|
1838
|
+
sort=sort,
|
|
1839
|
+
_rate_limiter=rate_limiter,
|
|
1840
|
+
_retry=retry,
|
|
1841
|
+
_telemetry=telemetry,
|
|
1842
|
+
)
|
|
1843
|
+
finally:
|
|
1844
|
+
await http.aclose()
|
|
1845
|
+
|
|
1846
|
+
|
|
1847
|
+
async def get_daily_uncle_block_count(
|
|
1848
|
+
*,
|
|
1849
|
+
start_date: date,
|
|
1850
|
+
end_date: date,
|
|
1851
|
+
api_kind: str,
|
|
1852
|
+
network: str,
|
|
1853
|
+
api_key: str,
|
|
1854
|
+
sort: str | None = None,
|
|
1855
|
+
http: HttpClient | None = None,
|
|
1856
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1857
|
+
rate_limiter: RateLimiter | None = None,
|
|
1858
|
+
retry: RetryPolicy | None = None,
|
|
1859
|
+
telemetry: Telemetry | None = None,
|
|
1860
|
+
) -> list[dict[str, Any]]:
|
|
1861
|
+
from aiochainscan.services.stats import get_daily_uncle_block_count as svc
|
|
1862
|
+
|
|
1863
|
+
http = http or AiohttpClient()
|
|
1864
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1865
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1866
|
+
try:
|
|
1867
|
+
return await svc(
|
|
1868
|
+
start_date=start_date,
|
|
1869
|
+
end_date=end_date,
|
|
1870
|
+
api_kind=api_kind,
|
|
1871
|
+
network=network,
|
|
1872
|
+
api_key=api_key,
|
|
1873
|
+
http=http,
|
|
1874
|
+
_endpoint_builder=endpoint,
|
|
1875
|
+
sort=sort,
|
|
1876
|
+
_rate_limiter=rate_limiter,
|
|
1877
|
+
_retry=retry,
|
|
1878
|
+
_telemetry=telemetry,
|
|
1879
|
+
)
|
|
1880
|
+
finally:
|
|
1881
|
+
await http.aclose()
|
|
1882
|
+
|
|
1883
|
+
|
|
1884
|
+
async def get_daily_average_gas_limit(
|
|
1885
|
+
*,
|
|
1886
|
+
start_date: date,
|
|
1887
|
+
end_date: date,
|
|
1888
|
+
api_kind: str,
|
|
1889
|
+
network: str,
|
|
1890
|
+
api_key: str,
|
|
1891
|
+
sort: str | None = None,
|
|
1892
|
+
http: HttpClient | None = None,
|
|
1893
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1894
|
+
rate_limiter: RateLimiter | None = None,
|
|
1895
|
+
retry: RetryPolicy | None = None,
|
|
1896
|
+
telemetry: Telemetry | None = None,
|
|
1897
|
+
) -> list[dict[str, Any]]:
|
|
1898
|
+
from aiochainscan.services.stats import get_daily_average_gas_limit as svc
|
|
1899
|
+
|
|
1900
|
+
http = http or AiohttpClient()
|
|
1901
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1902
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1903
|
+
try:
|
|
1904
|
+
return await svc(
|
|
1905
|
+
start_date=start_date,
|
|
1906
|
+
end_date=end_date,
|
|
1907
|
+
api_kind=api_kind,
|
|
1908
|
+
network=network,
|
|
1909
|
+
api_key=api_key,
|
|
1910
|
+
http=http,
|
|
1911
|
+
_endpoint_builder=endpoint,
|
|
1912
|
+
sort=sort,
|
|
1913
|
+
_rate_limiter=rate_limiter,
|
|
1914
|
+
_retry=retry,
|
|
1915
|
+
_telemetry=telemetry,
|
|
1916
|
+
)
|
|
1917
|
+
finally:
|
|
1918
|
+
await http.aclose()
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
async def get_daily_total_gas_used(
|
|
1922
|
+
*,
|
|
1923
|
+
start_date: date,
|
|
1924
|
+
end_date: date,
|
|
1925
|
+
api_kind: str,
|
|
1926
|
+
network: str,
|
|
1927
|
+
api_key: str,
|
|
1928
|
+
sort: str | None = None,
|
|
1929
|
+
http: HttpClient | None = None,
|
|
1930
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1931
|
+
rate_limiter: RateLimiter | None = None,
|
|
1932
|
+
retry: RetryPolicy | None = None,
|
|
1933
|
+
telemetry: Telemetry | None = None,
|
|
1934
|
+
) -> list[dict[str, Any]]:
|
|
1935
|
+
from aiochainscan.services.stats import get_daily_total_gas_used as svc
|
|
1936
|
+
|
|
1937
|
+
http = http or AiohttpClient()
|
|
1938
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1939
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1940
|
+
try:
|
|
1941
|
+
return await svc(
|
|
1942
|
+
start_date=start_date,
|
|
1943
|
+
end_date=end_date,
|
|
1944
|
+
api_kind=api_kind,
|
|
1945
|
+
network=network,
|
|
1946
|
+
api_key=api_key,
|
|
1947
|
+
http=http,
|
|
1948
|
+
_endpoint_builder=endpoint,
|
|
1949
|
+
sort=sort,
|
|
1950
|
+
_rate_limiter=rate_limiter,
|
|
1951
|
+
_retry=retry,
|
|
1952
|
+
_telemetry=telemetry,
|
|
1953
|
+
)
|
|
1954
|
+
finally:
|
|
1955
|
+
await http.aclose()
|
|
1956
|
+
|
|
1957
|
+
|
|
1958
|
+
async def get_daily_average_gas_price(
|
|
1959
|
+
*,
|
|
1960
|
+
start_date: date,
|
|
1961
|
+
end_date: date,
|
|
1962
|
+
api_kind: str,
|
|
1963
|
+
network: str,
|
|
1964
|
+
api_key: str,
|
|
1965
|
+
sort: str | None = None,
|
|
1966
|
+
http: HttpClient | None = None,
|
|
1967
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
1968
|
+
rate_limiter: RateLimiter | None = None,
|
|
1969
|
+
retry: RetryPolicy | None = None,
|
|
1970
|
+
telemetry: Telemetry | None = None,
|
|
1971
|
+
) -> list[dict[str, Any]]:
|
|
1972
|
+
from aiochainscan.services.stats import get_daily_average_gas_price as svc
|
|
1973
|
+
|
|
1974
|
+
http = http or AiohttpClient()
|
|
1975
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
1976
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
1977
|
+
try:
|
|
1978
|
+
return await svc(
|
|
1979
|
+
start_date=start_date,
|
|
1980
|
+
end_date=end_date,
|
|
1981
|
+
api_kind=api_kind,
|
|
1982
|
+
network=network,
|
|
1983
|
+
api_key=api_key,
|
|
1984
|
+
http=http,
|
|
1985
|
+
_endpoint_builder=endpoint,
|
|
1986
|
+
sort=sort,
|
|
1987
|
+
_rate_limiter=rate_limiter,
|
|
1988
|
+
_retry=retry,
|
|
1989
|
+
_telemetry=telemetry,
|
|
1990
|
+
)
|
|
1991
|
+
finally:
|
|
1992
|
+
await http.aclose()
|
|
1993
|
+
|
|
1994
|
+
|
|
1995
|
+
async def get_daily_block_count(
|
|
1996
|
+
*,
|
|
1997
|
+
start_date: date,
|
|
1998
|
+
end_date: date,
|
|
1999
|
+
api_kind: str,
|
|
2000
|
+
network: str,
|
|
2001
|
+
api_key: str,
|
|
2002
|
+
sort: str | None = None,
|
|
2003
|
+
http: HttpClient | None = None,
|
|
2004
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2005
|
+
rate_limiter: RateLimiter | None = None,
|
|
2006
|
+
retry: RetryPolicy | None = None,
|
|
2007
|
+
telemetry: Telemetry | None = None,
|
|
2008
|
+
) -> list[dict[str, Any]]:
|
|
2009
|
+
from aiochainscan.services.stats import get_daily_block_count as svc
|
|
2010
|
+
|
|
2011
|
+
http = http or AiohttpClient()
|
|
2012
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2013
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2014
|
+
try:
|
|
2015
|
+
return await svc(
|
|
2016
|
+
start_date=start_date,
|
|
2017
|
+
end_date=end_date,
|
|
2018
|
+
api_kind=api_kind,
|
|
2019
|
+
network=network,
|
|
2020
|
+
api_key=api_key,
|
|
2021
|
+
http=http,
|
|
2022
|
+
_endpoint_builder=endpoint,
|
|
2023
|
+
sort=sort,
|
|
2024
|
+
_rate_limiter=rate_limiter,
|
|
2025
|
+
_retry=retry,
|
|
2026
|
+
_telemetry=telemetry,
|
|
2027
|
+
)
|
|
2028
|
+
finally:
|
|
2029
|
+
await http.aclose()
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
async def get_daily_average_network_hash_rate(
|
|
2033
|
+
*,
|
|
2034
|
+
start_date: date,
|
|
2035
|
+
end_date: date,
|
|
2036
|
+
api_kind: str,
|
|
2037
|
+
network: str,
|
|
2038
|
+
api_key: str,
|
|
2039
|
+
sort: str | None = None,
|
|
2040
|
+
http: HttpClient | None = None,
|
|
2041
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2042
|
+
rate_limiter: RateLimiter | None = None,
|
|
2043
|
+
retry: RetryPolicy | None = None,
|
|
2044
|
+
telemetry: Telemetry | None = None,
|
|
2045
|
+
) -> list[dict[str, Any]]:
|
|
2046
|
+
from aiochainscan.services.stats import get_daily_average_network_hash_rate as svc
|
|
2047
|
+
|
|
2048
|
+
http = http or AiohttpClient()
|
|
2049
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2050
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2051
|
+
try:
|
|
2052
|
+
return await svc(
|
|
2053
|
+
start_date=start_date,
|
|
2054
|
+
end_date=end_date,
|
|
2055
|
+
api_kind=api_kind,
|
|
2056
|
+
network=network,
|
|
2057
|
+
api_key=api_key,
|
|
2058
|
+
http=http,
|
|
2059
|
+
_endpoint_builder=endpoint,
|
|
2060
|
+
sort=sort,
|
|
2061
|
+
_rate_limiter=rate_limiter,
|
|
2062
|
+
_retry=retry,
|
|
2063
|
+
_telemetry=telemetry,
|
|
2064
|
+
)
|
|
2065
|
+
finally:
|
|
2066
|
+
await http.aclose()
|
|
2067
|
+
|
|
2068
|
+
|
|
2069
|
+
async def get_daily_average_network_difficulty(
|
|
2070
|
+
*,
|
|
2071
|
+
start_date: date,
|
|
2072
|
+
end_date: date,
|
|
2073
|
+
api_kind: str,
|
|
2074
|
+
network: str,
|
|
2075
|
+
api_key: str,
|
|
2076
|
+
sort: str | None = None,
|
|
2077
|
+
http: HttpClient | None = None,
|
|
2078
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2079
|
+
rate_limiter: RateLimiter | None = None,
|
|
2080
|
+
retry: RetryPolicy | None = None,
|
|
2081
|
+
telemetry: Telemetry | None = None,
|
|
2082
|
+
) -> list[dict[str, Any]]:
|
|
2083
|
+
from aiochainscan.services.stats import get_daily_average_network_difficulty as svc
|
|
2084
|
+
|
|
2085
|
+
http = http or AiohttpClient()
|
|
2086
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2087
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2088
|
+
try:
|
|
2089
|
+
return await svc(
|
|
2090
|
+
start_date=start_date,
|
|
2091
|
+
end_date=end_date,
|
|
2092
|
+
api_kind=api_kind,
|
|
2093
|
+
network=network,
|
|
2094
|
+
api_key=api_key,
|
|
2095
|
+
http=http,
|
|
2096
|
+
_endpoint_builder=endpoint,
|
|
2097
|
+
sort=sort,
|
|
2098
|
+
_rate_limiter=rate_limiter,
|
|
2099
|
+
_retry=retry,
|
|
2100
|
+
_telemetry=telemetry,
|
|
2101
|
+
)
|
|
2102
|
+
finally:
|
|
2103
|
+
await http.aclose()
|
|
2104
|
+
|
|
2105
|
+
|
|
2106
|
+
async def get_ether_historical_daily_market_cap(
|
|
2107
|
+
*,
|
|
2108
|
+
start_date: date,
|
|
2109
|
+
end_date: date,
|
|
2110
|
+
api_kind: str,
|
|
2111
|
+
network: str,
|
|
2112
|
+
api_key: str,
|
|
2113
|
+
sort: str | None = None,
|
|
2114
|
+
http: HttpClient | None = None,
|
|
2115
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2116
|
+
rate_limiter: RateLimiter | None = None,
|
|
2117
|
+
retry: RetryPolicy | None = None,
|
|
2118
|
+
telemetry: Telemetry | None = None,
|
|
2119
|
+
) -> list[dict[str, Any]]:
|
|
2120
|
+
from aiochainscan.services.stats import get_ether_historical_daily_market_cap as svc
|
|
2121
|
+
|
|
2122
|
+
http = http or AiohttpClient()
|
|
2123
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2124
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2125
|
+
try:
|
|
2126
|
+
return await svc(
|
|
2127
|
+
start_date=start_date,
|
|
2128
|
+
end_date=end_date,
|
|
2129
|
+
api_kind=api_kind,
|
|
2130
|
+
network=network,
|
|
2131
|
+
api_key=api_key,
|
|
2132
|
+
http=http,
|
|
2133
|
+
_endpoint_builder=endpoint,
|
|
2134
|
+
sort=sort,
|
|
2135
|
+
_rate_limiter=rate_limiter,
|
|
2136
|
+
_retry=retry,
|
|
2137
|
+
_telemetry=telemetry,
|
|
2138
|
+
)
|
|
2139
|
+
finally:
|
|
2140
|
+
await http.aclose()
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
async def get_ether_historical_price(
|
|
2144
|
+
*,
|
|
2145
|
+
start_date: date,
|
|
2146
|
+
end_date: date,
|
|
2147
|
+
api_kind: str,
|
|
2148
|
+
network: str,
|
|
2149
|
+
api_key: str,
|
|
2150
|
+
sort: str | None = None,
|
|
2151
|
+
http: HttpClient | None = None,
|
|
2152
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2153
|
+
rate_limiter: RateLimiter | None = None,
|
|
2154
|
+
retry: RetryPolicy | None = None,
|
|
2155
|
+
telemetry: Telemetry | None = None,
|
|
2156
|
+
) -> list[dict[str, Any]]:
|
|
2157
|
+
from aiochainscan.services.stats import get_ether_historical_price as svc
|
|
2158
|
+
|
|
2159
|
+
http = http or AiohttpClient()
|
|
2160
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2161
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2162
|
+
try:
|
|
2163
|
+
return await svc(
|
|
2164
|
+
start_date=start_date,
|
|
2165
|
+
end_date=end_date,
|
|
2166
|
+
api_kind=api_kind,
|
|
2167
|
+
network=network,
|
|
2168
|
+
api_key=api_key,
|
|
2169
|
+
http=http,
|
|
2170
|
+
_endpoint_builder=endpoint,
|
|
2171
|
+
sort=sort,
|
|
2172
|
+
_rate_limiter=rate_limiter,
|
|
2173
|
+
_retry=retry,
|
|
2174
|
+
_telemetry=telemetry,
|
|
2175
|
+
)
|
|
2176
|
+
finally:
|
|
2177
|
+
await http.aclose()
|
|
2178
|
+
|
|
2179
|
+
|
|
2180
|
+
async def get_block_number(
|
|
2181
|
+
*,
|
|
2182
|
+
api_kind: str,
|
|
2183
|
+
network: str,
|
|
2184
|
+
api_key: str,
|
|
2185
|
+
http: HttpClient | None = None,
|
|
2186
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2187
|
+
rate_limiter: RateLimiter | None = None,
|
|
2188
|
+
retry: RetryPolicy | None = None,
|
|
2189
|
+
telemetry: Telemetry | None = None,
|
|
2190
|
+
) -> str:
|
|
2191
|
+
"""Fetch latest block number via default adapter."""
|
|
2192
|
+
|
|
2193
|
+
http = http or AiohttpClient()
|
|
2194
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2195
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2196
|
+
try:
|
|
2197
|
+
return await get_block_number_service(
|
|
2198
|
+
api_kind=api_kind,
|
|
2199
|
+
network=network,
|
|
2200
|
+
api_key=api_key,
|
|
2201
|
+
http=http,
|
|
2202
|
+
_endpoint_builder=endpoint,
|
|
2203
|
+
_rate_limiter=rate_limiter,
|
|
2204
|
+
_retry=retry,
|
|
2205
|
+
_telemetry=telemetry,
|
|
2206
|
+
)
|
|
2207
|
+
finally:
|
|
2208
|
+
await http.aclose()
|
|
2209
|
+
|
|
2210
|
+
|
|
2211
|
+
async def get_gas_price(
|
|
2212
|
+
*,
|
|
2213
|
+
api_kind: str,
|
|
2214
|
+
network: str,
|
|
2215
|
+
api_key: str,
|
|
2216
|
+
http: HttpClient | None = None,
|
|
2217
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2218
|
+
rate_limiter: RateLimiter | None = None,
|
|
2219
|
+
retry: RetryPolicy | None = None,
|
|
2220
|
+
telemetry: Telemetry | None = None,
|
|
2221
|
+
) -> str:
|
|
2222
|
+
http = http or AiohttpClient()
|
|
2223
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2224
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2225
|
+
try:
|
|
2226
|
+
return await get_gas_price_service(
|
|
2227
|
+
api_kind=api_kind,
|
|
2228
|
+
network=network,
|
|
2229
|
+
api_key=api_key,
|
|
2230
|
+
http=http,
|
|
2231
|
+
_endpoint_builder=endpoint,
|
|
2232
|
+
_rate_limiter=rate_limiter,
|
|
2233
|
+
_retry=retry,
|
|
2234
|
+
_telemetry=telemetry,
|
|
2235
|
+
)
|
|
2236
|
+
finally:
|
|
2237
|
+
await http.aclose()
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
async def get_tx_count(
|
|
2241
|
+
*,
|
|
2242
|
+
address: str,
|
|
2243
|
+
tag: int | str,
|
|
2244
|
+
api_kind: str,
|
|
2245
|
+
network: str,
|
|
2246
|
+
api_key: str,
|
|
2247
|
+
http: HttpClient | None = None,
|
|
2248
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2249
|
+
rate_limiter: RateLimiter | None = None,
|
|
2250
|
+
retry: RetryPolicy | None = None,
|
|
2251
|
+
telemetry: Telemetry | None = None,
|
|
2252
|
+
) -> str:
|
|
2253
|
+
http = http or AiohttpClient()
|
|
2254
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2255
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2256
|
+
try:
|
|
2257
|
+
return await get_tx_count_service(
|
|
2258
|
+
address=address,
|
|
2259
|
+
tag=tag,
|
|
2260
|
+
api_kind=api_kind,
|
|
2261
|
+
network=network,
|
|
2262
|
+
api_key=api_key,
|
|
2263
|
+
http=http,
|
|
2264
|
+
_endpoint_builder=endpoint,
|
|
2265
|
+
_rate_limiter=rate_limiter,
|
|
2266
|
+
_retry=retry,
|
|
2267
|
+
_telemetry=telemetry,
|
|
2268
|
+
)
|
|
2269
|
+
finally:
|
|
2270
|
+
await http.aclose()
|
|
2271
|
+
|
|
2272
|
+
|
|
2273
|
+
async def get_code(
|
|
2274
|
+
*,
|
|
2275
|
+
address: str,
|
|
2276
|
+
tag: int | str,
|
|
2277
|
+
api_kind: str,
|
|
2278
|
+
network: str,
|
|
2279
|
+
api_key: str,
|
|
2280
|
+
http: HttpClient | None = None,
|
|
2281
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2282
|
+
rate_limiter: RateLimiter | None = None,
|
|
2283
|
+
retry: RetryPolicy | None = None,
|
|
2284
|
+
telemetry: Telemetry | None = None,
|
|
2285
|
+
) -> str:
|
|
2286
|
+
http = http or AiohttpClient()
|
|
2287
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2288
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2289
|
+
try:
|
|
2290
|
+
return await get_code_service(
|
|
2291
|
+
address=address,
|
|
2292
|
+
tag=tag,
|
|
2293
|
+
api_kind=api_kind,
|
|
2294
|
+
network=network,
|
|
2295
|
+
api_key=api_key,
|
|
2296
|
+
http=http,
|
|
2297
|
+
_endpoint_builder=endpoint,
|
|
2298
|
+
_rate_limiter=rate_limiter,
|
|
2299
|
+
_retry=retry,
|
|
2300
|
+
_telemetry=telemetry,
|
|
2301
|
+
)
|
|
2302
|
+
finally:
|
|
2303
|
+
await http.aclose()
|
|
2304
|
+
|
|
2305
|
+
|
|
2306
|
+
async def eth_call(
|
|
2307
|
+
*,
|
|
2308
|
+
to: str,
|
|
2309
|
+
data: str,
|
|
2310
|
+
tag: int | str,
|
|
2311
|
+
api_kind: str,
|
|
2312
|
+
network: str,
|
|
2313
|
+
api_key: str,
|
|
2314
|
+
http: HttpClient | None = None,
|
|
2315
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2316
|
+
rate_limiter: RateLimiter | None = None,
|
|
2317
|
+
retry: RetryPolicy | None = None,
|
|
2318
|
+
telemetry: Telemetry | None = None,
|
|
2319
|
+
) -> str:
|
|
2320
|
+
http = http or AiohttpClient()
|
|
2321
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2322
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2323
|
+
try:
|
|
2324
|
+
return await eth_call_service(
|
|
2325
|
+
to=to,
|
|
2326
|
+
data=data,
|
|
2327
|
+
tag=tag,
|
|
2328
|
+
api_kind=api_kind,
|
|
2329
|
+
network=network,
|
|
2330
|
+
api_key=api_key,
|
|
2331
|
+
http=http,
|
|
2332
|
+
_endpoint_builder=endpoint,
|
|
2333
|
+
_rate_limiter=rate_limiter,
|
|
2334
|
+
_retry=retry,
|
|
2335
|
+
_telemetry=telemetry,
|
|
2336
|
+
)
|
|
2337
|
+
finally:
|
|
2338
|
+
await http.aclose()
|
|
2339
|
+
|
|
2340
|
+
|
|
2341
|
+
async def get_storage_at(
|
|
2342
|
+
*,
|
|
2343
|
+
address: str,
|
|
2344
|
+
position: str,
|
|
2345
|
+
tag: int | str,
|
|
2346
|
+
api_kind: str,
|
|
2347
|
+
network: str,
|
|
2348
|
+
api_key: str,
|
|
2349
|
+
http: HttpClient | None = None,
|
|
2350
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2351
|
+
rate_limiter: RateLimiter | None = None,
|
|
2352
|
+
retry: RetryPolicy | None = None,
|
|
2353
|
+
telemetry: Telemetry | None = None,
|
|
2354
|
+
) -> str:
|
|
2355
|
+
http = http or AiohttpClient()
|
|
2356
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2357
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2358
|
+
try:
|
|
2359
|
+
return await get_storage_at_service(
|
|
2360
|
+
address=address,
|
|
2361
|
+
position=position,
|
|
2362
|
+
tag=tag,
|
|
2363
|
+
api_kind=api_kind,
|
|
2364
|
+
network=network,
|
|
2365
|
+
api_key=api_key,
|
|
2366
|
+
http=http,
|
|
2367
|
+
_endpoint_builder=endpoint,
|
|
2368
|
+
_rate_limiter=rate_limiter,
|
|
2369
|
+
_retry=retry,
|
|
2370
|
+
_telemetry=telemetry,
|
|
2371
|
+
)
|
|
2372
|
+
finally:
|
|
2373
|
+
await http.aclose()
|
|
2374
|
+
|
|
2375
|
+
|
|
2376
|
+
async def get_block_tx_count_by_number(
|
|
2377
|
+
*,
|
|
2378
|
+
tag: int | str,
|
|
2379
|
+
api_kind: str,
|
|
2380
|
+
network: str,
|
|
2381
|
+
api_key: str,
|
|
2382
|
+
http: HttpClient | None = None,
|
|
2383
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2384
|
+
rate_limiter: RateLimiter | None = None,
|
|
2385
|
+
retry: RetryPolicy | None = None,
|
|
2386
|
+
telemetry: Telemetry | None = None,
|
|
2387
|
+
) -> str:
|
|
2388
|
+
http = http or AiohttpClient()
|
|
2389
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2390
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2391
|
+
try:
|
|
2392
|
+
return await get_block_tx_count_by_number_service(
|
|
2393
|
+
tag=tag,
|
|
2394
|
+
api_kind=api_kind,
|
|
2395
|
+
network=network,
|
|
2396
|
+
api_key=api_key,
|
|
2397
|
+
http=http,
|
|
2398
|
+
_endpoint_builder=endpoint,
|
|
2399
|
+
_rate_limiter=rate_limiter,
|
|
2400
|
+
_retry=retry,
|
|
2401
|
+
_telemetry=telemetry,
|
|
2402
|
+
)
|
|
2403
|
+
finally:
|
|
2404
|
+
await http.aclose()
|
|
2405
|
+
|
|
2406
|
+
|
|
2407
|
+
async def get_tx_by_block_number_and_index(
|
|
2408
|
+
*,
|
|
2409
|
+
tag: int | str,
|
|
2410
|
+
index: int | str,
|
|
2411
|
+
api_kind: str,
|
|
2412
|
+
network: str,
|
|
2413
|
+
api_key: str,
|
|
2414
|
+
http: HttpClient | None = None,
|
|
2415
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2416
|
+
rate_limiter: RateLimiter | None = None,
|
|
2417
|
+
retry: RetryPolicy | None = None,
|
|
2418
|
+
telemetry: Telemetry | None = None,
|
|
2419
|
+
) -> dict[str, Any]:
|
|
2420
|
+
http = http or AiohttpClient()
|
|
2421
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2422
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2423
|
+
try:
|
|
2424
|
+
return await get_tx_by_block_number_and_index_service(
|
|
2425
|
+
tag=tag,
|
|
2426
|
+
index=index,
|
|
2427
|
+
api_kind=api_kind,
|
|
2428
|
+
network=network,
|
|
2429
|
+
api_key=api_key,
|
|
2430
|
+
http=http,
|
|
2431
|
+
_endpoint_builder=endpoint,
|
|
2432
|
+
_rate_limiter=rate_limiter,
|
|
2433
|
+
_retry=retry,
|
|
2434
|
+
_telemetry=telemetry,
|
|
2435
|
+
)
|
|
2436
|
+
finally:
|
|
2437
|
+
await http.aclose()
|
|
2438
|
+
|
|
2439
|
+
|
|
2440
|
+
async def get_uncle_by_block_number_and_index(
|
|
2441
|
+
*,
|
|
2442
|
+
tag: int | str,
|
|
2443
|
+
index: int | str,
|
|
2444
|
+
api_kind: str,
|
|
2445
|
+
network: str,
|
|
2446
|
+
api_key: str,
|
|
2447
|
+
http: HttpClient | None = None,
|
|
2448
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2449
|
+
rate_limiter: RateLimiter | None = None,
|
|
2450
|
+
retry: RetryPolicy | None = None,
|
|
2451
|
+
telemetry: Telemetry | None = None,
|
|
2452
|
+
) -> dict[str, Any]:
|
|
2453
|
+
http = http or AiohttpClient()
|
|
2454
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2455
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2456
|
+
try:
|
|
2457
|
+
return await get_uncle_by_block_number_and_index_service(
|
|
2458
|
+
tag=tag,
|
|
2459
|
+
index=index,
|
|
2460
|
+
api_kind=api_kind,
|
|
2461
|
+
network=network,
|
|
2462
|
+
api_key=api_key,
|
|
2463
|
+
http=http,
|
|
2464
|
+
_endpoint_builder=endpoint,
|
|
2465
|
+
_rate_limiter=rate_limiter,
|
|
2466
|
+
_retry=retry,
|
|
2467
|
+
_telemetry=telemetry,
|
|
2468
|
+
)
|
|
2469
|
+
finally:
|
|
2470
|
+
await http.aclose()
|
|
2471
|
+
|
|
2472
|
+
|
|
2473
|
+
async def estimate_gas(
|
|
2474
|
+
*,
|
|
2475
|
+
to: str,
|
|
2476
|
+
value: str,
|
|
2477
|
+
gas_price: str,
|
|
2478
|
+
gas: str,
|
|
2479
|
+
api_kind: str,
|
|
2480
|
+
network: str,
|
|
2481
|
+
api_key: str,
|
|
2482
|
+
http: HttpClient | None = None,
|
|
2483
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2484
|
+
rate_limiter: RateLimiter | None = None,
|
|
2485
|
+
retry: RetryPolicy | None = None,
|
|
2486
|
+
telemetry: Telemetry | None = None,
|
|
2487
|
+
) -> str:
|
|
2488
|
+
http = http or AiohttpClient()
|
|
2489
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2490
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2491
|
+
try:
|
|
2492
|
+
return await estimate_gas_service(
|
|
2493
|
+
to=to,
|
|
2494
|
+
value=value,
|
|
2495
|
+
gas_price=gas_price,
|
|
2496
|
+
gas=gas,
|
|
2497
|
+
api_kind=api_kind,
|
|
2498
|
+
network=network,
|
|
2499
|
+
api_key=api_key,
|
|
2500
|
+
http=http,
|
|
2501
|
+
_endpoint_builder=endpoint,
|
|
2502
|
+
_rate_limiter=rate_limiter,
|
|
2503
|
+
_retry=retry,
|
|
2504
|
+
_telemetry=telemetry,
|
|
2505
|
+
)
|
|
2506
|
+
finally:
|
|
2507
|
+
await http.aclose()
|
|
2508
|
+
|
|
2509
|
+
|
|
2510
|
+
async def send_raw_tx(
|
|
2511
|
+
*,
|
|
2512
|
+
raw_hex: str,
|
|
2513
|
+
api_kind: str,
|
|
2514
|
+
network: str,
|
|
2515
|
+
api_key: str,
|
|
2516
|
+
http: HttpClient | None = None,
|
|
2517
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2518
|
+
rate_limiter: RateLimiter | None = None,
|
|
2519
|
+
retry: RetryPolicy | None = None,
|
|
2520
|
+
telemetry: Telemetry | None = None,
|
|
2521
|
+
) -> dict[str, Any]:
|
|
2522
|
+
http = http or AiohttpClient()
|
|
2523
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2524
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2525
|
+
try:
|
|
2526
|
+
return await send_raw_tx_service(
|
|
2527
|
+
raw_hex=raw_hex,
|
|
2528
|
+
api_kind=api_kind,
|
|
2529
|
+
network=network,
|
|
2530
|
+
api_key=api_key,
|
|
2531
|
+
http=http,
|
|
2532
|
+
_endpoint_builder=endpoint,
|
|
2533
|
+
_rate_limiter=rate_limiter,
|
|
2534
|
+
_retry=retry,
|
|
2535
|
+
_telemetry=telemetry,
|
|
2536
|
+
)
|
|
2537
|
+
finally:
|
|
2538
|
+
await http.aclose()
|
|
2539
|
+
|
|
2540
|
+
|
|
2541
|
+
async def get_tx_receipt(
|
|
2542
|
+
*,
|
|
2543
|
+
txhash: str,
|
|
2544
|
+
api_kind: str,
|
|
2545
|
+
network: str,
|
|
2546
|
+
api_key: str,
|
|
2547
|
+
http: HttpClient | None = None,
|
|
2548
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2549
|
+
rate_limiter: RateLimiter | None = None,
|
|
2550
|
+
retry: RetryPolicy | None = None,
|
|
2551
|
+
telemetry: Telemetry | None = None,
|
|
2552
|
+
) -> dict[str, Any]:
|
|
2553
|
+
http = http or AiohttpClient()
|
|
2554
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2555
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2556
|
+
try:
|
|
2557
|
+
return await get_tx_receipt_service(
|
|
2558
|
+
txhash=txhash,
|
|
2559
|
+
api_kind=api_kind,
|
|
2560
|
+
network=network,
|
|
2561
|
+
api_key=api_key,
|
|
2562
|
+
http=http,
|
|
2563
|
+
_endpoint_builder=endpoint,
|
|
2564
|
+
_rate_limiter=rate_limiter,
|
|
2565
|
+
_retry=retry,
|
|
2566
|
+
_telemetry=telemetry,
|
|
2567
|
+
)
|
|
2568
|
+
finally:
|
|
2569
|
+
await http.aclose()
|
|
2570
|
+
|
|
2571
|
+
|
|
2572
|
+
async def get_contract_abi(
|
|
2573
|
+
*,
|
|
2574
|
+
address: str,
|
|
2575
|
+
api_kind: str,
|
|
2576
|
+
network: str,
|
|
2577
|
+
api_key: str,
|
|
2578
|
+
http: HttpClient | None = None,
|
|
2579
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2580
|
+
rate_limiter: RateLimiter | None = None,
|
|
2581
|
+
retry: RetryPolicy | None = None,
|
|
2582
|
+
telemetry: Telemetry | None = None,
|
|
2583
|
+
) -> str:
|
|
2584
|
+
http = http or AiohttpClient()
|
|
2585
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2586
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2587
|
+
try:
|
|
2588
|
+
return await get_contract_abi_service(
|
|
2589
|
+
address=address,
|
|
2590
|
+
api_kind=api_kind,
|
|
2591
|
+
network=network,
|
|
2592
|
+
api_key=api_key,
|
|
2593
|
+
http=http,
|
|
2594
|
+
_endpoint_builder=endpoint,
|
|
2595
|
+
_rate_limiter=rate_limiter,
|
|
2596
|
+
_retry=retry,
|
|
2597
|
+
_telemetry=telemetry,
|
|
2598
|
+
)
|
|
2599
|
+
finally:
|
|
2600
|
+
await http.aclose()
|
|
2601
|
+
|
|
2602
|
+
|
|
2603
|
+
async def get_contract_source_code(
|
|
2604
|
+
*,
|
|
2605
|
+
address: str,
|
|
2606
|
+
api_kind: str,
|
|
2607
|
+
network: str,
|
|
2608
|
+
api_key: str,
|
|
2609
|
+
http: HttpClient | None = None,
|
|
2610
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2611
|
+
rate_limiter: RateLimiter | None = None,
|
|
2612
|
+
retry: RetryPolicy | None = None,
|
|
2613
|
+
telemetry: Telemetry | None = None,
|
|
2614
|
+
) -> list[dict[str, Any]]:
|
|
2615
|
+
http = http or AiohttpClient()
|
|
2616
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2617
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2618
|
+
try:
|
|
2619
|
+
return await get_contract_source_code_service(
|
|
2620
|
+
address=address,
|
|
2621
|
+
api_kind=api_kind,
|
|
2622
|
+
network=network,
|
|
2623
|
+
api_key=api_key,
|
|
2624
|
+
http=http,
|
|
2625
|
+
_endpoint_builder=endpoint,
|
|
2626
|
+
_rate_limiter=rate_limiter,
|
|
2627
|
+
_retry=retry,
|
|
2628
|
+
_telemetry=telemetry,
|
|
2629
|
+
)
|
|
2630
|
+
finally:
|
|
2631
|
+
await http.aclose()
|
|
2632
|
+
|
|
2633
|
+
|
|
2634
|
+
async def verify_contract_source_code(
|
|
2635
|
+
*,
|
|
2636
|
+
contract_address: str,
|
|
2637
|
+
source_code: str,
|
|
2638
|
+
contract_name: str,
|
|
2639
|
+
compiler_version: str,
|
|
2640
|
+
optimization_used: bool,
|
|
2641
|
+
runs: int,
|
|
2642
|
+
constructor_arguements: str,
|
|
2643
|
+
api_kind: str,
|
|
2644
|
+
network: str,
|
|
2645
|
+
api_key: str,
|
|
2646
|
+
) -> dict[str, Any]:
|
|
2647
|
+
http: HttpClient | None = None
|
|
2648
|
+
endpoint: EndpointBuilder | None = None
|
|
2649
|
+
telemetry: Telemetry | None = None
|
|
2650
|
+
http = http or AiohttpClient()
|
|
2651
|
+
endpoint = endpoint or UrlBuilderEndpoint()
|
|
2652
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2653
|
+
try:
|
|
2654
|
+
return await verify_contract_source_code_service(
|
|
2655
|
+
contract_address=contract_address,
|
|
2656
|
+
source_code=source_code,
|
|
2657
|
+
contract_name=contract_name,
|
|
2658
|
+
compiler_version=compiler_version,
|
|
2659
|
+
optimization_used=optimization_used,
|
|
2660
|
+
runs=runs,
|
|
2661
|
+
constructor_arguements=constructor_arguements,
|
|
2662
|
+
api_kind=api_kind,
|
|
2663
|
+
network=network,
|
|
2664
|
+
api_key=api_key,
|
|
2665
|
+
http=http,
|
|
2666
|
+
_endpoint_builder=endpoint,
|
|
2667
|
+
_telemetry=telemetry,
|
|
2668
|
+
)
|
|
2669
|
+
finally:
|
|
2670
|
+
await http.aclose()
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
async def check_verification_status(
|
|
2674
|
+
*,
|
|
2675
|
+
guid: str,
|
|
2676
|
+
api_kind: str,
|
|
2677
|
+
network: str,
|
|
2678
|
+
api_key: str,
|
|
2679
|
+
http: HttpClient | None = None,
|
|
2680
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2681
|
+
rate_limiter: RateLimiter | None = None,
|
|
2682
|
+
retry: RetryPolicy | None = None,
|
|
2683
|
+
telemetry: Telemetry | None = None,
|
|
2684
|
+
) -> dict[str, Any]:
|
|
2685
|
+
http = http or AiohttpClient()
|
|
2686
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2687
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2688
|
+
try:
|
|
2689
|
+
return await check_verification_status_service(
|
|
2690
|
+
guid=guid,
|
|
2691
|
+
api_kind=api_kind,
|
|
2692
|
+
network=network,
|
|
2693
|
+
api_key=api_key,
|
|
2694
|
+
http=http,
|
|
2695
|
+
_endpoint_builder=endpoint,
|
|
2696
|
+
_rate_limiter=rate_limiter,
|
|
2697
|
+
_retry=retry,
|
|
2698
|
+
_telemetry=telemetry,
|
|
2699
|
+
)
|
|
2700
|
+
finally:
|
|
2701
|
+
await http.aclose()
|
|
2702
|
+
|
|
2703
|
+
|
|
2704
|
+
async def verify_proxy_contract(
|
|
2705
|
+
*,
|
|
2706
|
+
address: str,
|
|
2707
|
+
expected_implementation: str | None,
|
|
2708
|
+
api_kind: str,
|
|
2709
|
+
network: str,
|
|
2710
|
+
api_key: str,
|
|
2711
|
+
http: HttpClient | None = None,
|
|
2712
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2713
|
+
rate_limiter: RateLimiter | None = None,
|
|
2714
|
+
retry: RetryPolicy | None = None,
|
|
2715
|
+
telemetry: Telemetry | None = None,
|
|
2716
|
+
) -> dict[str, Any]:
|
|
2717
|
+
http = http or AiohttpClient()
|
|
2718
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2719
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2720
|
+
try:
|
|
2721
|
+
return await verify_proxy_contract_service(
|
|
2722
|
+
address=address,
|
|
2723
|
+
expected_implementation=expected_implementation,
|
|
2724
|
+
api_kind=api_kind,
|
|
2725
|
+
network=network,
|
|
2726
|
+
api_key=api_key,
|
|
2727
|
+
http=http,
|
|
2728
|
+
_endpoint_builder=endpoint,
|
|
2729
|
+
_rate_limiter=rate_limiter,
|
|
2730
|
+
_retry=retry,
|
|
2731
|
+
_telemetry=telemetry,
|
|
2732
|
+
)
|
|
2733
|
+
finally:
|
|
2734
|
+
await http.aclose()
|
|
2735
|
+
|
|
2736
|
+
|
|
2737
|
+
async def check_proxy_contract_verification(
|
|
2738
|
+
*,
|
|
2739
|
+
guid: str,
|
|
2740
|
+
api_kind: str,
|
|
2741
|
+
network: str,
|
|
2742
|
+
api_key: str,
|
|
2743
|
+
http: HttpClient | None = None,
|
|
2744
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2745
|
+
rate_limiter: RateLimiter | None = None,
|
|
2746
|
+
retry: RetryPolicy | None = None,
|
|
2747
|
+
telemetry: Telemetry | None = None,
|
|
2748
|
+
) -> dict[str, Any]:
|
|
2749
|
+
http = http or AiohttpClient()
|
|
2750
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2751
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2752
|
+
try:
|
|
2753
|
+
return await check_proxy_contract_verification_service(
|
|
2754
|
+
guid=guid,
|
|
2755
|
+
api_kind=api_kind,
|
|
2756
|
+
network=network,
|
|
2757
|
+
api_key=api_key,
|
|
2758
|
+
http=http,
|
|
2759
|
+
_endpoint_builder=endpoint,
|
|
2760
|
+
_rate_limiter=rate_limiter,
|
|
2761
|
+
_retry=retry,
|
|
2762
|
+
_telemetry=telemetry,
|
|
2763
|
+
)
|
|
2764
|
+
finally:
|
|
2765
|
+
await http.aclose()
|
|
2766
|
+
|
|
2767
|
+
|
|
2768
|
+
async def get_contract_creation(
|
|
2769
|
+
*,
|
|
2770
|
+
contract_addresses: list[str],
|
|
2771
|
+
api_kind: str,
|
|
2772
|
+
network: str,
|
|
2773
|
+
api_key: str,
|
|
2774
|
+
http: HttpClient | None = None,
|
|
2775
|
+
endpoint_builder: EndpointBuilder | None = None,
|
|
2776
|
+
rate_limiter: RateLimiter | None = None,
|
|
2777
|
+
retry: RetryPolicy | None = None,
|
|
2778
|
+
telemetry: Telemetry | None = None,
|
|
2779
|
+
) -> list[dict[str, Any]]:
|
|
2780
|
+
http = http or AiohttpClient()
|
|
2781
|
+
endpoint = endpoint_builder or UrlBuilderEndpoint()
|
|
2782
|
+
telemetry = telemetry or StructlogTelemetry()
|
|
2783
|
+
try:
|
|
2784
|
+
return await get_contract_creation_service(
|
|
2785
|
+
contract_addresses=contract_addresses,
|
|
2786
|
+
api_kind=api_kind,
|
|
2787
|
+
network=network,
|
|
2788
|
+
api_key=api_key,
|
|
2789
|
+
http=http,
|
|
2790
|
+
_endpoint_builder=endpoint,
|
|
2791
|
+
_rate_limiter=rate_limiter,
|
|
2792
|
+
_retry=retry,
|
|
2793
|
+
_telemetry=telemetry,
|
|
2794
|
+
)
|
|
2795
|
+
finally:
|
|
2796
|
+
await http.aclose()
|
|
2797
|
+
|
|
2798
|
+
|
|
2799
|
+
class _DefaultSession:
|
|
2800
|
+
def __init__(self, http: HttpClient, endpoint: EndpointBuilder, telemetry: Telemetry) -> None:
|
|
2801
|
+
self.http = http
|
|
2802
|
+
self.endpoint = endpoint
|
|
2803
|
+
self.telemetry = telemetry
|
|
2804
|
+
|
|
2805
|
+
async def aclose(self) -> None:
|
|
2806
|
+
await self.http.aclose()
|
|
2807
|
+
|
|
2808
|
+
|
|
2809
|
+
async def open_default_session() -> _DefaultSession:
|
|
2810
|
+
"""Open a reusable default session for multiple facade calls.
|
|
2811
|
+
|
|
2812
|
+
Returns an object with `http`, `endpoint`, and `telemetry` attributes.
|
|
2813
|
+
Caller should `await session.aclose()` when done.
|
|
2814
|
+
"""
|
|
2815
|
+
http = AiohttpClient()
|
|
2816
|
+
endpoint = UrlBuilderEndpoint()
|
|
2817
|
+
telemetry = StructlogTelemetry()
|
|
2818
|
+
return _DefaultSession(http, endpoint, telemetry)
|