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

OK-36500, OK-36508, OK-36075: Improve device filtering in Device Management & Revert QR wallet reset logic & BTC connect issue #6871

Merged
merged 14 commits into from
Mar 13, 2025

Conversation

originalix
Copy link
Contributor

@originalix originalix commented Mar 13, 2025

Summary by CodeRabbit

  • New Features

    • Enjoy a smoother QR wallet creation process with simplified error handling.
    • Wallet listings now automatically filter out duplicate hardware wallets for improved clarity.
    • Device details have been updated so that QR wallets no longer show firmware update alerts or extra badges.
    • Default network and chain name retrieval has been enhanced for better connectivity handling.
  • Bug Fixes

    • Improved error handling in network retrieval processes to prevent undefined returns.

Copy link

codesandbox bot commented Mar 13, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

coderabbitai bot commented Mar 13, 2025

Walkthrough

The changes simplify the QR wallet creation process by removing an extra device lookup. The removed method previously checked for existing QR wallets and their associated devices. Now, the system directly queries devices by their ID. Additionally, a new optional parameter, skipDuplicateDevice, is added to filter out duplicate device entries in wallet retrieval. UI components have been updated to remove conditional checks related to QR wallets, such as badge displays and firmware update alerts. Overall, the modifications streamline the logic for creating and displaying QR wallets.

Changes

File(s) Summary of Changes
kit-bg/.../LocalDbBase.ts
kit/.../useCreateQrWallet.tsx
Removed the getQrWalletExistingDevice method and the byDevice parameter. Simplified QR wallet creation by directly querying devices with getDeviceByQuery and eliminating device mismatch checks.
kit-bg/.../ServiceAccount.ts
kit/.../DeviceManagementListModal/index.tsx
Introduced a new optional parameter skipDuplicateDevice in getAllHwQrWalletWithDevice to filter out duplicate devices. The method call now includes this flag to control hardware wallet inclusion.
kit/.../DeviceDetailsModal/DeviceBasicInfoSection.tsx
kit/.../DeviceDetailsModal/index.tsx
Adjusted UI components by removing conditional logic based on isQrWallet. This includes eliminating the QR-specific wallet badge and preventing firmware update alerts for QR wallets.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant QRWalletCreator
  participant LocalDbBase
  participant DeviceQuery
  
  User->>QRWalletCreator: Initiate QR wallet creation
  QRWalletCreator->>LocalDbBase: Call createQrWallet(rawDeviceId, …)
  LocalDbBase->>DeviceQuery: getDeviceByQuery(rawDeviceId)
  DeviceQuery-->>LocalDbBase: Return device info
  LocalDbBase-->>QRWalletCreator: Return device info
  QRWalletCreator->>User: Wallet creation proceeds with retrieved device
Loading
sequenceDiagram
  participant Client
  participant ServiceAccount
  participant WalletStore
  
  Client->>ServiceAccount: getAllHwQrWalletWithDevice(skipDuplicateDevice: true)
  ServiceAccount->>WalletStore: Fetch hardware and QR wallets
  Note right of ServiceAccount: Build deviceToHwWalletMap to filter duplicates
  ServiceAccount-->>Client: Return filtered wallet list
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 2dee648 and 9b918dc.

📒 Files selected for processing (1)
  • packages/kit-bg/src/providers/ProviderApiBtc.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: unittest (20.x)
  • GitHub Check: lint (20.x)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
packages/kit-bg/src/providers/ProviderApiBtc.ts (2)

216-221: Good addition of default chain fallback!

You've improved robustness by adding a default network fallback for when no connected networks exist. This prevents potential undefined returns and ensures users always get a valid chain.


231-235: Improved error handling with proper fallback

The code now returns the default chain when no networks are found and captures errors with logging. This makes the system more resilient by ensuring it doesn't fail silently.


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

ByteZhang1024
ByteZhang1024 previously approved these changes Mar 13, 2025
@originalix originalix enabled auto-merge (squash) March 13, 2025 07:47
@originalix originalix marked this pull request as draft March 13, 2025 07:49
auto-merge was automatically disabled March 13, 2025 07:49

Pull request was converted to draft

sidmorizon
sidmorizon previously approved these changes Mar 13, 2025
@originalix originalix dismissed stale reviews from sidmorizon and ByteZhang1024 via 2dee648 March 13, 2025 08:13
@originalix originalix changed the title OK-36500, OK-36508: Improve device filter in DeviceList & fix qr wallet logic OK-36500, OK-36508: Improve device filtering in Device Management & Revert QR wallet reset logic Mar 13, 2025
@originalix originalix marked this pull request as ready for review March 13, 2025 08:20
@originalix originalix enabled auto-merge (squash) March 13, 2025 08:21
@originalix originalix changed the title OK-36500, OK-36508: Improve device filtering in Device Management & Revert QR wallet reset logic OK-36500, OK-36508, OK-36075: Improve device filtering in Device Management & Revert QR wallet reset logic & BTC connect issue Mar 13, 2025
@originalix originalix merged commit 7a02291 into x Mar 13, 2025
8 checks passed
@originalix originalix deleted the OK-36500 branch March 13, 2025 14:18
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.

5 participants