Skip to content

Fix/deeplink research#379

Merged
IAmKio merged 15 commits intostagingfrom
fix/deeplink-research
Jul 29, 2025
Merged

Fix/deeplink research#379
IAmKio merged 15 commits intostagingfrom
fix/deeplink-research

Conversation

@IAmKio
Copy link
Collaborator

@IAmKio IAmKio commented Jul 29, 2025

Description

  • Added connection debug bar
  • Added comprehensive Sentry logging
  • Fixed WAGMI connection awareness
  • Updated logout sequence to log out of all providers

How Has This Been Tested?

  • Locally, branch deployment

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added a debug panel for inspecting authentication and wallet connection status, accessible via a long press on the logo or when debug mode is enabled.
    • Introduced new components for displaying detailed connection debug information and a collapsible debug panel.
    • Added a comprehensive logout hook supporting both Privy and WAGMI authentication.
  • Enhancements

    • Integrated extensive Sentry monitoring and logging across authentication, wallet connection, and transaction flows for improved observability and error tracking.
    • Improved batch and token sending modals with detailed Sentry instrumentation and enhanced error handling.
    • Updated UI styling for send modal buttons and debug panels for better usability and appearance.
    • Extended authentication detection to include WalletConnect alongside Privy and private key methods.
    • Enhanced WalletConnect lifecycle management with detailed telemetry and error reporting.
    • Adjusted environment variable naming and Sentry initialization for consistency and staging environment support.
    • Added dynamic UI adjustment in bottom menu based on debug mode activation.
  • Bug Fixes

    • Refined logout logic to ensure consistent session clearing across authentication providers.
  • Chores

    • Renamed environment variable for WalletConnect project ID to improve clarity.

@IAmKio IAmKio requested a review from vignesha22 July 29, 2025 10:13
@IAmKio IAmKio self-assigned this Jul 29, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 29, 2025

Warning

Rate limit exceeded

@IAmKio has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7dbe651 and 2e94033.

📒 Files selected for processing (2)
  • src/containers/Main.test.tsx (2 hunks)
  • src/services/walletConnect.ts (11 hunks)

Walkthrough

This update introduces comprehensive Sentry observability and debugging features across authentication, wallet connection, and transaction flows. It adds new debug UI components, refactors logout logic for multi-provider compatibility, and enhances WalletConnect and Privy integration. Environment variable naming is aligned, and batch/token sending flows are instrumented for detailed error and event tracking.

Changes

Cohort / File(s) Change Summary
Environment Variable Update
.env.example
Renamed VITE_WC_ID to VITE_REOWN_PROJECT_ID and updated placeholder value; added VITE_SENTRY_ENVIRONMENT variable.
Bottom Menu Debug Awareness
src/components/BottomMenu/index.tsx
Added isDebugMode state, effect hooks to monitor localStorage and window focus, and conditional styling for debug mode.
Unified Logout Logic
src/components/BottomMenuModal/AccountModal.tsx, src/pages/Loading.tsx, src/utils/logout.ts
Replaced separate Privy/WAGMI logout with new useComprehensiveLogout hook, consolidating logout for both providers and handling local/session storage cleanup.
Sentry Instrumentation: Batch Send
src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx
Added Sentry transactions, context, breadcrumbs, and error capturing throughout batch send flow, including user actions and polling.
Sentry Instrumentation: Token Send
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx
Added Sentry tracing, context, breadcrumbs, and error capturing for the token send flow; introduced helpers for asset symbol/contract extraction.
Sentry Instrumentation & UI Adjustments: Send Buttons
src/components/BottomMenuModal/SendModal/SendModalBottomButtons.tsx
Added Sentry context and breadcrumbs for button actions, refactored prop types for optionality, and updated layout/styling.
Debug Panel Components
src/components/ConnectionDebug.tsx, src/components/DebugPanel.tsx
Introduced new components for displaying detailed connection/authentication debug info in a collapsible panel.
Connection Debug Integration
src/containers/Authorized.tsx, src/pages/Login.tsx
Added state and effects to aggregate Privy and Wagmi debug info; rendered debug panel conditionally based on localStorage flag; implemented long-press logo to toggle debug mode on login.
Authentication & Provider Setup Overhaul
src/containers/Main.tsx
Integrated Wagmi connection into authentication flow, added WalletConnect provider setup, and instrumented all flows with Sentry for detailed telemetry and error tracking.
WalletConnect Service Refactor & Sentry
src/services/walletConnect.ts
Refactored connect/disconnect flows, renamed internal methods, and added extensive Sentry tracing, context, and error handling for all WalletConnect operations.
Test Mocks Update
src/containers/Main.test.tsx
Added mocks for @sentry/react and extended wagmi mocks to support new hooks and telemetry.
Sentry Initialization Update
src/main.tsx
Changed Sentry integration initialization methods, enabled Sentry unconditionally, and set environment default to "staging".

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant Privy
    participant Wagmi
    participant Sentry

    User->>UI: Initiate login or transaction
    UI->>Privy: Check authentication
    UI->>Wagmi: Check wallet connection
    alt Debug mode enabled
        UI->>UI: Show DebugPanel with ConnectionDebug
    end
    alt User triggers logout
        UI->>Wagmi: Disconnect (if connected)
        UI->>Privy: Logout
        UI->>Sentry: Log logout transaction/context
        UI->>UI: Clear storage, reload page
    end
    alt User sends transaction
        UI->>Sentry: Start transaction trace
        UI->>Wagmi/Privy: Prepare/send transaction
        UI->>Sentry: Log breadcrumbs/events
        alt Error occurs
            UI->>Sentry: Capture exception/context
        end
        UI->>Sentry: Finish transaction trace
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • fix/metamask-walletConnect-fix #373: Refines private key login logic and adds debug logging in src/containers/Main.tsx, closely related to authentication and WalletConnect handling in this PR.
  • Vite Switch #356: Updates environment variable prefixes and renames WalletConnect project ID variable, directly related to environment variable changes here.
  • userOp states fix #322: Adds state reset logic in SendModalTokensTabView.tsx's onSend function, related to the telemetry and instrumentation added here.

Suggested reviewers

  • RanaBug

Poem

🐰✨
In codey burrows deep and wide,
Debug panels now reside.
With Sentry’s watchful, clever eye,
Each bug and hiccup can’t slip by.
Logout flows are unified,
And WalletConnect is fortified—
This bunny’s proud, so hop inside!
✨🐾

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/deeplink-research

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
🪧 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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai 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

Documentation and Community

  • 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.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jul 29, 2025

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2e94033
Status: ✅  Deploy successful!
Preview URL: https://ea127e07.x-e62.pages.dev
Branch Preview URL: https://fix-deeplink-research.x-e62.pages.dev

View logs

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: 6

🔭 Outside diff range comments (3)
src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (2)

441-463: Refactor duplicate Sentry error capturing logic

The Sentry capturing logic for max attempts is duplicated. Consider extracting it into a helper function.

