@trezor/connect 9.1.8 → 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 (233) hide show
  1. package/CHANGELOG.md +11 -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/index.d.ts +1 -0
  159. package/lib/events/index.js +1 -0
  160. package/lib/events/ui-promise.d.ts +1 -1
  161. package/lib/events/webextension.d.ts +7 -0
  162. package/lib/events/webextension.js +10 -0
  163. package/lib/index.d.ts +1 -1
  164. package/lib/index.js +2 -2
  165. package/lib/types/api/applySettings.d.ts +18 -2
  166. package/lib/types/api/applySettings.js +9 -0
  167. package/lib/types/api/authenticateDevice.d.ts +22 -5
  168. package/lib/types/api/authenticateDevice.js +7 -0
  169. package/lib/types/api/authorizeCoinjoin.d.ts +15 -13
  170. package/lib/types/api/authorizeCoinjoin.js +15 -0
  171. package/lib/types/api/binance/index.d.ts +203 -30
  172. package/lib/types/api/binance/index.js +48 -0
  173. package/lib/types/api/bitcoin/index.d.ts +18 -15
  174. package/lib/types/api/bitcoin/index.js +17 -0
  175. package/lib/types/api/cancelCoinjoinAuthorization.d.ts +5 -4
  176. package/lib/types/api/cancelCoinjoinAuthorization.js +5 -0
  177. package/lib/types/api/cardano/index.d.ts +685 -187
  178. package/lib/types/api/cardano/index.js +208 -0
  179. package/lib/types/api/cardanoSignTransaction.d.ts +5 -8
  180. package/lib/types/api/cipherKeyValue.d.ts +12 -11
  181. package/lib/types/api/cipherKeyValue.js +12 -0
  182. package/lib/types/api/eos/index.d.ts +783 -116
  183. package/lib/types/api/eos/index.js +177 -0
  184. package/lib/types/api/ethereum/index.d.ts +162 -56
  185. package/lib/types/api/ethereum/index.js +90 -0
  186. package/lib/types/api/firmwareUpdate.d.ts +11 -11
  187. package/lib/types/api/firmwareUpdate.js +15 -0
  188. package/lib/types/api/getAccountDescriptor.d.ts +10 -8
  189. package/lib/types/api/getAccountDescriptor.js +10 -0
  190. package/lib/types/api/getAddress.d.ts +42 -9
  191. package/lib/types/api/getAddress.js +14 -0
  192. package/lib/types/api/getOwnershipId.d.ts +33 -8
  193. package/lib/types/api/getOwnershipId.js +10 -0
  194. package/lib/types/api/getOwnershipProof.d.ts +37 -12
  195. package/lib/types/api/getOwnershipProof.js +14 -0
  196. package/lib/types/api/getPublicKey.d.ts +31 -21
  197. package/lib/types/api/getPublicKey.js +26 -0
  198. package/lib/types/api/nem/index.d.ts +841 -91
  199. package/lib/types/api/nem/index.js +130 -0
  200. package/lib/types/api/pushTransaction.d.ts +6 -4
  201. package/lib/types/api/pushTransaction.js +6 -0
  202. package/lib/types/api/recoveryDevice.d.ts +14 -4
  203. package/lib/types/api/recoveryDevice.js +9 -0
  204. package/lib/types/api/requestLogin.d.ts +38 -13
  205. package/lib/types/api/requestLogin.js +15 -0
  206. package/lib/types/api/resetDevice.d.ts +15 -13
  207. package/lib/types/api/resetDevice.js +9 -0
  208. package/lib/types/api/ripple/index.d.ts +40 -22
  209. package/lib/types/api/ripple/index.js +24 -0
  210. package/lib/types/api/solana/index.d.ts +42 -21
  211. package/lib/types/api/solana/index.js +26 -0
  212. package/lib/types/api/stellar/index.d.ts +890 -180
  213. package/lib/types/api/stellar/index.js +249 -0
  214. package/lib/types/api/tezos/index.d.ts +162 -59
  215. package/lib/types/api/tezos/index.js +61 -0
  216. package/lib/types/api/unlockPath.d.ts +7 -5
  217. package/lib/types/api/unlockPath.js +7 -0
  218. package/lib/types/coinInfo.d.ts +273 -56
  219. package/lib/types/coinInfo.js +81 -0
  220. package/lib/types/device.d.ts +1 -1
  221. package/lib/types/device.js +2 -2
  222. package/lib/types/fees.d.ts +29 -25
  223. package/lib/types/fees.js +36 -0
  224. package/lib/types/firmware.d.ts +1 -0
  225. package/lib/types/firmware.js +3 -0
  226. package/lib/types/params.d.ts +26 -17
  227. package/lib/types/params.js +23 -0
  228. package/lib/utils/deviceFeaturesUtils.js +5 -4
  229. package/lib/utils/firmwareUtils.js +5 -4
  230. package/lib/utils/hdnodeUtils.d.ts +191 -1
  231. package/lib/utils/pathUtils.d.ts +191 -1
  232. package/lib/utils/urlUtils.js +3 -3
  233. package/package.json +10 -9
