HALFKEY
Mainnet · capped beta

Widget

The swap card, in your app.

One script tag. Your theme, your accent, your preset coin. Users sign with their own wallet, and the swap runs on the same program as HALFKEY.

Theme
Accent

Used for the active tab, the focus ring and XMR amounts.

Direction

Empty means SOL.

Optional. The quote loads with the card.

Layout

Optional.

The program supports an integrator share, capped at 2% and paid at settlement; the widget doesn't set it yet, and partner terms are by agreement (partners). Your ID is recorded in the link now.

Live preview

Open the embed

      
    

For your users

What the card does inside your page

The same card and the same live tracker as HALFKEY itself. Nothing passes through your server.

  • Quotes from bonded makersBest price across the makers online, with the all-in cost (spread plus fee) before anything is signed.
  • Signs with the user's own walletPhantom, Solflare or Backpack, inside the frame. If no wallet can reach the frame, the button becomes "Open in HALFKEY" with the same coin and amount.
  • Tracks the swap to the endSOL locked, XMR on its way in about 2 minutes, spendable after 10 Monero blocks. The swap also shows up in My swaps on any device with the same wallet.
  • Refunds without youIf a maker never delivers, the user takes the coins back. No support ticket, no custody on your side.

Layout

Sizes

480pxWidest100% of its container up to here
320pxNarrowestevery state fits, no sideways scroll
640pxForm heightmeasured in the preview above
autoHeightwidget.js follows the card through postMessage

A plain iframe has no script to resize it: give it the form height and let the tracker scroll.

Script attributes or query string

Parameters

Integrator guide
AttributeQueryValuesDefaultWhat it does
data-themethemedark | lightdarkCard colours. Light uses its own token set, checked for contrast.
data-accentaccent#hex#D9AE5FActive tab underline, focus ring, XMR amount. Darkened or lightened until it reaches AA contrast on the card.
data-radiusradius0 to 2824Corner radius of the card in px. Inner panes follow it.
data-dirdir1 | 211: sell for XMR. 2: XMR to SOL.
data-fromfromSOL | mint addressSOLThe coin the user sells. Any coin with a Jupiter route.
data-amountamountdecimalemptyPrefilled amount of that coin. The quote loads at once.
data-totoxmr | zecxmrThe other side of the pair. ZEC only where a maker offers it.
data-hide-tabshideTabs1offHides the direction tabs and the flip button.
data-compactcompact1offTighter spacing and no footnote, for narrow sidebars.
data-partnerpartnerSolana addressemptyYour partner ID. Kept in the link and in every swap the card opens on HALFKEY.

Invalid values are ignored and the default is used. data-target takes a CSS selector; without it the card mounts in #halfkey, or right after the script tag.

postMessage from the frame

Events

Every message is { type, v: 1, ... } and carries only public chain data. widget.js checks the sender, then fires the same names as DOM events on your container, with the message in event.detail.

const el = document.getElementById('halfkey');

el.addEventListener('halfkey:swap-started', (e) => {
  console.log('swap account', e.detail.escrow);
});
el.addEventListener('halfkey:swap-complete', (e) => {
  // e.detail.phase: 'collect' (XMR ready) or 'done' (SOL claimed)
});

// single-page apps: mount and unmount yourself
const w = HALFKEY.mount(el, { theme: 'dark', from: 'SOL', onEvent: (m) => {} });
w.destroy();
TypePayloadWhen
halfkey:ready{ height, network }The card has mounted.
halfkey:height{ height }Its height changed. widget.js resizes the iframe for you.
halfkey:swap-started{ escrow, asset, direction }The user started a swap. escrow is the swap account on Solana.
halfkey:swap-phase{ escrow, phase }The tracker moved: waiting-xmr, releasing, collect, refund, deposit, claim-sol, done...
halfkey:swap-complete{ escrow, phase }XMR is ready to collect (collect) or the SOL was claimed (done).

Security

What you are trusting

Less than with any custodial widget: the card holds no funds, and you never touch them.

  • Users sign with their own wallet.Their half of the key comes from a wallet signature and stays in the frame's memory. Neither you nor HALFKEY can sign for them.
  • The coins sit in the program, never with you or the maker.The maker is paid only by revealing its half of the key, which hands the user the XMR. No switch can stop a claim or a refund.
  • The widget is static.Plain files that hold no keys and no funds. Self-host them from the IPFS build and point the script at your copy; it loads the embed that sits next to it.
  • Check the sender of every message.widget.js accepts messages only from its own iframe and origin. If you listen yourself, compare event.origin and event.source.

Your own UI instead?

The SDK has the same quote, lock, track and collect calls the card uses. The API serves read-only quotes, limits and status over HTTPS.

SOL $— XMR $— 1 SOL = — XMR Monero block — · — Watchtowers — Solana mainnet · Monero mainnet