feat(arns): Pay for ArNS names with Turbo Credits (Phase 1, Model B) - #956
feat(arns): Pay for ArNS names with Turbo Credits (Phase 1, Model B)#956vilenarios wants to merge 3 commits into
Conversation
- Re-enable the Credits checkout tab, wired to the bundler payment-service REST (POST /v1/arns/purchase/:intent/:name) via the turbo-sdk ArNS-purchase methods; credits are debited server-side and the bundler fronts ARIO + SOL. - Cover buy-name / extend-lease / increase-undername / upgrade-name. - Model B: the Solana user owns the ANT (spawned client-side; processId passed to the bundler). @ar.io/sdk fundFrom:'turbo' is a no-op alias, so settlement is rerouted to the bundler REST. - Add nonce poll + resilience (arnsPurchaseResume) and a custody strategy seam (custodyStrategy.ts) for the future Model A path. - Make upload/gateway/payment URLs env-configurable. - Add an esbuild (dev) + rollup (build) codec shim rewriting the renamed getDataEnumCodec -> getDiscriminatedUnionCodec import dragged in by @solana/spl-token-metadata, so the browser build resolves. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (15)
✨ Finishing Touches🧪 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 |
The ArNS-purchase methods are now published on the @Alpha dist-tag (ardriveapp/turbo-sdk#435 merged). Replaces the local-tarball / placeholder pin so CI installs a real, resolvable version and the build is reproducible. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Permaweb Preview DeployedYour preview is available at: https://arns-react-pr-956_arns.ar.io
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
…aid BUY The Model B credits BUY flow spawns a user-owned ANT client-side (real SOL) before a server-fronted, credit-funded buy. Several P0 gaps let a user lose SOL, hit dead-end errors, or misread what they were paying: - SOL pre-flight gate now covers the credits path, not just crypto. Paying with credits still needs ~0.02 SOL for the ANT spawn, so a credits-rich / SOL-empty wallet is blocked + the "Pay now" button relabels to "Insufficient SOL" BEFORE clicking. Extracted the predicate into a pure, unit-tested checkInsufficientSolForGas() and added copy on the Credits tab. - Runtime 402 (InsufficientCreditsError) now opens the TurboTopUpModal instead of a dead-end error toast. - Orphan-ANT / SOL-bleed fix: persist the spawned ANT processId into the resume store BEFORE the buy; a retry REUSES it instead of spawning (and paying for) another. A non-402 failure after spawn surfaces an honest "your ANT was created, retrying reuses it, credits weren't charged" message. - Removed the stale "temporarily disabled" tooltip on the now-live Credits tab. - Added USD + ARIO real-world anchors next to the "Total due: X Credits" figure. - Invalidate turbo-credit-balance after a purchase so the debit shows at once. - PrimaryNameModal: documented that set-primary-name is ARIO-only (the credit path type excludes Primary-Name-Request); it never presented a credits option, so no user is misled — added a guard comment against a future fundFrom:'turbo'. Tests: new unit suites for the SOL gate, resume store (processId persistence), and the dispatch reuse-on-retry / honest-message / 402-passthrough behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CFu1gpBLo6pe5kBFNw5NF9
|
@coderabbitai review |
✅ Action performedReview finished.
|
What this does
Re-enables the Credits checkout tab, wired to the bundler payment-service
POST /v1/arns/purchase/:intent/:name. Credits are debited server-side andthe bundler fronts the ARIO + SOL; the browser never needs ARIO or SOL to
register a name.
upgrade-name.
processIdis passed to the bundler, so the user retains ownership.@ar.io/sdk'sfundFrom: 'turbo'turned out to be a no-op alias, sosettlement was rerouted to the bundler REST API via the turbo-sdk ArNS-purchase
methods.
ardriveapp/turbo-sdk#feat/arns-purchase-with-credits(est.@ardrive/turbo-sdk@1.43.0-alpha.1). This PR already updates the dependencypin to
1.43.0-alpha.1, butyarn.lockmust be regenerated once the alphais on npm (it is intentionally not included here — the local build used a
file:tarball pin).Testing status
TurboArNSClient.test.ts).was registered on-chain paying with Turbo Credits.
tsc✓ (save 1 pre-existing unrelated error), Biome ✓.Dep-blocker shim
@ardrive/turbo-sdk → @solana/spl-token-metadata@0.1.6imports the renamedgetDataEnumCodec; a scoped Vite (rollup) + esbuild (dev) transformrewrites it to
getDiscriminatedUnionCodecso the browser build resolves.Follow-up: fix turbo-sdk to not drag rc.1 codecs into the browser build,
which removes the shim.
Configurability
Payment / upload / gateway URLs are now env-configurable via
VITE_PAYMENT_SERVICE_URL,VITE_UPLOAD_SERVICE_URL, andVITE_GATEWAY_URL, sothe app can point at any bundler (e.g.
*.services.perma.online).Deferred
already present (
custodyStrategy.ts).🤖 Generated with Claude Code