@helios-lang/contract-utils 0.1.20 → 0.1.24

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 (104) hide show
  1. package/examples/multi-validator/README.md +13 -0
  2. package/examples/multi-validator/contract.js +28 -0
  3. package/examples/{spending → multi-validator}/index.d.ts +3 -3
  4. package/examples/multi-validator/index.js +27 -0
  5. package/examples/multi-validator/minting.hl +5 -0
  6. package/examples/{spending → multi-validator}/package-lock.json +6 -15
  7. package/examples/{spending → multi-validator}/package.json +0 -1
  8. package/examples/multi-validator/spending.hl +18 -0
  9. package/examples/multi-validator/utils.hl +9 -0
  10. package/package.json +7 -6
  11. package/src/{runtime → cast}/Cast.js +31 -8
  12. package/src/cast/index.js +12 -0
  13. package/src/codegen/LoadedModule.js +9 -0
  14. package/src/codegen/{TypescriptWriter.js → LoadedScriptsWriter.js} +149 -108
  15. package/src/codegen/LoadedValidator.js +23 -0
  16. package/src/codegen/{Module.js → TypeCheckedModule.js} +3 -3
  17. package/src/codegen/{Validator.js → TypeCheckedValidator.js} +5 -8
  18. package/src/codegen/TypeSchema.js +6 -2
  19. package/src/codegen/index.js +5 -4
  20. package/src/compiler/CompilerLib.js +51 -0
  21. package/src/{lib/Libg_v0_16.js → compiler/CompilerLib_v0_16.js} +244 -255
  22. package/src/compiler/index.js +6 -0
  23. package/src/compiler/ops.js +137 -0
  24. package/src/context/ContractContext.js +78 -0
  25. package/src/context/ContractContextBuilder.js +69 -0
  26. package/src/context/DagCompiler.js +229 -0
  27. package/src/context/index.js +1 -0
  28. package/src/hl2ts.js +116 -104
  29. package/src/index.js +12 -1
  30. package/types/cast/Cast.d.ts +32 -0
  31. package/types/cast/Cast.d.ts.map +1 -0
  32. package/types/cast/PermissiveType.d.ts +3 -0
  33. package/types/cast/PermissiveType.d.ts.map +1 -0
  34. package/types/cast/StrictType.d.ts +3 -0
  35. package/types/cast/StrictType.d.ts.map +1 -0
  36. package/types/cast/index.d.ts +5 -0
  37. package/types/cast/index.d.ts.map +1 -0
  38. package/types/codegen/LoadedModule.d.ts +6 -0
  39. package/types/codegen/LoadedModule.d.ts.map +1 -0
  40. package/types/codegen/LoadedScriptsWriter.d.ts +57 -0
  41. package/types/codegen/LoadedScriptsWriter.d.ts.map +1 -0
  42. package/types/codegen/LoadedValidator.d.ts +16 -0
  43. package/types/codegen/LoadedValidator.d.ts.map +1 -0
  44. package/types/codegen/TypeCheckedModule.d.ts +11 -0
  45. package/types/codegen/TypeCheckedModule.d.ts.map +1 -0
  46. package/types/codegen/TypeCheckedValidator.d.ts +8 -0
  47. package/types/codegen/TypeCheckedValidator.d.ts.map +1 -0
  48. package/types/codegen/TypeSchema.d.ts +10 -0
  49. package/types/codegen/TypeSchema.d.ts.map +1 -1
  50. package/types/codegen/TypescriptWriter.d.ts +4 -4
  51. package/types/codegen/Validator.d.ts +1 -1
  52. package/types/codegen/index.d.ts +5 -4
  53. package/types/codegen/index.d.ts.map +1 -1
  54. package/types/compiler/CompilerLib.d.ts +45 -0
  55. package/types/compiler/CompilerLib.d.ts.map +1 -0
  56. package/types/compiler/CompilerLib_v0_16.d.ts +271 -0
  57. package/types/compiler/CompilerLib_v0_16.d.ts.map +1 -0
  58. package/types/compiler/index.d.ts +4 -0
  59. package/types/compiler/index.d.ts.map +1 -0
  60. package/types/compiler/ops.d.ts +24 -0
  61. package/types/compiler/ops.d.ts.map +1 -0
  62. package/types/context/ContractContext.d.ts +23 -0
  63. package/types/context/ContractContext.d.ts.map +1 -0
  64. package/types/context/ContractContextBuilder.d.ts +53 -0
  65. package/types/context/ContractContextBuilder.d.ts.map +1 -0
  66. package/types/context/DagCompiler.d.ts +64 -0
  67. package/types/context/DagCompiler.d.ts.map +1 -0
  68. package/types/context/index.d.ts +2 -0
  69. package/types/context/index.d.ts.map +1 -0
  70. package/types/hl2ts.d.ts +9 -4
  71. package/types/hl2ts.d.ts.map +1 -1
  72. package/types/index.d.ts +4 -1
  73. package/types/index.d.ts.map +1 -1
  74. package/types/lib/Lib.d.ts +13 -71
  75. package/types/lib/Lib.d.ts.map +1 -1
  76. package/types/lib/Libg_v0_16.d.ts +53 -52
  77. package/types/lib/Libg_v0_16.d.ts.map +1 -1
  78. package/types/lib/index.d.ts +0 -1
  79. package/types/lib/index.d.ts.map +1 -1
  80. package/types/lib/load.d.ts +1 -7
  81. package/types/lib/load.d.ts.map +1 -1
  82. package/types/runtime/ContractContext.d.ts +22 -43
  83. package/types/runtime/ContractContext.d.ts.map +1 -1
  84. package/types/runtime/ContractContextBuilder.d.ts +15 -123
  85. package/types/runtime/ContractContextBuilder.d.ts.map +1 -1
  86. package/types/runtime/DagCompiler.d.ts +64 -0
  87. package/types/runtime/DagCompiler.d.ts.map +1 -0
  88. package/types/runtime/PermissiveType.d.ts +1 -1
  89. package/types/runtime/StrictType.d.ts +1 -1
  90. package/types/runtime/index.d.ts +0 -2
  91. package/examples/spending/contract.js +0 -16
  92. package/examples/spending/index.js +0 -27
  93. package/examples/spending/minting.hl +0 -5
  94. package/examples/spending/spending.hl +0 -17
  95. package/examples/spending/utils.hl +0 -5
  96. package/src/codegen/Writer.js +0 -37
  97. package/src/lib/Lib.js +0 -56
  98. package/src/lib/index.js +0 -6
  99. package/src/lib/load.js +0 -26
  100. package/src/runtime/ContractContext.js +0 -35
  101. package/src/runtime/ContractContextBuilder.js +0 -340
  102. package/src/runtime/index.js +0 -3
  103. /package/src/{runtime → cast}/PermissiveType.js +0 -0
  104. /package/src/{runtime → cast}/StrictType.js +0 -0
