Skip to content

Commit 4998b09

Browse files
Revert "Fix/sdk callback (#565)" (#566)
This reverts commit e0dad12.
1 parent e0dad12 commit 4998b09

File tree

26 files changed

+62
-105
lines changed

26 files changed

+62
-105
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.12-alpha.2",
5+
"version": "1.1.12-alpha.1",
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.12-alpha.2",
25+
"@onekeyfe/hd-transport-electron": "1.1.12-alpha.1",
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.12-alpha.2",
3+
"version": "1.1.12-alpha.1",
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.12-alpha.2",
23-
"@onekeyfe/hd-common-connect-sdk": "1.1.12-alpha.2",
24-
"@onekeyfe/hd-core": "1.1.12-alpha.2",
25-
"@onekeyfe/hd-web-sdk": "1.1.12-alpha.2",
22+
"@onekeyfe/hd-ble-sdk": "1.1.12-alpha.1",
23+
"@onekeyfe/hd-common-connect-sdk": "1.1.12-alpha.1",
24+
"@onekeyfe/hd-core": "1.1.12-alpha.1",
25+
"@onekeyfe/hd-web-sdk": "1.1.12-alpha.1",
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/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "onekey-hardware-playground",
3-
"version": "1.1.12-alpha.2",
3+
"version": "1.1.12-alpha.1",
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.12-alpha.2",
21-
"@onekeyfe/hd-shared": "1.1.12-alpha.2",
22-
"@onekeyfe/hd-web-sdk": "1.1.12-alpha.2",
20+
"@onekeyfe/hd-core": "1.1.12-alpha.1",
21+
"@onekeyfe/hd-shared": "1.1.12-alpha.1",
22+
"@onekeyfe/hd-web-sdk": "1.1.12-alpha.1",
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/shared-constants/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@onekey-internal/shared-constants",
3-
"version": "1.1.12-alpha.2",
3+
"version": "1.1.12-alpha.1",
44
"private": true,
55
"author": "OneKey",
66
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",

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.12-alpha.2",
3+
"version": "1.1.12-alpha.1",
44
"description": "Core processes and APIs for communicating with OneKey hardware devices.",
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.12-alpha.2",
29-
"@onekeyfe/hd-transport": "1.1.12-alpha.2",
28+
"@onekeyfe/hd-shared": "1.1.12-alpha.1",
29+
"@onekeyfe/hd-transport": "1.1.12-alpha.1",
3030
"axios": "^0.27.2",
3131
"bignumber.js": "^9.0.2",
3232
"bytebuffer": "^5.0.1",

packages/core/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const HardwareSdk = ({
3535
cancel,
3636
updateSettings,
3737
switchTransport,
38-
executeCallback,
3938
});
4039

4140
const HardwareSDKLowLevel = ({
@@ -44,7 +43,6 @@ const HardwareSDKLowLevel = ({
4443
dispose,
4544
eventEmitter,
4645
addHardwareGlobalEventListener,
47-
addHardwareCallbackEventListener,
4846
uiResponse,
4947
cancel,
5048
updateSettings,
@@ -56,7 +54,6 @@ const HardwareSDKLowLevel = ({
5654
dispose,
5755
eventEmitter,
5856
addHardwareGlobalEventListener,
59-
addHardwareCallbackEventListener,
6057
uiResponse,
6158
cancel,
6259
updateSettings,

packages/core/src/inject.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,18 @@ const registerCallback = (id: string, callback: CallbackFunction) => {
1515
callbackManager.set(id, callback);
1616
};
1717

18-
const executeCallbackApi = (id: string, ...args: any[]) => {
18+
const executeCallback = (id: string, ...args: any[]) => {
1919
const callback = callbackManager.get(id);
2020
if (callback) {
2121
callback(...args);
22-
return true;
2322
}
24-
return false;
2523
};
2624

2725
const cleanupCallback = (id: string) => {
2826
callbackManager.delete(id);
2927
};
3028

31-
export { executeCallbackApi as executeCallback, cleanupCallback };
29+
export { executeCallback, cleanupCallback };
3230

3331
export interface InjectApi {
3432
call: CallMethod;
@@ -39,7 +37,6 @@ export interface InjectApi {
3937
uiResponse: CoreApi['uiResponse'];
4038
cancel: CoreApi['cancel'];
4139
switchTransport: CoreApi['switchTransport'];
42-
executeCallback: typeof executeCallbackApi;
4340
}
4441

4542
export const inject = ({
@@ -67,8 +64,6 @@ export const inject = ({
6764
eventEmitter.removeAllListeners(type);
6865
},
6966

70-
executeCallback: (id, ...args) => executeCallbackApi(id, ...args),
71-
7267
init,
7368

7469
call,
@@ -103,7 +98,6 @@ export const createCoreApi = (
10398
| 'cancel'
10499
| 'updateSettings'
105100
| 'switchTransport'
106-
| 'executeCallback'
107101
> => ({
108102
getLogs: () => call({ method: 'getLogs' }),
109103
/**

packages/core/src/lowLevelInject.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { EventEmitter } from 'events';
2-
import { CallMethod, CoreMessage, IFrameCallbackMessage } from './events';
2+
import { CallMethod, CoreMessage } from './events';
33
import { CoreApi } from './types/api';
4-
import { createCoreApi, executeCallback } from './inject';
4+
import { createCoreApi } from './inject';
55

66
type IAddHardwareGlobalEventListener = (coreMessage: CoreMessage) => void;
7-
type IAddHardwareCallbackEventListener = (coreMessage: IFrameCallbackMessage) => void;
87

98
export interface LowLevelInjectApi {
109
call: CallMethod;
@@ -16,12 +15,10 @@ export interface LowLevelInjectApi {
1615
updateSettings: CoreApi['updateSettings'];
1716
switchTransport: CoreApi['switchTransport'];
1817
addHardwareGlobalEventListener: (listener: IAddHardwareGlobalEventListener) => void;
19-
addHardwareCallbackEventListener: (listener: IAddHardwareCallbackEventListener) => void;
2018
}
2119

2220
export type LowLevelCoreApi = Omit<CoreApi, 'on' | 'off'> & {
2321
addHardwareGlobalEventListener: (listener: IAddHardwareGlobalEventListener) => void;
24-
addHardwareCallbackEventListener: (listener: IAddHardwareCallbackEventListener) => void;
2522
};
2623

2724
export const lowLevelInject = ({
@@ -34,11 +31,9 @@ export const lowLevelInject = ({
3431
updateSettings,
3532
switchTransport,
3633
addHardwareGlobalEventListener,
37-
addHardwareCallbackEventListener,
3834
}: LowLevelInjectApi): LowLevelCoreApi => {
3935
const api: LowLevelCoreApi = {
4036
addHardwareGlobalEventListener,
41-
addHardwareCallbackEventListener,
4237
removeAllListeners: type => {
4338
eventEmitter.removeAllListeners(type);
4439
},
@@ -57,8 +52,6 @@ export const lowLevelInject = ({
5752

5853
switchTransport,
5954

60-
executeCallback: (id, ...args) => executeCallback(id, ...args),
61-
6255
emit: () => {},
6356

6457
...createCoreApi(call),

packages/core/src/topLevelInject.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import EventEmitter from 'events';
22
import { CoreApi } from './types/api';
3-
import { createCoreApi, executeCallback } from './inject';
3+
import { createCoreApi } from './inject';
44
import type { LowLevelCoreApi } from './lowLevelInject';
55
import { ConnectSettings } from './types/settings';
66

@@ -54,8 +54,6 @@ export const topLevelInject = () => {
5454

5555
switchTransport: (env: ConnectSettings['env']) =>
5656
lowLevelApi?.switchTransport(env) ?? Promise.resolve({ success: false }),
57-
58-
executeCallback: (id, ...args) => executeCallback(id, ...args),
5957
};
6058

6159
return api;

packages/core/src/types/api/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ export type CoreApi = {
177177
cancel: (connectId?: string) => void;
178178
updateSettings: typeof updateSettings;
179179
switchTransport: (env: ConnectSettings['env']) => Promise<{ success: boolean }>;
180-
executeCallback: (id: string, ...args: any[]) => boolean;
181180
getLogs: typeof getLogs;
182181

183182
/**

0 commit comments

Comments
 (0)