@onekeyfe/hd-ble-sdk 1.2.8-alpha.126 → 1.2.8-alpha.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/device-state-events.test.ts +34 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/package.json +5 -5
- package/src/index.ts +6 -1
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { readFileSync } from 'fs';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
3
|
import EventEmitter from 'events';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CORE_EVENT,
|
|
6
|
+
IFRAME,
|
|
7
|
+
LoggerNames,
|
|
8
|
+
UI_EVENT,
|
|
9
|
+
UI_REQUEST,
|
|
10
|
+
getLog,
|
|
11
|
+
initCore,
|
|
12
|
+
} from '@onekeyfe/hd-core';
|
|
5
13
|
import { HardwareErrorCode, createDeferred } from '@onekeyfe/hd-shared';
|
|
6
14
|
|
|
7
15
|
import sdkExport, { messagePromises } from '../src';
|
|
@@ -83,6 +91,31 @@ describe('SDK request cleanup', () => {
|
|
|
83
91
|
expect(Object.keys(messagePromises)).toHaveLength(0);
|
|
84
92
|
});
|
|
85
93
|
|
|
94
|
+
test('keeps Monero and Zcash addresses out of the handled-message log', () => {
|
|
95
|
+
core.emit(CORE_EVENT, {
|
|
96
|
+
event: UI_EVENT,
|
|
97
|
+
type: UI_REQUEST.PREVIOUS_ADDRESS_RESULT,
|
|
98
|
+
payload: {
|
|
99
|
+
device: {},
|
|
100
|
+
method: 'moneroGetAddress',
|
|
101
|
+
data: { address: 'synthetic-xmr-address-marker', path: "m/44'/128'/0'" },
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
core.emit(CORE_EVENT, {
|
|
105
|
+
event: IFRAME.CALLBACK,
|
|
106
|
+
type: IFRAME.CALLBACK,
|
|
107
|
+
payload: {
|
|
108
|
+
callbackId: 'unregistered',
|
|
109
|
+
data: { network: 'zcash', success: true, payload: { ufvk: 'synthetic-ufvk-marker' } },
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const logged = JSON.stringify(getLog().filter(entry => entry.prefix === LoggerNames.HdBleSdk));
|
|
114
|
+
expect(logged).toContain('moneroGetAddress');
|
|
115
|
+
expect(logged).toContain('unregistered');
|
|
116
|
+
expect(logged).not.toContain('synthetic-');
|
|
117
|
+
});
|
|
118
|
+
|
|
86
119
|
test('waits for Core disposal and does not retain old listeners after reinitialization', async () => {
|
|
87
120
|
const cleanup = createDeferred<void>();
|
|
88
121
|
core.dispose.mockImplementationOnce(async () => {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AASpD,eAAO,MAAM,eAAe,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;CAAO,CAAC;AAyKpE,QAAA,MAAM,cAAc,qCASlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -562,7 +562,8 @@ function handleMessage(message) {
|
|
|
562
562
|
});
|
|
563
563
|
}
|
|
564
564
|
else {
|
|
565
|
-
|
|
565
|
+
const blockLog = HardwareSdk.getLogBlockLabel(message);
|
|
566
|
+
Log.debug('hd-ble-sdk handleMessage', blockLog ? { event, type, method: blockLog } : JSON.stringify(HardwareSdk.getSafeLogPayload(message)));
|
|
566
567
|
}
|
|
567
568
|
}
|
|
568
569
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-ble-sdk",
|
|
3
|
-
"version": "1.2.8-alpha.
|
|
3
|
+
"version": "1.2.8-alpha.127",
|
|
4
4
|
"author": "OneKey",
|
|
5
5
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
6
6
|
"license": "ISC",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"lint:fix": "eslint . --fix"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@onekeyfe/hd-core": "1.2.8-alpha.
|
|
25
|
-
"@onekeyfe/hd-shared": "1.2.8-alpha.
|
|
26
|
-
"@onekeyfe/hd-transport-react-native": "1.2.8-alpha.
|
|
24
|
+
"@onekeyfe/hd-core": "1.2.8-alpha.127",
|
|
25
|
+
"@onekeyfe/hd-shared": "1.2.8-alpha.127",
|
|
26
|
+
"@onekeyfe/hd-transport-react-native": "1.2.8-alpha.127"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "1fdcafbc25357d5f4372dc8f89f8c97e561fd153"
|
|
29
29
|
}
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import HardwareSdk, {
|
|
|
15
15
|
executeCallback,
|
|
16
16
|
getLogBlockLabel,
|
|
17
17
|
getLogger,
|
|
18
|
+
getSafeLogPayload,
|
|
18
19
|
initCore,
|
|
19
20
|
parseConnectSettings,
|
|
20
21
|
setLoggerPostMessage,
|
|
@@ -72,7 +73,11 @@ function handleMessage(message: CoreMessage) {
|
|
|
72
73
|
progress: message?.payload?.progress,
|
|
73
74
|
});
|
|
74
75
|
} else {
|
|
75
|
-
|
|
76
|
+
const blockLog = getLogBlockLabel(message);
|
|
77
|
+
Log.debug(
|
|
78
|
+
'hd-ble-sdk handleMessage',
|
|
79
|
+
blockLog ? { event, type, method: blockLog } : JSON.stringify(getSafeLogPayload(message))
|
|
80
|
+
);
|
|
76
81
|
}
|
|
77
82
|
} catch (error) {
|
|
78
83
|
// ignore
|