@harmoniclabs/pebble 0.1.10 → 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 (182) hide show
  1. package/dist/IR/CompilationCtx.d.ts +40 -0
  2. package/dist/IR/CompilationCtx.js +54 -0
  3. package/dist/IR/IRHash.d.ts +23 -2
  4. package/dist/IR/IRHash.js +10 -60
  5. package/dist/IR/IRNodes/IRConst.js +35 -4
  6. package/dist/IR/IRNodes/IRHoisted.d.ts +0 -1
  7. package/dist/IR/IRNodes/IRHoisted.js +4 -6
  8. package/dist/IR/IRNodes/IRLetted.d.ts +0 -1
  9. package/dist/IR/IRNodes/IRLetted.js +4 -6
  10. package/dist/IR/IRNodes/IRNative/IRNativeTag.d.ts +22 -2
  11. package/dist/IR/IRNodes/IRNative/IRNativeTag.js +26 -2
  12. package/dist/IR/IRNodes/IRNative/index.d.ts +16 -1
  13. package/dist/IR/IRNodes/IRNative/index.js +31 -2
  14. package/dist/IR/IRNodes/utils/hashVarSym.d.ts +0 -1
  15. package/dist/IR/IRNodes/utils/hashVarSym.js +27 -33
  16. package/dist/IR/toUPLC/CompilerOptions.d.ts +34 -7
  17. package/dist/IR/toUPLC/CompilerOptions.js +19 -10
  18. package/dist/IR/toUPLC/compileIRToUPLC.js +39 -3
  19. package/dist/IR/toUPLC/subRoutines/inlineSingleUseLetBindingsAndReturnRoot.d.ts +23 -0
  20. package/dist/IR/toUPLC/subRoutines/inlineSingleUseLetBindingsAndReturnRoot.js +263 -0
  21. package/dist/IR/toUPLC/subRoutines/introduceCaseForDualHeadTailAndReturnRoot.d.ts +35 -0
  22. package/dist/IR/toUPLC/subRoutines/introduceCaseForDualHeadTailAndReturnRoot.js +169 -0
  23. package/dist/IR/toUPLC/subRoutines/replaceHoistedWithLetted.d.ts +0 -1
  24. package/dist/IR/toUPLC/subRoutines/replaceHoistedWithLetted.js +6 -6
  25. package/dist/IR/toUPLC/subRoutines/replaceNatives/nativeToIR.d.ts +2 -3
  26. package/dist/IR/toUPLC/subRoutines/replaceNatives/nativeToIR.js +106 -65
  27. package/dist/IR/toUPLC/subRoutines/rewriteHeadTailInCaseConsAndReturnRoot.d.ts +30 -0
  28. package/dist/IR/toUPLC/subRoutines/rewriteHeadTailInCaseConsAndReturnRoot.js +95 -0
  29. package/dist/IR/toUPLC/subRoutines/rewriteNativesAppliedToConstantsAndReturnRoot.js +36 -5
  30. package/dist/IR/toUPLC/subRoutines/rewriteToCaseOverConstAndReturnRoot.d.ts +35 -0
  31. package/dist/IR/toUPLC/subRoutines/rewriteToCaseOverConstAndReturnRoot.js +169 -0
  32. package/dist/IR/tree_utils/_ir_caseList.d.ts +15 -0
  33. package/dist/IR/tree_utils/_ir_caseList.js +19 -0
  34. package/dist/IR/tree_utils/bytesToHex.d.ts +8 -0
  35. package/dist/IR/tree_utils/bytesToHex.js +69 -0
  36. package/dist/ast/nodes/expr/functions/FuncExpr.d.ts +16 -2
  37. package/dist/ast/nodes/expr/functions/FuncExpr.js +17 -0
  38. package/dist/ast/nodes/expr/litteral/LitteralExpr.d.ts +2 -1
  39. package/dist/ast/nodes/expr/litteral/LitteralExpr.js +2 -0
  40. package/dist/ast/nodes/expr/litteral/TemplateStrExpr.d.ts +30 -0
  41. package/dist/ast/nodes/expr/litteral/TemplateStrExpr.js +35 -0
  42. package/dist/ast/nodes/statements/ExportStmt.d.ts +3 -3
  43. package/dist/ast/nodes/statements/PebbleStmt.d.ts +4 -3
  44. package/dist/ast/nodes/statements/PebbleStmt.js +6 -2
  45. package/dist/ast/nodes/statements/TestParam.d.ts +18 -0
  46. package/dist/ast/nodes/statements/TestParam.js +18 -0
  47. package/dist/ast/nodes/statements/TestStmt.d.ts +5 -3
  48. package/dist/ast/nodes/statements/TestStmt.js +3 -1
  49. package/dist/ast/nodes/statements/UsingStmt.d.ts +32 -2
  50. package/dist/ast/nodes/statements/UsingStmt.js +39 -3
  51. package/dist/ast/nodes/statements/declarations/NamespaceDecl.d.ts +21 -0
  52. package/dist/ast/nodes/statements/declarations/NamespaceDecl.js +31 -0
  53. package/dist/ast/nodes/statements/declarations/StructDecl.d.ts +16 -2
  54. package/dist/ast/nodes/statements/declarations/StructDecl.js +15 -1
  55. package/dist/compiler/AstCompiler/AstCompiler.d.ts +27 -0
  56. package/dist/compiler/AstCompiler/AstCompiler.js +244 -7
  57. package/dist/compiler/AstCompiler/internal/_deriveContractBody/_deriveContractBody.js +16 -5
  58. package/dist/compiler/AstCompiler/internal/exprs/_compileCallExpr.js +97 -6
  59. package/dist/compiler/AstCompiler/internal/exprs/_compileCaseExpr.js +31 -0
  60. package/dist/compiler/AstCompiler/internal/exprs/_compileFuncExpr.js +12 -5
  61. package/dist/compiler/AstCompiler/internal/exprs/_compileIsExpr.js +12 -0
  62. package/dist/compiler/AstCompiler/internal/exprs/_compileLitteralExpr.js +59 -0
  63. package/dist/compiler/AstCompiler/internal/exprs/_compilePropAccessExpr.d.ts +2 -3
  64. package/dist/compiler/AstCompiler/internal/exprs/_compilePropAccessExpr.js +64 -0
  65. package/dist/compiler/AstCompiler/internal/exprs/_compileUnaryPrefixExpr.js +13 -1
  66. package/dist/compiler/AstCompiler/internal/exprs/_compileVarAccessExpr.js +2 -0
  67. package/dist/compiler/AstCompiler/internal/exprs/binary/_compileAddExpr.js +18 -5
  68. package/dist/compiler/AstCompiler/internal/exprs/binary/_compileEqualExpr.js +3 -1
  69. package/dist/compiler/AstCompiler/internal/exprs/binary/_compileGreaterThanEqualExpr.js +2 -1
  70. package/dist/compiler/AstCompiler/internal/exprs/binary/_compileGreaterThanExpr.js +2 -1
  71. package/dist/compiler/AstCompiler/internal/exprs/binary/_compileLessThanEqualExpr.js +2 -1
  72. package/dist/compiler/AstCompiler/internal/exprs/binary/_compileLessThanExpr.js +2 -1
  73. package/dist/compiler/AstCompiler/internal/exprs/binary/_compileMultExpr.js +24 -6
  74. package/dist/compiler/AstCompiler/internal/exprs/binary/_compileNotEqualExpr.js +2 -1
  75. package/dist/compiler/AstCompiler/internal/exprs/binary/_compileSubExpr.js +16 -5
  76. package/dist/compiler/AstCompiler/internal/statements/_compileMatchStmt.js +33 -20
  77. package/dist/compiler/AstCompiler/internal/statements/_compileStatement.js +4 -1
  78. package/dist/compiler/AstCompiler/internal/statements/_compileTestStmt.d.ts +15 -1
  79. package/dist/compiler/AstCompiler/internal/statements/_compileTestStmt.js +70 -30
  80. package/dist/compiler/AstCompiler/internal/statements/_compileUsingAliasStmt.d.ts +11 -0
  81. package/dist/compiler/AstCompiler/internal/statements/_compileUsingAliasStmt.js +26 -0
  82. package/dist/compiler/AstCompiler/internal/statements/_compileUsingStmt.d.ts +9 -4
  83. package/dist/compiler/AstCompiler/internal/statements/_compileUsingStmt.js +51 -10
  84. package/dist/compiler/AstCompiler/internal/types/_compileDataEncodedConcreteType.js +21 -2
  85. package/dist/compiler/AstCompiler/internal/types/_compileSopEncodedConcreteType.js +17 -2
  86. package/dist/compiler/AstCompiler/scope/AstScope.d.ts +70 -1
  87. package/dist/compiler/AstCompiler/scope/AstScope.js +91 -0
  88. package/dist/compiler/AstCompiler/utils/getPropAccessReturnType.js +36 -1
  89. package/dist/compiler/AstCompiler/utils/monomorphizeGeneric.d.ts +36 -0
  90. package/dist/compiler/AstCompiler/utils/monomorphizeGeneric.js +123 -0
  91. package/dist/compiler/AstCompiler/utils/resolveNamespaceChain.d.ts +28 -0
  92. package/dist/compiler/AstCompiler/utils/resolveNamespaceChain.js +95 -0
  93. package/dist/compiler/AstCompiler/utils/resolveNamespacePath.d.ts +37 -0
  94. package/dist/compiler/AstCompiler/utils/resolveNamespacePath.js +93 -0
  95. package/dist/compiler/Compiler.d.ts +9 -1
  96. package/dist/compiler/Compiler.js +218 -30
  97. package/dist/compiler/TirCompiler/expressify/ExpressifyCtx.js +1 -1
  98. package/dist/compiler/TirCompiler/expressify/expressify.js +30 -2
  99. package/dist/compiler/TirCompiler/expressify/expressifyForStmt.d.ts +2 -1
  100. package/dist/compiler/TirCompiler/expressify/expressifyForStmt.js +45 -7
  101. package/dist/compiler/TirCompiler/expressify/expressifyVars.d.ts +0 -1
  102. package/dist/compiler/TirCompiler/expressify/expressifyVars.js +49 -15
  103. package/dist/compiler/test/TestResult.d.ts +38 -0
  104. package/dist/compiler/test/TestResult.js +6 -0
  105. package/dist/compiler/test/fuzz/PRNG.d.ts +26 -0
  106. package/dist/compiler/test/fuzz/PRNG.js +59 -0
  107. package/dist/compiler/tir/expressions/TirCaseExpr.d.ts +9 -0
  108. package/dist/compiler/tir/expressions/TirCaseExpr.js +144 -122
  109. package/dist/compiler/tir/expressions/TirElemAccessExpr.js +2 -2
  110. package/dist/compiler/tir/expressions/TirExpr.d.ts +2 -1
  111. package/dist/compiler/tir/expressions/TirExpr.js +2 -0
  112. package/dist/compiler/tir/expressions/TirFromDataExpr.js +102 -67
  113. package/dist/compiler/tir/expressions/TirIsExpr.js +14 -1
  114. package/dist/compiler/tir/expressions/TirNativeFunc.d.ts +18 -2
  115. package/dist/compiler/tir/expressions/TirNativeFunc.js +55 -118
  116. package/dist/compiler/tir/expressions/TirShowExpr.d.ts +52 -0
  117. package/dist/compiler/tir/expressions/TirShowExpr.js +199 -0
  118. package/dist/compiler/tir/expressions/TirToDataExpr.js +3 -0
  119. package/dist/compiler/tir/expressions/TirTraceExpr.js +11 -7
  120. package/dist/compiler/tir/expressions/TirTypeConversionExpr.js +10 -0
  121. package/dist/compiler/tir/expressions/TirVariableAccessExpr.d.ts +2 -3
  122. package/dist/compiler/tir/expressions/TirVariableAccessExpr.js +1 -4
  123. package/dist/compiler/tir/expressions/ToIRTermCtx.d.ts +20 -3
  124. package/dist/compiler/tir/expressions/ToIRTermCtx.js +48 -3
  125. package/dist/compiler/tir/expressions/binary/TirBinaryExpr.d.ts +2 -2
  126. package/dist/compiler/tir/expressions/binary/TirBinaryExpr.js +45 -8
  127. package/dist/compiler/tir/expressions/litteral/TirLitEnumMemberExpr.d.ts +19 -0
  128. package/dist/compiler/tir/expressions/litteral/TirLitEnumMemberExpr.js +24 -0
  129. package/dist/compiler/tir/expressions/litteral/TirLitteralExpr.d.ts +2 -1
  130. package/dist/compiler/tir/expressions/litteral/TirLitteralExpr.js +2 -0
  131. package/dist/compiler/tir/expressions/unary/TirUnaryMinus.js +4 -1
  132. package/dist/compiler/tir/program/TypedProgram.d.ts +101 -0
  133. package/dist/compiler/tir/program/TypedProgram.js +43 -0
  134. package/dist/compiler/tir/program/stdScope/populateBuiltinInterfaces.d.ts +17 -0
  135. package/dist/compiler/tir/program/stdScope/populateBuiltinInterfaces.js +70 -0
  136. package/dist/compiler/tir/program/stdScope/populateStdNamespace.d.ts +22 -0
  137. package/dist/compiler/tir/program/stdScope/populateStdNamespace.js +619 -0
  138. package/dist/compiler/tir/program/stdScope/prelude/preludeTypesSrc.js +35 -2
  139. package/dist/compiler/tir/program/stdScope/stdScope.d.ts +8 -0
  140. package/dist/compiler/tir/program/stdScope/stdScope.js +84 -41
  141. package/dist/compiler/tir/statements/TirStmt.js +0 -1
  142. package/dist/compiler/tir/statements/TirTestStmt.d.ts +46 -0
  143. package/dist/compiler/tir/statements/TirTestStmt.js +35 -0
  144. package/dist/compiler/tir/types/TirEnumType.d.ts +21 -0
  145. package/dist/compiler/tir/types/TirEnumType.js +36 -0
  146. package/dist/compiler/tir/types/TirNativeType/TirNativeType.d.ts +53 -2
  147. package/dist/compiler/tir/types/TirNativeType/TirNativeType.js +58 -1
  148. package/dist/compiler/tir/types/TirNativeType/native/array.d.ts +16 -0
  149. package/dist/compiler/tir/types/TirNativeType/native/array.js +38 -0
  150. package/dist/compiler/tir/types/TirNativeType/native/index.d.ts +2 -0
  151. package/dist/compiler/tir/types/TirNativeType/native/index.js +2 -0
  152. package/dist/compiler/tir/types/TirNativeType/native/value.d.ts +18 -0
  153. package/dist/compiler/tir/types/TirNativeType/native/value.js +17 -0
  154. package/dist/compiler/tir/types/TirStructType.js +6 -1
  155. package/dist/compiler/tir/types/TirType.d.ts +3 -2
  156. package/dist/compiler/tir/types/TirType.js +7 -2
  157. package/dist/compiler/tir/types/utils/canAssignTo.js +36 -1
  158. package/dist/compiler/tir/types/utils/canCastTo.js +14 -1
  159. package/dist/compiler/tir/types/utils/getDeconstructableType.d.ts +2 -1
  160. package/dist/compiler/tir/types/utils/getDeconstructableType.js +2 -0
  161. package/dist/compiler/tir/types/utils/inferTypeArgs.d.ts +19 -0
  162. package/dist/compiler/tir/types/utils/inferTypeArgs.js +83 -0
  163. package/dist/compiler/tir/types/utils/normalizeEnumToInt.d.ts +10 -0
  164. package/dist/compiler/tir/types/utils/normalizeEnumToInt.js +17 -0
  165. package/dist/compiler/tir/types/utils/substituteTypeParams.d.ts +9 -0
  166. package/dist/compiler/tir/types/utils/substituteTypeParams.js +67 -0
  167. package/dist/diagnostics/diagnosticMessages.generated.d.ts +10 -0
  168. package/dist/diagnostics/diagnosticMessages.generated.js +20 -0
  169. package/dist/index.d.ts +2 -0
  170. package/dist/index.js +2 -0
  171. package/dist/parser/Parser.d.ts +73 -3
  172. package/dist/parser/Parser.js +362 -46
  173. package/dist/tokenizer/Token.d.ts +106 -102
  174. package/dist/tokenizer/Token.js +111 -109
  175. package/dist/tokenizer/utils/tokenFromKeyword.js +11 -6
  176. package/dist/utils/semverSatisfies.d.ts +1 -0
  177. package/dist/utils/semverSatisfies.js +161 -0
  178. package/dist/version.generated.d.ts +1 -0
  179. package/dist/version.generated.js +2 -0
  180. package/package.json +5 -4
  181. package/dist/IR/tree_utils/_ir_lazyChooseList.d.ts +0 -3
  182. package/dist/IR/tree_utils/_ir_lazyChooseList.js +0 -7
