@onekeyfe/hd-core 0.3.4 → 0.3.5-alpha.0

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.
@@ -1616,6 +1616,39 @@
1616
1616
  }
1617
1617
  }
1618
1618
  },
1619
+ "RebootType": {
1620
+ "values": {
1621
+ "Normal": 0,
1622
+ "Boardloader": 1,
1623
+ "BootLoader": 2
1624
+ }
1625
+ },
1626
+ "Reboot": {
1627
+ "fields": {
1628
+ "reboot_type": {
1629
+ "rule": "required",
1630
+ "type": "RebootType",
1631
+ "id": 1
1632
+ }
1633
+ }
1634
+ },
1635
+ "FirmwareUpdateEmmc": {
1636
+ "fields": {
1637
+ "path": {
1638
+ "rule": "required",
1639
+ "type": "string",
1640
+ "id": 1
1641
+ },
1642
+ "reboot_on_success": {
1643
+ "type": "bool",
1644
+ "id": 2
1645
+ },
1646
+ "force_erase": {
1647
+ "type": "bool",
1648
+ "id": 3
1649
+ }
1650
+ }
1651
+ },
1619
1652
  "CardanoDerivationType": {
1620
1653
  "values": {
1621
1654
  "LEDGER": 0,
@@ -3407,6 +3440,207 @@
3407
3440
  }
3408
3441
  }
3409
3442
  },
