@helios-lang/contract-utils 0.2.81 → 0.3.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.
Files changed (66) hide show
  1. package/package.json +7 -7
  2. package/src/cast/Cast.js +149 -140
  3. package/src/cast/UserFunc.js +43 -50
  4. package/src/cast/index.js +2 -29
  5. package/src/codegen/LoadedScriptsWriter.js +55 -55
  6. package/src/codegen/TypeSchema.js +6 -14
  7. package/src/codegen/index.js +1 -14
  8. package/src/compiler/CompilerLib.js +1 -80
  9. package/src/compiler/CompilerLib_v0_16.js +14 -14
  10. package/src/compiler/CompilerLib_v0_17.js +25 -23
  11. package/src/compiler/index.js +0 -5
  12. package/src/compiler/ops.js +5 -7
  13. package/src/context/CacheEntry.js +86 -64
  14. package/src/context/ContractContextBuilder.js +37 -57
  15. package/src/context/ContractContextCache.js +5 -7
  16. package/src/context/DagCompiler.js +24 -20
  17. package/src/context/index.js +1 -7
  18. package/src/hl2ts.js +3 -6
  19. package/src/index.js +355 -9
  20. package/types/cast/Cast.d.ts +17 -103
  21. package/types/cast/Cast.d.ts.map +1 -1
  22. package/types/cast/UserFunc.d.ts +11 -94
  23. package/types/cast/UserFunc.d.ts.map +1 -1
  24. package/types/cast/index.d.ts +2 -9
  25. package/types/cast/index.d.ts.map +1 -1
  26. package/types/codegen/LoadedScriptsWriter.d.ts +8 -83
  27. package/types/codegen/LoadedScriptsWriter.d.ts.map +1 -1
  28. package/types/codegen/TypeCheckedValidator.d.ts +1 -1
  29. package/types/codegen/TypeCheckedValidator.d.ts.map +1 -1
  30. package/types/codegen/TypeSchema.d.ts +1 -1
  31. package/types/codegen/TypeSchema.d.ts.map +1 -1
  32. package/types/codegen/index.d.ts +1 -7
  33. package/types/codegen/index.d.ts.map +1 -1
  34. package/types/compiler/CompilerLib.d.ts +3 -138
  35. package/types/compiler/CompilerLib.d.ts.map +1 -1
  36. package/types/compiler/CompilerLib_v0_16.d.ts +8 -118
  37. package/types/compiler/CompilerLib_v0_16.d.ts.map +1 -1
  38. package/types/compiler/CompilerLib_v0_17.d.ts +12 -52
  39. package/types/compiler/CompilerLib_v0_17.d.ts.map +1 -1
  40. package/types/compiler/index.d.ts +0 -2
  41. package/types/compiler/index.d.ts.map +1 -1
  42. package/types/compiler/ops.d.ts +2 -2
  43. package/types/compiler/ops.d.ts.map +1 -1
  44. package/types/context/CacheEntry.d.ts +9 -22
  45. package/types/context/CacheEntry.d.ts.map +1 -1
  46. package/types/context/ContractContext.d.ts +8 -8
  47. package/types/context/ContractContext.d.ts.map +1 -1
  48. package/types/context/ContractContextBuilder.d.ts +5 -100
  49. package/types/context/ContractContextBuilder.d.ts.map +1 -1
  50. package/types/context/ContractContextCache.d.ts +5 -8
  51. package/types/context/ContractContextCache.d.ts.map +1 -1
  52. package/types/context/DagCompiler.d.ts +11 -15
  53. package/types/context/DagCompiler.d.ts.map +1 -1
  54. package/types/context/index.d.ts +1 -6
  55. package/types/context/index.d.ts.map +1 -1
  56. package/types/hl2ts.d.ts +0 -3
  57. package/types/hl2ts.d.ts.map +1 -1
  58. package/types/index.d.ts +284 -9
  59. package/types/index.d.ts.map +1 -1
  60. package/src/cast/PermissiveType.js +0 -18
  61. package/src/cast/StrictType.js +0 -18
  62. package/src/codegen/LoadedModule.js +0 -23
  63. package/src/codegen/LoadedValidator.js +0 -52
  64. package/src/codegen/TypeCheckedModule.js +0 -31
  65. package/src/codegen/TypeCheckedValidator.js +0 -15
  66. package/src/context/ContractContext.js +0 -130
