@trezor/connect 9.2.1 → 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 +26 -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/changeLanguage.js +11 -5
- package/lib/api/eos/eosSignTx.d.ts +58 -58
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +6 -6
- package/lib/api/getCoinInfo.d.ts +22 -22
- package/lib/api/getFeatures.d.ts +10 -10
- package/lib/api/getPublicKey.d.ts +6 -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/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 +7 -7
- package/lib/device/resolveDescriptorForTaproot.js +21 -16
- package/lib/events/device.d.ts +1 -0
- package/lib/events/device.js +1 -0
- package/lib/types/api/applySettings.d.ts +6 -6
- package/lib/types/api/getAddress.d.ts +5 -5
- package/lib/types/api/getPublicKey.js +4 -1
- package/lib/types/api/recoveryDevice.d.ts +1 -1
- 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
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.2';
|
|
5
5
|
const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
|
|
6
6
|
exports.DEFAULT_DOMAIN = `https://connect.trezor.io/${versionN[0]}/`;
|
|
7
7
|
//# sourceMappingURL=version.js.map
|
package/lib/device/Device.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface DeviceEvents {
|
|
|
22
22
|
[DEVICE.PASSPHRASE_ON_DEVICE]: () => void;
|
|
23
23
|
[DEVICE.BUTTON]: (device: Device, payload: DeviceButtonRequestPayload) => void;
|
|
24
24
|
[DEVICE.ACQUIRED]: () => void;
|
|
25
|
+
[DEVICE.SAVE_STATE]: (state: string) => void;
|
|
25
26
|
}
|
|
26
27
|
export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
27
28
|
transport: Transport;
|
|
@@ -79,7 +80,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
79
80
|
isInitialized(): boolean;
|
|
80
81
|
isSeedless(): boolean;
|
|
81
82
|
isInconsistent(): boolean;
|
|
82
|
-
getVersion(): [number, number, number]
|
|
83
|
+
getVersion(): never[] | [number, number, number];
|
|
83
84
|
atLeast(versions: string[] | string): boolean;
|
|
84
85
|
isUsed(): boolean;
|
|
85
86
|
isUsedHere(): boolean;
|
|
@@ -90,7 +91,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
90
91
|
getDevicePath(): string;
|
|
91
92
|
isT1(): boolean;
|
|
92
93
|
hasUnexpectedMode(allow: string[], require: string[]): "ui-device_bootloader_mode" | "ui-device_not_in_bootloader_mode" | "ui-device_not_initialized" | "ui-device_seedless" | null;
|
|
93
|
-
dispose(): import("@trezor/transport/lib/types").AbortableCall<void, "
|
|
94
|
+
dispose(): import("@trezor/transport/lib/types").AbortableCall<void, "Network request failed" | "Wrong result type." | "device disconnected during action" | "unexpected error" | "Aborted by timeout" | "Aborted by signal" | "This transport can not be used in this environment" | "device not found" | "Unable to open device" | "wrong previous session" | "session not found"> | undefined;
|
|
94
95
|
getMode(): "normal" | "bootloader" | "initialize" | "seedless";
|
|
95
96
|
toMessageObject(): DeviceTyped;
|
|
96
97
|
legacyForceRelease(): Promise<void>;
|
package/lib/device/Device.js
CHANGED
|
@@ -242,8 +242,9 @@ class Device extends utils_1.TypedEmitter {
|
|
|
242
242
|
if (typeof state !== 'string') {
|
|
243
243
|
delete this.internalState[this.instance];
|
|
244
244
|
}
|
|
245
|
-
else {
|
|
245
|
+
else if (state !== this.internalState[this.instance]) {
|
|
246
246
|
this.internalState[this.instance] = state;
|
|
247
|
+
this.emit(events_1.DEVICE.SAVE_STATE, state);
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
getInternalState() {
|
|
@@ -31,8 +31,8 @@ export declare class DeviceCommands {
|
|
|
31
31
|
isDisposed(): boolean;
|
|
32
32
|
unlockPath(params?: Messages.UnlockPath): Promise<TypedResponseMessage<"UnlockedPathRequest">>;
|
|
33
33
|
getPublicKey(params: Messages.GetPublicKey, unlockPath?: Messages.UnlockPath): Promise<{
|
|
34
|
-
root_fingerprint?: number | undefined;
|
|
35
34
|
descriptor?: string | undefined;
|
|
35
|
+
root_fingerprint?: number | undefined;
|
|
36
36
|
node: {
|
|
37
37
|
private_key?: string | undefined;
|
|
38
38
|
public_key: string;
|
|
@@ -51,25 +51,25 @@ export declare class DeviceCommands {
|
|
|
51
51
|
xpubSegwit?: string | undefined;
|
|
52
52
|
descriptorChecksum?: string | undefined;
|
|
53
53
|
path: number[];
|
|
54
|
-
depth: number;
|
|
55
|
-
fingerprint: number;
|
|
56
|
-
xpub: string;
|
|
57
54
|
publicKey: string;
|
|
58
55
|
serializedPath: string;
|
|
56
|
+
depth: number;
|
|
57
|
+
fingerprint: number;
|
|
59
58
|
chainCode: string;
|
|
60
59
|
childNum: number;
|
|
60
|
+
xpub: string;
|
|
61
61
|
}>;
|
|
62
62
|
getBitcoinHDNode(path: number[], coinInfo?: BitcoinNetworkInfo, validation?: boolean): Promise<{
|
|
63
63
|
xpubSegwit?: string | undefined;
|
|
64
64
|
descriptorChecksum?: string | undefined;
|
|
65
65
|
path: number[];
|
|
66
|
-
depth: number;
|
|
67
|
-
fingerprint: number;
|
|
68
|
-
xpub: string;
|
|
69
66
|
publicKey: string;
|
|
70
67
|
serializedPath: string;
|
|
68
|
+
depth: number;
|
|
69
|
+
fingerprint: number;
|
|
71
70
|
chainCode: string;
|
|
72
71
|
childNum: number;
|
|
72
|
+
xpub: string;
|
|
73
73
|
}>;
|
|
74
74
|
getAddress({ address_n, show_display, multisig, script_type, chunkify }: Messages.GetAddress, coinInfo: BitcoinNetworkInfo): Promise<{
|
|
75
75
|
path: number[];
|
|
@@ -4,23 +4,28 @@ exports.resolveDescriptorForTaproot = void 0;
|
|
|
4
4
|
const resolveDescriptorForTaproot = ({ response, publicKey }) => {
|
|
5
5
|
if (publicKey.descriptor !== null && publicKey.descriptor !== undefined) {
|
|
6
6
|
const [xpub, checksum] = publicKey.descriptor.split('#');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
xpub: `tr([${descriptorPath}]${response.xpub}/<0;1>/*)`,
|
|
21
|
-
checksum: undefined,
|
|
22
|
-
};
|
|
7
|
+
const openingSquareBracketSplit = xpub.split('[');
|
|
8
|
+
if (openingSquareBracketSplit.length === 2) {
|
|
9
|
+
const [beforeOpeningBracket, afterOpeningBracket] = openingSquareBracketSplit;
|
|
10
|
+
const closingSquareBracketSplit = afterOpeningBracket.split(']');
|
|
11
|
+
if (closingSquareBracketSplit.length === 2) {
|
|
12
|
+
const [path, afterClosingBracket] = closingSquareBracketSplit;
|
|
13
|
+
const correctedPath = path.replace(/h/g, "'");
|
|
14
|
+
return {
|
|
15
|
+
xpub: `${beforeOpeningBracket}[${correctedPath}]${afterClosingBracket}`,
|
|
16
|
+
checksum,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
23
20
|
}
|
|
21
|
+
const fingerprint = Number(publicKey.root_fingerprint || 0)
|
|
22
|
+
.toString(16)
|
|
23
|
+
.padStart(8, '0');
|
|
24
|
+
const descriptorPath = `${fingerprint}${response.serializedPath.substring(1)}`;
|
|
25
|
+
return {
|
|
26
|
+
xpub: `tr([${descriptorPath}]${response.xpub}/<0;1>/*)`,
|
|
27
|
+
checksum: undefined,
|
|
28
|
+
};
|
|
24
29
|
};
|
|
25
30
|
exports.resolveDescriptorForTaproot = resolveDescriptorForTaproot;
|
|
26
31
|
//# sourceMappingURL=resolveDescriptorForTaproot.js.map
|
package/lib/events/device.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const DEVICE: {
|
|
|
12
12
|
readonly ACQUIRED: "device-acquired";
|
|
13
13
|
readonly RELEASED: "device-released";
|
|
14
14
|
readonly USED_ELSEWHERE: "device-used_elsewhere";
|
|
15
|
+
readonly SAVE_STATE: "device-save_state";
|
|
15
16
|
readonly LOADING: "device-loading";
|
|
16
17
|
readonly BUTTON: "button";
|
|
17
18
|
readonly PIN: "pin";
|
package/lib/events/device.js
CHANGED
|
@@ -3,18 +3,18 @@ import { PROTO } from '../../constants';
|
|
|
3
3
|
import type { Params, Response } from '../params';
|
|
4
4
|
export type ApplySettings = Static<typeof ApplySettings>;
|
|
5
5
|
export declare const ApplySettings: import("@sinclair/typebox").TObject<{
|
|
6
|
+
passphrase_source: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
6
7
|
language: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
7
8
|
label: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
use_passphrase: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
10
|
+
homescreen: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
11
|
+
_passphrase_source: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
10
12
|
auto_lock_delay_ms: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
11
13
|
display_rotation: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
14
|
+
passphrase_always_on_device: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
15
|
+
safety_checks: import("@sinclair/typebox").TOptional<import("@trezor/schema-utils/lib/custom-types/keyof-enum").TKeyOfEnum<typeof PROTO.Enum_SafetyCheckLevel>>;
|
|
12
16
|
experimental_features: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
13
17
|
hide_passphrase_from_host: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
14
|
-
use_passphrase: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
15
|
-
homescreen: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
16
|
-
_passphrase_source: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
17
|
-
passphrase_source: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
18
18
|
}>;
|
|
19
19
|
export declare function applySettings(params: Params<ApplySettings>): Response<PROTO.Success>;
|
|
20
20
|
//# sourceMappingURL=applySettings.d.ts.map
|
|
@@ -3,9 +3,13 @@ import { PROTO } from '../../constants';
|
|
|
3
3
|
import { Address as AddressShared, Params, BundledParams, Response } from '../params';
|
|
4
4
|
export type GetAddress = Static<typeof GetAddress>;
|
|
5
5
|
export declare const GetAddress: import("@sinclair/typebox").TObject<{
|
|
6
|
+
coin: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
6
7
|
path: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>;
|
|
7
|
-
chunkify: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
8
8
|
address: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
9
|
+
showOnTrezor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
10
|
+
chunkify: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
11
|
+
useEventListener: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
12
|
+
scriptType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"SPENDADDRESS">, import("@sinclair/typebox").TLiteral<"SPENDMULTISIG">, import("@sinclair/typebox").TLiteral<"SPENDWITNESS">, import("@sinclair/typebox").TLiteral<"SPENDP2SHWITNESS">, import("@sinclair/typebox").TLiteral<"SPENDTAPROOT">]>>;
|
|
9
13
|
multisig: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
10
14
|
pubkeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
11
15
|
node: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
@@ -30,10 +34,6 @@ export declare const GetAddress: import("@sinclair/typebox").TObject<{
|
|
|
30
34
|
}>>>;
|
|
31
35
|
address_n: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>>;
|
|
32
36
|
}>>;
|
|
33
|
-
coin: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
34
|
-
showOnTrezor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
35
|
-
useEventListener: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
36
|
-
scriptType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"SPENDADDRESS">, import("@sinclair/typebox").TLiteral<"SPENDMULTISIG">, import("@sinclair/typebox").TLiteral<"SPENDWITNESS">, import("@sinclair/typebox").TLiteral<"SPENDP2SHWITNESS">, import("@sinclair/typebox").TLiteral<"SPENDTAPROOT">]>>;
|
|
37
37
|
crossChain: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
38
38
|
unlockPath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
39
39
|
address_n: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>;
|
|
@@ -7,7 +7,10 @@ const schema_utils_1 = require("@trezor/schema-utils");
|
|
|
7
7
|
exports.GetPublicKey = schema_utils_1.Type.Intersect([
|
|
8
8
|
params_1.GetPublicKey,
|
|
9
9
|
schema_utils_1.Type.Object({
|
|
10
|
-
coin: schema_utils_1.Type.Optional(schema_utils_1.Type.String(
|
|
10
|
+
coin: schema_utils_1.Type.Optional(schema_utils_1.Type.String({
|
|
11
|
+
description: 'determines network definition specified in coins.json file. Coin shortcut, name or label can be used. If coin is not set API will try to get network definition from path.',
|
|
12
|
+
default: 'btc',
|
|
13
|
+
})),
|
|
11
14
|
crossChain: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
12
15
|
scriptType: schema_utils_1.Type.Optional(constants_1.PROTO.InternalInputScriptType),
|
|
13
16
|
ignoreXpubMagic: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
@@ -8,9 +8,9 @@ export declare const RecoveryDevice: import("@sinclair/typebox").TObject<{
|
|
|
8
8
|
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof PROTO.RecoveryDeviceType>>;
|
|
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
|
-
u2f_counter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
12
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>]>]>>;
|
|
13
12
|
enforce_wordlist: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
13
|
+
u2f_counter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
14
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>;
|
package/lib/types/params.js
CHANGED
|
@@ -4,11 +4,15 @@ exports.PublicKey = exports.GetPublicKey = exports.GetAddress = exports.Derivati
|
|
|
4
4
|
const schema_utils_1 = require("@trezor/schema-utils");
|
|
5
5
|
const Bundle = (type) => schema_utils_1.Type.Object({ bundle: schema_utils_1.Type.Array(type, { minItems: 1 }) });
|
|
6
6
|
exports.Bundle = Bundle;
|
|
7
|
-
exports.DerivationPath = schema_utils_1.Type.Union([schema_utils_1.Type.String(), schema_utils_1.Type.Array(schema_utils_1.Type.Number())]
|
|
7
|
+
exports.DerivationPath = schema_utils_1.Type.Union([schema_utils_1.Type.String(), schema_utils_1.Type.Array(schema_utils_1.Type.Number())], {
|
|
8
|
+
description: 'Derivation Path. minimum length is `1`',
|
|
9
|
+
default: `m/49'/0'/0'`,
|
|
10
|
+
$id: 'DerivationPath',
|
|
11
|
+
});
|
|
8
12
|
exports.GetAddress = schema_utils_1.Type.Object({
|
|
9
13
|
path: exports.DerivationPath,
|
|
10
14
|
address: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
11
|
-
showOnTrezor: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
15
|
+
showOnTrezor: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean({ default: true })),
|
|
12
16
|
chunkify: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
13
17
|
useEventListener: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
14
18
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const httpRequest: (url: string, _type: string) => any;
|
|
2
|
-
//# sourceMappingURL=assets
|
|
2
|
+
//# sourceMappingURL=assets.native.d.ts.map
|
|
@@ -4,4 +4,4 @@ exports.httpRequest = void 0;
|
|
|
4
4
|
const assetUtils_1 = require("./assetUtils");
|
|
5
5
|
const httpRequest = (url, _type) => (0, assetUtils_1.getAssetByUrl)(url);
|
|
6
6
|
exports.httpRequest = httpRequest;
|
|
7
|
-
//# sourceMappingURL=assets
|
|
7
|
+
//# sourceMappingURL=assets.native.js.map
|
package/lib/utils/debug.d.ts
CHANGED
|
@@ -1,33 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
message: any[];
|
|
5
|
-
timestamp: number;
|
|
6
|
-
};
|
|
7
|
-
export type LogWriter = {
|
|
8
|
-
add: (message: LogMessage) => void;
|
|
9
|
-
};
|
|
10
|
-
export declare class Log {
|
|
11
|
-
prefix: string;
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
css: string;
|
|
14
|
-
messages: LogMessage[];
|
|
15
|
-
logWriter: LogWriter | undefined;
|
|
16
|
-
constructor(prefix: string, enabled: boolean, logWriter?: LogWriter);
|
|
17
|
-
addMessage({ level, prefix, timestamp }: {
|
|
18
|
-
level: string;
|
|
19
|
-
prefix: string;
|
|
20
|
-
timestamp?: number;
|
|
21
|
-
}, ...args: any[]): void;
|
|
22
|
-
setWriter(logWriter: any): void;
|
|
23
|
-
log(...args: any[]): void;
|
|
24
|
-
error(...args: any[]): void;
|
|
25
|
-
warn(...args: any[]): void;
|
|
26
|
-
debug(...args: any[]): void;
|
|
27
|
-
}
|
|
28
|
-
export declare const initLog: (prefix: string, enabled?: boolean, logWriter?: LogWriter) => Log;
|
|
29
|
-
export declare const setLogWriter: (logWriterFactory: () => LogWriter | undefined) => void;
|
|
30
|
-
export declare const enableLog: (enabled?: boolean) => void;
|
|
1
|
+
export declare const initLog: (prefix: string, enabled?: boolean | undefined, logWriter?: import("@trezor/utils").LogWriter | undefined) => import("@trezor/utils").Log;
|
|
2
|
+
export declare const setLogWriter: (logWriterFactory: () => import("@trezor/utils").LogWriter | undefined) => void;
|
|
3
|
+
export declare const enableLog: (enabled?: boolean | undefined) => void;
|
|
31
4
|
export declare const enableLogByPrefix: (prefix: string, enabled: boolean) => void;
|
|
32
|
-
export declare const getLog: () => LogMessage[];
|
|
5
|
+
export declare const getLog: () => import("@trezor/utils").LogMessage[];
|
|
6
|
+
export type { LogMessage, LogWriter, Log } from '@trezor/utils';
|
|
33
7
|
//# sourceMappingURL=debug.d.ts.map
|
package/lib/utils/debug.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLog = exports.enableLogByPrefix = exports.enableLog = exports.setLogWriter = exports.initLog =
|
|
3
|
+
exports.getLog = exports.enableLogByPrefix = exports.enableLog = exports.setLogWriter = exports.initLog = void 0;
|
|
4
|
+
const utils_1 = require("@trezor/utils");
|
|
4
5
|
const green = '#bada55';
|
|
5
6
|
const blue = '#20abd8';
|
|
6
7
|
const orange = '#f4a744';
|
|
@@ -18,113 +19,10 @@ const colors = {
|
|
|
18
19
|
InteractionTimeout: `color: ${green}; background: #000;`,
|
|
19
20
|
'@trezor/connect-popup': `color: ${yellow}; background: #000;`,
|
|
20
21
|
};
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.css = typeof window !== 'undefined' && colors[prefix] ? colors[prefix] : '';
|
|
28
|
-
if (logWriter) {
|
|
29
|
-
this.logWriter = logWriter;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
addMessage({ level, prefix, timestamp }, ...args) {
|
|
33
|
-
const message = {
|
|
34
|
-
level,
|
|
35
|
-
prefix,
|
|
36
|
-
css: this.css,
|
|
37
|
-
message: args,
|
|
38
|
-
timestamp: timestamp || Date.now(),
|
|
39
|
-
};
|
|
40
|
-
this.messages.push(message);
|
|
41
|
-
if (this.logWriter) {
|
|
42
|
-
try {
|
|
43
|
-
this.logWriter.add(message);
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
console.error('There was an error adding log message', err, message);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (this.messages.length > MAX_ENTRIES) {
|
|
50
|
-
this.messages.shift();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
setWriter(logWriter) {
|
|
54
|
-
this.logWriter = logWriter;
|
|
55
|
-
}
|
|
56
|
-
log(...args) {
|
|
57
|
-
this.addMessage({ level: 'log', prefix: this.prefix }, ...args);
|
|
58
|
-
if (this.enabled) {
|
|
59
|
-
console.log(`%c${this.prefix}`, this.css, ...args);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
error(...args) {
|
|
63
|
-
this.addMessage({ level: 'error', prefix: this.prefix }, ...args);
|
|
64
|
-
if (this.enabled) {
|
|
65
|
-
console.error(`%c${this.prefix}`, this.css, ...args);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
warn(...args) {
|
|
69
|
-
this.addMessage({ level: 'warn', prefix: this.prefix }, ...args);
|
|
70
|
-
if (this.enabled) {
|
|
71
|
-
console.warn(`%c${this.prefix}`, this.css, ...args);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
debug(...args) {
|
|
75
|
-
this.addMessage({ level: 'debug', prefix: this.prefix }, ...args);
|
|
76
|
-
if (this.enabled) {
|
|
77
|
-
if (this.css) {
|
|
78
|
-
console.log(`%c${this.prefix}`, this.css, ...args);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
console.log(this.prefix, ...args);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.Log = Log;
|
|
87
|
-
const _logs = {};
|
|
88
|
-
let writer;
|
|
89
|
-
const initLog = (prefix, enabled, logWriter) => {
|
|
90
|
-
const instanceWriter = logWriter || writer;
|
|
91
|
-
const instance = new Log(prefix, !!enabled, instanceWriter);
|
|
92
|
-
_logs[prefix] = instance;
|
|
93
|
-
return instance;
|
|
94
|
-
};
|
|
95
|
-
exports.initLog = initLog;
|
|
96
|
-
const setLogWriter = (logWriterFactory) => {
|
|
97
|
-
Object.keys(_logs).forEach(key => {
|
|
98
|
-
writer = logWriterFactory();
|
|
99
|
-
if (writer) {
|
|
100
|
-
_logs[key].setWriter(writer);
|
|
101
|
-
const { messages } = _logs[key];
|
|
102
|
-
messages.forEach(message => {
|
|
103
|
-
writer === null || writer === void 0 ? void 0 : writer.add(message);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
exports.setLogWriter = setLogWriter;
|
|
109
|
-
const enableLog = (enabled) => {
|
|
110
|
-
Object.keys(_logs).forEach(key => {
|
|
111
|
-
_logs[key].enabled = !!enabled;
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
exports.enableLog = enableLog;
|
|
115
|
-
const enableLogByPrefix = (prefix, enabled) => {
|
|
116
|
-
if (_logs[prefix]) {
|
|
117
|
-
_logs[prefix].enabled = enabled;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
exports.enableLogByPrefix = enableLogByPrefix;
|
|
121
|
-
const getLog = () => {
|
|
122
|
-
let logs = [];
|
|
123
|
-
Object.keys(_logs).forEach(key => {
|
|
124
|
-
logs = logs.concat(_logs[key].messages);
|
|
125
|
-
});
|
|
126
|
-
logs.sort((a, b) => a.timestamp - b.timestamp);
|
|
127
|
-
return logs;
|
|
128
|
-
};
|
|
129
|
-
exports.getLog = getLog;
|
|
22
|
+
const logsManager = new utils_1.LogsManager({ colors });
|
|
23
|
+
exports.initLog = logsManager.initLog.bind(logsManager);
|
|
24
|
+
exports.setLogWriter = logsManager.setLogWriter.bind(logsManager);
|
|
25
|
+
exports.enableLog = logsManager.enableLog.bind(logsManager);
|
|
26
|
+
exports.enableLogByPrefix = logsManager.enableLogByPrefix.bind(logsManager);
|
|
27
|
+
exports.getLog = logsManager.getLog.bind(logsManager);
|
|
130
28
|
//# sourceMappingURL=debug.js.map
|
|
@@ -87,8 +87,8 @@ export declare const convertMultisigPubKey: <T extends ({
|
|
|
87
87
|
prev_index: number;
|
|
88
88
|
} & {
|
|
89
89
|
address_n?: undefined;
|
|
90
|
-
script_type: "EXTERNAL";
|
|
91
90
|
script_pubkey: string;
|
|
91
|
+
script_type: "EXTERNAL";
|
|
92
92
|
}) | {
|
|
93
93
|
address_n?: undefined;
|
|
94
94
|
multisig?: {
|
|
@@ -123,7 +123,6 @@ export declare const convertMultisigPubKey: <T extends ({
|
|
|
123
123
|
script_type: "PAYTOADDRESS";
|
|
124
124
|
} | {
|
|
125
125
|
address?: undefined;
|
|
126
|
-
script_type?: "PAYTOADDRESS" | "PAYTOSCRIPTHASH" | "PAYTOMULTISIG" | "PAYTOWITNESS" | "PAYTOP2SHWITNESS" | "PAYTOTAPROOT" | undefined;
|
|
127
126
|
multisig?: {
|
|
128
127
|
address_n?: number[] | undefined;
|
|
129
128
|
nodes?: {
|
|
@@ -150,12 +149,12 @@ export declare const convertMultisigPubKey: <T extends ({
|
|
|
150
149
|
} | undefined;
|
|
151
150
|
orig_hash?: string | undefined;
|
|
152
151
|
orig_index?: number | undefined;
|
|
152
|
+
script_type?: "PAYTOADDRESS" | "PAYTOSCRIPTHASH" | "PAYTOMULTISIG" | "PAYTOWITNESS" | "PAYTOP2SHWITNESS" | "PAYTOTAPROOT" | undefined;
|
|
153
153
|
payment_req_index?: number | undefined;
|
|
154
154
|
address_n: number[];
|
|
155
155
|
amount: string | number;
|
|
156
156
|
} | {
|
|
157
157
|
address_n?: undefined;
|
|
158
|
-
script_type?: "PAYTOADDRESS" | "PAYTOSCRIPTHASH" | "PAYTOMULTISIG" | "PAYTOWITNESS" | "PAYTOP2SHWITNESS" | "PAYTOTAPROOT" | undefined;
|
|
159
158
|
multisig?: {
|
|
160
159
|
address_n?: number[] | undefined;
|
|
161
160
|
nodes?: {
|
|
@@ -182,6 +181,7 @@ export declare const convertMultisigPubKey: <T extends ({
|
|
|
182
181
|
} | undefined;
|
|
183
182
|
orig_hash?: string | undefined;
|
|
184
183
|
orig_index?: number | undefined;
|
|
184
|
+
script_type?: "PAYTOADDRESS" | "PAYTOSCRIPTHASH" | "PAYTOMULTISIG" | "PAYTOWITNESS" | "PAYTOP2SHWITNESS" | "PAYTOTAPROOT" | undefined;
|
|
185
185
|
payment_req_index?: number | undefined;
|
|
186
186
|
address: string;
|
|
187
187
|
amount: string | number;
|
package/lib/utils/pathUtils.d.ts
CHANGED
|
@@ -98,8 +98,8 @@ export declare const fixPath: <T extends ProtoWithDerivationPath<({
|
|
|
98
98
|
prev_index: number;
|
|
99
99
|
} & {
|
|
100
100
|
address_n?: undefined;
|
|
101
|
-
script_type: "EXTERNAL";
|
|
102
101
|
script_pubkey: string;
|
|
102
|
+
script_type: "EXTERNAL";
|
|
103
103
|
})> | ProtoWithDerivationPath<{
|
|
104
104
|
address_n?: undefined;
|
|
105
105
|
multisig?: {
|
|
@@ -134,7 +134,6 @@ export declare const fixPath: <T extends ProtoWithDerivationPath<({
|
|
|
134
134
|
script_type: "PAYTOADDRESS";
|
|
135
135
|
} | {
|
|
136
136
|
address?: undefined;
|
|
137
|
-
script_type?: "PAYTOADDRESS" | "PAYTOSCRIPTHASH" | "PAYTOMULTISIG" | "PAYTOWITNESS" | "PAYTOP2SHWITNESS" | "PAYTOTAPROOT" | undefined;
|
|
138
137
|
multisig?: {
|
|
139
138
|
address_n?: number[] | undefined;
|
|
140
139
|
nodes?: {
|
|
@@ -161,12 +160,12 @@ export declare const fixPath: <T extends ProtoWithDerivationPath<({
|
|
|
161
160
|
} | undefined;
|
|
162
161
|
orig_hash?: string | undefined;
|
|
163
162
|
orig_index?: number | undefined;
|
|
163
|
+
script_type?: "PAYTOADDRESS" | "PAYTOSCRIPTHASH" | "PAYTOMULTISIG" | "PAYTOWITNESS" | "PAYTOP2SHWITNESS" | "PAYTOTAPROOT" | undefined;
|
|
164
164
|
payment_req_index?: number | undefined;
|
|
165
165
|
address_n: number[];
|
|
166
166
|
amount: string | number;
|
|
167
167
|
} | {
|
|
168
168
|
address_n?: undefined;
|
|
169
|
-
script_type?: "PAYTOADDRESS" | "PAYTOSCRIPTHASH" | "PAYTOMULTISIG" | "PAYTOWITNESS" | "PAYTOP2SHWITNESS" | "PAYTOTAPROOT" | undefined;
|
|
170
169
|
multisig?: {
|
|
171
170
|
address_n?: number[] | undefined;
|
|
172
171
|
nodes?: {
|
|
@@ -193,6 +192,7 @@ export declare const fixPath: <T extends ProtoWithDerivationPath<({
|
|
|
193
192
|
} | undefined;
|
|
194
193
|
orig_hash?: string | undefined;
|
|
195
194
|
orig_index?: number | undefined;
|
|
195
|
+
script_type?: "PAYTOADDRESS" | "PAYTOSCRIPTHASH" | "PAYTOMULTISIG" | "PAYTOWITNESS" | "PAYTOP2SHWITNESS" | "PAYTOTAPROOT" | undefined;
|
|
196
196
|
payment_req_index?: number | undefined;
|
|
197
197
|
address: string;
|
|
198
198
|
amount: string | number;
|
|
@@ -4,4 +4,4 @@ import BlockfrostWorker from '@trezor/blockchain-link/lib/workers/blockfrost';
|
|
|
4
4
|
import SolanaWorker from '@trezor/blockchain-link/lib/workers/solana';
|
|
5
5
|
declare const ElectrumWorker: undefined;
|
|
6
6
|
export { BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker, SolanaWorker };
|
|
7
|
-
//# sourceMappingURL=workers
|
|
7
|
+
//# sourceMappingURL=workers.native.d.ts.map
|
|
@@ -12,4 +12,4 @@ const solana_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/wo
|
|
|
12
12
|
exports.SolanaWorker = solana_1.default;
|
|
13
13
|
const ElectrumWorker = undefined;
|
|
14
14
|
exports.ElectrumWorker = ElectrumWorker;
|
|
15
|
-
//# sourceMappingURL=workers
|
|
15
|
+
//# sourceMappingURL=workers.native.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trezor/connect",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.2",
|
|
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.",
|
|
@@ -19,16 +19,33 @@
|
|
|
19
19
|
"javascript"
|
|
20
20
|
],
|
|
21
21
|
"sideEffects": false,
|
|
22
|
-
"main": "lib/index",
|
|
22
|
+
"main": "lib/index.js",
|
|
23
23
|
"browser": {
|
|
24
|
-
"./lib/index": "./lib/index-browser",
|
|
25
|
-
"./lib/
|
|
26
|
-
"./lib/
|
|
24
|
+
"./lib/index.js": "./lib/index-browser.js",
|
|
25
|
+
"./lib/index": "./lib/index-browser.js",
|
|
26
|
+
"./lib/utils/assets": "./lib/utils/assets-browser.js",
|
|
27
|
+
"./lib/workers/workers": "./lib/workers/workers-browser.js"
|
|
27
28
|
},
|
|
28
29
|
"react-native": {
|
|
29
|
-
"./
|
|
30
|
-
"./
|
|
31
|
-
"./
|
|
30
|
+
"./src/index": "./src/index.ts",
|
|
31
|
+
"./src/index.ts": "./src/index.ts",
|
|
32
|
+
"./src/utils/assets": "./src/utils/assets.native.ts",
|
|
33
|
+
"./src/workers/workers": "./src/workers/workers.native.ts"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"main": "lib/index.js",
|
|
37
|
+
"browser": {
|
|
38
|
+
"./lib/index.js": "./lib/index-browser.js",
|
|
39
|
+
"./lib/index": "./lib/index-browser.js",
|
|
40
|
+
"./lib/utils/assets": "./lib/utils/assets-browser.js",
|
|
41
|
+
"./lib/workers/workers": "./lib/workers/workers-browser.js"
|
|
42
|
+
},
|
|
43
|
+
"react-native": {
|
|
44
|
+
"./lib/index": "./lib/index.js",
|
|
45
|
+
"./lib/index.ts": "./lib/index.js",
|
|
46
|
+
"./lib/utils/assets": "./lib/utils/assets.native.js",
|
|
47
|
+
"./lib/workers/workers": "./lib/workers/workers.native.js"
|
|
48
|
+
}
|
|
32
49
|
},
|
|
33
50
|
"files": [
|
|
34
51
|
"lib/",
|
|
@@ -38,7 +55,7 @@
|
|
|
38
55
|
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
|
|
39
56
|
"test:unit": "jest --version && jest",
|
|
40
57
|
"type-check": "yarn g:tsc --build",
|
|
41
|
-
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json",
|
|
58
|
+
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",
|
|
42
59
|
"version:beta": "yarn g:tsx scripts/bump-version.ts prerelease",
|
|
43
60
|
"version:patch": "yarn g:tsx scripts/bump-version.ts patch",
|
|
44
61
|
"version:minor": "yarn g:tsx scripts/bump-version.ts minor",
|
|
@@ -49,19 +66,20 @@
|
|
|
49
66
|
"prepublish": "yarn tsx ../../scripts/prepublish.js"
|
|
50
67
|
},
|
|
51
68
|
"dependencies": {
|
|
69
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
52
70
|
"@ethereumjs/common": "^4.2.0",
|
|
53
71
|
"@ethereumjs/tx": "^5.2.1",
|
|
54
72
|
"@fivebinaries/coin-selection": "2.2.1",
|
|
55
|
-
"@trezor/blockchain-link": "2.1.
|
|
56
|
-
"@trezor/blockchain-link-types": "1.0.
|
|
57
|
-
"@trezor/connect-analytics": "1.0.
|
|
58
|
-
"@trezor/connect-common": "0.0.
|
|
59
|
-
"@trezor/protobuf": "1.0.
|
|
60
|
-
"@trezor/protocol": "1.0.
|
|
61
|
-
"@trezor/schema-utils": "1.0.
|
|
62
|
-
"@trezor/transport": "1.1.
|
|
63
|
-
"@trezor/utils": "9.0.
|
|
64
|
-
"@trezor/utxo-lib": "2.0.
|
|
73
|
+
"@trezor/blockchain-link": "2.1.28",
|
|
74
|
+
"@trezor/blockchain-link-types": "1.0.15",
|
|
75
|
+
"@trezor/connect-analytics": "1.0.14",
|
|
76
|
+
"@trezor/connect-common": "0.0.31",
|
|
77
|
+
"@trezor/protobuf": "1.0.11",
|
|
78
|
+
"@trezor/protocol": "1.0.7",
|
|
79
|
+
"@trezor/schema-utils": "1.0.3",
|
|
80
|
+
"@trezor/transport": "1.1.27",
|
|
81
|
+
"@trezor/utils": "9.0.23",
|
|
82
|
+
"@trezor/utxo-lib": "2.0.8",
|
|
65
83
|
"bignumber.js": "^9.1.2",
|
|
66
84
|
"blakejs": "^1.2.1",
|
|
67
85
|
"bs58": "^5.0.0",
|
|
@@ -73,6 +91,7 @@
|
|
|
73
91
|
"@trezor/trezor-user-env-link": "1.0.2",
|
|
74
92
|
"@types/karma": "^6.3.8",
|
|
75
93
|
"@types/parse-uri": "^1.0.2",
|
|
94
|
+
"babel-loader": "^9.1.3",
|
|
76
95
|
"ethereum-cryptography": "^2.1.3",
|
|
77
96
|
"jest": "29.7.0",
|
|
78
97
|
"karma": "^6.4.2",
|
|
@@ -82,6 +101,7 @@
|
|
|
82
101
|
"karma-jasmine-async": "^0.0.1",
|
|
83
102
|
"karma-sourcemap-loader": "^0.4.0",
|
|
84
103
|
"karma-webpack": "^5.0.1",
|
|
104
|
+
"node-libs-browser": "^2.2.1",
|
|
85
105
|
"ts-node": "^10.9.1",
|
|
86
106
|
"tsx": "^4.7.0",
|
|
87
107
|
"webpack": "^5.90.1",
|