@@ -1,11 +1,10 @@
1
1
  /**
2
- * @typedef {import("../codegen/index.js").Module} ModuleDetails
3
- * @typedef {import("../codegen/index.js").Validator} ValidatorDetails
2
+ * @typedef {import("../codegen/index.js").TypeCheckedModule} ModuleDetails
3
+ * @typedef {import("../codegen/index.js").TypeCheckedValidator} ValidatorDetails
4
4
  * @typedef {import("../codegen/index.js").TypeSchema} InternalTypeDetails
5
5
  * @typedef {import("./Lib.js").CompileOptions} CompileOptions
6
6
  * @typedef {import("./Lib.js").CompileOutput} CompileOutput
7
7
  * @typedef {import("./Lib.js").Lib} Lib
8
- * @typedef {import("./Lib.js").LibOptions} LibOptions
9
8
  * @typedef {import("./Lib.js").SourceDetails} SourceDetails
10
9
  */
11
10
  /**
@@ -15,7 +14,7 @@
15
14
  */
16
15
  /**
17
16
  * @typedef {{
18
- * }} HashType
17
+ * }} ScriptHashType
19
18
  */
20
19
  /**
21
20
  * @typedef {{
@@ -100,15 +99,8 @@
100
99
  export class Lib_v0_16 implements Lib {
101
100
  /**
102
101
  * @param {any} lib
103
- * @param {LibOptions} options
104
102
  */
105
- constructor(lib: any, options: LibOptions);
106
- /**
107
- * @private
108
- * @readonly
109
- * @type {LibOptions}
110
- */
111
- private readonly options;
103
+ constructor(lib: any);
112
104
  lib: any;
113
105
  /**
114
106
  * @type {string}
@@ -116,83 +108,92 @@ export class Lib_v0_16 implements Lib {
116
108
  get version(): string;
117
109
  /**
118
110
  * @param {string} purpose
119
- * @returns {HashType}
111
+ * @returns {ScriptHashType}
112
+ */
113
+ getScriptHashType(purpose: string): ScriptHashType;
114
+ /**
115
+ * @param {{[name: string]: SourceDetails}} validators
116
+ * @param {{[name: string]: SourceDetails}} modules
117
+ * @returns {{modules: {[name: string]: ModuleDetails}, validators: {[name: string]: ValidatorDetails}}}
118
+ */
119
+ typeCheck(validators: {
120
+ [name: string]: import("./Lib.js").SourceDetails;
121
+ }, modules: {
122
+ [name: string]: import("./Lib.js").SourceDetails;
123
+ }): {
124
+ modules: {
125
+ [name: string]: import("./Lib.js").TypeCheckedModule;
126
+ };
127
+ validators: {
128
+ [name: string]: import("./Lib.js").TypeCheckedValidator;
129
+ };
130
+ };
131
+ /**
132
+ * Generate additional IR definitions
133
+ * * dependency on own precalculated hash (eg. unoptimized program should use hash of optimized program)
134
+ * * dependency on own hash through methods defined on the ScriptContext
135
+ * * dependency on hashes of other validators
136
+ * @private
137
+ * @param {string} name - name of the validator being compiled
138
+ * @param {string} purpose - purpose the validator being compiled
139
+ * @param {number} nPosParams
140
+ * @param {CompileOptions} options
141
+ * @returns {Map<string, IR>}
142
+ */
143
+ private generateExtraIRDefinitions;
144
+ /**
145
+ * @param {string} main
146
+ * @param {string[]} modules
147
+ * @param {CompileOptions} options
148
+ * @returns {CompileOutput}
120
149
  */
