@onekeyfe/hd-core 1.0.9-alpha.1 → 1.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 (60) hide show
  1. package/dist/api/btc/BTCSignMessage.d.ts +4 -0
  2. package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
  3. package/dist/api/btc/BTCSignPsbt.d.ts +12 -0
  4. package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -0
  5. package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
  6. package/dist/api/index.d.ts +1 -3
  7. package/dist/api/index.d.ts.map +1 -1
  8. package/dist/device/DeviceCommands.d.ts.map +1 -1
  9. package/dist/index.d.ts +11 -69
  10. package/dist/index.js +110 -507
  11. package/dist/inject.d.ts.map +1 -1
  12. package/dist/types/api/btcSignMessage.d.ts +1 -0
  13. package/dist/types/api/btcSignMessage.d.ts.map +1 -1
  14. package/dist/types/api/btcSignPsbt.d.ts +8 -0
  15. package/dist/types/api/btcSignPsbt.d.ts.map +1 -0
  16. package/dist/types/api/deviceUploadResource.d.ts +0 -1
  17. package/dist/types/api/deviceUploadResource.d.ts.map +1 -1
  18. package/dist/types/api/export.d.ts +0 -3
  19. package/dist/types/api/export.d.ts.map +1 -1
  20. package/dist/types/api/index.d.ts +2 -6
  21. package/dist/types/api/index.d.ts.map +1 -1
  22. package/dist/utils/homescreen.d.ts +1 -13
  23. package/dist/utils/homescreen.d.ts.map +1 -1
  24. package/dist/utils/index.d.ts +1 -1
  25. package/dist/utils/index.d.ts.map +1 -1
  26. package/dist/utils/patch.d.ts +1 -1
  27. package/dist/utils/patch.d.ts.map +1 -1
  28. package/package.json +4 -4
  29. package/src/api/btc/BTCSignMessage.ts +26 -2
  30. package/src/api/btc/BTCSignPsbt.ts +43 -0
  31. package/src/api/device/DeviceUploadResource.ts +4 -5
  32. package/src/api/index.ts +1 -4
  33. package/src/data/messages/messages.json +31 -259
  34. package/src/device/DeviceCommands.ts +1 -0
  35. package/src/inject.ts +2 -7
  36. package/src/types/api/btcSignMessage.ts +1 -0
  37. package/src/types/api/btcSignPsbt.ts +13 -0
  38. package/src/types/api/deviceUploadResource.ts +0 -1
  39. package/src/types/api/export.ts +0 -4
  40. package/src/types/api/index.ts +2 -11
  41. package/src/utils/homescreen.ts +18 -89
  42. package/src/utils/index.ts +1 -1
  43. package/dist/api/ton/TonGetAddress.d.ts +0 -18
  44. package/dist/api/ton/TonGetAddress.d.ts.map +0 -1
  45. package/dist/api/ton/TonSignMessage.d.ts +0 -15
  46. package/dist/api/ton/TonSignMessage.d.ts.map +0 -1
  47. package/dist/api/ton/TonSignProof.d.ts +0 -15
  48. package/dist/api/ton/TonSignProof.d.ts.map +0 -1
  49. package/dist/types/api/tonGetAddress.d.ts +0 -21
  50. package/dist/types/api/tonGetAddress.d.ts.map +0 -1
  51. package/dist/types/api/tonSignMessage.d.ts +0 -21
  52. package/dist/types/api/tonSignMessage.d.ts.map +0 -1
  53. package/dist/types/api/tonSignProof.d.ts +0 -15
  54. package/dist/types/api/tonSignProof.d.ts.map +0 -1
  55. package/src/api/ton/TonGetAddress.ts +0 -94
  56. package/src/api/ton/TonSignMessage.ts +0 -74
  57. package/src/api/ton/TonSignProof.ts +0 -61
  58. package/src/types/api/tonGetAddress.ts +0 -30
  59. package/src/types/api/tonSignMessage.ts +0 -26
  60. package/src/types/api/tonSignProof.ts +0 -20
@@ -3,7 +3,6 @@ import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
3
3
  import { bytesToHex } from '@noble/hashes/utils';
4
4
  import { ResourceUpload, Success } from '@onekeyfe/hd-transport';
5
5
  import { blake2s } from '@noble/hashes/blake2s';
6
- import { isEmpty } from 'lodash';
7
6
  import { TypedResponseMessage } from '../../device/DeviceCommands';
