Setup and Init

This page covers installing the SDK and initializing it as early as possible, so device events and UI prompts (PIN/Passphrase) are handled correctly.

Install

npm i @onekeyfe/hd-common-connect-sdk @onekeyfe/hd-shared @onekeyfe/hd-core

Initialize the SDK

import HardwareSDK from '@onekeyfe/hd-common-connect-sdk';

export async function initSdk(env: 'webusb' | 'lowlevel' | 'react-native' = 'webusb') {
  await HardwareSDK.init({
    env,
    debug: process.env.NODE_ENV !== 'production',
    fetchConfig: true,
  });
}
  • env: 'webusb' → browser WebUSB

  • env: 'lowlevel' → native shells (iOS/Android/Flutter) via a low-level adapter bundle

  • env: 'react-native' → React Native with pure BLE transports

Bind events early

Proceed to Device Discovery to obtain connectId and device_id for subsequent API calls.

Last updated

Was this helpful?