SwapChan

Embed the swap widget

Put SwapChan's swap card on your site: every aggregator and bridge we compare, every chain including Solana, Bitcoin and Tron, wallet connect inside the widget. Users never leave your page. Register as a partner and you earn 50% of SwapChan's 0.1% fee on swaps through your widget. The user pays the same either way. Estimate your earnings.

<script src="https://swapchan.com/widget.js" async></script>

Live preview

Options

widget.js attributeiframe paramWhat it does
data-partnerpartnerYour partner id (revenue share)
data-from-chain / data-to-chainfromChain / toChainChain id, e.g. 1, 8453, 792703809 (Solana)
data-from-token / data-to-tokenfromToken / toTokenToken address or mint
data-amountamountPrefilled amount, e.g. 100
data-themethemedark (default) or light
data-accentaccentButton color, e.g. #22c55e
data-chanchan0 hides Swap-chan and the chain characters
data-compactcompact1 = shorter card, best route only
data-lock-tolockTo1 = destination can't be changed ("buy our token")
data-targetCSS selector to mount into (default: where the script is)
data-widthiframe width (default 420px)

Events

The widget posts {source: "swapchan", type, ...} to your page for ready, quote, swap_submitted (with txHash), swap_completed and resize. With widget.js you can also listen for a swapchan event on window:

window.addEventListener("swapchan", (e) => {
  if (e.detail.type === "swap_completed") console.log("swapped via", e.detail.provider);
});

React

An @swapchan/widget React package is coming. Until then, render the iframe snippet from above as JSX. It's the same widget.

Affiliate links

No widget needed: add ?ref=your-id (or ?partner=) to any swapchan.com link, e.g. https://swapchan.com/?ref=your-id, a /swap/… route, a pre-filled deep link or /scanner. The id is kept in a first-party cookie for 30 days (last click wins; visits without a ref don't clear it), and quotes and swaps on the main site earn the same share under the same rules. AI agents can pass partner to the MCP quote tools; their swap links then carry your ref.

Revenue share