121
- getValidatorType(purpose: string): HashType;
150
+ compile(main: string, modules: string[], options: CompileOptions): CompileOutput;
122
151
  /**
123
152
  * @private
124
153
  * @param {SourceDetails[]} validators
125
154
  * @param {SourceDetails[]} modules
126
- * @param {{[name: string]: HashType}} validatorTypes
155
+ * @param {{[name: string]: ScriptHashType}} validatorTypes
127
156
  * @returns {Program[]}
128
157
  */
129
158
  private createPrograms;
130
159
  /**
131
160
  * @private
132
161
  * @param {Program} program
133
- * @param {{[name: string]: HashType}} validatorTypes
162
+ * @param {{[name: string]: ScriptHashType}} validatorTypes
134
163
  * @returns {IR}
135
164
  */
136
165
  private toTestIR;
137
166
  /**
138
167
  * @private
139
168
  * @param {Program[]} validators
140
- * @param {{[name: string]: HashType}} validatorTypes
169
+ * @param {{[name: string]: ScriptHashType}} validatorTypes
141
170
  * @returns {DagDependencies}
142
171
  */
143
172
  private buildDagDependencies;
144
173
  /**
145
- * @param {{[name: string]: SourceDetails}} validators
146
- * @param {{[name: string]: SourceDetails}} modules
147
- * @returns {{modules: {[name: string]: ModuleDetails}, validators: {[name: string]: ValidatorDetails}}}
148
- */
149
- typeCheck(validators: {
150
- [name: string]: import("./Lib.js").SourceDetails;
151
- }, modules: {
152
- [name: string]: import("./Lib.js").SourceDetails;
153
- }): {
154
- modules: {
155
- [name: string]: import("./Lib.js").ModuleDetails;
156
- };
157
- validators: {
158
- [name: string]: import("./Lib.js").ValidatorDetails;
159
- };
160
- };
161
- /**
174
+ * @private
162
175
  * @param {TypeSchema} it
163
176
  * @returns {InternalTypeDetails}
164
177
  */
165
- convertInternalType(it: TypeSchema): InternalTypeDetails;
178
+ private convertInternalType;
166
179
  /**
180
+ * @private
167
181
  * @param {DataType} dt
168
182
  * @returns {InternalTypeDetails}
169
183
  */
170
- getInternalTypeDetails(dt: DataType): InternalTypeDetails;
171
- /**
172
- * @param {string[]} modules
173
- * @returns {string[]}
174
- */
175
- sortModules(modules: string[]): string[];
176
- /**
177
- * @param {string} main
178
- * @param {string[]} modules
179
- * @param {CompileOptions} options
180
- * @returns {CompileOutput}
181
- */
182
- compile(main: string, modules: string[], options: CompileOptions): CompileOutput;
184
+ private getInternalTypeDetails;
183
185
  }
184
- export type ModuleDetails = import("../codegen/index.js").Module;
185
- export type ValidatorDetails = import("../codegen/index.js").Validator;
186
+ export type ModuleDetails = import("../codegen/index.js").TypeCheckedModule;
187
+ export type ValidatorDetails = import("../codegen/index.js").TypeCheckedValidator;
186
188
  export type InternalTypeDetails = import("../codegen/index.js").TypeSchema;
187
189
  export type CompileOptions = import("./Lib.js").CompileOptions;
188
190
  export type CompileOutput = import("./Lib.js").CompileOutput;
189
191
  export type Lib = import("./Lib.js").Lib;
190
- export type LibOptions = import("./Lib.js").LibOptions;
191
192
  export type SourceDetails = import("./Lib.js").SourceDetails;
192
193
  export type DagDependencies = {
193
194
  [name: string]: string[];
194
195
  };
195
- export type HashType = {};
196
+ export type ScriptHashType = {};
196
197
  export type IR = {
197
198
  includes: (m: string) => boolean;
198
199
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Libg_v0_16.d.ts","sourceRoot":"","sources":["../../src/lib/Libg_v0_16.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;GAEG;AAEH;;;;;;GAMG;AACH;;;;;;;;;GASG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;GAGG;AAEH;;GAEG;AACH;IAQI;;;OAGG;IACH,iBAHW,GAAG,WACH,UAAU,EAYpB;IArBD;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AC9B,GAAG;IACN,IAAQ,EAAU,MAAM,CAAA;IACxB,YAAgB,EAAE;QAAC,MAAM,MAAM,CAAC;QAAC,UAAU,EAAE,eAAe,EAAE,CAAA;KAAC,EAAE,CAAA;CAC9D;8BAIS;IACZ,MAAU,MAAM,CAAA;CACb,GAAG,UAAU;0BAIJ;IACZ,SAAa,EAAE,MAAM,CAAA;IACrB,UAAc,EAAE,MAAM,CAAA;IACtB,YAAgB,EAAE,UAAU,CAAA;CACzB;wBAIS,EACT"}
@@ -1,4 +1,3 @@
1
1
  export { loadLibrary } from "./load.js";
2
2
  export type Lib = import("./Lib.js").Lib;
3
- export type LibOptions = import("./Lib.js").LibOptions;
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.js"],"names":[],"mappings":";kBAGa,OAAO,UAAU,EAAE,GAAG;yBACtB,OAAO,UAAU,EAAE,UAAU"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.js"],"names":[],"mappings":";kBAGa,OAAO,UAAU,EAAE,GAAG"}
@@ -1,12 +1,6 @@
1
1
  /**
2
- * @typedef {import("./Lib.js").Lib} Lib
3
- * @typedef {import("./Lib.js").LibOptions} LibOptions
4
- */
5
- /**
6
- * @param {LibOptions} options
7
2
  * @returns {Lib}
8
3
  */
