@layerzerolabs/dw-model 0.2.6 → 0.2.8

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 (114) hide show
  1. package/.turbo/turbo-build.log +115 -65
  2. package/.turbo/turbo-lint.log +4 -0
  3. package/.turbo/turbo-test.log +3 -3
  4. package/dist/3QBHS4UZ.cjs +4 -0
  5. package/dist/3QBHS4UZ.cjs.map +1 -0
  6. package/dist/45LWGDPP.js +19 -0
  7. package/dist/45LWGDPP.js.map +1 -0
  8. package/dist/{XPJHJHX6.cjs → 5KVLMWQW.cjs} +6 -10
  9. package/dist/5KVLMWQW.cjs.map +1 -0
  10. package/dist/722WUAS6.cjs +70 -0
  11. package/dist/722WUAS6.cjs.map +1 -0
  12. package/dist/{SGPTRDQO.js → EQTOSW62.js} +6 -10
  13. package/dist/EQTOSW62.js.map +1 -0
  14. package/dist/JEBKWD5F.js +40 -0
  15. package/dist/JEBKWD5F.js.map +1 -0
  16. package/dist/JSK5QSWJ.js +11 -0
  17. package/dist/JSK5QSWJ.js.map +1 -0
  18. package/dist/MLHJKQTG.cjs +59 -0
  19. package/dist/MLHJKQTG.cjs.map +1 -0
  20. package/dist/N5NQRAA2.js +3 -0
  21. package/dist/N5NQRAA2.js.map +1 -0
  22. package/dist/{KM6G7QZX.cjs → OKS5GGII.cjs} +6 -6
  23. package/dist/OKS5GGII.cjs.map +1 -0
  24. package/dist/ONIG6I4S.cjs +23 -0
  25. package/dist/ONIG6I4S.cjs.map +1 -0
  26. package/dist/PP5TDTMN.cjs +41 -0
  27. package/dist/PP5TDTMN.cjs.map +1 -0
  28. package/dist/{7JO255NX.js → RMW3UTVK.js} +6 -6
  29. package/dist/RMW3UTVK.js.map +1 -0
  30. package/dist/SBZPLPCB.js +3 -0
  31. package/dist/SBZPLPCB.js.map +1 -0
  32. package/dist/UU3GEL4Y.js +39 -0
  33. package/dist/UU3GEL4Y.js.map +1 -0
  34. package/dist/X7GZKVDG.cjs +13 -0
  35. package/dist/X7GZKVDG.cjs.map +1 -0
  36. package/dist/YAFQX433.js +64 -0
  37. package/dist/YAFQX433.js.map +1 -0
  38. package/dist/ZQEYO4LO.cjs +4 -0
  39. package/dist/ZQEYO4LO.cjs.map +1 -0
  40. package/dist/deploy/index.cjs +86 -22
  41. package/dist/deploy/index.d.ts +3 -1
  42. package/dist/deploy/index.d.ts.map +1 -1
  43. package/dist/deploy/index.js +6 -2
  44. package/dist/deploy/resourceBuilder.cjs +13 -0
  45. package/dist/deploy/resourceBuilder.cjs.map +1 -0
  46. package/dist/deploy/resourceBuilder.d.ts +17 -0
  47. package/dist/deploy/resourceBuilder.d.ts.map +1 -0
  48. package/dist/deploy/resourceBuilder.js +4 -0
  49. package/dist/deploy/resourceBuilder.js.map +1 -0
  50. package/dist/deploy/resources.cjs +67 -0
  51. package/dist/deploy/resources.cjs.map +1 -0
  52. package/dist/deploy/resources.d.ts +79 -0
  53. package/dist/deploy/resources.d.ts.map +1 -0
  54. package/dist/deploy/resources.js +6 -0
  55. package/dist/deploy/resources.js.map +1 -0
  56. package/dist/deploy/{schemata.cjs → workflow.cjs} +23 -23
  57. package/dist/deploy/workflow.cjs.map +1 -0
  58. package/dist/deploy/{schemata.d.ts → workflow.d.ts} +25 -25
  59. package/dist/deploy/{schemata.d.ts.map → workflow.d.ts.map} +1 -1
  60. package/dist/deploy/{schemata.js → workflow.js} +3 -3
  61. package/dist/deploy/workflow.js.map +1 -0
  62. package/dist/index.cjs +156 -54
  63. package/dist/index.d.ts +1 -0
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +10 -4
  66. package/dist/role-management/generator.cjs +21 -0
  67. package/dist/role-management/generator.cjs.map +1 -0
  68. package/dist/role-management/generator.d.ts +31 -0
  69. package/dist/role-management/generator.d.ts.map +1 -0
  70. package/dist/role-management/generator.js +4 -0
  71. package/dist/role-management/generator.js.map +1 -0
  72. package/dist/role-management/index.cjs +48 -0
  73. package/dist/role-management/index.cjs.map +1 -0
  74. package/dist/role-management/index.d.ts +4 -0
  75. package/dist/role-management/index.d.ts.map +1 -0
  76. package/dist/role-management/index.js +7 -0
  77. package/dist/role-management/index.js.map +1 -0
  78. package/dist/role-management/schemata.cjs +29 -0
  79. package/dist/role-management/schemata.d.ts +134 -0
  80. package/dist/role-management/schemata.d.ts.map +1 -0
  81. package/dist/role-management/schemata.js +4 -0
  82. package/dist/role-management/types.cjs +13 -0
  83. package/dist/role-management/types.cjs.map +1 -0
  84. package/dist/role-management/types.d.ts +6 -0
  85. package/dist/role-management/types.d.ts.map +1 -0
  86. package/dist/role-management/types.js +4 -0
  87. package/dist/role-management/types.js.map +1 -0
  88. package/dist/wire/index.cjs +6 -6
  89. package/dist/wire/index.js +1 -1
  90. package/dist/wire/schemata.cjs +6 -6
  91. package/dist/wire/schemata.d.ts +10 -10
  92. package/dist/wire/schemata.d.ts.map +1 -1
  93. package/dist/wire/schemata.js +1 -1
  94. package/package.json +8 -8
  95. package/src/deploy/index.ts +3 -1
  96. package/src/deploy/resourceBuilder.ts +62 -0
  97. package/src/deploy/resources.ts +171 -0
  98. package/src/deploy/{schemata.ts → workflow.ts} +4 -4
  99. package/src/index.ts +1 -0
  100. package/src/role-management/generator.ts +17 -0
  101. package/src/role-management/index.ts +3 -0
  102. package/src/role-management/schemata.ts +81 -0
  103. package/src/role-management/types.ts +5 -0
  104. package/src/wire/schemata.ts +4 -5
  105. package/dist/7JO255NX.js.map +0 -1
  106. package/dist/GGP4SLHT.js +0 -3
  107. package/dist/GGP4SLHT.js.map +0 -1
  108. package/dist/HQUVR5B4.cjs +0 -4
  109. package/dist/HQUVR5B4.cjs.map +0 -1
  110. package/dist/KM6G7QZX.cjs.map +0 -1
  111. package/dist/SGPTRDQO.js.map +0 -1
  112. package/dist/XPJHJHX6.cjs.map +0 -1
  113. /package/dist/{deploy → role-management}/schemata.cjs.map +0 -0
  114. /package/dist/{deploy → role-management}/schemata.js.map +0 -0
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var X7GZKVDG_cjs = require('../X7GZKVDG.cjs');
4
+ require('../YJF4D23A.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "BaseContractRole", {
9
+ enumerable: true,
10
+ get: function () { return X7GZKVDG_cjs.BaseContractRole; }
11
+ });
12
+ //# sourceMappingURL=types.cjs.map
13
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"types.cjs"}
@@ -0,0 +1,6 @@
1
+ export declare enum BaseContractRole {
2
+ OWNER = "OWNER_ROLE",
3
+ ADMIN = "ADMIN_ROLE",
4
+ DEFAULT_ADMIN = "DEFAULT_ADMIN_ROLE"
5
+ }
6
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/role-management/types.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IACxB,KAAK,eAAe;IACpB,KAAK,eAAe;IACpB,aAAa,uBAAuB;CACvC"}
@@ -0,0 +1,4 @@
1
+ export { BaseContractRole } from '../JSK5QSWJ.js';
2
+ import '../VUOMXK5T.js';
3
+ //# sourceMappingURL=types.js.map
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
3
  require('../X4ZNR5GZ.cjs');
