@trezor/connect 9.1.5 → 9.1.6

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 (157) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/lib/api/{binanceGetAddress.d.ts → binance/api/binanceGetAddress.d.ts} +3 -3
  4. package/lib/api/{binanceGetAddress.js → binance/api/binanceGetAddress.js} +6 -6
  5. package/lib/api/{binanceGetPublicKey.d.ts → binance/api/binanceGetPublicKey.d.ts} +3 -3
  6. package/lib/api/{binanceGetPublicKey.js → binance/api/binanceGetPublicKey.js} +5 -5
  7. package/lib/api/{binanceSignTransaction.d.ts → binance/api/binanceSignTransaction.d.ts} +2 -2
  8. package/lib/api/{binanceSignTransaction.js → binance/api/binanceSignTransaction.js} +5 -5
  9. package/lib/api/binance/api/index.d.ts +4 -0
  10. package/lib/api/binance/api/index.js +13 -0
  11. package/lib/api/bitcoin/TransactionComposer.d.ts +4 -4
  12. package/lib/api/bitcoin/TransactionComposer.js +4 -18
  13. package/lib/api/bitcoin/inputs.d.ts +2 -2
  14. package/lib/api/bitcoin/inputs.js +4 -5
  15. package/lib/api/bitcoin/outputs.d.ts +4 -4
  16. package/lib/api/bitcoin/outputs.js +14 -23
  17. package/lib/api/blockchainEstimateFee.d.ts +2 -2
  18. package/lib/api/cardano/api/cardanoComposeTransaction.d.ts +8 -0
  19. package/lib/api/cardano/api/cardanoComposeTransaction.js +69 -0
  20. package/lib/api/{cardanoGetAddress.d.ts → cardano/api/cardanoGetAddress.d.ts} +3 -3
  21. package/lib/api/{cardanoGetAddress.js → cardano/api/cardanoGetAddress.js} +7 -7
  22. package/lib/api/{cardanoGetNativeScriptHash.d.ts → cardano/api/cardanoGetNativeScriptHash.d.ts} +3 -3
  23. package/lib/api/{cardanoGetNativeScriptHash.js → cardano/api/cardanoGetNativeScriptHash.js} +5 -5
  24. package/lib/api/{cardanoGetPublicKey.d.ts → cardano/api/cardanoGetPublicKey.d.ts} +3 -3
  25. package/lib/api/{cardanoGetPublicKey.js → cardano/api/cardanoGetPublicKey.js} +6 -6
  26. package/lib/api/{cardanoSignTransaction.d.ts → cardano/api/cardanoSignTransaction.d.ts} +18 -8
  27. package/lib/api/{cardanoSignTransaction.js → cardano/api/cardanoSignTransaction.js} +30 -13
  28. package/lib/api/cardano/api/index.d.ts +6 -0
  29. package/lib/api/cardano/api/index.js +17 -0
  30. package/lib/api/cardano/cardanoUtils.d.ts +6 -0
  31. package/lib/api/cardano/cardanoUtils.js +64 -1
  32. package/lib/api/composeTransaction.d.ts +5 -5
  33. package/lib/api/composeTransaction.js +14 -19
  34. package/lib/api/eos/api/eosGetPublicKey.d.ts +11 -0
  35. package/lib/api/{eosGetPublicKey.js → eos/api/eosGetPublicKey.js} +5 -5
  36. package/lib/api/{eosSignTransaction.d.ts → eos/api/eosSignTransaction.d.ts} +2 -2
  37. package/lib/api/{eosSignTransaction.js → eos/api/eosSignTransaction.js} +5 -5
  38. package/lib/api/eos/api/index.d.ts +3 -0
  39. package/lib/api/eos/api/index.js +11 -0
  40. package/lib/api/{ethereumGetAddress.d.ts → ethereum/api/ethereumGetAddress.d.ts} +4 -4
  41. package/lib/api/{ethereumGetAddress.js → ethereum/api/ethereumGetAddress.js} +9 -9
  42. package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +16 -0
  43. package/lib/api/{ethereumGetPublicKey.js → ethereum/api/ethereumGetPublicKey.js} +6 -6
  44. package/lib/api/{ethereumSignMessage.d.ts → ethereum/api/ethereumSignMessage.d.ts} +3 -3
  45. package/lib/api/{ethereumSignMessage.js → ethereum/api/ethereumSignMessage.js} +7 -7
  46. package/lib/api/{ethereumSignTransaction.d.ts → ethereum/api/ethereumSignTransaction.d.ts} +11 -9
  47. package/lib/api/{ethereumSignTransaction.js → ethereum/api/ethereumSignTransaction.js} +36 -43
  48. package/lib/api/{ethereumSignTypedData.d.ts → ethereum/api/ethereumSignTypedData.d.ts} +3 -3
  49. package/lib/api/{ethereumSignTypedData.js → ethereum/api/ethereumSignTypedData.js} +10 -10
  50. package/lib/api/{ethereumVerifyMessage.d.ts → ethereum/api/ethereumVerifyMessage.d.ts} +2 -2
  51. package/lib/api/{ethereumVerifyMessage.js → ethereum/api/ethereumVerifyMessage.js} +3 -3
  52. package/lib/api/ethereum/api/index.d.ts +7 -0
  53. package/lib/api/ethereum/api/index.js +19 -0
  54. package/lib/api/ethereum/ethereumSignTx.d.ts +2 -0
  55. package/lib/api/ethereum/ethereumSignTx.js +15 -1
  56. package/lib/api/firmware/verifyAuthenticityProof.js +1 -1
  57. package/lib/api/firmware/x509certificate.d.ts +1 -0
  58. package/lib/api/firmware/x509certificate.js +34 -2
  59. package/lib/api/getAccountDescriptor.d.ts +20 -0
  60. package/lib/api/getAccountDescriptor.js +162 -0
  61. package/lib/api/getAccountInfo.d.ts +2 -0
  62. package/lib/api/index.d.ts +1 -24
  63. package/lib/api/index.js +3 -50
  64. package/lib/api/nem/api/index.d.ts +3 -0
  65. package/lib/api/nem/api/index.js +11 -0
  66. package/lib/api/{nemGetAddress.d.ts → nem/api/nemGetAddress.d.ts} +3 -3
  67. package/lib/api/{nemGetAddress.js → nem/api/nemGetAddress.js} +6 -6
  68. package/lib/api/{nemSignTransaction.d.ts → nem/api/nemSignTransaction.d.ts} +2 -2
  69. package/lib/api/{nemSignTransaction.js → nem/api/nemSignTransaction.js} +5 -5
  70. package/lib/api/ripple/api/index.d.ts +3 -0
  71. package/lib/api/ripple/api/index.js +11 -0
  72. package/lib/api/{rippleGetAddress.d.ts → ripple/api/rippleGetAddress.d.ts} +3 -3
  73. package/lib/api/{rippleGetAddress.js → ripple/api/rippleGetAddress.js} +6 -6
  74. package/lib/api/{rippleSignTransaction.d.ts → ripple/api/rippleSignTransaction.d.ts} +2 -2
  75. package/lib/api/{rippleSignTransaction.js → ripple/api/rippleSignTransaction.js} +4 -4
  76. package/lib/api/solana/api/index.d.ts +4 -0
  77. package/lib/api/solana/api/index.js +13 -0
  78. package/lib/api/solana/api/solanaGetAddress.d.ts +23 -0
  79. package/lib/api/solana/api/solanaGetAddress.js +131 -0
  80. package/lib/api/solana/api/solanaGetPublicKey.d.ts +12 -0
  81. package/lib/api/solana/api/solanaGetPublicKey.js +84 -0
  82. package/lib/api/solana/api/solanaSignTransaction.d.ts +10 -0
  83. package/lib/api/solana/api/solanaSignTransaction.js +33 -0
  84. package/lib/api/stellar/api/index.d.ts +3 -0
  85. package/lib/api/stellar/api/index.js +11 -0
  86. package/lib/api/{stellarGetAddress.d.ts → stellar/api/stellarGetAddress.d.ts} +3 -3
  87. package/lib/api/{stellarGetAddress.js → stellar/api/stellarGetAddress.js} +6 -6
  88. package/lib/api/{stellarSignTransaction.d.ts → stellar/api/stellarSignTransaction.d.ts} +2 -2
  89. package/lib/api/{stellarSignTransaction.js → stellar/api/stellarSignTransaction.js} +6 -6
  90. package/lib/api/tezos/api/index.d.ts +4 -0
  91. package/lib/api/tezos/api/index.js +13 -0
  92. package/lib/api/{tezosGetAddress.d.ts → tezos/api/tezosGetAddress.d.ts} +3 -3
  93. package/lib/api/{tezosGetAddress.js → tezos/api/tezosGetAddress.js} +6 -6
  94. package/lib/api/{tezosGetPublicKey.d.ts → tezos/api/tezosGetPublicKey.d.ts} +3 -3
  95. package/lib/api/{tezosGetPublicKey.js → tezos/api/tezosGetPublicKey.js} +5 -5
  96. package/lib/api/{tezosSignTransaction.d.ts → tezos/api/tezosSignTransaction.d.ts} +2 -2
  97. package/lib/api/{tezosSignTransaction.js → tezos/api/tezosSignTransaction.js} +5 -5
  98. package/lib/backend/Blockchain.js +2 -0
  99. package/lib/constants/cardano.js +2 -2
  100. package/lib/constants/nem.js +3 -3
  101. package/lib/constants/network.d.ts +3 -0
  102. package/lib/constants/network.js +13 -1
  103. package/lib/core/index.d.ts +3 -1
  104. package/lib/core/index.js +17 -4
  105. package/lib/core/method.d.ts +2 -2
  106. package/lib/core/method.js +8 -2
  107. package/lib/core/method.native.d.ts +5 -0
  108. package/lib/core/method.native.js +34 -0
  109. package/lib/data/DataManager.d.ts +11 -0
  110. package/lib/data/config.d.ts +11 -0
  111. package/lib/data/config.js +4 -0
  112. package/lib/data/connectSettings.js +4 -0
  113. package/lib/data/defaultFeeLevels.js +8 -0
  114. package/lib/data/version.d.ts +1 -1
  115. package/lib/data/version.js +1 -1
  116. package/lib/device/Device.d.ts +1 -1
  117. package/lib/device/Device.js +11 -2
  118. package/lib/device/DeviceCommands.js +9 -0
  119. package/lib/device/DeviceList.js +4 -1
  120. package/lib/events/popup.d.ts +19 -3
  121. package/lib/events/popup.js +3 -0
  122. package/lib/factory.js +5 -0
  123. package/lib/types/api/cardanoComposeTransaction.d.ts +44 -0
  124. package/lib/types/api/cardanoComposeTransaction.js +3 -0
  125. package/lib/types/api/cardanoSignTransaction.d.ts +9 -0
  126. package/lib/types/api/composeTransaction.d.ts +28 -54
  127. package/lib/types/api/ethereum/index.d.ts +1 -0
  128. package/lib/types/api/getAccountDescriptor.d.ts +16 -0
  129. package/lib/types/api/getAccountDescriptor.js +3 -0
  130. package/lib/types/api/index.d.ts +10 -0
  131. package/lib/types/api/solana/index.d.ts +12 -0
  132. package/lib/types/api/solana/index.js +3 -0
  133. package/lib/types/api/solanaGetAddress.d.ts +4 -0
  134. package/lib/types/api/solanaGetAddress.js +3 -0
  135. package/lib/types/api/solanaGetPublicKey.d.ts +5 -0
  136. package/lib/types/api/solanaGetPublicKey.js +3 -0
  137. package/lib/types/api/solanaSignTransaction.d.ts +4 -0
  138. package/lib/types/api/solanaSignTransaction.js +3 -0
  139. package/lib/types/coinInfo.d.ts +2 -13
  140. package/lib/types/device.js +1 -1
  141. package/lib/types/index.d.ts +3 -1
  142. package/lib/types/index.js +1 -0
  143. package/lib/types/settings.d.ts +1 -0
  144. package/lib/utils/debug.d.ts +1 -2
  145. package/lib/utils/debug.js +6 -1
  146. package/lib/utils/deviceFeaturesUtils.js +2 -0
  147. package/lib/utils/formatUtils.d.ts +2 -0
  148. package/lib/utils/formatUtils.js +19 -1
  149. package/lib/workers/workers-browser.d.ts +2 -1
  150. package/lib/workers/workers-browser.js +3 -1
  151. package/lib/workers/workers-react-native.d.ts +2 -1
  152. package/lib/workers/workers-react-native.js +3 -1
  153. package/lib/workers/workers.d.ts +8 -5
  154. package/lib/workers/workers.js +34 -10
  155. package/package.json +22 -18
  156. package/lib/api/eosGetPublicKey.d.ts +0 -11
  157. package/lib/api/ethereumGetPublicKey.d.ts +0 -16
