Repository navigation
Build key - #1264
Merged
Merged
Build key#1264
Conversation
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) —RevenueShareDistributionandRevenueShareClaimtypes.src/services/revenueShare.service.ts(new) — readsGET /keys/:keyId/revenue-distributions?wallet=…with a tolerantnormaliser, and submits the
claim_revenue_sharecontract call.src/utils/revenueShare.utils.ts(new) — pro-rata share maths, claimabletotal, unclaimed selection, merging, and per-wallet claim persistence.
src/hooks/useRevenueShare.ts(new) —useRevenueShareDistributions,useClaimRevenueShareMutationanduseClaimAllRevenueShareMutation.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 keydetail tab strip.
src/lib/queryKeys.ts— newrevenueSharequery-key group.src/utils/creatorRevenue.utils.ts—roundToTwoDecimalsis now exported sothe share maths is shared.
Behaviour
paying holders and the holder's own share.
estimated pro-rata from the holder's key count, matching the model the
creator-side distribution preview uses.
claim_revenue_sharefor that distribution. Claim allsubmits them one after another, waiting for each to settle before sending the
next, and stops on the first failure.
claimed amount and date survive a reload.
Tests
Added coverage:
revenueShare.utils.test.ts,revenueShare.service.test.ts,RevenueSharePanel.test.tsxanduseRevenueShare.test.tsx.Note for review
Distributions are read from
GET /keys/:keyId/revenue-distributionswhen thebackend 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.