feat: add royalty earnings tracker and claim UI to creator dashboard - #1013
Open
sojetunde8 wants to merge 2 commits into
Open
sojetunde8 wants to merge 2 commits into
sojetunde8 wants to merge 2 commits into
Conversation
|
@sojetunde8 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.
Closes #987
Summary
Adds a royalty earnings section to the creator key management dashboard. The section shows total earned / pending / claimed totals, a per-transfer breakdown of the royalty events, a Claim Royalties button wired to a
claim_royaltiescontract-call mutation, and claimed history with Stellar Expert transaction hash links. Earnings data is fetched via React Query with a 60-secondrefetchInterval, matching the issue's refresh requirement and the existinguseNotificationscadence.Scope
src/services/royaltyEarnings.service.ts(new) —RoyaltyEarnings/RoyaltyEarningsEvent/RoyaltyClaimtypes andGET /creators/:creatorId/royaltiesfetcher following theBaseApiServiceconvention.src/hooks/useRoyaltyEarnings.ts(new) — React Query hook, key['creators', creatorId, 'royalties'],refetchInterval: 60_000; queryFn injectable for tests.src/hooks/useRoyaltyClaim.ts(new) —claim_royaltiesmutation followinguseCreatorContractActions' simulated-signing convention (on-chain wiring not in the client yet); invalidates the royalties query and toasts on success.src/components/creator/RoyaltyEarningsSection.tsx(new) — totals card, per-transfer breakdown list, claim button (disabled + "Claiming…" while pending), claimed history withbuildStellarExpertTxUrllinks, loading/empty/error states.src/lib/queryKeys.ts— addscreators.royalties(creatorId).src/pages/CreatorDashboardPage.tsx— renders the section on the Overview tab, below the stats card.Testing
src/components/creator/__tests__/RoyaltyEarningsSection.test.tsx(new) covers all acceptance criteria: totals rendered from the payload, per-transfer list, claim button invoking the mutation, claimed history with tx-hash links, 60s refresh (fake timers advance pastROYALTY_EARNINGS_REFETCH_INTERVAL_MS), empty and error states, and disabled claim while pending.dev, imports resolve to existing utils (formatNumber,formatRelativeTimeLabel,truncateTxHash,buildStellarExpertTxUrl).Files changed
src/services/royaltyEarnings.service.ts(new)src/hooks/useRoyaltyEarnings.ts(new)src/hooks/useRoyaltyClaim.ts(new)src/components/creator/RoyaltyEarningsSection.tsx(new)src/components/creator/__tests__/RoyaltyEarningsSection.test.tsx(new)src/lib/queryKeys.tssrc/pages/CreatorDashboardPage.tsx