Add a Create parlay action to an existing trading UI, opening a right-side drawer with the full slip: picks, stake, live payout preview, and submit.
This is the flagship integration: your app already renders markets (a trading panel, market cards, an order form) and you want a Combine action that collects outcomes into a parlay slip in a right-side drawer. Everything below is headless SDK plus plain React; swap the example styling for your design system freely.What you will wire up:
Outcome buttons that toggle legs into the slip (useParlaySlip)
A right-side drawer opened by the Combine button
Slip rows with remove, a stake input, and a live payout preview
A correlation transparency row
A submit button driving the useSubmitParlay status machine, with analytics
useParlaySlip is a map of marketId -> backed outcome (0 NO, 1 YES). Tapping the same outcome again removes the leg; tapping the other side flips it. sideOf(marketId) drives the selected state on your existing buttons:
useSubmitParlay only quotes as part of the submit flow, so the drawer fetches its own preview quote with the raw client (useTakerClient), debounced against slip and stake changes:
Preview quotes are also how refusals surface before submit: a mutually exclusive combo (two outcomes of the same HL question) comes back as an error like “legs 101 and 102 are mutually exclusive”. Render previewError prominently; the user must change the slip.
When legs co-move, the quote’s correlation block shows what the guard removed. Render a row whenever reductionBps > 0 so shortened odds never look arbitrary:
The submit quote is fresh.submit re-quotes internally right before signing, so the preview never goes stale into the order. The user signs exactly what the maker signed; the payout they confirm in the wallet is the payout they get.
Status machine.approving -> quoting -> signing -> submitting -> done, with error from any stage. The first-ever submit includes a USDC approve transaction (maxUint256, so it never recurs); every later submit is fully gasless.
ensureChain. By default the hook calls wagmi switchChain to the client’s chainId before writing. Hosts with their own network toggle pass ensureChain in the callbacks instead.
Clearing. The example clears the slip on success. Keeping it and showing a “view position” link into your positions table also works well.