riddlePARTNERS

Setup · swap

Swap widget

Drop-in DEX on your site. Users swap; you earn a share of the platform fee.

Open live demo →

  1. 1

    Finish account + origin

    Complete Partner account setup so your slug exists, then allowlist your site in Dashboard → Embeds.

  2. 2

    Mount the widget

    Replace acme with your slug. This is the supported browser entry (riddlepartners.js, same file as inject.js).

    <div id="riddle-swap"></div>
    <script src="https://partners.riddlewallet.com/riddlepartners.js"></script>
    <script>
      const riddle = RiddlePartners.createClient({ partner: 'acme' })
      riddle.mount('#riddle-swap', { product: 'swap', height: 560 })
    </script>
  3. 3

    Iframe alternative

    Use the same allow attribute so wallets can copy URIs.

    <iframe
      src="https://partners.riddlewallet.com/embed/swap?partner=acme&network=mainnet&embed=1"
      style="width:100%;height:560px;border:0;border-radius:16px"
      allow="clipboard-write; clipboard-read; payment; camera; publickey-credentials-get *; accelerometer; gyroscope"
      title="Riddle swap"
    ></iframe>
  4. 4

    Listen for success (optional)

    The iframe posts riddle-embed events, also as a CustomEvent named riddle-embed.

    window.addEventListener('riddle-embed', (e) => {
      const d = e.detail
      if (d.type === 'riddle-embed:success') console.log('swap attributed', d)
    })