@@ -152,9 +152,9 @@ export struct Address {
152
152
  stake: Optional<Credential>
153
153
  }
154
154
 
155
- export type Value = LinearMap<PolicyId, LinearMap<TokenName, int>>
155
+ export type ValueMap = LinearMap<PolicyId, LinearMap<TokenName, int>>
156
156
 
157
- type Value implements {
157
+ type ValueMap implements {
158
158
  amountOf( policy: PolicyId, name: bytes ): int
159
159
  {
160
160
  // todo
@@ -166,6 +166,39 @@ type Value implements {
166
166
  }
167
167
  }
168
168
 
169
+ // `Value` is a native built-in value (ConstTyTag.value).
170
+ // It is reached from `data` via `unValueData`; the ledger always passes data.
171
+ type Value implements {
172
+ amountOf( policy: PolicyId, name: bytes ): int
173
+ {
174
+ return native.lookupCoin( policy, name, this );
175
+ }
176
+ lovelaces(): int
177
+ {
178
+ return this.amountOf( #, # );
179
+ }
180
+ insert( policy: PolicyId, name: bytes, amount: int ): Value
181
+ {
182
+ return native.insertCoin( policy, name, amount, this );
183
+ }
184
+ union( other: Value ): Value
185
+ {
186
+ return native.unionValue( this, other );
187
+ }
188
+ contains( other: Value ): bool
189
+ {
190
+ return native.valueContains( this, other );
191
+ }
192
+ scale( factor: int ): Value
193
+ {
194
+ return native.scaleValue( factor, this );
195
+ }
196
+ toData(): data
197
+ {
198
+ return native.valueData( this );
199
+ }
200
+ }
201
+
169
202
  export struct OutputDatum {
170
203
  NoDatum {}
171
204
  DatumHash { hash: Hash32 }
@@ -11,7 +11,15 @@ export declare const string_t: TirStringT;
11
11
  export declare const bytes_t: TirBytesT;
12
12
  export declare const bool_t: TirBoolT;
13
13
  export declare const data_t: TirDataT;
14
+ export declare const valueMapLovelacesName: string;
15
+ export declare const valueMapAmountOfName: string;
14
16
  export declare const valueLovelacesName: string;
15
17
  export declare const valueAmountOfName: string;
18
+ export declare const valueInsertCoinName: string;
19
+ export declare const valueUnionName: string;
20
+ export declare const valueContainsName: string;
21
+ export declare const valueScaleName: string;
22
+ export declare const valueToDataName: string;
23
+ export declare const getCredentialHashFuncName: string;
16
24
  export declare function populateStdScope(program: TypedProgram): void;
17
25
  export declare function populatePreludeScope(program: TypedProgram): void;
@@ -6,6 +6,8 @@ import { TirDataT } from "../../types/TirNativeType/native/data.js";
6
6
  import { TirIntT } from "../../types/TirNativeType/native/int.js";
7
7
  import { TirLinearMapT } from "../../types/TirNativeType/native/linearMap.js";
8
8
  import { TirListT } from "../../types/TirNativeType/native/list.js";
9
+ import { TirArrayT } from "../../types/TirNativeType/native/array.js";
10
+ import { TirValueT } from "../../types/TirNativeType/native/value.js";
9
11
  import { TirDataOptT } from "../../types/TirNativeType/native/Optional/data.js";
10
12
  import { TirSopOptT } from "../../types/TirNativeType/native/Optional/sop.js";
11
13
  import { TirStringT } from "../../types/TirNativeType/native/string.js";
@@ -18,14 +20,24 @@ import { IRNative } from "../../../../IR/IRNodes/IRNative/index.js";
18
20
  import { IRFunc } from "../../../../IR/IRNodes/IRFunc.js";
19
21
  import { IRVar } from "../../../../IR/IRNodes/IRVar.js";
20
22
  import { _ir_apps } from "../../../../IR/IRNodes/IRApp.js";
23
+ import { IRConst } from "../../../../IR/IRNodes/IRConst.js";
21
24
  export const void_t = new TirVoidT();
22
25
  export const int_t = new TirIntT();
23
26
  export const string_t = new TirStringT();
24
27
  export const bytes_t = new TirBytesT();
25
28
  export const bool_t = new TirBoolT();
26
29
  export const data_t = new TirDataT();
27
- export const valueLovelacesName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "sortedValueLovelaces";
28
- export const valueAmountOfName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "amountOfValue";
30
+ export const valueMapLovelacesName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "sortedValueLovelaces";
31
+ export const valueMapAmountOfName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "amountOfValue";
32
+ // Native Value (ConstTyTag.value); methods route to the value builtins.
33
+ export const valueLovelacesName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "valueLovelaces";
34
+ export const valueAmountOfName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "valueAmountOf";
35
+ export const valueInsertCoinName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "valueInsertCoin";
36
+ export const valueUnionName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "valueUnion";
37
+ export const valueContainsName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "valueContains";
38
+ export const valueScaleName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "valueScale";
39
+ export const valueToDataName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "valueToData";
40
+ export const getCredentialHashFuncName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "getCredentialHash";
29
41
  export function populateStdScope(program) {
30
42
  const stdScope = program.stdScope;
31
43
  function _defineStdUnambigous(t) {
@@ -39,6 +51,24 @@ export function populateStdScope(program) {
39
51
  _defineStdUnambigous(bytes_t);
40
52
  _defineStdUnambigous(string_t);
41
53
  _defineStdUnambigous(data_t);
54
+ // Register native Value (ConstTyTag.value) in program.types so the prelude
55
+ // alias can wrap it. The user-facing `Value` name is defined in the
56
+ // prelude scope (with methods routed to the value builtins).
57
+ {
58
+ const value_native_t = new TirValueT();
59
+ program.types.set(value_native_t.toTirTypeKey(), value_native_t);
60
+ }
61
+ const array_name = TirArrayT.toTirTypeKey();
62
+ program.defineGenericType(array_name, 1, ([arg]) => new TirArrayT(arg));
63
+ stdScope.defineType(array_name, {
64
+ sopTirName: array_name,
65
+ dataTirName: array_name,
66
+ allTirNames: new Set([
67
+ array_name
68
+ ]),
69
+ methodsNames: new Map(),
70
+ isGeneric: true
71
+ });
42
72
  const opt_data_name = TirDataOptT.toTirTypeKey();
43
73
  program.defineGenericType(opt_data_name, 1, ([arg]) => new TirDataOptT(arg));
44
74
  const opt_sop_name = TirSopOptT.toTirTypeKey();
@@ -171,7 +201,6 @@ export function populatePreludeScope(program) {
171
201
  id: txHash_t,
172
202
  index: int_t
173
203
  }, onlyData);
174
- const getCredentialHashFuncName = PEBBLE_INTERNAL_IDENTIFIER_PREFIX + "getCredentialHash";
175
204
  const { data: credential_t } = defineMultiConstructorStruct("Credential", {
176
205
  PubKey: {
177
206
  hash: pubKeyHash_t
@@ -542,29 +571,29 @@ export function populatePreludeScope(program) {
542
571
  payment: credential_t,
543
572
  stake: opt_stakeCredential_t
544
573
  }, onlyData);
545
- // type Value = LinearMap<PolicyId, LinearMap<TokenName, int>>
574
+ // type ValueMap = LinearMap<PolicyId, LinearMap<TokenName, int>>
546
575
  const map_tokenName_int_t = program.getAppliedGeneric(TirLinearMapT.toTirTypeKey(), [tokenName_t, int_t]);
547
576
  if (!map_tokenName_int_t)
548
577
  throw new Error("expected map_tokenName_int_t");
549
578
  const map_policyId_map_tokenName_int_t = program.getAppliedGeneric(TirLinearMapT.toTirTypeKey(), [policyId_t, map_tokenName_int_t]);
550
579
  if (!map_policyId_map_tokenName_int_t)
551
580
  throw new Error("expected map_policyId_map_tokenName_int_t");
552
- const value_t = _defineUnambigousAlias("Value", map_policyId_map_tokenName_int_t, new Map([
581
+ const valueMap_t = _defineUnambigousAlias("ValueMap", map_policyId_map_tokenName_int_t, new Map([
553
582
  [
554
583
  "lovelaces",
555
- valueLovelacesName
584
+ valueMapLovelacesName
556
585
  ],
557
586
  [
558
587
  "amountOf",
559
- valueAmountOfName
588
+ valueMapAmountOfName
560
589
  ],
561
590
  ]));
562
- preludeScope.program.functions.set(valueLovelacesName, new TirInlineClosedIR(new TirFuncT([value_t], int_t), (ctx) => IRNative._sortedValueLovelaces, SourceRange.unknown));
563
- // Value.amountOf( policy: PolicyId, name: bytes ): int
591
+ preludeScope.program.functions.set(valueMapLovelacesName, new TirInlineClosedIR(new TirFuncT([valueMap_t], int_t), (ctx) => IRNative._sortedValueLovelaces, SourceRange.unknown));
592
+ // ValueMap.amountOf( policy: PolicyId, name: bytes ): int
564
593
  // The IR native _amountOfValue is curried as: (isPolicy)(value)(isTokenName) => int
565
594
  // where isPolicy and isTokenName are equality-check predicates.
566
595
  // This wrapper adapts (self, policy, tokenName) => _amountOfValue(p => equalsByteString(p, policy))(self)(tn => equalsByteString(tn, tokenName))
567
- preludeScope.program.functions.set(valueAmountOfName, new TirInlineClosedIR(new TirFuncT([value_t, policyId_t, bytes_t], int_t), (ctx) => {
596
+ preludeScope.program.functions.set(valueMapAmountOfName, new TirInlineClosedIR(new TirFuncT([valueMap_t, policyId_t, bytes_t], int_t), (ctx) => {
568
597
  const self = Symbol("amtOf_self");
569
598
  const policy = Symbol("amtOf_policy");
570
599
  const tokenName = Symbol("amtOf_tokenName");
@@ -578,37 +607,51 @@ export function populatePreludeScope(program) {
578
607
  // isTokenName predicate: \tn -> equalsByteString(tn, tokenName)
579
608
  _ir_apps(IRNative.equalsByteString, new IRVar(tokenName))));
580
609
  }, SourceRange.unknown));
581
- /* // TODO
582
- untagged struct FlatValueEntry {
583
- policy: PolicyId,
584
- name: bytes,
585
- amount: int
586
- }
587
-
588
- type FlatValue = List<FlatValueEntry>;
589
-
590
- type Value implements {
591
- amountOf( policy: PolicyId, name: bytes ): int
592
- {
593
- return native.valueAmountOf( this, policy, name );
594
- }
595
- lovelaces(): int
596
- {
597
- return this.amountOf( #, # );
598
- }
599
- flatten(): FlatValue
600
- {
601
- return native.flattenValue( this );
602
- }
603
- }
604
-
605
- type FlatValue implements {
606
- unflatten(): Value
607
- {
608
- return native.unflattenValue( this );
609
- }
610
- }
611
- */
610
+ // Native `Value` (ConstTyTag.value). Methods route to the value builtins.
611
+ const value_native_t = program.types.get(TirValueT.toTirTypeKey());
612
+ if (!value_native_t)
613
+ throw new Error("expected native Value type registered");
614
+ const value_t = _defineUnambigousAlias("Value", value_native_t, new Map([
615
+ ["lovelaces", valueLovelacesName],
616
+ ["amountOf", valueAmountOfName],
617
+ ["insert", valueInsertCoinName],
618
+ ["union", valueUnionName],
619
+ ["contains", valueContainsName],
620
+ ["scale", valueScaleName],
621
+ ["toData", valueToDataName],
622
+ ]));
623
+ // Value.lovelaces(): int -- lookupCoin "" "" self
624
+ preludeScope.program.functions.set(valueLovelacesName, new TirInlineClosedIR(new TirFuncT([value_t], int_t), (ctx) => {
625
+ const self = Symbol("value_lovelaces_self");
626
+ return new IRFunc([self], _ir_apps(IRNative.lookupCoin, IRConst.bytes(new Uint8Array(0)), IRConst.bytes(new Uint8Array(0)), new IRVar(self)));
627
+ }, SourceRange.unknown));
628
+ // Value.amountOf( policy, name ): int -- lookupCoin policy name self
629
+ preludeScope.program.functions.set(valueAmountOfName, new TirInlineClosedIR(new TirFuncT([value_t, policyId_t, bytes_t], int_t), (ctx) => {
630
+ const self = Symbol("value_amountOf_self");
631
+ const policy = Symbol("value_amountOf_policy");
632
+ const tokenName = Symbol("value_amountOf_tokenName");
633
+ return new IRFunc([self, policy, tokenName], _ir_apps(IRNative.lookupCoin, new IRVar(policy), new IRVar(tokenName), new IRVar(self)));
634
+ }, SourceRange.unknown));
635
+ // Value.insert( policy, name, amount ): Value -- insertCoin policy name amount self
636
+ preludeScope.program.functions.set(valueInsertCoinName, new TirInlineClosedIR(new TirFuncT([value_t, policyId_t, bytes_t, int_t], value_t), (ctx) => {
637
+ const self = Symbol("value_insert_self");
638
+ const policy = Symbol("value_insert_policy");
639
+ const tokenName = Symbol("value_insert_tokenName");
640
+ const amount = Symbol("value_insert_amount");
641
+ return new IRFunc([self, policy, tokenName, amount], _ir_apps(IRNative.insertCoin, new IRVar(policy), new IRVar(tokenName), new IRVar(amount), new IRVar(self)));
642
+ }, SourceRange.unknown));
643
+ // Value.union( other ): Value -- unionValue self other
644
+ preludeScope.program.functions.set(valueUnionName, new TirInlineClosedIR(new TirFuncT([value_t, value_t], value_t), (ctx) => IRNative.unionValue, SourceRange.unknown));
645
+ // Value.contains( other ): bool -- valueContains self other
646
+ preludeScope.program.functions.set(valueContainsName, new TirInlineClosedIR(new TirFuncT([value_t, value_t], bool_t), (ctx) => IRNative.valueContains, SourceRange.unknown));
647
+ // Value.scale( factor ): Value -- scaleValue factor self
648
+ preludeScope.program.functions.set(valueScaleName, new TirInlineClosedIR(new TirFuncT([value_t, int_t], value_t), (ctx) => {
649
+ const self = Symbol("value_scale_self");
650
+ const factor = Symbol("value_scale_factor");
651
+ return new IRFunc([self, factor], _ir_apps(IRNative.scaleValue, new IRVar(factor), new IRVar(self)));
652
+ }, SourceRange.unknown));
653
+ // Value.toData(): data -- valueData self
654
+ preludeScope.program.functions.set(valueToDataName, new TirInlineClosedIR(new TirFuncT([value_t], data_t), (ctx) => IRNative.valueData, SourceRange.unknown));
612
655
  // struct OutputDatum {
613
656
  // NoDatum {}
614
657
  // DatumHash { hash: Hash32 }
@@ -34,7 +34,6 @@ export function isTirStmt(thing) {
34
34
  || thing instanceof TirFailStmt
35
35
  || thing instanceof TirAssertStmt
36
36
  || thing instanceof TirTraceStmt
37
- // || thing instanceof TirTestStmt
38
37
  || thing instanceof TirMatchStmt
39
38
  || thing instanceof TirAssignmentStmt
40
39
  // || thing instanceof TirExprStmt
@@ -0,0 +1,46 @@
1
+ import { SourceRange } from "../../../ast/Source/SourceRange.js";
2
+ import { ITirStmt } from "./TirStmt.js";
3
+ /**
4
+ * Per-parameter fuzzer descriptor.
5
+ *
6
+ * - `kind: "primitive"`: the runner generates values directly in TS for a
7
+ * supported primitive type (`int`, `bool`, etc.). No Pebble-side fuzzer call.
8
+ * - `kind: "unsupported"`: the parameter type has no default generator and
9
+ * no `via` was supplied; the runner emits a SKIP `TestResult` carrying
10
+ * `reason`.
11
+ * - `kind: "via_not_implemented"`: the user wrote `via <expr>` and the
12
+ * compiler successfully type-checked it, but executing user-defined
13
+ * fuzzers is not wired up yet (Phase 2). Surfaced as SKIP.
14
+ */
15
+ export type FuzzerInfo = {
16
+ kind: "primitive";
17
+ primitive: "int" | "bool";
18
+ } | {
19
+ kind: "unsupported";
20
+ reason: string;
21
+ } | {
22
+ kind: "via_not_implemented";
23
+ };
24
+ /**
25
+ * A `test name( params? ) { body }` block.
26
+ *
27
+ * The compiled body lives in `program.functions` keyed by `tirFuncName`
28
+ * (synthesised as `__pebble_test_<name>_<srcUid>`). The executor
29
+ * (`runTests`) looks up that function, compiles it to UPLC, and evaluates it.
30
+ *
31
+ * `fuzzerInfos` is parallel to the function's params; for unit tests it is
32
+ * empty. For property tests, each entry tells the runner how to source
33
+ * values for that parameter.
34
+ */
35
+ export declare class TirTestStmt implements ITirStmt {
36
+ readonly name: string;
37
+ readonly tirFuncName: string;
38
+ readonly sourceFile: string;
39
+ readonly range: SourceRange;
40
+ readonly fuzzerInfos: FuzzerInfo[];
41
+ constructor(name: string, tirFuncName: string, sourceFile: string, range: SourceRange, fuzzerInfos?: FuzzerInfo[]);
42
+ toString(): string;
43
+ pretty(): string;
44
+ definitelyTerminates(): boolean;
45
+ deps(): string[];
46
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * A `test name( params? ) { body }` block.
3
+ *
4
+ * The compiled body lives in `program.functions` keyed by `tirFuncName`
5
+ * (synthesised as `__pebble_test_<name>_<srcUid>`). The executor
6
+ * (`runTests`) looks up that function, compiles it to UPLC, and evaluates it.
7
+ *
8
+ * `fuzzerInfos` is parallel to the function's params; for unit tests it is
9
+ * empty. For property tests, each entry tells the runner how to source
10
+ * values for that parameter.
11
+ */
12
+ export class TirTestStmt {
13
+ name;
14
+ tirFuncName;
15
+ sourceFile;
16
+ range;
17
+ fuzzerInfos;
18
+ constructor(name, tirFuncName, sourceFile, range, fuzzerInfos = []) {
19
+ this.name = name;
20
+ this.tirFuncName = tirFuncName;
21
+ this.sourceFile = sourceFile;
22
+ this.range = range;
23
+ this.fuzzerInfos = fuzzerInfos;
24
+ }
25
+ toString() {
26
+ return `test ${this.name} -> ${this.tirFuncName}`;
27
+ }
28
+ pretty() {
29
+ return this.toString();
30
+ }
31
+ definitelyTerminates() { return false; }
32
+ deps() {
33
+ return [this.tirFuncName];
34
+ }
35
+ }
@@ -0,0 +1,21 @@
1
+ import { ConstType } from "@harmoniclabs/uplc";
2
+ import { AstFuncName, TirFuncName } from "../../AstCompiler/scope/AstScope.js";
3
+ import { ITirType, TirType } from "./TirType.js";
4
+ export declare class TirEnumType implements ITirType {
5
+ readonly name: string;
6
+ readonly fileUid: string;
7
+ readonly members: readonly string[];
8
+ readonly methodNamesPtr: Map<AstFuncName, TirFuncName>;
9
+ constructor(name: string, fileUid: string, members: readonly string[], methodNamesPtr: Map<AstFuncName, TirFuncName>);
10
+ indexOf(member: string): number;
11
+ isConcrete(): boolean;
12
+ hasDataEncoding(): boolean;
13
+ toString(): string;
14
+ toAstName(): string;
15
+ toTirTypeKey(): string;
16
+ toConcreteTirTypeName(): string;
17
+ toUplcConstType(): ConstType;
18
+ clone(): TirEnumType;
19
+ }
20
+ export declare function isTirEnumType(thing: any): thing is TirEnumType;
21
+ export declare function getEnumType(type: TirType | undefined): TirEnumType | undefined;
@@ -0,0 +1,36 @@
1
+ import { isObject } from "@harmoniclabs/obj-utils";
2
+ import { constT } from "@harmoniclabs/uplc";
3
+ import { TirAliasType } from "./TirAliasType.js";
4
+ export class TirEnumType {
5
+ name;
6
+ fileUid;
7
+ members;
8
+ methodNamesPtr;
9
+ constructor(name, fileUid, members, methodNamesPtr) {
10
+ this.name = name;
11
+ this.fileUid = fileUid;
12
+ this.members = members;
13
+ this.methodNamesPtr = methodNamesPtr;
14
+ }
15
+ indexOf(member) {
16
+ return this.members.indexOf(member);
17
+ }
18
+ isConcrete() { return true; }
19
+ hasDataEncoding() { return true; }
20
+ toString() { return this.name; }
21
+ toAstName() { return this.name; }
22
+ toTirTypeKey() { return "enum_" + this.name + "_" + this.fileUid; }
23
+ toConcreteTirTypeName() { return this.toTirTypeKey(); }
24
+ toUplcConstType() { return constT.int; }
25
+ clone() {
26
+ return new TirEnumType(this.name, this.fileUid, this.members.slice(), this.methodNamesPtr);
27
+ }
28
+ }
29
+ export function isTirEnumType(thing) {
30
+ return isObject(thing) && thing instanceof TirEnumType;
31
+ }
32
+ export function getEnumType(type) {
33
+ while (type instanceof TirAliasType)
34
+ type = type.aliased;
35
+ return type instanceof TirEnumType ? type : undefined;
36
+ }
@@ -12,9 +12,11 @@ import { TirDataOptT } from "./native/Optional/data.js";
12
12
  import { TirSopOptT } from "./native/Optional/sop.js";
13
13
  import { TirStringT } from "./native/string.js";
14
14
  import { TirVoidT } from "./native/void.js";
15
- export type TirNamedDestructableNativeType = TirDataT | TirDataOptT<TirType> | TirSopOptT<TirType> | TirListT<TirType> | TirLinearMapT<TirType, TirType>;
15
+ import { TirArrayT } from "./native/array.js";
16
+ import { TirValueT } from "./native/value.js";
17
+ export type TirNamedDestructableNativeType = TirDataT | TirDataOptT<TirType> | TirSopOptT<TirType> | TirListT<TirType> | TirArrayT<TirType> | TirLinearMapT<TirType, TirType>;
16
18
  export declare function isTirNamedDestructableNativeType(t: any): t is TirNamedDestructableNativeType;
17
- export type TirNativeType = TirVoidT | TirBoolT | TirIntT | TirBytesT | TirStringT | TirDataT | TirDataOptT<TirType> | TirSopOptT<TirType> | TirListT<TirType> | TirLinearMapT<TirType, TirType> | TirLinearMapEntryT<TirType, TirType> | TirFuncT | TirUnConstrDataResultT | TirPairDataT;
19
+ export type TirNativeType = TirVoidT | TirBoolT | TirIntT | TirBytesT | TirStringT | TirDataT | TirDataOptT<TirType> | TirSopOptT<TirType> | TirListT<TirType> | TirArrayT<TirType> | TirValueT | TirLinearMapT<TirType, TirType> | TirLinearMapEntryT<TirType, TirType> | TirFuncT | TirUnConstrDataResultT | TirPairDataT | TirBlsG1T | TirBlsG2T | TirMlResultT;
18
20
  export declare function isTirNativeType(t: any): t is TirNativeType;
19
21
  export declare class TirUnConstrDataResultT implements ITirType {
20
22
  constructor();
@@ -40,3 +42,52 @@ export declare class TirPairDataT implements ITirType {
40
42
  clone(): TirPairDataT;
41
43
  toUplcConstType(): ConstType;
42
44
  }
45
+ /**
46
+ * BLS12-381 G1 element. Opaque native scalar; cannot be constructed from
47
+ * Pebble source directly — values are produced by `std.crypto.bls12_381.*`
48
+ * builtins (typically `g1Uncompress` or `g1HashToGroup`).
49
+ */
50
+ export declare class TirBlsG1T implements ITirType {
51
+ constructor();
52
+ hasDataEncoding(): boolean;
53
+ static toTirTypeKey(): string;
54
+ toTirTypeKey(): string;
55
+ toConcreteTirTypeName(): string;
56
+ toString(): string;
57
+ toAstName(): string;
58
+ isConcrete(): boolean;
59
+ clone(): TirBlsG1T;
60
+ toUplcConstType(): ConstType;
61
+ }
62
+ /**
63
+ * BLS12-381 G2 element. Opaque native scalar.
64
+ */
65
+ export declare class TirBlsG2T implements ITirType {
66
+ constructor();
67
+ hasDataEncoding(): boolean;
68
+ static toTirTypeKey(): string;
69
+ toTirTypeKey(): string;
70
+ toConcreteTirTypeName(): string;
71
+ toString(): string;
72
+ toAstName(): string;
73
+ isConcrete(): boolean;
74
+ clone(): TirBlsG2T;
75
+ toUplcConstType(): ConstType;
76
+ }
77
+ /**
78
+ * BLS12-381 Miller-loop result. Opaque native scalar produced by
79
+ * `bls12_381_millerLoop` and consumed by `bls12_381_finalVerify` /
80
+ * `bls12_381_mulMlResult`.
81
+ */
82
+ export declare class TirMlResultT implements ITirType {
83
+ constructor();
84
+ hasDataEncoding(): boolean;
85
+ static toTirTypeKey(): string;
86
+ toTirTypeKey(): string;
87
+ toConcreteTirTypeName(): string;
88
+ toString(): string;
89
+ toAstName(): string;
90
+ isConcrete(): boolean;
91
+ clone(): TirMlResultT;
92
+ toUplcConstType(): ConstType;
93
+ }
@@ -11,11 +11,14 @@ import { TirDataOptT } from "./native/Optional/data.js";
11
11
  import { TirSopOptT } from "./native/Optional/sop.js";
12
12
  import { TirStringT } from "./native/string.js";
13
13
  import { TirVoidT } from "./native/void.js";
14
+ import { TirArrayT } from "./native/array.js";
15
+ import { TirValueT } from "./native/value.js";
14
16
  export function isTirNamedDestructableNativeType(t) {
15
17
  return (t instanceof TirDataT
16
18
  || t instanceof TirDataOptT
17
19
  || t instanceof TirSopOptT
18
20
  || t instanceof TirListT
21
+ || t instanceof TirArrayT
19
22
  || t instanceof TirLinearMapT);
20
23
  }
21
24
  export function isTirNativeType(t) {
@@ -28,11 +31,16 @@ export function isTirNativeType(t) {
28
31
  || t instanceof TirDataOptT
29
32
  || t instanceof TirSopOptT
30
33
  || t instanceof TirListT
34
+ || t instanceof TirArrayT
35
+ || t instanceof TirValueT
31
36
  || t instanceof TirLinearMapT
32
37
  || t instanceof TirLinearMapEntryT
33
38
  || t instanceof TirFuncT // =>
34
39
  || t instanceof TirUnConstrDataResultT
35
- || t instanceof TirPairDataT);
40
+ || t instanceof TirPairDataT
41
+ || t instanceof TirBlsG1T
42
+ || t instanceof TirBlsG2T
43
+ || t instanceof TirMlResultT);
36
44
  }
37
45
  export class TirUnConstrDataResultT {
38
46
  constructor() { }
@@ -86,3 +94,52 @@ export class TirPairDataT {
86
94
  return constT.pairOf(constT.data, constT.data);
87
95
  }
88
96
  }
97
+ /**
98
+ * BLS12-381 G1 element. Opaque native scalar; cannot be constructed from
99
+ * Pebble source directly — values are produced by `std.crypto.bls12_381.*`
100
+ * builtins (typically `g1Uncompress` or `g1HashToGroup`).
101
+ */
102
+ export class TirBlsG1T {
103
+ constructor() { }
104
+ hasDataEncoding() { return false; }
105
+ static toTirTypeKey() { return "#bls12_381_g1#"; }
106
+ toTirTypeKey() { return TirBlsG1T.toTirTypeKey(); }
107
+ toConcreteTirTypeName() { return this.toTirTypeKey(); }
108
+ toString() { return "G1"; }
109
+ toAstName() { return "G1"; }
110
+ isConcrete() { return true; }
111
+ clone() { return new TirBlsG1T(); }
112
+ toUplcConstType() { return constT.bls12_381_G1_element; }
113
+ }
114
+ /**
115
+ * BLS12-381 G2 element. Opaque native scalar.
116
+ */
117
+ export class TirBlsG2T {
118
+ constructor() { }
119
+ hasDataEncoding() { return false; }
120
+ static toTirTypeKey() { return "#bls12_381_g2#"; }
121
+ toTirTypeKey() { return TirBlsG2T.toTirTypeKey(); }
122
+ toConcreteTirTypeName() { return this.toTirTypeKey(); }
123
+ toString() { return "G2"; }
124
+ toAstName() { return "G2"; }
125
+ isConcrete() { return true; }
126
+ clone() { return new TirBlsG2T(); }
127
+ toUplcConstType() { return constT.bls12_381_G2_element; }
128
+ }
129
+ /**
130
+ * BLS12-381 Miller-loop result. Opaque native scalar produced by
131
+ * `bls12_381_millerLoop` and consumed by `bls12_381_finalVerify` /
132
+ * `bls12_381_mulMlResult`.
133
+ */
134
+ export class TirMlResultT {
135
+ constructor() { }
136
+ hasDataEncoding() { return false; }
137
+ static toTirTypeKey() { return "#bls12_381_ml_result#"; }
138
+ toTirTypeKey() { return TirMlResultT.toTirTypeKey(); }
139
+ toConcreteTirTypeName() { return this.toTirTypeKey(); }
140
+ toString() { return "MlResult"; }
141
+ toAstName() { return "MlResult"; }
142
+ isConcrete() { return true; }
143
+ clone() { return new TirMlResultT(); }
144
+ toUplcConstType() { return constT.bls12_381_MlResult; }
145
+ }
@@ -0,0 +1,16 @@
1
+ import { ConstType } from "@harmoniclabs/uplc";
2
+ import { TirType, ITirType } from "../../TirType.js";
3
+ export declare class TirArrayT<T extends TirType = TirType> implements ITirType {
4
+ readonly typeArg: T;
5
+ constructor(typeArg: T);
6
+ hasDataEncoding(): boolean;
7
+ static toTirTypeKey(): string;
8
+ toTirTypeKey(): string;
9
+ toConcreteTirTypeName(): string;
10
+ toString(): string;
11
+ toAstName(): string;
12
+ private _isConcrete;
13
+ isConcrete(): boolean;
14
+ clone(): TirArrayT<T>;
15
+ toUplcConstType(): ConstType;
16
+ }
@@ -0,0 +1,38 @@
1
+ import { constT } from "@harmoniclabs/uplc";
2
+ import { getAppliedTirTypeName } from "../../../program/TypedProgram.js";
3
+ export class TirArrayT {
4
+ typeArg;
5
+ constructor(typeArg) {
6
+ this.typeArg = typeArg;
7
+ }
8
+ hasDataEncoding() { return this.typeArg.hasDataEncoding(); }
9
+ static toTirTypeKey() {
10
+ return "Array";
11
+ }
12
+ toTirTypeKey() {
13
+ return TirArrayT.toTirTypeKey();
14
+ }
15
+ toConcreteTirTypeName() {
16
+ return getAppliedTirTypeName(this.toTirTypeKey(), [this.typeArg.toConcreteTirTypeName()]);
17
+ }
18
+ toString() {
19
+ return `${this.toTirTypeKey()}<${this.typeArg.toString()}>`;
20
+ }
21
+ toAstName() {
22
+ return this.toTirTypeKey();
23
+ }
24
+ _isConcrete = undefined;
25
+ isConcrete() {
26
+ if (typeof this._isConcrete !== "boolean")
27
+ this._isConcrete = this.typeArg.isConcrete();
28
+ return this._isConcrete ?? false;
29
+ }
30
+ clone() {
31
+ const result = new TirArrayT(this.typeArg.clone());
32
+ result._isConcrete = this._isConcrete;
33
+ return result;
34
+ }
35
+ toUplcConstType() {
36
+ return constT.arrayOf(this.typeArg.toUplcConstType());
37
+ }
38
+ }
@@ -1,4 +1,5 @@
1
1
  export * from "./Optional/index.js";
2
+ export * from "./array.js";
2
3
  export * from "./bool.js";
3
4
  export * from "./bytes.js";
4
5
  export * from "./data.js";
@@ -8,4 +9,5 @@ export * from "./linearMap.js";
8
9
  export * from "./linearMapEntry.js";
9
10
  export * from "./list.js";
10
11
  export * from "./string.js";
12
+ export * from "./value.js";
11
13
  export * from "./void.js";
@@ -1,4 +1,5 @@
1
1
  export * from "./Optional/index.js";
2
+ export * from "./array.js";
2
3
  export * from "./bool.js";
3
4
  export * from "./bytes.js";
4
5
  export * from "./data.js";
@@ -8,4 +9,5 @@ export * from "./linearMap.js";
8
9
  export * from "./linearMapEntry.js";
9
10
  export * from "./list.js";
10
11
  export * from "./string.js";
12
+ export * from "./value.js";
11
13
  export * from "./void.js";
@@ -0,0 +1,18 @@
1
+ import { ConstType } from "@harmoniclabs/uplc";
2
+ import { ITirType } from "../../TirType.js";
3
+ export declare class TirValueT implements ITirType {
4
+ clone(): TirValueT;
5
+ isConcrete(): boolean;
6
+ toString(): string;
7
+ toAstName(): string;
8
+ static toTirTypeKey(): string;
9
+ toTirTypeKey(): string;
10
+ toConcreteTirTypeName(): string;
11
+ /**
12
+ * Native `Value` is bidirectionally reachable from `data` via
13
+ * `unValueData` / `valueData`, so it qualifies as data-encoded for
14
+ * the purposes of `data struct` field types.
15
+ */
16
+ hasDataEncoding(): boolean;
17
+ toUplcConstType(): ConstType;
18
+ }