@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
package/dist/index.js CHANGED
@@ -79,6 +79,7 @@ const createCoreApi = (call) => ({
79
79
  btcGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetAddress' })),
80
80
  btcGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetPublicKey' })),
81
81
  btcSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignMessage' })),
82
+ btcSignPsbt: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignPsbt' })),
82
83
  btcSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignTransaction' })),
83
84
  btcVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcVerifyMessage' })),
84
85
  starcoinGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinGetAddress' })),
@@ -140,9 +141,6 @@ const createCoreApi = (call) => ({
140
141
  nervosSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nervosSignTransaction' })),
141
142
  dnxGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'dnxGetAddress' })),
142
143
  dnxSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'dnxSignTransaction' })),
143
- tonGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tonGetAddress' })),
144
- tonSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tonSignMessage' })),
145
- tonSignProof: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tonSignProof' })),
146
144
  });
147
145
 
148
146
  const lowLevelInject = ({ call, cancel, dispose, eventEmitter, init, uiResponse, updateSettings, addHardwareGlobalEventListener, }) => {
@@ -1745,6 +1743,10 @@ var nested$1 = {
1745
1743
  no_script_type: {
1746
1744
  type: "bool",
1747
1745
  id: 5
1746
+ },
1747
+ is_bip322_simple: {
1748
+ type: "bool",
1749
+ id: 10
1748
1750
  }
1749
1751
  }
1750
1752
  },
@@ -2700,6 +2702,31 @@ var nested$1 = {
2700
2702
  }
2701
2703
  }
2702
2704
  },
2705
+ SignPsbt: {
2706
+ fields: {
2707
+ psbt: {
2708
+ rule: "required",
2709
+ type: "bytes",
2710
+ id: 1
2711
+ },
2712
+ coin_name: {
2713
+ type: "string",
2714
+ id: 2,
2715
+ options: {
2716
+ "default": "Bitcoin"
2717
+ }
2718
+ }
2719
+ }
2720
+ },
2721
+ SignedPsbt: {
2722
+ fields: {
2723
+ psbt: {
2724
+ rule: "required",
2725
+ type: "bytes",
2726
+ id: 1
2727
+ }
2728
+ }
2729
+ },
2703
2730
  SelfTest: {
2704
2731
  fields: {
2705
2732
  payload: {
@@ -3637,10 +3664,6 @@ var nested$1 = {
3637
3664
  rule: "required",
3638
3665
  type: "uint32",
3639
3666
  id: 4
3640
- },
3641
- address_type: {
3642
- type: "CardanoAddressType",
3643
- id: 5
3644
3667
  }
3645
3668
  }
3646
3669
  },
@@ -11243,255 +11266,6 @@ var nested$1 = {
11243
11266
  }
11244
11267
  }
11245
11268
  },