4
- var XPJHJHX6_cjs = require('../XPJHJHX6.cjs');
4
+ var _5KVLMWQW_cjs = require('../5KVLMWQW.cjs');
5
5
  require('../YJF4D23A.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "wireWorkflowChainResultSchema", {
10
10
  enumerable: true,
11
- get: function () { return XPJHJHX6_cjs.wireWorkflowChainResultSchema; }
11
+ get: function () { return _5KVLMWQW_cjs.wireWorkflowChainResultSchema; }
12
12
  });
13
13
  Object.defineProperty(exports, "wireWorkflowChainStateSchema", {
14
14
  enumerable: true,
15
- get: function () { return XPJHJHX6_cjs.wireWorkflowChainStateSchema; }
15
+ get: function () { return _5KVLMWQW_cjs.wireWorkflowChainStateSchema; }
16
16
  });
17
17
  Object.defineProperty(exports, "wireWorkflowFilterArgsSchema", {
18
18
  enumerable: true,
19
- get: function () { return XPJHJHX6_cjs.wireWorkflowFilterArgsSchema; }
19
+ get: function () { return _5KVLMWQW_cjs.wireWorkflowFilterArgsSchema; }
20
20
  });
21
21
  Object.defineProperty(exports, "wireWorkflowOrchestratorResultSchema", {
22
22
  enumerable: true,
23
- get: function () { return XPJHJHX6_cjs.wireWorkflowOrchestratorResultSchema; }
23
+ get: function () { return _5KVLMWQW_cjs.wireWorkflowOrchestratorResultSchema; }
24
24
  });
25
25
  Object.defineProperty(exports, "wireWorkflowOrchestratorStateSchema", {
26
26
  enumerable: true,
27
- get: function () { return XPJHJHX6_cjs.wireWorkflowOrchestratorStateSchema; }
27
+ get: function () { return _5KVLMWQW_cjs.wireWorkflowOrchestratorStateSchema; }
28
28
  });
29
29
  //# sourceMappingURL=index.cjs.map
30
30
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
1
  import '../N5VNZXZB.js';
2
- export { wireWorkflowChainResultSchema, wireWorkflowChainStateSchema, wireWorkflowFilterArgsSchema, wireWorkflowOrchestratorResultSchema, wireWorkflowOrchestratorStateSchema } from '../SGPTRDQO.js';
2
+ export { wireWorkflowChainResultSchema, wireWorkflowChainStateSchema, wireWorkflowFilterArgsSchema, wireWorkflowOrchestratorResultSchema, wireWorkflowOrchestratorStateSchema } from '../EQTOSW62.js';
3
3
  import '../VUOMXK5T.js';
4
4
  //# sourceMappingURL=index.js.map
5
5
  //# sourceMappingURL=index.js.map
@@ -1,29 +1,29 @@
1
1
  'use strict';
2
2
 
3
- var XPJHJHX6_cjs = require('../XPJHJHX6.cjs');
3
+ var _5KVLMWQW_cjs = require('../5KVLMWQW.cjs');
4
4
  require('../YJF4D23A.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "wireWorkflowChainResultSchema", {
9
9
  enumerable: true,
10
- get: function () { return XPJHJHX6_cjs.wireWorkflowChainResultSchema; }
10
+ get: function () { return _5KVLMWQW_cjs.wireWorkflowChainResultSchema; }
11
11
  });
12
12
  Object.defineProperty(exports, "wireWorkflowChainStateSchema", {
13
13
  enumerable: true,
14
- get: function () { return XPJHJHX6_cjs.wireWorkflowChainStateSchema; }
14
+ get: function () { return _5KVLMWQW_cjs.wireWorkflowChainStateSchema; }
15
15
  });
16
16
  Object.defineProperty(exports, "wireWorkflowFilterArgsSchema", {
17
17
  enumerable: true,
18
- get: function () { return XPJHJHX6_cjs.wireWorkflowFilterArgsSchema; }
18
+ get: function () { return _5KVLMWQW_cjs.wireWorkflowFilterArgsSchema; }
19
19
  });
20
20
  Object.defineProperty(exports, "wireWorkflowOrchestratorResultSchema", {
21
21
  enumerable: true,
22
- get: function () { return XPJHJHX6_cjs.wireWorkflowOrchestratorResultSchema; }
22
+ get: function () { return _5KVLMWQW_cjs.wireWorkflowOrchestratorResultSchema; }
23
23
  });
24
24
  Object.defineProperty(exports, "wireWorkflowOrchestratorStateSchema", {
25
25
  enumerable: true,
26
- get: function () { return XPJHJHX6_cjs.wireWorkflowOrchestratorStateSchema; }
26
+ get: function () { return _5KVLMWQW_cjs.wireWorkflowOrchestratorStateSchema; }
27
27
  });
28
28
  //# sourceMappingURL=schemata.cjs.map
29
29
  //# sourceMappingURL=schemata.cjs.map
@@ -16,7 +16,7 @@ export declare const wireWorkflowChainResultSchema: z.ZodObject<{
16
16
  }, z.core.$strip>, z.ZodObject<{
17
17
  name: z.ZodString;
18
18
  success: z.ZodLiteral<true>;
19
- txHash: z.ZodUnion<readonly [z.ZodType<`0x${string}`, unknown, z.core.$ZodTypeInternals<`0x${string}`, unknown>>, z.ZodLiteral<"NO_OP">]>;
19
+ txHash: z.ZodString;
20
20
  }, z.core.$strip>]>>;
21
21
  }, z.core.$strip>;
22
22
  export declare const wireWorkflowChainStateSchema: z.ZodObject<{
@@ -27,15 +27,15 @@ export declare const wireWorkflowChainStateSchema: z.ZodObject<{
27
27
  }, z.core.$strip>, z.ZodObject<{
28
28
  name: z.ZodString;
29
29
  success: z.ZodLiteral<true>;
30
- txHash: z.ZodUnion<readonly [z.ZodType<`0x${string}`, unknown, z.core.$ZodTypeInternals<`0x${string}`, unknown>>, z.ZodLiteral<"NO_OP">]>;
30
+ txHash: z.ZodString;
31
31
  }, z.core.$strip>]>>;
32
32
  srcChain: z.ZodOptional<z.ZodEnum<typeof ChainName>>;
33
- status: z.ZodUnion<readonly [z.ZodLiteral<"RUNNING">, z.ZodLiteral<"COMPLETE">]>;
33
+ status: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"RUNNING">, z.ZodLiteral<"COMPLETE">]>>;
34
34
  }, z.core.$strip>;
35
35
  export type WireWorkflowChainState = z.infer<typeof wireWorkflowChainStateSchema>;
36
36
  export type WireWorkflowChainResult = z.infer<typeof wireWorkflowChainResultSchema>;
