@onekeyfe/hd-core 1.1.27-alpha.41 → 1.1.27-alpha.43
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/__tests__/DeviceCommands.test.ts +99 -0
- package/__tests__/evmLedgerLegacySafety.test.ts +261 -0
- package/__tests__/logBlockEvent.test.ts +37 -0
- package/__tests__/preInitialize.test.ts +22 -0
- package/__tests__/protocol-v2.test.ts +139 -27
- package/dist/api/BaseMethod.d.ts +7 -1
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/algo/AlgoSignTransaction.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignTransaction.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
- package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessage.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosSignTransaction.d.ts.map +1 -1
- package/dist/api/device/DeviceLock.d.ts.map +1 -1
- package/dist/api/device/PreInitialize.d.ts +6 -0
- package/dist/api/device/PreInitialize.d.ts.map +1 -0
- package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessage.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +2 -10
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/near/NearSignTransaction.d.ts.map +1 -1
- package/dist/api/nem/NEMSignTransaction.d.ts.map +1 -1
- package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
- package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
- package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignEvent.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignSchnorr.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotSignTransaction.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +1 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -1
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +1 -1
- package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignMessage.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignTransaction.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/api/sui/SuiGetAddress.d.ts +3 -0
- package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts +3 -0
- package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts +3 -0
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +3 -0
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonGetAddress.d.ts +3 -0
- package/dist/api/ton/TonGetAddress.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +5 -0
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts +3 -0
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts +3 -0
- package/dist/api/ton/TonSignProof.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/xrp/XrpSignTransaction.d.ts.map +1 -1
- package/dist/core/PollingStateManager.d.ts +8 -0
- package/dist/core/PollingStateManager.d.ts.map +1 -0
- package/dist/core/RequestQueue.d.ts +1 -1
- package/dist/core/RequestQueue.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/device/Device.d.ts +17 -2
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/events/logBlockEvent.d.ts +1 -0
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/index.d.ts +25 -5
- package/dist/index.js +928 -407
- package/dist/types/api/index.d.ts +2 -0
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/preInitialize.d.ts +3 -0
- package/dist/types/api/preInitialize.d.ts.map +1 -0
- package/dist/types/api/protocolV2.d.ts +2 -2
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/params.d.ts +1 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +82 -2
- package/src/api/FirmwareUpdateV3.ts +0 -4
- package/src/api/FirmwareUpdateV4.ts +1 -19
- package/src/api/GetPassphraseState.ts +4 -3
- package/src/api/alephium/AlephiumSignMessage.ts +1 -0
- package/src/api/alephium/AlephiumSignTransaction.ts +1 -0
- package/src/api/algo/AlgoSignTransaction.ts +1 -0
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +8 -0
- package/src/api/aptos/AptosSignInMessage.ts +1 -0
- package/src/api/aptos/AptosSignMessage.ts +1 -0
- package/src/api/aptos/AptosSignTransaction.ts +1 -0
- package/src/api/benfen/BenfenSignMessage.ts +1 -0
- package/src/api/benfen/BenfenSignTransaction.ts +1 -0
- package/src/api/btc/BTCSignMessage.ts +1 -0
- package/src/api/btc/BTCSignPsbt.ts +1 -0
- package/src/api/btc/BTCSignTransaction.ts +1 -0
- package/src/api/cardano/CardanoSignMessage.ts +1 -0
- package/src/api/cardano/CardanoSignTransaction.ts +1 -0
- package/src/api/conflux/ConfluxSignMessage.ts +1 -0
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +1 -0
- package/src/api/conflux/ConfluxSignTransaction.ts +1 -0
- package/src/api/cosmos/CosmosSignTransaction.ts +1 -0
- package/src/api/device/DeviceLock.ts +1 -3
- package/src/api/device/PreInitialize.ts +41 -0
- package/src/api/dynex/DnxSignTransaction.ts +1 -0
- package/src/api/evm/EVMSignMessage.ts +2 -0
- package/src/api/evm/EVMSignMessageEIP712.ts +1 -0
- package/src/api/evm/EVMSignTransaction.ts +2 -0
- package/src/api/evm/EVMSignTypedData.ts +3 -1
- package/src/api/filecoin/FilecoinSignTransaction.ts +1 -0
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +4 -27
- package/src/api/index.ts +1 -0
- package/src/api/kaspa/KaspaSignTransaction.ts +1 -0
- package/src/api/near/NearSignTransaction.ts +1 -0
- package/src/api/nem/NEMSignTransaction.ts +1 -0
- package/src/api/neo/NeoSignTransaction.ts +1 -0
- package/src/api/nervos/NervosSignTransaction.ts +1 -0
- package/src/api/nexa/NexaSignTransaction.ts +2 -0
- package/src/api/nostr/NostrSignEvent.ts +1 -0
- package/src/api/nostr/NostrSignSchnorr.ts +1 -0
- package/src/api/polkadot/PolkadotSignTransaction.ts +1 -0
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +1 -5
- package/src/api/scdo/ScdoSignMessage.ts +1 -0
- package/src/api/scdo/ScdoSignTransaction.ts +1 -0
- package/src/api/solana/SolSignMessage.ts +1 -0
- package/src/api/solana/SolSignOffchainMessage.ts +1 -0
- package/src/api/solana/SolSignTransaction.ts +1 -0
- package/src/api/starcoin/StarcoinSignMessage.ts +1 -0
- package/src/api/starcoin/StarcoinSignTransaction.ts +1 -0
- package/src/api/stellar/StellarSignTransaction.ts +1 -0
- package/src/api/sui/SuiGetAddress.ts +3 -0
- package/src/api/sui/SuiGetPublicKey.ts +3 -0
- package/src/api/sui/SuiSignMessage.ts +4 -0
- package/src/api/sui/SuiSignTransaction.ts +4 -0
- package/src/api/ton/TonGetAddress.ts +3 -0
- package/src/api/ton/TonSignData.ts +11 -3
- package/src/api/ton/TonSignMessage.ts +4 -0
- package/src/api/ton/TonSignProof.ts +4 -0
- package/src/api/tron/TronSignMessage.ts +1 -0
- package/src/api/tron/TronSignTransaction.ts +1 -0
- package/src/api/xrp/XrpSignTransaction.ts +1 -0
- package/src/core/PollingStateManager.ts +47 -0
- package/src/core/RequestQueue.ts +10 -3
- package/src/core/index.ts +153 -34
- package/src/data/messages/messages-protocol-v2.json +489 -268
- package/src/device/Device.ts +73 -16
- package/src/events/logBlockEvent.ts +23 -0
- package/src/inject.ts +1 -1
- package/src/types/api/index.ts +2 -0
- package/src/types/api/preInitialize.ts +3 -0
- package/src/types/api/protocolV2.ts +2 -2
- package/src/types/params.ts +5 -0
- package/src/utils/deviceFeaturesUtils.ts +8 -17
package/dist/index.js
CHANGED
|
@@ -132,6 +132,7 @@ const createCoreApi = (call) => ({
|
|
|
132
132
|
checkFirmwareTypeAvailable: params => call(Object.assign(Object.assign({}, params), { method: 'checkFirmwareTypeAvailable' })),
|
|
133
133
|
cipherKeyValue: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cipherKeyValue' })),
|
|
134
134
|
testInitializeDeviceDuration: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'testInitializeDeviceDuration' })),
|
|
135
|
+
preInitialize: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'preInitialize' })),
|
|
135
136
|
deviceBackup: connectId => call({ connectId, method: 'deviceBackup' }),
|
|
136
137
|
deviceChangePin: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceChangePin' })),
|
|
137
138
|
deviceFlags: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceFlags' })),
|
|
@@ -816,7 +817,7 @@ const createLogMessage = (type, payload) => ({
|
|
|
816
817
|
|
|
817
818
|
const MAX_ENTRIES = 500;
|
|
818
819
|
let postMessage$1;
|
|
819
|
-
class Log$
|
|
820
|
+
class Log$i {
|
|
820
821
|
constructor(prefix, enabled) {
|
|
821
822
|
this.prefix = prefix;
|
|
822
823
|
this.enabled = enabled;
|
|
@@ -868,7 +869,7 @@ class Log$h {
|
|
|
868
869
|
}
|
|
869
870
|
const _logs = {};
|
|
870
871
|
const initLog = (prefix, enabled) => {
|
|
871
|
-
const instance = new Log$
|
|
872
|
+
const instance = new Log$i(prefix, !!enabled);
|
|
872
873
|
_logs[prefix] = instance;
|
|
873
874
|
return instance;
|
|
874
875
|
};
|
|
@@ -1066,7 +1067,7 @@ function patchFeatures(response) {
|
|
|
1066
1067
|
return response;
|
|
1067
1068
|
}
|
|
1068
1069
|
|
|
1069
|
-
const Log$
|
|
1070
|
+
const Log$h = getLogger(exports.LoggerNames.Core);
|
|
1070
1071
|
let globalInstanceCounter = 0;
|
|
1071
1072
|
let sdkInstanceCounter = 0;
|
|
1072
1073
|
function generateSdkInstanceId() {
|
|
@@ -1126,7 +1127,7 @@ function completeRequestContext(responseID, error) {
|
|
|
1126
1127
|
context.status = error ? 'error' : 'success';
|
|
1127
1128
|
if (error) {
|
|
1128
1129
|
context.error = error.message;
|
|
1129
|
-
Log$
|
|
1130
|
+
Log$h.error(`[RequestContext] [completeRequestContext] Error: ${formatRequestContext(context)}`);
|
|
1130
1131
|
}
|
|
1131
1132
|
globalActiveRequests.delete(responseID);
|
|
1132
1133
|
if (context.sdkInstanceId) {
|
|
@@ -25738,6 +25739,8 @@ var nested = {
|
|
|
25738
25739
|
MessageType_TonSignProof: 11905,
|
|
25739
25740
|
MessageType_TonSignedProof: 11906,
|
|
25740
25741
|
MessageType_TonTxAck: 11907,
|
|
25742
|
+
MessageType_TonSignData: 11908,
|
|
25743
|
+
MessageType_TonSignedData: 11909,
|
|
25741
25744
|
MessageType_ScdoGetAddress: 12001,
|
|
25742
25745
|
MessageType_ScdoAddress: 12002,
|
|
25743
25746
|
MessageType_ScdoSignTx: 12003,
|
|
@@ -25767,11 +25770,6 @@ var nested = {
|
|
|
25767
25770
|
MessageType_NeoAddress: 12302,
|
|
25768
25771
|
MessageType_NeoSignTx: 12303,
|
|
25769
25772
|
MessageType_NeoSignedTx: 12304,
|
|
25770
|
-
MessageType_UiviewShowAddressRequest: 30200,
|
|
25771
|
-
MessageType_UiviewShowPublicKeyRequest: 30201,
|
|
25772
|
-
MessageType_UiviewConfirmTxRequest: 30202,
|
|
25773
|
-
MessageType_UiviewConfirmSignMessageRequest: 30203,
|
|
25774
|
-
MessageType_UiviewResponse: 30204,
|
|
25775
25773
|
MessageType_ReadSEPublicKey: 10004,
|
|
25776
25774
|
MessageType_SEPublicKey: 10005,
|
|
25777
25775
|
MessageType_WriteSEPublicCert: 10006,
|
|
@@ -25782,6 +25780,9 @@ var nested = {
|
|
|
25782
25780
|
MessageType_ResourceUpload: 10018,
|
|
25783
25781
|
MessageType_ZoomRequest: 10019,
|
|
25784
25782
|
MessageType_BlurRequest: 10032,
|
|
25783
|
+
MessageType_SetWallpaper: 10033,
|
|
25784
|
+
MessageType_GetWallpaper: 10034,
|
|
25785
|
+
MessageType_Wallpaper: 10035,
|
|
25785
25786
|
MessageType_ResourceRequest: 10020,
|
|
25786
25787
|
MessageType_ResourceAck: 10021,
|
|
25787
25788
|
MessageType_ResourceUpdate: 10022,
|
|
@@ -25806,8 +25807,8 @@ var nested = {
|
|
|
25806
25807
|
MessageType_DeviceReboot: 60400,
|
|
25807
25808
|
MessageType_DeviceGetDeviceInfo: 60600,
|
|
25808
25809
|
MessageType_DeviceInfo: 60601,
|
|
25809
|
-
|
|
25810
|
-
|
|
25810
|
+
MessageType_GetOnboardingStatus: 60602,
|
|
25811
|
+
MessageType_OnboardingStatus: 60603,
|
|
25811
25812
|
MessageType_FilesystemFixPermission: 60800,
|
|
25812
25813
|
MessageType_FilesystemPathInfo: 60801,
|
|
25813
25814
|
MessageType_FilesystemPathInfoQuery: 60802,
|
|
@@ -25820,7 +25821,6 @@ var nested = {
|
|
|
25820
25821
|
MessageType_FilesystemDirMake: 60809,
|
|
25821
25822
|
MessageType_FilesystemDirRemove: 60810,
|
|
25822
25823
|
MessageType_FilesystemFormat: 60811,
|
|
25823
|
-
MessageType_FilesystemDiskControl: 60812,
|
|
25824
25824
|
MessageType_DeviceFirmwareUpdate: 61000,
|
|
25825
25825
|
MessageType_DeviceFirmwareInstallProgress: 61001,
|
|
25826
25826
|
MessageType_DeviceGetFirmwareUpdateStatus: 61002,
|
|
@@ -29419,6 +29419,208 @@ var nested = {
|
|
|
29419
29419
|
}
|
|
29420
29420
|
}
|
|
29421
29421
|
},
|
|
29422
|
+
DebugLinkInput: {
|
|
29423
|
+
fields: {
|
|
29424
|
+
x: {
|
|
29425
|
+
type: "uint32",
|
|
29426
|
+
id: 1
|
|
29427
|
+
},
|
|
29428
|
+
y: {
|
|
29429
|
+
type: "uint32",
|
|
29430
|
+
id: 2
|
|
29431
|
+
},
|
|
29432
|
+
duration_ms: {
|
|
29433
|
+
type: "uint32",
|
|
29434
|
+
id: 3
|
|
29435
|
+
},
|
|
29436
|
+
x_end: {
|
|
29437
|
+
type: "uint32",
|
|
29438
|
+
id: 4
|
|
29439
|
+
},
|
|
29440
|
+
y_end: {
|
|
29441
|
+
type: "uint32",
|
|
29442
|
+
id: 5
|
|
29443
|
+
}
|
|
29444
|
+
}
|
|
29445
|
+
},
|
|
29446
|
+
DebugLinkLayout: {
|
|
29447
|
+
fields: {
|
|
29448
|
+
lines: {
|
|
29449
|
+
rule: "repeated",
|
|
29450
|
+
type: "string",
|
|
29451
|
+
id: 1
|
|
29452
|
+
}
|
|
29453
|
+
}
|
|
29454
|
+
},
|
|
29455
|
+
DebugLinkReseedRandom: {
|
|
29456
|
+
fields: {
|
|
29457
|
+
value: {
|
|
29458
|
+
type: "uint32",
|
|
29459
|
+
id: 1
|
|
29460
|
+
}
|
|
29461
|
+
}
|
|
29462
|
+
},
|
|
29463
|
+
DebugLinkRecordScreen: {
|
|
29464
|
+
fields: {
|
|
29465
|
+
target_directory: {
|
|
29466
|
+
type: "string",
|
|
29467
|
+
id: 1
|
|
29468
|
+
}
|
|
29469
|
+
}
|
|
29470
|
+
},
|
|
29471
|
+
DebugLinkGetState: {
|
|
29472
|
+
fields: {
|
|
29473
|
+
wait_word_list: {
|
|
29474
|
+
type: "bool",
|
|
29475
|
+
id: 1
|
|
29476
|
+
},
|
|
29477
|
+
wait_word_pos: {
|
|
29478
|
+
type: "bool",
|
|
29479
|
+
id: 2
|
|
29480
|
+
},
|
|
29481
|
+
wait_layout: {
|
|
29482
|
+
type: "bool",
|
|
29483
|
+
id: 3
|
|
29484
|
+
}
|
|
29485
|
+
}
|
|
29486
|
+
},
|
|
29487
|
+
DebugLinkState: {
|
|
29488
|
+
fields: {
|
|
29489
|
+
layout: {
|
|
29490
|
+
type: "bytes",
|
|
29491
|
+
id: 1
|
|
29492
|
+
},
|
|
29493
|
+
pin: {
|
|
29494
|
+
type: "string",
|
|
29495
|
+
id: 2
|
|
29496
|
+
},
|
|
29497
|
+
matrix: {
|
|
29498
|
+
type: "string",
|
|
29499
|
+
id: 3
|
|
29500
|
+
},
|
|
29501
|
+
mnemonic_secret: {
|
|
29502
|
+
type: "bytes",
|
|
29503
|
+
id: 4
|
|
29504
|
+
},
|
|
29505
|
+
node: {
|
|
29506
|
+
type: "HDNodeType",
|
|
29507
|
+
id: 5
|
|
29508
|
+
},
|
|
29509
|
+
passphrase_protection: {
|
|
29510
|
+
type: "bool",
|
|
29511
|
+
id: 6
|
|
29512
|
+
},
|
|
29513
|
+
reset_word: {
|
|
29514
|
+
type: "string",
|
|
29515
|
+
id: 7
|
|
29516
|
+
},
|
|
29517
|
+
reset_entropy: {
|
|
29518
|
+
type: "bytes",
|
|
29519
|
+
id: 8
|
|
29520
|
+
},
|
|
29521
|
+
recovery_fake_word: {
|
|
29522
|
+
type: "string",
|
|
29523
|
+
id: 9
|
|
29524
|
+
},
|
|
29525
|
+
recovery_word_pos: {
|
|
29526
|
+
type: "uint32",
|
|
29527
|
+
id: 10
|
|
29528
|
+
},
|
|
29529
|
+
reset_word_pos: {
|
|
29530
|
+
type: "uint32",
|
|
29531
|
+
id: 11
|
|
29532
|
+
},
|
|
29533
|
+
mnemonic_type: {
|
|
29534
|
+
type: "BackupType",
|
|
29535
|
+
id: 12
|
|
29536
|
+
},
|
|
29537
|
+
layout_lines: {
|
|
29538
|
+
rule: "repeated",
|
|
29539
|
+
type: "string",
|
|
29540
|
+
id: 13
|
|
29541
|
+
}
|
|
29542
|
+
}
|
|
29543
|
+
},
|
|
29544
|
+
DebugLinkStop: {
|
|
29545
|
+
fields: {
|
|
29546
|
+
}
|
|
29547
|
+
},
|
|
29548
|
+
DebugLinkLog: {
|
|
29549
|
+
fields: {
|
|
29550
|
+
level: {
|
|
29551
|
+
type: "uint32",
|
|
29552
|
+
id: 1
|
|
29553
|
+
},
|
|
29554
|
+
bucket: {
|
|
29555
|
+
type: "string",
|
|
29556
|
+
id: 2
|
|
29557
|
+
},
|
|
29558
|
+
text: {
|
|
29559
|
+
type: "string",
|
|
29560
|
+
id: 3
|
|
29561
|
+
}
|
|
29562
|
+
}
|
|
29563
|
+
},
|
|
29564
|
+
DebugLinkMemoryRead: {
|
|
29565
|
+
fields: {
|
|
29566
|
+
address: {
|
|
29567
|
+
type: "uint32",
|
|
29568
|
+
id: 1
|
|
29569
|
+
},
|
|
29570
|
+
length: {
|
|
29571
|
+
type: "uint32",
|
|
29572
|
+
id: 2
|
|
29573
|
+
}
|
|
29574
|
+
}
|
|
29575
|
+
},
|
|
29576
|
+
DebugLinkMemory: {
|
|
29577
|
+
fields: {
|
|
29578
|
+
memory: {
|
|
29579
|
+
type: "bytes",
|
|
29580
|
+
id: 1
|
|
29581
|
+
}
|
|
29582
|
+
}
|
|
29583
|
+
},
|
|
29584
|
+
DebugLinkMemoryWrite: {
|
|
29585
|
+
fields: {
|
|
29586
|
+
address: {
|
|
29587
|
+
type: "uint32",
|
|
29588
|
+
id: 1
|
|
29589
|
+
},
|
|
29590
|
+
memory: {
|
|
29591
|
+
type: "bytes",
|
|
29592
|
+
id: 2
|
|
29593
|
+
},
|
|
29594
|
+
flash: {
|
|
29595
|
+
type: "bool",
|
|
29596
|
+
id: 3
|
|
29597
|
+
}
|
|
29598
|
+
}
|
|
29599
|
+
},
|
|
29600
|
+
DebugLinkFlashErase: {
|
|
29601
|
+
fields: {
|
|
29602
|
+
sector: {
|
|
29603
|
+
type: "uint32",
|
|
29604
|
+
id: 1
|
|
29605
|
+
}
|
|
29606
|
+
}
|
|
29607
|
+
},
|
|
29608
|
+
DebugLinkEraseSdCard: {
|
|
29609
|
+
fields: {
|
|
29610
|
+
format: {
|
|
29611
|
+
type: "bool",
|
|
29612
|
+
id: 1
|
|
29613
|
+
}
|
|
29614
|
+
}
|
|
29615
|
+
},
|
|
29616
|
+
DebugLinkWatchLayout: {
|
|
29617
|
+
fields: {
|
|
29618
|
+
watch: {
|
|
29619
|
+
type: "bool",
|
|
29620
|
+
id: 1
|
|
29621
|
+
}
|
|
29622
|
+
}
|
|
29623
|
+
},
|
|
29422
29624
|
EosGetPublicKey: {
|
|
29423
29625
|
fields: {
|
|
29424
29626
|
address_n: {
|
|
@@ -31252,6 +31454,30 @@ var nested = {
|
|
|
31252
31454
|
}
|
|
31253
31455
|
}
|
|
31254
31456
|
},
|
|
31457
|
+
InternalMyAddressRequest: {
|
|
31458
|
+
fields: {
|
|
31459
|
+
coin_type: {
|
|
31460
|
+
rule: "required",
|
|
31461
|
+
type: "uint32",
|
|
31462
|
+
id: 1
|
|
31463
|
+
},
|
|
31464
|
+
chain_id: {
|
|
31465
|
+
rule: "required",
|
|
31466
|
+
type: "uint32",
|
|
31467
|
+
id: 2
|
|
31468
|
+
},
|
|
31469
|
+
account_index: {
|
|
31470
|
+
rule: "required",
|
|
31471
|
+
type: "uint32",
|
|
31472
|
+
id: 3
|
|
31473
|
+
},
|
|
31474
|
+
derive_type: {
|
|
31475
|
+
rule: "required",
|
|
31476
|
+
type: "uint32",
|
|
31477
|
+
id: 4
|
|
31478
|
+
}
|
|
31479
|
+
}
|
|
31480
|
+
},
|
|
31255
31481
|
KaspaGetAddress: {
|
|
31256
31482
|
fields: {
|
|
31257
31483
|
address_n: {
|
|
@@ -32596,6 +32822,49 @@ var nested = {
|
|
|
32596
32822
|
}
|
|
32597
32823
|
}
|
|
32598
32824
|
},
|
|
32825
|
+
WallpaperTarget: {
|
|
32826
|
+
values: {
|
|
32827
|
+
Home: 0,
|
|
32828
|
+
Lock: 1
|
|
32829
|
+
}
|
|
32830
|
+
},
|
|
32831
|
+
SetWallpaper: {
|
|
32832
|
+
fields: {
|
|
32833
|
+
target: {
|
|
32834
|
+
rule: "required",
|
|
32835
|
+
type: "WallpaperTarget",
|
|
32836
|
+
id: 1
|
|
32837
|
+
},
|
|
32838
|
+
path: {
|
|
32839
|
+
rule: "required",
|
|
32840
|
+
type: "string",
|
|
32841
|
+
id: 2
|
|
32842
|
+
}
|
|
32843
|
+
}
|
|
32844
|
+
},
|
|
32845
|
+
GetWallpaper: {
|
|
32846
|
+
fields: {
|
|
32847
|
+
target: {
|
|
32848
|
+
rule: "required",
|
|
32849
|
+
type: "WallpaperTarget",
|
|
32850
|
+
id: 1
|
|
32851
|
+
}
|
|
32852
|
+
}
|
|
32853
|
+
},
|
|
32854
|
+
Wallpaper: {
|
|
32855
|
+
fields: {
|
|
32856
|
+
target: {
|
|
32857
|
+
rule: "required",
|
|
32858
|
+
type: "WallpaperTarget",
|
|
32859
|
+
id: 1
|
|
32860
|
+
},
|
|
32861
|
+
path: {
|
|
32862
|
+
rule: "required",
|
|
32863
|
+
type: "string",
|
|
32864
|
+
id: 2
|
|
32865
|
+
}
|
|
32866
|
+
}
|
|
32867
|
+
},
|
|
32599
32868
|
ResourceUpdate: {
|
|
32600
32869
|
fields: {
|
|
32601
32870
|
file_name: {
|
|
@@ -34779,142 +35048,6 @@ var nested = {
|
|
|
34779
35048
|
}
|
|
34780
35049
|
}
|
|
34781
35050
|
},
|
|
34782
|
-
ScdoGetAddress: {
|
|
34783
|
-
fields: {
|
|
34784
|
-
address_n: {
|
|
34785
|
-
rule: "repeated",
|
|
34786
|
-
type: "uint32",
|
|
34787
|
-
id: 1,
|
|
34788
|
-
options: {
|
|
34789
|
-
packed: false
|
|
34790
|
-
}
|
|
34791
|
-
},
|
|
34792
|
-
show_display: {
|
|
34793
|
-
type: "bool",
|
|
34794
|
-
id: 2
|
|
34795
|
-
}
|
|
34796
|
-
}
|
|
34797
|
-
},
|
|
34798
|
-
ScdoAddress: {
|
|
34799
|
-
fields: {
|
|
34800
|
-
address: {
|
|
34801
|
-
rule: "required",
|
|
34802
|
-
type: "string",
|
|
34803
|
-
id: 1
|
|
34804
|
-
}
|
|
34805
|
-
}
|
|
34806
|
-
},
|
|
34807
|
-
ScdoSignTx: {
|
|
34808
|
-
fields: {
|
|
34809
|
-
address_n: {
|
|
34810
|
-
rule: "repeated",
|
|
34811
|
-
type: "uint32",
|
|
34812
|
-
id: 1,
|
|
34813
|
-
options: {
|
|
34814
|
-
packed: false
|
|
34815
|
-
}
|
|
34816
|
-
},
|
|
34817
|
-
nonce: {
|
|
34818
|
-
rule: "required",
|
|
34819
|
-
type: "bytes",
|
|
34820
|
-
id: 2
|
|
34821
|
-
},
|
|
34822
|
-
gas_price: {
|
|
34823
|
-
rule: "required",
|
|
34824
|
-
type: "bytes",
|
|
34825
|
-
id: 3
|
|
34826
|
-
},
|
|
34827
|
-
gas_limit: {
|
|
34828
|
-
rule: "required",
|
|
34829
|
-
type: "bytes",
|
|
34830
|
-
id: 4
|
|
34831
|
-
},
|
|
34832
|
-
to: {
|
|
34833
|
-
rule: "required",
|
|
34834
|
-
type: "string",
|
|
34835
|
-
id: 5
|
|
34836
|
-
},
|
|
34837
|
-
value: {
|
|
34838
|
-
rule: "required",
|
|
34839
|
-
type: "bytes",
|
|
34840
|
-
id: 6
|
|
34841
|
-
},
|
|
34842
|
-
timestamp: {
|
|
34843
|
-
rule: "required",
|
|
34844
|
-
type: "bytes",
|
|
34845
|
-
id: 7
|
|
34846
|
-
},
|
|
34847
|
-
data_initial_chunk: {
|
|
34848
|
-
type: "bytes",
|
|
34849
|
-
id: 8,
|
|
34850
|
-
options: {
|
|
34851
|
-
"default": ""
|
|
34852
|
-
}
|
|
34853
|
-
},
|
|
34854
|
-
data_length: {
|
|
34855
|
-
type: "uint32",
|
|
34856
|
-
id: 9,
|
|
34857
|
-
options: {
|
|
34858
|
-
"default": 0
|
|
34859
|
-
}
|
|
34860
|
-
},
|
|
34861
|
-
tx_type: {
|
|
34862
|
-
type: "uint32",
|
|
34863
|
-
id: 10,
|
|
34864
|
-
options: {
|
|
34865
|
-
"default": 0
|
|
34866
|
-
}
|
|
34867
|
-
}
|
|
34868
|
-
}
|
|
34869
|
-
},
|
|
34870
|
-
ScdoSignedTx: {
|
|
34871
|
-
fields: {
|
|
34872
|
-
data_length: {
|
|
34873
|
-
type: "uint32",
|
|
34874
|
-
id: 1
|
|
34875
|
-
},
|
|
34876
|
-
signature: {
|
|
34877
|
-
type: "bytes",
|
|
34878
|
-
id: 2
|
|
34879
|
-
}
|
|
34880
|
-
}
|
|
34881
|
-
},
|
|
34882
|
-
ScdoTxAck: {
|
|
34883
|
-
fields: {
|
|
34884
|
-
data_chunk: {
|
|
34885
|
-
type: "bytes",
|
|
34886
|
-
id: 1
|
|
34887
|
-
}
|
|
34888
|
-
}
|
|
34889
|
-
},
|
|
34890
|
-
ScdoSignMessage: {
|
|
34891
|
-
fields: {
|
|
34892
|
-
address_n: {
|
|
34893
|
-
rule: "repeated",
|
|
34894
|
-
type: "uint32",
|
|
34895
|
-
id: 1,
|
|
34896
|
-
options: {
|
|
34897
|
-
packed: false
|
|
34898
|
-
}
|
|
34899
|
-
},
|
|
34900
|
-
message: {
|
|
34901
|
-
type: "bytes",
|
|
34902
|
-
id: 2
|
|
34903
|
-
}
|
|
34904
|
-
}
|
|
34905
|
-
},
|
|
34906
|
-
ScdoSignedMessage: {
|
|
34907
|
-
fields: {
|
|
34908
|
-
signature: {
|
|
34909
|
-
type: "bytes",
|
|
34910
|
-
id: 1
|
|
34911
|
-
},
|
|
34912
|
-
address: {
|
|
34913
|
-
type: "string",
|
|
34914
|
-
id: 2
|
|
34915
|
-
}
|
|
34916
|
-
}
|
|
34917
|
-
},
|
|
34918
35051
|
SolanaOffChainMessageVersion: {
|
|
34919
35052
|
values: {
|
|
34920
35053
|
MESSAGE_VERSION_0: 0
|
|
@@ -36883,16 +37016,16 @@ var nested = {
|
|
|
36883
37016
|
}
|
|
36884
37017
|
}
|
|
36885
37018
|
},
|
|
36886
|
-
|
|
37019
|
+
ViewAmount: {
|
|
36887
37020
|
fields: {
|
|
36888
|
-
|
|
37021
|
+
is_unlimited: {
|
|
36889
37022
|
rule: "required",
|
|
36890
|
-
type: "
|
|
37023
|
+
type: "bool",
|
|
36891
37024
|
id: 1
|
|
36892
37025
|
},
|
|
36893
|
-
|
|
37026
|
+
num: {
|
|
36894
37027
|
rule: "required",
|
|
36895
|
-
type: "
|
|
37028
|
+
type: "string",
|
|
36896
37029
|
id: 2
|
|
36897
37030
|
},
|
|
36898
37031
|
symbol: {
|
|
@@ -36902,95 +37035,64 @@ var nested = {
|
|
|
36902
37035
|
}
|
|
36903
37036
|
}
|
|
36904
37037
|
},
|
|
36905
|
-
|
|
37038
|
+
ViewDetail: {
|
|
36906
37039
|
fields: {
|
|
36907
37040
|
key: {
|
|
36908
37041
|
rule: "required",
|
|
36909
37042
|
type: "uint32",
|
|
36910
37043
|
id: 1
|
|
36911
37044
|
},
|
|
36912
|
-
|
|
37045
|
+
value: {
|
|
36913
37046
|
rule: "required",
|
|
36914
37047
|
type: "string",
|
|
36915
37048
|
id: 2
|
|
36916
37049
|
},
|
|
36917
|
-
|
|
36918
|
-
|
|
37050
|
+
is_overview: {
|
|
37051
|
+
rule: "required",
|
|
37052
|
+
type: "bool",
|
|
36919
37053
|
id: 3
|
|
36920
37054
|
},
|
|
36921
|
-
|
|
36922
|
-
type: "string",
|
|
36923
|
-
id: 4
|
|
36924
|
-
}
|
|
36925
|
-
}
|
|
36926
|
-
},
|
|
36927
|
-
TxDetailsNetwork: {
|
|
36928
|
-
fields: {
|
|
36929
|
-
coin_type: {
|
|
37055
|
+
has_icon: {
|
|
36930
37056
|
rule: "required",
|
|
36931
|
-
type: "
|
|
36932
|
-
id:
|
|
36933
|
-
},
|
|
36934
|
-
chain_id: {
|
|
36935
|
-
type: "uint64",
|
|
36936
|
-
id: 2
|
|
37057
|
+
type: "bool",
|
|
37058
|
+
id: 4
|
|
36937
37059
|
}
|
|
36938
37060
|
}
|
|
36939
37061
|
},
|
|
36940
|
-
|
|
37062
|
+
ViewSignPage: {
|
|
36941
37063
|
fields: {
|
|
36942
|
-
|
|
37064
|
+
title: {
|
|
36943
37065
|
rule: "required",
|
|
36944
|
-
type: "
|
|
37066
|
+
type: "string",
|
|
36945
37067
|
id: 1
|
|
36946
37068
|
},
|
|
36947
|
-
|
|
36948
|
-
|
|
36949
|
-
type: "string",
|
|
37069
|
+
amount: {
|
|
37070
|
+
type: "ViewAmount",
|
|
36950
37071
|
id: 2
|
|
36951
37072
|
},
|
|
36952
|
-
|
|
36953
|
-
rule: "
|
|
36954
|
-
type: "
|
|
37073
|
+
general: {
|
|
37074
|
+
rule: "repeated",
|
|
37075
|
+
type: "ViewDetail",
|
|
36955
37076
|
id: 3
|
|
36956
37077
|
}
|
|
36957
37078
|
}
|
|
36958
37079
|
},
|
|
36959
|
-
|
|
36960
|
-
values: {
|
|
36961
|
-
DISPLAY_TYPE_INFO: 0,
|
|
36962
|
-
DISPLAY_TYPE_SIGN: 1
|
|
36963
|
-
}
|
|
36964
|
-
},
|
|
36965
|
-
TxDetailsPage: {
|
|
37080
|
+
ViewVerifyPage: {
|
|
36966
37081
|
fields: {
|
|
36967
37082
|
title: {
|
|
36968
37083
|
rule: "required",
|
|
36969
37084
|
type: "string",
|
|
36970
37085
|
id: 1
|
|
36971
37086
|
},
|
|
36972
|
-
|
|
37087
|
+
address: {
|
|
36973
37088
|
rule: "required",
|
|
36974
|
-
type: "
|
|
37089
|
+
type: "string",
|
|
36975
37090
|
id: 2
|
|
36976
37091
|
},
|
|
36977
|
-
|
|
36978
|
-
|
|
37092
|
+
path: {
|
|
37093
|
+
rule: "required",
|
|
37094
|
+
type: "string",
|
|
36979
37095
|
id: 3
|
|
36980
|
-
},
|
|
36981
|
-
network: {
|
|
36982
|
-
type: "TxDetailsNetwork",
|
|
36983
|
-
id: 4
|
|
36984
|
-
},
|
|
36985
|
-
address: {
|
|
36986
|
-
rule: "repeated",
|
|
36987
|
-
type: "TxDetailsAddress",
|
|
36988
|
-
id: 5
|
|
36989
|
-
},
|
|
36990
|
-
general: {
|
|
36991
|
-
rule: "repeated",
|
|
36992
|
-
type: "TxDetailsGeneral",
|
|
36993
|
-
id: 6
|
|
36994
37096
|
}
|
|
36995
37097
|
}
|
|
36996
37098
|
},
|
|
@@ -37077,6 +37179,102 @@ var nested = {
|
|
|
37077
37179
|
}
|
|
37078
37180
|
}
|
|
37079
37181
|
},
|
|
37182
|
+
TonSignData: {
|
|
37183
|
+
fields: {
|
|
37184
|
+
address_n: {
|
|
37185
|
+
rule: "repeated",
|
|
37186
|
+
type: "uint32",
|
|
37187
|
+
id: 1,
|
|
37188
|
+
options: {
|
|
37189
|
+
packed: false
|
|
37190
|
+
}
|
|
37191
|
+
},
|
|
37192
|
+
type: {
|
|
37193
|
+
rule: "required",
|
|
37194
|
+
type: "TonSignDataType",
|
|
37195
|
+
id: 2
|
|
37196
|
+
},
|
|
37197
|
+
payload: {
|
|
37198
|
+
rule: "required",
|
|
37199
|
+
type: "bytes",
|
|
37200
|
+
id: 3
|
|
37201
|
+
},
|
|
37202
|
+
schema: {
|
|
37203
|
+
type: "string",
|
|
37204
|
+
id: 4
|
|
37205
|
+
},
|
|
37206
|
+
appdomain: {
|
|
37207
|
+
rule: "required",
|
|
37208
|
+
type: "string",
|
|
37209
|
+
id: 5
|
|
37210
|
+
},
|
|
37211
|
+
timestamp: {
|
|
37212
|
+
rule: "required",
|
|
37213
|
+
type: "uint64",
|
|
37214
|
+
id: 6
|
|
37215
|
+
},
|
|
37216
|
+
from_address: {
|
|
37217
|
+
type: "string",
|
|
37218
|
+
id: 7
|
|
37219
|
+
},
|
|
37220
|
+
wallet_version: {
|
|
37221
|
+
type: "TonWalletVersion",
|
|
37222
|
+
id: 8,
|
|
37223
|
+
options: {
|
|
37224
|
+
"default": "V4R2"
|
|
37225
|
+
}
|
|
37226
|
+
},
|
|
37227
|
+
wallet_id: {
|
|
37228
|
+
type: "uint32",
|
|
37229
|
+
id: 9,
|
|
37230
|
+
options: {
|
|
37231
|
+
"default": 698983191
|
|
37232
|
+
}
|
|
37233
|
+
},
|
|
37234
|
+
workchain: {
|
|
37235
|
+
type: "TonWorkChain",
|
|
37236
|
+
id: 10,
|
|
37237
|
+
options: {
|
|
37238
|
+
"default": "BASECHAIN"
|
|
37239
|
+
}
|
|
37240
|
+
},
|
|
37241
|
+
is_bounceable: {
|
|
37242
|
+
type: "bool",
|
|
37243
|
+
id: 11,
|
|
37244
|
+
options: {
|
|
37245
|
+
"default": false
|
|
37246
|
+
}
|
|
37247
|
+
},
|
|
37248
|
+
is_testnet_only: {
|
|
37249
|
+
type: "bool",
|
|
37250
|
+
id: 12,
|
|
37251
|
+
options: {
|
|
37252
|
+
"default": false
|
|
37253
|
+
}
|
|
37254
|
+
}
|
|
37255
|
+
},
|
|
37256
|
+
nested: {
|
|
37257
|
+
TonSignDataType: {
|
|
37258
|
+
values: {
|
|
37259
|
+
TEXT: 0,
|
|
37260
|
+
BINARY: 1,
|
|
37261
|
+
CELL: 2
|
|
37262
|
+
}
|
|
37263
|
+
}
|
|
37264
|
+
}
|
|
37265
|
+
},
|
|
37266
|
+
TonSignedData: {
|
|
37267
|
+
fields: {
|
|
37268
|
+
signature: {
|
|
37269
|
+
type: "bytes",
|
|
37270
|
+
id: 1
|
|
37271
|
+
},
|
|
37272
|
+
digest: {
|
|
37273
|
+
type: "bytes",
|
|
37274
|
+
id: 2
|
|
37275
|
+
}
|
|
37276
|
+
}
|
|
37277
|
+
},
|
|
37080
37278
|
GetProtoVersion: {
|
|
37081
37279
|
fields: {
|
|
37082
37280
|
}
|
|
@@ -37202,7 +37400,7 @@ var nested = {
|
|
|
37202
37400
|
},
|
|
37203
37401
|
DeviceHardwareInfo: {
|
|
37204
37402
|
fields: {
|
|
37205
|
-
|
|
37403
|
+
device_type: {
|
|
37206
37404
|
type: "DeviceType",
|
|
37207
37405
|
id: 10
|
|
37208
37406
|
},
|
|
@@ -37445,10 +37643,6 @@ var nested = {
|
|
|
37445
37643
|
rule: "repeated",
|
|
37446
37644
|
type: "DeviceFirmwareTarget",
|
|
37447
37645
|
id: 1
|
|
37448
|
-
},
|
|
37449
|
-
max_concurrent: {
|
|
37450
|
-
type: "uint32",
|
|
37451
|
-
id: 2
|
|
37452
37646
|
}
|
|
37453
37647
|
}
|
|
37454
37648
|
},
|
|
@@ -37762,44 +37956,73 @@ var nested = {
|
|
|
37762
37956
|
fields: {
|
|
37763
37957
|
}
|
|
37764
37958
|
},
|
|
37765
|
-
FilesystemDiskControl: {
|
|
37766
|
-
fields: {
|
|
37767
|
-
enable: {
|
|
37768
|
-
rule: "required",
|
|
37769
|
-
type: "uint32",
|
|
37770
|
-
id: 1
|
|
37771
|
-
}
|
|
37772
|
-
}
|
|
37773
|
-
},
|
|
37774
37959
|
OnboardingStep: {
|
|
37775
37960
|
values: {
|
|
37776
37961
|
ONBOARDING_STEP_UNKNOWN: 0,
|
|
37777
|
-
|
|
37778
|
-
|
|
37779
|
-
|
|
37780
|
-
|
|
37781
|
-
ONBOARDING_STEP_SEEDCARD_BACKUP: 5,
|
|
37782
|
-
ONBOARDING_STEP_RESTORE_CHOICE: 6,
|
|
37783
|
-
ONBOARDING_STEP_RESTORE_MNEMONIC: 7,
|
|
37784
|
-
ONBOARDING_STEP_RESTORE_MNEMONIC_SEEDCARD_BACKUP: 8,
|
|
37785
|
-
ONBOARDING_STEP_RESTORE_SEEDCARD: 9,
|
|
37786
|
-
ONBOARDING_STEP_DONE: 100
|
|
37962
|
+
ONBOARDING_STEP_DEVICE_VERIFICATION: 1,
|
|
37963
|
+
ONBOARDING_STEP_PERSONALIZATION: 2,
|
|
37964
|
+
ONBOARDING_STEP_SETUP: 3,
|
|
37965
|
+
ONBOARDING_STEP_FIRMWARE: 4
|
|
37787
37966
|
}
|
|
37788
37967
|
},
|
|
37789
|
-
|
|
37968
|
+
GetOnboardingStatus: {
|
|
37790
37969
|
fields: {
|
|
37791
37970
|
}
|
|
37792
37971
|
},
|
|
37793
|
-
|
|
37972
|
+
OnboardingStatus: {
|
|
37794
37973
|
fields: {
|
|
37795
37974
|
step: {
|
|
37796
37975
|
rule: "required",
|
|
37797
37976
|
type: "OnboardingStep",
|
|
37798
37977
|
id: 1
|
|
37799
37978
|
},
|
|
37800
|
-
|
|
37801
|
-
type: "
|
|
37979
|
+
setup: {
|
|
37980
|
+
type: "Setup",
|
|
37802
37981
|
id: 2
|
|
37982
|
+
},
|
|
37983
|
+
detail_code: {
|
|
37984
|
+
type: "uint32",
|
|
37985
|
+
id: 3
|
|
37986
|
+
},
|
|
37987
|
+
detail_str: {
|
|
37988
|
+
type: "string",
|
|
37989
|
+
id: 4
|
|
37990
|
+
}
|
|
37991
|
+
},
|
|
37992
|
+
nested: {
|
|
37993
|
+
Setup: {
|
|
37994
|
+
fields: {
|
|
37995
|
+
new_device: {
|
|
37996
|
+
type: "NewDevice",
|
|
37997
|
+
id: 1
|
|
37998
|
+
},
|
|
37999
|
+
restore: {
|
|
38000
|
+
type: "Restore",
|
|
38001
|
+
id: 2
|
|
38002
|
+
}
|
|
38003
|
+
},
|
|
38004
|
+
nested: {
|
|
38005
|
+
NewDevice: {
|
|
38006
|
+
fields: {
|
|
38007
|
+
seedcard_backup: {
|
|
38008
|
+
type: "bool",
|
|
38009
|
+
id: 1
|
|
38010
|
+
}
|
|
38011
|
+
}
|
|
38012
|
+
},
|
|
38013
|
+
Restore: {
|
|
38014
|
+
fields: {
|
|
38015
|
+
mnemonic: {
|
|
38016
|
+
type: "bool",
|
|
38017
|
+
id: 1
|
|
38018
|
+
},
|
|
38019
|
+
seedcard: {
|
|
38020
|
+
type: "bool",
|
|
38021
|
+
id: 2
|
|
38022
|
+
}
|
|
38023
|
+
}
|
|
38024
|
+
}
|
|
38025
|
+
}
|
|
37803
38026
|
}
|
|
37804
38027
|
}
|
|
37805
38028
|
},
|
|
@@ -38568,7 +38791,7 @@ const findLatestRelease = (releases) => {
|
|
|
38568
38791
|
};
|
|
38569
38792
|
|
|
38570
38793
|
var _a$1;
|
|
38571
|
-
const Log$
|
|
38794
|
+
const Log$g = getLogger(exports.LoggerNames.Core);
|
|
38572
38795
|
const FIRMWARE_FIELDS = [
|
|
38573
38796
|
'firmware',
|
|
38574
38797
|
'firmware-v2',
|
|
@@ -38630,37 +38853,37 @@ class DataManager {
|
|
|
38630
38853
|
let data = null;
|
|
38631
38854
|
let fetchMethod = 'none';
|
|
38632
38855
|
if (settings.configFetcher) {
|
|
38633
|
-
Log$
|
|
38856
|
+
Log$g.debug('[DataConfig] Trying configFetcher (client-side fetcher)...');
|
|
38634
38857
|
try {
|
|
38635
38858
|
data = yield settings.configFetcher(urlWithCache);
|
|
38636
38859
|
if (data) {
|
|
38637
38860
|
fetchMethod = 'configFetcher';
|
|
38638
|
-
Log$
|
|
38861
|
+
Log$g.log('[DataConfig] ConfigFetcher success');
|
|
38639
38862
|
}
|
|
38640
38863
|
else {
|
|
38641
|
-
Log$
|
|
38864
|
+
Log$g.debug('[DataConfig] ConfigFetcher returned null, will fallback to axios');
|
|
38642
38865
|
}
|
|
38643
38866
|
}
|
|
38644
38867
|
catch (e) {
|
|
38645
|
-
Log$
|
|
38868
|
+
Log$g.warn('[DataConfig] ConfigFetcher error, will fallback to axios:', e);
|
|
38646
38869
|
}
|
|
38647
38870
|
}
|
|
38648
38871
|
if (!data) {
|
|
38649
|
-
Log$
|
|
38872
|
+
Log$g.debug('[DataConfig] Trying axios (SDK default fetcher)...');
|
|
38650
38873
|
try {
|
|
38651
38874
|
const response = yield axios__default["default"].get(urlWithCache, {
|
|
38652
38875
|
timeout: 7000,
|
|
38653
38876
|
});
|
|
38654
38877
|
data = response.data;
|
|
38655
38878
|
fetchMethod = 'axios';
|
|
38656
|
-
Log$
|
|
38879
|
+
Log$g.log('[DataConfig] Axios fetch success');
|
|
38657
38880
|
}
|
|
38658
38881
|
catch (e) {
|
|
38659
|
-
Log$
|
|
38882
|
+
Log$g.warn('[DataConfig] Axios fetch error:', e);
|
|
38660
38883
|
}
|
|
38661
38884
|
}
|
|
38662
38885
|
if (data) {
|
|
38663
|
-
Log$
|
|
38886
|
+
Log$g.log(`[DataConfig] Config loaded successfully via [${fetchMethod}]`);
|
|
38664
38887
|
this.deviceMap = {
|
|
38665
38888
|
[hdShared.EDeviceType.Classic]: this.enrichFirmwareReleaseInfo(data.classic),
|
|
38666
38889
|
[hdShared.EDeviceType.Classic1s]: this.enrichFirmwareReleaseInfo(data.classic1s),
|
|
@@ -38674,7 +38897,7 @@ class DataManager {
|
|
|
38674
38897
|
};
|
|
38675
38898
|
}
|
|
38676
38899
|
else {
|
|
38677
|
-
Log$
|
|
38900
|
+
Log$g.warn('[DataConfig] All fetch methods failed, using built-in default config');
|
|
38678
38901
|
}
|
|
38679
38902
|
});
|
|
38680
38903
|
}
|
|
@@ -39002,27 +39225,20 @@ const getPassphraseStateWithRefreshDeviceInfo = (device, options) => __awaiter(v
|
|
|
39002
39225
|
const { features, commands } = device;
|
|
39003
39226
|
const locked = (features === null || features === void 0 ? void 0 : features.unlocked) === false;
|
|
39004
39227
|
const deviceType = getDeviceType(features);
|
|
39005
|
-
const isPro2 = deviceType === hdShared.EDeviceType.Pro2;
|
|
39006
39228
|
const { passphraseState, newSession, unlockedAttachPin } = yield getPassphraseState(features, commands, Object.assign({}, options));
|
|
39007
39229
|
const isModeT = deviceType === hdShared.EDeviceType.Touch || deviceType === hdShared.EDeviceType.Pro;
|
|
39008
|
-
const needRefreshWithPassphrase =
|
|
39230
|
+
const needRefreshWithPassphrase = passphraseState && (features === null || features === void 0 ? void 0 : features.passphrase_protection) !== true;
|
|
39009
39231
|
const needRefreshWithLocked = isModeT && locked;
|
|
39010
39232
|
if (needRefreshWithLocked || needRefreshWithPassphrase) {
|
|
39011
39233
|
yield device.getFeatures();
|
|
39012
39234
|
}
|
|
39013
|
-
if (isPro2 && device.features) {
|
|
39014
|
-
if (passphraseState) {
|
|
39015
|
-
device.features.passphrase_protection = true;
|
|
39016
|
-
}
|
|
39017
|
-
if (newSession) {
|
|
39018
|
-
device.features.session_id = newSession;
|
|
39019
|
-
}
|
|
39020
|
-
}
|
|
39021
39235
|
if (features === null || features === void 0 ? void 0 : features.device_id) {
|
|
39022
|
-
device.updateInternalState((
|
|
39236
|
+
device.updateInternalState((_b = (_a = device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) !== null && _b !== void 0 ? _b : false, passphraseState, (_d = (_c = device.features) === null || _c === void 0 ? void 0 : _c.device_id) !== null && _d !== void 0 ? _d : '', newSession, (_e = device.features) === null || _e === void 0 ? void 0 : _e.session_id);
|
|
39023
39237
|
}
|
|
39024
39238
|
return { passphraseState, newSession, unlockedAttachPin };
|
|
39025
39239
|
});
|
|
39240
|
+
const supportProSeriesAttachPinPassphrase = (deviceType, firmwareVersion) => (deviceType === hdShared.EDeviceType.Pro || deviceType === hdShared.EDeviceType.Pro2) &&
|
|
39241
|
+
semver__default["default"].gte(firmwareVersion, '4.15.0');
|
|
39026
39242
|
const getPassphraseState = (features, commands, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39027
39243
|
if (!features)
|
|
39028
39244
|
return { passphraseState: undefined, newSession: undefined, unlockedAttachPin: undefined };
|
|
@@ -39030,8 +39246,7 @@ const getPassphraseState = (features, commands, options) => __awaiter(void 0, vo
|
|
|
39030
39246
|
const deviceType = getDeviceType(features);
|
|
39031
39247
|
const supportAttachPinCapability = existCapability(features, hdTransport.Enum_Capability.Capability_AttachToPin);
|
|
39032
39248
|
const supportGetPassphraseState = supportAttachPinCapability ||
|
|
39033
|
-
deviceType
|
|
39034
|
-
(deviceType === hdShared.EDeviceType.Pro && semver__default["default"].gte(firmwareVersion.join('.'), '4.15.0'));
|
|
39249
|
+
supportProSeriesAttachPinPassphrase(deviceType, firmwareVersion.join('.'));
|
|
39035
39250
|
if (supportGetPassphraseState) {
|
|
39036
39251
|
const payload = (options === null || options === void 0 ? void 0 : options.onlyMainPin)
|
|
39037
39252
|
? { _only_main_pin: true }
|
|
@@ -39962,8 +40177,22 @@ const LogBlockEvent = new Set([
|
|
|
39962
40177
|
UI_RESPONSE.RECEIVE_PIN,
|
|
39963
40178
|
UI_RESPONSE.RECEIVE_PASSPHRASE,
|
|
39964
40179
|
]);
|
|
40180
|
+
const LogBlockMethod = new Set(['evmSignTypedData']);
|
|
40181
|
+
function getLogBlockLabel(message) {
|
|
40182
|
+
if (!message || typeof message !== 'object')
|
|
40183
|
+
return undefined;
|
|
40184
|
+
const { type, payload, method } = message;
|
|
40185
|
+
if (type && LogBlockEvent.has(type)) {
|
|
40186
|
+
return type;
|
|
40187
|
+
}
|
|
40188
|
+
const methodName = method !== null && method !== void 0 ? method : payload === null || payload === void 0 ? void 0 : payload.method;
|
|
40189
|
+
if (methodName && LogBlockMethod.has(methodName)) {
|
|
40190
|
+
return methodName;
|
|
40191
|
+
}
|
|
40192
|
+
return undefined;
|
|
40193
|
+
}
|
|
39965
40194
|
|
|
39966
|
-
const Log$
|
|
40195
|
+
const Log$f = getLogger(exports.LoggerNames.DevicePool);
|
|
39967
40196
|
const getDiff = (current, descriptors) => {
|
|
39968
40197
|
const connected = descriptors.filter(d => current.find(x => x.path === d.path) === undefined);
|
|
39969
40198
|
const disconnected = current.filter(d => descriptors.find(x => x.path === d.path) === undefined);
|
|
@@ -40021,7 +40250,7 @@ class DevicePool extends events.exports {
|
|
|
40021
40250
|
yield this._checkDevicePool(initOptions);
|
|
40022
40251
|
return { devices, deviceList };
|
|
40023
40252
|
}
|
|
40024
|
-
Log$
|
|
40253
|
+
Log$f.debug('found device in cache, but path is different: ', connectId);
|
|
40025
40254
|
}
|
|
40026
40255
|
}
|
|
40027
40256
|
try {
|
|
@@ -40082,7 +40311,7 @@ class DevicePool extends events.exports {
|
|
|
40082
40311
|
for (let i = this.connectedPool.length - 1; i >= 0; i--) {
|
|
40083
40312
|
const descriptor = this.connectedPool[i];
|
|
40084
40313
|
const device = yield this._createDevice(descriptor, initOptions);
|
|
40085
|
-
Log$
|
|
40314
|
+
Log$f.debug('emit DEVICE.CONNECT: ', device === null || device === void 0 ? void 0 : device.features);
|
|
40086
40315
|
this.emitter.emit(DEVICE.CONNECT, device);
|
|
40087
40316
|
this.connectedPool.splice(i, 1);
|
|
40088
40317
|
}
|
|
@@ -40102,9 +40331,9 @@ class DevicePool extends events.exports {
|
|
|
40102
40331
|
const diff = getDiff(this.current || [], upcoming);
|
|
40103
40332
|
this.upcoming = upcoming;
|
|
40104
40333
|
this.current = this.upcoming;
|
|
40105
|
-
Log$
|
|
40106
|
-
Log$
|
|
40107
|
-
Log$
|
|
40334
|
+
Log$f.debug('device pool -> current: ', this.current);
|
|
40335
|
+
Log$f.debug('device pool -> upcomming: ', this.upcoming);
|
|
40336
|
+
Log$f.debug('DeviceCache.reportDeviceChange diff: ', diff);
|
|
40108
40337
|
if (!diff.didUpdate) {
|
|
40109
40338
|
return;
|
|
40110
40339
|
}
|
|
@@ -40114,7 +40343,7 @@ class DevicePool extends events.exports {
|
|
|
40114
40343
|
this._addConnectedDeviceToPool(d);
|
|
40115
40344
|
return;
|
|
40116
40345
|
}
|
|
40117
|
-
Log$
|
|
40346
|
+
Log$f.debug('emit DEVICE.CONNECT: ', device.features);
|
|
40118
40347
|
this.emitter.emit(DEVICE.CONNECT, device);
|
|
40119
40348
|
});
|
|
40120
40349
|
diff.disconnected.forEach(d => {
|
|
@@ -40124,7 +40353,7 @@ class DevicePool extends events.exports {
|
|
|
40124
40353
|
this._addDisconnectedDeviceToPool(d);
|
|
40125
40354
|
return;
|
|
40126
40355
|
}
|
|
40127
|
-
Log$
|
|
40356
|
+
Log$f.debug('emit DEVICE.DISCONNECT: ', device.features);
|
|
40128
40357
|
this.emitter.emit(DEVICE.DISCONNECT, device);
|
|
40129
40358
|
});
|
|
40130
40359
|
}
|
|
@@ -40160,7 +40389,7 @@ class DevicePool extends events.exports {
|
|
|
40160
40389
|
this.disconnectPool = [];
|
|
40161
40390
|
this.devicesCache = {};
|
|
40162
40391
|
this.emitter.removeAllListeners();
|
|
40163
|
-
Log$
|
|
40392
|
+
Log$f.debug('DevicePool state has been reset');
|
|
40164
40393
|
}
|
|
40165
40394
|
}
|
|
40166
40395
|
DevicePool.current = null;
|
|
@@ -40170,7 +40399,7 @@ DevicePool.disconnectPool = [];
|
|
|
40170
40399
|
DevicePool.devicesCache = {};
|
|
40171
40400
|
DevicePool.emitter = new events.exports();
|
|
40172
40401
|
|
|
40173
|
-
const Log$
|
|
40402
|
+
const Log$e = getLogger(exports.LoggerNames.Transport);
|
|
40174
40403
|
const BleLogger = getLogger(exports.LoggerNames.HdBleTransport);
|
|
40175
40404
|
const HttpLogger = getLogger(exports.LoggerNames.HdTransportHttp);
|
|
40176
40405
|
const LowLevelLogger = getLogger(exports.LoggerNames.HdTransportLowLevel);
|
|
@@ -40180,7 +40409,7 @@ const WebUsbLogger = getLogger(exports.LoggerNames.HdTransportWebUsb);
|
|
|
40180
40409
|
const REACT_NATIVE_BLE_SCAN_TIMEOUT_MS = 8000;
|
|
40181
40410
|
class TransportManager {
|
|
40182
40411
|
static load() {
|
|
40183
|
-
Log$
|
|
40412
|
+
Log$e.debug('transport manager load');
|
|
40184
40413
|
this.defaultMessages = DataManager.getProtobufMessages();
|
|
40185
40414
|
this.currentMessages = this.defaultMessages;
|
|
40186
40415
|
this.protocolV1MessageSchema = 'v1CurrentSchema';
|
|
@@ -40189,14 +40418,14 @@ class TransportManager {
|
|
|
40189
40418
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40190
40419
|
try {
|
|
40191
40420
|
const env = DataManager.getSettings('env');
|
|
40192
|
-
Log$
|
|
40421
|
+
Log$e.debug('Initializing transports', env);
|
|
40193
40422
|
if (env === 'react-native') {
|
|
40194
40423
|
if (!this.reactNativeInit) {
|
|
40195
40424
|
yield this.transport.init(BleLogger, DevicePool.emitter);
|
|
40196
40425
|
this.reactNativeInit = true;
|
|
40197
40426
|
}
|
|
40198
40427
|
else {
|
|
40199
|
-
Log$
|
|
40428
|
+
Log$e.debug('React Native Do Not Initializing transports');
|
|
40200
40429
|
}
|
|
40201
40430
|
}
|
|
40202
40431
|
else if (env === 'node-usb') {
|
|
@@ -40217,15 +40446,15 @@ class TransportManager {
|
|
|
40217
40446
|
else {
|
|
40218
40447
|
yield this.transport.init(HttpLogger);
|
|
40219
40448
|
}
|
|
40220
|
-
Log$
|
|
40449
|
+
Log$e.debug('Configuring transports');
|
|
40221
40450
|
yield this.transport.configure(JSON.stringify(this.defaultMessages));
|
|
40222
40451
|
this.currentMessages = this.defaultMessages;
|
|
40223
40452
|
this.protocolV1MessageSchema = 'v1CurrentSchema';
|
|
40224
40453
|
yield this.configureProtocolV2Messages();
|
|
40225
|
-
Log$
|
|
40454
|
+
Log$e.debug('Configuring transports done');
|
|
40226
40455
|
}
|
|
40227
40456
|
catch (error) {
|
|
40228
|
-
Log$
|
|
40457
|
+
Log$e.debug('Initializing transports error: ', error);
|
|
40229
40458
|
if (error.code === 'ECONNABORTED') {
|
|
40230
40459
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BridgeTimeoutError);
|
|
40231
40460
|
}
|
|
@@ -40241,7 +40470,7 @@ class TransportManager {
|
|
|
40241
40470
|
if (this.currentMessages === messages || !messages) {
|
|
40242
40471
|
return;
|
|
40243
40472
|
}
|
|
40244
|
-
Log$
|
|
40473
|
+
Log$e.debug(`Reconfiguring transports Protocol V1 schema:${protocolV1MessageSchema}`);
|
|
40245
40474
|
try {
|
|
40246
40475
|
yield this.transport.configure(JSON.stringify(messages));
|
|
40247
40476
|
this.currentMessages = messages;
|
|
@@ -40264,9 +40493,9 @@ class TransportManager {
|
|
|
40264
40493
|
}
|
|
40265
40494
|
if (plugin) {
|
|
40266
40495
|
this.plugin = plugin;
|
|
40267
|
-
Log$
|
|
40496
|
+
Log$e.debug('set transport plugin: ', this.plugin);
|
|
40268
40497
|
}
|
|
40269
|
-
Log$
|
|
40498
|
+
Log$e.debug('set transport: ', this.transport.name, this.transport.version, this.transport.configured);
|
|
40270
40499
|
}
|
|
40271
40500
|
static getTransport() {
|
|
40272
40501
|
return this.transport;
|
|
@@ -40277,7 +40506,7 @@ class TransportManager {
|
|
|
40277
40506
|
const { configureProtocolV2 } = this.transport;
|
|
40278
40507
|
if (protocolV2Messages && typeof configureProtocolV2 === 'function') {
|
|
40279
40508
|
yield configureProtocolV2.call(this.transport, JSON.stringify(protocolV2Messages));
|
|
40280
|
-
Log$
|
|
40509
|
+
Log$e.debug('Protocol V2 messages configured');
|
|
40281
40510
|
}
|
|
40282
40511
|
});
|
|
40283
40512
|
}
|
|
@@ -40449,7 +40678,7 @@ const cancelDeviceWithInitialize = (device) => {
|
|
|
40449
40678
|
},
|
|
40450
40679
|
}));
|
|
40451
40680
|
};
|
|
40452
|
-
const Log$
|
|
40681
|
+
const Log$d = getLogger(exports.LoggerNames.DeviceCommands);
|
|
40453
40682
|
const LogCore = getLogger(exports.LoggerNames.Core);
|
|
40454
40683
|
class DeviceCommands {
|
|
40455
40684
|
constructor(device, mainId) {
|
|
@@ -40458,7 +40687,7 @@ class DeviceCommands {
|
|
|
40458
40687
|
this.transport = TransportManager.getTransport();
|
|
40459
40688
|
this.disposed = false;
|
|
40460
40689
|
this.instanceId = generateInstanceId('DeviceCommands', device.sdkInstanceId);
|
|
40461
|
-
Log$
|
|
40690
|
+
Log$d.debug(`[DeviceCommands] Created: ${this.instanceId}, device: ${this.device.instanceId}`);
|
|
40462
40691
|
}
|
|
40463
40692
|
dispose(_cancelRequest) {
|
|
40464
40693
|
var _a, _b;
|
|
@@ -40528,7 +40757,7 @@ class DeviceCommands {
|
|
|
40528
40757
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40529
40758
|
const shouldReduceDebug = shouldReduceDebugForCall(type);
|
|
40530
40759
|
if (!shouldReduceDebug) {
|
|
40531
|
-
Log$
|
|
40760
|
+
Log$d.debug('[DeviceCommands] [call] Sending', type);
|
|
40532
40761
|
}
|
|
40533
40762
|
try {
|
|
40534
40763
|
const promise = this.transport.call(this.mainId, type, msg !== null && msg !== void 0 ? msg : {}, options);
|
|
@@ -40563,7 +40792,7 @@ class DeviceCommands {
|
|
|
40563
40792
|
}
|
|
40564
40793
|
}
|
|
40565
40794
|
if (responseData) {
|
|
40566
|
-
Log$
|
|
40795
|
+
Log$d.debug('error response', responseData);
|
|
40567
40796
|
}
|
|
40568
40797
|
if (responseError === 'device disconnected during action') {
|
|
40569
40798
|
return { type: 'BridgeDeviceDisconnected', message: { error: responseError } };
|
|
@@ -40603,7 +40832,7 @@ class DeviceCommands {
|
|
|
40603
40832
|
'ResourceAck',
|
|
40604
40833
|
];
|
|
40605
40834
|
if (!skipTypes.includes(type) && msg) {
|
|
40606
|
-
Log$
|
|
40835
|
+
Log$d.debug('[DeviceCommands] [typedCall] Sending payload', type, sanitizeDebugPayload(msg));
|
|
40607
40836
|
}
|
|
40608
40837
|
}
|
|
40609
40838
|
catch (e) {
|
|
@@ -40614,10 +40843,10 @@ class DeviceCommands {
|
|
|
40614
40843
|
assertType(response, resType);
|
|
40615
40844
|
}
|
|
40616
40845
|
catch (error) {
|
|
40617
|
-
Log$
|
|
40846
|
+
Log$d.debug('DeviceCommands typedcall error: ', error);
|
|
40618
40847
|
if (error instanceof hdShared.HardwareError) {
|
|
40619
40848
|
if (error.errorCode === hdShared.HardwareErrorCode.ResponseUnexpectTypeError) {
|
|
40620
|
-
Log$
|
|
40849
|
+
Log$d.debug('[DeviceCommands] [typedCall] Unexpected response type', {
|
|
40621
40850
|
request: type,
|
|
40622
40851
|
expected: resType,
|
|
40623
40852
|
received: response.type,
|
|
@@ -40653,10 +40882,10 @@ class DeviceCommands {
|
|
|
40653
40882
|
if (shouldReduceDebugForCall(callType)) {
|
|
40654
40883
|
}
|
|
40655
40884
|
else if (DataManager.getSettings('env') === 'react-native') {
|
|
40656
|
-
Log$
|
|
40885
|
+
Log$d.debug('_filterCommonTypes: ', JSON.stringify(sanitizeDebugPayload(res)));
|
|
40657
40886
|
}
|
|
40658
40887
|
else {
|
|
40659
|
-
Log$
|
|
40888
|
+
Log$d.debug('_filterCommonTypes: ', sanitizeDebugPayload(res));
|
|
40660
40889
|
}
|
|
40661
40890
|
}
|
|
40662
40891
|
catch (error) {
|
|
@@ -40785,7 +41014,7 @@ class DeviceCommands {
|
|
|
40785
41014
|
reject(error);
|
|
40786
41015
|
});
|
|
40787
41016
|
const listenerCount = this.device.listenerCount(DEVICE.PIN);
|
|
40788
|
-
Log$
|
|
41017
|
+
Log$d.debug(`[${this.instanceId}] _promptPin called`, {
|
|
40789
41018
|
responseID: this.currentResponseID,
|
|
40790
41019
|
deviceInstanceId: this.device.instanceId,
|
|
40791
41020
|
listenerCount,
|
|
@@ -41024,7 +41253,7 @@ const parseRunOptions = (options) => {
|
|
|
41024
41253
|
options = {};
|
|
41025
41254
|
return options;
|
|
41026
41255
|
};
|
|
41027
|
-
const Log$
|
|
41256
|
+
const Log$c = getLogger(exports.LoggerNames.Device);
|
|
41028
41257
|
const deviceSessionCache = {};
|
|
41029
41258
|
function preloadSessionCache(deviceId, passphraseState, sessionId) {
|
|
41030
41259
|
const key = `${deviceId}@${passphraseState}`;
|
|
@@ -41048,7 +41277,7 @@ class Device extends events.exports {
|
|
|
41048
41277
|
this.sdkInstanceId = sdkInstanceId;
|
|
41049
41278
|
this.instanceId = generateInstanceId('Device', this.sdkInstanceId);
|
|
41050
41279
|
this.createdAt = Date.now();
|
|
41051
|
-
Log$
|
|
41280
|
+
Log$c.debug(`[Device] Created: ${this.instanceId}${this.sdkInstanceId ? ` for SDK: ${this.sdkInstanceId}` : ''}`);
|
|
41052
41281
|
}
|
|
41053
41282
|
static fromDescriptor(originalDescriptor, sdkInstanceId) {
|
|
41054
41283
|
const descriptor = Object.assign({}, originalDescriptor);
|
|
@@ -41123,12 +41352,12 @@ class Device extends events.exports {
|
|
|
41123
41352
|
if (DataManager.isBleConnect(env)) {
|
|
41124
41353
|
acquireResult = yield ((_a = this.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(this.originalDescriptor.id, undefined, true, expectedProtocol));
|
|
41125
41354
|
this.mainId = (_b = acquireResult === null || acquireResult === void 0 ? void 0 : acquireResult.uuid) !== null && _b !== void 0 ? _b : '';
|
|
41126
|
-
Log$
|
|
41355
|
+
Log$c.debug('Expected uuid:', this.mainId);
|
|
41127
41356
|
}
|
|
41128
41357
|
else {
|
|
41129
41358
|
acquireResult = yield ((_c = this.deviceConnector) === null || _c === void 0 ? void 0 : _c.acquire(this.originalDescriptor.path, this.originalDescriptor.session, undefined, expectedProtocol));
|
|
41130
41359
|
this.mainId = acquireResult;
|
|
41131
|
-
Log$
|
|
41360
|
+
Log$c.debug('Expected session id:', this.mainId);
|
|
41132
41361
|
}
|
|
41133
41362
|
this.deviceAcquired = true;
|
|
41134
41363
|
this.updateDescriptor({ [mainIdKey]: this.mainId });
|
|
@@ -41160,11 +41389,11 @@ class Device extends events.exports {
|
|
|
41160
41389
|
(this.mainId && DataManager.isBleConnect(env))) {
|
|
41161
41390
|
if (this.pendingCallbackPromise) {
|
|
41162
41391
|
try {
|
|
41163
|
-
Log$
|
|
41392
|
+
Log$c.debug('Waiting for callback tasks to complete before releasing device (in release method)');
|
|
41164
41393
|
yield this.pendingCallbackPromise.promise;
|
|
41165
41394
|
}
|
|
41166
41395
|
catch (error) {
|
|
41167
|
-
Log$
|
|
41396
|
+
Log$c.error('Error waiting for callback tasks in release method:', error);
|
|
41168
41397
|
}
|
|
41169
41398
|
}
|
|
41170
41399
|
if (this.commands) {
|
|
@@ -41183,7 +41412,7 @@ class Device extends events.exports {
|
|
|
41183
41412
|
this.updateDescriptor({ session: null });
|
|
41184
41413
|
}
|
|
41185
41414
|
catch (err) {
|
|
41186
|
-
Log$
|
|
41415
|
+
Log$c.error('[Device] release error: ', err);
|
|
41187
41416
|
}
|
|
41188
41417
|
finally {
|
|
41189
41418
|
this.needReloadDevice = true;
|
|
@@ -41192,6 +41421,46 @@ class Device extends events.exports {
|
|
|
41192
41421
|
this.deviceAcquired = false;
|
|
41193
41422
|
});
|
|
41194
41423
|
}
|
|
41424
|
+
preInitialize(initOptions) {
|
|
41425
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41426
|
+
if (!this.features) {
|
|
41427
|
+
yield this.acquire();
|
|
41428
|
+
yield this.initialize(initOptions);
|
|
41429
|
+
}
|
|
41430
|
+
this.markPreInitialized({
|
|
41431
|
+
passphraseState: initOptions === null || initOptions === void 0 ? void 0 : initOptions.passphraseState,
|
|
41432
|
+
});
|
|
41433
|
+
});
|
|
41434
|
+
}
|
|
41435
|
+
markPreInitialized(meta) {
|
|
41436
|
+
this.preInitializedAt = Date.now();
|
|
41437
|
+
this.preInitializeMeta = meta
|
|
41438
|
+
? {
|
|
41439
|
+
passphraseState: meta.passphraseState === '' ? undefined : meta.passphraseState,
|
|
41440
|
+
}
|
|
41441
|
+
: undefined;
|
|
41442
|
+
}
|
|
41443
|
+
clearPreInitialized() {
|
|
41444
|
+
this.preInitializedAt = undefined;
|
|
41445
|
+
this.preInitializeMeta = undefined;
|
|
41446
|
+
}
|
|
41447
|
+
isPreInitializeMetaMatch(payload) {
|
|
41448
|
+
if (!this.preInitializeMeta)
|
|
41449
|
+
return true;
|
|
41450
|
+
const passphraseState = (payload === null || payload === void 0 ? void 0 : payload.passphraseState) === '' ? undefined : payload === null || payload === void 0 ? void 0 : payload.passphraseState;
|
|
41451
|
+
return this.preInitializeMeta.passphraseState === passphraseState;
|
|
41452
|
+
}
|
|
41453
|
+
isPreInitializedValid(ttlMs) {
|
|
41454
|
+
if (!this.preInitializedAt)
|
|
41455
|
+
return false;
|
|
41456
|
+
return Date.now() - this.preInitializedAt <= ttlMs;
|
|
41457
|
+
}
|
|
41458
|
+
setLastInitializeDuration(durationMs) {
|
|
41459
|
+
this.lastInitializeDurationMs = durationMs;
|
|
41460
|
+
}
|
|
41461
|
+
getLastInitializeDuration() {
|
|
41462
|
+
return this.lastInitializeDurationMs;
|
|
41463
|
+
}
|
|
41195
41464
|
getCommands() {
|
|
41196
41465
|
return this.commands;
|
|
41197
41466
|
}
|
|
@@ -41203,8 +41472,8 @@ class Device extends events.exports {
|
|
|
41203
41472
|
}
|
|
41204
41473
|
getInternalState(_deviceId) {
|
|
41205
41474
|
var _a, _b;
|
|
41206
|
-
Log$
|
|
41207
|
-
Log$
|
|
41475
|
+
Log$c.debug('getInternalState session cache: ', deviceSessionCache);
|
|
41476
|
+
Log$c.debug('getInternalState session param: ', `device_id: ${_deviceId}`, `features.device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}`);
|
|
41208
41477
|
const deviceId = _deviceId || ((_b = this.features) === null || _b === void 0 ? void 0 : _b.device_id);
|
|
41209
41478
|
if (!deviceId)
|
|
41210
41479
|
return undefined;
|
|
@@ -41214,7 +41483,7 @@ class Device extends events.exports {
|
|
|
41214
41483
|
return deviceSessionCache[usePassKey];
|
|
41215
41484
|
}
|
|
41216
41485
|
updateInternalState(enablePassphrase, passphraseState, deviceId, sessionId = null, featuresSessionId = null) {
|
|
41217
|
-
Log$
|
|
41486
|
+
Log$c.debug('updateInternalState session param: ', `device_id: ${deviceId}`, `enablePassphrase: ${enablePassphrase}`, `passphraseState: ${passphraseState}`, `sessionId: ${sessionId}`, `featuresSessionId: ${featuresSessionId}`);
|
|
41218
41487
|
if (enablePassphrase) {
|
|
41219
41488
|
if (sessionId) {
|
|
41220
41489
|
deviceSessionCache[this.generateStateKey(deviceId, passphraseState)] = sessionId;
|
|
@@ -41227,11 +41496,11 @@ class Device extends events.exports {
|
|
|
41227
41496
|
if (deviceSessionCache[oldKey]) {
|
|
41228
41497
|
delete deviceSessionCache[oldKey];
|
|
41229
41498
|
}
|
|
41230
|
-
Log$
|
|
41499
|
+
Log$c.debug('updateInternalState session cache: ', deviceSessionCache);
|
|
41231
41500
|
}
|
|
41232
41501
|
setInternalState(state, initSession) {
|
|
41233
41502
|
var _a, _b;
|
|
41234
|
-
Log$
|
|
41503
|
+
Log$c.debug('setInternalState session param: ', `state: ${state}`, `initSession: ${initSession}`, `device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}`);
|
|
41235
41504
|
if (!this.features)
|
|
41236
41505
|
return;
|
|
41237
41506
|
if (!this.passphraseState && !initSession)
|
|
@@ -41243,11 +41512,11 @@ class Device extends events.exports {
|
|
|
41243
41512
|
if (state) {
|
|
41244
41513
|
deviceSessionCache[key] = state;
|
|
41245
41514
|
}
|
|
41246
|
-
Log$
|
|
41515
|
+
Log$c.debug('setInternalState done session cache: ', deviceSessionCache);
|
|
41247
41516
|
}
|
|
41248
41517
|
clearInternalState(_deviceId) {
|
|
41249
41518
|
var _a;
|
|
41250
|
-
Log$
|
|
41519
|
+
Log$c.debug('clearInternalState param: ', _deviceId);
|
|
41251
41520
|
const deviceId = _deviceId || ((_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id);
|
|
41252
41521
|
if (!deviceId)
|
|
41253
41522
|
return;
|
|
@@ -41263,7 +41532,7 @@ class Device extends events.exports {
|
|
|
41263
41532
|
if (this.originalDescriptor.protocolType === 'V2') {
|
|
41264
41533
|
this.passphraseState = options === null || options === void 0 ? void 0 : options.passphraseState;
|
|
41265
41534
|
if (this.features && !this.featuresNeedsReload && !(options === null || options === void 0 ? void 0 : options.initSession)) {
|
|
41266
|
-
Log$
|
|
41535
|
+
Log$c.debug('Skip Protocol V2 feature adapter; cached features are available');
|
|
41267
41536
|
return;
|
|
41268
41537
|
}
|
|
41269
41538
|
yield this._initializeProtocolV2();
|
|
@@ -41283,12 +41552,7 @@ class Device extends events.exports {
|
|
|
41283
41552
|
}
|
|
41284
41553
|
payload.passphrase_state = options === null || options === void 0 ? void 0 : options.passphraseState;
|
|
41285
41554
|
payload.is_contains_attach = true;
|
|
41286
|
-
|
|
41287
|
-
deviceId: options === null || options === void 0 ? void 0 : options.deviceId,
|
|
41288
|
-
passphraseState: options === null || options === void 0 ? void 0 : options.passphraseState,
|
|
41289
|
-
initSession: options === null || options === void 0 ? void 0 : options.initSession,
|
|
41290
|
-
InitializePayload: payload,
|
|
41291
|
-
});
|
|
41555
|
+
const initStartAt = Date.now();
|
|
41292
41556
|
try {
|
|
41293
41557
|
const { message } = yield Promise.race([
|
|
41294
41558
|
this.commands.typedCall('Initialize', 'Features', payload),
|
|
@@ -41298,19 +41562,20 @@ class Device extends events.exports {
|
|
|
41298
41562
|
}, 25 * 1000);
|
|
41299
41563
|
}),
|
|
41300
41564
|
]);
|
|
41301
|
-
|
|
41565
|
+
const initCostMs = Date.now() - initStartAt;
|
|
41566
|
+
this.setLastInitializeDuration(initCostMs);
|
|
41302
41567
|
this._updateFeatures(message, options === null || options === void 0 ? void 0 : options.initSession);
|
|
41303
41568
|
yield TransportManager.reconfigure(this.features);
|
|
41304
41569
|
}
|
|
41305
41570
|
catch (error) {
|
|
41306
|
-
Log$
|
|
41571
|
+
Log$c.error('Initialization failed:', error);
|
|
41307
41572
|
throw error;
|
|
41308
41573
|
}
|
|
41309
41574
|
});
|
|
41310
41575
|
}
|
|
41311
41576
|
_initializeProtocolV2() {
|
|
41312
41577
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41313
|
-
Log$
|
|
41578
|
+
Log$c.debug('Initialize device via Protocol V2 feature adapter');
|
|
41314
41579
|
try {
|
|
41315
41580
|
const features = yield Promise.race([
|
|
41316
41581
|
getProtocolV2Features({
|
|
@@ -41324,11 +41589,11 @@ class Device extends events.exports {
|
|
|
41324
41589
|
}, 10 * 1000);
|
|
41325
41590
|
}),
|
|
41326
41591
|
]);
|
|
41327
|
-
Log$
|
|
41592
|
+
Log$c.debug('Protocol V2 normalized features:', features);
|
|
41328
41593
|
this._updateFeatures(features);
|
|
41329
41594
|
}
|
|
41330
41595
|
catch (error) {
|
|
41331
|
-
Log$
|
|
41596
|
+
Log$c.error('Protocol V2 initialization failed:', error);
|
|
41332
41597
|
throw error;
|
|
41333
41598
|
}
|
|
41334
41599
|
});
|
|
@@ -41379,7 +41644,7 @@ class Device extends events.exports {
|
|
|
41379
41644
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41380
41645
|
if (this.runPromise) {
|
|
41381
41646
|
yield this.interruptionFromOutside();
|
|
41382
|
-
Log$
|
|
41647
|
+
Log$c.debug('[Device] run error:', 'Device is running, but will cancel previous operate');
|
|
41383
41648
|
}
|
|
41384
41649
|
options = parseRunOptions(options);
|
|
41385
41650
|
this.runPromise = hdShared.createDeferred(this._runInner.bind(this, fn, options));
|
|
@@ -41401,7 +41666,9 @@ class Device extends events.exports {
|
|
|
41401
41666
|
}
|
|
41402
41667
|
try {
|
|
41403
41668
|
if (fn) {
|
|
41404
|
-
|
|
41669
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipInitialize)) {
|
|
41670
|
+
yield this.initialize(options);
|
|
41671
|
+
}
|
|
41405
41672
|
}
|
|
41406
41673
|
}
|
|
41407
41674
|
catch (error) {
|
|
@@ -41435,7 +41702,7 @@ class Device extends events.exports {
|
|
|
41435
41702
|
yield ((_a = this.deviceConnector) === null || _a === void 0 ? void 0 : _a.disconnect(this.mainId));
|
|
41436
41703
|
}
|
|
41437
41704
|
yield this.release();
|
|
41438
|
-
Log$
|
|
41705
|
+
Log$c.debug(`error code ${e.errorCode} release device, mainId: ${this.mainId}`);
|
|
41439
41706
|
}
|
|
41440
41707
|
this.runPromise = null;
|
|
41441
41708
|
return;
|
|
@@ -41445,7 +41712,7 @@ class Device extends events.exports {
|
|
|
41445
41712
|
options.keepSession === false) {
|
|
41446
41713
|
this.keepSession = false;
|
|
41447
41714
|
yield this.release();
|
|
41448
|
-
Log$
|
|
41715
|
+
Log$c.debug('release device, mainId: ', this.mainId);
|
|
41449
41716
|
}
|
|
41450
41717
|
if (this.runPromise) {
|
|
41451
41718
|
this.runPromise.resolve();
|
|
@@ -41478,7 +41745,7 @@ class Device extends events.exports {
|
|
|
41478
41745
|
setCancelableAction(callback) {
|
|
41479
41746
|
this.cancelableAction = (e) => callback(e)
|
|
41480
41747
|
.catch(e2 => {
|
|
41481
|
-
Log$
|
|
41748
|
+
Log$c.debug('cancelableAction error', e2);
|
|
41482
41749
|
})
|
|
41483
41750
|
.finally(() => {
|
|
41484
41751
|
this.clearCancelableAction();
|
|
@@ -41562,7 +41829,8 @@ class Device extends events.exports {
|
|
|
41562
41829
|
hasUsePassphrase() {
|
|
41563
41830
|
var _a;
|
|
41564
41831
|
const isModeT = getDeviceType(this.features) === hdShared.EDeviceType.Touch ||
|
|
41565
|
-
getDeviceType(this.features) === hdShared.EDeviceType.Pro
|
|
41832
|
+
getDeviceType(this.features) === hdShared.EDeviceType.Pro ||
|
|
41833
|
+
getDeviceType(this.features) === hdShared.EDeviceType.Pro2;
|
|
41566
41834
|
const preCheckTouch = isModeT && ((_a = this.features) === null || _a === void 0 ? void 0 : _a.unlocked) === false;
|
|
41567
41835
|
return this.features && (!!this.features.passphrase_protection || preCheckTouch);
|
|
41568
41836
|
}
|
|
@@ -41583,6 +41851,9 @@ class Device extends events.exports {
|
|
|
41583
41851
|
pro: {
|
|
41584
41852
|
min: '4.15.0',
|
|
41585
41853
|
},
|
|
41854
|
+
pro2: {
|
|
41855
|
+
min: '4.15.0',
|
|
41856
|
+
},
|
|
41586
41857
|
};
|
|
41587
41858
|
}
|
|
41588
41859
|
unlockDevice() {
|
|
@@ -41591,9 +41862,7 @@ class Device extends events.exports {
|
|
|
41591
41862
|
const firmwareVersion = (_a = getDeviceFirmwareVersion(this.features)) === null || _a === void 0 ? void 0 : _a.join('.');
|
|
41592
41863
|
const versionRange = getMethodVersionRange(this.features, type => this.supportUnlockVersionRange()[type]);
|
|
41593
41864
|
const supportAttachPinCapability = existCapability(this.features, hdTransport.Enum_Capability.Capability_AttachToPin);
|
|
41594
|
-
const isPro2 = getDeviceType(this.features) === hdShared.EDeviceType.Pro2;
|
|
41595
41865
|
const supportUnlock = supportAttachPinCapability ||
|
|
41596
|
-
isPro2 ||
|
|
41597
41866
|
(versionRange && semver__default["default"].gte(firmwareVersion, versionRange.min));
|
|
41598
41867
|
if (supportUnlock) {
|
|
41599
41868
|
const res = yield this.commands.typedCall('UnLockDevice', 'UnLockDeviceResponse');
|
|
@@ -41634,7 +41903,7 @@ class Device extends events.exports {
|
|
|
41634
41903
|
const mainWalletUseAttachPin = unlockedAttachPin && useEmptyPassphrase;
|
|
41635
41904
|
const useErrorAttachPin = unlockedAttachPin && passphraseState && passphraseState !== newPassphraseState;
|
|
41636
41905
|
const passphraseStateMismatch = !!passphraseState && passphraseState !== newPassphraseState;
|
|
41637
|
-
Log$
|
|
41906
|
+
Log$c.debug('Check passphrase state safety: ', {
|
|
41638
41907
|
passphraseState,
|
|
41639
41908
|
newPassphraseState,
|
|
41640
41909
|
unlockedAttachPin,
|
|
@@ -41689,6 +41958,27 @@ class DeviceList extends events.exports {
|
|
|
41689
41958
|
}
|
|
41690
41959
|
}
|
|
41691
41960
|
|
|
41961
|
+
class PollingStateManager {
|
|
41962
|
+
constructor() {
|
|
41963
|
+
this.activePolls = new Map();
|
|
41964
|
+
}
|
|
41965
|
+
start(connectId) {
|
|
41966
|
+
var _a;
|
|
41967
|
+
const currentId = ((_a = this.activePolls.get(connectId)) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
41968
|
+
this.activePolls.set(connectId, currentId);
|
|
41969
|
+
return currentId;
|
|
41970
|
+
}
|
|
41971
|
+
isActive(connectId, pollingId) {
|
|
41972
|
+
return this.activePolls.get(connectId) === pollingId;
|
|
41973
|
+
}
|
|
41974
|
+
stop(connectId) {
|
|
41975
|
+
this.activePolls.delete(connectId);
|
|
41976
|
+
}
|
|
41977
|
+
stopAll() {
|
|
41978
|
+
this.activePolls.clear();
|
|
41979
|
+
}
|
|
41980
|
+
}
|
|
41981
|
+
|
|
41692
41982
|
const getFirmwareReleaseInfo = (features, firmwareType) => {
|
|
41693
41983
|
const firmwareStatus = DataManager.getFirmwareStatus(features, firmwareType);
|
|
41694
41984
|
const changelog = DataManager.getFirmwareChangelog(features, firmwareType);
|
|
@@ -41741,14 +42031,49 @@ const getBootloaderReleaseInfo = ({ features, willUpdateFirmwareVersion, firmwar
|
|
|
41741
42031
|
};
|
|
41742
42032
|
};
|
|
41743
42033
|
|
|
41744
|
-
const Log$
|
|
42034
|
+
const Log$b = getLogger(exports.LoggerNames.Method);
|
|
42035
|
+
const isEvmLedgerLegacyPathWithHighIndex = (path) => {
|
|
42036
|
+
let addressN;
|
|
42037
|
+
if (typeof path === 'string') {
|
|
42038
|
+
try {
|
|
42039
|
+
addressN = getHDPath(path);
|
|
42040
|
+
}
|
|
42041
|
+
catch (_a) {
|
|
42042
|
+
return false;
|
|
42043
|
+
}
|
|
42044
|
+
}
|
|
42045
|
+
else if (Array.isArray(path)) {
|
|
42046
|
+
addressN = path.map((item) => Number(item));
|
|
42047
|
+
}
|
|
42048
|
+
return (Array.isArray(addressN) &&
|
|
42049
|
+
addressN.length === 4 &&
|
|
42050
|
+
addressN[0] === toHardened(44) &&
|
|
42051
|
+
addressN[1] === toHardened(60) &&
|
|
42052
|
+
addressN[2] === toHardened(0) &&
|
|
42053
|
+
addressN[3] > 1 &&
|
|
42054
|
+
addressN[3] < toHardened(0));
|
|
42055
|
+
};
|
|
42056
|
+
const EVM_LEDGER_LEGACY_METHODS = ['evmGetAddress', 'evmGetPublicKey'];
|
|
41745
42057
|
class BaseMethod {
|
|
42058
|
+
getPreWarmKey() {
|
|
42059
|
+
var _a, _b, _c, _d;
|
|
42060
|
+
const payload = ((_a = this.payload) !== null && _a !== void 0 ? _a : {});
|
|
42061
|
+
return [
|
|
42062
|
+
(_c = (_b = this.connectId) !== null && _b !== void 0 ? _b : payload.connectId) !== null && _c !== void 0 ? _c : '',
|
|
42063
|
+
(_d = payload.passphraseState) !== null && _d !== void 0 ? _d : '',
|
|
42064
|
+
this.name,
|
|
42065
|
+
].join('|');
|
|
42066
|
+
}
|
|
41746
42067
|
constructor(message) {
|
|
41747
42068
|
this.shouldEnsureConnected = true;
|
|
41748
42069
|
this.checkDeviceId = false;
|
|
41749
42070
|
this.useDevicePassphraseState = true;
|
|
41750
42071
|
this.skipForceUpdateCheck = false;
|
|
42072
|
+
this.allowUsePreInitialize = false;
|
|
42073
|
+
this.isPreWarmSignal = false;
|
|
42074
|
+
this.preWarmTtl = 60 * 1000;
|
|
41751
42075
|
this.strictCheckDeviceSupport = false;
|
|
42076
|
+
this.temporarySafetyCheckPrompted = false;
|
|
41752
42077
|
this.postPreviousAddressMessage = (data) => {
|
|
41753
42078
|
this.postMessage(createUiMessage(UI_REQUEST.PREVIOUS_ADDRESS_RESULT, {
|
|
41754
42079
|
device: this.device.toMessageObject(),
|
|
@@ -41771,7 +42096,7 @@ class BaseMethod {
|
|
|
41771
42096
|
setContext(context) {
|
|
41772
42097
|
this.sdkInstanceId = context.sdkInstanceId;
|
|
41773
42098
|
this.instanceId = generateInstanceId('Method', this.sdkInstanceId);
|
|
41774
|
-
Log$
|
|
42099
|
+
Log$b.debug(`[BaseMethod] Created: ${this.instanceId}, method: ${this.name}, SDK: ${this.sdkInstanceId}`);
|
|
41775
42100
|
}
|
|
41776
42101
|
setDevice(device) {
|
|
41777
42102
|
var _a, _b;
|
|
@@ -41791,7 +42116,7 @@ class BaseMethod {
|
|
|
41791
42116
|
if (device.commands) {
|
|
41792
42117
|
device.commands.currentResponseID = this.responseID;
|
|
41793
42118
|
}
|
|
41794
|
-
Log$
|
|
42119
|
+
Log$b.debug(`[${this.instanceId}] setDevice: ${device.instanceId}, commands: ${(_b = device.commands) === null || _b === void 0 ? void 0 : _b.instanceId}`);
|
|
41795
42120
|
}
|
|
41796
42121
|
checkFirmwareRelease() {
|
|
41797
42122
|
if (!this.device || !this.device.features)
|
|
@@ -41838,20 +42163,43 @@ class BaseMethod {
|
|
|
41838
42163
|
});
|
|
41839
42164
|
}
|
|
41840
42165
|
}
|
|
42166
|
+
shouldPromptSafetyCheckForEvmLedgerLegacyPath() {
|
|
42167
|
+
var _a, _b;
|
|
42168
|
+
if (!EVM_LEDGER_LEGACY_METHODS.includes(this.name)) {
|
|
42169
|
+
return false;
|
|
42170
|
+
}
|
|
42171
|
+
const deviceType = getDeviceType(this.device.features);
|
|
42172
|
+
if (!DeviceModelToTypes.model_touch.includes(deviceType)) {
|
|
42173
|
+
return false;
|
|
42174
|
+
}
|
|
42175
|
+
const paths = Array.isArray((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle)
|
|
42176
|
+
? this.payload.bundle.map((item) => item === null || item === void 0 ? void 0 : item.path)
|
|
42177
|
+
: [(_b = this.payload) === null || _b === void 0 ? void 0 : _b.path];
|
|
42178
|
+
return paths.some(isEvmLedgerLegacyPathWithHighIndex);
|
|
42179
|
+
}
|
|
41841
42180
|
checkSafetyLevelOnTestNet() {
|
|
41842
42181
|
var _a, _b, _c;
|
|
41843
42182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42183
|
+
if (this.temporarySafetyCheckPrompted) {
|
|
42184
|
+
return false;
|
|
42185
|
+
}
|
|
41844
42186
|
let checkFlag = false;
|
|
41845
42187
|
if (this.name === 'evmSignTransaction' &&
|
|
41846
42188
|
[3, 4, 5, 420, 11155111].includes(Number((_b = (_a = this.payload) === null || _a === void 0 ? void 0 : _a.transaction) === null || _b === void 0 ? void 0 : _b.chainId))) {
|
|
41847
42189
|
checkFlag = true;
|
|
41848
42190
|
}
|
|
42191
|
+
if (this.shouldPromptSafetyCheckForEvmLedgerLegacyPath()) {
|
|
42192
|
+
checkFlag = true;
|
|
42193
|
+
}
|
|
41849
42194
|
if (checkFlag && ((_c = this.device.features) === null || _c === void 0 ? void 0 : _c.safety_checks) === 'Strict') {
|
|
41850
|
-
Log$
|
|
42195
|
+
Log$b.debug('will change safety_checks level');
|
|
41851
42196
|
yield this.device.commands.typedCall('ApplySettings', 'Success', {
|
|
41852
42197
|
safety_checks: 'PromptTemporarily',
|
|
41853
42198
|
});
|
|
42199
|
+
this.temporarySafetyCheckPrompted = true;
|
|
42200
|
+
return true;
|
|
41854
42201
|
}
|
|
42202
|
+
return false;
|
|
41855
42203
|
});
|
|
41856
42204
|
}
|
|
41857
42205
|
dispose() { }
|
|
@@ -41878,6 +42226,36 @@ class TestInitializeDeviceDuration extends BaseMethod {
|
|
|
41878
42226
|
}
|
|
41879
42227
|
}
|
|
41880
42228
|
|
|
42229
|
+
const Log$a = getLogger(exports.LoggerNames.Core);
|
|
42230
|
+
const parseInitOptions$1 = (payload) => ({
|
|
42231
|
+
initSession: payload === null || payload === void 0 ? void 0 : payload.initSession,
|
|
42232
|
+
passphraseState: payload === null || payload === void 0 ? void 0 : payload.passphraseState,
|
|
42233
|
+
deriveCardano: payload === null || payload === void 0 ? void 0 : payload.deriveCardano,
|
|
42234
|
+
});
|
|
42235
|
+
class PreInitialize extends BaseMethod {
|
|
42236
|
+
init() {
|
|
42237
|
+
this.skipForceUpdateCheck = true;
|
|
42238
|
+
this.useDevicePassphraseState = false;
|
|
42239
|
+
this.isPreWarmSignal = true;
|
|
42240
|
+
}
|
|
42241
|
+
run() {
|
|
42242
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42243
|
+
try {
|
|
42244
|
+
yield this.device.preInitialize(parseInitOptions$1(this.payload));
|
|
42245
|
+
if (this.device.hasDeviceAcquire()) {
|
|
42246
|
+
yield this.device.release();
|
|
42247
|
+
}
|
|
42248
|
+
return true;
|
|
42249
|
+
}
|
|
42250
|
+
catch (_a) {
|
|
42251
|
+
this.device.clearPreInitialized();
|
|
42252
|
+
Log$a.debug('[PRE-INIT][FAILED]');
|
|
42253
|
+
return false;
|
|
42254
|
+
}
|
|
42255
|
+
});
|
|
42256
|
+
}
|
|
42257
|
+
}
|
|
42258
|
+
|
|
41881
42259
|
class SearchDevices extends BaseMethod {
|
|
41882
42260
|
init() {
|
|
41883
42261
|
this.useDevice = false;
|
|
@@ -42250,10 +42628,11 @@ class GetPassphraseState extends BaseMethod {
|
|
|
42250
42628
|
allowCreateAttachPin: this.payload.allowCreateAttachPin,
|
|
42251
42629
|
});
|
|
42252
42630
|
const { features } = this.device;
|
|
42253
|
-
const isPro2 = getDeviceType(features) === hdShared.EDeviceType.Pro2;
|
|
42254
42631
|
const passphraseProtection = (_a = features === null || features === void 0 ? void 0 : features.passphrase_protection) !== null && _a !== void 0 ? _a : null;
|
|
42632
|
+
const deviceType = getDeviceType(features);
|
|
42633
|
+
const isProSeries = deviceType === hdShared.EDeviceType.Pro || deviceType === hdShared.EDeviceType.Pro2;
|
|
42255
42634
|
return Promise.resolve({
|
|
42256
|
-
passphrase_state:
|
|
42635
|
+
passphrase_state: isProSeries || passphraseProtection === true ? passphraseState : undefined,
|
|
42257
42636
|
session_id: (_b = newSession !== null && newSession !== void 0 ? newSession : features === null || features === void 0 ? void 0 : features.session_id) !== null && _b !== void 0 ? _b : undefined,
|
|
42258
42637
|
unlocked_attach_pin: unlockedAttachPin !== null && unlockedAttachPin !== void 0 ? unlockedAttachPin : features === null || features === void 0 ? void 0 : features.unlocked_attach_pin,
|
|
42259
42638
|
passphrase_protection: passphraseProtection,
|
|
@@ -43703,9 +44082,12 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
|
|
|
43703
44082
|
type,
|
|
43704
44083
|
}));
|
|
43705
44084
|
};
|
|
43706
|
-
this.postProgressMessage = (progress, progressType
|
|
43707
|
-
this.postMessage(createUiMessage(UI_REQUEST.FIRMWARE_PROGRESS,
|
|
43708
|
-
|
|
44085
|
+
this.postProgressMessage = (progress, progressType) => {
|
|
44086
|
+
this.postMessage(createUiMessage(UI_REQUEST.FIRMWARE_PROGRESS, {
|
|
44087
|
+
device: this.device.toMessageObject(),
|
|
44088
|
+
progress,
|
|
44089
|
+
progressType,
|
|
44090
|
+
}));
|
|
43709
44091
|
};
|
|
43710
44092
|
}
|
|
43711
44093
|
init() { }
|
|
@@ -43901,7 +44283,7 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
|
|
|
43901
44283
|
});
|
|
43902
44284
|
});
|
|
43903
44285
|
}
|
|
43904
|
-
emmcCommonUpdateProcess({ payload, filePath, processedSize, totalSize,
|
|
44286
|
+
emmcCommonUpdateProcess({ payload, filePath, processedSize, totalSize, }) {
|
|
43905
44287
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43906
44288
|
if (!filePath.startsWith('0:')) {
|
|
43907
44289
|
throw new Error('filePath must start with 0:');
|
|
@@ -43911,6 +44293,7 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
|
|
|
43911
44293
|
const chunkSize = 1024 * perPackageSize;
|
|
43912
44294
|
const totalChunks = Math.ceil(payload.byteLength / chunkSize);
|
|
43913
44295
|
let offset = 0;
|
|
44296
|
+
let currentFileProcessed = 0;
|
|
43914
44297
|
for (let i = 0; i < totalChunks; i++) {
|
|
43915
44298
|
const chunkStart = i * chunkSize;
|
|
43916
44299
|
const chunkEnd = Math.min(chunkStart + chunkSize, payload.byteLength);
|
|
@@ -43919,7 +44302,7 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
|
|
|
43919
44302
|
const overwrite = i === 0;
|
|
43920
44303
|
let progress;
|
|
43921
44304
|
if (totalSize !== undefined && processedSize !== undefined) {
|
|
43922
|
-
|
|
44305
|
+
currentFileProcessed = processedSize + chunkEnd;
|
|
43923
44306
|
progress = Math.min(Math.ceil((currentFileProcessed / totalSize) * 100), 99);
|
|
43924
44307
|
}
|
|
43925
44308
|
else {
|
|
@@ -43927,15 +44310,7 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
|
|
|
43927
44310
|
}
|
|
43928
44311
|
const writeRes = yield this.emmcFileWriteWithRetry(filePath, chunkLength, offset, chunk, overwrite, progress);
|
|
43929
44312
|
offset += writeRes.message.processed_byte;
|
|
43930
|
-
|
|
43931
|
-
const transferredBytes = totalSize !== undefined && processedSize !== undefined ? processedSize + offset : offset;
|
|
43932
|
-
const totalBytes = totalSize !== null && totalSize !== void 0 ? totalSize : payload.byteLength;
|
|
43933
|
-
this.postProgressMessage(progress, 'transferData', {
|
|
43934
|
-
transferredBytes,
|
|
43935
|
-
totalBytes,
|
|
43936
|
-
rateBytesPerSecond: elapsedMs > 0 ? Math.round((transferredBytes / elapsedMs) * 1000) : undefined,
|
|
43937
|
-
elapsedMs,
|
|
43938
|
-
});
|
|
44313
|
+
this.postProgressMessage(progress, 'transferData');
|
|
43939
44314
|
}
|
|
43940
44315
|
return totalSize !== undefined ? (processedSize !== null && processedSize !== void 0 ? processedSize : 0) + payload.byteLength : 0;
|
|
43941
44316
|
});
|
|
@@ -44097,8 +44472,7 @@ class DeviceLock extends BaseMethod {
|
|
|
44097
44472
|
}
|
|
44098
44473
|
run() {
|
|
44099
44474
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44100
|
-
|
|
44101
|
-
return Promise.resolve(res.message);
|
|
44475
|
+
return this.device.lockDevice();
|
|
44102
44476
|
});
|
|
44103
44477
|
}
|
|
44104
44478
|
}
|
|
@@ -44768,7 +45142,6 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
44768
45142
|
totalSize += bootloaderBinary.byteLength;
|
|
44769
45143
|
}
|
|
44770
45144
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.StartTransferData);
|
|
44771
|
-
const transferStartTime = Date.now();
|
|
44772
45145
|
if (resourceBinary) {
|
|
44773
45146
|
const file = yield JSZip__default["default"].loadAsync(resourceBinary);
|
|
44774
45147
|
const files = Object.entries(file.files);
|
|
@@ -44781,7 +45154,6 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
44781
45154
|
filePath: `0:res/${name}`,
|
|
44782
45155
|
processedSize,
|
|
44783
45156
|
totalSize,
|
|
44784
|
-
transferStartTime,
|
|
44785
45157
|
});
|
|
44786
45158
|
}
|
|
44787
45159
|
}
|
|
@@ -44792,7 +45164,6 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
44792
45164
|
filePath: `0:boot/bootloader.bin`,
|
|
44793
45165
|
processedSize,
|
|
44794
45166
|
totalSize,
|
|
44795
|
-
transferStartTime,
|
|
44796
45167
|
});
|
|
44797
45168
|
}
|
|
44798
45169
|
yield this.createUpdatesFolderIfNotExists(`0:updates/`);
|
|
@@ -44803,7 +45174,6 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
44803
45174
|
filePath: `0:updates/${fwbinary.fileName}`,
|
|
44804
45175
|
processedSize,
|
|
44805
45176
|
totalSize,
|
|
44806
|
-
transferStartTime,
|
|
44807
45177
|
});
|
|
44808
45178
|
}
|
|
44809
45179
|
}
|
|
@@ -45409,7 +45779,6 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45409
45779
|
if (bootloaderBinary)
|
|
45410
45780
|
totalSize += bootloaderBinary.byteLength;
|
|
45411
45781
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.StartTransferData);
|
|
45412
|
-
const transferStartTime = Date.now();
|
|
45413
45782
|
const targets = [];
|
|
45414
45783
|
if (resourceBinary) {
|
|
45415
45784
|
const resourcePath = `${PROTOCOL_V2_FIRMWARE_STAGING_VOLUME}res/`;
|
|
@@ -45425,7 +45794,6 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45425
45794
|
filePath: `${resourcePath}${name}`,
|
|
45426
45795
|
processedSize,
|
|
45427
45796
|
totalSize,
|
|
45428
|
-
transferStartTime,
|
|
45429
45797
|
});
|
|
45430
45798
|
}
|
|
45431
45799
|
}
|
|
@@ -45441,7 +45809,6 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45441
45809
|
filePath: bootloaderPath,
|
|
45442
45810
|
processedSize,
|
|
45443
45811
|
totalSize,
|
|
45444
|
-
transferStartTime,
|
|
45445
45812
|
});
|
|
45446
45813
|
targets.push({
|
|
45447
45814
|
target_id: ProtocolV2FirmwareTargetType.TARGET_BOOTLOADER,
|
|
@@ -45455,7 +45822,6 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45455
45822
|
filePath: firmwarePath,
|
|
45456
45823
|
processedSize,
|
|
45457
45824
|
totalSize,
|
|
45458
|
-
transferStartTime,
|
|
45459
45825
|
});
|
|
45460
45826
|
targets.push({
|
|
45461
45827
|
target_id: protocolV2FileNameToTargetId(fwbinary.fileName),
|
|
@@ -45625,7 +45991,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45625
45991
|
yield typedCall('FilesystemDirMake', 'Success', { path });
|
|
45626
45992
|
});
|
|
45627
45993
|
}
|
|
45628
|
-
protocolV2CommonUpdateProcess({ payload, filePath, processedSize, totalSize,
|
|
45994
|
+
protocolV2CommonUpdateProcess({ payload, filePath, processedSize, totalSize, }) {
|
|
45629
45995
|
var _a;
|
|
45630
45996
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45631
45997
|
const chunkSize = this.getProtocolV2FirmwareChunkSize();
|
|
@@ -45648,17 +46014,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
45648
46014
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.EmmcFileWriteFirmwareError, `invalid processed_byte ${nextOffset} for offset ${offset}`);
|
|
45649
46015
|
}
|
|
45650
46016
|
offset = nextOffset;
|
|
45651
|
-
|
|
45652
|
-
const transferredBytes = totalSize !== undefined && processedSize !== undefined
|
|
45653
|
-
? Math.min(processedSize + offset, totalSize)
|
|
45654
|
-
: offset;
|
|
45655
|
-
const totalBytes = totalSize !== null && totalSize !== void 0 ? totalSize : payload.byteLength;
|
|
45656
|
-
this.postProgressMessage(getUploadProgress(offset), 'transferData', {
|
|
45657
|
-
transferredBytes,
|
|
45658
|
-
totalBytes,
|
|
45659
|
-
rateBytesPerSecond: elapsedMs > 0 ? Math.round((transferredBytes / elapsedMs) * 1000) : undefined,
|
|
45660
|
-
elapsedMs,
|
|
45661
|
-
});
|
|
46017
|
+
this.postProgressMessage(getUploadProgress(offset), 'transferData');
|
|
45662
46018
|
}
|
|
45663
46019
|
return totalSize !== undefined ? (processedSize !== null && processedSize !== void 0 ? processedSize : 0) + payload.byteLength : 0;
|
|
45664
46020
|
});
|
|
@@ -45922,7 +46278,7 @@ class DeviceGetOnboardingStatus extends BaseMethod {
|
|
|
45922
46278
|
}
|
|
45923
46279
|
run() {
|
|
45924
46280
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45925
|
-
const res = yield this.device.commands.typedCall('
|
|
46281
|
+
const res = yield this.device.commands.typedCall('GetOnboardingStatus', 'OnboardingStatus', {});
|
|
45926
46282
|
return Promise.resolve(res.message);
|
|
45927
46283
|
});
|
|
45928
46284
|
}
|
|
@@ -46718,6 +47074,15 @@ class AllNetworkGetAddressBase extends BaseMethod {
|
|
|
46718
47074
|
this.device.on(DEVICE.PIN, onSignalAbort);
|
|
46719
47075
|
this.device.on(DEVICE.PASSPHRASE, onSignalAbort);
|
|
46720
47076
|
preCheckDeviceSupport(this.device, method);
|
|
47077
|
+
if (this.temporarySafetyCheckPrompted) {
|
|
47078
|
+
method.temporarySafetyCheckPrompted = true;
|
|
47079
|
+
}
|
|
47080
|
+
else {
|
|
47081
|
+
const appliedTemporarySafetyCheck = yield method.checkSafetyLevelOnTestNet();
|
|
47082
|
+
if (appliedTemporarySafetyCheck) {
|
|
47083
|
+
this.temporarySafetyCheckPrompted = true;
|
|
47084
|
+
}
|
|
47085
|
+
}
|
|
46721
47086
|
const response = yield method.run();
|
|
46722
47087
|
if (!Array.isArray(response) || response.length === 0) {
|
|
46723
47088
|
throw new Error('No response');
|
|
@@ -47608,6 +47973,7 @@ class BTCSignMessage extends BaseMethod {
|
|
|
47608
47973
|
init() {
|
|
47609
47974
|
this.checkDeviceId = true;
|
|
47610
47975
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
47976
|
+
this.allowUsePreInitialize = true;
|
|
47611
47977
|
validateParams(this.payload, [
|
|
47612
47978
|
{ name: 'path', required: true },
|
|
47613
47979
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -47664,6 +48030,7 @@ class BTCSignPsbt extends BaseMethod {
|
|
|
47664
48030
|
init() {
|
|
47665
48031
|
this.checkDeviceId = true;
|
|
47666
48032
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
48033
|
+
this.allowUsePreInitialize = true;
|
|
47667
48034
|
validateParams(this.payload, [
|
|
47668
48035
|
{ name: 'psbt', type: 'hexString', required: true },
|
|
47669
48036
|
{ name: 'coin', type: 'string' },
|
|
@@ -47982,6 +48349,7 @@ class BTCSignTransaction extends BaseMethod {
|
|
|
47982
48349
|
init() {
|
|
47983
48350
|
this.checkDeviceId = true;
|
|
47984
48351
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
48352
|
+
this.allowUsePreInitialize = true;
|
|
47985
48353
|
validateParams(this.payload, [
|
|
47986
48354
|
{ name: 'coin', type: 'string', required: true },
|
|
47987
48355
|
{ name: 'inputs', type: 'array', required: true },
|
|
@@ -48162,6 +48530,7 @@ class ConfluxGetAddress extends BaseMethod {
|
|
|
48162
48530
|
class ConfluxSignMessage extends BaseMethod {
|
|
48163
48531
|
init() {
|
|
48164
48532
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
48533
|
+
this.allowUsePreInitialize = true;
|
|
48165
48534
|
validateParams(this.payload, [
|
|
48166
48535
|
{ name: 'path', required: true },
|
|
48167
48536
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -48191,6 +48560,7 @@ class ConfluxSignMessage extends BaseMethod {
|
|
|
48191
48560
|
class ConfluxSignMessageCIP23 extends BaseMethod {
|
|
48192
48561
|
init() {
|
|
48193
48562
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
48563
|
+
this.allowUsePreInitialize = true;
|
|
48194
48564
|
validateParams(this.payload, [
|
|
48195
48565
|
{ name: 'path', required: true },
|
|
48196
48566
|
{ name: 'domainHash', type: 'hexString', required: true },
|
|
@@ -48276,6 +48646,7 @@ class ConfluxSignTransaction extends BaseMethod {
|
|
|
48276
48646
|
}
|
|
48277
48647
|
init() {
|
|
48278
48648
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
48649
|
+
this.allowUsePreInitialize = true;
|
|
48279
48650
|
validateParams(this.payload, [
|
|
48280
48651
|
{ name: 'path', required: true },
|
|
48281
48652
|
{ name: 'transaction', type: 'object', required: true },
|
|
@@ -48519,10 +48890,12 @@ class EVMSignMessage$2 extends BaseMethod {
|
|
|
48519
48890
|
init() {
|
|
48520
48891
|
this.checkDeviceId = true;
|
|
48521
48892
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
48893
|
+
this.allowUsePreInitialize = true;
|
|
48522
48894
|
validateParams(this.payload, [
|
|
48523
48895
|
{ name: 'path', required: true },
|
|
48524
48896
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
48525
48897
|
{ name: 'chainId', type: 'number' },
|
|
48898
|
+
{ name: 'usePreInitialize', type: 'boolean' },
|
|
48526
48899
|
]);
|
|
48527
48900
|
const { path, messageHex, chainId } = this.payload;
|
|
48528
48901
|
const addressN = validatePath(path, 3);
|
|
@@ -48552,6 +48925,7 @@ class EVMSignMessageEIP712 extends BaseMethod {
|
|
|
48552
48925
|
init() {
|
|
48553
48926
|
this.checkDeviceId = true;
|
|
48554
48927
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
48928
|
+
this.allowUsePreInitialize = true;
|
|
48555
48929
|
validateParams(this.payload, [
|
|
48556
48930
|
{ name: 'path', required: true },
|
|
48557
48931
|
{ name: 'domainHash', type: 'hexString', required: true },
|
|
@@ -48792,9 +49166,11 @@ class EVMSignTransaction extends BaseMethod {
|
|
|
48792
49166
|
init() {
|
|
48793
49167
|
this.checkDeviceId = true;
|
|
48794
49168
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
49169
|
+
this.allowUsePreInitialize = true;
|
|
48795
49170
|
validateParams(this.payload, [
|
|
48796
49171
|
{ name: 'path', required: true },
|
|
48797
49172
|
{ name: 'transaction', type: 'object', required: true },
|
|
49173
|
+
{ name: 'usePreInitialize', type: 'boolean' },
|
|
48798
49174
|
]);
|
|
48799
49175
|
const { path, transaction } = this.payload;
|
|
48800
49176
|
this.addressN = validatePath(path, 3);
|
|
@@ -49061,6 +49437,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
49061
49437
|
init() {
|
|
49062
49438
|
this.checkDeviceId = true;
|
|
49063
49439
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
49440
|
+
this.allowUsePreInitialize = true;
|
|
49064
49441
|
validateParams(this.payload, [
|
|
49065
49442
|
{ name: 'path', required: true },
|
|
49066
49443
|
{ name: 'metamaskV4Compat', type: 'boolean' },
|
|
@@ -49068,6 +49445,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
49068
49445
|
{ name: 'domainHash', type: 'hexString' },
|
|
49069
49446
|
{ name: 'messageHash', type: 'hexString' },
|
|
49070
49447
|
{ name: 'chainId', type: 'number' },
|
|
49448
|
+
{ name: 'usePreInitialize', type: 'boolean' },
|
|
49071
49449
|
]);
|
|
49072
49450
|
const { path, data, metamaskV4Compat, domainHash, messageHash, chainId } = this.payload;
|
|
49073
49451
|
const addressN = validatePath(path, 3);
|
|
@@ -49614,6 +49992,7 @@ class StarcoinSignMessage extends BaseMethod {
|
|
|
49614
49992
|
init() {
|
|
49615
49993
|
this.checkDeviceId = true;
|
|
49616
49994
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
49995
|
+
this.allowUsePreInitialize = true;
|
|
49617
49996
|
validateParams(this.payload, [
|
|
49618
49997
|
{ name: 'path', required: true },
|
|
49619
49998
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -49637,6 +50016,7 @@ class StarcoinSignTransaction extends BaseMethod {
|
|
|
49637
50016
|
init() {
|
|
49638
50017
|
this.checkDeviceId = true;
|
|
49639
50018
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
50019
|
+
this.allowUsePreInitialize = true;
|
|
49640
50020
|
validateParams(this.payload, [
|
|
49641
50021
|
{ name: 'path', required: true },
|
|
49642
50022
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -49905,6 +50285,7 @@ class NEMSignTransaction extends BaseMethod {
|
|
|
49905
50285
|
init() {
|
|
49906
50286
|
this.checkDeviceId = true;
|
|
49907
50287
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
50288
|
+
this.allowUsePreInitialize = true;
|
|
49908
50289
|
validateParams(this.payload, [
|
|
49909
50290
|
{ name: 'path', required: true },
|
|
49910
50291
|
{ name: 'transaction', type: 'object', required: true },
|
|
@@ -49982,6 +50363,7 @@ class SolSignTransaction extends BaseMethod {
|
|
|
49982
50363
|
var _a;
|
|
49983
50364
|
this.checkDeviceId = true;
|
|
49984
50365
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
50366
|
+
this.allowUsePreInitialize = true;
|
|
49985
50367
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
49986
50368
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
49987
50369
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
@@ -50067,6 +50449,7 @@ class SolSignOffchainMessage extends BaseMethod {
|
|
|
50067
50449
|
init() {
|
|
50068
50450
|
this.checkDeviceId = true;
|
|
50069
50451
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
50452
|
+
this.allowUsePreInitialize = true;
|
|
50070
50453
|
validateParams(this.payload, [
|
|
50071
50454
|
{ name: 'path', required: true },
|
|
50072
50455
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -50113,6 +50496,7 @@ class SolSignMessage extends BaseMethod {
|
|
|
50113
50496
|
init() {
|
|
50114
50497
|
this.checkDeviceId = true;
|
|
50115
50498
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
50499
|
+
this.allowUsePreInitialize = true;
|
|
50116
50500
|
validateParams(this.payload, [
|
|
50117
50501
|
{ name: 'path', required: true },
|
|
50118
50502
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -50434,6 +50818,7 @@ class StellarSignTransaction extends BaseMethod {
|
|
|
50434
50818
|
init() {
|
|
50435
50819
|
this.checkDeviceId = true;
|
|
50436
50820
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
50821
|
+
this.allowUsePreInitialize = true;
|
|
50437
50822
|
validateParams(this.payload, [
|
|
50438
50823
|
{ name: 'path', required: true },
|
|
50439
50824
|
{ name: 'networkPassphrase', type: 'string', required: true },
|
|
@@ -50544,6 +50929,7 @@ class TronSignMessage extends BaseMethod {
|
|
|
50544
50929
|
var _a;
|
|
50545
50930
|
this.checkDeviceId = true;
|
|
50546
50931
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
50932
|
+
this.allowUsePreInitialize = true;
|
|
50547
50933
|
validateParams(this.payload, [
|
|
50548
50934
|
{ name: 'path', required: true },
|
|
50549
50935
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -50702,6 +51088,7 @@ class TronSignTransaction extends BaseMethod {
|
|
|
50702
51088
|
init() {
|
|
50703
51089
|
this.checkDeviceId = true;
|
|
50704
51090
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
51091
|
+
this.allowUsePreInitialize = true;
|
|
50705
51092
|
validateParams(this.payload, [
|
|
50706
51093
|
{ name: 'path', required: true },
|
|
50707
51094
|
{ name: 'transaction', type: 'object', required: true },
|
|
@@ -50835,6 +51222,7 @@ class NearSignTransaction extends BaseMethod {
|
|
|
50835
51222
|
init() {
|
|
50836
51223
|
this.checkDeviceId = true;
|
|
50837
51224
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
51225
|
+
this.allowUsePreInitialize = true;
|
|
50838
51226
|
validateParams(this.payload, [
|
|
50839
51227
|
{ name: 'path', required: true },
|
|
50840
51228
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -51011,6 +51399,7 @@ class AptosSignTransaction extends BaseMethod {
|
|
|
51011
51399
|
init() {
|
|
51012
51400
|
this.checkDeviceId = true;
|
|
51013
51401
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
51402
|
+
this.allowUsePreInitialize = true;
|
|
51014
51403
|
validateParams(this.payload, [
|
|
51015
51404
|
{ name: 'path', required: true },
|
|
51016
51405
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -51061,6 +51450,7 @@ class AptosSignMessage extends BaseMethod {
|
|
|
51061
51450
|
init() {
|
|
51062
51451
|
this.checkDeviceId = true;
|
|
51063
51452
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
51453
|
+
this.allowUsePreInitialize = true;
|
|
51064
51454
|
validateParams(this.payload, [
|
|
51065
51455
|
{ name: 'path', required: true },
|
|
51066
51456
|
{ name: 'payload', type: 'object', required: true },
|
|
@@ -51122,6 +51512,7 @@ class AptosSignInMessage extends BaseMethod {
|
|
|
51122
51512
|
init() {
|
|
51123
51513
|
this.checkDeviceId = true;
|
|
51124
51514
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
51515
|
+
this.allowUsePreInitialize = true;
|
|
51125
51516
|
validateParams(this.payload, [
|
|
51126
51517
|
{ name: 'path', required: true },
|
|
51127
51518
|
{ name: 'payload', type: 'string', required: true },
|
|
@@ -51217,6 +51608,7 @@ class AlgoSignTransaction extends BaseMethod {
|
|
|
51217
51608
|
init() {
|
|
51218
51609
|
this.checkDeviceId = true;
|
|
51219
51610
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
51611
|
+
this.allowUsePreInitialize = true;
|
|
51220
51612
|
validateParams(this.payload, [
|
|
51221
51613
|
{ name: 'path', required: true },
|
|
51222
51614
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -51379,6 +51771,7 @@ class CosmosSignTransaction extends BaseMethod {
|
|
|
51379
51771
|
init() {
|
|
51380
51772
|
this.checkDeviceId = true;
|
|
51381
51773
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
51774
|
+
this.allowUsePreInitialize = true;
|
|
51382
51775
|
validateParams(this.payload, [
|
|
51383
51776
|
{ name: 'path', required: true },
|
|
51384
51777
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -51500,6 +51893,7 @@ class XrpGetAddress extends BaseMethod {
|
|
|
51500
51893
|
init() {
|
|
51501
51894
|
this.checkDeviceId = true;
|
|
51502
51895
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
51896
|
+
this.allowUsePreInitialize = true;
|
|
51503
51897
|
const { payload } = this;
|
|
51504
51898
|
validateParams(payload, [
|
|
51505
51899
|
{ name: 'path', required: true },
|
|
@@ -51603,6 +51997,9 @@ class SuiGetAddress extends BaseMethod {
|
|
|
51603
51997
|
}
|
|
51604
51998
|
getVersionRange() {
|
|
51605
51999
|
return {
|
|
52000
|
+
pro2: {
|
|
52001
|
+
min: '0.0.0',
|
|
52002
|
+
},
|
|
51606
52003
|
model_mini: {
|
|
51607
52004
|
min: '3.0.0',
|
|
51608
52005
|
},
|
|
@@ -51692,6 +52089,9 @@ class SuiGetPublicKey extends BaseMethod {
|
|
|
51692
52089
|
}
|
|
51693
52090
|
getVersionRange() {
|
|
51694
52091
|
return {
|
|
52092
|
+
pro2: {
|
|
52093
|
+
min: '0.0.0',
|
|
52094
|
+
},
|
|
51695
52095
|
model_mini: {
|
|
51696
52096
|
min: '3.0.0',
|
|
51697
52097
|
},
|
|
@@ -51720,6 +52120,7 @@ class SuiSignMessage extends BaseMethod {
|
|
|
51720
52120
|
init() {
|
|
51721
52121
|
this.checkDeviceId = true;
|
|
51722
52122
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
52123
|
+
this.allowUsePreInitialize = true;
|
|
51723
52124
|
validateParams(this.payload, [
|
|
51724
52125
|
{ name: 'path', required: true },
|
|
51725
52126
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -51733,6 +52134,9 @@ class SuiSignMessage extends BaseMethod {
|
|
|
51733
52134
|
}
|
|
51734
52135
|
getVersionRange() {
|
|
51735
52136
|
return {
|
|
52137
|
+
pro2: {
|
|
52138
|
+
min: '0.0.0',
|
|
52139
|
+
},
|
|
51736
52140
|
model_mini: {
|
|
51737
52141
|
min: '3.4.0',
|
|
51738
52142
|
},
|
|
@@ -51773,6 +52177,7 @@ class SuiSignTransaction extends BaseMethod {
|
|
|
51773
52177
|
init() {
|
|
51774
52178
|
this.checkDeviceId = true;
|
|
51775
52179
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
52180
|
+
this.allowUsePreInitialize = true;
|
|
51776
52181
|
validateParams(this.payload, [
|
|
51777
52182
|
{ name: 'path', required: true },
|
|
51778
52183
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -51786,6 +52191,9 @@ class SuiSignTransaction extends BaseMethod {
|
|
|
51786
52191
|
}
|
|
51787
52192
|
getVersionRange() {
|
|
51788
52193
|
return {
|
|
52194
|
+
pro2: {
|
|
52195
|
+
min: '0.0.0',
|
|
52196
|
+
},
|
|
51789
52197
|
model_mini: {
|
|
51790
52198
|
min: '3.0.0',
|
|
51791
52199
|
},
|
|
@@ -52576,6 +52984,7 @@ class CardanoSignTransaction extends BaseMethod {
|
|
|
52576
52984
|
var _a;
|
|
52577
52985
|
this.checkDeviceId = true;
|
|
52578
52986
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
52987
|
+
this.allowUsePreInitialize = true;
|
|
52579
52988
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
52580
52989
|
const { payload } = this;
|
|
52581
52990
|
if (payload.auxiliaryData && payload.auxiliaryData.governanceRegistrationParameters) {
|
|
@@ -52811,6 +53220,7 @@ class CardanoSignMessage extends BaseMethod {
|
|
|
52811
53220
|
init() {
|
|
52812
53221
|
this.checkDeviceId = true;
|
|
52813
53222
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
53223
|
+
this.allowUsePreInitialize = true;
|
|
52814
53224
|
const { payload } = this;
|
|
52815
53225
|
validateParams(payload, [
|
|
52816
53226
|
{ name: 'path', type: 'string', required: true },
|
|
@@ -52924,6 +53334,7 @@ class FilecoinSignTransaction extends BaseMethod {
|
|
|
52924
53334
|
init() {
|
|
52925
53335
|
this.checkDeviceId = true;
|
|
52926
53336
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
53337
|
+
this.allowUsePreInitialize = true;
|
|
52927
53338
|
validateParams(this.payload, [
|
|
52928
53339
|
{ name: 'path', required: true },
|
|
52929
53340
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -53094,6 +53505,7 @@ class PolkadotSignTransaction extends BaseMethod {
|
|
|
53094
53505
|
init() {
|
|
53095
53506
|
this.checkDeviceId = true;
|
|
53096
53507
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
53508
|
+
this.allowUsePreInitialize = true;
|
|
53097
53509
|
validateParams(this.payload, [
|
|
53098
53510
|
{ name: 'path', required: true },
|
|
53099
53511
|
{ name: 'network', required: true },
|
|
@@ -53516,6 +53928,7 @@ class KaspaSignTransaction extends BaseMethod {
|
|
|
53516
53928
|
var _a, _b, _c, _d, _e;
|
|
53517
53929
|
this.checkDeviceId = true;
|
|
53518
53930
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
53931
|
+
this.allowUsePreInitialize = true;
|
|
53519
53932
|
const payload = this.payload;
|
|
53520
53933
|
validateParams(payload, [
|
|
53521
53934
|
{ name: 'version', type: 'number' },
|
|
@@ -53692,6 +54105,7 @@ class NexaSignTransaction extends BaseMethod {
|
|
|
53692
54105
|
this.hasBundle = false;
|
|
53693
54106
|
}
|
|
53694
54107
|
init() {
|
|
54108
|
+
this.allowUsePreInitialize = true;
|
|
53695
54109
|
const payload = this.payload;
|
|
53696
54110
|
payload.inputs.forEach(input => {
|
|
53697
54111
|
validateParams(input, [
|
|
@@ -53847,6 +54261,7 @@ class NostrSignEvent extends BaseMethod {
|
|
|
53847
54261
|
init() {
|
|
53848
54262
|
this.checkDeviceId = true;
|
|
53849
54263
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
54264
|
+
this.allowUsePreInitialize = true;
|
|
53850
54265
|
const { payload } = this;
|
|
53851
54266
|
if (!validateEvent(payload.event)) {
|
|
53852
54267
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Can't serialize event with wrong or missing properties`);
|
|
@@ -53989,6 +54404,7 @@ class NostrSignSchnorr extends BaseMethod {
|
|
|
53989
54404
|
init() {
|
|
53990
54405
|
this.checkDeviceId = true;
|
|
53991
54406
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
54407
|
+
this.allowUsePreInitialize = true;
|
|
53992
54408
|
const { payload } = this;
|
|
53993
54409
|
validateParams(payload, [
|
|
53994
54410
|
{ name: 'path', required: true },
|
|
@@ -54156,6 +54572,7 @@ class NervosSignTransaction extends BaseMethod {
|
|
|
54156
54572
|
init() {
|
|
54157
54573
|
this.checkDeviceId = true;
|
|
54158
54574
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
54575
|
+
this.allowUsePreInitialize = true;
|
|
54159
54576
|
validateParams(this.payload, [
|
|
54160
54577
|
{ name: 'path', required: true },
|
|
54161
54578
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -54271,6 +54688,7 @@ class DnxSignTransaction extends BaseMethod {
|
|
|
54271
54688
|
init() {
|
|
54272
54689
|
this.checkDeviceId = true;
|
|
54273
54690
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
54691
|
+
this.allowUsePreInitialize = true;
|
|
54274
54692
|
const { payload } = this;
|
|
54275
54693
|
const addressN = validatePath(payload.path, 3);
|
|
54276
54694
|
validateParams(payload, [
|
|
@@ -54402,6 +54820,9 @@ class TonGetAddress extends BaseMethod {
|
|
|
54402
54820
|
}
|
|
54403
54821
|
getVersionRange() {
|
|
54404
54822
|
return {
|
|
54823
|
+
pro2: {
|
|
54824
|
+
min: '0.0.0',
|
|
54825
|
+
},
|
|
54405
54826
|
model_touch: {
|
|
54406
54827
|
min: '4.10.0',
|
|
54407
54828
|
},
|
|
@@ -54456,6 +54877,7 @@ class TonSignMessage extends BaseMethod {
|
|
|
54456
54877
|
this.strictCheckDeviceSupport = true;
|
|
54457
54878
|
this.checkDeviceId = true;
|
|
54458
54879
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
54880
|
+
this.allowUsePreInitialize = true;
|
|
54459
54881
|
validateParams(this.payload, [
|
|
54460
54882
|
{ name: 'path', required: true },
|
|
54461
54883
|
{ name: 'destination', type: 'string' },
|
|
@@ -54510,6 +54932,9 @@ class TonSignMessage extends BaseMethod {
|
|
|
54510
54932
|
}
|
|
54511
54933
|
getVersionRange() {
|
|
54512
54934
|
return {
|
|
54935
|
+
pro2: {
|
|
54936
|
+
min: '0.0.0',
|
|
54937
|
+
},
|
|
54513
54938
|
model_touch: {
|
|
54514
54939
|
min: '4.10.0',
|
|
54515
54940
|
},
|
|
@@ -54600,6 +55025,7 @@ class TonSignProof extends BaseMethod {
|
|
|
54600
55025
|
this.strictCheckDeviceSupport = true;
|
|
54601
55026
|
this.checkDeviceId = true;
|
|
54602
55027
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
55028
|
+
this.allowUsePreInitialize = true;
|
|
54603
55029
|
validateParams(this.payload, [
|
|
54604
55030
|
{ name: 'path', required: true },
|
|
54605
55031
|
{ name: 'appdomain', type: 'string' },
|
|
@@ -54627,6 +55053,9 @@ class TonSignProof extends BaseMethod {
|
|
|
54627
55053
|
}
|
|
54628
55054
|
getVersionRange() {
|
|
54629
55055
|
return {
|
|
55056
|
+
pro2: {
|
|
55057
|
+
min: '0.0.0',
|
|
55058
|
+
},
|
|
54630
55059
|
model_touch: {
|
|
54631
55060
|
min: '4.10.0',
|
|
54632
55061
|
},
|
|
@@ -54648,6 +55077,7 @@ class TonSignData extends BaseMethod {
|
|
|
54648
55077
|
this.strictCheckDeviceSupport = false;
|
|
54649
55078
|
this.checkDeviceId = true;
|
|
54650
55079
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
55080
|
+
this.allowUsePreInitialize = true;
|
|
54651
55081
|
validateParams(this.payload, [
|
|
54652
55082
|
{ name: 'path', required: true },
|
|
54653
55083
|
{ name: 'type', type: 'number', required: true },
|
|
@@ -54679,6 +55109,13 @@ class TonSignData extends BaseMethod {
|
|
|
54679
55109
|
is_testnet_only: this.payload.isTestnetOnly,
|
|
54680
55110
|
};
|
|
54681
55111
|
}
|
|
55112
|
+
getVersionRange() {
|
|
55113
|
+
return {
|
|
55114
|
+
pro2: {
|
|
55115
|
+
min: '0.0.0',
|
|
55116
|
+
},
|
|
55117
|
+
};
|
|
55118
|
+
}
|
|
54682
55119
|
run() {
|
|
54683
55120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54684
55121
|
const res = yield this.device.commands.typedCall('TonSignData', 'TonSignedData', Object.assign({}, this.params));
|
|
@@ -54768,6 +55205,7 @@ class ScdoSignTransaction extends BaseMethod {
|
|
|
54768
55205
|
init() {
|
|
54769
55206
|
this.checkDeviceId = true;
|
|
54770
55207
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
55208
|
+
this.allowUsePreInitialize = true;
|
|
54771
55209
|
validateParams(this.payload, [
|
|
54772
55210
|
{ name: 'path', required: true },
|
|
54773
55211
|
{ name: 'nonce', required: true },
|
|
@@ -54825,6 +55263,7 @@ class ScdoSignMessage extends BaseMethod {
|
|
|
54825
55263
|
init() {
|
|
54826
55264
|
this.checkDeviceId = true;
|
|
54827
55265
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
55266
|
+
this.allowUsePreInitialize = true;
|
|
54828
55267
|
validateParams(this.payload, [
|
|
54829
55268
|
{ name: 'path', required: true },
|
|
54830
55269
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -54955,6 +55394,7 @@ class AlephiumSignTransaction extends BaseMethod {
|
|
|
54955
55394
|
init() {
|
|
54956
55395
|
this.checkDeviceId = true;
|
|
54957
55396
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
55397
|
+
this.allowUsePreInitialize = true;
|
|
54958
55398
|
validateParams(this.payload, [
|
|
54959
55399
|
{ name: 'path', required: true },
|
|
54960
55400
|
{ name: 'rawTx', required: true, type: 'hexString' },
|
|
@@ -55000,6 +55440,7 @@ class AlephiumSignMessage extends BaseMethod {
|
|
|
55000
55440
|
init() {
|
|
55001
55441
|
this.checkDeviceId = true;
|
|
55002
55442
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
55443
|
+
this.allowUsePreInitialize = true;
|
|
55003
55444
|
validateParams(this.payload, [
|
|
55004
55445
|
{ name: 'path', required: true },
|
|
55005
55446
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -55217,6 +55658,7 @@ class BenfenSignMessage extends BaseMethod {
|
|
|
55217
55658
|
init() {
|
|
55218
55659
|
this.checkDeviceId = true;
|
|
55219
55660
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
55661
|
+
this.allowUsePreInitialize = true;
|
|
55220
55662
|
validateParams(this.payload, [
|
|
55221
55663
|
{ name: 'path', required: true },
|
|
55222
55664
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
@@ -55274,6 +55716,7 @@ class BenfenSignTransaction extends BaseMethod {
|
|
|
55274
55716
|
init() {
|
|
55275
55717
|
this.checkDeviceId = true;
|
|
55276
55718
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
55719
|
+
this.allowUsePreInitialize = true;
|
|
55277
55720
|
validateParams(this.payload, [
|
|
55278
55721
|
{ name: 'path', required: true },
|
|
55279
55722
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
@@ -55389,6 +55832,7 @@ class NeoSignTransaction extends BaseMethod {
|
|
|
55389
55832
|
init() {
|
|
55390
55833
|
this.checkDeviceId = true;
|
|
55391
55834
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
55835
|
+
this.allowUsePreInitialize = true;
|
|
55392
55836
|
this.strictCheckDeviceSupport = true;
|
|
55393
55837
|
validateParams(this.payload, [
|
|
55394
55838
|
{ name: 'path', required: true },
|
|
@@ -55437,6 +55881,7 @@ class NeoSignTransaction extends BaseMethod {
|
|
|
55437
55881
|
var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
55438
55882
|
__proto__: null,
|
|
55439
55883
|
testInitializeDeviceDuration: TestInitializeDeviceDuration,
|
|
55884
|
+
preInitialize: PreInitialize,
|
|
55440
55885
|
searchDevices: SearchDevices,
|
|
55441
55886
|
getFeatures: GetFeatures,
|
|
55442
55887
|
getDeviceInfo: GetDeviceInfo,
|
|
@@ -55825,13 +56270,15 @@ class RequestQueue {
|
|
|
55825
56270
|
this.pendingCallbackTasks.set(connectId, callbackPromise);
|
|
55826
56271
|
callbackPromise.promise.finally(() => {
|
|
55827
56272
|
Log$1.debug(`Callback task completed for connectId: ${connectId}`);
|
|
55828
|
-
this.pendingCallbackTasks.
|
|
56273
|
+
if (this.pendingCallbackTasks.get(connectId) === callbackPromise) {
|
|
56274
|
+
this.pendingCallbackTasks.delete(connectId);
|
|
56275
|
+
}
|
|
55829
56276
|
});
|
|
55830
56277
|
}
|
|
55831
|
-
waitForPendingCallbackTasks(connectId) {
|
|
56278
|
+
waitForPendingCallbackTasks(connectId, exceptTask) {
|
|
55832
56279
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55833
56280
|
const pendingTask = this.pendingCallbackTasks.get(connectId);
|
|
55834
|
-
if (pendingTask) {
|
|
56281
|
+
if (pendingTask && pendingTask !== exceptTask) {
|
|
55835
56282
|
Log$1.debug(`Waiting for pending callback task to complete for connectId: ${connectId}`);
|
|
55836
56283
|
yield pendingTask.promise;
|
|
55837
56284
|
}
|
|
@@ -55868,6 +56315,9 @@ const getSynchronize = (mutex) => {
|
|
|
55868
56315
|
};
|
|
55869
56316
|
|
|
55870
56317
|
const Log = getLogger(exports.LoggerNames.Core);
|
|
56318
|
+
const PRE_INITIALIZE_TTL_MS = 60 * 1000;
|
|
56319
|
+
const preWarmInflight = new Map();
|
|
56320
|
+
const preWarmDoneAt = new Map();
|
|
55871
56321
|
function hasDeriveCardano(method) {
|
|
55872
56322
|
var _a;
|
|
55873
56323
|
if (method.name.startsWith('allNetworkGetAddress') &&
|
|
@@ -55890,8 +56340,7 @@ let _deviceList;
|
|
|
55890
56340
|
let _connector;
|
|
55891
56341
|
let _uiPromises = [];
|
|
55892
56342
|
const deviceCacheMap = new Map();
|
|
55893
|
-
|
|
55894
|
-
const pollingState = {};
|
|
56343
|
+
const pollingManager = new PollingStateManager();
|
|
55895
56344
|
let preConnectCache = {
|
|
55896
56345
|
passphraseState: undefined,
|
|
55897
56346
|
};
|
|
@@ -55968,8 +56417,44 @@ const callAPI = (context, message) => __awaiter(void 0, void 0, void 0, function
|
|
|
55968
56417
|
if (error) {
|
|
55969
56418
|
return createResponseMessage(method.responseID, false, { error });
|
|
55970
56419
|
}
|
|
56420
|
+
if (method.isPreWarmSignal) {
|
|
56421
|
+
return handlePreWarmSignal(context, message, method);
|
|
56422
|
+
}
|
|
55971
56423
|
return onCallDevice(context, message, method);
|
|
55972
56424
|
});
|
|
56425
|
+
const handlePreWarmSignal = (context, message, method) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56426
|
+
if (!method.connectId) {
|
|
56427
|
+
return createResponseMessage(method.responseID, true, true);
|
|
56428
|
+
}
|
|
56429
|
+
const key = method.getPreWarmKey();
|
|
56430
|
+
const inflight = preWarmInflight.get(key);
|
|
56431
|
+
if (inflight) {
|
|
56432
|
+
try {
|
|
56433
|
+
yield inflight;
|
|
56434
|
+
}
|
|
56435
|
+
catch (_b) {
|
|
56436
|
+
}
|
|
56437
|
+
return createResponseMessage(method.responseID, true, true);
|
|
56438
|
+
}
|
|
56439
|
+
const doneAt = preWarmDoneAt.get(key);
|
|
56440
|
+
if (typeof doneAt === 'number' && Date.now() - doneAt <= method.preWarmTtl) {
|
|
56441
|
+
return createResponseMessage(method.responseID, true, true);
|
|
56442
|
+
}
|
|
56443
|
+
const run = onCallDevice(context, message, method);
|
|
56444
|
+
preWarmInflight.set(key, run);
|
|
56445
|
+
try {
|
|
56446
|
+
const result = yield run;
|
|
56447
|
+
if ((result === null || result === void 0 ? void 0 : result.success) === true && (result === null || result === void 0 ? void 0 : result.payload) === true) {
|
|
56448
|
+
preWarmDoneAt.set(key, Date.now());
|
|
56449
|
+
}
|
|
56450
|
+
return result;
|
|
56451
|
+
}
|
|
56452
|
+
finally {
|
|
56453
|
+
if (preWarmInflight.get(key) === run) {
|
|
56454
|
+
preWarmInflight.delete(key);
|
|
56455
|
+
}
|
|
56456
|
+
}
|
|
56457
|
+
});
|
|
55973
56458
|
const waitWithTimeout = (promise, timeout) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55974
56459
|
const timeoutPromise = new Promise((_, reject) => {
|
|
55975
56460
|
setTimeout(() => reject(new Error('Request timeout')), timeout);
|
|
@@ -55990,11 +56475,13 @@ const waitForPendingPromise = (getPrePendingCallPromise, removePrePendingCallPro
|
|
|
55990
56475
|
}
|
|
55991
56476
|
});
|
|
55992
56477
|
const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55993
|
-
var
|
|
56478
|
+
var _c, _d, _e, _f, _g;
|
|
55994
56479
|
let messageResponse;
|
|
55995
56480
|
const { requestQueue, getPrePendingCallPromise, setPrePendingCallPromise } = context;
|
|
55996
56481
|
updateMethodRequestContext(method, { status: 'running' });
|
|
55997
|
-
const
|
|
56482
|
+
const normalizePassphraseState = (s) => s || '';
|
|
56483
|
+
const connectStateChange = normalizePassphraseState(preConnectCache.passphraseState) !==
|
|
56484
|
+
normalizePassphraseState(method.payload.passphraseState);
|
|
55998
56485
|
preConnectCache = {
|
|
55999
56486
|
passphraseState: method.payload.passphraseState,
|
|
56000
56487
|
};
|
|
@@ -56007,15 +56494,19 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
56007
56494
|
}
|
|
56008
56495
|
yield waitForPendingPromise(getPrePendingCallPromise, setPrePendingCallPromise);
|
|
56009
56496
|
const task = requestQueue.createTask(method);
|
|
56497
|
+
let preWarmCallbackTask;
|
|
56498
|
+
if (method.isPreWarmSignal && method.connectId) {
|
|
56499
|
+
preWarmCallbackTask = hdShared.createDeferred();
|
|
56500
|
+
context.registerCallbackTask(method.connectId, preWarmCallbackTask);
|
|
56501
|
+
}
|
|
56010
56502
|
let device;
|
|
56011
56503
|
try {
|
|
56012
|
-
|
|
56013
|
-
|
|
56014
|
-
|
|
56015
|
-
pollingId += 1;
|
|
56016
|
-
device = yield ensureConnected(context, method, pollingId, (_b = task.abortController) === null || _b === void 0 ? void 0 : _b.signal);
|
|
56504
|
+
const connectId = (_c = method.connectId) !== null && _c !== void 0 ? _c : '';
|
|
56505
|
+
const pollingId = pollingManager.start(connectId);
|
|
56506
|
+
device = yield ensureConnected(context, method, connectId, pollingId, (_d = task.abortController) === null || _d === void 0 ? void 0 : _d.signal);
|
|
56017
56507
|
}
|
|
56018
56508
|
catch (e) {
|
|
56509
|
+
preWarmCallbackTask === null || preWarmCallbackTask === void 0 ? void 0 : preWarmCallbackTask.resolve();
|
|
56019
56510
|
console.log('ensureConnected error: ', e);
|
|
56020
56511
|
completeMethodRequestContext(method, e);
|
|
56021
56512
|
if (e.name === 'AbortError' || e.message === 'Request aborted') {
|
|
@@ -56027,16 +56518,17 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
56027
56518
|
requestQueue.releaseTask(method.responseID);
|
|
56028
56519
|
return createResponseMessage(method.responseID, false, { error: e });
|
|
56029
56520
|
}
|
|
56030
|
-
if ((
|
|
56521
|
+
if ((_e = method.payload) === null || _e === void 0 ? void 0 : _e.onlyConnectBleDevice) {
|
|
56522
|
+
preWarmCallbackTask === null || preWarmCallbackTask === void 0 ? void 0 : preWarmCallbackTask.resolve();
|
|
56031
56523
|
Log.debug('Call API - only connect ble device: ', device === null || device === void 0 ? void 0 : device.mainId);
|
|
56032
56524
|
return createResponseMessage(method.responseID, true, null);
|
|
56033
56525
|
}
|
|
56034
56526
|
Log.debug('Call API - setDevice: ', device.mainId);
|
|
56035
|
-
(
|
|
56527
|
+
(_f = method.setDevice) === null || _f === void 0 ? void 0 : _f.call(method, device);
|
|
56036
56528
|
method.context = context;
|
|
56037
56529
|
updateMethodRequestContext(method, {
|
|
56038
56530
|
deviceInstanceId: device.instanceId,
|
|
56039
|
-
commandsInstanceId: (
|
|
56531
|
+
commandsInstanceId: (_g = device.commands) === null || _g === void 0 ? void 0 : _g.instanceId,
|
|
56040
56532
|
});
|
|
56041
56533
|
const activeRequests = getActiveRequestsByDeviceInstance(device.instanceId);
|
|
56042
56534
|
if (activeRequests.length > 0) {
|
|
@@ -56051,11 +56543,11 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
56051
56543
|
device.on(DEVICE.SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE, onSelectDeviceForSwitchFirmwareWebDeviceHandler);
|
|
56052
56544
|
try {
|
|
56053
56545
|
if (method.connectId) {
|
|
56054
|
-
yield context.waitForCallbackTasks(method.connectId);
|
|
56546
|
+
yield context.waitForCallbackTasks(method.connectId, preWarmCallbackTask);
|
|
56055
56547
|
}
|
|
56056
56548
|
yield waitForPendingPromise(getPrePendingCallPromise, setPrePendingCallPromise);
|
|
56057
56549
|
const inner = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56058
|
-
var
|
|
56550
|
+
var _h, _j, _k, _l, _m;
|
|
56059
56551
|
const versionRange = getMethodVersionRange(device.features, type => method.getVersionRange()[type]);
|
|
56060
56552
|
if (device.features) {
|
|
56061
56553
|
yield DataManager.checkAndReloadData();
|
|
@@ -56145,7 +56637,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
56145
56637
|
require: support.require,
|
|
56146
56638
|
}));
|
|
56147
56639
|
}
|
|
56148
|
-
const passphraseStateSafety = yield device.checkPassphraseStateSafety((
|
|
56640
|
+
const passphraseStateSafety = yield device.checkPassphraseStateSafety((_h = method.payload) === null || _h === void 0 ? void 0 : _h.passphraseState, (_j = method.payload) === null || _j === void 0 ? void 0 : _j.useEmptyPassphrase, (_k = method.payload) === null || _k === void 0 ? void 0 : _k.skipPassphraseCheck);
|
|
56149
56641
|
checkPassphraseEnableState(method, device.features);
|
|
56150
56642
|
if (!passphraseStateSafety) {
|
|
56151
56643
|
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
@@ -56162,10 +56654,9 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
56162
56654
|
: hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'open safety check failed.');
|
|
56163
56655
|
throw error;
|
|
56164
56656
|
}
|
|
56165
|
-
(
|
|
56657
|
+
(_m = (_l = method.device) === null || _l === void 0 ? void 0 : _l.commands) === null || _m === void 0 ? void 0 : _m.checkDisposed();
|
|
56166
56658
|
try {
|
|
56167
56659
|
const response = yield method.run();
|
|
56168
|
-
Log.debug('Call API - Inner Method Run: ');
|
|
56169
56660
|
messageResponse = createResponseMessage(method.responseID, true, response);
|
|
56170
56661
|
requestQueue.resolveRequest(method.responseID, messageResponse);
|
|
56171
56662
|
completeMethodRequestContext(method);
|
|
@@ -56182,7 +56673,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
56182
56673
|
}
|
|
56183
56674
|
});
|
|
56184
56675
|
Log.debug('Call API - Device Run: ', device.mainId);
|
|
56185
|
-
const runOptions = Object.assign({ keepSession: method.payload.keepSession }, parseInitOptions(method));
|
|
56676
|
+
const runOptions = Object.assign({ keepSession: method.payload.keepSession, skipInitialize: canSkipInitialize(method, device) }, parseInitOptions(method));
|
|
56186
56677
|
const deviceRun = () => device.run(inner, runOptions);
|
|
56187
56678
|
task.callPromise = hdShared.createDeferred(deviceRun);
|
|
56188
56679
|
try {
|
|
@@ -56201,6 +56692,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
56201
56692
|
completeMethodRequestContext(method, error);
|
|
56202
56693
|
}
|
|
56203
56694
|
finally {
|
|
56695
|
+
preWarmCallbackTask === null || preWarmCallbackTask === void 0 ? void 0 : preWarmCallbackTask.resolve();
|
|
56204
56696
|
const response = messageResponse;
|
|
56205
56697
|
if (response) {
|
|
56206
56698
|
if (method) {
|
|
@@ -56296,7 +56788,30 @@ function initDeviceForBle(method) {
|
|
|
56296
56788
|
device.deviceConnector = _connector;
|
|
56297
56789
|
return device;
|
|
56298
56790
|
}
|
|
56299
|
-
|
|
56791
|
+
function canSkipInitialize(method, device) {
|
|
56792
|
+
var _a;
|
|
56793
|
+
const reasons = [];
|
|
56794
|
+
if (!method.allowUsePreInitialize)
|
|
56795
|
+
reasons.push('method.disallow');
|
|
56796
|
+
if (!((_a = method.payload) === null || _a === void 0 ? void 0 : _a.usePreInitialize))
|
|
56797
|
+
reasons.push('payload.usePreInitialize=false');
|
|
56798
|
+
if (!method.connectId)
|
|
56799
|
+
reasons.push('connectId.missing');
|
|
56800
|
+
if (!device.isPreInitializeMetaMatch(method.payload))
|
|
56801
|
+
reasons.push('meta.mismatch');
|
|
56802
|
+
if (!device.features)
|
|
56803
|
+
reasons.push('features.missing');
|
|
56804
|
+
if (!device.isPreInitializedValid(PRE_INITIALIZE_TTL_MS))
|
|
56805
|
+
reasons.push('ttl.expired');
|
|
56806
|
+
if (reasons.length) {
|
|
56807
|
+
Log.debug(`[PRE-INIT][MISS] method=${method.name} ${reasons.join(',')}`);
|
|
56808
|
+
return false;
|
|
56809
|
+
}
|
|
56810
|
+
const savedMs = device.getLastInitializeDuration();
|
|
56811
|
+
const saved = typeof savedMs === 'number' ? `saved ${savedMs}ms` : 'within TTL + meta match';
|
|
56812
|
+
Log.debug(`[PRE-INIT][HIT] method=${method.name} skip Initialize (${saved})`);
|
|
56813
|
+
return true;
|
|
56814
|
+
}
|
|
56300
56815
|
function isRetryableBleProtocolV2ProbeError(method, error) {
|
|
56301
56816
|
const message = error instanceof Error ? error.message : String(error !== null && error !== void 0 ? error : '');
|
|
56302
56817
|
return (method.payload.connectProtocol === 'V2' &&
|
|
@@ -56304,7 +56819,7 @@ function isRetryableBleProtocolV2ProbeError(method, error) {
|
|
|
56304
56819
|
message.includes('expected V2') &&
|
|
56305
56820
|
message.includes('did not respond to expected protocol'));
|
|
56306
56821
|
}
|
|
56307
|
-
function connectDeviceForBle(method, device) {
|
|
56822
|
+
function connectDeviceForBle(method, device, retryCount = 0) {
|
|
56308
56823
|
var _a;
|
|
56309
56824
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56310
56825
|
try {
|
|
@@ -56312,17 +56827,23 @@ function connectDeviceForBle(method, device) {
|
|
|
56312
56827
|
if ((_a = method.payload) === null || _a === void 0 ? void 0 : _a.onlyConnectBleDevice) {
|
|
56313
56828
|
return;
|
|
56314
56829
|
}
|
|
56315
|
-
|
|
56830
|
+
if (!canSkipInitialize(method, device)) {
|
|
56831
|
+
const initOptions = parseInitOptions(method);
|
|
56832
|
+
yield device.initialize(initOptions);
|
|
56833
|
+
device.markPreInitialized({
|
|
56834
|
+
passphraseState: initOptions.passphraseState,
|
|
56835
|
+
});
|
|
56836
|
+
}
|
|
56316
56837
|
}
|
|
56317
56838
|
catch (err) {
|
|
56318
56839
|
if ((err.errorCode === hdShared.HardwareErrorCode.BleTimeoutError ||
|
|
56319
56840
|
err.errorCode === hdShared.HardwareErrorCode.BleConnectedError ||
|
|
56320
56841
|
isRetryableBleProtocolV2ProbeError(method, err)) &&
|
|
56321
|
-
|
|
56322
|
-
|
|
56323
|
-
Log.debug(`
|
|
56842
|
+
retryCount < 6) {
|
|
56843
|
+
const nextRetry = retryCount + 1;
|
|
56844
|
+
Log.debug(`Bluetooth connect timeout and will retry, retry count: ${nextRetry}`);
|
|
56324
56845
|
yield wait(3000);
|
|
56325
|
-
yield connectDeviceForBle(method, device);
|
|
56846
|
+
yield connectDeviceForBle(method, device, nextRetry);
|
|
56326
56847
|
}
|
|
56327
56848
|
else {
|
|
56328
56849
|
throw err;
|
|
@@ -56330,7 +56851,7 @@ function connectDeviceForBle(method, device) {
|
|
|
56330
56851
|
}
|
|
56331
56852
|
});
|
|
56332
56853
|
}
|
|
56333
|
-
const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56854
|
+
const ensureConnected = (_context, method, connectId, pollingId, abortSignal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56334
56855
|
let tryCount = 0;
|
|
56335
56856
|
const MAX_RETRY_COUNT = method.payload && typeof method.payload.retryCount === 'number' ? method.payload.retryCount : 5;
|
|
56336
56857
|
const POLL_INTERVAL_TIME = (method.payload && method.payload.pollIntervalTime) || 1000;
|
|
@@ -56339,7 +56860,7 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
56339
56860
|
Log.debug(`EnsureConnected function start, MAX_RETRY_COUNT=${MAX_RETRY_COUNT}, POLL_INTERVAL_TIME=${POLL_INTERVAL_TIME} `);
|
|
56340
56861
|
const poll = (time = POLL_INTERVAL_TIME) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56341
56862
|
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56342
|
-
var
|
|
56863
|
+
var _o;
|
|
56343
56864
|
const abort = () => {
|
|
56344
56865
|
if (abortSignal && abortSignal.aborted) {
|
|
56345
56866
|
if (timer) {
|
|
@@ -56353,7 +56874,7 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
56353
56874
|
if (abort()) {
|
|
56354
56875
|
return;
|
|
56355
56876
|
}
|
|
56356
|
-
if (!
|
|
56877
|
+
if (!pollingManager.isActive(connectId, pollingId)) {
|
|
56357
56878
|
Log.debug('EnsureConnected function stop, polling id: ', pollingId);
|
|
56358
56879
|
reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.PollingStop));
|
|
56359
56880
|
return;
|
|
@@ -56401,7 +56922,6 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
56401
56922
|
clearTimeout(timer);
|
|
56402
56923
|
}
|
|
56403
56924
|
if (DataManager.isBleConnect(env)) {
|
|
56404
|
-
bleTimeoutRetry = 0;
|
|
56405
56925
|
if (abort()) {
|
|
56406
56926
|
return;
|
|
56407
56927
|
}
|
|
@@ -56444,7 +56964,7 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
56444
56964
|
clearTimeout(timer);
|
|
56445
56965
|
}
|
|
56446
56966
|
Log.debug('EnsureConnected get to max try count, will return: ', tryCount);
|
|
56447
|
-
if (DataManager.isBrowserWebUsb(env) && !((
|
|
56967
|
+
if (DataManager.isBrowserWebUsb(env) && !((_o = method.payload) === null || _o === void 0 ? void 0 : _o.skipWebDevicePrompt)) {
|
|
56448
56968
|
postMessage(createUiMessage(UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION));
|
|
56449
56969
|
reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission));
|
|
56450
56970
|
}
|
|
@@ -56459,7 +56979,6 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
56459
56979
|
return setTimeout(() => resolve(poll(time * 1.5)), time);
|
|
56460
56980
|
}));
|
|
56461
56981
|
});
|
|
56462
|
-
pollingState[pollingId] = true;
|
|
56463
56982
|
return poll();
|
|
56464
56983
|
});
|
|
56465
56984
|
const cancel = (context, connectId) => {
|
|
@@ -56539,12 +57058,9 @@ const checkPassphraseEnableState = (method, features) => {
|
|
|
56539
57058
|
}
|
|
56540
57059
|
};
|
|
56541
57060
|
const shouldCheckPassphraseState = (method, device) => {
|
|
56542
|
-
var _a, _b;
|
|
56543
57061
|
if (!method.useDevicePassphraseState)
|
|
56544
57062
|
return false;
|
|
56545
|
-
|
|
56546
|
-
const pro2ExplicitWalletSelection = isPro2 && (!!((_a = method.payload) === null || _a === void 0 ? void 0 : _a.passphraseState) || !!((_b = method.payload) === null || _b === void 0 ? void 0 : _b.useEmptyPassphrase));
|
|
56547
|
-
return device.hasUsePassphrase() || pro2ExplicitWalletSelection;
|
|
57063
|
+
return device.hasUsePassphrase();
|
|
56548
57064
|
};
|
|
56549
57065
|
const cleanup = () => {
|
|
56550
57066
|
_uiPromises = [];
|
|
@@ -56563,6 +57079,7 @@ const onDeviceConnectHandler = (device) => {
|
|
|
56563
57079
|
postMessage(createDeviceMessage(DEVICE.CONNECT, { device: deviceObject }));
|
|
56564
57080
|
};
|
|
56565
57081
|
const onDeviceDisconnectHandler = (device) => {
|
|
57082
|
+
device.clearPreInitialized();
|
|
56566
57083
|
const env = DataManager.getSettings('env');
|
|
56567
57084
|
const deviceObject = DataManager.isBleConnect(env) ? device : device.toMessageObject();
|
|
56568
57085
|
postMessage(createDeviceMessage(DEVICE.DISCONNECT, { device: deviceObject }));
|
|
@@ -56676,7 +57193,7 @@ class Core extends events.exports {
|
|
|
56676
57193
|
registerCallbackTask: (connectId, callbackPromise) => {
|
|
56677
57194
|
this.requestQueue.registerPendingCallbackTask(connectId, callbackPromise);
|
|
56678
57195
|
},
|
|
56679
|
-
waitForCallbackTasks: (connectId) => this.requestQueue.waitForPendingCallbackTasks(connectId),
|
|
57196
|
+
waitForCallbackTasks: (connectId, exceptTask) => this.requestQueue.waitForPendingCallbackTasks(connectId, exceptTask),
|
|
56680
57197
|
cancelCallbackTasks: (connectId) => this.requestQueue.cancelCallbackTasks(connectId),
|
|
56681
57198
|
};
|
|
56682
57199
|
}
|
|
@@ -56706,10 +57223,10 @@ class Core extends events.exports {
|
|
|
56706
57223
|
break;
|
|
56707
57224
|
}
|
|
56708
57225
|
case IFRAME.CALL: {
|
|
56709
|
-
Log.log(
|
|
57226
|
+
Log.log(`[${Date.now()}][CALL_API]`, message);
|
|
56710
57227
|
const response = yield callAPI(this.getCoreContext(), message);
|
|
56711
57228
|
const { success, payload } = response;
|
|
56712
|
-
Log.log(
|
|
57229
|
+
Log.log(`[${Date.now()}][CALL_API_RESPONSE]`, response);
|
|
56713
57230
|
if (success) {
|
|
56714
57231
|
return response;
|
|
56715
57232
|
}
|
|
@@ -56732,6 +57249,9 @@ class Core extends events.exports {
|
|
|
56732
57249
|
dispose() {
|
|
56733
57250
|
_deviceList = undefined;
|
|
56734
57251
|
_connector = undefined;
|
|
57252
|
+
deviceCacheMap.clear();
|
|
57253
|
+
preWarmInflight.clear();
|
|
57254
|
+
preWarmDoneAt.clear();
|
|
56735
57255
|
Log.debug(`[Core] Disposing SDK instance: ${this.sdkInstanceId}`);
|
|
56736
57256
|
cleanupSdkInstance(this.sdkInstanceId);
|
|
56737
57257
|
}
|
|
@@ -56754,7 +57274,7 @@ const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0,
|
|
|
56754
57274
|
yield DataManager.load(settings);
|
|
56755
57275
|
initTransport(Transport, plugin);
|
|
56756
57276
|
}
|
|
56757
|
-
catch (
|
|
57277
|
+
catch (_p) {
|
|
56758
57278
|
Log.error('DataManager.load error');
|
|
56759
57279
|
}
|
|
56760
57280
|
enableLog(DataManager.getSettings('debug'));
|
|
@@ -56873,6 +57393,7 @@ exports.getHomeScreenHex = getHomeScreenHex;
|
|
|
56873
57393
|
exports.getHomeScreenSize = getHomeScreenSize;
|
|
56874
57394
|
exports.getLanguageConfig = getLanguageConfig;
|
|
56875
57395
|
exports.getLog = getLog;
|
|
57396
|
+
exports.getLogBlockLabel = getLogBlockLabel;
|
|
56876
57397
|
exports.getLogger = getLogger;
|
|
56877
57398
|
exports.getMethodVersionRange = getMethodVersionRange;
|
|
56878
57399
|
exports.getOutputScriptType = getOutputScriptType;
|