Skip to content

Conversation

@MananTank
Copy link
Member

@MananTank MananTank commented Sep 4, 2025


PR-Codex overview

This PR primarily refines the payment handling in the application by introducing a new BridgePayment type, updating the data types for payment amounts, and ensuring that only bridge payments are processed in relevant components.

Detailed summary

  • Replaced Payment type with BridgePayment in TableRow and getCSVData.
  • Updated amount fields in BridgePayment to use string instead of bigint.
  • Introduced isBridgePayment function to filter payments.
  • Updated PaymentHistory to filter and display only bridge payments.
  • Changed how amounts are converted to tokens using BigInt.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Payments view and CSV export now show only bridge payments; onramp entries are excluded.
  • Bug Fixes

    • Improved accuracy for very large origin/destination amounts by converting amounts to integer form before token conversion.
    • Consistent token conversions across table, links, and CSV exports.
  • Refactor

    • Payment data model reorganized into distinct bridge vs onramp variants to enable reliable filtering and export.

@vercel
Copy link

vercel bot commented Sep 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
thirdweb-www Ready Ready Preview Comment Sep 4, 2025 2:54pm
4 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs-v2 Skipped Skipped Sep 4, 2025 2:54pm
nebula Skipped Skipped Sep 4, 2025 2:54pm
thirdweb_playground Skipped Skipped Sep 4, 2025 2:54pm
wallet-ui Skipped Skipped Sep 4, 2025 2:54pm

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 4, 2025 12:44 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 4, 2025 12:44 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula September 4, 2025 12:44 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui September 4, 2025 12:44 Inactive
@changeset-bot
Copy link

changeset-bot bot commented Sep 4, 2025

⚠️ No Changeset found

Latest commit: 17d40af

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 4, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Refactors Payment into a discriminated union (Bridge vs Onramp), moves bridge-specific fields into the Bridge variant, converts numeric amounts to strings, adds clientId/receiver/developer fee fields, exports BridgePayment, and updates UI components to filter for BridgePayment and convert string amounts to BigInt for formatting and CSV.

Changes

