MCPcopy Index your code
hub / github.com/OneKeyHQ/hardware-js-sdk

github.com/OneKeyHQ/hardware-js-sdk @v1.1.29

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.29 ↗ · + Follow
3,760 symbols 10,313 edges 1,313 files 153 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Hardware-js-sdk

Hardware-js-sdk is designed to allow third-party developers to quickly access the OneKey hardware wallet. The repository structure uses the monorepo to make each module more manageable.

Packages

package description
@onekeyfe/core The core process of hardware wallet connection.
@onekeyfe/hd-web-sdk Using the sdk in the web platform.
@onekeyfe/hd-ble-sdk Using the SDK in BLE communication environment. e.g: iOS / Android
@onekeyfe/hd-common-sdk Using the SDK in a node or web-usb environment
@onekeyfe/hd-transport Data serialization and deserialization of hardware communication data
@onekeyfe/hd-transport-http communication lib for http
@onekeyfe/hd-transport-react-native communication lib for React Native
@onekeyfe/hd-transport-webusb communication lib for WebUSB
@onekeyfe/hd-shared Tools, error definitions, constants
@onekeyfe/hardware-cli CLI for AI agent integration (Claude Code, Cursor, etc.)

Documentation

See the full documentation on developer.onekey.so.

hardware-js-sdk development

Before you start make sure you have downloaded and installed NVM, Yarn and git with git lfs.

  • git clone git@github.com:OneKeyHQ/hardware-js-sdk.git
  • git submodule update --init --recursive
  • yarn
  • yarn bootstrap

Run a dev build:

  • yarn dev:web (web sdk)
  • yarn dev:ble (react-native sdk)
  • yarn dev:core (core package)
  • yarn dev:transport-http (transport-http package)
  • yarn dev:shared (shared package)

Development with example desktop app (Recommend)

  • yarn bootstrap && yarn build
  • yarn example:desktop

Development with example mobile app

  • yarn bootstrap && yarn build
  • yarn example select ios or android in menu.

Development with example web app

  • Build web sdk
  • Edit connect src in packages/connect-examples/expo-example/src/constants/connect.ts, change CONNECT_SRC to https://localhost:8087/
  • yarn dev:web
  • Open chrome browser, enter https://localhost:8087/, simply type "thisisunsafe" directly on your keyboard (no need to press Enter)
  • Run example app
  • yarn bootstrap && yarn build
  • yarn example select web in menu.

Development onekey-app monorepo

  • Build all packages
  • yarn bootstrap && yarn build
  • Edit .env file, APP_MONOREPO_LOCAL_PATH=/path/to/v5-app-monorepo
  • yarn debug:watcher

Open v5-app-monorepo, run yarn && yarn app:xxxx to start the app.

Extension points exported contracts — how you extend this code

IAirGapSDK (Interface)
(no doc) [6 implementers]
packages/connect-examples/react-native-demo/air-gap/sdk/types.ts
ISecureStorage (Interface)
(no doc) [4 implementers]
packages/hd-cli/src/storage/types.ts
IConnector (Interface)
(no doc) [3 implementers]
packages/hwk-adapter-core/src/types/connector.ts
OpenDevice (Interface)
* Opened device state — holds the USB device, claimed interface, and endpoints.
packages/hd-transport-usb/src/index.ts
DeviceCleanupOptions (Interface)
* Device cleanup options
packages/hd-transport-electron/src/noble-ble-handler.ts
Device (Interface)
(no doc) [1 implementers]
packages/core/src/device/Device.ts
LedgerWebHidConnectorOptions (Interface)
(no doc)
packages/hwk-ledger-connector-webhid/src/LedgerWebHidConnector.ts
Window (Interface)
(no doc)
packages/hd-transport-web-device/src/electron-ble-transport.ts

Core symbols most depended-on inside this repo

resolve
called by 386
packages/hwk-adapter-core/src/utils/UiRequestRegistry.ts
log
called by 274
packages/core/src/utils/logger.ts
debug
called by 235
packages/hd-transport-electron/src/types/noble-extended.ts
validateParams
called by 184
packages/core/src/api/helpers/paramsValidator.ts
get
called by 134
packages/hd-cli/src/storage/types.ts
error
called by 132
packages/hd-transport-electron/src/types/noble-extended.ts
call
called by 130
packages/core/src/topLevelInject.ts
set
called by 125
packages/hd-cli/src/storage/types.ts

Shape

Function 1,787
Method 1,098
Interface 404
Class 395
Enum 76

Languages

TypeScript99%
Kotlin1%
Java1%

Modules by API surface

packages/hwk-ledger-adapter/src/adapter/LedgerAdapter.ts72 symbols
packages/hd-transport/src/types/messages.ts60 symbols
packages/core/src/device/Device.ts57 symbols
packages/core/src/core/index.ts51 symbols
packages/connect-examples/expo-example/src/testTools/automationTest/useAutomationTest.ts40 symbols
packages/hd-transport-electron/src/noble-ble-handler.ts38 symbols
packages/hwk-ledger-adapter/src/errors.ts36 symbols
packages/hwk-ledger-adapter/src/connector/LedgerConnectorBase.ts36 symbols
packages/connect-examples/expo-example/src/services/phonePilotMcp/index.ts35 symbols
packages/hwk-adapter-core/src/types/connector.ts30 symbols
packages/hd-transport-usb/src/index.ts30 symbols
packages/connect-examples/expo-example/src/testTools/slip39Test/core/slip39Utils.ts30 symbols

For agents

$ claude mcp add hardware-js-sdk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page