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-coreInitialize 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 WebUSBenv: 'lowlevel'→ native shells (iOS/Android/Flutter) via a low-level adapter bundleenv: 'react-native'→ React Native with pure BLE transports
Bind events early
More Info: Config Event
Proceed to Device Discovery to obtain connectId and device_id for subsequent API calls.
Last updated
Was this helpful?