Conversation
Keith-CY
reviewed
Mar 10, 2025
Contributor
There was a problem hiding this comment.
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 {
Keith-CY
approved these changes
Mar 11, 2025
|
/package |
silySuper
approved these changes
Mar 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
issue:
Screen-2025-03-07-212433.mp4