+const captureSentryMaxAttemptsError = (
+  chainId: number,
+  status: string,
+  sentryPayload: any,
+  sentryCaptured: boolean
+) => {
+  if (sentryCaptured) return false;
+  
+  // Polygon chain gets warning level, others get error level
+  const isPolygon = chainId === 137;
+  const level = isPolygon ? 'warning' : 'error';
+  const captureMethod = isPolygon ? Sentry.captureMessage : Sentry.captureException;
+  
+  captureMethod(
+    `Max attempts reached with userOp status "${status}"${isPolygon ? ' on Polygon' : ''}`,
+    {
+      level,
+      extra: sentryPayload,
+    }
+  );
+  
+  return true;
+};

 // Then replace both occurrences with:
-if (!sentryCaptured) {
-  sentryCaptured = true;
-  // Polygon chain
-  if (chainId === 137) {
-    Sentry.captureMessage(
-      `Max attempts reached with userOp status "${status}" on Polygon`,
-      {
-        level: 'warning',
-        extra: sentryPayload,
-      }
-    );
-  } else {
-    // Other chains
-    Sentry.captureException(
-      `Max attempts reached with userOp status "${status}"`,
-      {
-        level: 'error',
-        extra: sentryPayload,
-      }
-    );
-  }
-}
+sentryCaptured = captureSentryMaxAttemptsError(chainId, status, sentryPayload, sentryCaptured);

Also applies to: 497-519


423-430: Potential PII leakage in Sentry payload

The sentryPayload includes the wallet address which is personally identifiable information. Consider hashing or truncating sensitive data before sending to Sentry.

 const sentryPayload = {
-  walletAddress: accountAddress,
+  walletAddress: accountAddress ? `${accountAddress.slice(0, 6)}...${accountAddress.slice(-4)}` : undefined,
   userOpHash: newUserOpHash,
   chainId,
   transactionHash: response?.transaction,
   attempts,
   status,
 };
src/containers/Main.tsx (1)

138-604: Add missing transaction.finish() in the PK/account branch

The initial Sentry transaction is never closed when we take the first branch (if ((searchURL && searchURLPK) || account))—all your existing transaction.finish() calls live in the else branch’s updateProvider, but the PK/account updateProvider (and its error path) never calls transaction.finish(). This will leak open transactions whenever a user authenticates via pk or with an existing account.

Please update src/containers/Main.tsx around the PK/account block (lines ~148–185) to ensure you finish the transaction. For example:

   const updateProvider = async () => {
     // ...existing PK/account setup...
     Sentry.addBreadcrumb({ /* … */ });

+    // Close the Sentry transaction after setup
+    transaction.finish();
   };

-  updateProvider();
+  updateProvider().catch(() => {
+    // Ensure transaction is closed on unexpected errors
+  }).finally(() => {
+    transaction.finish();
+  });

That way, whether the PK logic succeeds or throws, you’ll always call transaction.finish().

🧹 Nitpick comments (14)
.env.example (1)

8-8: LGTM! Environment variable renamed to align with ReOwn branding.

The rename from VITE_WC_ID to VITE_REOWN_PROJECT_ID correctly reflects the ReOwn rebrand of WalletConnect.

Consider reordering the environment variable to follow alphabetical order as suggested by the linter:

 VITE_PLAUSIBLE_DOMAIN="dev.pillar.app"
 VITE_PX_DEVELOPMENT_ID="src-apps-development-dir"
+VITE_REOWN_PROJECT_ID="Your ReOwn project ID"
 VITE_REOWN_PROJECT_ID="Your ReOwn project ID"
 VITE_SKANDHA_URL="https://rpc.etherspot.io/v2"
 VITE_USE_TESTNETS=true
src/utils/logout.ts (1)

8-40: Well-designed comprehensive logout hook.

The hook effectively centralizes logout logic for both Privy and WAGMI, with proper error handling at each step. The sequential approach (WAGMI disconnect → Privy logout → storage clearing) is logical.

Consider using more specific error logging to distinguish between different failure scenarios:

     } catch (e) {
-      console.error('Error disconnecting from WAGMI:', e);
+      console.error('[Logout] WAGMI disconnect failed:', e);
     }
     } catch (e) {
-      console.error('Error during Privy logout:', e);
+      console.error('[Logout] Privy logout failed:', e);
     }
     } catch (e) {
-      console.error('Error clearing storage:', e);
+      console.error('[Logout] Storage clearing failed:', e);
     }
src/components/DebugPanel.tsx (1)

44-94: Well-structured debug panel styling.

The styled components provide a clean, dark-themed debug interface with smooth transitions and proper z-index layering.

Consider adding accessibility attributes for better screen reader support:

 const DebugToggleButton = styled.button`
   width: 100%;
   padding: 10px 20px;
   background: rgba(0, 0, 0, 0.8);
   border: none;
   border-bottom: 1px solid #333;
   color: #fff;
   cursor: pointer;
   display: flex;
   justify-content: space-between;
   align-items: center;
   font-size: 14px;
   font-weight: bold;
+  
+  &[aria-expanded="true"] {
+    border-bottom-color: #555;
+  }

And update the button usage:

-      <DebugToggleButton onClick={() => setIsOpen(!isOpen)}>
+      <DebugToggleButton 
+        onClick={() => setIsOpen(!isOpen)}
+        aria-expanded={isOpen}
+        aria-controls="debug-content"
+      >
src/containers/Authorized.tsx (1)

114-124: Debug panel integration looks good.

The localStorage-based conditional rendering is appropriate for debug features, and the placeholder onDisconnect handler is properly documented.

Consider implementing the onDisconnect handler to provide immediate disconnect functionality for debugging:

                        <ConnectionDebug 
                          debugInfo={debugInfo} 
                          onDisconnect={() => {
-                            // This will be handled by the comprehensive logout utility
-                            // when the user logs out through the normal flow
+                            // Import useComprehensiveLogout at the top
+                            // const { logout } = useComprehensiveLogout();
+                            // logout();
                          }}
                        />
src/components/BottomMenuModal/AccountModal.tsx (1)

166-166: Consider increasing the delay before page reload

The 500ms delay might not be sufficient for all async operations (logout, storage clearing, navigation) to complete, especially on slower networks or devices. This could lead to incomplete logout operations.

-  // Reload the page after a short delay to ensure clean state
-  setTimeout(() => window.location.reload(), 500);
+  // Reload the page after a delay to ensure all operations complete
+  setTimeout(() => window.location.reload(), 1000);
src/components/ConnectionDebug.tsx (2)

112-117: Move inline styles to styled component

The inline styles on the Button component should be moved to a styled component for consistency with the rest of the codebase.

+const DisconnectButton = styled(Button)`
+  margin-top: 10px;
+  background-color: #ff4444;
+`;

 {/* Disconnect button for testing */}
 {(debugInfo.wagmi?.isConnected || debugInfo.privy?.authenticated) && onDisconnect && (
   <DebugSection>
     <DebugSubtitle>Actions:</DebugSubtitle>
-    <Button 
-      onClick={onDisconnect} 
-      style={{marginTop: '10px', backgroundColor: '#ff4444'}}
-    >
+    <DisconnectButton onClick={onDisconnect}>
       Disconnect WAGMI
-    </Button>
+    </DisconnectButton>
   </DebugSection>
 )}

34-122: Add performance optimization with React.memo

This debug component might re-render frequently due to connection state changes. Consider memoizing the component to prevent unnecessary re-renders.

-const ConnectionDebug: React.FC<ConnectionDebugProps> = ({ debugInfo, onDisconnect }) => {
+const ConnectionDebug: React.FC<ConnectionDebugProps> = React.memo(({ debugInfo, onDisconnect }) => {
   return (
     <DebugContainer>
       {/* ... rest of the component ... */}
     </DebugContainer>
   );
-};
+});
+
+ConnectionDebug.displayName = 'ConnectionDebug';
src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (1)

106-122: Consider reducing Sentry context payload size

The Sentry context includes the full groupedTransactionsByChainId object which could be large. Consider including only essential metadata like counts instead of full transaction arrays.

 Sentry.setContext('send_batch', {
   sendId,
   timestamp: new Date().toISOString(),
   userAgent: navigator.userAgent,
   chainId,
   batchId,
   isSending: isSending[chainId],
-  groupedTransactionsCount: groupedTransactionsByChainId[chainId]?.length || 0,
+  transactionCount: groupedTransactionsByChainId[chainId]?.length || 0,
+  totalBatches: Object.keys(groupedTransactionsByChainId).length,
 });
src/pages/Login.tsx (2)

85-91: Remove or implement empty event listeners

The connect and disconnect event listeners have empty implementations. Either implement proper handling or remove them if not needed.

-// Add additional event listeners for debugging
-provider.on('connect', (connectInfo: any) => {
-  // Event listener for connect
-});
-
-provider.on('disconnect', (disconnectInfo: any) => {
-  // Event listener for disconnect
-});
+// Add event listeners for debugging if needed
+provider.on('connect', (connectInfo: any) => {
+  console.log('WalletConnect: Connected', connectInfo);
+});
+
+provider.on('disconnect', () => {
+  console.log('WalletConnect: Disconnected');
+});

158-163: Add visual feedback during long press

Users have no indication that a long press is in progress. Consider adding visual feedback like opacity change or a progress indicator.

 <animated.img
   src={PillarXLogo}
   alt="pillar-x-logo"
-  className="max-w-[300px] h-auto"
+  className={`max-w-[300px] h-auto ${logoPressStart ? 'opacity-70' : ''}`}
   style={styles}
   onMouseDown={handleLogoMouseDown}
   onMouseUp={handleLogoMouseUp}
   onMouseLeave={handleLogoMouseLeave}
   onTouchStart={handleLogoMouseDown}
   onTouchEnd={handleLogoMouseUp}
   onTouchCancel={handleLogoMouseLeave}
 />
src/components/BottomMenuModal/SendModal/SendModalBottomButtons.tsx (1)

156-166: Consider using theme colors instead of hardcoded values.

The Cost component uses a hardcoded color #666 which might not adapt well to different themes. Consider using theme-based colors for better consistency.

 const Cost = styled.div`
   font-size: 14px;
