@algorandfoundation/puya-ts 1.2.0-beta.4 → 1.2.0-beta.41

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 (111) hide show
  1. package/README.md +7 -5
  2. package/{analyser-service-_vXhzOY0.js → analyser-service-DRDPe9MV.js} +45 -8
  3. package/analyser-service-DRDPe9MV.js.map +1 -0
  4. package/analyserService.mjs +7 -6
  5. package/analyserService.mjs.map +1 -1
  6. package/arc4-clientgen-sFEhO2LJ.js +324 -0
  7. package/arc4-clientgen-sFEhO2LJ.js.map +1 -0
  8. package/arc4-clientgen.d.ts +6 -0
  9. package/awst/intrinsic-factory.d.ts +4 -2
  10. package/awst/json-serialize-awst.d.ts +0 -1
  11. package/awst/node-factory.d.ts +1 -0
  12. package/awst/nodes.d.ts +26 -15
  13. package/awst/source-location.d.ts +0 -1
  14. package/awst/to-code-visitor.d.ts +3 -2
  15. package/awst/validation/arc4-approval-calls-router.d.ts +1 -1
  16. package/awst/validation/{awst-traverser.d.ts → function-traverser.d.ts} +4 -10
  17. package/awst/wtypes.d.ts +47 -45
  18. package/awst_build/arc4-util.d.ts +1 -38
  19. package/awst_build/ast-visitors/base-visitor.d.ts +0 -1
  20. package/awst_build/ast-visitors/class-definition-visitor.d.ts +721 -1
  21. package/awst_build/ast-visitors/contract-method-visitor.d.ts +3 -5
  22. package/awst_build/ast-visitors/function-visitor.d.ts +721 -1
  23. package/awst_build/ast-visitors/text-visitor.d.ts +721 -1
  24. package/awst_build/context/awst-build-context.d.ts +1 -1
  25. package/awst_build/eb/arc28/arc-28-emit-function-builder.d.ts +1 -2
  26. package/awst_build/eb/arc4/arrays.d.ts +2 -1
  27. package/awst_build/eb/arc4/c2c.d.ts +0 -17
  28. package/awst_build/eb/arc4/uintn.d.ts +1 -1
  29. package/awst_build/eb/arc4/util.d.ts +1 -0
  30. package/awst_build/eb/array-like/arrays.d.ts +3 -2
  31. package/awst_build/eb/array-like/util.d.ts +0 -1
  32. package/awst_build/eb/bytes-expression-builder.d.ts +0 -28
  33. package/awst_build/eb/contract-builder.d.ts +0 -11
  34. package/awst_build/eb/index.d.ts +0 -2
  35. package/awst_build/eb/literal/object-literal-expression-builder.d.ts +8 -4
  36. package/awst_build/eb/logged-error-builder.d.ts +11 -0
  37. package/awst_build/eb/objects/util.d.ts +0 -2
  38. package/awst_build/eb/op-module-builder.d.ts +0 -3
  39. package/awst_build/eb/storage/box/box.d.ts +1 -21
  40. package/awst_build/eb/storage/global-map.d.ts +21 -0
  41. package/awst_build/eb/storage/local-map.d.ts +21 -0
  42. package/awst_build/eb/string-expression-builder.d.ts +0 -6
  43. package/awst_build/eb/util/resolve-compat-builder.d.ts +0 -8
  44. package/awst_build/models/decorator-data.d.ts +1 -0
  45. package/awst_build/op-metadata.d.ts +4 -3
  46. package/awst_build/ptypes/arc4-types.d.ts +11 -7
  47. package/awst_build/ptypes/base.d.ts +5 -0
  48. package/awst_build/ptypes/for-export.d.ts +0 -1
  49. package/awst_build/ptypes/index.d.ts +103 -100
  50. package/awst_build/ptypes/util.d.ts +2 -2
  51. package/awst_build/ptypes/visitor.d.ts +3 -1
  52. package/awst_build/ptypes/visitors/default-visitor.d.ts +3 -1
  53. package/awst_build/ptypes/visitors/index-type-visitor.d.ts +0 -31
  54. package/awst_build/type-resolver.d.ts +1 -1
  55. package/bin/puyats-clientgen.d.ts +2 -0
  56. package/bin/puyats-clientgen.mjs +101 -0
  57. package/bin/puyats-clientgen.mjs.map +1 -0
  58. package/bin/puyats-ls.mjs +24 -49
  59. package/bin/puyats-ls.mjs.map +1 -1
  60. package/bin/run-cli.mjs +19 -13
  61. package/bin/run-cli.mjs.map +1 -1
  62. package/{check-node-version-CNvxI8_l.js → check-node-version-C1jtIFzd.js} +3 -3
  63. package/{check-node-version-CNvxI8_l.js.map → check-node-version-C1jtIFzd.js.map} +1 -1
  64. package/cli/build-command.d.ts +2 -0
  65. package/cli-ls.d.ts +1 -1
  66. package/cli.d.ts +1 -1
  67. package/cli.mjs +39 -79
  68. package/cli.mjs.map +1 -1
  69. package/clientgen.d.ts +1 -0
  70. package/code-fix/{invalid-non-null-assertion.d.ts → no-op-non-null-assertion.d.ts} +1 -1
  71. package/{compile-Bz8LVwK2.js → compile-D3rBypqy.js} +11 -4
  72. package/compile-D3rBypqy.js.map +1 -0
  73. package/compile.d.ts +1 -1
  74. package/constants.d.ts +7 -2
  75. package/contract-class-model-bHAozdbL.js +5456 -0
  76. package/contract-class-model-bHAozdbL.js.map +1 -0
  77. package/errors.d.ts +1 -6
  78. package/index.d.ts +1 -2
  79. package/index.mjs +36 -26
  80. package/index.mjs.map +1 -1
  81. package/language-server/analyser-service.d.ts +0 -1
  82. package/language-server/compile-trigger-queue.d.ts +2 -2
  83. package/language-server/puya-language-server.d.ts +0 -38
  84. package/logger/index.d.ts +0 -7
  85. package/{options-COFRHTFQ.js → options-lB3ucfHV.js} +2666 -8407
  86. package/options-lB3ucfHV.js.map +1 -0
  87. package/options.d.ts +8 -3
  88. package/package.json +20 -12
  89. package/puya/check-puya-version.d.ts +0 -13
  90. package/puya/index.d.ts +1 -1
  91. package/puya/log-deserializer.d.ts +0 -2
  92. package/puya/puya-service.d.ts +5 -1
  93. package/{resolve-puya-path-DtTAMi0Y.js → resolve-puya-path-CxwX2Y7m.js} +9 -45
  94. package/resolve-puya-path-CxwX2Y7m.js.map +1 -0
  95. package/semver-DSCCFKAJ.js +45 -0
  96. package/semver-DSCCFKAJ.js.map +1 -0
  97. package/util/base-85.d.ts +1 -4
  98. package/util/generate-temp-file.d.ts +0 -8
  99. package/util/index.d.ts +1 -3
  100. package/util/typed-message-port.d.ts +2 -2
  101. package/util-Dz5YVLPa.js +63 -0
  102. package/util-Dz5YVLPa.js.map +1 -0
  103. package/visitor/syntax-names.d.ts +194 -194
  104. package/visitor/visitor.d.ts +4 -4
  105. package/analyser-service-_vXhzOY0.js.map +0 -1
  106. package/compile-Bz8LVwK2.js.map +0 -1
  107. package/language-server/ls-logger.d.ts +0 -11
  108. package/options-COFRHTFQ.js.map +0 -1
  109. package/resolve-puya-path-DtTAMi0Y.js.map +0 -1
  110. package/util/arc4-signature-parser.d.ts +0 -14
  111. package/util/polyfills.d.ts +0 -1
@@ -1,7 +1,8 @@
1
1
  import 'crypto';
2
2
  import 'node:worker_threads';
3
- export { c as createAnalyserService } from './analyser-service-_vXhzOY0.js';
4
- import './options-COFRHTFQ.js';
3
+ export { c as createAnalyserService } from './analyser-service-DRDPe9MV.js';
4
+ import './contract-class-model-bHAozdbL.js';
5
+ import './options-lB3ucfHV.js';
5
6
  import 'pathe';
6
7
  import 'typescript';
7
8
  import 'node:util';
@@ -13,14 +14,14 @@ import 'url';
13
14
  import 'fs';
14
15
  import 'child_process';
15
16
  import 'glob';
16
- import 'arcsecond';
17
17
  import 'node:fs';
18
- import 'tslib';
19
- import 'node:buffer';
20
18
  import 'node:crypto';
19
+ import 'polytype';
21
20
  import 'node:async_hooks';
21
+ import 'arcsecond';
22
+ import 'tslib';
23
+ import 'node:buffer';
22
24
  import 'cross-spawn';
23
25
  import 'change-case';
24
- import 'polytype';
25
26
  import 'minimatch';
26
27
  //# sourceMappingURL=analyserService.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"analyserService.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"analyserService.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,324 @@
1
+ import * as abi from '@algorandfoundation/algokit-utils/abi';
2
+ import { existsSync } from 'fs';
3
+ import { writeFile, readFile } from 'fs/promises';
4
+ import { ag as ContractReference, ac as ContractClassModel, f as AbsolutePath, ds as logger, a6 as CodeError, aa as Constants, aI as InternalError, ce as accountPType, cn as applicationPType, cC as assetPType, e1 as voidPType, cf as anyGtxnType, dF as paymentGtxnType, dk as keyRegistrationGtxnType, cu as assetConfigGtxnType, cD as assetTransferGtxnType, cy as assetFreezeGtxnType, cj as applicationCallGtxnType, bl as OnCompletionAction } from './contract-class-model-bHAozdbL.js';
5
+
6
+ const AUTO_GENERATED_COMMENT = '// This file is auto-generated, do not modify';
7
+ const DISABLE_ESLINT_PRAGMA = '/* eslint-disable */';
8
+ const ARC4_PYTYPE_MAPPING = new Map([
9
+ ['account', accountPType],
10
+ ['application', applicationPType],
11
+ ['asset', assetPType],
12
+ ['void', voidPType],
13
+ ['txn', anyGtxnType],
14
+ ['pay', paymentGtxnType],
15
+ ['keyreg', keyRegistrationGtxnType],
16
+ ['acfg', assetConfigGtxnType],
17
+ ['axfer', assetTransferGtxnType],
18
+ ['afrz', assetFreezeGtxnType],
19
+ ['appl', applicationCallGtxnType],
20
+ ]);
21
+ function resolveClients(compilationSet, filePaths, arc56Contracts) {
22
+ const sourceFileToOutDir = new Map();
23
+ for (const { sourceFile, outDir } of filePaths) {
24
+ sourceFileToOutDir.set(sourceFile.toString(), outDir);
25
+ }
26
+ const arc56Files = [];
27
+ for (const ref of compilationSet.compilationOutputSet) {
28
+ if (!(ref instanceof ContractReference)) {
29
+ continue;
30
+ }
31
+ const model = compilationSet.get(ref);
32
+ if (!(model instanceof ContractClassModel)) {
33
+ continue;
34
+ }
35
+ if (!model.type.isARC4) {
36
+ continue;
37
+ }
38
+ const sourceFile = AbsolutePath.resolve({ path: ref.moduleName });
39
+ const outDir = sourceFileToOutDir.get(sourceFile.toString());
40
+ if (outDir === undefined) {
41
+ logger.error(undefined, `Could not find a source file for the contract ${ref.className} at ${ref.moduleName}`);
42
+ continue;
43
+ }
44
+ const spec = arc56Contracts[ref.id];
45
+ if (spec === undefined) {
46
+ logger.error(undefined, `Could not find a generated spec for the contract ${ref.className} at ${ref.moduleName}`);
47
+ continue;
48
+ }
49
+ const name = model.options?.name || model.name;
50
+ arc56Files.push({
51
+ spec,
52
+ outFile: outDir.join(`${name}.client.ts`),
53
+ });
54
+ }
55
+ return arc56Files;
56
+ }
57
+ function writeARC4Clients(compilationSet, filePaths, arc56Contracts) {
58
+ const clientFiles = resolveClients(compilationSet, filePaths, arc56Contracts);
59
+ return Promise.all(clientFiles.map(async (clientTask) => {
60
+ await writeARC4Client(clientTask.spec, clientTask.outFile);
61
+ }));
62
+ }
63
+ async function writeARC4Client(spec, outFile) {
64
+ if (await shouldWriteFile(outFile)) {
65
+ logger.info(undefined, `Writing ${outFile.relativeTo('.')}`);
66
+ const typescriptClient = generateClientFor(spec);
67
+ await writeFile(outFile.toString(), typescriptClient, { encoding: 'utf-8' });
68
+ }
69
+ else {
70
+ logger.error(undefined, `Not outputting ${outFile.relativeTo('.')} since content does not appear to be auto-generated`);
71
+ }
72
+ }
73
+ async function shouldWriteFile(outFile) {
74
+ const filePath = outFile.toString();
75
+ // FIXME: There's a TOCTOU bug here...
76
+ if (!existsSync(filePath)) {
77
+ return true;
78
+ }
79
+ const contents = await readFile(filePath, { encoding: 'utf-8' });
80
+ return contents.startsWith(AUTO_GENERATED_COMMENT);
81
+ }
82
+ function generateClientFor(contract) {
83
+ const typeImports = new Set();
84
+ const imports = new Set();
85
+ const structToClass = new Map();
86
+ const reservedClassNames = new Set();
87
+ const reservedMethodNames = new Set();
88
+ const classDecls = [];
89
+ function useImport(name, asValue) {
90
+ if (asValue) {
91
+ if (typeImports.has(name))
92
+ typeImports.delete(name);
93
+ imports.add(name);
94
+ }
95
+ else if (!imports.has(name)) {
96
+ typeImports.add(name);
97
+ }
98
+ }
99
+ function indent(...texts) {
100
+ const INDENT = ' ';
101
+ return INDENT + texts.join('\n').replaceAll(/\n+/g, `$&${INDENT}`);
102
+ }
103
+ function classNameFor(name) {
104
+ const base_name = name;
105
+ let seq = 1;
106
+ while (reservedClassNames.has(name)) {
107
+ seq++;
108
+ name = `${base_name}${seq}`;
109
+ }
110
+ reservedClassNames.add(name);
111
+ return name;
112
+ }
113
+ function methodNameFor(name) {
114
+ const base_name = name;
115
+ let seq = 1;
116
+ while (reservedMethodNames.has(name)) {
117
+ seq++;
118
+ name = `${base_name}${seq}`;
119
+ }
120
+ reservedMethodNames.add(name);
121
+ return name;
122
+ }
123
+ function typeNameToAlgoTSName(typeName) {
124
+ const knownMapping = ARC4_PYTYPE_MAPPING.get(typeName);
125
+ if (knownMapping !== undefined) {
126
+ const { name, module } = knownMapping;
127
+ if (module === Constants.moduleNames.algoTs.gtxn) {
128
+ useImport('gtxn', false);
129
+ return `gtxn.${name}`;
130
+ }
131
+ else if (module === Constants.moduleNames.algoTs.reference) {
132
+ useImport(name, false);
133
+ return name;
134
+ }
135
+ else if (module === Constants.moduleNames.tslib) {
136
+ // The TypeScript prelude is always imported
137
+ return name;
138
+ }
139
+ throw new InternalError(`Cannot import ${name}: The module ${module} is unsupported`);
140
+ }
141
+ return ARC4ToAlgoTSName(abi.ABIType.from(typeName));
142
+ }
143
+ function ARC4ToAlgoTSName(type) {
144
+ useImport('arc4', false);
145
+ if (type instanceof abi.ABIBoolType)
146
+ return 'arc4.Bool';
147
+ if (type instanceof abi.ABIStringType)
148
+ return 'arc4.Str';
149
+ if (type instanceof abi.ABIAddressType)
150
+ return 'arc4.Address';
151
+ if (type instanceof abi.ABIByteType)
152
+ return 'arc4.Byte';
153
+ if (type instanceof abi.ABIUintType)
154
+ return `arc4.Uint<${type.bitSize}>`;
155
+ if (type instanceof abi.ABIUfixedType)
156
+ return `arc4.UFixed<${type.bitSize}, ${type.precision}>`;
157
+ if (type instanceof abi.ABIArrayStaticType) {
158
+ const elementType = ARC4ToAlgoTSName(type.childType);
159
+ return `arc4.StaticArray<${elementType}, ${type.length}>`;
160
+ }
161
+ if (type instanceof abi.ABIArrayDynamicType) {
162
+ if (type.childType instanceof abi.ABIByteType)
163
+ return 'arc4.DynamicBytes';
164
+ const elementType = ARC4ToAlgoTSName(type.childType);
165
+ return `arc4.DynamicArray<${elementType}>`;
166
+ }
167
+ if (type instanceof abi.ABITupleType) {
168
+ const tupleTypes = type.childTypes.map(ARC4ToAlgoTSName);
169
+ return `arc4.Tuple<readonly [${tupleTypes.join(', ')}]>`;
170
+ }
171
+ throw new CodeError(`unknown ARC-4 type '${type}'`);
172
+ }
173
+ function getClientType(type) {
174
+ // map ABI / AVM type to algots type
175
+ if (type === 'AVMUint64') {
176
+ useImport('uint64', false);
177
+ return 'uint64';
178
+ }
179
+ else if (type === 'AVMBytes') {
180
+ useImport('bytes', false);
181
+ return 'bytes';
182
+ }
183
+ else if (type in contract.structs) {
184
+ return structToClass.get(type) || prepareStructClass(type, contract.structs[type]);
185
+ }
186
+ else {
187
+ return typeNameToAlgoTSName(type);
188
+ }
189
+ }
190
+ function prepareStructClass(name, fields) {
191
+ useImport('arc4', true);
192
+ const className = classNameFor(name);
193
+ structToClass.set(name, className);
194
+ const lines = ['', `export class ${className} extends arc4.Struct<{`];
195
+ for (const field of fields) {
196
+ let type;
197
+ if (typeof field.type === 'string') {
198
+ type = getClientType(field.type);
199
+ }
200
+ else {
201
+ // generate anonymous struct type
202
+ const anonStruct = `${name}_${field.name}`;
203
+ type = prepareStructClass(anonStruct, field.type);
204
+ }
205
+ lines.push(indent(`${field.name}: ${type}`));
206
+ }
207
+ lines.push('}> {}');
208
+ classDecls.push(...lines);
209
+ return className;
210
+ }
211
+ function tsdoc(description) {
212
+ if (description === undefined || description === null) {
213
+ return [];
214
+ }
215
+ return ['/**', ` * ${description.replaceAll(/\n+/g, '$& * ')}`, ' */'];
216
+ }
217
+ function compatibleActions(create, call) {
218
+ if (create.length === 0) {
219
+ return true;
220
+ }
221
+ if (call.length === 0) {
222
+ return true;
223
+ }
224
+ // if both collections are present, then they are compatible if everything in
225
+ // create is also in call
226
+ const createSet = new Set(create);
227
+ const callSet = new Set(call);
228
+ return createSet.symmetricDifference(callSet).size === 0;
229
+ }
230
+ function ARC4MethodToTSDecorator(name, method) {
231
+ useImport('abimethod', true);
232
+ const abimethodArgs = [];
233
+ if (method.name !== name) {
234
+ abimethodArgs.push(`name: '${method.name}'`);
235
+ }
236
+ if (method.readonly) {
237
+ abimethodArgs.push('readonly: true');
238
+ }
239
+ // if any alias types are encountered, force index encoding
240
+ const argTypes = new Set(method.args.map((v) => v.type));
241
+ const aliasTypes = new Set(['asset', 'application', 'account']);
242
+ if (argTypes.intersection(aliasTypes).size !== 0) {
243
+ abimethodArgs.push("resourceEncoding: 'index'");
244
+ }
245
+ if (!compatibleActions(method.actions.create, method.actions.call)) {
246
+ // TODO: support this, once decorators support it
247
+ throw new CodeError(`unsupported on completion combination for generating an ARC-4 client for method: ${method.name}`);
248
+ }
249
+ const actions = [...method.actions.create, ...method.actions.call];
250
+ actions.sort((a, b) => OnCompletionAction[a] - OnCompletionAction[b]);
251
+ const uniqueActions = new Set(actions);
252
+ if (!(uniqueActions.size === 1 && uniqueActions.has('NoOp'))) {
253
+ abimethodArgs.push(`allowActions: [${actions.map((v) => `'${v}'`).join(', ')}]`);
254
+ }
255
+ if (method.actions.create.length !== 0 && method.actions.call.length !== 0) {
256
+ abimethodArgs.push("onCreate: 'allow'");
257
+ }
258
+ else if (method.actions.create.length !== 0) {
259
+ abimethodArgs.push("onCreate: 'require'");
260
+ }
261
+ else ;
262
+ const args = abimethodArgs.length === 0 ? '' : `{ ${abimethodArgs.join(', ')} }`;
263
+ return `@abimethod(${args})`;
264
+ }
265
+ function genArg(arg) {
266
+ const argType = getClientType(arg.struct || arg.type);
267
+ return `${arg.name}: ${argType},`;
268
+ }
269
+ function genMethod(method) {
270
+ useImport('err', true);
271
+ const return_type = getClientType(method.returns.struct || method.returns.type);
272
+ const method_name = methodNameFor(method.name);
273
+ const args = method.args.map(genArg);
274
+ let arglist;
275
+ if (args.length === 0) {
276
+ // No args -> inline arglist
277
+ arglist = '()';
278
+ }
279
+ else if (args.length === 1) {
280
+ // One arg -> inline arglist (remove trailing comma)
281
+ arglist = `(${args[0].slice(0, -1)})`;
282
+ }
283
+ else {
284
+ // At least two args -> multiline arglist
285
+ arglist = `(\n${indent(...args)}\n)`;
286
+ }
287
+ return indent(...tsdoc(method.desc), ARC4MethodToTSDecorator(method_name, method), `${method_name}${arglist}: ${return_type} {`, indent("err('stub only')"), '}');
288
+ }
289
+ function genMethods() {
290
+ const methods = [];
291
+ if (contract.methods.length !== 0) {
292
+ methods.push(genMethod(contract.methods[0]));
293
+ }
294
+ for (const method of contract.methods.slice(1)) {
295
+ methods.push(`\n${genMethod(method)}`);
296
+ }
297
+ return methods;
298
+ }
299
+ // generate class definitions for any referenced structs in methods
300
+ // don't generate from self.contract.structs as it may contain other struct definitions
301
+ const clientClass = classNameFor(contract.name);
302
+ const docs = tsdoc(contract.desc);
303
+ const methods = genMethods();
304
+ useImport('Contract', true);
305
+ const sortedTypeImports = [...typeImports].toSorted().join(', ');
306
+ const sortedImports = [...imports].toSorted().join(', ');
307
+ const lines = [];
308
+ // Header
309
+ lines.push(AUTO_GENERATED_COMMENT);
310
+ lines.push(DISABLE_ESLINT_PRAGMA);
311
+ if (sortedTypeImports.length !== 0)
312
+ lines.push(`import type { ${sortedTypeImports} } from '@algorandfoundation/algorand-typescript'`);
313
+ if (sortedImports.length !== 0)
314
+ lines.push(`import { ${sortedImports} } from '@algorandfoundation/algorand-typescript'`);
315
+ lines.push(
316
+ // Struct declarations
317
+ ...classDecls, '',
318
+ // Contract definition
319
+ ...docs, `export abstract class ${clientClass} extends Contract {`, ...methods, '}', '');
320
+ return lines.join('\n');
321
+ }
322
+
323
+ export { writeARC4Clients as a, writeARC4Client as w };
324
+ //# sourceMappingURL=arc4-clientgen-sFEhO2LJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arc4-clientgen-sFEhO2LJ.js","sources":["../src/arc4-clientgen.ts"],"sourcesContent":["import * as abi from '@algorandfoundation/algokit-utils/abi'\nimport { existsSync } from 'fs'\nimport { readFile, writeFile } from 'fs/promises'\nimport { ContractReference, OnCompletionAction } from './awst/models'\nimport type { CompilationSet } from './awst_build/models/contract-class-model'\nimport { ContractClassModel } from './awst_build/models/contract-class-model'\nimport type { ABICompatiblePType } from './awst_build/ptypes'\nimport * as ptype from './awst_build/ptypes'\nimport { Constants } from './constants'\nimport { CodeError, InternalError } from './errors'\nimport { logger } from './logger'\nimport type { AlgoFile } from './options'\nimport { AbsolutePath } from './util/absolute-path'\n\ntype Arc56Arg = abi.Arc56Method['args'][number]\n\ntype ClientTask = {\n spec: abi.Arc56Contract\n outFile: AbsolutePath\n}\n\nconst AUTO_GENERATED_COMMENT = '// This file is auto-generated, do not modify'\nconst DISABLE_ESLINT_PRAGMA = '/* eslint-disable */'\n\nconst ARC4_PYTYPE_MAPPING = new Map<string, ABICompatiblePType>([\n ['account', ptype.accountPType],\n ['application', ptype.applicationPType],\n ['asset', ptype.assetPType],\n ['void', ptype.voidPType],\n ['txn', ptype.anyGtxnType],\n ['pay', ptype.paymentGtxnType],\n ['keyreg', ptype.keyRegistrationGtxnType],\n ['acfg', ptype.assetConfigGtxnType],\n ['axfer', ptype.assetTransferGtxnType],\n ['afrz', ptype.assetFreezeGtxnType],\n ['appl', ptype.applicationCallGtxnType],\n])\n\nfunction resolveClients(\n compilationSet: CompilationSet,\n filePaths: AlgoFile[],\n arc56Contracts: Record<string, abi.Arc56Contract>,\n): ClientTask[] {\n const sourceFileToOutDir = new Map<string, AbsolutePath>()\n for (const { sourceFile, outDir } of filePaths) {\n sourceFileToOutDir.set(sourceFile.toString(), outDir)\n }\n\n const arc56Files = []\n for (const ref of compilationSet.compilationOutputSet) {\n if (!(ref instanceof ContractReference)) {\n continue\n }\n const model = compilationSet.get(ref)\n if (!(model instanceof ContractClassModel)) {\n continue\n }\n if (!model.type.isARC4) {\n continue\n }\n\n const sourceFile = AbsolutePath.resolve({ path: ref.moduleName })\n const outDir = sourceFileToOutDir.get(sourceFile.toString())\n if (outDir === undefined) {\n logger.error(undefined, `Could not find a source file for the contract ${ref.className} at ${ref.moduleName}`)\n continue\n }\n\n const spec = arc56Contracts[ref.id]\n if (spec === undefined) {\n logger.error(undefined, `Could not find a generated spec for the contract ${ref.className} at ${ref.moduleName}`)\n continue\n }\n\n const name = model.options?.name || model.name\n arc56Files.push({\n spec,\n outFile: outDir.join(`${name}.client.ts`),\n })\n }\n return arc56Files\n}\n\nexport function writeARC4Clients(compilationSet: CompilationSet, filePaths: AlgoFile[], arc56Contracts: Record<string, abi.Arc56Contract>) {\n const clientFiles = resolveClients(compilationSet, filePaths, arc56Contracts)\n return Promise.all(\n clientFiles.map(async (clientTask) => {\n await writeARC4Client(clientTask.spec, clientTask.outFile)\n }),\n )\n}\n\nexport async function writeARC4Client(spec: abi.Arc56Contract, outFile: AbsolutePath) {\n if (await shouldWriteFile(outFile)) {\n logger.info(undefined, `Writing ${outFile.relativeTo('.')}`)\n const typescriptClient = generateClientFor(spec)\n await writeFile(outFile.toString(), typescriptClient, { encoding: 'utf-8' })\n } else {\n logger.error(undefined, `Not outputting ${outFile.relativeTo('.')} since content does not appear to be auto-generated`)\n }\n}\n\nasync function shouldWriteFile(outFile: AbsolutePath): Promise<boolean> {\n const filePath = outFile.toString()\n // FIXME: There's a TOCTOU bug here...\n if (!existsSync(filePath)) {\n return true\n }\n const contents = await readFile(filePath, { encoding: 'utf-8' })\n return contents.startsWith(AUTO_GENERATED_COMMENT)\n}\n\nfunction generateClientFor(contract: abi.Arc56Contract): string {\n const typeImports = new Set<string>()\n const imports = new Set<string>()\n const structToClass = new Map<string, string>()\n const reservedClassNames = new Set<string>()\n const reservedMethodNames = new Set<string>()\n const classDecls: string[] = []\n\n function useImport(name: string, asValue: boolean) {\n if (asValue) {\n if (typeImports.has(name)) typeImports.delete(name)\n imports.add(name)\n } else if (!imports.has(name)) {\n typeImports.add(name)\n }\n }\n function indent(...texts: string[]): string {\n const INDENT = ' '\n return INDENT + texts.join('\\n').replaceAll(/\\n+/g, `$&${INDENT}`)\n }\n\n function classNameFor(name: string): string {\n const base_name = name\n let seq = 1\n while (reservedClassNames.has(name)) {\n seq++\n name = `${base_name}${seq}`\n }\n\n reservedClassNames.add(name)\n return name\n }\n\n function methodNameFor(name: string): string {\n const base_name = name\n let seq = 1\n while (reservedMethodNames.has(name)) {\n seq++\n name = `${base_name}${seq}`\n }\n\n reservedMethodNames.add(name)\n return name\n }\n\n function typeNameToAlgoTSName(typeName: string): string {\n const knownMapping = ARC4_PYTYPE_MAPPING.get(typeName)\n if (knownMapping !== undefined) {\n const { name, module } = knownMapping\n if (module === Constants.moduleNames.algoTs.gtxn) {\n useImport('gtxn', false)\n return `gtxn.${name}`\n } else if (module === Constants.moduleNames.algoTs.reference) {\n useImport(name, false)\n return name\n } else if (module === Constants.moduleNames.tslib) {\n // The TypeScript prelude is always imported\n return name\n }\n\n throw new InternalError(`Cannot import ${name}: The module ${module} is unsupported`)\n }\n return ARC4ToAlgoTSName(abi.ABIType.from(typeName))\n }\n\n function ARC4ToAlgoTSName(type: abi.ABIType): string {\n useImport('arc4', false)\n if (type instanceof abi.ABIBoolType) return 'arc4.Bool'\n if (type instanceof abi.ABIStringType) return 'arc4.Str'\n if (type instanceof abi.ABIAddressType) return 'arc4.Address'\n if (type instanceof abi.ABIByteType) return 'arc4.Byte'\n if (type instanceof abi.ABIUintType) return `arc4.Uint<${type.bitSize}>`\n if (type instanceof abi.ABIUfixedType) return `arc4.UFixed<${type.bitSize}, ${type.precision}>`\n if (type instanceof abi.ABIArrayStaticType) {\n const elementType = ARC4ToAlgoTSName(type.childType)\n return `arc4.StaticArray<${elementType}, ${type.length}>`\n }\n if (type instanceof abi.ABIArrayDynamicType) {\n if (type.childType instanceof abi.ABIByteType) return 'arc4.DynamicBytes'\n\n const elementType = ARC4ToAlgoTSName(type.childType)\n return `arc4.DynamicArray<${elementType}>`\n }\n if (type instanceof abi.ABITupleType) {\n const tupleTypes = type.childTypes.map(ARC4ToAlgoTSName)\n return `arc4.Tuple<readonly [${tupleTypes.join(', ')}]>`\n }\n throw new CodeError(`unknown ARC-4 type '${type}'`)\n }\n\n function getClientType(type: string): string {\n // map ABI / AVM type to algots type\n if (type === 'AVMUint64') {\n useImport('uint64', false)\n return 'uint64'\n } else if (type === 'AVMBytes') {\n useImport('bytes', false)\n return 'bytes'\n } else if (type in contract.structs) {\n return structToClass.get(type) || prepareStructClass(type, contract.structs[type])\n } else {\n return typeNameToAlgoTSName(type)\n }\n }\n\n function prepareStructClass(name: string, fields: abi.StructField[]) {\n useImport('arc4', true)\n\n const className = classNameFor(name)\n structToClass.set(name, className)\n const lines = ['', `export class ${className} extends arc4.Struct<{`]\n for (const field of fields) {\n let type: string\n if (typeof field.type === 'string') {\n type = getClientType(field.type)\n } else {\n // generate anonymous struct type\n const anonStruct = `${name}_${field.name}`\n type = prepareStructClass(anonStruct, field.type)\n }\n lines.push(indent(`${field.name}: ${type}`))\n }\n lines.push('}> {}')\n classDecls.push(...lines)\n return className\n }\n\n function tsdoc(description: string | undefined | null): string[] {\n if (description === undefined || description === null) {\n return []\n }\n return ['/**', ` * ${description.replaceAll(/\\n+/g, '$& * ')}`, ' */']\n }\n\n function compatibleActions(create: string[], call: string[]): boolean {\n if (create.length === 0) {\n return true\n }\n if (call.length === 0) {\n return true\n }\n // if both collections are present, then they are compatible if everything in\n // create is also in call\n const createSet = new Set(create)\n const callSet = new Set(call)\n return createSet.symmetricDifference(callSet).size === 0\n }\n\n function ARC4MethodToTSDecorator(name: string, method: abi.Arc56Method): string {\n useImport('abimethod', true)\n\n const abimethodArgs: string[] = []\n if (method.name !== name) {\n abimethodArgs.push(`name: '${method.name}'`)\n }\n if (method.readonly) {\n abimethodArgs.push('readonly: true')\n }\n // if any alias types are encountered, force index encoding\n const argTypes = new Set(method.args.map((v) => v.type))\n const aliasTypes = new Set(['asset', 'application', 'account'])\n if (argTypes.intersection(aliasTypes).size !== 0) {\n abimethodArgs.push(\"resourceEncoding: 'index'\")\n }\n if (!compatibleActions(method.actions.create, method.actions.call)) {\n // TODO: support this, once decorators support it\n throw new CodeError(`unsupported on completion combination for generating an ARC-4 client for method: ${method.name}`)\n }\n const actions = [...method.actions.create, ...method.actions.call]\n actions.sort((a, b) => OnCompletionAction[a] - OnCompletionAction[b])\n const uniqueActions = new Set(actions)\n\n if (!(uniqueActions.size === 1 && uniqueActions.has('NoOp'))) {\n abimethodArgs.push(`allowActions: [${actions.map((v) => `'${v}'`).join(', ')}]`)\n }\n if (method.actions.create.length !== 0 && method.actions.call.length !== 0) {\n abimethodArgs.push(\"onCreate: 'allow'\")\n } else if (method.actions.create.length !== 0) {\n abimethodArgs.push(\"onCreate: 'require'\")\n } else {\n // disallow is default\n }\n const args = abimethodArgs.length === 0 ? '' : `{ ${abimethodArgs.join(', ')} }`\n return `@abimethod(${args})`\n }\n\n function genArg(arg: Arc56Arg): string {\n const argType = getClientType(arg.struct || arg.type)\n return `${arg.name}: ${argType},`\n }\n\n function genMethod(method: abi.Arc56Method): string {\n useImport('err', true)\n\n const return_type = getClientType(method.returns.struct || method.returns.type)\n const method_name = methodNameFor(method.name)\n const args = method.args.map(genArg)\n let arglist: string\n if (args.length === 0) {\n // No args -> inline arglist\n arglist = '()'\n } else if (args.length === 1) {\n // One arg -> inline arglist (remove trailing comma)\n arglist = `(${args[0].slice(0, -1)})`\n } else {\n // At least two args -> multiline arglist\n arglist = `(\\n${indent(...args)}\\n)`\n }\n\n return indent(\n ...tsdoc(method.desc),\n ARC4MethodToTSDecorator(method_name, method),\n `${method_name}${arglist}: ${return_type} {`,\n indent(\"err('stub only')\"),\n '}',\n )\n }\n\n function genMethods(): string[] {\n const methods = []\n if (contract.methods.length !== 0) {\n methods.push(genMethod(contract.methods[0]))\n }\n for (const method of contract.methods.slice(1)) {\n methods.push(`\\n${genMethod(method)}`)\n }\n return methods\n }\n\n // generate class definitions for any referenced structs in methods\n // don't generate from self.contract.structs as it may contain other struct definitions\n const clientClass = classNameFor(contract.name)\n const docs = tsdoc(contract.desc)\n const methods = genMethods()\n useImport('Contract', true)\n\n const sortedTypeImports = [...typeImports].toSorted().join(', ')\n const sortedImports = [...imports].toSorted().join(', ')\n const lines = []\n // Header\n lines.push(AUTO_GENERATED_COMMENT)\n lines.push(DISABLE_ESLINT_PRAGMA)\n if (sortedTypeImports.length !== 0) lines.push(`import type { ${sortedTypeImports} } from '@algorandfoundation/algorand-typescript'`)\n if (sortedImports.length !== 0) lines.push(`import { ${sortedImports} } from '@algorandfoundation/algorand-typescript'`)\n\n lines.push(\n // Struct declarations\n ...classDecls,\n '',\n // Contract definition\n ...docs,\n `export abstract class ${clientClass} extends Contract {`,\n ...methods,\n '}',\n '',\n )\n return lines.join('\\n')\n}\n"],"names":["ptype.accountPType","ptype.applicationPType","ptype.assetPType","ptype.voidPType","ptype.anyGtxnType","ptype.paymentGtxnType","ptype.keyRegistrationGtxnType","ptype.assetConfigGtxnType","ptype.assetTransferGtxnType","ptype.assetFreezeGtxnType","ptype.applicationCallGtxnType"],"mappings":";;;;;AAqBA,MAAM,sBAAsB,GAAG,+CAA+C;AAC9E,MAAM,qBAAqB,GAAG,sBAAsB;AAEpD,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAA6B;AAC9D,IAAA,CAAC,SAAS,EAAEA,YAAkB,CAAC;AAC/B,IAAA,CAAC,aAAa,EAAEC,gBAAsB,CAAC;AACvC,IAAA,CAAC,OAAO,EAAEC,UAAgB,CAAC;AAC3B,IAAA,CAAC,MAAM,EAAEC,SAAe,CAAC;AACzB,IAAA,CAAC,KAAK,EAAEC,WAAiB,CAAC;AAC1B,IAAA,CAAC,KAAK,EAAEC,eAAqB,CAAC;AAC9B,IAAA,CAAC,QAAQ,EAAEC,uBAA6B,CAAC;AACzC,IAAA,CAAC,MAAM,EAAEC,mBAAyB,CAAC;AACnC,IAAA,CAAC,OAAO,EAAEC,qBAA2B,CAAC;AACtC,IAAA,CAAC,MAAM,EAAEC,mBAAyB,CAAC;AACnC,IAAA,CAAC,MAAM,EAAEC,uBAA6B,CAAC;AACxC,CAAA,CAAC;AAEF,SAAS,cAAc,CACrB,cAA8B,EAC9B,SAAqB,EACrB,cAAiD,EAAA;AAEjD,IAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAwB;IAC1D,KAAK,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IA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AAG,UAAU,EAAE;AAC5B,IAAA,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC;AAE3B,IAAA,MAAM,iBAAiB,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;AAChE,IAAA,MAAM,aAAa,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;IACxD,MAAM,KAAK,GAAG,EAAE;;AAEhB,IAAA,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC;AAClC,IAAA,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC;AACjC,IAAA,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,KAAK,CAAC,IAAI,CAAC,iBAAiB,iBAAiB,CAAA,iDAAA,CAAmD,CAAC;AACrI,IAAA,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,KAAK,CAAC,IAAI,CAAC,YAAY,aAAa,CAAA,iDAAA,CAAmD,CAAC;AAExH,IAAA,KAAK,CAAC,IAAI;;IAER,GAAG,UAAU,EACb,EAAE;;AAEF,IAAA,GAAG,IAAI,EACP,CAAA,sBAAA,EAAyB,WAAW,CAAA,mBAAA,CAAqB,EACzD,GAAG,OAAO,EACV,GAAG,EACH,EAAE,CACH;AACD,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;AACzB;;;;"}
@@ -0,0 +1,6 @@
1
+ import * as abi from '@algorandfoundation/algokit-utils/abi';
2
+ import type { CompilationSet } from './awst_build/models/contract-class-model';
3
+ import type { AlgoFile } from './options';
4
+ import { AbsolutePath } from './util/absolute-path';
5
+ export declare function writeARC4Clients(compilationSet: CompilationSet, filePaths: AlgoFile[], arc56Contracts: Record<string, abi.Arc56Contract>): Promise<void[]>;
6
+ export declare function writeARC4Client(spec: abi.Arc56Contract, outFile: AbsolutePath): Promise<void>;
@@ -8,14 +8,16 @@ export declare const intrinsicFactory: {
8
8
  right: awst.Expression;
9
9
  sourceLocation: SourceLocation;
10
10
  }): awst.BytesConstant | awst.StringConstant | awst.IntrinsicCall;
11
- err({ sourceLocation, comment }: {
11
+ err({ sourceLocation, comment, logError }: {
12
12
  sourceLocation: SourceLocation;
13
13
  comment: string | null;
14
+ logError?: boolean;
14
15
  }): awst.AssertExpression;
15
- assert({ sourceLocation, comment, condition }: {
16
+ assert({ sourceLocation, comment, condition, logError, }: {
16
17
  sourceLocation: SourceLocation;
17
18
  comment: string | null;
18
19
  condition: Expression;
20
+ logError?: boolean;
19
21
  }): awst.AssertExpression;
20
22
  bytesLen({ value, sourceLocation }: {
21
23
  value: awst.Expression;
@@ -3,7 +3,6 @@ export declare class SnakeCaseSerializer<T> {
3
3
  private readonly spaces;
4
4
  constructor(spaces?: number);
5
5
  serialize(obj: T): string;
6
- private b85;
7
6
  protected serializerFunction(key: string, value: unknown): unknown;
8
7
  }
9
8
  export declare class AwstSerializer<T> extends SnakeCaseSerializer<T> {
@@ -10,6 +10,7 @@ declare const explicitNodeFactory: {
10
10
  sourceLocation: SourceLocation;
11
11
  wtype: wtypes.WType;
12
12
  errorMessage: string | null;
13
+ logError?: boolean;
13
14
  }): AssertExpression;
14
15
  voidConstant(props: {
15
16
  sourceLocation: SourceLocation;
package/awst/nodes.d.ts CHANGED
@@ -73,6 +73,7 @@ export declare class AssertExpression extends Expression {
73
73
  readonly errorMessage: string | null;
74
74
  readonly wtype: wtypes.WType;
75
75
  readonly explicit: boolean;
76
+ readonly logError: boolean;
76
77
  accept<T>(visitor: ExpressionVisitor<T>): T;
77
78
  }
78
79
  export declare class IntegerConstant extends Expression {
@@ -151,7 +152,7 @@ export declare class AddressConstant extends Expression {
151
152
  export declare class ARC4Encode extends Expression {
152
153
  constructor(props: Props<ARC4Encode>);
153
154
  readonly value: Expression;
154
- readonly wtype: wtypes.ARC4Type;
155
+ readonly wtype: wtypes.ARC4Type | wtypes.BytesWType;
155
156
  readonly errorMessage: string | null;
156
157
  accept<T>(visitor: ExpressionVisitor<T>): T;
157
158
  }
@@ -286,13 +287,6 @@ export declare class InnerTransactionField extends Expression {
286
287
  readonly arrayIndex: Expression | null;
287
288
  accept<T>(visitor: ExpressionVisitor<T>): T;
288
289
  }
289
- export declare class SetInnerTransactionFields extends Expression {
290
- constructor(props: Props<SetInnerTransactionFields>);
291
- readonly itxns: Array<Expression>;
292
- readonly startWithBegin: boolean;
293
- readonly wtype: wtypes.WType;
294
- accept<T>(visitor: ExpressionVisitor<T>): T;
295
- }
296
290
  export declare class SubmitInnerTransaction extends Expression {
297
291
  constructor(props: Props<SubmitInnerTransaction>);
298
292
  readonly itxns: Array<Expression>;
@@ -347,8 +341,8 @@ export declare class AppAccountStateExpression extends Expression {
347
341
  readonly account: Expression;
348
342
  accept<T>(visitor: ExpressionVisitor<T>): T;
349
343
  }
350
- export declare class BoxPrefixedKeyExpression extends Expression {
351
- constructor(props: Props<BoxPrefixedKeyExpression>);
344
+ export declare class MapPrefixedKeyExpression extends Expression {
345
+ constructor(props: Props<MapPrefixedKeyExpression>);
352
346
  readonly prefix: Expression;
353
347
  readonly key: Expression;
354
348
  readonly wtype: wtypes.WType;
@@ -468,6 +462,14 @@ export declare class SubroutineCallExpression extends Expression {
468
462
  readonly args: Array<CallArg>;
469
463
  accept<T>(visitor: ExpressionVisitor<T>): T;
470
464
  }
465
+ export declare class ABICall extends Expression {
466
+ constructor(props: Props<ABICall>);
467
+ readonly target: MethodSignature | MethodSignatureString | null;
468
+ readonly args: Array<Expression>;
469
+ readonly fields: Map<TxnField, Expression>;
470
+ readonly wtype: wtypes.WABICallInnerTransactionFields;
471
+ accept<T>(visitor: ExpressionVisitor<T>): T;
472
+ }
471
473
  export declare class PuyaLibData {
472
474
  constructor(props: Props<PuyaLibData>);
473
475
  readonly id: string;
@@ -619,9 +621,15 @@ export declare class BytesAugmentedAssignment extends Statement {
619
621
  readonly value: Expression;
620
622
  accept<T>(visitor: StatementVisitor<T>): T;
621
623
  }
624
+ export declare class EmitFields extends Expression {
625
+ constructor(props: Props<EmitFields>);
626
+ readonly signature: string;
627
+ readonly values: Array<Expression>;
628
+ readonly wtype: wtypes.WType;
629
+ accept<T>(visitor: ExpressionVisitor<T>): T;
630
+ }
622
631
  export declare class Emit extends Expression {
623
632
  constructor(props: Props<Emit>);
624
- readonly signature: string;
625
633
  readonly value: Expression;
626
634
  readonly wtype: wtypes.WType;
627
635
  accept<T>(visitor: ExpressionVisitor<T>): T;
@@ -746,6 +754,7 @@ export declare class LogicSignature extends RootNode {
746
754
  readonly docstring: string | null;
747
755
  readonly reservedScratchSpace: Set<bigint>;
748
756
  readonly avmVersion: bigint | null;
757
+ readonly validateEncoding: boolean | null;
749
758
  accept<T>(visitor: RootNodeVisitor<T>): T;
750
759
  }
751
760
  export declare class CompiledContract extends Expression {
@@ -867,7 +876,6 @@ export declare const concreteNodes: {
867
876
  readonly namedTupleExpression: typeof NamedTupleExpression;
868
877
  readonly varExpression: typeof VarExpression;
869
878
  readonly innerTransactionField: typeof InnerTransactionField;
870
- readonly setInnerTransactionFields: typeof SetInnerTransactionFields;
871
879
  readonly submitInnerTransaction: typeof SubmitInnerTransaction;
872
880
  readonly fieldExpression: typeof FieldExpression;
873
881
  readonly indexExpression: typeof IndexExpression;
@@ -875,7 +883,7 @@ export declare const concreteNodes: {
875
883
  readonly intersectionSliceExpression: typeof IntersectionSliceExpression;
876
884
  readonly appStateExpression: typeof AppStateExpression;
877
885
  readonly appAccountStateExpression: typeof AppAccountStateExpression;
878
- readonly boxPrefixedKeyExpression: typeof BoxPrefixedKeyExpression;
886
+ readonly mapPrefixedKeyExpression: typeof MapPrefixedKeyExpression;
879
887
  readonly boxValueExpression: typeof BoxValueExpression;
880
888
  readonly singleEvaluation: typeof SingleEvaluation;
881
889
  readonly reinterpretCast: typeof ReinterpretCast;
@@ -893,6 +901,7 @@ export declare const concreteNodes: {
893
901
  readonly contractMethodTarget: typeof ContractMethodTarget;
894
902
  readonly callArg: typeof CallArg;
895
903
  readonly subroutineCallExpression: typeof SubroutineCallExpression;
904
+ readonly aBICall: typeof ABICall;
896
905
  readonly puyaLibData: typeof PuyaLibData;
897
906
  readonly puyaLibCall: typeof PuyaLibCall;
898
907
  readonly uInt64UnaryOperation: typeof UInt64UnaryOperation;
@@ -907,6 +916,7 @@ export declare const concreteNodes: {
907
916
  readonly uInt64AugmentedAssignment: typeof UInt64AugmentedAssignment;
908
917
  readonly bigUIntAugmentedAssignment: typeof BigUIntAugmentedAssignment;
909
918
  readonly bytesAugmentedAssignment: typeof BytesAugmentedAssignment;
919
+ readonly emitFields: typeof EmitFields;
910
920
  readonly emit: typeof Emit;
911
921
  readonly range: typeof Range;
912
922
  readonly enumeration: typeof Enumeration;
@@ -983,7 +993,6 @@ export interface ExpressionVisitor<T> {
983
993
  visitNamedTupleExpression(expression: NamedTupleExpression): T;
984
994
  visitVarExpression(expression: VarExpression): T;
985
995
  visitInnerTransactionField(expression: InnerTransactionField): T;
986
- visitSetInnerTransactionFields(expression: SetInnerTransactionFields): T;
987
996
  visitSubmitInnerTransaction(expression: SubmitInnerTransaction): T;
988
997
  visitFieldExpression(expression: FieldExpression): T;
989
998
  visitIndexExpression(expression: IndexExpression): T;
@@ -991,7 +1000,7 @@ export interface ExpressionVisitor<T> {
991
1000
  visitIntersectionSliceExpression(expression: IntersectionSliceExpression): T;
992
1001
  visitAppStateExpression(expression: AppStateExpression): T;
993
1002
  visitAppAccountStateExpression(expression: AppAccountStateExpression): T;
994
- visitBoxPrefixedKeyExpression(expression: BoxPrefixedKeyExpression): T;
1003
+ visitMapPrefixedKeyExpression(expression: MapPrefixedKeyExpression): T;
995
1004
  visitBoxValueExpression(expression: BoxValueExpression): T;
996
1005
  visitSingleEvaluation(expression: SingleEvaluation): T;
997
1006
  visitReinterpretCast(expression: ReinterpretCast): T;
@@ -1003,6 +1012,7 @@ export interface ExpressionVisitor<T> {
1003
1012
  visitNumericComparisonExpression(expression: NumericComparisonExpression): T;
1004
1013
  visitBytesComparisonExpression(expression: BytesComparisonExpression): T;
1005
1014
  visitSubroutineCallExpression(expression: SubroutineCallExpression): T;
1015
+ visitABICall(expression: ABICall): T;
1006
1016
  visitPuyaLibCall(expression: PuyaLibCall): T;
1007
1017
  visitUInt64UnaryOperation(expression: UInt64UnaryOperation): T;
1008
1018
  visitUInt64PostfixUnaryOperation(expression: UInt64PostfixUnaryOperation): T;
@@ -1013,6 +1023,7 @@ export interface ExpressionVisitor<T> {
1013
1023
  visitBytesBinaryOperation(expression: BytesBinaryOperation): T;
1014
1024
  visitBooleanBinaryOperation(expression: BooleanBinaryOperation): T;
1015
1025
  visitNot(expression: Not): T;
1026
+ visitEmitFields(expression: EmitFields): T;
1016
1027
  visitEmit(expression: Emit): T;
1017
1028
  visitRange(expression: Range): T;
1018
1029
  visitEnumeration(expression: Enumeration): T;
@@ -24,7 +24,6 @@ export declare class SourceLocation<TNode extends ts.Node | undefined = ts.Node
24
24
  private static getStartAndEnd;
25
25
  static fromNode<TNode extends ts.Node>(node: TNode, programDirectory: AbsolutePath): SourceLocation<TNode>;
26
26
  static fromFile(sourceFile: ts.SourceFile, programDirectory: AbsolutePath): SourceLocation;
27
- static fromTextRange(sourceFile: ts.SourceFile, textRange: ts.TextRange, programDirectory: AbsolutePath): SourceLocation;
28
27
  static fromDiagnostic(diagnostic: ts.DiagnosticWithLocation, programDirectory: AbsolutePath): SourceLocation;
29
28
  toString(options?: {
30
29
  pathsRelativeTo?: AbsolutePath;
@@ -16,7 +16,7 @@ export declare class ToCodeVisitor implements nodes.RootNodeVisitor<string[]>, n
16
16
  visitLoopContinue(statement: nodes.LoopContinue): string[];
17
17
  visitGoto(statement: nodes.Goto): string[];
18
18
  visitIntersectionSliceExpression(expression: nodes.IntersectionSliceExpression): string;
19
- visitBoxPrefixedKeyExpression(expression: nodes.BoxPrefixedKeyExpression): string;
19
+ visitMapPrefixedKeyExpression(expression: nodes.MapPrefixedKeyExpression): string;
20
20
  visitBoxValueExpression(expression: nodes.BoxValueExpression): string;
21
21
  visitIntegerConstant(expression: nodes.IntegerConstant): string;
22
22
  visitDecimalConstant(expression: nodes.DecimalConstant): string;
@@ -45,7 +45,7 @@ export declare class ToCodeVisitor implements nodes.RootNodeVisitor<string[]>, n
45
45
  visitTupleItemExpression(expression: nodes.TupleItemExpression): string;
46
46
  visitVarExpression(expression: nodes.VarExpression): string;
47
47
  visitInnerTransactionField(expression: nodes.InnerTransactionField): string;
48
- visitSetInnerTransactionFields(expression: nodes.SetInnerTransactionFields): string;
48
+ visitABICall(expression: nodes.ABICall): string;
49
49
  visitSizeOf(expression: nodes.SizeOf): string;
50
50
  visitSubmitInnerTransaction(expression: nodes.SubmitInnerTransaction): string;
51
51
  visitFieldExpression(expression: nodes.FieldExpression): string;
@@ -89,6 +89,7 @@ export declare class ToCodeVisitor implements nodes.RootNodeVisitor<string[]>, n
89
89
  visitForInLoop(statement: nodes.ForInLoop): string[];
90
90
  visitSubroutine(moduleStatement: nodes.Subroutine): string[];
91
91
  visitEmit(expression: nodes.Emit): string;
92
+ visitEmitFields(expression: nodes.EmitFields): string;
92
93
  visitContractMethod(statement: nodes.ContractMethod): string[];
93
94
  visitLogicSignature(moduleStatement: nodes.LogicSignature): string[];
94
95
  visitAssertExpression(expression: nodes.AssertExpression): string;
@@ -1,5 +1,5 @@
1
1
  import type { ARC4Router, AWST, ContractMethod, SubroutineCallExpression } from '../nodes';
2
- import { FunctionTraverser } from './awst-traverser';
2
+ import { FunctionTraverser } from './function-traverser';
3
3
  export declare class Arc4ApprovalCallsRouter extends FunctionTraverser {
4
4
  #private;
5
5
  static validate(awst: AWST[]): void;