@onekeyfe/hd-core 0.0.6 → 0.0.9

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 (93) hide show
  1. package/dist/api/BaseMethod.d.ts +2 -0
  2. package/dist/api/BaseMethod.d.ts.map +1 -1
  3. package/dist/api/CipherKeyValue.d.ts +9 -0
  4. package/dist/api/CipherKeyValue.d.ts.map +1 -0
  5. package/dist/api/SearchDevices.d.ts +1 -1
  6. package/dist/api/SearchDevices.d.ts.map +1 -1
  7. package/dist/api/device/DeviceRebootToBootloader.d.ts +8 -0
  8. package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
  9. package/dist/api/evm/EVMSignMessageEIP712.d.ts +5 -0
  10. package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
  11. package/dist/api/evm/EVMSignTransaction.d.ts +5 -0
  12. package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
  13. package/dist/api/evm/EVMSignTypedData.d.ts +7 -1
  14. package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
  15. package/dist/api/helpers/hexUtils.d.ts.map +1 -1
  16. package/dist/api/index.d.ts +7 -0
  17. package/dist/api/index.d.ts.map +1 -1
  18. package/dist/api/nem/NEMGetAddress.d.ts +9 -0
  19. package/dist/api/nem/NEMGetAddress.d.ts.map +1 -0
  20. package/dist/api/nem/NEMSignTransaction.d.ts +20 -0
  21. package/dist/api/nem/NEMSignTransaction.d.ts.map +1 -0
  22. package/dist/api/solana/SolGetAddress.d.ts +9 -0
  23. package/dist/api/solana/SolGetAddress.d.ts.map +1 -0
  24. package/dist/api/solana/SolSignTransaction.d.ts +17 -0
  25. package/dist/api/solana/SolSignTransaction.d.ts.map +1 -0
  26. package/dist/api/stellar/StellarGetAddress.d.ts +9 -0
  27. package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -0
  28. package/dist/api/stellar/StellarSignTransaction.d.ts +335 -0
  29. package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -0
  30. package/dist/core/index.d.ts.map +1 -1
  31. package/dist/data/version.d.ts +1 -1
  32. package/dist/data/version.d.ts.map +1 -1
  33. package/dist/events/ui-request.d.ts +1 -1
  34. package/dist/events/ui-request.d.ts.map +1 -1
  35. package/dist/index.d.ts +301 -3
  36. package/dist/index.js +755 -21
  37. package/dist/inject.d.ts.map +1 -1
  38. package/dist/types/api/cipherKeyValue.d.ts +19 -0
  39. package/dist/types/api/cipherKeyValue.d.ts.map +1 -0
  40. package/dist/types/api/export.d.ts +7 -0
  41. package/dist/types/api/export.d.ts.map +1 -1
  42. package/dist/types/api/index.d.ts +14 -0
  43. package/dist/types/api/index.d.ts.map +1 -1
  44. package/dist/types/api/nemGetAddress.d.ts +15 -0
  45. package/dist/types/api/nemGetAddress.d.ts.map +1 -0
  46. package/dist/types/api/nemSignTransaction.d.ts +93 -0
  47. package/dist/types/api/nemSignTransaction.d.ts.map +1 -0
  48. package/dist/types/api/solGetAddress.d.ts +14 -0
  49. package/dist/types/api/solGetAddress.d.ts.map +1 -0
  50. package/dist/types/api/solSignTransaction.d.ts +14 -0
  51. package/dist/types/api/solSignTransaction.d.ts.map +1 -0
  52. package/dist/types/api/stellarGetAddress.d.ts +14 -0
  53. package/dist/types/api/stellarGetAddress.d.ts.map +1 -0
  54. package/dist/types/api/stellarSignTransaction.d.ts +130 -0
  55. package/dist/types/api/stellarSignTransaction.d.ts.map +1 -0
  56. package/dist/types/device.d.ts +7 -0
  57. package/dist/types/device.d.ts.map +1 -1
  58. package/dist/utils/deviceFeaturesUtils.d.ts +51 -2
  59. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  60. package/dist/utils/index.d.ts +1 -1
  61. package/dist/utils/index.d.ts.map +1 -1
  62. package/package.json +3 -3
  63. package/src/api/BaseMethod.ts +5 -0
  64. package/src/api/CipherKeyValue.ts +66 -0
  65. package/src/api/SearchDevices.ts +2 -2
  66. package/src/api/device/DeviceRebootToBootloader.ts +11 -0
  67. package/src/api/evm/EVMSignMessageEIP712.ts +8 -0
  68. package/src/api/evm/EVMSignTransaction.ts +15 -0
  69. package/src/api/evm/EVMSignTypedData.ts +55 -15
  70. package/src/api/helpers/hexUtils.ts +0 -1
  71. package/src/api/index.ts +10 -0
  72. package/src/api/nem/NEMGetAddress.ts +61 -0
  73. package/src/api/nem/NEMSignTransaction.ts +246 -0
  74. package/src/api/solana/SolGetAddress.ts +59 -0
  75. package/src/api/solana/SolSignTransaction.ts +69 -0
  76. package/src/api/stellar/StellarGetAddress.ts +59 -0
  77. package/src/api/stellar/StellarSignTransaction.ts +213 -0
  78. package/src/core/index.ts +50 -6
  79. package/src/data/version.ts +1 -1
  80. package/src/events/ui-request.ts +1 -1
  81. package/src/inject.ts +15 -0
  82. package/src/types/api/cipherKeyValue.ts +26 -0
  83. package/src/types/api/export.ts +27 -0
  84. package/src/types/api/index.ts +18 -0
  85. package/src/types/api/nemGetAddress.ts +22 -0
  86. package/src/types/api/nemSignTransaction.ts +117 -0
  87. package/src/types/api/solGetAddress.ts +21 -0
  88. package/src/types/api/solSignTransaction.ts +21 -0
  89. package/src/types/api/stellarGetAddress.ts +21 -0
  90. package/src/types/api/stellarSignTransaction.ts +153 -0
  91. package/src/types/device.ts +8 -0
  92. package/src/utils/deviceFeaturesUtils.ts +34 -2
  93. package/src/utils/index.ts +7 -1
