@trezor/connect 9.1.1 → 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 (135) hide show
  1. package/CHANGELOG.md +13 -3
  2. package/README.md +2 -2
  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/refTx.d.ts +10 -2
  15. package/lib/api/bitcoin/refTx.js +46 -19
  16. package/lib/api/blockchainDisconnect.d.ts +1 -0
  17. package/lib/api/blockchainDisconnect.js +3 -1
  18. package/lib/api/blockchainEstimateFee.js +1 -1
  19. package/lib/api/blockchainSetCustomBackend.d.ts +1 -0
  20. package/lib/api/blockchainSetCustomBackend.js +3 -1
  21. package/lib/api/cancelCoinjoinAuthorization.d.ts +1 -0
  22. package/lib/api/cancelCoinjoinAuthorization.js +3 -1
  23. package/lib/api/cardanoGetAddress.d.ts +1 -0
  24. package/lib/api/cardanoGetAddress.js +4 -4
  25. package/lib/api/cardanoGetNativeScriptHash.d.ts +1 -0
  26. package/lib/api/cardanoGetNativeScriptHash.js +3 -1
  27. package/lib/api/cardanoGetPublicKey.d.ts +1 -0
  28. package/lib/api/cardanoGetPublicKey.js +3 -1
  29. package/lib/api/cardanoSignTransaction.d.ts +1 -0
  30. package/lib/api/cardanoSignTransaction.js +3 -1
  31. package/lib/api/checkFirmwareAuthenticity.js +2 -1
  32. package/lib/api/cipherKeyValue.d.ts +1 -0
  33. package/lib/api/cipherKeyValue.js +3 -1
  34. package/lib/api/composeTransaction.d.ts +3 -0
  35. package/lib/api/composeTransaction.js +9 -7
  36. package/lib/api/eosGetPublicKey.d.ts +1 -0
  37. package/lib/api/eosGetPublicKey.js +3 -1
  38. package/lib/api/eosSignTransaction.d.ts +1 -0
  39. package/lib/api/eosSignTransaction.js +3 -1
  40. package/lib/api/ethereum/ethereumDefinitions.d.ts +28 -6
  41. package/lib/api/ethereum/ethereumDefinitions.js +60 -1
  42. package/lib/api/ethereum/ethereumSignTx.d.ts +1 -1
  43. package/lib/api/ethereumGetAddress.d.ts +2 -0
  44. package/lib/api/ethereumGetAddress.js +28 -26
  45. package/lib/api/ethereumGetPublicKey.d.ts +1 -0
  46. package/lib/api/ethereumGetPublicKey.js +8 -10
  47. package/lib/api/ethereumSignMessage.d.ts +10 -1
  48. package/lib/api/ethereumSignMessage.js +14 -13
  49. package/lib/api/ethereumSignTransaction.d.ts +6 -0
  50. package/lib/api/ethereumSignTransaction.js +18 -5
  51. package/lib/api/ethereumSignTypedData.d.ts +6 -0
  52. package/lib/api/ethereumSignTypedData.js +15 -13
  53. package/lib/api/ethereumVerifyMessage.d.ts +1 -0
  54. package/lib/api/ethereumVerifyMessage.js +3 -1
  55. package/lib/api/getAccountInfo.d.ts +1 -0
  56. package/lib/api/getAccountInfo.js +3 -1
  57. package/lib/api/getAddress.d.ts +1 -0
  58. package/lib/api/getAddress.js +8 -10
  59. package/lib/api/getFeatures.d.ts +1 -1
  60. package/lib/api/getOwnershipId.d.ts +1 -0
  61. package/lib/api/getOwnershipId.js +3 -1
  62. package/lib/api/getOwnershipProof.d.ts +1 -0
  63. package/lib/api/getOwnershipProof.js +3 -1
  64. package/lib/api/getPublicKey.d.ts +1 -0
  65. package/lib/api/getPublicKey.js +3 -1
  66. package/lib/api/nemGetAddress.d.ts +1 -0
  67. package/lib/api/nemGetAddress.js +4 -4
  68. package/lib/api/nemSignTransaction.d.ts +1 -0
  69. package/lib/api/nemSignTransaction.js +3 -1
  70. package/lib/api/rebootToBootloader.d.ts +2 -1
  71. package/lib/api/rebootToBootloader.js +3 -1
  72. package/lib/api/requestLogin.d.ts +1 -0
  73. package/lib/api/requestLogin.js +3 -1
  74. package/lib/api/resetDevice.d.ts +1 -0
  75. package/lib/api/resetDevice.js +3 -1
  76. package/lib/api/rippleGetAddress.d.ts +1 -0
  77. package/lib/api/rippleGetAddress.js +4 -4
  78. package/lib/api/rippleSignTransaction.d.ts +1 -0
  79. package/lib/api/rippleSignTransaction.js +3 -1
  80. package/lib/api/showDeviceTutorial.d.ts +1 -0
  81. package/lib/api/showDeviceTutorial.js +3 -1
  82. package/lib/api/signMessage.d.ts +1 -0
  83. package/lib/api/signMessage.js +5 -1
  84. package/lib/api/signTransaction.d.ts +1 -0
  85. package/lib/api/signTransaction.js +16 -4
  86. package/lib/api/stellarGetAddress.d.ts +1 -0
  87. package/lib/api/stellarGetAddress.js +4 -4
  88. package/lib/api/stellarSignTransaction.d.ts +1 -0
  89. package/lib/api/stellarSignTransaction.js +3 -1
  90. package/lib/api/tezosGetAddress.d.ts +1 -0
  91. package/lib/api/tezosGetAddress.js +4 -4
  92. package/lib/api/tezosGetPublicKey.d.ts +1 -0
  93. package/lib/api/tezosGetPublicKey.js +3 -1
  94. package/lib/api/tezosSignTransaction.d.ts +1 -0
  95. package/lib/api/tezosSignTransaction.js +3 -1
  96. package/lib/api/verifyMessage.d.ts +1 -0
  97. package/lib/api/verifyMessage.js +7 -2
  98. package/lib/api/wipeDevice.d.ts +2 -1
  99. package/lib/api/wipeDevice.js +3 -1
  100. package/lib/backend/Blockchain.d.ts +1 -3
  101. package/lib/backend/Blockchain.js +10 -6
  102. package/lib/constants/index.d.ts +1 -1
  103. package/lib/constants/index.js +1 -1
  104. package/lib/core/AbstractMethod.d.ts +3 -1
  105. package/lib/core/AbstractMethod.js +3 -1
  106. package/lib/core/index.js +9 -1
  107. package/lib/data/DataManager.js +4 -1
  108. package/lib/data/analyticsInfo.js +1 -1
  109. package/lib/data/coinInfo.d.ts +9 -0
  110. package/lib/data/coinInfo.js +10 -41
  111. package/lib/data/config.js +5 -1
  112. package/lib/data/defaultFeeLevels.d.ts +17 -0
  113. package/lib/data/defaultFeeLevels.js +84 -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 +2 -2
  117. package/lib/device/Device.js +9 -7
  118. package/lib/device/DeviceCommands.js +6 -1
  119. package/lib/events/popup.d.ts +8 -1
  120. package/lib/events/popup.js +1 -0
  121. package/lib/events/ui-request.d.ts +2 -2
  122. package/lib/types/account.d.ts +1 -20
  123. package/lib/types/api/bitcoin/index.d.ts +2 -0
  124. package/lib/types/api/blockchainEstimateFee.d.ts +2 -5
  125. package/lib/types/coinInfo.d.ts +5 -17
  126. package/lib/types/device.d.ts +5 -2
  127. package/lib/types/device.js +7 -2
  128. package/lib/types/fees.d.ts +26 -0
  129. package/lib/types/fees.js +3 -0
  130. package/lib/types/index.d.ts +2 -1
  131. package/lib/types/index.js +1 -0
  132. package/lib/utils/assetUtils.js +3 -1
  133. package/lib/utils/urlUtils.d.ts +10 -3
  134. package/lib/utils/urlUtils.js +5 -9
  135. package/package.json +10 -8
