@onekeyfe/hd-core 1.0.34-alpha.0 → 1.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/BaseMethod.d.ts +1 -1
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/helpers/hexUtils.d.ts +1 -0
- package/dist/api/helpers/hexUtils.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +139 -125
- package/dist/types/api/firmwareUpdate.d.ts +1 -1
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +0 -2
- package/dist/utils/logger.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +3 -2
- package/src/api/CheckAllFirmwareRelease.ts +1 -1
- package/src/api/CheckBLEFirmwareRelease.ts +3 -3
- package/src/api/CheckBootloaderRelease.ts +1 -1
- package/src/api/CheckBridgeRelease.ts +1 -1
- package/src/api/CheckFirmwareRelease.ts +3 -3
- package/src/api/CipherKeyValue.ts +1 -1
- package/src/api/FirmwareUpdate.ts +1 -1
- package/src/api/FirmwareUpdateV2.ts +1 -1
- package/src/api/FirmwareUpdateV3.ts +1 -1
- package/src/api/GetFeatures.ts +3 -3
- package/src/api/GetOnekeyFeatures.ts +3 -3
- package/src/api/GetPassphraseState.ts +1 -1
- package/src/api/alephium/AlephiumGetAddress.ts +1 -1
- package/src/api/alephium/AlephiumSignMessage.ts +1 -1
- package/src/api/alephium/AlephiumSignTransaction.ts +1 -1
- package/src/api/algo/AlgoGetAddress.ts +1 -1
- package/src/api/algo/AlgoSignTransaction.ts +1 -1
- package/src/api/allnetwork/AllNetworkGetAddress.ts +1 -1
- package/src/api/aptos/AptosGetAddress.ts +1 -1
- package/src/api/aptos/AptosGetPublicKey.ts +1 -1
- package/src/api/aptos/AptosSignMessage.ts +1 -1
- package/src/api/aptos/AptosSignTransaction.ts +1 -1
- package/src/api/benfen/BenfenGetAddress.ts +1 -1
- package/src/api/benfen/BenfenGetPublicKey.ts +1 -1
- package/src/api/benfen/BenfenSignMessage.ts +1 -1
- package/src/api/benfen/BenfenSignTransaction.ts +1 -1
- package/src/api/btc/BTCGetAddress.ts +1 -1
- package/src/api/btc/BTCGetPublicKey.ts +1 -1
- package/src/api/btc/BTCSignMessage.ts +1 -1
- package/src/api/btc/BTCSignPsbt.ts +1 -1
- package/src/api/btc/BTCSignTransaction.ts +1 -1
- package/src/api/btc/BTCVerifyMessage.ts +1 -1
- package/src/api/cardano/CardanoGetAddress.ts +1 -1
- package/src/api/cardano/CardanoGetPublicKey.ts +1 -1
- package/src/api/cardano/CardanoSignMessage.ts +1 -1
- package/src/api/cardano/CardanoSignTransaction.ts +1 -1
- package/src/api/conflux/ConfluxGetAddress.ts +1 -1
- package/src/api/conflux/ConfluxSignMessage.ts +1 -1
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +1 -1
- package/src/api/conflux/ConfluxSignTransaction.ts +1 -1
- package/src/api/cosmos/CosmosGetAddress.ts +1 -1
- package/src/api/cosmos/CosmosGetPublicKey.ts +1 -1
- package/src/api/cosmos/CosmosSignTransaction.ts +1 -1
- package/src/api/device/DeviceUpdateBootloader.ts +1 -1
- package/src/api/dynex/DnxGetAddress.ts +1 -1
- package/src/api/dynex/DnxSignTransaction.ts +1 -1
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +1 -1
- package/src/api/evm/EVMSignMessage.ts +1 -1
- package/src/api/evm/EVMSignMessageEIP712.ts +1 -1
- package/src/api/evm/EVMSignTransaction.ts +1 -1
- package/src/api/evm/EVMSignTypedData.ts +3 -3
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/filecoin/FilecoinGetAddress.ts +1 -1
- package/src/api/filecoin/FilecoinSignTransaction.ts +1 -1
- package/src/api/helpers/hexUtils.ts +29 -0
- package/src/api/kaspa/KaspaGetAddress.ts +1 -1
- package/src/api/kaspa/KaspaSignTransaction.ts +1 -1
- package/src/api/lightning/LnurlAuth.ts +1 -1
- package/src/api/near/NearGetAddress.ts +1 -1
- package/src/api/near/NearSignTransaction.ts +1 -1
- package/src/api/nem/NEMGetAddress.ts +1 -1
- package/src/api/nem/NEMSignTransaction.ts +1 -1
- package/src/api/neo/NeoGetAddress.ts +1 -1
- package/src/api/neo/NeoSignTransaction.ts +1 -1
- package/src/api/nervos/NervosGetAddress.ts +1 -1
- package/src/api/nervos/NervosSignTransaction.ts +1 -1
- package/src/api/nexa/NexaGetAddress.ts +1 -1
- package/src/api/nostr/NostrDecryptMessage.ts +1 -1
- package/src/api/nostr/NostrEncryptMessage.ts +1 -1
- package/src/api/nostr/NostrGetPublicKey.ts +1 -1
- package/src/api/nostr/NostrSignEvent.ts +1 -1
- package/src/api/nostr/NostrSignSchnorr.ts +1 -1
- package/src/api/polkadot/PolkadotGetAddress.ts +1 -1
- package/src/api/polkadot/PolkadotSignTransaction.ts +1 -1
- package/src/api/scdo/ScdoGetAddress.ts +1 -1
- package/src/api/scdo/ScdoSignMessage.ts +1 -1
- package/src/api/scdo/ScdoSignTransaction.ts +1 -1
- package/src/api/solana/SolGetAddress.ts +1 -1
- package/src/api/solana/SolSignMessage.ts +1 -1
- package/src/api/solana/SolSignOffchainMessage.ts +1 -1
- package/src/api/solana/SolSignTransaction.ts +1 -1
- package/src/api/starcoin/StarcoinGetAddress.ts +1 -1
- package/src/api/starcoin/StarcoinGetPublicKey.ts +1 -1
- package/src/api/starcoin/StarcoinSignMessage.ts +1 -1
- package/src/api/starcoin/StarcoinSignTransaction.ts +1 -1
- package/src/api/starcoin/StarcoinVerifyMessage.ts +1 -1
- package/src/api/stellar/StellarGetAddress.ts +1 -1
- package/src/api/stellar/StellarSignTransaction.ts +1 -1
- package/src/api/sui/SuiGetAddress.ts +1 -1
- package/src/api/sui/SuiGetPublicKey.ts +1 -1
- package/src/api/sui/SuiSignMessage.ts +1 -1
- package/src/api/sui/SuiSignTransaction.ts +1 -1
- package/src/api/test/TestInitializeDeviceDuration.ts +3 -3
- package/src/api/ton/TonGetAddress.ts +1 -1
- package/src/api/ton/TonSignMessage.ts +1 -1
- package/src/api/ton/TonSignProof.ts +1 -1
- package/src/api/tron/TronGetAddress.ts +1 -1
- package/src/api/tron/TronSignMessage.ts +1 -1
- package/src/api/tron/TronSignTransaction.ts +1 -1
- package/src/api/xrp/XrpGetAddress.ts +1 -1
- package/src/api/xrp/XrpSignTransaction.ts +1 -1
- package/src/core/index.ts +1 -1
- package/src/data-manager/DataManager.ts +1 -1
- package/src/data-manager/TransportManager.ts +0 -3
- package/src/device/Device.ts +2 -2
- package/src/events/ui-request.ts +1 -1
- package/src/types/api/firmwareUpdate.ts +1 -1
- package/src/types/settings.ts +1 -9
- package/src/utils/logger.ts +0 -2
|
@@ -17,7 +17,7 @@ export default class EVMGetPublicKey extends BaseMethod<EthereumGetPublicKeyOneK
|
|
|
17
17
|
|
|
18
18
|
init() {
|
|
19
19
|
this.checkDeviceId = true;
|
|
20
|
-
this.
|
|
20
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
21
21
|
|
|
22
22
|
this.hasBundle = !!this.payload?.bundle;
|
|
23
23
|
this.useBatch = this.payload?.bundle?.every(
|
|
@@ -11,7 +11,7 @@ import signMessageLegacyV1 from './legacyV1/signMessage';
|
|
|
11
11
|
export default class EVMSignMessage extends BaseMethod<EthereumSignMessageOneKey> {
|
|
12
12
|
init() {
|
|
13
13
|
this.checkDeviceId = true;
|
|
14
|
-
this.
|
|
14
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
15
15
|
|
|
16
16
|
// check payload
|
|
17
17
|
validateParams(this.payload, [
|
|
@@ -8,7 +8,7 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
8
8
|
export default class EVMSignMessageEIP712 extends BaseMethod<EthereumSignMessageEIP712> {
|
|
9
9
|
init() {
|
|
10
10
|
this.checkDeviceId = true;
|
|
11
|
-
this.
|
|
11
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
12
|
|
|
13
13
|
validateParams(this.payload, [
|
|
14
14
|
{ name: 'path', required: true },
|
|
@@ -18,7 +18,7 @@ export default class EVMSignTransaction extends BaseMethod {
|
|
|
18
18
|
|
|
19
19
|
init() {
|
|
20
20
|
this.checkDeviceId = true;
|
|
21
|
-
this.
|
|
21
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
22
22
|
|
|
23
23
|
validateParams(this.payload, [
|
|
24
24
|
{ name: 'path', required: true },
|
|
@@ -13,7 +13,7 @@ import { UI_REQUEST } from '../../constants/ui-request';
|
|
|
13
13
|
import { validatePath } from '../helpers/pathUtils';
|
|
14
14
|
import { BaseMethod } from '../BaseMethod';
|
|
15
15
|
import { validateParams } from '../helpers/paramsValidator';
|
|
16
|
-
import { formatAnyHex, stripHexStartZeroes } from '../helpers/hexUtils';
|
|
16
|
+
import { formatAnyHex, parseChainId, stripHexStartZeroes } from '../helpers/hexUtils';
|
|
17
17
|
import { getDeviceFirmwareVersion, getDeviceType } from '../../utils';
|
|
18
18
|
import {
|
|
19
19
|
DeviceModelToTypes,
|
|
@@ -39,7 +39,7 @@ export type EVMSignTypedDataParams = {
|
|
|
39
39
|
export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams> {
|
|
40
40
|
init() {
|
|
41
41
|
this.checkDeviceId = true;
|
|
42
|
-
this.
|
|
42
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
43
43
|
|
|
44
44
|
validateParams(this.payload, [
|
|
45
45
|
{ name: 'path', required: true },
|
|
@@ -217,7 +217,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
217
217
|
gasToken: data.message.gasToken,
|
|
218
218
|
refundReceiver: data.message.refundReceiver,
|
|
219
219
|
nonce: formatAnyHex(new BigNumber(data.message.nonce).toString(16)),
|
|
220
|
-
chain_id:
|
|
220
|
+
chain_id: parseChainId(data.domain.chainId),
|
|
221
221
|
verifyingContract: data.domain.verifyingContract,
|
|
222
222
|
};
|
|
223
223
|
response = await typedCall(
|
|
@@ -10,7 +10,7 @@ import verifyMessage from './latest/verifyMessage';
|
|
|
10
10
|
export default class EVMSignMessage extends BaseMethod<EthereumVerifyMessageOneKey> {
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
validateParams(this.payload, [
|
|
16
16
|
{ name: 'address', type: 'string', required: true },
|
|
@@ -10,7 +10,7 @@ export default class FilecoinGetAddress extends BaseMethod<HardwareFilecoinGetAd
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
this.hasBundle = !!this.payload?.bundle;
|
|
16
16
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -10,7 +10,7 @@ export default class FilecoinSignTransaction extends BaseMethod<HardwareFilecoin
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
14
14
|
|
|
15
15
|
// check payload
|
|
16
16
|
validateParams(this.payload, [
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
|
|
1
3
|
export const hasHexPrefix = (str: string): boolean => str.slice(0, 2).toLowerCase() === '0x';
|
|
2
4
|
|
|
3
5
|
// remove hex prefix
|
|
@@ -80,3 +82,30 @@ export function hexToBytes(hex: string): Uint8Array {
|
|
|
80
82
|
}
|
|
81
83
|
return array;
|
|
82
84
|
}
|
|
85
|
+
|
|
86
|
+
export function parseChainId(chainId: string | number | undefined): number {
|
|
87
|
+
if (!chainId) {
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (typeof chainId === 'string') {
|
|
92
|
+
if (chainId.trim() === '') {
|
|
93
|
+
return 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (chainId.match(/^[0-9]+$/)) {
|
|
97
|
+
return new BigNumber(chainId, 10).toNumber();
|
|
98
|
+
}
|
|
99
|
+
if (chainId.startsWith('0x') || chainId.match(/^[0-9a-fA-F]+$/)) {
|
|
100
|
+
return new BigNumber(chainId, 16).toNumber();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
throw new Error(`Invalid chainId ${chainId}`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (typeof chainId === 'number') {
|
|
107
|
+
return new BigNumber(chainId).toNumber();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
throw new Error(`Invalid chainId ${chainId}`);
|
|
111
|
+
}
|
|
@@ -10,7 +10,7 @@ export default class KaspaGetAddress extends BaseMethod<HardwareKaspaGetAddress[
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
this.hasBundle = !!this.payload?.bundle;
|
|
16
16
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -19,7 +19,7 @@ export default class KaspaSignTransaction extends BaseMethod<KaspaSignTransactio
|
|
|
19
19
|
|
|
20
20
|
init() {
|
|
21
21
|
this.checkDeviceId = true;
|
|
22
|
-
this.
|
|
22
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
23
23
|
|
|
24
24
|
const payload = this.payload as KaspaSignTransactionParams;
|
|
25
25
|
|
|
@@ -9,7 +9,7 @@ export default class LnurlAuth1 extends BaseMethod<ILnurlAuth> {
|
|
|
9
9
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
|
-
this.
|
|
12
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
13
|
|
|
14
14
|
const { payload } = this;
|
|
15
15
|
validateParams(payload, [
|
|
@@ -10,7 +10,7 @@ export default class NearGetAddress extends BaseMethod<HardwareNearGetAddress[]>
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
this.hasBundle = !!this.payload?.bundle;
|
|
16
16
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -8,7 +8,7 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
8
8
|
export default class NearSignTransaction extends BaseMethod<HardwareNearSignTx> {
|
|
9
9
|
init() {
|
|
10
10
|
this.checkDeviceId = true;
|
|
11
|
-
this.
|
|
11
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
12
|
|
|
13
13
|
// check payload
|
|
14
14
|
validateParams(this.payload, [
|
|
@@ -12,7 +12,7 @@ export default class NEMGetAddress extends BaseMethod<HardwareNEMGetAddress[]> {
|
|
|
12
12
|
|
|
13
13
|
init() {
|
|
14
14
|
this.checkDeviceId = true;
|
|
15
|
-
this.
|
|
15
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
16
16
|
|
|
17
17
|
this.hasBundle = !!this.payload?.bundle;
|
|
18
18
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -228,7 +228,7 @@ export default class NEMSignTransaction extends BaseMethod<NEMSignTx> {
|
|
|
228
228
|
|
|
229
229
|
init() {
|
|
230
230
|
this.checkDeviceId = true;
|
|
231
|
-
this.
|
|
231
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
232
232
|
|
|
233
233
|
validateParams(this.payload, [
|
|
234
234
|
{ name: 'path', required: true },
|
|
@@ -10,7 +10,7 @@ export default class NeoGetAddress extends BaseMethod<HardwareNeoGetAddress[]> {
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
this.strictCheckDeviceSupport = true;
|
|
15
15
|
|
|
16
16
|
this.hasBundle = !!this.payload?.bundle;
|
|
@@ -9,7 +9,7 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
9
9
|
export default class NeoSignTransaction extends BaseMethod<NeoSignTx> {
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
|
-
this.
|
|
12
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
13
|
this.strictCheckDeviceSupport = true;
|
|
14
14
|
|
|
15
15
|
validateParams(this.payload, [
|
|
@@ -11,7 +11,7 @@ export default class NervosGetAddress extends BaseMethod<HardwareNervosGetAddres
|
|
|
11
11
|
|
|
12
12
|
init() {
|
|
13
13
|
this.checkDeviceId = true;
|
|
14
|
-
this.
|
|
14
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
15
15
|
|
|
16
16
|
this.hasBundle = !!this.payload?.bundle;
|
|
17
17
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -16,7 +16,7 @@ export default class NervosSignTransaction extends BaseMethod<NervosSignTx> {
|
|
|
16
16
|
|
|
17
17
|
init() {
|
|
18
18
|
this.checkDeviceId = true;
|
|
19
|
-
this.
|
|
19
|
+
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
20
20
|
|
|
21
21
|
// check payload
|
|
22
22
|
validateParams(this.payload, [
|
|
@@ -10,7 +10,7 @@ export default class NexaGetAddress extends BaseMethod<HardwareNexaGetAddress[]>
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
this.hasBundle = !!this.payload?.bundle;
|
|
16
16
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -9,7 +9,7 @@ export default class NostrDecryptMessage extends BaseMethod<DecryptMessage> {
|
|
|
9
9
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
|
-
this.
|
|
12
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
13
|
|
|
14
14
|
const { payload } = this;
|
|
15
15
|
validateParams(payload, [
|
|
@@ -9,7 +9,7 @@ export default class NostrEncryptMessage extends BaseMethod<EncryptMessage> {
|
|
|
9
9
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
|
-
this.
|
|
12
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
13
|
|
|
14
14
|
const { payload } = this;
|
|
15
15
|
validateParams(payload, [
|
|
@@ -11,7 +11,7 @@ export default class NostrGetPublicKey extends BaseMethod<GetPublicKey[]> {
|
|
|
11
11
|
|
|
12
12
|
init() {
|
|
13
13
|
this.checkDeviceId = true;
|
|
14
|
-
this.
|
|
14
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
15
15
|
|
|
16
16
|
this.hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
|
|
17
17
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -12,7 +12,7 @@ export default class NostrSignEvent extends BaseMethod<SignEvent> {
|
|
|
12
12
|
|
|
13
13
|
init() {
|
|
14
14
|
this.checkDeviceId = true;
|
|
15
|
-
this.
|
|
15
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
16
16
|
|
|
17
17
|
const { payload } = this;
|
|
18
18
|
if (!validateEvent(payload.event)) {
|
|
@@ -9,7 +9,7 @@ export default class NostrSignSchnorr extends BaseMethod<SignSchnorr> {
|
|
|
9
9
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
|
-
this.
|
|
12
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
13
|
|
|
14
14
|
const { payload } = this;
|
|
15
15
|
validateParams(payload, [
|
|
@@ -11,7 +11,7 @@ export default class PolkadotGetAddress extends BaseMethod<HardwarePolkadotGetAd
|
|
|
11
11
|
|
|
12
12
|
init() {
|
|
13
13
|
this.checkDeviceId = true;
|
|
14
|
-
this.
|
|
14
|
+
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
15
15
|
|
|
16
16
|
this.hasBundle = !!this.payload?.bundle;
|
|
17
17
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -11,7 +11,7 @@ export default class PolkadotSignTransaction extends BaseMethod<HardwarePolkadot
|
|
|
11
11
|
|
|
12
12
|
init() {
|
|
13
13
|
this.checkDeviceId = true;
|
|
14
|
-
this.
|
|
14
|
+
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
15
15
|
|
|
16
16
|
// check payload
|
|
17
17
|
validateParams(this.payload, [
|
|
@@ -10,7 +10,7 @@ export default class ScdoGetAddress extends BaseMethod<HardwareScdoGetAddress[]>
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
this.hasBundle = !!this.payload?.bundle;
|
|
16
16
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -8,7 +8,7 @@ import { stripHexPrefix } from '../helpers/hexUtils';
|
|
|
8
8
|
export default class ScdoSignMessage extends BaseMethod<HardwareScdoSignMessage> {
|
|
9
9
|
init() {
|
|
10
10
|
this.checkDeviceId = true;
|
|
11
|
-
this.
|
|
11
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
12
|
|
|
13
13
|
// check payload
|
|
14
14
|
validateParams(this.payload, [
|
|
@@ -11,7 +11,7 @@ import { formatAnyHex, stripHexStartZeroes } from '../helpers/hexUtils';
|
|
|
11
11
|
export default class ScdoSignTransaction extends BaseMethod<HardwareScdoSignTx> {
|
|
12
12
|
init() {
|
|
13
13
|
this.checkDeviceId = true;
|
|
14
|
-
this.
|
|
14
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
15
15
|
|
|
16
16
|
// check payload
|
|
17
17
|
validateParams(this.payload, [
|
|
@@ -10,7 +10,7 @@ export default class SolGetAddress extends BaseMethod<SolanaGetAddress[]> {
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
this.hasBundle = !!this.payload?.bundle;
|
|
16
16
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -8,7 +8,7 @@ import { stripHexPrefix } from '../helpers/hexUtils';
|
|
|
8
8
|
export default class SolSignMessage extends BaseMethod<HardwareSolSignUnsafeMessage> {
|
|
9
9
|
init() {
|
|
10
10
|
this.checkDeviceId = true;
|
|
11
|
-
this.
|
|
11
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
12
|
|
|
13
13
|
// check payload
|
|
14
14
|
validateParams(this.payload, [
|
|
@@ -8,7 +8,7 @@ import { stripHexPrefix } from '../helpers/hexUtils';
|
|
|
8
8
|
export default class SolSignOffchainMessage extends BaseMethod<HardwareSolSignOffChainMessage> {
|
|
9
9
|
init() {
|
|
10
10
|
this.checkDeviceId = true;
|
|
11
|
-
this.
|
|
11
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
12
|
|
|
13
13
|
// check payload
|
|
14
14
|
validateParams(this.payload, [
|
|
@@ -11,7 +11,7 @@ export default class SolSignTransaction extends BaseMethod<HardwareSolanaSignTx[
|
|
|
11
11
|
|
|
12
12
|
init() {
|
|
13
13
|
this.checkDeviceId = true;
|
|
14
|
-
this.
|
|
14
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
15
15
|
|
|
16
16
|
this.hasBundle = !!this.payload?.bundle;
|
|
17
17
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -10,7 +10,7 @@ export default class StarcoinGetAddress extends BaseMethod<HardwareStarcoinGetAd
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
this.hasBundle = !!this.payload?.bundle;
|
|
16
16
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -13,7 +13,7 @@ export default class StarcoinGetPublicKey extends BaseMethod<HardwareStarcoinGet
|
|
|
13
13
|
|
|
14
14
|
init() {
|
|
15
15
|
this.checkDeviceId = true;
|
|
16
|
-
this.
|
|
16
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
17
17
|
|
|
18
18
|
this.hasBundle = !!this.payload?.bundle;
|
|
19
19
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -8,7 +8,7 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
8
8
|
export default class StarcoinSignMessage extends BaseMethod<HardwareStarcoinSignMessage> {
|
|
9
9
|
init() {
|
|
10
10
|
this.checkDeviceId = true;
|
|
11
|
-
this.
|
|
11
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
12
|
|
|
13
13
|
// check payload
|
|
14
14
|
validateParams(this.payload, [
|
|
@@ -8,7 +8,7 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
8
8
|
export default class StarcoinSignTransaction extends BaseMethod<StarcoinSignTx> {
|
|
9
9
|
init() {
|
|
10
10
|
this.checkDeviceId = true;
|
|
11
|
-
this.
|
|
11
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
12
|
|
|
13
13
|
// check payload
|
|
14
14
|
validateParams(this.payload, [
|
|
@@ -7,7 +7,7 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
7
7
|
export default class EVMSignMessage extends BaseMethod<HardwareStarcoinVerifyMessage> {
|
|
8
8
|
init() {
|
|
9
9
|
this.checkDeviceId = true;
|
|
10
|
-
this.
|
|
10
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
11
11
|
|
|
12
12
|
validateParams(this.payload, [
|
|
13
13
|
{ name: 'publicKey', type: 'string', required: true },
|
|
@@ -10,7 +10,7 @@ export default class StellarGetAddress extends BaseMethod<HardwareStellarGetAddr
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
this.hasBundle = !!this.payload?.bundle;
|
|
16
16
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -149,7 +149,7 @@ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSi
|
|
|
149
149
|
|
|
150
150
|
init() {
|
|
151
151
|
this.checkDeviceId = true;
|
|
152
|
-
this.
|
|
152
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
153
153
|
|
|
154
154
|
// check payload
|
|
155
155
|
validateParams(this.payload, [
|
|
@@ -16,7 +16,7 @@ export default class SuiGetAddress extends BaseMethod<HardwareSuiGetAddress[]> {
|
|
|
16
16
|
|
|
17
17
|
init() {
|
|
18
18
|
this.checkDeviceId = true;
|
|
19
|
-
this.
|
|
19
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
20
20
|
|
|
21
21
|
this.hasBundle = !!this.payload?.bundle;
|
|
22
22
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -10,7 +10,7 @@ export default class SuiGetPublicKey extends BaseMethod<any> {
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
this.hasBundle = !!this.payload?.bundle;
|
|
16
16
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -8,7 +8,7 @@ import { stripHexPrefix } from '../helpers/hexUtils';
|
|
|
8
8
|
export default class SuiSignMessage extends BaseMethod<HardwareSuiSignMessage> {
|
|
9
9
|
init() {
|
|
10
10
|
this.checkDeviceId = true;
|
|
11
|
-
this.
|
|
11
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
12
|
|
|
13
13
|
// check payload
|
|
14
14
|
validateParams(this.payload, [
|
|
@@ -15,7 +15,7 @@ type SuiSignTx = Omit<HardwareSuiSignTx, 'data_initial_chunk' | 'data_length'> &
|
|
|
15
15
|
export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
16
16
|
init() {
|
|
17
17
|
this.checkDeviceId = true;
|
|
18
|
-
this.
|
|
18
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
19
19
|
|
|
20
20
|
// check payload
|
|
21
21
|
validateParams(this.payload, [
|
|
@@ -3,9 +3,9 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
3
3
|
|
|
4
4
|
export default class TestInitializeDeviceDuration extends BaseMethod {
|
|
5
5
|
init() {
|
|
6
|
-
this.
|
|
7
|
-
...this.
|
|
8
|
-
UI_REQUEST.
|
|
6
|
+
this.allowDeviceMode = [
|
|
7
|
+
...this.allowDeviceMode,
|
|
8
|
+
UI_REQUEST.NOT_INITIALIZE,
|
|
9
9
|
UI_REQUEST.BOOTLOADER,
|
|
10
10
|
];
|
|
11
11
|
this.useDevicePassphraseState = false;
|
|
@@ -14,7 +14,7 @@ export default class TonGetAddress extends BaseMethod<HardwareTonGetAddress[]> {
|
|
|
14
14
|
init() {
|
|
15
15
|
this.strictCheckDeviceSupport = true;
|
|
16
16
|
this.checkDeviceId = true;
|
|
17
|
-
this.
|
|
17
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
18
18
|
|
|
19
19
|
this.hasBundle = !!this.payload?.bundle;
|
|
20
20
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -22,7 +22,7 @@ export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
|
|
|
22
22
|
init() {
|
|
23
23
|
this.strictCheckDeviceSupport = true;
|
|
24
24
|
this.checkDeviceId = true;
|
|
25
|
-
this.
|
|
25
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
26
26
|
|
|
27
27
|
// init params
|
|
28
28
|
validateParams(this.payload, [
|
|
@@ -10,7 +10,7 @@ export default class TonSignProof extends BaseMethod<HardwareTonSignProof> {
|
|
|
10
10
|
init() {
|
|
11
11
|
this.strictCheckDeviceSupport = true;
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
// init params
|
|
16
16
|
validateParams(this.payload, [
|
|
@@ -10,7 +10,7 @@ export default class TronGetAddress extends BaseMethod<HardwareTronGetAddress[]>
|
|
|
10
10
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
|
-
this.
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
14
|
|
|
15
15
|
this.hasBundle = !!this.payload?.bundle;
|
|
16
16
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -8,7 +8,7 @@ import { stripHexPrefix } from '../helpers/hexUtils';
|
|
|
8
8
|
export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage> {
|
|
9
9
|
init() {
|
|
10
10
|
this.checkDeviceId = true;
|
|
11
|
-
this.
|
|
11
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
12
12
|
|
|
13
13
|
// check payload
|
|
14
14
|
validateParams(this.payload, [
|
|
@@ -119,7 +119,7 @@ export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
|
119
119
|
|
|
120
120
|
init() {
|
|
121
121
|
this.checkDeviceId = true;
|
|
122
|
-
this.
|
|
122
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
123
123
|
|
|
124
124
|
// check payload
|
|
125
125
|
validateParams(this.payload, [
|
|
@@ -19,7 +19,7 @@ export default class XrpGetAddress extends BaseMethod<
|
|
|
19
19
|
|
|
20
20
|
init() {
|
|
21
21
|
this.checkDeviceId = true;
|
|
22
|
-
this.
|
|
22
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
23
23
|
|
|
24
24
|
this.hasBundle = !!this.payload?.bundle;
|
|
25
25
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
@@ -9,7 +9,7 @@ export default class XrpGetAddress extends BaseMethod<XrpSignTransactionParams>
|
|
|
9
9
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
|
-
this.
|
|
12
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
13
|
|
|
14
14
|
const { payload } = this;
|
|
15
15
|
validateParams(payload, [
|
package/src/core/index.ts
CHANGED