package/types/index.d.ts CHANGED
@@ -1,13 +1,288 @@
1
- export * from "./cast/index.js";
2
- export { LoadedScriptsWriter } from "./codegen/LoadedScriptsWriter.js";
3
- export type LoadedValidator = import("./codegen/index.js").LoadedValidator;
4
- export type LoadedModule = import("./codegen/index.js").LoadedModule;
1
+ export { makeLoadedScriptsWriter } from "./codegen/index.js";
2
+ /**
3
+ * `returns` is optional to accomodate main functions that return undefined
4
+ */
5
+ export type TypeCheckedUserFunc = {
6
+ name: string;
7
+ requiresScriptContext: boolean;
8
+ requiresCurrentScript: boolean;
9
+ arguments: {
10
+ name: string;
11
+ type: TypeSchema;
12
+ isOptional: boolean;
13
+ }[];
14
+ returns?: TypeSchema;
15
+ };
16
+ export type TypeCheckedModule = {
17
+ name: string;
18
+ purpose: string;
19
+ sourceCode: string;
20
+ moduleDepedencies: string[];
21
+ types: Record<string, TypeSchema>;
22
+ functions?: Record<string, TypeCheckedUserFunc>;
23
+ };
24
+ export type TypeCheckedValidator = TypeCheckedModule & {
25
+ hashDependencies: string[];
26
+ currentScriptIndex?: number;
27
+ Redeemer: TypeSchema;
28
+ Datum?: TypeSchema;
29
+ };
30
+ export type ScriptHashType = any;
31
+ /**
32
+ * if `debug` is true, the ir is included in the user functions where possible
33
+ */
34
+ export type CompileOptions = {
35
+ allValidatorHashTypes: Record<string, ScriptHashType>;
36
+ allValidatorIndices?: Record<string, number>;
37
+ hashDependencies: Record<string, string>;
38
+ dependsOnOwnHash?: boolean;
39
+ ownHash?: string;
40
+ parameters?: Record<string, UplcData>;
41
+ isTestnet: boolean;
42
+ optimize: boolean;
43
+ debug?: boolean;
44
+ excludeUserFuncs?: Set<string>;
45
+ onCompileUserFunc?: (props: {
46
+ name: string;
47
+ cborHex: string;
48
+ plutusVersion: PlutusVersion;
49
+ ir?: string;
50
+ sourceMap?: UplcSourceMapJsonSafe;
51
+ alt?: {
52
+ cborHex: string;
53
+ ir?: string;
54
+ sourceMap?: UplcSourceMapJsonSafe;
55
+ };
56
+ }) => void;
57
+ };
58
+ export type CompileOutput = {
59
+ cborHex: string;
60
+ plutusVersion: PlutusVersion;
61
+ ir?: string;
62
+ sourceMap?: import("@helios-lang/uplc").UplcSourceMapJsonSafe;
63
+ };
64
+ export type TypeCheckOutput = {
65
+ modules: {
66
+ [name: string]: TypeCheckedModule;
67
+ };
68
+ validators: {
69
+ [name: string]: TypeCheckedValidator;
70
+ };
71
+ };
72
+ export type SourceDetails = {
73
+ name: string;
74
+ purpose: string;
75
+ sourceCode: string;
76
+ };
77
+ export type CompilerLib = {
78
+ version: string;
79
+ getScriptHashType: (purpose: string) => ScriptHashType;
80
+ typeCheck: (validators: string[], modules: string[]) => ({
81
+ modules: {
82
+ [name: string]: TypeCheckedModule;
83
+ };
84
+ validators: {
85
+ [name: string]: TypeCheckedValidator;
86
+ };
87
+ });
88
+ compile: (main: string, modules: string[], options: CompileOptions) => CompileOutput;
89
+ };
90
+ export type DagDependencies = Record<string, string[]>;
91
+ export type CastConfig = {
92
+ isMainnet: boolean;
93
+ };
94
+ export type Cast<TStrict, TPermissive> = {
95
+ kind: "Cast";
96
+ schema: TypeSchema;
97
+ config: CastConfig;
98
+ fromUplcData: (data: UplcData, dataPath?: string) => TStrict;
99
+ /**
100
+ * converts javascript object to UPLC data, according to the schema.
101
+ * The optional `dataPath` parameter can provide a contextual cue for the
102
+ * data-conversion process, and will be displayed as part of any error messages
103
+ * thrown during the data transformation
104
+ */
105
+ toUplcData: (x: TPermissive, dataPath?: string) => UplcData;
106
+ };
107
+ export type ConfigurableCast<TStrict, TPermissive> = (config: CastConfig) => Cast<TStrict, TPermissive>;
108
+ /**
109
+ * StrictType and PermissiveType work for both Cast and ConfigurableCast
110
+ */
111
+ export type CastLike<TStrict, TPermissive> = Cast<TStrict, TPermissive> | ConfigurableCast<TStrict, TPermissive>;
112
+ export type SchemaToUplcContext = {
113
+ /**
114
+ * - symbol table permitting recursive schema references
115
+ */
116
+ defs: Record<string, TypeSchema>;
117
+ /**
118
+ * - provides developer-facing cues for any parsing errors, showing the deep field path of any error
119
+ */
120
+ dataPath: string;
121
+ };
122
+ export type UplcToSchemaContext = {
123
+ /**
124
+ * - symbol table permitting recursive schema references
125
+ */
126
+ defs: Record<string, TypeSchema>;
127
+ /**
128
+ * - provides developer-facing cues for any parsing errors, showing the deep field path of any error
129
+ */
130
+ dataPath: string;
131
+ /**
132
+ * - has isMainnet indicator
133
+ */
134
+ config: CastConfig;
135
+ };
136
+ /**
137
+ * TODO: add logOptions here as well (which can be overridden by logOptions passed directly to eval(), evalUnsafe() and profile())?
138
+ * `returns` is optional to accomodate main functions that return void
139
+ */
140
+ export type UserFuncProps = {
141
+ name: string;
142
+ requiresScriptContext: boolean;
143
+ requiresCurrentScript: boolean;
144
+ arguments: {
145
+ name: string;
146
+ type: TypeSchema;
147
+ isOptional: boolean;
148
+ }[];
149
+ returns?: TypeSchema;
150
+ validatorIndices?: Record<string, number>;
151
+ castConfig: CastConfig;
152
+ };
153
+ export type UnsafeArgsT<ArgsT> = { [K in keyof ArgsT]: K extends "$currentScript" ? string : UplcData; };
154
+ export type UserFunc<ArgsT extends {
155
+ [argName: string]: any;
156
+ }, RetT> = {
157
+ uplc: UplcProgram;
158
+ name: string;
159
+ eval: (namedArgs: ArgsT, logOptions?: UplcLogger | undefined) => RetT;
160
+ evalUnsafe: (namedArgs: UnsafeArgsT<ArgsT>, logOptions?: UplcLogger | undefined) => RetT extends void ? void : UplcData;
161
+ profile: (namedArgs: UnsafeArgsT<ArgsT>, logOptions?: UplcLogger | undefined) => CekResult;
162
+ };
163
+ export type LoadedModule = {
164
+ $name: string;
165
+ $purpose: "module";
166
+ $sourceCode: string;
167
+ $dependencies: ReadonlyArray<LoadedModule>;
168
+ $types: {
169
+ [name: string]: CastLike<any, any>;
170
+ };
171
+ $functions: {
172
+ [name: string]: (uplc: UplcProgram, config: CastConfig) => UserFunc<any, any>;
173
+ };
174
+ };
175
+ /**
176
+ * * Note: `$hashDependencies` doesn't contain the indirect dependencies! It must be kept to a minimum in order to inform in which order the validators must be compiled
177
+ */
178
+ export type LoadedValidator = {
179
+ $name: string;
180
+ $sourceCode: string;
181
+ $dependencies: ReadonlyArray<LoadedModule>;
182
+ $hashDependencies: ReadonlyArray<LoadedValidator>;
183
+ $currentScriptIndex?: number;
184
+ $dependsOnOwnHash: boolean;
185
+ $types: {
186
+ [name: string]: CastLike<any, any>;
187
+ };
188
+ $functions: {
189
+ [name: string]: (uplc: UplcProgram, config: CastConfig) => UserFunc<any, any>;
190
+ };
191
+ $Redeemer: CastLike<any, any>;
192
+ } & ({
193
+ $purpose: "spending" | "mixed";
194
+ $Datum: CastLike<any, any>;
195
+ } | {
196
+ $purpose: "minting" | "certifying" | "rewarding" | "staking";
197
+ });
198
+ export type NamedDependencyToObject<N extends {
199
+ $name: string;
200
+ }> = { [name in N["$name"]]: Extract<N, {
201
+ "$name": name;
202
+ }>; };
203
+ export type NamedDependenciesToObject<N extends ReadonlyArray<{
204
+ $name: string;
205
+ }>> = NamedDependencyToObject<N extends ReadonlyArray<infer M> ? M : never>;
206
+ export type ExtractDependencies<V extends LoadedValidator> = NamedDependenciesToObject<V["$dependencies"]>;
207
+ export type PermissiveType<C extends CastLike<any, any>> = C extends CastLike<any, infer TPermissive> ? TPermissive : never;
208
+ export type StrictType<C extends CastLike<any, any>> = C extends CastLike<infer TStrict, any> ? TStrict : never;
209
+ export type AnyContractValidatorContext = (ValidatorHash<SpendingContext<any, any, any, any>> | MintingPolicyHash<MintingContext<any, any>> | StakingValidatorHash<StakingContext<any, any>> | ScriptHash);
210
+ export type ContractValidatorContexts<V extends LoadedValidator> = V extends {
211
+ "$purpose": "spending";
212
+ "$Datum": CastLike<any, any>;
213
+ "$Redeemer": CastLike<any, any>;
214
+ } ? {
215
+ $hash: ValidatorHash<SpendingContext<StrictType<V["$Datum"]>, PermissiveType<V["$Datum"]>, StrictType<V["$Redeemer"]>, PermissiveType<V["$Redeemer"]>>>;
216
+ } & ContractTypesContext<V["$types"]> & ContractUserFuncsContext<V["$functions"]> : V extends {
217
+ "$purpose": "minting";
218
+ "$Redeemer": CastLike<any, any>;
219
+ } ? {
220
+ $hash: MintingPolicyHash<MintingContext<StrictType<V["$Redeemer"]>, PermissiveType<V["$Redeemer"]>>>;
221
+ } & ContractTypesContext<V["$types"]> & ContractUserFuncsContext<V["$functions"]> : V extends {
222
+ "$purpose": ("certifying" | "rewarding" | "staking");
223
+ "$Redeemer": CastLike<any, any>;
224
+ } ? {
225
+ $hash: StakingValidatorHash<StakingContext<StrictType<V["$Redeemer"]>, PermissiveType<V["$Redeemer"]>>>;
226
+ } & ContractTypesContext<V["$types"]> & ContractUserFuncsContext<V["$functions"]> : V extends {
227
+ "$purpose": "mixed";
228
+ "$Datum": CastLike<any, any>;
229
+ "$Redeemer": CastLike<any, any>;
230
+ } ? {
231
+ $hash: ScriptHash<SpendingContext<StrictType<V["$Datum"]>, PermissiveType<V["$Datum"]>, StrictType<V["$Redeemer"]>, PermissiveType<V["$Redeemer"]>>>;
232
+ } & ContractTypesContext<V["$types"]> & ContractUserFuncsContext<V["$functions"]> : never;
233
+ export type ContractModuleContexts<V extends LoadedModule> = ContractTypesContext<V["$types"]> & ContractUserFuncsContext<V["$functions"]>;
234
+ export type ContractTypesContext<T extends {
235
+ [typeName: string]: CastLike<any, any>;
236
+ }> = { [K in keyof T]: Cast<StrictType<T[K]>, PermissiveType<T[K]>>; };
237
+ export type ContractUserFuncsContext<T extends {
238
+ [funcName: string]: (uplc: UplcProgram, config: CastConfig) => UserFunc<any, any>;
239
+ }> = { [K in keyof T]: ReturnType<T[K]>; };
5
240
  export type ContractContext<Vs extends {
6
- [name: string]: import("./codegen/index.js").LoadedValidator;
241
+ [name: string]: LoadedValidator;
7
242
  }, Ms extends {
8
- [name: string]: import("./codegen/index.js").LoadedModule;
9
- }> = import("./context/index.js").ContractContext<Vs, Ms>;
10
- export type ExtractDependencies<V extends LoadedValidator> = import("./codegen/index.js").ExtractDependencies<V>;
11
- export { ContractContextBuilder, contractContextCache } from "./context/index.js";
243
+ [name: string]: LoadedModule;
244
+ }> = { [K in keyof Vs]: ContractValidatorContexts<Vs[K]>; } & { [K in keyof Ms]: ContractModuleContexts<Ms[K]>; };
245
+ /**
246
+ * if `debug` is true, the ir is included where possible
247
+ */
248
+ export type ContractContextBuilderProps = {
249
+ isMainnet: boolean;
250
+ expectedHashes?: {
251
+ [name: string]: string;
252
+ };
253
+ parameters?: Record<string, UplcData>;
254
+ dumpHashes?: boolean;
255
+ debug?: boolean;
256
+ };
257
+ export type LoadedScriptsWriter = {
258
+ writeModules: (modules: Record<string, TypeCheckedModule>) => LoadedScriptsWriter;
259
+ writeValidators: (validators: Record<string, TypeCheckedValidator>) => LoadedScriptsWriter;
260
+ finalize: () => [string, string, string];
261
+ };
262
+ export type ContractContextBuilder<Vs extends {
263
+ [name: string]: LoadedValidator;
264
+ }, Ms extends {
265
+ [name: string]: LoadedModule;
266
+ }> = {
267
+ with: <V extends LoadedValidator>(validator: V) => ContractContextBuilder<Vs & { [K in V["$name"]]: V; }, Ms & ExtractDependencies<V>>;
268
+ withModule: <M extends LoadedModule>(m: M) => ContractContextBuilder<Vs, Ms & { [K in M["$name"]]: M; }>;
269
+ build: (props: ContractContextBuilderProps) => ContractContext<Vs, Ms>;
270
+ };
271
+ import type { TypeSchema } from "@helios-lang/type-utils";
272
+ import type { UplcData } from "@helios-lang/uplc";
273
+ import type { PlutusVersion } from "@helios-lang/uplc";
274
+ import type { UplcSourceMapJsonSafe } from "@helios-lang/uplc";
275
+ import type { UplcProgram } from "@helios-lang/uplc";
276
+ import type { UplcLogger } from "@helios-lang/uplc";
277
+ import type { CekResult } from "@helios-lang/uplc";
278
+ import type { SpendingContext } from "@helios-lang/ledger";
279
+ import type { ValidatorHash } from "@helios-lang/ledger";
280
+ import type { MintingContext } from "@helios-lang/ledger";
281
+ import type { MintingPolicyHash } from "@helios-lang/ledger";
282
+ import type { StakingContext } from "@helios-lang/ledger";
283
+ import type { StakingValidatorHash } from "@helios-lang/ledger";
284
+ import type { ScriptHash } from "@helios-lang/ledger";
285
+ export { makeCast, makeUserFunc } from "./cast/index.js";
286
+ export { makeContractContextBuilder, contractContextCache } from "./context/index.js";
12
287
  export { typeCheckFiles, typeCheckScripts, loadCompilerLib } from "./compiler/ops.js";
