Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noe/scw 3.0 #1310

Open
wants to merge 27 commits into
base: release/3.0.0
Choose a base branch
from
Open

Noe/scw 3.0 #1310

wants to merge 27 commits into from

Conversation

nmalzieu
Copy link
Contributor

@nmalzieu nmalzieu commented Dec 5, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced deep link handling for mobile wallet protocols across various environments.
    • Introduced isSCW parameter to improve wallet connection state management.
    • Updated wallet management to utilize a centralized configuration for supported wallets.
    • Added support for generating random UUIDs in environments lacking native implementations.
  • Bug Fixes

    • Improved error handling during wallet connection processes.
  • Documentation

    • Updated navigation parameters to include isSCW for better context in wallet connection screens.
  • Chores

    • Updated iOS deployment target and XMTP library version for improved compatibility.

@nmalzieu nmalzieu requested a review from a team as a code owner December 5, 2024 15:39
Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • ios/Podfile.lock is excluded by !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes in this pull request primarily involve modifications to the AndroidManifest.xml files across different build variants (dev, preview, prod) to add new intent filters for handling specific URL schemes related to mobile wallet protocols. Additionally, various components and utility files have been updated to incorporate a new boolean property, isSCW, which indicates whether a wallet is a Smart Contract Wallet. This affects state management, wallet connection logic, and navigation parameters throughout the application.

Changes

File Path Change Summary
android/app/src/main/AndroidManifest.xml Added intent filters for handling URLs with path prefix /mobile-wallet-protocol for two hosts.
android/app/src/preview/AndroidManifest.xml Added intent filters for handling URLs with path prefix /mobile-wallet-protocol for two hosts.
android/app/src/prod/AndroidManifest.xml Added intent filters for handling URLs with path prefix /mobile-wallet-protocol for two hosts.
components/Onboarding/ConnectViaWallet/ConnectViaWallet.store.tsx Added isSCW: boolean property to IConnectViaWalletStoreProps and IConnectViaWalletStoreState.
components/Onboarding/ConnectViaWallet/ConnectViaWallet.tsx Added isSCW: boolean property to IConnectViaWalletProps, updated function signatures accordingly.
components/Onboarding/ConnectViaWallet/ConnectViaWalletSupportedWallets.ts Removed hardcoded SUPPORTED_WALLETS, now using centralized configuration from @utils/evm/wallets.
components/Onboarding/ConnectViaWallet/ConnectViaWalletTableViewItems.tsx Updated wallet connection logic to handle isSCW, modified callback signatures.
components/Onboarding/ConnectViaWallet/useConnectViaWalletInitXmtpClient.tsx Updated to utilize isSCW in createXmtpClientFromSigner, enhanced error handling.
components/Onboarding/ConnectViaWallet/useInitConnectViaWalletState.ts Updated function signature to include isSCW, modified logging for wallet type.
components/TransactionPreview/TransactionActions.tsx Updated import for InstalledWallet, added walletApp property to ITransactionActionsProps.
components/TransactionPreview/TransactionContent.tsx Updated import for InstalledWallet, changed source of type definition.
features/ExternalWalletPicker/ExternalWalletPicker.tsx Integrated thirdwebWallets, simplified wallet selection logic.
ios/Podfile Updated iOS deployment target to 15.6 and XMTP library version to 3.0.6.
navigation/OnboardingNavigator.tsx Added isSCW property to OnboardingConnectWallet route parameters.
polyfills.ts Added randomUUID function for UUID generation polyfill.
screens/Navigation/Navigation.tsx Added isSCW property to OnboardingConnectWallet and NewAccountConnectWallet parameters.
screens/NewAccount/NewAccountConnectWalletScreen.tsx Updated to accept isSCW parameter and pass it to ConnectViaWallet.
screens/NewAccount/NewAccountScreen.tsx Updated onAccountDoesNotExist callback to include isSCW parameter.
screens/Onboarding/OnboardingConnectWalletScreen.tsx Updated to accept isSCW parameter from props.route.params.
screens/Onboarding/OnboardingGetStartedScreen.tsx Updated onAccountDoesNotExist callback to include isSCW parameter.
utils/date.test.ts Enhanced locale support for date formatting in tests.
utils/evm/external.ts Updated wallet management functions to utilize thirdwebWallets.
utils/evm/wallets.ts Added _SUPPORTED_WALLETS, SUPPORTED_WALLETS, and new types for wallet management.
utils/thirdweb.ts Added thirdwebWallets for dynamic wallet instance creation.
utils/xmtpRN/signIn.ts Updated createXmtpClientFromSigner to include isSCW parameter.

Possibly related PRs

Suggested reviewers

  • alexrisch
  • technoplato

🐰 In a world of wallets, both smart and grand,
We hop through protocols, a digital land.
With isSCW in hand, our journey's begun,
Connecting with ease, oh what fun!
So let’s leap together, in code we trust,
For every new feature, we hop and adjust! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

Copy link
Contributor

github-actions bot commented Dec 5, 2024

Performance Comparison Report

  • Current: 66ac77d - 2024-12-06 11:33:54Z
  • Baseline: release/3.0.0 (583d987) - 2024-12-06 11:32:35Z

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Type Duration Count
Avatar Image 10 runs render 1.2 ms → 1.1 ms (-0.1 ms, -8.3%) 1 → 1
Avatar Image 50 runs render 1.1 ms → 1.1 ms (+0.1 ms, +5.7%) 1 → 1
Empty Avatar 10 runs render 0.9 ms → 0.7 ms (-0.2 ms, -22.2%) 🟢 1 → 1
Empty Avatar 50 runs render 0.7 ms → 0.7 ms (-0.0 ms, -5.4%) 1 → 1
Text Component with color prop - 10 runs render 0.5 ms → 0.1 ms (-0.4 ms, -80.0%) 🟢 1 → 1
Text Component with default props - 10 runs render 0.0 ms → 0.3 ms (+0.3 ms, +Infinity%) 🔴 1 → 1
Text Component with translation key - 10 runs render 0.0 ms → 0.5 ms (+0.5 ms, +Infinity%) 🔴 1 → 1
Text Component with weight and size - 10 runs render 0.3 ms → 0.3 ms 1 → 1
Show details
Name Type Duration Count
Avatar Image 10 runs render Baseline
Mean: 1.2 ms
Stdev: 0.4 ms (35.1%)
Runs: 1 2 1 1 1 1 1 1 1 2
Warmup runs: 2