37
37
  export declare const wireWorkflowOrchestratorResultSchema: z.ZodObject<{
38
- stateByChain: z.ZodRecord<z.ZodUnion<[z.ZodEnum<typeof ChainName>, z.ZodNever]>, z.ZodObject<{
38
+ stateByChain: z.ZodDefault<z.ZodRecord<z.ZodUnion<[z.ZodEnum<typeof ChainName>, z.ZodNever]>, z.ZodObject<{
39
39
  results: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
40
40
  name: z.ZodString;
41
41
  success: z.ZodLiteral<false>;
@@ -43,12 +43,12 @@ export declare const wireWorkflowOrchestratorResultSchema: z.ZodObject<{
43
43
  }, z.core.$strip>, z.ZodObject<{
44
44
  name: z.ZodString;
45
45
  success: z.ZodLiteral<true>;
46
- txHash: z.ZodUnion<readonly [z.ZodType<`0x${string}`, unknown, z.core.$ZodTypeInternals<`0x${string}`, unknown>>, z.ZodLiteral<"NO_OP">]>;
46
+ txHash: z.ZodString;
47
47
  }, z.core.$strip>]>>;
48
- }, z.core.$strip>>;
48
+ }, z.core.$strip>>>;
49
49
  }, z.core.$strip>;
50
50
  export declare const wireWorkflowOrchestratorStateSchema: z.ZodObject<{
51
- stateByChain: z.ZodRecord<z.ZodUnion<[z.ZodEnum<typeof ChainName>, z.ZodNever]>, z.ZodObject<{
51
+ stateByChain: z.ZodDefault<z.ZodRecord<z.ZodUnion<[z.ZodEnum<typeof ChainName>, z.ZodNever]>, z.ZodObject<{
52
52
  results: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
53
53
  name: z.ZodString;
54
54
  success: z.ZodLiteral<false>;
@@ -56,10 +56,10 @@ export declare const wireWorkflowOrchestratorStateSchema: z.ZodObject<{
56
56
  }, z.core.$strip>, z.ZodObject<{
57
57
  name: z.ZodString;
58
58
  success: z.ZodLiteral<true>;
59
- txHash: z.ZodUnion<readonly [z.ZodType<`0x${string}`, unknown, z.core.$ZodTypeInternals<`0x${string}`, unknown>>, z.ZodLiteral<"NO_OP">]>;
59
+ txHash: z.ZodString;
60
60
  }, z.core.$strip>]>>;
61
- }, z.core.$strip>>;
62
- status: z.ZodUnion<readonly [z.ZodLiteral<"RUNNING">, z.ZodLiteral<"COMPLETE">]>;
61
+ }, z.core.$strip>>>;
62
+ status: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"RUNNING">, z.ZodLiteral<"COMPLETE">]>>;
63
63
  }, z.core.$strip>;
64
64
  export type WireWorkflowOrchestratorState = z.infer<typeof wireWorkflowOrchestratorStateSchema>;
65
65
  export type WireWorkflowOrchestratorResult = z.infer<typeof wireWorkflowOrchestratorResultSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemata.d.ts","sourceRoot":"","sources":["../../src/wire/schemata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAG3B,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEjE,eAAO,MAAM,4BAA4B;;;;;;;CAsBxC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;iBAexC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;iBAGvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;iBAE/C,CAAC;AAEH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;iBAE9C,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAChG,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC"}
