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: string; address: string };
    to: { network: string; address: string };
    amount: string;
    fromToken?: string;
    toToken?: string;
    slippage?: string;
  }
): Promise<SwidgeQuoteResponse>

Parameters

Param
Type
Description

request

object

Quote request configuration

request.from

object

Source wallet details

request.from.network

string

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

request.from.address

string

Source wallet address

request.to

object

Destination wallet details

request.to.network

string

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

request.to.address

string

Destination wallet address

request.amount

string

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

request.fromToken?

string

Source token contract (omit for native tokens)

request.toToken?

string

Destination token contract (omit for native tokens)

request.slippage?

string

Slippage tolerance % (default: "0.5")

Returns

  • Promise<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

SwidgeExecuteRequest

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

Returns

  • Promise<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