Add to your Dapp (embeddable flow)
Surface on-chain options RFQs inside your Dapp with an iframe. Opshuns hosts the quote UI; your users connect a wallet and fill through your page. You earn referral fees when you pass your wallet in the iframe URL.
No API keys, no backend, and no on-chain integration code on your side. Only an iframe and a referral address.
When to use this
| Path | Choose when |
|---|---|
| This embed | Fastest web Dapp path; hosted quote UI is fine; referral revenue is enough |
| Wallet API flow | Native / in-wallet UX; you control layout; Turnstile-free quote create via taker org |
| TypeScript SDK + Call the CLOB / Settle matched intents | You call contracts (or match) yourself |
Architecture
Your Dapp page
└─ <iframe src="https://frame.opshuns.com/?referralAddress=0xYou…">
└─ Opshuns Frame (hosted quote box)
├─ POST /api/quote (public RFQ, referrer=0xYou…)
├─ WebSocket rfq_stream:<token>
└─ User wallet → package fill with the same referrer
The trading app at app.* is not embeddable (X-Frame-Options: DENY). Always iframe frame.*, not app.*.
Quick start
<iframe
src="https://frame.opshuns.com/?referralAddress=0xYOURADDRESS"
width="480"
height="800"
style="border:0;border-radius:12px;"
title="Opshuns"
></iframe>
Replace 0xYOURADDRESS with the wallet that should receive referral fees. It has to be the quote referrer (hashed into taker_address_hash) and the same address at fill. Invalid or missing addresses settle with referrer = address(0).
With the payoff diagram:
<iframe
src="https://frame.opshuns.com/?referralAddress=0xYOURADDRESS&showPayoffDiagram=true"
width="780"
height="800"
style="border:0;border-radius:12px;"
title="Opshuns"
></iframe>
Hosts
| Environment | Frame URL |
|---|---|
| Production | frame.opshuns.com |
| Testnet | frame.testnet.opshuns.com |
| Staging | frame.staging.opshuns.com |
| Local | http://localhost:3005 (npm run dev:framed) |
Point VITE_FRAME_URL at the matching host if you use the trading app’s landing-page embed preview.
Query parameters
All flags are case-insensitive. Booleans accept true / false.
| Param | Default | Effect |
|---|---|---|
referralAddress | none | 0x + 40 hex chars. Credited on fills through this embed. |
side | buy | buy or sell. Alias: buySell. |
type | call | call or put. Aliases: optionType, callPut. |
strategy | single | Initial structure (strangle, iron_condor, …). Alias: optionStrategy. |
expiry | next suggested week | YYYY-MM-DD or YYYY-MM-DDTHH:mm. Aliases: expiration, expiryDate. |
amount | empty | Prefills size (underlying units). Aliases: quantity, size. When set, Quote stays disabled longer before it arms. |
strike | empty | Primary strike (strikePrice alias), or strikes=90,110 / named fields. Works before a market is listed. |
underlying | all listed | Symbols or addresses for the underlying picker (WETH,WBTC). Alias: underlyingTokens. |
quote | all listed | Symbols or addresses for the pair quote picker. Aliases: quoteTokens, pairQuote. |
premium | all payment / listed | Symbols or addresses for the premium picker. Alias: premiumTokens. |
showPayoffDiagram | false | true shows the options payoff diagram beside the quote box. |
tooltips | true | false hides hover help (useful in a short iframe). |
lang | browser / English | UI language (de, ja, zh-TW, …). Alias: locale. |
Restrict which tokens appear
Limit the underlying, pair quote, and premium pickers from the iframe URL. Full walkthrough: Embed the quote box → Restrict which tokens appear.
| Field | Param | Example |
|---|---|---|
| Underlying | underlying | underlying=WETH,WBTC |
| Pair quote | quote | quote=USDC |
| Premium | premium | premium=USDC |
Comma-separated symbols or 0x addresses; first value is the default. Aliases: underlyingTokens, quoteTokens / pairQuote, premiumTokens.
<iframe
src="https://frame.opshuns.com/?referralAddress=0xYOURADDRESS&underlying=WETH"e=USDC&premium=USDC"
width="480"
height="800"
style="border:0;border-radius:12px;"
title="Opshuns"
></iframe>
Examples:
https://frame.opshuns.com/?referralAddress=0xYOURADDRESS
https://frame.opshuns.com/?referralAddress=0xYOURADDRESS&side=sell&type=put
https://frame.opshuns.com/?referralAddress=0xYOURADDRESS&expiry=2026-12-31&strike=3500
https://frame.opshuns.com/?referralAddress=0xYOURADDRESS&strategy=strangle
https://frame.opshuns.com/?referralAddress=0xYOURADDRESS&underlying=WETH"e=USDC&premium=USDC
https://frame.opshuns.com/?referralAddress=0xYOURADDRESS&showPayoffDiagram=true
https://frame.opshuns.com/?referralAddress=0xYOURADDRESS&lang=de
Referral fees
On fills with a valid referralAddress, referral fees are additive on top of protocol fees:
| Fee | Default | Basis |
|---|---|---|
| Premium referral | 19.53 bps (1/512) | Option premium |
| Underlying referral | 1.22 bps (1/8192) | Trade notional |
Full schedule and who pays: Protocol & referral fees.
The Frame reads referralAddress from the URL. That value is the quote referrer and must be passed again at fill. You do not sign the maker quote. A different address at fill reverts.
Sizing
Recommended: 480×800 (quote only) or 780×800 (with payoff). See Embed the quote box for minimums and layout notes.
Give the iframe enough height for the expiry calendar and offer list. If you use sandbox, include allow-popups so wallet connect / WalletConnect can open.
Host page checklist
- CSP: allow
frame-src(orchild-src) forhttps://frame.opshuns.com(or your environment host). - Wallet popups: injected wallets and WalletConnect open outside the iframe; do not block popups.
- No cookies required:
referrerPolicy="strict-origin-when-cross-origin"is enough. - Frame ancestors: Frame allows any parent (
frame-ancestors *).
What traders get
Same quote box as the trading app: amount, underlying, premium token, expiry, strategy picker, RFQ offers, and wallet connect. Spreads: Option spreads.
Local development
npm run dev:framed
Embed http://localhost:3005/?referralAddress=0xYOURADDRESS. The Frame uses the same API / RPC as trading (VITE_API_URL, etc.).
Related
- TypeScript SDK:
@opshuns/sdkwhen you outgrow the iframe - Detailed Frame reference (params, sizing, CSP): Embed the quote box (Frame)
- Quote payloads: API-only option quotes
- On-chain settlement: On-chain fill modes