@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
|
@@ -69,22 +69,23 @@ class GetAccountInfo extends AbstractMethod_1.AbstractMethod {
|
|
|
69
69
|
});
|
|
70
70
|
this.useDevice = willUseDevice;
|
|
71
71
|
this.useUi = willUseDevice;
|
|
72
|
+
this.noBackupConfirmationMode = this.params.every(batch => batch.suppressBackupWarning)
|
|
73
|
+
? 'popup-only'
|
|
74
|
+
: 'always';
|
|
72
75
|
}
|
|
73
76
|
get info() {
|
|
74
77
|
return 'Export account info';
|
|
75
78
|
}
|
|
76
|
-
|
|
77
|
-
await this.getPopupPromise().promise;
|
|
78
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
79
|
+
get confirmation() {
|
|
79
80
|
if (this.params.length === 1 && !this.params[0].path && !this.params[0].descriptor) {
|
|
80
|
-
|
|
81
|
+
return {
|
|
81
82
|
view: 'export-account-info',
|
|
82
83
|
label: `Export info for ${this.params[0].coinInfo.label} account of your selection`,
|
|
83
84
|
customConfirmButton: {
|
|
84
85
|
label: 'Proceed to account selection',
|
|
85
86
|
className: 'not-empty-css',
|
|
86
87
|
},
|
|
87
|
-
}
|
|
88
|
+
};
|
|
88
89
|
}
|
|
89
90
|
else {
|
|
90
91
|
const keys = {};
|
|
@@ -113,34 +114,20 @@ class GetAccountInfo extends AbstractMethod_1.AbstractMethod {
|
|
|
113
114
|
str.push('</span>');
|
|
114
115
|
});
|
|
115
116
|
});
|
|
116
|
-
|
|
117
|
+
return {
|
|
117
118
|
view: 'export-account-info',
|
|
118
119
|
label: `Export info for: ${str.join('')}`,
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
const uiResp = await uiPromise.promise;
|
|
122
|
-
return uiResp.payload;
|
|
123
|
-
}
|
|
124
|
-
async noBackupConfirmation(allowSuppression) {
|
|
125
|
-
if (allowSuppression && this.params.every(batch => batch.suppressBackupWarning)) {
|
|
126
|
-
return true;
|
|
120
|
+
};
|
|
127
121
|
}
|
|
128
|
-
await this.getPopupPromise().promise;
|
|
129
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
130
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
131
|
-
view: 'no-backup',
|
|
132
|
-
}));
|
|
133
|
-
const uiResp = await uiPromise.promise;
|
|
134
|
-
return uiResp.payload;
|
|
135
122
|
}
|
|
136
|
-
|
|
137
|
-
if (
|
|
138
|
-
return super.checkFirmwareRange(
|
|
123
|
+
checkFirmwareRange() {
|
|
124
|
+
if (this.params.length === 1) {
|
|
125
|
+
return super.checkFirmwareRange();
|
|
139
126
|
}
|
|
140
127
|
const invalid = [];
|
|
141
128
|
for (let i = 0; i < this.params.length; i++) {
|
|
142
129
|
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, this.params[i].coinInfo, AbstractMethod_1.DEFAULT_FIRMWARE_RANGE);
|
|
143
|
-
const exception =
|
|
130
|
+
const exception = super.checkFirmwareRange();
|
|
144
131
|
if (exception) {
|
|
145
132
|
invalid.push({
|
|
146
133
|
index: i,
|
package/lib/api/getAddress.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ type Params = PROTO.GetAddress & {
|
|
|
9
9
|
export default class GetAddress extends AbstractMethod<'getAddress', Params[]> {
|
|
10
10
|
hasBundle?: boolean;
|
|
11
11
|
progress: number;
|
|
12
|
-
confirmed?: boolean;
|
|
13
12
|
init(): void;
|
|
14
13
|
get info(): string;
|
|
15
14
|
getButtonRequestData(code: string): {
|
|
@@ -17,8 +16,10 @@ export default class GetAddress extends AbstractMethod<'getAddress', Params[]> {
|
|
|
17
16
|
serializedPath: string;
|
|
18
17
|
address: string;
|
|
19
18
|
} | undefined;
|
|
20
|
-
confirmation():
|
|
21
|
-
|
|
19
|
+
get confirmation(): {
|
|
20
|
+
view: "export-address";
|
|
21
|
+
label: string;
|
|
22
|
+
} | undefined;
|
|
22
23
|
_call({ address_n, show_display, multisig, script_type, coinInfo, unlockPath, chunkify, }: Params): Promise<{
|
|
23
24
|
path: number[];
|
|
24
25
|
serializedPath: string;
|
package/lib/api/getAddress.js
CHANGED
|
@@ -15,6 +15,7 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
15
15
|
this.progress = 0;
|
|
16
16
|
}
|
|
17
17
|
init() {
|
|
18
|
+
this.noBackupConfirmationMode = 'always';
|
|
18
19
|
this.requiredPermissions = ['read'];
|
|
19
20
|
this.hasBundle = !!this.payload.bundle;
|
|
20
21
|
const payload = !this.payload.bundle
|
|
@@ -61,7 +62,6 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
61
62
|
this.params.length === 1 &&
|
|
62
63
|
typeof this.params[0].address === 'string' &&
|
|
63
64
|
this.params[0].show_display;
|
|
64
|
-
this.confirmed = useEventListener;
|
|
65
65
|
this.useUi = !useEventListener;
|
|
66
66
|
}
|
|
67
67
|
get info() {
|
|
@@ -84,27 +84,13 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
label: this.info,
|
|
95
|
-
}));
|
|
96
|
-
const uiResp = await uiPromise.promise;
|
|
97
|
-
this.confirmed = uiResp.payload;
|
|
98
|
-
return this.confirmed;
|
|
99
|
-
}
|
|
100
|
-
async noBackupConfirmation() {
|
|
101
|
-
await this.getPopupPromise().promise;
|
|
102
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
103
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
104
|
-
view: 'no-backup',
|
|
105
|
-
}));
|
|
106
|
-
const uiResp = await uiPromise.promise;
|
|
107
|
-
return uiResp.payload;
|
|
87
|
+
get confirmation() {
|
|
88
|
+
return !this.useUi
|
|
89
|
+
? undefined
|
|
90
|
+
: {
|
|
91
|
+
view: 'export-address',
|
|
92
|
+
label: this.info,
|
|
93
|
+
};
|
|
108
94
|
}
|
|
109
95
|
async _call({ address_n, show_display, multisig, script_type, coinInfo, unlockPath, chunkify, }) {
|
|
110
96
|
const cmd = this.device.getCommands();
|
package/lib/api/getFeatures.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export default class GetFeatures extends AbstractMethod<'getFeatures'> {
|
|
|
12
12
|
homescreen_height?: number | undefined;
|
|
13
13
|
bootloader_locked?: boolean | undefined;
|
|
14
14
|
language_version_matches?: boolean | undefined;
|
|
15
|
+
unit_packaging?: number | undefined;
|
|
15
16
|
flags: number | null;
|
|
16
17
|
language: string | null;
|
|
17
18
|
label: string | null;
|
|
@@ -2,10 +2,12 @@ import { AbstractMethod } from '../core/AbstractMethod';
|
|
|
2
2
|
import { PROTO } from '../constants';
|
|
3
3
|
export default class GetOwnershipId extends AbstractMethod<'getOwnershipId', PROTO.GetOwnershipId[]> {
|
|
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<import("../types/api/getOwnershipId").OwnershipId | import("../types/api/getOwnershipId").OwnershipId[]>;
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=getOwnershipId.d.ts.map
|
|
@@ -32,22 +32,11 @@ class GetOwnershipId extends AbstractMethod_1.AbstractMethod {
|
|
|
32
32
|
get info() {
|
|
33
33
|
return 'Export ownership id';
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return true;
|
|
38
|
-
await this.getPopupPromise().promise;
|
|
39
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION, this.device);
|
|
40
|
-
let label = this.info;
|
|
41
|
-
if (this.params.length > 1) {
|
|
42
|
-
label = 'Export multiple ownership proof ids';
|
|
43
|
-
}
|
|
44
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
35
|
+
get confirmation() {
|
|
36
|
+
return {
|
|
45
37
|
view: 'export-address',
|
|
46
|
-
label,
|
|
47
|
-
}
|
|
48
|
-
const uiResp = await uiPromise.promise;
|
|
49
|
-
this.confirmed = uiResp.payload;
|
|
50
|
-
return this.confirmed;
|
|
38
|
+
label: this.params.length > 1 ? 'Export multiple ownership proof ids' : this.info,
|
|
39
|
+
};
|
|
51
40
|
}
|
|
52
41
|
async run() {
|
|
53
42
|
const responses = [];
|
|
@@ -2,10 +2,12 @@ import { AbstractMethod } from '../core/AbstractMethod';
|
|
|
2
2
|
import { PROTO } from '../constants';
|
|
3
3
|
export default class GetOwnershipProof extends AbstractMethod<'getOwnershipProof', PROTO.GetOwnershipProof[]> {
|
|
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<import("../types/api/getOwnershipProof").OwnershipProof | import("../types/api/getOwnershipProof").OwnershipProof[]>;
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=getOwnershipProof.d.ts.map
|
|
@@ -38,22 +38,11 @@ class GetOwnershipProof extends AbstractMethod_1.AbstractMethod {
|
|
|
38
38
|
get info() {
|
|
39
39
|
return 'Export ownership proof';
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return true;
|
|
44
|
-
await this.getPopupPromise().promise;
|
|
45
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION, this.device);
|
|
46
|
-
let label = this.info;
|
|
47
|
-
if (this.params.length > 1) {
|
|
48
|
-
label = 'Export multiple ownership proofs';
|
|
49
|
-
}
|
|
50
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
41
|
+
get confirmation() {
|
|
42
|
+
return {
|
|
51
43
|
view: 'export-address',
|
|
52
|
-
label,
|
|
53
|
-
}
|
|
54
|
-
const uiResp = await uiPromise.promise;
|
|
55
|
-
this.confirmed = uiResp.payload;
|
|
56
|
-
return this.confirmed;
|
|
44
|
+
label: this.params.length > 1 ? 'Export multiple ownership proofs' : this.info,
|
|
45
|
+
};
|
|
57
46
|
}
|
|
58
47
|
async run() {
|
|
59
48
|
const responses = [];
|
|
@@ -2,17 +2,18 @@ import { AbstractMethod } from '../core/AbstractMethod';
|
|
|
2
2
|
import type { BitcoinNetworkInfo } from '../types';
|
|
3
3
|
import type { PROTO } from '../constants';
|
|
4
4
|
type Params = PROTO.GetPublicKey & {
|
|
5
|
-
coinInfo
|
|
5
|
+
coinInfo: BitcoinNetworkInfo;
|
|
6
6
|
suppressBackupWarning?: boolean;
|
|
7
7
|
unlockPath?: PROTO.UnlockPath;
|
|
8
8
|
};
|
|
9
9
|
export default class GetPublicKey extends AbstractMethod<'getPublicKey', Params[]> {
|
|
10
10
|
hasBundle?: boolean;
|
|
11
|
-
confirmed?: boolean;
|
|
12
11
|
init(): void;
|
|
13
12
|
get info(): string;
|
|
14
|
-
confirmation():
|
|
15
|
-
|
|
13
|
+
get confirmation(): {
|
|
14
|
+
view: "export-xpub";
|
|
15
|
+
label: string;
|
|
16
|
+
};
|
|
16
17
|
run(): Promise<{
|
|
17
18
|
xpubSegwit?: string | undefined;
|
|
18
19
|
descriptorChecksum?: string | undefined;
|
package/lib/api/getPublicKey.js
CHANGED
|
@@ -18,6 +18,7 @@ class GetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
|
18
18
|
: this.payload;
|
|
19
19
|
(0, schema_utils_1.Assert)((0, types_1.Bundle)(getPublicKey_1.GetPublicKey), payload);
|
|
20
20
|
this.params = payload.bundle.map(batch => {
|
|
21
|
+
var _a;
|
|
21
22
|
let coinInfo;
|
|
22
23
|
if (batch.coin) {
|
|
23
24
|
coinInfo = (0, coinInfo_1.getBitcoinNetwork)(batch.coin);
|
|
@@ -27,11 +28,9 @@ class GetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
|
27
28
|
(0, paramsValidator_1.validateCoinPath)(address_n, coinInfo);
|
|
28
29
|
}
|
|
29
30
|
else if (!coinInfo) {
|
|
30
|
-
coinInfo = (0, coinInfo_1.getBitcoinNetwork)(address_n);
|
|
31
|
-
}
|
|
32
|
-
if (coinInfo) {
|
|
33
|
-
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, coinInfo, this.firmwareRange);
|
|
31
|
+
coinInfo = (_a = (0, coinInfo_1.getBitcoinNetwork)(address_n)) !== null && _a !== void 0 ? _a : (0, coinInfo_1.getBitcoinNetwork)('btc');
|
|
34
32
|
}
|
|
33
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, coinInfo, this.firmwareRange);
|
|
35
34
|
return {
|
|
36
35
|
address_n,
|
|
37
36
|
coin_name: coinInfo === null || coinInfo === void 0 ? void 0 : coinInfo.name,
|
|
@@ -44,42 +43,20 @@ class GetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
|
44
43
|
suppress_backup_warning: batch.suppressBackupWarning,
|
|
45
44
|
};
|
|
46
45
|
});
|
|
46
|
+
this.noBackupConfirmationMode = this.params.every(batch => batch.suppressBackupWarning || !batch.show_display)
|
|
47
|
+
? 'popup-only'
|
|
48
|
+
: 'always';
|
|
47
49
|
}
|
|
48
50
|
get info() {
|
|
49
51
|
return 'Export public key';
|
|
50
52
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return true;
|
|
54
|
-
await this.getPopupPromise().promise;
|
|
55
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
56
|
-
let label;
|
|
57
|
-
if (this.params.length > 1) {
|
|
58
|
-
label = 'Export multiple public keys';
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
label = (0, accountUtils_1.getPublicKeyLabel)(this.params[0].address_n, this.params[0].coinInfo);
|
|
62
|
-
}
|
|
63
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
53
|
+
get confirmation() {
|
|
54
|
+
return {
|
|
64
55
|
view: 'export-xpub',
|
|
65
|
-
label
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return this.confirmed;
|
|
70
|
-
}
|
|
71
|
-
async noBackupConfirmation(allowSuppression) {
|
|
72
|
-
if (allowSuppression &&
|
|
73
|
-
this.params.every(batch => batch.suppressBackupWarning || !batch.show_display)) {
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
await this.getPopupPromise().promise;
|
|
77
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
78
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
79
|
-
view: 'no-backup',
|
|
80
|
-
}));
|
|
81
|
-
const uiResp = await uiPromise.promise;
|
|
82
|
-
return uiResp.payload;
|
|
56
|
+
label: this.params.length > 1
|
|
57
|
+
? 'Export multiple public keys'
|
|
58
|
+
: (0, accountUtils_1.getPublicKeyLabel)(this.params[0].address_n, this.params[0].coinInfo),
|
|
59
|
+
};
|
|
83
60
|
}
|
|
84
61
|
async run() {
|
|
85
62
|
const responses = [];
|
package/lib/api/index.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ export { default as changePin } from './changePin';
|
|
|
21
21
|
export { default as changeWipeCode } from './changeWipeCode';
|
|
22
22
|
export { default as cipherKeyValue } from './cipherKeyValue';
|
|
23
23
|
export { default as composeTransaction } from './composeTransaction';
|
|
24
|
-
export { default as firmwareUpdate } from './firmwareUpdate';
|
|
25
24
|
export { default as getAccountDescriptor } from './getAccountDescriptor';
|
|
26
25
|
export { default as getAccountInfo } from './getAccountInfo';
|
|
27
26
|
export { default as getAddress } from './getAddress';
|
package/lib/api/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.getAccountDescriptor = exports.
|
|
6
|
+
exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.getAccountDescriptor = exports.composeTransaction = exports.cipherKeyValue = exports.changeWipeCode = exports.changePin = exports.changeLanguage = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
|
|
7
7
|
var applyFlags_1 = require("./applyFlags");
|
|
8
8
|
Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return __importDefault(applyFlags_1).default; } });
|
|
9
9
|
var applySettings_1 = require("./applySettings");
|
|
@@ -50,8 +50,6 @@ var cipherKeyValue_1 = require("./cipherKeyValue");
|
|
|
50
50
|
Object.defineProperty(exports, "cipherKeyValue", { enumerable: true, get: function () { return __importDefault(cipherKeyValue_1).default; } });
|
|
51
51
|
var composeTransaction_1 = require("./composeTransaction");
|
|
52
52
|
Object.defineProperty(exports, "composeTransaction", { enumerable: true, get: function () { return __importDefault(composeTransaction_1).default; } });
|
|
53
|
-
var firmwareUpdate_1 = require("./firmwareUpdate");
|
|
54
|
-
Object.defineProperty(exports, "firmwareUpdate", { enumerable: true, get: function () { return __importDefault(firmwareUpdate_1).default; } });
|
|
55
53
|
var getAccountDescriptor_1 = require("./getAccountDescriptor");
|
|
56
54
|
Object.defineProperty(exports, "getAccountDescriptor", { enumerable: true, get: function () { return __importDefault(getAccountDescriptor_1).default; } });
|
|
57
55
|
var getAccountInfo_1 = require("./getAccountInfo");
|
|
@@ -6,7 +6,6 @@ type Params = PROTO.NEMGetAddress & {
|
|
|
6
6
|
export default class NEMGetAddress extends AbstractMethod<'nemGetAddress', Params[]> {
|
|
7
7
|
hasBundle?: boolean;
|
|
8
8
|
progress: number;
|
|
9
|
-
confirmed?: boolean;
|
|
10
9
|
init(): void;
|
|
11
10
|
get info(): string;
|
|
12
11
|
getButtonRequestData(code: string): {
|
|
@@ -14,8 +13,10 @@ export default class NEMGetAddress extends AbstractMethod<'nemGetAddress', Param
|
|
|
14
13
|
serializedPath: string;
|
|
15
14
|
address: string;
|
|
16
15
|
} | undefined;
|
|
17
|
-
confirmation():
|
|
18
|
-
|
|
16
|
+
get confirmation(): {
|
|
17
|
+
view: "export-address";
|
|
18
|
+
label: string;
|
|
19
|
+
};
|
|
19
20
|
_call({ address_n, network, show_display, chunkify }: Params): Promise<{
|
|
20
21
|
address: string;
|
|
21
22
|
}>;
|
|
@@ -18,6 +18,7 @@ class NEMGetAddress 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.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('NEM'), this.firmwareRange);
|
|
23
24
|
this.hasBundle = !!this.payload.bundle;
|
|
@@ -39,7 +40,6 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
39
40
|
this.params.length === 1 &&
|
|
40
41
|
typeof this.params[0].address === 'string' &&
|
|
41
42
|
this.params[0].show_display;
|
|
42
|
-
this.confirmed = useEventListener;
|
|
43
43
|
this.useUi = !useEventListener;
|
|
44
44
|
}
|
|
45
45
|
get info() {
|
|
@@ -69,27 +69,11 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return true;
|
|
75
|
-
await this.getPopupPromise().promise;
|
|
76
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
77
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
72
|
+
get confirmation() {
|
|
73
|
+
return {
|
|
78
74
|
view: 'export-address',
|
|
79
75
|
label: this.info,
|
|
80
|
-
}
|
|
81
|
-
const uiResp = await uiPromise.promise;
|
|
82
|
-
this.confirmed = uiResp.payload;
|
|
83
|
-
return this.confirmed;
|
|
84
|
-
}
|
|
85
|
-
async noBackupConfirmation() {
|
|
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, {
|
|
89
|
-
view: 'no-backup',
|
|
90
|
-
}));
|
|
91
|
-
const uiResp = await uiPromise.promise;
|
|
92
|
-
return uiResp.payload;
|
|
76
|
+
};
|
|
93
77
|
}
|
|
94
78
|
async _call({ address_n, network, show_display, chunkify }) {
|
|
95
79
|
const cmd = this.device.getCommands();
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
2
|
import { PROTO } from '../constants';
|
|
3
3
|
export default class RebootToBootloader extends AbstractMethod<'rebootToBootloader', PROTO.RebootToBootloader> {
|
|
4
|
-
confirmed?: boolean;
|
|
5
4
|
init(): void;
|
|
6
5
|
get info(): string;
|
|
7
|
-
confirmation():
|
|
6
|
+
get confirmation(): {
|
|
7
|
+
view: "device-management";
|
|
8
|
+
customConfirmButton: {
|
|
9
|
+
className: string;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
8
14
|
run(): Promise<{
|
|
9
15
|
message: string;
|
|
10
16
|
}>;
|
|
@@ -24,22 +24,15 @@ class RebootToBootloader extends AbstractMethod_1.AbstractMethod {
|
|
|
24
24
|
get info() {
|
|
25
25
|
return 'Reboot to bootloader';
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return true;
|
|
30
|
-
await this.getPopupPromise().promise;
|
|
31
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
32
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
27
|
+
get confirmation() {
|
|
28
|
+
return {
|
|
33
29
|
view: 'device-management',
|
|
34
30
|
customConfirmButton: {
|
|
35
31
|
className: 'confirm',
|
|
36
32
|
label: `Reboot`,
|
|
37
33
|
},
|
|
38
34
|
label: 'Are you sure you want to reboot to bootloader?',
|
|
39
|
-
}
|
|
40
|
-
const uiResp = await uiPromise.promise;
|
|
41
|
-
this.confirmed = uiResp.payload;
|
|
42
|
-
return this.confirmed;
|
|
35
|
+
};
|
|
43
36
|
}
|
|
44
37
|
async run() {
|
|
45
38
|
const cmd = this.device.getCommands();
|
|
@@ -2,7 +2,14 @@ import { AbstractMethod } from '../core/AbstractMethod';
|
|
|
2
2
|
import type { PROTO } from '../constants';
|
|
3
3
|
export default class RecoveryDevice extends AbstractMethod<'recoveryDevice', PROTO.RecoveryDevice> {
|
|
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
|
}>;
|
|
@@ -24,19 +24,15 @@ class RecoveryDevice extends AbstractMethod_1.AbstractMethod {
|
|
|
24
24
|
this.allowDeviceMode = [...this.allowDeviceMode, events_1.UI.INITIALIZE];
|
|
25
25
|
this.useDeviceState = false;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
30
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
27
|
+
get confirmation() {
|
|
28
|
+
return {
|
|
31
29
|
view: 'device-management',
|
|
32
30
|
customConfirmButton: {
|
|
33
31
|
className: 'confirm',
|
|
34
32
|
label: 'Proceed',
|
|
35
33
|
},
|
|
36
34
|
label: 'Do you want to recover device from seed?',
|
|
37
|
-
}
|
|
38
|
-
const uiResp = await uiPromise.promise;
|
|
39
|
-
return uiResp.payload;
|
|
35
|
+
};
|
|
40
36
|
}
|
|
41
37
|
async run() {
|
|
42
38
|
const cmd = this.device.getCommands();
|
package/lib/api/resetDevice.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
2
|
import { PROTO } from '../constants';
|
|
3
3
|
export default class ResetDevice extends AbstractMethod<'resetDevice', PROTO.ResetDevice> {
|
|
4
|
-
confirmed?: boolean;
|
|
5
4
|
init(): void;
|
|
6
5
|
get info(): string;
|
|
7
|
-
confirmation():
|
|
6
|
+
get confirmation(): {
|
|
7
|
+
view: "device-management";
|
|
8
|
+
label: string;
|
|
9
|
+
};
|
|
8
10
|
run(): Promise<{
|
|
9
11
|
message: string;
|
|
10
12
|
}>;
|
package/lib/api/resetDevice.js
CHANGED
|
@@ -29,18 +29,11 @@ class ResetDevice extends AbstractMethod_1.AbstractMethod {
|
|
|
29
29
|
get info() {
|
|
30
30
|
return 'Setup device';
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return true;
|
|
35
|
-
await this.getPopupPromise().promise;
|
|
36
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
37
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
32
|
+
get confirmation() {
|
|
33
|
+
return {
|
|
38
34
|
view: 'device-management',
|
|
39
35
|
label: 'Do you really you want to create a new wallet?',
|
|
40
|
-
}
|
|
41
|
-
const uiResp = await uiPromise.promise;
|
|
42
|
-
this.confirmed = uiResp.payload;
|
|
43
|
-
return this.confirmed;
|
|
36
|
+
};
|
|
44
37
|
}
|
|
45
38
|
async run() {
|
|
46
39
|
const cmd = this.device.getCommands();
|
|
@@ -6,7 +6,6 @@ type Params = PROTO.RippleGetAddress & {
|
|
|
6
6
|
export default class RippleGetAddress extends AbstractMethod<'rippleGetAddress', Params[]> {
|
|
7
7
|
hasBundle?: boolean;
|
|
8
8
|
progress: number;
|
|
9
|
-
confirmed?: boolean;
|
|
10
9
|
init(): void;
|
|
11
10
|
get info(): string;
|
|
12
11
|
getButtonRequestData(code: string): {
|
|
@@ -14,8 +13,10 @@ export default class RippleGetAddress extends AbstractMethod<'rippleGetAddress',
|
|
|
14
13
|
serializedPath: string;
|
|
15
14
|
address: string;
|
|
16
15
|
} | undefined;
|
|
17
|
-
confirmation():
|
|
18
|
-
|
|
16
|
+
get confirmation(): {
|
|
17
|
+
view: "export-address";
|
|
18
|
+
label: string;
|
|
19
|
+
};
|
|
19
20
|
_call({ address_n, show_display, chunkify }: Params): Promise<{
|
|
20
21
|
address: string;
|
|
21
22
|
}>;
|
|
@@ -15,6 +15,7 @@ class RippleGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
15
15
|
this.progress = 0;
|
|
16
16
|
}
|
|
17
17
|
init() {
|
|
18
|
+
this.noBackupConfirmationMode = 'always';
|
|
18
19
|
this.requiredPermissions = ['read'];
|
|
19
20
|
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Ripple'), this.firmwareRange);
|
|
20
21
|
this.hasBundle = !!this.payload.bundle;
|
|
@@ -35,7 +36,6 @@ class RippleGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
35
36
|
this.params.length === 1 &&
|
|
36
37
|
typeof this.params[0].address === 'string' &&
|
|
37
38
|
this.params[0].show_display;
|
|
38
|
-
this.confirmed = useEventListener;
|
|
39
39
|
this.useUi = !useEventListener;
|
|
40
40
|
}
|
|
41
41
|
get info() {
|
|
@@ -53,27 +53,11 @@ class RippleGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return true;
|
|
59
|
-
await this.getPopupPromise().promise;
|
|
60
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
61
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
56
|
+
get confirmation() {
|
|
57
|
+
return {
|
|
62
58
|
view: 'export-address',
|
|
63
59
|
label: this.info,
|
|
64
|
-
}
|
|
65
|
-
const uiResp = await uiPromise.promise;
|
|
66
|
-
this.confirmed = uiResp.payload;
|
|
67
|
-
return this.confirmed;
|
|
68
|
-
}
|
|
69
|
-
async noBackupConfirmation() {
|
|
70
|
-
await this.getPopupPromise().promise;
|
|
71
|
-
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
72
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
73
|
-
view: 'no-backup',
|
|
74
|
-
}));
|
|
75
|
-
const uiResp = await uiPromise.promise;
|
|
76
|
-
return uiResp.payload;
|
|
60
|
+
};
|
|
77
61
|
}
|
|
78
62
|
async _call({ address_n, show_display, chunkify }) {
|
|
79
63
|
const cmd = this.device.getCommands();
|
|
@@ -6,7 +6,6 @@ type Params = PROTO.SolanaGetAddress & {
|
|
|
6
6
|
export default class SolanaGetAddress extends AbstractMethod<'solanaGetAddress', Params[]> {
|
|
7
7
|
hasBundle?: boolean;
|
|
8
8
|
progress: number;
|
|
9
|
-
confirmed?: boolean;
|
|
10
9
|
init(): void;
|
|
11
10
|
get info(): "Export solana address" | "Export multiple Solana addresses";
|
|
12
11
|
getButtonRequestData(code: string): {
|
|
@@ -14,8 +13,10 @@ export default class SolanaGetAddress extends AbstractMethod<'solanaGetAddress',
|
|
|
14
13
|
serializedPath: string;
|
|
15
14
|
address: string;
|
|
16
15
|
} | undefined;
|
|
17
|
-
confirmation():
|
|
18
|
-
|
|
16
|
+
get confirmation(): {
|
|
17
|
+
view: "export-address";
|
|
18
|
+
label: string;
|
|
19
|
+
};
|
|
19
20
|
_call({ address_n, show_display, chunkify }: Params): Promise<{
|
|
20
21
|
address: string;
|
|
21
22
|
}>;
|