@algorandfoundation/puya-ts 1.0.0-alpha.4

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 (241) hide show
  1. package/README.md +11 -0
  2. package/awst/index.d.ts +4 -0
  3. package/awst/intrinsic-factory.d.ts +35 -0
  4. package/awst/json-serialize-awst.d.ts +17 -0
  5. package/awst/models.d.ts +85 -0
  6. package/awst/node-factory.d.ts +90 -0
  7. package/awst/nodes.d.ts +841 -0
  8. package/awst/source-location.d.ts +21 -0
  9. package/awst/to-code-visitor.d.ts +87 -0
  10. package/awst/txn-fields.d.ts +84 -0
  11. package/awst/util.d.ts +2 -0
  12. package/awst/wtypes.d.ts +131 -0
  13. package/awst_build/base-visitor.d.ts +87 -0
  14. package/awst_build/constructor-visitor.d.ts +18 -0
  15. package/awst_build/context/awst-build-context.d.ts +72 -0
  16. package/awst_build/context/evaluation-context.d.ts +11 -0
  17. package/awst_build/context/switch-loop-context.d.ts +31 -0
  18. package/awst_build/context/unique-name-resolver.d.ts +14 -0
  19. package/awst_build/contract-data.d.ts +24 -0
  20. package/awst_build/contract-method-visitor.d.ts +20 -0
  21. package/awst_build/contract-visitor.d.ts +33 -0
  22. package/awst_build/decorator-visitor.d.ts +34 -0
  23. package/awst_build/eb/arc4/arrays.d.ts +31 -0
  24. package/awst_build/eb/arc4/uint-n-constructor-builder.d.ts +14 -0
  25. package/awst_build/eb/arc4-bare-method-decorator-builder.d.ts +19 -0
  26. package/awst_build/eb/assert-function-builder.d.ts +10 -0
  27. package/awst_build/eb/assert-match-function-builder.d.ts +8 -0
  28. package/awst_build/eb/biguint-expression-builder.d.ts +21 -0
  29. package/awst_build/eb/boolean-expression-builder.d.ts +15 -0
  30. package/awst_build/eb/bytes-expression-builder.d.ts +44 -0
  31. package/awst_build/eb/contract-builder.d.ts +19 -0
  32. package/awst_build/eb/ensure-budget.d.ts +8 -0
  33. package/awst_build/eb/folding.d.ts +5 -0
  34. package/awst_build/eb/free-subroutine-expression-builder.d.ts +22 -0
  35. package/awst_build/eb/index.d.ts +90 -0
  36. package/awst_build/eb/intrinsic-enum-builder.d.ts +9 -0
  37. package/awst_build/eb/iterable-iterator-expression-builder.d.ts +10 -0
  38. package/awst_build/eb/literal/array-literal-expression-builder.d.ts +19 -0
  39. package/awst_build/eb/literal/big-int-literal-expression-builder.d.ts +19 -0
  40. package/awst_build/eb/literal/conditional-expression-builder.d.ts +22 -0
  41. package/awst_build/eb/literal/object-expression-builder.d.ts +13 -0
  42. package/awst_build/eb/literal/object-literal-expression-builder.d.ts +28 -0
  43. package/awst_build/eb/literal-expression-builder.d.ts +27 -0
  44. package/awst_build/eb/log-function-builder.d.ts +7 -0
  45. package/awst_build/eb/namespace-builder.d.ts +9 -0
  46. package/awst_build/eb/native-array-expression-builder.d.ts +8 -0
  47. package/awst_build/eb/omitted-expression-builder.d.ts +9 -0
  48. package/awst_build/eb/op-module-builder.d.ts +25 -0
  49. package/awst_build/eb/reference/account.d.ts +15 -0
  50. package/awst_build/eb/reference/application.d.ts +12 -0
  51. package/awst_build/eb/reference/asset.d.ts +13 -0
  52. package/awst_build/eb/reference/base.d.ts +37 -0
  53. package/awst_build/eb/storage/box.d.ts +50 -0
  54. package/awst_build/eb/storage/global-state.d.ts +29 -0
  55. package/awst_build/eb/storage/local-state.d.ts +32 -0
  56. package/awst_build/eb/storage/util.d.ts +5 -0
  57. package/awst_build/eb/storage/value-proxy.d.ts +22 -0
  58. package/awst_build/eb/string-expression-builder.d.ts +27 -0
  59. package/awst_build/eb/transactions/group-transactions.d.ts +15 -0
  60. package/awst_build/eb/transactions/inner-transaction-params.d.ts +19 -0
  61. package/awst_build/eb/transactions/inner-transactions.d.ts +10 -0
  62. package/awst_build/eb/transactions/txn-fields.d.ts +1317 -0
  63. package/awst_build/eb/transactions/util.d.ts +5 -0
  64. package/awst_build/eb/tuple-expression-builder.d.ts +12 -0
  65. package/awst_build/eb/uint64-enum-type-builder.d.ts +13 -0
  66. package/awst_build/eb/uint64-expression-builder.d.ts +21 -0
  67. package/awst_build/eb/urange-function.d.ts +7 -0
  68. package/awst_build/eb/util/arg-parsing.d.ts +106 -0
  69. package/awst_build/eb/util/compare-bytes.d.ts +5 -0
  70. package/awst_build/eb/util/compare-uint64.d.ts +5 -0
  71. package/awst_build/eb/util/index.d.ts +19 -0
  72. package/awst_build/eb/util/require-constant-value.d.ts +4 -0
  73. package/awst_build/eb/void-expression-builder.d.ts +7 -0
  74. package/awst_build/function-visitor.d.ts +45 -0
  75. package/awst_build/index.d.ts +5 -0
  76. package/awst_build/lib/index.d.ts +2 -0
  77. package/awst_build/op-metadata.d.ts +27 -0
  78. package/awst_build/ptypes/arc4-types.d.ts +56 -0
  79. package/awst_build/ptypes/base.d.ts +31 -0
  80. package/awst_build/ptypes/index.d.ts +455 -0
  81. package/awst_build/ptypes/intrinsic-enum-type.d.ts +14 -0
  82. package/awst_build/ptypes/op-ptypes.d.ts +6 -0
  83. package/awst_build/ptypes/register.d.ts +2 -0
  84. package/awst_build/source-file-visitor.d.ts +21 -0
  85. package/awst_build/subroutine-visitor.d.ts +10 -0
  86. package/awst_build/symbol-name.d.ts +10 -0
  87. package/awst_build/text-visitor.d.ts +20 -0
  88. package/awst_build/type-registry.d.ts +61 -0
  89. package/awst_build/type-resolver.d.ts +18 -0
  90. package/bin/run-cli.d.ts +2 -0
  91. package/bin/run-cli.mjs +20 -0
  92. package/bin/run-cli.mjs.map +1 -0
  93. package/cli.d.ts +1 -0
  94. package/cli.mjs +146 -0
  95. package/cli.mjs.map +1 -0
  96. package/compile-options.d.ts +17 -0
  97. package/constants.d.ts +20 -0
  98. package/errors.d.ts +46 -0
  99. package/index-D6W2FUFQ.js +16297 -0
  100. package/index-D6W2FUFQ.js.map +1 -0
  101. package/index.d.ts +19 -0
  102. package/index.mjs +15 -0
  103. package/index.mjs.map +1 -0
  104. package/logger.d.ts +39 -0
  105. package/node_modules/typescript/LICENSE.txt +55 -0
  106. package/node_modules/typescript/README.md +50 -0
  107. package/node_modules/typescript/SECURITY.md +41 -0
  108. package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  109. package/node_modules/typescript/bin/tsc +2 -0
  110. package/node_modules/typescript/bin/tsserver +2 -0
  111. package/node_modules/typescript/lib/cancellationToken.js +90 -0
  112. package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2087 -0
  113. package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2087 -0
  114. package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2087 -0
  115. package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2087 -0
  116. package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2087 -0
  117. package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2087 -0
  118. package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2087 -0
  119. package/node_modules/typescript/lib/lib.d.ts +22 -0
  120. package/node_modules/typescript/lib/lib.decorators.d.ts +386 -0
  121. package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  122. package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  123. package/node_modules/typescript/lib/lib.dom.d.ts +28087 -0
  124. package/node_modules/typescript/lib/lib.dom.iterable.d.ts +491 -0
  125. package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  126. package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  127. package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  128. package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  129. package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +527 -0
  130. package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  131. package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  132. package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  133. package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  134. package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  135. package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  136. package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  137. package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  138. package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  139. package/node_modules/typescript/lib/lib.es2017.d.ts +25 -0
  140. package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  141. package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  142. package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  143. package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  144. package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  145. package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  146. package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  147. package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  148. package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  149. package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  150. package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  151. package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  152. package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  153. package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  154. package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  155. package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  156. package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  157. package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  158. package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  159. package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  160. package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  161. package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +727 -0
  162. package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  163. package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  164. package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  165. package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  166. package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  167. package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  168. package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +97 -0
  169. package/node_modules/typescript/lib/lib.es2020.string.d.ts +42 -0
  170. package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  171. package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  172. package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  173. package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  174. package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  175. package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  176. package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +76 -0
  177. package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  178. package/node_modules/typescript/lib/lib.es2022.d.ts +26 -0
  179. package/node_modules/typescript/lib/lib.es2022.error.d.ts +73 -0
  180. package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  181. package/node_modules/typescript/lib/lib.es2022.intl.d.ts +121 -0
  182. package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  183. package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  184. package/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts +39 -0
  185. package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  186. package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  187. package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  188. package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  189. package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  190. package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  191. package/node_modules/typescript/lib/lib.es5.d.ts +4585 -0
  192. package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  193. package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  194. package/node_modules/typescript/lib/lib.esnext.collection.d.ts +106 -0
  195. package/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  196. package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  197. package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  198. package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  199. package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  200. package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  201. package/node_modules/typescript/lib/lib.esnext.object.d.ts +29 -0
  202. package/node_modules/typescript/lib/lib.esnext.promise.d.ts +35 -0
  203. package/node_modules/typescript/lib/lib.esnext.regexp.d.ts +25 -0
  204. package/node_modules/typescript/lib/lib.esnext.string.d.ts +29 -0
  205. package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  206. package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  207. package/node_modules/typescript/lib/lib.webworker.d.ts +9410 -0
  208. package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  209. package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +288 -0
  210. package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2087 -0
  211. package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2087 -0
  212. package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2087 -0
  213. package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2087 -0
  214. package/node_modules/typescript/lib/tsc.js +130771 -0
  215. package/node_modules/typescript/lib/tsserver.js +623 -0
  216. package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  217. package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  218. package/node_modules/typescript/lib/typesMap.json +497 -0
  219. package/node_modules/typescript/lib/typescript.d.ts +11329 -0
  220. package/node_modules/typescript/lib/typescript.js +196077 -0
  221. package/node_modules/typescript/lib/typingsInstaller.js +236 -0
  222. package/node_modules/typescript/lib/watchGuard.js +53 -0
  223. package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2087 -0
  224. package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2087 -0
  225. package/node_modules/typescript/package.json +121 -0
  226. package/package.json +42 -0
  227. package/parser/index.d.ts +13 -0
  228. package/parser/json-serialize-source-files.d.ts +2 -0
  229. package/parser/resolve-module-name-literals.d.ts +2 -0
  230. package/puya/build-compilation-set-mapping.d.ts +10 -0
  231. package/puya/index.d.ts +13 -0
  232. package/puya/options.d.ts +29 -0
  233. package/puya/run-child-proc.d.ts +5 -0
  234. package/util/base-32.d.ts +2 -0
  235. package/util/base-85.d.ts +10 -0
  236. package/util/default-map.d.ts +1 -0
  237. package/util/generate-temp-file.d.ts +9 -0
  238. package/util/index.d.ts +43 -0
  239. package/visitor/syntax-names.d.ts +441 -0
  240. package/visitor/visitor.d.ts +26 -0
  241. package/write-artifact.d.ts +12 -0
@@ -0,0 +1,5 @@
1
+ import { TransactionKind } from '../../../awst/models';
2
+ import type { GroupTransactionPType, InnerTransactionPType, ItxnParamsPType } from '../../ptypes';
3
+ export declare function getInnerTransactionType(kind: TransactionKind | undefined): InnerTransactionPType;
4
+ export declare function getItxnParamsType(kind: TransactionKind | undefined): ItxnParamsPType;
5
+ export declare function getGroupTransactionType(kind: TransactionKind | undefined): GroupTransactionPType;
@@ -0,0 +1,12 @@
1
+ import type { Expression } from '../../awst/nodes';
2
+ import type { SourceLocation } from '../../awst/source-location';
3
+ import type { PType } from '../ptypes';
4
+ import { TuplePType } from '../ptypes';
5
+ import type { InstanceBuilder, NodeBuilder } from './index';
6
+ import { InstanceExpressionBuilder } from './index';
7
+ export declare class TupleExpressionBuilder extends InstanceExpressionBuilder<TuplePType> {
8
+ constructor(expression: Expression, ptype: PType);
9
+ iterate(): Expression;
10
+ indexAccess(index: InstanceBuilder, sourceLocation: SourceLocation): NodeBuilder;
11
+ getItemBuilders(): InstanceBuilder[];
12
+ }
@@ -0,0 +1,13 @@
1
+ import type { Expression } from '../../awst/nodes';
2
+ import type { SourceLocation } from '../../awst/source-location';
3
+ import type { PType } from '../ptypes';
4
+ import { Uint64EnumMemberType, Uint64EnumType } from '../ptypes';
5
+ import { InstanceExpressionBuilder, NodeBuilder } from './index';
6
+ export declare class Uint64EnumTypeBuilder extends NodeBuilder {
7
+ readonly ptype: Uint64EnumType;
8
+ constructor(sourceLocation: SourceLocation, ptype: PType);
9
+ memberAccess(name: string, sourceLocation: SourceLocation): NodeBuilder;
10
+ }
11
+ export declare class Uint64EnumMemberExpressionBuilder extends InstanceExpressionBuilder<Uint64EnumMemberType> {
12
+ constructor(expr: Expression, ptype: PType);
13
+ }
@@ -0,0 +1,21 @@
1
+ import type { awst } from '../../awst';
2
+ import type { Expression } from '../../awst/nodes';
3
+ import type { SourceLocation } from '../../awst/source-location';
4
+ import type { InstanceType, PType } from '../ptypes';
5
+ import type { BuilderComparisonOp, InstanceBuilder } from './index';
6
+ import { BuilderBinaryOp, BuilderUnaryOp, FunctionBuilder, InstanceExpressionBuilder } from './index';
7
+ export declare class UInt64FunctionBuilder extends FunctionBuilder {
8
+ readonly ptype: import("../ptypes").LibFunctionType;
9
+ call(args: Array<InstanceBuilder>, typeArgs: ReadonlyArray<PType>, sourceLocation: SourceLocation): InstanceBuilder;
10
+ }
11
+ export declare class UInt64ExpressionBuilder extends InstanceExpressionBuilder<InstanceType> {
12
+ constructor(expr: Expression);
13
+ boolEval(sourceLocation: SourceLocation, negate: boolean): Expression;
14
+ compare(other: InstanceBuilder, op: BuilderComparisonOp, sourceLocation: SourceLocation): InstanceBuilder;
15
+ prefixUnaryOp(op: BuilderUnaryOp, sourceLocation: SourceLocation): InstanceBuilder;
16
+ postfixUnaryOp(op: BuilderUnaryOp, sourceLocation: SourceLocation): InstanceBuilder;
17
+ binaryOp(other: InstanceBuilder, op: BuilderBinaryOp, sourceLocation: SourceLocation): InstanceBuilder;
18
+ augmentedAssignment(other: InstanceBuilder, op: BuilderBinaryOp, sourceLocation: SourceLocation): InstanceBuilder;
19
+ assign(other: InstanceBuilder, sourceLocation: SourceLocation): InstanceBuilder;
20
+ toBytes(sourceLocation: SourceLocation): awst.Expression;
21
+ }
@@ -0,0 +1,7 @@
1
+ import type { SourceLocation } from '../../awst/source-location';
2
+ import type { PType } from '../ptypes';
3
+ import type { InstanceBuilder, NodeBuilder } from './index';
4
+ import { FunctionBuilder } from './index';
5
+ export declare class UrangeFunctionBuilder extends FunctionBuilder {
6
+ call(args: ReadonlyArray<InstanceBuilder>, typeArgs: ReadonlyArray<PType>, sourceLocation: SourceLocation): NodeBuilder;
7
+ }
@@ -0,0 +1,106 @@
1
+ import type { SourceLocation } from '../../../awst/source-location';
2
+ import type { DeliberateAny, Tuple } from '../../../typescript-helpers';
3
+ import type { PType, PTypeOrClass } from '../../ptypes';
4
+ import type { InstanceBuilder } from '../index';
5
+ declare const ArgSpecDiscriminator: unique symbol;
6
+ /**
7
+ * Optional arg spec
8
+ * Will be mapped to `Expression | undefined`
9
+ */
10
+ type OptionalArg = {
11
+ t: PTypeOrClass[];
12
+ required: false;
13
+ [ArgSpecDiscriminator]: 'arg';
14
+ };
15
+ /**
16
+ * Required arg spec
17
+ * Will be mapped to `Expression`
18
+ */
19
+ type RequiredArg = {
20
+ t: PTypeOrClass[];
21
+ required: true;
22
+ [ArgSpecDiscriminator]: 'arg';
23
+ };
24
+ type ArgSpec = OptionalArg | RequiredArg;
25
+ /**
26
+ * Object arg spec
27
+ * Will be mapped to an object with the same keys where each property
28
+ * is mapped to a Required or Optional spec
29
+ */
30
+ type ObjArgSpec = Record<string, ArgSpec> & {
31
+ [ArgSpecDiscriminator]: 'obj';
32
+ };
33
+ /**
34
+ * Maps an ObjArgSpec to its output type
35
+ */
36
+ type ArgsForObjSpec<T extends ObjArgSpec> = {
37
+ [key in keyof T]: ArgFor<T[key]>;
38
+ };
39
+ /**
40
+ * Defines the expected shape of a single argument.
41
+ * Either an ArgSpec indicting a single value, or an ObjArgSpec indicating an
42
+ * object literal with several properties
43
+ */
44
+ type ArgMap = ArgSpec | ObjArgSpec;
45
+ /**
46
+ * Maps an arg spec to its output type
47
+ */
48
+ type ArgFor<T extends ObjArgSpec | ArgSpec> = T extends ObjArgSpec ? ArgsForObjSpec<T> : T extends OptionalArg ? InstanceBuilder | undefined : T extends RequiredArg ? InstanceBuilder : never;
49
+ /**
50
+ * Maps each arg to an expected output type
51
+ */
52
+ type ParsedArgs<T extends [...DeliberateAny[]]> = T extends [infer T1 extends ArgMap, ...infer TRest] ? [ArgFor<T1>, ...ParsedArgs<TRest>] : T extends [] ? [] : T extends Array<infer TItem extends ArgMap> ? Array<ArgFor<TItem>> : never;
53
+ declare const argSpecFactory: {
54
+ /**
55
+ * A required arg with one of the specified types
56
+ * @param ptypes
57
+ */
58
+ required(...ptypes: PTypeOrClass[]): RequiredArg;
59
+ /**
60
+ * An optional arg with one of the specified types
61
+ * @param ptypes
62
+ */
63
+ optional(...ptypes: PTypeOrClass[]): OptionalArg;
64
+ /**
65
+ * An object map arg, if all properties are optional - the arg itself becomes optional
66
+ * @param props A mapping of expected properties to expected ptypes
67
+ */
68
+ obj<T extends Omit<ObjArgSpec, typeof ArgSpecDiscriminator>>(props: T): T & {
69
+ [ArgSpecDiscriminator]: "obj";
70
+ };
71
+ };
72
+ export type ArgSpecFactory = typeof argSpecFactory;
73
+ export declare function parseFunctionArgs<const TGenericCount extends number, const TArgMap extends [...ArgMap[]]>({ args, typeArgs, funcName, callLocation, genericTypeArgs, argSpec, }: {
74
+ /**
75
+ * Raw args array passed to call function
76
+ */
77
+ args: ReadonlyArray<InstanceBuilder>;
78
+ /**
79
+ * Raw typeArgs array passed to call function
80
+ */
81
+ typeArgs: ReadonlyArray<PType>;
82
+ /**
83
+ * The name of the function being called
84
+ * (Used for error context)
85
+ */
86
+ funcName: string;
87
+ /**
88
+ * The location of the call expression in the application source code
89
+ */
90
+ callLocation: SourceLocation;
91
+ /**
92
+ * The expected number of generic type arguments
93
+ */
94
+ genericTypeArgs: TGenericCount;
95
+ /**
96
+ * A mapping of expected argument types
97
+ */
98
+ argSpec: (a: ArgSpecFactory) => TArgMap;
99
+ }): {
100
+ /**
101
+ * A tuple of generic type args with a length of `TGenericCount`
102
+ */
103
+ ptypes: Tuple<PType, TGenericCount>;
104
+ args: ParsedArgs<TArgMap>;
105
+ };
106
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Expression } from '../../../awst/nodes';
2
+ import type { SourceLocation } from '../../../awst/source-location';
3
+ import { BooleanExpressionBuilder } from '../boolean-expression-builder';
4
+ import { BuilderComparisonOp } from '../index';
5
+ export declare function compareBytes(left: Expression, right: Expression, op: BuilderComparisonOp, sourceLocation: SourceLocation, typeDescription: string): BooleanExpressionBuilder;
@@ -0,0 +1,5 @@
1
+ import type { Expression } from '../../../awst/nodes';
2
+ import type { SourceLocation } from '../../../awst/source-location';
3
+ import { BooleanExpressionBuilder } from '../boolean-expression-builder';
4
+ import { BuilderComparisonOp } from '../index';
5
+ export declare function compareUint64(left: Expression, right: Expression, op: BuilderComparisonOp, sourceLocation: SourceLocation, typeDescription: string): BooleanExpressionBuilder;
@@ -0,0 +1,19 @@
1
+ import type { awst, ConstantValue } from '../../../awst';
2
+ import type { Expression } from '../../../awst/nodes';
3
+ import type { SourceLocation } from '../../../awst/source-location';
4
+ import type { PType, PTypeOrClass } from '../../ptypes';
5
+ import type { NodeBuilder } from '../index';
6
+ import { InstanceBuilder } from '../index';
7
+ export declare function requireExpressionOfType(builder: NodeBuilder, ptype: PTypeOrClass): Expression;
8
+ export declare function requireBuilderOfType(builder: NodeBuilder, ptype: PTypeOrClass): InstanceBuilder;
9
+ export declare function resolvableToType(builder: NodeBuilder, ptype: PTypeOrClass): builder is InstanceBuilder;
10
+ export declare function requestExpressionOfType(builder: NodeBuilder, ptype: PTypeOrClass): Expression | undefined;
11
+ export declare function requestBuilderOfType(builder: NodeBuilder, ptype: PTypeOrClass): InstanceBuilder | undefined;
12
+ export declare function requireInstanceBuilder(builder: NodeBuilder): InstanceBuilder;
13
+ export declare function requireExpressionsOfType<const TPTypes extends [...PType[]]>(builders: ReadonlyArray<InstanceBuilder>, ptypes: TPTypes, sourceLocation: SourceLocation): Array<awst.Expression>;
14
+ export declare function requireStringConstant(builder: InstanceBuilder): awst.StringConstant;
15
+ export declare function requireIntegerConstant(builder: InstanceBuilder): awst.IntegerConstant;
16
+ export declare function requireBooleanConstant(builder: InstanceBuilder): awst.BoolConstant;
17
+ export declare function requestConstantOfType(builder: NodeBuilder, ptype: PType): awst.Constant | undefined;
18
+ export declare function requireConstantOfType(builder: NodeBuilder, ptype: PType, messageOverride?: string): awst.Constant;
19
+ export declare function isValidLiteralForPType(literalValue: ConstantValue, ptype: PTypeOrClass): boolean;
@@ -0,0 +1,4 @@
1
+ import type { ConstantValue } from '../../../awst';
2
+ import type { SourceLocation } from '../../../awst/source-location';
3
+ import type { NodeBuilder } from '../index';
4
+ export declare function requireConstantValue(builder: NodeBuilder, sourceLocation: SourceLocation): ConstantValue;
@@ -0,0 +1,7 @@
1
+ import type { Expression, LValue } from '../../awst/nodes';
2
+ import type { InstanceType } from '../ptypes';
3
+ import { InstanceExpressionBuilder } from './index';
4
+ export declare class VoidExpressionBuilder extends InstanceExpressionBuilder<InstanceType> {
5
+ constructor(expr: Expression);
6
+ resolveLValue(): LValue;
7
+ }
@@ -0,0 +1,45 @@
1
+ import ts from 'typescript';
2
+ import type * as awst from '../awst/nodes';
3
+ import type { SourceLocation } from '../awst/source-location';
4
+ import type { Statements } from '../visitor/syntax-names';
5
+ import type { Visitor } from '../visitor/visitor';
6
+ import { BaseVisitor } from './base-visitor';
7
+ import type { AwstBuildContext } from './context/awst-build-context';
8
+ import type { InstanceBuilder } from './eb';
9
+ import { FunctionPType } from './ptypes';
10
+ export declare class FunctionVisitor extends BaseVisitor implements Visitor<ts.ParameterDeclaration, awst.SubroutineArgument>, Visitor<ts.Block, awst.Block>, Visitor<Statements, awst.Statement | awst.Statement[]> {
11
+ protected accept: <TNode extends ts.Node>(node: TNode) => import("../visitor/visitor").MethodReturnType<import("../visitor/visitor").VisitorMethod<import("../visitor/visitor").KindForNode<import("../visitor/syntax-names").MapBaseType<TNode>>>, FunctionVisitor>;
12
+ protected readonly _functionType: FunctionPType;
13
+ constructor(ctx: AwstBuildContext, node: ts.MethodDeclaration | ts.FunctionDeclaration | ts.ConstructorDeclaration);
14
+ protected buildFunctionAwst(node: ts.MethodDeclaration | ts.FunctionDeclaration | ts.ConstructorDeclaration): {
15
+ args: awst.SubroutineArgument[];
16
+ documentation: awst.MethodDocumentation;
17
+ body: awst.Block;
18
+ };
19
+ buildAssignmentTarget(bindingName: ts.BindingName, sourceLocation: SourceLocation): InstanceBuilder;
20
+ evaluateParameterBindingExpressions(parameters: Iterable<ts.ParameterDeclaration>, sourceLocation: SourceLocation): awst.Statement[];
21
+ visitTypeAliasDeclaration(node: ts.TypeAliasDeclaration): awst.Statement[];
22
+ visitClassDeclaration(node: ts.ClassDeclaration): awst.Statement | awst.Statement[];
23
+ visitVariableDeclarationList(node: ts.VariableDeclarationList): awst.Statement[];
24
+ visitVariableStatement(node: ts.VariableStatement): awst.Statement | awst.Statement[];
25
+ visitForStatement(node: ts.ForStatement): awst.Statement | awst.Statement[];
26
+ visitForOfStatement(node: ts.ForOfStatement): awst.Statement | awst.Statement[];
27
+ visitForInStatement(node: ts.ForInStatement): awst.Statement | awst.Statement[];
28
+ visitTryStatement(node: ts.TryStatement): awst.Statement | awst.Statement[];
29
+ visitEmptyStatement(node: ts.EmptyStatement): awst.Statement | awst.Statement[];
30
+ visitExpressionStatement(node: ts.ExpressionStatement): awst.Statement | awst.Statement[];
31
+ visitIfStatement(node: ts.IfStatement): awst.Statement | awst.Statement[];
32
+ visitDoStatement(node: ts.DoStatement): awst.Statement | awst.Statement[];
33
+ visitWhileStatement(node: ts.WhileStatement): awst.Statement | awst.Statement[];
34
+ visitContinueStatement(node: ts.ContinueStatement): awst.Statement | awst.Statement[];
35
+ visitBreakStatement(node: ts.BreakStatement): awst.Statement | awst.Statement[];
36
+ visitReturnStatement(node: ts.ReturnStatement): awst.Statement | awst.Statement[];
37
+ visitWithStatement(node: ts.WithStatement): awst.Statement | awst.Statement[];
38
+ visitSwitchStatement(node: ts.SwitchStatement): awst.Statement | awst.Statement[];
39
+ visitLabeledStatement(node: ts.LabeledStatement): awst.Statement | awst.Statement[];
40
+ visitThrowStatement(node: ts.ThrowStatement): awst.Statement | awst.Statement[];
41
+ visitDebuggerStatement(node: ts.DebuggerStatement): awst.Statement | awst.Statement[];
42
+ visitImportDeclaration(node: ts.ImportDeclaration): awst.Statement | awst.Statement[];
43
+ visitBlock(node: ts.Block): awst.Block;
44
+ visitParameter(node: ts.ParameterDeclaration): awst.SubroutineArgument;
45
+ }
@@ -0,0 +1,5 @@
1
+ import type { CompilationSet } from '../awst/models';
2
+ import type { AWST } from '../awst/nodes';
3
+ import type { CompileOptions } from '../compile-options';
4
+ import type { CreateProgramResult } from '../parser';
5
+ export declare function buildAwst({ program, sourceFiles }: CreateProgramResult, options: CompileOptions): [AWST[], CompilationSet];
@@ -0,0 +1,2 @@
1
+ import type { AWST } from '../../awst/nodes';
2
+ export declare function buildLibAwst(): AWST[];
@@ -0,0 +1,27 @@
1
+ import * as ptypes from './ptypes';
2
+ import type { Expression } from '../awst/nodes';
3
+ export type ImmediateArgMapping = {
4
+ name: string;
5
+ ptypes: ptypes.PType[];
6
+ };
7
+ export type StackArg = {
8
+ name: string;
9
+ ptypes: ptypes.PType[];
10
+ };
11
+ export type Signature = {
12
+ argNames: string[];
13
+ immediateArgs: Array<ImmediateArgMapping | bigint | string>;
14
+ stackArgs: Array<StackArg | Expression>;
15
+ returnType: ptypes.PType;
16
+ };
17
+ export type IntrinsicOpMapping = {
18
+ type: 'op-mapping';
19
+ op: string;
20
+ signatures: Signature[];
21
+ };
22
+ export type IntrinsicOpGrouping = {
23
+ type: 'op-grouping';
24
+ name: string;
25
+ ops: Record<string, IntrinsicOpMapping>;
26
+ };
27
+ export declare const OP_METADATA: Record<string, IntrinsicOpMapping | IntrinsicOpGrouping>;
@@ -0,0 +1,56 @@
1
+ import type { SourceLocation } from '../../awst/source-location';
2
+ import type { ARC4Type } from '../../awst/wtypes';
3
+ import { ARC4DynamicArray, ARC4StaticArray, ARC4UIntN } from '../../awst/wtypes';
4
+ import { PType } from './base';
5
+ import { LibFunctionType } from './index';
6
+ export declare const UintNConstructor: LibFunctionType;
7
+ export declare abstract class ARC4EncodedType extends PType {
8
+ abstract get wtype(): ARC4Type;
9
+ }
10
+ export declare class UintNType extends ARC4EncodedType {
11
+ static baseFullName: string;
12
+ readonly module: "@algorandfoundation/algorand-typescript/arc4/encoded-types.d.ts";
13
+ readonly n: bigint;
14
+ readonly name: string;
15
+ readonly singleton = false;
16
+ get wtype(): ARC4UIntN;
17
+ constructor({ n }: {
18
+ n: bigint;
19
+ });
20
+ static parameterise(typeArgs: PType[]): UintNType;
21
+ getGenericArgs(): PType[];
22
+ }
23
+ export declare const DynamicArrayConstructor: LibFunctionType;
24
+ export declare class DynamicArrayType extends ARC4EncodedType {
25
+ static baseFullName: string;
26
+ readonly module: "@algorandfoundation/algorand-typescript/arc4/encoded-types.d.ts";
27
+ readonly elementType: ARC4EncodedType;
28
+ readonly name: string;
29
+ readonly singleton = false;
30
+ readonly sourceLocation: SourceLocation | undefined;
31
+ get wtype(): ARC4DynamicArray;
32
+ constructor({ elementType, sourceLocation }: {
33
+ elementType: ARC4EncodedType;
34
+ sourceLocation?: SourceLocation;
35
+ });
36
+ static parameterise(typeArgs: PType[]): DynamicArrayType;
37
+ getGenericArgs(): PType[];
38
+ }
39
+ export declare const StaticArrayConstructor: LibFunctionType;
40
+ export declare class StaticArrayType extends ARC4EncodedType {
41
+ static baseFullName: string;
42
+ readonly module: "@algorandfoundation/algorand-typescript/arc4/encoded-types.d.ts";
43
+ readonly elementType: ARC4EncodedType;
44
+ readonly arraySize: bigint;
45
+ readonly name: string;
46
+ readonly singleton = false;
47
+ readonly sourceLocation: SourceLocation | undefined;
48
+ get wtype(): ARC4StaticArray;
49
+ constructor({ elementType, arraySize, sourceLocation, }: {
50
+ elementType: ARC4EncodedType;
51
+ arraySize: bigint;
52
+ sourceLocation?: SourceLocation;
53
+ });
54
+ static parameterise(typeArgs: PType[]): StaticArrayType;
55
+ getGenericArgs(): PType[];
56
+ }
@@ -0,0 +1,31 @@
1
+ import type { wtypes } from '../../awst';
2
+ import type { DeliberateAny } from '../../typescript-helpers';
3
+ /**
4
+ * Represents a public type visible to a developer of AlgoTS
5
+ */
6
+ export declare abstract class PType {
7
+ /**
8
+ * Get the associated wtype for this ptype if applicable
9
+ */
10
+ abstract readonly wtype: wtypes.WType | undefined;
11
+ /**
12
+ * Get the unaliased name of this ptype
13
+ */
14
+ abstract readonly name: string;
15
+ /**
16
+ * Get the declaring module of this ptype
17
+ */
18
+ abstract readonly module: string;
19
+ abstract readonly singleton: boolean;
20
+ get fullName(): string;
21
+ get wtypeOrThrow(): wtypes.WType;
22
+ equals(other: PType): boolean;
23
+ static equals(other: PType): boolean;
24
+ equalsOrInstanceOf(other: PTypeOrClass): boolean;
25
+ toString(): string;
26
+ getGenericArgs(): PType[];
27
+ }
28
+ export type PTypeOrClass = PType | {
29
+ new (...args: DeliberateAny[]): PType;
30
+ equals(other: PType): boolean;
31
+ };