hypersync.utils
Documentation for eth_defi.hypersync.utils Python module.
Hypersync configuration utils.
Functions
|
Helper for scan-vaults and scan-prices scripts to configure Hypersync client from environment variables. |
Classes
HypersyncBackendConfig(hypersync_client: 'ThrottledHypersyncClient | None', hypersync_url: 'str | None', scan_backend: str) |
- class HypersyncBackendConfig
Bases:
objectHypersyncBackendConfig(hypersync_client: ‘ThrottledHypersyncClient | None’, hypersync_url: ‘str | None’, scan_backend: str)
- configure_hypersync_from_env(web3, hypersync_api_key=None, limiter=None, concurrency=None)
Helper for scan-vaults and scan-prices scripts to configure Hypersync client from environment variables.
Some chains support HyperSync, others don’t - autodetect support
The returned client is always a
ThrottledHypersyncClientthat rate-limits every API call. The rate defaults to 150 RPM and can be overridden with theHYPERSYNC_RPMenvironment variable or by passing an explicit limiter.Stream concurrency defaults to the Hypersync server default (10) and can be overridden with the
HYPERSYNC_CONCURRENCYenvironment variable or via the concurrency parameter.
- Parameters
hypersync_api_key (Optional[str]) – Use given API key, instead of reading from env.
limiter (Optional[pyrate_limiter.limiter.Limiter]) – Optional shared
pyrate_limiter.Limiter. Pass the same instance to multipleconfigure_hypersync_from_envcalls (e.g. lead discovery + price scanning) so they coordinate rate limits via one SQLite bucket.concurrency (Optional[int]) – Number of requests in flight for stream tuning.
Nonefalls back to theHYPERSYNC_CONCURRENCYenv var, then to the Hypersync server default.web3 (web3.main.Web3) –
- Returns
A valid Hypersync config if the chain supports HyperSync
- Return type