@trezor/connect 9.1.9 → 9.1.11

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 +16 -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 +10 -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 +7 -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 +4 -4
  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 +163 -57
  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
@@ -1,17 +1,18 @@
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");
5
4
  const constants_1 = require("../constants");
6
5
  const BlockchainLink_1 = require("../backend/BlockchainLink");
7
6
  const coinInfo_1 = require("../data/coinInfo");
7
+ const types_1 = require("../types");
8
+ const schema_utils_1 = require("@trezor/schema-utils");
8
9
  class BlockchainDisconnect extends AbstractMethod_1.AbstractMethod {
9
10
  init() {
10
11
  this.requiredPermissions = [];
11
12
  this.useDevice = false;
12
13
  this.useUi = false;
13
14
  const { payload } = this;
14
- (0, paramsValidator_1.validateParams)(payload, [{ name: 'coin', type: 'string', required: true }]);
15
+ (0, schema_utils_1.Assert)(types_1.CoinObj, payload);
15
16
  const coinInfo = (0, coinInfo_1.getCoinInfo)(payload.coin);
16
17
  if (!coinInfo) {
17
18
  throw constants_1.ERRORS.TypedError('Method_UnknownCoin');
@@ -6,7 +6,7 @@ type Params = {
6
6
  };
7
7
  export default class BlockchainGetAccountBalanceHistory extends AbstractMethod<'blockchainGetAccountBalanceHistory', Params> {
8
8
  init(): void;
9
- run(): Promise<import("packages/blockchain-link-types/lib/common").AccountBalanceHistory[]>;
9
+ run(): Promise<import("@trezor/blockchain-link-types/lib/common").AccountBalanceHistory[]>;
10
10
  }
11
11
  export {};
12
12
  //# sourceMappingURL=blockchainGetAccountBalanceHistory.d.ts.map
@@ -9,7 +9,7 @@ export default class BlockchainGetCurrentFiatRates extends AbstractMethod<'block
9
9
  init(): void;
10
10
  run(): Promise<{
11
11
  ts: number;
12
- rates: import("packages/blockchain-link-types/lib/common").FiatRates;
12
+ rates: import("@trezor/blockchain-link-types/lib/common").FiatRates;
13
13
  }>;
14
14
  }
15
15
  export {};
@@ -11,7 +11,7 @@ export default class BlockchainGetFiatRatesForTimestamps extends AbstractMethod<
11
11
  run(): Promise<{
12
12
  tickers: {
13
13
  ts: number;
14
- rates: import("packages/blockchain-link-types/lib/common").FiatRates;
14
+ rates: import("@trezor/blockchain-link-types/lib/common").FiatRates;
15
15
  }[];
16
16
  }>;
17
17
  }
@@ -6,7 +6,7 @@ type Params = {
6
6
  };
7
7
  export default class BlockchainGetTransactions extends AbstractMethod<'blockchainGetTransactions', Params> {
8
8
  init(): void;
9
- run(): Promise<import("packages/blockchain-link-types/lib/common").Transaction[]>;
9
+ run(): Promise<import("@trezor/blockchain-link-types/lib/common").Transaction[]>;
10
10
  }
11
11
  export {};
12
12
  //# sourceMappingURL=blockchainGetTransactions.d.ts.map
@@ -3,6 +3,8 @@ import { PROTO } from '../constants';
3
3
  export default class CancelCoinjoinAuthorization extends AbstractMethod<'cancelCoinjoinAuthorization', PROTO.CancelAuthorization> {
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=cancelCoinjoinAuthorization.d.ts.map
@@ -2,9 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const AbstractMethod_1 = require("../core/AbstractMethod");
4
4
  const paramsValidator_1 = require("./common/paramsValidator");
5
+ const schema_utils_1 = require("@trezor/schema-utils");
6
+ const cancelCoinjoinAuthorization_1 = require("../types/api/cancelCoinjoinAuthorization");
5
7
  class CancelCoinjoinAuthorization extends AbstractMethod_1.AbstractMethod {
6
8
  init() {
7
9
  const { payload } = this;
10
+ (0, schema_utils_1.Assert)(cancelCoinjoinAuthorization_1.CancelCoinjoinAuthorization, payload);
8
11
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
9
12
  this.preauthorized =
10
13
  typeof payload.preauthorized === 'boolean' ? payload.preauthorized : true;
@@ -16,9 +16,11 @@ export default class CardanoGetAddress extends AbstractMethod<'cardanoGetAddress
16
16
  } | undefined;
17
17
  confirmation(): Promise<boolean>;
18
18
  noBackupConfirmation(): Promise<boolean>;
19
- _call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, chunkify, }: Params): Promise<PROTO.CardanoAddress>;
19
+ _call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, chunkify, }: Params): Promise<{
20
+ address: string;
21
+ }>;
20
22
  _ensureFirmwareSupportsBatch(batch: Params): void;