@@ -7,10 +7,10 @@ var PROTOCOL_MAGICS;
7
7
  PROTOCOL_MAGICS[PROTOCOL_MAGICS["testnet_preprod"] = 1] = "testnet_preprod";
8
8
  PROTOCOL_MAGICS[PROTOCOL_MAGICS["testnet_preview"] = 2] = "testnet_preview";
9
9
  PROTOCOL_MAGICS[PROTOCOL_MAGICS["testnet_legacy"] = 1097911063] = "testnet_legacy";
10
- })(PROTOCOL_MAGICS = exports.PROTOCOL_MAGICS || (exports.PROTOCOL_MAGICS = {}));
10
+ })(PROTOCOL_MAGICS || (exports.PROTOCOL_MAGICS = PROTOCOL_MAGICS = {}));
11
11
  var NETWORK_IDS;
12
12
  (function (NETWORK_IDS) {
13
13
  NETWORK_IDS[NETWORK_IDS["mainnet"] = 1] = "mainnet";
14
14
  NETWORK_IDS[NETWORK_IDS["testnet"] = 0] = "testnet";
15
- })(NETWORK_IDS = exports.NETWORK_IDS || (exports.NETWORK_IDS = {}));
15
+ })(NETWORK_IDS || (exports.NETWORK_IDS = NETWORK_IDS = {}));
16
16
  //# sourceMappingURL=cardano.js.map
@@ -6,7 +6,7 @@ var Networks;
6
6
  Networks[Networks["mainnet"] = 104] = "mainnet";
7
7
  Networks[Networks["testnet"] = 152] = "testnet";
8
8
  Networks[Networks["mijin"] = 96] = "mijin";
9
- })(Networks = exports.Networks || (exports.Networks = {}));
9
+ })(Networks || (exports.Networks = Networks = {}));
10
10
  var TxType;
11
11
  (function (TxType) {
12
12
  TxType[TxType["TRANSFER"] = 257] = "TRANSFER";
@@ -18,11 +18,11 @@ var TxType;
18
18
  TxType[TxType["PROVISION_NAMESPACE"] = 8193] = "PROVISION_NAMESPACE";
19
19
  TxType[TxType["MOSAIC_CREATION"] = 16385] = "MOSAIC_CREATION";
20
20
  TxType[TxType["SUPPLY_CHANGE"] = 16386] = "SUPPLY_CHANGE";
21
- })(TxType = exports.TxType || (exports.TxType = {}));
21
+ })(TxType || (exports.TxType = TxType = {}));
22
22
  var TxVersion;
23
23
  (function (TxVersion) {
24
24
  TxVersion[TxVersion["mainnet"] = 1744830464] = "mainnet";
25
25
  TxVersion[TxVersion["testnet"] = -1744830464] = "testnet";
26
26
  TxVersion[TxVersion["mijin"] = 1610612736] = "mijin";
27
- })(TxVersion = exports.TxVersion || (exports.TxVersion = {}));
27
+ })(TxVersion || (exports.TxVersion = TxVersion = {}));
28
28
  //# sourceMappingURL=nem.js.map
@@ -8,6 +8,9 @@ export declare const TYPES: {
8
8
  readonly ripple: "Ripple";
9
9
  readonly tezos: "Tezos";
10
10
  readonly binance: "Binance";
11
+ readonly solana: "Solana";
11
12
  };
12
13
  export type NetworkType = keyof typeof TYPES;
14
+ export declare const MODULES: readonly ["binance", "cardano", "eos", "ethereum", "nem", "ripple", "solana", "stellar", "tezos"];
15
+ export type ModuleName = (typeof MODULES)[number];
13
16
  //# sourceMappingURL=network.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TYPES = void 0;
3
+ exports.MODULES = exports.TYPES = void 0;
4
4
  exports.TYPES = {
5
5
  bitcoin: 'Bitcoin',
6
6
  ethereum: 'Ethereum',
@@ -11,5 +11,17 @@ exports.TYPES = {
11
11
  ripple: 'Ripple',
12
12
  tezos: 'Tezos',
13
13
  binance: 'Binance',
14
+ solana: 'Solana',
14
15
  };
16
+ exports.MODULES = [
17
+ 'binance',
18
+ 'cardano',
19
+ 'eos',
20
+ 'ethereum',
21
+ 'nem',
22
+ 'ripple',
23
+ 'solana',
24
+ 'stellar',
25
+ 'tezos',
26
+ ];
15
27
  //# sourceMappingURL=network.js.map
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import EventEmitter from 'events';
3
3
  import { TransportInfo, CoreMessage } from '../events';
4
+ import { AbstractMethod } from './AbstractMethod';
4
5
  import { LogWriter } from '../utils/debug';
5
6
  import type { ConnectSettings } from '../types';
6
7
  export declare const handleMessage: (message: CoreMessage) => void;
@@ -8,8 +9,9 @@ export declare const onCall: (message: CoreMessage) => Promise<void>;
8
9
  export declare class Core extends EventEmitter {
9
10
  handleMessage(message: any): void;
10
11
  dispose(): Promise<void>;
11
- getCurrentMethod(): (import("../api").applyFlags | import("../api").applySettings | import("../api").authenticateDevice | import("../api").authorizeCoinjoin | import("../api").cancelCoinjoinAuthorization | import("../api").showDeviceTutorial | import("../api").backupDevice | import("../api").binanceGetAddress | import("../api").binanceGetPublicKey | import("../api").binanceSignTransaction | import("../api").blockchainDisconnect | import("../api").blockchainEstimateFee | import("../api").blockchainGetAccountBalanceHistory | import("../api").blockchainGetCurrentFiatRates | import("../api").blockchainGetFiatRatesForTimestamps | import("../api").blockchainGetTransactions | import("../api").blockchainSetCustomBackend | import("../api").blockchainSubscribe | import("../api").blockchainSubscribeFiatRates | import("../api").blockchainUnsubscribe | import("../api").blockchainUnsubscribeFiatRates | import("../api").cardanoGetAddress | import("../api").cardanoGetNativeScriptHash | import("../api").cardanoGetPublicKey | import("../api").cardanoSignTransaction | import("../api").changePin | import("../api").cipherKeyValue | import("../api").composeTransaction | import("../api").eosGetPublicKey | import("../api").eosSignTransaction | import("../api").ethereumGetAddress | import("../api").ethereumGetPublicKey | import("../api").ethereumSignMessage | import("../api").ethereumSignTransaction | import("../api").ethereumSignTypedData | import("../api").ethereumVerifyMessage | import("../api").firmwareUpdate | import("../api").getAccountInfo | import("../api").getAddress | import("../api").getCoinInfo | import("../api").getDeviceState | import("../api").getFeatures | import("../api").getFirmwareHash | import("../api").getOwnershipId | import("../api").getOwnershipProof | import("../api").getPublicKey | import("../api").getSettings | import("../api").nemGetAddress | import("../api").nemSignTransaction | import("../api").pushTransaction | import("../api").rebootToBootloader | import("../api").recoveryDevice | import("../api").requestLogin | import("../api").resetDevice | import("../api").rippleGetAddress | import("../api").rippleSignTransaction | import("../api").setBusy | import("../api").setProxy | import("../api").signMessage | import("../api").signTransaction | import("../api").stellarGetAddress | import("../api").stellarSignTransaction | import("../api").tezosGetAddress | import("../api").tezosGetPublicKey | import("../api").tezosSignTransaction | import("../api").unlockPath | import("../api").verifyMessage | import("../api").wipeDevice | import("../api").checkFirmwareAuthenticity)[];
12
+ getCurrentMethod(): Promise<AbstractMethod<any, undefined>>;
12
13
  getTransportInfo(): TransportInfo | undefined;
14
+ enumerate(): void;
13
15
  }
14
16
  export declare const initCore: (settings: ConnectSettings, logWriterFactory?: () => LogWriter | undefined) => Promise<Core>;
15
17
  export declare const initTransport: (settings: ConnectSettings) => Promise<void>;
package/lib/core/index.js CHANGED
@@ -19,11 +19,12 @@ let _core;
19
19
  let _deviceList;
20
20
  let _popupPromise;
21
21
  const _uiPromises = [];
22
- const _callMethods = [];
23
22
  let _preferredDevice;
23
+ const _callMethods = [];
24
24
  let _interactionTimeout;
25
25
  let _deviceListInitTimeout;
26
26
  let _overridePromise;
27
+ let _getMethodPromise;
27
28
  const _log = (0, debug_1.initLog)('Core');
28
29
  const postMessage = (message) => {
29
30
  if (message.event === events_2.RESPONSE_EVENT) {
@@ -165,7 +166,10 @@ const onCall = async (message) => {
165
166
  let method;
166
167
  let messageResponse;
167
168
  try {
168
- method = (0, method_1.getMethod)(message);
169
+ _log.debug('loading method...');
170
+ _getMethodPromise = (0, method_1.getMethod)(message);
171
+ method = await _getMethodPromise;
172
+ _log.debug('method selected', method.name);
169
173
  method.postMessage = postMessage;
170
174
  method.getPopupPromise = getPopupPromise;
171
175
  method.createUiPromise = createUiPromise;
@@ -622,8 +626,11 @@ class Core extends events_1.default {
622
626
  await _deviceList.dispose();
623
627
  }
624
628
  }
625
- getCurrentMethod() {
626
- return _callMethods;
629
+ async getCurrentMethod() {
630
+ if (_getMethodPromise) {
631
+ await _getMethodPromise;
632
+ }
633
+ return _callMethods[0];
627
634
  }
628
635
  getTransportInfo() {
629
636
  if (!_deviceList) {
@@ -631,6 +638,12 @@ class Core extends events_1.default {
631
638
  }
632
639
  return _deviceList.getTransportInfo();
633
640
  }
641
+ enumerate() {
642
+ if (!_deviceList) {
643
+ return;
644
+ }
645
+ _deviceList.enumerate();
646
+ }
634
647
  }
635
648
  exports.Core = Core;
636
649
  const initCore = async (settings, logWriterFactory) => {
@@ -1,6 +1,6 @@
1
- import * as Methods from '../api';
2
1
  import type { IFrameCallMessage } from '../events';
2
+ import type { AbstractMethod } from './AbstractMethod';
3
3
  export declare const getMethod: (message: IFrameCallMessage & {
4
4
  id?: number;
5
- }) => Methods.applyFlags | Methods.applySettings | Methods.authenticateDevice | Methods.authorizeCoinjoin | Methods.cancelCoinjoinAuthorization | Methods.showDeviceTutorial | Methods.backupDevice | Methods.binanceGetAddress | Methods.binanceGetPublicKey | Methods.binanceSignTransaction | Methods.blockchainDisconnect | Methods.blockchainEstimateFee | Methods.blockchainGetAccountBalanceHistory | Methods.blockchainGetCurrentFiatRates | Methods.blockchainGetFiatRatesForTimestamps | Methods.blockchainGetTransactions | Methods.blockchainSetCustomBackend | Methods.blockchainSubscribe | Methods.blockchainSubscribeFiatRates | Methods.blockchainUnsubscribe | Methods.blockchainUnsubscribeFiatRates | Methods.cardanoGetAddress | Methods.cardanoGetNativeScriptHash | Methods.cardanoGetPublicKey | Methods.cardanoSignTransaction | Methods.changePin | Methods.cipherKeyValue | Methods.composeTransaction | Methods.eosGetPublicKey | Methods.eosSignTransaction | Methods.ethereumGetAddress | Methods.ethereumGetPublicKey | Methods.ethereumSignMessage | Methods.ethereumSignTransaction | Methods.ethereumSignTypedData | Methods.ethereumVerifyMessage | Methods.firmwareUpdate | Methods.getAccountInfo | Methods.getAddress | Methods.getCoinInfo | Methods.getDeviceState | Methods.getFeatures | Methods.getFirmwareHash | Methods.getOwnershipId | Methods.getOwnershipProof | Methods.getPublicKey | Methods.getSettings | Methods.nemGetAddress | Methods.nemSignTransaction | Methods.pushTransaction | Methods.rebootToBootloader | Methods.recoveryDevice | Methods.requestLogin | Methods.resetDevice | Methods.rippleGetAddress | Methods.rippleSignTransaction | Methods.setBusy | Methods.setProxy | Methods.signMessage | Methods.signTransaction | Methods.stellarGetAddress | Methods.stellarSignTransaction | Methods.tezosGetAddress | Methods.tezosGetPublicKey | Methods.tezosSignTransaction | Methods.unlockPath | Methods.verifyMessage | Methods.wipeDevice | Methods.checkFirmwareAuthenticity;
5
+ }) => Promise<AbstractMethod<any>>;
6
6
  //# sourceMappingURL=method.d.ts.map
@@ -4,12 +4,18 @@ exports.getMethod = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Methods = tslib_1.__importStar(require("../api"));
6
6
  const errors_1 = require("../constants/errors");
7
- const getMethod = (message) => {
7
+ const network_1 = require("../constants/network");
8
+ const getMethodModule = (method) => network_1.MODULES.find(module => method.startsWith(module));
9
+ const getMethod = async (message) => {
8
10
  const { method } = message.payload;
9
11
  if (typeof method !== 'string') {
10
12
  throw (0, errors_1.TypedError)('Method_InvalidParameter', 'Message method is not set');
11
13
  }
12
- const MethodConstructor = Methods[method];
14
+ const methodModule = getMethodModule(method);
15
+ const methods = methodModule
16
+ ? await Promise.resolve(`${`../api/${methodModule}/api`}`).then(s => tslib_1.__importStar(require(s)))
17
+ : Methods;
18
+ const MethodConstructor = methods[method];
13
19
  if (MethodConstructor) {
14
20
  return new MethodConstructor(message);
15
21
  }
@@ -0,0 +1,5 @@
1
+ import type { IFrameCallMessage } from '../events';
2
+ export declare const getMethod: (message: IFrameCallMessage & {
3
+ id?: number;
4
+ }) => Promise<any>;
5
+ //# sourceMappingURL=method.native.d.ts.map
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMethod = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const Methods = tslib_1.__importStar(require("../api"));
6
+ const errors_1 = require("../constants/errors");
7
+ const network_1 = require("../constants/network");
8
+ const moduleMethods = {
9
+ binance: require('../api/binance/api'),
10
+ cardano: require('../api/cardano/api'),
11
+ eos: require('../api/eos/api'),
12
+ ethereum: require('../api/ethereum/api'),
13
+ nem: require('../api/nem/api'),
14
+ ripple: require('../api/ripple/api'),
15
+ solana: require('../api/solana/api'),
16
+ stellar: require('../api/stellar/api'),
17
+ tezos: require('../api/tezos/api'),
18
+ };
19
+ const getMethodModule = (method) => network_1.MODULES.find(module => method.startsWith(module));
20
+ const getMethod = async (message) => {
21
+ const { method } = message.payload;
22
+ if (typeof method !== 'string') {
23
+ throw (0, errors_1.TypedError)('Method_InvalidParameter', 'Message method is not set');
24
+ }
25
+ const methodModule = getMethodModule(method);
26
+ const methods = methodModule ? moduleMethods[methodModule] : Methods;
27
+ const MethodConstructor = methods[method];
28
+ if (MethodConstructor) {
29
+ return new MethodConstructor(message);
30
+ }
31
+ throw (0, errors_1.TypedError)('Method_InvalidParameter', `Method ${method} not found`);
32
+ };
33
+ exports.getMethod = getMethod;
34
+ //# sourceMappingURL=method.native.js.map
@@ -145,6 +145,17 @@ export declare class DataManager {
145
145
  max?: undefined;
146
146
  comment?: undefined;
147
147
  capabilities?: undefined;
148
+ } | {
149
+ methods: string[];
150
+ min: {
151
+ T1B1: string;
152
+ T2T1: string;
153
+ T2B1: string;
154
+ };
155
+ coin?: undefined;
156
+ max?: undefined;
157
+ comment?: undefined;
158
+ capabilities?: undefined;
148
159
  })[];
149
160
  };
150
161
  }
@@ -133,6 +133,17 @@ export declare const config: {
133
133
  max?: undefined;
134
134
  comment?: undefined;
135
135
  capabilities?: undefined;
136
+ } | {
137
+ methods: string[];
138
+ min: {
139
+ T1B1: string;
140
+ T2T1: string;
141
+ T2B1: string;
142
+ };
143
+ coin?: undefined;
144
+ max?: undefined;
145
+ comment?: undefined;
146
+ capabilities?: undefined;
136
147
  })[];
137
148
  };
138
149
  //# sourceMappingURL=config.d.ts.map
@@ -212,6 +212,10 @@ exports.config = {
212
212
  methods: ['getFirmwareHash'],
213
213
  min: { T1B1: '1.11.1', T2T1: '2.5.1' },
214
214
  },
215
+ {
216
+ methods: ['solanaGetPublicKey', 'solanaGetAddress', 'solanaSignTransaction'],
217
+ min: { T1B1: '0', T2T1: '2.7.0', T2B1: '2.7.0' },
218
+ },
215
219
  ],
