Skip to content

Commit 7a8e977

Browse files
Feat/all network callback (#525)
* feat: support all netwrok callback * chore: optimize all network * feat: add allNetworkByloop * fix: all network error * chore: release abortController * chore: fix unlocked error * chore: fix error * fix: device select device tips * feat: add root fingerprint * chore: release 1.1.4-alpha.3
1 parent b508ccb commit 7a8e977

File tree

46 files changed

+1055
-525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1055
-525
lines changed

lerna.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@
66
],
77
"npmClient": "yarn",
88
"useWorkspaces": true,
9-
"version": "independent"
9+
"version": "independent",
10+
"command": {
11+
"version": {
12+
"exact": true
13+
}
14+
}
1015
}

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

Lines changed: 1 addition & 1 deletion
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.2",
5+
"version": "1.1.4-alpha.3",
66
"author": "OneKey",
77
"description": "End-to-end encrypted workspaces for teams",
88
"main": "dist/index.js",

packages/connect-examples/electron-example/src/preload.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ ipcRenderer.on(ipcMessageKeys.INJECT_ONEKEY_DESKTOP_GLOBALS, (_, globals) => {
4646
try {
4747
contextBridge.exposeInMainWorld('ONEKEY_DESKTOP_GLOBALS', globals);
4848
} catch (error) {
49+
// @ts-expect-error
50+
window.ONEKEY_DESKTOP_GLOBALS = globals;
4951
// Fallback for development or when contextBridge is not available
5052
console.warn('Failed to expose ONEKEY_DESKTOP_GLOBALS via contextBridge:', error);
5153
}

packages/connect-examples/expo-example/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ const StackNavigator = createNativeStackNavigator();
5454
function NavigationContent() {
5555
// 处理从 404 页面重定向过来的路径
5656
useEffect(() => {
57-
const redirectPath = sessionStorage.getItem('redirectPath');
57+
const redirectPath = sessionStorage?.getItem('redirectPath');
5858
if (redirectPath) {
59-
sessionStorage.removeItem('redirectPath');
59+
sessionStorage?.removeItem('redirectPath');
6060
// 使用 window.history.replaceState 替换当前历史记录
6161
window.history.replaceState(null, '', redirectPath);
6262
}

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "expo-example",
3-
"version": "1.1.2",
3+
"version": "1.1.4-alpha.3",
44
"scripts": {
55
"start": "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.2",
23-
"@onekeyfe/hd-common-connect-sdk": "^1.1.2",
24-
"@onekeyfe/hd-core": "^1.1.2",
25-
"@onekeyfe/hd-web-sdk": "^1.1.2",
22+
"@onekeyfe/hd-ble-sdk": "1.1.4-alpha.3",
23+
"@onekeyfe/hd-common-connect-sdk": "1.1.4-alpha.3",
24+
"@onekeyfe/hd-core": "1.1.4-alpha.3",
25+
"@onekeyfe/hd-web-sdk": "1.1.4-alpha.3",
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",
@@ -43,6 +43,7 @@
4343
"bitcoinjs-lib": "^6.1.5",
4444
"bn.js": "^5.2.1",
4545
"buffer": "^6.0.3",
46+
"burnt": "^0.13.0",
4647
"compressorjs": "^1.1.1",
4748
"elliptic": "^6.5.5",
4849
"expo": "^50.0.20",
@@ -97,7 +98,8 @@
9798
"typescript": "^5.3.3"
9899
},
99100
"resolutions": {
100-
"pbkdf2": "3.1.3"
101+
"pbkdf2": "3.1.3",
102+
"form-data": "4.0.4"
101103
},
102104
"private": true
103105
}

packages/connect-examples/expo-example/shim.native.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,22 @@ if (typeof TextDecoder === 'undefined') {
3333
if (typeof TextEncoder === 'undefined') {
3434
global.TextEncoder = require('text-encoding').TextEncoder;
3535
}
36+
37+
// Web API polyfills for React Native
38+
global.sessionStorage = {
39+
getItem: () => null,
40+
setItem: () => null,
41+
removeItem: () => null,
42+
clear: () => null,
43+
key: () => null,
44+
length: 0,
45+
};
46+
47+
global.history = {
48+
replaceState: () => null,
49+
pushState: () => null,
50+
back: () => null,
51+
forward: () => null,
52+
go: () => null,
53+
length: 1,
54+
};

packages/connect-examples/expo-example/src/components/PlaygroundExecutor.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,23 @@ const PlaygroundExecutor: React.FC<PlaygroundExecutorProps> = ({
4141

4242
let requestParams;
4343
try {
44+
const rawParams = await onAcquireParams();
4445
requestParams = {
4546
...commonParams,
4647
retryCount: 1,
47-
...(await onAcquireParams()),
48+
...rawParams,
4849
};
50+
51+
if (method === 'allNetworkGetAddressByLoop') {
52+
// @ts-expect-error
53+
requestParams.onLoopItemResponse = (data: any, error: any) => {
54+
onExecute(JSON.stringify({ data, error }, null, 2));
55+
};
56+
// @ts-expect-error
57+
requestParams.onAllItemsResponse = (data: any) => {
58+
onExecute(JSON.stringify(data, null, 2));
59+
};
60+
}
4961
} catch (error) {
5062
requestParams = {
5163
...commonParams,

packages/connect-examples/expo-example/src/data/allnetwork.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,4 +424,12 @@ const api: PlaygroundProps[] = [
424424
},
425425
];
426426

427+
api.push({
428+
method: 'allNetworkGetAddressByLoop',
429+
description: 'Get addresses with real-time callback for each generated address',
430+
presupposes: api[0].presupposes?.map(item => ({
431+
...item,
432+
})),
433+
});
434+
427435
export default api;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@onekeyfe/onekey-hardware-playground",
3-
"version": "1.1.2",
3+
"version": "1.1.4-alpha.3",
44
"private": true,
55
"sideEffects": [
66
"app/utils/shim.js",
@@ -17,9 +17,9 @@
1717
},
1818
"dependencies": {
1919
"@noble/hashes": "^1.8.0",
20-
"@onekeyfe/hd-core": "^1.1.2",
21-
"@onekeyfe/hd-shared": "^1.1.2",
22-
"@onekeyfe/hd-web-sdk": "^1.1.2",
20+
"@onekeyfe/hd-core": "1.1.4-alpha.3",
21+
"@onekeyfe/hd-shared": "1.1.4-alpha.3",
22+
"@onekeyfe/hd-web-sdk": "1.1.4-alpha.3",
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/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@onekeyfe/hd-core",
3-
"version": "1.1.2",
3+
"version": "1.1.4-alpha.3",
44
"description": "> TODO: description",
55
"author": "OneKey",
66
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
2525
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
2626
},
2727
"dependencies": {
28-
"@onekeyfe/hd-shared": "^1.1.2",
29-
"@onekeyfe/hd-transport": "^1.1.2",
28+
"@onekeyfe/hd-shared": "1.1.4-alpha.3",
29+
"@onekeyfe/hd-transport": "1.1.4-alpha.3",
3030
"axios": "^0.27.2",
3131
"bignumber.js": "^9.0.2",
3232
"bytebuffer": "^5.0.1",

0 commit comments

Comments
 (0)