-
Notifications
You must be signed in to change notification settings - Fork 2
fix: hardware version #79
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
Conversation
WalkthroughUpdated the HardwareSDK initialization in src/hardware/instance.ts to point connectSrc from https://jssdk.onekey.so/1.0.26/ to https://jssdk.onekey.so/1.1.11/. Other settings and the getHardwareSDKInstance API remain unchanged. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes ✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
src/hardware/instance.ts (4)
27-31: Log the source URL alongside the version.Helps diagnose mismatches between hd-core version and the web SDK served from connectSrc.
- console.log( - 'HardwareSDK initialized success, version: ', - getSDKVersion() - ); + console.log('HardwareSDK initialized', { + coreVersion: getSDKVersion(), + connectSrc: settings.connectSrc, + });
33-35: Capture richer error context.Log the failing connectSrc to speed up triage.
- } catch (e) { - reject(e); - } + } catch (e) { + console.error('HardwareSDK init failed', { + connectSrc: settings.connectSrc, + error: e, + }); + reject(e); + }
3-5: Avoid blanket@ts-expect-errorby adding a module declaration.Improves type safety and keeps builds clean.
Create a typings file (e.g., types/onekey-sdk.d.ts):
declare module '@onekeyfe/hd-web-sdk/build/onekey-js-sdk.min.js' { import type { CoreApi } from '@onekeyfe/hd-core'; export const HardwareWebSdk: CoreApi; }
11-17: Redundantinitializedflag with memoized promise.memoizee({ promise: true, max: 1 }) already prevents duplicate init. The extra flag adds complexity.
Consider removing the flag and relying on the memoized init promise.
Also applies to: 31-33
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/hardware/instance.ts(1 hunks)
Summary by CodeRabbit