@@ -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>;
@@ -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,6 +9,7 @@ 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>;
13
14
  noBackupConfirmation(): Promise<boolean>;
14
15
  run(): Promise<import("../types/api/getPublicKey").HDNodeResponse | import("../types/api/getPublicKey").HDNodeResponse[]>;
@@ -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;
@@ -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
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);
@@ -2,6 +2,7 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
3
  export default class ShowDeviceTutorial extends AbstractMethod<'showDeviceTutorial', PROTO.ShowDeviceTutorial> {
4
4
  init(): void;
5
+ get info(): string;
5
6
  run(): Promise<PROTO.Success>;
6
7
  }
7
8
  //# sourceMappingURL=showDeviceTutorial.d.ts.map
@@ -6,11 +6,13 @@ const events_1 = require("../events");
6
6
  class ShowDeviceTutorial extends AbstractMethod_1.AbstractMethod {
7
7
  init() {
8
8
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
9
- this.info = 'Show device tutorial';
10
9
  this.useEmptyPassphrase = true;
11
10
  this.useDeviceState = false;
12
11
  this.allowDeviceMode = [events_1.UI.INITIALIZE];
13
12
  }
13
+ get info() {
14
+ return 'Show device tutorial';
15
+ }
14
16
  async run() {
15
17
  const cmd = this.device.getCommands();
16
18
  const response = await cmd.typedCall('ShowDeviceTutorial', 'Success');
@@ -2,6 +2,7 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { PROTO } from '../constants';
3
3
  export default class SignMessage extends AbstractMethod<'signMessage', PROTO.SignMessage> {
4
4
  init(): void;
5
+ get info(): string;
5
6
  run(): Promise<PROTO.MessageSignature>;
6
7
  }
7
8
  //# sourceMappingURL=signMessage.d.ts.map
@@ -25,7 +25,6 @@ class SignMessage extends AbstractMethod_1.AbstractMethod {
25
25
  else {
26
26
  coinInfo = (0, coinInfo_1.getBitcoinNetwork)(path);
27
27
  }
28
- this.info = (0, pathUtils_1.getLabel)('Sign #NETWORK message', coinInfo);
29
28
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(payload.no_script_type ? 'signMessageNoScriptType' : this.name, coinInfo, this.firmwareRange);
30
29
  const messageHex = payload.hex
31
30
  ? (0, formatUtils_1.messageToHex)(payload.message)
@@ -39,6 +38,11 @@ class SignMessage extends AbstractMethod_1.AbstractMethod {
39
38
  no_script_type: payload.no_script_type,
40
39
  };
41
40
  }
41
+ get info() {
42
+ var _a;
43
+ const coinInfo = (0, coinInfo_1.getBitcoinNetwork)((_a = this.payload.coin) !== null && _a !== void 0 ? _a : this.params.address_n);
44
+ return (0, pathUtils_1.getLabel)('Sign #NETWORK message', coinInfo);
45
+ }
42
46
  async run() {
43
47
  const cmd = this.device.getCommands();
44
48
  const { message } = await cmd.typedCall('SignMessage', 'MessageSignature', this.params);
@@ -16,6 +16,7 @@ type Params = {
16
16
  };
17
17
  export default class SignTransaction extends AbstractMethod<'signTransaction', Params> {
18
18
  init(): void;
19
+ get info(): string;
19
20
  private fetchAddresses;
20
21
  private fetchRefTxs;
21
22
  run(): Promise<import("../types").SignedTransaction>;
@@ -11,8 +11,8 @@ const BlockchainLink_1 = require("../backend/BlockchainLink");
11
11
  const bitcoin_1 = require("./bitcoin");
12
12
  class SignTransaction extends AbstractMethod_1.AbstractMethod {
13
13
  init() {
14
+ var _a, _b, _c;
14
15
  this.requiredPermissions = ['read', 'write'];
15
- this.info = 'Sign transaction';
16
16
  const { payload } = this;
17
17
  (0, paramsValidator_1.validateParams)(payload, [
18
18
  { name: 'coin', type: 'string', required: true },
@@ -48,15 +48,23 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
48
48
  }
49
49
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, coinInfo, this.firmwareRange);
50
50
  this.preauthorized = payload.preauthorized;
51
- this.info = (0, pathUtils_1.getLabel)('Sign #NETWORK transaction', coinInfo);
52
51
  const inputs = (0, bitcoin_1.validateTrezorInputs)(payload.inputs, coinInfo);
53
52
  const outputs = (0, bitcoin_1.validateTrezorOutputs)(payload.outputs, coinInfo);
54
- const refTxs = (0, bitcoin_1.validateReferencedTransactions)(payload.refTxs, inputs, outputs);
53
+ if (payload.refTxs && ((_a = payload.account) === null || _a === void 0 ? void 0 : _a.transactions)) {
54
+ console.warn('two sources of referential transactions were passed. payload.refTxs have precedence');
55
+ }
56
+ const refTxs = (0, bitcoin_1.validateReferencedTransactions)({
57
+ transactions: payload.refTxs || ((_b = payload.account) === null || _b === void 0 ? void 0 : _b.transactions),
58
+ inputs,
59
+ outputs,
60
+ coinInfo,
61
+ addresses: (_c = payload.account) === null || _c === void 0 ? void 0 : _c.addresses,
62
+ });
55
63
  const outputsWithAmount = outputs.filter(output => typeof output.amount === 'string' &&
56
64
  !Object.prototype.hasOwnProperty.call(output, 'op_return_data'));
57
65
  if (outputsWithAmount.length > 0) {
58
66
  const total = outputsWithAmount.reduce((bn, output) => bn.plus(typeof output.amount === 'string' ? output.amount : '0'), new bignumber_js_1.default(0));
59
- if (total.lte(coinInfo.dustLimit)) {
67
+ if (total.lt(coinInfo.dustLimit)) {
60
68
  throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Total amount is below dust limit.');
61
69
  }
62
70
  }
@@ -85,6 +93,10 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
85
93
  };
86
94
  this.params.options = (0, bitcoin_1.enhanceSignTx)(this.params.options, coinInfo);
87
95
  }
96
+ get info() {
97
+ const coinInfo = (0, coinInfo_1.getBitcoinNetwork)(this.payload.coin);
98
+ return (0, pathUtils_1.getLabel)('Sign #NETWORK transaction', coinInfo);
99
+ }
88
100
  async fetchAddresses(blockchain) {
89
101
  const { device, params: { inputs, coinInfo }, } = this;
90
102
  const accountPath = inputs.find(i => i.address_n);
@@ -8,6 +8,7 @@ export default class StellarGetAddress extends AbstractMethod<'stellarGetAddress
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 StellarGetAddress 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 Stellar address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
46
- }
47
- else {
48
- this.info = 'Export multiple Stellar addresses';
47
+ return `Export Stellar address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
49
48
  }
49
+ return 'Export multiple Stellar addresses';
50
50
  }
51
51
  getButtonRequestData(code) {
52
52
  if (code === 'ButtonRequest_Address') {
@@ -11,6 +11,7 @@ declare const StellarSignTransactionFeatures: Readonly<{
11
11
  }>;
12
12
  export default class StellarSignTransaction extends AbstractMethod<'stellarSignTransaction', Params> {
13
13
  init(): void;
14
+ get info(): string;
14
15
  _isFeatureSupported(feature: keyof typeof StellarSignTransactionFeatures): boolean;
15
16
  _ensureFeatureIsSupported(feature: keyof typeof StellarSignTransactionFeatures): void;
16
17
  _ensureFirmwareSupportsParams(): void;
@@ -15,7 +15,6 @@ class StellarSignTransaction extends AbstractMethod_1.AbstractMethod {
15
15
  init() {
16
16
  this.requiredPermissions = ['read', 'write'];
17
17
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Stellar'), this.firmwareRange);
18
- this.info = 'Sign Stellar transaction';
19
18
  const { payload } = this;
20
19
  (0, paramsValidator_1.validateParams)(payload, [
21
20
  { name: 'path', required: true },
@@ -30,6 +29,9 @@ class StellarSignTransaction extends AbstractMethod_1.AbstractMethod {
30
29
  transaction,
31
30
  };
32
31
  }
32
+ get info() {
33
+ return 'Sign Stellar transaction';
34
+ }
33
35
  _isFeatureSupported(feature) {
34
36
  return this.device.atLeast(StellarSignTransactionFeatures[feature]);
35
37
  }
@@ -8,6 +8,7 @@ export default class TezosGetAddress extends AbstractMethod<'tezosGetAddress', P
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;