Skip to content

fix: HardWallet connection tip#3326

Merged
Keith-CY merged 2 commits intodevelopfrom
feat-445
Mar 11, 2025
Merged

fix: HardWallet connection tip#3326
Keith-CY merged 2 commits intodevelopfrom
feat-445

Conversation

@devchenyan
Copy link
Contributor

@Keith-CY Keith-CY requested a review from Copilot March 10, 2025 06:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR adds a new error case to address mismatches between the connected hardware wallet and the expected wallet, ensuring that devices are correctly verified before further operations.

  • Introduces a new DeviceNotMatchWallet exception in the UI and wallet packages.
  • Updates API, controller, and remote services to handle an optional walletID parameter for device connection.
  • Modifies various hooks and components to incorporate the new error state and message for device-wallet mismatches.

Reviewed Changes

File Description
packages/neuron-ui/src/exceptions/hardware.ts Adds DeviceNotMatchWalletException with a static message for localization.
packages/neuron-wallet/src/controllers/hardware.ts Updates connectDevice to destructure and check walletID and validate the matching of public keys.
packages/neuron-wallet/src/exceptions/hardware.ts Introduces DeviceNotMatchWallet with an error code for wallet-device mismatches.
packages/neuron-ui/src/utils/enums.ts Adds a new error code (408) for DeviceNotMatchWallet.
packages/neuron-ui/src/components/CellManagement/hooks.ts, Receive/VerifyHardwareAddress.tsx, HardwareSign/hooks.ts Updates import and error handling to account for the new DeviceNotMatchWallet error condition.
packages/neuron-wallet/src/controllers/api.ts Adjusts the API handler to pass the walletID parameter when connecting devices.
packages/neuron-ui/src/services/remote/hardware.ts Updates the connectDevice API to support an extended payload with walletID.

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

packages/neuron-wallet/src/exceptions/hardware.ts:23

  • [nitpick] For consistency with the UI exception naming, consider renaming 'DeviceNotMatchWallet' to 'DeviceNotMatchWalletException' and adding a descriptive error message property similar to the pattern used in other exception classes.
export class DeviceNotMatchWallet extends Error {

@Danie0918 Danie0918 requested a review from Keith-CY March 11, 2025 01:34
@silySuper
Copy link

silySuper commented Mar 11, 2025

/package
Packaging for test is done in 13779281283. @silySuper

@Keith-CY Keith-CY added this pull request to the merge queue Mar 11, 2025
Merged via the queue into develop with commit 0d4c967 Mar 11, 2025
23 checks passed
@Keith-CY Keith-CY deleted the feat-445 branch March 11, 2025 03:27
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.

4 participants