Skip to content

fix(homepage): route production onramp through vechain/onramp-proxy - #655

Merged
victhorbi merged 4 commits into
mainfrom
fix/homepage-onramp-proxy-payload
Aug 7, 2026
Merged

fix(homepage): route production onramp through vechain/onramp-proxy#655
victhorbi merged 4 commits into
mainfrom
fix/homepage-onramp-proxy-payload

Conversation

@victhorbi

@victhorbi victhorbi commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two fixes to the Transak onramp integration, bundled together per request.

1. Homepage widgetUrlBuilder didn't match the onramp-proxy contract

#654 repointed deploy-cloudfront.yaml's NEXT_PUBLIC_TRANSAK_API_URL (prod) at vechain/onramp-proxy — a GET-only endpoint (?provider=transak&address=..., response {url, partnerOrderId}) — and fixed the examples/next-template example's widgetUrlBuilder to match. It missed examples/homepage, the app that actually builds and deploys to vechainkit.vechain.org via that same workflow, which was left POSTing the old vechain-kit-infra JSON body to an endpoint that now only accepts GET.

Fix: ports the same production/staging branch already working in next-template's widgetUrlBuilder into examples/homepage's copy.

Verified locally against the real production endpoint:

curl -sS -G "https://onramp-proxy.vechain.org/" \
  --data-urlencode "provider=transak" --data-urlencode "address=0x..." \
  --data-urlencode "os=web" --data-urlencode "theme=LIGHT" \
  --data-urlencode "currency=USD" \
  --data-urlencode "referrerDomain=https://vechainkit.vechain.org" \
  --data-urlencode "fiatAmount=30"

200 {"url": "https://global.transak.com?...", "partnerOrderId": "..."} — exact shape the fixed widgetUrlBuilder now builds. Opened the returned url: the Transak widget renders cleanly (quote: $30 → ~5880 VET, Vechain Network, card payment available), no IP/ASN mismatch error (unlike the old vechain-kit-infra proxy).

2. "Add card details" step rendered clipped/overlapping the quote screen

Reported via screenshot: inside the embedded widget, the card-details form overlapped the screen underneath it instead of replacing it cleanly.

Root cause (confirmed against @transak/ui-js-sdk@1.0.0's actual runtime source): in containerId mode the SDK always renders its iframe at width:100%; height:100% of the container element — widgetWidth/widgetHeight config options are silently ignored in that mode (they only apply to the SDK's own standalone full-screen overlay, used when no containerId is passed). So the container's own CSS is what actually bounds the widget, and both copies of it in this repo (TransakCheckoutModal, AccountModal/Contents/TransakOnramp/TransakOnrampContent) capped it at maxH="620px" — well under Transak's own documented single-embed sizing of height: 80dvh (docs.transak.com/integration/web/iframe), which is what the deeper flow steps (KYC, add-card-details) actually need. The card-details screen didn't fit, so it rendered clipped and overlapping the quote screen behind it.

Fix: raises both containers to h="80dvh" (clamped 560px900px), matching Transak's own guidance.

Verification: confirmed via the SDK's published source (@transak/ui-js-sdk@1.0.0/lib/index.js) and Transak's iframe integration doc; not re-tested against the live "add card details" screen itself (would require a full wallet-connected session in the demo app taken deep into a real payment flow, which I avoided going further into than viewing).

🤖 Generated with Claude Code

#654 repointed deploy-cloudfront's NEXT_PUBLIC_TRANSAK_API_URL_PROD secret
at vechain/onramp-proxy (GET contract) and fixed the next-template example's
widgetUrlBuilder to match, but the actual production build (examples/homepage,
deployed to vechainkit.vechain.org) was left on the old vechain-kit-infra
POST/JSON contract — so the deployed widgetUrlBuilder now POSTs JSON to a
GET-only endpoint and every production onramp call 405s. Ports the same
production/staging branch already working in next-template.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@victhorbi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2620d762-c036-4e53-b69d-2b1b888920b1

📥 Commits

Reviewing files that changed from the base of the PR and between 3968ba2 and 2a941a2.

📒 Files selected for processing (10)
  • examples/playground/.env.example
  • examples/playground/src/app/(playground)/data/page.tsx
  • examples/playground/src/app/(playground)/payments/page.tsx
  • examples/playground/src/app/components/layout/navItems.ts
  • examples/playground/src/app/providers/VechainKitProviderWrapper.tsx
  • packages/vechain-kit/src/components/AccountModal/AccountModal.tsx
  • packages/vechain-kit/src/components/AccountModal/Contents/TransakOnramp/TransakOnrampContent.tsx
  • packages/vechain-kit/src/components/PayWithTransakButton/PayWithTransakButton.tsx
  • packages/vechain-kit/src/components/TransakCheckoutModal/TransakCheckoutModal.tsx
  • packages/vechain-kit/src/hooks/payments/useTransakCheckout.ts
