Skip to content

[#160] Fix getRoyaltyInfo ABI mismatch#161

Merged
realproject7 merged 1 commit intomainfrom
task/160-fix-royalty-abi
Mar 16, 2026
Merged

[#160] Fix getRoyaltyInfo ABI mismatch#161
realproject7 merged 1 commit intomainfrom
task/160-fix-royalty-abi

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • getRoyaltyInfo on the deployed MCV2_Bond takes (address token, address beneficiary)uint256, not (address token)(uint256, address) as previously assumed
  • Updated ABI definitions in lib/price.ts, packages/sdk/src/abi.ts, and packages/sdk/src/client.ts
  • WriterTradingStats and ClaimRoyalties now fetch the bond creator via tokenBond() and pass it as the beneficiary
  • CLI claim and status commands updated to use the correct 2-arg signature

Fixes #160

Test plan

  • tsc --noEmit — zero errors
  • next build — clean
  • vitest run — 22/22 tests pass
  • Verify on Base Sepolia: getRoyaltyInfo(token, creator) returns unclaimed amount
  • Verify writer dashboard shows earnings instead of "—"
  • Verify ClaimRoyalties button appears when royalties are available

🤖 Generated with Claude Code

…iciary)

The deployed MCV2_Bond contract's getRoyaltyInfo takes two address params
(token + beneficiary) and returns a single uint256, not one address param
returning (uint256, address). Updated ABI in lib/price.ts, SDK, and CLI.
Components now fetch the bond creator via tokenBond() and pass it as the
beneficiary argument.

Fixes #160

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

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

T2b APPROVE

Reviewed all 8 files. The ABI correction is consistent across all layers:

  1. ABI definitions (lib/price.ts, sdk/abi.ts) — Both updated to (address token, address beneficiary) → uint256. Consistent.

  2. SDK client (client.ts) — getRoyaltyInfo now takes beneficiary param, returns { unclaimed }. RoyaltyInfo interface updated. Clean breaking change.

  3. CLI (claim.ts, status.ts) — Both fetch tokenBond() first to get creator, then pass as beneficiary. Good restructuring in claim.ts to avoid duplicate tokenBond calls.

  4. Web components:

    • WriterTradingStats — Correctly splits into two dependent queries with enabled guard.
    • ClaimRoyalties — Accepts beneficiary prop, includes it in query key for proper cache invalidation.
    • writer/page.tsx — Threads writerAddress down as beneficiary. Safe since the dashboard only shows the connected wallet's storylines.

No issues found.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

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

Verdict: APPROVE

Summary

The PR corrects the deployed getRoyaltyInfo(token, beneficiary) ABI across the app, SDK, and CLI, and updates the affected royalty reads to supply the beneficiary address. I did not find any remaining one-argument callers, and CI is passing.

Findings

  • [info] No remaining blocking findings.
    • File: packages/sdk/src/client.ts:500
    • Suggestion: None.

Decision

Approving because the ABI mismatch is fixed consistently across the relevant surfaces, the writer dashboard royalty reads are restored, and the required lint-and-typecheck check is green.

@realproject7 realproject7 merged commit 8018174 into main Mar 16, 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.

[QA-Bug] Writer earnings always zero — getRoyaltyInfo reverts, ABI mismatch

2 participants