Skip to content

donations added#8

Merged
Junman140 merged 3 commits into
mainfrom
PIRC
Mar 2, 2026
Merged

donations added#8
Junman140 merged 3 commits into
mainfrom
PIRC

Conversation

@Junman140

@Junman140 Junman140 commented Mar 2, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Donate UI with Pi-network payments, donation modal, and recent-donations tracking
    • Project management pages: register projects and view "My projects"
    • Create launch/token flow for approved projects
    • View transactions on an external explorer from trade/swap/history views
  • Improvements

    • Mint (Launchpad) and Launch navigation shown only to admins
    • "Trade" relabeled to "Save"
    • Social links added to profile (GitHub, Telegram, X)

@coderabbitai

coderabbitai Bot commented Mar 2, 2026

Copy link
Copy Markdown
ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 416ef5a and 4831e5b.

📒 Files selected for processing (4)
  • app/token/[code]/page.tsx
  • components/swap/recent-swaps.tsx
  • components/transaction-history.tsx
  • lib/explorer.ts

📝 Walkthrough

Walkthrough

Adds donation UI and Pi payment flows, project management and launch creation pages, role-gated admin UI for minting, explorer transaction viewing, new project & pi-payments APIs, and enhancements to the Pi provider and app navigation/metadata.

Changes

Cohort / File(s) Summary
Access Control & Admin UI
app/dashboard/page.tsx, app/mint/page.tsx, app/profile/page.tsx
Mint action and Mint page now require profile?.role === "admin". Profile page injects admin-only Launchpad link; non-admins see informational alerts/redirects instead of mint UI.
Donation UI & Modal
app/donate/page.tsx, components/donation-modal.tsx
New Donate page and DonationModal component implementing Pi auth, predefined/custom amounts, memo, status states, and onSuccess callback. Review modal state handling and integration with Pi provider.
Pi Provider & Payment Lifecycle
components/providers/pi-provider.tsx, lib/api/pi-payments.ts
Extended createPayment signature to accept donationData; added approve/complete/cancel flows and sandbox consistency; cancel incomplete payments fire-and-forget. New API wrappers: approvePiPayment, completePiPayment, cancelPiPayment. Check server-await semantics and error paths.
Project APIs & Launchpad
lib/api/projects.ts, lib/api/launchpad.ts, lib/api/index.ts
New typed projects API (list/get/create/update) and CreateLaunchWithTokenPayload + createLaunchWithToken. lib/api/index.ts now re-exports ./projects. Verify payload shapes and totalSupply string coercion.
Investing Pages
app/invest/create/page.tsx, app/invest/projects/page.tsx, app/invest/page.tsx
Added Create Launch page (form + validation + createLaunchWithToken) and My Projects page (project listing, registration, status badges). Invest index adds header actions. Validate form-to-API mapping and UX states.
Explorer Integration
lib/explorer.ts, app/token/[code]/page.tsx, components/swap/recent-swaps.tsx, components/transaction-history.tsx
New explorer helpers (getTransactionExplorerUrl, viewTransactionOnExplorer) and replaced copy actions with "View on explorer" calls; transaction hash badges become clickable. Check URL selection logic (mainnet vs testnet).
Layout & Navigation
app/layout.tsx, app/page.tsx
Removed a contributor from metadata.generator; renamed trade action to savings and updated routing/labels.
Misc / Integrations
components/..., app/... (other small edits)
Small UI imports and icon additions (e.g., Heart, ExternalLink), minor layout tweaks across profile and other components.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant UI as DonationModal<br/>(component)
    participant Pi as Pi Provider
    participant API as Payment API<br/>(approve/complete)
    participant Backend as Backend Server

    User->>UI: open modal / choose amount
    UI->>UI: validate input (amount>0, logged in)
    User->>UI: submit donation
    activate UI
    UI->>Pi: createPayment(amount,memo,donationData)
    activate Pi
    Pi->>API: POST /pi/payments/approve (paymentId)
    activate API
    API->>Backend: approve request
    Backend-->>API: approval result
    API-->>Pi: approval response
    deactivate API

    Pi->>API: POST /pi/payments/complete (paymentId, txid, donationData)
    activate API
    API->>Backend: complete & record donation
    Backend-->>API: completion result
    API-->>Pi: completion response
    deactivate API

    Pi-->>UI: payment success (paymentId, txid)
    deactivate Pi
    UI->>User: call onSuccess(paymentId, amount)
    UI->>UI: show success, reset & close
    deactivate UI
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 I nibble keys and twirl my whiskers,
I hush the bugs and charm the fixtures,
Donations, launches, roles in tune—
I hop, I ship, beneath the moon. ✨


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@Junman140 Junman140 merged commit a5eb373 into main Mar 2, 2026
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