9
- export function loadLibrary(options?: LibOptions): Lib;
4
+ export function loadLibrary(): Lib;
10
5
  export type Lib = import("./Lib.js").Lib;
11
- export type LibOptions = import("./Lib.js").LibOptions;
12
6
  //# sourceMappingURL=load.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/lib/load.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;GAGG;AACH,sCAHW,UAAU,GACR,GAAG,CAcf;kBApBY,OAAO,UAAU,EAAE,GAAG;yBACtB,OAAO,UAAU,EAAE,UAAU"}
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/lib/load.js"],"names":[],"mappings":"AAeA;;GAEG;AACH,+BAFa,GAAG,CAcf;kBA1BY,OAAO,UAAU,EAAE,GAAG"}
@@ -1,44 +1,23 @@
1
- /**
2
- * @typedef {{
3
- * $name: string
4
- * $purpose: string
5
- * $program: {
6
- * optimized: UplcProgramV2
7
- * unoptimized: UplcProgramV2
8
- * }
9
- * $hash: ScriptHash
10
- * $Redeemer: Cast<any, any>
11
- * $Datum?: Cast<any, any>
12
- * }} Validator
13
- */
14
- /**
15
- * @template {{[name: string]: Validator}} T
16
- */
17
- export class ContractContext<T extends {
18
- [name: string]: Validator;
19
- }> {
20
- /**
21
- * @param {T} validators
22
- */
23
- constructor(validators: T);
24
- /**
25
- * @readonly
26
- * @type {T}
27
- */
28
- readonly validators: T;
29
- }
30
- export type Validator = {
31
- $name: string;
32
- $purpose: string;
33
- $program: {
34
- optimized: UplcProgramV2;
35
- unoptimized: UplcProgramV2;
36
- };
37
- $hash: ScriptHash;
38
- $Redeemer: Cast<any, any>;
39
- $Datum?: Cast<any, any>;
40
- };
41
- import { UplcProgramV2 } from "@helios-lang/uplc";
42
- import { ScriptHash } from "@helios-lang/ledger";
43
- import { Cast } from "./Cast.js";
1
+ export type LoadedValidator = import("../codegen/index.js").LoadedValidator;
2
+ export type MintingContext<TRedeemerStrict, TRedeemerPermissive> = import("@helios-lang/ledger").MintingContext<TRedeemerStrict, TRedeemerPermissive>;
3
+ export type SpendingContext<TDatumStrict, TDatumPermissive, TRedeemerStrict, TRedeemerPermissive> = import("@helios-lang/ledger").SpendingContext<TDatumStrict, TDatumPermissive, TRedeemerStrict, TRedeemerPermissive>;
4
+ export type StakingContext<TRedeemerStrict, TRedeemerPermissive> = import("@helios-lang/ledger").StakingContext<TRedeemerStrict, TRedeemerPermissive>;
5
+ export type PermissiveType<C extends Cast<any, any>> = import("../cast/index.js").PermissiveType<C>;
6
+ export type StrictType<C extends Cast<any, any>> = import("../cast/index.js").StrictType<C>;
7
+ export type AnyContractValidatorHash = (ValidatorHash<SpendingContext<any, any, any, any>> | MintingPolicyHash<MintingContext<any, any>> | StakingValidatorHash<StakingContext<any, any>>);
8
+ export type ContractValidatorHash<V extends import("../codegen/LoadedValidator.js").LoadedValidator> = V extends {
9
+ "$purpose": "spending";
10
+ "$Datum": Cast;
11
+ } ? ValidatorHash<SpendingContext<StrictType<V["$Datum"]>, PermissiveType<V["$Datum"]>, StrictType<V["$Redeemer"]>, PermissiveType<V["$Redeemer"]>>> : V extends {
12
+ "$purpose": "minting";
13
+ } ? MintingPolicyHash<MintingContext<StrictType<V["$Redeemer"]>, PermissiveType<V["$Redeemer"]>>> : V extends {
14
+ "$purpose": ("certifying" | "rewarding");
15
+ } ? StakingValidatorHash<StakingContext<StrictType<V["$Redeemer"]>, PermissiveType<V["$Redeemer"]>>> : never;
16
+ export type ContractContext<T extends {
17
+ [name: string]: import("../codegen/LoadedValidator.js").LoadedValidator;
18
+ }> = { [K in keyof T]: ContractValidatorHash<T[K]>; };
19
+ import { Cast } from "../cast/index.js";
20
+ import { ValidatorHash } from "@helios-lang/ledger";
21
+ import { MintingPolicyHash } from "@helios-lang/ledger";
22
+ import { StakingValidatorHash } from "@helios-lang/ledger";
44
23
  //# sourceMappingURL=ContractContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContractContext.d.ts","sourceRoot":"","sources":["../../src/runtime/ContractContext.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH;;;IAOI;;OAEG;IACH,wBAFW,CAAC,EAIX;IAXD;;;OAGG;IACH,qBAFU,CAAC,CAED;CAQb;wBA7BY;IACZ,KAAS,EAAE,MAAM,CAAA;IACjB,QAAY,EAAE,MAAM,CAAA;IACpB,QAAY,EAAE;QACd,SAAe,EAAE,aAAa,CAAA;QAC9B,WAAiB,EAAE,aAAa,CAAA;KAC3B,CAAA;IACL,KAAS,EAAE,UAAU,CAAA;IACrB,SAAa,EAAE,KAAK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/B,CACF,GACP,CAAO,SAAS;IAAC,UAAU,EAAE,CAAC,YAAY,GAAG,WAAW,CAAC,CAAA;CAAC,GAAG,qBAC7D,eACA,WAAqB,CAAC,CAAC,WAAW,CAAC,CAAC,EACpC,eAAyB,CAAC,CAAC,WAAW,CAAC,CAAC,CAC/B,CACF,GAAG,KAAK;;;;qBAjEK,kBAAkB;8BADhC,qBAAqB;kCAArB,qBAAqB;qCAArB,qBAAqB"}