📝 Walkthrough

Walkthrough

The provider now uses a production onramp proxy for Transak widget URLs. It sends query parameters with GET, validates the response, and preserves the existing non-production POST flow.

Changes

Transak widget URL flow

Layer / File(s) Summary
Production proxy request and response validation
examples/homepage/src/app/providers/VechainKitProviderWrapper.tsx
Production builds Transak query parameters, optionally includes fiatAmount, calls the onramp proxy with GET, returns the response URL, and reports unsuccessful responses or missing URLs. Non-production keeps the existing POST endpoint.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: davidecarpini, agilulfo1820

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: routing production homepage onramp requests through the Vechain onramp proxy.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/homepage-onramp-proxy-payload

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Size Change: +14.7 kB (+0.16%)

Total Size: 9.03 MB

Filename Size Change
packages/vechain-kit/dist/index-BH7jqfB8.d.mts 0 B -5.63 kB (removed) 🏆
packages/vechain-kit/dist/index-BH7jqfB8.d.mts.map 0 B -2.99 kB (removed) 🏆
packages/vechain-kit/dist/index-BWiqLqRg.d.mts 0 B -190 kB (removed) 🏆
packages/vechain-kit/dist/index-BWiqLqRg.d.mts.map 0 B -50.4 kB (removed) 🏆
packages/vechain-kit/dist/index-CMamqD3w.d.cts 0 B -190 kB (removed) 🏆
packages/vechain-kit/dist/index-CMamqD3w.d.cts.map 0 B -51.6 kB (removed) 🏆
packages/vechain-kit/dist/index-DksqLJEA.d.cts 0 B -5.63 kB (removed) 🏆
packages/vechain-kit/dist/index-DksqLJEA.d.cts.map 0 B -2.99 kB (removed) 🏆
packages/vechain-kit/dist/index.cjs.map 2.9 MB +5.99 kB (+0.21%)
packages/vechain-kit/dist/index.mjs.map 2.84 MB +5.85 kB (+0.21%)
packages/vechain-kit/dist/index-96sI3giT.d.cts 5.63 kB +5.63 kB (new file) 🆕
packages/vechain-kit/dist/index-96sI3giT.d.cts.map 2.99 kB +2.99 kB (new file) 🆕
packages/vechain-kit/dist/index-CcQYMCEr.d.mts 190 kB +190 kB (new file) 🆕
packages/vechain-kit/dist/index-CcQYMCEr.d.mts.map 50.4 kB +50.4 kB (new file) 🆕
packages/vechain-kit/dist/index-DldZh604.d.cts 190 kB +190 kB (new file) 🆕
packages/vechain-kit/dist/index-DldZh604.d.cts.map 51.7 kB +51.7 kB (new file) 🆕
packages/vechain-kit/dist/index-UjeEZ8Md.d.mts 5.63 kB +5.63 kB (new file) 🆕
packages/vechain-kit/dist/index-UjeEZ8Md.d.mts.map 2.99 kB +2.99 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
packages/vechain-kit/dist/assets 4.1 kB 0 B
packages/vechain-kit/dist/assets-BpQtJMK4.mjs 51.4 kB 0 B
packages/vechain-kit/dist/assets-BpQtJMK4.mjs.map 74.7 kB 0 B
packages/vechain-kit/dist/assets-qmvJ4lSm.cjs 59 kB 0 B
packages/vechain-kit/dist/assets-qmvJ4lSm.cjs.map 76.2 kB 0 B
packages/vechain-kit/dist/assets/index.cjs 717 B 0 B
packages/vechain-kit/dist/assets/index.d.cts 973 B 0 B
packages/vechain-kit/dist/assets/index.d.mts 973 B 0 B
packages/vechain-kit/dist/assets/index.mjs 719 B 0 B
packages/vechain-kit/dist/index.cjs 1.16 MB +870 B (+0.08%)
packages/vechain-kit/dist/index.d.cts 25 kB 0 B
packages/vechain-kit/dist/index.d.mts 25 kB 0 B
packages/vechain-kit/dist/index.mjs 1.11 MB +777 B (+0.07%)
packages/vechain-kit/dist/utils 4.1 kB 0 B
packages/vechain-kit/dist/utils-Bf4wG_2j.cjs 27.4 kB 0 B
packages/vechain-kit/dist/utils-Bf4wG_2j.cjs.map 69.8 kB 0 B
packages/vechain-kit/dist/utils-Y7vw7K0X.mjs 22.2 kB 0 B
packages/vechain-kit/dist/utils-Y7vw7K0X.mjs.map 69 kB 0 B
packages/vechain-kit/dist/utils/index.cjs 2.02 kB 0 B
packages/vechain-kit/dist/utils/index.d.cts 3.1 kB 0 B
packages/vechain-kit/dist/utils/index.d.mts 3.1 kB 0 B
packages/vechain-kit/dist/utils/index.mjs 2.04 kB 0 B

