@onekeyfe/hd-core 0.1.41 → 0.1.44

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.
Files changed (103) hide show
  1. package/dist/api/BaseMethod.d.ts.map +1 -1
  2. package/dist/api/aptos/AptosGetAddress.d.ts +9 -0
  3. package/dist/api/aptos/AptosGetAddress.d.ts.map +1 -0
  4. package/dist/api/aptos/AptosSignTransaction.d.ts +12 -0
  5. package/dist/api/aptos/AptosSignTransaction.d.ts.map +1 -0
  6. package/dist/api/conflux/ConfluxGetAddress.d.ts +14 -0
  7. package/dist/api/conflux/ConfluxGetAddress.d.ts.map +1 -0
  8. package/dist/api/conflux/ConfluxSignMessage.d.ts +12 -0
  9. package/dist/api/conflux/ConfluxSignMessage.d.ts.map +1 -0
  10. package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts +12 -0
  11. package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts.map +1 -0
  12. package/dist/api/conflux/ConfluxSignTransaction.d.ts +17 -0
  13. package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -0
  14. package/dist/api/helpers/stringUtils.d.ts +1 -0
  15. package/dist/api/helpers/stringUtils.d.ts.map +1 -1
  16. package/dist/api/index.d.ts +21 -10
  17. package/dist/api/index.d.ts.map +1 -1
  18. package/dist/api/near/NearGetAddress.d.ts +14 -0
  19. package/dist/api/near/NearGetAddress.d.ts.map +1 -0
  20. package/dist/api/near/NearSignTransaction.d.ts +12 -0
  21. package/dist/api/near/NearSignTransaction.d.ts.map +1 -0
  22. package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
  23. package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
  24. package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
  25. package/dist/api/tron/TronGetAddress.d.ts +14 -0
  26. package/dist/api/tron/TronGetAddress.d.ts.map +1 -0
  27. package/dist/api/tron/TronSignMessage.d.ts +12 -0
  28. package/dist/api/tron/TronSignMessage.d.ts.map +1 -0
  29. package/dist/api/tron/TronSignTransaction.d.ts +14 -0
  30. package/dist/api/tron/TronSignTransaction.d.ts.map +1 -0
  31. package/dist/core/index.d.ts.map +1 -1
  32. package/dist/device/DeviceCommands.d.ts +1 -1
  33. package/dist/device/DeviceCommands.d.ts.map +1 -1
  34. package/dist/index.d.ts +347 -199
  35. package/dist/index.js +1579 -594
  36. package/dist/inject.d.ts.map +1 -1
  37. package/dist/types/api/aptosGetAddress.d.ts +14 -0
  38. package/dist/types/api/aptosGetAddress.d.ts.map +1 -0
  39. package/dist/types/api/aptosSignTransaction.d.ts +11 -0
  40. package/dist/types/api/aptosSignTransaction.d.ts.map +1 -0
  41. package/dist/types/api/confluxGetAddress.d.ts +15 -0
  42. package/dist/types/api/confluxGetAddress.d.ts.map +1 -0
  43. package/dist/types/api/confluxSignMessage.d.ts +8 -0
  44. package/dist/types/api/confluxSignMessage.d.ts.map +1 -0
  45. package/dist/types/api/confluxSignMessageCIP23.d.ts +9 -0
  46. package/dist/types/api/confluxSignMessageCIP23.d.ts.map +1 -0
  47. package/dist/types/api/confluxSignTransaction.d.ts +25 -0
  48. package/dist/types/api/confluxSignTransaction.d.ts.map +1 -0
  49. package/dist/types/api/deviceVerify.d.ts +2 -3
  50. package/dist/types/api/deviceVerify.d.ts.map +1 -1
  51. package/dist/types/api/export.d.ts +11 -0
  52. package/dist/types/api/export.d.ts.map +1 -1
  53. package/dist/types/api/index.d.ts +49 -27
  54. package/dist/types/api/index.d.ts.map +1 -1
  55. package/dist/types/api/nearGetAddress.d.ts +14 -0
  56. package/dist/types/api/nearGetAddress.d.ts.map +1 -0
  57. package/dist/types/api/nearSignTransaction.d.ts +8 -0
  58. package/dist/types/api/nearSignTransaction.d.ts.map +1 -0
  59. package/dist/types/api/tronGetAddress.d.ts +14 -0
  60. package/dist/types/api/tronGetAddress.d.ts.map +1 -0
  61. package/dist/types/api/tronSignMessage.d.ts +8 -0
  62. package/dist/types/api/tronSignMessage.d.ts.map +1 -0
  63. package/dist/types/api/tronSignTransaction.d.ts +32 -0
  64. package/dist/types/api/tronSignTransaction.d.ts.map +1 -0
  65. package/dist/utils/patch.d.ts +1 -1
  66. package/dist/utils/patch.d.ts.map +1 -1
  67. package/package.json +4 -4
  68. package/src/api/BaseMethod.ts +5 -2
  69. package/src/api/aptos/AptosGetAddress.ts +60 -0
  70. package/src/api/aptos/AptosSignTransaction.ts +45 -0
  71. package/src/api/conflux/ConfluxGetAddress.ts +67 -0
  72. package/src/api/conflux/ConfluxSignMessage.ts +48 -0
  73. package/src/api/conflux/ConfluxSignMessageCIP23.ts +48 -0
  74. package/src/api/conflux/ConfluxSignTransaction.ts +134 -0
  75. package/src/api/helpers/stringUtils.ts +3 -0
  76. package/src/api/index.ts +26 -10
  77. package/src/api/near/NearGetAddress.ts +68 -0
  78. package/src/api/near/NearSignTransaction.ts +45 -0
  79. package/src/api/solana/SolGetAddress.ts +0 -2
  80. package/src/api/solana/SolSignTransaction.ts +0 -2
  81. package/src/api/stellar/StellarSignTransaction.ts +14 -7
  82. package/src/api/tron/TronGetAddress.ts +68 -0
  83. package/src/api/tron/TronSignMessage.ts +48 -0
  84. package/src/api/tron/TronSignTransaction.ts +87 -0
  85. package/src/core/index.ts +15 -2
  86. package/src/data/messages/messages.json +8887 -8433
  87. package/src/device/DeviceCommands.ts +6 -7
  88. package/src/inject.ts +26 -0
  89. package/src/types/api/aptosGetAddress.ts +23 -0
  90. package/src/types/api/aptosSignTransaction.ts +17 -0
  91. package/src/types/api/confluxGetAddress.ts +24 -0
  92. package/src/types/api/confluxSignMessage.ts +13 -0
  93. package/src/types/api/confluxSignMessageCIP23.ts +14 -0
  94. package/src/types/api/confluxSignTransaction.ts +32 -0
  95. package/src/types/api/deviceVerify.ts +2 -2
  96. package/src/types/api/export.ts +25 -0
  97. package/src/types/api/index.ts +101 -35
  98. package/src/types/api/nearGetAddress.ts +23 -0
  99. package/src/types/api/nearSignTransaction.ts +13 -0
  100. package/src/types/api/tronGetAddress.ts +23 -0
  101. package/src/types/api/tronSignMessage.ts +13 -0
  102. package/src/types/api/tronSignTransaction.ts +41 -0
  103. package/src/utils/deviceFeaturesUtils.ts +2 -2
