@trezor/connect 9.2.0 → 9.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +1 -1
- package/lib/api/binance/api/binanceSignTransaction.d.ts +1 -1
- package/lib/api/binance/binanceSignTx.d.ts +1 -1
- package/lib/api/bitcoin/Fees.d.ts +2 -2
- package/lib/api/bitcoin/TransactionComposer.d.ts +2 -2
- package/lib/api/blockchainEstimateFee.js +1 -0
- package/lib/api/cardano/cardanoOutputs.d.ts +1 -1
- package/lib/api/cardano/cardanoTokenBundle.d.ts +2 -2
- package/lib/api/changeLanguage.js +11 -5
- package/lib/api/eos/eosSignTx.d.ts +58 -58
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +8 -6
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +4 -4
- package/lib/api/getAccountInfo.d.ts +2 -2
- package/lib/api/getAccountInfo.js +3 -0
- package/lib/api/getCoinInfo.d.ts +22 -22
- package/lib/api/getFeatures.d.ts +13 -12
- package/lib/api/getPublicKey.d.ts +8 -6
- package/lib/api/nem/nemSignTx.d.ts +13 -13
- package/lib/api/stellar/stellarSignTx.d.ts +1 -1
- package/lib/api/tezos/tezosSignTx.d.ts +18 -18
- package/lib/backend/BackendManager.d.ts +1 -2
- package/lib/backend/BackendManager.js +15 -15
- package/lib/backend/Blockchain.d.ts +1 -1
- package/lib/backend/Blockchain.js +1 -1
- package/lib/core/index.js +33 -4
- package/lib/data/coinInfo.d.ts +117 -117
- package/lib/data/config.js +15 -1
- package/lib/data/defaultFeeLevels.js +9 -1
- package/lib/data/deviceAuthenticityConfig.js +4 -1
- package/lib/data/firmwareInfo.d.ts +1 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +3 -2
- package/lib/device/Device.js +2 -1
- package/lib/device/DeviceCommands.d.ts +10 -6
- package/lib/device/DeviceCommands.js +8 -5
- package/lib/device/resolveDescriptorForTaproot.d.ts +15 -0
- package/lib/device/resolveDescriptorForTaproot.js +31 -0
- package/lib/events/device.d.ts +1 -0
- package/lib/events/device.js +1 -0
- package/lib/types/account.d.ts +2 -0
- package/lib/types/api/applySettings.d.ts +6 -6
- package/lib/types/api/binance/index.d.ts +10 -10
- package/lib/types/api/cardano/index.d.ts +4 -4
- package/lib/types/api/changeLanguage.d.ts +1 -1
- package/lib/types/api/cipherKeyValue.d.ts +2 -2
- package/lib/types/api/eos/index.d.ts +3 -3
- package/lib/types/api/ethereum/index.d.ts +3 -3
- package/lib/types/api/firmwareUpdate.d.ts +1 -1
- package/lib/types/api/getAddress.d.ts +5 -5
- package/lib/types/api/getPublicKey.d.ts +1 -0
- package/lib/types/api/getPublicKey.js +5 -1
- package/lib/types/api/nem/index.d.ts +7 -7
- package/lib/types/api/recoveryDevice.d.ts +1 -1
- package/lib/types/api/stellar/index.d.ts +146 -146
- package/lib/types/params.js +6 -2
- package/lib/utils/{assets-native.d.ts → assets.native.d.ts} +1 -1
- package/lib/utils/{assets-native.js → assets.native.js} +1 -1
- package/lib/utils/debug.d.ts +5 -31
- package/lib/utils/debug.js +8 -110
- package/lib/utils/hdnodeUtils.d.ts +3 -3
- package/lib/utils/pathUtils.d.ts +3 -3
- package/lib/workers/{workers-react-native.d.ts → workers.native.d.ts} +1 -1
- package/lib/workers/{workers-react-native.js → workers.native.js} +1 -1
- package/package.json +39 -19
|
@@ -15,24 +15,26 @@ export default class GetPublicKey extends AbstractMethod<'getPublicKey', Params[
|
|
|
15
15
|
noBackupConfirmation(allowSuppression?: boolean): Promise<boolean>;
|
|
16
16
|
run(): Promise<{
|
|
17
17
|
xpubSegwit?: string | undefined;
|
|
18
|
+
descriptorChecksum?: string | undefined;
|
|
18
19
|
path: number[];
|
|
19
|
-
depth: number;
|
|
20
|
-
fingerprint: number;
|
|
21
|
-
xpub: string;
|
|
22
20
|
publicKey: string;
|
|
23
21
|
serializedPath: string;
|
|
22
|
+
depth: number;
|
|
23
|
+
fingerprint: number;
|
|
24
24
|
chainCode: string;
|
|
25
25
|
childNum: number;
|
|
26
|
+
xpub: string;
|
|
26
27
|
} | {
|
|
27
28
|
xpubSegwit?: string | undefined;
|
|
29
|
+
descriptorChecksum?: string | undefined;
|
|
28
30
|
path: number[];
|
|
29
|
-
depth: number;
|
|
30
|
-
fingerprint: number;
|
|
31
|
-
xpub: string;
|
|
32
31
|
publicKey: string;
|
|
33
32
|
serializedPath: string;
|
|
33
|
+
depth: number;
|
|
34
|
+
fingerprint: number;
|
|
34
35
|
chainCode: string;
|
|
35
36
|
childNum: number;
|
|
37
|
+
xpub: string;
|
|
36
38
|
}[]>;
|
|
37
39
|
}
|
|
38
40
|
export {};
|
|
@@ -2,14 +2,6 @@ import { PROTO } from '../../constants';
|
|
|
2
2
|
import * as $T from '../../types/api/nem';
|
|
3
3
|
export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chunkify?: boolean) => {
|
|
4
4
|
chunkify?: boolean | undefined;
|
|
5
|
-
multisig?: {
|
|
6
|
-
address_n?: number[] | undefined;
|
|
7
|
-
network?: number | undefined;
|
|
8
|
-
signer?: string | undefined;
|
|
9
|
-
timestamp: number;
|
|
10
|
-
fee: string | number;
|
|
11
|
-
deadline: number;
|
|
12
|
-
} | undefined;
|
|
13
5
|
transfer?: {
|
|
14
6
|
public_key?: string | undefined;
|
|
15
7
|
payload?: string | undefined;
|
|
@@ -21,6 +13,14 @@ export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chun
|
|
|
21
13
|
amount: string | number;
|
|
22
14
|
recipient: string;
|
|
23
15
|
} | undefined;
|
|
16
|
+
multisig?: {
|
|
17
|
+
address_n?: number[] | undefined;
|
|
18
|
+
network?: number | undefined;
|
|
19
|
+
signer?: string | undefined;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
fee: string | number;
|
|
22
|
+
deadline: number;
|
|
23
|
+
} | undefined;
|
|
24
24
|
cosigning?: boolean | undefined;
|
|
25
25
|
provision_namespace?: {
|
|
26
26
|
parent?: string | undefined;
|
|
@@ -32,17 +32,17 @@ export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chun
|
|
|
32
32
|
fee: string | number;
|
|
33
33
|
sink: string;
|
|
34
34
|
definition: {
|
|
35
|
-
fee?: string | number | undefined;
|
|
36
35
|
name?: string | undefined;
|
|
37
|
-
|
|
38
|
-
divisibility?: number | undefined;
|
|
36
|
+
fee?: string | number | undefined;
|
|
39
37
|
levy?: PROTO.NEMMosaicLevy | undefined;
|
|
38
|
+
divisibility?: number | undefined;
|
|
39
|
+
transferable?: boolean | undefined;
|
|
40
|
+
ticker?: string | undefined;
|
|
40
41
|
levy_address?: string | undefined;
|
|
41
42
|
levy_namespace?: string | undefined;
|
|
42
43
|
levy_mosaic?: string | undefined;
|
|
43
44
|
supply?: number | undefined;
|
|
44
45
|
mutable_supply?: boolean | undefined;
|
|
45
|
-
transferable?: boolean | undefined;
|
|
46
46
|
networks?: number[] | undefined;
|
|
47
47
|
description: string;
|
|
48
48
|
namespace: string;
|
|
@@ -51,9 +51,9 @@ export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chun
|
|
|
51
51
|
} | undefined;
|
|
52
52
|
supply_change?: {
|
|
53
53
|
type: PROTO.NEMSupplyChangeType;
|
|
54
|
+
delta: number;
|
|
54
55
|
namespace: string;
|
|
55
56
|
mosaic: string;
|
|
56
|
-
delta: number;
|
|
57
57
|
} | undefined;
|
|
58
58
|
aggregate_modification?: {
|
|
59
59
|
modifications?: {
|
|
@@ -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
|
-
public_key: string;
|
|
5
4
|
signature: string;
|
|
5
|
+
public_key: string;
|
|
6
6
|
}>;
|
|
7
7
|
//# sourceMappingURL=stellarSignTx.d.ts.map
|
|
@@ -18,31 +18,20 @@ export declare const createTx: (address_n: number[], branch: string, operation:
|
|
|
18
18
|
source: Uint8Array;
|
|
19
19
|
amount: string | number;
|
|
20
20
|
fee: string | number;
|
|
21
|
-
gas_limit: number;
|
|
22
21
|
destination: {
|
|
23
22
|
hash: Uint8Array;
|
|
24
23
|
tag: number;
|
|
25
24
|
};
|
|
26
25
|
counter: number;
|
|
26
|
+
gas_limit: number;
|
|
27
27
|
storage_limit: number;
|
|
28
28
|
} | undefined;
|
|
29
|
-
proposal?: {
|
|
30
|
-
source: string;
|
|
31
|
-
period: number;
|
|
32
|
-
proposals: string[];
|
|
33
|
-
} | undefined;
|
|
34
|
-
ballot?: {
|
|
35
|
-
source: string;
|
|
36
|
-
period: number;
|
|
37
|
-
proposal: string;
|
|
38
|
-
ballot: PROTO.TezosBallotType;
|
|
39
|
-
} | undefined;
|
|
40
29
|
reveal?: {
|
|
41
|
-
public_key: Uint8Array;
|
|
42
30
|
source: Uint8Array;
|
|
31
|
+
public_key: Uint8Array;
|
|
43
32
|
fee: string | number;
|
|
44
|
-
gas_limit: number;
|
|
45
33
|
counter: number;
|
|
34
|
+
gas_limit: number;
|
|
46
35
|
storage_limit: number;
|
|
47
36
|
} | undefined;
|
|
48
37
|
origination?: {
|
|
@@ -51,20 +40,31 @@ export declare const createTx: (address_n: number[], branch: string, operation:
|
|
|
51
40
|
spendable?: boolean | undefined;
|
|
52
41
|
delegatable?: boolean | undefined;
|
|
53
42
|
source: Uint8Array;
|
|
54
|
-
script: string | number[];
|
|
55
43
|
fee: string | number;
|
|
56
|
-
|
|
44
|
+
script: string | number[];
|
|
57
45
|
counter: number;
|
|
46
|
+
gas_limit: number;
|
|
58
47
|
storage_limit: number;
|
|
59
48
|
balance: number;
|
|
60
49
|
} | undefined;
|
|
61
50
|
delegation?: {
|
|
62
51
|
source: Uint8Array;
|
|
63
52
|
fee: string | number;
|
|
64
|
-
delegate: Uint8Array;
|
|
65
|
-
gas_limit: number;
|
|
66
53
|
counter: number;
|
|
54
|
+
gas_limit: number;
|
|
67
55
|
storage_limit: number;
|
|
56
|
+
delegate: Uint8Array;
|
|
57
|
+
} | undefined;
|
|
58
|
+
proposal?: {
|
|
59
|
+
source: string;
|
|
60
|
+
period: number;
|
|
61
|
+
proposals: string[];
|
|
62
|
+
} | undefined;
|
|
63
|
+
ballot?: {
|
|
64
|
+
source: string;
|
|
65
|
+
period: number;
|
|
66
|
+
proposal: string;
|
|
67
|
+
ballot: PROTO.TezosBallotType;
|
|
68
68
|
} | undefined;
|
|
69
69
|
address_n: number[];
|
|
70
70
|
branch: Uint8Array;
|
|
@@ -15,9 +15,8 @@ export declare class BackendManager {
|
|
|
15
15
|
removeCustom(shortcut: CoinShortcut): void;
|
|
16
16
|
private setInstance;
|
|
17
17
|
private setPreferred;
|
|
18
|
-
private
|
|
18
|
+
private onDisconnect;
|
|
19
19
|
private clearReconnect;
|
|
20
|
-
private onDisconnected;
|
|
21
20
|
private patchCoinInfo;
|
|
22
21
|
}
|
|
23
22
|
export {};
|
|
@@ -24,7 +24,10 @@ class BackendManager {
|
|
|
24
24
|
postMessage,
|
|
25
25
|
debug: DataManager_1.DataManager.getSettings('debug'),
|
|
26
26
|
proxy: DataManager_1.DataManager.getSettings('proxy'),
|
|
27
|
-
onDisconnected:
|
|
27
|
+
onDisconnected: pendingSubscriptions => {
|
|
28
|
+
const reconnectAttempts = pendingSubscriptions ? 0 : undefined;
|
|
29
|
+
this.onDisconnect(coinInfo, postMessage, reconnectAttempts);
|
|
30
|
+
},
|
|
28
31
|
});
|
|
29
32
|
this.setInstance(coinInfo.shortcut, backend);
|
|
30
33
|
}
|
|
@@ -35,11 +38,7 @@ class BackendManager {
|
|
|
35
38
|
return backend;
|
|
36
39
|
}
|
|
37
40
|
catch (error) {
|
|
38
|
-
this.
|
|
39
|
-
this.setPreferred(coinInfo.shortcut, undefined);
|
|
40
|
-
if (reconnect) {
|
|
41
|
-
this.planReconnect(backend.coinInfo, backend.postMessage, reconnect.attempts);
|
|
42
|
-
}
|
|
41
|
+
this.onDisconnect(coinInfo, postMessage, reconnect === null || reconnect === void 0 ? void 0 : reconnect.attempts);
|
|
43
42
|
throw error;
|
|
44
43
|
}
|
|
45
44
|
}
|
|
@@ -79,15 +78,22 @@ class BackendManager {
|
|
|
79
78
|
else
|
|
80
79
|
this.preferred[shortcut] = url;
|
|
81
80
|
}
|
|
82
|
-
|
|
81
|
+
onDisconnect(coinInfo, postMessage, reconnectAttempt) {
|
|
83
82
|
var _a;
|
|
84
|
-
|
|
83
|
+
this.setInstance(coinInfo.shortcut, undefined);
|
|
84
|
+
if (reconnectAttempt === undefined || reconnectAttempt === 4) {
|
|
85
|
+
this.setPreferred(coinInfo.shortcut, undefined);
|
|
86
|
+
}
|
|
87
|
+
if (reconnectAttempt === undefined) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const timeout = Math.min(2500 * reconnectAttempt, 20000);
|
|
85
91
|
const time = Date.now() + timeout;
|
|
86
92
|
const handle = setTimeout(() => {
|
|
87
93
|
this.getOrConnect(coinInfo, postMessage).catch(() => { });
|
|
88
94
|
}, timeout);
|
|
89
95
|
clearTimeout((_a = this.reconnect[coinInfo.shortcut]) === null || _a === void 0 ? void 0 : _a.handle);
|
|
90
|
-
this.reconnect[coinInfo.shortcut] = { attempts:
|
|
96
|
+
this.reconnect[coinInfo.shortcut] = { attempts: reconnectAttempt + 1, handle };
|
|
91
97
|
postMessage((0, events_1.createBlockchainMessage)(events_1.BLOCKCHAIN.RECONNECTING, { coin: coinInfo, time }));
|
|
92
98
|
}
|
|
93
99
|
clearReconnect(shortcut) {
|
|
@@ -96,12 +102,6 @@ class BackendManager {
|
|
|
96
102
|
delete this.reconnect[shortcut];
|
|
97
103
|
return reconnect;
|
|
98
104
|
}
|
|
99
|
-
onDisconnected(backend, pendingSubscriptions) {
|
|
100
|
-
this.setInstance(backend.coinInfo.shortcut, undefined);
|
|
101
|
-
if (pendingSubscriptions) {
|
|
102
|
-
this.planReconnect(backend.coinInfo, backend.postMessage, 0);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
105
|
patchCoinInfo(coinInfo) {
|
|
106
106
|
var _a, _b;
|
|
107
107
|
const custom = this.custom[coinInfo.shortcut];
|
|
@@ -7,7 +7,7 @@ export type BlockchainOptions = {
|
|
|
7
7
|
postMessage: (message: CoreEventMessage) => void;
|
|
8
8
|
proxy?: Proxy;
|
|
9
9
|
debug?: boolean;
|
|
10
|
-
onDisconnected?: (
|
|
10
|
+
onDisconnected?: (pendingSubscriptions?: boolean) => void;
|
|
11
11
|
};
|
|
12
12
|
export declare class Blockchain {
|
|
13
13
|
link: BlockchainLink;
|
|
@@ -58,7 +58,7 @@ class Blockchain {
|
|
|
58
58
|
error: error.message,
|
|
59
59
|
code: error.code,
|
|
60
60
|
}));
|
|
61
|
-
(_a = this.onDisconnected) === null || _a === void 0 ? void 0 : _a.call(this,
|
|
61
|
+
(_a = this.onDisconnected) === null || _a === void 0 ? void 0 : _a.call(this, !!pendingSubscriptions);
|
|
62
62
|
}
|
|
63
63
|
async initLink() {
|
|
64
64
|
let info;
|
package/lib/core/index.js
CHANGED
|
@@ -114,6 +114,7 @@ const initDevice = async (method) => {
|
|
|
114
114
|
let showDeviceSelection = isWebUsb;
|
|
115
115
|
const isUsingPopup = DataManager_1.DataManager.getSettings('popup');
|
|
116
116
|
const origin = DataManager_1.DataManager.getSettings('origin');
|
|
117
|
+
const useCoreInPopup = DataManager_1.DataManager.getSettings('useCoreInPopup');
|
|
117
118
|
const { preferredDevice } = connect_common_1.storage.load().origin[origin] || {};
|
|
118
119
|
const preferredDeviceInList = preferredDevice && _deviceList.getDevice(preferredDevice.path);
|
|
119
120
|
if (preferredDevice && !preferredDeviceInList) {
|
|
@@ -129,9 +130,10 @@ const initDevice = async (method) => {
|
|
|
129
130
|
}
|
|
130
131
|
else {
|
|
131
132
|
const devices = _deviceList.asArray();
|
|
132
|
-
if (devices.length === 1 && !isWebUsb) {
|
|
133
|
+
if (devices.length === 1 && (!isWebUsb || !isUsingPopup)) {
|
|
133
134
|
device = _deviceList.getDevice(devices[0].path);
|
|
134
|
-
showDeviceSelection =
|
|
135
|
+
showDeviceSelection =
|
|
136
|
+
!!(device === null || device === void 0 ? void 0 : device.unreadableError) || device.isUnacquired() || !!useCoreInPopup;
|
|
135
137
|
}
|
|
136
138
|
else {
|
|
137
139
|
showDeviceSelection = true;
|
|
@@ -159,11 +161,11 @@ const initDevice = async (method) => {
|
|
|
159
161
|
if (uiPromise) {
|
|
160
162
|
const { payload } = await uiPromise.promise;
|
|
161
163
|
if (payload.remember) {
|
|
162
|
-
const { path, state } = payload.device;
|
|
164
|
+
const { label, path, state } = payload.device;
|
|
163
165
|
connect_common_1.storage.save(store => {
|
|
164
166
|
store.origin[origin] = {
|
|
165
167
|
...store.origin[origin],
|
|
166
|
-
preferredDevice: { path, state },
|
|
168
|
+
preferredDevice: { label, path, state },
|
|
167
169
|
};
|
|
168
170
|
return store;
|
|
169
171
|
});
|
|
@@ -186,6 +188,8 @@ const onCall = async (message) => {
|
|
|
186
188
|
const trustedHost = DataManager_1.DataManager.getSettings('trustedHost');
|
|
187
189
|
const isUsingPopup = DataManager_1.DataManager.getSettings('popup');
|
|
188
190
|
const origin = DataManager_1.DataManager.getSettings('origin');
|
|
191
|
+
const env = DataManager_1.DataManager.getSettings('env');
|
|
192
|
+
const useCoreInPopup = DataManager_1.DataManager.getSettings('useCoreInPopup');
|
|
189
193
|
const { preferredDevice } = connect_common_1.storage.loadForOrigin(origin) || {};
|
|
190
194
|
if (preferredDevice && !message.payload.device) {
|
|
191
195
|
message.payload.device = preferredDevice;
|
|
@@ -294,6 +298,31 @@ const onCall = async (message) => {
|
|
|
294
298
|
device.on(events_2.DEVICE.PASSPHRASE_ON_DEVICE, () => {
|
|
295
299
|
postMessage((0, events_2.createUiMessage)(events_2.UI.REQUEST_PASSPHRASE_ON_DEVICE, { device: device.toMessageObject() }));
|
|
296
300
|
});
|
|
301
|
+
device.on(events_2.DEVICE.SAVE_STATE, (state) => {
|
|
302
|
+
connect_common_1.storage.saveForOrigin(store => {
|
|
303
|
+
if (useCoreInPopup && env === 'webextension') {
|
|
304
|
+
return {
|
|
305
|
+
...store,
|
|
306
|
+
preferredDevice: store.preferredDevice
|
|
307
|
+
? {
|
|
308
|
+
...store.preferredDevice,
|
|
309
|
+
internalState: state,
|
|
310
|
+
internalStateExpiration: Date.now() + 1000 * 60 * 15,
|
|
311
|
+
}
|
|
312
|
+
: undefined,
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
return store;
|
|
316
|
+
}, origin);
|
|
317
|
+
});
|
|
318
|
+
if (!device.getInternalState() && useCoreInPopup && env === 'webextension') {
|
|
319
|
+
const { preferredDevice } = connect_common_1.storage.loadForOrigin(origin) || {};
|
|
320
|
+
if ((preferredDevice === null || preferredDevice === void 0 ? void 0 : preferredDevice.internalState) &&
|
|
321
|
+
(preferredDevice === null || preferredDevice === void 0 ? void 0 : preferredDevice.internalStateExpiration) &&
|
|
322
|
+
preferredDevice.internalStateExpiration > new Date().getTime()) {
|
|
323
|
+
device.setInternalState(preferredDevice.internalState);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
297
326
|
try {
|
|
298
327
|
let PIN_TRIES = 1;
|
|
299
328
|
const MAX_PIN_TRIES = 3;
|