compressed-size-action

@victhorbi

Copy link
Copy Markdown
Collaborator Author

Verified locally against the real production endpoint before requesting review:

curl -sS -G "https://onramp-proxy.vechain.org/" \
  --data-urlencode "provider=transak" \
  --data-urlencode "address=0x..." \
  --data-urlencode "os=web" \
  --data-urlencode "theme=LIGHT" \
  --data-urlencode "currency=USD" \
  --data-urlencode "referrerDomain=https://vechainkit.vechain.org" \
  --data-urlencode "fiatAmount=30"

200 {"url": "https://global.transak.com?...", "partnerOrderId": "..."} — exact request shape the fixed widgetUrlBuilder now builds.

Opened the returned url in a browser: the Transak widget renders cleanly (quote: $30 → ~5880 VET, Vechain Network, card payment available), no IP/ASN mismatch error (unlike the old vechain-kit-infra proxy).

🤖 Generated with Claude Code

Reported: the "Add card details" step rendered clipped/overlapping the
quote screen underneath it inside the embedded widget.

Root cause (confirmed against @transak/ui-js-sdk@1.0.0's actual runtime):
in containerId mode the SDK always renders the iframe at width:100%;
height:100% of its container — widgetWidth/widgetHeight config options are
silently ignored in that mode (they only apply to the SDK's own standalone
overlay, used when no containerId is passed). So the container's own CSS
is what bounds the widget, and both copies of it (TransakCheckoutModal,
TransakOnrampContent) capped it at maxH="620px" — well under Transak's own
documented single-embed sizing of `height: 80dvh`
(docs.transak.com/integration/web/iframe), which is closer to what the
deeper flow steps (KYC, add-card-details) actually need. Raises both
containers to 80dvh (560-900px clamp) to match.
…frame

Reported on the preview deploy: opening the widget showed a blank white
container for a few seconds (the iframe loading Transak's remote app),
and the whole flow felt cramped -- the modal wasn't using the available
screen space.

- useTransakCheckout: track `widgetReady`, flipped by the SDK's
  TRANSAK_WIDGET_INITIALISED event (previously unused). False from the
  moment the widget opens until the iframe has actually rendered.
- TransakCheckoutModal / TransakOnrampContent: render a centered Spinner
  as a sibling overlay while `!widgetReady` -- never as a child of the
  SDK's own container div, since the SDK appends/removes the iframe via
  direct DOM calls (containerId mode) that would fight React for that
  node's children.
- TransakCheckoutModal: BaseModal size 'sm' -> 'lg' (Transak's own
  single-embed sample uses a 500px-wide container; 'sm' was 384px).
- AccountModal: the 'transak-onramp' content type now gets its own
  larger size/height ('lg', up to 90dvh) instead of the fixed 485px/'sm'
  every other AccountModal screen uses -- that fixed cap was squeezing
  an embedded external payment app (quote, KYC, add-card-details) into
  a size tuned for simple menu/settings screens.
- New "Payments" page (mirrors the "Transactions" page's structure):
  PayWithTransakButton for the drop-in Buy VET button, plus a
  useTransakCheckout demo for a fully custom trigger. Added to the
  sidebar nav under Build, status NEW.
- "Reading Data" page: new DemoSection for useTotalBalance -- one USD
  figure across liquid tokens + staking positions, the same total the
  AccountModal shows.
- Wired transak config into the playground's VechainKitProviderWrapper
  (same dual-contract widgetUrlBuilder as the homepage example: prod ->
  vechain/onramp-proxy, staging -> vechain-kit-infra), gated on the new
  NEXT_PUBLIC_TRANSAK_* env vars (added to .env.example, all optional --
  the Payments page degrades to the hook's built-in "not configured"
  error when unset, same as every other example integration here).
@victhorbi

Copy link
Copy Markdown
Collaborator Author

Added to the playground (`examples/playground`):

  • New "Payments" page (mirrors the "Transactions" page): `PayWithTransakButton` for the drop-in Buy VET flow, plus a `useTransakCheckout` demo for a fully custom trigger. Sidebar nav entry under Build, status NEW.
  • "Reading Data" page: new demo section for `useTotalBalance` — total portfolio value in USD (liquid tokens + staking positions), live.
  • Wired the same dual-contract `widgetUrlBuilder` (prod → onramp-proxy, staging → vechain-kit-infra) into the playground's provider, gated on new optional `NEXT_PUBLIC_TRANSAK_*` env vars — degrades to the hook's built-in "not configured" message when unset, same posture as every other example integration in this app.

🤖 Generated with Claude Code

@victhorbi
victhorbi merged commit 2c9bd8e into main Aug 7, 2026
7 checks passed
@victhorbi
victhorbi deleted the fix/homepage-onramp-proxy-payload branch August 7, 2026 10:26
@davidecarpini davidecarpini mentioned this pull request Aug 28, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants