BYO Adapter
The {c} Checkout trades through one seam — a TradeAdapter. V3 venues get the built-in one for free; a venue on a different protocol (e.g. V2) passes trade to back the same drawer, gate, autospend, and optimistic flow with its own quote + buildCalls. The shell never sees a conditionId or any on-chain detail — per-market specifics ride along on the opaque market.meta.
The gate stays protocol-blind: every buy is
SponsorAction: 'prediction', so per-venue accounting + throttling need zero V2 knowledge.quote(market, outcome, amount)→ est. outcome tokens; drives the drawer's live re-quote
buildCalls(…, minOut)→ the exact batch the wallet sends; slippage already applied
market.metaopaque — your on-chain market_id, a venue-auth permit, anything
import type { TradeAdapter, Call } from '@prophecy-dev/connect-react'
// quote() + buildCalls() are required; the rest are OPTIONAL — provide them to keep the
// checkout at full featureset (balance, Max, the payout preview, the right token symbol).
const v2Adapter: TradeAdapter = {
async quote({ market, outcomeIndex, amount }) {
const { marketId } = market.meta as { marketId: bigint } // opaque passthrough
return readV2Quote(marketId, outcomeIndex, amount)
},
async buildCalls({ market, outcomeIndex, amount, minOut }): Promise<Call[]> {
const { marketId, permit } = market.meta as { marketId: bigint; permit: `0x${string}` }
return encodeV2Buy(marketId, outcomeIndex, amount, minOut, permit)
},
// ── optional: configure the collateral + resolution semantics ──
collateral: { symbol: 'USDC', decimals: 6 }, // amount labels + parsing
balanceOf: (owner) => readUsdcBalance(owner), // lights up Balance / Max / slider
payout: ({ amount, quote }) => myProtocolPayout(amount, quote), // else default: quote redeems 1:1
}
// Drop it in — zero change to the rest of the checkout. (Omit `trade` → built-in V3 / PST.)
<ProphecyProvider trade={v2Adapter} wallet={wallet} reader={reader} venueId="acme">
<App />
<ProphecyCheckout />
</ProphecyProvider>
// Then pass meta on the market you predict:
predict({ id, title, outcomes, meta: { marketId, permit } }, outcomeIndex, amount)