@@ -0,0 +1,69 @@
1
+ import { SolanaSignTx as HardwareSolanaSignTx } from '@onekeyfe/hd-transport/src/types/messages';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
+ import { serializedPath, validatePath } from '../helpers/pathUtils';
4
+ import { BaseMethod } from '../BaseMethod';
5
+ import { validateParams } from '../helpers/paramsValidator';
6
+ import { SolanaSignedTx, SolanaSignTransactionParams } from '../../types';
7
+ import { formatAnyHex } from '../helpers/hexUtils';
8
+
9
+ export default class SolSignTransaction extends BaseMethod<HardwareSolanaSignTx[]> {
10
+ hasBundle = false;
11
+
12
+ init() {
13
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
14
+
15
+ this.hasBundle = !!this.payload?.bundle;
16
+ const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
17
+
18
+ // check payload
19
+ validateParams(payload, [{ name: 'bundle', type: 'array' }]);
20
+
21
+ // init params
22
+ this.params = [];
23
+ payload.bundle.forEach((batch: SolanaSignTransactionParams) => {
24
+ const addressN = validatePath(batch.path, 3);
25
+
26
+ validateParams(batch, [
27
+ { name: 'path', required: true },
28
+ { name: 'rawTx', type: 'hexString', required: true },
29
+ ]);
30
+
31
+ this.params.push({
32
+ address_n: addressN,
33
+ raw_tx: formatAnyHex(batch.rawTx),
34
+ });
35
+ });
36
+ }
37
+
38
+ getVersionRange() {
39
+ return {
40
+ classic: {
41
+ min: '2.1.9',
42
+ },
43
+ mini: {
44
+ min: '2.1.9',
45
+ },
46
+ };
47
+ }
48
+
49
+ async run() {
50
+ const responses: SolanaSignedTx[] = [];
51
+
52
+ for (let i = 0; i < this.params.length; i++) {
53
+ const param = this.params[i];
54
+
55
+ const res = await this.device.commands.typedCall('SolanaSignTx', 'SolanaSignedTx', {
56
+ ...param,
57
+ });
58
+
59
+ const { signature } = res.message;
60
+
61
+ responses.push({
62
+ path: serializedPath(param.address_n),
63
+ signature,
64
+ });
65
+ }
66
+
67
+ return Promise.resolve(this.hasBundle ? responses : responses[0]);
68
+ }
69
+ }
@@ -0,0 +1,59 @@
1
+ import { StellarGetAddress as HardwareStellarGetAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
+ import { serializedPath, validatePath } from '../helpers/pathUtils';
4
+ import { BaseMethod } from '../BaseMethod';
5
+ import { validateParams } from '../helpers/paramsValidator';
6
+ import { StellarGetAddressParams, StellarAddress } from '../../types';
7
+
8
+ export default class StellarGetAddress extends BaseMethod<HardwareStellarGetAddress[]> {
9
+ hasBundle = false;
10
+
11
+ init() {
12
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
13
+
14
+ this.hasBundle = !!this.payload?.bundle;
15
+ const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
16
+
17
+ // check payload
18
+ validateParams(payload, [{ name: 'bundle', type: 'array' }]);
19
+
20
+ // init params
21
+ this.params = [];
22
+ payload.bundle.forEach((batch: StellarGetAddressParams) => {
23
+ const addressN = validatePath(batch.path, 3);
24
+
25
+ validateParams(batch, [
26
+ { name: 'path', required: true },
27
+ { name: 'showOnOneKey', type: 'boolean' },
28
+ ]);
29
+
30
+ const showOnOneKey = batch.showOnOneKey ?? true;
31
+
32
+ this.params.push({
33
+ address_n: addressN,
34
+ show_display: showOnOneKey,
35
+ });
36
+ });
37
+ }
38
+
39
+ async run() {
40
+ const responses: StellarAddress[] = [];
41
+
42
+ for (let i = 0; i < this.params.length; i++) {
43
+ const param = this.params[i];
44
+
45
+ const res = await this.device.commands.typedCall('StellarGetAddress', 'StellarAddress', {
46
+ ...param,
47
+ });
48
+
49
+ const { address } = res.message;
50
+
51
+ responses.push({
52
+ path: serializedPath(param.address_n),
53
+ address,
54
+ });
55
+ }
56
+
57
+ return Promise.resolve(this.hasBundle ? responses : responses[0]);
58
+ }
59
+ }
@@ -0,0 +1,213 @@
1
+ import {
2
+ StellarSignedTx,
3
+ StellarSignTx as HardwareStellarSignTx,
4
+ } from '@onekeyfe/hd-transport/src/types/messages';
5
+ import { UI_REQUEST } from '../../constants/ui-request';
6
+ import { validatePath } from '../helpers/pathUtils';
7
+ import { BaseMethod } from '../BaseMethod';
8
+ import { validateParams } from '../helpers/paramsValidator';
9
+ import { StellarOperation, StellarSignTransactionParams } from '../../types';
10
+
11
+ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSignTx> {
12
+ operations: any[] = [];
13
+
14
+ parseOperation = (op: StellarOperation) => {
15
+ switch (op.type) {
16
+ case 'createAccount':
17
+ validateParams(op, [
18
+ { name: 'destination', type: 'string', required: true },
19
+ { name: 'startingBalance', type: 'bigNumber', required: true },
20
+ ]);
21
+ return {
22
+ type: 'StellarCreateAccountOp',
23
+ source_account: op.source,
24
+ new_account: op.destination,
25
+ starting_balance: op.startingBalance,
26
+ };
27
+
28
+ case 'payment':
29
+ validateParams(op, [
30
+ { name: 'destination', type: 'string', required: true },
31
+ { name: 'amount', type: 'bigNumber', required: true },
32
+ { name: 'asset', required: true },
33
+ ]);
34
+ return {
35
+ type: 'StellarPaymentOp',
36
+ source_account: op.source,
37
+ destination_account: op.destination,
38
+ asset: op.asset,
39
+ amount: op.amount,
40
+ };
41
+
42
+ case 'pathPayment':
43
+ validateParams(op, [{ name: 'destAmount', type: 'bigNumber', required: true }]);
44
+ return {
45
+ type: 'StellarPathPaymentOp',
46
+ source_account: op.source,
47
+ send_asset: op.sendAsset,
48
+ send_max: op.sendMax,
49
+ destination_account: op.destination,
50
+ destination_asset: op.destAsset,
51
+ destination_amount: op.destAmount,
52
+ paths: op.path,
53
+ };
54
+
55
+ case 'createPassiveOffer':
56
+ validateParams(op, [{ name: 'amount', type: 'bigNumber', required: true }]);
57
+ return {
58
+ type: 'StellarCreatePassiveOfferOp',
59
+ source_account: op.source,
60
+ buying_asset: op.buying,
61
+ selling_asset: op.selling,
62
+ amount: op.amount,
63
+ price_n: op.price.n,
64
+ price_d: op.price.d,
65
+ };
66
+
67
+ case 'manageOffer':
68
+ validateParams(op, [{ name: 'amount', type: 'bigNumber', required: true }]);
69
+ return {
70
+ type: 'StellarManageOfferOp',
71
+ source_account: op.source,
72
+ buying_asset: op.buying,
73
+ selling_asset: op.selling,
74
+ amount: op.amount,
75
+ offer_id: op.offerId,
76
+ price_n: op.price.n,
77
+ price_d: op.price.d,
78
+ };
79
+
80
+ case 'setOptions': {
81
+ const signer = op.signer
82
+ ? {
83
+ signer_type: op.signer.type,
84
+ signer_key: op.signer.key,
85
+ signer_weight: op.signer.weight,
86
+ }
87
+ : undefined;
88
+ return {
89
+ type: 'StellarSetOptionsOp',
90
+ source_account: op.source,
91
+ clear_flags: op.clearFlags,
92
+ set_flags: op.setFlags,
93
+ master_weight: op.masterWeight,
94
+ low_threshold: op.lowThreshold,
95
+ medium_threshold: op.medThreshold,
96
+ high_threshold: op.highThreshold,
97
+ home_domain: op.homeDomain,
98
+ inflation_destination_account: op.inflationDest,
99
+ ...signer,
100
+ };
101
+ }
102
+
103
+ case 'changeTrust':
104
+ validateParams(op, [{ name: 'limit', type: 'bigNumber' }]);
105
+ return {
106
+ type: 'StellarChangeTrustOp',
107
+ source_account: op.source,
108
+ asset: op.line,
109
+ limit: op.limit,
110
+ };
111
+
112
+ case 'allowTrust':
113
+ return {
114
+ type: 'StellarAllowTrustOp',
115
+ source_account: op.source,
116
+ trusted_account: op.trustor,
117
+ asset_type: op.assetType,
118
+ asset_code: op.assetCode,
119
+ is_authorized: op.authorize ? 1 : 0,
120
+ };
121
+
122
+ case 'accountMerge':
123
+ return {
124
+ type: 'StellarAccountMergeOp',
125
+ source_account: op.source,
126
+ destination_account: op.destination,
127
+ };
128
+
129
+ case 'manageData':
130
+ return {
131
+ type: 'StellarManageDataOp',
132
+ source_account: op.source,
133
+ key: op.name,
134
+ value: op.value,
135
+ };
136
+
137
+ case 'bumpSequence':
138
+ return {
139
+ type: 'StellarBumpSequenceOp',
140
+ source_account: op.source,
141
+ bump_to: op.bumpTo,
142
+ };
143
+ default:
144
+ return {};
145
+ }
146
+ };
147
+
148
+ init() {
149
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
150
+
151
+ // check payload
152
+ validateParams(this.payload, [
153
+ { name: 'path', required: true },
154
+ { name: 'networkPassphrase', type: 'string', required: true },
155
+ { name: 'transaction', type: 'object', required: true },
156
+ ]);
157
+
158
+ // init params
159
+ const addressN = validatePath(this.payload.path, 3);
160
+ const { transaction, networkPassphrase } = this.payload as StellarSignTransactionParams;
161
+
162
+ this.params = {
163
+ address_n: addressN,
164
+ network_passphrase: networkPassphrase,
165
+ source_account: transaction.source,
166
+ fee: transaction.fee,
167
+ sequence_number: transaction.sequence,
168
+ num_operations: transaction.operations.length,
169
+ };
170
+
171
+ if (transaction.timebounds) {
172
+ this.params.timebounds_start = transaction.timebounds.minTime;
173
+ this.params.timebounds_end = transaction.timebounds.maxTime;
174
+ }
175
+
176
+ if (transaction.memo) {
177
+ this.params.memo_type = transaction.memo.type;
178
+ this.params.memo_text = transaction.memo.text;
179
+ this.params.memo_id = transaction.memo.id;
180
+ this.params.memo_hash = transaction.memo.hash;
181
+ }
182
+
183
+ transaction.operations.forEach(op => {
184
+ const transformed = this.parseOperation(op);
185
+ if (transformed) {
186
+ this.operations.push(transformed);
187
+ }
188
+ });
189
+
190
+ console.log('StellarSignTransactionParams', this.params);
191
+ console.log('StellarSignTransactionOperations', this.operations);
192
+ }
193
+
194
+ processTxRequest = async (operations: any, index: number): Promise<StellarSignedTx> => {
195
+ const isLastOp = index + 1 >= operations.length;
196
+ const { type, ...op } = operations[index];
197
+
198
+ if (isLastOp) {
199
+ const response = await this.device.commands.typedCall(type, 'StellarSignedTx', op);
200
+ return response.message;
201
+ }
202
+
203
+ await this.device.commands.typedCall(type, 'StellarTxOpRequest', op);
204
+
205
+ return this.processTxRequest(operations, index + 1);
206
+ };
207
+
208
+ async run() {
209
+ await this.device.commands.typedCall('StellarSignTx', 'StellarTxOpRequest', { ...this.params });
210
+
211
+ return this.processTxRequest(this.operations, 0);
212
+ }
213
+ }
package/src/core/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import semver from 'semver';
1
2
  import EventEmitter from 'events';
2
3
  import { OneKeyDeviceInfo } from '@onekeyfe/hd-transport';
3
4
  import { ERRORS } from '../constants';
@@ -25,6 +26,11 @@ import type { BaseMethod } from '../api/BaseMethod';
25
26
  import type { ConnectSettings, KnownDevice } from '../types';
26
27
  import TransportManager from '../data-manager/TransportManager';
27
28
  import DeviceConnector from '../device/DeviceConnector';
29
+ import {
30
+ getDeviceFirmwareVersion,
31
+ getDeviceModel,
32
+ getDeviceType,
33
+ } from '../utils/deviceFeaturesUtils';
28
34
 
29
35
  const Log = initLog('Core');
30
36
 
@@ -100,11 +106,38 @@ export const callAPI = async (message: CoreMessage) => {
100
106
 
101
107
  try {
102
108
  const inner = async (): Promise<void> => {
103
- // check firmware status
104
- // const firmwareException = method.checkFirmwareRange();
105
- // if (firmwareException) {
106
- // return Promise.reject(ERRORS.TypedError('Device_FwException', firmwareException));
107
- // }
109
+ // check firmware version
110
+ const deviceType = getDeviceType(device.features);
111
+ const deviceModel = getDeviceModel(device.features);
112
+ const versionRangeType = method.getVersionRange()[deviceType];
113
+ const versionRangeModel = method.getVersionRange()[deviceModel];
114
+
115
+ // Type has a higher priority than Model
116
+ const versionRange = versionRangeType ?? versionRangeModel;
117
+
118
+ if (versionRange && device.features) {
119
+ const currentVersion = getDeviceFirmwareVersion(device.features).join('.');
120
+ if (semver.valid(versionRange.min) && semver.lt(currentVersion, versionRange.min)) {
121
+ return Promise.reject(
122
+ ERRORS.TypedError(
123
+ 'Device_FwException',
124
+ `Device firmware version is too low, please update to ${versionRange.min}`
125
+ )
126
+ );
127
+ }
128
+ if (
129
+ versionRange.max &&
130
+ semver.valid(versionRange.max) &&
131
+ semver.gt(currentVersion, versionRange.max)
132
+ ) {
133
+ return Promise.reject(
134
+ ERRORS.TypedError(
135
+ 'Device_FwException',
136
+ `Device firmware version is too high, this method has been deprecated in ${versionRange.max}`
137
+ )
138
+ );
139
+ }
140
+ }
108
141
 
109
142
  // check call method mode
110
143
  const unexpectedMode = device.hasUnexpectedMode(
@@ -149,6 +182,7 @@ export const callAPI = async (message: CoreMessage) => {
149
182
  } catch (error) {
150
183
  messageResponse = createResponseMessage(method.responseID, false, error);
151
184
  _callPromise?.reject(ERRORS.TypedError('Call_API', error));
185
+ Log.debug('Call API - Run Error: ', error);
152
186
  } finally {
153
187
  const response = messageResponse;
154
188
 
@@ -251,7 +285,17 @@ const onDevicePinHandler = async (...[device, type, callback]: DeviceEvents['pin
251
285
 
252
286
  const onDeviceButtonHandler = (...[device, request]: [...DeviceEvents['button']]) => {
253
287
  postMessage(createDeviceMessage(DEVICE.BUTTON, { ...request, device: device.toMessageObject() }));
254
- postMessage(createUiMessage(UI_REQUEST.REQUEST_BUTTON, { device: device.toMessageObject() }));
288
+
289
+ if (request.code === 'ButtonRequest_PinEntry') {
290
+ postMessage(
291
+ createUiMessage(UI_REQUEST.REQUEST_PIN, {
292
+ device: device.toMessageObject() as KnownDevice,
293
+ type: 'ButtonRequest_PinEntry',
294
+ })
295
+ );
296
+ } else {
297
+ postMessage(createUiMessage(UI_REQUEST.REQUEST_BUTTON, { device: device.toMessageObject() }));
298
+ }
255
299
  };
256
300
 
257
301
  /**
@@ -1,3 +1,3 @@
1
1
  export const VERSION = '1.0.0-alpha.1';
2
2
 
3
- export const DEFAULT_DOMAIN = `https://localhost:8088/`;
3
+ export const DEFAULT_DOMAIN = `https://hardware-sdk.onekey.so/`;
@@ -28,7 +28,7 @@ export type UiRequestDeviceAction = {
28
28
  type: typeof UI_REQUEST.REQUEST_PIN;
29
29
  payload: {
30
30
  device: Device;
31
- type?: PROTO.PinMatrixRequestType;
31
+ type?: PROTO.PinMatrixRequestType | 'ButtonRequest_PinEntry';
32
32
  };
33
33
  };
34
34
 
package/src/inject.ts CHANGED
@@ -66,6 +66,8 @@ export const inject = ({
66
66
  */
67
67
  checkTransportRelease: () => call({ method: 'checkTransportRelease' }),
68
68
 
69
+ cipherKeyValue: (connectId, params) => call({ ...params, connectId, method: 'cipherKeyValue' }),
70
+
69
71
  deviceBackup: connectId => call({ connectId, method: 'deviceBackup' }),
70
72
  deviceChangePin: (connectId, params) =>
71
73
  call({ ...params, connectId, method: 'deviceChangePin' }),
@@ -109,6 +111,19 @@ export const inject = ({
109
111
  call({ ...params, connectId, method: 'starcoinSignTransaction' }),
110
112
  starcoinVerifyMessage: (connectId, params) =>
111
113
  call({ ...params, connectId, method: 'starcoinVerifyMessage' }),
114
+
115
+ nemGetAddress: (connectId, params) => call({ ...params, connectId, method: 'nemGetAddress' }),
116
+ nemSignTransaction: (connectId, params) =>
117
+ call({ ...params, connectId, method: 'nemSignTransaction' }),
118
+
119
+ solGetAddress: (connectId, params) => call({ ...params, connectId, method: 'solGetAddress' }),
120
+ solSignTransaction: (connectId, params) =>
121
+ call({ ...params, connectId, method: 'solSignTransaction' }),
122
+
123
+ stellarGetAddress: (connectId, params) =>
124
+ call({ ...params, connectId, method: 'stellarGetAddress' }),
125
+ stellarSignTransaction: (connectId, params) =>
126
+ call({ ...params, connectId, method: 'stellarSignTransaction' }),
112
127
  };
113
128
  return api;
114
129
  };
@@ -0,0 +1,26 @@
1
+ import { CipheredKeyValue as HardwareCipheredKeyValue } from '@onekeyfe/hd-transport/src/types/messages';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type CipheredKeyValue = {
5
+ path: string;
6
+ } & HardwareCipheredKeyValue;
7
+
8
+ export type CipheredKeyValueParams = {
9
+ path: string | number[];
10
+ key: string;
11
+ value: string;
12
+ encrypt?: boolean;
13
+ askOnEncrypt?: boolean;
14
+ askOnDecrypt?: boolean;
15
+ iv?: string;
16
+ };
17
+
18
+ export declare function cipherKeyValue(
19
+ connectId: string,
20
+ params: CommonParams & CipheredKeyValueParams
21
+ ): Response<CipheredKeyValue>;
22
+
23
+ export declare function cipherKeyValue(
24
+ connectId: string,
25
+ params: CommonParams & { bundle?: CipheredKeyValueParams[] }
26
+ ): Response<Array<CipheredKeyValue>>;
@@ -11,6 +11,8 @@ export type {
11
11
  TransactionOptions,
12
12
  } from './btcSignTransaction';
13
13
 
14
+ export type { CipheredKeyValue, CipheredKeyValueParams } from './cipherKeyValue';
15
+
14
16
  export type { DeviceChangePinParams } from './deviceChangePin';
15
17
  export type { DeviceFlagsParams } from './deviceFlags';
16
18
  export type { DeviceRecoveryParams } from './deviceRecovery';
@@ -41,3 +43,28 @@ export type { StarcoinPublicKey, StarcoinGetPublicKeyParams } from './starcoinGe
41
43
  export type { StarcoinSignMessageParams } from './starcoinSignMessage';
42
44
  export type { StarcoinSignTransactionParams } from './starcoinSignTransaction';
43
45
  export type { StarcoinVerifyMessageParams } from './starcoinVerifyMessage';
46
+
47
+ export type { NEMAddress, NEMGetAddressParams } from './nemGetAddress';
48
+ export type {
49
+ NEMAggregateModificationTransaction,
50
+ NEMImportanceTransaction,
51
+ NEMMosaic,
52
+ NEMMosaicCreationTransaction,
53
+ NEMMultisigTransaction,
54
+ NEMProvisionNamespaceTransaction,
55
+ NEMSupplyChangeTransaction,
56
+ NEMTransferTransaction,
57
+ NEMTransaction,
58
+ NEMSignTransactionParams,
59
+ } from './nemSignTransaction';
60
+
61
+ export type { SolanaAddress, SolanaGetAddressParams } from './solGetAddress';
62
+ export type { SolanaSignedTx, SolanaSignTransactionParams } from './solSignTransaction';
63
+
64
+ export type { StellarAddress, StellarGetAddressParams } from './stellarGetAddress';
65
+ export type {
66
+ StellarAsset,
67
+ StellarOperation,
68
+ StellarTransaction,
69
+ StellarSignTransactionParams,
70
+ } from './stellarSignTransaction';
@@ -32,6 +32,13 @@ import { starcoinGetPublicKey } from './starcoinGetPublicKey';
32
32
  import { starcoinSignMessage } from './starcoinSignMessage';
33
33
  import { starcoinSignTransaction } from './starcoinSignTransaction';
34
34
  import { starcoinVerifyMessage } from './starcoinVerifyMessage';
35
+ import { nemGetAddress } from './nemGetAddress';
36
+ import { nemSignTransaction } from './nemSignTransaction';
37
+ import { solGetAddress } from './solGetAddress';
38
+ import { solSignTransaction } from './solSignTransaction';
39
+ import { stellarGetAddress } from './stellarGetAddress';
40
+ import { stellarSignTransaction } from './stellarSignTransaction';
41
+ import { cipherKeyValue } from './cipherKeyValue';
35
42
 
36
43
  export * from './export';
37
44
 
@@ -61,6 +68,8 @@ export type CoreApi = {
61
68
 
62
69
  checkTransportRelease: typeof checkTransportRelease;
63
70
 
71
+ cipherKeyValue: typeof cipherKeyValue;
72
+
64
73
  deviceBackup: typeof deviceBackup;
65
74
  deviceChangePin: typeof deviceChangePin;
66
75
  deviceFlags: typeof deviceFlags;
@@ -90,4 +99,13 @@ export type CoreApi = {
90
99
  starcoinSignMessage: typeof starcoinSignMessage;
91
100
  starcoinSignTransaction: typeof starcoinSignTransaction;
92
101
  starcoinVerifyMessage: typeof starcoinVerifyMessage;
102
+
103
+ nemGetAddress: typeof nemGetAddress;
104
+ nemSignTransaction: typeof nemSignTransaction;
105
+
106
+ solGetAddress: typeof solGetAddress;
107
+ solSignTransaction: typeof solSignTransaction;
108
+
109
+ stellarGetAddress: typeof stellarGetAddress;
110
+ stellarSignTransaction: typeof stellarSignTransaction;
93
111
  };
@@ -0,0 +1,22 @@
1
+ import { NEMAddress as HardwareNEMAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type NEMAddress = {
5
+ path: string;
6
+ } & HardwareNEMAddress;
7
+
8
+ export type NEMGetAddressParams = {
9
+ path: string | number[];
10
+ network?: number;
11
+ showOnOneKey?: boolean;
12
+ };
13
+
14
+ export declare function nemGetAddress(
15
+ connectId: string,
16
+ params: CommonParams & NEMGetAddressParams
17
+ ): Response<NEMAddress>;
18
+
19
+ export declare function nemGetAddress(
20
+ connectId: string,
21
+ params: CommonParams & { bundle?: NEMGetAddressParams[] }
22
+ ): Response<Array<NEMAddress>>;