AsyncHTTPClient
AsyncHTTPClient¶
Asynchronous HTTP client
Attributes¶
account
property
¶
account: LightAccount
Get the LightAccount instance (this is not a web3 contract instance).
Functions¶
connect
async
¶
connect(initialize_bridge: bool = True) -> None
Connect to Derive and validate credentials.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initialize_bridge
|
bool
|
If True, attempt to initialize bridge client (requires owner signer) |
True
|
disconnect
async
¶
disconnect() -> None
Close the underlying session and clear cached state. Idempotent.
fetch_subaccount
async
¶
fetch_subaccount(subaccount_id: int) -> Subaccount
Fetch a subaccount from API and cache it.
fetch_subaccounts
async
¶
fetch_subaccounts() -> list[Subaccount]
Fetch subaccounts from API and cache them.
from_env
classmethod
¶
from_env(
session_key_path: Path | None = None,
env_file: Path | None = None,
) -> AsyncHTTPClient
Create the AsyncHTTPClient instance.
timeout
async
¶
timeout(seconds: float) -> AsyncGenerator[None, None]
Temporarily overwrite client's AsyncHTTPSession's request_timeout.