Skip to content

AsyncBridgeClient

AsyncBridgeClient

Async client for bridging tokens to/from Derive.

Supports: - Deposits/withdrawals: USDC, USDT, WETH, DRV, OLAS, etc. - Gas funding: ETH to owner EOA - Multiple chains: BASE, ARBITRUM, OPTIMISM, ETH

Functions

connect async

connect() -> None

poll_tx_progress async

poll_tx_progress(
    *, tx_result: BridgeTxResult
) -> BridgeTxResult

Poll for bridge completion across both chains.

Can take a variable amount of time depending on chains and chain congestion.

prepare_deposit_tx async

prepare_deposit_tx(
    *,
    amount: Decimal,
    currency: Currency,
    chain_id: ChainID
) -> PreparedBridgeTx

Prepare deposit to your Derive LightAccount wallet from the owner's EOA on an external chain.

prepare_gas_deposit_tx async

prepare_gas_deposit_tx(
    *, amount: Decimal, chain_id: ChainID = ETH
) -> PreparedBridgeTx

Prepare ETH deposit to fund gas for your owner's account.

Your owner's account needs ETH to sign transactions on Derive L2. This bridges ETH to your EOA (not your LightAccount wallet).

Parameters:

Name Type Description Default
amount Decimal

ETH amount in decimal units (e.g., 0.001)

required
chain_id ChainID

Currently only Ethereum mainnet supported

ETH

Returns:

Type Description
PreparedBridgeTx

PreparedBridgeTx ready for submission

prepare_withdrawal_tx async

prepare_withdrawal_tx(
    *,
    amount: Decimal,
    currency: Currency,
    chain_id: ChainID
) -> PreparedBridgeTx

Prepare withdrawal from your Derive LightAccount wallet to the owner's EOA on an external chain.

submit_tx async

submit_tx(
    *, prepared_tx: PreparedBridgeTx
) -> BridgeTxResult

Submit a prepared bridge transaction.

try_poll_tx_progress async

try_poll_tx_progress(
    *, tx_result: BridgeTxResult
) -> IOResult[BridgeTxResult, Exception]

Poll progress with explicit error handling.

try_prepare_deposit_tx async

try_prepare_deposit_tx(
    *,
    amount: Decimal,
    currency: Currency,
    chain_id: ChainID
) -> IOResult[PreparedBridgeTx, Exception]

Prepare deposit with explicit error handling.

try_prepare_gas_deposit_tx async

try_prepare_gas_deposit_tx(
    *, amount: Decimal, chain_id: ChainID = ETH
) -> IOResult[PreparedBridgeTx, Exception]

Prepare gas deposit with explicit error handling.

try_prepare_withdrawal_tx async

try_prepare_withdrawal_tx(
    *,
    amount: Decimal,
    currency: Currency,
    chain_id: ChainID
) -> IOResult[PreparedBridgeTx, Exception]

Prepare withdrawal with explicit error handling.

try_submit_tx async

try_submit_tx(
    *, prepared_tx: PreparedBridgeTx
) -> IOResult[BridgeTxResult, Exception]

Submit transaction with explicit error handling.