@@ -1,4 +1,4 @@
1
- import type { Transport, Messages } from '@onekeyfe/hd-transport';
1
+ import { Transport, Messages, FailureType } from '@onekeyfe/hd-transport';
2
2
  import { ERRORS, HardwareError, HardwareErrorCode } from '@onekeyfe/hd-shared';
3
3
  import TransportManager from '../data-manager/TransportManager';
4
4
  import DataManager from '../data-manager/DataManager';
@@ -147,23 +147,23 @@ export class DeviceCommands {
147
147
  const { message } = res.message;
148
148
  let error: HardwareError | null = null;
149
149
  // Model One does not send any message in firmware update
150
- if (code === 'Failure_FirmwareError' && !message) {
150
+ if (code === FailureType.Failure_FirmwareError && !message) {
151
151
  error = ERRORS.TypedError(HardwareErrorCode.FirmwareError);
152
152
  }
153
153
  // Failure_ActionCancelled message could be also missing
154
- if (code === 'Failure_ActionCancelled') {
154
+ if (code === FailureType.Failure_ActionCancelled) {
155
155
  error = ERRORS.TypedError(HardwareErrorCode.ActionCancelled);
156
156
  }
157
157
 
158
- if (code === 'Failure_PinInvalid') {
158
+ if (code === FailureType.Failure_PinInvalid) {
159
159
  error = ERRORS.TypedError(HardwareErrorCode.PinInvalid, message);
160
160
  }
161
161
 
162
- if (code === 'Failure_PinCancelled') {
162
+ if (code === FailureType.Failure_PinCancelled) {
163
163
  error = ERRORS.TypedError(HardwareErrorCode.PinCancelled);
164
164
  }
165
165
 
166
- if (code === 'Failure_DataError' && message === 'Please confirm the BlindSign enabled') {
166
+ if (code === FailureType.Failure_DataError && message === 'Please confirm the BlindSign enabled') {
167
167
  error = ERRORS.TypedError(HardwareErrorCode.BlindSignDisabled);
168
168
  }
169
169
 
@@ -208,7 +208,6 @@ export class DeviceCommands {
208
208
  return this._promptPin(res.message.type).then(
209
209
  pin => {
210
210
  if (pin === '@@ONEKEY_INPUT_PIN_IN_DEVICE') {
211
- // @ts-expect-error
212
211
  return this._commonCall('BixinPinInputOnDevice');
213
212
  }
214
213
  return this._commonCall('PinMatrixAck', { pin });
package/src/inject.ts CHANGED
@@ -145,6 +145,32 @@ export const inject = ({
145
145
 
146
146
  firmwareUpdate: (connectId, params) => call({ ...params, connectId, method: 'firmwareUpdate' }),
147
147
  requestWebUsbDevice: () => call({ method: 'requestWebUsbDevice' }),
148
+
149
+ tronGetAddress: (connectId, deviceId, params) =>
150
+ call({ ...params, connectId, deviceId, method: 'tronGetAddress' }),
151
+ tronSignMessage: (connectId, deviceId, params) =>
152
+ call({ ...params, connectId, deviceId, method: 'tronSignMessage' }),
153
+ tronSignTransaction: (connectId, deviceId, params) =>
154
+ call({ ...params, connectId, deviceId, method: 'tronSignTransaction' }),
155
+
156
+ confluxGetAddress: (connectId, deviceId, params) =>
157
+ call({ ...params, connectId, deviceId, method: 'confluxGetAddress' }),
158
+ confluxSignMessage: (connectId, deviceId, params) =>
159
+ call({ ...params, connectId, deviceId, method: 'confluxSignMessage' }),
160
+ confluxSignMessageCIP23: (connectId, deviceId, params) =>
161
+ call({ ...params, connectId, deviceId, method: 'confluxSignMessageCIP23' }),
162
+ confluxSignTransaction: (connectId, deviceId, params) =>
163
+ call({ ...params, connectId, deviceId, method: 'confluxSignTransaction' }),
164
+
165
+ nearGetAddress: (connectId, deviceId, params) =>
166
+ call({ ...params, connectId, deviceId, method: 'nearGetAddress' }),
167
+ nearSignTransaction: (connectId, deviceId, params) =>
168
+ call({ ...params, connectId, deviceId, method: 'nearSignTransaction' }),
169
+
170
+ aptosGetAddress: (connectId, deviceId, params) =>
171
+ call({ ...params, connectId, deviceId, method: 'aptosGetAddress' }),
172
+ aptosSignTransaction: (connectId, deviceId, params) =>
173
+ call({ ...params, connectId, deviceId, method: 'aptosSignTransaction' }),
148
174
  };
149
175
  return api;
150
176
  };
@@ -0,0 +1,23 @@
1
+ import { AptosAddress as HardwareAptosAddress } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type AptosAddress = {
5
+ path: string;
6
+ } & HardwareAptosAddress;
7
+
8
+ export type AptosGetAddressParams = {
9
+ path: string | number[];
10
+ showOnOneKey?: boolean;
11
+ };
12
+
13
+ export declare function aptosGetAddress(
14
+ connectId: string,
15
+ deviceId: string,
16
+ params: CommonParams & AptosGetAddressParams
17
+ ): Response<AptosAddress>;
18
+
19
+ export declare function aptosGetAddress(
20
+ connectId: string,
21
+ deviceId: string,
22
+ params: CommonParams & { bundle?: AptosGetAddressParams[] }
23
+ ): Response<Array<AptosAddress>>;
@@ -0,0 +1,17 @@
1
+ import { AptosSignedTx as HardwareAptosSignedTx } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type AptosSignedTx = {
5
+ path: string;
6
+ } & HardwareAptosSignedTx;
7
+
8
+ export type AptosSignTransactionParams = {
9
+ path: string | number[];
10
+ rawTx?: string;
11
+ };
12
+
13
+ export declare function aptosSignTransaction(
14
+ connectId: string,
15
+ deviceId: string,
16
+ params: CommonParams & AptosSignTransactionParams,
17
+ ): Response<AptosSignedTx>;
@@ -0,0 +1,24 @@
1
+ import { ConfluxAddress as HardwareConfluxAddress } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type ConfluxAddress = {
5
+ path: string;
6
+ } & HardwareConfluxAddress;
7
+
8
+ export type ConfluxGetAddressParams = {
9
+ path: string | number[];
10
+ chainId?: number;
11
+ showOnOneKey?: boolean;
12
+ };
13
+
14
+ export declare function confluxGetAddress(
15
+ connectId: string,
16
+ deviceId: string,
17
+ params: CommonParams & ConfluxGetAddressParams
18
+ ): Response<ConfluxAddress>;
19
+
20
+ export declare function confluxGetAddress(
21
+ connectId: string,
22
+ deviceId: string,
23
+ params: CommonParams & { bundle?: ConfluxGetAddressParams[] }
24
+ ): Response<Array<ConfluxAddress>>;
@@ -0,0 +1,13 @@
1
+ import { ConfluxMessageSignature } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type ConfluxSignMessageParams = {
5
+ path: string | number[];
6
+ messageHex: string;
7
+ };
8
+
9
+ export declare function confluxSignMessage(
10
+ connectId: string,
11
+ deviceId: string,
12
+ params: CommonParams & ConfluxSignMessageParams
13
+ ): Response<ConfluxMessageSignature>;
@@ -0,0 +1,14 @@
1
+ import { ConfluxMessageSignature } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type ConfluxSignMessageCIP23Params = {
5
+ path: string | number[];
6
+ domainHash: string;
7
+ messageHash: string;
8
+ };
9
+
10
+ export declare function confluxSignMessageCIP23(
11
+ connectId: string,
12
+ deviceId: string,
13
+ params: CommonParams & ConfluxSignMessageCIP23Params
14
+ ): Response<ConfluxMessageSignature>;
@@ -0,0 +1,32 @@
1
+ import type { CommonParams, Response } from '../params';
2
+
3
+ export type ConfluxSignedTx = {
4
+ v: string;
5
+ r: string;
6
+ s: string;
7
+ };
8
+
9
+ export type ConfluxTransaction = {
10
+ to: string;
11
+ value: string;
12
+ gasLimit: string;
13
+ gasPrice: string;
14
+ nonce: string;
15
+ epochHeight: string;
16
+ storageLimit: string;
17
+ chainId?: number;
18
+ data?: string;
19
+ data_initial_chunk?: string;
20
+ data_length?: string;
21
+ };
22
+
23
+ export type ConfluxSignTransactionParams = {
24
+ path: string | number[];
25
+ transaction: ConfluxTransaction;
26
+ };
27
+
28
+ export declare function confluxSignTransaction(
29
+ connectId: string,
30
+ deviceId: string,
31
+ params: CommonParams & ConfluxTransaction
32
+ ): Response<ConfluxSignedTx>;
@@ -5,8 +5,8 @@ export type DeviceVerifyParams = {
5
5
  };
6
6
 
7
7
  export type DeviceVerifySignature = {
8
- cert: Buffer;
9
- signature: Buffer;
8
+ cert: string;
9
+ signature: string;
10
10
  };
11
11
 
12
12
  export declare function deviceVerify(
@@ -70,3 +70,28 @@ export type {
70
70
  StellarTransaction,
71
71
  StellarSignTransactionParams,
72
72
  } from './stellarSignTransaction';
73
+
74
+ export type { TronAddress, TronGetAddressParams } from './tronGetAddress';
75
+ export type { TronSignMessageParams } from './tronSignMessage';
76
+ export type {
77
+ TronTransaction,
78
+ TronSignTransactionParams,
79
+ TronTransactionContract,
80
+ TronTransferContract,
81
+ TronTriggerSmartContract,
82
+ } from './tronSignTransaction';
83
+
84
+ export type { ConfluxAddress, ConfluxGetAddressParams } from './confluxGetAddress';
85
+ export type { ConfluxSignMessageParams } from './confluxSignMessage';
86
+ export type { ConfluxSignMessageCIP23Params } from './confluxSignMessageCIP23';
87
+ export type {
88
+ ConfluxSignTransactionParams,
89
+ ConfluxSignedTx,
90
+ ConfluxTransaction,
91
+ } from './confluxSignTransaction';
92
+
93
+ export type { NearAddress, NearGetAddressParams } from './nearGetAddress';
94
+ export type { NearSignTransactionParams } from './nearSignTransaction';
95
+
96
+ export type { AptosAddress, AptosGetAddressParams } from './aptosGetAddress';
97
+ export type { AptosSignedTx, AptosSignTransactionParams } from './aptosSignTransaction';
@@ -1,11 +1,33 @@
1
1
  import { on, off, removeAllListeners } from './event';
2
+ import { uiResponse } from './uiResponse';
3
+ import { init } from './init';
4
+
5
+ import { getLogs } from './getLogs';
6
+ import { checkTransportRelease } from './checkTransportRelease';
7
+ import { checkBridgeStatus } from './checkBridgeStatus';
8
+
2
9
  import { searchDevices } from './searchDevices';
3
10
  import { getFeatures } from './getFeatures';
11
+ import { getPassphraseState } from './getPassphraseState';
4
12
  import { checkFirmwareRelease } from './checkFirmwareRelease';
5
- import { init } from './init';
6
13
  import { checkBLEFirmwareRelease } from './checkBLEFirmwareRelease';
7
- import { checkTransportRelease } from './checkTransportRelease';
8
- import { checkBridgeStatus } from './checkBridgeStatus';
14
+ import { firmwareUpdate } from './firmwareUpdate';
15
+ import { requestWebUsbDevice } from './requestWebUsbDevice';
16
+
17
+ import { deviceReset } from './deviceReset';
18
+ import { deviceRecovery } from './deviceRecovery';
19
+ import { deviceVerify } from './deviceVerify';
20
+ import { deviceWipe } from './deviceWipe';
21
+ import { deviceRebootToBootloader } from './deviceRebootToBootloader';
22
+ import { deviceBackup } from './deviceBackup';
23
+ import { deviceChangePin } from './deviceChangePin';
24
+ import { deviceSettings } from './deviceSettings';
25
+ import { deviceFlags } from './deviceFlags';
26
+ import { deviceUpdateReboot } from './deviceUpdateReboot';
27
+ import { deviceSupportFeatures } from './deviceSupportFeatures';
28
+
29
+ import { cipherKeyValue } from './cipherKeyValue';
30
+
9
31
  import { evmGetAddress } from './evmGetAddress';
10
32
  import { evmGetPublicKey } from './evmGetPublicKey';
11
33
  import { evmSignMessage } from './evmSignMessage';
@@ -13,39 +35,42 @@ import { evmSignMessageEIP712 } from './evmSignMessageEIP712';
13
35
  import { evmSignTransaction } from './evmSignTransaction';
14
36
  import { evmSignTypedData } from './evmSignTypedData';
15
37
  import { evmVerifyMessage } from './evmVerifyMessage';
38
+
16
39
  import { btcGetAddress } from './btcGetAddress';
17
40
  import { btcGetPublicKey } from './btcGetPublicKey';
18
41
  import { btcSignMessage } from './btcSignMessage';
19
42
  import { btcSignTransaction } from './btcSignTransaction';
20
43
  import { btcVerifyMessage } from './btcVerifyMessage';
21
- import { uiResponse } from './uiResponse';
22
- import { deviceReset } from './deviceReset';
23
- import { deviceRecovery } from './deviceRecovery';
24
- import { deviceVerify } from './deviceVerify';
25
- import { deviceWipe } from './deviceWipe';
26
- import { deviceRebootToBootloader } from './deviceRebootToBootloader';
27
- import { deviceBackup } from './deviceBackup';
28
- import { deviceChangePin } from './deviceChangePin';
29
- import { deviceSettings } from './deviceSettings';
30
- import { deviceFlags } from './deviceFlags';
31
- import { deviceUpdateReboot } from './deviceUpdateReboot';
44
+
32
45
  import { starcoinGetAddress } from './starcoinGetAddress';
33
46
  import { starcoinGetPublicKey } from './starcoinGetPublicKey';
34
47
  import { starcoinSignMessage } from './starcoinSignMessage';
35
48
  import { starcoinSignTransaction } from './starcoinSignTransaction';
36
49
  import { starcoinVerifyMessage } from './starcoinVerifyMessage';
50
+
37
51
  import { nemGetAddress } from './nemGetAddress';
38
52
  import { nemSignTransaction } from './nemSignTransaction';
53
+
39
54
  import { solGetAddress } from './solGetAddress';
40
55
  import { solSignTransaction } from './solSignTransaction';
56
+
41
57
  import { stellarGetAddress } from './stellarGetAddress';
42
58
  import { stellarSignTransaction } from './stellarSignTransaction';
43
- import { cipherKeyValue } from './cipherKeyValue';
44
- import { firmwareUpdate } from './firmwareUpdate';
45
- import { getLogs } from './getLogs';
46
- import { deviceSupportFeatures } from './deviceSupportFeatures';
47
- import { requestWebUsbDevice } from './requestWebUsbDevice';
48
- import { getPassphraseState } from './getPassphraseState';
59
+
60
+ import { tronGetAddress } from './tronGetAddress';
61
+ import { tronSignTransaction } from './tronSignTransaction';
62
+ import { tronSignMessage } from './tronSignMessage';
63
+
64
+ import { confluxGetAddress } from './confluxGetAddress';
65
+ import { confluxSignMessage } from './confluxSignMessage';
66
+ import { confluxSignMessageCIP23 } from './confluxSignMessageCIP23';
67
+ import { confluxSignTransaction } from './confluxSignTransaction';
68
+
69
+ import { nearGetAddress } from './nearGetAddress';
70
+ import { nearSignTransaction } from './nearSignTransaction';
71
+
72
+ import { aptosGetAddress } from './aptosGetAddress';
73
+ import { aptosSignTransaction } from './aptosSignTransaction';
49
74
 
50
75
  export * from './export';
51
76
 
@@ -66,22 +91,16 @@ export type CoreApi = {
66
91
  /**
67
92
  * Core function
68
93
  */
69
- searchDevices: typeof searchDevices;
70
-
71
- requestWebUsbDevice: typeof requestWebUsbDevice;
72
-
73
- getFeatures: typeof getFeatures;
74
-
75
- checkFirmwareRelease: typeof checkFirmwareRelease;
76
-
77
- checkBLEFirmwareRelease: typeof checkBLEFirmwareRelease;
78
-
79
94
  checkTransportRelease: typeof checkTransportRelease;
80
-
81
95
  checkBridgeStatus: typeof checkBridgeStatus;
82
96
 
83
- cipherKeyValue: typeof cipherKeyValue;
84
-
97
+ /**
98
+ * Device function
99
+ */
100
+ searchDevices: typeof searchDevices;
101
+ requestWebUsbDevice: typeof requestWebUsbDevice;
102
+ getFeatures: typeof getFeatures;
103
+ getPassphraseState: typeof getPassphraseState;
85
104
  deviceBackup: typeof deviceBackup;
86
105
  deviceChangePin: typeof deviceChangePin;
87
106
  deviceFlags: typeof deviceFlags;
@@ -93,8 +112,15 @@ export type CoreApi = {
93
112
  deviceSupportFeatures: typeof deviceSupportFeatures;
94
113
  deviceVerify: typeof deviceVerify;
95
114
  deviceWipe: typeof deviceWipe;
96
- getPassphraseState: typeof getPassphraseState;
115
+ checkFirmwareRelease: typeof checkFirmwareRelease;
116
+ checkBLEFirmwareRelease: typeof checkBLEFirmwareRelease;
117
+ firmwareUpdate: typeof firmwareUpdate;
97
118
 
119
+ cipherKeyValue: typeof cipherKeyValue;
120
+
121
+ /**
122
+ * EVM function
123
+ */
98
124
  evmGetAddress: typeof evmGetAddress;
99
125
  evmGetPublicKey: typeof evmGetPublicKey;
100
126
  evmSignMessage: typeof evmSignMessage;
@@ -103,26 +129,66 @@ export type CoreApi = {
103
129
  evmSignTypedData: typeof evmSignTypedData;
104
130
  evmVerifyMessage: typeof evmVerifyMessage;
105
131
 
132
+ /**
133
+ * BTC function
134
+ */
106
135
  btcGetAddress: typeof btcGetAddress;
107
136
  btcGetPublicKey: typeof btcGetPublicKey;
108
137
  btcSignMessage: typeof btcSignMessage;
109
138
  btcSignTransaction: typeof btcSignTransaction;
110
139
  btcVerifyMessage: typeof btcVerifyMessage;
111
140
 
141
+ /**
142
+ * Starcoin function
143
+ */
112
144
  starcoinGetAddress: typeof starcoinGetAddress;
113
145
  starcoinGetPublicKey: typeof starcoinGetPublicKey;
114
146
  starcoinSignMessage: typeof starcoinSignMessage;
115
147
  starcoinSignTransaction: typeof starcoinSignTransaction;
116
148
  starcoinVerifyMessage: typeof starcoinVerifyMessage;
117
149
 
150
+ /**
151
+ * Nem function
152
+ */
118
153
  nemGetAddress: typeof nemGetAddress;
119
154
  nemSignTransaction: typeof nemSignTransaction;
120
155
 
156
+ /**
157
+ * Solana function
158
+ */
121
159
  solGetAddress: typeof solGetAddress;
122
160
  solSignTransaction: typeof solSignTransaction;
123
161
 
162
+ /**
163
+ * Stellar function
164
+ */
124
165
  stellarGetAddress: typeof stellarGetAddress;
125
166
  stellarSignTransaction: typeof stellarSignTransaction;
126
167
 
127
- firmwareUpdate: typeof firmwareUpdate;
168
+ /**
169
+ * Tron function
170
+ */
171
+ tronGetAddress: typeof tronGetAddress;
172
+ tronSignMessage: typeof tronSignMessage;
173
+ tronSignTransaction: typeof tronSignTransaction;
174
+
175
+ /**
176
+ * Conflux function
177
+ */
178
+ confluxGetAddress: typeof confluxGetAddress;
179
+ confluxSignMessage: typeof confluxSignMessage;
180
+ confluxSignMessageCIP23: typeof confluxSignMessageCIP23;
181
+ confluxSignTransaction: typeof confluxSignTransaction;
182
+
183
+ /**
184
+ * Near function
185
+ */
186
+ nearGetAddress: typeof nearGetAddress;
187
+ nearSignTransaction: typeof nearSignTransaction;
188
+
189
+ /**
190
+ * Aptos function
191
+ */
192
+ aptosGetAddress: typeof aptosGetAddress;
193
+ aptosSignTransaction: typeof aptosSignTransaction;
128
194
  };
@@ -0,0 +1,23 @@
1
+ import { NearAddress as HardwareNearAddress } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type NearAddress = {
5
+ path: string;
6
+ } & HardwareNearAddress;
7
+
8
+ export type NearGetAddressParams = {
9
+ path: string | number[];
10
+ showOnOneKey?: boolean;
11
+ };
12
+
13
+ export declare function nearGetAddress(
14
+ connectId: string,
15
+ deviceId: string,
16
+ params: CommonParams & NearGetAddressParams,
17
+ ): Response<NearAddress>;
18
+
19
+ export declare function nearGetAddress(
20
+ connectId: string,
21
+ deviceId: string,
22
+ params: CommonParams & { bundle?: NearGetAddressParams[] },
23
+ ): Response<Array<NearAddress>>;
@@ -0,0 +1,13 @@
1
+ import { NearSignedTx } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type NearSignTransactionParams = {
5
+ path: string | number[];
6
+ rawTx: string;
7
+ };
8
+
9
+ export declare function nearSignTransaction(
10
+ connectId: string,
11
+ deviceId: string,
12
+ params: CommonParams & NearSignTransactionParams,
13
+ ): Response<NearSignedTx>;
@@ -0,0 +1,23 @@
1
+ import { TronAddress as HardwareTronAddress } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type TronAddress = {
5
+ path: string;
6
+ } & HardwareTronAddress;
7
+
8
+ export type TronGetAddressParams = {
9
+ path: string | number[];
10
+ showOnOneKey?: boolean;
11
+ };
12
+
13
+ export declare function tronGetAddress(
14
+ connectId: string,
15
+ deviceId: string,
16
+ params: CommonParams & TronGetAddressParams,
17
+ ): Response<TronAddress>;
18
+
19
+ export declare function tronGetAddress(
20
+ connectId: string,
21
+ deviceId: string,
22
+ params: CommonParams & { bundle?: TronGetAddressParams[] },
23
+ ): Response<Array<TronAddress>>;
@@ -0,0 +1,13 @@
1
+ import { TronMessageSignature } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type TronSignMessageParams = {
5
+ path: string | number[];
6
+ messageHex: string;
7
+ };
8
+
9
+ export declare function tronSignMessage(
10
+ connectId: string,
11
+ deviceId: string,
12
+ params: CommonParams & TronSignMessageParams
13
+ ): Response<TronMessageSignature>;
@@ -0,0 +1,41 @@
1
+ import { UintType, TronSignedTx } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type TronTransferContract = {
5
+ toAddress?: string;
6
+ amount?: UintType;
7
+ };
8
+
9
+ export type TronTriggerSmartContract = {
10
+ contractAddress?: string;
11
+ callValue?: number;
12
+ data?: string;
13
+ callTokenValue?: number;
14
+ assetId?: number;
15
+ };
16
+
17
+ export type TronTransactionContract = {
18
+ transferContract?: TronTransferContract;
19
+ triggerSmartContract?: TronTriggerSmartContract;
20
+ };
21
+
22
+ export type TronTransaction = {
23
+ refBlockBytes: string;
24
+ refBlockHash: string;
25
+ expiration: number;
26
+ data?: string;
27
+ contract: TronTransactionContract;
28
+ timestamp: number;
29
+ feeLimit?: number;
30
+ };
31
+
32
+ export type TronSignTransactionParams = {
33
+ path: string | number[];
34
+ transaction: TronTransaction;
35
+ };
36
+
37
+ export declare function tronSignTransaction(
38
+ connectId: string,
39
+ deviceId: string,
40
+ params: CommonParams & TronSignTransactionParams,
41
+ ): Response<TronSignedTx>;
@@ -56,9 +56,9 @@ export const getDeviceTypeByDeviceId = (deviceId?: string): IDeviceType => {
56
56
  export const getDeviceUUID = (features: Features) => {
57
57
  const deviceType = getDeviceType(features);
58
58
  if (deviceType === 'classic') {
59
- return features.onekey_serial;
59
+ return features.onekey_serial ?? '';
60
60
  }
61
- return features.serial_no;
61
+ return features.serial_no ?? '';
62
62
  };
63
63
 
64
64
  export const getDeviceLabel = (features: Features) => {