Cohort / File(s) Summary
Universal Bridge API types
apps/dashboard/src/@/api/universal-bridge/developer.ts
Replaces flat Payment type with a discriminated union: common fields (id, createdAt, clientId, receiver, transactions, status, destinationAmount as string, destinationToken, purchaseData) plus a Bridge variant (`type: "buy"
Payments UI list and CSV
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx
Imports BridgePayment. Adds isBridgePayment type guard, filters API results to Bridge payments for rendering and CSV. Updates getCSVData signature to BridgePayment[] and uses BigInt(...) to convert destinationAmount/originAmount before token formatting.
Payments table row
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
Changes prop type to purchase: BridgePayment. Converts originAmount and destinationAmount with BigInt(...) before calling token formatter (toTokens). Other rendering logic unchanged.
Payment links revenue calc
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
Uses BigInt(curr.destinationAmount) when passing amounts to toTokens during revenue accumulation; accumulation and formatting logic otherwise unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as Payments UI
  participant API as getPayments()
  participant TF as TokenFormatter (toTokens)

  UI->>API: fetchPayments()
  API-->>UI: Payment[] (Bridge | Onramp)

  UI->>UI: filter isBridgePayment() → BridgePayment[]
  rect rgb(220,245,230)
    note right of UI: Render rows & generate CSV from BridgePayment[]
    UI->>TF: toTokens(BigInt(originAmount), originToken)
    TF-->>UI: formatted origin
    UI->>TF: toTokens(BigInt(destinationAmount), destinationToken)
    TF-->>UI: formatted destination
  end

  UI->>UI: produce CSV from BridgePayment[]
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mnn/fix-bridge-crash

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MananTank MananTank marked this pull request as ready for review September 4, 2025 12:44
@MananTank MananTank requested review from a team as code owners September 4, 2025 12:44
@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Sep 4, 2025
Copy link
Member Author

MananTank commented Sep 4, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codecov
Copy link

codecov bot commented Sep 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.53%. Comparing base (bc6309d) to head (17d40af).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7982   +/-   ##
=======================================
  Coverage   56.53%   56.53%           
=======================================
  Files         904      904           
  Lines       58626    58626           
  Branches     4146     4146           
=======================================
  Hits        33145    33145           
  Misses      25375    25375           
  Partials      106      106           
Flag Coverage Δ
packages 56.53% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MananTank MananTank force-pushed the mnn/fix-bridge-crash branch from 5ddc5f9 to d8611da Compare September 4, 2025 12:47
@vercel vercel bot temporarily deployed to Preview – wallet-ui September 4, 2025 12:48 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 4, 2025 12:48 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 4, 2025 12:48 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula September 4, 2025 12:48 Inactive
@MananTank MananTank changed the title fix payments tx history crash Dashboard: fix payments tx history table crashing Sep 4, 2025
@MananTank MananTank changed the title Dashboard: fix payments tx history table crashing Dashboard: fix payments tx history table crashing on onramp entry Sep 4, 2025
@MananTank MananTank changed the title Dashboard: fix payments tx history table crashing on onramp entry Dashboard: fix payments tx history table crashing on onramp type Sep 4, 2025
@MananTank MananTank changed the title Dashboard: fix payments tx history table crashing on onramp type Dashboard: fix payments tx history table crashing on onramp type purchase Sep 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.01 KB (0%) 1.3 s (0%) 224 ms (+184.95% 🔺) 1.6 s
thirdweb (cjs) 357.32 KB (0%) 7.2 s (0%) 661 ms (+8.45% 🔺) 7.9 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 112 ms (+2186.31% 🔺) 226 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 78 ms (+4725.73% 🔺) 88 ms
thirdweb/react (minimal + tree-shaking) 19.15 KB (0%) 383 ms (0%) 74 ms (+560.24% 🔺) 457 ms

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx (1)

88-90: Consider handling edge cases in payment filtering

While the filtering implementation is correct, consider what happens when all payments are filtered out (all onramp payments). The UI already handles empty state, but you might want to add a more specific message for this scenario.

Consider adding a specific message when payments exist but are all filtered out:

-{isEmpty && !isLoading ? (
+{isEmpty && !isLoading ? (
   <div className="flex min-h-[150px] w-full items-center justify-center text-muted-foreground text-sm">
-    No data available
+    {payPurchaseData?.data.length > 0 ? "No bridge payments available" : "No data available"}
   </div>
 ) : payPurchaseData ? (
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bc6309d and d8611da.

📒 Files selected for processing (3)
  • apps/dashboard/src/@/api/universal-bridge/developer.ts (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx (4 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
apps/{dashboard,playground-web}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/* (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
apps/{dashboard,playground}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

apps/{dashboard,playground}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/_ (e.g., Button, Input, Tabs, Card)
Use NavLink for internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names with cn() from @/lib/utils for conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start with import "server-only"; use next/headers, server‑only env, heavy data fetching, and redirect() where appropriate
Client Components must start with 'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: call getAuthToken() from cookies, send Authorization: Bearer <token> header, and return typed results (avoid any)
Client-side data fetching: wrap calls in React Query with descriptive, stable queryKeys and set sensible staleTime/cacheTime (≥ 60s default); keep tokens secret via internal routes or server actions
Do not import posthog-js in server components (client-side only)

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
apps/{dashboard,playground}/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Expose a className prop on the root element of every component

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: gregfromstl
PR: thirdweb-dev/js#7450
File: packages/thirdweb/src/bridge/Webhook.ts:57-81
Timestamp: 2025-06-26T19:46:04.024Z
Learning: In the onramp webhook schema (`packages/thirdweb/src/bridge/Webhook.ts`), the `currencyAmount` field is intentionally typed as `z.number()` while other amount fields use `z.string()` because `currencyAmount` represents fiat currency amounts in decimals (like $10.50), whereas other amount fields represent token amounts in wei (very large integers that benefit from bigint representation). The different naming convention (`currencyAmount` vs `amount`) reflects this intentional distinction.
📚 Learning: 2025-08-20T10:35:18.543Z
Learnt from: jnsdls
PR: thirdweb-dev/js#7888
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/page.tsx:77-81
Timestamp: 2025-08-20T10:35:18.543Z
Learning: The webhooks/payments route exists at apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/payments/page.tsx and was added as part of the unified project layout changes.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
📚 Learning: 2025-08-20T10:35:18.543Z
Learnt from: jnsdls
PR: thirdweb-dev/js#7888
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/page.tsx:77-81
Timestamp: 2025-08-20T10:35:18.543Z
Learning: The webhooks/payments route exists at apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/payments/page.tsx and was added as part of the unified project layout PR #7888.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
🧬 Code graph analysis (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx (1)
  • TableRow (10-90)
apps/dashboard/src/@/api/universal-bridge/developer.ts (2)
  • Payment (304-344)
  • BridgePayment (346-346)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx (1)
apps/dashboard/src/@/api/universal-bridge/developer.ts (1)
  • BridgePayment (346-346)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (9)
apps/dashboard/src/@/api/universal-bridge/developer.ts (4)

300-303: Good type refactoring for discriminated union

The introduction of explicit type aliases for BridgePaymentType and OnrampPaymentType improves code readability and type safety. This discriminated union pattern is a solid approach to prevent type-related crashes.


316-317: String type for amounts aligns with webhook patterns

Using string for destinationAmount is consistent with the established pattern for token amounts in wei, as noted in the retrieved learnings about amount field types in the codebase.


328-329: Consider making blockNumber required for data consistency

The blockNumber field is marked as optional. If this field is expected to be present for completed transactions, consider making it required to ensure data consistency.


346-346: Clean type extraction for bridge payments

The BridgePayment type extraction using TypeScript's Extract utility type is a clean and type-safe way to narrow the union type.

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx (2)

3-13: Type update properly constrains input to bridge payments only

The function signature correctly updates to accept BridgePayment instead of Payment, ensuring that only bridge-type payments with the required fields are processed. This prevents runtime errors from accessing undefined fields.


16-17: Proper BigInt conversion for string amounts

Converting string amounts to BigInt before passing to toTokens is correct and necessary. This handles the API's string representation of wei amounts properly.

Also applies to: 20-21

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx (3)

127-129: Type guard correctly filters out onramp payments

The type guard implementation is correct and efficiently filters out onramp payments. The condition purchase.type !== "onramp" properly narrows the type.


63-65: CSV export correctly filters bridge payments

Good practice to filter payments before CSV export, ensuring only bridge payments with the required fields are processed.


131-141: CSV function signature and BigInt conversion are correct

The function correctly accepts BridgePayment[] and properly converts string amounts to BigInt. This ensures type safety throughout the CSV export process.

@MananTank MananTank force-pushed the mnn/fix-bridge-crash branch from d8611da to 29be72e Compare September 4, 2025 13:14
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 4, 2025 13:14 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 4, 2025 13:14 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula September 4, 2025 13:14 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui September 4, 2025 13:14 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx (1)

295-320: Fix mislabeled destructive action: “Delete Webhook” → “Delete Payment Link”

User-facing copy is incorrect for this dialog.

-            Delete Webhook
+            Delete Payment Link
🧹 Nitpick comments (3)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx (1)

187-201: Avoid float precision loss; sum in base units (bigint) then format once

Current code converts each usage to a Number and sums, which can lose precision for 18‑dec tokens and large totals. Sum as bigint in base units, then format with toTokens + formatTokenAmount.

-                        `${(
-                          paymentLinkUsagesQuery.data
-                            ?.find((x) => x.paymentLink.id === paymentLink.id)
-                            ?.usages?.reduce(
-                              (acc, curr) =>
-                                acc +
-                                Number(
-                                  toTokens(
-                                    BigInt(curr.destinationAmount),
-                                    curr.destinationToken.decimals,
-                                  ),
-                                ),
-                              0,
-                            ) || 0
-                        ).toString()} ${paymentLink.destinationToken.symbol}`
+                        `${formatTokenAmount(
+                          toTokens(
+                            (paymentLinkUsagesQuery.data
+                              ?.find((x) => x.paymentLink.id === paymentLink.id)
+                              ?.usages?.reduce(
+                                (acc, curr) =>
+                                  acc + BigInt(curr.destinationAmount ?? "0"),
+                                0n,
+                              )) ?? 0n,
+                            paymentLink.destinationToken.decimals,
+                          ),
+                        )} ${paymentLink.destinationToken.symbol}`

Nit: cache the .find(...) result per row to avoid repeating the lookup.

apps/dashboard/src/@/api/universal-bridge/developer.ts (2)

316-339: Tighten address fields to Address for stronger type safety

Several address-like strings can use the existing Address type.

 export type Payment = {
@@
-  receiver: string;
+  receiver: Address;
@@
   destinationToken: {
-    address: string;
+    address: Address;
@@
   | {
       type: BridgePaymentType;
       transactionId: string;
       blockNumber?: string;
-      sender: string;
-      developerFeeRecipient: string;
+      sender: Address;
+      developerFeeRecipient: Address;
       developerFeeBps: number;
       originAmount: string;
       originToken: {
-        address: string;
+        address: Address;
         symbol: string;
         decimals: number;
         chainId: number;
       };
     }

346-347: Export a narrow type guard for Bridge payments

Centralizing the guard makes downstream filtering simpler and type-safe.

 export type BridgePayment = Extract<Payment, { type: BridgePaymentType }>;
+
+export function isBridgePayment(p: Payment): p is BridgePayment {
+  return p.type !== "onramp";
+}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d8611da and 29be72e.

📒 Files selected for processing (4)
  • apps/dashboard/src/@/api/universal-bridge/developer.ts (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx (4 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
apps/{dashboard,playground-web}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/* (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
apps/{dashboard,playground}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

apps/{dashboard,playground}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/_ (e.g., Button, Input, Tabs, Card)
Use NavLink for internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names with cn() from @/lib/utils for conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start with import "server-only"; use next/headers, server‑only env, heavy data fetching, and redirect() where appropriate
Client Components must start with 'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: call getAuthToken() from cookies, send Authorization: Bearer <token> header, and return typed results (avoid any)
Client-side data fetching: wrap calls in React Query with descriptive, stable queryKeys and set sensible staleTime/cacheTime (≥ 60s default); keep tokens secret via internal routes or server actions
Do not import posthog-js in server components (client-side only)

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
apps/{dashboard,playground}/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Expose a className prop on the root element of every component

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
🧠 Learnings (2)
📚 Learning: 2025-08-20T10:35:18.543Z
Learnt from: jnsdls
PR: thirdweb-dev/js#7888
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/page.tsx:77-81
Timestamp: 2025-08-20T10:35:18.543Z
Learning: The webhooks/payments route exists at apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/payments/page.tsx and was added as part of the unified project layout changes.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
📚 Learning: 2025-08-20T10:35:18.543Z
Learnt from: jnsdls
PR: thirdweb-dev/js#7888
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/page.tsx:77-81
Timestamp: 2025-08-20T10:35:18.543Z
Learning: The webhooks/payments route exists at apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/payments/page.tsx and was added as part of the unified project layout PR #7888.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Build Packages
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Lint Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/dashboard/src/@/api/universal-bridge/developer.ts (1)

301-344: Good discriminated union; aligns types and prevents onramp crashes

Using type with a Bridge vs Onramp union and moving bridge-only fields behind the discriminant is the right call.

@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 4, 2025

Merge activity

…hase (#7982)

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the payment-related types and logic in the application to improve type safety and clarity. It introduces a new `BridgePayment` type, updates the `TableRow` component, and modifies how payments are filtered and processed.

### Detailed summary
- Changed `Payment` type to `BridgePayment` in `TableRow` component.
- Updated `originAmount` and `destinationAmount` to use `BigInt`.
- Introduced `BridgePaymentType` and `OnrampPaymentType`.
- Modified `getCSVData` to accept only `BridgePayment` types.
- Added `isBridgePayment` function to filter payments.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- New Features
  - Payments views and CSV export now explicitly show only bridge payments; onramp entries are excluded.

- Bug Fixes
  - Improved accuracy for large origin/destination amounts by converting amounts to integer form before token conversion.
  - Consistent token conversions across table, links, and CSV exports.

- Refactor
  - Payment data reorganized into distinct bridge vs onramp variants to improve filtering and export consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx (1)

317-317: Fix mislabeled destructive action (“Delete Webhook” → “Delete payment”)

User-facing string is incorrect for this dialog.

-            Delete Webhook
+            Delete payment
♻️ Duplicate comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx (1)

15-22: Harden amount parsing to prevent crashes on invalid/empty strings

Direct BigInt(...) will throw on "", nullish, or malformed numerics. This was already flagged earlier and still applies here.

-  const originAmount = toTokens(
-    BigInt(purchase.originAmount),
-    purchase.originToken.decimals,
-  );
+  const originAmount = toTokens(
+    toBigIntOrZero(purchase.originAmount),
+    purchase.originToken.decimals,
+  );
@@
-  const destinationAmount = toTokens(
-    BigInt(purchase.destinationAmount),
-    purchase.destinationToken.decimals,
-  );
+  const destinationAmount = toTokens(
+    toBigIntOrZero(purchase.destinationAmount),
+    purchase.destinationToken.decimals,
+  );

Add this helper near the top of the file:

function toBigIntOrZero(v: unknown): bigint {
  if (typeof v !== "string") return 0n;
  const s = v.trim();
  if (s === "" || !/^\d+$/.test(s)) return 0n;
  try {
    return BigInt(s);
  } catch {
    return 0n;
  }
}
🧹 Nitpick comments (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx (1)

58-66: Set sensible React Query cache to reduce refetch churn

Add staleTime to both queries (≥ 60s per guidelines) and gate usages query on links being loaded.

   const paymentLinksQuery = useQuery({
     queryFn: async () => {
       return getPaymentLinks({
         clientId: props.clientId,
         teamId: props.teamId,
       });
     },
     queryKey: ["payment-links", props.clientId, props.teamId],
+    staleTime: 60_000,
   });
@@
   const paymentLinkUsagesQuery = useQuery({
     queryFn: async () => {
       const paymentLinks = paymentLinksQuery.data || [];
       return await Promise.all(
         paymentLinks.map(async (paymentLink) => {
           const { data } = await getPayments({
             clientId: props.clientId,
             teamId: props.teamId,
             paymentLinkId: paymentLink.id,
           });
           return {
             paymentLink,
             usages: data,
           };
         }),
       );
     },
     queryKey: [
       "payment-link-usages",
       paymentLinksQuery.dataUpdatedAt,
       props.clientId,
       props.teamId,
     ],
+    enabled: !!paymentLinksQuery.data,
+    staleTime: 60_000,
   });

Also applies to: 68-91

apps/dashboard/src/@/api/universal-bridge/developer.ts (1)

301-347: Tighten address typing; export a shared type guard

  • Use Address for all EVM addresses for stronger type guarantees.
  • Export a reusable isBridgePayment guard here so UI can share a single source of truth.
 type BridgePaymentType = "buy" | "sell" | "transfer";
 type OnrampPaymentType = "onramp";
 
 export type Payment = {
   // common
   id: string;
   createdAt: string;
   clientId: string;
-  receiver: string;
+  receiver: Address;
   transactions: Array<{
     chainId: number;
     transactionHash: string;
   }>;
   status: "PENDING" | "COMPLETED" | "FAILED" | "NOT_FOUND";
 
   destinationAmount: string;
   destinationToken: {
-    address: string;
+    address: Address;
     symbol: string;
     decimals: number;
     chainId: number;
   };
   purchaseData: unknown;
 } & (
   | {
       type: BridgePaymentType;
       transactionId: string;
       blockNumber?: string;
-      sender: string;
-      developerFeeRecipient: string;
+      sender: Address;
+      developerFeeRecipient: Address;
       developerFeeBps: number;
       originAmount: string;
       originToken: {
-        address: string;
+        address: Address;
         symbol: string;
         decimals: number;
         chainId: number;
       };
     }
   | {
       onrampId: string;
       type: OnrampPaymentType;
     }
 );
 
 export type BridgePayment = Extract<Payment, { type: BridgePaymentType }>;

Add (outside the changed block) for reuse across the app:

export function isBridgePayment(p: Payment): p is BridgePayment {
  return p.type === "buy" || p.type === "sell" || p.type === "transfer";
}

If the backend can ever return non-decimal numeric strings (e.g., "0x..."), let me know and I’ll adjust the parsers accordingly.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 29be72e and 17d40af.

📒 Files selected for processing (4)
  • apps/dashboard/src/@/api/universal-bridge/developer.ts (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx (4 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentHistory.client.tsx
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
apps/{dashboard,playground-web}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/* (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
apps/{dashboard,playground}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

apps/{dashboard,playground}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/_ (e.g., Button, Input, Tabs, Card)
Use NavLink for internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names with cn() from @/lib/utils for conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start with import "server-only"; use next/headers, server‑only env, heavy data fetching, and redirect() where appropriate
Client Components must start with 'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: call getAuthToken() from cookies, send Authorization: Bearer <token> header, and return typed results (avoid any)
Client-side data fetching: wrap calls in React Query with descriptive, stable queryKeys and set sensible staleTime/cacheTime (≥ 60s default); keep tokens secret via internal routes or server actions
Do not import posthog-js in server components (client-side only)

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
  • apps/dashboard/src/@/api/universal-bridge/developer.ts
apps/{dashboard,playground}/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Expose a className prop on the root element of every component

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
🧠 Learnings (2)
📚 Learning: 2025-08-20T10:35:18.543Z
Learnt from: jnsdls
PR: thirdweb-dev/js#7888
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/page.tsx:77-81
Timestamp: 2025-08-20T10:35:18.543Z
Learning: The webhooks/payments route exists at apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/payments/page.tsx and was added as part of the unified project layout changes.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
📚 Learning: 2025-08-20T10:35:18.543Z
Learnt from: jnsdls
PR: thirdweb-dev/js#7888
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/page.tsx:77-81
Timestamp: 2025-08-20T10:35:18.543Z
Learning: The webhooks/payments route exists at apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/payments/page.tsx and was added as part of the unified project layout PR #7888.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx
🧬 Code graph analysis (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx (1)
apps/dashboard/src/@/api/universal-bridge/developer.ts (1)
  • BridgePayment (346-346)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/links/components/PaymentLinksTable.client.tsx (1)

187-201: It looks like destinationAmount is typed as z.string(), so it may contain empty or invalid strings, and BigInt(curr.destinationAmount) would indeed throw in those cases. Also, converting each value to human‐readable form via Number(toTokens(...)) loses precision when decimals are large (e.g., 18) and summing in JavaScript numbers is unsafe for big integers. The suggested refactor to:

  • Accumulate a single BigInt sum in base units
  • Safely parse each string to BigInt (guarding empty/invalid)
  • Convert the final sum once with toTokens

is valid. Add the toBigIntOrZero helper as proposed.

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/PaymentsTableRow.tsx (1)

10-13: Good switch to BridgePayment props

The prop narrowing eliminates onramp-only shapes from this row and aligns with the PR’s intent.

@graphite-app graphite-app bot merged commit 17d40af into main Sep 4, 2025
24 checks passed
@graphite-app graphite-app bot deleted the mnn/fix-bridge-crash branch September 4, 2025 14:55
@vercel vercel bot temporarily deployed to Production – docs-v2 September 4, 2025 14:56 Inactive
@vercel vercel bot temporarily deployed to Production – thirdweb_playground September 4, 2025 14:56 Inactive
@vercel vercel bot temporarily deployed to Production – nebula September 4, 2025 14:56 Inactive
@vercel vercel bot temporarily deployed to Production – wallet-ui September 4, 2025 14:56 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dashboard Involves changes to the Dashboard.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants