@trezor/connect 9.0.11 → 9.1.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.
Files changed (171) hide show
  1. package/CHANGELOG.md +22 -3
  2. package/README.md +20 -3
  3. package/lib/api/backupDevice.d.ts +1 -1
  4. package/lib/api/binanceGetAddress.d.ts +1 -0
  5. package/lib/api/binanceGetAddress.js +4 -4
  6. package/lib/api/binanceGetPublicKey.d.ts +1 -0
  7. package/lib/api/binanceGetPublicKey.js +3 -1
  8. package/lib/api/binanceSignTransaction.d.ts +2 -1
  9. package/lib/api/binanceSignTransaction.js +3 -1
  10. package/lib/api/bitcoin/Fees.d.ts +2 -2
  11. package/lib/api/bitcoin/Fees.js +32 -90
  12. package/lib/api/bitcoin/TransactionComposer.d.ts +1 -2
  13. package/lib/api/bitcoin/TransactionComposer.js +3 -2
  14. package/lib/api/bitcoin/createPendingTx.d.ts +1 -0
  15. package/lib/api/bitcoin/createPendingTx.js +1 -0
  16. package/lib/api/bitcoin/refTx.d.ts +10 -2
  17. package/lib/api/bitcoin/refTx.js +46 -19
  18. package/lib/api/blockchainDisconnect.d.ts +1 -0
  19. package/lib/api/blockchainDisconnect.js +3 -1
  20. package/lib/api/blockchainEstimateFee.js +1 -1
  21. package/lib/api/blockchainSetCustomBackend.d.ts +1 -0
  22. package/lib/api/blockchainSetCustomBackend.js +3 -1
  23. package/lib/api/cancelCoinjoinAuthorization.d.ts +8 -0
  24. package/lib/api/cancelCoinjoinAuthorization.js +27 -0
  25. package/lib/api/cardanoGetAddress.d.ts +1 -0
  26. package/lib/api/cardanoGetAddress.js +4 -4
  27. package/lib/api/cardanoGetNativeScriptHash.d.ts +1 -0
  28. package/lib/api/cardanoGetNativeScriptHash.js +3 -1
  29. package/lib/api/cardanoGetPublicKey.d.ts +2 -0
  30. package/lib/api/cardanoGetPublicKey.js +12 -1
  31. package/lib/api/cardanoSignTransaction.d.ts +1 -0
  32. package/lib/api/cardanoSignTransaction.js +3 -1
  33. package/lib/api/checkFirmwareAuthenticity.js +2 -1
  34. package/lib/api/cipherKeyValue.d.ts +1 -0
  35. package/lib/api/cipherKeyValue.js +5 -2
  36. package/lib/api/composeTransaction.d.ts +3 -0
  37. package/lib/api/composeTransaction.js +9 -7
  38. package/lib/api/eosGetPublicKey.d.ts +1 -0
  39. package/lib/api/eosGetPublicKey.js +3 -1
  40. package/lib/api/eosSignTransaction.d.ts +1 -0
  41. package/lib/api/eosSignTransaction.js +3 -1
  42. package/lib/api/ethereum/ethereumDefinitions.d.ts +28 -6
  43. package/lib/api/ethereum/ethereumDefinitions.js +60 -1
  44. package/lib/api/ethereum/ethereumSignTx.d.ts +1 -1
  45. package/lib/api/ethereumGetAddress.d.ts +2 -0
  46. package/lib/api/ethereumGetAddress.js +28 -26
  47. package/lib/api/ethereumGetPublicKey.d.ts +1 -0
  48. package/lib/api/ethereumGetPublicKey.js +8 -10
  49. package/lib/api/ethereumSignMessage.d.ts +10 -1
  50. package/lib/api/ethereumSignMessage.js +14 -13
  51. package/lib/api/ethereumSignTransaction.d.ts +6 -0
  52. package/lib/api/ethereumSignTransaction.js +18 -5
  53. package/lib/api/ethereumSignTypedData.d.ts +6 -0
  54. package/lib/api/ethereumSignTypedData.js +15 -13
  55. package/lib/api/ethereumVerifyMessage.d.ts +1 -0
  56. package/lib/api/ethereumVerifyMessage.js +3 -1
  57. package/lib/api/getAccountInfo.d.ts +3 -0
  58. package/lib/api/getAccountInfo.js +3 -1
  59. package/lib/api/getAddress.d.ts +1 -0
  60. package/lib/api/getAddress.js +8 -10
  61. package/lib/api/getFeatures.d.ts +1 -1
  62. package/lib/api/getOwnershipId.d.ts +1 -0
  63. package/lib/api/getOwnershipId.js +3 -1
  64. package/lib/api/getOwnershipProof.d.ts +1 -0
  65. package/lib/api/getOwnershipProof.js +3 -1
  66. package/lib/api/getPublicKey.d.ts +2 -0
  67. package/lib/api/getPublicKey.js +12 -1
  68. package/lib/api/index.d.ts +2 -0
  69. package/lib/api/index.js +6 -2
  70. package/lib/api/nemGetAddress.d.ts +1 -0
  71. package/lib/api/nemGetAddress.js +4 -4
  72. package/lib/api/nemSignTransaction.d.ts +1 -0
  73. package/lib/api/nemSignTransaction.js +3 -1
  74. package/lib/api/rebootToBootloader.d.ts +2 -1
  75. package/lib/api/rebootToBootloader.js +4 -2
  76. package/lib/api/requestLogin.d.ts +1 -0
  77. package/lib/api/requestLogin.js +3 -1
  78. package/lib/api/resetDevice.d.ts +1 -0
  79. package/lib/api/resetDevice.js +3 -1
  80. package/lib/api/rippleGetAddress.d.ts +1 -0
  81. package/lib/api/rippleGetAddress.js +4 -4
  82. package/lib/api/rippleSignTransaction.d.ts +1 -0
  83. package/lib/api/rippleSignTransaction.js +3 -1
  84. package/lib/api/showDeviceTutorial.d.ts +8 -0
  85. package/lib/api/showDeviceTutorial.js +23 -0
  86. package/lib/api/signMessage.d.ts +1 -0
  87. package/lib/api/signMessage.js +5 -1
  88. package/lib/api/signTransaction.d.ts +1 -0
  89. package/lib/api/signTransaction.js +16 -4
  90. package/lib/api/stellarGetAddress.d.ts +1 -0
  91. package/lib/api/stellarGetAddress.js +4 -4
  92. package/lib/api/stellarSignTransaction.d.ts +1 -0
  93. package/lib/api/stellarSignTransaction.js +3 -1
  94. package/lib/api/tezosGetAddress.d.ts +1 -0
  95. package/lib/api/tezosGetAddress.js +4 -4
  96. package/lib/api/tezosGetPublicKey.d.ts +1 -0
  97. package/lib/api/tezosGetPublicKey.js +3 -1
  98. package/lib/api/tezosSignTransaction.d.ts +1 -0
  99. package/lib/api/tezosSignTransaction.js +3 -1
  100. package/lib/api/verifyMessage.d.ts +1 -0
  101. package/lib/api/verifyMessage.js +7 -2
  102. package/lib/api/wipeDevice.d.ts +2 -1
  103. package/lib/api/wipeDevice.js +3 -1
  104. package/lib/backend/Blockchain.d.ts +1 -3
  105. package/lib/backend/Blockchain.js +10 -6
  106. package/lib/constants/errors.d.ts +0 -3
  107. package/lib/constants/errors.js +1 -4
  108. package/lib/constants/index.d.ts +1 -1
  109. package/lib/constants/index.js +1 -1
  110. package/lib/core/AbstractMethod.d.ts +3 -1
  111. package/lib/core/AbstractMethod.js +3 -1
  112. package/lib/core/index.d.ts +5 -6
  113. package/lib/core/index.js +53 -51
  114. package/lib/core/method.d.ts +1 -1
  115. package/lib/data/DataManager.js +4 -1
  116. package/lib/data/analyticsInfo.js +1 -1
  117. package/lib/data/coinInfo.d.ts +9 -1
  118. package/lib/data/coinInfo.js +16 -54
  119. package/lib/data/config.js +12 -2
  120. package/lib/data/defaultFeeLevels.d.ts +17 -0
  121. package/lib/data/defaultFeeLevels.js +84 -0
  122. package/lib/data/version.d.ts +1 -1
  123. package/lib/data/version.js +1 -1
  124. package/lib/device/Device.d.ts +10 -12
  125. package/lib/device/Device.js +69 -102
  126. package/lib/device/DeviceCommands.d.ts +4 -3
  127. package/lib/device/DeviceCommands.js +46 -19
  128. package/lib/device/DeviceList.d.ts +15 -25
  129. package/lib/device/DeviceList.js +224 -258
  130. package/lib/events/popup.d.ts +8 -1
  131. package/lib/events/popup.js +1 -0
  132. package/lib/events/transport.d.ts +2 -9
  133. package/lib/events/transport.js +3 -10
  134. package/lib/events/ui-request.d.ts +2 -2
  135. package/lib/factory.js +2 -0
  136. package/lib/index.js +7 -7
  137. package/lib/types/account.d.ts +1 -20
  138. package/lib/types/api/bitcoin/index.d.ts +2 -0
  139. package/lib/types/api/blockchainEstimateFee.d.ts +2 -5
  140. package/lib/types/api/cancelCoinjoinAuthorization.d.ts +8 -0
  141. package/lib/types/api/cancelCoinjoinAuthorization.js +3 -0
  142. package/lib/types/api/index.d.ts +4 -0
  143. package/lib/types/api/showDeviceTutorial.d.ts +4 -0
  144. package/lib/types/api/showDeviceTutorial.js +3 -0
  145. package/lib/types/coinInfo.d.ts +5 -17
  146. package/lib/types/device.d.ts +5 -2
  147. package/lib/types/device.js +8 -0
  148. package/lib/types/fees.d.ts +26 -0
  149. package/lib/types/fees.js +3 -0
  150. package/lib/types/index.d.ts +2 -1
  151. package/lib/types/index.js +1 -0
  152. package/lib/types/settings.d.ts +1 -1
  153. package/lib/utils/assetUtils.js +3 -1
  154. package/lib/utils/debug.js +2 -1
  155. package/lib/utils/deviceFeaturesUtils.d.ts +2 -1
  156. package/lib/utils/deviceFeaturesUtils.js +12 -1
  157. package/lib/utils/urlUtils.d.ts +10 -3
  158. package/lib/utils/urlUtils.js +5 -9
  159. package/lib/workers/workers-browser.d.ts +1 -3
  160. package/lib/workers/workers-browser.js +1 -7
  161. package/lib/workers/workers-react-native.d.ts +1 -3
  162. package/lib/workers/workers-react-native.js +1 -7
  163. package/lib/workers/workers.d.ts +1 -5
  164. package/lib/workers/workers.js +1 -5
  165. package/package.json +17 -12
  166. package/lib/device/DescriptorStream.d.ts +0 -28
  167. package/lib/device/DescriptorStream.js +0 -139
  168. package/lib/utils/objectUtils.d.ts +0 -10
  169. package/lib/utils/objectUtils.js +0 -37
  170. package/lib/workers/RNUsbPlugin.d.ts +0 -31
  171. package/lib/workers/RNUsbPlugin.js +0 -65