@@ -1,57 +1,17 @@
1
1
  /**
2
+ * @typedef {import("../codegen/LoadedModule.js").LoadedModule} LoadedModule
3
+ * @typedef {import("../codegen/LoadedValidator.js").LoadedValidator} LoadedValidator
2
4
  * @typedef {import("../lib/index.js").Lib} Lib
3
- * @typedef {import("../lib/index.js").LibOptions} LibOptions
4
- * @typedef {import("./ContractContext.js").Validator} CompiledValidator
5
5
  */
6
6
  /**
7
- * @template TRedeemerStrict
8
- * @template TRedeemerPermissive
9
- * @typedef {import("@helios-lang/ledger").MintingContext<TRedeemerStrict, TRedeemerPermissive>} MintingContext
7
+ * @template {{[name: string]: LoadedValidator}} T
8
+ * @typedef {import("./ContractContext.js").ContractContext<T>} ContractContext
10
9
  */
11
10
  /**
12
- * @template TDatumStrict
13
- * @template TDatumPermissive
14
- * @template TRedeemerStrict
15
- * @template TRedeemerPermissive
16
- * @typedef {import("@helios-lang/ledger").SpendingContext<TDatumStrict, TDatumPermissive, TRedeemerStrict, TRedeemerPermissive>} SpendingContext
17
- */
18
- /**
19
- * @template TRedeemerStrict
20
- * @template TRedeemerPermissive
21
- * @typedef {import("@helios-lang/ledger").StakingContext<TRedeemerStrict, TRedeemerPermissive>} StakingContext
22
- */
23
- /**
24
- * @template {Cast} C
25
- * @typedef {import("./PermissiveType.js").PermissiveType<C>} PermissiveType
26
- */
27
- /**
28
- * @template {Cast} C
29
- * @typedef {import("./StrictType.js").StrictType<C>} StrictType
30
- */
31
- /**
32
- * @typedef {{
33
- * $name: string
34
- * $sourceCode: string
35
- * $dependencies: Module[]
36
- * }} Module
37
- */
38
- /**
39
- * @typedef {{
40
- * $name: string
41
- * $purpose: string
42
- * $sourceCode: string
43
- * $dependencies: Module[]
44
- * $hashDependencies: Validator[]
45
- * $dependsOnOwnHash: boolean
46
- * $Redeemer: Cast<any, any>
47
- * $Datum?: Cast<any, any>
48
- * }} Validator
49
- */
50
- /**
51
- * @template {{[name: string]: Validator}} T
11
+ * @template {{[name: string]: LoadedValidator}} T
52
12
  */