21
- run(): Promise<import("../../..").CardanoAddress | import("../../..").CardanoAddress[]>;
23
+ run(): Promise<import("../../../types").CardanoAddress | import("../../../types").CardanoAddress[]>;
22
24
  }
23
25
  export {};
24
26
  //# sourceMappingURL=cardanoGetAddress.d.ts.map
@@ -7,6 +7,9 @@ const pathUtils_1 = require("../../../utils/pathUtils");
7
7
  const cardanoAddressParameters_1 = require("../cardanoAddressParameters");
8
8
  const constants_1 = require("../../../constants");
9
9
  const events_1 = require("../../../events");
10
+ const schema_utils_1 = require("@trezor/schema-utils");
11
+ const types_1 = require("../../../types");
12
+ const cardano_1 = require("../../../types/api/cardano");
10
13
  class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
11
14
  constructor() {
12
15
  super(...arguments);
@@ -19,20 +22,8 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
19
22
  const payload = !this.payload.bundle
20
23
  ? { ...this.payload, bundle: [this.payload] }
21
24
  : this.payload;
22
- (0, paramsValidator_1.validateParams)(payload, [
23
- { name: 'bundle', type: 'array' },
24
- { name: 'useEventListener', type: 'boolean' },
25
- ]);
25
+ (0, schema_utils_1.Assert)((0, types_1.Bundle)(cardano_1.CardanoGetAddress), payload);
26
26
  this.params = payload.bundle.map(batch => {
27
- (0, paramsValidator_1.validateParams)(batch, [
28
- { name: 'addressParameters', type: 'object', required: true },
29
- { name: 'networkId', type: 'number', required: true },
30
- { name: 'protocolMagic', type: 'number', required: true },
31
- { name: 'derivationType', type: 'number' },
32
- { name: 'address', type: 'string' },
33
- { name: 'showOnTrezor', type: 'boolean' },
34
- { name: 'chunkify', type: 'boolean' },
35
- ]);
36
27
  (0, cardanoAddressParameters_1.validateAddressParameters)(batch.addressParameters);
37
28
  return {
38
29
  address_parameters: (0, cardanoAddressParameters_1.addressParametersToProto)(batch.addressParameters),
@@ -1,6 +1,6 @@
1
1
  import { PROTO } from '../../../constants';
2
2
  import { AbstractMethod } from '../../../core/AbstractMethod';
3
- import type { CardanoNativeScript } from '../../../types/api/cardano';
3
+ import { CardanoNativeScript } from '../../../types/api/cardano';
4
4
  export default class CardanoGetNativeScriptHash extends AbstractMethod<'cardanoGetNativeScriptHash', PROTO.CardanoGetNativeScriptHash> {
5
5
  init(): void;
6
6
  get info(): string;
@@ -5,16 +5,14 @@ const AbstractMethod_1 = require("../../../core/AbstractMethod");
5
5
  const paramsValidator_1 = require("../../common/paramsValidator");
6
6
  const coinInfo_1 = require("../../../data/coinInfo");
7
7
  const pathUtils_1 = require("../../../utils/pathUtils");
8
+ const cardano_1 = require("../../../types/api/cardano");
9
+ const schema_utils_1 = require("@trezor/schema-utils");
8
10
  class CardanoGetNativeScriptHash extends AbstractMethod_1.AbstractMethod {
9
11
  init() {
10
12
  this.requiredPermissions = ['read'];
11
13
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Cardano'), this.firmwareRange);
12
14
  const { payload } = this;
13
- (0, paramsValidator_1.validateParams)(payload, [
14
- { name: 'script', type: 'object', required: true },
15
- { name: 'displayFormat', type: 'number', required: true },
16
- { name: 'derivationType', type: 'number' },
17
- ]);
15
+ (0, schema_utils_1.Assert)(cardano_1.CardanoGetNativeScriptHash, payload);
18
16
  this.validateScript(payload.script);
19
17
  this.params = {
20
18
  script: this.scriptToProto(payload.script),
@@ -28,14 +26,6 @@ class CardanoGetNativeScriptHash extends AbstractMethod_1.AbstractMethod {
28
26
  return 'Get Cardano native script hash';
29
27
  }
30
28
  validateScript(script) {
31
- (0, paramsValidator_1.validateParams)(script, [
32
- { name: 'type', type: 'number', required: true },
33
- { name: 'scripts', type: 'array', allowEmpty: true },
34
- { name: 'keyHash', type: 'string' },
35
- { name: 'requiredSignaturesCount', type: 'number' },
36
- { name: 'invalidBefore', type: 'uint' },
37
- { name: 'invalidHereafter', type: 'uint' },
38
- ]);
39
29
  if (script.keyPath) {
40
30
  (0, pathUtils_1.validatePath)(script.keyPath, 3);
41
31
  }
@@ -10,7 +10,7 @@ export default class CardanoGetPublicKey extends AbstractMethod<'cardanoGetPubli
10
10
  get info(): string;
11
11
  confirmation(): Promise<boolean>;
12
12
  noBackupConfirmation(allowSuppression?: boolean): Promise<boolean>;
13
- run(): Promise<import("../../..").CardanoPublicKey | import("../../..").CardanoPublicKey[]>;
13
+ run(): Promise<import("../../../types").CardanoPublicKey | import("../../../types").CardanoPublicKey[]>;
14
14
  }
15
15
  export {};
16
16
  //# sourceMappingURL=cardanoGetPublicKey.d.ts.map
@@ -6,6 +6,9 @@ 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 events_1 = require("../../../events");
9
+ const schema_utils_1 = require("@trezor/schema-utils");
10
+ const types_1 = require("../../../types");
11
+ const cardano_1 = require("../../../types/api/cardano");
9
12
  class CardanoGetPublicKey extends AbstractMethod_1.AbstractMethod {
10
13
  init() {
11
14
  this.requiredPermissions = ['read'];
@@ -14,14 +17,8 @@ class CardanoGetPublicKey extends AbstractMethod_1.AbstractMethod {
14
17
  const payload = !this.payload.bundle
15
18
  ? { ...this.payload, bundle: [this.payload] }
16
19
  : this.payload;
17
- (0, paramsValidator_1.validateParams)(payload, [{ name: 'bundle', type: 'array' }]);
20
+ (0, schema_utils_1.Assert)((0, types_1.Bundle)(cardano_1.CardanoGetPublicKey), payload);
18
21
  this.params = payload.bundle.map(batch => {
19
- (0, paramsValidator_1.validateParams)(batch, [
20
- { name: 'path', required: true },
21
- { name: 'derivationType', type: 'number' },
22
- { name: 'showOnTrezor', type: 'boolean' },
23
- { name: 'suppressBackupWarning', type: 'boolean' },
24
- ]);
25
22
  const path = (0, pathUtils_1.validatePath)(batch.path, 3);
26
23
  return {
27
24
  address_n: path,
@@ -3,7 +3,7 @@ import type { CertificateWithPoolOwnersAndRelays } from '../cardanoCertificate';
3
3
  import { Path, InputWithPath, CollateralInputWithPath } from '../cardanoInputs';
4
4
  import type { OutputWithData } from '../cardanoOutputs';
5
5
  import { PROTO } from '../../../constants';
6
- import type { CardanoAuxiliaryDataSupplement, CardanoSignedTxData, CardanoSignedTxWitness } from '../../../types/api/cardano';
6
+ import { type CardanoSignedTxData } from '../../../types/api/cardano';
7
7
  import type { AssetGroupWithTokens } from '../cardanoTokenBundle';
8
8
  declare const CardanoSignTransactionFeatures: Readonly<{
9
9
  TransactionStreaming: string[];
@@ -55,11 +55,33 @@ export default class CardanoSignTransaction extends AbstractMethod<'cardanoSignT
55
55
  _ensureFeatureIsSupported(feature: keyof typeof CardanoSignTransactionFeatures): void;
56
56
  _ensureFirmwareSupportsParams(): void;
57
57
  _sign_tx(): Promise<CardanoSignedTxData>;
58
- run(): Promise<CardanoSignedTxData | {
58
+ run(): Promise<{
59
+ auxiliaryDataSupplement?: {
60
+ cVoteRegistrationSignature?: string | undefined;
61
+ type: PROTO.CardanoTxAuxiliaryDataSupplementType;
62
+ auxiliaryDataHash: string;
63
+ } | undefined;
64
+ hash: string;
65
+ witnesses: {
66
+ chainCode?: string | undefined;
67
+ type: PROTO.CardanoTxWitnessType;
68
+ signature: string;
69
+ pubKey: string;
70
+ }[];
71
+ } | {
59
72
  serializedTx: string;
73
+ auxiliaryDataSupplement?: {
74
+ cVoteRegistrationSignature?: string | undefined;
75
+ type: PROTO.CardanoTxAuxiliaryDataSupplementType;
76
+ auxiliaryDataHash: string;
77
+ } | undefined;
60
78
  hash: string;
61
- witnesses: CardanoSignedTxWitness[];
62
- auxiliaryDataSupplement?: CardanoAuxiliaryDataSupplement | undefined;
79
+ witnesses: {
80
+ chainCode?: string | undefined;
81
+ type: PROTO.CardanoTxWitnessType;
82
+ signature: string;
83
+ pubKey: string;
84
+ }[];
63
85
  }>;
64
86
  }
65
87
  export {};
@@ -10,8 +10,10 @@ const cardanoCertificate_1 = require("../cardanoCertificate");
10
10
  const cardanoInputs_1 = require("../cardanoInputs");
11
11
  const cardanoOutputs_1 = require("../cardanoOutputs");
12
12
  const constants_1 = require("../../../constants");
13
+ const cardano_1 = require("../../../types/api/cardano");
13
14
  const cardanoWitnesses_1 = require("../cardanoWitnesses");
14
15
  const cardanoTokenBundle_1 = require("../cardanoTokenBundle");
16
+ const schema_utils_1 = require("@trezor/schema-utils");
15
17
  const CardanoSignTransactionFeatures = Object.freeze({
16
18
  TransactionStreaming: ['0', '2.4.2'],
17
19
  TokenMinting: ['0', '2.4.3'],
@@ -46,30 +48,7 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
46
48
  payload.auxiliaryData.cVoteRegistrationParameters =
47
49
  payload.auxiliaryData.governanceRegistrationParameters;
48
50
  }
49
- (0, paramsValidator_1.validateParams)(payload, [
50
- { name: 'signingMode', type: 'number', required: true },
51
- { name: 'inputs', type: 'array', required: true },
52
- { name: 'outputs', type: 'array', required: true, allowEmpty: true },
53
- { name: 'fee', type: 'uint', required: true },
54
- { name: 'ttl', type: 'uint' },
55
- { name: 'certificates', type: 'array', allowEmpty: true },
56
- { name: 'withdrawals', type: 'array', allowEmpty: true },
57
- { name: 'mint', type: 'array', allowEmpty: true },
58
- { name: 'validityIntervalStart', type: 'uint' },
59
- { name: 'scriptDataHash', type: 'string' },
60
- { name: 'collateralInputs', type: 'array', allowEmpty: true },
61
- { name: 'requiredSigners', type: 'array', allowEmpty: true },
62
- { name: 'totalCollateral', type: 'uint' },
63
- { name: 'referenceInputs', type: 'array', allowEmpty: true },
64
- { name: 'protocolMagic', type: 'number', required: true },
65
- { name: 'networkId', type: 'number', required: true },
66
- { name: 'additionalWitnessRequests', type: 'array', allowEmpty: true },
67
- { name: 'derivationType', type: 'number' },
68
- { name: 'includeNetworkId', type: 'boolean' },
69
- { name: 'unsignedTx', type: 'object' },
70
- { name: 'testnet', type: 'boolean' },
71
- { name: 'chunkify', type: 'boolean' },
72
- ]);
51
+ (0, schema_utils_1.AssertWeak)(schema_utils_1.Type.Union([cardano_1.CardanoSignTransaction, cardano_1.CardanoSignTransactionExtended]), payload);
73
52
  const inputsWithPath = payload.inputs.map(cardanoInputs_1.transformInput);
74
53
  const outputsWithData = payload.outputs.map(cardanoOutputs_1.transformOutput);
75
54
  let certificatesWithPoolOwnersAndRelays = [];
@@ -78,19 +57,12 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
78
57
  }
79
58
  let withdrawals = [];
80
59
  if (payload.withdrawals) {
81
- withdrawals = payload.withdrawals.map(withdrawal => {
82
- (0, paramsValidator_1.validateParams)(withdrawal, [
83
- { name: 'amount', type: 'uint', required: true },
84
- { name: 'scriptHash', type: 'string' },
85
- { name: 'keyHash', type: 'string' },
86
- ]);
87
- return {
88
- path: withdrawal.path ? (0, pathUtils_1.validatePath)(withdrawal.path, 5) : undefined,
89
- amount: withdrawal.amount,
90
- script_hash: withdrawal.scriptHash,
91
- key_hash: withdrawal.keyHash,
92
- };
93
- });
60
+ withdrawals = payload.withdrawals.map(withdrawal => ({
61
+ path: withdrawal.path ? (0, pathUtils_1.validatePath)(withdrawal.path, 5) : undefined,
62
+ amount: withdrawal.amount,
63
+ script_hash: withdrawal.scriptHash,
64
+ key_hash: withdrawal.keyHash,
65
+ }));
94
66
  }
95
67
  let mint = [];
96
68
  if (payload.mint) {
@@ -110,15 +82,12 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
110
82
  }
111
83
  let requiredSigners = [];
112
84
  if (payload.requiredSigners) {
113
- requiredSigners = payload.requiredSigners.map(requiredSigner => {
114
- (0, paramsValidator_1.validateParams)(requiredSigner, [{ name: 'keyHash', type: 'string' }]);
115
- return {
116
- key_path: requiredSigner.keyPath
117
- ? (0, pathUtils_1.validatePath)(requiredSigner.keyPath, 3)
118
- : undefined,
119
- key_hash: requiredSigner.keyHash,
120
- };
121
- });
85
+ requiredSigners = payload.requiredSigners.map(requiredSigner => ({
86
+ key_path: requiredSigner.keyPath
87
+ ? (0, pathUtils_1.validatePath)(requiredSigner.keyPath, 3)
88
+ : undefined,
89
+ key_hash: requiredSigner.keyHash,
90
+ }));
122
91
  }
123
92
  const collateralReturnWithData = payload.collateralReturn
124
93
  ? (0, cardanoOutputs_1.transformOutput)(payload.collateralReturn)
@@ -1,6 +1,6 @@
1
1
  import { PROTO } from '../../constants';
2
2
  import type { Device } from '../../device/Device';
3
- import type { CardanoAddressParameters } from '../../types/api/cardano';
3
+ import { CardanoAddressParameters } from '../../types/api/cardano';
4
4
  export declare const validateAddressParameters: (addressParameters: CardanoAddressParameters) => void;
5
5
  export declare const modifyAddressParametersForBackwardsCompatibility: (device: Device, address_parameters: PROTO.CardanoAddressParametersType) => PROTO.CardanoAddressParametersType;
6
6
  export declare const addressParametersToProto: (addressParameters: CardanoAddressParameters) => PROTO.CardanoAddressParametersType;
@@ -1,29 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addressParametersFromProto = exports.addressParametersToProto = exports.modifyAddressParametersForBackwardsCompatibility = exports.validateAddressParameters = void 0;
4
- const paramsValidator_1 = require("../common/paramsValidator");
5
4
  const pathUtils_1 = require("../../utils/pathUtils");
6
5
  const constants_1 = require("../../constants");
6
+ const cardano_1 = require("../../types/api/cardano");
7
+ const schema_utils_1 = require("@trezor/schema-utils");
7
8
  const validateAddressParameters = (addressParameters) => {
8
- (0, paramsValidator_1.validateParams)(addressParameters, [
9
- { name: 'addressType', type: 'number', required: true },
10
- { name: 'stakingKeyHash', type: 'string' },
11
- { name: 'paymentScriptHash', type: 'string' },
12
- { name: 'stakingScriptHash', type: 'string' },
13
- ]);
9
+ (0, schema_utils_1.Assert)(cardano_1.CardanoAddressParameters, addressParameters);
14
10
  if (addressParameters.path) {
15
11
  (0, pathUtils_1.validatePath)(addressParameters.path);
16
12
  }
17
13
  if (addressParameters.stakingPath) {
18
14
  (0, pathUtils_1.validatePath)(addressParameters.stakingPath);
19
15
  }
20
- if (addressParameters.certificatePointer) {
21
- (0, paramsValidator_1.validateParams)(addressParameters.certificatePointer, [
22
- { name: 'blockIndex', type: 'number', required: true },
23
- { name: 'txIndex', type: 'number', required: true },
24
- { name: 'certificateIndex', type: 'number', required: true },
25
- ]);
26
- }
27
16
  };
28
17
  exports.validateAddressParameters = validateAddressParameters;
29
18
  const modifyAddressParametersForBackwardsCompatibility = (device, address_parameters) => {
@@ -1,6 +1,6 @@
1
1
  import type { Device } from '../../device/Device';
2
2
  import { PROTO } from '../../constants';
3
- import type { CardanoAuxiliaryData } from '../../types/api/cardano';
3
+ import { CardanoAuxiliaryData } from '../../types/api/cardano';
4
4
  export declare const transformAuxiliaryData: (auxiliaryData: CardanoAuxiliaryData) => PROTO.CardanoTxAuxiliaryData;
5
5
  export declare const modifyAuxiliaryDataForBackwardsCompatibility: (device: Device, auxiliary_data: PROTO.CardanoTxAuxiliaryData) => PROTO.CardanoTxAuxiliaryData;
6
6
  //# sourceMappingURL=cardanoAuxiliaryData.d.ts.map
@@ -2,19 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.modifyAuxiliaryDataForBackwardsCompatibility = exports.transformAuxiliaryData = void 0;
4
4
  const cardanoAddressParameters_1 = require("./cardanoAddressParameters");
5
- const paramsValidator_1 = require("../common/paramsValidator");
6
5
  const pathUtils_1 = require("../../utils/pathUtils");
7
6
  const constants_1 = require("../../constants");
7
+ const cardano_1 = require("../../types/api/cardano");
8
+ const schema_utils_1 = require("@trezor/schema-utils");
8
9
  const MAX_DELEGATION_COUNT = 32;
9
10
  const transformDelegation = (delegation) => {
10
11
  if (delegation.votingPublicKey) {
11
12
  console.warn('Please use votePublicKey instead of votingPublicKey.');
12
13
  delegation.votePublicKey = delegation.votingPublicKey;
13
14
  }
14
- (0, paramsValidator_1.validateParams)(delegation, [
15
- { name: 'votePublicKey', type: 'string', required: true },
16
- { name: 'weight', type: 'uint', required: true },
17
- ]);
15
+ (0, schema_utils_1.Assert)(cardano_1.CardanoCVoteRegistrationDelegation, delegation);
18
16
  return {
19
17
  vote_public_key: delegation.votePublicKey,
20
18
  weight: delegation.weight,
@@ -30,15 +28,7 @@ const transformCvoteRegistrationParameters = (cVoteRegistrationParameters) => {
30
28
  cVoteRegistrationParameters.paymentAddressParameters =
31
29
  cVoteRegistrationParameters.rewardAddressParameters;
32
30
  }
33
- (0, paramsValidator_1.validateParams)(cVoteRegistrationParameters, [
34
- { name: 'votePublicKey', type: 'string' },
35
- { name: 'stakingPath', required: true },
36
- { name: 'nonce', type: 'uint', required: true },
37
- { name: 'format', type: 'number' },
38
- { name: 'delegations', type: 'array', allowEmpty: true },
39
- { name: 'votingPurpose', type: 'uint' },
40
- { name: 'address', type: 'string' },
41
- ]);
31
+ (0, schema_utils_1.Assert)(cardano_1.CardanoCVoteRegistrationParameters, cVoteRegistrationParameters);
42
32
  const { paymentAddressParameters } = cVoteRegistrationParameters;
43
33
  if (paymentAddressParameters) {
44
34
  (0, cardanoAddressParameters_1.validateAddressParameters)(paymentAddressParameters);
@@ -61,12 +51,7 @@ const transformCvoteRegistrationParameters = (cVoteRegistrationParameters) => {
61
51
  };
62
52
  };
63
53
  const transformAuxiliaryData = (auxiliaryData) => {
64
- (0, paramsValidator_1.validateParams)(auxiliaryData, [
65
- {
66
- name: 'hash',
67
- type: 'string',
68
- },
69
- ]);
54
+ (0, schema_utils_1.Assert)(cardano_1.CardanoAuxiliaryData, auxiliaryData);
70
55
  let cVoteRegistrationParameters;
71
56
  if (auxiliaryData.cVoteRegistrationParameters) {
72
57
  cVoteRegistrationParameters = transformCvoteRegistrationParameters(auxiliaryData.cVoteRegistrationParameters);
@@ -1,5 +1,5 @@
1
1
  import { PROTO } from '../../constants';
2
- import type { CardanoCertificate } from '../../types/api/cardano';
2
+ import { CardanoCertificate } from '../../types/api/cardano';
3
3
  export type CertificateWithPoolOwnersAndRelays = {
4
4
  certificate: PROTO.CardanoTxCertificate;
5
5
  poolOwners: PROTO.CardanoPoolOwner[];
@@ -1,57 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformCertificate = void 0;
4
- const paramsValidator_1 = require("../common/paramsValidator");
5
4
  const pathUtils_1 = require("../../utils/pathUtils");
6
5
  const constants_1 = require("../../constants");
6
+ const cardano_1 = require("../../types/api/cardano");
7
+ const schema_utils_1 = require("@trezor/schema-utils");
7
8
  const ipv4AddressToHex = (ipv4Address) => Buffer.from(ipv4Address.split('.').map(ipPart => parseInt(ipPart, 10))).toString('hex');
8
9
  const ipv6AddressToHex = (ipv6Address) => ipv6Address.split(':').join('');
9
- const validatePoolMargin = (margin) => {
10
- (0, paramsValidator_1.validateParams)(margin, [
11
- { name: 'numerator', type: 'string', required: true },
12
- { name: 'denominator', type: 'string', required: true },
13
- ]);
14
- };
15
- const validatePoolMetadata = (metadata) => {
16
- (0, paramsValidator_1.validateParams)(metadata, [
17
- { name: 'url', type: 'string', required: true },
18
- { name: 'hash', type: 'string', required: true },
19
- ]);
20
- };
21
10
  const validatePoolRelay = (relay) => {
22
- (0, paramsValidator_1.validateParams)(relay, [{ name: 'type', type: 'number', required: true }]);
11
+ (0, schema_utils_1.Assert)(cardano_1.CardanoPoolRelay, relay);
23
12
  if (relay.type === constants_1.PROTO.CardanoPoolRelayType.SINGLE_HOST_IP) {
24
- const paramsToValidate = [
25
- { name: 'port', type: 'number', required: true },
26
- ];
27
- if (relay.ipv4Address) {
28
- paramsToValidate.push({ name: 'ipv4Address', type: 'string', required: false });
29
- }
30
- if (relay.ipv6Address) {
31
- paramsToValidate.push({ name: 'ipv6Address', type: 'string', required: false });
32
- }
33
- (0, paramsValidator_1.validateParams)(relay, paramsToValidate);
34
13
  if (!relay.ipv4Address && !relay.ipv6Address) {
35
14
  throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Either ipv4Address or ipv6Address must be supplied');
36
15
  }
37
16
  }
38
17
  else if (relay.type === constants_1.PROTO.CardanoPoolRelayType.SINGLE_HOST_NAME) {
39
- (0, paramsValidator_1.validateParams)(relay, [
40
- { name: 'hostName', type: 'string', required: true },
41
- { name: 'port', type: 'number', required: true },
42
- ]);
18
+ if (!relay.hostName) {
19
+ throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'hostName must be supplied');
20
+ }
21
+ if (!relay.port) {
22
+ throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'port must be supplied');
23
+ }
43
24
  }
44
25
  else if (relay.type === constants_1.PROTO.CardanoPoolRelayType.MULTIPLE_HOST_NAME) {
45
- (0, paramsValidator_1.validateParams)(relay, [{ name: 'hostName', type: 'string', required: true }]);
26
+ if (!relay.hostName) {
27
+ throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'hostName must be supplied');
28
+ }
46
29
  }
47
30
  };
48
31
  const validatePoolOwners = (owners) => {
49
32
  owners.forEach(owner => {
50
- if (owner.stakingKeyHash) {
51
- (0, paramsValidator_1.validateParams)(owner, [
52
- { name: 'stakingKeyHash', type: 'string', required: !owner.stakingKeyPath },
53
- ]);
54
- }
55
33
  if (owner.stakingKeyPath) {
56
34
  (0, pathUtils_1.validatePath)(owner.stakingKeyPath, 5);
57
35
  }
@@ -65,23 +43,9 @@ const validatePoolOwners = (owners) => {
65
43
  }
66
44
  };
67
45
  const validatePoolParameters = (poolParameters) => {
68
- (0, paramsValidator_1.validateParams)(poolParameters, [
69
- { name: 'poolId', type: 'string', required: true },
70
- { name: 'vrfKeyHash', type: 'string', required: true },
71
- { name: 'pledge', type: 'string', required: true },
72
- { name: 'cost', type: 'string', required: true },
73
- { name: 'margin', type: 'object', required: true },
74
- { name: 'rewardAccount', type: 'string', required: true },
75
- { name: 'owners', type: 'array', required: true },
76
- { name: 'relays', type: 'array', required: true, allowEmpty: true },
77
- { name: 'metadata', type: 'object' },
78
- ]);
79
- validatePoolMargin(poolParameters.margin);
46
+ (0, schema_utils_1.Assert)(cardano_1.CardanoPoolParameters, poolParameters);
80
47
  validatePoolOwners(poolParameters.owners);
81
48
  poolParameters.relays.forEach(validatePoolRelay);
82
- if (poolParameters.metadata) {
83
- validatePoolMetadata(poolParameters.metadata);
84
- }
85
49
  };
86
50
  const transformPoolParameters = (poolParameters) => {
87
51
  if (!poolParameters) {
@@ -117,20 +81,17 @@ const transformPoolParameters = (poolParameters) => {
117
81
  };
118
82
  };
119
83
  const transformCertificate = (certificate) => {
120
- const paramsToValidate = [
121
- { name: 'type', type: 'number', required: true },
122
- ];
123
- if (certificate.type !== constants_1.PROTO.CardanoCertificateType.STAKE_POOL_REGISTRATION) {
124
- paramsToValidate.push({ name: 'scriptHash', type: 'string' });
125
- paramsToValidate.push({ name: 'keyHash', type: 'string' });
126
- }
84
+ (0, schema_utils_1.Assert)(cardano_1.CardanoCertificate, certificate);
127
85
  if (certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_DELEGATION) {
128
- paramsToValidate.push({ name: 'pool', type: 'string', required: true });
86
+ if (!certificate.pool) {
87
+ throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'pool must be supplied for STAKE_DELEGATION');
88
+ }
129
89
  }
130
90
  if (certificate.type === constants_1.PROTO.CardanoCertificateType.STAKE_POOL_REGISTRATION) {
131
- paramsToValidate.push({ name: 'poolParameters', type: 'object', required: true });
91
+ if (!certificate.poolParameters) {
92
+ throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'poolParameters must be supplied for STAKE_POOL_REGISTRATION');
93
+ }
132
94
  }
133
- (0, paramsValidator_1.validateParams)(certificate, paramsToValidate);
134
95
  const { poolParameters, poolOwners, poolRelays } = transformPoolParameters(certificate.poolParameters);
135
96
  return {
136
97
  certificate: {
@@ -1,14 +1,26 @@
1
- import type { PROTO } from '../../constants';
1
+ import { PROTO } from '../../constants';
2
+ import { Static } from '@trezor/schema-utils';
2
3
  export type Path = number[];
3
- export type InputWithPath = {
4
- input: PROTO.CardanoTxInput;
5
- path?: Path;
6
- };
4
+ export declare const Path: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>;
7
5
  export type CollateralInputWithPath = {
8
6
  collateralInput: PROTO.CardanoTxCollateralInput;
9
7
  path?: Path;
10
8
  };
11
- export declare const transformInput: (input: any) => InputWithPath;
12
- export declare const transformCollateralInput: (collateralInput: any) => CollateralInputWithPath;
13
- export declare const transformReferenceInput: (referenceInput: any) => PROTO.CardanoTxReferenceInput;
9
+ export type InputWithPath = Static<typeof InputWithPath>;
10
+ export declare const InputWithPath: import("@sinclair/typebox").TObject<{
11
+ input: import("@sinclair/typebox").TObject<{
12
+ prev_hash: import("@sinclair/typebox").TString;
13
+ prev_index: import("@sinclair/typebox").TNumber;
14
+ }>;
15
+ path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>>;
16
+ }>;
17
+ export type InputWithPathParam = Static<typeof InputWithPath>;
18
+ export declare const InputWithPathParam: import("@sinclair/typebox").TObject<{
19
+ path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>>;
20
+ prev_hash: import("@sinclair/typebox").TString;
21
+ prev_index: import("@sinclair/typebox").TNumber;
22
+ }>;
23
+ export declare const transformInput: (input: unknown) => InputWithPath;
24
+ export declare const transformCollateralInput: (collateralInput: unknown) => CollateralInputWithPath;
25
+ export declare const transformReferenceInput: (referenceInput: unknown) => PROTO.CardanoTxReferenceInput;
14
26
  //# sourceMappingURL=cardanoInputs.d.ts.map