Skip to main content

Typed Python client for the deBridge DLN cross-chain swap/order API (EVM + Solana).

Project description

debridge-py

CI PyPI Docs Python versions License: MIT

Typed Python client for the deBridge DLN cross-chain swap/order API. Works across EVM chains and Solana (19+ chains), sync and async, with full type hints (py.typed), built on httpx + pydantic v2.

The client covers the public, no-auth data endpoints needed to quote and track cross-chain orders. Signing and broadcasting the returned transaction is left to you (optionally with the [exec] extra: web3.py for EVM, solders for Solana).

Install

pip install debridge-py
# optional signing helpers:
pip install "debridge-py[exec]"

Quickstart

from debridge import DebridgeClient
from debridge.constants import ChainId

with DebridgeClient() as client:
    # 1. discover supported chains
    chains = client.get_supported_chains()

    # 2. quote + build a cross-chain order (10 USDC Base -> USDC Arbitrum)
    order = client.create_order(
        src_chain_id=ChainId.BASE,
        src_chain_token_in="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        src_chain_token_in_amount="10000000",          # 10 USDC (6 decimals)
        dst_chain_id=ChainId.ARBITRUM,
        dst_chain_token_out="0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
        dst_chain_token_out_amount="auto",              # API quotes the output
        dst_chain_token_out_recipient="0xYourRecipient",
        sender_address="0xYourSender",
    )
    print(order.estimation.dst_chain_token_out.amount)  # estimated output
    print(order.tx.to, order.tx.value, order.tx.data)   # tx to sign & send

    # 3. after broadcasting order.tx, poll until the order settles
    final = client.poll_status(order.order_id, interval=5, timeout=600)
    print(final.status)  # e.g. "Fulfilled"

Async

import asyncio
from debridge import AsyncDebridgeClient

async def main():
    async with AsyncDebridgeClient() as client:
        chains = await client.get_supported_chains()
        print(len(chains.chains))

asyncio.run(main())

EVM and Solana

Addresses and amounts are kept as strings so the same models represent both 0x-hex (EVM) and base58 (Solana) values and amounts beyond 64-bit range. The returned transaction adapts to the source chain:

  • EVM source → order.tx has data, to, value (an EVM call).
  • Solana source → order.tx has only data (the serialized versioned tx as hex).

Native-token sentinels are exposed as constants.EVM_NATIVE_TOKEN and constants.SOLANA_NATIVE_TOKEN.

API surface

Method Endpoint
get_supported_chains() GET /supported-chains-info
get_token_list(chain_id) GET /token-list
create_order(...) GET /dln/order/create-tx
get_order_status(order_id) GET /dln/order/{id}/status
get_order(order_id) GET /dln/order/{id}
poll_status(order_id, interval, timeout) polls status to a terminal state

Every method exists on both DebridgeClient (sync) and AsyncDebridgeClient (async, with await). Errors raise DebridgeAPIError (a DebridgeError), exposing .error_id, .error_code, .message, .req_id, .status_code — including compliance blocks that the API returns with HTTP 200.

Configuration

DebridgeClient(base_url="https://my-proxy.example/v1.0", timeout=30.0)

base_url defaults to https://dln.debridge.finance/v1.0 and can point at any compatible endpoint.

Development

uv venv --python 3.9 && source .venv/bin/activate
uv pip install -e ".[dev]"
pytest            # unit tests (network mocked, integration deselected)
pytest -m integration   # one live test against the real API
ruff check . && ruff format --check .
mypy

See CONTRIBUTING.md for the full contributor workflow and CHANGELOG.md for release history.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

debridge_py-0.1.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

debridge_py-0.1.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file debridge_py-0.1.0.tar.gz.

File metadata

  • Download URL: debridge_py-0.1.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for debridge_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7968047b55ebd67a169ac52b3eb9f9328c93f5a0c42addcd38bcfabbb8ec9e7a
MD5 bf3357d516a3f3c738f10b1ea80e478b
BLAKE2b-256 11e6e08c1521bb96ce2323a971c1a253469af8840ac87a5e9f8f122236862a0b

See more details on using hashes here.

File details

Details for the file debridge_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: debridge_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for debridge_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea00c0582ceefd250e6a4a2e9a30b3644e35fbf32415c2bfb35e1beb57413aa6
MD5 6c5d4e57de42686dcdd567328d9dfae3
BLAKE2b-256 4f93de41dd443777fa1115c3588d5f91653f7d9e38bed320ef705b134f8af342

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page