53
13
  export class ContractContextBuilder<T extends {
54
- [name: string]: Validator;
14
+ [name: string]: import("./DagCompiler.js").LoadedValidator;
55
15
  }> {
56
16
  /**
57
17
  * @returns {ContractContextBuilder<{}>}
@@ -60,7 +20,6 @@ export class ContractContextBuilder<T extends {
60
20
  /**
61
21
  * @private
62
22
  * @param {T} validators
63
- * @param {Option<Module[]>} forcedModules
64
23
  */
65
24
  private constructor();
66
25
  /**
@@ -70,92 +29,25 @@ export class ContractContextBuilder<T extends {
70
29
  */
71
30
  private readonly validators;
72
31
  /**
73
- * @private
74
- * @readonly
75
- * @type {Option<Module[]>}
76
- */
77
- private readonly forcedModules;
78
- /**
79
- * @param {Module[]} modules
80
- * @returns {ContractContextBuilder<T>}
81
- */
82
- setModules(modules: Module[]): ContractContextBuilder<T>;
83
- /**
84
- * @template {Validator} V
32
+ * @template {LoadedValidator} V
85
33
  * @param {V} validator
86
34
  * @returns {ContractContextBuilder<T & {
87
35
  * [K in V["$name"]]: V
88
36
  * }>}
89
37
  */
90
- with<V extends Validator>(validator: V): ContractContextBuilder<T & { [K in V["$name"]]: V; }>;
91
- /**
92
- * @private
93
- * @param {Validator} validator
94
- * @returns {Map<string, string>}
95
- */
96
- private getModules;
97
- /**
98
- * @private
99
- * @param {Lib} lib
100
- * @returns {{[name: string]: any}}
101
- */
102
- private getValidatorTypes;
38
+ with<V extends import("./DagCompiler.js").LoadedValidator>(validator: V): ContractContextBuilder<T & { [K in V["$name"]]: V; }>;
103
39
  /**
104
40
  * @param {Option<{[name: string]: string}>} expectedHashes
105
- * @param {LibOptions} options
106
- * @returns {{
107
- * [K in keyof T]:
108
- * T[K]["$purpose"] extends "spending" ? ValidatorHash<
109
- * SpendingContext<
110
- * StrictType<T[K]["$Datum"]>,
111
- * PermissiveType<T[K]["$Datum"]>,
112
- * StrictType<T[K]["$Redeemer"]>,
113
- * PermissiveType<T[K]["$Redeemer"]>
114
- * >
115
- * > :
116
- * T[K]["$purpose"] extends "minting" ? MintingPolicyHash<
117
- * MintingContext<
118
- * StrictType<T[K]["$Redeemer"]>,
119
- * PermissiveType<T[K]["$Redeemer"]>
120
- * >
121
- * > :
122
- * T[K]["$purpose"] extends ("certifying" | "rewarding") ? StakingValidatorHash<
123
- * StakingContext<
124
- * StrictType<T[K]["$Redeemer"]>,
125
- * PermissiveType<T[K]["$Redeemer"]>
126
- * >
127
- * > : never
128
- * }}
41
+ * @returns {ContractContext<T>}
129
42
  */
130
43
  build(expectedHashes?: Option<{
131
44
  [name: string]: string;
132
- }>, options?: LibOptions): { [K_1 in keyof T]: T[K_1]["$purpose"] extends "spending" ? ValidatorHash<SpendingContext<import("./StrictType.js").StrictType<T[K_1]["$Datum"]>, import("./PermissiveType.js").PermissiveType<T[K_1]["$Datum"]>, import("./StrictType.js").StrictType<T[K_1]["$Redeemer"]>, import("./PermissiveType.js").PermissiveType<T[K_1]["$Redeemer"]>>> : T[K_1]["$purpose"] extends "minting" ? MintingPolicyHash<MintingContext<import("./StrictType.js").StrictType<T[K_1]["$Redeemer"]>, import("./PermissiveType.js").PermissiveType<T[K_1]["$Redeemer"]>>> : T[K_1]["$purpose"] extends "certifying" | "rewarding" ? StakingValidatorHash<StakingContext<import("./StrictType.js").StrictType<T[K_1]["$Redeemer"]>, import("./PermissiveType.js").PermissiveType<T[K_1]["$Redeemer"]>>> : never; };
45
+ }>): ContractContext<T>;
133
46
  }
47
+ export type LoadedModule = import("../codegen/LoadedModule.js").LoadedModule;
48
+ export type LoadedValidator = import("../codegen/LoadedValidator.js").LoadedValidator;
134
49
  export type Lib = import("../lib/index.js").Lib;
135
- export type LibOptions = import("../lib/index.js").LibOptions;
136
- export type CompiledValidator = import("./ContractContext.js").Validator;
137
- export type MintingContext<TRedeemerStrict, TRedeemerPermissive> = import("@helios-lang/ledger").MintingContext<TRedeemerStrict, TRedeemerPermissive>;
138
- export type SpendingContext<TDatumStrict, TDatumPermissive, TRedeemerStrict, TRedeemerPermissive> = import("@helios-lang/ledger").SpendingContext<TDatumStrict, TDatumPermissive, TRedeemerStrict, TRedeemerPermissive>;
139
- export type StakingContext<TRedeemerStrict, TRedeemerPermissive> = import("@helios-lang/ledger").StakingContext<TRedeemerStrict, TRedeemerPermissive>;
140
- export type PermissiveType<C extends Cast<import("@helios-lang/ledger").UplcData, import("@helios-lang/ledger").UplcData>> = import("./PermissiveType.js").PermissiveType<C>;
141
- export type StrictType<C extends Cast<import("@helios-lang/ledger").UplcData, import("@helios-lang/ledger").UplcData>> = import("./StrictType.js").StrictType<C>;
142
- export type Module = {
143
- $name: string;
144
- $sourceCode: string;
145
- $dependencies: Module[];
146
- };
147
- export type Validator = {
148
- $name: string;
149
- $purpose: string;
150
- $sourceCode: string;
151
- $dependencies: Module[];
152
- $hashDependencies: Validator[];
153
- $dependsOnOwnHash: boolean;
154
- $Redeemer: Cast<any, any>;
155
- $Datum?: Cast<any, any>;
156
- };
157
- import { ValidatorHash } from "@helios-lang/ledger";
158
- import { MintingPolicyHash } from "@helios-lang/ledger";
159
- import { StakingValidatorHash } from "@helios-lang/ledger";
160
- import { Cast } from "./Cast.js";
50
+ export type ContractContext<T extends {
51
+ [name: string]: import("./DagCompiler.js").LoadedValidator;
52
+ }> = import("./ContractContext.js").ContractContext<T>;
161
53
  //# sourceMappingURL=ContractContextBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContractContextBuilder.d.ts","sourceRoot":"","sources":["../../src/runtime/ContractContextBuilder.js"],"names":[],"mappings":"AAaA;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;A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;IAC9B,SAAa,EAAE,KAAK,GAAG,EAAE,GAAG,CAAC,CAAA;IAC7B,MAAU,CAAC,EAAE,KAAK,GAAG,EAAE,GAAG,CAAC,CAAA;CACxB;8BA7DG,qBAAqB;kCAArB,qBAAqB;qCAArB,qBAAqB;qBAIP,WAAW"}