1
+ {"version":3,"file":"schemata.d.ts","sourceRoot":"","sources":["../../src/wire/schemata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEjE,eAAO,MAAM,4BAA4B;;;;;;;CAsBxC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;iBAexC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;iBAGvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;iBAE/C,CAAC;AAEH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;iBAE9C,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAChG,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- export { wireWorkflowChainResultSchema, wireWorkflowChainStateSchema, wireWorkflowFilterArgsSchema, wireWorkflowOrchestratorResultSchema, wireWorkflowOrchestratorStateSchema } from '../SGPTRDQO.js';
1
+ export { wireWorkflowChainResultSchema, wireWorkflowChainStateSchema, wireWorkflowFilterArgsSchema, wireWorkflowOrchestratorResultSchema, wireWorkflowOrchestratorStateSchema } from '../EQTOSW62.js';
2
2
  import '../VUOMXK5T.js';
3
3
  //# sourceMappingURL=schemata.js.map
4
4
  //# sourceMappingURL=schemata.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layerzerolabs/dw-model",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,17 +15,18 @@
15
15
  "types": "./dist/index.d.ts",
16
16
  "dependencies": {
17
17
  "zod": "3.25.56",
18
- "@layerzerolabs/common-chain-model": "0.2.6",
19
- "@layerzerolabs/typescript-utils": "0.2.6",
20
- "@layerzerolabs/zod-utils": "0.2.6",
21
- "@layerzerolabs/layerzero-definitions": "0.2.6"
18
+ "@layerzerolabs/common-chain-model": "0.2.8",
19
+ "@layerzerolabs/gated-transaction": "0.2.8",
20
+ "@layerzerolabs/layerzero-definitions": "0.2.8",
21
+ "@layerzerolabs/zod-utils": "0.2.8",
22
+ "@layerzerolabs/typescript-utils": "0.2.8"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@mysten/sui": "^1.35.0",
25
26
  "tsup": "^8.4.0",
26
27
  "vitest": "^3.2.3",
27
- "@layerzerolabs/tsup-configuration": "0.2.6",
28
- "@layerzerolabs/typescript-configuration": "0.2.6"
28
+ "@layerzerolabs/tsup-configuration": "0.2.8",
29
+ "@layerzerolabs/typescript-configuration": "0.2.8"
29
30
  },
30
31
  "publishConfig": {
31
32
  "access": "restricted",
@@ -36,7 +37,6 @@
36
37
  },
37
38
  "scripts": {
38
39
  "build": "tsup",
39
- "clean": "rm -rf ./node_modules .turbo ./dist",
40
40
  "lint": "eslint . --max-warnings 0 || (eslint . --fix --max-warnings 0 && false)",
41
41
  "test": "vitest --run --pass-with-no-tests --typecheck"
42
42
  }
@@ -1 +1,3 @@
1
- export * from './schemata';
1
+ export * from './resourceBuilder';
2
+ export * from './resources';
3
+ export * from './workflow';
@@ -0,0 +1,62 @@
1
+ import type { z } from 'zod/v4';
2
+
3
+ import type {
4
+ BaseContractResource,
5
+ BaseMeshResource,
6
+ baseResourceSchema,
7
+ ContractResourceDependency,
8
+ MeshResourceDependency,
9
+ } from './resources';
10
+
11
+ export type ContractResourceBuilderResult<Resource extends BaseContractResource> = {
12
+ id: ContractResourceDependency<Resource>;
13
+ build: () => Resource;
14
+ };
15
+
16
+ export type MeshResourceBuilderResult<Resource extends BaseMeshResource> = {
17
+ id: MeshResourceDependency<Resource>;
18
+ build: () => Resource;
19
+ };
20
+
21
+ export const createResourceBuilder =
22
+ <T extends typeof baseResourceSchema, U extends Omit<z.infer<T>, 'type' | 'resourceBaseType'>>(
23
+ _resourceSchema: T,
24
+ {
25
+ resourceBaseType,
26
+ type,
27
+ }: {
28
+ resourceBaseType: 'CONTRACT' | 'MESH';
29
+ type: T['shape'] extends { type: z.ZodType<infer Type> } ? Type : undefined;
30
+ },
31
+ ) =>
32
+ (
33
+ resource: U,
34
+ ): z.infer<T> extends BaseContractResource
35
+ ? ContractResourceBuilderResult<z.infer<T>>
36
+ : z.infer<T> extends BaseMeshResource
37
+ ? MeshResourceBuilderResult<z.infer<T>>
38
+ : never => {
39
+ if (resourceBaseType === 'CONTRACT') {
40
+ return {
41
+ id: {
42
+ __CONTRACT_RESOURCE_DEPENDENCY: true,
43
+ __dependencyType: null as any,
44
+ id: resource.id,
45
+ },
46
+ build: () => ({ ...resource, type, resourceBaseType }),
47
+ } satisfies ContractResourceBuilderResult<any> as any;
48
+ }
49
+ if (resourceBaseType === 'MESH') {
50
+ return {
51
+ id: {
52
+ __MESH_RESOURCE_DEPENDENCY: true,
53
+ // this is just a type brand, doesnt need to exist
54
+ __dependencyType: null as any,
55
+ id: resource.id,
56
+ },
57
+ build: () => ({ ...resource, type, resourceBaseType }),
58
+ } satisfies MeshResourceBuilderResult<any> as any;
59
+ }
60
+
61
+ throw new Error(`Can't handle resouceBaseType "${resourceBaseType}"`);
62
+ };
@@ -0,0 +1,171 @@
1
+ import z from 'zod/v4';
2
+
3
+ import type { NormalizedHexString } from '@layerzerolabs/common-chain-model';
4
+ import { ChainName } from '@layerzerolabs/layerzero-definitions';
5
+ import type { IsAny } from '@layerzerolabs/typescript-utils';
6
+
7
+ import { upgradeableConfigSchema } from '../upgrade';
8
+
9
+ export const baseResourceSchema = z.object({
10
+ id: z.string(), // account-unique ID for this resource
11
+ name: z.string().optional(), // display name for this resource
12
+ resourceBaseType: z.string() as z.ZodString | z.ZodLiteral,
13
+ });
14
+
15
+ export const baseMeshResourceSchema = z.object({
16
+ ...baseResourceSchema.shape,
17
+ resourceBaseType: z.literal('MESH'),
18
+ });
19
+
20
+ export const baseContractResourceSchema = z.object({
21
+ ...baseResourceSchema.shape,
22
+ resourceBaseType: z.literal('CONTRACT'),
23
+ chainName: z.enum(ChainName),
24
+ upgradeConfig: upgradeableConfigSchema.optional(),
25
+ verifyContract: z.boolean().optional(),
26
+
27
+ chainConfig: z.any().optional(),
28
+ });
29
+
30
+ export type BaseResource = z.infer<typeof baseResourceSchema>;
31
+ export type BaseMeshResource = z.infer<typeof baseMeshResourceSchema>;
32
+ export type BaseContractResource = z.infer<typeof baseContractResourceSchema>;
33
+
34
+ export type ContractResourceDependency<T extends BaseContractResource = BaseContractResource> = {
35
+ id: string;
36
+ /** WARNING: this field is not present at runtime */
37
+ __dependencyType: T;
38
+ ['__CONTRACT_RESOURCE_DEPENDENCY']: true;
39
+ };
40
+
41
+ export const isContractResourceDependency = (o: any): o is ContractResourceDependency =>
42
+ o != null &&
43
+ typeof o === 'object' &&
44
+ (o as ContractResourceDependency).__CONTRACT_RESOURCE_DEPENDENCY;
45
+
46
+ export type ContractResourceDependencySchema<T extends typeof baseContractResourceSchema> =
47
+ z.ZodType<ContractResourceDependency<z.infer<T>>>;
48
+
49
+ export const contractResourceDependencySchema: ContractResourceDependencySchema<
50
+ typeof baseContractResourceSchema
51
+ > = z.custom<ContractResourceDependency>(isContractResourceDependency);
52
+
53
+ export const contractResourceDependencySchemaFor = <T extends typeof baseContractResourceSchema>(
54
+ // FIXME use this to generate a real schema
55
+ _resource: T,
56
+ ): ContractResourceDependencySchema<T> =>
57
+ z.custom<ContractResourceDependency<z.infer<T>>>(isContractResourceDependency);
58
+
59
+ export type ResolvedContractResourceDependency<T extends BaseContractResource> = {
60
+ id: string;
61
+ resource: T;
62
+ address: NormalizedHexString;
63
+ };
64
+
65
+ export type ResolvedContractResourceDependencySchema<T extends typeof baseContractResourceSchema> =
66
+ z.ZodType<ResolvedContractResourceDependency<z.infer<T>>>;
67
+
68
+ export const resolvedContractResourceDependencySchema: ResolvedContractResourceDependencySchema<any> =
69
+ // FIXME could be a real schema
70
+ z.custom<ResolvedContractResourceDependency<any>>();
71
+
72
+ export type MeshResourceDependency<T extends BaseMeshResource = BaseMeshResource> = {
73
+ id: string;
74
+ /** WARNING: this field is not present at runtime */
75
+ __dependencyType: T;
76
+ ['__MESH_RESOURCE_DEPENDENCY']: true;
77
+ };
78
+
79
+ export const isMeshResourceDependency = (o: any): o is MeshResourceDependency =>
80
+ o != null && typeof o === 'object' && (o as MeshResourceDependency).__MESH_RESOURCE_DEPENDENCY;
81
+
82
+ export type MeshResourceDependencySchema<T extends typeof baseMeshResourceSchema> = z.ZodType<
83
+ MeshResourceDependency<z.infer<T>>
84
+ >;
85
+
86
+ export const meshResourceDependencySchema: MeshResourceDependencySchema<
87
+ typeof baseMeshResourceSchema
88
+ > = z.custom<MeshResourceDependency>(isMeshResourceDependency);
89
+
90
+ export const meshResourceDependencySchemaFor = <T extends typeof baseMeshResourceSchema>(
91
+ // FIXME use this to generate a real schema
92
+ _resource: T,
93
+ ): MeshResourceDependencySchema<T> =>
94
+ z.custom<MeshResourceDependency<z.infer<T>>>(isMeshResourceDependency);
95
+
96
+ export type ResolvedMeshResourceDependency<T extends BaseMeshResource> = {
97
+ id: string;
98
+ resource: T;
99
+ // TODO: is there any other resolved information we want to inject here?
100
+ };
101
+
102
+ export type ResolvedMeshResourceDependencySchema<T extends typeof baseMeshResourceSchema> =
103
+ // FIXME could be a real schema
104
+ z.ZodType<ResolvedMeshResourceDependency<z.infer<T>>>;
105
+
106
+ export const resolvedMeshResourceDependencySchema: ResolvedMeshResourceDependencySchema<any> =
107
+ z.custom<ResolvedMeshResourceDependency<any>>();
108
+
109
+ // FIXME this could be recursive, probably overkill
110
+ export type ResolvedResourceSchema<Resource extends typeof baseResourceSchema> = z.ZodObject<
111
+ {
112
+ [K in keyof Resource['shape']]: Resource['shape'][K] extends infer R extends z.ZodType
113
+ ? R extends z.ZodAny
114
+ ? R
115
+ : R extends z.ZodOptional<z.ZodAny>
116
+ ? R
117
+ : R extends ContractResourceDependencySchema<infer I>
118
+ ? ResolvedContractResourceDependencySchema<I>
119
+ : R extends z.ZodOptional<ContractResourceDependencySchema<infer I>>
120
+ ? z.ZodOptional<ResolvedContractResourceDependencySchema<I>>
121
+ : R extends MeshResourceDependencySchema<infer I>
122
+ ? ResolvedMeshResourceDependencySchema<I>
123
+ : R extends z.ZodOptional<MeshResourceDependencySchema<infer I>>
124
+ ? z.ZodOptional<ResolvedMeshResourceDependencySchema<I>>
125
+ : R
126
+ : never;
127
+ },
128
+ z.core.$strip
129
+ >;
130
+
131
+ // FIXME this could be recursive, probably overkill
132
+ export type ResolvedResource<Resource extends BaseResource> = {
133
+ [K in keyof Resource]: Resource[K] extends infer R
134
+ ? R extends undefined
135
+ ? R
136
+ : IsAny<R> extends true
137
+ ? R
138
+ : IsAny<Exclude<R, undefined>> extends true
139
+ ? R
140
+ : R extends ContractResourceDependency<infer I>
141
+ ? ResolvedContractResourceDependency<I>
142
+ : R extends ContractResourceDependency<infer I> | undefined
143
+ ? ResolvedContractResourceDependency<I> | undefined
144
+ : R extends MeshResourceDependency<infer I>
145
+ ? ResolvedMeshResourceDependency<I>
146
+ : R extends MeshResourceDependency<infer I> | undefined
147
+ ? ResolvedMeshResourceDependency<I> | undefined
148
+ : R
149
+ : never;
150
+ };
151
+
152
+ export const extractContractResourceDependencyIds = <Resource extends BaseResource>(
153
+ resource: Resource,
154
+ ) =>
155
+ Object.entries(resource).filter(([, id]) => isContractResourceDependency(id)) as unknown as [
156
+ prop: string,
157
+ id: ContractResourceDependency,
158
+ ][];
159
+
160
+ export const extractMeshResourceDependencyIds = <Resource extends BaseResource>(
161
+ resource: Resource,
162
+ ) =>
163
+ Object.entries(resource).filter(([, id]) => isMeshResourceDependency(id)) as unknown as [
164
+ prop: string,
165
+ id: MeshResourceDependency,
166
+ ][];
167
+
168
+ // FIXME implement runtime
169
+ export const createResolvedResourceSchema = <Resource extends typeof baseResourceSchema>(
170
+ resource: Resource,
171
+ ) => resource as ResolvedResourceSchema<Resource>;
@@ -79,12 +79,12 @@ export const verificationArgumentsSchema = z.union([
79
79
  ]);
80
80
 
81
81
  export const deployWorkflowChainResultSchema = z.object({
82
- results: z.array(deployWorkflowChainResultItemSchema),
82
+ results: z.array(deployWorkflowChainResultItemSchema).default([]),
83
83
  });
84
84
 
85
85
  export const deployWorkflowChainStateSchema = deployWorkflowChainResultSchema.extend({
86
86
  srcChain: z.enum(ChainName).optional(),
87
- status: z.union([z.literal('RUNNING'), z.literal('COMPLETE')]),
87
+ status: z.union([z.literal('RUNNING'), z.literal('COMPLETE')]).default('RUNNING'),
88
88
  });
89
89
 
90
90
  export type DeployWorkflowChainState = z.infer<typeof deployWorkflowChainStateSchema>;
@@ -92,11 +92,11 @@ export type DeployWorkflowChainResult = z.infer<typeof deployWorkflowChainResult
92
92
  export type DeployWorkflowChainResultItem = z.infer<typeof deployWorkflowChainResultItemSchema>;
93
93
 
94
94
  export const deployWorkflowOrchestratorResultSchema = z.object({
95
- stateByChain: z.partialRecord(z.enum(ChainName), deployWorkflowChainResultSchema),
95
+ stateByChain: z.partialRecord(z.enum(ChainName), deployWorkflowChainResultSchema).default({}),
96
96
  });
97
97
 
98
98
  export const deployWorkflowOrchestratorStateSchema = deployWorkflowOrchestratorResultSchema.extend({
99
- status: z.union([z.literal('RUNNING'), z.literal('COMPLETE')]),
99
+ status: z.union([z.literal('RUNNING'), z.literal('COMPLETE')]).default('RUNNING'),
100
100
  });
101
101
 
102
102
  export type DeployWorkflowOrchestratorState = z.infer<typeof deployWorkflowOrchestratorStateSchema>;
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './deploy';
2
+ export * from './role-management';
2
3
  export * from './upgrade';
3
4
  export * from './wire';
@@ -0,0 +1,17 @@
1
+ import type { CreateSetRoleTransactionsWithSpecializedInput, HasRoleWithSpecializedInput } from '.';
2
+
3
+ export const generateThrowCreateSetRoleTransactions =
4
+ (): CreateSetRoleTransactionsWithSpecializedInput => () => {
5
+ throw new Error('Not implemented');
6
+ };
7
+
8
+ export const generateThrowHasRole = (): HasRoleWithSpecializedInput => () => {
9
+ throw new Error('Not implemented');
10
+ };
11
+
12
+ export const generateThrowRoleManagement = () => {
13
+ return {
14
+ createSetRoleTransactions: generateThrowCreateSetRoleTransactions(),
15
+ hasRole: generateThrowHasRole(),
16
+ };
17
+ };
@@ -0,0 +1,3 @@
1
+ export * from './generator';
2
+ export * from './schemata';
3
+ export * from './types';
@@ -0,0 +1,81 @@
1
+ import { z } from 'zod/v4';
2
+
3
+ import { normalizedHexSchema, transactionSchema } from '@layerzerolabs/common-chain-model';
4
+ import { gatedTransactionSchema } from '@layerzerolabs/gated-transaction';
5
+ import { functionSchema } from '@layerzerolabs/zod-utils';
6
+
7
+ export const generateCreateSetRoleTransactionsSchema = <
8
+ const T extends readonly [string, ...string[]],
9
+ >(
10
+ roles: T,
11
+ ) =>
12
+ functionSchema({
13
+ input: z.tuple([
14
+ z.object({
15
+ role: z.enum(roles),
16
+ accountAddress: normalizedHexSchema,
17
+ shouldGrant: z.boolean(),
18
+ }),
19
+ ]),
20
+ output: z.promise(
21
+ gatedTransactionSchema({
22
+ name: z.string(),
23
+ transactionSchema: transactionSchema,
24
+ }).array(),
25
+ ),
26
+ });
27
+
28
+ export const generateHasRoleSchema = <const T extends readonly [string, ...string[]]>(roles: T) =>
29
+ functionSchema({
30
+ input: z.tuple([
31
+ z.object({
32
+ role: z.enum(roles),
33
+ accountAddress: normalizedHexSchema,
34
+ }),
35
+ ]),
36
+ output: z.promise(z.boolean()),
37
+ });
38
+
39
+ export const generateRoleManagementSchemas = <const T extends readonly [string, ...string[]]>(
40
+ roles: T,
41
+ ) => ({
42
+ createSetRoleTransactions: generateCreateSetRoleTransactionsSchema(roles),
43
+ hasRole: generateHasRoleSchema(roles),
44
+ });
45
+
46
+ export const createSetRoleTransactionsWithSpecializedInputSchema = functionSchema({
47
+ input: z.tuple([
48
+ z.object({
49
+ address: normalizedHexSchema,
50
+ }),
51
+ z.object({
52
+ role: z.string(),
53
+ accountAddress: normalizedHexSchema,
54
+ shouldGrant: z.boolean(),
55
+ }),
56
+ ]),
57
+ output: z.promise(
58
+ gatedTransactionSchema({
59
+ name: z.string(),
60
+ transactionSchema: transactionSchema,
61
+ }).array(),
62
+ ),
63
+ });
64
+
65
+ export const hasRoleWithSpecializedInputSchema = functionSchema({
66
+ input: z.tuple([
67
+ z.object({
68
+ address: normalizedHexSchema,
69
+ }),
70
+ z.object({
71
+ role: z.string(),
72
+ accountAddress: normalizedHexSchema,
73
+ }),
74
+ ]),
75
+ output: z.promise(z.boolean()),
76
+ });
77
+
78
+ export type CreateSetRoleTransactionsWithSpecializedInput = z.infer<
79
+ typeof createSetRoleTransactionsWithSpecializedInputSchema
80
+ >;
81
+ export type HasRoleWithSpecializedInput = z.infer<typeof hasRoleWithSpecializedInputSchema>;
@@ -0,0 +1,5 @@
1
+ export enum BaseContractRole {
2
+ OWNER = 'OWNER_ROLE',
3
+ ADMIN = 'ADMIN_ROLE',
4
+ DEFAULT_ADMIN = 'DEFAULT_ADMIN_ROLE',
5
+ }
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod/v4';
2
2
 
3
- import { hexSchema } from '@layerzerolabs/common-chain-model';
4
3
  import { ChainName } from '@layerzerolabs/layerzero-definitions';
5
4
 
6
5
  export const wireWorkflowFilterArgsSchema = {
@@ -38,7 +37,7 @@ export const wireWorkflowChainResultSchema = z.object({
38
37
  z.object({
39
38
  name: z.string(),
40
39
  success: z.literal(true),
41
- txHash: z.union([hexSchema, z.literal('NO_OP')]),
40
+ txHash: z.string(),
42
41
  }),
43
42
  ]),
44
43
  ),
@@ -46,18 +45,18 @@ export const wireWorkflowChainResultSchema = z.object({
46
45
 
47
46
  export const wireWorkflowChainStateSchema = wireWorkflowChainResultSchema.extend({
48
47
  srcChain: z.enum(ChainName).optional(),
49
- status: z.union([z.literal('RUNNING'), z.literal('COMPLETE')]),
48
+ status: z.union([z.literal('RUNNING'), z.literal('COMPLETE')]).default('RUNNING'),
50
49
  });
51
50
 
52
51
  export type WireWorkflowChainState = z.infer<typeof wireWorkflowChainStateSchema>;
53
52
  export type WireWorkflowChainResult = z.infer<typeof wireWorkflowChainResultSchema>;
54
53
 
55
54
  export const wireWorkflowOrchestratorResultSchema = z.object({
56
- stateByChain: z.partialRecord(z.enum(ChainName), wireWorkflowChainResultSchema),
55
+ stateByChain: z.partialRecord(z.enum(ChainName), wireWorkflowChainResultSchema).default({}),
57
56
  });
58
57
 
59
58
  export const wireWorkflowOrchestratorStateSchema = wireWorkflowOrchestratorResultSchema.extend({
60
- status: z.union([z.literal('RUNNING'), z.literal('COMPLETE')]),
59
+ status: z.union([z.literal('RUNNING'), z.literal('COMPLETE')]).default('RUNNING'),
61
60
  });
62
61
 
63
62
  export type WireWorkflowOrchestratorState = z.infer<typeof wireWorkflowOrchestratorStateSchema>;