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, _AsyncAlloyIntrospectionMixin

High-performance async Ethereum RPC provider using Alloy.

A thin Python wrapper around the Rust AsyncAlloyProvider pyclass. Adds string block-identifier resolution ('latest', 'earliest', 'pending') and exposes the inner Rust pyclass via as_async_alloy() for Rust-side call seams. The public surface is assembled from the async query mixins.

Parameters:

rust_provider – The underlying Rust AsyncAlloyProvider pyclass.

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 AsyncAlloyProvider asynchronously.

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 ValueError when the endpoint serves another chain.

Returns:

An AsyncAlloyProvider instance.