Skip to content

referral system#15

Merged
Junman140 merged 1 commit into
mainfrom
PIRC
Mar 19, 2026
Merged

referral system#15
Junman140 merged 1 commit into
mainfrom
PIRC

Conversation

@Junman140

@Junman140 Junman140 commented Mar 19, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added referral earnings history card displaying payout records with dates and transaction links.
    • Added optional fee policy explanation in swap fee breakdown.
  • Updates

    • Referral link sharing now displays and uses username format instead of codes.
    • Enhanced swap fee display with role-based visibility and percentage breakdown.
    • Updated referral earnings copy to reflect automatic wallet payouts and transaction history.

@coderabbitai

coderabbitai Bot commented Mar 19, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9e8b67ca-debd-4302-8ca6-50181d86dfd9

📥 Commits

Reviewing files that changed from the base of the PR and between 0eee1eb and 4f7abad.

📒 Files selected for processing (6)
  • app/profile/rewards/page.tsx
  • components/swap/swap-card.tsx
  • lib/api/auth.ts
  • lib/api/rewards.ts
  • lib/api/swap.ts
  • lib/api/user.ts

📝 Walkthrough

Walkthrough

This PR extends the admin user model with role-based fields and profiles, adds APIs for user profile management and developer credentials, introduces payout history display to the rewards page, and enhances swap fee reporting with role-conditional fee labels and platform fee details.

Changes

Cohort / File(s) Summary
User Roles & Profiles
lib/api/auth.ts, lib/api/user.ts
Extended AdminUser type to include optional roles, business profile (company, KYC, billing), and developer profile (sandbox/production flags, webhooks, API keys). New user.ts module provides CRUD functions for profiles, API key management, and fetching current user.
Referral Payouts Display
app/profile/rewards/page.tsx, lib/api/rewards.ts
Added getReferralPayouts API function and ReferralPayoutRecord type. Updated rewards page to fetch and display payout history with transaction links, replacing manual payout threshold UI. Changed referral sharing text from "referral code" to "username".
Swap Fee Breakdown
components/swap/swap-card.tsx, lib/api/swap.ts
Extended SwapQuoteResponse with platform fee fields and reason summary. Updated fee display to show platform fees conditionally based on user role, include percentage breakdowns, and optionally display fee policy explanation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • fees and referral system #14: Touches the same rewards/referral feature with modifications to payout display and API types.
  • Pirc #11: Updates the rewards/referral functionality including rewards API and referral page UI.

Poem

🐰 A developer hops with glee,
New roles and profiles, API-dee!
Payouts now dance in history's light,
Fees break down with roles-based sight, 🎉
The warren grows, refactored right!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PIRC
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Junman140 Junman140 merged commit 935bdc0 into main Mar 19, 2026
1 of 2 checks 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.

1 participant