13
288
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;8BAUa,OAAO,o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C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,KAAK,mBAAmB;qBACnE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,KAAK,mBAAmB;cACzE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;;mCAIS,EAAE,SAAtC;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;CAAE,EACF,EAAE,SAAnC;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAA;CAAE;UAEnC,CAAC,CAAyB,SAAf,eAAe,EAAE,SAAS,EAAE,CAAC,KAAK,sBAAsB,CAAC,EAAE,GAAG,GAAE,CAAe,IAAV,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAC,EAAE,EAAE,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC;gBAC7H,CAAC,CAAsB,SAAZ,YAAY,EAAE,CAAC,EAAE,CAAC,KAAK,sBAAsB,CAAC,EAAE,EAAE,EAAE,GAAG,GAAE,CAAe,IAAV,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAC,CAAC;WACzF,CAAC,KAAK,EAAE,2BAA2B,KAAK,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC;;gCArW1C,yBAAyB;8BAC+C,mBAAmB;mCAAnB,mBAAmB;2CAAnB,mBAAmB;iCAAnB,mBAAmB;gCAAnB,mBAAmB;+BAAnB,mBAAmB;qCAFc,qBAAqB;mCAArB,qBAAqB;oCAArB,qBAAqB;uCAArB,qBAAqB;oCAArB,qBAAqB;0CAArB,qBAAqB;gCAArB,qBAAqB"}
@@ -1,18 +0,0 @@
1
- export {}
2
-
3
- /**
4
- * @template TStrict
5
- * @template TPermissive
6
- * @typedef {import("./Cast.js").ConfigurableCast<TStrict, TPermissive>} ConfigurableCast
7
- */
8
-
9
- /**
10
- * @template TStrict
11
- * @template TPermissive
12
- * @typedef {import("./Cast.js").CastLike<TStrict, TPermissive>} CastLike
13
- */
14
-
15
- /**
16
- * @template {CastLike<any, any>} C
17
- * @typedef {C extends CastLike<any, infer TPermissive> ? TPermissive : never} PermissiveType
18
- */
@@ -1,18 +0,0 @@
1
- export {}
2
-
3
- /**
4
- * @template TStrict
5
- * @template TPermissive
6
- * @typedef {import("./Cast.js").ConfigurableCast<TStrict, TPermissive>} ConfigurableCast
7
- */
8
-
9
- /**
10
- * @template TStrict
11
- * @template TPermissive
12
- * @typedef {import("./Cast.js").CastLike<TStrict, TPermissive>} CastLike
13
- */
14
-
15
- /**
16
- * @template {CastLike<any, any>} C
17
- * @typedef {C extends CastLike<infer TStrict, any> ? TStrict : never} StrictType
18
- */
@@ -1,23 +0,0 @@
1
- import { UserFunc } from "../cast/UserFunc.js"
2
-
3
- /**
4
- * @typedef {import("@helios-lang/uplc").UplcProgram} UplcProgram
5
- * @typedef {import("../cast/Cast.js").CastConfig} CastConfig
6
- */
7
-
8
- /**
9
- * @template TStrict
10
- * @template TPermissive
11
- * @typedef {import("../cast/Cast.js").CastLike<TStrict, TPermissive>} CastLike
12
- */
13
-
14
- /**
15
- * @typedef {{
16
- * $name: string
17
- * $purpose: "module"
18
- * $sourceCode: string
19
- * $dependencies: ReadonlyArray<LoadedModule>
20
- * $types: {[name: string]: CastLike<any, any>}
21
- * $functions: {[name: string]: (uplc: UplcProgram, config: CastConfig) => UserFunc<any>}
22
- * }} LoadedModule
23
- */
@@ -1,52 +0,0 @@
1
- import { UserFunc } from "../cast/UserFunc.js"
2
-
3
- /**
4
- * @template TStrict
5
- * @template TPermissive
6
- * @typedef {import("../cast/Cast.js").CastLike<TStrict, TPermissive>} CastLike
7
- */
8
-
9
- /**
10
- * @typedef {import("@helios-lang/uplc").UplcProgram} UplcProgram
11
- * @typedef {import("../cast/Cast.js").CastConfig} CastConfig
12
- * @typedef {import("./LoadedModule.js").LoadedModule} LoadedModule
13
- */
14
-
15
- /**
16
- * * Note: `$hashDependencies` doesn't contain the indirect dependencies! It must be kept to a minimum in order to inform in which order the validators must be compiled
17
- * @typedef {{
18
- * $name: string
19
- * $sourceCode: string
20
- * $dependencies: ReadonlyArray<LoadedModule>
21
- * $hashDependencies: ReadonlyArray<LoadedValidator>
22
- * $currentScriptIndex?: number
23
- * $dependsOnOwnHash: boolean
24
- * $types: {[name: string]: CastLike<any, any>}
25
- * $functions: {[name: string]: (uplc: UplcProgram, config: CastConfig) => UserFunc<any>}
26
- * $Redeemer: CastLike<any, any>
27
- * } & (
28
- * {
29
- * $purpose: "spending" | "mixed"
30
- * $Datum: CastLike<any, any>
31
- * } | {
32
- * $purpose: "minting" | "certifying" | "rewarding" | "staking"
33
- * }
34
- * )} LoadedValidator
35
- */
36
-
37
- /**
38
- * @template {{$name: string}} N
39
- * @typedef {{
40
- * [name in N["$name"]]: Extract<N, {"$name": name}>
41
- * }} NamedDependencyToObject
42
- */
43
-
44
- /**
45
- * @template {ReadonlyArray<{$name: string}>} N
46
- * @typedef {NamedDependencyToObject<N extends ReadonlyArray<infer M> ? M : never>} NamedDependenciesToObject
47
- */
48
-
49
- /**
50
- * @template {LoadedValidator} V
51
- * @typedef {NamedDependenciesToObject<V["$dependencies"]>} ExtractDependencies
52
- */
@@ -1,31 +0,0 @@
1
- export {}
2
-
3
- /**
4
- * @typedef {import("./TypeSchema.js").TypeSchema} TypeSchema
5
- */
6
-
7
- /**
8
- * `returns` is optional to accomodate main functions that return undefined
9
- * @typedef {{
10
- * name: string
11
- * requiresScriptContext: boolean
12
- * requiresCurrentScript: boolean
13
- * arguments: {
14
- * name: string
15
- * type: TypeSchema
16
- * isOptional: boolean
17
- * }[]
18
- * returns?: TypeSchema
19
- * }} TypeCheckedUserFunc
20
- */
21
-
22
- /**
23
- * @typedef {{
24
- * name: string
25
- * purpose: string
26
- * sourceCode: string
27
- * moduleDepedencies: string[]
28
- * types: Record<string, TypeSchema>
29
- * functions?: Record<string, TypeCheckedUserFunc>
30
- * }} TypeCheckedModule
31
- */
@@ -1,15 +0,0 @@
1
- export {}
2
-
3
- /**
4
- * @typedef {import("./TypeCheckedModule.js").TypeCheckedModule} TypeCheckedModule
5
- * @typedef {import("./TypeSchema.js").TypeSchema} TypeSchema
6
- */
7
-
8
- /**
9
- * @typedef {TypeCheckedModule & {
10
- * hashDependencies: string[]
11
- * currentScriptIndex?: number
12
- * Redeemer: TypeSchema
13
- * Datum?: TypeSchema
14
- * }} TypeCheckedValidator
15
- */
@@ -1,130 +0,0 @@
1
- import {
2
- StakingValidatorHash,
3
- ValidatorHash,
4
- MintingPolicyHash,
5
- ScriptHash
6
- } from "@helios-lang/ledger"
7
- import { Cast, UserFunc } from "../cast/index.js"
8
-
9
- /**
10
- * @typedef {import("@helios-lang/uplc").UplcProgram} UplcProgram
11
- * @typedef {import("../cast/Cast.js").CastConfig} CastConfig
12
- * @typedef {import("../codegen/index.js").LoadedModule} LoadedModule
13
- * @typedef {import("../codegen/index.js").LoadedValidator} LoadedValidator
14
- */
15
-
16
- /**
17
- * @template TRedeemerStrict
18
- * @template TRedeemerPermissive
19
- * @typedef {import("@helios-lang/ledger").MintingContext<TRedeemerStrict, TRedeemerPermissive>} MintingContext
20
- */
21
-
22
- /**
23
- * @template TDatumStrict
24
- * @template TDatumPermissive
25
- * @template TRedeemerStrict
26
- * @template TRedeemerPermissive
27
- * @typedef {import("@helios-lang/ledger").SpendingContext<TDatumStrict, TDatumPermissive, TRedeemerStrict, TRedeemerPermissive>} SpendingContext
28
- */
29
-
30
- /**
31
- * @template TRedeemerStrict
32
- * @template TRedeemerPermissive
33
- * @typedef {import("@helios-lang/ledger").StakingContext<TRedeemerStrict, TRedeemerPermissive>} StakingContext
34
- */
35
-
36
- /**
37
- * @template TStrict
38
- * @template TPermissive
39
- * @typedef {import("../cast/index.js").CastLike<TStrict, TPermissive>} CastLike
40
- */
41
-
42
- /**
43
- * @template {CastLike<any, any>} C
44
- * @typedef {import("../cast/index.js").PermissiveType<C>} PermissiveType
45
- */
46
-
47
- /**
48
- * @template {CastLike<any, any>} C
49
- * @typedef {import("../cast/index.js").StrictType<C>} StrictType
50
- */
51
-
52
- /**
53
- * @typedef {(
54
- * ValidatorHash<SpendingContext<any, any, any, any>> |
55
- * MintingPolicyHash<MintingContext<any, any>> |
56
- * StakingValidatorHash<StakingContext<any, any>> |
57
- * ScriptHash
58
- * )} AnyContractValidatorContext
59
- */
60
-
61
- /**
62
- * @template {LoadedValidator} V
63
- * @typedef {V extends {"$purpose": "spending", "$Datum": CastLike<any, any>, "$Redeemer": CastLike<any, any>} ? {
64
- * $hash: ValidatorHash<
65
- * SpendingContext<
66
- * StrictType<V["$Datum"]>,
67
- * PermissiveType<V["$Datum"]>,
68
- * StrictType<V["$Redeemer"]>,
69
- * PermissiveType<V["$Redeemer"]>
70
- * >
71
- * >
72
- * } & ContractTypesContext<V["$types"]> & ContractUserFuncsContext<V["$functions"]> :
73
- * V extends {"$purpose": "minting", "$Redeemer": CastLike<any, any>} ? {
74
- * $hash: MintingPolicyHash<
75
- * MintingContext<
76
- * StrictType<V["$Redeemer"]>,
77
- * PermissiveType<V["$Redeemer"]>
78
- * >
79
- * >
80
- * } & ContractTypesContext<V["$types"]> & ContractUserFuncsContext<V["$functions"]> :
81
- * V extends {"$purpose": ("certifying" | "rewarding" | "staking"), "$Redeemer": CastLike<any, any>} ? {
82
- * $hash: StakingValidatorHash<
83
- * StakingContext<
84
- * StrictType<V["$Redeemer"]>,
85
- * PermissiveType<V["$Redeemer"]>
86
- * >
87
- * >
88
- * } & ContractTypesContext<V["$types"]> & ContractUserFuncsContext<V["$functions"]> :
89
- * V extends {"$purpose": "mixed", "$Datum": CastLike<any, any>, "$Redeemer": CastLike<any, any>} ? {
90
- * $hash: ScriptHash<
91
- * SpendingContext<
92
- * StrictType<V["$Datum"]>,
93
- * PermissiveType<V["$Datum"]>,
94
- * StrictType<V["$Redeemer"]>,
95
- * PermissiveType<V["$Redeemer"]>
96
- * >
97
- * >
98
- * } & ContractTypesContext<V["$types"]> & ContractUserFuncsContext<V["$functions"]> :
99
- * never
100
- * } ContractValidatorContexts
101
- */
102
-
103
- /**
104
- * @template {LoadedModule} V
105
- * @typedef {ContractTypesContext<V["$types"]> & ContractUserFuncsContext<V["$functions"]>} ContractModuleContexts
106
- */
107
-
108
- /**
109
- * @template {{[typeName: string]: CastLike<any, any>}} T
110
- * @typedef {{
111
- * [K in keyof T]: Cast<StrictType<T[K]>, PermissiveType<T[K]>>
112
- * }} ContractTypesContext
113
- */
114
-
115
- /**
116
- * @template {{[funcName: string]: (uplc: UplcProgram, config: CastConfig) => UserFunc<any>}} T
117
- * @typedef {{
118
- * [K in keyof T]: ReturnType<T[K]>
119
- * }} ContractUserFuncsContext
120
- */
121
-
122
- /**
123
- * @template {{[name: string]: LoadedValidator}} Vs
124
- * @template {{[name: string]: LoadedModule}} Ms
125
- * @typedef {{
126
- * [K in keyof Vs]: ContractValidatorContexts<Vs[K]>
127
- * } & {
128
- * [K in keyof Ms]: ContractModuleContexts<Ms[K]>
129
- * }} ContractContext
130
- */