@trezor/connect 9.1.9 → 9.1.10

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 (229) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/lib/api/applyFlags.d.ts +4 -2
  4. package/lib/api/applyFlags.js +3 -2
  5. package/lib/api/applySettings.d.ts +4 -2
  6. package/lib/api/applySettings.js +3 -13
  7. package/lib/api/authenticateDevice.js +3 -11
  8. package/lib/api/authorizeCoinjoin.d.ts +3 -1
  9. package/lib/api/authorizeCoinjoin.js +3 -11
  10. package/lib/api/backupDevice.d.ts +3 -1
  11. package/lib/api/binance/api/binanceGetAddress.d.ts +4 -2
  12. package/lib/api/binance/api/binanceGetAddress.js +4 -10
  13. package/lib/api/binance/api/binanceGetPublicKey.d.ts +9 -1
  14. package/lib/api/binance/api/binanceGetPublicKey.js +3 -5
  15. package/lib/api/binance/api/binanceSignTransaction.d.ts +4 -1
  16. package/lib/api/binance/api/binanceSignTransaction.js +5 -6
  17. package/lib/api/binance/binanceSignTx.d.ts +84 -3
  18. package/lib/api/binance/binanceSignTx.js +3 -26
  19. package/lib/api/bitcoin/Fees.d.ts +14 -2
  20. package/lib/api/bitcoin/TransactionComposer.d.ts +13 -2
  21. package/lib/api/bitcoin/refTx.d.ts +2 -2
  22. package/lib/api/bitcoin/refTx.js +22 -24
  23. package/lib/api/bitcoin/signtxVerify.d.ts +1 -1
  24. package/lib/api/blockchainDisconnect.d.ts +1 -1
  25. package/lib/api/blockchainDisconnect.js +3 -2
  26. package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -1
  27. package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -1
  28. package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -1
  29. package/lib/api/blockchainGetTransactions.d.ts +1 -1
  30. package/lib/api/cancelCoinjoinAuthorization.d.ts +3 -1
  31. package/lib/api/cancelCoinjoinAuthorization.js +3 -0
  32. package/lib/api/cardano/api/cardanoGetAddress.d.ts +4 -2
  33. package/lib/api/cardano/api/cardanoGetAddress.js +4 -13
  34. package/lib/api/cardano/api/cardanoGetNativeScriptHash.d.ts +1 -1
  35. package/lib/api/cardano/api/cardanoGetNativeScriptHash.js +3 -13
  36. package/lib/api/cardano/api/cardanoGetPublicKey.d.ts +1 -1
  37. package/lib/api/cardano/api/cardanoGetPublicKey.js +4 -7
  38. package/lib/api/cardano/api/cardanoSignTransaction.d.ts +26 -4
  39. package/lib/api/cardano/api/cardanoSignTransaction.js +15 -46
  40. package/lib/api/cardano/cardanoAddressParameters.d.ts +1 -1
  41. package/lib/api/cardano/cardanoAddressParameters.js +3 -14
  42. package/lib/api/cardano/cardanoAuxiliaryData.d.ts +1 -1
  43. package/lib/api/cardano/cardanoAuxiliaryData.js +5 -20
  44. package/lib/api/cardano/cardanoCertificate.d.ts +1 -1
  45. package/lib/api/cardano/cardanoCertificate.js +20 -59
  46. package/lib/api/cardano/cardanoInputs.d.ts +20 -8
  47. package/lib/api/cardano/cardanoInputs.js +18 -14
  48. package/lib/api/cardano/cardanoOutputs.d.ts +31 -2
  49. package/lib/api/cardano/cardanoOutputs.js +14 -11
  50. package/lib/api/cardano/cardanoTokenBundle.d.ts +11 -6
  51. package/lib/api/cardano/cardanoTokenBundle.js +9 -21
  52. package/lib/api/changePin.d.ts +4 -2
  53. package/lib/api/changePin.js +3 -2
  54. package/lib/api/changeWipeCode.d.ts +3 -1
  55. package/lib/api/cipherKeyValue.d.ts +5 -1
  56. package/lib/api/cipherKeyValue.js +13 -21
  57. package/lib/api/common/paramsValidator.js +5 -4
  58. package/lib/api/eos/api/eosGetPublicKey.d.ts +11 -1
  59. package/lib/api/eos/api/eosGetPublicKey.js +3 -6
  60. package/lib/api/eos/api/eosSignTransaction.js +3 -5
  61. package/lib/api/eos/eosSignTx.d.ts +160 -2
  62. package/lib/api/ethereum/api/ethereumGetAddress.js +4 -10
  63. package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +21 -1
  64. package/lib/api/ethereum/api/ethereumGetPublicKey.js +3 -5
  65. package/lib/api/ethereum/api/ethereumSignMessage.d.ts +6 -3
  66. package/lib/api/ethereum/api/ethereumSignMessage.js +3 -5
  67. package/lib/api/ethereum/api/ethereumSignTransaction.d.ts +2 -2
  68. package/lib/api/ethereum/api/ethereumSignTransaction.js +3 -25
  69. package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +83 -3
  70. package/lib/api/ethereum/api/ethereumSignTypedData.js +20 -12
  71. package/lib/api/ethereum/api/ethereumVerifyMessage.d.ts +3 -1
  72. package/lib/api/ethereum/api/ethereumVerifyMessage.js +3 -6
  73. package/lib/api/ethereum/ethereumDefinitions.d.ts +37 -19
  74. package/lib/api/ethereum/ethereumDefinitions.js +21 -15
  75. package/lib/api/ethereum/ethereumSignTx.d.ts +1 -1
  76. package/lib/api/firmware/getBinary.js +5 -4
  77. package/lib/api/firmware/modifyFirmware.js +3 -2
  78. package/lib/api/firmware/uploadFirmware.d.ts +3 -1
  79. package/lib/api/firmware/verifyAuthenticityProof.js +3 -3
  80. package/lib/api/firmwareUpdate.js +10 -15
  81. package/lib/api/getAccountDescriptor.d.ts +2 -2
  82. package/lib/api/getAccountDescriptor.js +4 -7
  83. package/lib/api/getAccountInfo.d.ts +8 -8
  84. package/lib/api/getAddress.d.ts +8 -2
  85. package/lib/api/getAddress.js +4 -20
  86. package/lib/api/getCoinInfo.d.ts +117 -2
  87. package/lib/api/getCoinInfo.js +3 -2
  88. package/lib/api/getFeatures.d.ts +49 -1
  89. package/lib/api/getFirmwareHash.d.ts +3 -1
  90. package/lib/api/getFirmwareHash.js +3 -1
  91. package/lib/api/getOwnershipId.js +4 -7
  92. package/lib/api/getOwnershipProof.js +4 -11
  93. package/lib/api/getPublicKey.d.ts +21 -1
  94. package/lib/api/getPublicKey.js +4 -18
  95. package/lib/api/nem/api/nemGetAddress.d.ts +4 -2
  96. package/lib/api/nem/api/nemGetAddress.js +4 -11
  97. package/lib/api/nem/api/nemSignTransaction.d.ts +4 -1
  98. package/lib/api/nem/api/nemSignTransaction.js +3 -5
  99. package/lib/api/nem/nemSignTx.d.ts +75 -1
  100. package/lib/api/pushTransaction.js +3 -5
  101. package/lib/api/rebootToBootloader.d.ts +3 -1
  102. package/lib/api/recoveryDevice.d.ts +3 -1
  103. package/lib/api/recoveryDevice.js +3 -12
  104. package/lib/api/requestLogin.js +7 -9
  105. package/lib/api/resetDevice.d.ts +3 -1
  106. package/lib/api/resetDevice.js +3 -12
  107. package/lib/api/ripple/api/rippleGetAddress.d.ts +4 -2
  108. package/lib/api/ripple/api/rippleGetAddress.js +4 -10
  109. package/lib/api/ripple/api/rippleSignTransaction.js +3 -17
  110. package/lib/api/setBusy.d.ts +3 -1
  111. package/lib/api/setBusy.js +3 -1
  112. package/lib/api/showDeviceTutorial.d.ts +3 -1
  113. package/lib/api/signMessage.d.ts +4 -1
  114. package/lib/api/signMessage.js +3 -7
  115. package/lib/api/solana/additionalInfo.js +3 -14
  116. package/lib/api/solana/api/solanaGetAddress.d.ts +4 -2
  117. package/lib/api/solana/api/solanaGetAddress.js +4 -7
  118. package/lib/api/solana/api/solanaGetPublicKey.d.ts +13 -1
  119. package/lib/api/solana/api/solanaGetPublicKey.js +3 -5
  120. package/lib/api/solana/api/solanaSignTransaction.js +3 -4
  121. package/lib/api/stellar/api/stellarGetAddress.d.ts +4 -2
  122. package/lib/api/stellar/api/stellarGetAddress.js +4 -10
  123. package/lib/api/stellar/api/stellarSignTransaction.js +3 -5
  124. package/lib/api/stellar/stellarSignTx.d.ts +5 -3
  125. package/lib/api/stellar/stellarSignTx.js +3 -15
  126. package/lib/api/tezos/api/tezosGetAddress.d.ts +4 -2
  127. package/lib/api/tezos/api/tezosGetAddress.js +4 -10
  128. package/lib/api/tezos/api/tezosGetPublicKey.d.ts +9 -1
  129. package/lib/api/tezos/api/tezosGetPublicKey.js +3 -6
  130. package/lib/api/tezos/api/tezosSignTransaction.d.ts +5 -1
  131. package/lib/api/tezos/api/tezosSignTransaction.js +3 -5
  132. package/lib/api/tezos/tezosSignTx.d.ts +70 -2
  133. package/lib/api/tezos/tezosSignTx.js +3 -44
  134. package/lib/api/unlockPath.js +3 -4
  135. package/lib/api/verifyMessage.d.ts +3 -1
  136. package/lib/api/verifyMessage.js +3 -7
  137. package/lib/api/wipeDevice.d.ts +3 -1
  138. package/lib/constants/index.d.ts +1 -1
  139. package/lib/constants/index.js +1 -1
  140. package/lib/constants/nem.d.ts +7 -0
  141. package/lib/constants/nem.js +5 -1
  142. package/lib/core/AbstractMethod.d.ts +1 -1
  143. package/lib/core/AbstractMethod.js +4 -3
  144. package/lib/core/index.js +3 -3
  145. package/lib/data/coinInfo.d.ts +588 -12
  146. package/lib/data/coinInfo.js +6 -6
  147. package/lib/data/config.js +5 -0
  148. package/lib/data/deviceAuthenticityConfig.d.ts +19 -13
  149. package/lib/data/deviceAuthenticityConfig.js +23 -1
  150. package/lib/data/firmwareInfo.js +11 -10
  151. package/lib/data/version.d.ts +1 -1
  152. package/lib/data/version.js +1 -1
  153. package/lib/device/Device.d.ts +2 -6
  154. package/lib/device/Device.js +8 -27
  155. package/lib/device/DeviceCommands.d.ts +36 -4
  156. package/lib/device/DeviceCommands.js +5 -2
  157. package/lib/device/DeviceList.js +1 -1
  158. package/lib/events/ui-promise.d.ts +1 -1
  159. package/lib/index.d.ts +1 -1
  160. package/lib/index.js +2 -2
  161. package/lib/types/api/applySettings.d.ts +18 -2
  162. package/lib/types/api/applySettings.js +9 -0
  163. package/lib/types/api/authenticateDevice.d.ts +22 -5
  164. package/lib/types/api/authenticateDevice.js +7 -0
  165. package/lib/types/api/authorizeCoinjoin.d.ts +15 -13
  166. package/lib/types/api/authorizeCoinjoin.js +15 -0
  167. package/lib/types/api/binance/index.d.ts +203 -30
  168. package/lib/types/api/binance/index.js +48 -0
  169. package/lib/types/api/bitcoin/index.d.ts +18 -15
  170. package/lib/types/api/bitcoin/index.js +17 -0
  171. package/lib/types/api/cancelCoinjoinAuthorization.d.ts +5 -4
  172. package/lib/types/api/cancelCoinjoinAuthorization.js +5 -0
  173. package/lib/types/api/cardano/index.d.ts +685 -187
  174. package/lib/types/api/cardano/index.js +208 -0
  175. package/lib/types/api/cardanoSignTransaction.d.ts +5 -8
  176. package/lib/types/api/cipherKeyValue.d.ts +12 -11
  177. package/lib/types/api/cipherKeyValue.js +12 -0
  178. package/lib/types/api/eos/index.d.ts +783 -116
  179. package/lib/types/api/eos/index.js +177 -0
  180. package/lib/types/api/ethereum/index.d.ts +162 -56
  181. package/lib/types/api/ethereum/index.js +90 -0
  182. package/lib/types/api/firmwareUpdate.d.ts +11 -11
  183. package/lib/types/api/firmwareUpdate.js +15 -0
  184. package/lib/types/api/getAccountDescriptor.d.ts +10 -8
  185. package/lib/types/api/getAccountDescriptor.js +10 -0
  186. package/lib/types/api/getAddress.d.ts +42 -9
  187. package/lib/types/api/getAddress.js +14 -0
  188. package/lib/types/api/getOwnershipId.d.ts +33 -8
  189. package/lib/types/api/getOwnershipId.js +10 -0
  190. package/lib/types/api/getOwnershipProof.d.ts +37 -12
  191. package/lib/types/api/getOwnershipProof.js +14 -0
  192. package/lib/types/api/getPublicKey.d.ts +31 -21
  193. package/lib/types/api/getPublicKey.js +26 -0
  194. package/lib/types/api/nem/index.d.ts +841 -91
  195. package/lib/types/api/nem/index.js +130 -0
  196. package/lib/types/api/pushTransaction.d.ts +6 -4
  197. package/lib/types/api/pushTransaction.js +6 -0
  198. package/lib/types/api/recoveryDevice.d.ts +14 -4
  199. package/lib/types/api/recoveryDevice.js +9 -0
  200. package/lib/types/api/requestLogin.d.ts +38 -13
  201. package/lib/types/api/requestLogin.js +15 -0
  202. package/lib/types/api/resetDevice.d.ts +15 -13
  203. package/lib/types/api/resetDevice.js +9 -0
  204. package/lib/types/api/ripple/index.d.ts +40 -22
  205. package/lib/types/api/ripple/index.js +24 -0
  206. package/lib/types/api/solana/index.d.ts +42 -21
  207. package/lib/types/api/solana/index.js +26 -0
  208. package/lib/types/api/stellar/index.d.ts +890 -180
  209. package/lib/types/api/stellar/index.js +249 -0
  210. package/lib/types/api/tezos/index.d.ts +162 -59
  211. package/lib/types/api/tezos/index.js +61 -0
  212. package/lib/types/api/unlockPath.d.ts +7 -5
  213. package/lib/types/api/unlockPath.js +7 -0
  214. package/lib/types/coinInfo.d.ts +273 -56
  215. package/lib/types/coinInfo.js +81 -0
  216. package/lib/types/device.d.ts +1 -1
  217. package/lib/types/device.js +2 -2
  218. package/lib/types/fees.d.ts +29 -25
  219. package/lib/types/fees.js +36 -0
  220. package/lib/types/firmware.d.ts +1 -0
  221. package/lib/types/firmware.js +3 -0
  222. package/lib/types/params.d.ts +26 -17
  223. package/lib/types/params.js +23 -0
  224. package/lib/utils/deviceFeaturesUtils.js +5 -4
  225. package/lib/utils/firmwareUtils.js +5 -4
  226. package/lib/utils/hdnodeUtils.d.ts +191 -1
  227. package/lib/utils/pathUtils.d.ts +191 -1
  228. package/lib/utils/urlUtils.js +3 -3
  229. package/package.json +10 -9
