docs(partner): audit & correct partner-integration docs; fix ratesRefetchInterval prop - #12474
Conversation
…docs Bring partner-facing integration docs in line with the current implementation (props/headers/endpoints had drifted ~3 months behind code). - swap-widget README: rewrite as the canonical widget reference — correct props (sellFilters/buyFilters, removed walletClient/affiliate props), required walletConnectProjectId, accurate chains/swappers, exports, peer deps, CSS import - public-api swap-widget-sdk.md: reduce to a pointer to the canonical README - public-api introduction.md / rest-api-guide.md: add base URL, response/error envelope, status values, quote/rate expiry, polling, params, rate limits - affiliates.md: fix to X-Partner-Code only; partnerCode-based stats/swaps; clarify attribution model; correct dashboard URL; drop web-app-only related-asset fee claim - affiliate-system.md: describe implemented architecture and the on-chain-fee vs off-chain-settlement attribution model - remove affiliate-data-model.md (stale design spec; schema lives in microservices) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…st owns AppKit The widget renders once Reown AppKit is initialized, which is satisfied either by passing walletConnectProjectId (widget self-initializes) or by the host app initializing AppKit and the widget reading the shared singleton (see ExternalWalletApp demo). Docs previously stated the prop was unconditionally required to render. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- partner code is partner-chosen at registration, not issued - scope the endpoints table heading to "Affiliate API Endpoints" - note partnerBps only appears on partner-attributed quotes - standardize the partner-code placeholder across docs Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- note the app-wide global limiter that applies on top of per-group limits - fix "sliding window" to "fixed window" (express-rate-limit MemoryStore) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A status call requires a bound txHash, and binding immediately sets the status to submitted, so clients never observe the internal pending state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The widget statically imports the Bitcoin/Solana AppKit adapters and tsup externalizes them, so a consumer must install all of them or the build fails to resolve. The previous command omitted the Bitcoin/Solana peers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The prop was declared on SwapWidgetProps but never threaded to useSwapRates, so it had no effect and rates always refetched at the hardcoded 15s default. Thread it through the component tree like allowedSwapperNames; an unset prop still falls back to the 15s default in useSwapRates. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- the Bitcoin/Solana AppKit adapters are statically imported at load, so list them as required peers rather than optional add-ons - document the literal apiBaseUrl default (https://api.shapeshift.com) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e doc Those constants are ShapeShift's own protocol affiliate-account identifiers, not part of the partner attribution system this doc describes. One of the referenced files (CowSwapper/constants.ts) didn't contain an affiliate constant anyway. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThis PR rewrites affiliate-related documentation across docs/affiliates.md, docs/architecture/affiliate-system.md, and packages/public-api docs to describe a partner-code-based attribution model using the X-Partner-Code header, removes affiliate-data-model.md, updates the swap-widget README, and adds an optional ratesRefetchInterval parameter to SwapWidget and useSwapDisplayValues. ChangesAffiliate documentation rewrite
Swap rates refetch interval
Sequence Diagram(s)sequenceDiagram
participant Widget
participant PublicAPI
participant SwapService
Widget->>PublicAPI: swap request with X-Partner-Code header
PublicAPI->>SwapService: resolvePartnerCode(partnerCode)
SwapService-->>PublicAPI: partnerAddress, partnerBps, shapeshiftBps
PublicAPI->>PublicAPI: compute affiliateBps
PublicAPI->>SwapService: register swap with partner split metadata
PublicAPI-->>Widget: swap response with affiliateBps
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Accuracy audit of the partner-integration documentation set, verifying every concrete claim against the actual implementation (swap-widget, public-api, swap-service, affiliate-dashboard) and correcting the discrepancies found. Includes one small code fix uncovered during the review.
Docs reviewed & corrected:
docs/affiliates.md— partner code is partner-chosen (not "issued");walletConnectProjectIdnot strictly required when the host owns AppKit; scoped the endpoints-table heading; clarifiedpartnerBpsonly appears on attributed quotes.packages/public-api/docs/introduction.md— corrected rate-limit description (fixed window + app-wide global limiter on top of per-group limits).packages/public-api/docs/rest-api-guide.md— dropped the unobservablependingswap status (binding a txHash immediately moves it tosubmitted).packages/public-api/docs/swap-widget-sdk.md— install command now lists all required peer deps.packages/swap-widget/README.md— Bitcoin/Solana AppKit adapters documented as required peers (they're statically imported); documented the literalapiBaseUrldefault; dual AppKit-init guidance.docs/architecture/affiliate-system.md— verified the attribution model end-to-end (only the totalaffiliateBpsreaches the swapper; the split + partner address are off-chain settlement metadata); removed tangential swapper affiliate-constant references.Code fix:
fix(swap-widget): wire ratesRefetchInterval prop through to useSwapRates— the prop was declared onSwapWidgetPropsbut never threaded touseSwapRates, so it had no effect. Now flows through the component tree likeallowedSwapperNames; an unset prop still falls back to the existing 15s default.Issue (if applicable)
closes #
Risk
Low. Documentation-only except one self-contained
swap-widgetprop-wiring fix. The fix mirrors the existingallowedSwapperNamesthreading and preserves prior behavior when the prop is unset (15s refetch default). No new or modified on-chain transactions; no protocol, wallet, or contract interactions affected.Testing
Engineering
pnpm exec eslinton the changed files andtsc --noEmitfor theswap-widgetpackage both pass clean.ratesRefetchIntervalnow propagatesSwapWidget → SwapWidgetCore → SwapWidgetContent → useSwapDisplayValues → useSwapRates; verify by passing e.g.ratesRefetchInterval={5000}and observing the rates refetch cadence; omitting it keeps the 15s default.Operations
Docs-only plus a non-user-facing widget prop default; no operations testing required.
Screenshots (if applicable)
N/A
Summary by CodeRabbit
New Features
X-Partner-Codeheader.Documentation