Typed Python client for the Squid Router API (Axelar-powered cross-chain swap & bridge aggregator).
Project description
squidrouter-py
A typed, batteries-included Python client for the Squid Router
v2 API — the Axelar-powered aggregator for
cross-chain swaps and bridging. Sync and async, built on
httpx and pydantic v2.
Requirements
- Python 3.9+
- An integrator ID — every Squid API request requires one. It is sent in
the
x-integrator-idheader. Get a free integrator ID from the Squid integrator portal (apply via the link in the docs and check your email). The client will not work without it.
Installation
pip install squidrouter-py
The package installs as squidrouter-py; you import it as squidrouter.
Quickstart
from squidrouter import SquidClient, RouteRequest
with SquidClient(integrator_id="YOUR_INTEGRATOR_ID") as client:
# List supported chains and tokens
chains = client.get_chains()
tokens = client.get_tokens()
# Request a cross-chain route: USDT on BNB Chain -> USDC on Arbitrum
route = client.get_route(
RouteRequest(
from_chain="56",
from_token="0x55d398326f99059fF775485246999027B3197955",
from_amount="1000000000000000",
to_chain="42161",
to_token="0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
from_address="0xYourAddress",
to_address="0xYourAddress",
slippage=1.0,
)
)
estimate = route.route.estimate
print("You will receive ~", estimate.to_amount)
# The signable transaction is in route.route.transaction_request.
# Save these two values to track the transaction later:
request_id = route.request_id # from the x-request-id response header
quote_id = route.route.quote_id # required for Squid Intents status tracking
Tracking transaction status
After you broadcast the route's transaction on-chain, poll for its
cross-chain status. Squid Intents is enabled by default, so you must pass the
quote_id:
status = client.poll_status(
transaction_id="0xYourSourceTxHash",
request_id=request_id,
from_chain_id="56",
to_chain_id="42161",
quote_id=quote_id,
)
print(status.squid_transaction_status) # e.g. "success"
poll_status blocks until a terminal state (success, partial_success,
needs_gas, not_found) or raises StatusTimeoutError. For a single check use
client.get_status(...).
Async
import asyncio
from squidrouter import AsyncSquidClient
async def main():
async with AsyncSquidClient(integrator_id="YOUR_INTEGRATOR_ID") as client:
chains = await client.get_chains()
print(len(chains.chains), "chains supported")
asyncio.run(main())
Configuration
SquidClient / AsyncSquidClient accept:
| Argument | Default | Description |
|---|---|---|
integrator_id |
— (required) | Your Squid integrator ID. |
base_url |
https://apiplus.squidrouter.com |
API base URL. |
integrator_header |
x-integrator-id |
Header name carrying the integrator ID. |
timeout |
30.0 |
Request timeout in seconds. |
client |
None |
A pre-configured httpx.Client / AsyncClient. |
Error handling
from squidrouter import SquidClient, SquidAPIError
with SquidClient(integrator_id="YOUR_INTEGRATOR_ID") as client:
try:
client.get_chains()
except SquidAPIError as exc:
print(exc.status_code, exc.message, exc.request_id)
SquidError— base class for everything raised by this library.SquidAPIError— non-2xx API response; carriesstatus_code,message,response_body,request_id.StatusTimeoutError—poll_statusdid not reach a terminal state in time; carrieslast_status.
License
This is an unofficial, community-maintained client and is not affiliated with Squid or Axelar. See the official Squid documentation for the authoritative API reference.
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 squidrouter_py-0.1.0.tar.gz.
File metadata
- Download URL: squidrouter_py-0.1.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2580d5d9290f9ea9fba9edf53b287f2344a0c97bb10596499e26ff7f4eeeaec9
|
|
| MD5 |
d612487a3f240d13a752ae161831c22f
|
|
| BLAKE2b-256 |
9e6f37f080c8d8db8b8cce03ab00a58977a3469edb00495c1ce4ea7930d80144
|
File details
Details for the file squidrouter_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: squidrouter_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.3 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 |
0d2f5fac3e0d15ceae2b432897f5da582f68acffdf5b2bf0fe0f3f77aa19c0ed
|
|
| MD5 |
61b9aae64d40276bd3ce9b0eca4fbc36
|
|
| BLAKE2b-256 |
5f45820b73ac3da6dc5ece119558c83a6538c3e8899284b756bbe5759ba72ce2
|