Skip to main content
The widget is a hosted swap UI. It never asks the user to connect a second wallet: @ravnexchange/widget-connector lets it use the wallet already connected on your page. To earn from it, set your fee and your site on your key, then give the widget your public key: you put your own fee on top, and RAVN shares it with you 60/40 (Pricing).
1

Embed the iframe

Set ?origin= to your page’s exact origin.
Keep allow-same-origin: without it the widget can’t talk to your page. It needs no allow-popups or allow-top-navigation. v1 stays stable; a breaking change ships as v2.
2

Wrap your wallet

These call your wallet, which shows the user what they’re signing. Never wire them to a signer with no confirmation step.
3

Connect the bridge

4

Earn your fee

Run this once from your server, with your secret key (get a key if you don’t have one). It sets your fee, where RAVN pays your share, and the sites your key works on:
List the origin you set in ?origin=, plus every other site that uses the key in a browser. Your fee and site list take effect within a minute. Then add apiKey: "rvn_live_your_key" to the bridge’s config. On a page the key doesn’t list, the widget stops quoting and says why. The widget collects your fee and reports each swap itself, and widget swaps reach your webhook too. Details: Set your fee and Getting paid.Pass your public key (rvn_live_…), never your secret key. A secret key stops the widget: rotate it. A key from before secret keys existed works once you claim its secret key.
Native BTC deposits need nothing from you: the widget shows the deposit address, a QR code and live status itself. If the bridge never answers, the widget shows “Couldn’t reach the host page”: check that ?origin= is your page’s exact origin and that you created the bridge. For tighter framing, set your page’s CSP frame-src to https://app.ravn.exchange. To match your brand, see Theming.

Open on a pair

Add these to config to open the widget on your pair. The widget reads them once, when it starts, and the visitor can change them.
Give each side its chain and its token: a side missing either, or with a token the widget can’t find, opens on the default.

Change the theme live

bridge.updateConfig(config) merges config into the one the bridge has and re-applies the theme without reloading the widget. Only the theme changes live: apiKey and the starting pair keep the values the widget started with. A light or dark object replaces the previous one whole, and a theme field set to undefined goes back to its default.

Reference

HTMLIFrameElement
required
The embedded iframe.
string
required
https://app.ravn.exchange. Never *.
() => RavnWallet | null
required
Your EVM wallet, or null when none is connected.
() => RavnSolanaWallet | null
Your Solana wallet, or null. signTransaction gets an unsigned base64 versioned transaction and returns it signed.
object
Your public key as apiKey, so widget swaps carry your fee, plus an optional starting pair and the widget’s theme.
A wallet request while no wallet is connected fails in the widget with WALLET_NOT_CONNECTED or SOLANA_WALLET_NOT_CONNECTED.