Skip to content

Build key - #1264

Merged
Chucks1093 merged 3 commits into
accesslayerorg:devfrom
assumptaamara:buildKey
Oct 21, 2026
Merged

Chucks1093 merged 3 commits into
accesslayerorg:devfrom
assumptaamara:buildKey

Conversation

@assumptaamara

Copy link
Copy Markdown
Contributor

Summary

Adds a Revenue Share tab to the key detail page. Holders can see every
revenue distribution the creator has made for the key — the date, the total
distributed and their own pro-rata share — and claim what is owed to them.

What changed

  • src/types/revenueShare.ts (new) — RevenueShareDistribution and
    RevenueShareClaim types.
  • src/services/revenueShare.service.ts (new) — reads
    GET /keys/:keyId/revenue-distributions?wallet=… with a tolerant
    normaliser, and submits the claim_revenue_share contract call.
  • src/utils/revenueShare.utils.ts (new) — pro-rata share maths, claimable
    total, unclaimed selection, merging, and per-wallet claim persistence.
  • src/hooks/useRevenueShare.ts (new) — useRevenueShareDistributions,
    useClaimRevenueShareMutation and useClaimAllRevenueShareMutation.
  • src/components/common/RevenueSharePanel.tsx (new) — the panel: summary,
    per-entry claim, claim all, claimed state, empty and error states.
  • src/pages/CreatorDetailPage.tsx — the Revenue Share tab, added to the key
    detail tab strip.
  • src/lib/queryKeys.ts — new revenueShare query-key group.
  • src/utils/creatorRevenue.utils.ts — roundToTwoDecimals is now exported so
    the share maths is shared.

Behaviour

  • Each entry shows the distribution date, the total distributed, the number of
    paying holders and the holder's own share.
  • The holder's share comes from the server; when it is not reported it is
    estimated pro-rata from the holder's key count, matching the model the
    creator-side distribution preview uses.
  • Claim submits claim_revenue_share for that distribution. Claim all
    submits them one after another, waiting for each to settle before sending the
    next, and stops on the first failure.
  • A settled claim is written to the cache and persisted per wallet, so the
    claimed amount and date survive a reload.
  • With no wallet connected the panel asks the user to connect before listing.

Tests

Added coverage: revenueShare.utils.test.ts, revenueShare.service.test.ts,
RevenueSharePanel.test.tsx and useRevenueShare.test.tsx.

Note for review

Distributions are read from GET /keys/:keyId/revenue-distributions when the
backend exposes it, and from the locally recorded creator distributions
otherwise — the same source the creator dashboard already lists. A missing
endpoint is treated as "no server distributions" rather than an error, matching
how the badges endpoint is handled.

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@assumptaamara Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit fadbd33 into accesslayerorg:dev Oct 21, 2026
1 check passed
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.

Build key creator revenue share claim UI on key detail page

2 participants