Skip to content

feat: add shop credits support to the navbar and publication flow - #812

Draft
RocioCM wants to merge 4 commits into
masterfrom
feat/shop-credits-collection-manager
Draft

feat: add shop credits support to the navbar and publication flow#812
RocioCM wants to merge 4 commits into
masterfrom
feat/shop-credits-collection-manager

Conversation

@RocioCM

@RocioCM RocioCM commented Jul 31, 2026

Copy link
Copy Markdown
Member

Wires shop credits (the USD-pegged shop currency) through the dapps layer, for decentraland/shop#206. Three pieces:

  • CreditsResponse gains the optional usd: { balanceCents, credits } block that credits-server now returns on the same /users/:address/credits endpoint.
  • Navbar2 derives shopCreditsBalance from that block — same pattern and withCredits gate as the existing marketplace creditsBalance, zero additional requests. onClickShopCredits stays a passthrough so each app sets its own top-up destination. As a side effect of the decentraland-ui2 bump, showManaBalancesInNavbar becomes properly typed (marketplace can drop its @ts-expect-error).
  • The credits SSE payload only carries { credits, totalCredits }, so the saga now preserves the previous usd block when a push arrives without it — otherwise the shop credits balance clears on the first SSE update. Covered in sagas.spec.ts. Extending the SSE payload server-side is a follow-up.
  • useShopCreditsCollectionManager supports the shop credits publication flow (builder publishing fees).

Draft until decentraland/ui2#461 is released — the ui2 dependency needs bumping to that version for the new NavbarProps to typecheck.

decentraland-bot and others added 4 commits July 24, 2026 13:26
…n flow

Add a new method to CreditsService that enables paying wearable collection
publishing fees with USD-pegged shop credits via POST /credits/authorize-publication.
Unlike the existing useCreditsCollectionManager (which requires pre-existing Credit[]
objects), this method gets the credit and external call signature atomically from a
single authenticated endpoint, using ADR-44 signed-fetch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The credits-server endpoint already returns a `usd` field with
`balanceCents` and `credits` when the feature flag is on. Update
the type to capture it so consumers (builder) can read the shop
credits balance. Also prefix unused `walletAddress` param.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@decentraland-bot

Copy link
Copy Markdown
Contributor

Review: feat: add shop credits support to the navbar and publication flow

Files: 4 changed (+41/−1)

Summary

Small, focused PR that wires shop credits (USD-pegged) through the dapps layer. Derives shopCreditsBalance from the credits-server response's usd block and fixes an SSE saga bug that would wipe the shop credits balance on every push update.

What looks good

  • Navbar2.tsx: Derives shopCreditsBalance from credits?.usd?.credits using the same withCredits gate as the existing marketplace creditsBalance — clean, no additional requests.
  • NavbarProps2 omit list correctly updated to include shopCreditsBalance so the dapps layer controls it.
  • SSE saga fix is important: The SSE payload only carries { credits, totalCredits } (MANA credits), not the usd block. Without this fix, every SSE push would overwrite the full credits state and wipe the shop credits balance. The saga now checks for missing usd in the SSE payload and preserves the existing usd block from state — correct approach.
  • Test coverage: The new sagas.spec.ts test verifies the SSE preservation behavior end-to-end using expectSaga — provides existing credits with a usd block, fires an SSE message without it, and asserts the merged result retains usd.

Pipeline failure

The Build and Test job fails at the tsc step with:

TS2322: Property 'shopCreditsBalance' does not exist on type 'IntrinsicAttributes & NavbarProps'

This is expected — the prop is being added in decentraland/ui2#461, which hasn't been released yet. Once ui2 is released and the decentraland-ui2 dependency is bumped here, CI will go green.

No issues found. LGTM ✅


🤖 Generated with Claude Code

@decentraland-bot decentraland-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No p0/p1/p2 findings. SSE saga preservation of the usd block is correct and well-tested. LGTM.

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