@trezor/connect 9.2.1 → 9.2.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.
Files changed (115) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +1 -1
  3. package/lib/api/binance/api/binanceSignTransaction.d.ts +1 -1
  4. package/lib/api/binance/binanceSignTx.d.ts +1 -1
  5. package/lib/api/bitcoin/Fees.d.ts +2 -2
  6. package/lib/api/bitcoin/TransactionComposer.d.ts +2 -2
  7. package/lib/api/blockchainDisconnect.d.ts +1 -0
  8. package/lib/api/blockchainDisconnect.js +3 -4
  9. package/lib/api/blockchainEstimateFee.d.ts +1 -0
  10. package/lib/api/blockchainEstimateFee.js +7 -4
  11. package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -0
  12. package/lib/api/blockchainGetAccountBalanceHistory.js +3 -1
  13. package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -0
  14. package/lib/api/blockchainGetCurrentFiatRates.js +3 -1
  15. package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -0
  16. package/lib/api/blockchainGetFiatRatesForTimestamps.js +3 -1
  17. package/lib/api/blockchainGetTransactions.d.ts +1 -0
  18. package/lib/api/blockchainGetTransactions.js +3 -1
  19. package/lib/api/blockchainSetCustomBackend.js +1 -5
  20. package/lib/api/blockchainSubscribe.d.ts +2 -0
  21. package/lib/api/blockchainSubscribe.js +13 -2
  22. package/lib/api/blockchainSubscribeFiatRates.d.ts +1 -0
  23. package/lib/api/blockchainSubscribeFiatRates.js +3 -1
  24. package/lib/api/blockchainUnsubscribe.d.ts +1 -0
  25. package/lib/api/blockchainUnsubscribe.js +5 -2
  26. package/lib/api/blockchainUnsubscribeFiatRates.d.ts +1 -0
  27. package/lib/api/blockchainUnsubscribeFiatRates.js +6 -2
  28. package/lib/api/changeLanguage.d.ts +0 -1
  29. package/lib/api/changeLanguage.js +8 -39
  30. package/lib/api/composeTransaction.d.ts +2 -0
  31. package/lib/api/composeTransaction.js +10 -5
  32. package/lib/api/eos/eosSignTx.d.ts +58 -58
  33. package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +6 -6
  34. package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +2 -1
  35. package/lib/api/ethereum/ethereumDefinitions.js +1 -0
  36. package/lib/api/getAccountInfo.js +4 -3
  37. package/lib/api/getCoinInfo.d.ts +25 -22
  38. package/lib/api/getFeatures.d.ts +10 -10
  39. package/lib/api/getPublicKey.d.ts +6 -6
  40. package/lib/api/nem/nemSignTx.d.ts +13 -13
  41. package/lib/api/pushTransaction.d.ts +1 -0
  42. package/lib/api/pushTransaction.js +2 -1
  43. package/lib/api/resetDevice.d.ts +1 -1
  44. package/lib/api/resetDevice.js +2 -2
  45. package/lib/api/signTransaction.d.ts +1 -0
  46. package/lib/api/signTransaction.js +5 -3
  47. package/lib/api/stellar/stellarSignTx.d.ts +1 -1
  48. package/lib/api/tezos/tezosSignTx.d.ts +18 -18
  49. package/lib/backend/BackendManager.d.ts +6 -4
  50. package/lib/backend/BackendManager.js +36 -28
  51. package/lib/backend/Blockchain.d.ts +15 -4
  52. package/lib/backend/Blockchain.js +27 -17
  53. package/lib/backend/BlockchainLink.d.ts +3 -3
  54. package/lib/backend/BlockchainLink.js +3 -3
  55. package/lib/core/AbstractMethod.js +1 -0
  56. package/lib/core/index.js +34 -5
  57. package/lib/data/DataManager.d.ts +22 -0
  58. package/lib/data/DataManager.js +7 -3
  59. package/lib/data/coinInfo.d.ts +131 -117
  60. package/lib/data/config.d.ts +22 -0
  61. package/lib/data/config.js +19 -1
  62. package/lib/data/connectSettings.js +3 -0
  63. package/lib/data/defaultFeeLevels.js +9 -1
  64. package/lib/data/deviceAuthenticityConfig.d.ts +9 -0
  65. package/lib/data/deviceAuthenticityConfig.js +26 -3
  66. package/lib/data/firmwareInfo.d.ts +1 -1
  67. package/lib/data/firmwareInfo.js +1 -5
  68. package/lib/data/getLanguage.d.ts +6 -0
  69. package/lib/data/getLanguage.js +10 -0
  70. package/lib/data/models.d.ts +9 -0
  71. package/lib/data/models.js +9 -0
  72. package/lib/data/version.d.ts +1 -1
  73. package/lib/data/version.js +1 -1
  74. package/lib/device/Device.d.ts +15 -3
  75. package/lib/device/Device.js +55 -6
  76. package/lib/device/DeviceCommands.d.ts +8 -8
  77. package/lib/device/DeviceList.js +4 -6
  78. package/lib/device/resolveDescriptorForTaproot.js +21 -16
  79. package/lib/events/blockchain.d.ts +3 -0
  80. package/lib/events/device.d.ts +1 -0
  81. package/lib/events/device.js +1 -0
  82. package/lib/types/api/applySettings.d.ts +6 -6
  83. package/lib/types/api/authenticateDevice.d.ts +9 -0
  84. package/lib/types/api/bitcoin/index.d.ts +1 -0
  85. package/lib/types/api/blockchainSetCustomBackend.d.ts +3 -2
  86. package/lib/types/api/blockchainSubscribe.d.ts +1 -0
  87. package/lib/types/api/composeTransaction.d.ts +2 -0
  88. package/lib/types/api/getAccountInfo.d.ts +1 -0
  89. package/lib/types/api/getAddress.d.ts +5 -5
  90. package/lib/types/api/getCoinInfo.d.ts +4 -2
  91. package/lib/types/api/getPublicKey.js +4 -1
  92. package/lib/types/api/nemGetAddress.d.ts +11 -4
  93. package/lib/types/api/nemGetAddress.js +9 -0
  94. package/lib/types/api/pushTransaction.d.ts +1 -0
  95. package/lib/types/api/pushTransaction.js +1 -0
  96. package/lib/types/api/recoveryDevice.d.ts +1 -1
  97. package/lib/types/api/resetDevice.d.ts +1 -15
  98. package/lib/types/api/resetDevice.js +0 -9
  99. package/lib/types/api/setBusy.d.ts +2 -2
  100. package/lib/types/coinInfo.d.ts +15 -7
  101. package/lib/types/coinInfo.js +8 -6
  102. package/lib/types/firmware.d.ts +5 -15
  103. package/lib/types/params.d.ts +1 -0
  104. package/lib/types/params.js +5 -2
  105. package/lib/types/settings.d.ts +1 -0
  106. package/lib/utils/assetUtils.js +18 -8
  107. package/lib/utils/{assets-native.d.ts → assets.native.d.ts} +1 -1
  108. package/lib/utils/{assets-native.js → assets.native.js} +1 -1
  109. package/lib/utils/debug.d.ts +5 -31
  110. package/lib/utils/debug.js +8 -110
  111. package/lib/utils/hdnodeUtils.d.ts +3 -3
  112. package/lib/utils/pathUtils.d.ts +3 -3
  113. package/lib/workers/{workers-react-native.d.ts → workers.native.d.ts} +1 -1
  114. package/lib/workers/{workers-react-native.js → workers.native.js} +1 -1
  115. package/package.json +40 -20