11246
- TonWalletVersion: {
11247
- values: {
11248
- V3R1: 0,
11249
- V3R2: 1,
11250
- V4R1: 2,
11251
- V4R2: 3
11252
- }
11253
- },
11254
- TonWorkChain: {
11255
- values: {
11256
- BASECHAIN: 0,
11257
- MASTERCHAIN: 1
11258
- }
11259
- },
11260
- TonGetAddress: {
11261
- fields: {
11262
- address_n: {
11263
- rule: "repeated",
11264
- type: "uint32",
11265
- id: 1,
11266
- options: {
11267
- packed: false
11268
- }
11269
- },
11270
- show_display: {
11271
- type: "bool",
11272
- id: 2
11273
- },
11274
- wallet_version: {
11275
- type: "TonWalletVersion",
11276
- id: 3,
11277
- options: {
11278
- "default": "V3R2"
11279
- }
11280
- },
11281
- is_bounceable: {
11282
- type: "bool",
11283
- id: 4,
11284
- options: {
11285
- "default": false
11286
- }
11287
- },
11288
- is_testnet_only: {
11289
- type: "bool",
11290
- id: 5,
11291
- options: {
11292
- "default": false
11293
- }
11294
- },
11295
- workchain: {
11296
- type: "TonWorkChain",
11297
- id: 6,
11298
- options: {
11299
- "default": "BASECHAIN"
11300
- }
11301
- },
11302
- wallet_id: {
11303
- type: "uint32",
11304
- id: 7,
11305
- options: {
11306
- "default": 698983191
11307
- }
11308
- }
11309
- }
11310
- },
11311
- TonAddress: {
11312
- fields: {
11313
- public_key: {
11314
- rule: "required",
11315
- type: "bytes",
11316
- id: 1
11317
- },
11318
- address: {
11319
- rule: "required",
11320
- type: "string",
11321
- id: 2
11322
- }
11323
- }
11324
- },
11325
- TonSignMessage: {
11326
- fields: {
11327
- address_n: {
11328
- rule: "repeated",
11329
- type: "uint32",
11330
- id: 1,
11331
- options: {
11332
- packed: false
11333
- }
11334
- },
11335
- destination: {
11336
- rule: "required",
11337
- type: "string",
11338
- id: 2
11339
- },
11340
- jetton_master_address: {
11341
- type: "string",
11342
- id: 3
11343
- },
11344
- ton_amount: {
11345
- rule: "required",
11346
- type: "uint64",
11347
- id: 4
11348
- },
11349
- jetton_amount: {
11350
- type: "uint64",
11351
- id: 5
11352
- },
11353
- fwd_fee: {
11354
- type: "uint64",
11355
- id: 6,
11356
- options: {
11357
- "default": 0
11358
- }
11359
- },
11360
- comment: {
11361
- type: "string",
11362
- id: 7
11363
- },
11364
- mode: {
11365
- type: "uint32",
11366
- id: 8,
11367
- options: {
11368
- "default": 3
11369
- }
11370
- },
11371
- seqno: {
11372
- rule: "required",
11373
- type: "uint32",
11374
- id: 9
11375
- },
11376
- expire_at: {
11377
- rule: "required",
11378
- type: "uint64",
11379
- id: 10
11380
- },
11381
- wallet_version: {
11382
- type: "TonWalletVersion",
11383
- id: 11,
11384
- options: {
11385
- "default": "V4R2"
11386
- }
11387
- },
11388
- wallet_id: {
11389
- type: "uint32",
11390
- id: 12,
11391
- options: {
11392
- "default": 698983191
11393
- }
11394
- },
11395
- workchain: {
11396
- type: "TonWorkChain",
11397
- id: 13,
11398
- options: {
11399
- "default": "BASECHAIN"
11400
- }
11401
- },
11402
- is_bounceable: {
11403
- type: "bool",
11404
- id: 14,
11405
- options: {
11406
- "default": false
11407
- }
11408
- },
11409
- is_testnet_only: {
11410
- type: "bool",
11411
- id: 15,
11412
- options: {
11413
- "default": false
11414
- }
11415
- }
11416
- }
11417
- },
11418
- TonSignedMessage: {
11419
- fields: {
11420
- signature: {
11421
- type: "bytes",
11422
- id: 1
11423
- }
11424
- }
11425
- },
11426
- TonSignProof: {
11427
- fields: {
11428
- address_n: {
11429
- rule: "repeated",
11430
- type: "uint32",
11431
- id: 1,
11432
- options: {
11433
- packed: false
11434
- }
11435
- },
11436
- appdomain: {
11437
- rule: "required",
11438
- type: "bytes",
11439
- id: 2
11440
- },
11441
- comment: {
11442
- type: "bytes",
11443
- id: 3
11444
- },
11445
- expire_at: {
11446
- rule: "required",
11447
- type: "uint64",
11448
- id: 4
11449
- },
11450
- wallet_version: {
11451
- type: "TonWalletVersion",
11452
- id: 5,
11453
- options: {
11454
- "default": "V4R2"
11455
- }
11456
- },
11457
- wallet_id: {
11458
- type: "uint32",
11459
- id: 6,
11460
- options: {
11461
- "default": 698983191
11462
- }
11463
- },
11464
- workchain: {
11465
- type: "TonWorkChain",
11466
- id: 7,
11467
- options: {
11468
- "default": "BASECHAIN"
11469
- }
11470
- },
11471
- is_bounceable: {
11472
- type: "bool",
11473
- id: 8,
11474
- options: {
11475
- "default": false
11476
- }
11477
- },
11478
- is_testnet_only: {
11479
- type: "bool",
11480
- id: 9,
11481
- options: {
11482
- "default": false
11483
- }
11484
- }
11485
- }
11486
- },
11487
- TonSignedProof: {
11488
- fields: {
11489
- signature: {
11490
- type: "bytes",
11491
- id: 1
11492
- }
11493
- }
11494
- },
11495
11269
  TronGetAddress: {
11496
11270
  fields: {
11497
11271
  address_n: {
@@ -12110,6 +11884,8 @@ var nested$1 = {
12110
11884
  MessageType_TezosSignedTx: 153,
12111
11885
  MessageType_TezosGetPublicKey: 154,
12112
11886
  MessageType_TezosPublicKey: 155,
11887
+ MessageType_SignPsbt: 10052,
11888
+ MessageType_SignedPsbt: 10053,
12113
11889
  MessageType_StellarSignTx: 202,
12114
11890
  MessageType_StellarTxOpRequest: 203,
12115
11891
  MessageType_StellarGetAddress: 207,
@@ -12337,12 +12113,6 @@ var nested$1 = {
12337
12113
  MessageType_DnxInputAck: 11804,
12338
12114
  MessageType_DnxRTSigsRequest: 11805,
12339
12115
  MessageType_DnxSignedTx: 11806,
12340
- MessageType_TonGetAddress: 11901,
12341
- MessageType_TonAddress: 11902,
12342
- MessageType_TonSignMessage: 11903,
12343
- MessageType_TonSignedMessage: 11904,
12344
- MessageType_TonSignProof: 11905,
12345
- MessageType_TonSignedProof: 11906,
12346
12116
  MessageType_DeviceBackToBoot: 903,
12347
12117
  MessageType_DeviceInfoSettings: 10001,
12348
12118
  MessageType_GetDeviceInfo: 10002,
@@ -24456,16 +24226,22 @@ const getT1Data = () => ({
24456
24226
  },
24457
24227
  });
24458
24228
  const getTouchData = () => ({
24459
- 'wallpaper-1': { name: 'wallpaper-1', hex: '77616c6c70617065722d312e706e67' },
24460
- 'wallpaper-2': { name: 'wallpaper-2', hex: '77616c6c70617065722d322e706e67' },
24461
- 'wallpaper-3': { name: 'wallpaper-3', hex: '77616c6c70617065722d332e706e67' },
24462
- 'wallpaper-4': { name: 'wallpaper-4', hex: '77616c6c70617065722d342e706e67' },
24463
- });
24464
- const getProData = () => ({
24465
- 'wallpaper-1': { name: 'wallpaper-1', hex: '77616c6c70617065722d312e6a7067' },
24466
- 'wallpaper-2': { name: 'wallpaper-2', hex: '77616c6c70617065722d322e6a7067' },
24467
- 'wallpaper-3': { name: 'wallpaper-3', hex: '77616c6c70617065722d332e6a7067' },
24468
- 'wallpaper-4': { name: 'wallpaper-4', hex: '77616c6c70617065722d342e6a7067' },
24229
+ 'wallpaper-1': {
24230
+ name: 'wallpaper-1',
24231
+ hex: '77616c6c70617065722d312e706e67',
24232
+ },
24233
+ 'wallpaper-2': {
24234
+ name: 'wallpaper-2',
24235
+ hex: '77616c6c70617065722d322e706e67',
24236
+ },
24237
+ 'wallpaper-3': {
24238
+ name: 'wallpaper-3',
24239
+ hex: '77616c6c70617065722d332e706e67',
24240
+ },
24241
+ 'wallpaper-4': {
24242
+ name: 'wallpaper-4',
24243
+ hex: '77616c6c70617065722d342e706e67',
24244
+ },
24469
24245
  });
24470
24246
  const getHomeScreenHex = (deviceType, name) => {
24471
24247
  var _a, _b;
@@ -24480,54 +24256,12 @@ const getHomeScreenHex = (deviceType, name) => {
24480
24256
  data = getTouchData();
24481
24257
  break;
24482
24258
  case 'pro':
24483
- data = getProData();
24484
- break;
24485
- default:
24486
24259
  data = {};
24487
- }
24488
- return (_b = (_a = data[name]) === null || _a === void 0 ? void 0 : _a.hex) !== null && _b !== void 0 ? _b : '';
24489
- };
24490
- const getHomeScreenDefaultList = (features) => {
24491
- let data;
24492
- const deviceType = getDeviceType(features);
24493
- switch (deviceType) {
24494
- case 'classic':
24495
- case 'classic1s':
24496
- case 'mini':
24497
- data = getT1Data();
24498
- break;
24499
- case 'touch':
24500
- data = getTouchData();
24501
- break;
24502
- case 'pro':
24503
- data = getProData();
24504
24260
  break;
24505
24261
  default:
24506
24262
  data = {};
24507
24263
  }
24508
- return Object.keys(data);
24509
- };
24510
- const getHomeScreenSize = ({ deviceType, homeScreenType, thumbnail, }) => {
24511
- const sizes = {
24512
- touch: {
24513
- thumbnail: {
24514
- Nft: { width: 238, height: 238 },
24515
- WallPaper: { width: 144, height: 240 },
24516
- },
24517
- full: { width: 480, height: 800 },
24518
- },
24519
- pro: {
24520
- thumbnail: {
24521
- Nft: { width: 226, height: 226, radius: 40 },
24522
- WallPaper: { width: 144, height: 240, radius: 40 },
24523
- },
24524
- full: { width: 480, height: 800 },
24525
- },
24526
- };
24527
- const deviceConfig = sizes[deviceType];
24528
- if (!deviceConfig)
24529
- return undefined;
24530
- return thumbnail ? deviceConfig.thumbnail[homeScreenType] : deviceConfig.full;
24264
+ return (_b = (_a = data[name]) === null || _a === void 0 ? void 0 : _a.hex) !== null && _b !== void 0 ? _b : '';
24531
24265
  };
24532
24266
 
24533
24267
  const isBleConnect = (env) => env === 'react-native' || env === 'lowlevel';
@@ -24986,6 +24720,7 @@ class DeviceCommands {
24986
24720
  this.callPromise = promise;
24987
24721
  const res = yield promise;
24988
24722
  Log$7.debug('[DeviceCommands] [call] Received', res.type);
24723
+ console.log('[DeviceCommands] [call] Received', res.type);
24989
24724
  return res;
24990
24725
  }
24991
24726
  catch (error) {
@@ -26509,7 +26244,7 @@ class DeviceUploadResource extends BaseMethod {
26509
26244
  { name: 'thumbnailDataHex', type: 'string', required: true },
26510
26245
  { name: 'resType', type: 'number', required: true },
26511
26246
  { name: 'nftMetaData', type: 'string' },
26512
- { name: 'fileNameNoExt', type: 'string' },
26247
+ { name: 'file_name_no_ext', type: 'boolean' },
26513
26248
  ]);
26514
26249
  const { suffix, dataHex, thumbnailDataHex, resType, nftMetaData } = this
26515
26250
  .payload;
@@ -26518,9 +26253,7 @@ class DeviceUploadResource extends BaseMethod {
26518
26253
  thumbnailData: hexToBytes(thumbnailDataHex),
26519
26254
  };
26520
26255
  const fileHash = utils.bytesToHex(blake2s.blake2s(this.payload.dataHex)).slice(0, 8);
26521
- const file_name_no_ext = lodash.isEmpty(this.payload.fileNameNoExt)
26522
- ? `${resType === 0 ? 'wp' : 'nft'}-${fileHash}-${Math.floor(Date.now() / 1000)}`
26523
- : this.payload.fileNameNoExt;
26256
+ const file_name_no_ext = `${resType === 0 ? 'wp' : 'nft'}-${fileHash}-${Math.floor(Date.now() / 1000)}`;
26524
26257
  this.params = {
26525
26258
  extension: suffix,
26526
26259
  data_length: this.paramsData.data.byteLength,
@@ -27827,19 +27560,43 @@ class BTCSignMessage extends BaseMethod {
27827
27560
  { name: 'messageHex', type: 'hexString', required: true },
27828
27561
  { name: 'coin', type: 'string' },
27829
27562
  { name: 'noScriptType', type: 'boolean' },
27563
+ { name: 'dAppSignType', type: 'string' },
27830
27564
  ]);
27831
- const { path, messageHex, coin, noScriptType } = this.payload;
27565
+ const { path, messageHex, coin, noScriptType: _noScriptType, dAppSignType } = this.payload;
27566
+ let noScriptType = _noScriptType;
27567
+ let isBip322Simple = false;
27832
27568
  const addressN = validatePath(path);
27833
27569
  const { coinName, scriptType } = getCoinAndScriptType(addressN, coin, false);
27570
+ let finalScriptType = scriptType;
27571
+ if (dAppSignType === 'ecdsa' || dAppSignType === 'bip322-simple') {
27572
+ if (dAppSignType === 'ecdsa') {
27573
+ noScriptType = true;
27574
+ }
27575
+ else {
27576
+ isBip322Simple = true;
27577
+ noScriptType = false;
27578
+ }
27579
+ }
27580
+ else {
27581
+ finalScriptType = noScriptType ? undefined : scriptType;
27582
+ }
27834
27583
  this.params = {
27835
27584
  address_n: addressN,
27836
27585
  message: formatAnyHex(messageHex),
27837
27586
  coin_name: coinName,
27838
- script_type: noScriptType ? undefined : scriptType,
27587
+ script_type: finalScriptType,
27839
27588
  no_script_type: noScriptType,
27589
+ is_bip322_simple: isBip322Simple,
27840
27590
  };
27841
27591
  }
27842
27592
  getVersionRange() {
27593
+ if (this.payload.dAppSignType) {
27594
+ return {
27595
+ pro: {
27596
+ min: '4.9.3',
27597
+ },
27598
+ };
27599
+ }
27843
27600
  return getBitcoinForkVersionRange([this.params.coin_name]);
27844
27601
  }
27845
27602
  run() {
@@ -27850,6 +27607,36 @@ class BTCSignMessage extends BaseMethod {
27850
27607
  }
27851
27608
  }
27852
27609
 
27610
+ class BTCSignPsbt extends BaseMethod {
27611
+ init() {
27612
+ this.checkDeviceId = true;
27613
+ this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
27614
+ validateParams(this.payload, [
27615
+ { name: 'psbt', type: 'hexString', required: true },
27616
+ { name: 'coin', type: 'string' },
27617
+ ]);
27618
+ const { psbt, coin } = this.payload;
27619
+ const coinInfo = getCoinInfo(undefined, coin);
27620
+ this.params = {
27621
+ psbt: formatAnyHex(psbt),
27622
+ coin_name: coinInfo.name,
27623
+ };
27624
+ }
27625
+ getVersionRange() {
27626
+ return {
27627
+ pro: {
27628
+ min: '4.9.3',
27629
+ },
27630
+ };
27631
+ }
27632
+ run() {
27633
+ return __awaiter(this, void 0, void 0, function* () {
27634
+ const res = yield this.device.commands.typedCall('SignPsbt', 'SignedPsbt', Object.assign({}, this.params));
27635
+ return Promise.resolve(res.message);
27636
+ });
27637
+ }
27638
+ }
27639
+
27853
27640
  const requestPrevTxInfo$1 = ({ typedCall, txRequest: { request_type, details }, refTxs }) => {
27854
27641
  const { tx_hash } = details;
27855
27642
  if (!tx_hash) {
@@ -33686,186 +33473,6 @@ class DnxSignTransaction extends BaseMethod {
33686
33473
  }
33687
33474
  }
33688
33475
 
33689
- class TonGetAddress extends BaseMethod {
33690
- constructor() {
33691
- super(...arguments);
33692
- this.hasBundle = false;
33693
- this.shouldConfirm = false;
33694
- }
33695
- init() {
33696
- var _a;
33697
- this.checkDeviceId = true;
33698
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33699
- this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33700
- const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33701
- this.shouldConfirm = this.hasBundle
33702
- ? this.payload.bundle.some((i) => !!i.showOnOneKey)
33703
- : false;
33704
- validateParams(payload, [{ name: 'bundle', type: 'array' }]);
33705
- this.params = [];
33706
- payload.bundle.forEach((batch) => {
33707
- var _a;
33708
- const addressN = validatePath(batch.path, 3);
33709
- validateParams(batch, [
33710
- { name: 'path', required: true },
33711
- { name: 'showOnOneKey', type: 'boolean' },
33712
- { name: 'walletVersion' },
33713
- { name: 'isBounceable', type: 'boolean' },
33714
- { name: 'isTestnetOnly', type: 'boolean' },
33715
- { name: 'workchain' },
33716
- { name: 'walletId', type: 'number' },
33717
- ]);
33718
- const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
33719
- this.params.push({
33720
- address_n: addressN,
33721
- show_display: showOnOneKey,
33722
- wallet_version: batch.walletVersion,
33723
- is_bounceable: batch.isBounceable,
33724
- is_testnet_only: batch.isTestnetOnly,
33725
- workchain: batch.workchain,
33726
- wallet_id: batch.walletId,
33727
- });
33728
- });
33729
- }
33730
- getVersionRange() {
33731
- return {
33732
- model_mini: {
33733
- min: '3.0.0',
33734
- },
33735
- model_touch: {
33736
- min: '4.3.0',
33737
- },
33738
- };
33739
- }
33740
- run() {
33741
- return __awaiter(this, void 0, void 0, function* () {
33742
- const responses = [];
33743
- for (let i = 0; i < this.params.length; i++) {
33744
- const param = this.params[i];
33745
- const res = yield this.device.commands.typedCall('TonGetAddress', 'TonAddress', Object.assign({}, param));
33746
- const { address, public_key } = res.message;
33747
- const result = {
33748
- path: serializedPath(param.address_n),
33749
- publicKey: public_key,
33750
- address,
33751
- };
33752
- responses.push(result);
33753
- this.postPreviousAddressMessage(result);
33754
- }
33755
- validateResult(responses, ['address', 'publicKey'], {
33756
- expectedLength: this.params.length,
33757
- });
33758
- return Promise.resolve(this.hasBundle ? responses : responses[0]);
33759
- });
33760
- }
33761
- }
33762
-
33763
- class TonSignMessage extends BaseMethod {
33764
- init() {
33765
- this.checkDeviceId = true;
33766
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33767
- validateParams(this.payload, [
33768
- { name: 'path', required: true },
33769
- { name: 'destination', type: 'string' },
33770
- { name: 'jettonMasterAddress', type: 'string' },
33771
- { name: 'tonAmount', type: 'number' },
33772
- { name: 'jettonAmount', type: 'number' },
33773
- { name: 'fwdFee', type: 'number' },
33774
- { name: 'comment', type: 'string' },
33775
- { name: 'mode', type: 'number' },
33776
- { name: 'seqno', type: 'number' },
33777
- { name: 'expireAt', type: 'number' },
33778
- { name: 'walletVersion' },
33779
- { name: 'walletId', type: 'number' },
33780
- { name: 'workchain' },
33781
- { name: 'isBounceable', type: 'boolean' },
33782
- { name: 'isTestnetOnly', type: 'boolean' },
33783
- ]);
33784
- const { path } = this.payload;
33785
- const addressN = validatePath(path, 3);
33786
- this.params = {
33787
- address_n: addressN,
33788
- destination: this.payload.destination,
33789
- jetton_master_address: this.payload.jettonMasterAddress,
33790
- ton_amount: this.payload.tonAmount,
33791
- jetton_amount: this.payload.jettonAmount,
33792
- fwd_fee: this.payload.fwdFee,
33793
- comment: this.payload.comment,
33794
- mode: this.payload.mode,
33795
- seqno: this.payload.seqno,
33796
- expire_at: this.payload.expireAt,
33797
- wallet_version: this.payload.walletVersion,
33798
- wallet_id: this.payload.walletId,
33799
- workchain: this.payload.workchain,
33800
- is_bounceable: this.payload.isBounceable,
33801
- is_testnet_only: this.payload.isTestnetOnly,
33802
- };
33803
- }
33804
- getVersionRange() {
33805
- return {
33806
- model_mini: {
33807
- min: '3.0.0',
33808
- },
33809
- model_touch: {
33810
- min: '4.3.0',
33811
- },
33812
- };
33813
- }
33814
- run() {
33815
- return __awaiter(this, void 0, void 0, function* () {
33816
- const res = yield this.device.commands.typedCall('TonSignMessage', 'TonSignedMessage', Object.assign({}, this.params));
33817
- return Promise.resolve(res.message);
33818
- });
33819
- }
33820
- }
33821
-
33822
- class TonSignProof extends BaseMethod {
33823
- init() {
33824
- this.checkDeviceId = true;
33825
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33826
- validateParams(this.payload, [
33827
- { name: 'path', required: true },
33828
- { name: 'appdomain', type: 'string' },
33829
- { name: 'comment', type: 'string' },
33830
- { name: 'expireAt', type: 'number' },
33831
- { name: 'walletVersion' },
33832
- { name: 'walletId', type: 'number' },
33833
- { name: 'workchain' },
33834
- { name: 'isBounceable', type: 'boolean' },
33835
- { name: 'isTestnetOnly', type: 'boolean' },
33836
- ]);
33837
- const { path } = this.payload;
33838
- const addressN = validatePath(path, 3);
33839
- this.params = {
33840
- address_n: addressN,
33841
- appdomain: this.payload.appdomain,
33842
- comment: this.payload.comment,
33843
- expire_at: this.payload.expireAt,
33844
- wallet_version: this.payload.walletVersion,
33845
- wallet_id: this.payload.walletId,
33846
- workchain: this.payload.workchain,
33847
- is_bounceable: this.payload.isBounceable,
33848
- is_testnet_only: this.payload.isTestnetOnly,
33849
- };
33850
- }
33851
- getVersionRange() {
33852
- return {
33853
- model_mini: {
33854
- min: '3.0.0',
33855
- },
33856
- model_touch: {
33857
- min: '4.3.0',
33858
- },
33859
- };
33860
- }
33861
- run() {
33862
- return __awaiter(this, void 0, void 0, function* () {
33863
- const res = yield this.device.commands.typedCall('TonSignProof', 'TonSignedProof', Object.assign({}, this.params));
33864
- return Promise.resolve(res.message);
33865
- });
33866
- }
33867
- }
33868
-
33869
33476
  var ApiMethods = /*#__PURE__*/Object.freeze({
33870
33477
  __proto__: null,
33871
33478
  searchDevices: SearchDevices,
@@ -33901,6 +33508,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
33901
33508
  btcGetAddress: BTCGetAddress,
33902
33509
  btcGetPublicKey: BTCGetPublicKey,
33903
33510
  btcSignMessage: BTCSignMessage,
33511
+ btcSignPsbt: BTCSignPsbt,
33904
33512
  btcSignTransaction: BTCSignTransaction,
33905
33513
  btcVerifyMessage: BTCVerifyMessage,
33906
33514
  confluxGetAddress: ConfluxGetAddress,
@@ -33966,10 +33574,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
33966
33574
  nervosGetAddress: NervosGetAddress,
33967
33575
  nervosSignTransaction: NervosSignTransaction,
33968
33576
  dnxGetAddress: DnxGetAddress,
33969
- dnxSignTransaction: DnxSignTransaction,
33970
- tonGetAddress: TonGetAddress,
33971
- tonSignMessage: TonSignMessage,
33972
- tonSignProof: TonSignProof
33577
+ dnxSignTransaction: DnxSignTransaction
33973
33578
  });
33974
33579
 
33975
33580
  function findMethod(message) {
@@ -34725,9 +34330,7 @@ exports.getDeviceUUID = getDeviceUUID;
34725
34330
  exports.getEnv = getEnv;
34726
34331
  exports.getFirmwareUpdateField = getFirmwareUpdateField;
34727
34332
  exports.getHDPath = getHDPath;
34728
- exports.getHomeScreenDefaultList = getHomeScreenDefaultList;
34729
34333
  exports.getHomeScreenHex = getHomeScreenHex;
34730
- exports.getHomeScreenSize = getHomeScreenSize;
34731
34334
  exports.getLog = getLog;
34732
34335
  exports.getLogger = getLogger;
34733
34336
  exports.getMethodVersionRange = getMethodVersionRange;