Skip to content

Conversation

@wabicai
Copy link
Contributor

@wabicai wabicai commented Sep 1, 2025

Summary by CodeRabbit

  • Chores
    • Updated the underlying hardware SDK to a newer release, improving connection stability and device compatibility.
    • Users may experience faster initialization and fewer connectivity interruptions when interacting with hardware devices.
    • No changes to public interfaces or workflows; existing functionality continues to work as before.

@coderabbitai
Copy link

coderabbitai bot commented Sep 1, 2025

Walkthrough

Updated 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

Cohort / File(s) Summary
Hardware SDK bootstrap URL update
src/hardware/instance.ts
Changed connectSrc from 1.0.26 to 1.1.11; kept debug, preRelease, fetchConfig unchanged; no API signature changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/hd-version

🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@revan-zhang
Copy link
Contributor

revan-zhang commented Sep 1, 2025

🎉 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)

Copy link

@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

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-error by 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: Redundant initialized flag 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 6edd730 and 43ee07a.

📒 Files selected for processing (1)
  • src/hardware/instance.ts (1 hunks)

@wabicai wabicai merged commit 21dcdef into main Sep 1, 2025
10 checks passed
@wabicai wabicai deleted the fix/hd-version branch September 1, 2025 13:38
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