-  color: #666;
+  color: ${({ theme }) => theme.color.text.secondary};
   text-align: center;
   margin-top: 12px;
 `;
src/containers/Main.tsx (1)

374-559: Consider extracting WalletConnect setup logic.

The WalletConnect provider setup logic is comprehensive with good error handling, but it's quite complex and deeply nested. Consider extracting this into a separate function for better maintainability.

src/services/walletConnect.ts (2)

79-96: Consider debouncing the Sentry context updates.

The Sentry context is updated on every state change, which could be frequent. While the impact is minimal, consider debouncing these updates for better performance.

+import { useMemo } from 'react';
+import { debounce } from 'lodash'; // or implement a simple debounce

 // Sentry context for WalletConnect state
 useEffect(() => {
+  const updateContext = debounce(() => {
     Sentry.setContext('walletconnect_state', {
       hasWallet: !!wallet,
       hasWalletKit: !!walletKit,
       activeSessionsCount: Object.keys(activeSessions || {}).length,
       isLoadingConnect,
       isLoadingDisconnect,
       isLoadingDisconnectAll,
       hasUser: !!user,
       isConnected,
       hasWalletConnectTxHash: !!walletConnectTxHash,
       hasWalletConnectPayload: !!walletConnectPayload,
       userAgent: navigator.userAgent,
       timestamp: new Date().toISOString(),
     });
+  }, 500);
+  
+  updateContext();
+  return () => updateContext.cancel();
 }, [wallet, walletKit, activeSessions, isLoadingConnect, isLoadingDisconnect, isLoadingDisconnectAll, user, isConnected, walletConnectTxHash, walletConnectPayload]);

97-179: Consider making the page reload optional or providing user feedback.

The automatic page reload after logout might be jarring for users. Consider showing a loading state or making it configurable.

Additionally, the reload happens even if the logout fails, which might not always be the desired behavior:

 } catch (error) {
   Sentry.captureException(error, {
     // ... existing Sentry configuration
   });
   
-  // Still reload the page even if logout fails
-  window.location.reload();
+  // Consider showing an error message instead of reloading
+  console.error('Logout failed:', error);
+  // Optionally reload only if critical state needs clearing
+  if (shouldReloadOnError) {
+    window.location.reload();
+  }
 } finally {
   transaction.finish();
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c7e2cb and 0803bd5.

📒 Files selected for processing (14)
  • .env.example (1 hunks)
  • src/components/BottomMenu/index.tsx (5 hunks)
  • src/components/BottomMenuModal/AccountModal.tsx (4 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (17 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalBottomButtons.tsx (6 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (15 hunks)
  • src/components/ConnectionDebug.tsx (1 hunks)
  • src/components/DebugPanel.tsx (1 hunks)
  • src/containers/Authorized.tsx (4 hunks)
  • src/containers/Main.tsx (12 hunks)
  • src/pages/Loading.tsx (1 hunks)
  • src/pages/Login.tsx (2 hunks)
  • src/services/walletConnect.ts (11 hunks)
  • src/utils/logout.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (1)

Learnt from: RanaBug
PR: #320
File: src/components/BottomMenuModal/HistoryModal/TransactionInfo.tsx:177-182
Timestamp: 2025-05-28T14:30:02.702Z
Learning: In the transaction history tracking feature, chain ID validation is performed earlier in the flow before the values reach the TransactionInfo component, so additional validation at the display level is not needed.

src/containers/Main.tsx (1)

Learnt from: IAmKio
PR: #243
File: src/containers/Main.tsx:85-86
Timestamp: 2025-02-20T19:50:40.447Z
Learning: Passing private key via URL parameters in the login flow is an intentional design choice for handling edge cases in the private key login mode.

src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (2)

Learnt from: RanaBug
PR: #275
File: src/apps/the-exchange/components/DropdownTokensList/DropdownTokenList.tsx:180-195
Timestamp: 2025-03-28T09:22:22.712Z
Learning: In the Exchange app, swapTokenList and receiveTokenList are derived from searchTokenResult when search is active, so including searchToken in the useEffect dependency array that uses these lists would be redundant as the lists will update when search results change.

Learnt from: RanaBug
PR: #320
File: src/components/BottomMenuModal/HistoryModal/TransactionInfo.tsx:177-182
Timestamp: 2025-05-28T14:30:02.702Z
Learning: In the transaction history tracking feature, chain ID validation is performed earlier in the flow before the values reach the TransactionInfo component, so additional validation at the display level is not needed.

src/components/BottomMenu/index.tsx (1)

Learnt from: RanaBug
PR: #275
File: src/apps/the-exchange/components/DropdownTokensList/DropdownTokenList.tsx:180-195
Timestamp: 2025-03-28T09:22:22.712Z
Learning: In the Exchange app, swapTokenList and receiveTokenList are derived from searchTokenResult when search is active, so including searchToken in the useEffect dependency array that uses these lists would be redundant as the lists will update when search results change.

🧬 Code Graph Analysis (6)
src/components/BottomMenuModal/AccountModal.tsx (2)
src/utils/logout.ts (1)
  • useComprehensiveLogout (8-40)
src/services/dappLocalStorage.ts (1)
  • clearDappStorage (36-40)
src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (1)
src/utils/blockchain.ts (1)
  • getChainName (260-279)
src/pages/Loading.tsx (1)
src/utils/logout.ts (1)
  • useComprehensiveLogout (8-40)
src/services/walletConnect.ts (2)
src/utils/logout.ts (1)
  • useComprehensiveLogout (8-40)
__mocks__/walletConnectMock.ts (2)
  • WalletKit (41-41)
  • getSdkError (40-40)
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (1)
src/types/index.ts (1)
  • AssetSelectOption (55-55)
src/components/ConnectionDebug.tsx (1)
src/components/LandingPage/Button/index.jsx (1)
  • Button (38-61)
🪛 dotenv-linter (3.3.0)
.env.example

[warning] 8-8: [UnorderedKey] The VITE_REOWN_PROJECT_ID key should go before the VITE_USE_TESTNETS key

⏰ 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: unit-tests
  • GitHub Check: lint
  • GitHub Check: build
🔇 Additional comments (23)
src/utils/logout.ts (1)

17-17: It looks like the ripgrep search didn’t find any implementation in your repo (and the tsx type wasn’t recognized), so the WAGMI source itself isn’t present here. Please manually verify in your installed WAGMI package (e.g. inspect the disconnect function’s signature in node_modules/@wagmi/core/dist/index.d.ts or the official docs) whether disconnect returns a Promise before using await wagmiDisconnect().

src/components/DebugPanel.tsx (1)

17-26: Excellent controlled/uncontrolled state pattern implementation.

The state management correctly handles both controlled and uncontrolled modes, with proper fallback to internal state when no controlled state is provided.

src/pages/Loading.tsx (2)

6-13: Improved import organization with clear categorization.

The import statements are now well-organized with clear section headers (images, components, utils), making the code more readable and maintainable.


21-21: LGTM! Successfully migrated to comprehensive logout.

The change from usePrivy to useComprehensiveLogout aligns with the centralized logout strategy while maintaining the same functionality. The 15-second auto-logout behavior is preserved.

src/containers/Authorized.tsx (2)

39-49: Good debug state initialization and connector detection.

The debug info state and WalletConnect connector detection provide comprehensive visibility into the connection state for debugging purposes.


60-86: Comprehensive debug info aggregation with proper dependency tracking.

The useEffect correctly aggregates debug information from both Privy and WAGMI hooks, with appropriate dependency array to ensure updates when relevant state changes.

src/components/BottomMenuModal/AccountModal.tsx (1)

157-160: No redundancy: clearDappStorage handles app-specific keys

useComprehensiveLogout (src/utils/logout.ts) only removes the auth key (ACCOUNT_VIA_PK) and clears sessionStorage.
clearDappStorage (src/services/dappLocalStorage.ts) removes the dapp’s own localStorage entries (@pillarx:history, @pillarx:balances, @pillarx:nfts).

Both calls are needed to fully clear user and app data.

src/pages/Login.tsx (1)

114-126: Add cleanup for long press timer on component unmount

The long press timer should be cleared if the component unmounts while the timer is active to prevent memory leaks and unexpected behavior.

 useEffect(() => {
+  let timer: NodeJS.Timeout | undefined;
+  
   if (logoPressStart) {
-    const timer = setTimeout(() => {
+    timer = setTimeout(() => {
       const pressDuration = Date.now() - logoPressStart;
       if (pressDuration >= 5000) { // 5 seconds
         localStorage.setItem('debug_connections', 'true');
         window.location.reload();
       }
     }, 5000);
-
-    return () => clearTimeout(timer);
   }
+  
+  return () => {
+    if (timer) clearTimeout(timer);
+  };
 }, [logoPressStart]);

Likely an incorrect or invalid review comment.

src/components/BottomMenuModal/SendModal/SendModalBottomButtons.tsx (3)

13-22: LGTM! Props interface changes improve flexibility.

Making safetyWarningMessage, errorMessage, and estimatedCostFormatted optional allows the component to be used in more scenarios. The change to onSend signature is also handled correctly in the click handler.


37-49: LGTM! Comprehensive Sentry context setup.

The effect properly tracks all relevant button states and includes useful debugging information like user agent and timestamp. Dependencies are correctly specified.


51-99: LGTM! Well-structured telemetry handlers.

The handler functions properly wrap the original callbacks with Sentry breadcrumbs, capturing relevant state data. Good use of optional chaining for the optional callbacks.

src/containers/Main.tsx (2)

72-82: LGTM! Unified authentication state handling.

The integration of WalletConnect authentication alongside Privy and private key methods provides a comprehensive authentication solution. The isAuthenticated condition correctly combines all three authentication sources.


619-833: LGTM! Comprehensive route setup logging.

The Sentry instrumentation for route setup provides excellent visibility into the authentication flow and helps debug routing issues.

src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (4)

103-118: LGTM! Clean helper functions for asset metadata extraction.

The helper functions properly handle both token and NFT asset types, providing a consistent way to extract symbols and contract addresses for telemetry purposes.


539-717: Excellent error handling and telemetry implementation.

The error handling properly separates user-facing messages from technical details sent to Sentry. Each error scenario includes comprehensive context for debugging.


932-1111: LGTM! Robust UserOp status monitoring.

The implementation properly handles:

  • Interval-based status checking with cleanup
  • Chain-specific behavior for Polygon
  • Maximum retry attempts with appropriate Sentry logging
  • Proper error handling and transaction lifecycle management

506-1185: Sentry transaction lifecycle coverage verified – all paths call transaction.finish()

Confirmed that every early return and the final success path invokes transaction.finish(), ensuring no transactions remain open.

src/services/walletConnect.ts (6)

22-23: LGTM! Appropriate imports for enhanced observability and unified logout.

The addition of Sentry for monitoring, wagmi hooks for wallet state management, and the comprehensive logout utility aligns well with the PR's objectives.

Also applies to: 42-44


214-313: Excellent Sentry integration for WalletKit initialization.

The implementation provides comprehensive tracking of the initialization process with proper transaction lifecycle management and error handling. The environment variable rename is consistently applied.


354-501: Well-implemented transaction hash retrieval with comprehensive monitoring.

The polling mechanism with Sentry tracking provides excellent observability. The 3-minute timeout and progress logging every 10 attempts are reasonable choices.


514-717: Robust WalletConnect connection implementation with excellent error handling.

The Sentry integration provides detailed tracking of the connection process, and the error handling covers all common scenarios with user-friendly messages.


719-887: Well-structured session disconnection with comprehensive monitoring.

The rename to disconnectSession improves clarity, and the Sentry integration provides excellent observability for debugging connection issues.


1275-1276: Unable to find any in-repo usages of the renamed disconnect property
I ran a broad search for useWalletConnect combined with disconnect and found no matches in the codebase. It’s possible consumers aren’t using this hook yet—or they may be accessing disconnectSession directly.

Please manually verify that:

  • Any external or internal consumers of useWalletConnect have been updated to reference disconnectSession instead of disconnect.
  • Documentation, examples, or tests don’t still refer to the old disconnect property.

Comment on lines +66 to +70
const checkDebugMode = () => {
setIsDebugMode(localStorage.getItem('debug_connections') === 'true');
};

checkDebugMode();
Copy link
Contributor

@coderabbitai coderabbitai bot Jul 29, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for localStorage access

The localStorage.getItem call could throw in certain environments (e.g., when cookies are disabled or in private browsing mode). Consider wrapping it in a try-catch block.

 const checkDebugMode = () => {
-  setIsDebugMode(localStorage.getItem('debug_connections') === 'true');
+  try {
+    setIsDebugMode(localStorage.getItem('debug_connections') === 'true');
+  } catch (error) {
+    console.warn('Unable to access localStorage:', error);
+    setIsDebugMode(false);
+  }
 };
🤖 Prompt for AI Agents
In src/components/BottomMenu/index.tsx around lines 66 to 70, the call to
localStorage.getItem may throw errors in some environments like private browsing
or when cookies are disabled. Wrap the localStorage.getItem call inside a
try-catch block to safely handle any exceptions. In the catch block, set
isDebugMode to false or a safe default to ensure the app continues to function
without crashing.

Copy link
Contributor

@vignesha22 vignesha22 Jul 29, 2025

Choose a reason for hiding this comment

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

Can you pls add this bit of try catch block @IAmKio

Copy link
Contributor

Choose a reason for hiding this comment

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

@vignesha22 I'll add the try-catch block to handle localStorage access errors safely:

// Monitor debug mode changes
useEffect(() => {
  const checkDebugMode = () => {
    try {
      setIsDebugMode(localStorage.getItem('debug_connections') === 'true');
    } catch (error) {
      console.warn('Unable to access localStorage:', error);
      setIsDebugMode(false);
    }
  };

  checkDebugMode();
  
  // Listen for storage changes
  window.addEventListener('storage', checkDebugMode);
  
  // Also check on focus in case localStorage was changed in another tab
  window.addEventListener('focus', checkDebugMode);

  return () => {
    window.removeEventListener('storage', checkDebugMode);
    window.removeEventListener('focus', checkDebugMode);
  };
}, []);

This ensures the app won't crash if localStorage access fails in environments like private browsing mode or when storage is disabled.

margin: 0 auto;
position: fixed;
bottom: 22px;
bottom: ${({ $isDebugMode }) => $isDebugMode ? '42px' : '22px'};
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the debug mode bottom offset aligns with debug panel height

The bottom position changes from 22px to 42px when debug mode is active. This 20px difference should match the height of the debug panel to prevent overlap.


🏁 Script executed:

#!/bin/bash
# Check DebugPanel component for height-related styles
echo "=== Searching for DebugPanel height configuration ==="
fd -t f "DebugPanel" src/ -x cat {} \; | grep -A 10 -B 10 "height\|bottom\|position"

# Check if 20px offset is used elsewhere
echo -e "\n=== Checking for related positioning values ==="
rg "(20|42|22)px" --type ts --type tsx src/components/ | grep -i "bottom\|position\|debug"

Length of output: 1658


Align DebugMode offset with actual toggle height

The current debug‐mode offset only adds 20px atop the base 22px, but the DebugToggleButton’s vertical sizing (10px padding top + 14px font‐size + 10px padding bottom = 34px, plus its 1px bottom border) means you need ~35px of extra space to avoid overlap. Update the bottom offset so it matches the toggle’s height:

• File: src/components/BottomMenu/index.tsx
Line: ~248

- bottom: ${({ $isDebugMode }) => $isDebugMode ? '42px' : '22px'};
+ bottom: ${({ $isDebugMode }) => $isDebugMode ? '57px' : '22px'}; // 22px base + 34px padding/font + 1px border

Alternatively, use a CSS‐calc or constant to keep these values in sync:

:root {
  --bottom-menu-base: 22px;
  --debug-toggle-height: 34px;
  --debug-toggle-border: 1px;
}
…
bottom: ${({ $isDebugMode }) =>
  $isDebugMode
    ? `calc(var(--bottom-menu-base) + var(--debug-toggle-height) + var(--debug-toggle-border))`
    : 'var(--bottom-menu-base)'};
🤖 Prompt for AI Agents
In src/components/BottomMenu/index.tsx at line 248, the bottom offset for debug
mode is set to 42px, which is insufficient given the DebugToggleButton's total
height of approximately 35px plus the base offset of 22px. Update the bottom
offset to be the sum of the base offset, the toggle height, and its border,
either by directly setting it to around 57px or by using CSS variables with a
calc expression to keep these values synchronized and avoid overlap.

connectors: [
walletConnect({
projectId: import.meta.env.VITE_WC_ID ?? '',
projectId: import.meta.env.VITE_REOWN_PROJECT_ID ?? '',
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify environment variable migration.

The WalletConnect project ID environment variable has been renamed from VITE_WC_ID to VITE_REOWN_PROJECT_ID. Ensure this change is documented and all deployment environments are updated accordingly.


🌐 Web query:

What is Reown and why was the WalletConnect environment variable renamed to use "REOWN" instead of "WC"?

💡 Result:

Reown is the new name for the platform and protocol formerly known as WalletConnect[4][6][8]. Reown continues to provide the core functionality WalletConnect was known for—securely connecting crypto wallets to decentralized applications (dApps) and games—while expanding its scope, toolkit, and branding[4][8]. The environment variable used in integrations was renamed from "WC" (for WalletConnect) to "REOWN" to reflect this brand transition and ensure clarity and consistency for all new and existing tooling and documentation[8].

Essential context and details:

  • Reown's role:
    Reown is an open protocol enabling users to securely connect their crypto wallets to games and dApps through QR codes or deep links[1]. It offers seamless integration for developers, supporting connections across over 100 blockchains and millions of monthly users[4][6].

  • Branding and naming update:

    • WalletConnect Inc. rebranded as Reown in late 2024, marking its shift from a singular protocol to a broader platform for digital ownership and user experience[4][8].
    • The company’s mission is now focused on simplifying and scaling Web3 user experiences under the Reown name[8].
    • This rebrand was implemented across all official communications, SDKs, dashboards, and developer resources[4][8].
  • Environment variable change ("WC" to "REOWN"):

    • Before the rebrand, environment variables for SDKs and integrations commonly used the prefix or pattern WC_, such as WC_PROJECT_ID or WALLET_CONNECT_PROJECT_ID[7].
    • With the rebrand, official guidance and new SDK releases have migrated to using the REOWN prefix (e.g., REOWN_PROJECT_ID), aligning environment variables and configuration keys with the new brand identity for clarity and to avoid confusion as WalletConnect is phased out[8].
    • This change ensures consistency across current documentation, onboarding, support, and future-facing product development.
  • Developer implications:
    Developers working with the Reown (WalletConnect) SDKs or APIs should:

    • Use the updated REOWN_PROJECT_ID environment variable moving forward.
    • Refactor any legacy codebases or integration scripts referencing the older WalletConnect-prefixed variables to the new REOWN equivalents to avoid deprecation issues and maintain alignment with ongoing documentation and support.
  • Backwards compatibility:
    Some older projects and legacy repositories may temporarily continue to recognize the WC_ or WALLET_CONNECT_ environment variables for backward compatibility, but all new projects are strongly encouraged to standardize on REOWN_[7][8].

Summary:
Reown is the new name for the company and network previously called WalletConnect, and the environment variable prefix was changed from "WC" (or WALLET_CONNECT) to "REOWN" to clearly reflect the new branding across all development, integration, and documentation materials going forward[4][8].

Citations:


Ensure all environment variables and documentation reflect the Reown rebrand

The project has been renamed from WalletConnect to Reown, and the VITE_WC_ID variable has been replaced by VITE_REOWN_PROJECT_ID to align with the new branding. Please update every configuration and reference accordingly:

  • Update your environment files
    • Replace any VITE_WC_ID entries in .env, .env.example, or other sample files with VITE_REOWN_PROJECT_ID
    • Remove deprecated VITE_WC_ID keys to avoid confusion in CI/CD and local setups
  • Revise documentation and onboarding guides
    • Update README.md, internal wikis, and any developer-facing docs to reference VITE_REOWN_PROJECT_ID
    • Note the rename in your changelog or migration guide so teams deploying to staging/production are aware
  • Audit automation and deployment scripts
    • Search pipelines, Dockerfiles, Kubernetes manifests, and GitHub Actions workflows for legacy WC_ variables and update them

Once these changes are applied, all environments will remain consistent with the Reown branding and avoid any runtime errors due to missing or misnamed variables.

🤖 Prompt for AI Agents
In src/containers/Main.tsx at line 846, the environment variable reference has
been updated to use VITE_REOWN_PROJECT_ID instead of the old VITE_WC_ID. To
fully implement this rebrand, update all environment files by replacing
VITE_WC_ID with VITE_REOWN_PROJECT_ID and remove any deprecated VITE_WC_ID
entries. Additionally, revise all documentation, onboarding guides, and
changelogs to reflect the new variable name. Finally, audit and update all
automation and deployment scripts, including CI/CD pipelines, Dockerfiles,
Kubernetes manifests, and GitHub workflows, to ensure no legacy WC_ variables
remain.

Copy link
Contributor

@vignesha22 vignesha22 left a comment

Choose a reason for hiding this comment

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

Just two minor changes on adding try/catch block and lint/tests update are pending else all good.



// Use comprehensive logout for both Privy and WAGMI
await logout();
Copy link
Contributor

Choose a reason for hiding this comment

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

can you pls add try and catch block like before while calling this error?

@github-actions github-actions bot temporarily deployed to Preview (fix/deeplink-research) July 29, 2025 12:01 Inactive
@github-actions github-actions bot temporarily deployed to Preview (fix/deeplink-research) July 29, 2025 12:24 Inactive
@github-actions github-actions bot temporarily deployed to Preview (fix/deeplink-research) July 29, 2025 12:37 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: 3

♻️ Duplicate comments (1)
src/containers/Main.tsx (1)

867-867: Ensure all environment variables and documentation reflect the Reown rebrand

The environment variable has been updated from VITE_WC_ID to VITE_REOWN_PROJECT_ID to align with the WalletConnect to Reown rebrand.

🧹 Nitpick comments (1)
src/services/walletConnect.ts (1)

109-109: Consider extracting ID generation into a utility function

The pattern ${operation}_${Date.now()}_${Math.random().toString(36).substr(2, 9)} is repeated multiple times. Consider creating a utility function to reduce duplication:

const generateOperationId = (operation: string): string => {
  return `${operation}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
};

