@ledgerhq/revault-sdk 0.26.4 → 0.26.5

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/bake.d.cts CHANGED
@@ -66,7 +66,12 @@ declare const zManifestGovernanceRule: z.ZodObject<{
66
66
  type ManifestGovernanceRule = z.infer<typeof zManifestGovernanceRule>;
67
67
  declare const zManifestPolicy: z.ZodObject<{
68
68
  name: z.ZodString;
69
- currency: z.ZodNullable<z.ZodString>;
69
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
+ asset: z.ZodOptional<z.ZodNullable<z.ZodObject<{
71
+ network: z.ZodString;
72
+ contractAddress: z.ZodNullable<z.ZodString>;
73
+ tokenIdentifier: z.ZodNullable<z.ZodString>;
74
+ }, z.core.$strict>>>;
70
75
  rules: z.ZodArray<z.ZodObject<{
71
76
  type: z.ZodEnum<{
72
77
  DEPLOY_CONTRACT: "DEPLOY_CONTRACT";
@@ -327,7 +332,12 @@ declare const zManifestWorkspace: z.ZodObject<{
327
332
  }, z.core.$strict>>>;
328
333
  policies: z.ZodOptional<z.ZodArray<z.ZodObject<{
329
334
  name: z.ZodString;
330
- currency: z.ZodNullable<z.ZodString>;
335
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
336
+ asset: z.ZodOptional<z.ZodNullable<z.ZodObject<{
337
+ network: z.ZodString;
338
+ contractAddress: z.ZodNullable<z.ZodString>;
339
+ tokenIdentifier: z.ZodNullable<z.ZodString>;
340
+ }, z.core.$strict>>>;
331
341
  rules: z.ZodArray<z.ZodObject<{
332
342
  type: z.ZodEnum<{
333
343
  DEPLOY_CONTRACT: "DEPLOY_CONTRACT";
@@ -543,7 +553,12 @@ declare const zManifest: z.ZodObject<{
543
553
  }, z.core.$strict>>>;
544
554
  policies: z.ZodOptional<z.ZodArray<z.ZodObject<{
545
555
  name: z.ZodString;
546
- currency: z.ZodNullable<z.ZodString>;
556
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
557
+ asset: z.ZodOptional<z.ZodNullable<z.ZodObject<{
558
+ network: z.ZodString;
559
+ contractAddress: z.ZodNullable<z.ZodString>;
560
+ tokenIdentifier: z.ZodNullable<z.ZodString>;
561
+ }, z.core.$strict>>>;
547
562
  rules: z.ZodArray<z.ZodObject<{
548
563
  type: z.ZodEnum<{
549
564
  DEPLOY_CONTRACT: "DEPLOY_CONTRACT";
package/lib/bake.d.ts CHANGED
@@ -66,7 +66,12 @@ declare const zManifestGovernanceRule: z.ZodObject<{
66
66
  type ManifestGovernanceRule = z.infer<typeof zManifestGovernanceRule>;
67
67
  declare const zManifestPolicy: z.ZodObject<{
68
68
  name: z.ZodString;
69
- currency: z.ZodNullable<z.ZodString>;
69
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
+ asset: z.ZodOptional<z.ZodNullable<z.ZodObject<{
71
+ network: z.ZodString;
72
+ contractAddress: z.ZodNullable<z.ZodString>;
73
+ tokenIdentifier: z.ZodNullable<z.ZodString>;
74
+ }, z.core.$strict>>>;
70
75
  rules: z.ZodArray<z.ZodObject<{
71
76
  type: z.ZodEnum<{
72
77
  DEPLOY_CONTRACT: "DEPLOY_CONTRACT";
@@ -327,7 +332,12 @@ declare const zManifestWorkspace: z.ZodObject<{
327
332
  }, z.core.$strict>>>;
328
333
  policies: z.ZodOptional<z.ZodArray<z.ZodObject<{
329
334
  name: z.ZodString;
330
- currency: z.ZodNullable<z.ZodString>;
335
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
336
+ asset: z.ZodOptional<z.ZodNullable<z.ZodObject<{
337
+ network: z.ZodString;
338
+ contractAddress: z.ZodNullable<z.ZodString>;
339
+ tokenIdentifier: z.ZodNullable<z.ZodString>;
340
+ }, z.core.$strict>>>;
331
341
  rules: z.ZodArray<z.ZodObject<{
332
342
  type: z.ZodEnum<{
333
343
  DEPLOY_CONTRACT: "DEPLOY_CONTRACT";
@@ -543,7 +553,12 @@ declare const zManifest: z.ZodObject<{
543
553
  }, z.core.$strict>>>;
544
554
  policies: z.ZodOptional<z.ZodArray<z.ZodObject<{
545
555
  name: z.ZodString;
546
- currency: z.ZodNullable<z.ZodString>;
556
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
557
+ asset: z.ZodOptional<z.ZodNullable<z.ZodObject<{
558
+ network: z.ZodString;
559
+ contractAddress: z.ZodNullable<z.ZodString>;
560
+ tokenIdentifier: z.ZodNullable<z.ZodString>;
561
+ }, z.core.$strict>>>;
547
562
  rules: z.ZodArray<z.ZodObject<{
548
563
  type: z.ZodEnum<{
549
564
  DEPLOY_CONTRACT: "DEPLOY_CONTRACT";
package/lib/bake.js CHANGED
@@ -370,8 +370,8 @@ async function bakeWorkspace(options, logger) {
370
370
  userIds: step.members.map(userIdFromDeviceIndexOrName)
371
371
  };
372
372
  }),
373
- threshold: rule.threshold,
374
- whitelistIds: rule.whitelistNames?.map(whitelistIdFromName)
373
+ ...rule.threshold !== void 0 ? { threshold: rule.threshold } : {},
374
+ ...rule.whitelistNames !== void 0 ? { whitelistIds: rule.whitelistNames.map(whitelistIdFromName) } : {}
375
375
  };
376
376
  }
377
377
  function rawSigningRuleFromManifest(rule) {
@@ -609,13 +609,18 @@ async function bakeWorkspace(options, logger) {
609
609
  return;
610
610
  }
611
611
  logStep(`Creating policy ${policy.name}...`);
612
+ const policyAsset = policy.asset !== void 0 ? policy.asset : policy.currency !== void 0 && policy.currency !== null ? {
613
+ network: policy.currency,
614
+ contractAddress: null,
615
+ tokenIdentifier: null
616
+ } : null;
612
617
  logSubStep("Creating request...");
613
618
  let request = await admin1.client.requests.create.mutate({
614
619
  request: {
615
620
  type: "CREATE_POLICY",
616
621
  data: {
617
622
  ...policyEditData,
618
- currency: policy.currency
623
+ asset: policyAsset
619
624
  }
620
625
  },
621
626
  waitForChallenges: false
@@ -912,7 +917,7 @@ async function recipeWorkspace(options, logger) {
912
917
  logger.info("Reading policies...");
913
918
  const policies = publicPolicies.map((policy) => ({
914
919
  name: policy.name,
915
- currency: policy.currency,
920
+ asset: policy.asset,
916
921
  rules: policy.rules.map(govRuleToManifest)
917
922
  }));
918
923
  logger.info("Reading accounts...");
@@ -1134,9 +1139,15 @@ const zManifestGovernanceRule = z.object({
1134
1139
  }).optional(),
1135
1140
  whitelistNames: z.array(z.string()).optional()
1136
1141
  }).strict();
1142
+ const zManifestPolicyAsset = z.object({
1143
+ network: z.string(),
1144
+ contractAddress: z.string().nullable(),
1145
+ tokenIdentifier: z.string().nullable()
1146
+ }).strict();
1137
1147
  const zManifestPolicy = z.object({
1138
1148
  name: z.string(),
1139
- currency: z.string().nullable(),
1149
+ currency: z.string().nullable().optional(),
1150
+ asset: zManifestPolicyAsset.nullable().optional(),
1140
1151
  rules: z.array(zManifestGovernanceRule)
1141
1152
  }).strict();
1142
1153
  const zManifestClassicAccountGovernance = z.object({