8
7
  import { DeviceModelToTypes, DeviceUploadResourceParams } from '../../types';
9
8
  import { BaseMethod } from '../BaseMethod';
@@ -54,7 +53,7 @@ export default class DeviceUploadResource extends BaseMethod<ResourceUpload> {
54
53
  { name: 'thumbnailDataHex', type: 'string', required: true },
55
54
  { name: 'resType', type: 'number', required: true },
56
55
  { name: 'nftMetaData', type: 'string' },
57
- { name: 'fileNameNoExt', type: 'string' },
56
+ { name: 'file_name_no_ext', type: 'boolean' },
58
57
  ]);
59
58
 
60
59
  const { suffix, dataHex, thumbnailDataHex, resType, nftMetaData } = this
@@ -67,9 +66,9 @@ export default class DeviceUploadResource extends BaseMethod<ResourceUpload> {
67
66
  };
68
67
 
69
68
  const fileHash = bytesToHex(blake2s(this.payload.dataHex)).slice(0, 8);
70
- const file_name_no_ext = isEmpty(this.payload.fileNameNoExt)
71
- ? `${resType === 0 ? 'wp' : 'nft'}-${fileHash}-${Math.floor(Date.now() / 1000)}`
72
- : this.payload.fileNameNoExt;
69
+ const file_name_no_ext = `${resType === 0 ? 'wp' : 'nft'}-${fileHash}-${Math.floor(
70
+ Date.now() / 1000
71
+ )}`;
73
72
 
74
73
  this.params = {
75
74
  extension: suffix,
package/src/api/index.ts CHANGED
@@ -34,6 +34,7 @@ export { default as cipherKeyValue } from './CipherKeyValue';
34
34
  export { default as btcGetAddress } from './btc/BTCGetAddress';
35
35
  export { default as btcGetPublicKey } from './btc/BTCGetPublicKey';
36
36
  export { default as btcSignMessage } from './btc/BTCSignMessage';
37
+ export { default as btcSignPsbt } from './btc/BTCSignPsbt';
37
38
  export { default as btcSignTransaction } from './btc/BTCSignTransaction';
38
39
  export { default as btcVerifyMessage } from './btc/BTCVerifyMessage';
39
40
 
@@ -122,7 +123,3 @@ export { default as nervosSignTransaction } from './nervos/NervosSignTransaction
122
123
 
123
124
  export { default as dnxGetAddress } from './dynex/DnxGetAddress';
124
125
  export { default as dnxSignTransaction } from './dynex/DnxSignTransaction';
125
-
126
- export { default as tonGetAddress } from './ton/TonGetAddress';
127
- export { default as tonSignMessage } from './ton/TonSignMessage';
128
- export { default as tonSignProof } from './ton/TonSignProof';
@@ -645,6 +645,10 @@
645
645
  "no_script_type": {
646
646
  "type": "bool",
647
647
  "id": 5
648
+ },
649
+ "is_bip322_simple": {
650
+ "type": "bool",
651
+ "id": 10
648
652
  }
649
653
  }
650
654
  },
@@ -1600,6 +1604,31 @@
1600
1604
  }
1601
1605
  }
1602
1606
  },
1607
+ "SignPsbt": {
1608
+ "fields": {
1609
+ "psbt": {
1610
+ "rule": "required",
1611
+ "type": "bytes",
1612
+ "id": 1
1613
+ },
1614
+ "coin_name": {
1615
+ "type": "string",
1616
+ "id": 2,
1617
+ "options": {
1618
+ "default": "Bitcoin"
1619
+ }
1620
+ }
1621
+ }
1622
+ },
1623
+ "SignedPsbt": {
1624
+ "fields": {
1625
+ "psbt": {
1626
+ "rule": "required",
1627
+ "type": "bytes",
1628
+ "id": 1
1629
+ }
1630
+ }
1631
+ },
1603
1632
  "SelfTest": {
1604
1633
  "fields": {
1605
1634
  "payload": {
@@ -2534,10 +2563,6 @@
2534
2563
  "rule": "required",
2535
2564
  "type": "uint32",
2536
2565
  "id": 4
2537
- },
2538
- "address_type": {
2539
- "type": "CardanoAddressType",
2540
- "id": 5
2541
2566
  }
2542
2567
  }
2543
2568
  },