1
+ {"version":3,"file":"ContractContextBuilder.d.ts","sourceRoot":"","sources":["../../src/runtime/ContractContextBuilder.js"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH;;;GAGG;AAEH;;GAEG;AACH;;;IAgBI;;OAEG;IACH,gBAFa,uBAAuB,EAAE,CAAC,CAItC;IAbD;;;OAGG;IACH,sBAEC;IAbD;;;;OAIG;IACH,4BAAU;IAiBV;;;;;;OAMG;IACH,gIAKC;IAED;;;OAGG;IACH;;SAFa,gBAAgB,CAAC,CAAC,CAU9B;CACJ;2BA/DY,OAAO,4BAA4B,EAAE,YAAY;8BACjD,OAAO,+BAA+B,EAAE,eAAe;kBACvD,OAAO,iBAAiB,EAAE,GAAG;;;KAK7B,OAAO,sBAAsB,EAAE,eAAe,CAAC,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @param {LoadedValidator} validator
3
+ * @returns {string[]}
4
+ */
5
+ export function getModuleDependencies(validator: LoadedValidator): string[];
6
+ /**
7
+ * @typedef {import("../codegen/LoadedValidator.js").LoadedValidator} LoadedValidator
8
+ * @typedef {import("../lib/index.js").Lib} Lib
9
+ * @typedef {import("./ContractContext.js").AnyContractValidatorHash} AnyContractValidatorHash
10
+ */
11
+ /**
12
+ * Compiles a set of validators that depend on eachothers hashes (forming a Directed Acyclical Graph)
13
+ */
14
+ export class DagCompiler {
15
+ /**
16
+ * @param {Lib} lib
17
+ */
18
+ constructor(lib: Lib);
19
+ /**
20
+ * @private
21
+ * @readonly
22
+ * @type {Lib}
23
+ */
24
+ private readonly lib;
25
+ /**
26
+ * @private
27
+ * @readonly
28
+ * @type {{[name: string]: AnyContractValidatorHash}}
29
+ */
30
+ private readonly cache;
31
+ /**
32
+ * @param {LoadedValidator[]} validators
33
+ * @param {Option<{[name: string]: string}>} expectedHashes
34
+ * @returns {{[name: string]: AnyContractValidatorHash}}
35
+ */
36
+ build(validators: LoadedValidator[], expectedHashes?: Option<{
37
+ [name: string]: string;
38
+ }>): {
39
+ [name: string]: import("./ContractContext.js").AnyContractValidatorHash;
40
+ };
41
+ /**
42
+ * @private
43
+ * @param {LoadedValidator} validator
44
+ * @param {UplcProgramV2} program
45
+ * @param {string} hash - although this can be derived from `program`, reuse this to save some effort
46
+ */
47
+ private addToCache;
48
+ /**
49
+ * @private
50
+ * @param {LoadedValidator} validator
51
+ * @returns {{[name: string]: string}} - TODO: do we really need the purpose?
52
+ */
53
+ private getHashDependencies;
54
+ /**
55
+ * @private
56
+ * @param {LoadedValidator[]} validators
57
+ * @returns {{[name: string]: any}}
58
+ */
59
+ private getHashTypes;
60
+ }
61
+ export type LoadedValidator = import("../codegen/LoadedValidator.js").LoadedValidator;
62
+ export type Lib = import("../lib/index.js").Lib;
63
+ export type AnyContractValidatorHash = import("./ContractContext.js").AnyContractValidatorHash;
64
+ //# sourceMappingURL=DagCompiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DagCompiler.d.ts","sourceRoot":"","sources":["../../src/runtime/DagCompiler.js"],"names":[],"mappings":"AA4MA;;;GAGG;AACH,iDAHW,eAAe,GACb,MAAM,EAAE,CAsBpB;AA3ND;;;;GAIG;AAEH;;GAEG;AACH;IAeI;;OAEG;IACH,iBAFW,GAAG,EAKb;IApBD;;;;OAIG;IACH,qBAAG;IAEH;;;;OAIG;IACH,uBAAK;IAUL;;;;OAIG;IACH,kBAJW,eAAe,EAAE;;;;MAkF3B;IAED;;;;;OAKG;IACH,mBA6BC;IAED;;;;OAIG;IACH,4BAoBC;IAED;;;;OAIG;IACH,qBAMC;CACJ;8BAhMY,OAAO,+BAA+B,EAAE,eAAe;kBACvD,OAAO,iBAAiB,EAAE,GAAG;uCAC7B,OAAO,sBAAsB,EAAE,wBAAwB"}
@@ -1,3 +1,3 @@
1
1
  export type PermissiveType<C extends Cast<import("@helios-lang/uplc/types/data/UplcData.js").UplcData, import("@helios-lang/uplc/types/data/UplcData.js").UplcData>> = C extends Cast<any, infer TPermissive> ? TPermissive : never;
2
- import { Cast } from "./Cast.js";
2
+ import { Cast } from "../cast/Cast.js";
3
3
  //# sourceMappingURL=PermissiveType.d.ts.map
@@ -1,3 +1,3 @@
1
1
  export type StrictType<C extends Cast<import("@helios-lang/uplc/types/data/UplcData.js").UplcData, import("@helios-lang/uplc/types/data/UplcData.js").UplcData>> = C extends Cast<infer TStrict, any> ? TStrict : never;
2
- import { Cast } from "./Cast.js";
2
+ import { Cast } from "../cast/Cast.js";
3
3
  //# sourceMappingURL=StrictType.d.ts.map
@@ -1,4 +1,2 @@
1
- export { Cast } from "./Cast.js";
2
- export { ContractContext } from "./ContractContext.js";
3
1
  export { ContractContextBuilder } from "./ContractContextBuilder.js";
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,16 +0,0 @@
1
- import { ContractContextBuilder } from "@helios-lang/contract-utils"
2
- import { Address, TxBuilder } from "@helios-lang/ledger"
3
- import { match_string, match_string_policy } from "./index.js"
4
-
5
- const context = ContractContextBuilder.new()
6
- .with(match_string)
7
- .with(match_string_policy)
8
- .build()
9
-
10
- console.log(context.match_string_policy.toHex())
11
-
12
- const address = Address.fromHash(context.match_string)
13
-
14
- const b = new TxBuilder()
15
- .mint(context.match_string_policy, [["", 10]], "hello")
16
- .pay(address, 0n, { hash: { One: { message: "hello" } } })
@@ -1,27 +0,0 @@
1
- import { Cast } from "@helios-lang/contract-utils";
2
- export const utils = {
3
- $name: "utils",
4
- $purpose: "module",
5
- $sourceCode: "module utils\n\nfunc compare(a: String, b: String) -> Bool {\n a == b\n}",
6
- $dependencies: [],
7
- }
8
- export const match_string_policy = {
9
- $name: "match_string_policy",
10
- $purpose: "minting",
11
- $sourceCode: "minting match_string_policy\n\nfunc main(redeemer: String, _) -> Bool {\n redeemer == \"Hello\"\n}",
12
- $dependencies: [],
13
- $hashDependencies: [],
14
- $dependsOnOwnHash: false,
15
- $Redeemer: new Cast({"primitiveType":"String"}),
16
-
17
- }
18
- export const match_string = {
19
- $name: "match_string",
20
- $purpose: "spending",
21
- $sourceCode: "spending match_string\n\nimport { compare } from utils\n\nenum Datum {\n One {\n message: String\n }\n\n Two {\n code: Int\n }\n}\n\nfunc main(datum: Datum, redeemer: String, _) -> Bool {\n compare(datum.switch{d: One => d.message, d: Two => d.code.show()}, redeemer)\n}",
22
- $dependencies: [utils],
23
- $hashDependencies: [],
24
- $dependsOnOwnHash: false,
25
- $Redeemer: new Cast({"primitiveType":"String"}),
26
- $Datum: new Cast({"enumVariantTypes":[{"name":"One","fieldTypes":[{"name":"message","type":{"primitiveType":"String"}}]},{"name":"Two","fieldTypes":[{"name":"code","type":{"primitiveType":"Int"}}]}]})
27
- }
@@ -1,5 +0,0 @@
1
- minting match_string_policy
2
-
3
- func main(redeemer: String, _) -> Bool {
4
- redeemer == "Hello"
5
- }
@@ -1,17 +0,0 @@
1
- spending match_string
2
-
3
- import { compare } from "./utils.hl"
4
-
5
- enum Datum {
6
- One {
7
- message: String
8
- }
9
-
10
- Two {
11
- code: Int
12
- }
13
- }
14
-
15
- func main(datum: Datum, redeemer: String, _) -> Bool {
16
- compare(datum.switch{d: One => d.message, d: Two => d.code.show()}, redeemer)
17
- }
@@ -1,5 +0,0 @@
1
- module utils
2
-
3
- func compare(a: String, b: String) -> Bool {
4
- a == b
5
- }