@@ -1,5 +1,7 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { EthereumTransaction, EthereumTransactionEIP1559 } from '../types/api/ethereum';
3
+ import type { EthereumNetworkInfo } from '../types';
4
+ import type { EthereumDefinitions } from '@trezor/protobuf/lib/messages';
3
5
  type Params = {
4
6
  path: number[];
5
7
  tx: ({
@@ -7,9 +9,13 @@ type Params = {
7
9
  } & EthereumTransaction) | ({
8
10
  type: 'eip1559';
9
11
  } & EthereumTransactionEIP1559);
12
+ network?: EthereumNetworkInfo;
13
+ definitions?: EthereumDefinitions;
10
14
  };
11
15
  export default class EthereumSignTransaction extends AbstractMethod<'ethereumSignTransaction', Params> {
12
16
  init(): void;
17
+ initAsync(): Promise<void>;
18
+ get info(): string;
13
19
  run(): Promise<{
14
20
  v: string;
15
21
  r: string;
@@ -35,7 +35,6 @@ class EthereumSignTransaction extends AbstractMethod_1.AbstractMethod {
35
35
  ]);
36
36
  const path = (0, pathUtils_1.validatePath)(payload.path, 3);
37
37
  const network = (0, coinInfo_1.getEthereumNetwork)(path);
38
- this.info = (0, ethereumUtils_1.getNetworkLabel)('Sign #NETWORK transaction', network);
39
38
  const tx = payload.transaction;
40
39
  const isEIP1559 = tx.maxFeePerGas && tx.maxPriorityFeePerGas;
41
40
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(isEIP1559 ? 'eip1559' : this.name, network, this.firmwareRange);
@@ -70,16 +69,30 @@ class EthereumSignTransaction extends AbstractMethod_1.AbstractMethod {
70
69
  type: isEIP1559 ? 'eip1559' : 'legacy',
71
70
  ...strip(tx),
72
71
  },
72
+ network,
73
73
  };
74
74
  }
