@onekeyfe/hd-core 0.2.15 → 0.2.17
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/dist/api/FirmwareUpdateV2.d.ts +2 -1
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/cardano/helper/cardanoInputs.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts +15 -0
- package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -0
- package/dist/api/filecoin/FilecoinGetAddress.d.ts +17 -0
- package/dist/api/filecoin/FilecoinGetAddress.d.ts.map +1 -0
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts +19 -0
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts.map +1 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +2 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +41 -4
- package/dist/index.js +472 -277
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/cardano.d.ts.map +1 -1
- package/dist/types/api/deviceRebootToBoardloader.d.ts +5 -0
- package/dist/types/api/deviceRebootToBoardloader.d.ts.map +1 -0
- package/dist/types/api/export.d.ts +2 -0
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/filecoinGetAddress.d.ts +14 -0
- package/dist/types/api/filecoinGetAddress.d.ts.map +1 -0
- package/dist/types/api/filecoinSignTransaction.d.ts +14 -0
- package/dist/types/api/filecoinSignTransaction.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdate.d.ts +7 -0
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +8 -2
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -0
- package/dist/types/settings.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/FirmwareUpdateV2.ts +25 -2
- package/src/api/device/DeviceRebootToBoardloader.ts +28 -0
- package/src/api/filecoin/FilecoinGetAddress.ts +71 -0
- package/src/api/filecoin/FilecoinSignTransaction.ts +54 -0
- package/src/api/firmware/getBinary.ts +12 -2
- package/src/api/index.ts +4 -0
- package/src/data/messages/messages.json +463 -419
- package/src/data-manager/DataManager.ts +17 -5
- package/src/inject.ts +7 -0
- package/src/types/api/cardano.ts +0 -1
- package/src/types/api/deviceRebootToBoardloader.ts +6 -0
- package/src/types/api/export.ts +3 -0
- package/src/types/api/filecoinGetAddress.ts +23 -0
- package/src/types/api/filecoinSignTransaction.ts +23 -0
- package/src/types/api/firmwareUpdate.ts +12 -0
- package/src/types/api/index.ts +13 -2
- package/src/types/settings.ts +1 -0
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
IDeviceFirmwareStatus,
|
|
18
18
|
IDeviceBLEFirmwareStatus,
|
|
19
19
|
ITransportStatus,
|
|
20
|
+
IDeviceType,
|
|
20
21
|
} from '../types';
|
|
21
22
|
import { getReleaseChangelog, getReleaseStatus, findLatestRelease } from '../utils/release';
|
|
22
23
|
|
|
@@ -48,6 +49,12 @@ export default class DataManager {
|
|
|
48
49
|
default: MessagesJSON as unknown as JSON,
|
|
49
50
|
};
|
|
50
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Since 3.5.0, Touch uses the firmware-v2 field to get firmware release info
|
|
54
|
+
*/
|
|
55
|
+
static getFirmwareUpdateField = (deviceType: IDeviceType) =>
|
|
56
|
+
deviceType === 'touch' ? 'firmware-v2' : 'firmware';
|
|
57
|
+
|
|
51
58
|
static getFirmwareStatus = (features: Features): IDeviceFirmwareStatus => {
|
|
52
59
|
const deviceType = getDeviceType(features);
|
|
53
60
|
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
@@ -59,7 +66,8 @@ export default class DataManager {
|
|
|
59
66
|
return 'unknown';
|
|
60
67
|
}
|
|
61
68
|
|
|
62
|
-
const
|
|
69
|
+
const firmwareUpdateField = this.getFirmwareUpdateField(deviceType);
|
|
70
|
+
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
63
71
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
64
72
|
return getReleaseStatus(targetDeviceConfigList, currentVersion);
|
|
65
73
|
};
|
|
@@ -74,7 +82,8 @@ export default class DataManager {
|
|
|
74
82
|
|
|
75
83
|
if (deviceType !== 'pro' && deviceType !== 'touch') return undefined;
|
|
76
84
|
|
|
77
|
-
const
|
|
85
|
+
const firmwareUpdateField = this.getFirmwareUpdateField(deviceType);
|
|
86
|
+
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
78
87
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
79
88
|
const targetDeviceConfig = targetDeviceConfigList.filter(item =>
|
|
80
89
|
forcedUpdateRes
|
|
@@ -94,7 +103,8 @@ export default class DataManager {
|
|
|
94
103
|
|
|
95
104
|
if (deviceType !== 'pro' && deviceType !== 'touch') return undefined;
|
|
96
105
|
|
|
97
|
-
const
|
|
106
|
+
const firmwareUpdateField = this.getFirmwareUpdateField(deviceType);
|
|
107
|
+
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
98
108
|
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.fullResource);
|
|
99
109
|
|
|
100
110
|
return findLatestRelease(targetDeviceConfig)?.fullResource;
|
|
@@ -111,14 +121,16 @@ export default class DataManager {
|
|
|
111
121
|
return [];
|
|
112
122
|
}
|
|
113
123
|
|
|
114
|
-
const
|
|
124
|
+
const firmwareUpdateField = this.getFirmwareUpdateField(deviceType);
|
|
125
|
+
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
115
126
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
116
127
|
return getReleaseChangelog(targetDeviceConfigList, currentVersion);
|
|
117
128
|
};
|
|
118
129
|
|
|
119
130
|
static getFirmwareLatestRelease = (features: Features) => {
|
|
120
131
|
const deviceType = getDeviceType(features);
|
|
121
|
-
const
|
|
132
|
+
const firmwareUpdateField = this.getFirmwareUpdateField(deviceType);
|
|
133
|
+
const targetDeviceConfigList = this.deviceMap[deviceType]?.[firmwareUpdateField] ?? [];
|
|
122
134
|
|
|
123
135
|
const target = findLatestRelease(targetDeviceConfigList);
|
|
124
136
|
if (!target) return target;
|
package/src/inject.ts
CHANGED
|
@@ -80,6 +80,8 @@ export const inject = ({
|
|
|
80
80
|
deviceChangePin: (connectId, params) =>
|
|
81
81
|
call({ ...params, connectId, method: 'deviceChangePin' }),
|
|
82
82
|
deviceFlags: (connectId, params) => call({ ...params, connectId, method: 'deviceFlags' }),
|
|
83
|
+
deviceRebootToBoardloader: connectId =>
|
|
84
|
+
call({ connectId, method: 'deviceRebootToBoardloader' }),
|
|
83
85
|
deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
|
|
84
86
|
deviceRecovery: (connectId, params) => call({ ...params, connectId, method: 'deviceRecovery' }),
|
|
85
87
|
deviceReset: (connectId, params) => call({ ...params, connectId, method: 'deviceReset' }),
|
|
@@ -212,6 +214,11 @@ export const inject = ({
|
|
|
212
214
|
call({ ...params, connectId, deviceId, method: 'cardanoGetPublicKey' }),
|
|
213
215
|
cardanoSignTransaction: (connectId, deviceId, params) =>
|
|
214
216
|
call({ ...params, connectId, deviceId, method: 'cardanoSignTransaction' }),
|
|
217
|
+
|
|
218
|
+
filecoinGetAddress: (connectId, deviceId, params) =>
|
|
219
|
+
call({ ...params, connectId, deviceId, method: 'filecoinGetAddress' }),
|
|
220
|
+
filecoinSignTransaction: (connectId, deviceId, params) =>
|
|
221
|
+
call({ ...params, connectId, deviceId, method: 'filecoinSignTransaction' }),
|
|
215
222
|
};
|
|
216
223
|
return api;
|
|
217
224
|
};
|
package/src/types/api/cardano.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Success, RebootToBoardloader } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type RebootToBoardloaderParams = RebootToBoardloader;
|
|
5
|
+
|
|
6
|
+
export declare function deviceRebootToBoardloader(connectId: string): Response<Success>;
|
package/src/types/api/export.ts
CHANGED
|
@@ -118,3 +118,6 @@ export type {
|
|
|
118
118
|
} from './cardanoGetAddress';
|
|
119
119
|
|
|
120
120
|
export type { CardanoSignTransaction, CardanoSignedTxData } from './cardano';
|
|
121
|
+
|
|
122
|
+
export type { FilecoinAddress, FilecoinGetAddressParams } from './filecoinGetAddress';
|
|
123
|
+
export type { FilecoinSignTransactionParams, FilecoinSignedTx } from './filecoinSignTransaction';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FilecoinAddress as HardwareFilecoinAddress } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type FilecoinAddress = {
|
|
5
|
+
path: string;
|
|
6
|
+
} & HardwareFilecoinAddress;
|
|
7
|
+
|
|
8
|
+
export type FilecoinGetAddressParams = {
|
|
9
|
+
path: string | number[];
|
|
10
|
+
showOnOneKey?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare function filecoinGetAddress(
|
|
14
|
+
connectId: string,
|
|
15
|
+
deviceId: string,
|
|
16
|
+
params: CommonParams & FilecoinGetAddressParams
|
|
17
|
+
): Response<FilecoinAddress>;
|
|
18
|
+
|
|
19
|
+
export declare function filecoinGetAddress(
|
|
20
|
+
connectId: string,
|
|
21
|
+
deviceId: string,
|
|
22
|
+
params: CommonParams & { bundle?: FilecoinGetAddressParams[] }
|
|
23
|
+
): Response<Array<FilecoinAddress>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FilecoinSignedTx as HardwareFilecoinSignedTx } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type FilecoinSignedTx = {
|
|
5
|
+
path: string;
|
|
6
|
+
} & HardwareFilecoinSignedTx;
|
|
7
|
+
|
|
8
|
+
export type FilecoinSignTransactionParams = {
|
|
9
|
+
path: string | number[];
|
|
10
|
+
rawTx?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare function filecoinSignTransaction(
|
|
14
|
+
connectId: string,
|
|
15
|
+
deviceId: string,
|
|
16
|
+
params: CommonParams & FilecoinSignTransactionParams
|
|
17
|
+
): Response<FilecoinSignedTx>;
|
|
18
|
+
|
|
19
|
+
export declare function filecoinSignTransaction(
|
|
20
|
+
connectId: string,
|
|
21
|
+
deviceId: string,
|
|
22
|
+
params: CommonParams & { bundle?: FilecoinSignTransactionParams[] }
|
|
23
|
+
): Response<Array<FilecoinSignedTx>>;
|
|
@@ -20,3 +20,15 @@ export declare function firmwareUpdate(
|
|
|
20
20
|
connectId: string | undefined,
|
|
21
21
|
params: Params<FirmwareUpdateBinaryParams>
|
|
22
22
|
): Response<PROTO.Success>;
|
|
23
|
+
|
|
24
|
+
type IPlatform = 'native' | 'desktop' | 'ext' | 'web' | 'webEmbed';
|
|
25
|
+
type Platform = { platform: IPlatform };
|
|
26
|
+
|
|
27
|
+
export declare function firmwareUpdateV2(
|
|
28
|
+
connectId: string | undefined,
|
|
29
|
+
params: Params<FirmwareUpdateParams & Platform>
|
|
30
|
+
): Response<PROTO.Success>;
|
|
31
|
+
export declare function firmwareUpdateV2(
|
|
32
|
+
connectId: string | undefined,
|
|
33
|
+
params: Params<FirmwareUpdateBinaryParams & Platform>
|
|
34
|
+
): Response<PROTO.Success>;
|
package/src/types/api/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { getFeatures } from './getFeatures';
|
|
|
11
11
|
import { getPassphraseState } from './getPassphraseState';
|
|
12
12
|
import { checkFirmwareRelease } from './checkFirmwareRelease';
|
|
13
13
|
import { checkBLEFirmwareRelease } from './checkBLEFirmwareRelease';
|
|
14
|
-
import { firmwareUpdate } from './firmwareUpdate';
|
|
14
|
+
import { firmwareUpdate, firmwareUpdateV2 } from './firmwareUpdate';
|
|
15
15
|
import { requestWebUsbDevice } from './requestWebUsbDevice';
|
|
16
16
|
|
|
17
17
|
import { deviceReset } from './deviceReset';
|
|
@@ -19,6 +19,7 @@ import { deviceRecovery } from './deviceRecovery';
|
|
|
19
19
|
import { deviceVerify } from './deviceVerify';
|
|
20
20
|
import { deviceWipe } from './deviceWipe';
|
|
21
21
|
import { deviceRebootToBootloader } from './deviceRebootToBootloader';
|
|
22
|
+
import { deviceRebootToBoardloader } from './deviceRebootToBoardloader';
|
|
22
23
|
import { deviceBackup } from './deviceBackup';
|
|
23
24
|
import { deviceChangePin } from './deviceChangePin';
|
|
24
25
|
import { deviceSettings } from './deviceSettings';
|
|
@@ -94,6 +95,9 @@ import { cardanoGetAddress } from './cardanoGetAddress';
|
|
|
94
95
|
import { cardanoGetPublicKey } from './cardanoGetPublicKey';
|
|
95
96
|
import { cardanoSignTransaction } from './cardanoSignTransaction';
|
|
96
97
|
|
|
98
|
+
import { filecoinGetAddress } from './filecoinGetAddress';
|
|
99
|
+
import { filecoinSignTransaction } from './filecoinSignTransaction';
|
|
100
|
+
|
|
97
101
|
export * from './export';
|
|
98
102
|
|
|
99
103
|
export type CoreApi = {
|
|
@@ -126,6 +130,7 @@ export type CoreApi = {
|
|
|
126
130
|
deviceBackup: typeof deviceBackup;
|
|
127
131
|
deviceChangePin: typeof deviceChangePin;
|
|
128
132
|
deviceFlags: typeof deviceFlags;
|
|
133
|
+
deviceRebootToBoardloader: typeof deviceRebootToBoardloader;
|
|
129
134
|
deviceRebootToBootloader: typeof deviceRebootToBootloader;
|
|
130
135
|
deviceRecovery: typeof deviceRecovery;
|
|
131
136
|
deviceReset: typeof deviceReset;
|
|
@@ -139,7 +144,7 @@ export type CoreApi = {
|
|
|
139
144
|
checkFirmwareRelease: typeof checkFirmwareRelease;
|
|
140
145
|
checkBLEFirmwareRelease: typeof checkBLEFirmwareRelease;
|
|
141
146
|
firmwareUpdate: typeof firmwareUpdate;
|
|
142
|
-
firmwareUpdateV2: typeof
|
|
147
|
+
firmwareUpdateV2: typeof firmwareUpdateV2;
|
|
143
148
|
|
|
144
149
|
cipherKeyValue: typeof cipherKeyValue;
|
|
145
150
|
|
|
@@ -251,4 +256,10 @@ export type CoreApi = {
|
|
|
251
256
|
cardanoGetAddress: typeof cardanoGetAddress;
|
|
252
257
|
cardanoGetPublicKey: typeof cardanoGetPublicKey;
|
|
253
258
|
cardanoSignTransaction: typeof cardanoSignTransaction;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Filecoin function
|
|
262
|
+
*/
|
|
263
|
+
filecoinGetAddress: typeof filecoinGetAddress;
|
|
264
|
+
filecoinSignTransaction: typeof filecoinSignTransaction;
|
|
254
265
|
};
|
package/src/types/settings.ts
CHANGED