@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
|
@@ -10,6 +10,7 @@ export default class NearSignTransaction extends BaseMethod<HardwareNearSignTx>
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
13
14
|
|
|
14
15
|
// check payload
|
|
15
16
|
validateParams(this.payload, [
|
|
@@ -230,6 +230,7 @@ export default class NEMSignTransaction extends BaseMethod<NEMSignTx> {
|
|
|
230
230
|
init() {
|
|
231
231
|
this.checkDeviceId = true;
|
|
232
232
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
233
|
+
this.allowUsePreInitialize = true;
|
|
233
234
|
|
|
234
235
|
validateParams(this.payload, [
|
|
235
236
|
{ name: 'path', required: true },
|
|
@@ -11,6 +11,7 @@ export default class NeoSignTransaction extends BaseMethod<NeoSignTx> {
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
13
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
|
+
this.allowUsePreInitialize = true;
|
|
14
15
|
this.strictCheckDeviceSupport = true;
|
|
15
16
|
|
|
16
17
|
validateParams(this.payload, [
|
|
@@ -19,6 +19,7 @@ export default class NervosSignTransaction extends BaseMethod<NervosSignTx> {
|
|
|
19
19
|
init() {
|
|
20
20
|
this.checkDeviceId = true;
|
|
21
21
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
22
|
+
this.allowUsePreInitialize = true;
|
|
22
23
|
|
|
23
24
|
// check payload
|
|
24
25
|
validateParams(this.payload, [
|
|
@@ -12,6 +12,8 @@ export default class NexaSignTransaction extends BaseMethod<NexaSignTransactionP
|
|
|
12
12
|
hasBundle = false;
|
|
13
13
|
|
|
14
14
|
init() {
|
|
15
|
+
this.allowUsePreInitialize = true;
|
|
16
|
+
|
|
15
17
|
const payload = this.payload as NexaSignTransactionParams;
|
|
16
18
|
|
|
17
19
|
payload.inputs.forEach(input => {
|
|
@@ -15,6 +15,7 @@ export default class NostrSignEvent extends BaseMethod<SignEvent> {
|
|
|
15
15
|
init() {
|
|
16
16
|
this.checkDeviceId = true;
|
|
17
17
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
18
|
+
this.allowUsePreInitialize = true;
|
|
18
19
|
|
|
19
20
|
const { payload } = this;
|
|
20
21
|
if (!validateEvent(payload.event)) {
|
|
@@ -11,6 +11,7 @@ export default class NostrSignSchnorr extends BaseMethod<SignSchnorr> {
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
13
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
|
+
this.allowUsePreInitialize = true;
|
|
14
15
|
|
|
15
16
|
const { payload } = this;
|
|
16
17
|
validateParams(payload, [
|
|
@@ -13,6 +13,7 @@ export default class PolkadotSignTransaction extends BaseMethod<HardwarePolkadot
|
|
|
13
13
|
init() {
|
|
14
14
|
this.checkDeviceId = true;
|
|
15
15
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
16
|
+
this.allowUsePreInitialize = true;
|
|
16
17
|
|
|
17
18
|
// check payload
|
|
18
19
|
validateParams(this.payload, [
|
|
@@ -8,11 +8,7 @@ export default class DeviceGetOnboardingStatus extends BaseMethod {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
async run() {
|
|
11
|
-
const res = await this.device.commands.typedCall(
|
|
12
|
-
'DeviceGetOnboardingStatus',
|
|
13
|
-
'DeviceOnboardingStatus',
|
|
14
|
-
{}
|
|
15
|
-
);
|
|
11
|
+
const res = await this.device.commands.typedCall('GetOnboardingStatus', 'OnboardingStatus', {});
|
|
16
12
|
return Promise.resolve(res.message);
|
|
17
13
|
}
|
|
18
14
|
}
|
|
@@ -11,6 +11,7 @@ export default class ScdoSignMessage extends BaseMethod<HardwareScdoSignMessage>
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
13
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
|
+
this.allowUsePreInitialize = true;
|
|
14
15
|
|
|
15
16
|
// check payload
|
|
16
17
|
validateParams(this.payload, [
|
|
@@ -18,6 +18,7 @@ export default class ScdoSignTransaction extends BaseMethod<HardwareScdoSignTx>
|
|
|
18
18
|
init() {
|
|
19
19
|
this.checkDeviceId = true;
|
|
20
20
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
21
|
+
this.allowUsePreInitialize = true;
|
|
21
22
|
|
|
22
23
|
// check payload
|
|
23
24
|
validateParams(this.payload, [
|
|
@@ -10,6 +10,7 @@ export default class SolSignMessage extends BaseMethod<HardwareSolSignUnsafeMess
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
13
14
|
|
|
14
15
|
// check payload
|
|
15
16
|
validateParams(this.payload, [
|
|
@@ -10,6 +10,7 @@ export default class SolSignOffchainMessage extends BaseMethod<HardwareSolSignOf
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
13
14
|
|
|
14
15
|
// check payload
|
|
15
16
|
validateParams(this.payload, [
|
|
@@ -13,6 +13,7 @@ export default class SolSignTransaction extends BaseMethod<HardwareSolanaSignTx[
|
|
|
13
13
|
init() {
|
|
14
14
|
this.checkDeviceId = true;
|
|
15
15
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
16
|
+
this.allowUsePreInitialize = true;
|
|
16
17
|
|
|
17
18
|
this.hasBundle = !!this.payload?.bundle;
|
|
18
19
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -10,6 +10,7 @@ export default class StarcoinSignMessage extends BaseMethod<HardwareStarcoinSign
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
13
14
|
|
|
14
15
|
// check payload
|
|
15
16
|
validateParams(this.payload, [
|
|
@@ -10,6 +10,7 @@ export default class StarcoinSignTransaction extends BaseMethod<StarcoinSignTx>
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
13
14
|
|
|
14
15
|
// check payload
|
|
15
16
|
validateParams(this.payload, [
|
|
@@ -231,6 +231,7 @@ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSi
|
|
|
231
231
|
init() {
|
|
232
232
|
this.checkDeviceId = true;
|
|
233
233
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
234
|
+
this.allowUsePreInitialize = true;
|
|
234
235
|
|
|
235
236
|
// check payload
|
|
236
237
|
validateParams(this.payload, [
|
|
@@ -10,6 +10,7 @@ export default class SuiSignMessage extends BaseMethod<HardwareSuiSignMessage> {
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
+
this.allowUsePreInitialize = true;
|
|
13
14
|
|
|
14
15
|
// check payload
|
|
15
16
|
validateParams(this.payload, [
|
|
@@ -29,6 +30,9 @@ export default class SuiSignMessage extends BaseMethod<HardwareSuiSignMessage> {
|
|
|
29
30
|
|
|
30
31
|
getVersionRange() {
|
|
31
32
|
return {
|
|
33
|
+
pro2: {
|
|
34
|
+
min: '0.0.0',
|
|
35
|
+
},
|
|
32
36
|
model_mini: {
|
|
33
37
|
min: '3.4.0',
|
|
34
38
|
},
|
|
@@ -19,6 +19,7 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
19
19
|
init() {
|
|
20
20
|
this.checkDeviceId = true;
|
|
21
21
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
22
|
+
this.allowUsePreInitialize = true;
|
|
22
23
|
|
|
23
24
|
// check payload
|
|
24
25
|
validateParams(this.payload, [
|
|
@@ -39,6 +40,9 @@ export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
|
39
40
|
|
|
40
41
|
getVersionRange() {
|
|
41
42
|
return {
|
|
43
|
+
pro2: {
|
|
44
|
+
min: '0.0.0',
|
|
45
|
+
},
|
|
42
46
|
model_mini: {
|
|
43
47
|
min: '3.0.0',
|
|
44
48
|
},
|
|
@@ -9,12 +9,12 @@ import type { TonSignDataParams } from '../../types/api/tonSignData';
|
|
|
9
9
|
|
|
10
10
|
export default class TonSignData extends BaseMethod<HardwareTonSignData> {
|
|
11
11
|
init() {
|
|
12
|
-
// Keep strict-check off until
|
|
13
|
-
//
|
|
14
|
-
// Flip back to true and add getVersionRange() once those numbers land.
|
|
12
|
+
// Keep strict-check off for touch/classic1s until their firmware release
|
|
13
|
+
// versions are decided. Pro2 is explicitly allowed by getVersionRange().
|
|
15
14
|
this.strictCheckDeviceSupport = false;
|
|
16
15
|
this.checkDeviceId = true;
|
|
17
16
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
17
|
+
this.allowUsePreInitialize = true;
|
|
18
18
|
|
|
19
19
|
validateParams(this.payload, [
|
|
20
20
|
{ name: 'path', required: true },
|
|
@@ -50,6 +50,14 @@ export default class TonSignData extends BaseMethod<HardwareTonSignData> {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
getVersionRange() {
|
|
54
|
+
return {
|
|
55
|
+
pro2: {
|
|
56
|
+
min: '0.0.0',
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
53
61
|
async run() {
|
|
54
62
|
const res = await this.device.commands.typedCall('TonSignData', 'TonSignedData', {
|
|
55
63
|
...this.params,
|
|
@@ -26,6 +26,7 @@ export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
|
|
|
26
26
|
this.strictCheckDeviceSupport = true;
|
|
27
27
|
this.checkDeviceId = true;
|
|
28
28
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
29
|
+
this.allowUsePreInitialize = true;
|
|
29
30
|
|
|
30
31
|
// init params
|
|
31
32
|
validateParams(this.payload, [
|
|
@@ -85,6 +86,9 @@ export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
|
|
|
85
86
|
|
|
86
87
|
getVersionRange() {
|
|
87
88
|
return {
|
|
89
|
+
pro2: {
|
|
90
|
+
min: '0.0.0',
|
|
91
|
+
},
|
|
88
92
|
model_touch: {
|
|
89
93
|
min: '4.10.0',
|
|
90
94
|
},
|
|
@@ -11,6 +11,7 @@ export default class TonSignProof extends BaseMethod<HardwareTonSignProof> {
|
|
|
11
11
|
this.strictCheckDeviceSupport = true;
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
13
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
|
+
this.allowUsePreInitialize = true;
|
|
14
15
|
|
|
15
16
|
// init params
|
|
16
17
|
validateParams(this.payload, [
|
|
@@ -43,6 +44,9 @@ export default class TonSignProof extends BaseMethod<HardwareTonSignProof> {
|
|
|
43
44
|
|
|
44
45
|
getVersionRange() {
|
|
45
46
|
return {
|
|
47
|
+
pro2: {
|
|
48
|
+
min: '0.0.0',
|
|
49
|
+
},
|
|
46
50
|
model_touch: {
|
|
47
51
|
min: '4.10.0',
|
|
48
52
|
},
|
|
@@ -14,6 +14,7 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
14
14
|
init() {
|
|
15
15
|
this.checkDeviceId = true;
|
|
16
16
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
17
|
+
this.allowUsePreInitialize = true;
|
|
17
18
|
|
|
18
19
|
// check payload
|
|
19
20
|
validateParams(this.payload, [
|
|
@@ -123,6 +123,7 @@ export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
|
123
123
|
init() {
|
|
124
124
|
this.checkDeviceId = true;
|
|
125
125
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
126
|
+
this.allowUsePreInitialize = true;
|
|
126
127
|
|
|
127
128
|
// check payload
|
|
128
129
|
validateParams(this.payload, [
|
|
@@ -11,6 +11,7 @@ export default class XrpGetAddress extends BaseMethod<XrpSignTransactionParams>
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
13
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
|
+
this.allowUsePreInitialize = true;
|
|
14
15
|
|
|
15
16
|
const { payload } = this;
|
|
16
17
|
validateParams(payload, [
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages polling state for device connection attempts.
|
|
3
|
+
*
|
|
4
|
+
* Polling is isolated by connectId (device), so:
|
|
5
|
+
* - New request for device A only stops device A's previous polling
|
|
6
|
+
* - Device B's polling is unaffected
|
|
7
|
+
*/
|
|
8
|
+
export class PollingStateManager {
|
|
9
|
+
// connectId -> current polling ID
|
|
10
|
+
private activePolls = new Map<string, number>();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Start a new polling session for a device.
|
|
14
|
+
* Automatically stops the previous polling for the same device.
|
|
15
|
+
* @param connectId - Device identifier (use empty string for USB without connectId)
|
|
16
|
+
* @returns The new polling ID
|
|
17
|
+
*/
|
|
18
|
+
start(connectId: string): number {
|
|
19
|
+
const currentId = (this.activePolls.get(connectId) ?? 0) + 1;
|
|
20
|
+
this.activePolls.set(connectId, currentId);
|
|
21
|
+
return currentId;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Check if a polling session is still active.
|
|
26
|
+
* @param connectId - Device identifier
|
|
27
|
+
* @param pollingId - The polling ID to check
|
|
28
|
+
*/
|
|
29
|
+
isActive(connectId: string, pollingId: number): boolean {
|
|
30
|
+
return this.activePolls.get(connectId) === pollingId;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Stop polling for a specific device.
|
|
35
|
+
* @param connectId - Device identifier
|
|
36
|
+
*/
|
|
37
|
+
stop(connectId: string): void {
|
|
38
|
+
this.activePolls.delete(connectId);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Stop all active polling sessions.
|
|
43
|
+
*/
|
|
44
|
+
stopAll(): void {
|
|
45
|
+
this.activePolls.clear();
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/core/RequestQueue.ts
CHANGED
|
@@ -113,13 +113,20 @@ export default class RequestQueue {
|
|
|
113
113
|
|
|
114
114
|
callbackPromise.promise.finally(() => {
|
|
115
115
|
Log.debug(`Callback task completed for connectId: ${connectId}`);
|
|
116
|
-
this.
|
|
116
|
+
// Delete by identity so a newer task that replaced this slot isn't orphaned.
|
|
117
|
+
if (this.pendingCallbackTasks.get(connectId) === callbackPromise) {
|
|
118
|
+
this.pendingCallbackTasks.delete(connectId);
|
|
119
|
+
}
|
|
117
120
|
});
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
public async waitForPendingCallbackTasks(
|
|
123
|
+
public async waitForPendingCallbackTasks(
|
|
124
|
+
connectId: string,
|
|
125
|
+
exceptTask?: Deferred<void>
|
|
126
|
+
): Promise<void> {
|
|
121
127
|
const pendingTask = this.pendingCallbackTasks.get(connectId);
|
|
122
|
-
|
|
128
|
+
// Skip only the caller's own task (self-wait); a different one is still awaited.
|
|
129
|
+
if (pendingTask && pendingTask !== exceptTask) {
|
|
123
130
|
Log.debug(`Waiting for pending callback task to complete for connectId: ${connectId}`);
|
|
124
131
|
await pendingTask.promise;
|
|
125
132
|
}
|