@trezor/connect 9.5.5 → 9.6.0
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 +47 -4
- package/README.md +1 -1
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +2 -2
- package/lib/api/discoverAccounts.d.ts +33 -0
- package/lib/api/discoverAccounts.js +180 -0
- package/lib/api/eos/eosSignTx.d.ts +4 -4
- package/lib/api/ethereum/ethereumSignTx.js +8 -6
- package/lib/api/firmware/getBinary.d.ts +1 -1
- package/lib/api/getAccountInfo.d.ts +4 -0
- package/lib/api/getAccountInfo.js +2 -0
- package/lib/api/getFeatures.d.ts +1 -1
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +4 -1
- package/lib/api/nem/nemSignTx.d.ts +9 -9
- package/lib/api/resetDevice.d.ts +1 -0
- package/lib/api/resetDevice.js +4 -0
- package/lib/api/signTransaction.d.ts +12 -12
- package/lib/api/solana/api/solanaSignTransaction.d.ts +1 -0
- package/lib/api/solana/api/solanaSignTransaction.js +12 -0
- package/lib/api/solana/solanaDefinitions.d.ts +8 -0
- package/lib/api/solana/solanaDefinitions.js +39 -0
- package/lib/api/solana/solanaUtils.js +1 -1
- package/lib/api/stellar/stellarSignTx.d.ts +1 -1
- package/lib/api/tezos/tezosSignTx.d.ts +6 -6
- package/lib/backend/Blockchain.js +6 -1
- package/lib/constants/network.d.ts +1 -1
- package/lib/constants/network.js +0 -1
- package/lib/core/method.native.js +0 -1
- package/lib/data/defaultFeeLevels.js +9 -0
- package/lib/data/downloadReleasesMetadata.d.ts +1 -1
- package/lib/data/firmwareInfo.d.ts +2 -2
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +5 -10
- package/lib/device/Device.js +3 -2
- package/lib/device/DeviceCommands.d.ts +9 -8
- package/lib/device/DeviceCommands.js +10 -5
- package/lib/device/DeviceCurrentSession.d.ts +142 -263
- package/lib/device/DeviceCurrentSession.js +9 -9
- package/lib/device/checkFirmwareRevision.d.ts +1 -1
- package/lib/device/checkFirmwareRevision.js +1 -1
- package/lib/factory.js +1 -7
- package/lib/impl/dynamic.d.ts +2 -0
- package/lib/impl/dynamic.js +27 -8
- package/lib/tsconfig.lib.tsbuildinfo +1 -1
- package/lib/types/api/discoverAccounts.d.ts +222 -0
- package/lib/types/api/discoverAccounts.js +57 -0
- package/lib/types/api/index.d.ts +2 -6
- package/lib/types/firmware.d.ts +1 -17
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.js +0 -1
- package/lib/types/settings.d.ts +1 -1
- package/lib/utils/deviceFeaturesUtils.js +3 -0
- package/lib/utils/firmwareUtils.d.ts +2 -2
- package/lib/workers/workers-browser.d.ts +2 -1
- package/lib/workers/workers-browser.js +3 -1
- package/lib/workers/workers.d.ts +2 -1
- package/lib/workers/workers.js +3 -1
- package/lib/workers/workers.native.d.ts +2 -1
- package/lib/workers/workers.native.js +3 -1
- package/package.json +16 -16
- package/lib/api/binance/api/binanceGetAddress.d.ts +0 -26
- package/lib/api/binance/api/binanceGetAddress.js +0 -109
- package/lib/api/binance/api/binanceGetPublicKey.d.ts +0 -21
- package/lib/api/binance/api/binanceGetPublicKey.js +0 -63
- package/lib/api/binance/api/binanceSignTransaction.d.ts +0 -17
- package/lib/api/binance/api/binanceSignTransaction.js +0 -34
- package/lib/api/binance/api/index.d.ts +0 -4
- package/lib/api/binance/api/index.js +0 -11
- package/lib/api/binance/binanceSignTx.d.ts +0 -87
- package/lib/api/binance/binanceSignTx.js +0 -69
- package/lib/types/api/binance/index.d.ts +0 -204
- package/lib/types/api/binance/index.js +0 -51
- package/lib/types/api/binanceGetAddress.d.ts +0 -4
- package/lib/types/api/binanceGetAddress.js +0 -3
- package/lib/types/api/binanceGetPublicKey.d.ts +0 -4
- package/lib/types/api/binanceGetPublicKey.js +0 -3
- package/lib/types/api/binanceSignTransaction.d.ts +0 -5
- package/lib/types/api/binanceSignTransaction.js +0 -3
|
@@ -26,22 +26,22 @@ export default class SignTransaction extends AbstractMethod<'signTransaction', P
|
|
|
26
26
|
address_n?: number[] | undefined;
|
|
27
27
|
nodes?: {
|
|
28
28
|
private_key?: string | undefined;
|
|
29
|
-
public_key: string;
|
|
30
29
|
depth: number;
|
|
31
30
|
fingerprint: number;
|
|
32
31
|
child_num: number;
|
|
33
32
|
chain_code: string;
|
|
33
|
+
public_key: string;
|
|
34
34
|
}[] | undefined;
|
|
35
35
|
pubkeys_order?: PROTO.MultisigPubkeysOrder | undefined;
|
|
36
36
|
pubkeys: {
|
|
37
37
|
address_n: number[];
|
|
38
38
|
node: string | {
|
|
39
39
|
private_key?: string | undefined;
|
|
40
|
-
public_key: string;
|
|
41
40
|
depth: number;
|
|
42
41
|
fingerprint: number;
|
|
43
42
|
child_num: number;
|
|
44
43
|
chain_code: string;
|
|
44
|
+
public_key: string;
|
|
45
45
|
};
|
|
46
46
|
}[];
|
|
47
47
|
signatures: string[];
|
|
@@ -57,9 +57,9 @@ export default class SignTransaction extends AbstractMethod<'signTransaction', P
|
|
|
57
57
|
witness?: string | undefined;
|
|
58
58
|
ownership_proof?: string | undefined;
|
|
59
59
|
commitment_data?: string | undefined;
|
|
60
|
-
amount: string | number;
|
|
61
60
|
prev_hash: string;
|
|
62
61
|
prev_index: number;
|
|
62
|
+
amount: string | number;
|
|
63
63
|
} & {
|
|
64
64
|
script_type?: "SPENDADDRESS" | "SPENDMULTISIG" | "SPENDWITNESS" | "SPENDP2SHWITNESS" | "SPENDTAPROOT" | undefined;
|
|
65
65
|
address_n: number[];
|
|
@@ -69,22 +69,22 @@ export default class SignTransaction extends AbstractMethod<'signTransaction', P
|
|
|
69
69
|
address_n?: number[] | undefined;
|
|
70
70
|
nodes?: {
|
|
71
71
|
private_key?: string | undefined;
|
|
72
|
-
public_key: string;
|
|
73
72
|
depth: number;
|
|
74
73
|
fingerprint: number;
|
|
75
74
|
child_num: number;
|
|
76
75
|
chain_code: string;
|
|
76
|
+
public_key: string;
|
|
77
77
|
}[] | undefined;
|
|
78
78
|
pubkeys_order?: PROTO.MultisigPubkeysOrder | undefined;
|
|
79
79
|
pubkeys: {
|
|
80
80
|
address_n: number[];
|
|
81
81
|
node: string | {
|
|
82
82
|
private_key?: string | undefined;
|
|
83
|
-
public_key: string;
|
|
84
83
|
depth: number;
|
|
85
84
|
fingerprint: number;
|
|
86
85
|
child_num: number;
|
|
87
86
|
chain_code: string;
|
|
87
|
+
public_key: string;
|
|
88
88
|
};
|
|
89
89
|
}[];
|
|
90
90
|
signatures: string[];
|
|
@@ -100,9 +100,9 @@ export default class SignTransaction extends AbstractMethod<'signTransaction', P
|
|
|
100
100
|
witness?: string | undefined;
|
|
101
101
|
ownership_proof?: string | undefined;
|
|
102
102
|
commitment_data?: string | undefined;
|
|
103
|
-
amount: string | number;
|
|
104
103
|
prev_hash: string;
|
|
105
104
|
prev_index: number;
|
|
105
|
+
amount: string | number;
|
|
106
106
|
} & {
|
|
107
107
|
address_n?: undefined;
|
|
108
108
|
script_pubkey: string;
|
|
@@ -114,22 +114,22 @@ export default class SignTransaction extends AbstractMethod<'signTransaction', P
|
|
|
114
114
|
address_n?: number[] | undefined;
|
|
115
115
|
nodes?: {
|
|
116
116
|
private_key?: string | undefined;
|
|
117
|
-
public_key: string;
|
|
118
117
|
depth: number;
|
|
119
118
|
fingerprint: number;
|
|
120
119
|
child_num: number;
|
|
121
120
|
chain_code: string;
|
|
121
|
+
public_key: string;
|
|
122
122
|
}[] | undefined;
|
|
123
123
|
pubkeys_order?: PROTO.MultisigPubkeysOrder | undefined;
|
|
124
124
|
pubkeys: {
|
|
125
125
|
address_n: number[];
|
|
126
126
|
node: string | {
|
|
127
127
|
private_key?: string | undefined;
|
|
128
|
-
public_key: string;
|
|
129
128
|
depth: number;
|
|
130
129
|
fingerprint: number;
|
|
131
130
|
child_num: number;
|
|
132
131
|
chain_code: string;
|
|
132
|
+
public_key: string;
|
|
133
133
|
};
|
|
134
134
|
}[];
|
|
135
135
|
signatures: string[];
|
|
@@ -147,22 +147,22 @@ export default class SignTransaction extends AbstractMethod<'signTransaction', P
|
|
|
147
147
|
address_n?: number[] | undefined;
|
|
148
148
|
nodes?: {
|
|
149
149
|
private_key?: string | undefined;
|
|
150
|
-
public_key: string;
|
|
151
150
|
depth: number;
|
|
152
151
|
fingerprint: number;
|
|
153
152
|
child_num: number;
|
|
154
153
|
chain_code: string;
|
|
154
|
+
public_key: string;
|
|
155
155
|
}[] | undefined;
|
|
156
156
|
pubkeys_order?: PROTO.MultisigPubkeysOrder | undefined;
|
|
157
157
|
pubkeys: {
|
|
158
158
|
address_n: number[];
|
|
159
159
|
node: string | {
|
|
160
160
|
private_key?: string | undefined;
|
|
161
|
-
public_key: string;
|
|
162
161
|
depth: number;
|
|
163
162
|
fingerprint: number;
|
|
164
163
|
child_num: number;
|
|
165
164
|
chain_code: string;
|
|
165
|
+
public_key: string;
|
|
166
166
|
};
|
|
167
167
|
}[];
|
|
168
168
|
signatures: string[];
|
|
@@ -180,22 +180,22 @@ export default class SignTransaction extends AbstractMethod<'signTransaction', P
|
|
|
180
180
|
address_n?: number[] | undefined;
|
|
181
181
|
nodes?: {
|
|
182
182
|
private_key?: string | undefined;
|
|
183
|
-
public_key: string;
|
|
184
183
|
depth: number;
|
|
185
184
|
fingerprint: number;
|
|
186
185
|
child_num: number;
|
|
187
186
|
chain_code: string;
|
|
187
|
+
public_key: string;
|
|
188
188
|
}[] | undefined;
|
|
189
189
|
pubkeys_order?: PROTO.MultisigPubkeysOrder | undefined;
|
|
190
190
|
pubkeys: {
|
|
191
191
|
address_n: number[];
|
|
192
192
|
node: string | {
|
|
193
193
|
private_key?: string | undefined;
|
|
194
|
-
public_key: string;
|
|
195
194
|
depth: number;
|
|
196
195
|
fingerprint: number;
|
|
197
196
|
child_num: number;
|
|
198
197
|
chain_code: string;
|
|
198
|
+
public_key: string;
|
|
199
199
|
};
|
|
200
200
|
}[];
|
|
201
201
|
signatures: string[];
|
|
@@ -6,6 +6,7 @@ type Params = PROTO.SolanaSignTx & {
|
|
|
6
6
|
};
|
|
7
7
|
export default class SolanaSignTransaction extends AbstractMethod<'solanaSignTransaction', Params> {
|
|
8
8
|
init(): void;
|
|
9
|
+
initAsync(): Promise<void>;
|
|
9
10
|
get info(): string;
|
|
10
11
|
payloadToPrecomposed(): Promise<undefined> | Promise<{
|
|
11
12
|
type: "final";
|
|
@@ -13,6 +13,7 @@ const solana_1 = require("../../../types/api/solana");
|
|
|
13
13
|
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
14
14
|
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
15
15
|
const additionalInfo_1 = require("../additionalInfo");
|
|
16
|
+
const solanaDefinitions_1 = require("../solanaDefinitions");
|
|
16
17
|
const solanaUtils_1 = require("../solanaUtils");
|
|
17
18
|
class SolanaSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
18
19
|
init() {
|
|
@@ -29,6 +30,17 @@ class SolanaSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
29
30
|
serialize: !!payload.serialize,
|
|
30
31
|
};
|
|
31
32
|
}
|
|
33
|
+
async initAsync() {
|
|
34
|
+
const token = this.params.additional_info?.token_accounts_infos?.[0];
|
|
35
|
+
if (token) {
|
|
36
|
+
const tokenDefinition = await (0, solanaDefinitions_1.getSolanaTokenDefinition)({
|
|
37
|
+
mintAddress: token.token_mint,
|
|
38
|
+
});
|
|
39
|
+
if (!tokenDefinition)
|
|
40
|
+
return;
|
|
41
|
+
this.params.additional_info.encoded_token = tokenDefinition;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
32
44
|
get info() {
|
|
33
45
|
return 'Sign Solana transaction';
|
|
34
46
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MessagesSchema } from '@trezor/protobuf';
|
|
2
|
+
interface GetSolanaTokenDefinition {
|
|
3
|
+
mintAddress?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const getSolanaTokenDefinition: ({ mintAddress }: GetSolanaTokenDefinition) => Promise<ArrayBuffer | undefined>;
|
|
6
|
+
export declare const decodeSolanaTokenDefinition: (encodedDefinition: ArrayBuffer) => MessagesSchema.SolanaTokenInfo;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=solanaDefinitions.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decodeSolanaTokenDefinition = exports.getSolanaTokenDefinition = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cross_fetch_1 = tslib_1.__importDefault(require("cross-fetch"));
|
|
6
|
+
const protobuf_1 = require("@trezor/protobuf");
|
|
7
|
+
const protocol_1 = require("@trezor/protocol");
|
|
8
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
9
|
+
const DataManager_1 = require("../../data/DataManager");
|
|
10
|
+
const getSolanaTokenDefinition = async ({ mintAddress }) => {
|
|
11
|
+
try {
|
|
12
|
+
if (mintAddress) {
|
|
13
|
+
const tokenDefinitionUrl = `https://data.trezor.io/firmware/definitions/solana/token/${mintAddress}.dat`;
|
|
14
|
+
const tokenDefinition = await (0, cross_fetch_1.default)(tokenDefinitionUrl);
|
|
15
|
+
if (tokenDefinition.status === 200) {
|
|
16
|
+
const arrayBuffer = await tokenDefinition.arrayBuffer();
|
|
17
|
+
return arrayBuffer;
|
|
18
|
+
}
|
|
19
|
+
else if (tokenDefinition.status !== 404) {
|
|
20
|
+
throw new Error(`unexpected status: $${tokenDefinition.status}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
console.warn(`unable to download or parse solana token ${mintAddress} definition. detail: ${err.message}`);
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
28
|
+
};
|
|
29
|
+
exports.getSolanaTokenDefinition = getSolanaTokenDefinition;
|
|
30
|
+
const decodeSolanaTokenDefinition = (encodedDefinition) => {
|
|
31
|
+
const messages = DataManager_1.DataManager.getProtobufMessages();
|
|
32
|
+
const proto = (0, protobuf_1.parseConfigure)(messages);
|
|
33
|
+
const { protobufPayload } = protocol_1.trzd.decode(encodedDefinition);
|
|
34
|
+
const { message: decodedTokenDefinition } = (0, protobuf_1.decodeMessage)(proto, 'SolanaTokenInfo', protobufPayload);
|
|
35
|
+
(0, schema_utils_1.Assert)(protobuf_1.MessagesSchema.SolanaTokenInfo, decodedTokenDefinition);
|
|
36
|
+
return decodedTokenDefinition;
|
|
37
|
+
};
|
|
38
|
+
exports.decodeSolanaTokenDefinition = decodeSolanaTokenDefinition;
|
|
39
|
+
//# sourceMappingURL=solanaDefinitions.js.map
|
|
@@ -155,7 +155,7 @@ const buildCreateAssociatedTokenAccountInstruction = async (funderAddress, newOw
|
|
|
155
155
|
exports.buildCreateAssociatedTokenAccountInstruction = buildCreateAssociatedTokenAccountInstruction;
|
|
156
156
|
const getMinimumRequiredTokenAccountsForTransfer = (tokenAccounts, requiredAmount) => {
|
|
157
157
|
let accumulatedBalance = new bigNumber_1.BigNumber('0');
|
|
158
|
-
const requiredAccounts = ts_belt_1.F.toMutable((0, ts_belt_1.pipe)(tokenAccounts, ts_belt_1.A.sort((a, b) => new bigNumber_1.BigNumber(b.balance).comparedTo(new bigNumber_1.BigNumber(a.balance))), ts_belt_1.A.takeWhile(tokenAccount => {
|
|
158
|
+
const requiredAccounts = ts_belt_1.F.toMutable((0, ts_belt_1.pipe)(tokenAccounts, ts_belt_1.A.sort((a, b) => new bigNumber_1.BigNumber(b.balance).comparedTo(new bigNumber_1.BigNumber(a.balance)) ?? 0), ts_belt_1.A.takeWhile(tokenAccount => {
|
|
159
159
|
const needMoreAccounts = accumulatedBalance.lt(requiredAmount);
|
|
160
160
|
accumulatedBalance = accumulatedBalance.plus(tokenAccount.balance);
|
|
161
161
|
return needMoreAccounts;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TypedCall } from '../../device/DeviceCommands';
|
|
2
2
|
import { StellarTransaction } from '../../types/api/stellar';
|
|
3
3
|
export declare const stellarSignTx: (typedCall: TypedCall, address_n: number[], networkPassphrase: string, tx: StellarTransaction) => Promise<{
|
|
4
|
-
signature: string;
|
|
5
4
|
public_key: string;
|
|
5
|
+
signature: string;
|
|
6
6
|
}>;
|
|
7
7
|
//# sourceMappingURL=stellarSignTx.d.ts.map
|
|
@@ -15,21 +15,21 @@ export declare const createTx: (address_n: number[], branch: string, operation:
|
|
|
15
15
|
set_delegate?: Uint8Array<ArrayBufferLike> | undefined;
|
|
16
16
|
cancel_delegate?: boolean | undefined;
|
|
17
17
|
} | undefined;
|
|
18
|
-
source: Uint8Array<ArrayBufferLike>;
|
|
19
|
-
amount: string | number;
|
|
20
18
|
fee: string | number;
|
|
19
|
+
amount: string | number;
|
|
21
20
|
destination: {
|
|
22
21
|
hash: Uint8Array<ArrayBufferLike>;
|
|
23
22
|
tag: number;
|
|
24
23
|
};
|
|
24
|
+
source: Uint8Array<ArrayBufferLike>;
|
|
25
25
|
counter: number;
|
|
26
26
|
gas_limit: number;
|
|
27
27
|
storage_limit: number;
|
|
28
28
|
} | undefined;
|
|
29
29
|
reveal?: {
|
|
30
|
-
source: Uint8Array<ArrayBufferLike>;
|
|
31
|
-
public_key: Uint8Array<ArrayBufferLike>;
|
|
32
30
|
fee: string | number;
|
|
31
|
+
public_key: Uint8Array<ArrayBufferLike>;
|
|
32
|
+
source: Uint8Array<ArrayBufferLike>;
|
|
33
33
|
counter: number;
|
|
34
34
|
gas_limit: number;
|
|
35
35
|
storage_limit: number;
|
|
@@ -39,17 +39,17 @@ export declare const createTx: (address_n: number[], branch: string, operation:
|
|
|
39
39
|
manager_pubkey?: string | undefined;
|
|
40
40
|
spendable?: boolean | undefined;
|
|
41
41
|
delegatable?: boolean | undefined;
|
|
42
|
-
source: Uint8Array<ArrayBufferLike>;
|
|
43
42
|
fee: string | number;
|
|
44
43
|
script: string | number[];
|
|
45
44
|
balance: number;
|
|
45
|
+
source: Uint8Array<ArrayBufferLike>;
|
|
46
46
|
counter: number;
|
|
47
47
|
gas_limit: number;
|
|
48
48
|
storage_limit: number;
|
|
49
49
|
} | undefined;
|
|
50
50
|
delegation?: {
|
|
51
|
-
source: Uint8Array<ArrayBufferLike>;
|
|
52
51
|
fee: string | number;
|
|
52
|
+
source: Uint8Array<ArrayBufferLike>;
|
|
53
53
|
counter: number;
|
|
54
54
|
gas_limit: number;
|
|
55
55
|
storage_limit: number;
|
|
@@ -18,6 +18,8 @@ const getWorker = (type) => {
|
|
|
18
18
|
return workers_1.ElectrumWorker;
|
|
19
19
|
case 'solana':
|
|
20
20
|
return workers_1.SolanaWorker;
|
|
21
|
+
case 'stellar':
|
|
22
|
+
return workers_1.StellarWorker;
|
|
21
23
|
default:
|
|
22
24
|
return null;
|
|
23
25
|
}
|
|
@@ -56,7 +58,10 @@ class Blockchain {
|
|
|
56
58
|
server,
|
|
57
59
|
debug: options.debug,
|
|
58
60
|
proxy: options.proxy,
|
|
59
|
-
...(
|
|
61
|
+
...(this.coinInfo.type === 'ethereum' ? { throttleBlockEvent: 10 * 1000 } : {}),
|
|
62
|
+
...(['ripple', 'stellar'].includes(blockchainLink.type)
|
|
63
|
+
? { throttleBlockEvent: 60 * 1000 }
|
|
64
|
+
: {}),
|
|
60
65
|
});
|
|
61
66
|
}
|
|
62
67
|
onError(error) {
|
|
@@ -11,6 +11,6 @@ export declare const TYPES: {
|
|
|
11
11
|
readonly solana: "Solana";
|
|
12
12
|
};
|
|
13
13
|
export type NetworkType = keyof typeof TYPES;
|
|
14
|
-
export declare const MODULES: readonly ["
|
|
14
|
+
export declare const MODULES: readonly ["cardano", "eos", "ethereum", "nem", "ripple", "solana", "stellar", "tezos"];
|
|
15
15
|
export type ModuleName = (typeof MODULES)[number];
|
|
16
16
|
//# sourceMappingURL=network.d.ts.map
|
package/lib/constants/network.js
CHANGED
|
@@ -6,7 +6,6 @@ const Methods = tslib_1.__importStar(require("../api"));
|
|
|
6
6
|
const errors_1 = require("../constants/errors");
|
|
7
7
|
const network_1 = require("../constants/network");
|
|
8
8
|
const moduleMethods = {
|
|
9
|
-
binance: require('../api/binance/api'),
|
|
10
9
|
cardano: require('../api/cardano/api'),
|
|
11
10
|
eos: require('../api/eos/api'),
|
|
12
11
|
ethereum: require('../api/ethereum/api'),
|
|
@@ -96,6 +96,13 @@ const SOLANA_FEE_INFO = {
|
|
|
96
96
|
maxFee: 1000000000,
|
|
97
97
|
dustLimit: -1,
|
|
98
98
|
};
|
|
99
|
+
const STELLAR_FEE_INFO = {
|
|
100
|
+
blockTime: -1,
|
|
101
|
+
defaultFees: [{ label: 'normal', feePerUnit: '100', blocks: -1 }],
|
|
102
|
+
minFee: 100,
|
|
103
|
+
maxFee: 10000000,
|
|
104
|
+
dustLimit: -1,
|
|
105
|
+
};
|
|
99
106
|
const MISC_FEE_LEVELS = {
|
|
100
107
|
xrp: RIPPLE_FEE_INFO,
|
|
101
108
|
txrp: RIPPLE_FEE_INFO,
|
|
@@ -103,6 +110,8 @@ const MISC_FEE_LEVELS = {
|
|
|
103
110
|
tada: CARDANO_FEE_INFO,
|
|
104
111
|
sol: SOLANA_FEE_INFO,
|
|
105
112
|
dsol: SOLANA_FEE_INFO,
|
|
113
|
+
xlm: STELLAR_FEE_INFO,
|
|
114
|
+
txlm: STELLAR_FEE_INFO,
|
|
106
115
|
};
|
|
107
116
|
const getMiscFeeLevels = (data) => {
|
|
108
117
|
const shortcut = data.shortcut.toLowerCase();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DeviceModelInternal, VersionArray } from '@trezor/device-utils';
|
|
2
|
-
import type { Features,
|
|
1
|
+
import { DeviceModelInternal, FirmwareRelease, VersionArray } from '@trezor/device-utils';
|
|
2
|
+
import type { Features, ReleaseInfo } from '../types';
|
|
3
3
|
export declare const parseFirmwareReleases: (json: any, deviceModel: DeviceModelInternal) => void;
|
|
4
4
|
export declare const getReleases: (deviceModel: DeviceModelInternal) => FirmwareRelease[];
|
|
5
5
|
export interface GetInfoProps {
|
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.DEEPLINK_VERSION = exports.CONTENT_SCRIPT_VERSION = exports.DEFAULT_DOMAIN = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '9.
|
|
4
|
+
exports.VERSION = '9.6.0';
|
|
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
|
@@ -110,7 +110,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
110
110
|
unfinished_backup: boolean | null;
|
|
111
111
|
no_backup: boolean | null;
|
|
112
112
|
recovery_status: "Nothing" | "Recovery" | "Backup" | null;
|
|
113
|
-
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")[];
|
|
113
|
+
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" | "Capability_BLE" | "Capability_NFC")[];
|
|
114
114
|
backup_type: "Bip39" | "Slip39_Basic" | "Slip39_Advanced" | "Slip39_Single_Extendable" | "Slip39_Basic_Extendable" | "Slip39_Advanced_Extendable" | null;
|
|
115
115
|
sd_card_present: boolean | null;
|
|
116
116
|
sd_protection: boolean | null;
|
|
@@ -143,7 +143,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
143
143
|
private availableTranslations;
|
|
144
144
|
private authenticityChecks;
|
|
145
145
|
private readonly uniquePath;
|
|
146
|
-
private
|
|
146
|
+
private emitLifecycle;
|
|
147
147
|
private sessionDfd?;
|
|
148
148
|
handshakeFinished: boolean;
|
|
149
149
|
constructor({ id, transport, descriptor, listener }: DeviceParams);
|
|
@@ -175,11 +175,11 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
175
175
|
root_fingerprint?: number | undefined;
|
|
176
176
|
node: {
|
|
177
177
|
private_key?: string | undefined;
|
|
178
|
-
public_key: string;
|
|
179
178
|
depth: number;
|
|
180
179
|
fingerprint: number;
|
|
181
180
|
child_num: number;
|
|
182
181
|
chain_code: string;
|
|
182
|
+
public_key: string;
|
|
183
183
|
};
|
|
184
184
|
xpub: string;
|
|
185
185
|
}>;
|
|
@@ -190,11 +190,11 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
190
190
|
ethereumGetPublicKey: ({ address_n, show_display, }: PROTO.EthereumGetPublicKey) => Promise<{
|
|
191
191
|
node: {
|
|
192
192
|
private_key?: string | undefined;
|
|
193
|
-
public_key: string;
|
|
194
193
|
depth: number;
|
|
195
194
|
fingerprint: number;
|
|
196
195
|
child_num: number;
|
|
197
196
|
chain_code: string;
|
|
197
|
+
public_key: string;
|
|
198
198
|
};
|
|
199
199
|
xpub: string;
|
|
200
200
|
}>;
|
|
@@ -221,12 +221,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
221
221
|
xpub: string;
|
|
222
222
|
}>;
|
|
223
223
|
preauthorize: (throwError: boolean) => Promise<boolean>;
|
|
224
|
-
getAccountDescriptor: (coinInfo: import("../types").CoinInfo,
|
|
225
|
-
descriptor: string;
|
|
226
|
-
legacyXpub?: string;
|
|
227
|
-
address_n: number[];
|
|
228
|
-
descriptorChecksum?: string;
|
|
229
|
-
}>;
|
|
224
|
+
getAccountDescriptor: (coinInfo: import("../types").CoinInfo, address_n: number[], derivationType?: PROTO.CardanoDerivationType) => Promise<import("./DeviceCommands").AccountDescriptor>;
|
|
230
225
|
typedCall: PROTO.TypedCall;
|
|
231
226
|
};
|
|
232
227
|
setInstance(instance?: number): void;
|
package/lib/device/Device.js
CHANGED
|
@@ -179,6 +179,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
179
179
|
catch (error) {
|
|
180
180
|
_log.warn(`device.run error.message: ${error.message}, code: ${error.code}`);
|
|
181
181
|
if (error.code === 'Device_NotFound' ||
|
|
182
|
+
error.code === 'Device_Disconnected' ||
|
|
182
183
|
error.message === transport_1.TRANSPORT_ERROR.DEVICE_NOT_FOUND ||
|
|
183
184
|
error.message === transport_1.TRANSPORT_ERROR.DEVICE_DISCONNECTED_DURING_ACTION ||
|
|
184
185
|
error.message === transport_1.TRANSPORT_ERROR.HTTP_ERROR) {
|
|
@@ -252,8 +253,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
252
253
|
return this.runPromise;
|
|
253
254
|
}
|
|
254
255
|
async interrupt(reason) {
|
|
255
|
-
await this.currentSession?.abort(reason);
|
|
256
|
-
await this.currentSession?.dispose();
|
|
256
|
+
await this.currentSession?.abort(reason, true);
|
|
257
257
|
this.runAbort?.abort(reason);
|
|
258
258
|
await this.currentRun;
|
|
259
259
|
}
|
|
@@ -668,6 +668,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
668
668
|
this.sessionDfd?.reject(new Error());
|
|
669
669
|
this.lastAcquiredHere = false;
|
|
670
670
|
this.emitLifecycle(events_1.DEVICE.DISCONNECT);
|
|
671
|
+
this.emitLifecycle = () => { };
|
|
671
672
|
return this.interrupt(constants_1.ERRORS.TypedError('Device_Disconnected'));
|
|
672
673
|
}
|
|
673
674
|
isBootloader() {
|
|
@@ -3,6 +3,12 @@ import type { TypedCallProvider } from '../device/DeviceCurrentSession';
|
|
|
3
3
|
import type { BitcoinNetworkInfo, CoinInfo } from '../types';
|
|
4
4
|
type TypedCall = Messages.TypedCall;
|
|
5
5
|
export type { TypedCall };
|
|
6
|
+
export type AccountDescriptor = {
|
|
7
|
+
descriptor: string;
|
|
8
|
+
legacyXpub?: string;
|
|
9
|
+
address_n: number[];
|
|
10
|
+
descriptorChecksum?: string;
|
|
11
|
+
};
|
|
6
12
|
export declare const DeviceCommands: (deviceTypedCall: TypedCallProvider) => {
|
|
7
13
|
unlockPath: (params?: Messages.UnlockPath) => Promise<{
|
|
8
14
|
type: "UnlockedPathRequest";
|
|
@@ -15,11 +21,11 @@ export declare const DeviceCommands: (deviceTypedCall: TypedCallProvider) => {
|
|
|
15
21
|
root_fingerprint?: number | undefined;
|
|
16
22
|
node: {
|
|
17
23
|
private_key?: string | undefined;
|
|
18
|
-
public_key: string;
|
|
19
24
|
depth: number;
|
|
20
25
|
fingerprint: number;
|
|
21
26
|
child_num: number;
|
|
22
27
|
chain_code: string;
|
|
28
|
+
public_key: string;
|
|
23
29
|
};
|
|
24
30
|
xpub: string;
|
|
25
31
|
}>;
|
|
@@ -30,11 +36,11 @@ export declare const DeviceCommands: (deviceTypedCall: TypedCallProvider) => {
|
|
|
30
36
|
ethereumGetPublicKey: ({ address_n, show_display, }: Messages.EthereumGetPublicKey) => Promise<{
|
|
31
37
|
node: {
|
|
32
38
|
private_key?: string | undefined;
|
|
33
|
-
public_key: string;
|
|
34
39
|
depth: number;
|
|
35
40
|
fingerprint: number;
|
|
36
41
|
child_num: number;
|
|
37
42
|
chain_code: string;
|
|
43
|
+
public_key: string;
|
|
38
44
|
};
|
|
39
45
|
xpub: string;
|
|
40
46
|
}>;
|
|
@@ -61,12 +67,7 @@ export declare const DeviceCommands: (deviceTypedCall: TypedCallProvider) => {
|
|
|
61
67
|
xpub: string;
|
|
62
68
|
}>;
|
|
63
69
|
preauthorize: (throwError: boolean) => Promise<boolean>;
|
|
64
|
-
getAccountDescriptor: (coinInfo: CoinInfo,
|
|
65
|
-
descriptor: string;
|
|
66
|
-
legacyXpub?: string;
|
|
67
|
-
address_n: number[];
|
|
68
|
-
descriptorChecksum?: string;
|
|
69
|
-
}>;
|
|
70
|
+
getAccountDescriptor: (coinInfo: CoinInfo, address_n: number[], derivationType?: Messages.CardanoDerivationType) => Promise<AccountDescriptor>;
|
|
70
71
|
typedCall: Messages.TypedCall;
|
|
71
72
|
};
|
|
72
73
|
//# sourceMappingURL=DeviceCommands.d.ts.map
|
|
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const coinInfo_1 = require("../data/coinInfo");
|
|
7
7
|
const resolveDescriptorForTaproot_1 = require("../device/resolveDescriptorForTaproot");
|
|
8
|
-
const accountUtils_1 = require("../utils/accountUtils");
|
|
9
8
|
const hdnodeUtils = tslib_1.__importStar(require("../utils/hdnodeUtils"));
|
|
10
9
|
const pathUtils_1 = require("../utils/pathUtils");
|
|
11
10
|
const DeviceCommands = (deviceTypedCall) => {
|
|
@@ -133,10 +132,7 @@ const DeviceCommands = (deviceTypedCall) => {
|
|
|
133
132
|
return false;
|
|
134
133
|
}
|
|
135
134
|
};
|
|
136
|
-
const getAccountDescriptor = async (coinInfo,
|
|
137
|
-
const address_n = Array.isArray(indexOrPath)
|
|
138
|
-
? indexOrPath
|
|
139
|
-
: (0, accountUtils_1.getAccountAddressN)(coinInfo, indexOrPath);
|
|
135
|
+
const getAccountDescriptor = async (coinInfo, address_n, derivationType = constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR) => {
|
|
140
136
|
if (coinInfo.type === 'bitcoin') {
|
|
141
137
|
const resp = await getHDNode({ address_n }, { coinInfo, validation: false });
|
|
142
138
|
return {
|
|
@@ -183,6 +179,15 @@ const DeviceCommands = (deviceTypedCall) => {
|
|
|
183
179
|
address_n,
|
|
184
180
|
};
|
|
185
181
|
}
|
|
182
|
+
if (coinInfo.shortcut === 'XLM' || coinInfo.shortcut === 'tXLM') {
|
|
183
|
+
const { message } = await typedCall('StellarGetAddress', 'StellarAddress', {
|
|
184
|
+
address_n,
|
|
185
|
+
});
|
|
186
|
+
return {
|
|
187
|
+
descriptor: message.address,
|
|
188
|
+
address_n,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
186
191
|
throw constants_1.ERRORS.TypedError('Runtime', 'DeviceCommands.getAccountDescriptor: unsupported coinInfo.type');
|
|
187
192
|
};
|
|
188
193
|
return {
|