@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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { FilecoinSignTx as HardwareFilecoinSignTx } from '@onekeyfe/hd-transport';
|
|
2
|
+
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
3
|
+
import { BaseMethod } from '../BaseMethod';
|
|
4
|
+
import { validateParams } from '../helpers/paramsValidator';
|
|
5
|
+
import { FilecoinSignTransactionParams } from '../../types';
|
|
6
|
+
import { formatAnyHex } from '../helpers/hexUtils';
|
|
7
|
+
|
|
8
|
+
export default class FilecoinSignTransaction extends BaseMethod<HardwareFilecoinSignTx> {
|
|
9
|
+
hasBundle = false;
|
|
10
|
+
|
|
11
|
+
init() {
|
|
12
|
+
this.checkDeviceId = true;
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
14
|
+
|
|
15
|
+
// check payload
|
|
16
|
+
validateParams(this.payload, [
|
|
17
|
+
{ name: 'path', required: true },
|
|
18
|
+
{ name: 'rawTx', type: 'hexString', required: true },
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
// init params
|
|
22
|
+
const { path, rawTx } = this.payload as FilecoinSignTransactionParams;
|
|
23
|
+
const addressN = validatePath(path, 3);
|
|
24
|
+
|
|
25
|
+
this.params = {
|
|
26
|
+
address_n: addressN,
|
|
27
|
+
raw_tx: formatAnyHex(rawTx),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getVersionRange() {
|
|
32
|
+
return {
|
|
33
|
+
model_mini: {
|
|
34
|
+
min: '2.10.0',
|
|
35
|
+
},
|
|
36
|
+
model_touch: {
|
|
37
|
+
min: '3.5.0',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async run() {
|
|
43
|
+
const res = await this.device.commands.typedCall('FilecoinSignTx', 'FilecoinSignedTx', {
|
|
44
|
+
...this.params,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const { signature } = res.message;
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
path: serializedPath(this.params.address_n),
|
|
51
|
+
signature,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
3
|
-
import { Features } from '../../types';
|
|
3
|
+
import { Features, IDeviceType } from '../../types';
|
|
4
4
|
import { getDeviceType, httpRequest } from '../../utils';
|
|
5
5
|
import { DataManager } from '../../data-manager';
|
|
6
6
|
import { findLatestRelease } from '../../utils/release';
|
|
@@ -53,9 +53,19 @@ export const getSysResourceBinary = async (url: string) => {
|
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
const getFirmwareUpdateField = (deviceType: IDeviceType, updateType: 'firmware' | 'ble') => {
|
|
57
|
+
if (updateType === 'ble') {
|
|
58
|
+
return 'ble';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return deviceType === 'touch' ? 'firmware-v2' : 'firmware';
|
|
62
|
+
};
|
|
63
|
+
|
|
56
64
|
const getInfo = ({ features, updateType }: GetInfoProps) => {
|
|
57
65
|
const deviceType = getDeviceType(features);
|
|
58
66
|
const { deviceMap } = DataManager;
|
|
59
|
-
|
|
67
|
+
|
|
68
|
+
const firmwareUpdateField = getFirmwareUpdateField(deviceType, updateType);
|
|
69
|
+
const releaseInfo = deviceMap?.[deviceType]?.[firmwareUpdateField] ?? [];
|
|
60
70
|
return findLatestRelease(releaseInfo);
|
|
61
71
|
};
|
package/src/api/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as deviceBackup } from './device/DeviceBackup';
|
|
|
10
10
|
export { default as deviceChangePin } from './device/DeviceChangePin';
|
|
11
11
|
export { default as deviceFlags } from './device/DeviceFlags';
|
|
12
12
|
export { default as deviceRebootToBootloader } from './device/DeviceRebootToBootloader';
|
|
13
|
+
export { default as deviceRebootToBoardloader } from './device/DeviceRebootToBoardloader';
|
|
13
14
|
export { default as deviceRecovery } from './device/DeviceRecovery';
|
|
14
15
|
export { default as deviceReset } from './device/DeviceReset';
|
|
15
16
|
export { default as deviceSettings } from './device/DeviceSettings';
|
|
@@ -89,3 +90,6 @@ export { default as suiSignTransaction } from './sui/SuiSignTransaction';
|
|
|
89
90
|
export { default as cardanoGetAddress } from './cardano/CardanoGetAddress';
|
|
90
91
|
export { default as cardanoGetPublicKey } from './cardano/CardanoGetPublicKey';
|
|
91
92
|
export { default as cardanoSignTransaction } from './cardano/CardanoSignTransaction';
|
|
93
|
+
|
|
94
|
+
export { default as filecoinGetAddress } from './filecoin/FilecoinGetAddress';
|
|
95
|
+
export { default as filecoinSignTransaction } from './filecoin/FilecoinSignTransaction';
|