@@ -10104,255 +10129,6 @@
10104
10129
  }
10105
10130
  }
10106
10131
  },
10107
- "TonWalletVersion": {
10108
- "values": {
10109
- "V3R1": 0,
10110
- "V3R2": 1,
10111
- "V4R1": 2,
10112
- "V4R2": 3
10113
- }
10114
- },
10115
- "TonWorkChain": {
10116
- "values": {
10117
- "BASECHAIN": 0,
10118
- "MASTERCHAIN": 1
10119
- }
10120
- },
10121
- "TonGetAddress": {
10122
- "fields": {
10123
- "address_n": {
10124
- "rule": "repeated",
10125
- "type": "uint32",
10126
- "id": 1,
10127
- "options": {
10128
- "packed": false
10129
- }
10130
- },
10131
- "show_display": {
10132
- "type": "bool",
10133
- "id": 2
10134
- },
10135
- "wallet_version": {
10136
- "type": "TonWalletVersion",
10137
- "id": 3,
10138
- "options": {
10139
- "default": "V3R2"
10140
- }
10141
- },
10142
- "is_bounceable": {
10143
- "type": "bool",
10144
- "id": 4,
10145
- "options": {
10146
- "default": false
10147
- }
10148
- },
10149
- "is_testnet_only": {
10150
- "type": "bool",
10151
- "id": 5,
10152
- "options": {
10153
- "default": false
10154
- }
10155
- },
10156
- "workchain": {
10157
- "type": "TonWorkChain",
10158
- "id": 6,
10159
- "options": {
10160
- "default": "BASECHAIN"
10161
- }
10162
- },
10163
- "wallet_id": {
10164
- "type": "uint32",
10165
- "id": 7,
10166
- "options": {
10167
- "default": 698983191
10168
- }
10169
- }
10170
- }
10171
- },
10172
- "TonAddress": {
10173
- "fields": {
10174
- "public_key": {
10175
- "rule": "required",
10176
- "type": "bytes",
10177
- "id": 1
10178
- },
10179
- "address": {
10180
- "rule": "required",
10181
- "type": "string",
10182
- "id": 2
10183
- }
10184
- }
10185
- },
10186
- "TonSignMessage": {
10187
- "fields": {
10188
- "address_n": {
10189
- "rule": "repeated",
10190
- "type": "uint32",
10191
- "id": 1,
10192
- "options": {
10193
- "packed": false
10194
- }
10195
- },
10196
- "destination": {
10197
- "rule": "required",
10198
- "type": "string",
10199
- "id": 2
10200
- },
10201
- "jetton_master_address": {
10202
- "type": "string",
10203
- "id": 3
10204
- },
10205
- "ton_amount": {
10206
- "rule": "required",
10207
- "type": "uint64",
10208
- "id": 4
10209
- },
10210
- "jetton_amount": {
10211
- "type": "uint64",
10212
- "id": 5
10213
- },
10214
- "fwd_fee": {
10215
- "type": "uint64",
10216
- "id": 6,
10217
- "options": {
10218
- "default": 0
10219
- }
10220
- },
10221
- "comment": {
10222
- "type": "string",
10223
- "id": 7
10224
- },
10225
- "mode": {
10226
- "type": "uint32",
10227
- "id": 8,
10228
- "options": {
10229
- "default": 3
10230
- }
10231
- },
10232
- "seqno": {
10233
- "rule": "required",
10234
- "type": "uint32",
10235
- "id": 9
10236
- },
10237
- "expire_at": {
10238
- "rule": "required",
10239
- "type": "uint64",
10240
- "id": 10
10241
- },
10242
- "wallet_version": {
10243
- "type": "TonWalletVersion",
10244
- "id": 11,
10245
- "options": {
10246
- "default": "V4R2"
10247
- }
10248
- },
10249
- "wallet_id": {
10250
- "type": "uint32",
10251
- "id": 12,
10252
- "options": {
10253
- "default": 698983191
10254
- }
10255
- },
10256
- "workchain": {
10257
- "type": "TonWorkChain",
10258
- "id": 13,
10259
- "options": {
10260
- "default": "BASECHAIN"
10261
- }
10262
- },
10263
- "is_bounceable": {
10264
- "type": "bool",
10265
- "id": 14,
10266
- "options": {
10267
- "default": false
10268
- }
10269
- },
10270
- "is_testnet_only": {
10271
- "type": "bool",
10272
- "id": 15,
10273
- "options": {
10274
- "default": false
10275
- }
10276
- }
10277
- }
10278
- },
10279
- "TonSignedMessage": {
10280
- "fields": {
10281
- "signature": {
10282
- "type": "bytes",
10283
- "id": 1
10284
- }
10285
- }
10286
- },
10287
- "TonSignProof": {
10288
- "fields": {
10289
- "address_n": {
10290
- "rule": "repeated",
10291
- "type": "uint32",
10292
- "id": 1,
10293
- "options": {
10294
- "packed": false
10295
- }
10296
- },
10297
- "appdomain": {
10298
- "rule": "required",
10299
- "type": "bytes",
10300
- "id": 2
10301
- },
10302
- "comment": {
10303
- "type": "bytes",
10304
- "id": 3
10305
- },
10306
- "expire_at": {
10307
- "rule": "required",
10308
- "type": "uint64",
10309
- "id": 4
10310
- },
10311
- "wallet_version": {
10312
- "type": "TonWalletVersion",
10313
- "id": 5,
10314
- "options": {
10315
- "default": "V4R2"
10316
- }
10317
- },
10318
- "wallet_id": {
10319
- "type": "uint32",
10320
- "id": 6,
10321
- "options": {
10322
- "default": 698983191
10323
- }
10324
- },
10325
- "workchain": {
10326
- "type": "TonWorkChain",
10327
- "id": 7,
10328
- "options": {
10329
- "default": "BASECHAIN"
10330
- }
10331
- },
10332
- "is_bounceable": {
10333
- "type": "bool",
10334
- "id": 8,
10335
- "options": {
10336
- "default": false
10337
- }
10338
- },
10339
- "is_testnet_only": {
10340
- "type": "bool",
10341
- "id": 9,
10342
- "options": {
10343
- "default": false
10344
- }
10345
- }
10346
- }
10347
- },
10348
- "TonSignedProof": {
10349
- "fields": {
10350
- "signature": {
10351
- "type": "bytes",
10352
- "id": 1
10353
- }
10354
- }
10355
- },
10356
10132
  "TronGetAddress": {
10357
10133
  "fields": {
10358
10134
  "address_n": {
@@ -10969,6 +10745,8 @@
10969
10745
  "MessageType_TezosSignedTx": 153,
10970
10746
  "MessageType_TezosGetPublicKey": 154,
10971
10747
  "MessageType_TezosPublicKey": 155,
10748
+ "MessageType_SignPsbt": 10052,
10749
+ "MessageType_SignedPsbt": 10053,
10972
10750
  "MessageType_StellarSignTx": 202,
10973
10751
  "MessageType_StellarTxOpRequest": 203,
10974
10752
  "MessageType_StellarGetAddress": 207,
@@ -11196,12 +10974,6 @@
11196
10974
  "MessageType_DnxInputAck": 11804,
11197
10975
  "MessageType_DnxRTSigsRequest": 11805,
11198
10976
  "MessageType_DnxSignedTx": 11806,
11199
- "MessageType_TonGetAddress": 11901,
11200
- "MessageType_TonAddress": 11902,
11201
- "MessageType_TonSignMessage": 11903,
11202
- "MessageType_TonSignedMessage": 11904,
11203
- "MessageType_TonSignProof": 11905,
11204
- "MessageType_TonSignedProof": 11906,
11205
10977
  "MessageType_DeviceBackToBoot": 903,
11206
10978
  "MessageType_DeviceInfoSettings": 10001,
11207
10979
  "MessageType_GetDeviceInfo": 10002,
@@ -76,6 +76,7 @@ export class DeviceCommands {
76
76
  this.callPromise = promise;
77
77
  const res = await promise;
78
78
  Log.debug('[DeviceCommands] [call] Received', res.type);
79
+ console.log('[DeviceCommands] [call] Received', res.type);
79
80
  return res;
80
81
  } catch (error) {
81
82
  Log.debug('[DeviceCommands] [call] Received error', error);
package/src/inject.ts CHANGED
@@ -152,6 +152,8 @@ export const createCoreApi = (
152
152
  call({ ...params, connectId, deviceId, method: 'btcGetPublicKey' }),
153
153
  btcSignMessage: (connectId, deviceId, params) =>
154
154
  call({ ...params, connectId, deviceId, method: 'btcSignMessage' }),
155
+ btcSignPsbt: (connectId, deviceId, params) =>
156
+ call({ ...params, connectId, deviceId, method: 'btcSignPsbt' }),
155
157
  btcSignTransaction: (connectId, deviceId, params) =>
156
158
  call({ ...params, connectId, deviceId, method: 'btcSignTransaction' }),
157
159
  btcVerifyMessage: (connectId, deviceId, params) =>
@@ -294,11 +296,4 @@ export const createCoreApi = (
294
296
  call({ ...params, connectId, deviceId, method: 'dnxGetAddress' }),
295
297
  dnxSignTransaction: (connectId, deviceId, params) =>
296
298
  call({ ...params, connectId, deviceId, method: 'dnxSignTransaction' }),
297
-
298
- tonGetAddress: (connectId, deviceId, params) =>
299
- call({ ...params, connectId, deviceId, method: 'tonGetAddress' }),
300
- tonSignMessage: (connectId, deviceId, params) =>
301
- call({ ...params, connectId, deviceId, method: 'tonSignMessage' }),
302
- tonSignProof: (connectId, deviceId, params) =>
303
- call({ ...params, connectId, deviceId, method: 'tonSignProof' }),
304
299
  });
@@ -6,6 +6,7 @@ export type BTCSignMessageParams = {
6
6
  messageHex: string;
7
7
  coin?: string;
8
8
  noScriptType?: boolean;
9
+ dAppSignType?: 'ecdsa' | 'bip322-simple';
9
10
  };
10
11
 
11
12
  export declare function btcSignMessage(
@@ -0,0 +1,13 @@
1
+ import { SignedPsbt } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type BTCSignPsbtParams = {
5
+ psbt: string;
6
+ coin?: string;
7
+ };
8
+
9
+ export declare function btcSignPsbt(
10
+ connectId: string,
11
+ deviceId: string,
12
+ params: CommonParams & BTCSignPsbtParams
13
+ ): Response<SignedPsbt>;
@@ -7,7 +7,6 @@ export type DeviceUploadResourceParams = {
7
7
  thumbnailDataHex: string;
8
8
  resType: ResourceType;
9
9
  nftMetaData: string;
10
- fileNameNoExt?: string;
11
10
  };
12
11
 
13
12
  export declare function deviceUploadResource(
@@ -152,7 +152,3 @@ export type { NervosSignedTx, NervosSignTransactionParams } from './nervosSignTr
152
152
 
153
153
  export type { DnxAddress, DnxGetAddressParams } from './dnxGetAddress';
154
154
  export type { DnxTxKey, DnxSignTransactionParams, DnxSignature } from './dnxSignTransaction';
155
-
156
- export type { TonAddress, TonGetAddressParams } from './tonGetAddress';
157
- export type { TonSignMessageParams } from './tonSignMessage';
158
- export type { TonSignProofParams } from './tonSignProof';
@@ -46,6 +46,7 @@ import { evmVerifyMessage } from './evmVerifyMessage';
46
46
  import { btcGetAddress } from './btcGetAddress';
47
47
  import { btcGetPublicKey } from './btcGetPublicKey';
48
48
  import { btcSignMessage } from './btcSignMessage';
49
+ import { btcSignPsbt } from './btcSignPsbt';
49
50
  import { btcSignTransaction } from './btcSignTransaction';
50
51
  import { btcVerifyMessage } from './btcVerifyMessage';
51
52
 
@@ -126,10 +127,6 @@ import { nervosSignTransaction } from './nervosSignTransaction';
126
127
  import { dnxGetAddress } from './dnxGetAddress';
127
128
  import { dnxSignTransaction } from './dnxSignTransaction';
128
129
 
129
- import { tonGetAddress } from './tonGetAddress';
130
- import { tonSignMessage } from './tonSignMessage';
131
- import { tonSignProof } from './tonSignProof';
132
-
133
130
  export * from './export';
134
131
 
135
132
  export type CoreApi = {
@@ -203,6 +200,7 @@ export type CoreApi = {
203
200
  btcGetAddress: typeof btcGetAddress;
204
201
  btcGetPublicKey: typeof btcGetPublicKey;
205
202
  btcSignMessage: typeof btcSignMessage;
203
+ btcSignPsbt: typeof btcSignPsbt;
206
204
  btcSignTransaction: typeof btcSignTransaction;
207
205
  btcVerifyMessage: typeof btcVerifyMessage;
208
206
 
@@ -346,11 +344,4 @@ export type CoreApi = {
346
344
  */
347
345
  dnxGetAddress: typeof dnxGetAddress;
348
346
  dnxSignTransaction: typeof dnxSignTransaction;
349
-
350
- /**
351
- * TON Network
352
- */
353
- tonGetAddress: typeof tonGetAddress;
354
- tonSignMessage: typeof tonSignMessage;
355
- tonSignProof: typeof tonSignProof;
356
347
  };
@@ -1,5 +1,4 @@
1
- import type { Features, IDeviceType } from '../types';
2
- import { getDeviceType } from './deviceInfoUtils';
1
+ import type { IDeviceType } from '../types';
3
2
 
4
3
  type IScreenData = { name: string; hex: string };
5
4
 
@@ -219,20 +218,22 @@ export const getT1Data = (): Record<string, IScreenData> => ({
219
218
  });
220
219
 
221
220
  export const getTouchData = (): Record<string, IScreenData> => ({
222
- 'wallpaper-1': { name: 'wallpaper-1', hex: '77616c6c70617065722d312e706e67' },
223
- 'wallpaper-2': { name: 'wallpaper-2', hex: '77616c6c70617065722d322e706e67' },
224
- 'wallpaper-3': { name: 'wallpaper-3', hex: '77616c6c70617065722d332e706e67' },
225
- 'wallpaper-4': { name: 'wallpaper-4', hex: '77616c6c70617065722d342e706e67' },
226
- });
227
- export const getProData = (): Record<string, IScreenData> => ({
228
- 'wallpaper-1': { name: 'wallpaper-1', hex: '77616c6c70617065722d312e6a7067' },
229
- 'wallpaper-2': { name: 'wallpaper-2', hex: '77616c6c70617065722d322e6a7067' },
230
- 'wallpaper-3': { name: 'wallpaper-3', hex: '77616c6c70617065722d332e6a7067' },
231
- 'wallpaper-4': { name: 'wallpaper-4', hex: '77616c6c70617065722d342e6a7067' },
232
- // Current version cannot be modified
233
- // 'wallpaper-5': { name: 'wallpaper-5', hex: '77616c6c70617065722d352e6a7067' },
234
- // 'wallpaper-6': { name: 'wallpaper-6', hex: '77616c6c70617065722d362e6a7067' },
235
- // 'wallpaper-7': { name: 'wallpaper-7', hex: '77616c6c70617065722d372e6a7067' },
221
+ 'wallpaper-1': {
222
+ name: 'wallpaper-1',
223
+ hex: '77616c6c70617065722d312e706e67',
224
+ },
225
+ 'wallpaper-2': {
226
+ name: 'wallpaper-2',
227
+ hex: '77616c6c70617065722d322e706e67',
228
+ },
229
+ 'wallpaper-3': {
230
+ name: 'wallpaper-3',
231
+ hex: '77616c6c70617065722d332e706e67',
232
+ },
233
+ 'wallpaper-4': {
234
+ name: 'wallpaper-4',
235
+ hex: '77616c6c70617065722d342e706e67',
236
+ },
236
237
  });
237
238
 
238
239
  export const getHomeScreenHex = (deviceType: IDeviceType, name: string) => {
@@ -247,83 +248,11 @@ export const getHomeScreenHex = (deviceType: IDeviceType, name: string) => {
247
248
  data = getTouchData();
248
249
  break;
249
250
  case 'pro':
250
- data = getProData();
251
- break;
252
- default:
253
251
  data = {};
254
- }
255
-
256
- return data[name]?.hex ?? '';
257
- };
258
-
259
- export const getHomeScreenDefaultList = (features: Features) => {
260
- let data: Record<string, IScreenData>;
261
- const deviceType = getDeviceType(features);
262
-
263
- switch (deviceType) {
264
- case 'classic':
265
- case 'classic1s':
266
- case 'mini':
267
- data = getT1Data();
268
- break;
269
- case 'touch':
270
- data = getTouchData();
271
- break;
272
- case 'pro':
273
- data = getProData();
274
252
  break;
275
253
  default:
276
254
  data = {};
277
255
  }
278
256
 
279
- return Object.keys(data);
280
- };
281
-
282
- type SizeConfig = {
283
- width: number;
284
- height: number;
285
- radius?: number;
286
- };
287
-
288
- export const getHomeScreenSize = ({
289
- deviceType,
290
- homeScreenType,
291
- thumbnail,
292
- }: {
293
- deviceType: IDeviceType;
294
- homeScreenType: 'WallPaper' | 'Nft';
295
- thumbnail?: boolean;
296
- }) => {
297
- const sizes: Partial<
298
- Record<
299
- IDeviceType,
300
- {
301
- thumbnail: {
302
- Nft: SizeConfig;
303
- WallPaper: SizeConfig;
304
- };
305
- full: SizeConfig;
306
- }
307
- >
308
- > = {
309
- touch: {
310
- thumbnail: {
311
- Nft: { width: 238, height: 238 },
312
- WallPaper: { width: 144, height: 240 },
313
- },
314
- full: { width: 480, height: 800 },
315
- },
316
- pro: {
317
- thumbnail: {
318
- Nft: { width: 226, height: 226, radius: 40 },
319
- WallPaper: { width: 144, height: 240, radius: 40 },
320
- },
321
- full: { width: 480, height: 800 },
322
- },
323
- };
324
-
325
- const deviceConfig = sizes[deviceType];
326
- if (!deviceConfig) return undefined;
327
-
328
- return thumbnail ? deviceConfig.thumbnail[homeScreenType] : deviceConfig.full;
257
+ return data[name]?.hex ?? '';
329
258
  };
@@ -29,7 +29,7 @@ export { getHDPath, getScriptType, getOutputScriptType } from '../api/helpers/pa
29
29
 
30
30
  export const isBleConnect = (env: string) => env === 'react-native' || env === 'lowlevel';
31
31
 
32
- export { getHomeScreenHex, getHomeScreenDefaultList, getHomeScreenSize } from './homescreen';
32
+ export { getHomeScreenHex } from './homescreen';
33
33
 
34
34
  export const wait = (ms: number) =>
35
35
  new Promise(resolve => {
@@ -1,18 +0,0 @@
1
- import { TonGetAddress as HardwareTonGetAddress } from '@onekeyfe/hd-transport';
2
- import { BaseMethod } from '../BaseMethod';
3
- import { TonAddress } from '../../types';
4
- export default class TonGetAddress extends BaseMethod<HardwareTonGetAddress[]> {
5
- hasBundle: boolean;
6
- shouldConfirm: boolean;
7
- init(): void;
8
- getVersionRange(): {
9
- model_mini: {
10
- min: string;
11
- };
12
- model_touch: {
13
- min: string;
14
- };
15
- };
16
- run(): Promise<TonAddress | TonAddress[]>;
17
- }
18
- //# sourceMappingURL=TonGetAddress.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TonGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/ton/TonGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAIhF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAC,qBAAqB,EAAE,CAAC;IAC5E,SAAS,UAAS;IAElB,aAAa,UAAS;IAEtB,IAAI;IA2CJ,eAAe;;;;;;;;IAWT,GAAG;CA0BV"}
@@ -1,15 +0,0 @@
1
- import { TonSignMessage as HardwareTonSignMessage } from '@onekeyfe/hd-transport';
2
- import { BaseMethod } from '../BaseMethod';
3
- export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
4
- init(): void;
5
- getVersionRange(): {
6
- model_mini: {
7
- min: string;
8
- };
9
- model_touch: {
10
- min: string;
11
- };
12
- };
13
- run(): Promise<import("@onekeyfe/hd-transport").TonSignedMessage>;
14
- }
15
- //# sourceMappingURL=TonSignMessage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TonSignMessage.d.ts","sourceRoot":"","sources":["../../../src/api/ton/TonSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAIlF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IAC5E,IAAI;IA8CJ,eAAe;;;;;;;;IAWT,GAAG;CAOV"}
@@ -1,15 +0,0 @@
1
- import { TonSignProof as HardwareTonSignProof } from '@onekeyfe/hd-transport';
2
- import { BaseMethod } from '../BaseMethod';
3
- export default class TonSignProof extends BaseMethod<HardwareTonSignProof> {
4
- init(): void;
5
- getVersionRange(): {
6
- model_mini: {
7
- min: string;
8
- };
9
- model_touch: {
10
- min: string;
11
- };
12
- };
13
- run(): Promise<import("@onekeyfe/hd-transport").TonSignedProof>;
14
- }
15
- //# sourceMappingURL=TonSignProof.d.ts.map