Skip to content

Improve royalty claim UX: post-claim state + claimed history #328

@realproject7

Description

@realproject7

Context

The ClaimRoyalties component (src/components/ClaimRoyalties.tsx) needs UX improvements for post-claim state and royalty history display.

Currently after claiming:

  • The button shows "Claimed X WETH" but stays green/active — should go inactive
  • The tx link is shown but the balance display doesn't immediately reflect 0
  • No historical "total claimed" info shown

The contract's getRoyaltyInfo(wallet, reserveToken) already returns both (balance, claimed) — we have access to the cumulative claimed amount without any extra calls.

Tasks

1. Post-claim success state

After a successful claim:

  • Balance display should show 0 WETH (refetch already happens, but ensure UI reflects it)
  • Claim button should be disabled with text "Claimed" (not clickable)
  • Show success message with clickable tx link to BaseScan, e.g.:
    Claimed 0.0001 WETH — tx: 0xabc...def
  • Clicking "Claimed" button or waiting for next refetch cycle should reset to idle state showing the updated (zero) balance

2. Show cumulative claimed royalties

  • Read the claimed value from getRoyaltyInfo (second return value — already available in the ABI after PR [#321] Fix SDK royalty ABI/client and web app MCV2 ABI accuracy #326 fix)
  • Display total claimed amount alongside unclaimed, e.g.:
    ROYALTIES: 0 WETH (claimed: 0.0001 WETH so far)
  • Only show the "claimed so far" portion if claimed > 0 — don't clutter the UI when nothing has been claimed yet

Files to Change

  • src/components/ClaimRoyalties.tsx — main component

Current getRoyaltyInfo call (line 42-47)

The query already reads from getRoyaltyInfo(beneficiary, PLOT_TOKEN) which returns [balance, claimed]. Currently only balance is used. Destructure both values:

const [balance, claimed] = await publicClient.readContract({
  address: MCV2_BOND,
  abi: mcv2BondAbi,
  functionName: "getRoyaltyInfo",
  args: [beneficiary, PLOT_TOKEN],
});
return { unclaimed: balance, claimed };

Acceptance Criteria

  • After successful claim, balance shows 0 and Claim button is disabled
  • Success message includes clickable tx link (BaseScan)
  • Cumulative "claimed so far" amount shown when > 0
  • Button resets to normal idle state on next data refetch
  • npm run build and npm run typecheck pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/T3Assigned to T3 builder agentenhancementNew feature or requestphase/5-tradingPhase 5: Token Trading

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions