@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,21 @@
1
+ import type ts from 'typescript';
2
+ export declare class SourceLocation {
3
+ file: string;
4
+ line: number;
5
+ endLine: number;
6
+ column: number;
7
+ endColumn: number;
8
+ constructor(props: {
9
+ file: string;
10
+ line: number;
11
+ endLine: number;
12
+ column: number;
13
+ endColumn: number;
14
+ });
15
+ static fromNode(sourceFile: ts.SourceFile, node: ts.Node, programDirectory: string): SourceLocation;
16
+ static fromFile(sourceFile: ts.SourceFile, programDirectory: string): SourceLocation;
17
+ static fromTextRange(sourceFile: ts.SourceFile, textRange: ts.TextRange, programDirectory: string): SourceLocation;
18
+ static fromDiagnostic(diagnostic: ts.DiagnosticWithLocation, programDirectory: string): SourceLocation;
19
+ toString(): string;
20
+ static fromLocations(...sourceLocation: SourceLocation[]): SourceLocation;
21
+ }
@@ -0,0 +1,87 @@
1
+ import type { AppStorageDefinition, ContractMemberNodeVisitor, ExpressionVisitor, RootNodeVisitor, StatementVisitor } from './nodes';
2
+ import * as nodes from './nodes';
3
+ export declare class ToCodeVisitor implements RootNodeVisitor<string[]>, ContractMemberNodeVisitor<string[]>, StatementVisitor<string[]>, ExpressionVisitor<string> {
4
+ #private;
5
+ visitRange(expression: nodes.Range): string;
6
+ visitVoidConstant(expression: nodes.VoidConstant): string;
7
+ visitGroupTransactionReference(expression: nodes.GroupTransactionReference): string;
8
+ visitPuyaLibCall(expression: nodes.PuyaLibCall): string;
9
+ visitARC4Router(expression: nodes.ARC4Router): string;
10
+ visitAppStorageDefinition(contractMemberNode: AppStorageDefinition): string[];
11
+ visitUInt64PostfixUnaryOperation(expression: nodes.UInt64PostfixUnaryOperation): string;
12
+ visitBigUIntPostfixUnaryOperation(expression: nodes.BigUIntPostfixUnaryOperation): string;
13
+ visitCompiledContract(expression: nodes.CompiledContract): string;
14
+ visitCompiledLogicSig(expression: nodes.CompiledLogicSig): string;
15
+ visitLoopExit(statement: nodes.LoopExit): string[];
16
+ visitLoopContinue(statement: nodes.LoopContinue): string[];
17
+ visitGoto(statement: nodes.Goto): string[];
18
+ visitIntersectionSliceExpression(expression: nodes.IntersectionSliceExpression): string;
19
+ visitBoxValueExpression(expression: nodes.BoxValueExpression): string;
20
+ visitIntegerConstant(expression: nodes.IntegerConstant): string;
21
+ visitDecimalConstant(expression: nodes.DecimalConstant): string;
22
+ visitBoolConstant(expression: nodes.BoolConstant): string;
23
+ visitBytesConstant(expression: nodes.BytesConstant): string;
24
+ visitStringConstant(expression: nodes.StringConstant): string;
25
+ visitTemplateVar(expression: nodes.TemplateVar): string;
26
+ visitMethodConstant(expression: nodes.MethodConstant): string;
27
+ visitAddressConstant(expression: nodes.AddressConstant): string;
28
+ visitARC4Encode(expression: nodes.ARC4Encode): string;
29
+ visitCopy(expression: nodes.Copy): string;
30
+ visitArrayConcat(expression: nodes.ArrayConcat): string;
31
+ visitArrayPop(expression: nodes.ArrayPop): string;
32
+ visitArrayExtend(expression: nodes.ArrayExtend): string;
33
+ visitARC4Decode(expression: nodes.ARC4Decode): string;
34
+ visitIntrinsicCall(expression: nodes.IntrinsicCall): string;
35
+ visitCreateInnerTransaction(expression: nodes.CreateInnerTransaction): string;
36
+ visitUpdateInnerTransaction(expression: nodes.UpdateInnerTransaction): string;
37
+ visitCheckedMaybe(expression: nodes.CheckedMaybe): string;
38
+ visitTupleExpression(expression: nodes.TupleExpression): string;
39
+ visitTupleItemExpression(expression: nodes.TupleItemExpression): string;
40
+ visitVarExpression(expression: nodes.VarExpression): string;
41
+ visitInnerTransactionField(expression: nodes.InnerTransactionField): string;
42
+ visitSubmitInnerTransaction(expression: nodes.SubmitInnerTransaction): string;
43
+ visitFieldExpression(expression: nodes.FieldExpression): string;
44
+ visitIndexExpression(expression: nodes.IndexExpression): string;
45
+ visitSliceExpression(expression: nodes.SliceExpression): string;
46
+ visitAppStateExpression(expression: nodes.AppStateExpression): string;
47
+ visitAppAccountStateExpression(expression: nodes.AppAccountStateExpression): string;
48
+ visitSingleEvaluation(expression: nodes.SingleEvaluation): string;
49
+ visitReinterpretCast(expression: nodes.ReinterpretCast): string;
50
+ visitNewArray(expression: nodes.NewArray): string;
51
+ visitConditionalExpression(expression: nodes.ConditionalExpression): string;
52
+ visitAssignmentExpression(expression: nodes.AssignmentExpression): string;
53
+ visitNumericComparisonExpression(expression: nodes.NumericComparisonExpression): string;
54
+ visitBytesComparisonExpression(expression: nodes.BytesComparisonExpression): string;
55
+ visitSubroutineCallExpression(expression: nodes.SubroutineCallExpression): string;
56
+ visitCallTarget(target: nodes.SubroutineCallExpression['target']): string;
57
+ visitUInt64UnaryOperation(expression: nodes.UInt64UnaryOperation): string;
58
+ visitBytesUnaryOperation(expression: nodes.BytesUnaryOperation): string;
59
+ visitUInt64BinaryOperation(expression: nodes.UInt64BinaryOperation): string;
60
+ visitBigUIntBinaryOperation(expression: nodes.BigUIntBinaryOperation): string;
61
+ visitBytesBinaryOperation(expression: nodes.BytesBinaryOperation): string;
62
+ visitBooleanBinaryOperation(expression: nodes.BooleanBinaryOperation): string;
63
+ visitNot(expression: nodes.Not): string;
64
+ visitEnumeration(expression: nodes.Enumeration): string;
65
+ visitReversed(expression: nodes.Reversed): string;
66
+ visitStateGet(expression: nodes.StateGet): string;
67
+ visitStateDelete(expression: nodes.StateDelete): string;
68
+ visitStateGetEx(expression: nodes.StateGetEx): string;
69
+ visitStateExists(expression: nodes.StateExists): string;
70
+ visitNewStruct(expression: nodes.NewStruct): string;
71
+ visitExpressionStatement(statement: nodes.ExpressionStatement): string[];
72
+ visitBlock(statement: nodes.Block): string[];
73
+ visitIfElse(statement: nodes.IfElse): string[];
74
+ visitSwitch(statement: nodes.Switch): string[];
75
+ visitWhileLoop(statement: nodes.WhileLoop): string[];
76
+ visitReturnStatement(statement: nodes.ReturnStatement): string[];
77
+ visitAssignmentStatement(statement: nodes.AssignmentStatement): string[];
78
+ visitUInt64AugmentedAssignment(statement: nodes.UInt64AugmentedAssignment): string[];
79
+ visitBigUIntAugmentedAssignment(statement: nodes.BigUIntAugmentedAssignment): string[];
80
+ visitBytesAugmentedAssignment(statement: nodes.BytesAugmentedAssignment): string[];
81
+ visitForInLoop(statement: nodes.ForInLoop): string[];
82
+ visitSubroutine(moduleStatement: nodes.Subroutine): string[];
83
+ visitContractMethod(statement: nodes.ContractMethod): string[];
84
+ visitLogicSignature(moduleStatement: nodes.LogicSignature): string[];
85
+ visitContractFragment(c: nodes.ContractFragment): string[];
86
+ visitSpecialMethod(statement: nodes.ContractMethod, name: string): string[];
87
+ }
@@ -0,0 +1,84 @@
1
+ import { wtypes } from './index';
2
+ export declare class TxnFieldData {
3
+ readonly immediate: string;
4
+ readonly wtype: wtypes.WType;
5
+ readonly numValues: number;
6
+ readonly isInnerParam: boolean;
7
+ constructor(data: {
8
+ field: TxnField;
9
+ wtype: wtypes.WType;
10
+ numValues?: number;
11
+ isInnerParam?: boolean;
12
+ });
13
+ }
14
+ export declare enum TxnField {
15
+ Sender = "Sender",
16
+ Fee = "Fee",
17
+ FirstValid = "FirstValid",
18
+ FirstValidTime = "FirstValidTime",
19
+ LastValid = "LastValid",
20
+ Note = "Note",
21
+ Lease = "Lease",
22
+ Receiver = "Receiver",
23
+ Amount = "Amount",
24
+ CloseRemainderTo = "CloseRemainderTo",
25
+ VotePK = "VotePK",
26
+ SelectionPK = "SelectionPK",
27
+ VoteFirst = "VoteFirst",
28
+ VoteLast = "VoteLast",
29
+ VoteKeyDilution = "VoteKeyDilution",
30
+ Type = "Type",
31
+ TypeEnum = "TypeEnum",
32
+ XferAsset = "XferAsset",
33
+ AssetAmount = "AssetAmount",
34
+ AssetSender = "AssetSender",
35
+ AssetReceiver = "AssetReceiver",
36
+ AssetCloseTo = "AssetCloseTo",
37
+ GroupIndex = "GroupIndex",
38
+ TxID = "TxID",
39
+ ApplicationID = "ApplicationID",
40
+ OnCompletion = "OnCompletion",
41
+ NumAppArgs = "NumAppArgs",
42
+ NumAccounts = "NumAccounts",
43
+ ApprovalProgram = "ApprovalProgram",
44
+ ClearStateProgram = "ClearStateProgram",
45
+ RekeyTo = "RekeyTo",
46
+ ConfigAsset = "ConfigAsset",
47
+ ConfigAssetTotal = "ConfigAssetTotal",
48
+ ConfigAssetDecimals = "ConfigAssetDecimals",
49
+ ConfigAssetDefaultFrozen = "ConfigAssetDefaultFrozen",
50
+ ConfigAssetUnitName = "ConfigAssetUnitName",
51
+ ConfigAssetName = "ConfigAssetName",
52
+ ConfigAssetURL = "ConfigAssetURL",
53
+ ConfigAssetMetadataHash = "ConfigAssetMetadataHash",
54
+ ConfigAssetManager = "ConfigAssetManager",
55
+ ConfigAssetReserve = "ConfigAssetReserve",
56
+ ConfigAssetFreeze = "ConfigAssetFreeze",
57
+ ConfigAssetClawback = "ConfigAssetClawback",
58
+ FreezeAsset = "FreezeAsset",
59
+ FreezeAssetAccount = "FreezeAssetAccount",
60
+ FreezeAssetFrozen = "FreezeAssetFrozen",
61
+ NumAssets = "NumAssets",
62
+ NumApplications = "NumApplications",
63
+ GlobalNumUint = "GlobalNumUint",
64
+ GlobalNumByteSlice = "GlobalNumByteSlice",
65
+ LocalNumUint = "LocalNumUint",
66
+ LocalNumByteSlice = "LocalNumByteSlice",
67
+ ExtraProgramPages = "ExtraProgramPages",
68
+ Nonparticipation = "Nonparticipation",
69
+ NumLogs = "NumLogs",
70
+ CreatedAssetID = "CreatedAssetID",
71
+ CreatedApplicationID = "CreatedApplicationID",
72
+ LastLog = "LastLog",
73
+ StateProofPK = "StateProofPK",
74
+ NumApprovalProgramPages = "NumApprovalProgramPages",
75
+ NumClearStateProgramPages = "NumClearStateProgramPages",
76
+ ApplicationArgs = "ApplicationArgs",
77
+ Accounts = "Accounts",
78
+ Assets = "Assets",
79
+ Applications = "Applications",
80
+ Logs = "Logs",
81
+ ApprovalProgramPages = "ApprovalProgramPages",
82
+ ClearStateProgramPages = "ClearStateProgramPages"
83
+ }
84
+ export declare const TxnFields: Record<TxnField, TxnFieldData>;
package/awst/util.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { Constant, Expression } from './nodes';
2
+ export declare function isConstant(expr: Expression): expr is Constant;
@@ -0,0 +1,131 @@
1
+ import { TransactionKind } from './models';
2
+ import type { SourceLocation } from './source-location';
3
+ export declare enum AVMType {
4
+ bytes = 1,
5
+ uint64 = 2,
6
+ any = 3
7
+ }
8
+ export declare class WType {
9
+ constructor(props: {
10
+ name: string;
11
+ immutable?: boolean;
12
+ scalarType: AVMType | null;
13
+ ephemeral?: boolean;
14
+ });
15
+ readonly name: string;
16
+ readonly immutable: boolean;
17
+ /**
18
+ * ephemeral types are not suitable for naive storage / persistence,
19
+ * even if their underlying type is a simple stack value
20
+ */
21
+ readonly ephemeral: boolean;
22
+ /**
23
+ * The AVM stack type of this type (if any)
24
+ */
25
+ readonly scalarType: AVMType | null;
26
+ equals(other: WType): boolean;
27
+ toString(): string;
28
+ get id(): string;
29
+ }
30
+ export declare const voidWType: WType;
31
+ export declare const boolWType: WType;
32
+ export declare const uint64WType: WType;
33
+ export declare const uint64RangeWType: WType;
34
+ export declare const bytesWType: WType;
35
+ export declare const stateKeyWType: WType;
36
+ export declare const boxKeyWType: WType;
37
+ export declare const stringWType: WType;
38
+ export declare const biguintWType: WType;
39
+ export declare const assetWType: WType;
40
+ export declare const accountWType: WType;
41
+ export declare const applicationWType: WType;
42
+ export declare abstract class ARC4Type extends WType {
43
+ readonly decodeType: WType | null;
44
+ readonly arc4Name: string;
45
+ readonly otherEncodeableTypes: WType[];
46
+ constructor({ decodeType, arc4Name, otherEncodeableTypes, ...rest }: {
47
+ decodeType: WType | null;
48
+ arc4Name: string;
49
+ otherEncodeableTypes: WType[];
50
+ name: string;
51
+ immutable?: boolean;
52
+ scalarType: AVMType | null;
53
+ ephemeral?: boolean;
54
+ });
55
+ }
56
+ export declare class WStructType extends WType {
57
+ }
58
+ export declare class WTuple extends WType {
59
+ types: WType[];
60
+ constructor(props: {
61
+ types: WType[];
62
+ immutable?: boolean;
63
+ });
64
+ toString(): string;
65
+ }
66
+ export declare class WArray extends WType {
67
+ readonly itemType: WType;
68
+ constructor(props: {
69
+ itemType: WType;
70
+ immutable: boolean;
71
+ });
72
+ }
73
+ export declare class WEnumeration extends WType {
74
+ readonly sequenceType: WType;
75
+ constructor(props: {
76
+ sequenceType: WType;
77
+ });
78
+ }
79
+ export declare class WGroupTransaction extends WType {
80
+ transactionType: TransactionKind | null;
81
+ constructor({ transactionType }: {
82
+ transactionType?: TransactionKind;
83
+ });
84
+ }
85
+ export declare class WInnerTransaction extends WType {
86
+ transactionType: TransactionKind | null;
87
+ constructor({ transactionType }: {
88
+ transactionType?: TransactionKind;
89
+ });
90
+ }
91
+ export declare class WInnerTransactionFields extends WType {
92
+ transactionType: TransactionKind | null;
93
+ constructor({ transactionType }: {
94
+ transactionType?: TransactionKind;
95
+ });
96
+ }
97
+ export declare class ARC4UIntN extends ARC4Type {
98
+ readonly n: bigint;
99
+ constructor({ n }: {
100
+ n: bigint;
101
+ });
102
+ }
103
+ export declare class ARC4UFixedNxM extends ARC4Type {
104
+ }
105
+ export declare class ARC4Struct extends ARC4Type {
106
+ }
107
+ export declare abstract class ARC4Array extends ARC4Type {
108
+ readonly elementType: ARC4Type;
109
+ protected constructor(props: {
110
+ arc4Name: string;
111
+ otherEncodeableTypes: WType[];
112
+ name: string;
113
+ elementType: ARC4Type;
114
+ });
115
+ }
116
+ export declare class ARC4DynamicArray extends ARC4Array {
117
+ readonly sourceLocation: SourceLocation | null;
118
+ constructor({ elementType, sourceLocation }: {
119
+ elementType: ARC4Type;
120
+ sourceLocation?: SourceLocation;
121
+ });
122
+ }
123
+ export declare class ARC4StaticArray extends ARC4Array {
124
+ readonly sourceLocation: SourceLocation | null;
125
+ readonly arraySize: bigint;
126
+ constructor({ elementType, sourceLocation, arraySize }: {
127
+ arraySize: bigint;
128
+ elementType: ARC4Type;
129
+ sourceLocation?: SourceLocation;
130
+ });
131
+ }
@@ -0,0 +1,87 @@
1
+ import ts from 'typescript';
2
+ import type { Expression, LValue, Statement } from '../awst/nodes';
3
+ import type { SourceLocation } from '../awst/source-location';
4
+ import type { Expressions } from '../visitor/syntax-names';
5
+ import type { Visitor } from '../visitor/visitor';
6
+ import type { AwstBuildContext } from './context/awst-build-context';
7
+ import type { InstanceBuilder } from './eb';
8
+ import { NodeBuilder } from './eb';
9
+ import type { PType } from './ptypes';
10
+ import { TextVisitor } from './text-visitor';
11
+ export declare abstract class BaseVisitor implements Visitor<Expressions, NodeBuilder> {
12
+ context: AwstBuildContext;
13
+ private baseAccept;
14
+ readonly textVisitor: TextVisitor;
15
+ protected constructor(context: AwstBuildContext);
16
+ logNotSupported(node: ts.Node | undefined, message: string): void;
17
+ throwNotSupported(node: ts.Node, message: string): never;
18
+ visitBigIntLiteral(node: ts.BigIntLiteral): InstanceBuilder;
19
+ visitRegularExpressionLiteral(node: ts.RegularExpressionLiteral): InstanceBuilder;
20
+ visitFalseKeyword(node: ts.FalseLiteral): InstanceBuilder;
21
+ visitTrueKeyword(node: ts.TrueLiteral): InstanceBuilder;
22
+ sourceLocation(node: ts.Node): SourceLocation;
23
+ visitStringLiteral(node: ts.StringLiteral): InstanceBuilder;
24
+ visitNoSubstitutionTemplateLiteral(node: ts.NoSubstitutionTemplateLiteral): InstanceBuilder;
25
+ visitNumericLiteral(node: ts.NumericLiteral): InstanceBuilder;
26
+ visitIdentifier(node: ts.Identifier): NodeBuilder;
27
+ visitImportKeyword(node: ts.ImportExpression): NodeBuilder;
28
+ visitNullKeyword(node: ts.NullLiteral): NodeBuilder;
29
+ visitPrivateIdentifier(node: ts.PrivateIdentifier): NodeBuilder;
30
+ visitSuperKeyword(node: ts.SuperExpression): NodeBuilder;
31
+ visitThisKeyword(node: ts.ThisExpression): NodeBuilder;
32
+ visitFunctionExpression(node: ts.FunctionExpression): NodeBuilder;
33
+ visitClassExpression(node: ts.ClassExpression): NodeBuilder;
34
+ visitObjectLiteralExpression(node: ts.ObjectLiteralExpression): NodeBuilder;
35
+ visitArrayLiteralExpression(node: ts.ArrayLiteralExpression): NodeBuilder;
36
+ visitPropertyAccessExpression(node: ts.PropertyAccessExpression): NodeBuilder;
37
+ visitElementAccessExpression(node: ts.ElementAccessExpression): NodeBuilder;
38
+ visitCallExpression(node: ts.CallExpression): NodeBuilder;
39
+ visitNewExpression(node: ts.NewExpression): NodeBuilder;
40
+ visitTaggedTemplateExpression(node: ts.TaggedTemplateExpression): NodeBuilder;
41
+ visitTypeAssertionExpression(node: ts.TypeAssertion): NodeBuilder;
42
+ visitParenthesizedExpression(node: ts.ParenthesizedExpression): NodeBuilder;
43
+ /**
44
+ * `delete obj.prop`
45
+ *
46
+ * Not supported currently as typescript requires 'prop' to be optional and we don't support optional values
47
+ */
48
+ visitDeleteExpression(node: ts.DeleteExpression): NodeBuilder;
49
+ visitTypeOfExpression(node: ts.TypeOfExpression): NodeBuilder;
50
+ visitVoidExpression(node: ts.VoidExpression): NodeBuilder;
51
+ visitAwaitExpression(node: ts.AwaitExpression): NodeBuilder;
52
+ visitPrefixUnaryExpression(node: ts.PrefixUnaryExpression): NodeBuilder;
53
+ visitPostfixUnaryExpression(node: ts.PostfixUnaryExpression): NodeBuilder;
54
+ evaluateCondition(nodeOrBuilder: ts.Expression | NodeBuilder, negate?: boolean): Expression;
55
+ visitBinaryExpression(node: ts.BinaryExpression): NodeBuilder;
56
+ visitConditionalExpression(node: ts.ConditionalExpression): NodeBuilder;
57
+ createConditionalExpression({ condition, ptype, whenFalse, whenTrue, sourceLocation, }: {
58
+ ptype: PType;
59
+ condition: Expression;
60
+ whenTrue: InstanceBuilder;
61
+ whenFalse: InstanceBuilder;
62
+ sourceLocation: SourceLocation;
63
+ }): InstanceBuilder;
64
+ visitTemplateExpression(node: ts.TemplateExpression): NodeBuilder;
65
+ visitYieldExpression(node: ts.YieldExpression): NodeBuilder;
66
+ visitOmittedExpression(node: ts.OmittedExpression): NodeBuilder;
67
+ visitExpressionWithTypeArguments(node: ts.ExpressionWithTypeArguments): NodeBuilder;
68
+ visitAsExpression(node: ts.AsExpression): NodeBuilder;
69
+ visitNonNullExpression(node: ts.NonNullExpression): NodeBuilder;
70
+ visitSatisfiesExpression(node: ts.SatisfiesExpression): NodeBuilder;
71
+ handleAssignmentStatement(target: InstanceBuilder, source: InstanceBuilder, sourceLocation: SourceLocation): Statement;
72
+ handleAssignment(target: InstanceBuilder, source: InstanceBuilder, sourceLocation: SourceLocation): InstanceBuilder;
73
+ /**
74
+ * Given a target and source type, produce a type that represents the result of an assignment expression.
75
+ *
76
+ * This will largely represent the sourceType verbatim with the exception of numeric literal types which need
77
+ * to be narrowed using the targetType.
78
+ *
79
+ * Eg. a `number` on the rhs should be narrowed to whatever the lhs is for example uint64.
80
+ * @param targetType The type of the assignment target
81
+ * @param sourceType The type of the assignment source
82
+ * @param sourceLocation
83
+ * @private
84
+ */
85
+ private buildAssignmentExpressionType;
86
+ buildLValue(target: InstanceBuilder, assignmentType: PType, sourceLocation: SourceLocation): LValue;
87
+ }
@@ -0,0 +1,18 @@
1
+ import ts from 'typescript';
2
+ import type { ContractReference } from '../awst/models';
3
+ import * as awst from '../awst/nodes';
4
+ import type { AwstBuildContext } from './context/awst-build-context';
5
+ import { ContractMethodBaseVisitor } from './contract-method-visitor';
6
+ export interface ConstructorInfo {
7
+ propertyInitializerStatements: awst.Statement[];
8
+ cref: ContractReference;
9
+ }
10
+ export declare class ConstructorVisitor extends ContractMethodBaseVisitor {
11
+ private readonly _result;
12
+ private _foundSuperCall;
13
+ private readonly _propertyInitializerStatements;
14
+ constructor(ctx: AwstBuildContext, node: ts.ConstructorDeclaration, contractInfo: ConstructorInfo);
15
+ get result(): awst.ContractMethod;
16
+ static buildConstructor(parentCtx: AwstBuildContext, node: ts.ConstructorDeclaration, constructorMethodInfo: ConstructorInfo): awst.ContractMethod;
17
+ visitBlock(node: ts.Block): awst.Block;
18
+ }
@@ -0,0 +1,72 @@
1
+ import ts from 'typescript';
2
+ import type { awst } from '../../awst';
3
+ import type { CompilationSet, ContractReference, LogicSigReference } from '../../awst/models';
4
+ import type { AppStorageDefinition } from '../../awst/nodes';
5
+ import { SourceLocation } from '../../awst/source-location';
6
+ import type { AppStorageDeclaration } from '../contract-data';
7
+ import type { NodeBuilder } from '../eb';
8
+ import type { ContractClassPType, PType } from '../ptypes';
9
+ import { EvaluationContext } from './evaluation-context';
10
+ import { SwitchLoopContext } from './switch-loop-context';
11
+ export interface AwstBuildContext {
12
+ /**
13
+ * Get the source location of a node in the current source file
14
+ * @param node
15
+ */
16
+ getSourceLocation(node: ts.Node): SourceLocation;
17
+ /**
18
+ * Get NodeBuilder instance for the given identifier.
19
+ * @param node
20
+ */
21
+ getBuilderForNode(node: ts.Identifier): NodeBuilder;
22
+ /**
23
+ * Reflect the PType of the given node
24
+ * @param node
25
+ */
26
+ getPTypeForNode(node: ts.Node): PType;
27
+ /**
28
+ * Reflect generic type parameters for a call expression
29
+ * @param node
30
+ */
31
+ getTypeParameters(node: ts.CallExpression): PType[];
32
+ /**
33
+ * Resolve the given identifier to a unique variable name that accounts
34
+ * for shadowed variable names.
35
+ * @param node
36
+ */
37
+ resolveVariableName(node: ts.Identifier): string;
38
+ /**
39
+ * Resolve the given parameter declaration to a unique parameter name to be used
40
+ * in destructuring assignments where no explicit parameter name is available.
41
+ * @param node
42
+ */
43
+ resolveDestructuredParamName(node: ts.ParameterDeclaration): string;
44
+ /**
45
+ * Generate a unique variable name for a discarded value.
46
+ */
47
+ generateDiscardedVarName(): string;
48
+ /**
49
+ * Add a named constant to the current context
50
+ * @param name The unique name of the constant declaration in this source file
51
+ * @param value The compile time constant value
52
+ */
53
+ addConstant(name: string, value: awst.Constant): void;
54
+ /**
55
+ * Retrieve the evaluation context
56
+ */
57
+ get evaluationCtx(): EvaluationContext;
58
+ /**
59
+ * Retrieve the switch loop context
60
+ */
61
+ get switchLoopCtx(): SwitchLoopContext;
62
+ /**
63
+ * Create a child context from this context. Used when entering a child parsing context such as a class or function.
64
+ */
65
+ createChildContext(): AwstBuildContext;
66
+ addStorageDeclaration(declaration: AppStorageDeclaration): void;
67
+ getStorageDeclaration(contractType: ContractClassPType, memberName: string): AppStorageDeclaration | undefined;
68
+ getStorageDefinitionsForContract(contractType: ContractClassPType): Map<string, AppStorageDefinition>;
69
+ addToCompilationSet(compilationTarget: ContractReference | LogicSigReference): void;
70
+ get compilationSet(): CompilationSet;
71
+ }
72
+ export declare function buildContextForProgram(program: ts.Program): AwstBuildContext;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Tracks the context in which expressions should be evaluated.
3
+ *
4
+ * A boolean context is more lenient with mixed expression types as it is only concerned with truthy-ness
5
+ */
6
+ export declare class EvaluationContext {
7
+ #private;
8
+ get isBoolean(): boolean;
9
+ enterBooleanContext(): Disposable;
10
+ leaveBooleanContext(): Disposable;
11
+ }
@@ -0,0 +1,31 @@
1
+ import ts from 'typescript';
2
+ import type { Block, Goto } from '../../awst/nodes';
3
+ import type { SourceLocation } from '../../awst/source-location';
4
+ type LoopContext = Disposable & {
5
+ breakTarget: Block;
6
+ continueTarget: Block;
7
+ readonly hasBreaks: boolean;
8
+ readonly hasContinues: boolean;
9
+ };
10
+ type SwitchContext = Disposable & {
11
+ breakTarget: Block;
12
+ caseTarget(caseIndex: number, sourceLocation: SourceLocation): Block;
13
+ gotoCase(caseIndex: number, sourceLocation: SourceLocation): Goto;
14
+ readonly hasBreaks: boolean;
15
+ };
16
+ /**
17
+ * Tracks parent switches and loops so that break and continue statements
18
+ * can target the correct parent.
19
+ */
20
+ export declare class SwitchLoopContext {
21
+ private labelCount;
22
+ private unlabelledCount;
23
+ constructor();
24
+ private switchLoopStack;
25
+ getBreakTarget(label: ts.Identifier | undefined, sourceLocation: SourceLocation): string;
26
+ getContinueTarget(label: ts.Identifier | undefined, sourceLocation: SourceLocation): string;
27
+ enterLoop(node: ts.WhileStatement | ts.ForStatement | ts.ForOfStatement | ts.ForInStatement | ts.DoStatement, sourceLocation: SourceLocation): LoopContext;
28
+ private uniqueNameForLabel;
29
+ enterSwitch(node: ts.SwitchStatement, sourceLocation: SourceLocation): SwitchContext;
30
+ }
31
+ export {};
@@ -0,0 +1,14 @@
1
+ import type ts from 'typescript';
2
+ export declare class UniqueNameResolver {
3
+ protected readonly symbolToName: Map<ts.Symbol, string>;
4
+ protected readonly nameToCount: Map<string, number>;
5
+ constructor(parent?: UniqueNameResolver);
6
+ /**
7
+ * Resolve a rawName to a unique name within the scope of this resolver. When provided
8
+ * with a symbol which has already been seen, return the same name
9
+ * @param rawName
10
+ * @param symbol
11
+ */
12
+ resolveUniqueName(rawName: string, symbol: ts.Symbol | undefined): string;
13
+ createChild(): UniqueNameResolver;
14
+ }
@@ -0,0 +1,24 @@
1
+ import type { AppStorageDefinition, BytesConstant } from '../awst/nodes';
2
+ import { AppStorageKind } from '../awst/nodes';
3
+ import type { SourceLocation } from '../awst/source-location';
4
+ import type { ContractClassPType, StorageProxyPType } from './ptypes';
5
+ import { BoxMapPType, BoxPType, BoxRefPType, GlobalStateType, LocalStateType } from './ptypes';
6
+ export declare class AppStorageDeclaration {
7
+ readonly memberName: string;
8
+ readonly ptype: GlobalStateType | LocalStateType | BoxMapPType | BoxPType | BoxRefPType;
9
+ readonly keyOverride: BytesConstant | null;
10
+ readonly sourceLocation: SourceLocation;
11
+ readonly definedIn: ContractClassPType;
12
+ readonly description: string | null;
13
+ constructor(props: {
14
+ memberName: string;
15
+ ptype: StorageProxyPType;
16
+ keyOverride: BytesConstant | null;
17
+ sourceLocation: SourceLocation;
18
+ definedIn: ContractClassPType;
19
+ description: string | null;
20
+ });
21
+ get kind(): AppStorageKind;
22
+ get key(): BytesConstant;
23
+ get definition(): AppStorageDefinition;
24
+ }
@@ -0,0 +1,20 @@
1
+ import type ts from 'typescript';
2
+ import type { ContractReference } from '../awst/models';
3
+ import * as awst from '../awst/nodes';
4
+ import type { AwstBuildContext } from './context/awst-build-context';
5
+ import type { NodeBuilder } from './eb';
6
+ import { FunctionVisitor } from './function-visitor';
7
+ export type ContractMethodInfo = {
8
+ cref: ContractReference;
9
+ arc4MethodConfig?: awst.ContractMethod['arc4MethodConfig'];
10
+ };
11
+ export declare class ContractMethodBaseVisitor extends FunctionVisitor {
12
+ visitSuperKeyword(node: ts.SuperExpression): NodeBuilder;
13
+ visitThisKeyword(node: ts.ThisExpression): NodeBuilder;
14
+ }
15
+ export declare class ContractMethodVisitor extends ContractMethodBaseVisitor {
16
+ private readonly _result;
17
+ constructor(ctx: AwstBuildContext, node: ts.MethodDeclaration, contractInfo: ContractMethodInfo);
18
+ get result(): awst.ContractMethod;
19
+ static buildContractMethod(parentCtx: AwstBuildContext, node: ts.MethodDeclaration, contractMethodInfo: ContractMethodInfo): awst.ContractMethod;
20
+ }
@@ -0,0 +1,33 @@
1
+ import ts from 'typescript';
2
+ import type * as awst from '../awst/nodes';
3
+ import { ContractFragment } from '../awst/nodes';
4
+ import type { ClassElements } 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
+ export declare class ContractVisitor extends BaseVisitor implements Visitor<ClassElements, void> {
9
+ private _ctor?;
10
+ private _subroutines;
11
+ private _approvalProgram;
12
+ private _clearStateProgram;
13
+ private _className;
14
+ private _contractPType;
15
+ private readonly _propertyInitialization;
16
+ readonly result: ContractFragment;
17
+ 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>>>, ContractVisitor>;
18
+ constructor(ctx: AwstBuildContext, classDec: ts.ClassDeclaration);
19
+ private acceptAndIgnoreBuildErrors;
20
+ private makeDefaultConstructor;
21
+ private getBaseContracts;
22
+ visitClassStaticBlockDeclaration(node: ts.ClassStaticBlockDeclaration): void;
23
+ visitConstructor(node: ts.ConstructorDeclaration): void;
24
+ visitGetAccessor(node: ts.GetAccessorDeclaration): void;
25
+ visitIndexSignature(node: ts.IndexSignatureDeclaration): void;
26
+ private buildDefaultArgument;
27
+ private buildArc4Config;
28
+ visitMethodDeclaration(node: ts.MethodDeclaration): void;
29
+ visitPropertyDeclaration(node: ts.PropertyDeclaration): void;
30
+ visitSemicolonClassElement(node: ts.SemicolonClassElement): void;
31
+ visitSetAccessor(node: ts.SetAccessorDeclaration): void;
32
+ static buildContract(ctx: AwstBuildContext, classDec: ts.ClassDeclaration): awst.ContractFragment;
33
+ }