Skip to main content
Cross-chain asset movement is one of the hardest infrastructure problems to build in-house. Your customers may hold ETH on Ethereum, but your product settles in USDC on Polygon. They may receive a payout in one token and want another. Getting from one to the other typically requires multiple transactions, gas on every chain involved, and UX that stops most users cold. Cross-chain payments handle the entire path (routing, bridging, and swapping) in a single customer action.

What this enables

Token conversion at settlement: Accept any token from customers and settle in the token your product uses. A customer paying with ETH can send the exact USDC equivalent to your contract on Polygon, without a separate conversion step. Cross-network fund movement: Move customer funds between networks as part of normal product operations, without your team managing bridge infrastructure or liquidity positions. Portfolio rebalancing: Let customers rebalance holdings across chains in one action. They specify what they want to end up with; the routing layer finds the optimal route. FX-like stablecoin conversion: Swap between stablecoins across networks (e.g., USDT on Tron to USDC on Polygon) as a backend settlement primitive.

How it works

The routing layer handles bridges and DEXs automatically, finding the best path for each transfer. You specify the source and destination; it handles what happens in between.
import { Swap } from "0xtrails";

<Swap
  apiKey="YOUR_API_KEY"
  from={{
    token: "ETH",
    chain: "ethereum",
  }}
  to={{
    token: "USDC",
    chain: "polygon",
    amount: "500", // exact output: user receives exactly 500 USDC
  }}
  onSwapSuccess={(result) => console.log("Settled:", result)}
/>
The customer selects how much to send. The SDK quotes the route, the customer confirms once, and funds arrive on Polygon as USDC.

Exact input vs. exact output

Two trade modes cover the main product scenarios:
ModeUse when
Exact inputCustomer specifies how much to send; they receive whatever that converts to
Exact outputCustomer receives a fixed amount; they pay whatever is required
Exact output is the right model for payments and settlements where the destination amount must be precise. Exact input suits exchange and conversion flows where the customer controls the spend.

Headless integration

For custom UIs or server-driven flows, use useQuote to get a route and execute it programmatically:
import { useQuote } from "0xtrails";

const { quote, loading } = useQuote({
  from: {
    chainId: 1,
    tokenAddress: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH on Ethereum
    amount: "0.5",
  },
  to: {
    chainId: 137,
    tokenAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", // USDC on Polygon
    recipient: "0xSETTLEMENT_ADDRESS",
  },
});

if (quote) {
  await quote.send();
}
For a full reference on quote parameters and swap configuration, see the Swap component and API reference.