@@ -5,6 +5,8 @@ const paramsValidator_1 = require("../../common/paramsValidator");
5
5
  const coinInfo_1 = require("../../../data/coinInfo");
6
6
  const pathUtils_1 = require("../../../utils/pathUtils");
7
7
  const events_1 = require("../../../events");
8
+ const schema_utils_1 = require("@trezor/schema-utils");
9
+ const types_1 = require("../../../types");
8
10
  class TezosGetPublicKey extends AbstractMethod_1.AbstractMethod {
9
11
  init() {
10
12
  this.requiredPermissions = ['read'];
@@ -13,13 +15,8 @@ class TezosGetPublicKey extends AbstractMethod_1.AbstractMethod {
13
15
  const payload = !this.payload.bundle
14
16
  ? { ...this.payload, bundle: [this.payload] }
15
17
  : this.payload;
16
- (0, paramsValidator_1.validateParams)(payload, [{ name: 'bundle', type: 'array' }]);
18
+ (0, schema_utils_1.Assert)((0, types_1.Bundle)(types_1.GetPublicKey), payload);
17
19
  this.params = payload.bundle.map(batch => {
18
- (0, paramsValidator_1.validateParams)(batch, [
19
- { name: 'path', required: true },
20
- { name: 'showOnTrezor', type: 'boolean' },
21
- { name: 'chunkify', type: 'boolean' },
22
- ]);
23
20
  const path = (0, pathUtils_1.validatePath)(batch.path, 3);
24
21
  return {
25
22
  address_n: path,
@@ -3,6 +3,10 @@ import type { PROTO } from '../../../constants';
3
3
  export default class TezosSignTransaction extends AbstractMethod<'tezosSignTransaction', PROTO.TezosSignTx> {
4
4
  init(): void;
5
5
  get info(): string;
6
- run(): Promise<PROTO.TezosSignedTx>;
6
+ run(): Promise<{
7
+ signature: string;
8
+ sig_op_contents: string;
9
+ operation_hash: string;
10
+ }>;
7
11
  }
8
12
  //# sourceMappingURL=tezosSignTransaction.d.ts.map
@@ -6,16 +6,14 @@ const paramsValidator_1 = require("../../common/paramsValidator");
6
6
  const coinInfo_1 = require("../../../data/coinInfo");
7
7
  const pathUtils_1 = require("../../../utils/pathUtils");
8
8
  const helper = tslib_1.__importStar(require("../tezosSignTx"));
9
+ const schema_utils_1 = require("@trezor/schema-utils");
10
+ const tezos_1 = require("../../../types/api/tezos");
9
11
  class TezosSignTransaction extends AbstractMethod_1.AbstractMethod {
10
12
  init() {
11
13
  this.requiredPermissions = ['read', 'write'];
12
14
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Tezos'), this.firmwareRange);
13
15
  const { payload } = this;
14
- (0, paramsValidator_1.validateParams)(payload, [
15
- { name: 'path', required: true },
16
- { name: 'branch', type: 'string', required: true },
17
- { name: 'operation', required: true },
18
- ]);
16
+ (0, schema_utils_1.Assert)(tezos_1.TezosSignTransaction, payload);
19
17
  const path = (0, pathUtils_1.validatePath)(payload.path, 3);
20
18
  this.params = helper.createTx(path, payload.branch, payload.operation);
21
19
  }
@@ -1,4 +1,72 @@
1
1
  import { PROTO } from '../../constants';
2
- import type { TezosOperation } from '../../types/api/tezos';
3
- export declare const createTx: (address_n: number[], branch: string, operation: TezosOperation, chunkify?: boolean) => PROTO.TezosSignTx;
2
+ import { TezosOperation } from '../../types/api/tezos';
3
+ export declare const createTx: (address_n: number[], branch: string, operation: TezosOperation, chunkify?: boolean) => {
4
+ chunkify?: boolean | undefined;
5
+ transaction?: {
6
+ parameters?: number[] | undefined;
7
+ parameters_manager?: {
8
+ transfer?: {
9
+ amount: string | number;
10
+ destination: {
11
+ hash: Uint8Array;
12
+ tag: number;
13
+ };
14
+ } | undefined;
15
+ set_delegate?: Uint8Array | undefined;
16
+ cancel_delegate?: boolean | undefined;
17
+ } | undefined;
18
+ source: Uint8Array;
19
+ amount: string | number;
20
+ fee: string | number;
21
+ destination: {
22
+ hash: Uint8Array;
23
+ tag: number;
24
+ };
25
+ counter: number;
26
+ gas_limit: number;
27
+ storage_limit: number;
28
+ } | undefined;
29
+ reveal?: {
30
+ source: Uint8Array;
31
+ public_key: Uint8Array;
32
+ fee: string | number;
33
+ counter: number;
34
+ gas_limit: number;
35
+ storage_limit: number;
36
+ } | undefined;
37
+ origination?: {
38
+ delegate?: Uint8Array | undefined;
39
+ manager_pubkey?: string | undefined;
40
+ spendable?: boolean | undefined;
41
+ delegatable?: boolean | undefined;
42
+ source: Uint8Array;
43
+ fee: string | number;
44
+ script: string | number[];
45
+ counter: number;
46
+ gas_limit: number;
47
+ storage_limit: number;
48
+ balance: number;
49
+ } | undefined;
50
+ delegation?: {
51
+ source: Uint8Array;
52
+ fee: string | number;
53
+ counter: number;
54
+ gas_limit: number;
55
+ storage_limit: number;
56
+ delegate: Uint8Array;
57
+ } | undefined;
58
+ proposal?: {
59
+ source: string;
60
+ period: number;
61
+ proposals: string[];
62
+ } | undefined;
63
+ ballot?: {
64
+ source: string;
65
+ period: number;
66
+ proposal: string;
67
+ ballot: PROTO.TezosBallotType;
68
+ } | undefined;
69
+ address_n: number[];
70
+ branch: Uint8Array;
71
+ };
4
72
  //# sourceMappingURL=tezosSignTx.d.ts.map
@@ -4,7 +4,8 @@ exports.createTx = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const bs58check = tslib_1.__importStar(require("bs58check"));
6
6
  const constants_1 = require("../../constants");
7
- const paramsValidator_1 = require("../common/paramsValidator");
7
+ const tezos_1 = require("../../types/api/tezos");
8
+ const schema_utils_1 = require("@trezor/schema-utils");
8
9
  const PREFIX = {
9
10
  B: new Uint8Array([1, 52]),
10
11
  tz1: new Uint8Array([6, 161, 159]),
@@ -66,16 +67,9 @@ const createTx = (address_n, branch, operation, chunkify) => {
66
67
  branch: bs58checkDecode(PREFIX.B, branch),
67
68
  chunkify: typeof chunkify === 'boolean' ? chunkify : false,
68
69
  };
70
+ (0, schema_utils_1.Assert)(tezos_1.TezosOperation, operation);
69
71
  if (operation.reveal) {
70
72
  const { reveal } = operation;
71
- (0, paramsValidator_1.validateParams)(reveal, [
72
- { name: 'source', type: 'string', required: true },
73
- { name: 'public_key', type: 'string', required: true },
74
- { name: 'fee', type: 'uint', required: true },
75
- { name: 'counter', type: 'number', required: true },
76
- { name: 'gas_limit', type: 'number', required: true },
77
- { name: 'storage_limit', type: 'number', required: true },
78
- ]);
79
73
  message = {
80
74
  ...message,
81
75
  reveal: {
@@ -90,15 +84,6 @@ const createTx = (address_n, branch, operation, chunkify) => {
90
84
  }
91
85
  if (operation.transaction) {
92
86
  const { transaction } = operation;
93
- (0, paramsValidator_1.validateParams)(transaction, [
94
- { name: 'source', type: 'string', required: true },
95
- { name: 'destination', type: 'string', required: true },
96
- { name: 'amount', type: 'uint', required: true },
97
- { name: 'counter', type: 'number', required: true },
98
- { name: 'fee', type: 'uint', required: true },
99
- { name: 'gas_limit', type: 'number', required: true },
100
- { name: 'storage_limit', type: 'number', required: true },
101
- ]);
102
87
  message = {
103
88
  ...message,
104
89
  transaction: {
@@ -125,11 +110,6 @@ const createTx = (address_n, branch, operation, chunkify) => {
125
110
  }
126
111
  if (transaction.parameters_manager) {
127
112
  const { parameters_manager } = transaction;
128
- (0, paramsValidator_1.validateParams)(parameters_manager, [
129
- { name: 'set_delegate', type: 'string', required: false },
130
- { name: 'cancel_delegate', type: 'boolean', required: false },
131
- { name: 'transfer', type: 'object', required: false },
132
- ]);
133
113
  if (parameters_manager.set_delegate) {
134
114
  message = {
135
115
  ...message,
@@ -155,10 +135,6 @@ const createTx = (address_n, branch, operation, chunkify) => {
155
135
  }
156
136
  if (parameters_manager.transfer) {
157
137
  const { transfer } = parameters_manager;
158
- (0, paramsValidator_1.validateParams)(transfer, [
159
- { name: 'amount', type: 'uint', required: true },
160
- { name: 'destination', type: 'string', required: true },
161
- ]);
162
138
  message = {
163
139
  ...message,
164
140
  transaction: {
@@ -179,15 +155,6 @@ const createTx = (address_n, branch, operation, chunkify) => {
179
155
  }
180
156
  if (operation.origination) {
181
157
  const { origination } = operation;
182
- (0, paramsValidator_1.validateParams)(origination, [
183
- { name: 'source', type: 'string', required: true },
184
- { name: 'balance', type: 'number', required: true },
185
- { name: 'fee', type: 'uint', required: true },
186
- { name: 'counter', type: 'number', required: true },
187
- { name: 'gas_limit', type: 'number', required: true },
188
- { name: 'storage_limit', type: 'number', required: true },
189
- { name: 'script', type: 'string', required: true },
190
- ]);
191
158
  message = {
192
159
  ...message,
193
160
  origination: {
@@ -212,14 +179,6 @@ const createTx = (address_n, branch, operation, chunkify) => {
212
179
  }
213
180
  if (operation.delegation) {
214
181
  const { delegation } = operation;
215
- (0, paramsValidator_1.validateParams)(delegation, [
216
- { name: 'source', type: 'string', required: true },
217
- { name: 'delegate', type: 'string', required: true },
218
- { name: 'fee', type: 'uint', required: true },
219
- { name: 'counter', type: 'number', required: true },
220
- { name: 'gas_limit', type: 'number', required: true },
221
- { name: 'storage_limit', type: 'number', required: true },
222
- ]);
223
182
  message = {
224
183
  ...message,
225
184
  delegation: {
@@ -3,16 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const AbstractMethod_1 = require("../core/AbstractMethod");
4
4
  const pathUtils_1 = require("../utils/pathUtils");
5
5
  const paramsValidator_1 = require("./common/paramsValidator");
6
+ const schema_utils_1 = require("@trezor/schema-utils");
7
+ const unlockPath_1 = require("../types/api/unlockPath");
6
8
  class UnlockPath extends AbstractMethod_1.AbstractMethod {
7
9
  init() {
8
10
  this.requiredPermissions = ['read'];
9
11
  this.skipFinalReload = true;
10
12
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, undefined, this.firmwareRange);
11
13
  const { payload } = this;
12
- (0, paramsValidator_1.validateParams)(payload, [
13
- { name: 'path', required: true },
14
- { name: 'mac', type: 'string' },
15
- ]);
14
+ (0, schema_utils_1.Assert)(unlockPath_1.UnlockPathParams, payload);
16
15
  const path = (0, pathUtils_1.validatePath)(payload.path, 1);
17
16
  this.params = {
18
17
  address_n: path,
@@ -3,6 +3,8 @@ import { PROTO } from '../constants';
3
3
  export default class VerifyMessage extends AbstractMethod<'verifyMessage', PROTO.VerifyMessage> {
4
4
  init(): void;
5
5
  get info(): string;
6
- run(): Promise<PROTO.Success>;
6
+ run(): Promise<{
7
+ message: string;
8
+ }>;
7
9
  }
8
10
  //# sourceMappingURL=verifyMessage.d.ts.map
@@ -6,17 +6,13 @@ const coinInfo_1 = require("../data/coinInfo");
6
6
  const pathUtils_1 = require("../utils/pathUtils");
7
7
  const formatUtils_1 = require("../utils/formatUtils");
8
8
  const constants_1 = require("../constants");
9
+ const types_1 = require("../types");
10
+ const schema_utils_1 = require("@trezor/schema-utils");
9
11
  class VerifyMessage extends AbstractMethod_1.AbstractMethod {
10
12
  init() {
11
13
  this.requiredPermissions = ['read', 'write'];
12
14
  const { payload } = this;
13
- (0, paramsValidator_1.validateParams)(payload, [
14
- { name: 'address', type: 'string', required: true },
15
- { name: 'signature', type: 'string', required: true },
16
- { name: 'message', type: 'string', required: true },
17
- { name: 'coin', type: 'string', required: true },
18
- { name: 'hex', type: 'boolean' },
19
- ]);
15
+ (0, schema_utils_1.Assert)(types_1.VerifyMessage, payload);
20
16
  const coinInfo = (0, coinInfo_1.getBitcoinNetwork)(payload.coin);
21
17
  if (!coinInfo) {
22
18
  throw constants_1.ERRORS.TypedError('Method_UnknownCoin');
@@ -4,6 +4,8 @@ export default class WipeDevice extends AbstractMethod<'wipeDevice'> {
4
4
  init(): void;
5
5
  confirmation(): Promise<boolean>;
6
6
  get info(): string;
7
- run(): Promise<import("packages/protobuf/lib/messages").Success>;
7
+ run(): Promise<{
8
+ message: string;
9
+ }>;
8
10
  }
9
11
  //# sourceMappingURL=wipeDevice.d.ts.map
@@ -2,5 +2,5 @@ export * as ERRORS from './errors';
2
2
  export * as NETWORK from './network';
3
3
  export * as CARDANO from './cardano';
4
4
  export * as NEM from './nem';
5
- export * as PROTO from '@trezor/protobuf/lib/messages';
5
+ export * as PROTO from '@trezor/protobuf/lib/messages-schema';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -6,5 +6,5 @@ exports.ERRORS = tslib_1.__importStar(require("./errors"));
6
6
  exports.NETWORK = tslib_1.__importStar(require("./network"));
7
7
  exports.CARDANO = tslib_1.__importStar(require("./cardano"));
8
8
  exports.NEM = tslib_1.__importStar(require("./nem"));
9
- exports.PROTO = tslib_1.__importStar(require("@trezor/protobuf/lib/messages"));
9
+ exports.PROTO = tslib_1.__importStar(require("@trezor/protobuf/lib/messages-schema"));
10
10
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,11 @@
1
+ import { Static } from '@trezor/schema-utils';
1
2
  export declare enum Networks {
2
3
  mainnet = 104,
3
4
  testnet = 152,
4
5
  mijin = 96
5
6
  }
7
+ export type EnumNetworks = Static<typeof EnumNetworks>;
8
+ export declare const EnumNetworks: import("@sinclair/typebox").TEnum<typeof Networks>;
6
9
  export declare enum TxType {
7
10
  TRANSFER = 257,
8
11
  COSIGNING = 258,
@@ -14,9 +17,13 @@ export declare enum TxType {
14
17
  MOSAIC_CREATION = 16385,
15
18
  SUPPLY_CHANGE = 16386
16
19
  }
20
+ export type EnumTxType = Static<typeof EnumTxType>;
21
+ export declare const EnumTxType: import("@sinclair/typebox").TEnum<typeof TxType>;
17
22
  export declare enum TxVersion {
18
23
  mainnet = 1744830464,
19
24
  testnet = -1744830464,
20
25
  mijin = 1610612736
21
26
  }
27
+ export type EnumTxVersion = Static<typeof EnumTxVersion>;
28
+ export declare const EnumTxVersion: import("@sinclair/typebox").TEnum<typeof TxVersion>;
22
29
  //# sourceMappingURL=nem.d.ts.map
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TxVersion = exports.TxType = exports.Networks = void 0;
3
+ exports.EnumTxVersion = exports.TxVersion = exports.EnumTxType = exports.TxType = exports.EnumNetworks = exports.Networks = void 0;
4
+ const schema_utils_1 = require("@trezor/schema-utils");
4
5
  var Networks;
5
6
  (function (Networks) {
6
7
  Networks[Networks["mainnet"] = 104] = "mainnet";
7
8
  Networks[Networks["testnet"] = 152] = "testnet";
8
9
  Networks[Networks["mijin"] = 96] = "mijin";
9
10
  })(Networks || (exports.Networks = Networks = {}));
11
+ exports.EnumNetworks = schema_utils_1.Type.Enum(Networks);
10
12
  var TxType;
11
13
  (function (TxType) {
12
14
  TxType[TxType["TRANSFER"] = 257] = "TRANSFER";
@@ -19,10 +21,12 @@ var TxType;
19
21
  TxType[TxType["MOSAIC_CREATION"] = 16385] = "MOSAIC_CREATION";
20
22
  TxType[TxType["SUPPLY_CHANGE"] = 16386] = "SUPPLY_CHANGE";
21
23
  })(TxType || (exports.TxType = TxType = {}));
24
+ exports.EnumTxType = schema_utils_1.Type.Enum(TxType);
22
25
  var TxVersion;
23
26
  (function (TxVersion) {
24
27
  TxVersion[TxVersion["mainnet"] = 1744830464] = "mainnet";
25
28
  TxVersion[TxVersion["testnet"] = -1744830464] = "testnet";
26
29
  TxVersion[TxVersion["mijin"] = 1610612736] = "mijin";
27
30
  })(TxVersion || (exports.TxVersion = TxVersion = {}));
31
+ exports.EnumTxVersion = schema_utils_1.Type.Enum(TxVersion);
28
32
  //# sourceMappingURL=nem.js.map
@@ -1,4 +1,4 @@
1
- import { Deferred } from '@trezor/utils';
1
+ import { Deferred } from '@trezor/utils/lib/createDeferred';
2
2
  import { NETWORK } from '../constants';
3
3
  import { CallMethodPayload, CallMethodResponse, UiRequestButtonData, UiPromiseCreator, PostMessage } from '../events';
4
4
  import type { Device } from '../device/Device';
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractMethod = exports.DEFAULT_FIRMWARE_RANGE = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const connect_common_1 = require("@trezor/connect-common");
5
- const utils_1 = require("@trezor/utils");
6
+ const versionUtils = tslib_1.__importStar(require("@trezor/utils/lib/versionUtils"));
6
7
  const DataManager_1 = require("../data/DataManager");
7
8
  const constants_1 = require("../constants");
8
9
  const events_1 = require("../events");
@@ -144,10 +145,10 @@ class AbstractMethod {
144
145
  }
145
146
  const version = device.getVersion().join('.');
146
147
  if (device.firmwareStatus === 'required' ||
147
- !utils_1.versionUtils.isNewerOrEqual(version, range.min)) {
148
+ !versionUtils.isNewerOrEqual(version, range.min)) {
148
149
  return events_1.UI.FIRMWARE_OLD;
149
150
  }
150
- if (range.max !== '0' && utils_1.versionUtils.isNewer(version, range.max)) {
151
+ if (range.max !== '0' && versionUtils.isNewer(version, range.max)) {
151
152
  if (isUsingPopup) {
152
153
  await this.getPopupPromise().promise;
153
154
  const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
package/lib/core/index.js CHANGED
@@ -4,7 +4,7 @@ exports.initTransport = exports.initCore = exports.Core = exports.onCall = expor
4
4
  const tslib_1 = require("tslib");
5
5
  const events_1 = tslib_1.__importDefault(require("events"));
6
6
  const transport_1 = require("@trezor/transport");
7
- const utils_1 = require("@trezor/utils");
7
+ const createDeferred_1 = require("@trezor/utils/lib/createDeferred");
8
8
  const DataManager_1 = require("../data/DataManager");
9
9
  const DeviceList_1 = require("../device/DeviceList");
10
10
  const analyticsInfo_1 = require("../data/analyticsInfo");
@@ -40,7 +40,7 @@ const getPopupPromise = (requestWindow = true) => {
40
40
  postMessage((0, events_2.createUiMessage)(events_2.UI.REQUEST_UI_WINDOW));
41
41
  }
42
42
  if (!_popupPromise) {
43
- _popupPromise = (0, utils_1.createDeferred)();
43
+ _popupPromise = (0, createDeferred_1.createDeferred)();
44
44
  }
45
45
  return _popupPromise;
46
46
  };
@@ -49,7 +49,7 @@ const interactionTimeout = () => _interactionTimeout.start(() => {
49
49
  });
50
50
  const createUiPromise = (promiseEvent, device) => {
51
51
  const uiPromise = {
52
- ...(0, utils_1.createDeferred)(promiseEvent),
52
+ ...(0, createDeferred_1.createDeferred)(promiseEvent),
53
53
  device,
54
54
  };
55
55
  _uiPromises.push(uiPromise);