@@ -1,13 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformReferenceInput = exports.transformCollateralInput = exports.transformInput = void 0;
4
- const paramsValidator_1 = require("../common/paramsValidator");
3
+ exports.transformReferenceInput = exports.transformCollateralInput = exports.transformInput = exports.InputWithPathParam = exports.InputWithPath = exports.Path = void 0;
5
4
  const pathUtils_1 = require("../../utils/pathUtils");
5
+ const constants_1 = require("../../constants");
6
+ const schema_utils_1 = require("@trezor/schema-utils");
7
+ const exports_1 = require("../../exports");
8
+ exports.Path = schema_utils_1.Type.Array(schema_utils_1.Type.Number());
9
+ exports.InputWithPath = schema_utils_1.Type.Object({
10
+ input: constants_1.PROTO.CardanoTxInput,
11
+ path: schema_utils_1.Type.Optional(exports.Path),
12
+ });
13
+ exports.InputWithPathParam = schema_utils_1.Type.Composite([
14
+ constants_1.PROTO.CardanoTxInput,
15
+ schema_utils_1.Type.Object({
16
+ path: schema_utils_1.Type.Optional(exports_1.DerivationPath),
17
+ }),
18
+ ]);
6
19
  const transformInput = (input) => {
7
- (0, paramsValidator_1.validateParams)(input, [
8
- { name: 'prev_hash', type: 'string', required: true },
9
- { name: 'prev_index', type: 'number', required: true },
10
- ]);
20
+ (0, schema_utils_1.Assert)(exports.InputWithPathParam, input);
11
21
  return {
12
22
  input: {
13
23
  prev_hash: input.prev_hash,
@@ -18,10 +28,7 @@ const transformInput = (input) => {
18
28
  };
19
29
  exports.transformInput = transformInput;
20
30
  const transformCollateralInput = (collateralInput) => {
21
- (0, paramsValidator_1.validateParams)(collateralInput, [
22
- { name: 'prev_hash', type: 'string', required: true },
23
- { name: 'prev_index', type: 'number', required: true },
24
- ]);
31
+ (0, schema_utils_1.Assert)(exports.InputWithPathParam, collateralInput);
25
32
  return {
26
33
  collateralInput: {
27
34
  prev_hash: collateralInput.prev_hash,
@@ -32,10 +39,7 @@ const transformCollateralInput = (collateralInput) => {
32
39
  };
33
40
  exports.transformCollateralInput = transformCollateralInput;
34
41
  const transformReferenceInput = (referenceInput) => {
35
- (0, paramsValidator_1.validateParams)(referenceInput, [
36
- { name: 'prev_hash', type: 'string', required: true },
37
- { name: 'prev_index', type: 'number', required: true },
38
- ]);
42
+ (0, schema_utils_1.Assert)(constants_1.PROTO.CardanoTxInput, referenceInput);
39
43
  return {
40
44
  prev_hash: referenceInput.prev_hash,
41
45
  prev_index: referenceInput.prev_index,
@@ -1,4 +1,4 @@
1
- import type { AssetGroupWithTokens } from './cardanoTokenBundle';
1
+ import { AssetGroupWithTokens } from './cardanoTokenBundle';
2
2
  import { PROTO } from '../../constants';
3
3
  export type OutputWithData = {
4
4
  output: PROTO.CardanoTxOutput;
@@ -6,6 +6,35 @@ export type OutputWithData = {
6
6
  inlineDatum?: string;
7
7
  referenceScript?: string;
8
8
  };
9
- export declare const transformOutput: (output: any) => OutputWithData;
9
+ export declare const OutputValidation: import("@sinclair/typebox").TObject<{
10
+ address: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
+ amount: import("@trezor/schema-utils/lib/custom-types/uint").TUint;
12
+ tokenBundle: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
13
+ policyId: import("@sinclair/typebox").TString;
14
+ tokenAmounts: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
15
+ assetNameBytes: import("@sinclair/typebox").TString;
16
+ amount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
17
+ mintAmount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
18
+ }>>;
19
+ }>>>;
20
+ datumHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
21
+ format: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
22
+ inlineDatum: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
23
+ referenceScript: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
24
+ addressParameters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
25
+ addressType: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoAddressType>;
26
+ path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>>;
27
+ stakingPath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>>;
28
+ stakingKeyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
29
+ certificatePointer: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
30
+ blockIndex: import("@sinclair/typebox").TNumber;
31
+ txIndex: import("@sinclair/typebox").TNumber;
32
+ certificateIndex: import("@sinclair/typebox").TNumber;
33
+ }>>;
34
+ paymentScriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
35
+ stakingScriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
36
+ }>>;
37
+ }>;
38
+ export declare const transformOutput: (output: unknown) => OutputWithData;
10
39
  export declare const sendOutput: (typedCall: any, outputWithData: OutputWithData) => Promise<void>;
11
40
  //# sourceMappingURL=cardanoOutputs.d.ts.map
@@ -1,20 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendOutput = exports.transformOutput = void 0;
4
- const paramsValidator_1 = require("../common/paramsValidator");
3
+ exports.sendOutput = exports.transformOutput = exports.OutputValidation = void 0;
5
4
  const cardanoAddressParameters_1 = require("./cardanoAddressParameters");
6
5
  const cardanoTokenBundle_1 = require("./cardanoTokenBundle");
7
6
  const cardanoUtils_1 = require("./cardanoUtils");
7
+ const cardano_1 = require("../../types/api/cardano");
8
+ const schema_utils_1 = require("@trezor/schema-utils");
9
+ exports.OutputValidation = schema_utils_1.Type.Object({
10
+ address: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
11
+ amount: schema_utils_1.Type.Uint(),
12
+ tokenBundle: schema_utils_1.Type.Optional(schema_utils_1.Type.Array(cardano_1.CardanoAssetGroup)),
13
+ datumHash: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
14
+ format: schema_utils_1.Type.Optional(schema_utils_1.Type.Number()),
15
+ inlineDatum: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
16
+ referenceScript: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
17
+ addressParameters: schema_utils_1.Type.Optional(cardano_1.CardanoAddressParameters),
18
+ });
8
19
  const transformOutput = (output) => {
9
- (0, paramsValidator_1.validateParams)(output, [
10
- { name: 'address', type: 'string' },
11
- { name: 'amount', type: 'uint', required: true },
12
- { name: 'tokenBundle', type: 'array', allowEmpty: true },
13
- { name: 'datumHash', type: 'string' },
14
- { name: 'format', type: 'number' },
15
- { name: 'inlineDatum', type: 'string' },
16
- { name: 'referenceScript', type: 'string' },
17
- ]);
20
+ (0, schema_utils_1.Assert)(exports.OutputValidation, output);
18
21
  const result = {
19
22
  output: {
20
23
  amount: output.amount,
@@ -1,8 +1,13 @@
1
- import type { PROTO } from '../../constants';
2
- import type { CardanoAssetGroup } from '../../types/api/cardano';
3
- export type AssetGroupWithTokens = {
4
- policyId: string;
5
- tokens: PROTO.CardanoToken[];
6
- };
1
+ import { CardanoAssetGroup } from '../../types/api/cardano';
2
+ import { Static } from '@trezor/schema-utils';
3
+ export type AssetGroupWithTokens = Static<typeof AssetGroupWithTokens>;
4
+ export declare const AssetGroupWithTokens: import("@sinclair/typebox").TObject<{
5
+ policyId: import("@sinclair/typebox").TString;
6
+ tokens: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
7
+ asset_name_bytes: import("@sinclair/typebox").TString;
8
+ amount: import("@sinclair/typebox").TOptional<import("@trezor/schema-utils/lib/custom-types/uint").TUint>;
9
+ mint_amount: import("@sinclair/typebox").TOptional<import("@trezor/schema-utils/lib/custom-types/uint").TUint>;
10
+ }>>;
11
+ }>;
7
12
  export declare const tokenBundleToProto: (tokenBundle: CardanoAssetGroup[]) => AssetGroupWithTokens[];
8
13
  //# sourceMappingURL=cardanoTokenBundle.d.ts.map
@@ -1,32 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenBundleToProto = void 0;
4
- const paramsValidator_1 = require("../common/paramsValidator");
5
- const validateTokens = (tokenAmounts) => {
6
- tokenAmounts.forEach(tokenAmount => {
7
- (0, paramsValidator_1.validateParams)(tokenAmount, [
8
- { name: 'assetNameBytes', type: 'string', required: true },
9
- { name: 'amount', type: 'uint' },
10
- { name: 'mintAmount', type: 'uint', allowNegative: true },
11
- ]);
12
- });
13
- };
14
- const validateTokenBundle = (tokenBundle) => {
15
- tokenBundle.forEach(tokenGroup => {
16
- (0, paramsValidator_1.validateParams)(tokenGroup, [
17
- { name: 'policyId', type: 'string', required: true },
18
- { name: 'tokenAmounts', type: 'array', required: true },
19
- ]);
20
- validateTokens(tokenGroup.tokenAmounts);
21
- });
22
- };
3
+ exports.tokenBundleToProto = exports.AssetGroupWithTokens = void 0;
4
+ const constants_1 = require("../../constants");
5
+ const cardano_1 = require("../../types/api/cardano");
6
+ const schema_utils_1 = require("@trezor/schema-utils");
7
+ exports.AssetGroupWithTokens = schema_utils_1.Type.Object({
8
+ policyId: schema_utils_1.Type.String(),
9
+ tokens: schema_utils_1.Type.Array(constants_1.PROTO.CardanoToken, { minItems: 1 }),
10
+ });
23
11
  const tokenAmountsToProto = (tokenAmounts) => tokenAmounts.map(tokenAmount => ({
24
12
  asset_name_bytes: tokenAmount.assetNameBytes,
25
13
  amount: tokenAmount.amount,
26
14
  mint_amount: tokenAmount.mintAmount,
27
15
  }));
28
16
  const tokenBundleToProto = (tokenBundle) => {
29
- validateTokenBundle(tokenBundle);
17
+ (0, schema_utils_1.Assert)(schema_utils_1.Type.Array(cardano_1.CardanoAssetGroup), tokenBundle);
30
18
  return tokenBundle.map(tokenGroup => ({
31
19
  policyId: tokenGroup.policyId,
32
20
  tokens: tokenAmountsToProto(tokenGroup.tokenAmounts),
@@ -1,7 +1,9 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
- import type { PROTO } from '../constants';
2
+ import { PROTO } from '../constants';
3
3
  export default class ChangePin extends AbstractMethod<'changePin', PROTO.ChangePin> {
4
4
  init(): void;
5
- run(): Promise<PROTO.Success>;
5
+ run(): Promise<{
6
+ message: string;
7
+ }>;
6
8
  }
7
9
  //# sourceMappingURL=changePin.d.ts.map
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const AbstractMethod_1 = require("../core/AbstractMethod");
4
- const paramsValidator_1 = require("./common/paramsValidator");
4
+ const schema_utils_1 = require("@trezor/schema-utils");
5
+ const constants_1 = require("../constants");
5
6
  class ChangePin extends AbstractMethod_1.AbstractMethod {
6
7
  init() {
7
8
  this.requiredPermissions = ['management'];
8
9
  this.useDeviceState = false;
9
10
  const { payload } = this;
10
- (0, paramsValidator_1.validateParams)(payload, [{ name: 'remove', type: 'boolean' }]);
11
+ (0, schema_utils_1.Assert)(constants_1.PROTO.ChangePin, payload);
11
12
  this.params = {
12
13
  remove: payload.remove,
13
14
  };
@@ -2,6 +2,8 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { PROTO } from '../constants';
3
3
  export default class ChangeWipeCode extends AbstractMethod<'changeWipeCode', PROTO.ChangeWipeCode> {
4
4
  init(): void;
5
- run(): Promise<PROTO.Success>;
5
+ run(): Promise<{
6
+ message: string;
7
+ }>;
6
8
  }
7
9
  //# sourceMappingURL=changeWipeCode.d.ts.map
@@ -4,6 +4,10 @@ export default class CipherKeyValue extends AbstractMethod<'cipherKeyValue', PRO
4
4
  hasBundle?: boolean;
5
5
  init(): void;
6
6
  get info(): string;
7
- run(): Promise<PROTO.CipheredKeyValue | PROTO.CipheredKeyValue[]>;
7
+ run(): Promise<{
8
+ value: string;
9
+ } | {
10
+ value: string;
11
+ }[]>;
8
12
  }
9
13
  //# sourceMappingURL=cipherKeyValue.d.ts.map
@@ -4,6 +4,9 @@ const events_1 = require("../events");
4
4
  const AbstractMethod_1 = require("../core/AbstractMethod");
5
5
  const paramsValidator_1 = require("./common/paramsValidator");
6
6
  const pathUtils_1 = require("../utils/pathUtils");
7
+ const schema_utils_1 = require("@trezor/schema-utils");
8
+ const params_1 = require("../types/params");
9
+ const cipherKeyValue_1 = require("../types/api/cipherKeyValue");
7
10
  class CipherKeyValue extends AbstractMethod_1.AbstractMethod {
8
11
  init() {
9
12
  this.requiredPermissions = ['read', 'write'];
@@ -14,27 +17,16 @@ class CipherKeyValue extends AbstractMethod_1.AbstractMethod {
14
17
  : this.payload;
15
18
  this.useEmptyPassphrase =
16
19
  typeof payload.useEmptyPassphrase === 'boolean' ? payload.useEmptyPassphrase : true;
17
- (0, paramsValidator_1.validateParams)(payload, [{ name: 'bundle', type: 'array' }]);
18
- this.params = payload.bundle.map(batch => {
19
- (0, paramsValidator_1.validateParams)(batch, [
20
- { name: 'path', required: true },
21
- { name: 'key', type: 'string' },
22
- { name: 'value', type: 'string' },
23
- { name: 'encrypt', type: 'boolean' },
24
- { name: 'askOnEncrypt', type: 'boolean' },
25
- { name: 'askOnDecrypt', type: 'boolean' },
26
- { name: 'iv', type: 'string' },
27
- ]);
28
- return {
29
- address_n: (0, pathUtils_1.validatePath)(batch.path),
30
- key: batch.key,
31
- value: batch.value instanceof Buffer ? batch.value.toString('hex') : batch.value,
32
- encrypt: batch.encrypt,
33
- ask_on_encrypt: batch.askOnEncrypt,
34
- ask_on_decrypt: batch.askOnDecrypt,
35
- iv: batch.iv instanceof Buffer ? batch.iv.toString('hex') : batch.iv,
36
- };
37
- });
20
+ (0, schema_utils_1.Assert)((0, params_1.Bundle)(cipherKeyValue_1.CipherKeyValue), payload);
21
+ this.params = payload.bundle.map(batch => ({
22
+ address_n: (0, pathUtils_1.validatePath)(batch.path),
23
+ key: batch.key,
24
+ value: batch.value instanceof Buffer ? batch.value.toString('hex') : batch.value,
25
+ encrypt: batch.encrypt,
26
+ ask_on_encrypt: batch.askOnEncrypt,
27
+ ask_on_decrypt: batch.askOnDecrypt,
28
+ iv: batch.iv instanceof Buffer ? batch.iv.toString('hex') : batch.iv,
29
+ }));
38
30
  }
39
31
  get info() {
40
32
  return 'Cipher key value';
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFirmwareRange = exports.validateCoinPath = exports.validateParams = void 0;
4
- const utils_1 = require("@trezor/utils");
4
+ const tslib_1 = require("tslib");
5
+ const versionUtils = tslib_1.__importStar(require("@trezor/utils/lib/versionUtils"));
5
6
  const constants_1 = require("../../constants");
6
7
  const pathUtils_1 = require("../../utils/pathUtils");
7
8
  const config_1 = require("../../data/config");
@@ -78,7 +79,7 @@ const getFirmwareRange = (method, coinInfo, currentRange) => {
78
79
  }
79
80
  else if (range[model].min !== '0' &&
80
81
  typeof supportVersion === 'string' &&
81
- utils_1.versionUtils.isNewer(supportVersion, range[model].min)) {
82
+ versionUtils.isNewer(supportVersion, range[model].min)) {
82
83
  range[model].min = supportVersion;
83
84
  }
84
85
  });
@@ -111,7 +112,7 @@ const getFirmwareRange = (method, coinInfo, currentRange) => {
111
112
  if (modelMin) {
112
113
  if (modelMin === '0' ||
113
114
  range[model].min === '0' ||
114
- !utils_1.versionUtils.isNewerOrEqual(range[model].min, modelMin)) {
115
+ !versionUtils.isNewerOrEqual(range[model].min, modelMin)) {
115
116
  range[model].min = modelMin;
116
117
  }
117
118
  }
@@ -123,7 +124,7 @@ const getFirmwareRange = (method, coinInfo, currentRange) => {
123
124
  if (modelMax) {
124
125
  if (modelMax === '0' ||
125
126
  range[model].max === '0' ||
126
- !utils_1.versionUtils.isNewerOrEqual(range[model].max, modelMax)) {
127
+ !versionUtils.isNewerOrEqual(range[model].max, modelMax)) {
127
128
  range[model].max = modelMax;
128
129
  }
129
130
  }
@@ -6,6 +6,16 @@ export default class EosGetPublicKey extends AbstractMethod<'eosGetPublicKey', P
6
6
  init(): void;
7
7
  get info(): string;
8
8
  confirmation(): Promise<boolean>;
9
- run(): Promise<import("../../..").EosPublicKey | import("../../..").EosPublicKey[]>;
9
+ run(): Promise<{
10
+ path: number[];
11
+ serializedPath: string;
12
+ wifPublicKey: string;
13
+ rawPublicKey: string;
14
+ } | {
15
+ path: number[];
16
+ serializedPath: string;
17
+ wifPublicKey: string;
18
+ rawPublicKey: string;
19
+ }[]>;
10
20
  }
11
21
  //# sourceMappingURL=eosGetPublicKey.d.ts.map
@@ -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 EosGetPublicKey extends AbstractMethod_1.AbstractMethod {
9
11
  init() {
10
12
  this.requiredPermissions = ['read'];
@@ -13,13 +15,8 @@ class EosGetPublicKey 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,
@@ -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("../eosSignTx"));
9
+ const schema_utils_1 = require("@trezor/schema-utils");
10
+ const eos_1 = require("../../../types/api/eos");
9
11
  class EosSignTransaction 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)('EOS'), this.firmwareRange);
13
15
  const { payload } = this;
14
- (0, paramsValidator_1.validateParams)(payload, [
15
- { name: 'path', required: true },
16
- { name: 'transaction', required: true },
17
- { name: 'chunkify', type: 'boolean' },
18
- ]);
16
+ (0, schema_utils_1.Assert)(eos_1.EosSignTransaction, payload);
19
17
  const path = (0, pathUtils_1.validatePath)(payload.path, 3);
20
18
  const { chain_id, header, ack } = helper.validate(payload.transaction);
21
19
  this.params = {
@@ -11,7 +11,165 @@ export declare const validate: (tx: EosSDKTransaction) => {
11
11
  max_cpu_usage_ms: number;
12
12
  delay_sec: number;
13
13
  };
14
- ack: PROTO.EosTxActionAck[];
14
+ ack: {
15
+ transfer?: {
16
+ memo: string;
17
+ quantity: {
18
+ symbol: string;
19
+ amount: string | number;
20
+ };
21
+ sender: string;
22
+ receiver: string;
23
+ } | undefined;
24
+ refund?: {
25
+ owner: string;
26
+ } | undefined;
27
+ unknown?: {
28
+ data_size: number;
29
+ data_chunk: string;
30
+ } | undefined;
31
+ new_account?: {
32
+ name: string;
33
+ owner: {
34
+ keys: {
35
+ type?: number | undefined;
36
+ address_n?: number[] | undefined;
37
+ weight: number;
38
+ key: string;
39
+ }[];
40
+ threshold: number;
41
+ accounts: {
42
+ weight: number;
43
+ account: {
44
+ permission: string;
45
+ actor: string;
46
+ };
47
+ }[];
48
+ waits: {
49
+ weight: number;
50
+ wait_sec: number;
51
+ }[];
52
+ };
53
+ creator: string;
54
+ active: {
55
+ keys: {
56
+ type?: number | undefined;
57
+ address_n?: number[] | undefined;
58
+ weight: number;
59
+ key: string;
60
+ }[];
61
+ threshold: number;
62
+ accounts: {
63
+ weight: number;
64
+ account: {
65
+ permission: string;
66
+ actor: string;
67
+ };
68
+ }[];
69
+ waits: {
70
+ weight: number;
71
+ wait_sec: number;
72
+ }[];
73
+ };
74
+ } | undefined;
75
+ delegate?: {
76
+ transfer: boolean;
77
+ sender: string;
78
+ receiver: string;
79
+ net_quantity: {
80
+ symbol: string;
81
+ amount: string | number;
82
+ };
83
+ cpu_quantity: {
84
+ symbol: string;
85
+ amount: string | number;
86
+ };
87
+ } | undefined;
88
+ undelegate?: {
89
+ sender: string;
90
+ receiver: string;
91
+ net_quantity: {
92
+ symbol: string;
93
+ amount: string | number;
94
+ };
95
+ cpu_quantity: {
96
+ symbol: string;
97
+ amount: string | number;
98
+ };
99
+ } | undefined;
100
+ buy_ram?: {
101
+ quantity: {
102
+ symbol: string;
103
+ amount: string | number;
104
+ };
105
+ receiver: string;
106
+ payer: string;
107
+ } | undefined;
108
+ buy_ram_bytes?: {
109
+ bytes: number;
110
+ receiver: string;
111
+ payer: string;
112
+ } | undefined;
113
+ sell_ram?: {
114
+ bytes: number;
115
+ account: string;
116
+ } | undefined;
117
+ vote_producer?: {
118
+ voter: string;
119
+ proxy: string;
120
+ producers: string[];
121
+ } | undefined;
122
+ update_auth?: {
123
+ permission: string;
124
+ account: string;
125
+ parent: string;
126
+ auth: {
127
+ keys: {
128
+ type?: number | undefined;
129
+ address_n?: number[] | undefined;
130
+ weight: number;
131
+ key: string;
132
+ }[];
133
+ threshold: number;
134
+ accounts: {
135
+ weight: number;
136
+ account: {
137
+ permission: string;
138
+ actor: string;
139
+ };
140
+ }[];
141
+ waits: {
142
+ weight: number;
143
+ wait_sec: number;
144
+ }[];
145
+ };
146
+ } | undefined;
147
+ delete_auth?: {
148
+ permission: string;
149
+ account: string;
150
+ } | undefined;
151
+ link_auth?: {
152
+ type: string;
153
+ account: string;
154
+ code: string;
155
+ requirement: string;
156
+ } | undefined;
157
+ unlink_auth?: {
158
+ type: string;
159
+ account: string;
160
+ code: string;
161
+ } | undefined;
162
+ common: {
163
+ name: string;
164
+ account: string;
165
+ authorization: {
166
+ permission: string;
167
+ actor: string;
168
+ }[];
169
+ };
170
+ }[];
15
171
  };
16
- export declare const signTx: (typedCall: TypedCall, address_n: number[], chain_id: string, header: PROTO.EosTxHeader, actions: PROTO.EosTxActionAck[], chunkify: boolean) => Promise<PROTO.EosSignedTx>;
172
+ export declare const signTx: (typedCall: TypedCall, address_n: number[], chain_id: string, header: PROTO.EosTxHeader, actions: PROTO.EosTxActionAck[], chunkify: boolean) => Promise<{
173
+ signature: string;
174
+ }>;
17
175
  //# sourceMappingURL=eosSignTx.d.ts.map
@@ -9,6 +9,9 @@ const formatUtils_1 = require("../../../utils/formatUtils");
9
9
  const constants_1 = require("../../../constants");
10
10
  const events_1 = require("../../../events");
11
11
  const ethereumDefinitions_1 = require("../ethereumDefinitions");
12
+ const schema_utils_1 = require("@trezor/schema-utils");
13
+ const types_1 = require("../../../types");
14
+ const getAddress_1 = require("../../../types/api/getAddress");
12
15
  class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
13
16
  constructor() {
14
17
  super(...arguments);
@@ -20,17 +23,8 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
20
23
  const payload = !this.payload.bundle
21
24
  ? { ...this.payload, bundle: [this.payload] }
22
25
  : this.payload;
23
- (0, paramsValidator_1.validateParams)(payload, [
24
- { name: 'bundle', type: 'array' },
25
- { name: 'useEventListener', type: 'boolean' },
26
- ]);
26
+ (0, schema_utils_1.Assert)((0, types_1.Bundle)(getAddress_1.GetAddress), payload);
27
27
  this.params = payload.bundle.map(batch => {
28
- (0, paramsValidator_1.validateParams)(batch, [
29
- { name: 'path', required: true },
30
- { name: 'address', type: 'string' },
31
- { name: 'showOnTrezor', type: 'boolean' },
32
- { name: 'chunkify', type: 'boolean' },
33
- ]);
34
28
  const path = (0, pathUtils_1.validatePath)(batch.path, 3);
35
29
  const network = (0, coinInfo_1.getEthereumNetwork)(path);
36
30
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, network, this.firmwareRange);
@@ -10,7 +10,27 @@ export default class EthereumGetPublicKey extends AbstractMethod<'ethereumGetPub
10
10
  init(): void;
11
11
  get info(): string;
12
12
  confirmation(): Promise<boolean>;
13
- run(): Promise<import("../../../types/api/getPublicKey").HDNodeResponse | import("../../../types/api/getPublicKey").HDNodeResponse[]>;
13
+ run(): Promise<{
14
+ xpubSegwit?: string | undefined;
15
+ path: number[];
16
+ publicKey: string;
17
+ serializedPath: string;
18
+ depth: number;
19
+ fingerprint: number;
20
+ chainCode: string;
21
+ childNum: number;
22
+ xpub: string;
23
+ } | {
24
+ xpubSegwit?: string | undefined;
25
+ path: number[];
26
+ publicKey: string;
27
+ serializedPath: string;
28
+ depth: number;
29
+ fingerprint: number;
30
+ chainCode: string;
31
+ childNum: number;
32
+ xpub: string;
33
+ }[]>;
14
34
  }
15
35
  export {};
16
36
  //# sourceMappingURL=ethereumGetPublicKey.d.ts.map
@@ -6,6 +6,8 @@ const pathUtils_1 = require("../../../utils/pathUtils");
6
6
  const ethereumUtils_1 = require("../../../utils/ethereumUtils");
7
7
  const coinInfo_1 = require("../../../data/coinInfo");
8
8
  const events_1 = require("../../../events");
9
+ const schema_utils_1 = require("@trezor/schema-utils");
10
+ const types_1 = require("../../../types");
9
11
  class EthereumGetPublicKey extends AbstractMethod_1.AbstractMethod {
10
12
  init() {
11
13
  this.requiredPermissions = ['read'];
@@ -13,12 +15,8 @@ class EthereumGetPublicKey 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
- ]);
22
20
  const path = (0, pathUtils_1.validatePath)(batch.path, 3);
23
21
  const network = (0, coinInfo_1.getEthereumNetwork)(path);
24
22
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, network, this.firmwareRange);