@trezor/connect 9.2.4 → 9.2.5-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 +125 -9
- package/README.md +2 -2
- package/lib/api/applySettings.js +1 -9
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +4 -1
- package/lib/api/cardano/api/cardanoSignTransaction.js +16 -1
- package/lib/api/cardano/cardanoCertificate.js +34 -0
- package/lib/api/cardano/cardanoWitnesses.js +4 -1
- package/lib/api/getFeatures.d.ts +6 -4
- package/lib/api/getPublicKey.d.ts +1 -1
- package/lib/api/getPublicKey.js +3 -3
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +3 -1
- package/lib/api/recoveryDevice.js +1 -1
- package/lib/api/setBrightness.d.ts +9 -0
- package/lib/api/setBrightness.js +23 -0
- package/lib/api/solana/api/solanaGetAddress.d.ts +1 -1
- package/lib/api/solana/api/solanaGetAddress.js +1 -1
- package/lib/backend/BackendManager.d.ts +1 -2
- package/lib/backend/BackendManager.js +6 -5
- package/lib/backend/BlockchainLink.js +1 -3
- package/lib/core/coreManager.d.ts +16 -0
- package/lib/core/coreManager.js +55 -0
- package/lib/core/index.d.ts +7 -1
- package/lib/core/index.js +44 -32
- package/lib/data/deviceAuthenticityConfig.js +4 -1
- package/lib/data/models.js +4 -4
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.js +5 -0
- package/lib/device/DeviceList.js +2 -0
- package/lib/factory.d.ts +2 -3
- package/lib/factory.js +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +27 -29
- package/lib/types/api/applySettings.d.ts +1 -0
- package/lib/types/api/cardano/index.d.ts +26 -0
- package/lib/types/api/cardano/index.js +9 -1
- package/lib/types/api/index.d.ts +7 -5
- package/lib/types/api/recoveryDevice.d.ts +2 -2
- package/lib/types/api/setBrightness.d.ts +4 -0
- package/lib/types/api/setBrightness.js +3 -0
- package/package.json +14 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,130 @@
|
|
|
1
|
-
|
|
|
2
|
-
|
|
|
3
|
-
|
|
|
4
|
-
|
|
|
5
|
-
| npm @trezor/connect-webextension | 9.2.4 | 9.2.
|
|
1
|
+
| Package | Stable | Canary |
|
|
2
|
+
| :------------------------------: | :----: | :----------: |
|
|
3
|
+
| npm @trezor/connect | 9.2.4 | 9.2.5-beta.2 |
|
|
4
|
+
| npm @trezor/connect-web | 9.2.4 | 9.2.5-beta.2 |
|
|
5
|
+
| npm @trezor/connect-webextension | 9.2.4 | 9.2.5-beta.2 |
|
|
6
|
+
|
|
7
|
+
| Deployment | Stable | Canary |
|
|
8
|
+
| :----------------: | :----: | :----------: |
|
|
9
|
+
| connect.trezor.io/ | 9.2.4 | 9.2.5-beta.2 |
|
|
10
|
+
|
|
11
|
+
Use the persistent link [connect.trezor.io/9](https://connect.trezor.io/9/) to access the latest stable version of Connect Explorer.
|
|
12
|
+
|
|
13
|
+
# 9.2.5-beta.2
|
|
14
|
+
|
|
15
|
+
- fix(connect): race condition when closing and opening popup subsequently (e0e51c7)
|
|
16
|
+
- chore(connect): implement required descriptor.type (9ef657f)
|
|
17
|
+
- docs(connect): Explorer landing page update (7db29e9)
|
|
18
|
+
- fix(connect): deviceList may become undefined after init transport (firefox) (322651b)
|
|
19
|
+
- fix(connect): Core with pending initialization (3f8e405)
|
|
20
|
+
- fix(connect): preserve DEVICE.ACQUIRED listeners after unsuccessful workflow (4cede4e)
|
|
21
|
+
- fix(connect): don't save state with legacy passphrase (af90317)
|
|
22
|
+
- feat(connect): new T3T1 colors (0797090)
|
|
23
|
+
- chores: 583fbd0, a27a385, 6c789d2
|
|
6
24
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
## connect-explorer
|
|
26
|
+
|
|
27
|
+
- readme pages (be0f933)
|
|
28
|
+
- getFeatures (0f9d057)
|
|
29
|
+
- don't change affected fields in manual mode (2c7143e)
|
|
30
|
+
- canary release explanation in changelog (6cf1eae)
|
|
31
|
+
- theme: steps colors (1f7a9e4)
|
|
32
|
+
- delete deprecated webusb parameter from init docs (a92429e)
|
|
33
|
+
- zoomable and dark mode illustrations (8d55ed1)
|
|
34
|
+
- some attributes were not passed trough the proxy (5cb6a26)
|
|
35
|
+
- MTT content max height (c8796b4)
|
|
36
|
+
- add links in changelog page (8dabb30)
|
|
37
|
+
|
|
38
|
+
## connect-web
|
|
39
|
+
|
|
40
|
+
- publish trezor-usb-permissions.html in NPM (c8628ea)
|
|
41
|
+
- refactor into classes (fc7a45b)
|
|
42
|
+
- core-in-popup mode (52891f3)
|
|
43
|
+
- passphrase missmatch resets the flow now (d55ff1c)
|
|
44
|
+
|
|
45
|
+
## connect-webextension
|
|
46
|
+
|
|
47
|
+
- stop publishing Trezor connect webextension proxy since it is for Trezor internal testing with connect-explorer (5df3ae0)
|
|
48
|
+
- use bundled build as package main (fff7eaf)
|
|
49
|
+
|
|
50
|
+
## connect-examples
|
|
51
|
+
|
|
52
|
+
- Improve the mv3 sw example to be make it easier for 3rd parties to understand how to integrate connect-webextension (884ec96, a0c0706)
|
|
53
|
+
|
|
54
|
+
## connect-common
|
|
55
|
+
|
|
56
|
+
- edit firmware changelogs (3637a56)
|
|
57
|
+
- firmware release url (0166df5)
|
|
58
|
+
- update firmware binaries to 2.7.2 (6392328)
|
|
59
|
+
- T3T1 support (9d0adae)
|
|
60
|
+
|
|
61
|
+
## connect-ui
|
|
62
|
+
|
|
63
|
+
- install bridge title align (19c5781)
|
|
64
|
+
|
|
65
|
+
## Dependencies update
|
|
66
|
+
|
|
67
|
+
- bump ws from 8.16.0 to 8.17.1 (bc5b787)
|
|
68
|
+
|
|
69
|
+
- npm-release: @trezor/blockchain-link 2.1.31-beta.2
|
|
70
|
+
- npm-release: @trezor/blockchain-link-utils 1.0.19-beta.1
|
|
71
|
+
- npm-release: @trezor/blockchain-link-types 1.0.18-beta.2
|
|
72
|
+
- npm-release: @trezor/type-utils 1.0.6-beta.1
|
|
73
|
+
- npm-release: @trezor/connect-analytics 1.0.16-beta.1
|
|
74
|
+
- npm-release: @trezor/analytics 1.0.18-beta.1
|
|
75
|
+
- npm-release: @trezor/connect-common 0.0.34-beta.1
|
|
76
|
+
- npm-release: @trezor/env-utils 1.0.18-beta.1
|
|
77
|
+
- npm-release: @trezor/transport 1.1.30-beta.2
|
|
78
|
+
- npm-release: @trezor/protobuf 1.0.14-beta.2
|
|
79
|
+
- npm-release: @trezor/schema-utils 1.0.5-beta.1
|
|
80
|
+
- npm-release: @trezor/protocol 1.0.10-beta.2
|
|
81
|
+
- npm-release: @trezor/utxo-lib 2.0.11-beta.1
|
|
82
|
+
- npm-release: @trezor/utils 9.0.25-beta.2
|
|
83
|
+
- npm-release: @trezor/connect 9.2.5-beta.2
|
|
84
|
+
|
|
85
|
+
# 9.2.5-beta.1
|
|
86
|
+
|
|
87
|
+
Improved reliability of popup handshake mechanism.
|
|
88
|
+
Improved compatibility with webextensions using TrezorConnect inside offscreen (eg. Metamask).
|
|
89
|
+
Cardano: support Conway certificates, increase minimum supported FW to 2.6.0 to clean up legacy code.
|
|
90
|
+
Minor fixes in Connect Explorer and documentation.
|
|
91
|
+
|
|
92
|
+
- feat(connect): Add tag 258 support (90bf3a7)
|
|
93
|
+
- feat(connect): Conway certificates (ab003ce)
|
|
94
|
+
- feat(connect): applySettings - accept all validated params (65809d8)
|
|
95
|
+
- fix(connect): immediate switch from custom to default backend (b8348ca)
|
|
96
|
+
- fix(connect): remove getPublicKey coinInfo fallback (fb446f2)
|
|
97
|
+
- chore(connect): add new TS3 CA pubkeys and update timestamp (35486ba)
|
|
98
|
+
- chore(connect): update fw version number for cardano (d737d3c)
|
|
99
|
+
- chore(connect): center changelog version table (93fab15)
|
|
100
|
+
- chore(connect): change name in changelog table (bbc5499)
|
|
101
|
+
- chore(connect): remove canary from changelog
|
|
102
|
+
|
|
103
|
+
## connect-web
|
|
104
|
+
|
|
105
|
+
- close on popup cancellation, legacy mode for handshake
|
|
106
|
+
- check if chrome.tabs really available in webextension env
|
|
107
|
+
|
|
108
|
+
## connect-iframe
|
|
109
|
+
|
|
110
|
+
- handshake handling issues
|
|
111
|
+
|
|
112
|
+
## connect-explorer
|
|
113
|
+
|
|
114
|
+
- remove nextra reference from webextension, show amountUnit in signTransaction and fix favicon path
|
|
115
|
+
|
|
116
|
+
## connect-popup
|
|
117
|
+
|
|
118
|
+
- temporary workaround for CONTENT_SCRIPT_LOADED and handling of CONTENT_SCRIPT_LOADED
|
|
119
|
+
|
|
120
|
+
## Dependencies update
|
|
10
121
|
|
|
11
|
-
|
|
122
|
+
- npm-release: @trezor/blockchain-link 2.1.31-beta.1
|
|
123
|
+
- npm-release: @trezor/blockchain-link-types 1.0.18-beta.1
|
|
124
|
+
- npm-release: @trezor/transport 1.1.30-beta.1
|
|
125
|
+
- npm-release: @trezor/protobuf 1.0.14-beta.1
|
|
126
|
+
- npm-release: @trezor/protocol 1.0.10-beta.1
|
|
127
|
+
- npm-release: @trezor/utils 9.0.25-beta.1
|
|
12
128
|
|
|
13
129
|
# 9.2.4
|
|
14
130
|
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @trezor/connect
|
|
2
2
|
|
|
3
|
-
API version 9.2.
|
|
3
|
+
API version 9.2.5-beta.2
|
|
4
4
|
|
|
5
|
-
[](https://github.com/trezor/trezor-suite/actions/workflows/test-connect.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@trezor/connect)
|
|
7
7
|
[](https://snyk.io/test/github/trezor/trezor-suite?targetFile=packages/connect/package.json)
|
|
8
8
|
|
package/lib/api/applySettings.js
CHANGED
|
@@ -10,15 +10,7 @@ class ApplySettings extends AbstractMethod_1.AbstractMethod {
|
|
|
10
10
|
const { payload } = this;
|
|
11
11
|
(0, schema_utils_1.Assert)(applySettings_1.ApplySettings, payload);
|
|
12
12
|
this.params = {
|
|
13
|
-
|
|
14
|
-
label: payload.label,
|
|
15
|
-
use_passphrase: payload.use_passphrase,
|
|
16
|
-
homescreen: payload.homescreen,
|
|
17
|
-
passphrase_always_on_device: payload.passphrase_always_on_device,
|
|
18
|
-
auto_lock_delay_ms: payload.auto_lock_delay_ms,
|
|
19
|
-
display_rotation: payload.display_rotation,
|
|
20
|
-
safety_checks: payload.safety_checks,
|
|
21
|
-
experimental_features: payload.experimental_features,
|
|
13
|
+
...payload,
|
|
22
14
|
_passphrase_source: payload.passphrase_source,
|
|
23
15
|
};
|
|
24
16
|
}
|
|
@@ -5,7 +5,9 @@ import type { OutputWithData } from '../cardanoOutputs';
|
|
|
5
5
|
import { PROTO } from '../../../constants';
|
|
6
6
|
import { type CardanoSignedTxData } from '../../../types/api/cardano';
|
|
7
7
|
import type { AssetGroupWithTokens } from '../cardanoTokenBundle';
|
|
8
|
-
declare const CardanoSignTransactionFeatures: Readonly<{
|
|
8
|
+
declare const CardanoSignTransactionFeatures: Readonly<{
|
|
9
|
+
Conway: string[];
|
|
10
|
+
}>;
|
|
9
11
|
export type CardanoSignTransactionParams = {
|
|
10
12
|
signingMode: PROTO.CardanoTxSigningMode;
|
|
11
13
|
inputsWithPath: InputWithPath[];
|
|
@@ -29,6 +31,7 @@ export type CardanoSignTransactionParams = {
|
|
|
29
31
|
additionalWitnessRequests: Path[];
|
|
30
32
|
derivationType: PROTO.CardanoDerivationType;
|
|
31
33
|
includeNetworkId?: boolean;
|
|
34
|
+
tagCborSets?: boolean;
|
|
32
35
|
unsignedTx?: {
|
|
33
36
|
body: string;
|
|
34
37
|
hash: string;
|
|
@@ -14,7 +14,9 @@ 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({
|
|
17
|
+
const CardanoSignTransactionFeatures = Object.freeze({
|
|
18
|
+
Conway: ['0', '2.7.1'],
|
|
19
|
+
});
|
|
18
20
|
class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
19
21
|
init() {
|
|
20
22
|
this.requiredPermissions = ['read', 'write'];
|
|
@@ -109,6 +111,7 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
109
111
|
? payload.derivationType
|
|
110
112
|
: constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
111
113
|
includeNetworkId: payload.includeNetworkId,
|
|
114
|
+
tagCborSets: payload.tagCborSets,
|
|
112
115
|
unsignedTx: 'unsignedTx' in payload ? payload.unsignedTx : undefined,
|
|
113
116
|
testnet: 'testnet' in payload ? payload.testnet : undefined,
|
|
114
117
|
chunkify: typeof payload.chunkify === 'boolean' ? payload.chunkify : false,
|
|
@@ -126,6 +129,17 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
_ensureFirmwareSupportsParams() {
|
|
132
|
+
const { params } = this;
|
|
133
|
+
params.certificatesWithPoolOwnersAndRelays.forEach(({ certificate }) => {
|
|
134
|
+
if (certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_REGISTRATION_CONWAY ||
|
|
135
|
+
certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY ||
|
|
136
|
+
certificate.type === constants_1.PROTO.CardanoCertificateType.VOTE_DELEGATION) {
|
|
137
|
+
this._ensureFeatureIsSupported('Conway');
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
if (params.tagCborSets) {
|
|
141
|
+
this._ensureFeatureIsSupported('Conway');
|
|
142
|
+
}
|
|
129
143
|
}
|
|
130
144
|
async _sign_tx() {
|
|
131
145
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
@@ -153,6 +167,7 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
153
167
|
derivation_type: this.params.derivationType,
|
|
154
168
|
include_network_id: this.params.includeNetworkId,
|
|
155
169
|
chunkify: this.params.chunkify,
|
|
170
|
+
tag_cbor_sets: this.params.tagCborSets,
|
|
156
171
|
};
|
|
157
172
|
await typedCall('CardanoSignTxInit', 'CardanoTxItemAck', signTxInitMessage);
|
|
158
173
|
for (const { input } of this.params.inputsWithPath) {
|
|
@@ -47,6 +47,15 @@ const validatePoolParameters = (poolParameters) => {
|
|
|
47
47
|
validatePoolOwners(poolParameters.owners);
|
|
48
48
|
poolParameters.relays.forEach(validatePoolRelay);
|
|
49
49
|
};
|
|
50
|
+
const validateDRep = (dRep) => {
|
|
51
|
+
(0, schema_utils_1.Assert)(cardano_1.CardanoDRep, dRep);
|
|
52
|
+
if (dRep.type === constants_1.PROTO.CardanoDRepType.KEY_HASH && !dRep.keyHash) {
|
|
53
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'keyHash must be supplied for KEY_HASH dRep type');
|
|
54
|
+
}
|
|
55
|
+
else if (dRep.type === constants_1.PROTO.CardanoDRepType.SCRIPT_HASH && !dRep.scriptHash) {
|
|
56
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'scriptHash must be supplied for SCRIPT_HASH dRep type');
|
|
57
|
+
}
|
|
58
|
+
};
|
|
50
59
|
const transformPoolParameters = (poolParameters) => {
|
|
51
60
|
if (!poolParameters) {
|
|
52
61
|
return { poolParameters: undefined, poolOwners: [], poolRelays: [] };
|
|
@@ -80,6 +89,17 @@ const transformPoolParameters = (poolParameters) => {
|
|
|
80
89
|
})),
|
|
81
90
|
};
|
|
82
91
|
};
|
|
92
|
+
const transformDRep = (dRep) => {
|
|
93
|
+
if (!dRep) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
validateDRep(dRep);
|
|
97
|
+
return {
|
|
98
|
+
type: dRep.type,
|
|
99
|
+
key_hash: dRep.keyHash,
|
|
100
|
+
script_hash: dRep.scriptHash,
|
|
101
|
+
};
|
|
102
|
+
};
|
|
83
103
|
const transformCertificate = (certificate) => {
|
|
84
104
|
(0, schema_utils_1.Assert)(cardano_1.CardanoCertificate, certificate);
|
|
85
105
|
if (certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_DELEGATION) {
|
|
@@ -92,7 +112,19 @@ const transformCertificate = (certificate) => {
|
|
|
92
112
|
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'poolParameters must be supplied for STAKE_POOL_REGISTRATION');
|
|
93
113
|
}
|
|
94
114
|
}
|
|
115
|
+
if (certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_REGISTRATION_CONWAY ||
|
|
116
|
+
certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY) {
|
|
117
|
+
if (!certificate.deposit) {
|
|
118
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'deposit must be supplied for STAKE_REGISTRATION_CONWAY or STAKE_DEREGISTRATION_CONWAY');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (certificate.type === constants_1.PROTO.CardanoCertificateType.VOTE_DELEGATION) {
|
|
122
|
+
if (!certificate.dRep) {
|
|
123
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'dRep must be supplied for VOTE_DELEGATION');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
95
126
|
const { poolParameters, poolOwners, poolRelays } = transformPoolParameters(certificate.poolParameters);
|
|
127
|
+
const dRep = transformDRep(certificate.dRep);
|
|
96
128
|
return {
|
|
97
129
|
certificate: {
|
|
98
130
|
type: certificate.type,
|
|
@@ -101,6 +133,8 @@ const transformCertificate = (certificate) => {
|
|
|
101
133
|
key_hash: certificate.keyHash,
|
|
102
134
|
pool: certificate.pool,
|
|
103
135
|
pool_parameters: poolParameters,
|
|
136
|
+
deposit: certificate.deposit,
|
|
137
|
+
drep: dRep,
|
|
104
138
|
},
|
|
105
139
|
poolOwners,
|
|
106
140
|
poolRelays,
|
|
@@ -16,7 +16,10 @@ const gatherWitnessPaths = (inputsWithPath, certificatesWithPoolOwnersAndRelays,
|
|
|
16
16
|
certificatesWithPoolOwnersAndRelays.forEach(({ certificate, poolOwners }) => {
|
|
17
17
|
if (certificate.path &&
|
|
18
18
|
(certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_DELEGATION ||
|
|
19
|
-
certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_DEREGISTRATION
|
|
19
|
+
certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_DEREGISTRATION ||
|
|
20
|
+
certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_REGISTRATION_CONWAY ||
|
|
21
|
+
certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY ||
|
|
22
|
+
certificate.type === constants_1.PROTO.CardanoCertificateType.VOTE_DELEGATION)) {
|
|
20
23
|
_insert(certificate.path);
|
|
21
24
|
}
|
|
22
25
|
poolOwners.forEach(poolOwner => {
|
package/lib/api/getFeatures.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export default class GetFeatures extends AbstractMethod<'getFeatures'> {
|
|
|
3
3
|
init(): void;
|
|
4
4
|
run(): Promise<{
|
|
5
5
|
hide_passphrase_from_host?: boolean | undefined;
|
|
6
|
+
haptic_feedback?: boolean | undefined;
|
|
6
7
|
_passphrase_cached?: boolean | undefined;
|
|
7
8
|
busy?: boolean | undefined;
|
|
8
9
|
homescreen_format?: "Toif" | "Jpeg" | "ToiG" | undefined;
|
|
@@ -13,6 +14,7 @@ export default class GetFeatures extends AbstractMethod<'getFeatures'> {
|
|
|
13
14
|
bootloader_locked?: boolean | undefined;
|
|
14
15
|
language_version_matches?: boolean | undefined;
|
|
15
16
|
unit_packaging?: number | undefined;
|
|
17
|
+
recovery_type?: "NormalRecovery" | "DryRun" | "UnlockRepeatedBackup" | undefined;
|
|
16
18
|
flags: number | null;
|
|
17
19
|
language: string | null;
|
|
18
20
|
label: string | null;
|
|
@@ -35,7 +37,7 @@ export default class GetFeatures extends AbstractMethod<'getFeatures'> {
|
|
|
35
37
|
imported: boolean | null;
|
|
36
38
|
unlocked: boolean | null;
|
|
37
39
|
firmware_present: boolean | null;
|
|
38
|
-
|
|
40
|
+
backup_availability: "NotAvailable" | "Required" | "Available" | null;
|
|
39
41
|
model: string;
|
|
40
42
|
fw_major: number | null;
|
|
41
43
|
fw_minor: number | null;
|
|
@@ -43,9 +45,9 @@ export default class GetFeatures extends AbstractMethod<'getFeatures'> {
|
|
|
43
45
|
fw_vendor: string | null;
|
|
44
46
|
unfinished_backup: boolean | null;
|
|
45
47
|
no_backup: boolean | null;
|
|
46
|
-
|
|
47
|
-
capabilities: ("Capability_Bitcoin" | "Capability_Bitcoin_like" | "Capability_Binance" | "Capability_Cardano" | "Capability_Crypto" | "Capability_EOS" | "Capability_Ethereum" | "Capability_Lisk" | "Capability_Monero" | "Capability_NEM" | "Capability_Ripple" | "Capability_Stellar" | "Capability_Tezos" | "Capability_U2F" | "Capability_Shamir" | "Capability_ShamirGroups" | "Capability_PassphraseEntry" | "Capability_Solana" | "Capability_Translations")[];
|
|
48
|
-
backup_type: "Bip39" | "Slip39_Basic" | "Slip39_Advanced" | null;
|
|
48
|
+
recovery_status: "Nothing" | "Recovery" | "Backup" | null;
|
|
49
|
+
capabilities: ("Capability_Bitcoin" | "Capability_Bitcoin_like" | "Capability_Binance" | "Capability_Cardano" | "Capability_Crypto" | "Capability_EOS" | "Capability_Ethereum" | "Capability_Lisk" | "Capability_Monero" | "Capability_NEM" | "Capability_Ripple" | "Capability_Stellar" | "Capability_Tezos" | "Capability_U2F" | "Capability_Shamir" | "Capability_ShamirGroups" | "Capability_PassphraseEntry" | "Capability_Solana" | "Capability_Translations" | "Capability_Brightness" | "Capability_Haptic")[];
|
|
50
|
+
backup_type: "Bip39" | "Slip39_Basic" | "Slip39_Advanced" | "Slip39_Single_Extendable" | "Slip39_Basic_Extendable" | "Slip39_Advanced_Extendable" | null;
|
|
49
51
|
sd_card_present: boolean | null;
|
|
50
52
|
sd_protection: boolean | null;
|
|
51
53
|
wipe_code_protection: boolean | null;
|
|
@@ -2,7 +2,7 @@ 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
|
};
|
package/lib/api/getPublicKey.js
CHANGED
|
@@ -18,7 +18,6 @@ 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;
|
|
22
21
|
let coinInfo;
|
|
23
22
|
if (batch.coin) {
|
|
24
23
|
coinInfo = (0, coinInfo_1.getBitcoinNetwork)(batch.coin);
|
|
@@ -28,7 +27,7 @@ class GetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
|
28
27
|
(0, paramsValidator_1.validateCoinPath)(address_n, coinInfo);
|
|
29
28
|
}
|
|
30
29
|
else if (!coinInfo) {
|
|
31
|
-
coinInfo = (
|
|
30
|
+
coinInfo = (0, coinInfo_1.getBitcoinNetwork)(address_n);
|
|
32
31
|
}
|
|
33
32
|
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, coinInfo, this.firmwareRange);
|
|
34
33
|
return {
|
|
@@ -63,7 +62,8 @@ class GetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
|
63
62
|
const cmd = this.device.getCommands();
|
|
64
63
|
for (let i = 0; i < this.params.length; i++) {
|
|
65
64
|
const { coinInfo, unlockPath, ...batch } = this.params[i];
|
|
66
|
-
const
|
|
65
|
+
const coinInfoFallback = coinInfo !== null && coinInfo !== void 0 ? coinInfo : (0, coinInfo_1.getBitcoinNetwork)('btc');
|
|
66
|
+
const response = await cmd.getHDNode(batch, { coinInfo: coinInfoFallback, unlockPath });
|
|
67
67
|
responses.push(response);
|
|
68
68
|
if (this.hasBundle) {
|
|
69
69
|
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
package/lib/api/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export { default as rebootToBootloader } from './rebootToBootloader';
|
|
|
37
37
|
export { default as recoveryDevice } from './recoveryDevice';
|
|
38
38
|
export { default as requestLogin } from './requestLogin';
|
|
39
39
|
export { default as resetDevice } from './resetDevice';
|
|
40
|
+
export { default as setBrightness } from './setBrightness';
|
|
40
41
|
export { default as setBusy } from './setBusy';
|
|
41
42
|
export { default as setProxy } from './setProxy';
|
|
42
43
|
export { default as signMessage } from './signMessage';
|
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.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;
|
|
6
|
+
exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.setBrightness = 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");
|
|
@@ -82,6 +82,8 @@ var requestLogin_1 = require("./requestLogin");
|
|
|
82
82
|
Object.defineProperty(exports, "requestLogin", { enumerable: true, get: function () { return __importDefault(requestLogin_1).default; } });
|
|
83
83
|
var resetDevice_1 = require("./resetDevice");
|
|
84
84
|
Object.defineProperty(exports, "resetDevice", { enumerable: true, get: function () { return __importDefault(resetDevice_1).default; } });
|
|
85
|
+
var setBrightness_1 = require("./setBrightness");
|
|
86
|
+
Object.defineProperty(exports, "setBrightness", { enumerable: true, get: function () { return __importDefault(setBrightness_1).default; } });
|
|
85
87
|
var setBusy_1 = require("./setBusy");
|
|
86
88
|
Object.defineProperty(exports, "setBusy", { enumerable: true, get: function () { return __importDefault(setBusy_1).default; } });
|
|
87
89
|
var setProxy_1 = require("./setProxy");
|
|
@@ -17,9 +17,9 @@ class RecoveryDevice extends AbstractMethod_1.AbstractMethod {
|
|
|
17
17
|
language: payload.language,
|
|
18
18
|
label: payload.label,
|
|
19
19
|
enforce_wordlist: payload.enforce_wordlist,
|
|
20
|
+
input_method: payload.input_method,
|
|
20
21
|
type: payload.type,
|
|
21
22
|
u2f_counter: payload.u2f_counter,
|
|
22
|
-
dry_run: payload.dry_run,
|
|
23
23
|
};
|
|
24
24
|
this.allowDeviceMode = [...this.allowDeviceMode, events_1.UI.INITIALIZE];
|
|
25
25
|
this.useDeviceState = false;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import { PROTO } from '../constants';
|
|
3
|
+
export default class SetBrightness extends AbstractMethod<'setBrightness', PROTO.SetBrightness> {
|
|
4
|
+
init(): void;
|
|
5
|
+
run(): Promise<{
|
|
6
|
+
message: string;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=setBrightness.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
6
|
+
class SetBrightness extends AbstractMethod_1.AbstractMethod {
|
|
7
|
+
init() {
|
|
8
|
+
this.requiredPermissions = ['management'];
|
|
9
|
+
this.useDeviceState = false;
|
|
10
|
+
const { payload } = this;
|
|
11
|
+
(0, schema_utils_1.Assert)(constants_1.PROTO.SetBrightness, payload);
|
|
12
|
+
this.params = {
|
|
13
|
+
value: payload.value,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
async run() {
|
|
17
|
+
const cmd = this.device.getCommands();
|
|
18
|
+
const response = await cmd.typedCall('SetBrightness', 'Success', this.params);
|
|
19
|
+
return response.message;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = SetBrightness;
|
|
23
|
+
//# sourceMappingURL=setBrightness.js.map
|
|
@@ -7,7 +7,7 @@ export default class SolanaGetAddress extends AbstractMethod<'solanaGetAddress',
|
|
|
7
7
|
hasBundle?: boolean;
|
|
8
8
|
progress: number;
|
|
9
9
|
init(): void;
|
|
10
|
-
get info(): "Export
|
|
10
|
+
get info(): "Export Solana address" | "Export multiple Solana addresses";
|
|
11
11
|
getButtonRequestData(code: string): {
|
|
12
12
|
type: "address";
|
|
13
13
|
serializedPath: string;
|
|
@@ -12,8 +12,7 @@ export declare class BackendManager {
|
|
|
12
12
|
dispose(): void;
|
|
13
13
|
reconnectAll(coin?: CoinInfo): Promise<Blockchain[]>;
|
|
14
14
|
isSupported(coinInfo: CoinInfo): void;
|
|
15
|
-
setCustom(shortcut: CoinShortcut, blockchainLink
|
|
16
|
-
removeCustom(shortcut: CoinShortcut): void;
|
|
15
|
+
setCustom(shortcut: CoinShortcut, blockchainLink?: BlockchainLink): void;
|
|
17
16
|
private setInstance;
|
|
18
17
|
private setPreferred;
|
|
19
18
|
private onDisconnect;
|
|
@@ -64,11 +64,12 @@ class BackendManager {
|
|
|
64
64
|
}
|
|
65
65
|
setCustom(shortcut, blockchainLink) {
|
|
66
66
|
this.setPreferred(shortcut, undefined);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
if (blockchainLink) {
|
|
68
|
+
this.custom[shortcut] = blockchainLink;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
delete this.custom[shortcut];
|
|
72
|
+
}
|
|
72
73
|
}
|
|
73
74
|
setInstance(coinIdentity, instance) {
|
|
74
75
|
if (!instance)
|
|
@@ -7,9 +7,7 @@ Object.defineProperty(exports, "Blockchain", { enumerable: true, get: function (
|
|
|
7
7
|
const backends = new BackendManager_1.BackendManager();
|
|
8
8
|
const findBackend = (coin, identity) => backends.get(coin, identity);
|
|
9
9
|
exports.findBackend = findBackend;
|
|
10
|
-
const setCustomBackend = (coinInfo, blockchainLink) => (blockchainLink === null || blockchainLink === void 0 ? void 0 : blockchainLink.url.length)
|
|
11
|
-
? backends.setCustom(coinInfo.shortcut, blockchainLink)
|
|
12
|
-
: backends.removeCustom(coinInfo.shortcut);
|
|
10
|
+
const setCustomBackend = (coinInfo, blockchainLink) => backends.setCustom(coinInfo.shortcut, (blockchainLink === null || blockchainLink === void 0 ? void 0 : blockchainLink.url.length) ? blockchainLink : coinInfo.blockchainLink);
|
|
13
11
|
exports.setCustomBackend = setCustomBackend;
|
|
14
12
|
const isBackendSupported = (coinInfo) => backends.isSupported(coinInfo);
|
|
15
13
|
exports.isBackendSupported = isBackendSupported;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { CoreEventMessage } from '../events';
|
|
4
|
+
import { ConnectSettings } from '../types';
|
|
5
|
+
type CoreInstance = EventEmitter & {
|
|
6
|
+
init: (settings: ConnectSettings, onCoreEvent: (message: CoreEventMessage) => void, ...rest: any[]) => Promise<void>;
|
|
7
|
+
dispose: () => any;
|
|
8
|
+
};
|
|
9
|
+
export declare const initCoreManager: <Core extends CoreInstance>(core: Core) => {
|
|
10
|
+
getOrInitCore: (...[settings, onCoreEvent, ...rest]: Parameters<Core["init"]>) => Promise<Core>;
|
|
11
|
+
getCore: () => Core | undefined;
|
|
12
|
+
getInitPromise: () => Promise<Core> | undefined;
|
|
13
|
+
dispose: () => void;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=coreManager.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initCoreManager = void 0;
|
|
4
|
+
const utils_1 = require("@trezor/utils");
|
|
5
|
+
const events_1 = require("../events");
|
|
6
|
+
const initCoreManager = (core) => {
|
|
7
|
+
const state = {};
|
|
8
|
+
let initDfd;
|
|
9
|
+
const getOrInitCore = (...[settings, onCoreEvent, ...rest]) => {
|
|
10
|
+
if (state.core)
|
|
11
|
+
return Promise.resolve(state.core);
|
|
12
|
+
if (state.initPromise)
|
|
13
|
+
return state.initPromise;
|
|
14
|
+
const eventThrottle = async (...args) => {
|
|
15
|
+
if (state.initPromise) {
|
|
16
|
+
const core = await state.initPromise.catch(() => { });
|
|
17
|
+
if (!core)
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
onCoreEvent(...args);
|
|
21
|
+
};
|
|
22
|
+
const dfd = (0, utils_1.createDeferred)();
|
|
23
|
+
initDfd = dfd;
|
|
24
|
+
state.initPromise = dfd.promise;
|
|
25
|
+
core.init(settings, eventThrottle, ...rest)
|
|
26
|
+
.then(() => {
|
|
27
|
+
core.on(events_1.CORE_EVENT, onCoreEvent);
|
|
28
|
+
core.off(events_1.CORE_EVENT, eventThrottle);
|
|
29
|
+
state.core = core;
|
|
30
|
+
dfd.resolve(core);
|
|
31
|
+
})
|
|
32
|
+
.catch(dfd.reject)
|
|
33
|
+
.finally(() => {
|
|
34
|
+
initDfd = undefined;
|
|
35
|
+
delete state.initPromise;
|
|
36
|
+
});
|
|
37
|
+
return dfd.promise;
|
|
38
|
+
};
|
|
39
|
+
const dispose = () => {
|
|
40
|
+
var _a;
|
|
41
|
+
initDfd === null || initDfd === void 0 ? void 0 : initDfd.reject(new Error('Core disposed'));
|
|
42
|
+
initDfd = undefined;
|
|
43
|
+
(_a = state.core) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
44
|
+
delete state.initPromise;
|
|
45
|
+
delete state.core;
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
getOrInitCore,
|
|
49
|
+
getCore: () => state.core,
|
|
50
|
+
getInitPromise: () => state.initPromise,
|
|
51
|
+
dispose,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
exports.initCoreManager = initCoreManager;
|
|
55
|
+
//# sourceMappingURL=coreManager.js.map
|
package/lib/core/index.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ export declare class Core extends EventEmitter {
|
|
|
11
11
|
getCurrentMethod(): Promise<AbstractMethod<any, undefined>>;
|
|
12
12
|
getTransportInfo(): TransportInfo | undefined;
|
|
13
13
|
enumerate(): void;
|
|
14
|
+
init(settings: ConnectSettings, onCoreEvent: (message: CoreEventMessage) => void, logWriterFactory?: () => LogWriter | undefined): Promise<void>;
|
|
14
15
|
}
|
|
15
|
-
export declare const
|
|
16
|
+
export declare const initCoreState: () => {
|
|
17
|
+
getOrInitCore: (settings: ConnectSettings, onCoreEvent: (message: CoreEventMessage) => void, logWriterFactory?: (() => LogWriter | undefined) | undefined) => Promise<Core>;
|
|
18
|
+
getCore: () => Core | undefined;
|
|
19
|
+
getInitPromise: () => Promise<Core> | undefined;
|
|
20
|
+
dispose: () => void;
|
|
21
|
+
};
|
|
16
22
|
//# sourceMappingURL=index.d.ts.map
|