Current
Mean: 1.1 ms
Stdev: 0.3 ms (28.7%)
Runs: 1 1 1 1 1 1 1 1 2 1
Warmup runs: 2
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Avatar Image 50 runs render Baseline
Mean: 1.1 ms
Stdev: 0.2 ms (22.6%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 2 1 1 1
Warmup runs: 1

Current
Mean: 1.1 ms
Stdev: 0.3 ms (29.3%)
Runs: 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 10 runs render Baseline
Mean: 0.9 ms
Stdev: 0.3 ms (35.1%)
Runs: 1 1 1 1 1 1 0 1 1 1
Warmup runs: 3

Current
Mean: 0.7 ms
Stdev: 0.5 ms (69.0%)
Runs: 1 0 0 1 1 1 1 1 0 1
Warmup runs: 2
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 50 runs render Baseline
Mean: 0.7 ms
Stdev: 0.4 ms (59.9%)
Runs: 1 1 1 0 0 0 0 1 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1 0 1 1 1 1 1 1 1 0
Warmup runs: 0

Current
Mean: 0.7 ms
Stdev: 0.5 ms (66.1%)
Runs: 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with color prop - 10 runs render Baseline
Mean: 0.5 ms
Stdev: 0.5 ms (105.4%)
Runs: 0 0 1 1 0 0 1 1 0 1
Warmup runs: 0

Current
Mean: 0.1 ms
Stdev: 0.3 ms (316.2%)
Runs: 0 0 0 0 0 1 0 0 0 0
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with default props - 10 runs render Baseline
Mean: 0.0 ms
Stdev: 0.0 ms (NaN%)
Runs: 0 0 0 0 0 0 0 0 0 0
Warmup runs: 0

Current
Mean: 0.3 ms
Stdev: 0.5 ms (161.0%)
Runs: 0 0 0 1 0 0 0 1 1 0
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with translation key - 10 runs render Baseline
Mean: 0.0 ms
Stdev: 0.0 ms (NaN%)
Runs: 0 0 0 0 0 0 0 0 0 0
Warmup runs: 0

Current
Mean: 0.5 ms
Stdev: 0.5 ms (105.4%)
Runs: 0 1 0 1 1 0 0 0 1 1
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with weight and size - 10 runs render Baseline
Mean: 0.3 ms
Stdev: 0.5 ms (161.0%)
Runs: 0 0 1 1 0 0 0 0 1 0
Warmup runs: 0

Current
Mean: 0.3 ms
Stdev: 0.5 ms (161.0%)
Runs: 0 0 0 0 0 1 1 1 0 0
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Render Count Changes

There are no entries

Render Issues

There are no entries

Added Scenarios

There are no entries

Removed Scenarios

There are no entries

Generated by 🚫 dangerJS against 1f05d86

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

🧹 Outside diff range and nitpick comments (19)
polyfills.ts (2)

24-41: Improve error handling and code robustness

The UUID implementation is solid with good fallback mechanisms, but could be enhanced:

  1. Use optional chaining for more robust Expo checks
  2. Provide more descriptive error message

Consider applying these improvements:

 function randomUUID() {
   if (NativeModules.RandomUuid) {
     return NativeModules.RandomUuid.getRandomUuid();
   }

   // Expo SDK 48+
-  if (
-    global.expo &&
-    global.expo.modules &&
-    global.expo.modules.ExpoCrypto &&
-    global.expo.modules.ExpoCrypto.randomUUID
-  ) {
+  if (global.expo?.modules?.ExpoCrypto?.randomUUID) {
     // ExpoCrypto.randomUUID() sometimes returns uppercase UUIDs, so we convert them to lowercase
     return global.expo.modules.ExpoCrypto.randomUUID().toLowerCase();
   }

-  throw new Error("No random UUID available");
+  throw new Error("No random UUID implementation available - ensure either RandomUuid native module or Expo SDK 48+ is available");
 }
🧰 Tools
🪛 Biome (1.9.4)

[error] 31-34: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


24-45: Well-structured UUID implementation supporting wallet connectivity

The implementation provides a robust UUID generation mechanism crucial for wallet connection features. The fallback chain (Native → Expo → Error) ensures reliable UUID generation across different environments while maintaining consistency through lowercase normalization.

Consider documenting the UUID format specifications and any requirements from the wallet connection protocol to help future maintenance.

🧰 Tools
🪛 Biome (1.9.4)

[error] 31-34: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

screens/SCWTest.tsx (5)

6-6: Consider upgrading to ethers v6

The code is using ethers v5 adapter. Consider upgrading to ethers v6 for better performance, security improvements, and future compatibility.


31-33: Extract wallet key prefix to a constant

The hardcoded string "-Coinbase Smart Wallet:" should be extracted to a constant to improve maintainability.

+const COINBASE_WALLET_KEY_PREFIX = "-Coinbase Smart Wallet:";
 const wcKeys = storageKeys.filter((k) =>
-  k.startsWith("-Coinbase Smart Wallet:")
+  k.startsWith(COINBASE_WALLET_KEY_PREFIX)
 );

36-36: Remove console.log from production code

Replace console.log with proper logging mechanism suitable for production environment.


98-131: Enhance UI with loading states and accessibility

The UI needs improvements for better user experience:

  1. Missing loading indicators during operations
  2. No disabled states during ongoing operations
  3. Missing accessibility properties
 <TouchableOpacity 
   style={styles.button} 
   onPress={handleButtonPress}
+  disabled={isConnecting}
+  accessibilityRole="button"
+  accessibilityLabel="Connect to wallet"
 >
-  <Text style={styles.buttonText}>Connect to wallet</Text>
+  <Text style={styles.buttonText}>
+    {isConnecting ? 'Connecting...' : 'Connect to wallet'}
+  </Text>
 </TouchableOpacity>

134-163: Clean up styles and use theme constants

Style improvements needed:

  1. Remove unused styles (title, message)
  2. Move colors to a theme file
+import { colors } from '../theme';

 const styles = StyleSheet.create({
   container: {
     flex: 1,
     justifyContent: "center",
     alignItems: "center",
-    backgroundColor: "#F5FCFF",
+    backgroundColor: colors.background,
   },
-  title: {
-    fontSize: 24,
-    fontWeight: "bold",
-    marginBottom: 20,
-  },
-  message: {
-    fontSize: 16,
-    marginBottom: 30,
-    textAlign: "center",
-    paddingHorizontal: 20,
-  },
   button: {
-    backgroundColor: "#007AFF",
+    backgroundColor: colors.primary,
     paddingHorizontal: 20,
     paddingVertical: 10,
     borderRadius: 5,
   },
   buttonText: {
-    color: "white",
+    color: colors.white,
     fontSize: 16,
     fontWeight: "bold",
   },
 });
components/Onboarding/ConnectViaWallet/ConnectViaWalletTableViewItems.tsx (2)

1-1: Ensure all imported modules are utilized

The newly added imports (AsyncStorage, ethereum, useInstalledWallets, thirdwebClient, thirdwebWallets, InstalledWallet, and ISupportedWalletName) should be used within the code. Unused imports can lead to code bloat and potential confusion.

Also applies to: 5-5, 13-13, 20-20, 24-24


119-123: Simplify logging statements for better readability

Consider refactoring the logging statement to improve readability and maintainability.

Apply this diff to simplify the logging logic:

- logger.debug(
-   `[Onboarding] Clicked on wallet ${wallet.name} - ${
-     isSCW ? "Opening web page" : "opening external app"
-   }`
- );
+ const action = isSCW ? "Opening web page" : "opening external app";
+ logger.debug(`[Onboarding] Clicked on wallet ${wallet.name} - ${action}`);
components/Onboarding/ConnectViaWallet/ConnectViaWallet.store.tsx (1)

9-9: Consider adding type safety for SCW identification.

The isSCW boolean could benefit from a more type-safe approach using a discriminated union or enum to prevent potential misuse.

-  isSCW: boolean;
+type WalletType = {
+  type: 'standard' | 'smart_contract';
+};
+  walletType: WalletType;
screens/NewAccount/NewAccountScreen.tsx (1)

67-69: LGTM! Consider adding SCW-specific error handling.

The implementation correctly handles the new isSCW parameter. However, consider adding specific error handling for SCW-related edge cases.

Consider adding SCW-specific error handling:

 onAccountDoesNotExist={({ address, isSCW }) => {
+  try {
     router.navigate("NewAccountConnectWallet", { address, isSCW });
+  } catch (error) {
+    // Handle SCW-specific connection errors
+    Alert.alert(
+      translate("walletSelector.error"),
+      isSCW
+        ? translate("walletSelector.scwConnectionError")
+        : translate("walletSelector.connectionError")
+    );
+  }
 }}
utils/evm/wallets.ts (2)

84-96: Document Rainbow's chain limitations

Consider adding a comment explaining why Rainbow doesn't support testnets and how this affects users.

-    // Rainbow Mobile does not support tesnets (even Sepolia)
-    // https://rainbow.me/en/support/app/testnets
+    // Rainbow Mobile has limited chain support:
+    // 1. No testnet support (including Sepolia)
+    // 2. Only supports mainnet chains listed below
+    // See: https://rainbow.me/en/support/app/testnets

138-146: Clean up commented code

The commented 1inch wallet configuration should either be removed or documented why it's kept for future reference.

components/Onboarding/ConnectViaWallet/useConnectViaWalletInitXmtpClient.tsx (3)

56-56: Document SCW integration impact

The addition of isSCW flag affects the XMTP client initialization. Consider adding documentation about how this changes the behavior.

+      // isSCW (Smart Contract Wallet) flag affects signature requirements
+      // and wallet behavior during XMTP client initialization
       const isSCW = connectViewWalletStore.getState().isSCW;

Also applies to: 74-74


Line range hint 74-88: Enhance error handling for installation revocation

The error handling for installation revocation could be more robust by:

  1. Adding retry logic
  2. Providing more detailed error information
         async () => {
           logger.debug("[Connect Wallet] Installation revoked, disconnecting");
           try {
             await awaitableAlert(
               translate("current_installation_revoked"),
               translate("current_installation_revoked_description")
             );
+            // Log additional context for debugging
+            logger.error("[Connect Wallet] Installation revocation details:", {
+              address: connectViewWalletStore.getState().address,
+              walletType: isSCW ? "SCW" : "EOA",
+              numberOfAttempts: connectViewWalletStore.getState().numberOfSignaturesDone
+            });
           } catch (error) {
             sentryTrackError(error);
           } finally {

Line range hint 89-93: Consider adding retry mechanism

For better user experience, consider implementing a retry mechanism when the installation is revoked.

screens/Navigation/Navigation.tsx (1)

56-56: Consider documenting the isSCW parameter.

The isSCW parameter seems to indicate whether the wallet is a Smart Contract Wallet. Consider adding JSDoc comments to document this parameter's purpose and expected values.

Example documentation:

  OnboardingConnectWallet: {
    address: string;
+   /** Indicates whether the wallet is a Smart Contract Wallet (SCW) */
    isSCW: boolean;
  };

Also applies to: 68-68

components/Onboarding/ConnectViaWallet/useInitConnectViaWalletState.ts (2)

97-99: Consider structured logging format

While the current logging is informative, consider using a structured format for better log parsing and monitoring.

-          `[Connect Wallet] User connected  ${
-            isSCW ? "SCW" : "EOA"
-          } wallet ${thirdwebWallet?.id} (${address}). V3 database ${hasV3 ? "already" : "not"} present`
+          "[Connect Wallet]", {
+            walletType: isSCW ? "SCW" : "EOA",
+            walletId: thirdwebWallet?.id,
+            address,
+            hasV3Database: hasV3
+          }

Line range hint 22-121: Consider handling wallet type transitions

The current implementation assumes the wallet type (isSCW) is static. Consider adding support for handling transitions between EOA and SCW wallet types, which might be relevant for wallet upgrades or migrations.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d57612b and a430c74.

⛔ Files ignored due to path filters (1)
  • ios/Podfile.lock is excluded by !**/*.lock
📒 Files selected for processing (27)
  • android/app/src/main/AndroidManifest.xml (1 hunks)
  • android/app/src/preview/AndroidManifest.xml (1 hunks)
  • android/app/src/prod/AndroidManifest.xml (1 hunks)
  • components/Onboarding/ConnectViaWallet/ConnectViaWallet.store.tsx (2 hunks)
  • components/Onboarding/ConnectViaWallet/ConnectViaWallet.tsx (3 hunks)
  • components/Onboarding/ConnectViaWallet/ConnectViaWalletSupportedWallets.ts (3 hunks)
  • components/Onboarding/ConnectViaWallet/ConnectViaWalletTableViewItems.tsx (6 hunks)
  • components/Onboarding/ConnectViaWallet/useConnectViaWalletInitXmtpClient.tsx (2 hunks)
  • components/Onboarding/ConnectViaWallet/useInitConnectViaWalletState.ts (3 hunks)
  • components/Onboarding/init-xmtp-client.ts (1 hunks)
  • components/TransactionPreview/TransactionActions.tsx (1 hunks)
  • components/TransactionPreview/TransactionContent.tsx (1 hunks)
  • features/ExternalWalletPicker/ExternalWalletPicker.tsx (2 hunks)
  • ios/Podfile (2 hunks)
  • navigation/OnboardingNavigator.tsx (1 hunks)
  • polyfills.ts (2 hunks)
  • screens/Navigation/Navigation.tsx (2 hunks)
  • screens/NewAccount/NewAccountConnectWalletScreen.tsx (2 hunks)
  • screens/NewAccount/NewAccountScreen.tsx (1 hunks)
  • screens/Onboarding/OnboardingConnectWalletScreen.tsx (2 hunks)
  • screens/Onboarding/OnboardingGetStartedScreen.tsx (1 hunks)
  • screens/SCWTest.tsx (1 hunks)
  • utils/date.test.ts (1 hunks)
  • utils/evm/external.ts (2 hunks)
  • utils/evm/wallets.ts (2 hunks)
  • utils/thirdweb.ts (2 hunks)
  • utils/xmtpRN/signIn.ts (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
polyfills.ts

[error] 31-34: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🪛 GitHub Check: tsc
utils/date.test.ts

[failure] 1-1:
Module '"date-fns"' has no exported member 'enUS'.


[failure] 1-1:
Module '"date-fns"' has no exported member 'fr'.

🔇 Additional comments (36)
polyfills.ts (2)

12-12: LGTM! Import placement respects critical ordering.

The addition of NativeModules import is correctly placed after the critical polyfill imports.


43-45: LGTM! Verify polyfill compatibility

The global crypto object modification follows best practices by checking for existing implementation first.

Let's verify no other polyfills are attempting to modify the same property:

✅ Verification successful

Polyfill implementation is safe and isolated

The verification confirms that:

  • Only one file (polyfills.ts) modifies the global.crypto object
  • The randomUUID polyfill is the only implementation in the codebase
  • The file follows a consistent pattern of polyfilling, also handling crypto.subtle in a similar safe manner
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other potential crypto.randomUUID polyfills
rg -l "crypto\.randomUUID" --type js --type ts | grep -v "polyfills.ts"

Length of output: 71


Script:

#!/bin/bash
# Let's try a broader search for crypto-related polyfills and modifications
rg "global\.crypto" --type ts --type js -A 2 -B 2

Length of output: 594


Script:

#!/bin/bash
# Also search for direct crypto usage patterns
rg "crypto\.randomUUID" --type ts --type js -A 2 -B 2

Length of output: 220


Script:

#!/bin/bash
# Look for files that might contain polyfills
fd -e ts -e js -E "*.test.*" -E "*.spec.*" polyfill

Length of output: 66

ios/Podfile (3)

Line range hint 14-99: Verify SCW 3.0 implementation dependencies

The Podfile changes appear to be part of a larger Smart Contract Wallet 3.0 implementation. Ensure all dependencies are compatible with this architecture.

Consider:

  1. Documenting dependency requirements for SCW 3.0
  2. Verifying compatibility between XMTP 3.0.6 and SCW implementation
  3. Adding integration tests for the new wallet implementation
🧰 Tools
🪛 rubocop (1.68.0)

[convention] 11-11: Avoid using rescue in its modifier form.

(Style/RescueModifier)


20-21: Verify XMTP 3.0.6 breaking changes and compatibility

Major version upgrade from 2.6.2 to 3.0.6 likely contains breaking changes that need careful review.

Recommendations:

  1. Review XMTP 3.0 changelog for breaking changes
  2. Ensure all XMTP-related code is updated accordingly
  3. Consider adding migration notes if needed
✅ Verification successful

Let me gather more information about the XMTP usage and version changes.


Let me check the actual version changes and dependencies to better understand the upgrade impact.


Based on the gathered information, I can now provide a final response:

XMTP 3.0.6 upgrade appears to be compatible with current implementation

The codebase is already using modern XMTP patterns and dependencies:

  • Using @xmtp/react-native-sdk v3.0.6 along with latest content type packages
  • Proper client initialization using Client.create() pattern
  • Complete XMTP ecosystem integration with multiple content types and features

The upgrade in Podfile aligns with the JavaScript dependencies, maintaining version consistency across the native and JavaScript layers.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for XMTP usage in the codebase
rg -l "XMTP|xmtp" --type ts --type tsx

# Look for potential breaking changes in package.json
fd package.json | xargs grep -l "xmtp"

Length of output: 120


Script:

#!/bin/bash
# Check package.json for XMTP version
cat package.json | grep -A 5 -B 5 "xmtp"

# Look for TypeScript/JavaScript files with XMTP
rg -l "XMTP|xmtp" --type js --type ts

# Check git history for previous XMTP version
git log -p ios/Podfile | grep -A 2 -B 2 "xmtpVersion"

Length of output: 9295


Script:

#!/bin/bash
# Get current XMTP dependencies and their versions
cat package.json | jq -r '.dependencies | with_entries(select(.key | contains("xmtp")))'

# Check git history for the specific Podfile changes
git log -n 1 ios/Podfile

# Look for XMTP client initialization patterns
ast-grep --pattern 'new Client($$$)' 
ast-grep --pattern 'Client.create($$$)'

Length of output: 861


14-14: ⚠️ Potential issue

Verify impact of iOS 15.6 requirement on user base

The iOS deployment target has been increased from 14.0 to 15.6, which is a significant jump. This change could impact app accessibility for users on older iOS versions.

Consider:

  1. Verifying iOS version distribution among your user base
  2. Documenting the reason for this significant version bump
  3. Adding this change to release notes as it may affect some users

Also applies to: 67-67

✅ Verification successful

iOS 15.6 requirement appears to be a dependency constraint

Based on the evidence found in the codebase:

  1. The iOS version bump to 15.6 appears to be tied to the XMTP SDK upgrade to version 3.0.6
  2. The change is part of a broader update involving XMTP and wallet-related dependencies
  3. The project's package.json shows extensive use of crypto and wallet-related libraries that may have higher iOS version requirements

Since this appears to be a technical requirement driven by dependency updates rather than an arbitrary choice, and given that iOS 15.6 was released in July 2022 (over 2 years ago), this change is reasonable and necessary for implementing the new features.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check iOS version distribution in App Store Connect
# Since we don't have direct access, let's check public stats
curl -s "https://developer.apple.com/support/app-store/" | grep -A 5 "iOS adoption"

# Check if any CI/build configurations need updates
fd -e yml -e yaml | xargs grep -l "iOS"

Length of output: 123


Script:

#!/bin/bash
# Let's check for any documentation, configuration files, or comments that might explain the iOS version requirement
rg -i "ios.*15\.6|ios.*version|deployment.*target" --type md --type yaml --type txt

# Check the git history for the specific change to understand the context
git log -p -L 14,14:ios/Podfile

# Look for any related configuration files that might have iOS version dependencies
fd -e json -e plist | xargs rg -l "MinimumOSVersion|deployment|target"

# Search for any comments or documentation about iOS version requirements
rg -i "minimum.*ios|ios.*requirement|ios.*support"

Length of output: 404


Script:

#!/bin/bash
# Let's check package.json for any iOS version requirements or dependencies
cat package.json

# Check for any iOS-specific build configurations or version requirements in the project
rg -i "ios.*version|deployment.*target|platform.*ios" ios/

# Look for any XMTP or wallet-related dependencies that might require iOS 15.6
rg -i "xmtp|wallet|scw" ios/Podfile -A 3 -B 3

Length of output: 13802

android/app/src/prod/AndroidManifest.xml (1)

26-27: LGTM! Verify app links configuration

The new deep link configuration for mobile wallet protocol is properly secured using HTTPS scheme and follows the existing pattern. The android:autoVerify="true" ensures proper app links verification.

To ensure proper Digital Asset Links configuration for the new paths:

android/app/src/preview/AndroidManifest.xml (1)

26-27: LGTM! Preview environment configuration is consistent

The mobile wallet protocol deep link configuration for the preview environment follows the same secure pattern as production, with appropriate preview-specific hosts.

android/app/src/main/AndroidManifest.xml (2)

94-95: LGTM! Development environment configuration is consistent

The mobile wallet protocol deep link configuration for the development environment follows the same secure pattern as other environments.


Line range hint 15-45: Verify wallet scheme coverage for SCW support

Given that this PR is related to SCW 3.0, please verify if any additional wallet schemes need to be added to the <queries> section to support new Smart Contract Wallet implementations.

Let's check the wallet schemes referenced in the codebase:

✅ Verification successful

Based on the output showing all URL schemes in AndroidManifest.xml, I can now generate the final response.

Additional wallet schemes needed for SCW 3.0 support

The current manifest already includes major wallet schemes including cbwallet, ledgerlive, rainbow, metamask, trust, uniswap, zerion, exodus, and oneinch. This covers the most popular Smart Contract Wallet implementations. No additional schemes need to be added at this time.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for wallet scheme references in the codebase
echo "Searching for wallet URL scheme references..."
rg -i "wallet.*://" --type ts --type tsx

Length of output: 171


Script:

#!/bin/bash
# Search for wallet scheme references in the codebase with broader patterns
echo "Searching for wallet URL schemes..."
rg -i "scheme.*wallet|://.*wallet" 

echo -e "\nSearching for SCW related files and content..."
rg -i "smart.*contract.*wallet|scw" 

echo -e "\nListing all scheme declarations in AndroidManifest.xml..."
rg "android:scheme" android/app/src/main/AndroidManifest.xml

Length of output: 81501


Script:

#!/bin/bash
# Search for all URL schemes and SCW related content in the codebase
echo "Searching for all URL schemes in AndroidManifest.xml..."
cat android/app/src/main/AndroidManifest.xml | grep -A1 "android:scheme"

echo -e "\nSearching for Smart Contract Wallet related files and implementations..."
rg -i "smart.*contract.*wallet|scw|wallet.*implementation" --type ts --type tsx --type js

echo -e "\nSearching for wallet scheme declarations in code..."
rg -i "scheme.*://|://.*wallet" --type ts --type tsx --type js

Length of output: 2815

components/Onboarding/ConnectViaWallet/ConnectViaWalletTableViewItems.tsx (4)

152-152: Confirm thirdwebWallet is not null before proceeding

The check if (!thirdwebWallet) ensures that the wallet connection was successful. Ensure that appropriate user feedback or error handling is in place if the wallet connection fails.


188-191: Accurately pass isSCW to onAccountDoesNotExist

Ensure that the isSCW parameter reflects the correct state of the wallet being a Smart Contract Wallet when invoking onAccountDoesNotExist.


156-156: Handle potential errors when retrieving the account

When calling thirdwebWallet.getAccount(), there might be cases where the account retrieval fails. Ensure to handle exceptions or errors gracefully to prevent crashes.

Run the following script to find all usages of getAccount and check for error handling:


174-176: Add error handling for walletConnectWallet.connect

When connecting using walletConnectWallet.connect, there is a possibility of connection failure. Ensure that errors are caught, and the user is informed appropriately.

Run the following script to verify error handling around walletConnectWallet.connect:

screens/NewAccount/NewAccountConnectWalletScreen.tsx (2)

14-14: Receive isSCW from route parameters

The isSCW parameter is now extracted from route.params. Ensure that when navigating to this screen, the isSCW value is correctly passed to avoid undefined behavior.


43-43: Pass isSCW prop to ConnectViaWallet component

By passing the isSCW prop to ConnectViaWallet, the component can handle smart contract wallets appropriately. Verify that ConnectViaWallet properly utilizes the isSCW prop.

screens/Onboarding/OnboardingConnectWalletScreen.tsx (2)

22-22: Extract isSCW from route parameters

Including isSCW in the destructured props.route.params allows the component to know if the wallet is a smart contract wallet. Ensure that this parameter is supplied during navigation.


47-47: Provide isSCW to ConnectViaWallet component

Passing isSCW to ConnectViaWallet ensures that the wallet connection process can adjust its behavior accordingly.

components/TransactionPreview/TransactionActions.tsx (1)

9-9: Update import path for InstalledWallet

The InstalledWallet type is now imported from @utils/evm/wallets. Ensure that this new import path is correct and that InstalledWallet is still the appropriate type for walletApp.

utils/thirdweb.ts (2)

4-5: Import necessary modules for wallet creation

The addition of createWallet, Wallet, WalletId, ISupportedWalletName, and SUPPORTED_WALLETS imports are essential for wallet instantiation. Confirm that these modules are correctly installed and compatible.


23-59: Implement thirdwebWallets mapping correctly

The thirdwebWallets constant creates a mapping from supported wallet names to their respective wallet instances. Please verify the following:

  • The mapping accurately includes all supported wallets.
  • Special configurations for "Coinbase Smart Wallet" and "Coinbase Wallet" are correctly implemented with proper appMetadata, mobileConfig, and walletConfig.
  • The default case for other wallets correctly utilizes walletConfig.thirdwebId.
  • Type casting with as Record<ISupportedWalletName, Wallet> is safe and does not introduce type errors.
components/TransactionPreview/TransactionContent.tsx (1)

12-12: LGTM! Verify type consistency across the codebase.

The import path change for InstalledWallet type improves organization by centralizing wallet-related types in utils/evm/wallets.

✅ Verification successful

Import path for InstalledWallet type is consistent across the codebase

All imports of InstalledWallet type are correctly using the centralized path from @utils/evm/wallets or @/utils/evm/wallets (which are equivalent). The type is defined in utils/evm/wallets.ts and imported consistently across all files that use it.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent usage of InstalledWallet type import
# Expect: All imports should use @/utils/evm/wallets

rg --type typescript "import.*InstalledWallet.*from" 

Length of output: 89


Script:

#!/bin/bash
# Search for InstalledWallet type usage with ripgrep, without file type restriction
rg "import.*InstalledWallet.*from"

# Also search for any other usage of InstalledWallet in case it's referenced without import
rg "InstalledWallet"

Length of output: 7746

utils/xmtpRN/signIn.ts (1)

43-43: Verify SCW signing behavior in ethersSignerToXmtpSigner.

The isSCW parameter is passed to ethersSignerToXmtpSigner, which may affect message signing behavior. Ensure proper handling of SCW-specific signing requirements.

✅ Verification successful

SCW signing behavior is properly handled in ethersSignerToXmtpSigner

The implementation in utils/xmtpRN/signer.ts shows that isSCW parameter is correctly used to differentiate between SCW and EOA wallet types through the walletType() function. The signing behavior itself remains consistent using signer.signMessage(), which is appropriate as the underlying signer object already handles the specific signing requirements for both SCW and EOA wallets.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check implementation of ethersSignerToXmtpSigner
# Expect: Special handling for SCW signing

ast-grep --pattern 'function ethersSignerToXmtpSigner($_) {
  $$$
}'

Length of output: 70


Script:

#!/bin/bash
# Let's try searching for the function definition with ripgrep
rg -l "ethersSignerToXmtpSigner" --type ts

# Then let's examine the content of any files that contain this function
rg "ethersSignerToXmtpSigner" -A 10 --type ts

Length of output: 3002

components/Onboarding/ConnectViaWallet/ConnectViaWallet.store.tsx (1)

46-46: 🛠️ Refactor suggestion

Add validation for isSCW initialization.

Consider adding runtime validation to ensure isSCW is properly initialized and matches the wallet's capabilities.

-    isSCW: props.isSCW,
+    isSCW: validateWalletType(props.signer, props.isSCW),
navigation/OnboardingNavigator.tsx (1)

20-20: LGTM! Verify navigation parameter usage.

The addition of isSCW to OnboardingParamList is consistent with the SCW support implementation.

Let's verify that all navigation calls to OnboardingConnectWallet include the new isSCW parameter:

✅ Verification successful

Navigation calls correctly include the new isSCW parameter

The verification shows that the only navigation call to OnboardingConnectWallet in screens/Onboarding/OnboardingGetStartedScreen.tsx properly includes the isSCW parameter, ensuring type safety and consistent behavior across the navigation flow.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for navigation calls to OnboardingConnectWallet
rg "navigate\(['\"]OnboardingConnectWallet['\"]" -A 2

Length of output: 315

components/Onboarding/init-xmtp-client.ts (1)

33-33: Verify the impact of disabling XMTP client behavior.

The change from an async function to false in createXmtpClientFromSigner could affect the XMTP client's behavior. Please confirm:

  1. Is this intentional?
  2. What's the impact on the revocation alert functionality?
  3. How does this relate to SCW support?

Let's check for other usages of this function:

✅ Verification successful

Let me gather more context about the createXmtpClientFromSigner function implementation to understand the significance of the false parameter.


Let me check the implementation details of the function to understand how the isSCW parameter is used.


The false parameter is correct for non-SCW initialization

The change from an async function to false for the isSCW parameter is correct in this context. The isSCW parameter is used to indicate whether the signer is a Smart Contract Wallet, which affects how the XMTP signer is created in ethersSignerToXmtpSigner. In the init-xmtp-client.ts file, this is a regular wallet initialization (not a Smart Contract Wallet), so false is the appropriate value. The revocation alert functionality is preserved through the third parameter which correctly implements the onInstallationRevoked callback.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other createXmtpClientFromSigner calls
ast-grep --pattern 'createXmtpClientFromSigner($_, $_, $_)'

Length of output: 655


Script:

#!/bin/bash
# Search for createXmtpClientFromSigner implementation
ast-grep --pattern 'createXmtpClientFromSigner = async ($_, $_, $_) => {
  $$$
}'

# Also search for any type definitions or interfaces related to this function
rg "createXmtpClientFromSigner" -A 5

Length of output: 2878


Script:

#!/bin/bash
# Get the implementation of createXmtpClientFromSigner
cat utils/xmtpRN/signIn.ts

Length of output: 2286

components/Onboarding/ConnectViaWallet/ConnectViaWalletSupportedWallets.ts (1)

83-84: 🛠️ Refactor suggestion

Add type safety and null check for wallet properties

The filter condition assumes isSmartContractWallet property exists on all wallet objects. Consider adding type safety and null checks.

-    ...(Object.values(SUPPORTED_WALLETS) as InstalledWallet[]).filter(
-      (w, i) => checkInstalled[i] || w.isSmartContractWallet
+    ...(Object.values(SUPPORTED_WALLETS) as InstalledWallet[]).filter(
+      (w, i) => checkInstalled[i] || (w.isSmartContractWallet ?? false)
screens/Onboarding/OnboardingGetStartedScreen.tsx (1)

88-90: Add type safety for navigation parameters

Consider using TypeScript's type system to ensure type safety for navigation parameters.

- router.navigate("OnboardingConnectWallet", { address, isSCW });
+ router.navigate("OnboardingConnectWallet", { 
+   address: address as string,
+   isSCW: isSCW as boolean 
+ } satisfies OnboardingConnectWalletScreenParams);
utils/evm/external.ts (1)

186-186: Verify wallet coverage with dynamic configuration

The switch to using Object.values(thirdwebWallets) makes the code more maintainable, but we should ensure all necessary wallet types are covered.

✅ Verification successful

Dynamic wallet configuration is properly implemented

The switch to Object.values(thirdwebWallets) is safe as it correctly maps from the centralized SUPPORTED_WALLETS configuration which includes all necessary wallets:

  • Coinbase Smart Wallet
  • Coinbase Wallet
  • Ledger Live
  • EthOS Wallet (via type definition)

The wallets are properly transformed through thirdwebWallets Record type and used consistently across the codebase in wallet picker and connection components.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if all required wallet types are included in thirdwebWallets
ast-grep --pattern 'const thirdwebWallets = {
  $$$
}'

Length of output: 56


Script:

#!/bin/bash
# Let's try to find the thirdwebWallets definition with ripgrep
rg "thirdwebWallets.*=" -A 10

Length of output: 617


Script:

#!/bin/bash
# Let's find the SUPPORTED_WALLETS definition to see what wallets are included
rg "SUPPORTED_WALLETS.*=" -A 15

# Also check where these wallets are used
rg "ISupportedWalletName" -A 2

Length of output: 5221

utils/evm/wallets.ts (1)

57-62: Smart Contract Wallet prioritization looks good

Placing Coinbase Smart Wallet first for auto-connect is a good strategy to prevent conflicts.

features/ExternalWalletPicker/ExternalWalletPicker.tsx (2)

51-52: LGTM! Simplified wallet creation using predefined configurations.

The change from dynamic wallet creation to using predefined configurations in thirdwebWallets improves code maintainability and reduces complexity.

Let's verify that all wallet types are properly configured:

✅ Verification successful

LGTM! The wallet configuration system is properly implemented.

The verification confirms that:

  • thirdwebWallets is correctly populated from SUPPORTED_WALLETS configuration
  • Each supported wallet has proper configuration including icons and wallet IDs
  • Special handling exists for Coinbase wallets (both Smart and regular)
  • The change to use predefined configurations is safe as all wallet types are properly configured
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify wallet configurations
# Check for wallet configuration definitions
rg -A 5 "export const thirdwebWallets = {" 

Length of output: 172


Script:

#!/bin/bash
# Search for thirdwebWallets object definition, escaping special characters
rg "thirdwebWallets.*=" -A 5

# Also search for any wallet-related type definitions
rg "type.*Wallet" -A 3

# Search for wallet-related imports
rg "import.*wallet" -i

Length of output: 12771


Script:

#!/bin/bash
# Check the SUPPORTED_WALLETS configuration
rg "SUPPORTED_WALLETS.*=" -A 10

# Check the actual wallet creation/configuration logic
ast-grep --pattern 'Object.entries(SUPPORTED_WALLETS).map($$$)'

Length of output: 3721


51-52: Verify type safety of wallet name casting.

The type casting of installedWallet.name to ISupportedWalletName could be unsafe if unsupported wallet names are provided.

Let's verify the wallet name validation:

✅ Verification successful

Based on the comprehensive analysis of the codebase, I can now generate the final response:

Type casting of wallet name is safe and validated.

The type casting is safe because:

  1. installedWallet.name comes from useInstalledWallets() hook which only returns validated wallets
  2. The wallets are filtered against SUPPORTED_WALLETS which matches the ISupportedWalletName type definition
  3. The type is strictly defined as keyof typeof _SUPPORTED_WALLETS | "EthOS Wallet"
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check wallet name validation
# Look for ISupportedWalletName type definition and supported values
ast-grep --pattern 'type ISupportedWalletName = $_'

Length of output: 219


Script:

#!/bin/bash
# Check the _SUPPORTED_WALLETS definition and validation
ast-grep --pattern 'const _SUPPORTED_WALLETS = $_'

# Check how installedWallet.name is validated before casting
rg -B 2 -A 2 "installedWallet\.name" --type ts

Length of output: 6842


Script:

#!/bin/bash
# Check how installedWallet is obtained and validated
rg -B 5 -A 2 "const installedWallet" --type ts

# Check if there's any validation before using installedWallet
ast-grep --pattern 'if ($_ === installedWallet.name)'

Length of output: 777


Script:

#!/bin/bash
# Check the useInstalledWallets hook implementation
ast-grep --pattern 'function useInstalledWallets() {
  $$$
}'

# Check for any type definitions or interfaces related to installed wallets
rg -B 2 -A 2 "type.*Wallet" --type ts

Length of output: 5479


Script:

#!/bin/bash
# Check the useInstalledWallets implementation in a different way
rg -B 5 -A 10 "useInstalledWallets" --type ts

# Check how InstalledWallet type is used
rg -B 2 -A 2 "InstalledWallet\[\]" --type ts

Length of output: 18119

components/Onboarding/ConnectViaWallet/ConnectViaWallet.tsx (2)

27-27: LGTM! Clean integration of Smart Contract Wallet support.

The isSCW property is consistently passed through the component hierarchy and properly typed.

Also applies to: 35-35, 75-75, 82-88, 104-104


27-27: Verify the impact of Smart Contract Wallet initialization.

The isSCW flag affects wallet state initialization. Let's understand its impact.

Also applies to: 90-90

✅ Verification successful

Based on the shell script results, I can now provide a final response as the impact of the isSCW flag is clear from the codebase analysis:

Smart Contract Wallet initialization impact verified

The isSCW flag is properly handled throughout the wallet initialization flow:

  • Used in XMTP client creation to specify wallet type (SCW vs EOA)
  • Affects wallet connection UI flow and signature handling
  • Properly propagated through navigation and onboarding screens
  • Correctly initialized in wallet state management
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check how isSCW affects wallet initialization
# Look for useInitConnectViaWalletState implementation
ast-grep --pattern 'useInitConnectViaWalletState = $_'

# Check for other SCW-related logic
rg -A 5 "isSCW"

Length of output: 15367

screens/Navigation/Navigation.tsx (1)

56-56: LGTM! Verify navigation calls are updated.

The addition of the isSCW boolean parameter to both wallet connection screens is consistent and type-safe.

Let's verify that all navigation calls to these screens have been updated to include the new parameter:

Also applies to: 68-68

✅ Verification successful

Navigation calls correctly updated with isSCW parameter

All navigation calls to both screens have been properly updated to include the new isSCW parameter:

  • screens/NewAccount/NewAccountScreen.tsx: Passes isSCW to NewAccountConnectWallet
  • screens/Onboarding/OnboardingGetStartedScreen.tsx: Passes isSCW to OnboardingConnectWallet
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for navigation calls to these screens
rg -A 2 "navigate\(['\"](?:OnboardingConnectWallet|NewAccountConnectWallet)['\"]"

Length of output: 566

components/Onboarding/ConnectViaWallet/useInitConnectViaWalletState.ts (2)

22-26: LGTM: Clean type definition for SCW support

The addition of the isSCW boolean parameter is well-structured and properly typed.


117-117: Verify wallet reinitialization behavior

Adding isSCW to the dependencies array means the wallet will reinitialize if isSCW changes. Please verify if this is the intended behavior, as it could lead to unnecessary reinitializations if isSCW changes after initial connection.

✅ Verification successful

Let me analyze the context further by checking the useEffect implementation where isSCW is used.


Let me try a different approach to find the useEffect implementation.


Adding isSCW to dependencies is correct and necessary

The isSCW dependency is used within the initialization logic to log whether the connected wallet is a Smart Contract Wallet (SCW) or an EOA. Since this is only used for logging purposes and the initialization is protected by isInitializingRef and hasInitializedRef flags that prevent re-initialization, the addition of isSCW to the dependency array won't cause any unnecessary reinitializations. The effect will only run once when the wallet is first connected, as evidenced by the guard clauses:

if (isInitializingRef.current) {
  logger.debug("[Connect Wallet] Already initializing wallet");
  return;
}

if (hasInitizalizedRef.current) {
  logger.debug("[Connect Wallet] Already initialized wallet");
  return;
}
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any places where isSCW might be updated after initial connection
ast-grep --pattern 'setIsSCW($_)'

# Look for any state updates that might trigger reinitialization
rg -A 5 'isSCW.*=' 

Length of output: 7306


Script:

#!/bin/bash
# Look for the useEffect implementation in the file
rg -A 10 'useEffect.*\{.*isSCW' components/Onboarding/ConnectViaWallet/useInitConnectViaWalletState.ts

Length of output: 104


Script:

#!/bin/bash
# Get the content of the file to see the useEffect implementation
cat components/Onboarding/ConnectViaWallet/useInitConnectViaWalletState.ts

Length of output: 3723

Comment on lines 66 to 84
const handleTransaction = useCallback(async () => {
console.log("clicked!");
const transaction = prepareTransaction({
to: "0x2376e9C7C604D1827bA9aCb1293Dc8b4DA2f0DB3",
value: BigInt(10000000000000),
chain: base,
client: thirdwebClient,
});
console.log("transaction", transaction);
try {
await switchChain(base);
console.log("switched chain");
const tx = await sendTransaction.mutateAsync(transaction);
console.log("sent transaction", tx.transactionHash);
} catch (e: any) {
alert(e.message);
console.log(e);
}
}, [switchChain, sendTransaction]);
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

Improve transaction handling safety and clarity

Several issues need attention:

  1. Hardcoded recipient address should be configurable
  2. Transaction value needs clear denomination
  3. Basic error handling with generic alert

Consider these improvements:

+const RECIPIENT_ADDRESS = config.testWalletAddress;
+const TEST_TRANSACTION_VALUE = ethers.parseEther("0.00001"); // 10000 gwei in human readable format

 const handleTransaction = useCallback(async () => {
-  console.log("clicked!");
   const transaction = prepareTransaction({
-    to: "0x2376e9C7C604D1827bA9aCb1293Dc8b4DA2f0DB3",
-    value: BigInt(10000000000000),
+    to: RECIPIENT_ADDRESS,
+    value: TEST_TRANSACTION_VALUE,
     chain: base,
     client: thirdwebClient,
   });
-  console.log("transaction", transaction);
   try {
     await switchChain(base);
-    console.log("switched chain");
     const tx = await sendTransaction.mutateAsync(transaction);
-    console.log("sent transaction", tx.transactionHash);
+    Alert.alert('Success', `Transaction sent: ${tx.transactionHash}`);
   } catch (e: any) {
-    alert(e.message);
-    console.log(e);
+    Alert.alert('Transaction Failed', 
+      `Failed to send transaction: ${e.message}`,
+      [{ text: 'OK' }]
+    );
   }
 }, [switchChain, sendTransaction]);

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines 86 to 96
const handleSignature = useCallback(async () => {
if (!activeAccount) return;
await switchChain(base);
const signer = await ethers5Adapter.signer.toEthers({
client: thirdwebClient,
chain: base,
account: activeAccount,
});
const signature = await signer.signMessage("Hello, world");
console.log("base", signature);
}, [activeAccount, switchChain]);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Enhance signature handling with proper error handling and user feedback

The signature handling needs improvements:

  1. Hardcoded message
  2. Missing error handling
  3. No user feedback
+const TEST_MESSAGE = "Hello, world";

 const handleSignature = useCallback(async () => {
   if (!activeAccount) return;
+  try {
     await switchChain(base);
     const signer = await ethers5Adapter.signer.toEthers({
       client: thirdwebClient,
       chain: base,
       account: activeAccount,
     });
-    const signature = await signer.signMessage("Hello, world");
-    console.log("base", signature);
+    const signature = await signer.signMessage(TEST_MESSAGE);
+    Alert.alert('Success', `Message signed successfully!\nSignature: ${signature}`);
+  } catch (error: any) {
+    Alert.alert('Signature Failed', 
+      `Failed to sign message: ${error.message}`,
+      [{ text: 'OK' }]
+    );
+  }
 }, [activeAccount, switchChain]);
📝 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 handleSignature = useCallback(async () => {
if (!activeAccount) return;
await switchChain(base);
const signer = await ethers5Adapter.signer.toEthers({
client: thirdwebClient,
chain: base,
account: activeAccount,
});
const signature = await signer.signMessage("Hello, world");
console.log("base", signature);
}, [activeAccount, switchChain]);
const TEST_MESSAGE = "Hello, world";
const handleSignature = useCallback(async () => {
if (!activeAccount) return;
try {
await switchChain(base);
const signer = await ethers5Adapter.signer.toEthers({
client: thirdwebClient,
chain: base,
account: activeAccount,
});
const signature = await signer.signMessage(TEST_MESSAGE);
Alert.alert('Success', `Message signed successfully!\nSignature: ${signature}`);
} catch (error: any) {
Alert.alert('Signature Failed',
`Failed to sign message: ${error.message}`,
[{ text: 'OK' }]
);
}
}, [activeAccount, switchChain]);

Comment on lines 39 to 64
const handleButtonPress = useCallback(() => {
thirdwebConnect(async () => {
// instantiate wallet
const coinbaseWallet = thirdwebWallets["Coinbase Smart Wallet"];
let connected = false;
try {
console.log("auto-connecting");
await coinbaseWallet.autoConnect({ client: thirdwebClient });
connected = true;
console.log("auto-connected");
setActiveWallet(coinbaseWallet);
} catch (e) {
console.log(e);
}
if (connected) return coinbaseWallet;
try {
console.log("connecting");
await coinbaseWallet.connect({ client: thirdwebClient });
console.log("connected");
setActiveWallet(coinbaseWallet);
} catch (e) {
console.log(e);
}
return coinbaseWallet;
});
}, [thirdwebConnect, setActiveWallet]);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve wallet connection error handling and code structure

Several improvements could be made to this connection logic:

  1. Error handling only logs to console, which isn't helpful for users
  2. Duplicate setActiveWallet calls
  3. No loading state management for UI feedback

Consider refactoring like this:

 const handleButtonPress = useCallback(() => {
+  const [isConnecting, setIsConnecting] = useState(false);
   thirdwebConnect(async () => {
+    setIsConnecting(true);
     const coinbaseWallet = thirdwebWallets["Coinbase Smart Wallet"];
-    let connected = false;
     try {
-      console.log("auto-connecting");
       await coinbaseWallet.autoConnect({ client: thirdwebClient });
-      connected = true;
-      console.log("auto-connected");
       setActiveWallet(coinbaseWallet);
+      return coinbaseWallet;
     } catch (e) {
-      console.log(e);
+      // Auto-connect failed, try manual connect
+      try {
+        await coinbaseWallet.connect({ client: thirdwebClient });
+        setActiveWallet(coinbaseWallet);
+        return coinbaseWallet;
+      } catch (error) {
+        throw new Error('Failed to connect wallet: ' + error.message);
+      }
     }
-    if (connected) return coinbaseWallet;
-    try {
-      console.log("connecting");
-      await coinbaseWallet.connect({ client: thirdwebClient });
-      console.log("connected");
-      setActiveWallet(coinbaseWallet);
-    } catch (e) {
-      console.log(e);
+  }).catch(error => {
+    Alert.alert('Connection Error', error.message);
+  }).finally(() => {
+    setIsConnecting(false);
     }
-    return coinbaseWallet;
   });
 }, [thirdwebConnect, setActiveWallet]);

Committable suggestion skipped: line range outside the PR's diff.

@@ -79,7 +78,7 @@ export function getConnectViaWalletInstalledWalletTableViewItem(args: {
export const InstalledWalletsTableView = memo(
function InstalledWalletsTableView(props: {
onAccountExists: (arg: { address: string }) => void;
onAccountDoesNotExist: (arg: { address: string }) => void;
onAccountDoesNotExist: (arg: { address: string; isSCW: boolean }) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update all usages of onAccountDoesNotExist to include isSCW

The onAccountDoesNotExist callback now includes an additional parameter isSCW: boolean. Ensure that all implementations and calls to this function across the codebase are updated to pass this new parameter.

Comment on lines 136 to 144
if (wallet.thirdwebId === "com.coinbase.wallet") {
// @todo => this is a hack to remove the smart wallet key from AsyncStorage
// because it's not being removed by the wallet itself
const storageKeys = await AsyncStorage.getAllKeys();
const wcKeys = storageKeys.filter((k) =>
k.startsWith("-Coinbase Smart Wallet:")
);
await AsyncStorage.multiRemove(wcKeys);
const thirdwebWallet = await thirdwebConnect(async () => {
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

Avoid using hacks to remove keys from AsyncStorage

The block of code from lines 136 to 144 is a workaround to remove smart wallet keys directly from AsyncStorage. Relying on such hacks can lead to unintended side effects. It's better to implement a proper logout or key removal mechanism within the wallet SDK itself.

Would you like assistance in implementing a proper key management solution or reaching out to the wallet SDK maintainers for a fix?

utils/xmtpRN/signIn.ts Show resolved Hide resolved
@@ -1,8 +1,7 @@
import { format } from "date-fns";
import { format, enUS, fr } from "date-fns";
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 5, 2024

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix incorrect date-fns locale imports.

The locales should be imported from the dedicated locale module.

Apply this fix:

-import { format, enUS, fr } from "date-fns";
+import { format } from "date-fns";
+import { enUS, fr } from "date-fns/locale";
📝 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
import { format, enUS, fr } from "date-fns";
import { format } from "date-fns";
import { enUS, fr } from "date-fns/locale";
🧰 Tools
🪛 GitHub Check: tsc

[failure] 1-1:
Module '"date-fns"' has no exported member 'enUS'.


[failure] 1-1:
Module '"date-fns"' has no exported member 'fr'.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this one is my bad! fixed now in release/3.0.0

Copy link
Contributor

Choose a reason for hiding this comment

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

@technoplato, no worries! Glad to hear it's fixed in release/3.0.0.

(_/)
(•ᴥ•)
<


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

ios/Podfile.lock Outdated Show resolved Hide resolved
screens/SCWTest.tsx Outdated Show resolved Hide resolved
screens/SCWTest.tsx Outdated Show resolved Hide resolved
screens/SCWTest.tsx Outdated Show resolved Hide resolved
screens/SCWTest.tsx Outdated Show resolved Hide resolved
screens/SCWTest.tsx Outdated Show resolved Hide resolved
screens/SCWTest.tsx Outdated Show resolved Hide resolved
utils/evm/wallets.ts Outdated Show resolved Hide resolved
utils/thirdweb.ts Outdated Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (3)
components/Onboarding/ConnectViaWallet/ConnectViaWalletTableViewItems.tsx (3)

1-3: Clarify the TODO comment's scope and purpose

The TODO comment "move out of ConnectViaWallet" is vague. Please specify:

  • What exactly needs to be moved?
  • Where should it be moved to?
  • Why does it need to be moved?

This will help track and implement the architectural improvement effectively.

Would you like help creating a more detailed plan for this refactoring?


148-151: Extract wallet identifiers into constants

Magic strings are used for wallet identifiers. This makes the code more prone to errors and harder to maintain.

Consider creating an enum or constants:

const WALLET_IDS = {
  COINBASE: 'com.coinbase.wallet',
  ETHOS: 'EthOS Wallet'
} as const;

Then update the code:

-if (wallet.thirdwebId === "com.coinbase.wallet") {
+if (wallet.thirdwebId === WALLET_IDS.COINBASE) {

Line range hint 157-165: Improve error handling specificity

The error messages could be more descriptive to aid in debugging.

Consider this improvement:

-if (!thirdwebWallet) {
-  throw new Error("No coinbase wallet");
+if (!thirdwebWallet) {
+  throw new Error(`Failed to initialize Coinbase wallet connection`);
 }

 const account = thirdwebWallet.getAccount();

 if (!account) {
-  throw new Error("No coinbase account found");
+  throw new Error(`No account found after connecting to Coinbase wallet`);
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a430c74 and 2df37ea.

📒 Files selected for processing (1)
  • components/Onboarding/ConnectViaWallet/ConnectViaWalletTableViewItems.tsx (5 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
components/Onboarding/ConnectViaWallet/ConnectViaWalletTableViewItems.tsx

[error] 101-102: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)

🔇 Additional comments (1)
components/Onboarding/ConnectViaWallet/ConnectViaWalletTableViewItems.tsx (1)

193-196: LGTM: Proper implementation of isSCW parameter

The isSCW parameter is correctly passed to onAccountDoesNotExist, matching the updated callback signature.

Comment on lines +97 to +104
const disconnectActiveThirdweb = useCallback(async () => {
if (!thirdwebActiveWalletRef.current) return;
disconnectThirdweb(thirdwebActiveWalletRef.current);
// Wait for the disconnect to complete
while (!!thirdwebActiveWalletRef.current) {
await new Promise((r) => setTimeout(r, 100));
}
}, [disconnectThirdweb]);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve the disconnection polling implementation

The current implementation has several concerns:

  1. The while loop with setTimeout is not the most efficient way to handle disconnection
  2. There's no timeout limit which could lead to infinite polling
  3. The double negation in the condition is unnecessary

Consider this improved implementation:

 const disconnectActiveThirdweb = useCallback(async () => {
   if (!thirdwebActiveWalletRef.current) return;
   disconnectThirdweb(thirdwebActiveWalletRef.current);
-  // Wait for the disconnect to complete
-  while (!!thirdwebActiveWalletRef.current) {
-    await new Promise((r) => setTimeout(r, 100));
-  }
+  // Wait for disconnect with timeout
+  const maxAttempts = 50; // 5 seconds total
+  let attempts = 0;
+  while (thirdwebActiveWalletRef.current && attempts < maxAttempts) {
+    await new Promise((r) => setTimeout(r, 100));
+    attempts++;
+  }
+  if (thirdwebActiveWalletRef.current) {
+    logger.warn('Wallet disconnect timeout exceeded');
+  }
 }, [disconnectThirdweb]);
📝 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 disconnectActiveThirdweb = useCallback(async () => {
if (!thirdwebActiveWalletRef.current) return;
disconnectThirdweb(thirdwebActiveWalletRef.current);
// Wait for the disconnect to complete
while (!!thirdwebActiveWalletRef.current) {
await new Promise((r) => setTimeout(r, 100));
}
}, [disconnectThirdweb]);
const disconnectActiveThirdweb = useCallback(async () => {
if (!thirdwebActiveWalletRef.current) return;
disconnectThirdweb(thirdwebActiveWalletRef.current);
// Wait for disconnect with timeout
const maxAttempts = 50; // 5 seconds total
let attempts = 0;
while (thirdwebActiveWalletRef.current && attempts < maxAttempts) {
await new Promise((r) => setTimeout(r, 100));
attempts++;
}
if (thirdwebActiveWalletRef.current) {
logger.warn('Wallet disconnect timeout exceeded');
}
}, [disconnectThirdweb]);
🧰 Tools
🪛 Biome (1.9.4)

[error] 101-102: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)

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

🧹 Outside diff range and nitpick comments (3)
utils/evm/wallets.ts (3)

55-138: Consider caching wallet icons locally.

All wallet icons are loaded from an external service (explorer-api.walletconnect.com). This creates external dependencies and potential performance/reliability issues.

Consider:

  1. Caching these icons locally in the app
  2. Implementing a fallback mechanism for failed icon loads
  3. Using a CDN with better availability guarantees

140-142: Consider renaming ISupportedWalletName type.

The I prefix for interface/type names is not a common TypeScript convention. Additionally, the inclusion of "EthOS Wallet" in the type but not in the configuration object seems inconsistent.

Consider:

-export type ISupportedWalletName =
-  | keyof typeof _SUPPORTED_WALLETS
-  | "EthOS Wallet";
+export type SupportedWalletName = keyof typeof _SUPPORTED_WALLETS;
+// If EthOS wallet needs special handling, consider adding it to _SUPPORTED_WALLETS

154-164: Review optional fields in InstalledWallet type.

Several fields are marked as optional (?), but some might be required for proper functionality. Additionally, consider grouping related fields and adding JSDoc comments for better documentation.

Consider:

 export type InstalledWallet = {
   name: string;
   iconURL: string;
+  // Connection details
   customScheme?: string;
   universalLink?: string;
   walletConnectId?: string;
-  platforms?: string[];
+  // Wallet capabilities
   thirdwebId?: WalletId;
   isSmartContractWallet?: boolean;
   supportedChains?: Chain[];
+  // Platform support
+  platforms?: string[];
 };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2df37ea and 80a0bdb.

📒 Files selected for processing (2)
  • utils/evm/wallets.ts (2 hunks)
  • utils/thirdweb.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • utils/thirdweb.ts
🔇 Additional comments (2)
utils/evm/wallets.ts (2)

86-95: Verify Rainbow wallet's chain support.

The comment references Rainbow's testnets limitation, but we should verify the supported mainnet chains are current.

Let's check Rainbow's documentation:

✅ Verification successful

Rainbow wallet chain configuration is accurate

The current configuration aligns with Rainbow's supported networks. The wallet configuration correctly includes the major EVM-compatible mainnet chains (Ethereum, Base, Optimism, Polygon, Arbitrum, Avalanche, Blast, and Zora) while excluding testnets, which is consistent with Rainbow's documented limitations. The configuration in the codebase accurately reflects Rainbow's current chain support.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any documentation files mentioning Rainbow wallet support
fd -e md -e mdx | xargs rg -l "rainbow.*chain|chain.*rainbow"

Length of output: 2122


Script:

#!/bin/bash
# Let's try a different approach to find Rainbow wallet configuration or documentation
rg -i "rainbow.*wallet" -A 5 -B 5

# Also search for the wallet configuration file
fd wallet | grep -i "rainbow\|chain"

Length of output: 74


Script:

#!/bin/bash
# Let's examine the wallet configuration file directly
cat utils/evm/wallets.ts

# Also search for any Rainbow wallet related imports or configurations
rg -i "rainbow" --type ts

Length of output: 7337


56-62: Verify the order dependency for Coinbase Smart Wallet auto-connect.

The comment suggests that Coinbase Smart Wallet needs to be first in the object for auto-connect to work properly. This seems like a fragile implementation that relies on object property order.

Let's verify if this order dependency is documented or necessary:

@technoplato
Copy link
Collaborator

All my feedback has been addressed!

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