@onekeyfe/hd-core 0.2.40 → 0.2.42
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.
- package/dist/api/BaseMethod.d.ts +2 -1
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckBLEFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
- package/dist/api/CheckBridgeStatus.d.ts.map +1 -1
- package/dist/api/CheckFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckTransportRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/GetFeatures.d.ts.map +1 -1
- package/dist/api/GetLogs.d.ts.map +1 -1
- package/dist/api/RequestWebUsbDevice.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/device/DeviceFullyUploadResource.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceSupportFeatures.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateReboot.d.ts.map +1 -1
- package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts +1 -0
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +2 -0
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/connectSettings.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +168 -78
- package/dist/types/settings.d.ts +1 -0
- package/dist/types/settings.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +9 -3
- package/src/api/CheckBLEFirmwareRelease.ts +2 -1
- package/src/api/CheckBootloaderRelease.ts +2 -1
- package/src/api/CheckBridgeStatus.ts +1 -0
- package/src/api/CheckFirmwareRelease.ts +1 -0
- package/src/api/CheckTransportRelease.ts +1 -0
- package/src/api/CipherKeyValue.ts +1 -1
- package/src/api/FirmwareUpdate.ts +2 -1
- package/src/api/FirmwareUpdateV2.ts +2 -1
- package/src/api/GetFeatures.ts +6 -1
- package/src/api/GetLogs.ts +1 -0
- package/src/api/GetPassphraseState.ts +1 -1
- package/src/api/RequestWebUsbDevice.ts +1 -0
- package/src/api/SearchDevices.ts +1 -0
- package/src/api/algo/AlgoGetAddress.ts +1 -1
- package/src/api/algo/AlgoSignTransaction.ts +1 -1
- package/src/api/aptos/AptosGetAddress.ts +1 -1
- package/src/api/aptos/AptosGetPublicKey.ts +1 -1
- package/src/api/aptos/AptosSignMessage.ts +1 -1
- package/src/api/aptos/AptosSignTransaction.ts +1 -1
- package/src/api/btc/BTCGetAddress.ts +1 -1
- package/src/api/btc/BTCGetPublicKey.ts +1 -1
- package/src/api/btc/BTCSignMessage.ts +1 -1
- package/src/api/btc/BTCSignTransaction.ts +1 -1
- package/src/api/btc/BTCVerifyMessage.ts +1 -1
- package/src/api/cardano/CardanoGetAddress.ts +1 -1
- package/src/api/cardano/CardanoGetPublicKey.ts +1 -1
- package/src/api/cardano/CardanoSignMessage.ts +1 -1
- package/src/api/cardano/CardanoSignTransaction.ts +1 -1
- package/src/api/conflux/ConfluxGetAddress.ts +1 -1
- package/src/api/conflux/ConfluxSignMessage.ts +1 -1
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +1 -1
- package/src/api/conflux/ConfluxSignTransaction.ts +1 -1
- package/src/api/cosmos/CosmosGetAddress.ts +1 -1
- package/src/api/cosmos/CosmosGetPublicKey.ts +1 -1
- package/src/api/cosmos/CosmosSignTransaction.ts +1 -1
- package/src/api/device/DeviceFullyUploadResource.ts +2 -1
- package/src/api/device/DeviceRebootToBoardloader.ts +1 -0
- package/src/api/device/DeviceRebootToBootloader.ts +1 -0
- package/src/api/device/DeviceSupportFeatures.ts +1 -0
- package/src/api/device/DeviceUpdateBootloader.ts +2 -1
- package/src/api/device/DeviceUpdateReboot.ts +1 -0
- package/src/api/device/DeviceUploadResource.ts +1 -0
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +1 -1
- package/src/api/evm/EVMSignMessage.ts +1 -1
- package/src/api/evm/EVMSignMessageEIP712.ts +1 -1
- package/src/api/evm/EVMSignTransaction.ts +1 -1
- package/src/api/evm/EVMSignTypedData.ts +66 -1
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/filecoin/FilecoinGetAddress.ts +1 -1
- package/src/api/filecoin/FilecoinSignTransaction.ts +1 -1
- package/src/api/near/NearGetAddress.ts +1 -1
- package/src/api/near/NearSignTransaction.ts +1 -1
- package/src/api/nem/NEMGetAddress.ts +1 -1
- package/src/api/nem/NEMSignTransaction.ts +1 -1
- package/src/api/polkadot/PolkadotGetAddress.ts +1 -1
- package/src/api/polkadot/PolkadotSignTransaction.ts +1 -1
- package/src/api/solana/SolGetAddress.ts +1 -1
- package/src/api/solana/SolSignTransaction.ts +1 -1
- package/src/api/starcoin/StarcoinGetAddress.ts +1 -1
- package/src/api/starcoin/StarcoinGetPublicKey.ts +1 -1
- package/src/api/starcoin/StarcoinSignMessage.ts +1 -1
- package/src/api/starcoin/StarcoinSignTransaction.ts +1 -1
- package/src/api/starcoin/StarcoinVerifyMessage.ts +1 -1
- package/src/api/stellar/StellarGetAddress.ts +1 -1
- package/src/api/stellar/StellarSignTransaction.ts +1 -1
- package/src/api/sui/SuiGetAddress.ts +1 -1
- package/src/api/sui/SuiGetPublicKey.ts +1 -1
- package/src/api/sui/SuiSignTransaction.ts +1 -1
- package/src/api/tron/TronGetAddress.ts +1 -1
- package/src/api/tron/TronSignMessage.ts +1 -1
- package/src/api/tron/TronSignTransaction.ts +1 -1
- package/src/api/xrp/XrpGetAddress.ts +1 -1
- package/src/api/xrp/XrpSignTransaction.ts +1 -1
- package/src/core/index.ts +41 -26
- package/src/data-manager/DataManager.ts +15 -1
- package/src/data-manager/connectSettings.ts +4 -0
- package/src/types/settings.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -10835,6 +10835,9 @@ const parseConnectSettings = (input = {}) => {
|
|
|
10835
10835
|
if (input.timestamp) {
|
|
10836
10836
|
settings.timestamp = input.timestamp;
|
|
10837
10837
|
}
|
|
10838
|
+
if (input.preRelease) {
|
|
10839
|
+
settings.preRelease = input.preRelease;
|
|
10840
|
+
}
|
|
10838
10841
|
return settings;
|
|
10839
10842
|
};
|
|
10840
10843
|
|
|
@@ -11289,7 +11292,10 @@ class DataManager {
|
|
|
11289
11292
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11290
11293
|
this.settings = settings;
|
|
11291
11294
|
try {
|
|
11292
|
-
const
|
|
11295
|
+
const url = settings.preRelease
|
|
11296
|
+
? 'https://data.onekey.so/pre-config.json'
|
|
11297
|
+
: 'https://data.onekey.so/config.json';
|
|
11298
|
+
const { data } = yield axios__default["default"].get(`${url}?noCache=${getTimeStamp()}`, {
|
|
11293
11299
|
timeout: 7000,
|
|
11294
11300
|
});
|
|
11295
11301
|
this.deviceMap = {
|
|
@@ -11306,6 +11312,15 @@ class DataManager {
|
|
|
11306
11312
|
}
|
|
11307
11313
|
});
|
|
11308
11314
|
}
|
|
11315
|
+
static checkAndReloadData() {
|
|
11316
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
11317
|
+
if (getTimeStamp() - this.lastCheckTimestamp > 1000 * 60 * 60 * 3) {
|
|
11318
|
+
yield this.load(this.settings).then(() => {
|
|
11319
|
+
this.lastCheckTimestamp = getTimeStamp();
|
|
11320
|
+
});
|
|
11321
|
+
}
|
|
11322
|
+
});
|
|
11323
|
+
}
|
|
11309
11324
|
static getProtobufMessages() {
|
|
11310
11325
|
return this.messages.default;
|
|
11311
11326
|
}
|
|
@@ -11341,6 +11356,7 @@ DataManager.assets = null;
|
|
|
11341
11356
|
DataManager.messages = {
|
|
11342
11357
|
default: MessagesJSON,
|
|
11343
11358
|
};
|
|
11359
|
+
DataManager.lastCheckTimestamp = 0;
|
|
11344
11360
|
DataManager.getFirmwareStatus = (features) => {
|
|
11345
11361
|
var _b, _c;
|
|
11346
11362
|
const deviceType = getDeviceType(features);
|
|
@@ -12557,6 +12573,7 @@ class BaseMethod {
|
|
|
12557
12573
|
this.shouldEnsureConnected = true;
|
|
12558
12574
|
this.checkDeviceId = false;
|
|
12559
12575
|
this.useDevicePassphraseState = true;
|
|
12576
|
+
this.skipForceUpdateCheck = false;
|
|
12560
12577
|
const { payload } = message;
|
|
12561
12578
|
this.name = payload.method;
|
|
12562
12579
|
this.payload = payload;
|
|
@@ -12564,7 +12581,7 @@ class BaseMethod {
|
|
|
12564
12581
|
this.connectId = payload.connectId || '';
|
|
12565
12582
|
this.deviceId = payload.deviceId || '';
|
|
12566
12583
|
this.useDevice = true;
|
|
12567
|
-
this.
|
|
12584
|
+
this.notAllowDeviceMode = [UI_REQUEST.INITIALIZE];
|
|
12568
12585
|
this.requireDeviceMode = [];
|
|
12569
12586
|
}
|
|
12570
12587
|
getVersionRange() {
|
|
@@ -12619,6 +12636,7 @@ class SearchDevices extends BaseMethod {
|
|
|
12619
12636
|
init() {
|
|
12620
12637
|
this.useDevice = false;
|
|
12621
12638
|
this.useDevicePassphraseState = false;
|
|
12639
|
+
this.skipForceUpdateCheck = true;
|
|
12622
12640
|
}
|
|
12623
12641
|
run() {
|
|
12624
12642
|
var _a, _b;
|
|
@@ -12641,8 +12659,13 @@ class SearchDevices extends BaseMethod {
|
|
|
12641
12659
|
|
|
12642
12660
|
class GetFeatures extends BaseMethod {
|
|
12643
12661
|
init() {
|
|
12644
|
-
this.
|
|
12662
|
+
this.notAllowDeviceMode = [
|
|
12663
|
+
...this.notAllowDeviceMode,
|
|
12664
|
+
UI_REQUEST.INITIALIZE,
|
|
12665
|
+
UI_REQUEST.BOOTLOADER,
|
|
12666
|
+
];
|
|
12645
12667
|
this.useDevicePassphraseState = false;
|
|
12668
|
+
this.skipForceUpdateCheck = true;
|
|
12646
12669
|
}
|
|
12647
12670
|
run() {
|
|
12648
12671
|
return Promise.resolve(this.device.features);
|
|
@@ -12651,7 +12674,7 @@ class GetFeatures extends BaseMethod {
|
|
|
12651
12674
|
|
|
12652
12675
|
class GetPassphraseState extends BaseMethod {
|
|
12653
12676
|
init() {
|
|
12654
|
-
this.
|
|
12677
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
12655
12678
|
this.useDevicePassphraseState = false;
|
|
12656
12679
|
}
|
|
12657
12680
|
run() {
|
|
@@ -12682,6 +12705,7 @@ class CheckBridgeStatus$1 extends BaseMethod {
|
|
|
12682
12705
|
init() {
|
|
12683
12706
|
this.useDevice = false;
|
|
12684
12707
|
this.useDevicePassphraseState = false;
|
|
12708
|
+
this.skipForceUpdateCheck = true;
|
|
12685
12709
|
}
|
|
12686
12710
|
run() {
|
|
12687
12711
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -12694,6 +12718,7 @@ class CheckBridgeStatus$1 extends BaseMethod {
|
|
|
12694
12718
|
class CheckFirmwareRelease extends BaseMethod {
|
|
12695
12719
|
init() {
|
|
12696
12720
|
this.useDevicePassphraseState = false;
|
|
12721
|
+
this.skipForceUpdateCheck = true;
|
|
12697
12722
|
}
|
|
12698
12723
|
run() {
|
|
12699
12724
|
if (this.device.features) {
|
|
@@ -12706,9 +12731,10 @@ class CheckFirmwareRelease extends BaseMethod {
|
|
|
12706
12731
|
|
|
12707
12732
|
class CheckBLEFirmwareRelease extends BaseMethod {
|
|
12708
12733
|
init() {
|
|
12709
|
-
this.
|
|
12734
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
|
|
12710
12735
|
this.checkDeviceId = true;
|
|
12711
12736
|
this.useDevicePassphraseState = false;
|
|
12737
|
+
this.skipForceUpdateCheck = true;
|
|
12712
12738
|
}
|
|
12713
12739
|
run() {
|
|
12714
12740
|
if (this.device.features) {
|
|
@@ -12723,6 +12749,7 @@ class CheckTransportRelease extends BaseMethod {
|
|
|
12723
12749
|
init() {
|
|
12724
12750
|
this.useDevice = false;
|
|
12725
12751
|
this.useDevicePassphraseState = false;
|
|
12752
|
+
this.skipForceUpdateCheck = true;
|
|
12726
12753
|
}
|
|
12727
12754
|
run() {
|
|
12728
12755
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -12738,6 +12765,7 @@ class CheckBridgeStatus extends BaseMethod {
|
|
|
12738
12765
|
init() {
|
|
12739
12766
|
this.useDevice = false;
|
|
12740
12767
|
this.useDevicePassphraseState = false;
|
|
12768
|
+
this.skipForceUpdateCheck = true;
|
|
12741
12769
|
}
|
|
12742
12770
|
run() {
|
|
12743
12771
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -12765,9 +12793,10 @@ class CheckBridgeStatus extends BaseMethod {
|
|
|
12765
12793
|
|
|
12766
12794
|
class CheckBootloaderRelease extends BaseMethod {
|
|
12767
12795
|
init() {
|
|
12768
|
-
this.
|
|
12796
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
|
|
12769
12797
|
this.checkDeviceId = true;
|
|
12770
12798
|
this.useDevicePassphraseState = false;
|
|
12799
|
+
this.skipForceUpdateCheck = true;
|
|
12771
12800
|
}
|
|
12772
12801
|
run() {
|
|
12773
12802
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -12957,6 +12986,7 @@ class DeviceFlags extends BaseMethod {
|
|
|
12957
12986
|
class DeviceRebootToBootloader extends BaseMethod {
|
|
12958
12987
|
init() {
|
|
12959
12988
|
this.useDevicePassphraseState = false;
|
|
12989
|
+
this.skipForceUpdateCheck = true;
|
|
12960
12990
|
}
|
|
12961
12991
|
getVersionRange() {
|
|
12962
12992
|
return {
|
|
@@ -12979,6 +13009,7 @@ class DeviceRebootToBootloader extends BaseMethod {
|
|
|
12979
13009
|
class DeviceRebootToBoardloader extends BaseMethod {
|
|
12980
13010
|
init() {
|
|
12981
13011
|
this.useDevicePassphraseState = false;
|
|
13012
|
+
this.skipForceUpdateCheck = true;
|
|
12982
13013
|
}
|
|
12983
13014
|
getVersionRange() {
|
|
12984
13015
|
return {
|
|
@@ -13117,6 +13148,7 @@ class DeviceSettings extends BaseMethod {
|
|
|
13117
13148
|
class DeviceUpdateReboot extends BaseMethod {
|
|
13118
13149
|
init() {
|
|
13119
13150
|
this.useDevicePassphraseState = false;
|
|
13151
|
+
this.skipForceUpdateCheck = true;
|
|
13120
13152
|
}
|
|
13121
13153
|
run() {
|
|
13122
13154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -13192,6 +13224,7 @@ class DeviceUploadResource extends BaseMethod {
|
|
|
13192
13224
|
}
|
|
13193
13225
|
init() {
|
|
13194
13226
|
this.useDevicePassphraseState = false;
|
|
13227
|
+
this.skipForceUpdateCheck = true;
|
|
13195
13228
|
validateParams(this.payload, [
|
|
13196
13229
|
{ name: 'suffix', type: 'string', required: true },
|
|
13197
13230
|
{ name: 'dataHex', type: 'string', required: true },
|
|
@@ -13232,6 +13265,7 @@ class DeviceUploadResource extends BaseMethod {
|
|
|
13232
13265
|
class DeviceSupportFeatures extends BaseMethod {
|
|
13233
13266
|
init() {
|
|
13234
13267
|
this.useDevicePassphraseState = false;
|
|
13268
|
+
this.skipForceUpdateCheck = true;
|
|
13235
13269
|
}
|
|
13236
13270
|
run() {
|
|
13237
13271
|
if (!this.device.features)
|
|
@@ -13468,9 +13502,10 @@ class DeviceFullyUploadResource extends BaseMethod {
|
|
|
13468
13502
|
};
|
|
13469
13503
|
}
|
|
13470
13504
|
init() {
|
|
13471
|
-
this.
|
|
13505
|
+
this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
|
|
13472
13506
|
this.requireDeviceMode = [];
|
|
13473
13507
|
this.useDevicePassphraseState = false;
|
|
13508
|
+
this.skipForceUpdateCheck = true;
|
|
13474
13509
|
}
|
|
13475
13510
|
isSupportResourceUpdate(features, updateType) {
|
|
13476
13511
|
if (updateType !== 'firmware')
|
|
@@ -13516,9 +13551,10 @@ class DeviceUpdateBootloader extends BaseMethod {
|
|
|
13516
13551
|
};
|
|
13517
13552
|
}
|
|
13518
13553
|
init() {
|
|
13519
|
-
this.
|
|
13554
|
+
this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
|
|
13520
13555
|
this.requireDeviceMode = [];
|
|
13521
13556
|
this.useDevicePassphraseState = false;
|
|
13557
|
+
this.skipForceUpdateCheck = true;
|
|
13522
13558
|
}
|
|
13523
13559
|
run() {
|
|
13524
13560
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -13549,9 +13585,10 @@ class DeviceUpdateBootloader extends BaseMethod {
|
|
|
13549
13585
|
|
|
13550
13586
|
class FirmwareUpdate extends BaseMethod {
|
|
13551
13587
|
init() {
|
|
13552
|
-
this.
|
|
13588
|
+
this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
|
|
13553
13589
|
this.requireDeviceMode = [UI_REQUEST.BOOTLOADER];
|
|
13554
13590
|
this.useDevicePassphraseState = false;
|
|
13591
|
+
this.skipForceUpdateCheck = true;
|
|
13555
13592
|
const { payload } = this;
|
|
13556
13593
|
validateParams(payload, [
|
|
13557
13594
|
{ name: 'version', type: 'array' },
|
|
@@ -13612,9 +13649,10 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
13612
13649
|
};
|
|
13613
13650
|
}
|
|
13614
13651
|
init() {
|
|
13615
|
-
this.
|
|
13652
|
+
this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
|
|
13616
13653
|
this.requireDeviceMode = [];
|
|
13617
13654
|
this.useDevicePassphraseState = false;
|
|
13655
|
+
this.skipForceUpdateCheck = true;
|
|
13618
13656
|
const { payload } = this;
|
|
13619
13657
|
validateParams(payload, [
|
|
13620
13658
|
{ name: 'version', type: 'array' },
|
|
@@ -13789,6 +13827,7 @@ class RequestWebUsbDevice extends BaseMethod {
|
|
|
13789
13827
|
init() {
|
|
13790
13828
|
this.useDevice = false;
|
|
13791
13829
|
this.useDevicePassphraseState = false;
|
|
13830
|
+
this.skipForceUpdateCheck = true;
|
|
13792
13831
|
}
|
|
13793
13832
|
run() {
|
|
13794
13833
|
var _a, _b;
|
|
@@ -13823,7 +13862,7 @@ class CipherKeyValue extends BaseMethod {
|
|
|
13823
13862
|
init() {
|
|
13824
13863
|
var _a;
|
|
13825
13864
|
this.checkDeviceId = true;
|
|
13826
|
-
this.
|
|
13865
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
13827
13866
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
13828
13867
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
13829
13868
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -14117,7 +14156,7 @@ class BTCGetAddress extends BaseMethod {
|
|
|
14117
14156
|
}
|
|
14118
14157
|
init() {
|
|
14119
14158
|
this.checkDeviceId = true;
|
|
14120
|
-
this.
|
|
14159
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14121
14160
|
this.hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
|
|
14122
14161
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
14123
14162
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -14171,7 +14210,7 @@ class BTCGetPublicKey extends BaseMethod {
|
|
|
14171
14210
|
}
|
|
14172
14211
|
init() {
|
|
14173
14212
|
this.checkDeviceId = true;
|
|
14174
|
-
this.
|
|
14213
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14175
14214
|
this.hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
|
|
14176
14215
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
14177
14216
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -14230,7 +14269,7 @@ class BTCGetPublicKey extends BaseMethod {
|
|
|
14230
14269
|
class BTCSignMessage extends BaseMethod {
|
|
14231
14270
|
init() {
|
|
14232
14271
|
this.checkDeviceId = true;
|
|
14233
|
-
this.
|
|
14272
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14234
14273
|
validateParams(this.payload, [
|
|
14235
14274
|
{ name: 'path', required: true },
|
|
14236
14275
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -14529,7 +14568,7 @@ var signtxLegacy = (typedCall, inputs, outputs, refTxsArray, options, coinName)
|
|
|
14529
14568
|
class BTCSignTransaction extends BaseMethod {
|
|
14530
14569
|
init() {
|
|
14531
14570
|
this.checkDeviceId = true;
|
|
14532
|
-
this.
|
|
14571
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14533
14572
|
validateParams(this.payload, [
|
|
14534
14573
|
{ name: 'coin', type: 'string', required: true },
|
|
14535
14574
|
{ name: 'inputs', type: 'array', required: true },
|
|
@@ -14620,7 +14659,7 @@ class BTCSignTransaction extends BaseMethod {
|
|
|
14620
14659
|
class BTCVerifyMessage extends BaseMethod {
|
|
14621
14660
|
init() {
|
|
14622
14661
|
this.checkDeviceId = true;
|
|
14623
|
-
this.
|
|
14662
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14624
14663
|
validateParams(this.payload, [
|
|
14625
14664
|
{ name: 'address', type: 'string', required: true },
|
|
14626
14665
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -14652,7 +14691,7 @@ class ConfluxGetAddress extends BaseMethod {
|
|
|
14652
14691
|
}
|
|
14653
14692
|
init() {
|
|
14654
14693
|
var _a;
|
|
14655
|
-
this.
|
|
14694
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14656
14695
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
14657
14696
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
14658
14697
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -14695,7 +14734,7 @@ class ConfluxGetAddress extends BaseMethod {
|
|
|
14695
14734
|
|
|
14696
14735
|
class ConfluxSignMessage extends BaseMethod {
|
|
14697
14736
|
init() {
|
|
14698
|
-
this.
|
|
14737
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14699
14738
|
validateParams(this.payload, [
|
|
14700
14739
|
{ name: 'path', required: true },
|
|
14701
14740
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -14724,7 +14763,7 @@ class ConfluxSignMessage extends BaseMethod {
|
|
|
14724
14763
|
|
|
14725
14764
|
class ConfluxSignMessageCIP23 extends BaseMethod {
|
|
14726
14765
|
init() {
|
|
14727
|
-
this.
|
|
14766
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14728
14767
|
validateParams(this.payload, [
|
|
14729
14768
|
{ name: 'path', required: true },
|
|
14730
14769
|
{ name: 'domainHash', type: 'hexString', required: true },
|
|
@@ -14809,7 +14848,7 @@ class ConfluxSignTransaction extends BaseMethod {
|
|
|
14809
14848
|
});
|
|
14810
14849
|
}
|
|
14811
14850
|
init() {
|
|
14812
|
-
this.
|
|
14851
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14813
14852
|
validateParams(this.payload, [
|
|
14814
14853
|
{ name: 'path', required: true },
|
|
14815
14854
|
{ name: 'transaction', type: 'object', required: true },
|
|
@@ -14858,7 +14897,7 @@ class EvmGetAddress extends BaseMethod {
|
|
|
14858
14897
|
init() {
|
|
14859
14898
|
var _a;
|
|
14860
14899
|
this.checkDeviceId = true;
|
|
14861
|
-
this.
|
|
14900
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14862
14901
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
14863
14902
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
14864
14903
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -14905,7 +14944,7 @@ class EVMGetPublicKey extends BaseMethod {
|
|
|
14905
14944
|
init() {
|
|
14906
14945
|
var _a, _b;
|
|
14907
14946
|
this.checkDeviceId = true;
|
|
14908
|
-
this.
|
|
14947
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14909
14948
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
14910
14949
|
this.useBatch = !!((_b = this.payload) === null || _b === void 0 ? void 0 : _b.useBatch);
|
|
14911
14950
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -14955,7 +14994,7 @@ class EVMGetPublicKey extends BaseMethod {
|
|
|
14955
14994
|
class EVMSignMessage$2 extends BaseMethod {
|
|
14956
14995
|
init() {
|
|
14957
14996
|
this.checkDeviceId = true;
|
|
14958
|
-
this.
|
|
14997
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14959
14998
|
validateParams(this.payload, [
|
|
14960
14999
|
{ name: 'path', required: true },
|
|
14961
15000
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -14980,7 +15019,7 @@ class EVMSignMessage$2 extends BaseMethod {
|
|
|
14980
15019
|
class EVMSignMessageEIP712 extends BaseMethod {
|
|
14981
15020
|
init() {
|
|
14982
15021
|
this.checkDeviceId = true;
|
|
14983
|
-
this.
|
|
15022
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
14984
15023
|
validateParams(this.payload, [
|
|
14985
15024
|
{ name: 'path', required: true },
|
|
14986
15025
|
{ name: 'domainHash', type: 'hexString', required: true },
|
|
@@ -15085,7 +15124,7 @@ class EVMSignTransaction extends BaseMethod {
|
|
|
15085
15124
|
}
|
|
15086
15125
|
init() {
|
|
15087
15126
|
this.checkDeviceId = true;
|
|
15088
|
-
this.
|
|
15127
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15089
15128
|
validateParams(this.payload, [
|
|
15090
15129
|
{ name: 'path', required: true },
|
|
15091
15130
|
{ name: 'transaction', type: 'object', required: true },
|
|
@@ -15252,7 +15291,7 @@ const getFieldType = (typeName, types) => {
|
|
|
15252
15291
|
class EVMSignTypedData extends BaseMethod {
|
|
15253
15292
|
init() {
|
|
15254
15293
|
this.checkDeviceId = true;
|
|
15255
|
-
this.
|
|
15294
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15256
15295
|
validateParams(this.payload, [
|
|
15257
15296
|
{ name: 'path', required: true },
|
|
15258
15297
|
{ name: 'metamaskV4Compat', type: 'boolean' },
|
|
@@ -15369,6 +15408,30 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
15369
15408
|
},
|
|
15370
15409
|
};
|
|
15371
15410
|
}
|
|
15411
|
+
hasNestedArrays(item) {
|
|
15412
|
+
if (!item)
|
|
15413
|
+
return false;
|
|
15414
|
+
if (Array.isArray(item)) {
|
|
15415
|
+
for (const element of item) {
|
|
15416
|
+
if (Array.isArray(element)) {
|
|
15417
|
+
return true;
|
|
15418
|
+
}
|
|
15419
|
+
if (typeof element === 'object' && element !== null) {
|
|
15420
|
+
if (this.hasNestedArrays(element)) {
|
|
15421
|
+
return true;
|
|
15422
|
+
}
|
|
15423
|
+
}
|
|
15424
|
+
}
|
|
15425
|
+
}
|
|
15426
|
+
else if (typeof item === 'object' && item !== null) {
|
|
15427
|
+
for (const property in item) {
|
|
15428
|
+
if (this.hasNestedArrays(item[property])) {
|
|
15429
|
+
return true;
|
|
15430
|
+
}
|
|
15431
|
+
}
|
|
15432
|
+
}
|
|
15433
|
+
return false;
|
|
15434
|
+
}
|
|
15372
15435
|
supportSignTyped() {
|
|
15373
15436
|
const deviceType = getDeviceType(this.device.features);
|
|
15374
15437
|
if (deviceType === 'classic' || deviceType === 'mini') {
|
|
@@ -15411,6 +15474,25 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
15411
15474
|
}
|
|
15412
15475
|
return Promise.resolve(response.message);
|
|
15413
15476
|
}
|
|
15477
|
+
const currentVersion = getDeviceFirmwareVersion(this.device.features).join('.');
|
|
15478
|
+
if (this.hasNestedArrays(this.params.data)) {
|
|
15479
|
+
const supportNestedArraysSignVersion = '4.2.0';
|
|
15480
|
+
if (semver__default["default"].gte(currentVersion, supportNestedArraysSignVersion)) {
|
|
15481
|
+
validateParams(this.params, [
|
|
15482
|
+
{ name: 'domainHash', type: 'hexString', required: true },
|
|
15483
|
+
{ name: 'messageHash', type: 'hexString', required: true },
|
|
15484
|
+
]);
|
|
15485
|
+
const { domainHash, messageHash } = this.params;
|
|
15486
|
+
const response = yield this.device.commands.typedCall('EthereumSignTypedHash', 'EthereumTypedDataSignature', {
|
|
15487
|
+
address_n: addressN,
|
|
15488
|
+
domain_separator_hash: domainHash !== null && domainHash !== void 0 ? domainHash : '',
|
|
15489
|
+
message_hash: messageHash,
|
|
15490
|
+
chain_id: chainId,
|
|
15491
|
+
});
|
|
15492
|
+
return Promise.resolve(response.message);
|
|
15493
|
+
}
|
|
15494
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodNeedUpgradeFirmware, `Device firmware version is too low, please update to ${supportNestedArraysSignVersion}`, { current: currentVersion, require: supportNestedArraysSignVersion });
|
|
15495
|
+
}
|
|
15414
15496
|
return this.signTypedData();
|
|
15415
15497
|
});
|
|
15416
15498
|
}
|
|
@@ -15419,7 +15501,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
15419
15501
|
class EVMSignMessage$1 extends BaseMethod {
|
|
15420
15502
|
init() {
|
|
15421
15503
|
this.checkDeviceId = true;
|
|
15422
|
-
this.
|
|
15504
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15423
15505
|
validateParams(this.payload, [
|
|
15424
15506
|
{ name: 'address', type: 'string', required: true },
|
|
15425
15507
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -15450,7 +15532,7 @@ class StarcoinGetAddress extends BaseMethod {
|
|
|
15450
15532
|
init() {
|
|
15451
15533
|
var _a;
|
|
15452
15534
|
this.checkDeviceId = true;
|
|
15453
|
-
this.
|
|
15535
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15454
15536
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
15455
15537
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
15456
15538
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -15490,7 +15572,7 @@ class StarcoinGetPublicKey extends BaseMethod {
|
|
|
15490
15572
|
init() {
|
|
15491
15573
|
var _a;
|
|
15492
15574
|
this.checkDeviceId = true;
|
|
15493
|
-
this.
|
|
15575
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15494
15576
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
15495
15577
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
15496
15578
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -15525,7 +15607,7 @@ class StarcoinGetPublicKey extends BaseMethod {
|
|
|
15525
15607
|
class StarcoinSignMessage extends BaseMethod {
|
|
15526
15608
|
init() {
|
|
15527
15609
|
this.checkDeviceId = true;
|
|
15528
|
-
this.
|
|
15610
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15529
15611
|
validateParams(this.payload, [
|
|
15530
15612
|
{ name: 'path', required: true },
|
|
15531
15613
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -15548,7 +15630,7 @@ class StarcoinSignMessage extends BaseMethod {
|
|
|
15548
15630
|
class StarcoinSignTransaction extends BaseMethod {
|
|
15549
15631
|
init() {
|
|
15550
15632
|
this.checkDeviceId = true;
|
|
15551
|
-
this.
|
|
15633
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15552
15634
|
validateParams(this.payload, [
|
|
15553
15635
|
{ name: 'path', required: true },
|
|
15554
15636
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -15571,7 +15653,7 @@ class StarcoinSignTransaction extends BaseMethod {
|
|
|
15571
15653
|
class EVMSignMessage extends BaseMethod {
|
|
15572
15654
|
init() {
|
|
15573
15655
|
this.checkDeviceId = true;
|
|
15574
|
-
this.
|
|
15656
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15575
15657
|
validateParams(this.payload, [
|
|
15576
15658
|
{ name: 'publicKey', type: 'string', required: true },
|
|
15577
15659
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -15601,7 +15683,7 @@ class NEMGetAddress extends BaseMethod {
|
|
|
15601
15683
|
init() {
|
|
15602
15684
|
var _a;
|
|
15603
15685
|
this.checkDeviceId = true;
|
|
15604
|
-
this.
|
|
15686
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15605
15687
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
15606
15688
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
15607
15689
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -15808,7 +15890,7 @@ class NEMSignTransaction extends BaseMethod {
|
|
|
15808
15890
|
}
|
|
15809
15891
|
init() {
|
|
15810
15892
|
this.checkDeviceId = true;
|
|
15811
|
-
this.
|
|
15893
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15812
15894
|
validateParams(this.payload, [
|
|
15813
15895
|
{ name: 'path', required: true },
|
|
15814
15896
|
{ name: 'transaction', type: 'object', required: true },
|
|
@@ -15833,7 +15915,7 @@ class SolGetAddress extends BaseMethod {
|
|
|
15833
15915
|
init() {
|
|
15834
15916
|
var _a;
|
|
15835
15917
|
this.checkDeviceId = true;
|
|
15836
|
-
this.
|
|
15918
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15837
15919
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
15838
15920
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
15839
15921
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -15877,7 +15959,7 @@ class SolSignTransaction extends BaseMethod {
|
|
|
15877
15959
|
init() {
|
|
15878
15960
|
var _a;
|
|
15879
15961
|
this.checkDeviceId = true;
|
|
15880
|
-
this.
|
|
15962
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15881
15963
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
15882
15964
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
15883
15965
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -15929,7 +16011,7 @@ class StellarGetAddress extends BaseMethod {
|
|
|
15929
16011
|
init() {
|
|
15930
16012
|
var _a;
|
|
15931
16013
|
this.checkDeviceId = true;
|
|
15932
|
-
this.
|
|
16014
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
15933
16015
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
15934
16016
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
15935
16017
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -16093,7 +16175,7 @@ class StellarSignTransaction extends BaseMethod {
|
|
|
16093
16175
|
}
|
|
16094
16176
|
init() {
|
|
16095
16177
|
this.checkDeviceId = true;
|
|
16096
|
-
this.
|
|
16178
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16097
16179
|
validateParams(this.payload, [
|
|
16098
16180
|
{ name: 'path', required: true },
|
|
16099
16181
|
{ name: 'networkPassphrase', type: 'string', required: true },
|
|
@@ -16146,7 +16228,7 @@ class TronGetAddress extends BaseMethod {
|
|
|
16146
16228
|
init() {
|
|
16147
16229
|
var _a;
|
|
16148
16230
|
this.checkDeviceId = true;
|
|
16149
|
-
this.
|
|
16231
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16150
16232
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
16151
16233
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
16152
16234
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -16192,7 +16274,7 @@ class TronGetAddress extends BaseMethod {
|
|
|
16192
16274
|
class TronSignMessage extends BaseMethod {
|
|
16193
16275
|
init() {
|
|
16194
16276
|
this.checkDeviceId = true;
|
|
16195
|
-
this.
|
|
16277
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16196
16278
|
validateParams(this.payload, [
|
|
16197
16279
|
{ name: 'path', required: true },
|
|
16198
16280
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -16256,7 +16338,7 @@ class TronSignTransaction extends BaseMethod {
|
|
|
16256
16338
|
}
|
|
16257
16339
|
init() {
|
|
16258
16340
|
this.checkDeviceId = true;
|
|
16259
|
-
this.
|
|
16341
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16260
16342
|
validateParams(this.payload, [
|
|
16261
16343
|
{ name: 'path', required: true },
|
|
16262
16344
|
{ name: 'transaction', type: 'object', required: true },
|
|
@@ -16295,7 +16377,7 @@ class NearGetAddress extends BaseMethod {
|
|
|
16295
16377
|
init() {
|
|
16296
16378
|
var _a;
|
|
16297
16379
|
this.checkDeviceId = true;
|
|
16298
|
-
this.
|
|
16380
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16299
16381
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
16300
16382
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
16301
16383
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -16341,7 +16423,7 @@ class NearGetAddress extends BaseMethod {
|
|
|
16341
16423
|
class NearSignTransaction extends BaseMethod {
|
|
16342
16424
|
init() {
|
|
16343
16425
|
this.checkDeviceId = true;
|
|
16344
|
-
this.
|
|
16426
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16345
16427
|
validateParams(this.payload, [
|
|
16346
16428
|
{ name: 'path', required: true },
|
|
16347
16429
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -16376,7 +16458,7 @@ class AptosGetAddress extends BaseMethod {
|
|
|
16376
16458
|
init() {
|
|
16377
16459
|
var _a;
|
|
16378
16460
|
this.checkDeviceId = true;
|
|
16379
|
-
this.
|
|
16461
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16380
16462
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
16381
16463
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
16382
16464
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -16446,7 +16528,7 @@ class AptosGetPublicKey extends BaseMethod {
|
|
|
16446
16528
|
init() {
|
|
16447
16529
|
var _a;
|
|
16448
16530
|
this.checkDeviceId = true;
|
|
16449
|
-
this.
|
|
16531
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16450
16532
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
16451
16533
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
16452
16534
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -16490,7 +16572,7 @@ class AptosGetPublicKey extends BaseMethod {
|
|
|
16490
16572
|
class AptosSignTransaction extends BaseMethod {
|
|
16491
16573
|
init() {
|
|
16492
16574
|
this.checkDeviceId = true;
|
|
16493
|
-
this.
|
|
16575
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16494
16576
|
validateParams(this.payload, [
|
|
16495
16577
|
{ name: 'path', required: true },
|
|
16496
16578
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -16520,7 +16602,7 @@ class AptosSignTransaction extends BaseMethod {
|
|
|
16520
16602
|
class AptosSignMessage extends BaseMethod {
|
|
16521
16603
|
init() {
|
|
16522
16604
|
this.checkDeviceId = true;
|
|
16523
|
-
this.
|
|
16605
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16524
16606
|
validateParams(this.payload, [
|
|
16525
16607
|
{ name: 'path', required: true },
|
|
16526
16608
|
{ name: 'payload', type: 'object', required: true },
|
|
@@ -16586,7 +16668,7 @@ class AlgoGetAddress extends BaseMethod {
|
|
|
16586
16668
|
init() {
|
|
16587
16669
|
var _a;
|
|
16588
16670
|
this.checkDeviceId = true;
|
|
16589
|
-
this.
|
|
16671
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode];
|
|
16590
16672
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
16591
16673
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
16592
16674
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -16636,7 +16718,7 @@ class AlgoSignTransaction extends BaseMethod {
|
|
|
16636
16718
|
}
|
|
16637
16719
|
init() {
|
|
16638
16720
|
this.checkDeviceId = true;
|
|
16639
|
-
this.
|
|
16721
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode];
|
|
16640
16722
|
validateParams(this.payload, [
|
|
16641
16723
|
{ name: 'path', required: true },
|
|
16642
16724
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -16675,7 +16757,7 @@ class CosmosGetAddress extends BaseMethod {
|
|
|
16675
16757
|
init() {
|
|
16676
16758
|
var _a;
|
|
16677
16759
|
this.checkDeviceId = true;
|
|
16678
|
-
this.
|
|
16760
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode];
|
|
16679
16761
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
16680
16762
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
16681
16763
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -16732,7 +16814,7 @@ class CosmosGetPublicKey extends BaseMethod {
|
|
|
16732
16814
|
init() {
|
|
16733
16815
|
var _a;
|
|
16734
16816
|
this.checkDeviceId = true;
|
|
16735
|
-
this.
|
|
16817
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16736
16818
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
16737
16819
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
16738
16820
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -16792,7 +16874,7 @@ class CosmosSignTransaction extends BaseMethod {
|
|
|
16792
16874
|
}
|
|
16793
16875
|
init() {
|
|
16794
16876
|
this.checkDeviceId = true;
|
|
16795
|
-
this.
|
|
16877
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode];
|
|
16796
16878
|
validateParams(this.payload, [
|
|
16797
16879
|
{ name: 'path', required: true },
|
|
16798
16880
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -16834,7 +16916,7 @@ class XrpGetAddress$1 extends BaseMethod {
|
|
|
16834
16916
|
init() {
|
|
16835
16917
|
var _a;
|
|
16836
16918
|
this.checkDeviceId = true;
|
|
16837
|
-
this.
|
|
16919
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16838
16920
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
16839
16921
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
16840
16922
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -16902,7 +16984,7 @@ class XrpGetAddress extends BaseMethod {
|
|
|
16902
16984
|
}
|
|
16903
16985
|
init() {
|
|
16904
16986
|
this.checkDeviceId = true;
|
|
16905
|
-
this.
|
|
16987
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16906
16988
|
const { payload } = this;
|
|
16907
16989
|
validateParams(payload, [
|
|
16908
16990
|
{ name: 'path', required: true },
|
|
@@ -16961,7 +17043,7 @@ class SuiGetAddress extends BaseMethod {
|
|
|
16961
17043
|
init() {
|
|
16962
17044
|
var _a;
|
|
16963
17045
|
this.checkDeviceId = true;
|
|
16964
|
-
this.
|
|
17046
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16965
17047
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
16966
17048
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
16967
17049
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -17034,7 +17116,7 @@ class SuiGetPublicKey extends BaseMethod {
|
|
|
17034
17116
|
init() {
|
|
17035
17117
|
var _a;
|
|
17036
17118
|
this.checkDeviceId = true;
|
|
17037
|
-
this.
|
|
17119
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
17038
17120
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
17039
17121
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
17040
17122
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -17081,7 +17163,7 @@ class SuiGetPublicKey extends BaseMethod {
|
|
|
17081
17163
|
class SuiSignTransaction extends BaseMethod {
|
|
17082
17164
|
init() {
|
|
17083
17165
|
this.checkDeviceId = true;
|
|
17084
|
-
this.
|
|
17166
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
17085
17167
|
validateParams(this.payload, [
|
|
17086
17168
|
{ name: 'path', required: true },
|
|
17087
17169
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -17196,7 +17278,7 @@ class CardanoGetAddress extends BaseMethod {
|
|
|
17196
17278
|
init() {
|
|
17197
17279
|
var _a, _b;
|
|
17198
17280
|
this.checkDeviceId = true;
|
|
17199
|
-
this.
|
|
17281
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
17200
17282
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
17201
17283
|
this.isCheck = !!((_b = this.payload) === null || _b === void 0 ? void 0 : _b.isCheck);
|
|
17202
17284
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -17286,7 +17368,7 @@ class CardanoGetPublicKey extends BaseMethod {
|
|
|
17286
17368
|
init() {
|
|
17287
17369
|
var _a;
|
|
17288
17370
|
this.checkDeviceId = true;
|
|
17289
|
-
this.
|
|
17371
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
17290
17372
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
17291
17373
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
17292
17374
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -17736,7 +17818,7 @@ class CardanoSignTransaction extends BaseMethod {
|
|
|
17736
17818
|
init() {
|
|
17737
17819
|
var _a;
|
|
17738
17820
|
this.checkDeviceId = true;
|
|
17739
|
-
this.
|
|
17821
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
17740
17822
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
17741
17823
|
const { payload } = this;
|
|
17742
17824
|
validateParams(payload, [
|
|
@@ -17958,7 +18040,7 @@ class CardanoSignTransaction extends BaseMethod {
|
|
|
17958
18040
|
class CardanoSignMessage extends BaseMethod {
|
|
17959
18041
|
init() {
|
|
17960
18042
|
this.checkDeviceId = true;
|
|
17961
|
-
this.
|
|
18043
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
17962
18044
|
const { payload } = this;
|
|
17963
18045
|
validateParams(payload, [
|
|
17964
18046
|
{ name: 'path', type: 'string', required: true },
|
|
@@ -18002,7 +18084,7 @@ class FilecoinGetAddress extends BaseMethod {
|
|
|
18002
18084
|
init() {
|
|
18003
18085
|
var _a;
|
|
18004
18086
|
this.checkDeviceId = true;
|
|
18005
|
-
this.
|
|
18087
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
18006
18088
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
18007
18089
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
18008
18090
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -18057,7 +18139,7 @@ class FilecoinSignTransaction extends BaseMethod {
|
|
|
18057
18139
|
}
|
|
18058
18140
|
init() {
|
|
18059
18141
|
this.checkDeviceId = true;
|
|
18060
|
-
this.
|
|
18142
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode];
|
|
18061
18143
|
validateParams(this.payload, [
|
|
18062
18144
|
{ name: 'path', required: true },
|
|
18063
18145
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -18101,7 +18183,7 @@ class PolkadotGetAddress extends BaseMethod {
|
|
|
18101
18183
|
init() {
|
|
18102
18184
|
var _a;
|
|
18103
18185
|
this.checkDeviceId = true;
|
|
18104
|
-
this.
|
|
18186
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode];
|
|
18105
18187
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
18106
18188
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
18107
18189
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -18160,7 +18242,7 @@ class PolkadotSignTransaction extends BaseMethod {
|
|
|
18160
18242
|
}
|
|
18161
18243
|
init() {
|
|
18162
18244
|
this.checkDeviceId = true;
|
|
18163
|
-
this.
|
|
18245
|
+
this.notAllowDeviceMode = [...this.notAllowDeviceMode];
|
|
18164
18246
|
validateParams(this.payload, [
|
|
18165
18247
|
{ name: 'path', required: true },
|
|
18166
18248
|
{ name: 'network', required: true },
|
|
@@ -18480,22 +18562,30 @@ const callAPI = (message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
18480
18562
|
const versionRangeType = method.getVersionRange()[deviceType];
|
|
18481
18563
|
const versionRangeModel = method.getVersionRange()[deviceModel];
|
|
18482
18564
|
const versionRange = versionRangeType !== null && versionRangeType !== void 0 ? versionRangeType : versionRangeModel;
|
|
18483
|
-
if (
|
|
18484
|
-
|
|
18485
|
-
|
|
18486
|
-
|
|
18487
|
-
|
|
18488
|
-
|
|
18489
|
-
}
|
|
18490
|
-
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodNeedUpgradeFirmware, `Device firmware version is too low, please update to ${versionRange.min}`, { current: currentVersion, require: versionRange.min }));
|
|
18565
|
+
if (device.features) {
|
|
18566
|
+
yield DataManager.checkAndReloadData();
|
|
18567
|
+
const newVersionStatus = DataManager.getFirmwareStatus(device.features);
|
|
18568
|
+
const bleVersionStatus = DataManager.getBLEFirmwareStatus(device.features);
|
|
18569
|
+
if ((newVersionStatus === 'required' || bleVersionStatus === 'required') &&
|
|
18570
|
+
method.skipForceUpdateCheck === false) {
|
|
18571
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.NewFirmwareForceUpdate, 'Device firmware version is too low, please update to the latest version', { connectId: method.connectId, deviceId: method.deviceId });
|
|
18491
18572
|
}
|
|
18492
|
-
if (versionRange
|
|
18493
|
-
|
|
18494
|
-
semver__default["default"].
|
|
18495
|
-
|
|
18573
|
+
if (versionRange) {
|
|
18574
|
+
const currentVersion = getDeviceFirmwareVersion(device.features).join('.');
|
|
18575
|
+
if (semver__default["default"].valid(versionRange.min) && semver__default["default"].lt(currentVersion, versionRange.min)) {
|
|
18576
|
+
if (newVersionStatus === 'none' || newVersionStatus === 'valid') {
|
|
18577
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.NewFirmwareUnRelease);
|
|
18578
|
+
}
|
|
18579
|
+
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodNeedUpgradeFirmware, `Device firmware version is too low, please update to ${versionRange.min}`, { current: currentVersion, require: versionRange.min }));
|
|
18580
|
+
}
|
|
18581
|
+
if (versionRange.max &&
|
|
18582
|
+
semver__default["default"].valid(versionRange.max) &&
|
|
18583
|
+
semver__default["default"].gte(currentVersion, versionRange.max)) {
|
|
18584
|
+
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodDeprecated, `Device firmware version is too high, this method has been deprecated in ${versionRange.max}`, { current: currentVersion, deprecated: versionRange.max }));
|
|
18585
|
+
}
|
|
18496
18586
|
}
|
|
18497
18587
|
}
|
|
18498
|
-
const unexpectedMode = device.hasUnexpectedMode(method.
|
|
18588
|
+
const unexpectedMode = device.hasUnexpectedMode(method.notAllowDeviceMode, method.requireDeviceMode);
|
|
18499
18589
|
if (unexpectedMode) {
|
|
18500
18590
|
if (unexpectedMode === UI_REQUEST$1.NOT_IN_BOOTLOADER) {
|
|
18501
18591
|
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceUnexpectedBootloaderMode));
|