@trezor/connect 9.2.3 → 9.2.4-beta.2
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/CHANGELOG.md +77 -5
- package/README.md +1 -1
- package/lib/api/applyFlags.d.ts +8 -1
- package/lib/api/applyFlags.js +3 -8
- package/lib/api/applySettings.d.ts +8 -1
- package/lib/api/applySettings.js +3 -8
- package/lib/api/backupDevice.d.ts +10 -2
- package/lib/api/backupDevice.js +12 -9
- package/lib/api/binance/api/binanceGetAddress.d.ts +4 -3
- package/lib/api/binance/api/binanceGetAddress.js +8 -22
- package/lib/api/binance/api/binanceGetPublicKey.d.ts +4 -2
- package/lib/api/binance/api/binanceGetPublicKey.js +6 -18
- package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -1
- package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -1
- package/lib/api/cardano/api/cardanoGetAddress.d.ts +4 -4
- package/lib/api/cardano/api/cardanoGetAddress.js +9 -39
- package/lib/api/cardano/api/cardanoGetPublicKey.d.ts +4 -3
- package/lib/api/cardano/api/cardanoGetPublicKey.js +9 -31
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +1 -13
- package/lib/api/cardano/api/cardanoSignTransaction.js +2 -75
- package/lib/api/cardano/cardanoAddressParameters.d.ts +1 -2
- package/lib/api/cardano/cardanoAddressParameters.js +4 -10
- package/lib/api/cardano/cardanoAuxiliaryData.d.ts +1 -2
- package/lib/api/cardano/cardanoAuxiliaryData.js +2 -2
- package/lib/api/changeLanguage.d.ts +8 -1
- package/lib/api/changeLanguage.js +3 -7
- package/lib/api/eos/api/eosGetPublicKey.d.ts +4 -2
- package/lib/api/eos/api/eosGetPublicKey.js +6 -18
- package/lib/api/ethereum/api/ethereumGetAddress.d.ts +4 -3
- package/lib/api/ethereum/api/ethereumGetAddress.js +4 -20
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +4 -2
- package/lib/api/ethereum/api/ethereumGetPublicKey.js +3 -10
- package/lib/api/firmware/index.d.ts +2 -0
- package/lib/api/firmware/index.js +5 -1
- package/lib/api/firmware/parseFirmwareHeaders.d.ts +5 -0
- package/lib/api/firmware/parseFirmwareHeaders.js +35 -0
- package/lib/api/firmware/uploadFirmware.d.ts +1 -1
- package/lib/api/firmware/uploadFirmware.js +9 -1
- package/lib/api/getAccountDescriptor.d.ts +5 -3
- package/lib/api/getAccountDescriptor.js +8 -21
- package/lib/api/getAccountInfo.d.ts +23 -7
- package/lib/api/getAccountInfo.js +12 -25
- package/lib/api/getAddress.d.ts +4 -3
- package/lib/api/getAddress.js +8 -22
- package/lib/api/getFeatures.d.ts +1 -0
- package/lib/api/getOwnershipId.d.ts +4 -2
- package/lib/api/getOwnershipId.js +4 -15
- package/lib/api/getOwnershipProof.d.ts +4 -2
- package/lib/api/getOwnershipProof.js +4 -15
- package/lib/api/getPublicKey.d.ts +5 -4
- package/lib/api/getPublicKey.js +12 -35
- package/lib/api/index.d.ts +0 -1
- package/lib/api/index.js +1 -3
- package/lib/api/nem/api/nemGetAddress.d.ts +4 -3
- package/lib/api/nem/api/nemGetAddress.js +4 -20
- package/lib/api/rebootToBootloader.d.ts +8 -2
- package/lib/api/rebootToBootloader.js +3 -10
- package/lib/api/recoveryDevice.d.ts +8 -1
- package/lib/api/recoveryDevice.js +3 -7
- package/lib/api/resetDevice.d.ts +4 -2
- package/lib/api/resetDevice.js +3 -10
- package/lib/api/ripple/api/rippleGetAddress.d.ts +4 -3
- package/lib/api/ripple/api/rippleGetAddress.js +4 -20
- package/lib/api/solana/api/solanaGetAddress.d.ts +4 -3
- package/lib/api/solana/api/solanaGetAddress.js +7 -28
- package/lib/api/solana/api/solanaGetPublicKey.d.ts +4 -3
- package/lib/api/solana/api/solanaGetPublicKey.js +7 -27
- package/lib/api/stellar/api/stellarGetAddress.d.ts +4 -3
- package/lib/api/stellar/api/stellarGetAddress.js +4 -20
- package/lib/api/tezos/api/tezosGetAddress.d.ts +4 -3
- package/lib/api/tezos/api/tezosGetAddress.js +4 -20
- package/lib/api/tezos/api/tezosGetPublicKey.d.ts +4 -2
- package/lib/api/tezos/api/tezosGetPublicKey.js +6 -18
- package/lib/api/wipeDevice.d.ts +8 -2
- package/lib/api/wipeDevice.js +3 -10
- package/lib/backend/Blockchain.d.ts +2 -2
- package/lib/constants/errors.d.ts +1 -0
- package/lib/constants/errors.js +1 -0
- package/lib/core/AbstractMethod.d.ts +4 -8
- package/lib/core/AbstractMethod.js +6 -28
- package/lib/core/index.d.ts +2 -1
- package/lib/core/index.js +258 -226
- package/lib/core/onCallFirmwareUpdate.d.ts +31 -0
- package/lib/core/onCallFirmwareUpdate.js +266 -0
- package/lib/data/DataManager.d.ts +10 -0
- package/lib/data/analyticsInfo.d.ts +2 -2
- package/lib/data/analyticsInfo.js +6 -7
- package/lib/data/config.d.ts +10 -0
- package/lib/data/config.js +15 -5
- package/lib/data/deviceAuthenticityConfig.js +8 -4
- package/lib/data/firmwareInfo.js +1 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +5 -2
- package/lib/device/Device.d.ts +2 -2
- package/lib/device/Device.js +4 -4
- package/lib/device/DeviceCommands.d.ts +4 -16
- package/lib/device/DeviceCommands.js +10 -72
- package/lib/device/DeviceList.d.ts +7 -4
- package/lib/device/DeviceList.js +46 -40
- package/lib/events/blockchain.d.ts +2 -2
- package/lib/events/index.d.ts +1 -0
- package/lib/events/ui-request.d.ts +13 -1
- package/lib/events/ui-request.js +1 -0
- package/lib/index.js +2 -2
- package/lib/types/api/backupDevice.d.ts +2 -2
- package/lib/types/api/dispose.d.ts +1 -1
- package/lib/types/api/firmwareUpdate.d.ts +7 -6
- package/lib/types/api/firmwareUpdate.js +1 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/types/settings.d.ts +1 -1
- package/lib/utils/popupPromiseManager.d.ts +8 -0
- package/lib/utils/popupPromiseManager.js +21 -0
- package/lib/utils/uiPromiseManager.d.ts +38 -0
- package/lib/utils/uiPromiseManager.js +47 -0
- package/lib/workers/workers-browser.d.ts +3 -1
- package/lib/workers/workers-browser.js +2 -2
- package/package.json +9 -9
- package/lib/api/firmwareUpdate.d.ts +0 -19
- package/lib/api/firmwareUpdate.js +0 -78
|
@@ -14,19 +14,7 @@ const cardano_1 = require("../../../types/api/cardano");
|
|
|
14
14
|
const cardanoWitnesses_1 = require("../cardanoWitnesses");
|
|
15
15
|
const cardanoTokenBundle_1 = require("../cardanoTokenBundle");
|
|
16
16
|
const schema_utils_1 = require("@trezor/schema-utils");
|
|
17
|
-
const CardanoSignTransactionFeatures = Object.freeze({
|
|
18
|
-
TransactionStreaming: ['0', '2.4.2'],
|
|
19
|
-
TokenMinting: ['0', '2.4.3'],
|
|
20
|
-
Multisig: ['0', '2.4.3'],
|
|
21
|
-
NetworkIdInTxBody: ['0', '2.4.4'],
|
|
22
|
-
OutputDatumHash: ['0', '2.4.4'],
|
|
23
|
-
ScriptDataHash: ['0', '2.4.4'],
|
|
24
|
-
Plutus: ['0', '2.4.4'],
|
|
25
|
-
KeyHashStakeCredential: ['0', '2.4.4'],
|
|
26
|
-
Babbage: ['0', '2.5.2'],
|
|
27
|
-
CIP36Registration: ['0', '2.5.3'],
|
|
28
|
-
CIP36RegistrationExternalPaymentAddress: ['0', '2.5.4'],
|
|
29
|
-
});
|
|
17
|
+
const CardanoSignTransactionFeatures = Object.freeze({});
|
|
30
18
|
class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
31
19
|
init() {
|
|
32
20
|
this.requiredPermissions = ['read', 'write'];
|
|
@@ -138,67 +126,6 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
138
126
|
}
|
|
139
127
|
}
|
|
140
128
|
_ensureFirmwareSupportsParams() {
|
|
141
|
-
var _a;
|
|
142
|
-
const { params } = this;
|
|
143
|
-
this._ensureFeatureIsSupported('TransactionStreaming');
|
|
144
|
-
params.certificatesWithPoolOwnersAndRelays.forEach(({ certificate }) => {
|
|
145
|
-
if (certificate.key_hash) {
|
|
146
|
-
this._ensureFeatureIsSupported('KeyHashStakeCredential');
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
params.outputsWithData.forEach(({ output }) => {
|
|
150
|
-
if (output.datum_hash) {
|
|
151
|
-
this._ensureFeatureIsSupported('OutputDatumHash');
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
params.withdrawals.forEach(withdrawal => {
|
|
155
|
-
if (withdrawal.key_hash) {
|
|
156
|
-
this._ensureFeatureIsSupported('KeyHashStakeCredential');
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
if (params.mint.length > 0) {
|
|
160
|
-
this._ensureFeatureIsSupported('TokenMinting');
|
|
161
|
-
}
|
|
162
|
-
if (params.additionalWitnessRequests.length > 0 ||
|
|
163
|
-
params.signingMode === constants_1.PROTO.CardanoTxSigningMode.MULTISIG_TRANSACTION) {
|
|
164
|
-
this._ensureFeatureIsSupported('Multisig');
|
|
165
|
-
}
|
|
166
|
-
if (params.includeNetworkId) {
|
|
167
|
-
this._ensureFeatureIsSupported('NetworkIdInTxBody');
|
|
168
|
-
}
|
|
169
|
-
if (params.scriptDataHash) {
|
|
170
|
-
this._ensureFeatureIsSupported('ScriptDataHash');
|
|
171
|
-
}
|
|
172
|
-
if (params.signingMode === constants_1.PROTO.CardanoTxSigningMode.PLUTUS_TRANSACTION) {
|
|
173
|
-
this._ensureFeatureIsSupported('Plutus');
|
|
174
|
-
}
|
|
175
|
-
params.outputsWithData.forEach(({ output, inlineDatum, referenceScript }) => {
|
|
176
|
-
if (output.format === constants_1.PROTO.CardanoTxOutputSerializationFormat.MAP_BABBAGE ||
|
|
177
|
-
inlineDatum ||
|
|
178
|
-
referenceScript) {
|
|
179
|
-
this._ensureFeatureIsSupported('Babbage');
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
if (params.collateralReturnWithData ||
|
|
183
|
-
params.totalCollateral != null ||
|
|
184
|
-
params.referenceInputs.length > 0) {
|
|
185
|
-
this._ensureFeatureIsSupported('Babbage');
|
|
186
|
-
}
|
|
187
|
-
if (params.requiredSigners.length > 0 &&
|
|
188
|
-
params.signingMode !== constants_1.PROTO.CardanoTxSigningMode.PLUTUS_TRANSACTION) {
|
|
189
|
-
this._ensureFeatureIsSupported('Babbage');
|
|
190
|
-
}
|
|
191
|
-
if ((_a = params.auxiliaryData) === null || _a === void 0 ? void 0 : _a.cvote_registration_parameters) {
|
|
192
|
-
const { format, delegations, voting_purpose, payment_address } = params.auxiliaryData.cvote_registration_parameters;
|
|
193
|
-
if (format === constants_1.PROTO.CardanoCVoteRegistrationFormat.CIP36 ||
|
|
194
|
-
(delegations === null || delegations === void 0 ? void 0 : delegations.length) ||
|
|
195
|
-
voting_purpose != null) {
|
|
196
|
-
this._ensureFeatureIsSupported('CIP36Registration');
|
|
197
|
-
}
|
|
198
|
-
if (payment_address) {
|
|
199
|
-
this._ensureFeatureIsSupported('CIP36RegistrationExternalPaymentAddress');
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
129
|
}
|
|
203
130
|
async _sign_tx() {
|
|
204
131
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
@@ -251,7 +178,7 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
251
178
|
if (this.params.auxiliaryData) {
|
|
252
179
|
const { cvote_registration_parameters } = this.params.auxiliaryData;
|
|
253
180
|
if (cvote_registration_parameters) {
|
|
254
|
-
this.params.auxiliaryData = (0, cardanoAuxiliaryData_1.modifyAuxiliaryDataForBackwardsCompatibility)(this.
|
|
181
|
+
this.params.auxiliaryData = (0, cardanoAuxiliaryData_1.modifyAuxiliaryDataForBackwardsCompatibility)(this.params.auxiliaryData);
|
|
255
182
|
}
|
|
256
183
|
const { message } = await typedCall('CardanoTxAuxiliaryData', 'CardanoTxAuxiliaryDataSupplement', this.params.auxiliaryData);
|
|
257
184
|
const auxiliaryDataType = constants_1.PROTO.CardanoTxAuxiliaryDataSupplementType[message.type];
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { PROTO } from '../../constants';
|
|
2
|
-
import type { Device } from '../../device/Device';
|
|
3
2
|
import { CardanoAddressParameters } from '../../types/api/cardano';
|
|
4
3
|
export declare const validateAddressParameters: (addressParameters: CardanoAddressParameters) => void;
|
|
5
|
-
export declare const modifyAddressParametersForBackwardsCompatibility: (
|
|
4
|
+
export declare const modifyAddressParametersForBackwardsCompatibility: (address_parameters: PROTO.CardanoAddressParametersType) => PROTO.CardanoAddressParametersType;
|
|
6
5
|
export declare const addressParametersToProto: (addressParameters: CardanoAddressParameters) => PROTO.CardanoAddressParametersType;
|
|
7
6
|
export declare const addressParametersFromProto: (addressParameters: PROTO.CardanoAddressParametersType) => CardanoAddressParameters;
|
|
8
7
|
//# sourceMappingURL=cardanoAddressParameters.d.ts.map
|
|
@@ -15,21 +15,15 @@ const validateAddressParameters = (addressParameters) => {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
exports.validateAddressParameters = validateAddressParameters;
|
|
18
|
-
const modifyAddressParametersForBackwardsCompatibility = (
|
|
18
|
+
const modifyAddressParametersForBackwardsCompatibility = (address_parameters) => {
|
|
19
19
|
if (address_parameters.address_type === constants_1.PROTO.CardanoAddressType.REWARD) {
|
|
20
20
|
let { address_n, address_n_staking } = address_parameters;
|
|
21
21
|
if (address_n.length > 0 && address_n_staking.length > 0) {
|
|
22
22
|
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', `Only stakingPath is allowed for CardanoAddressType.REWARD`);
|
|
23
23
|
}
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
address_n = [];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else if (address_n_staking.length > 0) {
|
|
31
|
-
address_n = address_n_staking;
|
|
32
|
-
address_n_staking = [];
|
|
24
|
+
if (address_n.length > 0) {
|
|
25
|
+
address_n_staking = address_n;
|
|
26
|
+
address_n = [];
|
|
33
27
|
}
|
|
34
28
|
return {
|
|
35
29
|
...address_parameters,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Device } from '../../device/Device';
|
|
2
1
|
import { PROTO } from '../../constants';
|
|
3
2
|
import { CardanoAuxiliaryData } from '../../types/api/cardano';
|
|
4
3
|
export declare const transformAuxiliaryData: (auxiliaryData: CardanoAuxiliaryData) => PROTO.CardanoTxAuxiliaryData;
|
|
5
|
-
export declare const modifyAuxiliaryDataForBackwardsCompatibility: (
|
|
4
|
+
export declare const modifyAuxiliaryDataForBackwardsCompatibility: (auxiliary_data: PROTO.CardanoTxAuxiliaryData) => PROTO.CardanoTxAuxiliaryData;
|
|
6
5
|
//# sourceMappingURL=cardanoAuxiliaryData.d.ts.map
|
|
@@ -62,11 +62,11 @@ const transformAuxiliaryData = (auxiliaryData) => {
|
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
64
|
exports.transformAuxiliaryData = transformAuxiliaryData;
|
|
65
|
-
const modifyAuxiliaryDataForBackwardsCompatibility = (
|
|
65
|
+
const modifyAuxiliaryDataForBackwardsCompatibility = (auxiliary_data) => {
|
|
66
66
|
const { cvote_registration_parameters } = auxiliary_data;
|
|
67
67
|
if (cvote_registration_parameters === null || cvote_registration_parameters === void 0 ? void 0 : cvote_registration_parameters.payment_address_parameters) {
|
|
68
68
|
cvote_registration_parameters.payment_address_parameters =
|
|
69
|
-
(0, cardanoAddressParameters_1.modifyAddressParametersForBackwardsCompatibility)(
|
|
69
|
+
(0, cardanoAddressParameters_1.modifyAddressParametersForBackwardsCompatibility)(cvote_registration_parameters.payment_address_parameters);
|
|
70
70
|
return {
|
|
71
71
|
...auxiliary_data,
|
|
72
72
|
cvote_registration_parameters,
|
|
@@ -2,7 +2,14 @@ import { AbstractMethod } from '../core/AbstractMethod';
|
|
|
2
2
|
import { ChangeLanguage as ChangeLanguageSchema } from '../types/api/changeLanguage';
|
|
3
3
|
export default class ChangeLanguage extends AbstractMethod<'changeLanguage', ChangeLanguageSchema> {
|
|
4
4
|
init(): void;
|
|
5
|
-
confirmation():
|
|
5
|
+
get confirmation(): {
|
|
6
|
+
view: "device-management";
|
|
7
|
+
customConfirmButton: {
|
|
8
|
+
className: string;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
label: string;
|
|
12
|
+
};
|
|
6
13
|
run(): Promise<{
|
|
7
14
|
message: string;
|
|
8
15
|
}>;
|
|
@@ -14,19 +14,15 @@ class ChangeLanguage extends AbstractMethod_1.AbstractMethod {
|
|
|
14
14
|
(0, schema_utils_1.Assert)(changeLanguage_1.ChangeLanguage, payload);
|
|
15
15
|
this.params = payload;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
20
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
17
|
+
get confirmation() {
|
|
18
|
+
return {
|
|
21
19
|
view: 'device-management',
|
|
22
20
|
customConfirmButton: {
|
|
23
21
|
className: 'confirm',
|
|
24
22
|
label: 'Proceed',
|
|
25
23
|
},
|
|
26
24
|
label: 'Do you want to change language?',
|
|
27
|
-
}
|
|
28
|
-
const uiResp = await uiPromise.promise;
|
|
29
|
-
return uiResp.payload;
|
|
25
|
+
};
|
|
30
26
|
}
|
|
31
27
|
run() {
|
|
32
28
|
const { language, binary } = this.params;
|
|
@@ -2,10 +2,12 @@ import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
|
2
2
|
import type { PROTO } from '../../../constants';
|
|
3
3
|
export default class EosGetPublicKey extends AbstractMethod<'eosGetPublicKey', PROTO.EosGetPublicKey[]> {
|
|
4
4
|
hasBundle?: boolean;
|
|
5
|
-
confirmed?: boolean;
|
|
6
5
|
init(): void;
|
|
7
6
|
get info(): string;
|
|
8
|
-
confirmation():
|
|
7
|
+
get confirmation(): {
|
|
8
|
+
view: "export-address";
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
9
11
|
run(): Promise<{
|
|
10
12
|
path: number[];
|
|
11
13
|
serializedPath: string;
|
|
@@ -28,25 +28,13 @@ class EosGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
|
28
28
|
get info() {
|
|
29
29
|
return 'Export Eos public key';
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return true;
|
|
34
|
-
await this.getPopupPromise().promise;
|
|
35
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
36
|
-
let label;
|
|
37
|
-
if (this.params.length > 1) {
|
|
38
|
-
label = 'Export multiple Eos public keys';
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
label = `Export Eos public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
|
|
42
|
-
}
|
|
43
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
31
|
+
get confirmation() {
|
|
32
|
+
return {
|
|
44
33
|
view: 'export-address',
|
|
45
|
-
label
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return this.confirmed;
|
|
34
|
+
label: this.params.length > 1
|
|
35
|
+
? 'Export multiple Eos public keys'
|
|
36
|
+
: `Export Eos public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`,
|
|
37
|
+
};
|
|
50
38
|
}
|
|
51
39
|
async run() {
|
|
52
40
|
const responses = [];
|
|
@@ -9,7 +9,6 @@ type Params = PROTO.EthereumGetAddress & {
|
|
|
9
9
|
export default class EthereumGetAddress extends AbstractMethod<'ethereumGetAddress', Params[]> {
|
|
10
10
|
hasBundle?: boolean;
|
|
11
11
|
progress: number;
|
|
12
|
-
confirmed?: boolean;
|
|
13
12
|
init(): void;
|
|
14
13
|
initAsync(): Promise<void>;
|
|
15
14
|
get info(): string;
|
|
@@ -18,8 +17,10 @@ export default class EthereumGetAddress extends AbstractMethod<'ethereumGetAddre
|
|
|
18
17
|
serializedPath: string;
|
|
19
18
|
address: string;
|
|
20
19
|
} | undefined;
|
|
21
|
-
confirmation():
|
|
22
|
-
|
|
20
|
+
get confirmation(): {
|
|
21
|
+
view: "export-address";
|
|
22
|
+
label: string;
|
|
23
|
+
};
|
|
23
24
|
_call({ address_n, show_display, encoded_network, chunkify }: Params): Promise<{
|
|
24
25
|
path: number[];
|
|
25
26
|
serializedPath: string;
|
|
@@ -18,6 +18,7 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
18
18
|
this.progress = 0;
|
|
19
19
|
}
|
|
20
20
|
init() {
|
|
21
|
+
this.noBackupConfirmationMode = 'always';
|
|
21
22
|
this.requiredPermissions = ['read'];
|
|
22
23
|
this.hasBundle = !!this.payload.bundle;
|
|
23
24
|
const payload = !this.payload.bundle
|
|
@@ -40,7 +41,6 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
40
41
|
this.params.length === 1 &&
|
|
41
42
|
typeof this.params[0].address === 'string' &&
|
|
42
43
|
this.params[0].show_display;
|
|
43
|
-
this.confirmed = useEventListener;
|
|
44
44
|
this.useUi = !useEventListener;
|
|
45
45
|
}
|
|
46
46
|
async initAsync() {
|
|
@@ -80,27 +80,11 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return true;
|
|
86
|
-
await this.getPopupPromise().promise;
|
|
87
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
88
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
83
|
+
get confirmation() {
|
|
84
|
+
return {
|
|
89
85
|
view: 'export-address',
|
|
90
86
|
label: this.info,
|
|
91
|
-
}
|
|
92
|
-
const uiResp = await uiPromise.promise;
|
|
93
|
-
this.confirmed = uiResp.payload;
|
|
94
|
-
return this.confirmed;
|
|
95
|
-
}
|
|
96
|
-
async noBackupConfirmation() {
|
|
97
|
-
await this.getPopupPromise().promise;
|
|
98
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
99
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
100
|
-
view: 'no-backup',
|
|
101
|
-
}));
|
|
102
|
-
const uiResp = await uiPromise.promise;
|
|
103
|
-
return uiResp.payload;
|
|
87
|
+
};
|
|
104
88
|
}
|
|
105
89
|
_call({ address_n, show_display, encoded_network, chunkify }) {
|
|
106
90
|
const cmd = this.device.getCommands();
|
|
@@ -6,10 +6,12 @@ type Params = PROTO.EthereumGetPublicKey & {
|
|
|
6
6
|
};
|
|
7
7
|
export default class EthereumGetPublicKey extends AbstractMethod<'ethereumGetPublicKey', Params[]> {
|
|
8
8
|
hasBundle?: boolean;
|
|
9
|
-
confirmed?: boolean;
|
|
10
9
|
init(): void;
|
|
11
10
|
get info(): string;
|
|
12
|
-
confirmation():
|
|
11
|
+
get confirmation(): {
|
|
12
|
+
view: "export-xpub";
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
13
15
|
run(): Promise<{
|
|
14
16
|
xpubSegwit?: string | undefined;
|
|
15
17
|
descriptorChecksum?: string | undefined;
|
|
@@ -38,18 +38,11 @@ class EthereumGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
|
38
38
|
}
|
|
39
39
|
return 'Export multiple public keys';
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return true;
|
|
44
|
-
await this.getPopupPromise().promise;
|
|
45
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
46
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
41
|
+
get confirmation() {
|
|
42
|
+
return {
|
|
47
43
|
view: 'export-xpub',
|
|
48
44
|
label: this.info,
|
|
49
|
-
}
|
|
50
|
-
const uiResp = await uiPromise.promise;
|
|
51
|
-
this.confirmed = uiResp.payload;
|
|
52
|
-
return this.confirmed;
|
|
45
|
+
};
|
|
53
46
|
}
|
|
54
47
|
async run() {
|
|
55
48
|
const responses = [];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { getBinary } from './getBinary';
|
|
2
|
+
export { getLanguage } from '../../data/getLanguage';
|
|
2
3
|
export { shouldStripFwHeaders, stripFwHeaders } from './modifyFirmware';
|
|
3
4
|
export { uploadFirmware } from './uploadFirmware';
|
|
4
5
|
export { calculateFirmwareHash } from './calculateFirmwareHash';
|
|
6
|
+
export { parseFirmwareHeaders } from './parseFirmwareHeaders';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateFirmwareHash = exports.uploadFirmware = exports.stripFwHeaders = exports.shouldStripFwHeaders = exports.getBinary = void 0;
|
|
3
|
+
exports.parseFirmwareHeaders = exports.calculateFirmwareHash = exports.uploadFirmware = exports.stripFwHeaders = exports.shouldStripFwHeaders = exports.getLanguage = exports.getBinary = void 0;
|
|
4
4
|
var getBinary_1 = require("./getBinary");
|
|
5
5
|
Object.defineProperty(exports, "getBinary", { enumerable: true, get: function () { return getBinary_1.getBinary; } });
|
|
6
|
+
var getLanguage_1 = require("../../data/getLanguage");
|
|
7
|
+
Object.defineProperty(exports, "getLanguage", { enumerable: true, get: function () { return getLanguage_1.getLanguage; } });
|
|
6
8
|
var modifyFirmware_1 = require("./modifyFirmware");
|
|
7
9
|
Object.defineProperty(exports, "shouldStripFwHeaders", { enumerable: true, get: function () { return modifyFirmware_1.shouldStripFwHeaders; } });
|
|
8
10
|
Object.defineProperty(exports, "stripFwHeaders", { enumerable: true, get: function () { return modifyFirmware_1.stripFwHeaders; } });
|
|
@@ -10,4 +12,6 @@ var uploadFirmware_1 = require("./uploadFirmware");
|
|
|
10
12
|
Object.defineProperty(exports, "uploadFirmware", { enumerable: true, get: function () { return uploadFirmware_1.uploadFirmware; } });
|
|
11
13
|
var calculateFirmwareHash_1 = require("./calculateFirmwareHash");
|
|
12
14
|
Object.defineProperty(exports, "calculateFirmwareHash", { enumerable: true, get: function () { return calculateFirmwareHash_1.calculateFirmwareHash; } });
|
|
15
|
+
var parseFirmwareHeaders_1 = require("./parseFirmwareHeaders");
|
|
16
|
+
Object.defineProperty(exports, "parseFirmwareHeaders", { enumerable: true, get: function () { return parseFirmwareHeaders_1.parseFirmwareHeaders; } });
|
|
13
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseFirmwareHeaders = void 0;
|
|
4
|
+
const parseFirmwareHeaders = (buff) => {
|
|
5
|
+
const vendorHeader = buff.subarray(0, 4).toString('utf8');
|
|
6
|
+
let trezorImageHeader = '';
|
|
7
|
+
let restbuff;
|
|
8
|
+
if (vendorHeader === 'TRZV') {
|
|
9
|
+
const vendorHeaderLength = buff.readUInt32LE(4);
|
|
10
|
+
trezorImageHeader = buff
|
|
11
|
+
.subarray(vendorHeaderLength, vendorHeaderLength + 4)
|
|
12
|
+
.toString('utf8');
|
|
13
|
+
restbuff = buff.subarray(vendorHeaderLength + 4);
|
|
14
|
+
}
|
|
15
|
+
else if (vendorHeader === 'TRZR') {
|
|
16
|
+
restbuff = buff.subarray(256 + 4);
|
|
17
|
+
trezorImageHeader = buff.subarray(256, 256 + 4).toString('utf8');
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
restbuff = buff.subarray(4);
|
|
21
|
+
trezorImageHeader = buff.subarray(0, 4).toString('utf8');
|
|
22
|
+
}
|
|
23
|
+
if (trezorImageHeader !== 'TRZF') {
|
|
24
|
+
throw new Error(`unexpected header ${vendorHeader}`);
|
|
25
|
+
}
|
|
26
|
+
const version_major = restbuff.readInt8(12);
|
|
27
|
+
const version_minor = restbuff.readInt8(13);
|
|
28
|
+
const version_patch = restbuff.readInt8(14);
|
|
29
|
+
const version = [version_major, version_minor, version_patch];
|
|
30
|
+
return {
|
|
31
|
+
version,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
exports.parseFirmwareHeaders = parseFirmwareHeaders;
|
|
35
|
+
//# sourceMappingURL=parseFirmwareHeaders.js.map
|
|
@@ -2,7 +2,7 @@ import { CoreEventMessage } from '../../events';
|
|
|
2
2
|
import { PROTO } from '../../constants';
|
|
3
3
|
import type { Device } from '../../device/Device';
|
|
4
4
|
import type { TypedCall } from '../../device/DeviceCommands';
|
|
5
|
-
export declare const uploadFirmware: (typedCall: TypedCall, postMessage: (message: CoreEventMessage) => void, device: Device, { payload }: PROTO.FirmwareUpload) => Promise<{
|
|
5
|
+
export declare const uploadFirmware: (typedCall: TypedCall, postMessage: (message: CoreEventMessage) => void, device: Device, { payload }: PROTO.FirmwareUpload) => Promise<import("../../device/DeviceCommands").TypedResponseMessage<"Success"> | {
|
|
6
6
|
message: string;
|
|
7
7
|
}>;
|
|
8
8
|
//# sourceMappingURL=uploadFirmware.d.ts.map
|
|
@@ -11,6 +11,7 @@ const postConfirmationMessage = (device) => {
|
|
|
11
11
|
const postProgressMessage = (device, progress, postMessage) => {
|
|
12
12
|
postMessage((0, events_1.createUiMessage)(events_1.UI.FIRMWARE_PROGRESS, {
|
|
13
13
|
device: device.toMessageObject(),
|
|
14
|
+
operation: 'flashing',
|
|
14
15
|
progress,
|
|
15
16
|
}));
|
|
16
17
|
};
|
|
@@ -19,8 +20,15 @@ const uploadFirmware = async (typedCall, postMessage, device, { payload }) => {
|
|
|
19
20
|
postConfirmationMessage(device);
|
|
20
21
|
await typedCall('FirmwareErase', 'Success', {});
|
|
21
22
|
postProgressMessage(device, 0, postMessage);
|
|
22
|
-
|
|
23
|
+
let i = 0;
|
|
24
|
+
const progressTimer = setInterval(() => {
|
|
25
|
+
i++;
|
|
26
|
+
postProgressMessage(device, Math.min(i * 2, 99), postMessage);
|
|
27
|
+
}, 300);
|
|
28
|
+
const message = await typedCall('FirmwareUpload', 'Success', {
|
|
23
29
|
payload,
|
|
30
|
+
}).finally(() => {
|
|
31
|
+
clearInterval(progressTimer);
|
|
24
32
|
});
|
|
25
33
|
postProgressMessage(device, 100, postMessage);
|
|
26
34
|
return message;
|
|
@@ -10,9 +10,11 @@ export default class GetAccountDescriptor extends AbstractMethod<'getAccountDesc
|
|
|
10
10
|
hasBundle?: boolean;
|
|
11
11
|
init(): void;
|
|
12
12
|
get info(): string;
|
|
13
|
-
confirmation():
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
get confirmation(): {
|
|
14
|
+
view: "export-account-info";
|
|
15
|
+
label: string;
|
|
16
|
+
};
|
|
17
|
+
checkFirmwareRange(): undefined;
|
|
16
18
|
run(): Promise<GetAccountDescriptorResponse | (GetAccountDescriptorResponse | null)[]>;
|
|
17
19
|
dispose(): void;
|
|
18
20
|
}
|
|
@@ -37,13 +37,14 @@ class GetAccountDescriptor extends AbstractMethod_1.AbstractMethod {
|
|
|
37
37
|
coinInfo,
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
|
+
this.noBackupConfirmationMode = this.params.every(batch => batch.suppressBackupWarning)
|
|
41
|
+
? 'popup-only'
|
|
42
|
+
: 'always';
|
|
40
43
|
}
|
|
41
44
|
get info() {
|
|
42
45
|
return 'Export account descriptor';
|
|
43
46
|
}
|
|
44
|
-
|
|
45
|
-
await this.getPopupPromise().promise;
|
|
46
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
47
|
+
get confirmation() {
|
|
47
48
|
const keys = {};
|
|
48
49
|
this.params.forEach(b => {
|
|
49
50
|
if (!keys[b.coinInfo.label]) {
|
|
@@ -70,30 +71,16 @@ class GetAccountDescriptor extends AbstractMethod_1.AbstractMethod {
|
|
|
70
71
|
str.push('</span>');
|
|
71
72
|
});
|
|
72
73
|
});
|
|
73
|
-
|
|
74
|
+
return {
|
|
74
75
|
view: 'export-account-info',
|
|
75
76
|
label: `Export descriptor for: ${str.join('')}`,
|
|
76
|
-
}
|
|
77
|
-
const uiResp = await uiPromise.promise;
|
|
78
|
-
return uiResp.payload;
|
|
79
|
-
}
|
|
80
|
-
async noBackupConfirmation(allowSuppression) {
|
|
81
|
-
if (allowSuppression && this.params.every(batch => batch.suppressBackupWarning)) {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
await this.getPopupPromise().promise;
|
|
85
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
86
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
87
|
-
view: 'no-backup',
|
|
88
|
-
}));
|
|
89
|
-
const uiResp = await uiPromise.promise;
|
|
90
|
-
return uiResp.payload;
|
|
77
|
+
};
|
|
91
78
|
}
|
|
92
|
-
|
|
79
|
+
checkFirmwareRange() {
|
|
93
80
|
const invalid = [];
|
|
94
81
|
for (let i = 0; i < this.params.length; i++) {
|
|
95
82
|
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, this.params[i].coinInfo, AbstractMethod_1.DEFAULT_FIRMWARE_RANGE);
|
|
96
|
-
const exception =
|
|
83
|
+
const exception = super.checkFirmwareRange();
|
|
97
84
|
if (exception) {
|
|
98
85
|
invalid.push({
|
|
99
86
|
index: i,
|
|
@@ -12,9 +12,19 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
12
12
|
discovery?: Discovery;
|
|
13
13
|
init(): void;
|
|
14
14
|
get info(): string;
|
|
15
|
-
confirmation():
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
get confirmation(): {
|
|
16
|
+
view: "export-account-info";
|
|
17
|
+
label: string;
|
|
18
|
+
customConfirmButton: {
|
|
19
|
+
label: string;
|
|
20
|
+
className: string;
|
|
21
|
+
};
|
|
22
|
+
} | {
|
|
23
|
+
view: "export-account-info";
|
|
24
|
+
label: string;
|
|
25
|
+
customConfirmButton?: undefined;
|
|
26
|
+
};
|
|
27
|
+
checkFirmwareRange(): "ui-device_firmware_old" | "ui-device_firmware_unsupported" | "ui-device_firmware_not_compatible" | "ui-device_firmware_not_installed" | undefined;
|
|
18
28
|
run(): Promise<AccountInfo | (AccountInfo | null)[] | {
|
|
19
29
|
utxo: AccountUtxo[] | undefined;
|
|
20
30
|
descriptor: string;
|
|
@@ -33,7 +43,11 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
33
43
|
};
|
|
34
44
|
misc?: {
|
|
35
45
|
nonce?: string | undefined;
|
|
36
|
-
|
|
46
|
+
contractInfo?: import("@trezor/blockchain-link-types/lib/blockbook-api").ContractInfo | undefined;
|
|
47
|
+
stakingPools?: import("@trezor/blockchain-link-types/lib/blockbook-api").StakingPool[] | undefined;
|
|
48
|
+
addressAliases?: {
|
|
49
|
+
[key: string]: import("@trezor/blockchain-link-types/lib/blockbook-api").AddressAlias;
|
|
50
|
+
} | undefined;
|
|
37
51
|
sequence?: number | undefined;
|
|
38
52
|
reserve?: string | undefined;
|
|
39
53
|
rewards?: string | undefined;
|
|
@@ -54,7 +68,6 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
54
68
|
ledger: number;
|
|
55
69
|
seq: number;
|
|
56
70
|
} | undefined;
|
|
57
|
-
stakingPools?: import("@trezor/blockchain-link-types").StakingPool[] | undefined;
|
|
58
71
|
path: string;
|
|
59
72
|
}>;
|
|
60
73
|
discover(request: Request): Promise<{
|
|
@@ -75,7 +88,11 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
75
88
|
};
|
|
76
89
|
misc?: {
|
|
77
90
|
nonce?: string | undefined;
|
|
78
|
-
|
|
91
|
+
contractInfo?: import("@trezor/blockchain-link-types/lib/blockbook-api").ContractInfo | undefined;
|
|
92
|
+
stakingPools?: import("@trezor/blockchain-link-types/lib/blockbook-api").StakingPool[] | undefined;
|
|
93
|
+
addressAliases?: {
|
|
94
|
+
[key: string]: import("@trezor/blockchain-link-types/lib/blockbook-api").AddressAlias;
|
|
95
|
+
} | undefined;
|
|
79
96
|
sequence?: number | undefined;
|
|
80
97
|
reserve?: string | undefined;
|
|
81
98
|
rewards?: string | undefined;
|
|
@@ -96,7 +113,6 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
96
113
|
ledger: number;
|
|
97
114
|
seq: number;
|
|
98
115
|
} | undefined;
|
|
99
|
-
stakingPools?: import("@trezor/blockchain-link-types").StakingPool[] | undefined;
|
|
100
116
|
path: string;
|
|
101
117
|
}>;
|
|
102
118
|
dispose(): void;
|