216
220
  };
217
221
  //# sourceMappingURL=config.js.map
@@ -20,6 +20,7 @@ const initialSettings = {
20
20
  lazyLoad: false,
21
21
  timestamp: new Date().getTime(),
22
22
  interactionTimeout: 600,
23
+ sharedLogger: true,
23
24
  };
24
25
  const parseManifest = (manifest) => {
25
26
  if (!manifest)
@@ -103,6 +104,9 @@ const parseConnectSettings = (input = {}) => {
103
104
  if (typeof input.manifest === 'object') {
104
105
  settings.manifest = parseManifest(input.manifest);
105
106
  }
107
+ if (typeof input.sharedLogger === 'boolean') {
108
+ settings.sharedLogger = input.sharedLogger;
109
+ }
106
110
  return settings;
107
111
  };
108
112
  exports.parseConnectSettings = parseConnectSettings;
@@ -64,11 +64,19 @@ const CARDANO_FEE_INFO = {
64
64
  maxFee: 16384 * 44 + 155381,
65
65
  dustLimit: -1,
66
66
  };
67
+ const SOLANA_FEE_INFO = {
68
+ blockTime: -1,
69
+ defaultFees: [{ label: 'normal', feePerUnit: '5000', blocks: -1 }],
70
+ minFee: -1,
71
+ maxFee: -1,
72
+ dustLimit: -1,
73
+ };
67
74
  const MISC_FEE_LEVELS = {
68
75
  xrp: RIPPLE_FEE_INFO,
69
76
  txrp: RIPPLE_FEE_INFO,
70
77
  ada: CARDANO_FEE_INFO,
71
78
  tada: CARDANO_FEE_INFO,
79
+ sol: SOLANA_FEE_INFO,
72
80
  };
73
81
  const getMiscFeeLevels = (data) => {
74
82
  const shortcut = data.shortcut.toLowerCase();
@@ -1,3 +1,3 @@
1
- export declare const VERSION = "9.1.5";
1
+ export declare const VERSION = "9.1.6";
2
2
  export declare const DEFAULT_DOMAIN: string;
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -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.1.5';
4
+ exports.VERSION = '9.1.6';
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
@@ -90,7 +90,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
90
90
  dispose(): import("packages/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;
91
91
  getMode(): "normal" | "bootloader" | "initialize" | "seedless";
92
92
  toMessageObject(): DeviceTyped;
93
- _getNetworkTypeState(): "bitcoin" | "ethereum" | "nem" | "eos" | "stellar" | "cardano" | "ripple" | "tezos" | "binance";
93
+ _getNetworkTypeState(): "binance" | "cardano" | "eos" | "ethereum" | "nem" | "ripple" | "solana" | "stellar" | "tezos" | "bitcoin";
94
94
  _setNetworkTypeState(networkType?: NETWORK.NetworkType): void;
95
95
  _altModeChange(networkType?: NETWORK.NetworkType): boolean;
96
96
  _isAltModeNetworkType(networkType?: keyof typeof NETWORK.TYPES): boolean;
@@ -117,7 +117,10 @@ class Device extends typedEventEmitter_1.TypedEmitter {
117
117
  options = parseRunOptions(options);
118
118
  const runPromise = (0, utils_1.createDeferred)();
119
119
  this.runPromise = runPromise;
120
- return Promise.race([this._runInner(fn, options), runPromise.promise]);
120
+ this._runInner(fn, options).catch(err => {
121
+ runPromise.reject(err);
122
+ });
123
+ return runPromise.promise;
121
124
  }
122
125
  async override(error) {
123
126
  if (this.acquirePromise) {
@@ -327,7 +330,13 @@ class Device extends typedEventEmitter_1.TypedEmitter {
327
330
  }
328
331
  this.features = feat;
329
332
  this.featuresNeedsReload = false;
330
- if (this.getMode() !== 'bootloader') {
333
+ if (feat.fw_vendor === 'Trezor Bitcoin-only') {
334
+ this.firmwareType = types_1.FirmwareType.BitcoinOnly;
335
+ }
336
+ else if (feat.fw_vendor === 'Trezor') {
337
+ this.firmwareType = types_1.FirmwareType.Regular;
338
+ }
339
+ else if (this.getMode() !== 'bootloader') {
331
340
  this.firmwareType =
332
341
  feat.capabilities &&
333
342
  feat.capabilities.length > 0 &&
@@ -474,6 +474,15 @@ class DeviceCommands {
474
474
  address_n,
475
475
  };
476
476
  }
477
+ if (coinInfo.shortcut === 'SOL' || coinInfo.shortcut === 'DSOL') {
478
+ const { message } = await this.typedCall('SolanaGetAddress', 'SolanaAddress', {
479
+ address_n,
480
+ });
481
+ return {
482
+ descriptor: message.address,
483
+ address_n,
484
+ };
485
+ }
477
486
  throw constants_1.ERRORS.TypedError('Runtime', 'DeviceCommands.getAccountDescriptor: unsupported coinInfo.type');
478
487
  }
479
488
  async cancel() {
@@ -60,7 +60,10 @@ class DeviceList extends typedEventEmitter_1.TypedEmitter {
60
60
  }
61
61
  }
62
62
  else if (transportType instanceof transport_1.Transport) {
63
- this.transports.unshift(transportType);
63
+ if (!transportType.getMessage()) {
64
+ transportType.updateMessages(this.messages);
65
+ }
66
+ this.transports.push(transportType);
64
67
  }
65
68
  else {
66
69
  throw constants_1.ERRORS.TypedError('Runtime', 'DeviceList.init: transports[] of unexpected type');
@@ -5,6 +5,7 @@ import type { MessageFactoryFn } from '../types/utils';
5
5
  export declare const POPUP: {
6
6
  readonly BOOTSTRAP: "popup-bootstrap";
7
7
  readonly LOADED: "popup-loaded";
8
+ readonly CORE_LOADED: "popup-core-loaded";
8
9
  readonly INIT: "popup-init";
9
10
  readonly ERROR: "popup-error";
10
11
  readonly EXTENSION_USB_PERMISSIONS: "open-usb-permissions";
@@ -13,6 +14,8 @@ export declare const POPUP: {
13
14
  readonly CANCEL_POPUP_REQUEST: "ui-cancel-popup-request";
14
15
  readonly CLOSE_WINDOW: "window.close";
15
16
  readonly ANALYTICS_RESPONSE: "popup-analytics-response";
17
+ readonly CONTENT_SCRIPT_LOADED: "popup-content-script-loaded";
18
+ readonly METHOD_INFO: "popup-method-info";
16
19
  };
17
20
  export interface PopupInit {
18
21
  type: typeof POPUP.INIT;
@@ -20,13 +23,13 @@ export interface PopupInit {
20
23
  settings: ConnectSettings;
21
24
  useBroadcastChannel: boolean;
22
25
  systemInfo: SystemInfo;
26
+ useCore?: boolean;
23
27
  };
24
28
  }
25
29
  export interface PopupHandshake {
26
30
  type: typeof POPUP.HANDSHAKE;
27
31
  payload: {
28
32
  settings: ConnectSettings;
29
- method?: string;
30
33
  transport?: TransportInfo;
31
34
  };
32
35
  }
@@ -48,10 +51,23 @@ export interface PopupAnalyticsResponse {
48
51
  enabled: boolean;
49
52
  };
50
53
  }
54
+ export interface PopupMethodInfo {
55
+ type: typeof POPUP.METHOD_INFO;
56
+ payload: {
57
+ info: string;
58
+ method: string;
59
+ };
60
+ }
61
+ export interface PopupContentScriptLoaded {
62
+ type: typeof POPUP.CONTENT_SCRIPT_LOADED;
63
+ payload: {
64
+ id: string;
65
+ };
66
+ }
51
67
  export type PopupEvent = {
52
- type: typeof POPUP.LOADED | typeof POPUP.CANCEL_POPUP_REQUEST;
68
+ type: typeof POPUP.LOADED | typeof POPUP.CORE_LOADED | typeof POPUP.CANCEL_POPUP_REQUEST;
53
69
  payload?: typeof undefined;
54
- } | PopupInit | PopupHandshake | PopupError | PopupClosedMessage | PopupAnalyticsResponse;
70
+ } | PopupInit | PopupHandshake | PopupError | PopupClosedMessage | PopupAnalyticsResponse | PopupContentScriptLoaded | PopupMethodInfo;
55
71
  export type PopupEventMessage = PopupEvent & {
56
72
  event: typeof UI_EVENT;
57
73
  };
@@ -5,6 +5,7 @@ const ui_request_1 = require("./ui-request");
5
5
  exports.POPUP = {
6
6
  BOOTSTRAP: 'popup-bootstrap',
7
7
  LOADED: 'popup-loaded',
8
+ CORE_LOADED: 'popup-core-loaded',
8
9
  INIT: 'popup-init',
9
10
  ERROR: 'popup-error',
10
11
  EXTENSION_USB_PERMISSIONS: 'open-usb-permissions',
@@ -13,6 +14,8 @@ exports.POPUP = {
13
14
  CANCEL_POPUP_REQUEST: 'ui-cancel-popup-request',
14
15
  CLOSE_WINDOW: 'window.close',
15
16
  ANALYTICS_RESPONSE: 'popup-analytics-response',
17
+ CONTENT_SCRIPT_LOADED: 'popup-content-script-loaded',
18
+ METHOD_INFO: 'popup-method-info',
16
19
  };
17
20
  const createPopupMessage = (type, payload) => ({
18
21
  event: ui_request_1.UI_EVENT,
package/lib/factory.js CHANGED
@@ -42,6 +42,7 @@ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse,
42
42
  cardanoGetNativeScriptHash: params => call({ ...params, method: 'cardanoGetNativeScriptHash' }),
43
43
  cardanoGetPublicKey: params => call({ ...params, method: 'cardanoGetPublicKey' }),
44
44
  cardanoSignTransaction: params => call({ ...params, method: 'cardanoSignTransaction' }),
45
+ cardanoComposeTransaction: params => call({ ...params, method: 'cardanoComposeTransaction' }),
45
46
  cipherKeyValue: params => call({ ...params, method: 'cipherKeyValue' }),
46
47
  composeTransaction: params => call({ ...params, method: 'composeTransaction' }),
47
48
  ethereumGetAddress: params => call({
@@ -54,6 +55,7 @@ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse,
54
55
  ethereumSignTransaction: params => call({ ...params, method: 'ethereumSignTransaction' }),
55
56
  ethereumSignTypedData: params => call({ ...params, method: 'ethereumSignTypedData' }),
56
57
  ethereumVerifyMessage: params => call({ ...params, method: 'ethereumVerifyMessage' }),
58
+ getAccountDescriptor: params => call({ ...params, method: 'getAccountDescriptor' }),
57
59
  getAccountInfo: params => call({ ...params, method: 'getAccountInfo' }),
58
60
  getAddress: params => call({
59
61
  ...params,
@@ -81,6 +83,9 @@ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse,
81
83
  rippleSignTransaction: params => call({ ...params, method: 'rippleSignTransaction' }),
82
84
  signMessage: params => call({ ...params, method: 'signMessage' }),
83
85
  signTransaction: params => call({ ...params, method: 'signTransaction' }),
86
+ solanaGetPublicKey: params => call({ ...params, method: 'solanaGetPublicKey' }),
87
+ solanaGetAddress: params => call({ ...params, method: 'solanaGetAddress' }),
88
+ solanaSignTransaction: params => call({ ...params, method: 'solanaSignTransaction' }),
84
89
  stellarGetAddress: params => call({
85
90
  ...params,
86
91
  method: 'stellarGetAddress',
@@ -0,0 +1,44 @@
1
+ import type { types, trezorUtils } from '@fivebinaries/coin-selection';
2
+ import type { AccountAddresses, AccountUtxo } from '../../exports';
3
+ import type { Params, Response } from '../params';
4
+ import type { CardanoCertificate, CardanoInput, CardanoOutput } from './cardano';
5
+ import type { PrecomposeResultFinal, PrecomposeResultNonFinal, PrecomposeResultError } from './composeTransaction';
6
+ export type PrecomposedTransactionFinalCardano = Omit<PrecomposeResultFinal, 'inputs' | 'outputs' | 'outputsPermutation'> & {
7
+ deposit?: string;
8
+ ttl?: number;
9
+ inputs: CardanoInput[];
10
+ outputs: CardanoOutput[];
11
+ unsignedTx: {
12
+ body: string;
13
+ hash: string;
14
+ };
15
+ };
16
+ export type PrecomposedTransactionNonFinalCardano = Omit<PrecomposeResultNonFinal, 'inputs'> & {
17
+ deposit?: string;
18
+ };
19
+ export type PrecomposedTransactionErrorCardano = PrecomposeResultError | {
20
+ type: 'error';
21
+ error: 'UTXO_BALANCE_INSUFFICIENT' | 'UTXO_VALUE_TOO_SMALL';
22
+ };
23
+ export type PrecomposedTransactionCardano = PrecomposedTransactionFinalCardano | PrecomposedTransactionNonFinalCardano | PrecomposedTransactionErrorCardano;
24
+ export type CardanoComposeTransactionParams = {
25
+ account: {
26
+ descriptor: string;
27
+ addresses: AccountAddresses;
28
+ utxo: AccountUtxo[];
29
+ };
30
+ feeLevels?: {
31
+ feePerUnit?: string;
32
+ }[];
33
+ outputs?: types.UserOutput[];
34
+ certificates?: CardanoCertificate[];
35
+ withdrawals?: types.Withdrawal[];
36
+ changeAddress: {
37
+ address: string;
38
+ path: string;
39
+ };
40
+ addressParameters: Parameters<(typeof trezorUtils)['transformToTrezorOutputs']>[1];
41
+ testnet?: boolean;
42
+ };
43
+ export declare function cardanoComposeTransaction(params: Params<CardanoComposeTransactionParams>): Response<PrecomposedTransactionCardano[]>;
44
+ //# sourceMappingURL=cardanoComposeTransaction.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=cardanoComposeTransaction.js.map
@@ -1,4 +1,13 @@
1
1
  import type { Params, Response } from '../params';
2
2
  import type { CardanoSignTransaction, CardanoSignedTxData } from './cardano';
3
3
  export declare function cardanoSignTransaction(params: Params<CardanoSignTransaction>): Response<CardanoSignedTxData>;
4
+ export declare function cardanoSignTransaction(params: Params<CardanoSignTransaction & {
5
+ unsignedTx: {
6
+ body: string;
7
+ hash: string;
8
+ };
9
+ testnet: boolean;
10
+ }>): Response<CardanoSignedTxData & {
11
+ serializedTx: string;
12
+ }>;
4
13
  //# sourceMappingURL=cardanoSignTransaction.d.ts.map