@onekeyfe/hd-core 1.2.8-alpha.2 → 1.2.8-alpha.21
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/README.md +27 -0
- package/__tests__/btc-derive-context-hash.test.ts +200 -0
- package/__tests__/core-dispose.test.ts +114 -1
- package/__tests__/core-error-output.test.ts +21 -0
- package/__tests__/device-connector-protocol.test.ts +5 -2
- package/__tests__/device-lifecycle-events.test.ts +73 -10
- package/__tests__/device-pool-state.test.ts +50 -0
- package/__tests__/protocol-v2-bootloader-mode.test.ts +12 -0
- package/__tests__/usb-identity-probe.test.ts +293 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts +21 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/btc/BTCDeriveContextHash.d.ts +16 -0
- package/dist/api/btc/BTCDeriveContextHash.d.ts.map +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -1
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/device/Device.d.ts +2 -0
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +4 -4
- package/dist/device/DevicePool.d.ts.map +1 -1
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/index.d.ts +47 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2593 -2305
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/btcDeriveContextHash.d.ts +10 -0
- package/dist/types/api/btcDeriveContextHash.d.ts.map +1 -0
- package/dist/types/api/export.d.ts +1 -0
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +2 -0
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/device.d.ts +8 -0
- package/dist/types/device.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +4 -7
- package/src/api/SearchDevices.ts +163 -7
- package/src/api/btc/BTCDeriveContextHash.ts +90 -0
- package/src/api/index.ts +1 -0
- package/src/api/protocol-v2/DeviceReboot.ts +2 -0
- package/src/core/index.ts +46 -15
- package/src/data/messages/messages.json +51 -0
- package/src/device/Device.ts +10 -0
- package/src/device/DeviceConnector.ts +4 -4
- package/src/device/DevicePool.ts +12 -2
- package/src/events/logBlockEvent.ts +1 -0
- package/src/index.ts +1 -0
- package/src/inject.ts +2 -0
- package/src/types/api/btcDeriveContextHash.ts +15 -0
- package/src/types/api/export.ts +1 -0
- package/src/types/api/index.ts +2 -0
- package/src/types/device.ts +10 -0
package/src/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { executeCallback, cleanupCallback };
|
|
|
21
21
|
export { preloadSessionCache } from './device/Device';
|
|
22
22
|
export { projectFeatures as projectDeviceStateFeatures } from './device/DeviceStateProjector';
|
|
23
23
|
export { getMethodSupportedProtocols } from './api/utils';
|
|
24
|
+
export { probeUsbDeviceIdentitiesWithTransport } from './api/SearchDevices';
|
|
24
25
|
export {
|
|
25
26
|
getFirmwareUpdateHostBindingGeneration,
|
|
26
27
|
registerFirmwareUpdateHostBinding,
|
package/src/inject.ts
CHANGED
|
@@ -309,6 +309,8 @@ export const createCoreApi = (
|
|
|
309
309
|
call({ ...params, connectId, deviceId, method: 'btcGetAddress' }),
|
|
310
310
|
btcGetPublicKey: (connectId, deviceId, params) =>
|
|
311
311
|
call({ ...params, connectId, deviceId, method: 'btcGetPublicKey' }),
|
|
312
|
+
btcDeriveContextHash: (connectId, deviceId, params) =>
|
|
313
|
+
call({ ...params, connectId, deviceId, method: 'btcDeriveContextHash' }),
|
|
312
314
|
btcSignMessage: (connectId, deviceId, params) =>
|
|
313
315
|
call({ ...params, connectId, deviceId, method: 'btcSignMessage' }),
|
|
314
316
|
btcSignPsbt: (connectId, deviceId, params) =>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BabylonDerivedContextHash } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type BTCDeriveContextHashParams = {
|
|
5
|
+
path: string | number[];
|
|
6
|
+
appName: string;
|
|
7
|
+
context: string;
|
|
8
|
+
network: 'bitcoin-mainnet' | 'bitcoin-testnet' | 'bitcoin-signet' | 'bitcoin-regtest';
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export declare function btcDeriveContextHash(
|
|
12
|
+
connectId: string,
|
|
13
|
+
deviceId: string,
|
|
14
|
+
params: CommonParams & BTCDeriveContextHashParams
|
|
15
|
+
): Response<BabylonDerivedContextHash>;
|
package/src/types/api/export.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { BTCAddress, BTCGetAddressParams } from './btcGetAddress';
|
|
2
2
|
export type { BTCPublicKey, BTCGetPublicKeyParams } from './btcGetPublicKey';
|
|
3
|
+
export type { BTCDeriveContextHashParams } from './btcDeriveContextHash';
|
|
3
4
|
export type { BTCSignMessageParams } from './btcSignMessage';
|
|
4
5
|
export type { BTCVerifyMessageParams } from './btcVerifyMessage';
|
|
5
6
|
export type {
|
package/src/types/api/index.ts
CHANGED
|
@@ -73,6 +73,7 @@ import type { evmSignTypedData } from './evmSignTypedData';
|
|
|
73
73
|
import type { evmVerifyMessage } from './evmVerifyMessage';
|
|
74
74
|
import type { btcGetAddress } from './btcGetAddress';
|
|
75
75
|
import type { btcGetPublicKey } from './btcGetPublicKey';
|
|
76
|
+
import type { btcDeriveContextHash } from './btcDeriveContextHash';
|
|
76
77
|
import type { btcSignMessage } from './btcSignMessage';
|
|
77
78
|
import type { btcSignPsbt } from './btcSignPsbt';
|
|
78
79
|
import type { btcSignTransaction } from './btcSignTransaction';
|
|
@@ -286,6 +287,7 @@ export type CoreApi = {
|
|
|
286
287
|
*/
|
|
287
288
|
btcGetAddress: typeof btcGetAddress;
|
|
288
289
|
btcGetPublicKey: typeof btcGetPublicKey;
|
|
290
|
+
btcDeriveContextHash: typeof btcDeriveContextHash;
|
|
289
291
|
btcSignMessage: typeof btcSignMessage;
|
|
290
292
|
btcSignPsbt: typeof btcSignPsbt;
|
|
291
293
|
btcSignTransaction: typeof btcSignTransaction;
|
package/src/types/device.ts
CHANGED
|
@@ -85,6 +85,16 @@ export type SearchDevice = {
|
|
|
85
85
|
commType: OneKeyDeviceCommType;
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
+
/** Identity confirmed over USB. The descriptor path is only a transport address. */
|
|
89
|
+
export type UsbDeviceIdentity = {
|
|
90
|
+
path: string;
|
|
91
|
+
serialNo: string | null;
|
|
92
|
+
deviceId: string | null;
|
|
93
|
+
deviceType: IDeviceType;
|
|
94
|
+
connectProtocol: HardwareConnectProtocol;
|
|
95
|
+
commType: 'webusb' | 'bridge';
|
|
96
|
+
};
|
|
97
|
+
|
|
88
98
|
// export type UnknownDevice = {
|
|
89
99
|
// type: 'unacquired';
|
|
90
100
|
// id?: null;
|