3443
+ "EmmcFixPermission": {
3444
+ "fields": {}
3445
+ },
3446
+ "EmmcPath": {
3447
+ "fields": {
3448
+ "exist": {
3449
+ "rule": "required",
3450
+ "type": "bool",
3451
+ "id": 1
3452
+ },
3453
+ "size": {
3454
+ "rule": "required",
3455
+ "type": "uint64",
3456
+ "id": 2
3457
+ },
3458
+ "year": {
3459
+ "rule": "required",
3460
+ "type": "uint32",
3461
+ "id": 3
3462
+ },
3463
+ "month": {
3464
+ "rule": "required",
3465
+ "type": "uint32",
3466
+ "id": 4
3467
+ },
3468
+ "day": {
3469
+ "rule": "required",
3470
+ "type": "uint32",
3471
+ "id": 5
3472
+ },
3473
+ "hour": {
3474
+ "rule": "required",
3475
+ "type": "uint32",
3476
+ "id": 6
3477
+ },
3478
+ "minute": {
3479
+ "rule": "required",
3480
+ "type": "uint32",
3481
+ "id": 7
3482
+ },
3483
+ "second": {
3484
+ "rule": "required",
3485
+ "type": "uint32",
3486
+ "id": 8
3487
+ },
3488
+ "readonly": {
3489
+ "rule": "required",
3490
+ "type": "bool",
3491
+ "id": 9
3492
+ },
3493
+ "hidden": {
3494
+ "rule": "required",
3495
+ "type": "bool",
3496
+ "id": 10
3497
+ },
3498
+ "system": {
3499
+ "rule": "required",
3500
+ "type": "bool",
3501
+ "id": 11
3502
+ },
3503
+ "archive": {
3504
+ "rule": "required",
3505
+ "type": "bool",
3506
+ "id": 12
3507
+ },
3508
+ "directory": {
3509
+ "rule": "required",
3510
+ "type": "bool",
3511
+ "id": 13
3512
+ }
3513
+ }
3514
+ },
3515
+ "EmmcPathInfo": {
3516
+ "fields": {
3517
+ "path": {
3518
+ "rule": "required",
3519
+ "type": "string",
3520
+ "id": 1
3521
+ }
3522
+ }
3523
+ },
3524
+ "EmmcFile": {
3525
+ "fields": {
3526
+ "path": {
3527
+ "rule": "required",
3528
+ "type": "string",
3529
+ "id": 1
3530
+ },
3531
+ "offset": {
3532
+ "rule": "required",
3533
+ "type": "uint32",
3534
+ "id": 2
3535
+ },
3536
+ "len": {
3537
+ "rule": "required",
3538
+ "type": "uint32",
3539
+ "id": 3
3540
+ },
3541
+ "data": {
3542
+ "type": "bytes",
3543
+ "id": 4
3544
+ },
3545
+ "data_hash": {
3546
+ "type": "uint32",
3547
+ "id": 5
3548
+ },
3549
+ "processed_byte": {
3550
+ "type": "uint32",
3551
+ "id": 6
3552
+ }
3553
+ }
3554
+ },
3555
+ "EmmcFileRead": {
3556
+ "fields": {
3557
+ "file": {
3558
+ "rule": "required",
3559
+ "type": "EmmcFile",
3560
+ "id": 1
3561
+ },
3562
+ "ui_percentage": {
3563
+ "type": "uint32",
3564
+ "id": 2
3565
+ }
3566
+ }
3567
+ },
3568
+ "EmmcFileWrite": {
3569
+ "fields": {
3570
+ "file": {
3571
+ "rule": "required",
3572
+ "type": "EmmcFile",
3573
+ "id": 1
3574
+ },
3575
+ "overwrite": {
3576
+ "rule": "required",
3577
+ "type": "bool",
3578
+ "id": 2
3579
+ },
3580
+ "append": {
3581
+ "rule": "required",
3582
+ "type": "bool",
3583
+ "id": 3
3584
+ },
3585
+ "ui_percentage": {
3586
+ "type": "uint32",
3587
+ "id": 4
3588
+ }
3589
+ }
3590
+ },
3591
+ "EmmcFileDelete": {
3592
+ "fields": {
3593
+ "path": {
3594
+ "rule": "required",
3595
+ "type": "string",
3596
+ "id": 1
3597
+ }
3598
+ }
3599
+ },
3600
+ "EmmcDir": {
3601
+ "fields": {
3602
+ "path": {
3603
+ "rule": "required",
3604
+ "type": "string",
3605
+ "id": 1
3606
+ },
3607
+ "child_dirs": {
3608
+ "type": "string",
3609
+ "id": 2
3610
+ },
3611
+ "child_files": {
3612
+ "type": "string",
3613
+ "id": 3
3614
+ }
3615
+ }
3616
+ },
3617
+ "EmmcDirList": {
3618
+ "fields": {
3619
+ "path": {
3620
+ "rule": "required",
3621
+ "type": "string",
3622
+ "id": 1
3623
+ }
3624
+ }
3625
+ },
3626
+ "EmmcDirMake": {
3627
+ "fields": {
3628
+ "path": {
3629
+ "rule": "required",
3630
+ "type": "string",
3631
+ "id": 1
3632
+ }
3633
+ }
3634
+ },
3635
+ "EmmcDirRemove": {
3636
+ "fields": {
3637
+ "path": {
3638
+ "rule": "required",
3639
+ "type": "string",
3640
+ "id": 1
3641
+ }
3642
+ }
3643
+ },
3410
3644
  "EosGetPublicKey": {
3411
3645
  "fields": {
3412
3646
  "address_n": {
@@ -8845,6 +9079,8 @@
8845
9079
  "MessageType_FirmwareUpload": 7,
8846
9080
  "MessageType_FirmwareRequest": 8,
8847
9081
  "MessageType_SelfTest": 32,
9082
+ "MessageType_Reboot": 30000,
9083
+ "MessageType_FirmwareUpdateEmmc": 30001,
8848
9084
  "MessageType_GetPublicKey": 11,
8849
9085
  "MessageType_PublicKey": 12,
8850
9086
  "MessageType_SignTx": 15,
@@ -8886,6 +9122,17 @@
8886
9122
  "MessageType_DebugLinkRecordScreen": 9003,
8887
9123
  "MessageType_DebugLinkEraseSdCard": 9005,
8888
9124
  "MessageType_DebugLinkWatchLayout": 9006,
9125
+ "MessageType_EmmcFixPermission": 30100,
9126
+ "MessageType_EmmcPath": 30101,
9127
+ "MessageType_EmmcPathInfo": 30102,
9128
+ "MessageType_EmmcFile": 30103,
9129
+ "MessageType_EmmcFileRead": 30104,
9130
+ "MessageType_EmmcFileWrite": 30105,
9131
+ "MessageType_EmmcFileDelete": 30106,
9132
+ "MessageType_EmmcDir": 30107,
9133
+ "MessageType_EmmcDirList": 30108,
9134
+ "MessageType_EmmcDirMake": 30109,
9135
+ "MessageType_EmmcDirRemove": 30110,
8889
9136
  "MessageType_EthereumGetPublicKey": 450,
8890
9137
  "MessageType_EthereumPublicKey": 451,
8891
9138
  "MessageType_EthereumGetAddress": 56,
package/src/inject.ts CHANGED
@@ -94,6 +94,9 @@ export const createCoreApi = (
94
94
  */
95
95
  checkBridgeStatus: () => call({ method: 'checkBridgeStatus' }),
96
96
 
97
+ checkBridgeRelease: (connectId, params) =>
98
+ call({ ...params, connectId, method: 'checkBridgeRelease' }),
99
+
97
100
  checkBootloaderRelease: (connectId, params) =>
98
101
  call({ ...params, connectId, method: 'checkBootloaderRelease' }),
99
102
 
@@ -0,0 +1,14 @@
1
+ import type { CommonParams, Response } from '../params';
2
+
3
+ export type CheckBridgeReleaseResponse = {
4
+ shouldUpdate: boolean;
5
+ status: 'outdated' | 'valid';
6
+ releaseVersion: string;
7
+ } | null;
8
+
9
+ export declare function checkBridgeRelease(
10
+ connectId?: string,
11
+ params?: CommonParams & {
12
+ willUpdateFirmwareVersion?: string;
13
+ }
14
+ ): Response<CheckBridgeReleaseResponse>;
@@ -5,6 +5,7 @@ import { init } from './init';
5
5
  import { getLogs } from './getLogs';
6
6
  import { checkTransportRelease } from './checkTransportRelease';
7
7
  import { checkBridgeStatus } from './checkBridgeStatus';
8
+ import { checkBridgeRelease } from './checkBridgeRelease';
8
9
  import { checkBootloaderRelease } from './checkBootloaderRelease';
9
10
 
10
11
  import { searchDevices } from './searchDevices';
@@ -129,6 +130,7 @@ export type CoreApi = {
129
130
  */
130
131
  checkTransportRelease: typeof checkTransportRelease;
131
132
  checkBridgeStatus: typeof checkBridgeStatus;
133
+ checkBridgeRelease: typeof checkBridgeRelease;
132
134
  checkBootloaderRelease: typeof checkBootloaderRelease;
133
135
 
134
136
  /**
@@ -100,9 +100,8 @@ export const getDeviceBLEFirmwareVersion = (features: Features): IVersionArray |
100
100
  };
101
101
 
102
102
  export const getDeviceBootloaderVersion = (features: Features): IVersionArray => {
103
- const deviceType = getDeviceType(features);
104
103
  if (!features.bootloader_version) {
105
- if ((deviceType === 'classic' || deviceType === 'mini') && features.bootloader_mode) {
104
+ if (features.bootloader_mode) {
106
105
  return [features.major_version, features.minor_version, features.patch_version];
107
106
  }
108
107
  return [0, 0, 0];
@@ -1,10 +1,15 @@
1
1
  import axios from 'axios';
2
2
 
3
3
  export const httpRequest = async (url: string, type = 'text') => {
4
+ const headers: any = {};
5
+ if (url.indexOf('ngrok-free.app') > -1) {
6
+ headers['ngrok-skip-browser-warning'] = true;
7
+ }
4
8
  const response = await axios.request({
5
9
  url,
6
10
  withCredentials: false,
7
11
  responseType: type === 'binary' ? 'arraybuffer' : 'json',
12
+ headers,
8
13
  });
9
14
 
10
15
  if (+response.status === 200) {