// Usage:
const logoutId = generateOperationId('walletconnect_logout');

Also applies to: 226-226, 370-370, 533-533, 741-741

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0803bd5 and 2cbb54c.

📒 Files selected for processing (14)
  • src/components/BottomMenu/index.tsx (5 hunks)
  • src/components/BottomMenuModal/AccountModal.tsx (3 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (16 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalBottomButtons.tsx (6 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (15 hunks)
  • src/components/ConnectionDebug.tsx (1 hunks)
  • src/components/DebugPanel.tsx (1 hunks)
  • src/containers/Authorized.tsx (4 hunks)
  • src/containers/Main.test.tsx (2 hunks)
  • src/containers/Main.tsx (13 hunks)
  • src/pages/Loading.tsx (1 hunks)
  • src/pages/Login.tsx (2 hunks)
  • src/services/walletConnect.ts (11 hunks)
  • src/utils/logout.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/containers/Authorized.tsx
  • src/pages/Loading.tsx
  • src/utils/logout.ts
  • src/components/ConnectionDebug.tsx
  • src/components/DebugPanel.tsx
  • src/components/BottomMenuModal/SendModal/SendModalBottomButtons.tsx
  • src/components/BottomMenu/index.tsx
  • src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx
  • src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx
  • src/components/BottomMenuModal/AccountModal.tsx
🧰 Additional context used
🧠 Learnings (1)
src/containers/Main.tsx (1)

Learnt from: IAmKio
PR: #243
File: src/containers/Main.tsx:85-86
Timestamp: 2025-02-20T19:50:40.447Z
Learning: Passing private key via URL parameters in the login flow is an intentional design choice for handling edge cases in the private key login mode.

🧬 Code Graph Analysis (1)
src/pages/Login.tsx (2)
src/components/ConnectionDebug.tsx (1)
  • DebugInfo (5-29)
src/components/LandingPage/Button/index.jsx (1)
  • Button (38-61)
🔇 Additional comments (4)
src/containers/Main.test.tsx (1)

8-16: LGTM!

The test mocks are properly structured to support the new Sentry integration and wagmi hooks. The mock implementations correctly stub all the Sentry functions used throughout the codebase and follow the established pattern for mocking wagmi hooks.

Also applies to: 32-37

src/pages/Login.tsx (1)

128-156: Well-implemented debug functionality

The debug mode implementation with long-press activation and persistent localStorage state is well-designed. The integration with DebugPanel and ConnectionDebug components provides comprehensive connection state visibility.

Also applies to: 194-204

src/containers/Main.tsx (1)

83-122: Excellent Sentry integration for authentication observability

The comprehensive Sentry instrumentation with transactions, context, breadcrumbs, and detailed error tracking provides excellent observability for the authentication flow. The use of unique IDs for tracking operations is particularly helpful for debugging.

Also applies to: 148-190, 224-327

src/services/walletConnect.ts (1)

79-107: Exceptional Sentry integration for WalletConnect observability

The comprehensive telemetry implementation with transactions, breadcrumbs, context, and detailed error tracking provides excellent observability for all WalletConnect operations. The consistent pattern of tracking operation lifecycle from start to finish will greatly aid in debugging and monitoring.

Also applies to: 108-190, 224-327, 370-518

Comment on lines 1 to +12
/* eslint-disable @typescript-eslint/no-use-before-define */
import { usePrivy } from '@privy-io/react-auth';
import { animated, useTransition } from '@react-spring/web';
import { useEffect } from 'react';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';
import { useAccount, useConnect } from 'wagmi';
import { useAccount, useConnect, useDisconnect } from 'wagmi';

// components
import Button from '../components/Button';
import DebugPanel from '../components/DebugPanel';
import ConnectionDebug, { DebugInfo } from '../components/ConnectionDebug';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add Sentry import for consistent error tracking

Other files in this PR use Sentry for comprehensive error tracking, but this file only uses console.error. Add the Sentry import to maintain consistency:

 /* eslint-disable @typescript-eslint/no-use-before-define */
 import { usePrivy } from '@privy-io/react-auth';
 import { animated, useTransition } from '@react-spring/web';
 import { useEffect, useState } from 'react';
 import { useTranslation } from 'react-i18next';
 import styled from 'styled-components';
 import { useAccount, useConnect, useDisconnect } from 'wagmi';
+import * as Sentry from '@sentry/react';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/* eslint-disable @typescript-eslint/no-use-before-define */
import { usePrivy } from '@privy-io/react-auth';
import { animated, useTransition } from '@react-spring/web';
import { useEffect } from 'react';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';
import { useAccount, useConnect } from 'wagmi';
import { useAccount, useConnect, useDisconnect } from 'wagmi';
// components
import Button from '../components/Button';
import DebugPanel from '../components/DebugPanel';
import ConnectionDebug, { DebugInfo } from '../components/ConnectionDebug';
/* eslint-disable @typescript-eslint/no-use-before-define */
import { usePrivy } from '@privy-io/react-auth';
import { animated, useTransition } from '@react-spring/web';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';
import { useAccount, useConnect, useDisconnect } from 'wagmi';
+import * as Sentry from '@sentry/react';
// components
import Button from '../components/Button';
import DebugPanel from '../components/DebugPanel';
import ConnectionDebug, { DebugInfo } from '../components/ConnectionDebug';
🤖 Prompt for AI Agents
In src/pages/Login.tsx lines 1 to 12, the file currently lacks an import for
Sentry, which is used in other files for consistent error tracking. Add the
appropriate Sentry import statement at the top of the file alongside the other
imports to enable Sentry error reporting in this file.

Comment on lines 76 to 118
const listenForWalletConnectUri = async () => {
if (!walletConnectConnector) {
console.error('WalletConnect: Connector not found');
throw new Error('WalletConnect connector not found');
}

connect({ connector: walletConnectConnector });
try {
connect({ connector: walletConnectConnector });

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const provider: any = await walletConnectConnector.getProvider();
provider.once('display_uri', (uri: string) => {
const encodedURI = encodeURIComponent(uri);
window.location.href = `pillarwallet://wc?uri=${encodedURI}`;
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const provider: any = await walletConnectConnector.getProvider();

if (provider) {
// Event listener for display_uri
provider.once('display_uri', (uri: string) => {
const encodedURI = encodeURIComponent(uri);
const deeplinkUrl = `pillarwallet://wc?uri=${encodedURI}`;
window.location.href = deeplinkUrl;
});

// Add additional event listeners for debugging
provider.on('connect', () => {
// Event listener for connect
});

provider.on('disconnect', () => {
// Event listener for disconnect
});

provider.on('error', () => {
console.error('WalletConnect: error event:', error);
});
} else {
console.error('WalletConnect: Failed to get provider');
}
} catch (connectError) {
console.error(
'WalletConnect: Error during connection process:',
connectError
);
throw connectError;
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Enhance error tracking with Sentry

Replace console.error calls with Sentry error tracking for consistency with other files in this PR:

 const listenForWalletConnectUri = async () => {
   if (!walletConnectConnector) {
-    console.error('WalletConnect: Connector not found');
+    const error = new Error('WalletConnect connector not found');
+    console.error('WalletConnect: Connector not found');
+    Sentry.captureException(error, {
+      tags: {
+        component: 'login',
+        action: 'walletconnect_connector_missing',
+      },
+    });
     throw new Error('WalletConnect connector not found');
   }

Similarly update the error logging at lines 106, 109, and 112-115 to include Sentry tracking.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const listenForWalletConnectUri = async () => {
if (!walletConnectConnector) {
console.error('WalletConnect: Connector not found');
throw new Error('WalletConnect connector not found');
}
connect({ connector: walletConnectConnector });
try {
connect({ connector: walletConnectConnector });
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const provider: any = await walletConnectConnector.getProvider();
provider.once('display_uri', (uri: string) => {
const encodedURI = encodeURIComponent(uri);
window.location.href = `pillarwallet://wc?uri=${encodedURI}`;
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const provider: any = await walletConnectConnector.getProvider();
if (provider) {
// Event listener for display_uri
provider.once('display_uri', (uri: string) => {
const encodedURI = encodeURIComponent(uri);
const deeplinkUrl = `pillarwallet://wc?uri=${encodedURI}`;
window.location.href = deeplinkUrl;
});
// Add additional event listeners for debugging
provider.on('connect', () => {
// Event listener for connect
});
provider.on('disconnect', () => {
// Event listener for disconnect
});
provider.on('error', () => {
console.error('WalletConnect: error event:', error);
});
} else {
console.error('WalletConnect: Failed to get provider');
}
} catch (connectError) {
console.error(
'WalletConnect: Error during connection process:',
connectError
);
throw connectError;
}
};
const listenForWalletConnectUri = async () => {
if (!walletConnectConnector) {
const error = new Error('WalletConnect connector not found');
console.error('WalletConnect: Connector not found');
Sentry.captureException(error, {
tags: {
component: 'login',
action: 'walletconnect_connector_missing',
},
});
throw new Error('WalletConnect connector not found');
}
try {
connect({ connector: walletConnectConnector });
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const provider: any = await walletConnectConnector.getProvider();
if (provider) {
// Event listener for display_uri
provider.once('display_uri', (uri: string) => {
const encodedURI = encodeURIComponent(uri);
const deeplinkUrl = `pillarwallet://wc?uri=${encodedURI}`;
window.location.href = deeplinkUrl;
});
// Add additional event listeners for debugging
provider.on('connect', () => {
// Event listener for connect
});
provider.on('disconnect', () => {
// Event listener for disconnect
});
provider.on('error', () => {
console.error('WalletConnect: error event:', error);
});
} else {
console.error('WalletConnect: Failed to get provider');
}
} catch (connectError) {
console.error(
'WalletConnect: Error during connection process:',
connectError
);
throw connectError;
}
};
🤖 Prompt for AI Agents
In src/pages/Login.tsx between lines 76 and 118, replace all console.error calls
with Sentry error tracking calls to maintain consistency with the rest of the
project. Specifically, import Sentry if not already imported, then update the
error logging at lines 106, 109, and 112-115 by calling Sentry.captureException
or Sentry.captureMessage with the relevant error information instead of using
console.error. This will ensure errors are properly tracked and monitored.

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2cbb54c and 438f749.

📒 Files selected for processing (2)
  • .env.example (1 hunks)
  • src/main.tsx (1 hunks)
🧰 Additional context used
🪛 dotenv-linter (3.3.0)
.env.example

[warning] 8-8: [UnorderedKey] The VITE_REOWN_PROJECT_ID key should go before the VITE_USE_TESTNETS key


[warning] 9-9: [QuoteCharacter] The value has quote characters (', ")


[warning] 9-9: [UnorderedKey] The VITE_SKANDHA_URL key should go before the VITE_USE_TESTNETS key


[warning] 10-10: [QuoteCharacter] The value has quote characters (', ")


[warning] 10-10: [UnorderedKey] The VITE_SWAP_BUTTON_SWITCH key should go before the VITE_USE_TESTNETS key


[warning] 11-11: [QuoteCharacter] The value has quote characters (', ")


[warning] 11-11: [UnorderedKey] The VITE_PAYMASTER_URL key should go before the VITE_PLAUSIBLE_DOMAIN key


[warning] 12-12: [EndingBlankLine] No blank line at the end of the file


[warning] 12-12: [QuoteCharacter] The value has quote characters (', ")


[warning] 12-12: [UnorderedKey] The VITE_SENTRY_ENVIRONMENT key should go before the VITE_SKANDHA_URL key

⏰ 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: lint
  • GitHub Check: unit-tests
  • GitHub Check: build
🔇 Additional comments (3)
.env.example (1)

8-8: LGTM! Environment variable renamed for ReOwn migration.

The rename from VITE_WC_ID to VITE_REOWN_PROJECT_ID is consistent with the WalletConnect to ReOwn migration mentioned in the PR.

src/main.tsx (2)

37-38: Verify that enabling Sentry in all environments is intentional.

The change from conditional enabling (production only) to enabled: true means Sentry will now be active in development and staging environments. This will increase telemetry volume but provides better debugging capabilities.

Please confirm this change is intentional, especially considering potential data privacy and performance implications in development.


33-36: Confirmed: Function-Based Sentry Integrations Are Correct

  • File: src/main.tsx (lines 33–36)
    integrations: [
      Sentry.browserTracingIntegration(),
      Sentry.replayIntegration(),
    ],
  • These factory functions are the recommended approach in Sentry JS SDK v8+ (bundled in @sentry/react), replacing the old new BrowserTracing() and new Replay() constructors.
  • No separate @sentry/tracing or @sentry/replay imports are needed.
  • Ensure your root-level config includes tracesSampleRate, replaysSessionSampleRate, etc., as required by your application.

No further changes required.

@github-actions github-actions bot temporarily deployed to Preview (fix/deeplink-research) July 29, 2025 12:50 Inactive
@github-actions github-actions bot temporarily deployed to Preview (fix/deeplink-research) July 29, 2025 12:52 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: 2

🧹 Nitpick comments (1)
src/services/walletConnect.ts (1)

369-518: Well-implemented transaction hash polling with comprehensive tracking.

The polling mechanism with progress tracking is well thought out. Consider applying the same transaction status pattern suggested for other functions to maintain consistency across the codebase.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 438f749 and 7dbe651.

📒 Files selected for processing (5)
  • .env.example (1 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (16 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (15 hunks)
  • src/containers/Main.tsx (13 hunks)
  • src/services/walletConnect.ts (11 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx
  • src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx
🧰 Additional context used
🧠 Learnings (1)
src/containers/Main.tsx (1)

Learnt from: IAmKio
PR: #243
File: src/containers/Main.tsx:85-86
Timestamp: 2025-02-20T19:50:40.447Z
Learning: Passing private key via URL parameters in the login flow is an intentional design choice for handling edge cases in the private key login mode.

🧬 Code Graph Analysis (2)
src/services/walletConnect.ts (2)
src/utils/logout.ts (1)
  • useComprehensiveLogout (8-40)
__mocks__/walletConnectMock.ts (2)
  • WalletKit (41-41)
  • getSdkError (40-40)
src/containers/Main.tsx (2)
src/utils/blockchain.ts (1)
  • visibleChains (150-152)
src/apps/deposit/utils/blockchain.tsx (1)
  • getNetworkViem (60-79)
🪛 dotenv-linter (3.3.0)
.env.example

[warning] 8-8: [UnorderedKey] The VITE_REOWN_PROJECT_ID key should go before the VITE_USE_TESTNETS key


[warning] 9-9: [QuoteCharacter] The value has quote characters (', ")


[warning] 9-9: [UnorderedKey] The VITE_SKANDHA_URL key should go before the VITE_USE_TESTNETS key


[warning] 10-10: [QuoteCharacter] The value has quote characters (', ")


[warning] 10-10: [UnorderedKey] The VITE_SWAP_BUTTON_SWITCH key should go before the VITE_USE_TESTNETS key


[warning] 11-11: [QuoteCharacter] The value has quote characters (', ")


[warning] 11-11: [UnorderedKey] The VITE_PAYMASTER_URL key should go before the VITE_PLAUSIBLE_DOMAIN key


[warning] 12-12: [QuoteCharacter] The value has quote characters (', ")


[warning] 12-12: [UnorderedKey] The VITE_SENTRY_ENVIRONMENT key should go before the VITE_SKANDHA_URL key

⏰ 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: unit-tests
  • GitHub Check: lint
  • GitHub Check: build
🔇 Additional comments (8)
src/services/walletConnect.ts (3)

79-107: Good implementation of Sentry context tracking.

The comprehensive state tracking provides excellent visibility into WalletConnect state for debugging purposes.


531-737: Excellent error handling and user feedback in connection flow.

The specific error messages for different failure scenarios (expired URI, existing pairing, etc.) provide great user experience. The comprehensive Sentry tracking will help debug connection issues effectively.


739-910: Good refactoring of disconnect functionality.

The rename to disconnectSession is more descriptive, and the comprehensive error tracking maintains consistency with other operations.

src/containers/Main.tsx (3)

81-82: Good implementation of multi-source authentication.

The authentication logic correctly handles all three authentication methods (Privy, private key, and WalletConnect), providing a unified authentication state.


386-580: Well-structured provider setup with proper prioritization.

The implementation correctly prioritizes Privy wallets over WalletConnect connections and includes comprehensive error handling. The past issue with account reference has been properly addressed.


582-624: Good chain ID handling with appropriate fallbacks.

The implementation correctly handles chain ID setup for both Privy and WalletConnect, with sensible defaults to prevent errors.

.env.example (2)

12-13: Syntax issue resolved — LGTM.

The missing closing quote and final newline called out in the previous review are now fixed.


8-8: ✅ Environment variable rename verified

I ran rg -n VITE_WC_ID against the codebase and found no occurrences of the old variable. All references now use VITE_REOWN_PROJECT_ID, and VITE_WC_ID has been fully removed.

@IAmKio IAmKio merged commit feb3842 into staging Jul 29, 2025
6 checks passed
@IAmKio IAmKio deleted the fix/deeplink-research branch July 29, 2025 13:35
@coderabbitai coderabbitai bot mentioned this pull request Sep 16, 2025
3 tasks
@coderabbitai coderabbitai bot mentioned this pull request Nov 24, 2025
3 tasks
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.

2 participants