swidge

The swidge namespace provides cross-chain swap and bridge functionality. Bridge assets between chains or swap tokens on the same network with automatic routing and competitive fees. Supports all major EVM chains (Ethereum, Arbitrum, Polygon, etc.) and Solana.

Important notes:

  • Validate quotes before executing. Circuit only filters price impact >100%. Check quotes against your own risk thresholds.

  • Minimum $10-20 recommended to avoid fee issues

  • Adjust slippage: 0.5% default, 1-2% for volatile/cross-chain

  • Same network = swap; different networks = bridge

  • Omit fromToken/toToken for native tokens

swidge.quote()

Get pricing and routing information for swapping tokens between networks or within the same network.

Signature

agent.swidge.quote(
    request: {
        from: { network: str; address: str },
        to: { network: str; address: str },
        amount: str,
        fromToken: str | None,
        toToken: str | None,
        slippage: str | None
    }
) -> SwidgeQuoteResponse

Parameters

Param
Type
Description

request

dict

Quote request configuration

request.from

dict

Source wallet details

request.from.network

str

Source network; 'ethereum:{chainId}' | 'solana'

request.from.address

str

Source wallet address

request.to

dict

Destination wallet details

request.to.network

str

Destination network; 'ethereum:{chainId}' | 'solana'

request.to.address

str

Destination wallet address

request.amount

str

Amount in smallest unit (wei, lamports, etc.)

request.fromToken?

str

Source token contract (omit for native tokens)

request.toToken?

str

Destination token contract (omit for native tokens)

request.slippage?

str

Slippage tolerance % (default: "0.5")

Returns

  • SwidgeQuoteResponse

Examples

Bridge USDC: Polygon to Arbitrum

Swap USDC to ETH on Arbitrum

Common Errors

Error
Cause
Solution

"Quote failed"

Amount too small, insufficient liquidity

Use at least $10-20 worth of tokens

"Invalid token address"

Token doesn't exist on network

Verify token address on block explorer

"Price impact too high"

Slippage >100% (auto-filtered by Circuit)

Reduce amount or increase slippage

"Unsupported network"

Network not supported by Swidge

Check supported networks list

"No route found"

No path between tokens/chains

Try different token pair or amount

swidge.execute()

Execute a cross-chain swap or bridge using a quote from agent.swidge.quote(). Signs transactions, broadcasts them, and waits for completion.

Signature

Parameters

Param
Type
Description

quote

SwidgeData

Complete quote object from swidge.quote() (the data field)

Returns

  • SwidgeExecuteResponse

Examples

Common Errors

Error
Cause
Solution

"Execution failed"

Insufficient balance for swap

Verify currentPositions has enough tokens

"Quote expired"

Quote too old (prices changed)

Get fresh quote before executing

"Slippage exceeded"

Price moved beyond slippage tolerance

Increase slippage or get new quote

"Transaction reverted"

Gas estimation failed, approval issues

Check allowances and gas availability

Last updated