@@ -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 = exports.Log = void 0;
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 MAX_ENTRIES = 100;
22
- class Log {
23
- constructor(prefix, enabled, logWriter) {
24
- this.prefix = prefix;
25
- this.enabled = enabled;
26
- this.messages = [];
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;
@@ -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-react-native.d.ts.map
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-react-native.js.map
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.1",
3
+ "version": "9.2.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.",
@@ -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/utils/assets": "./lib/utils/assets-browser",
26
- "./lib/workers/workers": "./lib/workers/workers-browser"
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
- "./lib/index": "./lib/index",
30
- "./lib/workers/workers": "./lib/workers/workers-react-native",
31
- "./lib/utils/assets": "./lib/utils/assets-native"
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,8 +55,8 @@
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",
42
- "version:beta": "yarn g:tsx scripts/bump-version.ts prerelease",
58
+ "build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",
59
+ "version:prerelease": "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",
45
62
  "version:major": "yarn g:tsx scripts/bump-version.ts major",
@@ -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.27",
56
- "@trezor/blockchain-link-types": "1.0.14",
57
- "@trezor/connect-analytics": "1.0.13",
58
- "@trezor/connect-common": "0.0.30",
59
- "@trezor/protobuf": "1.0.10",
60
- "@trezor/protocol": "1.0.6",
61
- "@trezor/schema-utils": "1.0.2",
62
- "@trezor/transport": "1.1.26",
63
- "@trezor/utils": "9.0.22",
64
- "@trezor/utxo-lib": "2.0.7",
73
+ "@trezor/blockchain-link": "2.1.29",
74
+ "@trezor/blockchain-link-types": "1.0.16",
75
+ "@trezor/connect-analytics": "1.0.14",
76
+ "@trezor/connect-common": "0.0.32",
77
+ "@trezor/protobuf": "1.0.12",
78
+ "@trezor/protocol": "1.0.8",
79
+ "@trezor/schema-utils": "1.0.3",
80
+ "@trezor/transport": "1.1.28",
81
+ "@trezor/utils": "9.0.23",
82
+ "@trezor/utxo-lib": "2.0.9",
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",