degenbot.provider.async_provider¶
Async Alloy provider: the mixin trees and AsyncAlloyProvider.
The sync twin lives in degenbot.provider.sync. The two trees are
deliberately parallel: 20 of the 22 methods they share are logic-identical
modulo await, and nearly all of those are single-line pass-throughs to
the wrapped Rust pyclass – the sync/await duality IS the code. The
multi-line logic both trees need (block-tag resolution, block-timestamp
extraction) lives once in degenbot.provider.block_helpers.
get_logs genuinely differs: the sync surface accepts a LogFilter or
individual keyword arguments with range validation; this surface takes
keyword arguments only. The sync tree also carries the context-manager and
scalar-property surface this tree exposes as awaited methods.
Module Contents¶
- class degenbot.provider.async_provider.AsyncAlloyProvider(rust_provider: degenbot.provider._rust.RustAsyncAlloyProvider)¶
Bases:
_AsyncAlloyEndpointMixin,_AsyncAlloyQueryMixin,_AsyncAlloyIntrospectionMixinHigh-performance async Ethereum RPC provider using Alloy.
A thin Python wrapper around the Rust
AsyncAlloyProviderpyclass. Adds string block-identifier resolution ('latest','earliest','pending') and exposes the inner Rust pyclass viaas_async_alloy()for Rust-side call seams. The public surface is assembled from the async query mixins.- Parameters:
rust_provider – The underlying Rust
AsyncAlloyProviderpyclass.
Prefer
create()to construct an instance from an RPC URL.- static create(rpc_url: str, max_retries: int = 10, max_blocks_per_request: int = 5000, *, requests_per_second: int | None = None, burst: int | None = None, chain_id: int | None = None) AsyncAlloyProvider¶
- Async:
Create an
AsyncAlloyProviderasynchronously.- Parameters:
rpc_url – HTTP/HTTPS/WS/IPC endpoint URL.
max_retries – Maximum retry attempts.
max_blocks_per_request – Maximum blocks per log request.
requests_per_second – Optional rate limit.
burst – Optional burst size for rate limiting.
chain_id – Chain to bind the endpoint to; the Rust core raises
ValueErrorwhen the endpoint serves another chain.
- Returns:
An
AsyncAlloyProviderinstance.