Skip to content

Commit 2e5b522

Browse files
authored
fix: firmwareEmmcUpdate error (#598)
1 parent d2bd248 commit 2e5b522

File tree

25 files changed

+148
-279
lines changed

25 files changed

+148
-279
lines changed

packages/connect-examples/electron-example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "hardware-example",
33
"productName": "HardwareExample",
44
"executableName": "onekey-hardware-example",
5-
"version": "1.1.16-alpha.7",
5+
"version": "1.1.16-alpha.8",
66
"author": "OneKey",
77
"description": "End-to-end encrypted workspaces for teams",
88
"main": "dist/index.js",
@@ -22,7 +22,7 @@
2222
"ts:check": "yarn tsc --noEmit"
2323
},
2424
"dependencies": {
25-
"@onekeyfe/hd-transport-electron": "1.1.16-alpha.7",
25+
"@onekeyfe/hd-transport-electron": "1.1.16-alpha.8",
2626
"@stoprocent/noble": "2.3.4",
2727
"debug": "4.3.4",
2828
"electron-is-dev": "^3.0.1",

packages/connect-examples/expo-example/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "expo-example",
3-
"version": "1.1.16-alpha.7",
3+
"version": "1.1.16-alpha.8",
44
"scripts": {
55
"start": "cross-env CONNECT_SRC=https://localhost:8087/ yarn expo start --dev-client",
66
"android": "yarn expo run:android",
@@ -19,10 +19,10 @@
1919
"@noble/ed25519": "^2.1.0",
2020
"@noble/hashes": "^1.3.3",
2121
"@noble/secp256k1": "^1.7.1",
22-
"@onekeyfe/hd-ble-sdk": "1.1.16-alpha.7",
23-
"@onekeyfe/hd-common-connect-sdk": "1.1.16-alpha.7",
24-
"@onekeyfe/hd-core": "1.1.16-alpha.7",
25-
"@onekeyfe/hd-web-sdk": "1.1.16-alpha.7",
22+
"@onekeyfe/hd-ble-sdk": "1.1.16-alpha.8",
23+
"@onekeyfe/hd-common-connect-sdk": "1.1.16-alpha.8",
24+
"@onekeyfe/hd-core": "1.1.16-alpha.8",
25+
"@onekeyfe/hd-web-sdk": "1.1.16-alpha.8",
2626
"@onekeyfe/react-native-ble-utils": "^0.1.3",
2727
"@polkadot/util-crypto": "13.1.1",
2828
"@react-native-async-storage/async-storage": "1.21.0",

packages/connect-examples/expo-playground/ArchitectureDiagram.drawio

Lines changed: 0 additions & 133 deletions
This file was deleted.

packages/connect-examples/expo-playground/app/components/providers/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,17 @@ const initConfig: Partial<ConnectSettings> = {
5151
debug: true,
5252
fetchConfig: true,
5353
env: sdkEnv,
54-
connectSrc: CONNECT_SRC,
5554
};
5655
```
5756

5857
### 4. 初始化SDK
5958
```typescript
6059
// 执行SDK初始化
61-
const res = await HardwareWebSdk.init(initConfig);
60+
const res = await HardwareCommonConnectSdk.init(initConfig);
6261
if (res === false) {
6362
throw new Error(t('sdk.initError'));
6463
}
65-
sdkInstance = HardwareWebSdk;
64+
sdkInstance = HardwareCommonConnectSdk;
6665

6766
// 设置事件监听器
6867
setupSDKEventListeners(sdkInstance);

packages/connect-examples/expo-playground/app/constants/connect.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/connect-examples/expo-playground/app/utils/hardwareInstance.ts

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import memoizee from 'memoizee';
22
import { ConnectSettings, CoreApi } from '@onekeyfe/hd-core';
3-
import SDK from '@onekeyfe/hd-web-sdk';
4-
import { CONNECT_SRC } from '../constants/connect';
3+
import HardwareCommonConnectSdk from '@onekeyfe/hd-common-connect-sdk';
54
import { logInfo, logError } from './logger';
65

7-
const { HardwareWebSdk } = SDK;
8-
96
let initialized = false;
107

118
export type TransportType = 'webusb' | 'jsbridge' | 'emulator';
@@ -24,8 +21,8 @@ function getSDKEnv(transport: TransportType): ConnectSettings['env'] {
2421
return 'emulator';
2522
case 'webusb':
2623
default:
27-
// 对于WebUSB,使用 'web' 环境配置,这与expo-example保持一致
28-
return 'web';
24+
// WebUSB 场景直接使用 common-connect-sdk 的 WebUSB 传输
25+
return 'webusb';
2926
}
3027
}
3128

@@ -36,7 +33,7 @@ export const getHardwareSDKInstance = memoizee(
3633
// 如果已经初始化且transport相同,直接返回
3734
if (initialized) {
3835
logInfo('SDK already initialized, returning cached instance');
39-
return { HardwareSDK: HardwareWebSdk, initialized: true };
36+
return { HardwareSDK: HardwareCommonConnectSdk, initialized: true };
4037
}
4138

4239
logInfo(`Initializing SDK with transport: ${transport}`);
@@ -45,12 +42,11 @@ export const getHardwareSDKInstance = memoizee(
4542
debug: true,
4643
fetchConfig: true,
4744
env: getSDKEnv(transport),
48-
connectSrc: CONNECT_SRC,
4945
};
5046

5147
logInfo('SDK initialization settings:', settings as Record<string, unknown>);
5248

53-
const result = await HardwareWebSdk.init(settings);
49+
const result = await HardwareCommonConnectSdk.init(settings);
5450

5551
if (result === false) {
5652
throw new Error('SDK initialization returned false');
@@ -59,21 +55,8 @@ export const getHardwareSDKInstance = memoizee(
5955
initialized = true;
6056
logInfo('SDK initialized successfully');
6157

62-
return { HardwareSDK: HardwareWebSdk, initialized: true };
58+
return { HardwareSDK: HardwareCommonConnectSdk, initialized: true };
6359
} catch (error) {
64-
// 处理iframe已存在的情况
65-
if (error && typeof error === 'object' && 'message' in error) {
66-
const errorMessage = (error as Error).message || '';
67-
if (
68-
errorMessage.includes('IFrame alerady initialized') ||
69-
errorMessage.includes('IFrame already initialized')
70-
) {
71-
logInfo('SDK iframe already exists, using existing instance');
72-
initialized = true;
73-
return { HardwareSDK: HardwareWebSdk, initialized: true };
74-
}
75-
}
76-
7760
logError('SDK initialization failed:', { error });
7861
throw error;
7962
}

packages/connect-examples/expo-playground/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "onekey-hardware-playground",
3-
"version": "1.1.16-alpha.7",
3+
"version": "1.1.16-alpha.8",
44
"private": true,
55
"sideEffects": [
66
"app/utils/shim.js",
77
"app/i18n/config.ts",
88
"**/*.css"
99
],
1010
"scripts": {
11-
"dev": "cross-env CONNECT_SRC=https://localhost:8087/ webpack serve --mode=development --config webpack.config.js",
11+
"dev": "webpack serve --mode=development --config webpack.config.js",
1212
"start": "webpack serve --mode=development --config webpack.config.js",
1313
"build": "webpack --mode=production --config webpack.config.js",
1414
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint --ignore-pattern 'dist/**' . ",
@@ -17,9 +17,9 @@
1717
},
1818
"dependencies": {
1919
"@noble/hashes": "^1.8.0",
20-
"@onekeyfe/hd-core": "1.1.16-alpha.7",
21-
"@onekeyfe/hd-shared": "1.1.16-alpha.7",
22-
"@onekeyfe/hd-web-sdk": "1.1.16-alpha.7",
20+
"@onekeyfe/hd-common-connect-sdk": "1.1.16-alpha.8",
21+
"@onekeyfe/hd-core": "1.1.16-alpha.8",
22+
"@onekeyfe/hd-shared": "1.1.16-alpha.8",
2323
"@radix-ui/react-checkbox": "^1.3.2",
2424
"@radix-ui/react-dialog": "^1.1.14",
2525
"@radix-ui/react-dropdown-menu": "^2.1.15",

packages/connect-examples/expo-playground/webpack.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@ module.exports = async (env, argv) => {
151151
'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development'),
152152
'process.env.COMMIT_SHA': JSON.stringify(process.env.COMMIT_SHA || 'dev'),
153153
'process.env.BUILD_TIME': JSON.stringify(new Date().toISOString()),
154-
...(process.env.CONNECT_SRC !== undefined
155-
? { 'process.env.CONNECT_SRC': JSON.stringify(process.env.CONNECT_SRC) }
156-
: {}),
157154
}),
158155
],
159156

0 commit comments

Comments
 (0)