@trezor/connect 9.2.4-beta.2 → 9.2.5-beta.1
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 +87 -40
- package/README.md +1 -1
- package/lib/api/applySettings.js +1 -9
- package/lib/api/bitcoin/Fees.js +3 -4
- package/lib/api/bitcoin/TransactionComposer.js +3 -4
- package/lib/api/bitcoin/createPendingTx.js +3 -4
- 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/composeTransaction.d.ts +1 -1
- package/lib/api/composeTransaction.js +2 -2
- package/lib/api/ethereum/ethereumSignTypedData.js +4 -5
- 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/signTransaction.js +2 -3
- 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/index.js +1 -1
- package/lib/data/config.js +5 -0
- package/lib/data/deviceAuthenticityConfig.js +4 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +3 -3
- package/lib/device/Device.js +4 -6
- package/lib/device/DeviceCommands.d.ts +3 -3
- package/lib/factory.js +1 -0
- package/lib/index.d.ts +1 -1
- 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/lib/utils/formatUtils.js +3 -4
- package/package.json +11 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,46 +1,75 @@
|
|
|
1
|
-
|
|
|
2
|
-
|
|
|
3
|
-
|
|
|
4
|
-
|
|
|
5
|
-
| npm @trezor/connect-webextension | 9.2.
|
|
6
|
-
| connect.trezor.io/9 | 9.2.2 | x |
|
|
1
|
+
| Package | Stable | Canary |
|
|
2
|
+
| :------------------------------: | :----: | :----------: |
|
|
3
|
+
| npm @trezor/connect | 9.2.4 | 9.2.5-beta.1 |
|
|
4
|
+
| npm @trezor/connect-web | 9.2.4 | 9.2.5-beta.1 |
|
|
5
|
+
| npm @trezor/connect-webextension | 9.2.4 | 9.2.5-beta.1 |
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
| Deployment | Stable | Canary |
|
|
8
|
+
| :-----------------: | :----: | :----------: |
|
|
9
|
+
| connect.trezor.io/9 | 9.2.4 | 9.2.5-beta.1 |
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
- chore(connect): fw-update: add error message when binary is too small (b0c1173f8d)
|
|
12
|
-
- chore(connect): remove legacyresults from cardano fixtures (acd9e1e510)
|
|
13
|
-
- chore(connect): bump fw versions required for cardano (c3d96b3ca7)
|
|
14
|
-
- chore(connect): remove validation in cardanoSignTransaction, cardanoAddressParameters, cardanoGetAddress, device.validateState (33efb4b8bd,013047bdb1, 21fadd17a6, 29311b5d61)
|
|
15
|
-
- feat(connect): use full version in URL when beta (26c70f48f7)
|
|
16
|
-
- fix(connect): simultaneous read of connected devices (f181c988a4)
|
|
17
|
-
- chore(connect): DeviceList now has two params - full settings object and messages (b6167266c9)
|
|
18
|
-
- chore(connect): remove DataManager from DeviceList (afc8760213)
|
|
19
|
-
- chore(connect): remove DataManager dependency from DeviceList constructor (7971515d71)
|
|
20
|
-
- chore(connect): simplify reduce code duplication in DeviceList (0cf8a04ed0)
|
|
11
|
+
Use the persistent link connect.trezor.io/9 to access the latest stable version of Connect Explorer.
|
|
21
12
|
|
|
22
|
-
|
|
13
|
+
# 9.2.5-beta.1
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
Improved reliability of popup handshake mechanism.
|
|
16
|
+
Improved compatibility with webextensions using TrezorConnect inside offscreen (eg. Metamask).
|
|
17
|
+
Cardano: support Conway certificates, increase minimum supported FW to 2.6.0 to clean up legacy code.
|
|
18
|
+
Minor fixes in Connect Explorer and documentation.
|
|
26
19
|
|
|
27
|
-
|
|
20
|
+
- feat(connect): Add tag 258 support (90bf3a7)
|
|
21
|
+
- feat(connect): Conway certificates (ab003ce)
|
|
22
|
+
- feat(connect): applySettings - accept all validated params (65809d8)
|
|
23
|
+
- fix(connect): immediate switch from custom to default backend (b8348ca)
|
|
24
|
+
- fix(connect): remove getPublicKey coinInfo fallback (fb446f2)
|
|
25
|
+
- chore(connect): add new TS3 CA pubkeys and update timestamp (35486ba)
|
|
26
|
+
- chore(connect): update fw version number for cardano (d737d3c)
|
|
27
|
+
- chore(connect): center changelog version table (93fab15)
|
|
28
|
+
- chore(connect): change name in changelog table (bbc5499)
|
|
29
|
+
- chore(connect): remove canary from changelog
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
## connect-web
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
- close on popup cancellation, legacy mode for handshake
|
|
34
|
+
- check if chrome.tabs really available in webextension env
|
|
32
35
|
|
|
33
|
-
-
|
|
36
|
+
## connect-iframe
|
|
37
|
+
|
|
38
|
+
- handshake handling issues
|
|
39
|
+
|
|
40
|
+
## connect-explorer
|
|
41
|
+
|
|
42
|
+
- remove nextra reference from webextension, show amountUnit in signTransaction and fix favicon path
|
|
43
|
+
|
|
44
|
+
## connect-popup
|
|
45
|
+
|
|
46
|
+
- temporary workaround for CONTENT_SCRIPT_LOADED and handling of CONTENT_SCRIPT_LOADED
|
|
34
47
|
|
|
35
48
|
## Dependencies update
|
|
36
49
|
|
|
37
|
-
- npm-release: @trezor/blockchain-link 2.1.
|
|
38
|
-
- npm-release: @trezor/blockchain-link-types 1.0.
|
|
39
|
-
- npm-release: @trezor/
|
|
40
|
-
- npm-release: @trezor/
|
|
50
|
+
- npm-release: @trezor/blockchain-link 2.1.31-beta.1
|
|
51
|
+
- npm-release: @trezor/blockchain-link-types 1.0.18-beta.1
|
|
52
|
+
- npm-release: @trezor/transport 1.1.30-beta.1
|
|
53
|
+
- npm-release: @trezor/protobuf 1.0.14-beta.1
|
|
54
|
+
- npm-release: @trezor/protocol 1.0.10-beta.1
|
|
55
|
+
- npm-release: @trezor/utils 9.0.25-beta.1
|
|
41
56
|
|
|
42
|
-
# 9.2.4
|
|
57
|
+
# 9.2.4
|
|
43
58
|
|
|
59
|
+
- chore: BigNumber wrapper (d18ba9a879)
|
|
60
|
+
- chore(connect): add Rabby to knownHosts (1ec4c5bfc5)
|
|
61
|
+
- chore(transport): make Session type literal (72570f2219)
|
|
62
|
+
- chore(connect): re-add feature support checking in cardanoSignTransaction (acf9ffc2cb)
|
|
63
|
+
- chore(connect): fw-update: add error message when binary is too small (b0c1173f8d)
|
|
64
|
+
- chore(connect): remove legacyresults from cardano fixtures (acd9e1e510)
|
|
65
|
+
- chore(connect): bump fw versions required for cardano (c3d96b3ca7)
|
|
66
|
+
- chore(connect): remove validation in cardanoSignTransaction, cardanoAddressParameters, cardanoGetAddress, device.validateState (33efb4b8bd,013047bdb1, 21fadd17a6, 29311b5d61)
|
|
67
|
+
- feat(connect): use full version in URL when beta (26c70f48f7)
|
|
68
|
+
- fix(connect): simultaneous read of connected devices (f181c988a4)
|
|
69
|
+
- chore(connect): DeviceList now has two params - full settings object and messages (b6167266c9)
|
|
70
|
+
- chore(connect): remove DataManager from DeviceList (afc8760213)
|
|
71
|
+
- chore(connect): remove DataManager dependency from DeviceList constructor (7971515d71)
|
|
72
|
+
- chore(connect): simplify reduce code duplication in DeviceList (0cf8a04ed0)
|
|
44
73
|
- feat(connect): BackupDevice now has params (4120912)
|
|
45
74
|
- chore(connect): update protobuf messages (41bff13)
|
|
46
75
|
- chore(connect): add new TS3 CA pubkeys and update timestamp (3ae06ac)
|
|
@@ -49,10 +78,23 @@
|
|
|
49
78
|
- fix(connect): intermediary reconnect improved, device authenticity, multi-apps synchronization, reading translations, bin_outputs in txcache (115c718, de1b969, 140ec9a a881142, 88d7608, 0bb13d3)
|
|
50
79
|
- fix(connect): bin_outputs in txcache (0bb13d3)
|
|
51
80
|
|
|
81
|
+
## connect-examples
|
|
82
|
+
|
|
83
|
+
- Update building process to allow multiple lines replacing of url mv2 and mv3 (e88b6f6f47)
|
|
84
|
+
|
|
85
|
+
## connect-explorer
|
|
86
|
+
|
|
87
|
+
Connect-explorer has been completely revamped into a new design :tada:
|
|
88
|
+
|
|
89
|
+
- feat(connect-explorer): use relative paths for assets and connect (f6f7cdf32c)
|
|
90
|
+
- fix(connect-explorer): method testing tool scrollbars (f15f6487d8)
|
|
91
|
+
- fix(connect-explorer): support GitHub emoji (fda80e5aa3)
|
|
92
|
+
|
|
52
93
|
## connect-popup
|
|
53
94
|
|
|
54
95
|
In general measures to address popup closing unexpectedly were taken. Update of content-script.js will be needed to make these changes effective.
|
|
55
96
|
|
|
97
|
+
- fix(connect-popup): use PassphraseTypeCardLegacy (629d6f8671)
|
|
56
98
|
- fix(connect-popup): update text in selectAccount (21f4382)
|
|
57
99
|
- fix(connect-popup): add delay before popup bootstrap to allow contentscript load (00b2056)
|
|
58
100
|
- fix(connect-popup): webextension example e2e (b9cce02)
|
|
@@ -61,20 +103,25 @@ In general measures to address popup closing unexpectedly were taken. Update of
|
|
|
61
103
|
- fix(connect-popup): delay popup.js loading to allow content script to init (92d15bc)
|
|
62
104
|
- fix(connect-popup): wait for POPUP.LOADED in webextension (cb18673)
|
|
63
105
|
|
|
64
|
-
##
|
|
106
|
+
## transport
|
|
65
107
|
|
|
66
|
-
|
|
108
|
+
- feat(transport): make signal required param in constructor (4b82f8d505)
|
|
67
109
|
|
|
68
110
|
## Dependencies update
|
|
69
111
|
|
|
70
|
-
- npm-release: @trezor/blockchain-link
|
|
71
|
-
- npm-release: @trezor/blockchain-link-
|
|
72
|
-
- npm-release: @trezor/
|
|
73
|
-
- npm-release: @trezor/connect-
|
|
74
|
-
- npm-release: @trezor/
|
|
75
|
-
- npm-release: @trezor/
|
|
76
|
-
- npm-release: @trezor/
|
|
77
|
-
- npm-release: @trezor/
|
|
112
|
+
- npm-release: @trezor/blockchain-link 2.1.30
|
|
113
|
+
- npm-release: @trezor/blockchain-link-utils 1.0.18
|
|
114
|
+
- npm-release: @trezor/blockchain-link-types 1.0.17
|
|
115
|
+
- npm-release: @trezor/connect-analytics 1.0.15
|
|
116
|
+
- npm-release: @trezor/analytics 1.0.17
|
|
117
|
+
- npm-release: @trezor/connect-common 0.0.33
|
|
118
|
+
- npm-release: @trezor/env-utils 1.0.17
|
|
119
|
+
- npm-release: @trezor/transport 1.1.29
|
|
120
|
+
- npm-release: @trezor/protobuf 1.0.13
|
|
121
|
+
- npm-release: @trezor/schema-utils 1.0.4
|
|
122
|
+
- npm-release: @trezor/protocol 1.0.9
|
|
123
|
+
- npm-release: @trezor/utxo-lib 2.0.10
|
|
124
|
+
- npm-release: @trezor/utils 9.0.24
|
|
78
125
|
|
|
79
126
|
# 9.2.3
|
|
80
127
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @trezor/connect
|
|
2
2
|
|
|
3
|
-
API version 9.2.
|
|
3
|
+
API version 9.2.5-beta.1
|
|
4
4
|
|
|
5
5
|
[](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@trezor/connect)
|
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
|
}
|
package/lib/api/bitcoin/Fees.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FeeLevels = void 0;
|
|
4
|
-
const
|
|
5
|
-
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
|
|
4
|
+
const bigNumber_1 = require("@trezor/utils/lib/bigNumber");
|
|
6
5
|
const convertFeeRate = (fee, minFee) => {
|
|
7
|
-
const feePerKB = new
|
|
6
|
+
const feePerKB = new bigNumber_1.BigNumber(fee);
|
|
8
7
|
if (feePerKB.isNaN() || feePerKB.lte('0'))
|
|
9
8
|
return;
|
|
10
9
|
const feePerB = feePerKB.div(1000);
|
|
@@ -41,7 +40,7 @@ const findLowest = (blocks) => blocks
|
|
|
41
40
|
.reverse()
|
|
42
41
|
.find(item => typeof item === 'string');
|
|
43
42
|
const findBlocksForFee = (feePerUnit, blocks) => {
|
|
44
|
-
const bn = new
|
|
43
|
+
const bn = new bigNumber_1.BigNumber(feePerUnit);
|
|
45
44
|
const lower = blocks.find(b => typeof b === 'string' && bn.gte(b));
|
|
46
45
|
if (!lower)
|
|
47
46
|
return -1;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TransactionComposer = void 0;
|
|
4
|
-
const
|
|
5
|
-
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
|
|
4
|
+
const bigNumber_1 = require("@trezor/utils/lib/bigNumber");
|
|
6
5
|
const utxo_lib_1 = require("@trezor/utxo-lib");
|
|
7
6
|
const Fees_1 = require("./Fees");
|
|
8
7
|
class TransactionComposer {
|
|
@@ -24,7 +23,7 @@ class TransactionComposer {
|
|
|
24
23
|
.concat(addresses.change)
|
|
25
24
|
.map(a => a.address);
|
|
26
25
|
this.utxos = options.utxos.flatMap(u => {
|
|
27
|
-
if (!u.required && new
|
|
26
|
+
if (!u.required && new bigNumber_1.BigNumber(u.amount).lte(this.coinInfo.dustLimit))
|
|
28
27
|
return [];
|
|
29
28
|
return {
|
|
30
29
|
...u,
|
|
@@ -55,7 +54,7 @@ class TransactionComposer {
|
|
|
55
54
|
});
|
|
56
55
|
if (!atLeastOneValid) {
|
|
57
56
|
const lastLevel = levels[levels.length - 1];
|
|
58
|
-
let lastFee = new
|
|
57
|
+
let lastFee = new bigNumber_1.BigNumber(lastLevel.feePerUnit);
|
|
59
58
|
while (lastFee.gt(this.coinInfo.minFee) && this.composed.custom === undefined) {
|
|
60
59
|
lastFee = lastFee.minus(1);
|
|
61
60
|
const tx = this.compose(lastFee.toString());
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPendingTransaction = void 0;
|
|
4
|
-
const
|
|
5
|
-
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
|
|
4
|
+
const bigNumber_1 = require("@trezor/utils/lib/bigNumber");
|
|
6
5
|
const pathUtils_1 = require("../../utils/pathUtils");
|
|
7
6
|
const createPendingTransaction = (tx, { addresses, inputs, outputs, }) => {
|
|
8
|
-
const valueOut = outputs.reduce((sum, out) => (0,
|
|
9
|
-
const valueIn = inputs.reduce((sum, ins) => (0,
|
|
7
|
+
const valueOut = outputs.reduce((sum, out) => (0, bigNumber_1.BigNumber)(sum).plus(out.amount), new bigNumber_1.BigNumber('0'));
|
|
8
|
+
const valueIn = inputs.reduce((sum, ins) => (0, bigNumber_1.BigNumber)(sum).plus(ins.amount), new bigNumber_1.BigNumber('0'));
|
|
10
9
|
const allAddresses = addresses.unused.concat(addresses.used, addresses.change);
|
|
11
10
|
const findAddress = ({ address_n }) => {
|
|
12
11
|
const path = address_n ? (0, pathUtils_1.getSerializedPath)(address_n) : undefined;
|
|
@@ -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 => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
4
|
+
const bigNumber_1 = require("@trezor/utils/lib/bigNumber");
|
|
5
5
|
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
6
6
|
const constants_1 = require("../constants");
|
|
7
7
|
const events_1 = require("../events");
|
|
@@ -36,7 +36,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
36
36
|
(0, BlockchainLink_1.isBackendSupported)(coinInfo);
|
|
37
37
|
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, coinInfo, this.firmwareRange);
|
|
38
38
|
const outputs = [];
|
|
39
|
-
let total = new
|
|
39
|
+
let total = new bigNumber_1.BigNumber(0);
|
|
40
40
|
payload.outputs.forEach(out => {
|
|
41
41
|
const output = (0, bitcoin_1.validateHDOutput)(out, coinInfo);
|
|
42
42
|
if ('amount' in output && typeof output.amount === 'string') {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFieldType = exports.encodeData = exports.parseArrayType = void 0;
|
|
4
|
-
const
|
|
5
|
-
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
|
|
4
|
+
const bigNumber_1 = require("@trezor/utils/lib/bigNumber");
|
|
6
5
|
const constants_1 = require("../../constants");
|
|
7
6
|
const formatUtils_1 = require("../../utils/formatUtils");
|
|
8
7
|
const paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/);
|
|
@@ -24,9 +23,9 @@ function twosComplement(number, bytes) {
|
|
|
24
23
|
if (bytes < 1 || bytes > 32) {
|
|
25
24
|
throw constants_1.ERRORS.TypedError('Runtime', 'Int byte size must be between 1 and 32 (8 and 256 bits)');
|
|
26
25
|
}
|
|
27
|
-
const minValue = new
|
|
26
|
+
const minValue = new bigNumber_1.BigNumber(2).exponentiatedBy(bytes * 8 - 1).negated();
|
|
28
27
|
const maxValue = minValue.negated().minus(1);
|
|
29
|
-
const bigNumber = new
|
|
28
|
+
const bigNumber = new bigNumber_1.BigNumber(number);
|
|
30
29
|
if (bigNumber.isGreaterThan(maxValue) || bigNumber.isLessThan(minValue)) {
|
|
31
30
|
throw constants_1.ERRORS.TypedError('Runtime', `Overflow when trying to convert number ${number} into ${bytes} bytes`);
|
|
32
31
|
}
|
|
@@ -36,7 +35,7 @@ function twosComplement(number, bytes) {
|
|
|
36
35
|
return bigNumber.minus(minValue).minus(minValue);
|
|
37
36
|
}
|
|
38
37
|
function intToHex(number, bytes, signed) {
|
|
39
|
-
let bigNumber = new
|
|
38
|
+
let bigNumber = new bigNumber_1.BigNumber(number);
|
|
40
39
|
if (signed) {
|
|
41
40
|
bigNumber = twosComplement(bigNumber, bytes);
|
|
42
41
|
}
|
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
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
|
|
3
|
+
const bigNumber_1 = require("@trezor/utils/lib/bigNumber");
|
|
5
4
|
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
6
5
|
const paramsValidator_1 = require("./common/paramsValidator");
|
|
7
6
|
const coinInfo_1 = require("../data/coinInfo");
|
|
@@ -65,7 +64,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
65
64
|
const outputsWithAmount = outputs.filter(output => typeof output.amount === 'string' &&
|
|
66
65
|
!Object.prototype.hasOwnProperty.call(output, 'op_return_data'));
|
|
67
66
|
if (outputsWithAmount.length > 0) {
|
|
68
|
-
const total = outputsWithAmount.reduce((bn, output) => bn.plus(typeof output.amount === 'string' ? output.amount : '0'), new
|
|
67
|
+
const total = outputsWithAmount.reduce((bn, output) => bn.plus(typeof output.amount === 'string' ? output.amount : '0'), new bigNumber_1.BigNumber(0));
|
|
69
68
|
if (total.lt(coinInfo.dustLimit)) {
|
|
70
69
|
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Total amount is below dust limit.');
|
|
71
70
|
}
|
|
@@ -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;
|
package/lib/core/index.js
CHANGED
|
@@ -196,7 +196,7 @@ const inner = async (method, device) => {
|
|
|
196
196
|
return Promise.reject(constants_1.ERRORS.TypedError('Method_PermissionsNotGranted'));
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
const deviceNeedsBackup = device.features.
|
|
199
|
+
const deviceNeedsBackup = device.features.backup_availability === 'Required';
|
|
200
200
|
if (deviceNeedsBackup) {
|
|
201
201
|
if (method.noBackupConfirmationMode === 'always' ||
|
|
202
202
|
(method.noBackupConfirmationMode === 'popup-only' && isUsingPopup)) {
|
package/lib/data/config.js
CHANGED
|
@@ -25,7 +25,7 @@ exports.DeviceAuthenticityConfig = schema_utils_1.Type.Intersect([
|
|
|
25
25
|
]);
|
|
26
26
|
exports.deviceAuthenticityConfig = {
|
|
27
27
|
version: 1,
|
|
28
|
-
timestamp: '2024-05-
|
|
28
|
+
timestamp: '2024-05-31T12:00:00+00:00',
|
|
29
29
|
T2B1: {
|
|
30
30
|
rootPubKeys: [
|
|
31
31
|
'04ca97480ac0d7b1e6efafe518cd433cec2bf8ab9822d76eafd34363b55d63e60380bff20acc75cde03cffcb50ab6f8ce70c878e37ebc58ff7cca0a83b16b15fa5',
|
|
@@ -52,6 +52,9 @@ exports.deviceAuthenticityConfig = {
|
|
|
52
52
|
'04d7ddaf7e17a678bef305950f0f9d74b90553d8502fd02c439f07ac7ea494e9e0519a1c5782bf23be058162e706057d3b241d507f89b9e5518e3696a92128fa6d',
|
|
53
53
|
'0488cf1dbadb18df0a094da837b3eeb0c85489cc21e7c2b94f8f4df207edccfddbb58e428d9a6ce1e42081c38665d134c7ee6f1f524688ce7444bc1d1340a8b1f1',
|
|
54
54
|
'04ff0c6e817d7c00a0912cf1d293e4d3a8c25403dca4e8ced5e7323352e34604725ad67739d1b4bf538a3864e95d8311ebc91d522b1603da94061e82535edced56',
|
|
55
|
+
'0445f15e55a044b1516a7b2cc13dd4e9ea415336f622b9185e4ffc19e2b51627637491195c85f87ac2582ac4a8d89a33983f0700d042fd7e57d55d346f4fbc832c',
|
|
56
|
+
'042b9cede77aa38f1d824ebd5e13129c8c1c163f3ea74b5251e420831ec17329be741b2af96cc6df0c253e4bffdac23f4bb373e53ae1821587ce0ecae476d2b95c',
|
|
57
|
+
'040cea26562b3763dddd741f4428f37cdc931dbd2db9665888505c2be42868ee2d739aed1d0a54c116b889f5d1ff57dae8dcc1e595cf6d69e71853a8053449ab9f',
|
|
55
58
|
],
|
|
56
59
|
debug: {
|
|
57
60
|
rootPubKeys: [
|
package/lib/data/version.d.ts
CHANGED
package/lib/data/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_DOMAIN = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '9.2.
|
|
4
|
+
exports.VERSION = '9.2.5-beta.1';
|
|
5
5
|
const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
|
|
6
6
|
const isBeta = exports.VERSION.includes('beta');
|
|
7
7
|
exports.DEFAULT_DOMAIN = isBeta
|
package/lib/device/Device.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TypedEmitter } from '@trezor/utils';
|
|
2
|
-
import {
|
|
1
|
+
import { Deferred, TypedEmitter } from '@trezor/utils';
|
|
2
|
+
import { Session } from '@trezor/transport';
|
|
3
3
|
import { TransportProtocol } from '@trezor/protocol';
|
|
4
4
|
import { DeviceCommands, PassphrasePromptResponse } from './DeviceCommands';
|
|
5
5
|
import { PROTO, NETWORK } from '../constants';
|
|
@@ -40,7 +40,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
40
40
|
loaded: boolean;
|
|
41
41
|
inconsistent: boolean;
|
|
42
42
|
firstRunPromise: Deferred<boolean>;
|
|
43
|
-
activitySessionID?:
|
|
43
|
+
activitySessionID?: Session | null;
|
|
44
44
|
commands?: DeviceCommands;
|
|
45
45
|
keepSession: boolean;
|
|
46
46
|
instance: number;
|
package/lib/device/Device.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Device = exports.GET_FEATURES_TIMEOUT = void 0;
|
|
4
4
|
const utils_1 = require("@trezor/utils");
|
|
5
|
-
const utils_2 = require("@trezor/utils");
|
|
6
|
-
const utils_3 = require("@trezor/utils");
|
|
7
5
|
const protocol_1 = require("@trezor/protocol");
|
|
8
6
|
const DeviceCommands_1 = require("./DeviceCommands");
|
|
9
7
|
const constants_1 = require("../constants");
|
|
@@ -47,7 +45,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
47
45
|
}
|
|
48
46
|
this.transport = transport;
|
|
49
47
|
this.originalDescriptor = descriptor;
|
|
50
|
-
this.firstRunPromise = (0,
|
|
48
|
+
this.firstRunPromise = (0, utils_1.createDeferred)();
|
|
51
49
|
}
|
|
52
50
|
static fromDescriptor(transport, originalDescriptor) {
|
|
53
51
|
const descriptor = { ...originalDescriptor, session: null };
|
|
@@ -124,7 +122,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
124
122
|
throw constants_1.ERRORS.TypedError('Device_CallInProgress');
|
|
125
123
|
}
|
|
126
124
|
options = parseRunOptions(options);
|
|
127
|
-
const runPromise = (0,
|
|
125
|
+
const runPromise = (0, utils_1.createDeferred)();
|
|
128
126
|
this.runPromise = runPromise;
|
|
129
127
|
this._runInner(fn, options).catch(err => {
|
|
130
128
|
runPromise.reject(err);
|
|
@@ -380,7 +378,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
380
378
|
feat.minor_version,
|
|
381
379
|
feat.patch_version,
|
|
382
380
|
];
|
|
383
|
-
if (!
|
|
381
|
+
if (!utils_1.versionUtils.isEqual(version, this.getVersion())) {
|
|
384
382
|
this.unavailableCapabilities = (0, deviceFeaturesUtils_1.getUnavailableCapabilities)(feat, (0, coinInfo_1.getAllNetworks)());
|
|
385
383
|
this.firmwareStatus = (0, firmwareInfo_1.getFirmwareStatus)(feat);
|
|
386
384
|
this.firmwareRelease = (0, firmwareInfo_1.getRelease)(feat);
|
|
@@ -448,7 +446,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
448
446
|
if (!this.features)
|
|
449
447
|
return false;
|
|
450
448
|
const modelVersion = typeof versions === 'string' ? versions : versions[this.features.major_version - 1];
|
|
451
|
-
return
|
|
449
|
+
return utils_1.versionUtils.isNewerOrEqual(this.getVersion().join('.'), modelVersion);
|
|
452
450
|
}
|
|
453
451
|
isUsed() {
|
|
454
452
|
return typeof this.originalDescriptor.session === 'string';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transport } from '@trezor/transport';
|
|
1
|
+
import { Transport, Session } from '@trezor/transport';
|
|
2
2
|
import { MessagesSchema as Messages } from '@trezor/protobuf';
|
|
3
3
|
import { Device } from './Device';
|
|
4
4
|
import type { CoinInfo, BitcoinNetworkInfo } from '../types';
|
|
@@ -21,12 +21,12 @@ export type PassphrasePromptResponse = {
|
|
|
21
21
|
export declare class DeviceCommands {
|
|
22
22
|
device: Device;
|
|
23
23
|
transport: Transport;
|
|
24
|
-
sessionId:
|
|
24
|
+
sessionId: Session;
|
|
25
25
|
disposed: boolean;
|
|
26
26
|
callPromise?: ReturnType<Transport['call']>;
|
|
27
27
|
_cancelableRequest?: (error?: any) => void;
|
|
28
28
|
_cancelableRequestBySend?: boolean;
|
|
29
|
-
constructor(device: Device, transport: Transport, sessionId:
|
|
29
|
+
constructor(device: Device, transport: Transport, sessionId: Session);
|
|
30
30
|
dispose(): void;
|
|
31
31
|
isDisposed(): boolean;
|
|
32
32
|
unlockPath(params?: Messages.UnlockPath): Promise<TypedResponseMessage<"UnlockedPathRequest">>;
|
package/lib/factory.js
CHANGED
|
@@ -127,6 +127,7 @@ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse,
|
|
|
127
127
|
recoveryDevice: params => call({ ...params, method: 'recoveryDevice' }),
|
|
128
128
|
getCoinInfo: params => call({ ...params, method: 'getCoinInfo' }),
|
|
129
129
|
rebootToBootloader: params => call({ ...params, method: 'rebootToBootloader' }),
|
|
130
|
+
setBrightness: params => call({ ...params, method: 'setBrightness' }),
|
|
130
131
|
setBusy: params => call({ ...params, method: 'setBusy' }),
|
|
131
132
|
setProxy: params => call({ ...params, method: 'setProxy' }),
|
|
132
133
|
dispose,
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import EventEmitter from 'events';
|
|
3
|
-
export declare const eventEmitter: EventEmitter
|
|
3
|
+
export declare const eventEmitter: EventEmitter<[never]>;
|
|
4
4
|
declare const TrezorConnect: import("./types").TrezorConnect;
|
|
5
5
|
export default TrezorConnect;
|
|
6
6
|
export * from './exports';
|
|
@@ -15,6 +15,7 @@ export declare const ApplySettings: import("@sinclair/typebox").TObject<{
|
|
|
15
15
|
safety_checks: import("@sinclair/typebox").TOptional<import("@trezor/schema-utils/lib/custom-types/keyof-enum").TKeyOfEnum<typeof PROTO.Enum_SafetyCheckLevel>>;
|
|
16
16
|
experimental_features: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
17
17
|
hide_passphrase_from_host: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
18
|
+
haptic_feedback: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
18
19
|
}>;
|
|
19
20
|
export declare function applySettings(params: Params<ApplySettings>): Response<PROTO.Success>;
|
|
20
21
|
//# sourceMappingURL=applySettings.d.ts.map
|
|
@@ -194,6 +194,12 @@ export declare const CardanoPoolParameters: import("@sinclair/typebox").TObject<
|
|
|
194
194
|
hash: import("@sinclair/typebox").TString;
|
|
195
195
|
}>>;
|
|
196
196
|
}>;
|
|
197
|
+
export type CardanoDRep = Static<typeof CardanoDRep>;
|
|
198
|
+
export declare const CardanoDRep: import("@sinclair/typebox").TObject<{
|
|
199
|
+
type: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDRepType>;
|
|
200
|
+
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
201
|
+
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
202
|
+
}>;
|
|
197
203
|
export type CardanoCertificate = Static<typeof CardanoCertificate>;
|
|
198
204
|
export declare const CardanoCertificate: import("@sinclair/typebox").TObject<{
|
|
199
205
|
type: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoCertificateType>;
|
|
@@ -227,6 +233,12 @@ export declare const CardanoCertificate: import("@sinclair/typebox").TObject<{
|
|
|
227
233
|
}>>;
|
|
228
234
|
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
229
235
|
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
236
|
+
deposit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
237
|
+
dRep: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
238
|
+
type: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDRepType>;
|
|
239
|
+
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
240
|
+
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
241
|
+
}>>;
|
|
230
242
|
}>;
|
|
231
243
|
export type CardanoWithdrawal = Static<typeof CardanoWithdrawal>;
|
|
232
244
|
export declare const CardanoWithdrawal: import("@sinclair/typebox").TObject<{
|
|
@@ -392,6 +404,12 @@ export declare const CardanoSignTransaction: import("@sinclair/typebox").TObject
|
|
|
392
404
|
}>>;
|
|
393
405
|
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
394
406
|
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
407
|
+
deposit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
408
|
+
dRep: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
409
|
+
type: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDRepType>;
|
|
410
|
+
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
411
|
+
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
412
|
+
}>>;
|
|
395
413
|
}>>>;
|
|
396
414
|
withdrawals: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
397
415
|
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>>;
|
|
@@ -489,6 +507,7 @@ export declare const CardanoSignTransaction: import("@sinclair/typebox").TObject
|
|
|
489
507
|
derivationType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDerivationType>>;
|
|
490
508
|
includeNetworkId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
491
509
|
chunkify: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
510
|
+
tagCborSets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
492
511
|
}>;
|
|
493
512
|
export type CardanoSignTransactionExtended = Static<typeof CardanoSignTransactionExtended>;
|
|
494
513
|
export declare const CardanoSignTransactionExtended: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
@@ -562,6 +581,12 @@ export declare const CardanoSignTransactionExtended: import("@sinclair/typebox")
|
|
|
562
581
|
}>>;
|
|
563
582
|
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
564
583
|
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
584
|
+
deposit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
585
|
+
dRep: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
586
|
+
type: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDRepType>;
|
|
587
|
+
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
588
|
+
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
589
|
+
}>>;
|
|
565
590
|
}>>>;
|
|
566
591
|
withdrawals: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
567
592
|
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>>;
|
|
@@ -659,6 +684,7 @@ export declare const CardanoSignTransactionExtended: import("@sinclair/typebox")
|
|
|
659
684
|
derivationType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDerivationType>>;
|
|
660
685
|
includeNetworkId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
661
686
|
chunkify: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
687
|
+
tagCborSets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
662
688
|
}>, import("@sinclair/typebox").TObject<{
|
|
663
689
|
unsignedTx: import("@sinclair/typebox").TObject<{
|
|
664
690
|
body: import("@sinclair/typebox").TString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CardanoSignedTxData = exports.CardanoAuxiliaryDataSupplement = exports.CardanoSignedTxWitness = exports.CardanoSignTransactionExtended = exports.CardanoSignTransaction = exports.CardanoAuxiliaryData = exports.CardanoCVoteRegistrationParameters = exports.CardanoCVoteRegistrationDelegation = exports.CardanoReferenceInput = exports.CardanoRequiredSigner = exports.CardanoCollateralInput = exports.CardanoMint = exports.CardanoWithdrawal = exports.CardanoCertificate = exports.CardanoPoolParameters = exports.CardanoPoolMargin = exports.CardanoPoolMetadata = exports.CardanoPoolRelay = exports.CardanoPoolOwner = exports.CardanoOutput = exports.CardanoAssetGroup = exports.CardanoToken = exports.CardanoInput = exports.CardanoGetPublicKey = exports.CardanoNativeScriptHash = exports.CardanoGetNativeScriptHash = exports.CardanoNativeScript = exports.CardanoGetAddress = exports.CardanoAddressParameters = exports.CardanoCertificatePointer = void 0;
|
|
3
|
+
exports.CardanoSignedTxData = exports.CardanoAuxiliaryDataSupplement = exports.CardanoSignedTxWitness = exports.CardanoSignTransactionExtended = exports.CardanoSignTransaction = exports.CardanoAuxiliaryData = exports.CardanoCVoteRegistrationParameters = exports.CardanoCVoteRegistrationDelegation = exports.CardanoReferenceInput = exports.CardanoRequiredSigner = exports.CardanoCollateralInput = exports.CardanoMint = exports.CardanoWithdrawal = exports.CardanoCertificate = exports.CardanoDRep = exports.CardanoPoolParameters = exports.CardanoPoolMargin = exports.CardanoPoolMetadata = exports.CardanoPoolRelay = exports.CardanoPoolOwner = exports.CardanoOutput = exports.CardanoAssetGroup = exports.CardanoToken = exports.CardanoInput = exports.CardanoGetPublicKey = exports.CardanoNativeScriptHash = exports.CardanoGetNativeScriptHash = exports.CardanoNativeScript = exports.CardanoGetAddress = exports.CardanoAddressParameters = exports.CardanoCertificatePointer = void 0;
|
|
4
4
|
const schema_utils_1 = require("@trezor/schema-utils");
|
|
5
5
|
const constants_1 = require("../../../constants");
|
|
6
6
|
const params_1 = require("../../params");
|
|
@@ -112,6 +112,11 @@ exports.CardanoPoolParameters = schema_utils_1.Type.Object({
|
|
|
112
112
|
relays: schema_utils_1.Type.Array(exports.CardanoPoolRelay),
|
|
113
113
|
metadata: schema_utils_1.Type.Optional(exports.CardanoPoolMetadata),
|
|
114
114
|
});
|
|
115
|
+
exports.CardanoDRep = schema_utils_1.Type.Object({
|
|
116
|
+
type: constants_1.PROTO.EnumCardanoDRepType,
|
|
117
|
+
keyHash: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
118
|
+
scriptHash: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
119
|
+
});
|
|
115
120
|
exports.CardanoCertificate = schema_utils_1.Type.Object({
|
|
116
121
|
type: constants_1.PROTO.EnumCardanoCertificateType,
|
|
117
122
|
path: schema_utils_1.Type.Optional(params_1.DerivationPath),
|
|
@@ -119,6 +124,8 @@ exports.CardanoCertificate = schema_utils_1.Type.Object({
|
|
|
119
124
|
poolParameters: schema_utils_1.Type.Optional(exports.CardanoPoolParameters),
|
|
120
125
|
scriptHash: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
121
126
|
keyHash: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
127
|
+
deposit: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
128
|
+
dRep: schema_utils_1.Type.Optional(exports.CardanoDRep),
|
|
122
129
|
});
|
|
123
130
|
exports.CardanoWithdrawal = schema_utils_1.Type.Object({
|
|
124
131
|
path: schema_utils_1.Type.Optional(params_1.DerivationPath),
|
|
@@ -181,6 +188,7 @@ exports.CardanoSignTransaction = schema_utils_1.Type.Object({
|
|
|
181
188
|
derivationType: schema_utils_1.Type.Optional(constants_1.PROTO.EnumCardanoDerivationType),
|
|
182
189
|
includeNetworkId: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
183
190
|
chunkify: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
191
|
+
tagCborSets: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
184
192
|
});
|
|
185
193
|
exports.CardanoSignTransactionExtended = schema_utils_1.Type.Intersect([
|
|
186
194
|
exports.CardanoSignTransaction,
|
package/lib/types/api/index.d.ts
CHANGED
|
@@ -18,14 +18,16 @@ import { blockchainSubscribeFiatRates } from './blockchainSubscribeFiatRates';
|
|
|
18
18
|
import { blockchainUnsubscribe } from './blockchainUnsubscribe';
|
|
19
19
|
import { blockchainUnsubscribeFiatRates } from './blockchainUnsubscribeFiatRates';
|
|
20
20
|
import { cancel } from './cancel';
|
|
21
|
+
import { cancelCoinjoinAuthorization } from './cancelCoinjoinAuthorization';
|
|
22
|
+
import { cardanoComposeTransaction } from './cardanoComposeTransaction';
|
|
21
23
|
import { cardanoGetAddress } from './cardanoGetAddress';
|
|
22
24
|
import { cardanoGetNativeScriptHash } from './cardanoGetNativeScriptHash';
|
|
23
25
|
import { cardanoGetPublicKey } from './cardanoGetPublicKey';
|
|
24
26
|
import { cardanoSignTransaction } from './cardanoSignTransaction';
|
|
25
|
-
import { cardanoComposeTransaction } from './cardanoComposeTransaction';
|
|
26
27
|
import { changeLanguage } from './changeLanguage';
|
|
27
28
|
import { changePin } from './changePin';
|
|
28
29
|
import { changeWipeCode } from './changeWipeCode';
|
|
30
|
+
import { checkFirmwareAuthenticity } from './checkFirmwareAuthenticity';
|
|
29
31
|
import { cipherKeyValue } from './cipherKeyValue';
|
|
30
32
|
import { composeTransaction } from './composeTransaction';
|
|
31
33
|
import { disableWebUSB } from './disableWebUSB';
|
|
@@ -66,12 +68,14 @@ import { requestWebUSBDevice } from './requestWebUSBDevice';
|
|
|
66
68
|
import { resetDevice } from './resetDevice';
|
|
67
69
|
import { rippleGetAddress } from './rippleGetAddress';
|
|
68
70
|
import { rippleSignTransaction } from './rippleSignTransaction';
|
|
71
|
+
import { setBrightness } from './setBrightness';
|
|
69
72
|
import { setBusy } from './setBusy';
|
|
70
73
|
import { setProxy } from './setProxy';
|
|
74
|
+
import { showDeviceTutorial } from './showDeviceTutorial';
|
|
71
75
|
import { signMessage } from './signMessage';
|
|
72
76
|
import { signTransaction } from './signTransaction';
|
|
73
|
-
import { solanaGetPublicKey } from './solanaGetPublicKey';
|
|
74
77
|
import { solanaGetAddress } from './solanaGetAddress';
|
|
78
|
+
import { solanaGetPublicKey } from './solanaGetPublicKey';
|
|
75
79
|
import { solanaSignTransaction } from './solanaSignTransaction';
|
|
76
80
|
import { stellarGetAddress } from './stellarGetAddress';
|
|
77
81
|
import { stellarSignTransaction } from './stellarSignTransaction';
|
|
@@ -82,9 +86,6 @@ import { uiResponse } from './uiResponse';
|
|
|
82
86
|
import { unlockPath } from './unlockPath';
|
|
83
87
|
import { verifyMessage } from './verifyMessage';
|
|
84
88
|
import { wipeDevice } from './wipeDevice';
|
|
85
|
-
import { checkFirmwareAuthenticity } from './checkFirmwareAuthenticity';
|
|
86
|
-
import { cancelCoinjoinAuthorization } from './cancelCoinjoinAuthorization';
|
|
87
|
-
import { showDeviceTutorial } from './showDeviceTutorial';
|
|
88
89
|
export interface TrezorConnect {
|
|
89
90
|
applyFlags: typeof applyFlags;
|
|
90
91
|
applySettings: typeof applySettings;
|
|
@@ -156,6 +157,7 @@ export interface TrezorConnect {
|
|
|
156
157
|
resetDevice: typeof resetDevice;
|
|
157
158
|
rippleGetAddress: typeof rippleGetAddress;
|
|
158
159
|
rippleSignTransaction: typeof rippleSignTransaction;
|
|
160
|
+
setBrightness: typeof setBrightness;
|
|
159
161
|
setBusy: typeof setBusy;
|
|
160
162
|
setProxy: typeof setProxy;
|
|
161
163
|
signMessage: typeof signMessage;
|
|
@@ -5,13 +5,13 @@ export type RecoveryDevice = Static<typeof RecoveryDevice>;
|
|
|
5
5
|
export declare const RecoveryDevice: import("@sinclair/typebox").TObject<{
|
|
6
6
|
language: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
7
7
|
label: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
-
type: import("@sinclair/typebox").TOptional<import("@
|
|
8
|
+
type: import("@sinclair/typebox").TOptional<import("@trezor/schema-utils/lib/custom-types/keyof-enum").TKeyOfEnum<typeof PROTO.Enum_RecoveryType>>;
|
|
9
9
|
pin_protection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
10
10
|
passphrase_protection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
11
11
|
word_count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<12>, import("@sinclair/typebox").TLiteral<18>, import("@sinclair/typebox").TLiteral<24>]>]>>;
|
|
12
12
|
enforce_wordlist: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
13
|
+
input_method: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof PROTO.RecoveryDeviceInputMethod>>;
|
|
13
14
|
u2f_counter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
14
|
-
dry_run: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
15
15
|
}>;
|
|
16
16
|
export declare function recoveryDevice(params: Params<RecoveryDevice>): Response<PROTO.Success>;
|
|
17
17
|
//# sourceMappingURL=recoveryDevice.d.ts.map
|
package/lib/utils/formatUtils.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deepTransform = exports.messageToHex = exports.addHexPrefix = exports.stripHexPrefix = exports.hasHexPrefix = exports.btckb2satoshib = exports.formatTime = exports.formatAmount = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const formatAmount = (n, coinInfo) => `${new bignumber_js_1.default(n).div(10 ** coinInfo.decimals).toString(10)} ${coinInfo.shortcut}`;
|
|
4
|
+
const bigNumber_1 = require("@trezor/utils/lib/bigNumber");
|
|
5
|
+
const formatAmount = (n, coinInfo) => `${new bigNumber_1.BigNumber(n).div(10 ** coinInfo.decimals).toString(10)} ${coinInfo.shortcut}`;
|
|
7
6
|
exports.formatAmount = formatAmount;
|
|
8
7
|
const formatTime = (n) => {
|
|
9
8
|
if (!n || n <= 0)
|
|
@@ -24,7 +23,7 @@ const formatTime = (n) => {
|
|
|
24
23
|
return res;
|
|
25
24
|
};
|
|
26
25
|
exports.formatTime = formatTime;
|
|
27
|
-
const btckb2satoshib = (n) => new
|
|
26
|
+
const btckb2satoshib = (n) => new bigNumber_1.BigNumber(n).times(1e5).toFixed(0, bigNumber_1.BigNumber.ROUND_HALF_UP);
|
|
28
27
|
exports.btckb2satoshib = btckb2satoshib;
|
|
29
28
|
const hasHexPrefix = (str) => str.slice(0, 2).toLowerCase() === '0x';
|
|
30
29
|
exports.hasHexPrefix = hasHexPrefix;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trezor/connect",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.5-beta.1",
|
|
4
4
|
"author": "Trezor <info@trezor.io>",
|
|
5
5
|
"homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/connect",
|
|
6
6
|
"description": "High-level javascript interface for Trezor hardware wallet.",
|
|
@@ -70,17 +70,16 @@
|
|
|
70
70
|
"@ethereumjs/common": "^4.2.0",
|
|
71
71
|
"@ethereumjs/tx": "^5.2.1",
|
|
72
72
|
"@fivebinaries/coin-selection": "2.2.1",
|
|
73
|
-
"@trezor/blockchain-link": "2.1.
|
|
74
|
-
"@trezor/blockchain-link-types": "1.0.
|
|
75
|
-
"@trezor/connect-analytics": "1.0.15
|
|
76
|
-
"@trezor/connect-common": "0.0.33
|
|
77
|
-
"@trezor/protobuf": "1.0.
|
|
78
|
-
"@trezor/protocol": "1.0.
|
|
79
|
-
"@trezor/schema-utils": "1.0.4
|
|
80
|
-
"@trezor/transport": "1.1.
|
|
81
|
-
"@trezor/utils": "9.0.
|
|
82
|
-
"@trezor/utxo-lib": "2.0.
|
|
83
|
-
"bignumber.js": "^9.1.2",
|
|
73
|
+
"@trezor/blockchain-link": "2.1.31-beta.1",
|
|
74
|
+
"@trezor/blockchain-link-types": "1.0.18-beta.1",
|
|
75
|
+
"@trezor/connect-analytics": "1.0.15",
|
|
76
|
+
"@trezor/connect-common": "0.0.33",
|
|
77
|
+
"@trezor/protobuf": "1.0.14-beta.1",
|
|
78
|
+
"@trezor/protocol": "1.0.10-beta.1",
|
|
79
|
+
"@trezor/schema-utils": "1.0.4",
|
|
80
|
+
"@trezor/transport": "1.1.30-beta.1",
|
|
81
|
+
"@trezor/utils": "9.0.25-beta.1",
|
|
82
|
+
"@trezor/utxo-lib": "2.0.10",
|
|
84
83
|
"blakejs": "^1.2.1",
|
|
85
84
|
"bs58": "^5.0.0",
|
|
86
85
|
"bs58check": "^3.0.1",
|