Typed Python client for the Across Protocol bridge API (sync + async).
Project description
across-protocol-py
A typed Python client for the Across Protocol bridge API. It wraps the
public, keyless quoting endpoints with pydantic v2 models and
ships both synchronous and asynchronous httpx-based clients.
- Sync (
AcrossClient) and async (AsyncAcrossClient) clients with identical surfaces. - Fully typed (
py.typed), validated request/response models. - Headline quoting via
/suggested-fees, plus/available-routes,/limits, and deposit status tracking with a poll-to-terminal helper.
Installation
pip install across-protocol-py
Quickstart
Get a cross-chain bridge quote (USDC from Ethereum to Polygon) in a few lines:
from across_protocol import AcrossClient
with AcrossClient() as client:
quote = client.get_suggested_fees(
input_token="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", # USDC on Ethereum
output_token="0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", # USDC.e on Polygon
origin_chain_id=1,
destination_chain_id=137,
amount=10_000_000, # 10 USDC (6 decimals)
)
print(f"Output amount: {quote.output_amount}")
print(f"Total relay fee: {quote.total_relay_fee.total}")
print(f"Estimated fill time: {quote.estimated_fill_time_sec}s")
The async client mirrors the sync API:
import asyncio
from across_protocol import AsyncAcrossClient
async def main() -> None:
async with AsyncAcrossClient() as client:
quote = await client.get_suggested_fees(
input_token="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
output_token="0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
origin_chain_id=1,
destination_chain_id=137,
amount=10_000_000,
)
print(quote.output_amount)
asyncio.run(main())
Other endpoints
with AcrossClient() as client:
routes = client.get_available_routes() # GET /available-routes
limits = client.get_limits(...) # GET /limits
status = client.get_deposit_status( # GET /deposit/status
origin_chain_id=1, deposit_id=2000000,
)
# Block until the deposit reaches a terminal state (filled / refunded / expired):
final = client.wait_for_deposit(origin_chain_id=1, deposit_id=2000000)
Configuration
The base URL defaults to https://app.across.to/api and can be overridden:
client = AcrossClient(base_url="https://testnet.across.to/api", timeout=30.0)
Development
pip install -e ".[dev]"
ruff check .
mypy src
pytest -q # unit tests (respx-mocked)
pytest -m integration -q # live integration test (hits the real API)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file across_protocol_py-0.1.0.tar.gz.
File metadata
- Download URL: across_protocol_py-0.1.0.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce5847b47d04c5d1e6a71912fb2e520096b5825cf8752568b598d331b0c19e34
|
|
| MD5 |
37327ba53dc212650d5a00f6db7b282c
|
|
| BLAKE2b-256 |
fd161ad0cdd5da07246c619f7c7da8c4ec24c6129819c09b4f43eb3c1b62df6d
|
File details
Details for the file across_protocol_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: across_protocol_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afc2204e8d3ecca58e523b31919c0c7233976c9582d604f893ea336b4c34ff93
|
|
| MD5 |
99a9327e816598948df16d661aa71959
|
|
| BLAKE2b-256 |
21a512fcb94e3c90005ff9875ad0464638c2c4c8470a0c651fceb7a9752e4439
|