Swap widget
The lazy (we mean efficient) way to add swaps to your site. One iframe gives your visitors the full LitVMSwap swap box: token picker, best routing, wallet connect, the lot.
Paste this
HTML
<iframe
src="https://www.litvmswap.com/widget?referrer=0xYourWallet&fee=10"
width="100%"
height="650"
style="border: none; border-radius: 24px;"
title="LitVMSwap swap widget"
></iframe>That's it. Visitors connect their own wallet inside the widget and sign their own swaps. You never touch their funds or keys.
Prefer clicking to typing? The widget builder makes the snippet for you with a live preview.
Options
| Query param | What it does |
|---|---|
referrer | Your wallet address. Receives your fee on every swap made through your widget |
fee | Your fee in basis points (10 = 0.1%). Use 0 to 500 |
Both are optional. Leave them out (or set fee=0) and the widget is just a free swap box for your community.
Keep the fee at 500 or below
The swap contract rejects referrer fees above 500 bps (5%), so a higher fee makes every swap in your widget
fail. And be upfront with your users about any fee you set.
Tips
- Height: 650px fits the swap box and its popups. Go taller if you have the room, the background is transparent.
- Width: it's responsive. Anything from a phone column to a sidebar works.
- Dark or light page: the widget has a transparent background, so test it on your actual page colours.
- Want full control over the UI? Use the Swap API and build your own.