@trezor/connect 9.1.1 → 9.1.3
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 +17 -3
- package/README.md +2 -2
- package/lib/api/backupDevice.d.ts +1 -1
- package/lib/api/binanceGetAddress.d.ts +1 -0
- package/lib/api/binanceGetAddress.js +4 -4
- package/lib/api/binanceGetPublicKey.d.ts +1 -0
- package/lib/api/binanceGetPublicKey.js +3 -1
- package/lib/api/binanceSignTransaction.d.ts +2 -1
- package/lib/api/binanceSignTransaction.js +3 -1
- package/lib/api/bitcoin/Fees.d.ts +2 -2
- package/lib/api/bitcoin/Fees.js +32 -90
- package/lib/api/bitcoin/TransactionComposer.d.ts +1 -2
- package/lib/api/bitcoin/TransactionComposer.js +3 -2
- package/lib/api/bitcoin/refTx.d.ts +10 -2
- package/lib/api/bitcoin/refTx.js +46 -19
- package/lib/api/blockchainDisconnect.d.ts +1 -0
- package/lib/api/blockchainDisconnect.js +3 -1
- package/lib/api/blockchainEstimateFee.js +1 -1
- package/lib/api/blockchainSetCustomBackend.d.ts +1 -0
- package/lib/api/blockchainSetCustomBackend.js +3 -1
- package/lib/api/cancelCoinjoinAuthorization.d.ts +1 -0
- package/lib/api/cancelCoinjoinAuthorization.js +3 -1
- package/lib/api/cardanoGetAddress.d.ts +1 -0
- package/lib/api/cardanoGetAddress.js +4 -4
- package/lib/api/cardanoGetNativeScriptHash.d.ts +1 -0
- package/lib/api/cardanoGetNativeScriptHash.js +3 -1
- package/lib/api/cardanoGetPublicKey.d.ts +1 -0
- package/lib/api/cardanoGetPublicKey.js +4 -2
- package/lib/api/cardanoSignTransaction.d.ts +1 -0
- package/lib/api/cardanoSignTransaction.js +3 -1
- package/lib/api/checkFirmwareAuthenticity.js +2 -1
- package/lib/api/cipherKeyValue.d.ts +1 -0
- package/lib/api/cipherKeyValue.js +3 -1
- package/lib/api/composeTransaction.d.ts +3 -0
- package/lib/api/composeTransaction.js +9 -7
- package/lib/api/eosGetPublicKey.d.ts +1 -0
- package/lib/api/eosGetPublicKey.js +3 -1
- package/lib/api/eosSignTransaction.d.ts +1 -0
- package/lib/api/eosSignTransaction.js +3 -1
- package/lib/api/ethereum/ethereumDefinitions.d.ts +28 -6
- package/lib/api/ethereum/ethereumDefinitions.js +60 -1
- package/lib/api/ethereum/ethereumSignTx.d.ts +1 -1
- package/lib/api/ethereumGetAddress.d.ts +2 -0
- package/lib/api/ethereumGetAddress.js +28 -26
- package/lib/api/ethereumGetPublicKey.d.ts +1 -0
- package/lib/api/ethereumGetPublicKey.js +8 -10
- package/lib/api/ethereumSignMessage.d.ts +10 -1
- package/lib/api/ethereumSignMessage.js +14 -13
- package/lib/api/ethereumSignTransaction.d.ts +6 -0
- package/lib/api/ethereumSignTransaction.js +18 -5
- package/lib/api/ethereumSignTypedData.d.ts +6 -0
- package/lib/api/ethereumSignTypedData.js +15 -13
- package/lib/api/ethereumVerifyMessage.d.ts +1 -0
- package/lib/api/ethereumVerifyMessage.js +3 -1
- package/lib/api/getAccountInfo.d.ts +1 -0
- package/lib/api/getAccountInfo.js +3 -1
- package/lib/api/getAddress.d.ts +1 -0
- package/lib/api/getAddress.js +8 -10
- package/lib/api/getFeatures.d.ts +1 -1
- package/lib/api/getOwnershipId.d.ts +1 -0
- package/lib/api/getOwnershipId.js +3 -1
- package/lib/api/getOwnershipProof.d.ts +1 -0
- package/lib/api/getOwnershipProof.js +3 -1
- package/lib/api/getPublicKey.d.ts +1 -0
- package/lib/api/getPublicKey.js +4 -2
- package/lib/api/nemGetAddress.d.ts +1 -0
- package/lib/api/nemGetAddress.js +4 -4
- package/lib/api/nemSignTransaction.d.ts +1 -0
- package/lib/api/nemSignTransaction.js +3 -1
- package/lib/api/rebootToBootloader.d.ts +2 -1
- package/lib/api/rebootToBootloader.js +3 -1
- package/lib/api/requestLogin.d.ts +1 -0
- package/lib/api/requestLogin.js +3 -1
- package/lib/api/resetDevice.d.ts +1 -0
- package/lib/api/resetDevice.js +3 -1
- package/lib/api/rippleGetAddress.d.ts +1 -0
- package/lib/api/rippleGetAddress.js +4 -4
- package/lib/api/rippleSignTransaction.d.ts +1 -0
- package/lib/api/rippleSignTransaction.js +3 -1
- package/lib/api/showDeviceTutorial.d.ts +1 -0
- package/lib/api/showDeviceTutorial.js +3 -1
- package/lib/api/signMessage.d.ts +1 -0
- package/lib/api/signMessage.js +5 -1
- package/lib/api/signTransaction.d.ts +1 -0
- package/lib/api/signTransaction.js +16 -4
- package/lib/api/stellarGetAddress.d.ts +1 -0
- package/lib/api/stellarGetAddress.js +4 -4
- package/lib/api/stellarSignTransaction.d.ts +1 -0
- package/lib/api/stellarSignTransaction.js +3 -1
- package/lib/api/tezosGetAddress.d.ts +1 -0
- package/lib/api/tezosGetAddress.js +4 -4
- package/lib/api/tezosGetPublicKey.d.ts +1 -0
- package/lib/api/tezosGetPublicKey.js +3 -1
- package/lib/api/tezosSignTransaction.d.ts +1 -0
- package/lib/api/tezosSignTransaction.js +3 -1
- package/lib/api/verifyMessage.d.ts +1 -0
- package/lib/api/verifyMessage.js +7 -2
- package/lib/api/wipeDevice.d.ts +2 -1
- package/lib/api/wipeDevice.js +3 -1
- package/lib/backend/Blockchain.d.ts +1 -3
- package/lib/backend/Blockchain.js +10 -6
- package/lib/constants/index.d.ts +1 -1
- package/lib/constants/index.js +1 -1
- package/lib/core/AbstractMethod.d.ts +3 -1
- package/lib/core/AbstractMethod.js +3 -1
- package/lib/core/index.js +9 -1
- package/lib/data/DataManager.js +4 -1
- package/lib/data/analyticsInfo.js +1 -1
- package/lib/data/coinInfo.d.ts +9 -0
- package/lib/data/coinInfo.js +10 -41
- package/lib/data/config.js +5 -1
- package/lib/data/defaultFeeLevels.d.ts +17 -0
- package/lib/data/defaultFeeLevels.js +84 -0
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +2 -2
- package/lib/device/Device.js +9 -7
- package/lib/device/DeviceCommands.js +6 -1
- package/lib/events/popup.d.ts +8 -1
- package/lib/events/popup.js +1 -0
- package/lib/events/ui-request.d.ts +2 -2
- package/lib/types/account.d.ts +1 -20
- package/lib/types/api/bitcoin/index.d.ts +2 -0
- package/lib/types/api/blockchainEstimateFee.d.ts +2 -5
- package/lib/types/coinInfo.d.ts +5 -17
- package/lib/types/device.d.ts +5 -2
- package/lib/types/device.js +7 -2
- package/lib/types/fees.d.ts +26 -0
- package/lib/types/fees.js +3 -0
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.js +1 -0
- package/lib/utils/assetUtils.js +3 -1
- package/lib/utils/urlUtils.d.ts +10 -3
- package/lib/utils/urlUtils.js +5 -9
- package/package.json +10 -8
package/lib/events/popup.js
CHANGED
|
@@ -12,6 +12,7 @@ exports.POPUP = {
|
|
|
12
12
|
CLOSED: 'popup-closed',
|
|
13
13
|
CANCEL_POPUP_REQUEST: 'ui-cancel-popup-request',
|
|
14
14
|
CLOSE_WINDOW: 'window.close',
|
|
15
|
+
ANALYTICS_RESPONSE: 'popup-analytics-response',
|
|
15
16
|
};
|
|
16
17
|
const createPopupMessage = (type, payload) => ({
|
|
17
18
|
event: ui_request_1.UI_EVENT,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { EventTypeDeviceSelected } from '@trezor/connect-analytics';
|
|
2
2
|
import type { PROTO } from '../constants';
|
|
3
3
|
import type { TransportDisableWebUSB, TransportRequestWebUSBDevice } from './transport';
|
|
4
|
-
import type { Device, CoinInfo, BitcoinNetworkInfo } from '../types';
|
|
5
|
-
import type { DiscoveryAccountType, DiscoveryAccount
|
|
4
|
+
import type { Device, CoinInfo, BitcoinNetworkInfo, SelectFeeLevel } from '../types';
|
|
5
|
+
import type { DiscoveryAccountType, DiscoveryAccount } from '../types/account';
|
|
6
6
|
import type { MessageFactoryFn } from '../types/utils';
|
|
7
7
|
import type { DeviceButtonRequest } from './device';
|
|
8
8
|
export declare const UI_EVENT = "UI_EVENT";
|
package/lib/types/account.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AccountInfo as AccountInfoBase, AccountAddresses, Utxo as AccountUtxo } from '@trezor/blockchain-link';
|
|
2
|
-
export type { AccountAddresses, Utxo as AccountUtxo, Address as AccountAddress, } from '@trezor/blockchain-link';
|
|
2
|
+
export type { AccountAddresses, Utxo as AccountUtxo, Address as AccountAddress, Transaction as AccountTransaction, } from '@trezor/blockchain-link';
|
|
3
3
|
export type DiscoveryAccountType = 'p2pkh' | 'p2sh' | 'p2tr' | 'p2wpkh';
|
|
4
4
|
export interface AccountInfo extends AccountInfoBase {
|
|
5
5
|
path?: string;
|
|
@@ -15,23 +15,4 @@ export interface DiscoveryAccount {
|
|
|
15
15
|
balance?: string;
|
|
16
16
|
addresses?: AccountAddresses;
|
|
17
17
|
}
|
|
18
|
-
export interface FeeLevel {
|
|
19
|
-
label: 'high' | 'normal' | 'economy' | 'low' | 'custom';
|
|
20
|
-
feePerUnit: string;
|
|
21
|
-
blocks: number;
|
|
22
|
-
feeLimit?: string;
|
|
23
|
-
feePerTx?: string;
|
|
24
|
-
}
|
|
25
|
-
export type SelectFeeLevel = {
|
|
26
|
-
name: string;
|
|
27
|
-
fee: '0';
|
|
28
|
-
feePerByte?: undefined;
|
|
29
|
-
disabled: true;
|
|
30
|
-
} | {
|
|
31
|
-
name: string;
|
|
32
|
-
fee: string;
|
|
33
|
-
feePerByte: string;
|
|
34
|
-
minutes: number;
|
|
35
|
-
total: string;
|
|
36
|
-
};
|
|
37
18
|
//# sourceMappingURL=account.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PROTO } from '../../../constants';
|
|
2
2
|
import type { AccountAddresses } from '@trezor/blockchain-link';
|
|
3
3
|
import type { Transaction as BlockbookTransaction } from '@trezor/blockchain-link-types/lib/blockbook';
|
|
4
|
+
import { AccountTransaction } from '../../account';
|
|
4
5
|
export interface SignMessage {
|
|
5
6
|
path: string | number[];
|
|
6
7
|
coin: string;
|
|
@@ -55,6 +56,7 @@ export interface SignTransaction {
|
|
|
55
56
|
refTxs?: RefTransaction[];
|
|
56
57
|
account?: {
|
|
57
58
|
addresses: AccountAddresses;
|
|
59
|
+
transactions?: AccountTransaction[];
|
|
58
60
|
};
|
|
59
61
|
coin: string;
|
|
60
62
|
locktime?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BlockchainLinkParams, BlockchainLinkResponse } from '@trezor/blockchain-link';
|
|
2
|
-
import type { FeeLevel } from '../
|
|
2
|
+
import type { FeeLevel, FeeInfo } from '../fees';
|
|
3
3
|
import type { CommonParamsWithCoin, Response } from '../params';
|
|
4
4
|
export interface BlockchainEstimateFee {
|
|
5
5
|
request?: BlockchainLinkParams<'estimateFee'> & {
|
|
@@ -11,10 +11,7 @@ export interface BlockchainEstimateFeeLevel {
|
|
|
11
11
|
feeLevels: 'preloaded' | 'smart';
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
interface EstimatedFee {
|
|
15
|
-
blockTime: number;
|
|
16
|
-
minFee: number;
|
|
17
|
-
maxFee: number;
|
|
14
|
+
interface EstimatedFee extends Omit<FeeInfo, 'dustLimit'> {
|
|
18
15
|
dustLimit?: number;
|
|
19
16
|
}
|
|
20
17
|
export interface BlockchainEstimatedFee extends EstimatedFee {
|
package/lib/types/coinInfo.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FeeLevel } from './fees';
|
|
1
2
|
export interface CoinSupport {
|
|
2
3
|
connect: boolean;
|
|
3
4
|
trezor1: string;
|
|
@@ -19,10 +20,6 @@ export interface BlockchainLink {
|
|
|
19
20
|
type: string;
|
|
20
21
|
url: string[];
|
|
21
22
|
}
|
|
22
|
-
export type BitcoinDefaultFeesKeys = 'High' | 'Normal' | 'Economy' | 'Low';
|
|
23
|
-
export type BitcoinDefaultFees = {
|
|
24
|
-
[key in BitcoinDefaultFeesKeys]: number;
|
|
25
|
-
};
|
|
26
23
|
interface Common {
|
|
27
24
|
label: string;
|
|
28
25
|
name: string;
|
|
@@ -31,9 +28,10 @@ interface Common {
|
|
|
31
28
|
support: CoinSupport;
|
|
32
29
|
decimals: number;
|
|
33
30
|
blockchainLink?: BlockchainLink;
|
|
34
|
-
|
|
31
|
+
blockTime: number;
|
|
35
32
|
minFee: number;
|
|
36
33
|
maxFee: number;
|
|
34
|
+
defaultFees: FeeLevel[];
|
|
37
35
|
}
|
|
38
36
|
export interface BitcoinNetworkInfo extends Common {
|
|
39
37
|
type: 'bitcoin';
|
|
@@ -46,7 +44,6 @@ export interface BitcoinNetworkInfo extends Common {
|
|
|
46
44
|
maxFeeSatoshiKb: number;
|
|
47
45
|
minAddressLength: number;
|
|
48
46
|
minFeeSatoshiKb: number;
|
|
49
|
-
defaultFees: BitcoinDefaultFees;
|
|
50
47
|
segwit: boolean;
|
|
51
48
|
xPubMagic: number;
|
|
52
49
|
xPubMagicSegwitNative?: number;
|
|
@@ -54,25 +51,16 @@ export interface BitcoinNetworkInfo extends Common {
|
|
|
54
51
|
taproot?: boolean;
|
|
55
52
|
network: Network;
|
|
56
53
|
isBitcoin: boolean;
|
|
57
|
-
blocks?: number;
|
|
58
54
|
}
|
|
59
55
|
export interface EthereumNetworkInfo extends Common {
|
|
60
56
|
type: 'ethereum';
|
|
61
|
-
chain: string;
|
|
62
57
|
chainId: number;
|
|
63
|
-
|
|
64
|
-
defaultFees: Array<{
|
|
65
|
-
label: 'high' | 'normal' | 'low';
|
|
66
|
-
feePerUnit: string;
|
|
67
|
-
feeLimit: string;
|
|
68
|
-
}>;
|
|
69
|
-
network: typeof undefined;
|
|
58
|
+
network?: typeof undefined;
|
|
70
59
|
}
|
|
71
60
|
export interface MiscNetworkInfo extends Common {
|
|
72
61
|
type: 'misc' | 'nem';
|
|
73
62
|
curve: string;
|
|
74
|
-
|
|
75
|
-
network: typeof undefined;
|
|
63
|
+
network?: typeof undefined;
|
|
76
64
|
}
|
|
77
65
|
export type CoinInfo = BitcoinNetworkInfo | EthereumNetworkInfo | MiscNetworkInfo;
|
|
78
66
|
export {};
|
package/lib/types/device.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ export type DeviceStatus = 'available' | 'occupied' | 'used';
|
|
|
4
4
|
export type DeviceMode = 'normal' | 'bootloader' | 'initialize' | 'seedless';
|
|
5
5
|
export type DeviceFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknown' | 'none';
|
|
6
6
|
export type UnavailableCapability = 'no-capability' | 'no-support' | 'update-required' | 'trezor-connect-outdated';
|
|
7
|
-
export
|
|
7
|
+
export declare enum FirmwareType {
|
|
8
|
+
BitcoinOnly = "bitcoin-only",
|
|
9
|
+
Regular = "regular"
|
|
10
|
+
}
|
|
8
11
|
export type UnavailableCapabilities = {
|
|
9
12
|
[key: string]: UnavailableCapability;
|
|
10
13
|
};
|
|
@@ -55,7 +58,7 @@ export type UnreadableDevice = {
|
|
|
55
58
|
};
|
|
56
59
|
export type Device = KnownDevice | UnknownDevice | UnreadableDevice;
|
|
57
60
|
export type Features = PROTO.Features;
|
|
58
|
-
export { DeviceModelInternal } from '@trezor/
|
|
61
|
+
export { DeviceModelInternal } from '@trezor/protobuf/lib/messages';
|
|
59
62
|
type FeaturesNarrowing = {
|
|
60
63
|
major_version: 2;
|
|
61
64
|
fw_major: null;
|
package/lib/types/device.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeviceModelInternal = void 0;
|
|
4
|
-
var
|
|
3
|
+
exports.DeviceModelInternal = exports.FirmwareType = void 0;
|
|
4
|
+
var FirmwareType;
|
|
5
|
+
(function (FirmwareType) {
|
|
6
|
+
FirmwareType["BitcoinOnly"] = "bitcoin-only";
|
|
7
|
+
FirmwareType["Regular"] = "regular";
|
|
8
|
+
})(FirmwareType = exports.FirmwareType || (exports.FirmwareType = {}));
|
|
9
|
+
var messages_1 = require("@trezor/protobuf/lib/messages");
|
|
5
10
|
Object.defineProperty(exports, "DeviceModelInternal", { enumerable: true, get: function () { return messages_1.DeviceModelInternal; } });
|
|
6
11
|
//# sourceMappingURL=device.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface FeeInfo {
|
|
2
|
+
blockTime: number;
|
|
3
|
+
minFee: number;
|
|
4
|
+
maxFee: number;
|
|
5
|
+
dustLimit: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FeeLevel {
|
|
8
|
+
label: 'high' | 'normal' | 'economy' | 'low' | 'custom';
|
|
9
|
+
feePerUnit: string;
|
|
10
|
+
blocks: number;
|
|
11
|
+
feeLimit?: string;
|
|
12
|
+
feePerTx?: string;
|
|
13
|
+
}
|
|
14
|
+
export type SelectFeeLevel = {
|
|
15
|
+
name: string;
|
|
16
|
+
fee: '0';
|
|
17
|
+
feePerByte?: undefined;
|
|
18
|
+
disabled: true;
|
|
19
|
+
} | {
|
|
20
|
+
name: string;
|
|
21
|
+
fee: string;
|
|
22
|
+
feePerByte: string;
|
|
23
|
+
minutes: number;
|
|
24
|
+
total: string;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=fees.d.ts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './api';
|
|
|
2
2
|
export * from './account';
|
|
3
3
|
export * from './coinInfo';
|
|
4
4
|
export * from './device';
|
|
5
|
+
export * from './fees';
|
|
5
6
|
export * from './firmware';
|
|
6
7
|
export * from './params';
|
|
7
8
|
export * from './settings';
|
|
@@ -15,5 +16,5 @@ export * from './api/stellar';
|
|
|
15
16
|
export * from './api/tezos';
|
|
16
17
|
export type { ComposeOutput, PrecomposedTransaction } from './api/composeTransaction';
|
|
17
18
|
export type { RecoveryDevice } from './api/recoveryDevice';
|
|
18
|
-
export type { TokenInfo, TokenTransfer, InternalTransfer, FiatRates,
|
|
19
|
+
export type { TokenInfo, TokenTransfer, InternalTransfer, FiatRates, Target as TransactionTarget, AccountBalanceHistory as BlockchainAccountBalanceHistory, } from '@trezor/blockchain-link';
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/types/index.js
CHANGED
|
@@ -5,6 +5,7 @@ tslib_1.__exportStar(require("./api"), exports);
|
|
|
5
5
|
tslib_1.__exportStar(require("./account"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./coinInfo"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./device"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./fees"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./firmware"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./params"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./settings"), exports);
|
package/lib/utils/assetUtils.js
CHANGED
|
@@ -6,6 +6,8 @@ const getAssetByUrl = (url) => {
|
|
|
6
6
|
switch (fileUrl) {
|
|
7
7
|
case './data/coins.json':
|
|
8
8
|
return require('@trezor/connect-common/files/coins.json');
|
|
9
|
+
case './data/coins-eth.json':
|
|
10
|
+
return require('@trezor/connect-common/files/coins-eth.json');
|
|
9
11
|
case './data/bridge/releases.json':
|
|
10
12
|
return require('@trezor/connect-common/files/bridge/releases.json');
|
|
11
13
|
case './data/firmware/1/releases.json':
|
|
@@ -13,7 +15,7 @@ const getAssetByUrl = (url) => {
|
|
|
13
15
|
case './data/firmware/2/releases.json':
|
|
14
16
|
return require('@trezor/connect-common/files/firmware/2/releases.json');
|
|
15
17
|
case './data/messages/messages.json':
|
|
16
|
-
return require('@trezor/
|
|
18
|
+
return require('@trezor/protobuf/messages.json');
|
|
17
19
|
default:
|
|
18
20
|
return null;
|
|
19
21
|
}
|
package/lib/utils/urlUtils.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export declare const getOrigin: (url: unknown) => string;
|
|
2
2
|
export declare const getHost: (url: unknown) => string | undefined;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
interface GetOnionDomain {
|
|
4
|
+
(url: string, dict: {
|
|
5
|
+
[domain: string]: string;
|
|
6
|
+
}): string;
|
|
7
|
+
(url: string[], dict: {
|
|
8
|
+
[domain: string]: string;
|
|
9
|
+
}): string[];
|
|
10
|
+
}
|
|
11
|
+
export declare const getOnionDomain: GetOnionDomain;
|
|
12
|
+
export {};
|
|
6
13
|
//# sourceMappingURL=urlUtils.d.ts.map
|
package/lib/utils/urlUtils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getOnionDomain = exports.getHost = exports.getOrigin = void 0;
|
|
4
|
+
const utils_1 = require("@trezor/utils");
|
|
4
5
|
const getOrigin = (url) => {
|
|
5
6
|
var _a;
|
|
6
7
|
if (typeof url !== 'string')
|
|
@@ -27,15 +28,10 @@ const getHost = (url) => {
|
|
|
27
28
|
exports.getHost = getHost;
|
|
28
29
|
const getOnionDomain = (url, dict) => {
|
|
29
30
|
var _a;
|
|
30
|
-
if (Array.isArray(url))
|
|
31
|
-
return url.map(u => (0,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const [, protocol, subdomain, domain, rest] = (_a = url.match(/^(http|ws)s?:\/\/([^:/]+\.)?([^/.]+\.[^/.]+)(\/.*)?$/i)) !== null && _a !== void 0 ? _a : [];
|
|
35
|
-
if (!domain || !dict[domain])
|
|
36
|
-
return url;
|
|
37
|
-
return `${protocol}://${subdomain || ''}${dict[domain]}${rest || ''}`;
|
|
38
|
-
}
|
|
31
|
+
if (Array.isArray(url))
|
|
32
|
+
return url.map(u => { var _a; return (_a = (0, utils_1.urlToOnion)(u, dict)) !== null && _a !== void 0 ? _a : u; });
|
|
33
|
+
if (typeof url === 'string')
|
|
34
|
+
return (_a = (0, utils_1.urlToOnion)(url, dict)) !== null && _a !== void 0 ? _a : url;
|
|
39
35
|
return url;
|
|
40
36
|
};
|
|
41
37
|
exports.getOnionDomain = getOnionDomain;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trezor/connect",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.3",
|
|
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.",
|
|
@@ -49,13 +49,15 @@
|
|
|
49
49
|
"prepublish": "yarn tsx ../../scripts/prepublish.js"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@trezor/blockchain-link": "2.1.
|
|
53
|
-
"@trezor/blockchain-link-types": "1.0.
|
|
54
|
-
"@trezor/connect-analytics": "1.0.
|
|
55
|
-
"@trezor/connect-common": "0.0.
|
|
56
|
-
"@trezor/
|
|
57
|
-
"@trezor/
|
|
58
|
-
"@trezor/
|
|
52
|
+
"@trezor/blockchain-link": "2.1.16",
|
|
53
|
+
"@trezor/blockchain-link-types": "1.0.5",
|
|
54
|
+
"@trezor/connect-analytics": "1.0.6",
|
|
55
|
+
"@trezor/connect-common": "0.0.20",
|
|
56
|
+
"@trezor/protobuf": "1.0.0",
|
|
57
|
+
"@trezor/protocol": "1.0.0",
|
|
58
|
+
"@trezor/transport": "1.1.15",
|
|
59
|
+
"@trezor/utils": "9.0.12",
|
|
60
|
+
"@trezor/utxo-lib": "1.0.10",
|
|
59
61
|
"bignumber.js": "^9.1.1",
|
|
60
62
|
"blakejs": "^1.2.1",
|
|
61
63
|
"bs58": "^5.0.0",
|