@ledgerhq/revault-api 1.44.0 → 1.46.0

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.
package/lib/fakes.mjs CHANGED
@@ -3,10 +3,10 @@ import { faker } from '@faker-js/faker';
3
3
  import { ChallengeType, PsdModel, UserRole, UserRegistrationState, AllowedAction, AdminPermission, RequestType, AccountGovernanceType, ActivationStatus, AccountType, MessageType, WhitelistType, UserDeviceType, RequestReviewStatus, RequestState, GateAccountType, GateUserType } from '@prisma/client';
4
4
  import { match, P } from 'ts-pattern';
5
5
  import z14, { z } from 'zod';
6
- import invariant8 from 'invariant';
7
- import elliptic from 'elliptic';
8
- import { omit, times, get, isPlainObject } from 'lodash-es';
6
+ import invariant5 from 'invariant';
9
7
  import 'axios';
8
+ import { omit, times, get, isPlainObject } from 'lodash-es';
9
+ import elliptic from 'elliptic';
10
10
 
11
11
  var zHexString = z.string().regex(/^[0-9a-fA-F]+$/);
12
12
  var zIntString = z.string().nonempty().regex(/^(-?[1-9]\d*|0)$/);
@@ -125,9 +125,10 @@ var BITCOIN_SPEC = {
125
125
  var zCantonTransferProposal = z14.object({
126
126
  amount: zUnsignedIntString.meta({ description: "Transfer amount" }),
127
127
  contractId: z14.string().meta({ description: "ID of the transfer-proposal contract" }),
128
+ instrumentAdmin: z14.string().meta({ description: "Issuer of the instrument being transferred" }),
128
129
  instrumentId: z14.string().meta({ description: "ID of the instrument being transferred" }),
129
130
  expiresAtMicros: z14.number().int().meta({ description: "Expiration timestamp in microseconds" }),
130
- memo: z14.string().nullable().meta({ description: "Optional note attached to the proposal" }),
131
+ reason: z14.string().nullable().meta({ description: "Optional reason attached to the transfer" }),
131
132
  sender: z14.string().meta({ description: "Party proposing to send the asset" }),
132
133
  recipient: z14.string().meta({ description: "Intended recipient of the proposed transfer" })
133
134
  }).meta({
@@ -150,8 +151,10 @@ var zCantonLikeTransactionType = z14.enum([
150
151
  "CANTON_LIKE_TAP"
151
152
  ]).meta({ description: "Canton-like transaction type" });
152
153
  var zExecuteBeforeSeconds = z14.number().int().positive().optional().meta({ description: "Execute before seconds" });
154
+ var zCantonReason = z14.string().nullable().meta({ description: "Optional reason attached to the onchain operation" });
153
155
  var zCantonLikeSendData = zCommonTransactionData.omit({ maxFee: true }).extend({
154
156
  executeBeforeSeconds: zExecuteBeforeSeconds,
157
+ reason: zCantonReason,
155
158
  type: z14.literal(zCantonLikeTransactionType.enum.CANTON_LIKE_SEND)
156
159
  }).meta({
157
160
  description: "Canton-like send data",
@@ -159,6 +162,7 @@ var zCantonLikeSendData = zCommonTransactionData.omit({ maxFee: true }).extend({
159
162
  });
160
163
  var zCantonLikeSendTokenData = zCommonTransactionData.omit({ maxFee: true }).extend({
161
164
  executeBeforeSeconds: zExecuteBeforeSeconds,
165
+ reason: zCantonReason,
162
166
  type: z14.literal(zCantonLikeTransactionType.enum.CANTON_LIKE_SEND_TOKEN)
163
167
  }).meta({
164
168
  description: "Canton-like send token data",
@@ -217,7 +221,7 @@ var zCantonLikeTransactionData = z14.discriminatedUnion("type", [
217
221
  zCantonLikeTapData
218
222
  ]);
219
223
  var zCantonLikeTransactionResponse = z14.discriminatedUnion("type", [
220
- zCommonTransactionResponse.extend({ type: zCantonLikeTransactionType }).meta({ description: "Canton-like transaction" })
224
+ zCommonTransactionResponse.extend({ type: zCantonLikeTransactionType, reason: zCantonReason }).meta({ description: "Canton-like transaction" })
221
225
  ]);
222
226
 
223
227
  // src/networks/canton/index.ts
@@ -456,6 +460,40 @@ var GENERIC_SPEC = {
456
460
  zEstimatedFees: z14.never(),
457
461
  zTransactionResponse: zGenericTransactionResponse,
458
462
  zStakingFields: z14.never()};
463
+
464
+ // src/errors.ts
465
+ var ValidationError = class extends Error {
466
+ };
467
+
468
+ // src/sync-utils.ts
469
+ var GATE_SYNC_ID_PREFIX = "gate://";
470
+ var buildGateSyncId = (workspaceName, gateType, gateId) => {
471
+ if (gateId <= 0) {
472
+ throw new ValidationError(`Invalid gate ID: ${gateId}`);
473
+ }
474
+ return `${GATE_SYNC_ID_PREFIX}${workspaceName}/${gateType}/${gateId}`;
475
+ };
476
+
477
+ // src/utils.ts
478
+ var isRecord = (value) => isPlainObject(value);
479
+ var randomHex = (length) => {
480
+ const hexBytes = times(length, () => {
481
+ const randomByte = Math.floor(Math.random() * 256);
482
+ return randomByte.toString(16).padStart(2, "0");
483
+ });
484
+ return hexBytes.join("").toUpperCase();
485
+ };
486
+ var genAuthUserId = () => randomHex(20);
487
+ var ensureNonEmptyArray = (values, message) => {
488
+ invariant5(
489
+ values.length > 0,
490
+ `Expected non-empty array but got one with length ${values.length}`
491
+ );
492
+ return values;
493
+ };
494
+ function unreachable(value) {
495
+ throw new Error(`Un-covered: ${value}`);
496
+ }
459
497
  var zHederaLikeAssetFields = z14.object({
460
498
  type: z14.literal(NetworkFamily.HEDERA_LIKE).meta({ description: "Account type" }),
461
499
  address: z14.string().nullable().meta({ description: "Account address" }),
@@ -469,11 +507,18 @@ var zHederaLikeTransactionType = z14.enum([
469
507
  "HEDERA_LIKE_SEND",
470
508
  "HEDERA_LIKE_RECEIVE",
471
509
  "HEDERA_LIKE_SEND_TOKEN",
472
- "HEDERA_LIKE_RECEIVE_TOKEN"
510
+ "HEDERA_LIKE_RECEIVE_TOKEN",
511
+ "HEDERA_LIKE_STAKE"
473
512
  ]).meta({ description: "Hedera-like transaction type" });
474
- var zHederaLikeLiveData = zCommonLiveData.extend({
475
- type: z14.literal(NetworkFamily.HEDERA_LIKE).meta({ description: "Account type" })
476
- }).meta({ description: "Hedera-like" });
513
+ var zHederaLikeStakingData = z14.object({
514
+ totalStaked: z14.string().meta({ description: "Total staked amount" }),
515
+ totalRewards: z14.string().meta({ description: "Total of rewards" })
516
+ }).nullable().meta({ description: "Hedera-like staking data" });
517
+ var zHederaLikeStakingFields = z14.object({
518
+ type: z14.literal(NetworkFamily.HEDERA_LIKE).meta({ description: "Account type" }),
519
+ staking: zHederaLikeStakingData.optional()
520
+ });
521
+ var zHederaLikeLiveData = zCommonLiveData.extend(zHederaLikeStakingFields.shape).meta({ description: "Hedera-like" });
477
522
  var zHederaLikeSendData = zCommonTransactionData.extend({
478
523
  type: z14.literal(zHederaLikeTransactionType.enum.HEDERA_LIKE_SEND),
479
524
  feeStrategy: zFeeStrategy
@@ -488,9 +533,20 @@ var zHederaLikeSendTokenData = zCommonTransactionData.extend({
488
533
  description: "Hedera-like send token data",
489
534
  id: "HederaLikeSendTokenData"
490
535
  });
536
+ var zHederaLikeStakeData = z14.object({
537
+ type: z14.literal(zHederaLikeTransactionType.enum.HEDERA_LIKE_STAKE),
538
+ currency: zCurrencyString.meta({ description: "Transaction currency" }),
539
+ nodeId: zIntString.meta({ description: "Node ID to delegate to" }),
540
+ maxFee: zUnsignedIntString.nullable().meta({ description: "Transaction max fee" }),
541
+ feeStrategy: zFeeStrategy
542
+ }).meta({
543
+ description: "Hedera-like stake data",
544
+ id: "HederaLikeStakeData"
545
+ });
491
546
  var zHederaLikeTransactionData = z14.discriminatedUnion("type", [
492
547
  zHederaLikeSendData,
493
- zHederaLikeSendTokenData
548
+ zHederaLikeSendTokenData,
549
+ zHederaLikeStakeData
494
550
  ]);
495
551
  var zHederaLikeTransactionResponse = z14.discriminatedUnion("type", [
496
552
  zCommonTransactionResponse.extend({
@@ -507,7 +563,7 @@ var HEDERA_SPEC = {
507
563
  zSendTransactionData: zHederaLikeSendData,
508
564
  zEstimatedFees: zHederaLikeEstimatedFees,
509
565
  zTransactionResponse: zHederaLikeTransactionResponse,
510
- zStakingFields: z.never()};
566
+ zStakingFields: zHederaLikeStakingFields};
511
567
  var zPolkadotLikeAssetFields = z14.object({
512
568
  type: z14.literal(NetworkFamily.POLKADOT_LIKE).meta({ description: "Account type" }),
513
569
  address: z14.string().nullable().meta({ description: "Account address" })
@@ -1239,6 +1295,7 @@ var zAccountLiveData = z14.discriminatedUnion("type", [
1239
1295
  z14.discriminatedUnion("type", [
1240
1296
  CARDANO_SPEC.zStakingFields,
1241
1297
  ETHEREUM_SPEC.zStakingFields,
1298
+ HEDERA_SPEC.zStakingFields,
1242
1299
  POLKADOT_SPEC.zStakingFields,
1243
1300
  SOLANA_SPEC.zStakingFields,
1244
1301
  SUI_SPEC.zStakingFields,
@@ -1327,42 +1384,6 @@ var zTransactionResponse = z14.discriminatedUnion("type", [
1327
1384
  ...TEZOS_SPEC.zTransactionResponse.options,
1328
1385
  ...TRON_SPEC.zTransactionResponse.options
1329
1386
  ]);
1330
-
1331
- // src/errors.ts
1332
- var ValidationError = class extends Error {
1333
- };
1334
-
1335
- // src/sync-utils.ts
1336
- var GATE_SYNC_ID_PREFIX = "gate://";
1337
- var buildGateSyncId = (workspaceName, gateType, gateId) => {
1338
- if (gateId <= 0) {
1339
- throw new ValidationError(`Invalid gate ID: ${gateId}`);
1340
- }
1341
- return `${GATE_SYNC_ID_PREFIX}${workspaceName}/${gateType}/${gateId}`;
1342
- };
1343
-
1344
- // src/utils.ts
1345
- var isRecord = (value) => isPlainObject(value);
1346
- var randomHex = (length) => {
1347
- const hexBytes = times(length, () => {
1348
- const randomByte = Math.floor(Math.random() * 256);
1349
- return randomByte.toString(16).padStart(2, "0");
1350
- });
1351
- return hexBytes.join("").toUpperCase();
1352
- };
1353
- var genAuthUserId = () => randomHex(20);
1354
- var ensureNonEmptyArray = (values, message) => {
1355
- invariant8(
1356
- values.length > 0,
1357
- `Expected non-empty array but got one with length ${values.length}`
1358
- );
1359
- return values;
1360
- };
1361
- function unreachable(value) {
1362
- throw new Error(`Un-covered: ${value}`);
1363
- }
1364
-
1365
- // src/__fakes__/faker-utils.ts
1366
1387
  var { ec: EC } = elliptic;
1367
1388
  var fakeUniqueName = (length = 20) => faker.string.alphanumeric({ length, casing: "lower" });
1368
1389
  var fakeHexString = (length, casing = "upper") => faker.string.hexadecimal({ prefix: "", casing, length });
@@ -1394,6 +1415,19 @@ var fakeCantonAddress = (role) => `${role}-${faker.lorem.word()}::${fakeHexStrin
1394
1415
  var fakeCantonPartyId = () => fakeCantonAddress("party");
1395
1416
  var fakeCantonContractId = () => fakeHexString(138, "lower");
1396
1417
  var fakeCantonInstrumentId = () => fakeHexString(10, "lower");
1418
+ var fakeCantonTransferProposal = (opts) => {
1419
+ return {
1420
+ amount: faker.number.bigInt().toString(),
1421
+ contractId: fakeCantonContractId(),
1422
+ instrumentAdmin: fakeCantonPartyId(),
1423
+ instrumentId: fakeCantonInstrumentId(),
1424
+ expiresAtMicros: faker.number.int(),
1425
+ reason: faker.lorem.sentence(),
1426
+ sender: fakeCantonPartyId(),
1427
+ recipient: fakeCantonPartyId(),
1428
+ ...opts
1429
+ };
1430
+ };
1397
1431
  var injectSyncId = (obj) => {
1398
1432
  let { syncId } = obj;
1399
1433
  if (syncId === void 0) {
@@ -1439,7 +1473,7 @@ var genConsistentAccountType = (opts) => {
1439
1473
  };
1440
1474
  var genAssetFieldsForType = (type) => {
1441
1475
  const currency = faker.helpers.arrayElement(
1442
- type === "RAW_SIGNING" ? ["ethereum", "bitcoin"] : WELL_KNOWN_NETWORKS_BY_FAMILY[type]
1476
+ type === "RAW_SIGNING" ? ["ethereum", "bitcoin", "sui"] : WELL_KNOWN_NETWORKS_BY_FAMILY[type]
1443
1477
  );
1444
1478
  const hsmXpub = fakeHexString(66, "upper");
1445
1479
  const hsmChainCode = fakeHexString(64, "upper");
@@ -1673,16 +1707,46 @@ var genAccount = (opts) => {
1673
1707
  ...rest
1674
1708
  });
1675
1709
  };
1676
- var genSignMessageData = (opts) => ({
1677
- message: {
1678
- type: "EIP191",
1679
- data: fakeHexString(10, "upper")
1680
- },
1681
- accountId: faker.string.uuid(),
1682
- address: faker.finance.ethereumAddress(),
1683
- derivationPath: "44'/60'/0'/0/0",
1684
- ...opts
1685
- });
1710
+ var genSignMessageData = (opts) => getSignMessageDataForType(MessageType.EIP191, opts);
1711
+ var getSignMessageDataForType = (type, opts) => {
1712
+ return {
1713
+ message: type === MessageType.EIP712 ? {
1714
+ type: "EIP712",
1715
+ data: {
1716
+ types: {
1717
+ EIP712Domain: [
1718
+ { name: "name", type: "string" },
1719
+ { name: "version", type: "string" },
1720
+ { name: "chainId", type: "uint256" },
1721
+ { name: "verifyingContract", type: "address" }
1722
+ ],
1723
+ PrimaryType: [
1724
+ { name: "a", type: "int256" },
1725
+ { name: "b", type: "bool" }
1726
+ ]
1727
+ },
1728
+ primaryType: "PrimaryType",
1729
+ domain: {
1730
+ name: "Test Domain",
1731
+ version: "1",
1732
+ chainId: 1,
1733
+ verifyingContract: "0x1234567890123456789012345678901234567890"
1734
+ },
1735
+ message: {
1736
+ a: faker.number.int({ min: 0, max: 1e3 }),
1737
+ b: faker.datatype.boolean()
1738
+ }
1739
+ }
1740
+ } : {
1741
+ type: "EIP191",
1742
+ data: fakeHexString(10, "upper")
1743
+ },
1744
+ accountId: faker.string.uuid(),
1745
+ address: faker.finance.ethereumAddress(),
1746
+ derivationPath: "44'/60'/0'/0/0",
1747
+ ...opts
1748
+ };
1749
+ };
1686
1750
  var genBitcoinLikeSendData = (opts) => {
1687
1751
  return {
1688
1752
  type: "BITCOIN_LIKE_SEND",
@@ -1790,6 +1854,17 @@ var genHederaLikeSendData = (txType) => {
1790
1854
  }
1791
1855
  };
1792
1856
  };
1857
+ var genHederaLikeStakeData = (txType) => {
1858
+ return {
1859
+ type: txType,
1860
+ currency: "hedera",
1861
+ maxFee: faker.number.bigInt({ min: 1 }).toString(),
1862
+ nodeId: faker.number.int({ min: 10, max: 99999999 }).toString(),
1863
+ feeStrategy: {
1864
+ type: faker.helpers.arrayElement(["SLOW", "NORMAL", "FAST"])
1865
+ }
1866
+ };
1867
+ };
1793
1868
  var genPolkadotLikeTxData = (txType) => {
1794
1869
  switch (txType) {
1795
1870
  case "POLKADOT_LIKE_SEND":
@@ -2003,15 +2078,6 @@ var genTronLikeTxData = (txType) => {
2003
2078
  }
2004
2079
  };
2005
2080
  };
2006
- var genCantonTransferProposal = () => ({
2007
- amount: faker.number.bigInt({ min: 0 }).toString(),
2008
- contractId: fakeCantonContractId(),
2009
- instrumentId: fakeCantonInstrumentId(),
2010
- expiresAtMicros: faker.date.future().getTime() * 1e3,
2011
- memo: faker.lorem.sentence(),
2012
- sender: fakeCantonPartyId(),
2013
- recipient: fakeCantonPartyId()
2014
- });
2015
2081
  var genCantonLikeTxData = (txType) => {
2016
2082
  switch (txType) {
2017
2083
  case "CANTON_LIKE_SEND":
@@ -2020,20 +2086,21 @@ var genCantonLikeTxData = (txType) => {
2020
2086
  type: txType,
2021
2087
  currency: "canton_network",
2022
2088
  amount: faker.number.bigInt({ min: 0 }).toString(),
2023
- recipient: fakeCantonPartyId()
2089
+ recipient: fakeCantonPartyId(),
2090
+ reason: faker.helpers.arrayElement([null, faker.lorem.word()])
2024
2091
  };
2025
2092
  case "CANTON_LIKE_WITHDRAW":
2026
2093
  return {
2027
2094
  type: txType,
2028
2095
  currency: "canton_network",
2029
- transferProposal: genCantonTransferProposal(),
2096
+ transferProposal: fakeCantonTransferProposal(),
2030
2097
  reason: faker.lorem.sentence()
2031
2098
  };
2032
2099
  case "CANTON_LIKE_RECEIVE":
2033
2100
  return {
2034
2101
  type: txType,
2035
2102
  currency: "canton_network",
2036
- transferProposal: genCantonTransferProposal(),
2103
+ transferProposal: fakeCantonTransferProposal(),
2037
2104
  verdict: "ACCEPT",
2038
2105
  reason: faker.lorem.sentence()
2039
2106
  };
@@ -2101,6 +2168,9 @@ var genCreateTransactionData = (opts) => {
2101
2168
  case "HEDERA_LIKE_SEND_TOKEN":
2102
2169
  transactionDefaults = genHederaLikeSendData(transactionType);
2103
2170
  break;
2171
+ case "HEDERA_LIKE_STAKE":
2172
+ transactionDefaults = genHederaLikeStakeData(transactionType);
2173
+ break;
2104
2174
  case "POLKADOT_LIKE_SEND":
2105
2175
  case "POLKADOT_LIKE_ADDPROXY":
2106
2176
  case "POLKADOT_LIKE_REMOVEPROXY":
@@ -2204,9 +2274,8 @@ var shouldHaveTargetId = (type) => {
2204
2274
  case RequestType.REVOKE_API_KEY:
2205
2275
  return false;
2206
2276
  case RequestType.CREATE_TRANSACTION:
2207
- // TODO: move to True when we resolved the MetaTransaction id being an int
2208
- case RequestType.SIGN_DIGESTS:
2209
2277
  return false;
2278
+ case RequestType.SIGN_DIGESTS:
2210
2279
  case RequestType.UPDATE_QUORUM:
2211
2280
  case RequestType.CREATE_PSD_USER:
2212
2281
  case RequestType.CREATE_API_USER:
@@ -2667,6 +2736,7 @@ var genVaultRequestReview = (opts) => {
2667
2736
  stepIndex: 0,
2668
2737
  userId: faker.string.uuid(),
2669
2738
  pubKey: fakePubKey(),
2739
+ groupName: null,
2670
2740
  challengeType,
2671
2741
  challenge,
2672
2742
  signature,
@@ -2935,7 +3005,6 @@ var zNote = z14.object({
2935
3005
  });
2936
3006
  var zValueTransactionAction = z.enum([
2937
3007
  AllowedAction.SEND,
2938
- AllowedAction.STAKE,
2939
3008
  AllowedAction.DEPLOY_CONTRACT,
2940
3009
  AllowedAction.EXECUTE_CONTRACT,
2941
3010
  AllowedAction.ACTIVATE_TOKEN
@@ -2956,6 +3025,10 @@ var zReceiveIntent = z.object({
2956
3025
  // null means "any value"
2957
3026
  verdict: z.enum(["ACCEPT", "REJECT"])
2958
3027
  });
3028
+ var zStakeAction = z.enum([AllowedAction.STAKE]);
3029
+ var zStakeIntent = z.object({
3030
+ type: zStakeAction
3031
+ });
2959
3032
  var zSigningAction = z.enum([AllowedAction.SIGN_MESSAGE, AllowedAction.SIGN_DIGESTS]);
2960
3033
  var zSigningIntent = z.object({
2961
3034
  type: zSigningAction
@@ -2973,11 +3046,13 @@ z.enum([AllowedAction.SIGN_DIGESTS]);
2973
3046
  var zGovernableAction = z.enum([
2974
3047
  ...zValueTransactionAction.options,
2975
3048
  ...zReceiveAction.options,
3049
+ ...zStakeAction.options,
2976
3050
  ...zSigningAction.options
2977
3051
  ]);
2978
3052
  z.discriminatedUnion("type", [
2979
3053
  zValueTransactionIntent,
2980
3054
  zReceiveIntent,
3055
+ zStakeIntent,
2981
3056
  zSigningIntent
2982
3057
  ]);
2983
3058
 
@@ -3267,6 +3342,10 @@ var zClassicAccountGovernanceFields = z.object({
3267
3342
  type: z.literal(AccountGovernanceType.CLASSIC).meta({ description: "Classic account governance" }),
3268
3343
  policyId: z.string().meta({ description: "Identifier of corresponding governance policy" })
3269
3344
  }).meta({ description: "Classic" });
3345
+ var zRawSigningAccountGovernanceFields = z.object({
3346
+ type: z.literal(AccountGovernanceType.RAW_SIGNING).meta({ description: "Raw signing account governance" }),
3347
+ policyId: z.string().meta({ description: "Identifier of corresponding governance policy" })
3348
+ }).meta({ description: "Raw Signing" });
3270
3349
  var zTradelinkAccountGovernanceFields = z.object({
3271
3350
  type: z.literal(AccountGovernanceType.TRADELINK).meta({ description: "Tradelink account governance" }),
3272
3351
  assetManagerId: z.string().meta({ description: "Identifier of corresponding asset manager" }),
@@ -3274,7 +3353,11 @@ var zTradelinkAccountGovernanceFields = z.object({
3274
3353
  description: "Tradelink exchange configurations"
3275
3354
  })
3276
3355
  }).meta({ description: "Tradelink" });
3277
- var zAccountGovernanceFields = z.discriminatedUnion("type", [zClassicAccountGovernanceFields, zTradelinkAccountGovernanceFields]).meta({ description: "Governance fields" });
3356
+ var zAccountGovernanceFields = z.discriminatedUnion("type", [
3357
+ zClassicAccountGovernanceFields,
3358
+ zRawSigningAccountGovernanceFields,
3359
+ zTradelinkAccountGovernanceFields
3360
+ ]).meta({ description: "Governance fields" });
3278
3361
 
3279
3362
  // src/accounts/types.ts
3280
3363
  var zAccountCommonFields = z14.object({
@@ -3326,7 +3409,7 @@ z14.object({
3326
3409
  })
3327
3410
  });
3328
3411
  z14.enum(["staked", "rewards", "total"]).default("total");
3329
- z14.object({
3412
+ var zBaseStakingValidator = z14.object({
3330
3413
  address: z14.string().meta({ description: "Validator address" }),
3331
3414
  apy: z14.string().nullable().meta({ description: "Validator APY" }),
3332
3415
  balance: z14.string().nullable().meta({ description: "Validator balance" }),
@@ -3336,41 +3419,66 @@ z14.object({
3336
3419
  name: z14.string().nullable().meta({ description: "Validator name" }),
3337
3420
  url: z14.string().nullable().meta({ description: "Validator URL" })
3338
3421
  });
3422
+ var zSuiStakingValidator = zBaseStakingValidator.extend({
3423
+ type: z14.literal(AccountType.SUI_LIKE).meta({ description: "Account type" })
3424
+ });
3425
+ var zHederaStakingValidator = zBaseStakingValidator.extend({
3426
+ type: z14.literal(AccountType.HEDERA_LIKE).meta({ description: "Account type" }),
3427
+ nodeId: zIntString.nullable().meta({ description: "Validator node ID" })
3428
+ });
3429
+ z14.discriminatedUnion("type", [
3430
+ zSuiStakingValidator,
3431
+ zHederaStakingValidator
3432
+ ]);
3339
3433
  z14.enum(["balance"]).default("balance");
3340
- var zMessageType = z14.enum(MessageType).meta({ description: "Type of the message to sign" });
3341
- var zMessageData = zHexString.nonempty().meta({
3342
- description: "Hex data to sign, either a json string for EIP712, or a raw string for other types"
3434
+ z14.enum(MessageType).meta({ description: "Type of the message to sign" });
3435
+ var zMessageHexData = zHexString.nonempty().meta({
3436
+ description: "Hex data string to sign",
3437
+ id: "MessageHexData"
3438
+ });
3439
+ var zEip712Data = z14.object({
3440
+ types: z14.record(z14.string(), z14.array(z14.object({ name: z14.string(), type: z14.string() }))).meta({ description: "EIP-712 types" }),
3441
+ primaryType: z14.string().meta({ description: "EIP-712 primary type" }),
3442
+ domain: z14.record(z14.string(), z14.any()).meta({ description: "EIP-712 domain" }),
3443
+ message: z14.record(z14.string(), z14.any()).meta({ description: "EIP-712 message" })
3444
+ }).meta({
3445
+ description: "EIP-712 data to sign",
3446
+ id: "Eip712Data"
3343
3447
  });
3344
3448
  var zMessage = z14.discriminatedUnion("type", [
3345
3449
  z14.object({
3346
3450
  type: z14.literal("EIP191"),
3347
- data: zMessageData
3451
+ data: zMessageHexData
3348
3452
  }),
3349
3453
  z14.object({
3350
3454
  type: z14.literal("EIP712"),
3351
- data: zMessageData
3352
- // TODO: put a proper EIP712 schema
3455
+ data: zEip712Data
3353
3456
  }),
3354
3457
  z14.object({
3355
3458
  type: z14.literal("CIP8"),
3356
- data: zMessageData,
3357
- signingKey: z14.literal(["PAYMENT", "STAKE"]).meta({ description: "CIP-8 signing key" })
3459
+ data: zMessageHexData,
3460
+ signingKey: z14.enum(["PAYMENT", "STAKE"]).meta({ description: "CIP-8 signing key" })
3358
3461
  }),
3359
3462
  z14.object({
3360
3463
  type: z14.literal("BIP137"),
3361
- data: zMessageData
3464
+ data: zMessageHexData
3362
3465
  })
3363
3466
  ]);
3364
3467
  z14.object({
3365
3468
  id: z14.string().meta({ description: "Unique identifier" }),
3366
- type: zMessageType,
3367
- data: zMessageData,
3368
3469
  address: z14.string().meta({ description: "Address of the signing key" }),
3369
3470
  derivationPath: z14.string().meta({ description: "Derivation path of the signing key" }),
3370
3471
  signature: zHsmSignature.meta({ description: "Signature of the message" }),
3371
3472
  createdById: z14.string().meta({ description: "ID of the creator" }),
3372
3473
  createdAt: z14.coerce.date().meta({ description: "Creation timestamp" })
3373
- }).meta({ description: "Signed message", id: "SignedMessageResponse" });
3474
+ }).and(zMessage).meta({ description: "Signed message", id: "SignedMessageResponse" });
3475
+ var zDigest = z14.object({
3476
+ digest: zHexString.meta({ description: "The hex string digest to sign" }),
3477
+ derivationPath: z14.string().nonempty().meta({ description: "The derivation path with which to sign the digest" })
3478
+ });
3479
+ zDigest.extend({
3480
+ signature: zHsmSignature.meta({ description: "Signature of the digest" })
3481
+ });
3374
3482
  var zCreateTransactionRequestData = z14.object({
3375
3483
  accountId: z14.string().min(1).meta({ description: "Target account id" }),
3376
3484
  transaction: zTransactionData
@@ -3388,16 +3496,15 @@ var zSignMessageUserInputData = zSignMessageRequestData.partial({
3388
3496
  address: true,
3389
3497
  derivationPath: true
3390
3498
  });
3391
- var zDigestData = z14.object({
3392
- digest: zHexString.meta({ description: "The hex string digest to sign" }),
3393
- derivationPath: z14.string().nonempty().meta({ description: "The derivation path with which to sign the digest" })
3394
- });
3395
3499
  var zSignDigestsRequestData = z14.object({
3396
3500
  accountId: z14.string().min(1).meta({ description: "Target account id" }),
3397
- digests: z14.array(zDigestData).meta({ description: "The digests to sign" })
3501
+ digests: z14.array(zDigest).meta({ description: "The digests to sign" })
3398
3502
  });
3399
3503
  z14.object({
3400
- signatures: z14.array(zHsmSignature)
3504
+ // Populated after input data is validated.
3505
+ govRuleHsmId: zHsmObjectId.optional(),
3506
+ // Populated after request is executed -- it holds the digests-signing result.
3507
+ signatures: z14.array(zHsmSignature).optional()
3401
3508
  });
3402
3509
 
3403
3510
  // src/accounts/app-types.ts
@@ -3474,7 +3581,7 @@ var zSignDigestsGovRuleData = z14.object({
3474
3581
  // we need to control for API users only
3475
3582
  }).meta({ description: "Digest signing rule" });
3476
3583
  var zAccountPolicyRequestData = z14.union([
3477
- z14.object({ policyId: z14.string() }).meta({ description: "Account policy" }),
3584
+ z14.object({ policyId: z14.string().min(1) }).meta({ description: "Account policy" }),
3478
3585
  z14.object({ rules: z14.array(zClassicGovRuleData) }).meta({ description: "Account governance rules" })
3479
3586
  ]).meta({ description: "Account policy or governance rules" });
3480
3587
  var zCreateAccountGovernanceData = z14.discriminatedUnion("type", [
@@ -3510,6 +3617,12 @@ var zCreateAccountRequestData = zCreateAccountUserInputData.omit({ index: true }
3510
3617
  description: "Create account request data",
3511
3618
  id: "CreateAccountRequestData"
3512
3619
  });
3620
+ zCreateAccountUserInputData.omit({
3621
+ governance: true
3622
+ }).extend({ policyId: z14.string().min(1).meta({ description: "Account policy" }) }).meta({
3623
+ description: "Create account request data (for API admin only)",
3624
+ id: "CreateClassicAccountWithPolicyIdUserInput"
3625
+ });
3513
3626
  var zEditAccountGovernanceData = z14.discriminatedUnion("type", [
3514
3627
  z14.object({
3515
3628
  type: z14.literal(AccountGovernanceType.CLASSIC),
@@ -3617,11 +3730,15 @@ var getAccountAssetFields = (account) => {
3617
3730
  var getAccountGovernanceFields = (account) => {
3618
3731
  switch (account.governanceType) {
3619
3732
  case AccountGovernanceType.CLASSIC:
3620
- case AccountGovernanceType.RAW_SIGNING:
3621
3733
  return {
3622
3734
  type: AccountGovernanceType.CLASSIC,
3623
3735
  policyId: account.classicGovernanceMixin.policyId
3624
3736
  };
3737
+ case AccountGovernanceType.RAW_SIGNING:
3738
+ return {
3739
+ type: AccountGovernanceType.RAW_SIGNING,
3740
+ policyId: account.classicGovernanceMixin.policyId
3741
+ };
3625
3742
  case AccountGovernanceType.TRADELINK:
3626
3743
  return {
3627
3744
  type: AccountGovernanceType.TRADELINK,
@@ -3928,6 +4045,7 @@ var zRequestReviewResponse = z14.object({
3928
4045
  // Note: Do NOT include `quorum` as it is already available in the request's `reviewSteps` field.
3929
4046
  stepIndex: z14.number().int().meta({ description: "Index of the governance step in the request workflow" }),
3930
4047
  userId: z14.string().meta({ description: "Reviewer id" }),
4048
+ groupName: z14.string().nullable().meta({ description: "Group name if the reviewer was part of an operator group" }),
3931
4049
  status: z14.enum(RequestReviewStatus).meta({ description: "Review status" }),
3932
4050
  createdAt: z14.coerce.date().meta({ description: "Created date" }),
3933
4051
  updatedAt: z14.coerce.date().meta({ description: "Updated date" })
@@ -3967,6 +4085,7 @@ var allowedRequestCreationInputByType = {
3967
4085
  type: z14.literal(RequestType.SIGN_MESSAGE),
3968
4086
  data: zSignMessageUserInputData
3969
4087
  }),
4088
+ [RequestType.SIGN_DIGESTS]: zVaultRequestMixinsByType[RequestType.SIGN_DIGESTS],
3970
4089
  [RequestType.CREATE_POLICY]: zVaultRequestMixinsByType[RequestType.CREATE_POLICY],
3971
4090
  [RequestType.EDIT_POLICY]: zVaultRequestMixinsByType[RequestType.EDIT_POLICY],
3972
4091
  [RequestType.CREATE_ACCOUNT]: z14.object({
@@ -4047,6 +4166,9 @@ z14.object({
4047
4166
  })
4048
4167
  ])
4049
4168
  });
4169
+ z14.object({
4170
+ taskId: z14.string().meta({ description: "Task ID" })
4171
+ });
4050
4172
 
4051
4173
  // src/requests/app-utils/index.ts
4052
4174
  function serializeVaultRequest(request) {