@helios-lang/contract-utils 0.2.10 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/cast/Cast.js +9 -0
- package/src/cast/UserFunc.js +36 -0
- package/src/cast/index.js +1 -0
- package/src/codegen/LoadedScriptsWriter.js +55 -1
- package/src/codegen/LoadedValidator.js +1 -1
- package/src/codegen/TypeCheckedModule.js +14 -1
- package/src/codegen/TypeSchema.js +2 -0
- package/src/context/ContractContext.js +4 -2
- package/src/context/ContractContextCache.js +5 -2
- package/types/cast/Cast.d.ts.map +1 -1
- package/types/cast/UserFunc.d.ts +41 -0
- package/types/cast/UserFunc.d.ts.map +1 -0
- package/types/cast/index.d.ts +1 -0
- package/types/cast/index.d.ts.map +1 -1
- package/types/codegen/LoadedScriptsWriter.d.ts +6 -1
- package/types/codegen/LoadedScriptsWriter.d.ts.map +1 -1
- package/types/codegen/LoadedValidator.d.ts +1 -1
- package/types/codegen/LoadedValidator.d.ts.map +1 -1
- package/types/codegen/TypeCheckedModule.d.ts +11 -3
- package/types/codegen/TypeCheckedModule.d.ts.map +1 -1
- package/types/codegen/TypeSchema.d.ts.map +1 -1
- package/types/context/ContractContext.d.ts +2 -1
- package/types/context/ContractContext.d.ts.map +1 -1
- package/types/context/ContractContextCache.d.ts +2 -2
- package/types/context/ContractContextCache.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helios-lang/contract-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Convenience and type-safety utilities for using Helios validators from within Typescript",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@helios-lang/cli-utils": "^0.1.6",
|
|
39
39
|
"@helios-lang/codec-utils": "^0.1.30",
|
|
40
40
|
"@helios-lang/compiler-utils": "^0.1.25",
|
|
41
|
-
"@helios-lang/ledger": "^0.2.
|
|
41
|
+
"@helios-lang/ledger": "^0.2.8",
|
|
42
42
|
"@helios-lang/type-utils": "^0.1.20",
|
|
43
43
|
"@helios-lang/uplc": "^0.1.31"
|
|
44
44
|
}
|
package/src/cast/Cast.js
CHANGED
|
@@ -145,6 +145,8 @@ function schemaToUplc(schema, x, defs = {}) {
|
|
|
145
145
|
return PubKeyHash.new(x).toUplcData()
|
|
146
146
|
case "Real":
|
|
147
147
|
return encodeRealData(x)
|
|
148
|
+
case "Ratio":
|
|
149
|
+
return new ListData([new IntData(x[0]), new IntData(x[1])])
|
|
148
150
|
case "ScriptHash":
|
|
149
151
|
return ScriptHash.new(x).toUplcData()
|
|
150
152
|
case "StakingCredential":
|
|
@@ -294,6 +296,13 @@ function uplcToSchema(schema, data, config, defs = {}) {
|
|
|
294
296
|
return MintingPolicyHash.fromUplcData(data)
|
|
295
297
|
case "PubKeyHash":
|
|
296
298
|
return PubKeyHash.fromUplcData(data)
|
|
299
|
+
case "Ratio": {
|
|
300
|
+
const [top, bottom] = ListData.expect(data).items
|
|
301
|
+
return [
|
|
302
|
+
IntData.expect(top).value,
|
|
303
|
+
IntData.expect(bottom).value
|
|
304
|
+
]
|
|
305
|
+
}
|
|
297
306
|
case "Real":
|
|
298
307
|
return decodeRealData(data)
|
|
299
308
|
case "ScriptHash":
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export {}
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import("@helios-lang/type-utils").TypeSchema} TypeSchema
|
|
5
|
+
* @typedef {import("@helios-lang/uplc").UplcData} UplcData
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {{
|
|
10
|
+
* requiresScriptContext: boolean
|
|
11
|
+
* requiresCurrentScript: boolean
|
|
12
|
+
* arguments: {
|
|
13
|
+
* name: string
|
|
14
|
+
* type: TypeSchema
|
|
15
|
+
* }[]
|
|
16
|
+
* returns: TypeSchema
|
|
17
|
+
* }} UserFuncProps
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @template {((args: Record<string, UplcData>) => UplcData)} T
|
|
22
|
+
*/
|
|
23
|
+
export class UserFunc {
|
|
24
|
+
/**
|
|
25
|
+
* @readonly
|
|
26
|
+
* @type {UserFuncProps}
|
|
27
|
+
*/
|
|
28
|
+
props
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {UserFuncProps} props
|
|
32
|
+
*/
|
|
33
|
+
constructor(props) {
|
|
34
|
+
this.props = props
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/cast/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { genTypes } from "./TypeSchema.js"
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @typedef {import("./TypeCheckedModule.js").TypeCheckedModule} TypeCheckedModule
|
|
6
|
+
* @typedef {import("./TypeCheckedModule.js").TypeCheckedUserFunc} TypeCheckedUserFunc
|
|
6
7
|
* @typedef {import("./TypeCheckedValidator.js").TypeCheckedValidator} TypeCheckedValidator
|
|
7
8
|
* @typedef {import("./TypeSchema.js").TypeSchema} TypeSchema
|
|
8
9
|
*/
|
|
@@ -200,7 +201,6 @@ export class LoadedScriptsWriter {
|
|
|
200
201
|
}
|
|
201
202
|
|
|
202
203
|
/**
|
|
203
|
-
*
|
|
204
204
|
* @param {Record<string, TypeSchema>} types
|
|
205
205
|
*/
|
|
206
206
|
writeTypes(types) {
|
|
@@ -228,6 +228,32 @@ export class LoadedScriptsWriter {
|
|
|
228
228
|
)
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
/**
|
|
232
|
+
* @param {Record<string, TypeCheckedUserFunc>} functions
|
|
233
|
+
*/
|
|
234
|
+
writeFunctions(functions) {
|
|
235
|
+
;[this.definition, this.declaration, this.combined].forEach((w) =>
|
|
236
|
+
w.write(" $functions: {\n")
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
for (let key in functions) {
|
|
240
|
+
const fn = functions[key]
|
|
241
|
+
const t = genFuncType(fn)
|
|
242
|
+
|
|
243
|
+
this.definition.write(
|
|
244
|
+
` ${key}: /** @type {UserFunc<${t}>} */ (new UserFunc(${JSON.stringify(fn)})),\n`
|
|
245
|
+
)
|
|
246
|
+
this.declaration.write(` ${key}: UserFunc<${t}>,\n`)
|
|
247
|
+
this.combined.write(
|
|
248
|
+
` ${key}: new UserFunc<${t}>(${JSON.stringify(fn)}),\n`
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
;[this.definition, this.declaration, this.combined].forEach((w) =>
|
|
253
|
+
w.write(" },\n")
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
|
|
231
257
|
/**
|
|
232
258
|
* @private
|
|
233
259
|
* @param {TypeCheckedModule} m
|
|
@@ -310,9 +336,37 @@ ${datumTypes ? ` $Datum: (config: CastConfig) => new Cast<${datumTypes[0]}, $
|
|
|
310
336
|
)
|
|
311
337
|
|
|
312
338
|
this.writeTypes(v.types)
|
|
339
|
+
if (v.functions) {
|
|
340
|
+
this.writeFunctions(v.functions)
|
|
341
|
+
}
|
|
313
342
|
|
|
314
343
|
this.definition.write(`}\n`)
|
|
315
344
|
this.declaration.write(`}\n`)
|
|
316
345
|
this.combined.write(`}\n`)
|
|
317
346
|
}
|
|
318
347
|
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* @param {TypeCheckedUserFunc} fn
|
|
351
|
+
* @returns {string}
|
|
352
|
+
*/
|
|
353
|
+
function genFuncType(fn) {
|
|
354
|
+
/**
|
|
355
|
+
* @type {string[]}
|
|
356
|
+
*/
|
|
357
|
+
const fields = []
|
|
358
|
+
|
|
359
|
+
if (fn.requiresScriptContext) {
|
|
360
|
+
fields.push("$scriptContext: UplcData")
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (fn.requiresCurrentScript) {
|
|
364
|
+
fields.push("$currentScript: string")
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
fn.arguments.forEach(({ name, type: _type }) => {
|
|
368
|
+
fields.push(`${name}: UplcData`)
|
|
369
|
+
})
|
|
370
|
+
|
|
371
|
+
return `({${fields.join(", ")}}) => UplcData`
|
|
372
|
+
}
|
|
@@ -21,7 +21,7 @@ import { Cast } from "../cast/Cast.js"
|
|
|
21
21
|
* $Redeemer: CastLike<any, any>
|
|
22
22
|
* } & (
|
|
23
23
|
* {
|
|
24
|
-
* $purpose: "spending"
|
|
24
|
+
* $purpose: "spending" | "mixed"
|
|
25
25
|
* $Datum: CastLike<any, any>
|
|
26
26
|
* } | {
|
|
27
27
|
* $purpose: "minting" | "certifying" | "rewarding" | "staking"
|
|
@@ -4,12 +4,25 @@ export {}
|
|
|
4
4
|
* @typedef {import("./TypeSchema.js").TypeSchema} TypeSchema
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {{
|
|
9
|
+
* requiresScriptContext: boolean
|
|
10
|
+
* requiresCurrentScript: boolean
|
|
11
|
+
* arguments: {
|
|
12
|
+
* name: string
|
|
13
|
+
* type: TypeSchema
|
|
14
|
+
* }[]
|
|
15
|
+
* returns: TypeSchema
|
|
16
|
+
* }} TypeCheckedUserFunc
|
|
17
|
+
*/
|
|
18
|
+
|
|
7
19
|
/**
|
|
8
20
|
* @typedef {{
|
|
9
21
|
* name: string
|
|
10
22
|
* purpose: string
|
|
11
23
|
* sourceCode: string
|
|
12
24
|
* moduleDepedencies: string[]
|
|
13
|
-
* types:
|
|
25
|
+
* types: Record<string, TypeSchema>
|
|
26
|
+
* functions?: Record<string, TypeCheckedUserFunc>
|
|
14
27
|
* }} TypeCheckedModule
|
|
15
28
|
*/
|
|
@@ -40,6 +40,8 @@ export function genTypes(schema) {
|
|
|
40
40
|
return ["PubKey", "PubKey | string | number[]"]
|
|
41
41
|
case "PubKeyHash":
|
|
42
42
|
return ["PubKeyHash", "PubKeyHash | string | number[]"]
|
|
43
|
+
case "Ratio":
|
|
44
|
+
return ["[bigint, bigint]", "[IntLike, IntLike]"]
|
|
43
45
|
case "Real":
|
|
44
46
|
return ["number", "number"]
|
|
45
47
|
case "SpendingCredential":
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StakingValidatorHash,
|
|
3
3
|
ValidatorHash,
|
|
4
|
-
MintingPolicyHash
|
|
4
|
+
MintingPolicyHash,
|
|
5
|
+
ScriptHash
|
|
5
6
|
} from "@helios-lang/ledger"
|
|
6
7
|
import { Cast } from "../cast/index.js"
|
|
7
8
|
|
|
@@ -50,7 +51,8 @@ import { Cast } from "../cast/index.js"
|
|
|
50
51
|
* @typedef {(
|
|
51
52
|
* ValidatorHash<SpendingContext<any, any, any, any>> |
|
|
52
53
|
* MintingPolicyHash<MintingContext<any, any>> |
|
|
53
|
-
* StakingValidatorHash<StakingContext<any, any>>
|
|
54
|
+
* StakingValidatorHash<StakingContext<any, any>> |
|
|
55
|
+
* ScriptHash
|
|
54
56
|
* )} AnyContractValidatorContext
|
|
55
57
|
*/
|
|
56
58
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { bytesToHex } from "@helios-lang/codec-utils"
|
|
2
2
|
import {
|
|
3
3
|
MintingPolicyHash,
|
|
4
|
+
ScriptHash,
|
|
4
5
|
StakingValidatorHash,
|
|
5
6
|
ValidatorHash
|
|
6
7
|
} from "@helios-lang/ledger"
|
|
@@ -22,7 +23,7 @@ import { UplcProgramV2 } from "@helios-lang/uplc"
|
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* @typedef {{[name: string]: {
|
|
25
|
-
* purpose: "minting" | "spending" | "staking"
|
|
26
|
+
* purpose: "minting" | "spending" | "staking" | "mixed"
|
|
26
27
|
* bytes: number[]
|
|
27
28
|
* unoptimizedCborHex?: string
|
|
28
29
|
* optimizedCborHex: string
|
|
@@ -173,7 +174,9 @@ class ContractContextCache {
|
|
|
173
174
|
? "minting"
|
|
174
175
|
: hash instanceof StakingValidatorHash
|
|
175
176
|
? "staking"
|
|
176
|
-
:
|
|
177
|
+
: hash instanceof ScriptHash
|
|
178
|
+
? "mixed"
|
|
179
|
+
: "unknown"
|
|
177
180
|
if (purpose == "unknown") {
|
|
178
181
|
throw new Error("unhandled hash type")
|
|
179
182
|
}
|
package/types/cast/Cast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cast.d.ts","sourceRoot":"","sources":["../../src/cast/Cast.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Cast.d.ts","sourceRoot":"","sources":["../../src/cast/Cast.js"],"names":[],"mappings":"AAgdA;;;;;;GAMG;AACH,kGAHW,UAAU,8BASpB;AA3bD;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;GAGG;AACH;IAaI;;;OAGG;IACH,oBAHW,UAAU,UACV,UAAU,EAKpB;IAnBD;;;OAGG;IACH,iBAFU,UAAU,CAEd;IAEN;;;OAGG;IACH,iBAFU,UAAU,CAEd;IAWN;;;OAGG;IACH,mBAHW,QAAQ,GACN,OAAO,CAInB;IAED;;;OAGG;IACH,cAHW,WAAW,GACT,QAAQ,CAIpB;CACJ;uBAhEY,OAAO,mBAAmB,EAAE,QAAQ;yBACpC,OAAO,qBAAqB,EAAE,UAAU;yBAIxC;IACZ,SAAa,EAAE,OAAO,CAAA;CACnB;8DAMkB,UAAU,KAAK,KAAK,OAAO,EAAE,WAAW,CAAC;;;;6CAOlD,KAAK,OAAO,EAAE,WAAW,CAAC,GAAG,iBAAiB,OAAO,EAAE,WAAW,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("@helios-lang/type-utils").TypeSchema} TypeSchema
|
|
3
|
+
* @typedef {import("@helios-lang/uplc").UplcData} UplcData
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {{
|
|
7
|
+
* requiresScriptContext: boolean
|
|
8
|
+
* requiresCurrentScript: boolean
|
|
9
|
+
* arguments: {
|
|
10
|
+
* name: string
|
|
11
|
+
* type: TypeSchema
|
|
12
|
+
* }[]
|
|
13
|
+
* returns: TypeSchema
|
|
14
|
+
* }} UserFuncProps
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @template {((args: Record<string, UplcData>) => UplcData)} T
|
|
18
|
+
*/
|
|
19
|
+
export class UserFunc<T extends (args: Record<string, UplcData>) => UplcData> {
|
|
20
|
+
/**
|
|
21
|
+
* @param {UserFuncProps} props
|
|
22
|
+
*/
|
|
23
|
+
constructor(props: UserFuncProps);
|
|
24
|
+
/**
|
|
25
|
+
* @readonly
|
|
26
|
+
* @type {UserFuncProps}
|
|
27
|
+
*/
|
|
28
|
+
readonly props: UserFuncProps;
|
|
29
|
+
}
|
|
30
|
+
export type TypeSchema = import("@helios-lang/type-utils").TypeSchema;
|
|
31
|
+
export type UplcData = import("@helios-lang/uplc").UplcData;
|
|
32
|
+
export type UserFuncProps = {
|
|
33
|
+
requiresScriptContext: boolean;
|
|
34
|
+
requiresCurrentScript: boolean;
|
|
35
|
+
arguments: {
|
|
36
|
+
name: string;
|
|
37
|
+
type: TypeSchema;
|
|
38
|
+
}[];
|
|
39
|
+
returns: TypeSchema;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=UserFunc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserFunc.d.ts","sourceRoot":"","sources":["../../src/cast/UserFunc.js"],"names":[],"mappings":"AAEA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,uCAFsB,OAAO,MAAM,EAAE,QAAQ,CAAC,KAAK,QAAQ;IASvD;;OAEG;IACH,mBAFW,aAAa,EAIvB;IAXD;;;OAGG;IACH,gBAFU,aAAa,CAElB;CAQR;yBAhCY,OAAO,yBAAyB,EAAE,UAAU;uBAC5C,OAAO,mBAAmB,EAAE,QAAQ;4BAIpC;IACZ,qBAAyB,EAAE,OAAO,CAAA;IAClC,qBAAyB,EAAE,OAAO,CAAA;IAClC,SAAa,EAAE;QACf,MAAY,MAAM,CAAA;QAClB,IAAU,EAAE,UAAU,CAAA;KACjB,EAAE,CAAA;IACP,OAAW,EAAE,UAAU,CAAA;CACpB"}
|
package/types/cast/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Cast };
|
|
2
2
|
export { configureCast } from "./Cast.js";
|
|
3
|
+
export { UserFunc } from "./UserFunc.js";
|
|
3
4
|
export type CastConfig = import("./Cast.js").CastConfig;
|
|
4
5
|
export type ConfigurableCast<TStrict, TPermissive> = import("./Cast.js").ConfigurableCast<TStrict, TPermissive>;
|
|
5
6
|
export type CastLike<TStrict, TPermissive> = import("./Cast.js").CastLike<TStrict, TPermissive>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cast/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cast/index.js"],"names":[],"mappings":";;;yBAMa,OAAO,WAAW,EAAE,UAAU;qDAM9B,OAAO,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC;6CAM1D,OAAO,WAAW,EAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;2DAKlD,OAAO,qBAAqB,EAAE,cAAc,CAAC,CAAC,CAAC;uDAK/C,OAAO,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;qBA5B/B,WAAW"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {import("./TypeCheckedModule.js").TypeCheckedModule} TypeCheckedModule
|
|
3
|
+
* @typedef {import("./TypeCheckedModule.js").TypeCheckedUserFunc} TypeCheckedUserFunc
|
|
3
4
|
* @typedef {import("./TypeCheckedValidator.js").TypeCheckedValidator} TypeCheckedValidator
|
|
4
5
|
* @typedef {import("./TypeSchema.js").TypeSchema} TypeSchema
|
|
5
6
|
*/
|
|
@@ -55,10 +56,13 @@ export class LoadedScriptsWriter {
|
|
|
55
56
|
*/
|
|
56
57
|
private writeHeaders;
|
|
57
58
|
/**
|
|
58
|
-
*
|
|
59
59
|
* @param {Record<string, TypeSchema>} types
|
|
60
60
|
*/
|
|
61
61
|
writeTypes(types: Record<string, TypeSchema>): void;
|
|
62
|
+
/**
|
|
63
|
+
* @param {Record<string, TypeCheckedUserFunc>} functions
|
|
64
|
+
*/
|
|
65
|
+
writeFunctions(functions: Record<string, TypeCheckedUserFunc>): void;
|
|
62
66
|
/**
|
|
63
67
|
* @private
|
|
64
68
|
* @param {TypeCheckedModule} m
|
|
@@ -71,6 +75,7 @@ export class LoadedScriptsWriter {
|
|
|
71
75
|
private writeValidator;
|
|
72
76
|
}
|
|
73
77
|
export type TypeCheckedModule = import("./TypeCheckedModule.js").TypeCheckedModule;
|
|
78
|
+
export type TypeCheckedUserFunc = import("./TypeCheckedModule.js").TypeCheckedUserFunc;
|
|
74
79
|
export type TypeCheckedValidator = import("./TypeCheckedValidator.js").TypeCheckedValidator;
|
|
75
80
|
export type TypeSchema = import("./TypeSchema.js").TypeSchema;
|
|
76
81
|
import { StringWriter } from "@helios-lang/codec-utils";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadedScriptsWriter.d.ts","sourceRoot":"","sources":["../../src/codegen/LoadedScriptsWriter.js"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"LoadedScriptsWriter.d.ts","sourceRoot":"","sources":["../../src/codegen/LoadedScriptsWriter.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH;IAUI;;;OAGG;IACH,gBAFa,mBAAmB,CAQ/B;IAfG,yBAAoC;IACpC,0BAAqC;IACrC,uBAAkC;IAetC;;;OAGG;IACH;;QAFa,mBAAmB,CAgC/B;IAED;;;OAGG;IACH;;QAFa,mBAAmB,CAkC/B;IAED;;OAEG;IACH,YAFa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAQpC;IAED;;;;;OAKG;IACH,cAKC;IAED;;;;;OAKG;IACH,sBALW,MAAM,YACN,MAAM,eACN,MAAM,EAAE,GACN,mBAAmB,CAmB/B;IAED;;;;OAIG;IACH,kBAJW,MAAM,kBACN,MAAM,EAAE,GACN,mBAAmB,CAQ/B;IAED;;OAEG;IACH,qBA6BC;IAED;;OAEG;IACH,kBAFW,OAAO,MAAM,EAAE,UAAU,CAAC,QAyBpC;IAED;;OAEG;IACH,0BAFW,OAAO,MAAM,EAAE,mBAAmB,CAAC,QAuB7C;IAED;;;OAGG;IACH,oBA4BC;IAED;;;OAGG;IACH,uBAmDC;CACJ;gCAtVY,OAAO,wBAAwB,EAAE,iBAAiB;kCAClD,OAAO,wBAAwB,EAAE,mBAAmB;mCACpD,OAAO,2BAA2B,EAAE,oBAAoB;yBACxD,OAAO,iBAAiB,EAAE,UAAU;6BAPpB,0BAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadedValidator.d.ts","sourceRoot":"","sources":["../../src/codegen/LoadedValidator.js"],"names":[],"mappings":"6CAKa,OAAO,iBAAiB,EAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;2BAIxD,OAAO,mBAAmB,EAAE,YAAY;;WAKzC,MAAM;iBACA,MAAM;mBACJ,cAAc,YAAY,CAAC;uBACvB,cAAc,eAAe,CAAC;uBAC9B,OAAO;;;;eAEf,SAAS,GAAG,EAAE,GAAG,CAAC;;cAGjB,UAAU;
|
|
1
|
+
{"version":3,"file":"LoadedValidator.d.ts","sourceRoot":"","sources":["../../src/codegen/LoadedValidator.js"],"names":[],"mappings":"6CAKa,OAAO,iBAAiB,EAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;2BAIxD,OAAO,mBAAmB,EAAE,YAAY;;WAKzC,MAAM;iBACA,MAAM;mBACJ,cAAc,YAAY,CAAC;uBACvB,cAAc,eAAe,CAAC;uBAC9B,OAAO;;;;eAEf,SAAS,GAAG,EAAE,GAAG,CAAC;;cAGjB,UAAU,GAAG,OAAO;YACtB,SAAS,GAAG,EAAE,GAAG,CAAC;;cAEhB,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS;;;WAM7C,MAAM;;;;;WAOQ,MAAM;;;;6DAM7B,0BAA0B,CAAC,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
export type TypeSchema = import("./TypeSchema.js").TypeSchema;
|
|
2
|
+
export type TypeCheckedUserFunc = {
|
|
3
|
+
requiresScriptContext: boolean;
|
|
4
|
+
requiresCurrentScript: boolean;
|
|
5
|
+
arguments: {
|
|
6
|
+
name: string;
|
|
7
|
+
type: TypeSchema;
|
|
8
|
+
}[];
|
|
9
|
+
returns: TypeSchema;
|
|
10
|
+
};
|
|
2
11
|
export type TypeCheckedModule = {
|
|
3
12
|
name: string;
|
|
4
13
|
purpose: string;
|
|
5
14
|
sourceCode: string;
|
|
6
15
|
moduleDepedencies: string[];
|
|
7
|
-
types:
|
|
8
|
-
|
|
9
|
-
};
|
|
16
|
+
types: Record<string, TypeSchema>;
|
|
17
|
+
functions?: Record<string, TypeCheckedUserFunc>;
|
|
10
18
|
};
|
|
11
19
|
//# sourceMappingURL=TypeCheckedModule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeCheckedModule.d.ts","sourceRoot":"","sources":["../../src/codegen/TypeCheckedModule.js"],"names":[],"mappings":"yBAGa,OAAO,iBAAiB,EAAE,UAAU
|
|
1
|
+
{"version":3,"file":"TypeCheckedModule.d.ts","sourceRoot":"","sources":["../../src/codegen/TypeCheckedModule.js"],"names":[],"mappings":"yBAGa,OAAO,iBAAiB,EAAE,UAAU;kCAIpC;IACZ,qBAAyB,EAAE,OAAO,CAAA;IAClC,qBAAyB,EAAE,OAAO,CAAA;IAClC,SAAa,EAAE;QACf,MAAY,MAAM,CAAA;QAClB,IAAU,EAAE,UAAU,CAAA;KACjB,EAAE,CAAA;IACP,OAAW,EAAE,UAAU,CAAA;CACpB;gCAIS;IACZ,MAAU,MAAM,CAAA;IAChB,OAAW,EAAE,MAAM,CAAA;IACnB,UAAc,EAAE,MAAM,CAAA;IACtB,iBAAqB,EAAE,MAAM,EAAE,CAAA;IAC/B,KAAS,EAAE,OAAO,MAAM,EAAE,UAAU,CAAC,CAAA;IACrC,SAAa,CAAC,EAAE,OAAO,MAAM,EAAE,mBAAmB,CAAC,CAAA;CAChD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSchema.d.ts","sourceRoot":"","sources":["../../src/codegen/TypeSchema.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,iCAHW,UAAU,GACR,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"TypeSchema.d.ts","sourceRoot":"","sources":["../../src/codegen/TypeSchema.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,iCAHW,UAAU,GACR,CAAC,MAAM,EAAE,MAAM,CAAC,CAoJ5B;yBA1JY,OAAO,yBAAyB,EAAE,UAAU"}
|
|
@@ -6,7 +6,7 @@ export type StakingContext<TRedeemerStrict, TRedeemerPermissive> = import("@heli
|
|
|
6
6
|
export type CastLike<TStrict, TPermissive> = import("../cast/index.js").CastLike<TStrict, TPermissive>;
|
|
7
7
|
export type PermissiveType<C extends CastLike<any, any>> = import("../cast/index.js").PermissiveType<C>;
|
|
8
8
|
export type StrictType<C extends CastLike<any, any>> = import("../cast/index.js").StrictType<C>;
|
|
9
|
-
export type AnyContractValidatorContext = (ValidatorHash<SpendingContext<any, any, any, any>> | MintingPolicyHash<MintingContext<any, any>> | StakingValidatorHash<StakingContext<any, any>>);
|
|
9
|
+
export type AnyContractValidatorContext = (ValidatorHash<SpendingContext<any, any, any, any>> | MintingPolicyHash<MintingContext<any, any>> | StakingValidatorHash<StakingContext<any, any>> | ScriptHash);
|
|
10
10
|
export type ContractValidatorContexts<V extends import("../codegen/LoadedValidator.js").LoadedValidator> = V extends {
|
|
11
11
|
"$purpose": "spending";
|
|
12
12
|
"$Datum": CastLike<any, any>;
|
|
@@ -36,5 +36,6 @@ export type ContractContext<Vs extends {
|
|
|
36
36
|
import { ValidatorHash } from "@helios-lang/ledger";
|
|
37
37
|
import { MintingPolicyHash } from "@helios-lang/ledger";
|
|
38
38
|
import { StakingValidatorHash } from "@helios-lang/ledger";
|
|
39
|
+
import { ScriptHash } from "@helios-lang/ledger";
|
|
39
40
|
import { Cast } from "../cast/index.js";
|
|
40
41
|
//# sourceMappingURL=ContractContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractContext.d.ts","sourceRoot":"","sources":["../../src/context/ContractContext.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContractContext.d.ts","sourceRoot":"","sources":["../../src/context/ContractContext.js"],"names":[],"mappings":"2BASa,OAAO,qBAAqB,EAAE,YAAY;8BAC1C,OAAO,qBAAqB,EAAE,eAAe;mEAM7C,OAAO,qBAAqB,EAAE,cAAc,CAAC,eAAe,EAAE,mBAAmB,CAAC;oGAQlF,OAAO,qBAAqB,EAAE,eAAe,CAAC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,CAAC;mEAMnH,OAAO,qBAAqB,EAAE,cAAc,CAAC,eAAe,EAAE,mBAAmB,CAAC;6CAMlF,OAAO,kBAAkB,EAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;2DAKzD,OAAO,kBAAkB,EAAE,cAAc,CAAC,CAAC,CAAC;uDAK5C,OAAO,kBAAkB,EAAE,UAAU,CAAC,CAAC,CAAC;0CAIxC,CACZ,cAAkB,gBAAgB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,GACtD,kBAAsB,eAAe,GAAG,EAAE,GAAG,CAAC,CAAC,GAC/C,qBAAyB,eAAe,GAAG,EAAE,GAAG,CAAC,CAAC,GAClD,UAAc,CACX;2GAKS,CAAC,SAAS;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,SAAS,GAAG,EAAE,GAAG,CAAC,CAAC;IAAC,WAAW,EAAE,SAAS,GAAG,EAAE,GAAG,CAAC,CAAA;CAAC,GAAG;IAChH,KAAa,EAAE,cACf,gBACA,WAAuB,CAAC,CAAC,QAAQ,CAAC,CAAC,EACnC,eAA2B,CAAC,CAAC,QAAQ,CAAC,CAAC,EACvC,WAAuB,CAAC,CAAC,WAAW,CAAC,CAAC,EACtC,eAA2B,CAAC,CAAC,WAAW,CAAC,CAAC,CAC/B,CACF,CAAA;CACF,GAAG,qBAAqB,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC3C,CAAO,SAAS;IAAC,UAAU,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,SAAS,GAAG,EAAE,GAAG,CAAC,CAAA;CAAC,GAAG;IAC3E,KAAa,EAAE,kBACf,eACA,WAAuB,CAAC,CAAC,WAAW,CAAC,CAAC,EACtC,eAA2B,CAAC,CAAC,WAAW,CAAC,CAAC,CAC/B,CACF,CAAA;CACF,GAAG,qBAAqB,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC3C,CAAO,SAAS;IAAC,UAAU,EAAE,CAAC,YAAY,GAAG,WAAW,GAAG,SAAS,CAAC,CAAC;IAAC,WAAW,EAAE,SAAS,GAAG,EAAE,GAAG,CAAC,CAAA;CAAC,GAAG;IAC1G,KAAa,EAAE,qBACf,eACA,WAAuB,CAAC,CAAC,WAAW,CAAC,CAAC,EACtC,eAA2B,CAAC,CAAC,WAAW,CAAC,CAAC,CAC/B,CACF,CAAA;CACF,GAAG,qBAAqB,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC3C,KAAW;kGAMC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,CAAC;;;;;;;;;8BAvFvC,qBAAqB;kCAArB,qBAAqB;qCAArB,qBAAqB;2BAArB,qBAAqB;qBACP,kBAAkB"}
|
|
@@ -8,7 +8,7 @@ export type CacheEntry = {
|
|
|
8
8
|
};
|
|
9
9
|
export type CacheEntryJson = {
|
|
10
10
|
[name: string]: {
|
|
11
|
-
purpose: "minting" | "spending" | "staking";
|
|
11
|
+
purpose: "minting" | "spending" | "staking" | "mixed";
|
|
12
12
|
bytes: number[];
|
|
13
13
|
unoptimizedCborHex?: string | undefined;
|
|
14
14
|
optimizedCborHex: string;
|
|
@@ -29,7 +29,7 @@ export type CacheEntryJson = {
|
|
|
29
29
|
*/
|
|
30
30
|
/**
|
|
31
31
|
* @typedef {{[name: string]: {
|
|
32
|
-
* purpose: "minting" | "spending" | "staking"
|
|
32
|
+
* purpose: "minting" | "spending" | "staking" | "mixed"
|
|
33
33
|
* bytes: number[]
|
|
34
34
|
* unoptimizedCborHex?: string
|
|
35
35
|
* optimizedCborHex: string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractContextCache.d.ts","sourceRoot":"","sources":["../../src/context/ContractContextCache.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContractContextCache.d.ts","sourceRoot":"","sources":["../../src/context/ContractContextCache.js"],"names":[],"mappings":"AAmOA,wDAA8D;4BAtNjD,OAAO,mBAAmB,EAAE,aAAa;yBACzC,OAAO,kBAAkB,EAAE,UAAU;yBACrC,OAAO,qBAAqB,EAAE,UAAU;0CACxC,OAAO,sBAAsB,EAAE,2BAA2B;;;;;;iBASzD,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO;eAC9C,MAAM,EAAE;;0BAEG,MAAM;uBACT,aAAa;oBAChB,UAAU;;kBAEZ,UAAU;;;AApBzB;;;;;GAKG;AAEH;;GAEG;AAEH;;;;;;;;;;;GAWG;AAEH;IACI;;OAEG;IACH,OAFU,UAAU,EAAE,CAEjB;IAEL;;;OAGG;IACH,GAFU,MAAM,CAEf;IAED;;OAEG;IACH,SAFU,OAAO,CAEV;IAQP,eAEC;IAED;;OAEG;IACH,WAFW,cAAc,EAAE,QAkE1B;IAED;;OAEG;IACH,aAFW,UAAU,QAMpB;IAED;;OAEG;IACH,SAFa,OAAO,UAAU,CAAC,CAY9B;IAED;;OAEG;IACH,UAFY,cAAc,EAAE,CAmE3B;CACJ"}
|