Cross-chain swap¶
Quote and track a swap whose input and output live on different chains. The API
surface is the same as a same-chain swap — the differences are the routeKind
you get back and how you track completion across two chains.
Warning
Cross-chain availability depends on the bridge providers configured for your
deployment and the token pair. Check the crossChain feature flag per chain on
Supported networks, and treat an empty route list as
"no route for this pair right now".
1. Quote with different chains¶
curl "https://vector.example.com/quote?fromChain=84532&toChain=421614&fromToken=0xUSDC…&toToken=0xUSDC…&amount=50000000&sender=0xUser…&routeMode=suggested" \
-H "api-key: $EDITH_API_KEY"
Cross-chain routes come back with a bridge-involving routeKind (anything other
than sameChainSwap) and a path whose legs mix swap and bridge steps. The
estimatedTimeMs matters here — bridging dominates the clock, and suggested
mode weighs it.
2. Build and execute the source transaction¶
Exchange the quoteId via
Build path by ID and submit the returned
transaction on the source chain, exactly as in the
end-to-end guide. The destination side is
carried by the route's bridge leg — you don't submit anything on the
destination chain.
3. Track across both chains¶
Get transaction status takes the source-chain transaction hash:
curl "https://vector.example.com/status?txHash=$SRC_TX_HASH&fromChain=84532&userAddress=0xUser…" \
-H "api-key: $EDITH_API_KEY"
The status vocabulary is made for the two-chain shape:
| Status | Meaning |
|---|---|
pending |
Source transaction seen, not yet final. |
src_confirmed |
Source chain done; bridge leg in flight. |
completed |
Funds delivered on the destination chain. |
failed |
The route failed; the response's srcTxDetails / destTxDetails show where. |
The response includes per-side TransactionDetails (txHash, chainId,
timestamp) so you can link both explorers in your UI.
UX guidance¶
- Show the two phases distinctly — users tolerate bridge time when they can see
src_confirmedas progress rather than silence. - Poll
/statusat a relaxed cadence (bridge legs take minutes, not milliseconds). - On
failedaftersrc_confirmed, surfacedestTxDetailsand your support channel — funds are on one identifiable side, never ambiguous.