75
- async run() {
76
- const { tx } = this.params;
75
+ async initAsync() {
76
+ if (this.params.tx.chainId === 1 && !this.params.tx.data) {
77
+ return;
78
+ }
77
79
  const slip44 = (0, pathUtils_1.getSlip44ByPath)(this.params.path);
78
80
  const definitions = await (0, ethereumDefinitions_1.getEthereumDefinitions)({
79
- chainId: tx.chainId,
81
+ chainId: this.params.tx.chainId,
80
82
  slip44,
81
- contractAddress: tx.data ? tx.to : undefined,
83
+ contractAddress: this.params.tx.data ? this.params.tx.to : undefined,
82
84
  });
85
+ this.params.definitions = definitions;
86
+ const decoded = (0, ethereumDefinitions_1.decodeEthereumDefinition)(definitions);
87
+ if (decoded.network) {
88
+ this.params.network = (0, ethereumDefinitions_1.ethereumNetworkInfoFromDefinition)(decoded.network);
89
+ }
90
+ }
91
+ get info() {
92
+ return (0, ethereumUtils_1.getNetworkLabel)('Sign #NETWORK transaction', this.params.network);
93
+ }
94
+ run() {
95
+ const { tx, definitions } = this.params;
83
96
  return tx.type === 'eip1559'
84
97
  ? helper.ethereumSignTxEIP1559(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, tx.to, tx.value, tx.gasLimit, tx.maxFeePerGas, tx.maxPriorityFeePerGas, tx.nonce, tx.chainId, tx.data, tx.accessList, definitions)
85
98
  : helper.ethereumSignTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, tx.to, tx.value, tx.gasLimit, tx.gasPrice, tx.nonce, tx.chainId, tx.data, tx.txType, definitions);
@@ -1,10 +1,16 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { EthereumSignTypedDataTypes, EthereumSignTypedData as EthereumSignTypedDataParams, EthereumSignTypedHash as EthereumSignTypedHashParams } from '../types/api/ethereum';
3
+ import type { EthereumNetworkInfo } from '../types';
4
+ import type { EthereumDefinitions } from '@trezor/protobuf/lib/messages';
3
5
  type Params = (Omit<EthereumSignTypedDataParams<EthereumSignTypedDataTypes>, 'path'> | Omit<EthereumSignTypedHashParams<EthereumSignTypedDataTypes>, 'path'>) & {
4
6
  address_n: number[];
7
+ network?: EthereumNetworkInfo;
8
+ definitions?: EthereumDefinitions;
5
9
  };
6
10
  export default class EthereumSignTypedData extends AbstractMethod<'ethereumSignTypedData', Params> {
7
11
  init(): void;
12
+ initAsync(): Promise<void>;
13
+ get info(): string;
8
14
  run(): Promise<{
9
15
  address: string;
10
16
  signature: string;
@@ -9,6 +9,7 @@ const constants_1 = require("../constants");
9
9
  const ethereumSignTypedData_1 = require("./ethereum/ethereumSignTypedData");
10
10
  const formatUtils_1 = require("../utils/formatUtils");
11
11
  const ethereumDefinitions_1 = require("./ethereum/ethereumDefinitions");
12
+ const types_1 = require("../types");
12
13
  class EthereumSignTypedData extends AbstractMethod_1.AbstractMethod {
13
14
  init() {
14
15
  this.requiredPermissions = ['read', 'write'];
@@ -23,11 +24,11 @@ class EthereumSignTypedData extends AbstractMethod_1.AbstractMethod {
23
24
  const path = (0, pathUtils_1.validatePath)(payload.path, 3);
24
25
  const network = (0, coinInfo_1.getEthereumNetwork)(path);
25
26
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, network, this.firmwareRange);
26
- this.info = (0, ethereumUtils_1.getNetworkLabel)('Sign #NETWORK typed data', network);
27
27
  this.params = {
28
28
  address_n: path,
29
29
  metamask_v4_compat: payload.metamask_v4_compat,
30
30
  data: payload.data,
31
+ network,
31
32
  };
32
33
  if (payload.domain_separator_hash) {
33
34
  this.params = {
@@ -51,31 +52,32 @@ class EthereumSignTypedData extends AbstractMethod_1.AbstractMethod {
51
52
  }
52
53
  }
53
54
  }
54
- async run() {
55
- const cmd = this.device.getCommands();
55
+ async initAsync() {
56
+ if (this.params.network)
57
+ return;
56
58
  const { address_n } = this.params;
57
- const network = (0, coinInfo_1.getEthereumNetwork)(address_n);
58
59
  const slip44 = (0, pathUtils_1.getSlip44ByPath)(address_n);
59
- const definitions = await (0, ethereumDefinitions_1.getEthereumDefinitions)({
60
- chainId: network === null || network === void 0 ? void 0 : network.chainId,
60
+ this.params.definitions = await (0, ethereumDefinitions_1.getEthereumDefinitions)({
61
61
  slip44,
62
62
  });
63
- if (this.device.features.model === '1') {
63
+ }
64
+ get info() {
65
+ return (0, ethereumUtils_1.getNetworkLabel)('Sign #NETWORK typed data', (0, coinInfo_1.getEthereumNetwork)(this.params.address_n));
66
+ }
67
+ async run() {
68
+ const cmd = this.device.getCommands();
69
+ const { address_n, definitions } = this.params;
70
+ if (this.device.features.model === types_1.DeviceModelInternal.T1B1) {
64
71
  (0, paramsValidator_1.validateParams)(this.params, [
65
72
  { name: 'domain_separator_hash', type: 'string', required: true },
66
73
  { name: 'message_hash', type: 'string' },
67
74
  ]);
68
75
  const { domain_separator_hash, message_hash } = this.params;
69
- const definitionParams = {
70
- ...(definitions.encoded_network && {
71
- encoded_network: definitions.encoded_network,
72
- }),
73
- };
74
76
  const response = await cmd.typedCall('EthereumSignTypedHash', 'EthereumTypedDataSignature', {
75
77
  address_n,
76
78
  domain_separator_hash: domain_separator_hash,
77
79
  message_hash,
78
- ...definitionParams,
80
+ encoded_network: definitions === null || definitions === void 0 ? void 0 : definitions.encoded_network,
79
81
  });
80
82
  const { address, signature } = response.message;
81
83
  return {
@@ -2,6 +2,7 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { PROTO } from '../constants';
3
3
  export default class EthereumVerifyMessage extends AbstractMethod<'ethereumVerifyMessage', PROTO.EthereumVerifyMessage> {
4
4
  init(): void;
5
+ get info(): string;
5
6
  run(): Promise<PROTO.Success>;
6
7
  }
7
8
  //# sourceMappingURL=ethereumVerifyMessage.d.ts.map
@@ -7,7 +7,6 @@ class EthereumVerifyMessage extends AbstractMethod_1.AbstractMethod {
7
7
  init() {
8
8
  this.requiredPermissions = ['read', 'write'];
9
9
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
10
- this.info = 'Verify message';
11
10
  const { payload } = this;
12
11
  (0, paramsValidator_1.validateParams)(payload, [
13
12
  { name: 'address', type: 'string', required: true },
@@ -24,6 +23,9 @@ class EthereumVerifyMessage extends AbstractMethod_1.AbstractMethod {
24
23
  message: messageHex,
25
24
  };
26
25
  }
26
+ get info() {
27
+ return 'Verify message';
28
+ }
27
29
  async run() {
28
30
  const cmd = this.device.getCommands();
29
31
  const response = await cmd.typedCall('EthereumVerifyMessage', 'Success', this.params);
@@ -11,6 +11,7 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
11
11
  hasBundle?: boolean;
12
12
  discovery?: Discovery;
13
13
  init(): void;
14
+ get info(): string;
14
15
  confirmation(): Promise<boolean>;
15
16
  noBackupConfirmation(): Promise<boolean>;
16
17
  checkFirmwareRange(isUsingPopup: boolean): Promise<"ui-device_firmware_old" | "ui-device_firmware_unsupported" | "ui-device_firmware_not_compatible" | "ui-device_firmware_not_installed" | undefined>;
@@ -28,6 +29,7 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
28
29
  unconfirmed: number;
29
30
  transactions?: import("packages/blockchain-link-types/lib/common").Transaction[] | undefined;
30
31
  txids?: string[] | undefined;
32
+ addrTxCount?: number | undefined;
31
33
  };
32
34
  misc?: {
33
35
  nonce?: string | undefined;
@@ -67,6 +69,7 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
67
69
  unconfirmed: number;
68
70
  transactions?: import("packages/blockchain-link-types/lib/common").Transaction[] | undefined;
69
71
  txids?: string[] | undefined;
72
+ addrTxCount?: number | undefined;
70
73
  };
71
74
  misc?: {
72
75
  nonce?: string | undefined;
@@ -17,7 +17,6 @@ class GetAccountInfo extends AbstractMethod_1.AbstractMethod {
17
17
  }
18
18
  init() {
19
19
  this.requiredPermissions = ['read'];
20
- this.info = 'Export account info';
21
20
  this.useDevice = true;
22
21
  this.useUi = true;
23
22
  let willUseDevice = false;
@@ -69,6 +68,9 @@ class GetAccountInfo extends AbstractMethod_1.AbstractMethod {
69
68
  this.useDevice = willUseDevice;
70
69
  this.useUi = willUseDevice;
71
70
  }
71
+ get info() {
72
+ return 'Export account info';
73
+ }
72
74
  async confirmation() {
73
75
  await this.getPopupPromise().promise;
74
76
  const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
@@ -11,6 +11,7 @@ export default class GetAddress extends AbstractMethod<'getAddress', Params[]> {
11
11
  progress: number;
12
12
  confirmed?: boolean;
13
13
  init(): void;
14
+ get info(): string;
14
15
  getButtonRequestData(code: string): {
15
16
  type: "address";
16
17
  serializedPath: string;
@@ -71,19 +71,17 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
71
71
  this.params[0].show_display;
72
72
  this.confirmed = useEventListener;
73
73
  this.useUi = !useEventListener;
74
+ }
75
+ get info() {
74
76
  if (this.params.length === 1) {
75
- this.info = (0, pathUtils_1.getLabel)('Export #NETWORK address', this.params[0].coinInfo);
77
+ return (0, pathUtils_1.getLabel)('Export #NETWORK address', this.params[0].coinInfo);
76
78
  }
77
- else {
78
- const requestedNetworks = this.params.map(b => b.coinInfo);
79
- const uniqNetworks = (0, coinInfo_1.getUniqueNetworks)(requestedNetworks);
80
- if (uniqNetworks.length === 1 && uniqNetworks[0]) {
81
- this.info = (0, pathUtils_1.getLabel)('Export multiple #NETWORK addresses', uniqNetworks[0]);
82
- }
83
- else {
84
- this.info = 'Export multiple addresses';
85
- }
79
+ const requestedNetworks = this.params.map(b => b.coinInfo);
80
+ const uniqNetworks = (0, coinInfo_1.getUniqueNetworks)(requestedNetworks);
81
+ if (uniqNetworks.length === 1 && uniqNetworks[0]) {
82
+ return (0, pathUtils_1.getLabel)('Export multiple #NETWORK addresses', uniqNetworks[0]);
86
83
  }
84
+ return 'Export multiple addresses';
87
85
  }
88
86
  getButtonRequestData(code) {
89
87
  if (code === 'ButtonRequest_Address') {
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  export default class GetFeatures extends AbstractMethod<'getFeatures'> {
3
3
  init(): void;
4
- run(): Promise<import("packages/transport/lib/types/messages").Features>;
4
+ run(): Promise<import("packages/protobuf/lib/messages").Features>;
5
5
  }
6
6
  //# sourceMappingURL=getFeatures.d.ts.map
@@ -4,6 +4,7 @@ export default class GetOwnershipId extends AbstractMethod<'getOwnershipId', PRO
4
4
  hasBundle?: boolean;
5
5
  confirmed?: boolean;
6
6
  init(): void;
7
+ get info(): string;
7
8
  confirmation(): Promise<boolean>;
8
9
  run(): Promise<import("../types/api/getOwnershipId").OwnershipId | import("../types/api/getOwnershipId").OwnershipId[]>;
9
10
  }
@@ -8,7 +8,6 @@ const events_1 = require("../events");
8
8
  class GetOwnershipId extends AbstractMethod_1.AbstractMethod {
9
9
  init() {
10
10
  this.requiredPermissions = ['read'];
11
- this.info = 'Export ownership id';
12
11
  this.hasBundle = !!this.payload.bundle;
13
12
  const payload = !this.payload.bundle
14
13
  ? { ...this.payload, bundle: [this.payload] }
@@ -33,6 +32,9 @@ class GetOwnershipId extends AbstractMethod_1.AbstractMethod {
33
32
  };
34
33
  });
35
34
  }
35
+ get info() {
36
+ return 'Export ownership id';
37
+ }
36
38
  async confirmation() {
37
39
  if (this.confirmed)
38
40
  return true;
@@ -4,6 +4,7 @@ export default class GetOwnershipProof extends AbstractMethod<'getOwnershipProof
4
4
  hasBundle?: boolean;
5
5
  confirmed?: boolean;
6
6
  init(): void;
7
+ get info(): string;
7
8
  confirmation(): Promise<boolean>;
8
9
  run(): Promise<import("../types/api/getOwnershipProof").OwnershipProof | import("../types/api/getOwnershipProof").OwnershipProof[]>;
9
10
  }
@@ -8,7 +8,6 @@ const events_1 = require("../events");
8
8
  class GetOwnershipProof extends AbstractMethod_1.AbstractMethod {
9
9
  init() {
10
10
  this.requiredPermissions = ['read'];
11
- this.info = 'Export ownership proof';
12
11
  this.hasBundle = !!this.payload.bundle;
13
12
  const payload = !this.payload.bundle
14
13
  ? { ...this.payload, bundle: [this.payload] }
@@ -43,6 +42,9 @@ class GetOwnershipProof extends AbstractMethod_1.AbstractMethod {
43
42
  };
44
43
  });
45
44
  }
45
+ get info() {
46
+ return 'Export ownership proof';
47
+ }
46
48
  async confirmation() {
47
49
  if (this.confirmed)
48
50
  return true;
@@ -9,7 +9,9 @@ export default class GetPublicKey extends AbstractMethod<'getPublicKey', Params[
9
9
  hasBundle?: boolean;
10
10
  confirmed?: boolean;
11
11
  init(): void;
12
+ get info(): string;
12
13
  confirmation(): Promise<boolean>;
14
+ noBackupConfirmation(): Promise<boolean>;
13
15
  run(): Promise<import("../types/api/getPublicKey").HDNodeResponse | import("../types/api/getPublicKey").HDNodeResponse[]>;
14
16
  }
15
17
  export {};
@@ -9,7 +9,6 @@ const accountUtils_1 = require("../utils/accountUtils");
9
9
  class GetPublicKey extends AbstractMethod_1.AbstractMethod {
10
10
  init() {
11
11
  this.requiredPermissions = ['read'];
12
- this.info = 'Export public key';
13
12
  this.hasBundle = !!this.payload.bundle;
14
13
  const payload = !this.payload.bundle
15
14
  ? { ...this.payload, bundle: [this.payload] }
@@ -58,6 +57,9 @@ class GetPublicKey extends AbstractMethod_1.AbstractMethod {
58
57
  };
59
58
  });
60
59
  }
60
+ get info() {
61
+ return 'Export public key';
62
+ }
61
63
  async confirmation() {
62
64
  if (this.confirmed)
63
65
  return true;
@@ -78,6 +80,15 @@ class GetPublicKey extends AbstractMethod_1.AbstractMethod {
78
80
  this.confirmed = uiResp.payload;
79
81
  return this.confirmed;
80
82
  }
83
+ async noBackupConfirmation() {
84
+ await this.getPopupPromise().promise;
85
+ const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
86
+ this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
87
+ view: 'get-public-key-no-backup',
88
+ }));
89
+ const uiResp = await uiPromise.promise;
90
+ return uiResp.payload;
91
+ }
81
92
  async run() {
82
93
  const responses = [];
83
94
  const cmd = this.device.getCommands();
@@ -1,6 +1,8 @@
1
1
  export { default as applyFlags } from './applyFlags';
2
2
  export { default as applySettings } from './applySettings';
3
3
  export { default as authorizeCoinjoin } from './authorizeCoinjoin';
4
+ export { default as cancelCoinjoinAuthorization } from './cancelCoinjoinAuthorization';
5
+ export { default as showDeviceTutorial } from './showDeviceTutorial';
4
6
  export { default as backupDevice } from './backupDevice';
5
7
  export { default as binanceGetAddress } from './binanceGetAddress';
6
8
  export { default as binanceGetPublicKey } from './binanceGetPublicKey';
package/lib/api/index.js CHANGED
@@ -3,14 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.nemSignTransaction = exports.nemGetAddress = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.firmwareUpdate = exports.ethereumVerifyMessage = exports.ethereumSignTypedData = exports.ethereumSignTransaction = exports.ethereumSignMessage = exports.ethereumGetPublicKey = exports.ethereumGetAddress = exports.eosSignTransaction = exports.eosGetPublicKey = exports.composeTransaction = exports.cipherKeyValue = exports.changePin = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.binanceSignTransaction = exports.binanceGetPublicKey = exports.binanceGetAddress = exports.backupDevice = exports.authorizeCoinjoin = exports.applySettings = exports.applyFlags = void 0;
7
- exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.tezosSignTransaction = exports.tezosGetPublicKey = exports.tezosGetAddress = exports.stellarSignTransaction = exports.stellarGetAddress = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.rippleSignTransaction = exports.rippleGetAddress = exports.resetDevice = void 0;
6
+ exports.rebootToBootloader = exports.pushTransaction = exports.nemSignTransaction = exports.nemGetAddress = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.firmwareUpdate = exports.ethereumVerifyMessage = exports.ethereumSignTypedData = exports.ethereumSignTransaction = exports.ethereumSignMessage = exports.ethereumGetPublicKey = exports.ethereumGetAddress = exports.eosSignTransaction = exports.eosGetPublicKey = exports.composeTransaction = exports.cipherKeyValue = exports.changePin = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.binanceSignTransaction = exports.binanceGetPublicKey = exports.binanceGetAddress = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.applySettings = exports.applyFlags = void 0;
7
+ exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.tezosSignTransaction = exports.tezosGetPublicKey = exports.tezosGetAddress = exports.stellarSignTransaction = exports.stellarGetAddress = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.rippleSignTransaction = exports.rippleGetAddress = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = void 0;
8
8
  var applyFlags_1 = require("./applyFlags");
9
9
  Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return __importDefault(applyFlags_1).default; } });
10
10
  var applySettings_1 = require("./applySettings");
11
11
  Object.defineProperty(exports, "applySettings", { enumerable: true, get: function () { return __importDefault(applySettings_1).default; } });
12
12
  var authorizeCoinjoin_1 = require("./authorizeCoinjoin");
13
13
  Object.defineProperty(exports, "authorizeCoinjoin", { enumerable: true, get: function () { return __importDefault(authorizeCoinjoin_1).default; } });
14
+ var cancelCoinjoinAuthorization_1 = require("./cancelCoinjoinAuthorization");
15
+ Object.defineProperty(exports, "cancelCoinjoinAuthorization", { enumerable: true, get: function () { return __importDefault(cancelCoinjoinAuthorization_1).default; } });
16
+ var showDeviceTutorial_1 = require("./showDeviceTutorial");
17
+ Object.defineProperty(exports, "showDeviceTutorial", { enumerable: true, get: function () { return __importDefault(showDeviceTutorial_1).default; } });
14
18
  var backupDevice_1 = require("./backupDevice");
15
19
  Object.defineProperty(exports, "backupDevice", { enumerable: true, get: function () { return __importDefault(backupDevice_1).default; } });
16
20
  var binanceGetAddress_1 = require("./binanceGetAddress");
@@ -8,6 +8,7 @@ export default class NEMGetAddress extends AbstractMethod<'nemGetAddress', Param
8
8
  progress: number;
9
9
  confirmed?: boolean;
10
10
  init(): void;
11
+ get info(): string;
11
12
  getButtonRequestData(code: string): {
12
13
  type: "address";
13
14
  serializedPath: string;
@@ -46,6 +46,8 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
46
46
  this.params[0].show_display;
47
47
  this.confirmed = useEventListener;
48
48
  this.useUi = !useEventListener;
49
+ }
50
+ get info() {
49
51
  if (this.params.length === 1) {
50
52
  let network = 'Unknown';
51
53
  switch (this.params[0].network) {
@@ -59,11 +61,9 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
59
61
  network = 'Mijin';
60
62
  break;
61
63
  }
62
- this.info = `Export NEM address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1} on ${network} network`;
63
- }
64
- else {
65
- this.info = 'Export multiple NEM addresses';
64
+ return `Export NEM address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1} on ${network} network`;
66
65
  }
66
+ return 'Export multiple NEM addresses';
67
67
  }
68
68
  getButtonRequestData(code) {
69
69
  if (code === 'ButtonRequest_Address') {
@@ -2,6 +2,7 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { PROTO } from '../constants';
3
3
  export default class NEMSignTransaction extends AbstractMethod<'nemSignTransaction', PROTO.NEMSignTx> {
4
4
  init(): void;
5
+ get info(): string;
5
6
  run(): Promise<PROTO.NEMSignedTx>;
6
7
  }
7
8
  //# sourceMappingURL=nemSignTransaction.d.ts.map
@@ -10,7 +10,6 @@ class NEMSignTransaction extends AbstractMethod_1.AbstractMethod {
10
10
  init() {
11
11
  this.requiredPermissions = ['read', 'write'];
12
12
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('NEM'), this.firmwareRange);
13
- this.info = 'Sign NEM transaction';
14
13
  const { payload } = this;
15
14
  (0, paramsValidator_1.validateParams)(payload, [
16
15
  { name: 'path', required: true },
@@ -19,6 +18,9 @@ class NEMSignTransaction extends AbstractMethod_1.AbstractMethod {
19
18
  const path = (0, pathUtils_1.validatePath)(payload.path, 3);
20
19
  this.params = helper.createTx(payload.transaction, path);
21
20
  }
21
+ get info() {
22
+ return 'Sign NEM transaction';
23
+ }
22
24
  async run() {
23
25
  const cmd = this.device.getCommands();
24
26
  const response = await cmd.typedCall('NEMSignTx', 'NEMSignedTx', this.params);
@@ -2,7 +2,8 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  export default class RebootToBootloader extends AbstractMethod<'rebootToBootloader'> {
3
3
  confirmed?: boolean;
4
4
  init(): void;
5
+ get info(): string;
5
6
  confirmation(): Promise<boolean>;
6
- run(): Promise<import("packages/transport/lib/types/messages").Success>;
7
+ run(): Promise<import("packages/protobuf/lib/messages").Success>;
7
8
  }
8
9
  //# sourceMappingURL=rebootToBootloader.d.ts.map
@@ -9,13 +9,15 @@ class RebootToBootloader extends AbstractMethod_1.AbstractMethod {
9
9
  this.skipFinalReload = true;
10
10
  this.keepSession = false;
11
11
  this.requiredPermissions = ['management'];
12
- this.info = 'Reboot to bootloader';
13
12
  this.useDeviceState = false;
14
13
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, {
15
14
  1: { min: '1.10.0', max: '0' },
16
- 2: { min: '0', max: '0' },
15
+ 2: { min: '2.6.0', max: '0' },
17
16
  });
18
17
  }
18
+ get info() {
19
+ return 'Reboot to bootloader';
20
+ }
19
21
  async confirmation() {
20
22
  if (this.confirmed)
21
23
  return true;
@@ -3,6 +3,7 @@ import type { PROTO } from '../constants';
3
3
  export default class RequestLogin extends AbstractMethod<'requestLogin', PROTO.SignIdentity> {
4
4
  asyncChallenge?: boolean;
5
5
  init(): void;
6
+ get info(): string;
6
7
  run(): Promise<{
7
8
  address: string;
8
9
  publicKey: string;
@@ -9,7 +9,6 @@ class RequestLogin extends AbstractMethod_1.AbstractMethod {
9
9
  init() {
10
10
  this.requiredPermissions = ['read', 'write'];
11
11
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
12
- this.info = 'Login';
13
12
  this.useEmptyPassphrase = true;
14
13
  const { payload } = this;
15
14
  const identity = {};
@@ -35,6 +34,9 @@ class RequestLogin extends AbstractMethod_1.AbstractMethod {
35
34
  };
36
35
  this.asyncChallenge = !!payload.asyncChallenge;
37
36
  }
37
+ get info() {
38
+ return 'Login';
39
+ }
38
40
  async run() {
39
41
  if (this.asyncChallenge) {
40
42
  const uiPromise = this.createUiPromise(events_1.UI.LOGIN_CHALLENGE_RESPONSE);
@@ -3,6 +3,7 @@ import type { PROTO } from '../constants';
3
3
  export default class ResetDevice extends AbstractMethod<'resetDevice', PROTO.ResetDevice> {
4
4
  confirmed?: boolean;
5
5
  init(): void;
6
+ get info(): string;
6
7
  confirmation(): Promise<boolean>;
7
8
  run(): Promise<PROTO.Success>;
8
9
  }
@@ -9,7 +9,6 @@ class ResetDevice extends AbstractMethod_1.AbstractMethod {
9
9
  this.useDeviceState = false;
10
10
  this.requiredPermissions = ['management'];
11
11
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
12
- this.info = 'Setup device';
13
12
  const { payload } = this;
14
13
  (0, paramsValidator_1.validateParams)(payload, [
15
14
  { name: 'display_random', type: 'boolean' },
@@ -36,6 +35,9 @@ class ResetDevice extends AbstractMethod_1.AbstractMethod {
36
35
  backup_type: payload.backup_type,
37
36
  };
38
37
  }
38
+ get info() {
39
+ return 'Setup device';
40
+ }
39
41
  async confirmation() {
40
42
  if (this.confirmed)
41
43
  return true;
@@ -8,6 +8,7 @@ export default class RippleGetAddress extends AbstractMethod<'rippleGetAddress',
8
8
  progress: number;
9
9
  confirmed?: boolean;
10
10
  init(): void;
11
+ get info(): string;
11
12
  getButtonRequestData(code: string): {
12
13
  type: "address";
13
14
  serializedPath: string;
@@ -41,12 +41,12 @@ class RippleGetAddress extends AbstractMethod_1.AbstractMethod {
41
41
  this.params[0].show_display;
42
42
  this.confirmed = useEventListener;
43
43
  this.useUi = !useEventListener;
44
+ }
45
+ get info() {
44
46
  if (this.params.length === 1) {
45
- this.info = `Export Ripple address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
46
- }
47
- else {
48
- this.info = 'Export multiple Ripple addresses';
47
+ return `Export Ripple address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
49
48
  }
49
+ return 'Export multiple Ripple addresses';
50
50
  }
51
51
  getButtonRequestData(code) {
52
52
  if (code === 'ButtonRequest_Address') {
@@ -2,6 +2,7 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { PROTO } from '../constants';
3
3
  export default class RippleSignTransaction extends AbstractMethod<'rippleSignTransaction', PROTO.RippleSignTx> {
4
4
  init(): void;
5
+ get info(): string;
5
6
  run(): Promise<{
6
7
  serializedTx: string;
7
8
  signature: string;
@@ -8,7 +8,6 @@ class RippleSignTransaction extends AbstractMethod_1.AbstractMethod {
8
8
  init() {
9
9
  this.requiredPermissions = ['read', 'write'];
10
10
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Ripple'), this.firmwareRange);
11
- this.info = 'Sign Ripple transaction';
12
11
  const { payload } = this;
13
12
  (0, paramsValidator_1.validateParams)(payload, [
14
13
  { name: 'path', required: true },
@@ -41,6 +40,9 @@ class RippleSignTransaction extends AbstractMethod_1.AbstractMethod {
41
40
  },
42
41
  };
43
42
  }
43
+ get info() {
44
+ return 'Sign Ripple transaction';
45
+ }
44
46
  async run() {
45
47
  const cmd = this.device.getCommands();
46
48
  const { message } = await cmd.typedCall('RippleSignTx', 'RippleSignedTx', this.params);
@@ -0,0 +1,8 @@
1
+ import { AbstractMethod } from '../core/AbstractMethod';
2
+ import { PROTO } from '../constants';
3
+ export default class ShowDeviceTutorial extends AbstractMethod<'showDeviceTutorial', PROTO.ShowDeviceTutorial> {
4
+ init(): void;
5
+ get info(): string;
6
+ run(): Promise<PROTO.Success>;
7
+ }
8
+ //# sourceMappingURL=showDeviceTutorial.d.ts.map