@trezor/connect 9.5.0 → 9.5.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 +18 -6
- package/README.md +1 -1
- package/lib/api/bitcoin/BitcoinFees.d.ts +25 -0
- package/lib/api/bitcoin/{Fees.js → BitcoinFees.js} +8 -29
- package/lib/api/bitcoin/TransactionComposer.d.ts +2 -2
- package/lib/api/bitcoin/TransactionComposer.js +5 -5
- package/lib/api/bitcoin/index.d.ts +1 -1
- package/lib/api/bitcoin/index.js +1 -1
- package/lib/api/blockchainEstimateFee.js +15 -4
- package/lib/api/{bitcoin/Fees.d.ts → common/MiscFees.d.ts} +10 -11
- package/lib/api/common/MiscFees.js +46 -0
- package/lib/api/common/paramsValidator.js +1 -1
- package/lib/api/ethereum/EthereumFees.d.ts +24 -0
- package/lib/api/ethereum/EthereumFees.js +71 -0
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +6 -0
- package/lib/api/ethereum/ethereumDefinitions.js +1 -3
- package/lib/api/getCoinInfo.d.ts +18 -0
- package/lib/api/solana/api/solanaComposeTransaction.d.ts +1 -2
- package/lib/api/solana/api/solanaComposeTransaction.js +2 -5
- package/lib/api/unlockPath.d.ts +1 -1
- package/lib/backend/Blockchain.d.ts +1 -0
- package/lib/core/AbstractMethod.js +1 -1
- package/lib/data/coinInfo.d.ts +66 -0
- package/lib/data/connectSettings.js +3 -0
- package/lib/data/defaultFeeLevels.js +1 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +3 -5
- package/lib/device/Device.js +25 -20
- package/lib/device/DeviceList.d.ts +6 -13
- package/lib/device/DeviceList.js +44 -174
- package/lib/device/TransportList.d.ts +9 -0
- package/lib/device/TransportList.js +50 -0
- package/lib/device/TransportManager.d.ts +34 -0
- package/lib/device/TransportManager.js +149 -0
- package/lib/device/checkFirmwareRevision.js +9 -5
- package/lib/types/api/solana/index.d.ts +1 -2
- package/lib/types/api/solana/index.js +1 -2
- package/lib/types/coinInfo.d.ts +36 -0
- package/lib/types/device.d.ts +6 -0
- package/lib/types/fees.d.ts +13 -0
- package/lib/types/fees.js +13 -1
- package/lib/types/settings.d.ts +3 -1
- package/lib/types/utils.d.ts +0 -1
- package/lib/types/utils.js +0 -3
- package/lib/utils/assets-browser.d.ts +4 -0
- package/lib/utils/assets-browser.js +11 -2
- package/package.json +15 -15
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BridgeTransport, NodeUsbTransport, Transport, UdpTransport } from '@trezor/transport';
|
|
2
|
+
import type { AbstractTransportParams } from '@trezor/transport/lib/transports/abstract';
|
|
3
|
+
import { ConnectSettingsTransport } from '../types';
|
|
4
|
+
type Params = AbstractTransportParams & {
|
|
5
|
+
sessionsBackgroundUrl?: string | null;
|
|
6
|
+
};
|
|
7
|
+
export declare const createTransportList: (params: Params) => (existing: Transport[], transports?: ConnectSettingsTransport[]) => (Transport | NodeUsbTransport | BridgeTransport | UdpTransport)[];
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=TransportList.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTransportList = void 0;
|
|
4
|
+
const transport_1 = require("@trezor/transport");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const transportInfo_1 = require("../data/transportInfo");
|
|
7
|
+
const tryGetTransport = (transports, name) => transports.find(t => t.name === name);
|
|
8
|
+
const getOrCreateTransport = (transports, transportType, params) => {
|
|
9
|
+
if (typeof transportType === 'string') {
|
|
10
|
+
const existing = tryGetTransport(transports, transportType);
|
|
11
|
+
if (existing)
|
|
12
|
+
return existing;
|
|
13
|
+
switch (transportType) {
|
|
14
|
+
case 'WebUsbTransport':
|
|
15
|
+
return new transport_1.WebUsbTransport(params);
|
|
16
|
+
case 'NodeUsbTransport':
|
|
17
|
+
return new transport_1.NodeUsbTransport(params);
|
|
18
|
+
case 'BridgeTransport':
|
|
19
|
+
return new transport_1.BridgeTransport({
|
|
20
|
+
latestVersion: (0, transportInfo_1.getBridgeInfo)().version.join('.'),
|
|
21
|
+
...params,
|
|
22
|
+
});
|
|
23
|
+
case 'UdpTransport':
|
|
24
|
+
return new transport_1.UdpTransport(params);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else if (typeof transportType === 'function' && 'prototype' in transportType) {
|
|
28
|
+
const transportInstance = new transportType(params);
|
|
29
|
+
if ((0, transport_1.isTransportInstance)(transportInstance)) {
|
|
30
|
+
return tryGetTransport(transports, transportInstance.name) ?? transportInstance;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if ((0, transport_1.isTransportInstance)(transportType)) {
|
|
34
|
+
if (tryGetTransport(transports, transportType.name)) {
|
|
35
|
+
return transportType;
|
|
36
|
+
}
|
|
37
|
+
if (!transportType.getMessage()) {
|
|
38
|
+
transportType.updateMessages(params.messages);
|
|
39
|
+
}
|
|
40
|
+
return transportType;
|
|
41
|
+
}
|
|
42
|
+
throw constants_1.ERRORS.TypedError('Runtime', `DeviceList.init: transports[] of unexpected type: ${transportType}`);
|
|
43
|
+
};
|
|
44
|
+
const createTransports = (existing, transports = [], params) => {
|
|
45
|
+
const transportTypes = transports?.length ? transports : ['BridgeTransport'];
|
|
46
|
+
return transportTypes.map(type => getOrCreateTransport(existing, type, params));
|
|
47
|
+
};
|
|
48
|
+
const createTransportList = (params) => (existing, transports) => createTransports(existing, transports, params);
|
|
49
|
+
exports.createTransportList = createTransportList;
|
|
50
|
+
//# sourceMappingURL=TransportList.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TRANSPORT, Transport } from '@trezor/transport';
|
|
2
|
+
import { TypedEmitter } from '@trezor/utils';
|
|
3
|
+
type TransportManagerEvents = {
|
|
4
|
+
[TRANSPORT.START]: Transport;
|
|
5
|
+
[TRANSPORT.ERROR]: string;
|
|
6
|
+
};
|
|
7
|
+
type TransportManagerParams = {
|
|
8
|
+
startTransport: (transport: Transport, pendingTransportEvent: boolean, signal: AbortSignal) => Promise<void>;
|
|
9
|
+
stopTransport: (transport: Transport) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
type InitParams = {
|
|
12
|
+
transports: Transport[];
|
|
13
|
+
transportReconnect?: boolean;
|
|
14
|
+
pendingTransportEvent?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare class TransportManager extends TypedEmitter<TransportManagerEvents> {
|
|
17
|
+
private lock;
|
|
18
|
+
private transports;
|
|
19
|
+
private activeTransport?;
|
|
20
|
+
private transportReconnect;
|
|
21
|
+
private upgradeTimeout?;
|
|
22
|
+
private readonly startTransport;
|
|
23
|
+
private readonly stopTransport;
|
|
24
|
+
constructor({ startTransport, stopTransport }: TransportManagerParams);
|
|
25
|
+
pending(): Promise<void> | undefined;
|
|
26
|
+
get(): Transport | undefined;
|
|
27
|
+
init({ transports, transportReconnect, pendingTransportEvent }: InitParams): Promise<void>;
|
|
28
|
+
dispose(): Promise<void>;
|
|
29
|
+
private selectTransport;
|
|
30
|
+
private scheduleUpgradeCheck;
|
|
31
|
+
private createInitPromise;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=TransportManager.d.ts.map
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransportManager = void 0;
|
|
4
|
+
const transport_1 = require("@trezor/transport");
|
|
5
|
+
const utils_1 = require("@trezor/utils");
|
|
6
|
+
const createOverrideLock = () => {
|
|
7
|
+
let promise;
|
|
8
|
+
let sequence = 0;
|
|
9
|
+
let abort;
|
|
10
|
+
let message;
|
|
11
|
+
const override = async (abortMessage, action) => {
|
|
12
|
+
message = abortMessage;
|
|
13
|
+
const seq = ++sequence;
|
|
14
|
+
while (promise) {
|
|
15
|
+
abort?.abort(new Error(abortMessage));
|
|
16
|
+
await promise.catch(() => { });
|
|
17
|
+
}
|
|
18
|
+
if (seq !== sequence)
|
|
19
|
+
return Promise.reject(new Error(message));
|
|
20
|
+
abort = new AbortController();
|
|
21
|
+
promise = action(abort.signal).finally(() => {
|
|
22
|
+
abort = undefined;
|
|
23
|
+
promise = undefined;
|
|
24
|
+
});
|
|
25
|
+
return promise;
|
|
26
|
+
};
|
|
27
|
+
const getPending = () => promise;
|
|
28
|
+
return { override, getPending };
|
|
29
|
+
};
|
|
30
|
+
class TransportManager extends utils_1.TypedEmitter {
|
|
31
|
+
lock = createOverrideLock();
|
|
32
|
+
transports = [];
|
|
33
|
+
activeTransport;
|
|
34
|
+
transportReconnect = false;
|
|
35
|
+
upgradeTimeout;
|
|
36
|
+
startTransport;
|
|
37
|
+
stopTransport;
|
|
38
|
+
constructor({ startTransport, stopTransport }) {
|
|
39
|
+
super();
|
|
40
|
+
this.startTransport = startTransport;
|
|
41
|
+
this.stopTransport = stopTransport;
|
|
42
|
+
}
|
|
43
|
+
pending() {
|
|
44
|
+
return this.lock.getPending();
|
|
45
|
+
}
|
|
46
|
+
get() {
|
|
47
|
+
return this.activeTransport;
|
|
48
|
+
}
|
|
49
|
+
init({ transports, transportReconnect = false, pendingTransportEvent = false }) {
|
|
50
|
+
this.transports = transports;
|
|
51
|
+
this.transportReconnect = transportReconnect;
|
|
52
|
+
return this.lock.override('New init', signal => this.createInitPromise(pendingTransportEvent, signal));
|
|
53
|
+
}
|
|
54
|
+
dispose() {
|
|
55
|
+
this.removeAllListeners();
|
|
56
|
+
return this.lock.override('Disposing', async () => {
|
|
57
|
+
const { activeTransport } = this;
|
|
58
|
+
if (activeTransport) {
|
|
59
|
+
clearTimeout(this.upgradeTimeout);
|
|
60
|
+
delete this.activeTransport;
|
|
61
|
+
await this.stopTransport(activeTransport);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async selectTransport([transport, ...rest], signal) {
|
|
66
|
+
if (signal.aborted)
|
|
67
|
+
throw new Error(signal.reason);
|
|
68
|
+
if (transport === this.activeTransport)
|
|
69
|
+
return transport;
|
|
70
|
+
const result = await transport.init({ signal });
|
|
71
|
+
if (result.success)
|
|
72
|
+
return transport;
|
|
73
|
+
else if (rest.length)
|
|
74
|
+
return this.selectTransport(rest, signal);
|
|
75
|
+
else
|
|
76
|
+
throw new Error(result.error);
|
|
77
|
+
}
|
|
78
|
+
scheduleUpgradeCheck(pendingTransportEvent) {
|
|
79
|
+
clearTimeout(this.upgradeTimeout);
|
|
80
|
+
this.upgradeTimeout = setTimeout(async () => {
|
|
81
|
+
if (!this.activeTransport || this.activeTransport === this.transports[0])
|
|
82
|
+
return;
|
|
83
|
+
for (const t of this.transports) {
|
|
84
|
+
if (t === this.activeTransport)
|
|
85
|
+
break;
|
|
86
|
+
if (await t.ping()) {
|
|
87
|
+
this.lock
|
|
88
|
+
.override('Upgrading', signal => this.createInitPromise(pendingTransportEvent, signal))
|
|
89
|
+
.catch(() => { });
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
this.scheduleUpgradeCheck(pendingTransportEvent);
|
|
94
|
+
}, 1000);
|
|
95
|
+
}
|
|
96
|
+
async createInitPromise(pendingTransportEvent, abortSignal) {
|
|
97
|
+
try {
|
|
98
|
+
const { transports, activeTransport } = this;
|
|
99
|
+
const transport = transports.length
|
|
100
|
+
? await this.selectTransport(transports, abortSignal)
|
|
101
|
+
: undefined;
|
|
102
|
+
if (activeTransport !== transport) {
|
|
103
|
+
if (activeTransport) {
|
|
104
|
+
clearTimeout(this.upgradeTimeout);
|
|
105
|
+
delete this.activeTransport;
|
|
106
|
+
await this.stopTransport(activeTransport);
|
|
107
|
+
}
|
|
108
|
+
if (transport) {
|
|
109
|
+
await this.startTransport(transport, pendingTransportEvent, abortSignal);
|
|
110
|
+
transport.on(transport_1.TRANSPORT.ERROR, error => {
|
|
111
|
+
this.emit(transport_1.TRANSPORT.ERROR, error);
|
|
112
|
+
clearTimeout(this.upgradeTimeout);
|
|
113
|
+
this.lock
|
|
114
|
+
.override('Transport error', async (signal) => {
|
|
115
|
+
delete this.activeTransport;
|
|
116
|
+
await this.stopTransport(transport);
|
|
117
|
+
if (this.transportReconnect) {
|
|
118
|
+
await (0, utils_1.resolveAfter)(1000, signal);
|
|
119
|
+
await this.createInitPromise(pendingTransportEvent, signal);
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
.catch(() => { });
|
|
123
|
+
});
|
|
124
|
+
this.activeTransport = transport;
|
|
125
|
+
this.emit(transport_1.TRANSPORT.START, transport);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this.emit(transport_1.TRANSPORT.ERROR, 'Transport disabled');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (transport && transport !== transports[0]) {
|
|
132
|
+
this.scheduleUpgradeCheck(pendingTransportEvent);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
this.emit(transport_1.TRANSPORT.ERROR, error?.message);
|
|
137
|
+
if (this.transportReconnect && !abortSignal.aborted) {
|
|
138
|
+
this.lock
|
|
139
|
+
.override('Reconnecting', async (signal) => {
|
|
140
|
+
await (0, utils_1.resolveAfter)(1000, signal);
|
|
141
|
+
await this.createInitPromise(pendingTransportEvent, signal);
|
|
142
|
+
})
|
|
143
|
+
.catch(() => { });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.TransportManager = TransportManager;
|
|
149
|
+
//# sourceMappingURL=TransportManager.js.map
|
|
@@ -4,12 +4,14 @@ exports.checkFirmwareRevision = void 0;
|
|
|
4
4
|
const versionUtils_1 = require("@trezor/utils/lib/versionUtils");
|
|
5
5
|
const downloadReleasesMetadata_1 = require("../data/downloadReleasesMetadata");
|
|
6
6
|
const calculateRevisionForDevice_1 = require("./calculateRevisionForDevice");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const assets_browser_1 = require("../utils/assets-browser");
|
|
8
|
+
const isNotFoundError = (e) => e instanceof assets_browser_1.HttpRequestError && e.response.status === 404;
|
|
9
|
+
const isNodeJSOfflineError = (e) => ['FetchError', 'AbortError'].includes(e.name);
|
|
10
|
+
const isReactNativeOfflineError = (e) => e.name === 'TypeError' && e.message.includes('Network request failed');
|
|
11
|
+
const isOfflineError = (e) => {
|
|
10
12
|
if (!(e instanceof Error))
|
|
11
13
|
return false;
|
|
12
|
-
return
|
|
14
|
+
return isNodeJSOfflineError(e) || isReactNativeOfflineError(e);
|
|
13
15
|
};
|
|
14
16
|
const getOnlineReleaseMetadata = async ({ firmwareVersion, internalModel, }) => {
|
|
15
17
|
const onlineReleases = await (0, downloadReleasesMetadata_1.downloadReleasesMetadata)({ internal_model: internalModel });
|
|
@@ -49,7 +51,9 @@ const checkFirmwareRevision = async ({ firmwareVersion, internalModel, deviceRev
|
|
|
49
51
|
return { success: true };
|
|
50
52
|
}
|
|
51
53
|
catch (e) {
|
|
52
|
-
|
|
54
|
+
if (isNotFoundError(e))
|
|
55
|
+
return failFirmwareRevisionCheck('firmware-version-unknown');
|
|
56
|
+
return isOfflineError(e)
|
|
53
57
|
? failFirmwareRevisionCheck('cannot-perform-check-offline')
|
|
54
58
|
: failFirmwareRevisionCheck('other-error');
|
|
55
59
|
}
|
|
@@ -71,8 +71,7 @@ export type SolanaComposedTransaction = Static<typeof SolanaComposedTransaction>
|
|
|
71
71
|
export declare const SolanaComposedTransaction: import("@trezor/schema-utils").TObject<{
|
|
72
72
|
serializedTx: import("@trezor/schema-utils").TString;
|
|
73
73
|
additionalInfo: import("@trezor/schema-utils").TObject<{
|
|
74
|
-
|
|
75
|
-
newTokenAccountProgramName: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TLiteral<"spl-token">, import("@trezor/schema-utils").TLiteral<"spl-token-2022">]>>;
|
|
74
|
+
newAccountProgramName: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TLiteral<"spl-token">, import("@trezor/schema-utils").TLiteral<"spl-token-2022">]>>;
|
|
76
75
|
tokenAccountInfo: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TObject<{
|
|
77
76
|
baseAddress: import("@trezor/schema-utils").TString;
|
|
78
77
|
tokenProgram: import("@trezor/schema-utils").TString;
|
|
@@ -51,8 +51,7 @@ exports.SolanaComposeTransaction = schema_utils_1.Type.Object({
|
|
|
51
51
|
exports.SolanaComposedTransaction = schema_utils_1.Type.Object({
|
|
52
52
|
serializedTx: schema_utils_1.Type.String(),
|
|
53
53
|
additionalInfo: schema_utils_1.Type.Object({
|
|
54
|
-
|
|
55
|
-
newTokenAccountProgramName: schema_utils_1.Type.Optional(exports.SolanaProgramName),
|
|
54
|
+
newAccountProgramName: schema_utils_1.Type.Optional(exports.SolanaProgramName),
|
|
56
55
|
tokenAccountInfo: schema_utils_1.Type.Optional(exports.SolanaTxTokenAccountInfo),
|
|
57
56
|
}),
|
|
58
57
|
});
|
package/lib/types/coinInfo.d.ts
CHANGED
|
@@ -68,6 +68,12 @@ export declare const BitcoinNetworkInfo: import("@trezor/schema-utils").TInterse
|
|
|
68
68
|
blocks: import("@trezor/schema-utils").TNumber;
|
|
69
69
|
feeLimit: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
70
70
|
feePerTx: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
71
|
+
baseFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
72
|
+
maxFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
73
|
+
effectiveGasPrice: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
74
|
+
maxPriorityFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
75
|
+
maxWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
76
|
+
minWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
71
77
|
}>>;
|
|
72
78
|
}>, import("@trezor/schema-utils").TObject<{
|
|
73
79
|
type: import("@trezor/schema-utils").TLiteral<"bitcoin">;
|
|
@@ -129,6 +135,12 @@ export declare const EthereumNetworkInfo: import("@trezor/schema-utils").TInters
|
|
|
129
135
|
blocks: import("@trezor/schema-utils").TNumber;
|
|
130
136
|
feeLimit: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
131
137
|
feePerTx: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
138
|
+
baseFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
139
|
+
maxFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
140
|
+
effectiveGasPrice: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
141
|
+
maxPriorityFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
142
|
+
maxWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
143
|
+
minWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
132
144
|
}>>;
|
|
133
145
|
}>, import("@trezor/schema-utils").TObject<{
|
|
134
146
|
type: import("@trezor/schema-utils").TLiteral<"ethereum">;
|
|
@@ -191,6 +203,12 @@ export declare const MiscNetworkInfo: import("@trezor/schema-utils").TIntersect<
|
|
|
191
203
|
blocks: import("@trezor/schema-utils").TNumber;
|
|
192
204
|
feeLimit: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
193
205
|
feePerTx: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
206
|
+
baseFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
207
|
+
maxFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
208
|
+
effectiveGasPrice: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
209
|
+
maxPriorityFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
210
|
+
maxWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
211
|
+
minWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
194
212
|
}>>;
|
|
195
213
|
}>, import("@trezor/schema-utils").TObject<{
|
|
196
214
|
type: import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TLiteral<"misc">, import("@trezor/schema-utils").TLiteral<"nem">]>;
|
|
@@ -227,6 +245,12 @@ export declare const CoinInfo: import("@trezor/schema-utils").TUnion<[import("@t
|
|
|
227
245
|
blocks: import("@trezor/schema-utils").TNumber;
|
|
228
246
|
feeLimit: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
229
247
|
feePerTx: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
248
|
+
baseFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
249
|
+
maxFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
250
|
+
effectiveGasPrice: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
251
|
+
maxPriorityFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
252
|
+
maxWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
253
|
+
minWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
230
254
|
}>>;
|
|
231
255
|
}>, import("@trezor/schema-utils").TObject<{
|
|
232
256
|
type: import("@trezor/schema-utils").TLiteral<"bitcoin">;
|
|
@@ -286,6 +310,12 @@ export declare const CoinInfo: import("@trezor/schema-utils").TUnion<[import("@t
|
|
|
286
310
|
blocks: import("@trezor/schema-utils").TNumber;
|
|
287
311
|
feeLimit: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
288
312
|
feePerTx: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
313
|
+
baseFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
314
|
+
maxFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
315
|
+
effectiveGasPrice: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
316
|
+
maxPriorityFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
317
|
+
maxWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
318
|
+
minWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
289
319
|
}>>;
|
|
290
320
|
}>, import("@trezor/schema-utils").TObject<{
|
|
291
321
|
type: import("@trezor/schema-utils").TLiteral<"ethereum">;
|
|
@@ -320,6 +350,12 @@ export declare const CoinInfo: import("@trezor/schema-utils").TUnion<[import("@t
|
|
|
320
350
|
blocks: import("@trezor/schema-utils").TNumber;
|
|
321
351
|
feeLimit: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
322
352
|
feePerTx: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
353
|
+
baseFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
354
|
+
maxFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
355
|
+
effectiveGasPrice: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
356
|
+
maxPriorityFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
357
|
+
maxWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
358
|
+
minWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
323
359
|
}>>;
|
|
324
360
|
}>, import("@trezor/schema-utils").TObject<{
|
|
325
361
|
type: import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TLiteral<"misc">, import("@trezor/schema-utils").TLiteral<"nem">]>;
|
package/lib/types/device.d.ts
CHANGED
|
@@ -44,6 +44,9 @@ type BaseDevice = {
|
|
|
44
44
|
path: DeviceUniquePath;
|
|
45
45
|
name: string;
|
|
46
46
|
};
|
|
47
|
+
export type BluetoothDeviceProps = {
|
|
48
|
+
id: string;
|
|
49
|
+
};
|
|
47
50
|
export type KnownDevice = BaseDevice & {
|
|
48
51
|
type: 'acquired';
|
|
49
52
|
id: string | null;
|
|
@@ -66,6 +69,7 @@ export type KnownDevice = BaseDevice & {
|
|
|
66
69
|
};
|
|
67
70
|
transportSessionOwner?: undefined;
|
|
68
71
|
transportDescriptorType?: typeof undefined;
|
|
72
|
+
bluetoothProps?: BluetoothDeviceProps;
|
|
69
73
|
};
|
|
70
74
|
export type UnknownDevice = BaseDevice & {
|
|
71
75
|
type: 'unacquired';
|
|
@@ -85,6 +89,7 @@ export type UnknownDevice = BaseDevice & {
|
|
|
85
89
|
availableTranslations?: typeof undefined;
|
|
86
90
|
transportSessionOwner?: string;
|
|
87
91
|
transportDescriptorType?: typeof undefined;
|
|
92
|
+
bluetoothProps?: BluetoothDeviceProps;
|
|
88
93
|
};
|
|
89
94
|
export type UnreadableDevice = BaseDevice & {
|
|
90
95
|
type: 'unreadable';
|
|
@@ -104,6 +109,7 @@ export type UnreadableDevice = BaseDevice & {
|
|
|
104
109
|
availableTranslations?: typeof undefined;
|
|
105
110
|
transportSessionOwner?: undefined;
|
|
106
111
|
transportDescriptorType: Descriptor['type'];
|
|
112
|
+
bluetoothProps?: BluetoothDeviceProps;
|
|
107
113
|
};
|
|
108
114
|
export type Device = KnownDevice | UnknownDevice | UnreadableDevice;
|
|
109
115
|
export type Features = PROTO.Features;
|
package/lib/types/fees.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ export declare const FeeInfo: import("@trezor/schema-utils").TObject<{
|
|
|
6
6
|
maxFee: import("@trezor/schema-utils").TNumber;
|
|
7
7
|
dustLimit: import("@trezor/schema-utils").TNumber;
|
|
8
8
|
}>;
|
|
9
|
+
export type PriorityFeeEstimationDetails = Static<typeof PriorityFeeEstimationDetails>;
|
|
10
|
+
export declare const PriorityFeeEstimationDetails: import("@trezor/schema-utils").TObject<{
|
|
11
|
+
maxFeePerGas: import("@trezor/schema-utils").TString;
|
|
12
|
+
maxPriorityFeePerGas: import("@trezor/schema-utils").TString;
|
|
13
|
+
maxWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
14
|
+
minWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
15
|
+
}>;
|
|
9
16
|
export type FeeLevel = Static<typeof FeeLevel>;
|
|
10
17
|
export declare const FeeLevel: import("@trezor/schema-utils").TObject<{
|
|
11
18
|
label: import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TLiteral<"high">, import("@trezor/schema-utils").TLiteral<"normal">, import("@trezor/schema-utils").TLiteral<"economy">, import("@trezor/schema-utils").TLiteral<"low">, import("@trezor/schema-utils").TLiteral<"custom">]>;
|
|
@@ -13,6 +20,12 @@ export declare const FeeLevel: import("@trezor/schema-utils").TObject<{
|
|
|
13
20
|
blocks: import("@trezor/schema-utils").TNumber;
|
|
14
21
|
feeLimit: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
15
22
|
feePerTx: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
23
|
+
baseFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
24
|
+
maxFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
25
|
+
effectiveGasPrice: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
26
|
+
maxPriorityFeePerGas: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
|
|
27
|
+
maxWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
28
|
+
minWaitTimeEstimate: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TNumber>;
|
|
16
29
|
}>;
|
|
17
30
|
export type SelectFeeLevel = Static<typeof SelectFeeLevel>;
|
|
18
31
|
export declare const SelectFeeLevel: import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TObject<{
|
package/lib/types/fees.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectFeeLevel = exports.FeeLevel = exports.FeeInfo = void 0;
|
|
3
|
+
exports.SelectFeeLevel = exports.FeeLevel = exports.PriorityFeeEstimationDetails = exports.FeeInfo = void 0;
|
|
4
4
|
const schema_utils_1 = require("@trezor/schema-utils");
|
|
5
5
|
exports.FeeInfo = schema_utils_1.Type.Object({
|
|
6
6
|
blockTime: schema_utils_1.Type.Number(),
|
|
@@ -8,6 +8,12 @@ exports.FeeInfo = schema_utils_1.Type.Object({
|
|
|
8
8
|
maxFee: schema_utils_1.Type.Number(),
|
|
9
9
|
dustLimit: schema_utils_1.Type.Number(),
|
|
10
10
|
});
|
|
11
|
+
exports.PriorityFeeEstimationDetails = schema_utils_1.Type.Object({
|
|
12
|
+
maxFeePerGas: schema_utils_1.Type.String(),
|
|
13
|
+
maxPriorityFeePerGas: schema_utils_1.Type.String(),
|
|
14
|
+
maxWaitTimeEstimate: schema_utils_1.Type.Optional(schema_utils_1.Type.Number()),
|
|
15
|
+
minWaitTimeEstimate: schema_utils_1.Type.Optional(schema_utils_1.Type.Number()),
|
|
16
|
+
});
|
|
11
17
|
exports.FeeLevel = schema_utils_1.Type.Object({
|
|
12
18
|
label: schema_utils_1.Type.Union([
|
|
13
19
|
schema_utils_1.Type.Literal('high'),
|
|
@@ -20,6 +26,12 @@ exports.FeeLevel = schema_utils_1.Type.Object({
|
|
|
20
26
|
blocks: schema_utils_1.Type.Number(),
|
|
21
27
|
feeLimit: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
22
28
|
feePerTx: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
29
|
+
baseFeePerGas: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
30
|
+
maxFeePerGas: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
31
|
+
effectiveGasPrice: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
32
|
+
maxPriorityFeePerGas: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
33
|
+
maxWaitTimeEstimate: schema_utils_1.Type.Optional(schema_utils_1.Type.Number()),
|
|
34
|
+
minWaitTimeEstimate: schema_utils_1.Type.Optional(schema_utils_1.Type.Number()),
|
|
23
35
|
});
|
|
24
36
|
exports.SelectFeeLevel = schema_utils_1.Type.Union([
|
|
25
37
|
schema_utils_1.Type.Object({
|
package/lib/types/settings.d.ts
CHANGED
|
@@ -7,13 +7,14 @@ export interface Manifest {
|
|
|
7
7
|
}
|
|
8
8
|
export type Proxy = BlockchainSettings['proxy'];
|
|
9
9
|
type KnownTransport = Exclude<Transport['name'], 'NativeUsbTransport' | 'BluetoothTransport'>;
|
|
10
|
+
export type ConnectSettingsTransport = KnownTransport | Transport | (new (...args: any[]) => Transport);
|
|
10
11
|
export interface ConnectSettingsPublic {
|
|
11
12
|
manifest?: Manifest;
|
|
12
13
|
connectSrc?: string;
|
|
13
14
|
debug?: boolean;
|
|
14
15
|
popup?: boolean;
|
|
15
16
|
transportReconnect?: boolean;
|
|
16
|
-
transports?:
|
|
17
|
+
transports?: ConnectSettingsTransport[];
|
|
17
18
|
pendingTransportEvent?: boolean;
|
|
18
19
|
lazyLoad?: boolean;
|
|
19
20
|
interactionTimeout?: number;
|
|
@@ -29,6 +30,7 @@ export interface ConnectSettingsInternal {
|
|
|
29
30
|
popupSrc: string;
|
|
30
31
|
webusbSrc: string;
|
|
31
32
|
version: string;
|
|
33
|
+
npmVersion?: string;
|
|
32
34
|
priority: number;
|
|
33
35
|
extension?: string;
|
|
34
36
|
env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native';
|
package/lib/types/utils.d.ts
CHANGED
|
@@ -12,5 +12,4 @@ export type MessageFactoryFn<Group, Event> = UnionToIntersection<Event extends {
|
|
|
12
12
|
type: Event['type'];
|
|
13
13
|
payload: undefined;
|
|
14
14
|
} : never>;
|
|
15
|
-
export declare const typedObjectKeys: <T extends Record<any, any>>(obj: T) => Array<keyof T>;
|
|
16
15
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/types/utils.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { HttpRequestOptions, HttpRequestReturnType, HttpRequestType } from './assetsTypes';
|
|
2
|
+
export declare class HttpRequestError extends Error {
|
|
3
|
+
response: Response;
|
|
4
|
+
constructor(response: Response);
|
|
5
|
+
}
|
|
2
6
|
export declare const httpRequest: <T extends HttpRequestType>(url: string, type?: T, options?: HttpRequestOptions) => Promise<HttpRequestReturnType<T>>;
|
|
3
7
|
//# sourceMappingURL=assets-browser.d.ts.map
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.httpRequest = void 0;
|
|
3
|
+
exports.httpRequest = exports.HttpRequestError = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const cross_fetch_1 = tslib_1.__importDefault(require("cross-fetch"));
|
|
6
|
+
class HttpRequestError extends Error {
|
|
7
|
+
response;
|
|
8
|
+
constructor(response) {
|
|
9
|
+
const message = `${response.status} while fetching ${response.url}`;
|
|
10
|
+
super(message);
|
|
11
|
+
this.response = response;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.HttpRequestError = HttpRequestError;
|
|
6
15
|
const httpRequest = async (url, type = 'text', options) => {
|
|
7
16
|
const init = { ...options, credentials: 'same-origin' };
|
|
8
17
|
const response = await (0, cross_fetch_1.default)(url, init);
|
|
@@ -16,7 +25,7 @@ const httpRequest = async (url, type = 'text', options) => {
|
|
|
16
25
|
}
|
|
17
26
|
return response.text();
|
|
18
27
|
}
|
|
19
|
-
throw new
|
|
28
|
+
throw new HttpRequestError(response);
|
|
20
29
|
};
|
|
21
30
|
exports.httpRequest = httpRequest;
|
|
22
31
|
//# sourceMappingURL=assets-browser.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trezor/connect",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.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.",
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"prepublish": "yarn tsx ../../scripts/prepublish.js"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@babel/preset-typescript": "^7.24.7",
|
|
72
71
|
"@ethereumjs/common": "^4.4.0",
|
|
73
72
|
"@ethereumjs/tx": "^5.4.0",
|
|
74
73
|
"@fivebinaries/coin-selection": "3.0.0",
|
|
@@ -80,24 +79,25 @@
|
|
|
80
79
|
"@solana-program/token": "^0.4.1",
|
|
81
80
|
"@solana-program/token-2022": "^0.3.4",
|
|
82
81
|
"@solana/web3.js": "^2.0.0",
|
|
83
|
-
"@trezor/blockchain-link": "2.4.
|
|
84
|
-
"@trezor/blockchain-link-types": "1.3.
|
|
85
|
-
"@trezor/blockchain-link-utils": "1.3.
|
|
82
|
+
"@trezor/blockchain-link": "2.4.1",
|
|
83
|
+
"@trezor/blockchain-link-types": "1.3.1",
|
|
84
|
+
"@trezor/blockchain-link-utils": "1.3.1",
|
|
86
85
|
"@trezor/connect-analytics": "1.3.0",
|
|
87
|
-
"@trezor/connect-common": "0.3.
|
|
88
|
-
"@trezor/crypto-utils": "1.1.
|
|
89
|
-
"@trezor/protobuf": "1.3.
|
|
90
|
-
"@trezor/protocol": "1.2.
|
|
91
|
-
"@trezor/schema-utils": "1.3.
|
|
92
|
-
"@trezor/transport": "1.4.
|
|
93
|
-
"@trezor/utils": "9.3.
|
|
94
|
-
"@trezor/utxo-lib": "2.3.
|
|
86
|
+
"@trezor/connect-common": "0.3.1",
|
|
87
|
+
"@trezor/crypto-utils": "1.1.1",
|
|
88
|
+
"@trezor/protobuf": "1.3.1",
|
|
89
|
+
"@trezor/protocol": "1.2.3",
|
|
90
|
+
"@trezor/schema-utils": "1.3.1",
|
|
91
|
+
"@trezor/transport": "1.4.1",
|
|
92
|
+
"@trezor/utils": "9.3.1",
|
|
93
|
+
"@trezor/utxo-lib": "2.3.1",
|
|
95
94
|
"blakejs": "^1.2.1",
|
|
96
95
|
"bs58": "^6.0.0",
|
|
97
96
|
"bs58check": "^4.0.0",
|
|
98
97
|
"cross-fetch": "^4.0.0"
|
|
99
98
|
},
|
|
100
99
|
"devDependencies": {
|
|
100
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
101
101
|
"@trezor/eslint": "1.0.0",
|
|
102
102
|
"@trezor/trezor-user-env-link": "1.0.2",
|
|
103
103
|
"@types/karma": "^6.3.9",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"karma-webpack": "^5.0.1",
|
|
113
113
|
"node-fetch": "^2.6.4",
|
|
114
114
|
"node-libs-browser": "^2.2.1",
|
|
115
|
-
"ts-node": "^10.9.
|
|
116
|
-
"tsx": "^4.
|
|
115
|
+
"ts-node": "^10.9.2",
|
|
116
|
+
"tsx": "^4.19.3",
|
|
117
117
|
"web3-utils": "^4.3.2",
|
|
118
118
|
"webpack": "^5.97.1",
|
|
119
119
|
"ws": "^8.18.0"
|