开发者视角
btcGetAddressTSexamples/btcGetAddress.ts
1import HardwareSDK from '@onekeyfe/hd-common-connect-sdk'2
3await HardwareSDK.init({4 env: 'webusb',5 fetchConfig: true,6 debug: false,7})8
9const devicesRes = await HardwareSDK.searchDevices()10if (!devicesRes.success) throw new Error(devicesRes.payload.error)11const connectId = devicesRes.payload[0].connectId12
13const featuresRes = await HardwareSDK.getFeatures(connectId)14if (!featuresRes.success) throw new Error(featuresRes.payload.error)15const deviceId = featuresRes.payload.device_id16
17const res = await HardwareSDK.btcGetAddress(connectId, deviceId, {18 path: "m/44'/0'/0'/0/0",19 coin: 'btc',20 showOnOneKey: true,21})22if (!res.success) throw new Error(res.payload.error)23
24console.log(res.payload)Last updated on



