@algorandfoundation/puya-ts 1.2.0-beta.4 → 1.2.0-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/{analyser-service-_vXhzOY0.js → analyser-service-D0IsFlp4.js} +409 -372
- package/analyser-service-D0IsFlp4.js.map +1 -0
- package/analyserService.mjs +7 -6
- package/analyserService.mjs.map +1 -1
- package/arc4-clientgen-BMCeFyNd.js +324 -0
- package/arc4-clientgen-BMCeFyNd.js.map +1 -0
- package/arc4-clientgen.d.ts +6 -0
- package/awst/intrinsic-factory.d.ts +4 -2
- package/awst/json-serialize-awst.d.ts +0 -1
- package/awst/node-factory.d.ts +1 -0
- package/awst/nodes.d.ts +26 -15
- package/awst/source-location.d.ts +0 -1
- package/awst/to-code-visitor.d.ts +3 -2
- package/awst/validation/arc4-approval-calls-router.d.ts +1 -1
- package/awst/validation/{awst-traverser.d.ts → function-traverser.d.ts} +4 -10
- package/awst/wtypes.d.ts +47 -45
- package/awst_build/arc4-util.d.ts +1 -38
- package/awst_build/ast-visitors/base-visitor.d.ts +0 -1
- package/awst_build/ast-visitors/class-definition-visitor.d.ts +721 -1
- package/awst_build/ast-visitors/contract-method-visitor.d.ts +3 -5
- package/awst_build/ast-visitors/function-visitor.d.ts +721 -1
- package/awst_build/ast-visitors/text-visitor.d.ts +721 -1
- package/awst_build/context/awst-build-context.d.ts +1 -1
- package/awst_build/eb/arc28/arc-28-emit-function-builder.d.ts +1 -2
- package/awst_build/eb/arc4/arrays.d.ts +2 -1
- package/awst_build/eb/arc4/c2c.d.ts +0 -17
- package/awst_build/eb/arc4/uintn.d.ts +1 -1
- package/awst_build/eb/arc4/util.d.ts +1 -0
- package/awst_build/eb/array-like/arrays.d.ts +3 -2
- package/awst_build/eb/array-like/util.d.ts +0 -1
- package/awst_build/eb/bytes-expression-builder.d.ts +0 -28
- package/awst_build/eb/contract-builder.d.ts +0 -11
- package/awst_build/eb/index.d.ts +0 -2
- package/awst_build/eb/literal/object-literal-expression-builder.d.ts +8 -4
- package/awst_build/eb/logged-error-builder.d.ts +11 -0
- package/awst_build/eb/objects/util.d.ts +0 -2
- package/awst_build/eb/op-module-builder.d.ts +0 -3
- package/awst_build/eb/storage/box/box.d.ts +1 -21
- package/awst_build/eb/storage/global-map.d.ts +21 -0
- package/awst_build/eb/storage/local-map.d.ts +21 -0
- package/awst_build/eb/string-expression-builder.d.ts +0 -6
- package/awst_build/eb/util/resolve-compat-builder.d.ts +0 -8
- package/awst_build/models/decorator-data.d.ts +1 -0
- package/awst_build/op-metadata.d.ts +4 -3
- package/awst_build/ptypes/arc4-types.d.ts +11 -7
- package/awst_build/ptypes/base.d.ts +5 -0
- package/awst_build/ptypes/for-export.d.ts +0 -1
- package/awst_build/ptypes/index.d.ts +103 -100
- package/awst_build/ptypes/util.d.ts +2 -2
- package/awst_build/ptypes/visitor.d.ts +3 -1
- package/awst_build/ptypes/visitors/default-visitor.d.ts +3 -1
- package/awst_build/ptypes/visitors/index-type-visitor.d.ts +0 -31
- package/awst_build/type-resolver.d.ts +1 -1
- package/bin/puyats-clientgen.d.ts +2 -0
- package/bin/puyats-clientgen.mjs +101 -0
- package/bin/puyats-clientgen.mjs.map +1 -0
- package/bin/puyats-ls.mjs +24 -49
- package/bin/puyats-ls.mjs.map +1 -1
- package/bin/run-cli.mjs +19 -13
- package/bin/run-cli.mjs.map +1 -1
- package/{check-node-version-CNvxI8_l.js → check-node-version-BP_a9Mv8.js} +3 -3
- package/{check-node-version-CNvxI8_l.js.map → check-node-version-BP_a9Mv8.js.map} +1 -1
- package/cli/build-command.d.ts +2 -0
- package/cli-ls.d.ts +1 -1
- package/cli.d.ts +1 -1
- package/cli.mjs +39 -79
- package/cli.mjs.map +1 -1
- package/clientgen.d.ts +1 -0
- package/code-fix/{invalid-non-null-assertion.d.ts → no-op-non-null-assertion.d.ts} +1 -1
- package/{compile-Bz8LVwK2.js → compile-BaYaEC1Y.js} +11 -4
- package/compile-BaYaEC1Y.js.map +1 -0
- package/compile.d.ts +1 -1
- package/constants.d.ts +7 -2
- package/contract-class-model-pgJctz5F.js +5456 -0
- package/contract-class-model-pgJctz5F.js.map +1 -0
- package/errors.d.ts +1 -6
- package/index.d.ts +1 -2
- package/index.mjs +36 -26
- package/index.mjs.map +1 -1
- package/language-server/analyser-service.d.ts +0 -1
- package/language-server/compile-trigger-queue.d.ts +2 -2
- package/language-server/puya-language-server.d.ts +0 -38
- package/logger/index.d.ts +0 -7
- package/{options-COFRHTFQ.js → options-8bOJR8qx.js} +2776 -8517
- package/options-8bOJR8qx.js.map +1 -0
- package/options.d.ts +8 -3
- package/package.json +20 -12
- package/puya/check-puya-version.d.ts +0 -13
- package/puya/index.d.ts +1 -1
- package/puya/log-deserializer.d.ts +0 -2
- package/puya/puya-service.d.ts +5 -1
- package/{resolve-puya-path-DtTAMi0Y.js → resolve-puya-path-EZBzWIlE.js} +9 -45
- package/resolve-puya-path-EZBzWIlE.js.map +1 -0
- package/semver-DpFo0aCr.js +45 -0
- package/semver-DpFo0aCr.js.map +1 -0
- package/util/base-85.d.ts +1 -4
- package/util/generate-temp-file.d.ts +0 -8
- package/util/index.d.ts +1 -3
- package/util/typed-message-port.d.ts +2 -2
- package/util-JPoBh0Op.js +63 -0
- package/util-JPoBh0Op.js.map +1 -0
- package/visitor/syntax-names.d.ts +194 -194
- package/visitor/visitor.d.ts +4 -4
- package/analyser-service-_vXhzOY0.js.map +0 -1
- package/compile-Bz8LVwK2.js.map +0 -1
- package/language-server/ls-logger.d.ts +0 -11
- package/options-COFRHTFQ.js.map +0 -1
- package/resolve-puya-path-DtTAMi0Y.js.map +0 -1
- package/util/arc4-signature-parser.d.ts +0 -14
- package/util/polyfills.d.ts +0 -1
|
@@ -2,7 +2,7 @@ import { TransactionKind } from '../../awst/models';
|
|
|
2
2
|
import { SourceLocation } from '../../awst/source-location';
|
|
3
3
|
import { wtypes } from '../../awst/wtypes';
|
|
4
4
|
import { SymbolName } from '../symbol-name';
|
|
5
|
-
import type { ABICompatiblePType, PTypeOrClass } from './base';
|
|
5
|
+
import type { ABICompatiblePType, PTypeField, PTypeOrClass } from './base';
|
|
6
6
|
import { GenericPType, PType } from './base';
|
|
7
7
|
import type { PTypeVisitor } from './visitor';
|
|
8
8
|
export * from './base';
|
|
@@ -135,31 +135,60 @@ declare abstract class StorageProxyPType extends PType {
|
|
|
135
135
|
keyWType: wtypes.WType;
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
+
declare abstract class StateProxyPType extends StorageProxyPType {
|
|
139
|
+
readonly module: string;
|
|
140
|
+
readonly kind: string;
|
|
141
|
+
protected constructor(props: {
|
|
142
|
+
content: PType;
|
|
143
|
+
kind: string;
|
|
144
|
+
});
|
|
145
|
+
get name(): string;
|
|
146
|
+
get fullName(): string;
|
|
147
|
+
}
|
|
138
148
|
export declare const GlobalStateGeneric: GenericPType<GlobalStateType>;
|
|
139
|
-
export declare class GlobalStateType extends
|
|
149
|
+
export declare class GlobalStateType extends StateProxyPType {
|
|
140
150
|
readonly [PType.IdSymbol] = "GlobalStateType";
|
|
141
|
-
|
|
142
|
-
|
|
151
|
+
constructor(props: {
|
|
152
|
+
content: PType;
|
|
153
|
+
});
|
|
154
|
+
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
155
|
+
}
|
|
156
|
+
declare abstract class StateMapProxyPType extends StorageProxyPType {
|
|
143
157
|
readonly module: string;
|
|
158
|
+
readonly kind: string;
|
|
159
|
+
readonly keyType: PType;
|
|
160
|
+
protected constructor(props: {
|
|
161
|
+
content: PType;
|
|
162
|
+
keyType: PType;
|
|
163
|
+
kind: string;
|
|
164
|
+
});
|
|
144
165
|
get name(): string;
|
|
145
166
|
get fullName(): string;
|
|
167
|
+
}
|
|
168
|
+
export declare const GlobalMapGeneric: GenericPType<GlobalMapType>;
|
|
169
|
+
export declare class GlobalMapType extends StateMapProxyPType {
|
|
170
|
+
readonly [PType.IdSymbol] = "GlobalMapType";
|
|
146
171
|
constructor(props: {
|
|
147
172
|
content: PType;
|
|
173
|
+
keyType: PType;
|
|
148
174
|
});
|
|
149
175
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
150
176
|
}
|
|
151
177
|
export declare const LocalStateGeneric: GenericPType<LocalStateType>;
|
|
152
|
-
export declare class LocalStateType extends
|
|
178
|
+
export declare class LocalStateType extends StateProxyPType {
|
|
153
179
|
readonly [PType.IdSymbol] = "LocalStateType";
|
|
154
|
-
static readonly baseName = "LocalState";
|
|
155
|
-
static readonly baseFullName: string;
|
|
156
|
-
readonly module: string;
|
|
157
|
-
get name(): string;
|
|
158
|
-
get fullName(): string;
|
|
159
180
|
constructor(props: {
|
|
160
181
|
content: PType;
|
|
161
182
|
});
|
|
162
|
-
|
|
183
|
+
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
184
|
+
}
|
|
185
|
+
export declare const LocalMapGeneric: GenericPType<LocalMapType>;
|
|
186
|
+
export declare class LocalMapType extends StateMapProxyPType {
|
|
187
|
+
readonly [PType.IdSymbol] = "LocalMapType";
|
|
188
|
+
constructor(props: {
|
|
189
|
+
content: PType;
|
|
190
|
+
keyType: PType;
|
|
191
|
+
});
|
|
163
192
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
164
193
|
}
|
|
165
194
|
export declare const BoxGeneric: GenericPType<BoxPType>;
|
|
@@ -186,7 +215,7 @@ export declare class BoxMapPType extends StorageProxyPType {
|
|
|
186
215
|
});
|
|
187
216
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
188
217
|
}
|
|
189
|
-
export type AppStorageType = GlobalStateType | LocalStateType | BoxPType | BoxMapPType;
|
|
218
|
+
export type AppStorageType = GlobalStateType | LocalStateType | BoxPType | BoxMapPType | GlobalMapType | LocalMapType;
|
|
190
219
|
/**
|
|
191
220
|
* An open generic type parameter
|
|
192
221
|
*/
|
|
@@ -223,7 +252,7 @@ export declare class AnyPType extends PType {
|
|
|
223
252
|
readonly [PType.IdSymbol] = "AnyPType";
|
|
224
253
|
get wtype(): never;
|
|
225
254
|
readonly name = "any";
|
|
226
|
-
readonly module
|
|
255
|
+
readonly module: "lib.d.ts";
|
|
227
256
|
readonly singleton = false;
|
|
228
257
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
229
258
|
}
|
|
@@ -249,8 +278,7 @@ export declare class ABICompatibleInstanceType extends InstanceType implements A
|
|
|
249
278
|
abiTypeSignature: string;
|
|
250
279
|
});
|
|
251
280
|
}
|
|
252
|
-
|
|
253
|
-
readonly [PType.IdSymbol] = "LibFunctionType";
|
|
281
|
+
declare abstract class LibPType extends PType {
|
|
254
282
|
readonly wtype: undefined;
|
|
255
283
|
readonly name: string;
|
|
256
284
|
readonly module: string;
|
|
@@ -259,74 +287,46 @@ export declare class LibFunctionType extends PType {
|
|
|
259
287
|
name: string;
|
|
260
288
|
module: string;
|
|
261
289
|
});
|
|
290
|
+
}
|
|
291
|
+
export declare class LibFunctionType extends LibPType {
|
|
292
|
+
readonly [PType.IdSymbol] = "LibFunctionType";
|
|
262
293
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
263
294
|
}
|
|
264
|
-
export declare class LibClassType extends
|
|
295
|
+
export declare class LibClassType extends LibPType {
|
|
265
296
|
readonly [PType.IdSymbol] = "LibClassType";
|
|
266
|
-
readonly wtype: undefined;
|
|
267
|
-
readonly name: string;
|
|
268
|
-
readonly module: string;
|
|
269
|
-
readonly singleton = true;
|
|
270
|
-
constructor({ name, module }: {
|
|
271
|
-
name: string;
|
|
272
|
-
module: string;
|
|
273
|
-
});
|
|
274
297
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
275
298
|
}
|
|
276
|
-
export declare class LibObjType extends
|
|
299
|
+
export declare class LibObjType extends LibPType {
|
|
277
300
|
readonly [PType.IdSymbol] = "LibObjType";
|
|
278
|
-
readonly wtype: undefined;
|
|
279
|
-
readonly name: string;
|
|
280
|
-
readonly module: string;
|
|
281
|
-
readonly singleton = true;
|
|
282
|
-
constructor({ name, module }: {
|
|
283
|
-
name: string;
|
|
284
|
-
module: string;
|
|
285
|
-
});
|
|
286
301
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
287
302
|
}
|
|
288
|
-
|
|
289
|
-
readonly [PType.IdSymbol] = "IntrinsicFunctionGroupType";
|
|
303
|
+
declare abstract class IntrinsicOpPType extends PType {
|
|
290
304
|
readonly wtype: undefined;
|
|
291
305
|
readonly name: string;
|
|
292
306
|
readonly module: string;
|
|
293
|
-
readonly singleton
|
|
307
|
+
abstract readonly singleton: boolean;
|
|
294
308
|
constructor({ name }: {
|
|
295
309
|
name: string;
|
|
296
310
|
});
|
|
311
|
+
}
|
|
312
|
+
export declare class IntrinsicFunctionGroupType extends IntrinsicOpPType {
|
|
313
|
+
readonly [PType.IdSymbol] = "IntrinsicFunctionGroupType";
|
|
314
|
+
readonly singleton = true;
|
|
297
315
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
298
316
|
}
|
|
299
|
-
export declare class IntrinsicFunctionGroupTypeType extends
|
|
317
|
+
export declare class IntrinsicFunctionGroupTypeType extends IntrinsicOpPType {
|
|
300
318
|
readonly [PType.IdSymbol] = "IntrinsicFunctionGroupTypeType";
|
|
301
|
-
readonly wtype: undefined;
|
|
302
|
-
readonly name: string;
|
|
303
|
-
readonly module: string;
|
|
304
319
|
readonly singleton = false;
|
|
305
|
-
constructor({ name }: {
|
|
306
|
-
name: string;
|
|
307
|
-
});
|
|
308
320
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
309
321
|
}
|
|
310
|
-
export declare class IntrinsicFunctionType extends
|
|
322
|
+
export declare class IntrinsicFunctionType extends IntrinsicOpPType {
|
|
311
323
|
readonly [PType.IdSymbol] = "IntrinsicFunctionType";
|
|
312
|
-
readonly wtype: undefined;
|
|
313
|
-
readonly name: string;
|
|
314
|
-
readonly module: string;
|
|
315
324
|
readonly singleton = true;
|
|
316
|
-
constructor({ name }: {
|
|
317
|
-
name: string;
|
|
318
|
-
});
|
|
319
325
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
320
326
|
}
|
|
321
|
-
export declare class IntrinsicFunctionTypeType extends
|
|
327
|
+
export declare class IntrinsicFunctionTypeType extends IntrinsicOpPType {
|
|
322
328
|
readonly [PType.IdSymbol] = "IntrinsicFunctionTypeType";
|
|
323
|
-
readonly wtype: undefined;
|
|
324
|
-
readonly name: string;
|
|
325
|
-
readonly module: string;
|
|
326
329
|
readonly singleton = false;
|
|
327
|
-
constructor({ name }: {
|
|
328
|
-
name: string;
|
|
329
|
-
});
|
|
330
330
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
331
331
|
}
|
|
332
332
|
export declare const bzeroFunction: IntrinsicFunctionType;
|
|
@@ -334,7 +334,6 @@ export declare class NamespacePType extends PType {
|
|
|
334
334
|
readonly [PType.IdSymbol] = "NamespacePType";
|
|
335
335
|
readonly wtype: undefined;
|
|
336
336
|
readonly name: string;
|
|
337
|
-
readonly factory: undefined;
|
|
338
337
|
readonly module: string;
|
|
339
338
|
readonly singleton = true;
|
|
340
339
|
constructor({ name, module }: {
|
|
@@ -382,26 +381,28 @@ export declare class ArrayLiteralPType extends PType {
|
|
|
382
381
|
getReadonlyTupleType(): ReadonlyTuplePType;
|
|
383
382
|
getMutableTupleType(): MutableTuplePType;
|
|
384
383
|
}
|
|
385
|
-
|
|
386
|
-
readonly [
|
|
384
|
+
declare abstract class TupleBasePType extends PType {
|
|
385
|
+
readonly items: PType[];
|
|
386
|
+
readonly singleton = false;
|
|
387
387
|
readonly module: string;
|
|
388
|
+
private readonly namePrefix;
|
|
389
|
+
protected constructor(props: {
|
|
390
|
+
items: PType[];
|
|
391
|
+
immutable?: boolean;
|
|
392
|
+
});
|
|
388
393
|
get name(): string;
|
|
389
394
|
get fullName(): string;
|
|
390
|
-
|
|
391
|
-
|
|
395
|
+
}
|
|
396
|
+
export declare class MutableTuplePType extends TupleBasePType {
|
|
397
|
+
readonly [PType.IdSymbol] = "MutableTuplePType";
|
|
392
398
|
constructor(props: {
|
|
393
399
|
items: PType[];
|
|
394
400
|
});
|
|
395
401
|
get wtype(): wtypes.ARC4Tuple;
|
|
396
402
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
397
403
|
}
|
|
398
|
-
export declare class ReadonlyTuplePType extends
|
|
404
|
+
export declare class ReadonlyTuplePType extends TupleBasePType {
|
|
399
405
|
readonly [PType.IdSymbol] = "ReadonlyTuplePType";
|
|
400
|
-
readonly module: string;
|
|
401
|
-
get name(): string;
|
|
402
|
-
get fullName(): string;
|
|
403
|
-
readonly items: PType[];
|
|
404
|
-
readonly singleton = false;
|
|
405
406
|
constructor(props: {
|
|
406
407
|
items: PType[];
|
|
407
408
|
});
|
|
@@ -409,33 +410,33 @@ export declare class ReadonlyTuplePType extends PType {
|
|
|
409
410
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
410
411
|
}
|
|
411
412
|
export declare const ArrayGeneric: GenericPType<ArrayPType>;
|
|
412
|
-
|
|
413
|
-
readonly [PType.IdSymbol] = "ArrayPType";
|
|
413
|
+
declare abstract class DynamicArrayBasePType extends PType {
|
|
414
414
|
readonly elementType: PType;
|
|
415
|
-
readonly immutable
|
|
415
|
+
readonly immutable: boolean;
|
|
416
416
|
readonly singleton = false;
|
|
417
417
|
readonly name: string;
|
|
418
418
|
readonly module: string;
|
|
419
|
+
private readonly kind;
|
|
420
|
+
protected constructor(props: {
|
|
421
|
+
elementType: PType;
|
|
422
|
+
immutable: boolean;
|
|
423
|
+
});
|
|
419
424
|
get fullName(): string;
|
|
425
|
+
get wtype(): wtypes.ARC4DynamicArray;
|
|
426
|
+
}
|
|
427
|
+
export declare class ArrayPType extends DynamicArrayBasePType {
|
|
428
|
+
readonly [PType.IdSymbol] = "ArrayPType";
|
|
420
429
|
constructor(props: {
|
|
421
430
|
elementType: PType;
|
|
422
431
|
});
|
|
423
|
-
get wtype(): wtypes.ARC4DynamicArray;
|
|
424
432
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
425
433
|
}
|
|
426
434
|
export declare const ReadonlyArrayGeneric: GenericPType<ReadonlyArrayPType>;
|
|
427
|
-
export declare class ReadonlyArrayPType extends
|
|
435
|
+
export declare class ReadonlyArrayPType extends DynamicArrayBasePType {
|
|
428
436
|
readonly [PType.IdSymbol] = "ReadonlyArrayPType";
|
|
429
|
-
readonly elementType: PType;
|
|
430
|
-
readonly singleton = false;
|
|
431
|
-
readonly immutable = true;
|
|
432
|
-
readonly name: string;
|
|
433
|
-
readonly module: string;
|
|
434
|
-
get fullName(): string;
|
|
435
437
|
constructor(props: {
|
|
436
438
|
elementType: PType;
|
|
437
439
|
});
|
|
438
|
-
get wtype(): wtypes.ARC4DynamicArray;
|
|
439
440
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
440
441
|
}
|
|
441
442
|
export declare const FixedArrayGeneric: GenericPType<FixedArrayPType>;
|
|
@@ -461,24 +462,25 @@ declare abstract class ObjectPType extends PType {
|
|
|
461
462
|
readonly module: string;
|
|
462
463
|
readonly alias: SymbolName | null;
|
|
463
464
|
readonly description: string | undefined;
|
|
464
|
-
readonly properties:
|
|
465
|
+
readonly properties: PTypeField[];
|
|
465
466
|
readonly singleton = false;
|
|
466
467
|
readonly immutable: boolean;
|
|
467
468
|
constructor(props: {
|
|
468
469
|
alias?: SymbolName | null;
|
|
469
|
-
properties:
|
|
470
|
+
properties: PTypeField[];
|
|
470
471
|
description?: string;
|
|
471
472
|
namePrefix: string;
|
|
472
473
|
immutable: boolean;
|
|
473
474
|
});
|
|
474
|
-
orderedProperties(): [string, PType][];
|
|
475
475
|
toString(): string;
|
|
476
|
+
getProperty(name: string): PTypeField | undefined;
|
|
476
477
|
hasSameStructure(other: ObjectPType): boolean;
|
|
478
|
+
protected toWTuple(fallbackName: string): wtypes.WTuple;
|
|
477
479
|
}
|
|
478
480
|
export declare class ObjectLiteralPType extends ObjectPType {
|
|
479
481
|
readonly [PType.IdSymbol] = "ObjectLiteralPType";
|
|
480
482
|
constructor(props: {
|
|
481
|
-
properties:
|
|
483
|
+
properties: PTypeField[];
|
|
482
484
|
});
|
|
483
485
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
484
486
|
getImmutable(): ImmutableObjectPType;
|
|
@@ -489,7 +491,7 @@ export declare class ImmutableObjectPType extends ObjectPType {
|
|
|
489
491
|
readonly [PType.IdSymbol] = "ImmutableObjectPType";
|
|
490
492
|
constructor(props: {
|
|
491
493
|
alias?: SymbolName | null;
|
|
492
|
-
properties:
|
|
494
|
+
properties: PTypeField[];
|
|
493
495
|
description?: string;
|
|
494
496
|
});
|
|
495
497
|
get wtype(): wtypes.WTuple;
|
|
@@ -499,7 +501,7 @@ export declare class MutableObjectPType extends ObjectPType {
|
|
|
499
501
|
readonly [PType.IdSymbol] = "MutableObjectPType";
|
|
500
502
|
constructor(props: {
|
|
501
503
|
alias?: SymbolName | null;
|
|
502
|
-
properties:
|
|
504
|
+
properties: PTypeField[];
|
|
503
505
|
description?: string;
|
|
504
506
|
});
|
|
505
507
|
get wtype(): wtypes.ARC4Struct;
|
|
@@ -573,12 +575,14 @@ export declare const BytesFunction: LibFunctionType;
|
|
|
573
575
|
export declare const logFunction: LibFunctionType;
|
|
574
576
|
export declare const assertFunction: LibFunctionType;
|
|
575
577
|
export declare const errFunction: LibFunctionType;
|
|
578
|
+
export declare const loggedAssertFunction: LibFunctionType;
|
|
579
|
+
export declare const loggedErrFunction: LibFunctionType;
|
|
576
580
|
export declare const assetPType: ABICompatibleInstanceType;
|
|
577
581
|
export declare const AssetFunction: LibFunctionType;
|
|
578
582
|
export declare const accountPType: ABICompatibleInstanceType;
|
|
579
583
|
export declare const AccountFunction: LibFunctionType;
|
|
580
584
|
export declare const applicationPType: ABICompatibleInstanceType;
|
|
581
|
-
export declare const
|
|
585
|
+
export declare const ApplicationFunction: LibFunctionType;
|
|
582
586
|
export declare const ClearStateProgram: FunctionPType;
|
|
583
587
|
export declare const ApprovalProgram: FunctionPType;
|
|
584
588
|
export declare const baseContractType: BaseContractClassType;
|
|
@@ -622,7 +626,7 @@ export declare const AssetTransferTxnFunction: TransactionFunctionType;
|
|
|
622
626
|
export declare const assetFreezeGtxnType: GroupTransactionPType;
|
|
623
627
|
export declare const AssetFreezeTxnFunction: TransactionFunctionType;
|
|
624
628
|
export declare const applicationCallGtxnType: GroupTransactionPType;
|
|
625
|
-
export declare const
|
|
629
|
+
export declare const ApplicationCallTxnFunction: TransactionFunctionType;
|
|
626
630
|
export declare const anyGtxnType: GroupTransactionPType;
|
|
627
631
|
export declare const TransactionFunction: TransactionFunctionType;
|
|
628
632
|
export declare const assertMatchFunction: LibFunctionType;
|
|
@@ -686,12 +690,12 @@ export declare class GeneratorType extends UnsupportedType {
|
|
|
686
690
|
nextType: PType;
|
|
687
691
|
});
|
|
688
692
|
}
|
|
689
|
-
export declare const
|
|
690
|
-
export declare const
|
|
691
|
-
export declare const
|
|
692
|
-
export declare const
|
|
693
|
-
export declare const
|
|
694
|
-
export declare const
|
|
693
|
+
export declare const paymentItxnFunction: TransactionFunctionType;
|
|
694
|
+
export declare const keyRegistrationItxnFunction: TransactionFunctionType;
|
|
695
|
+
export declare const assetConfigItxnFunction: TransactionFunctionType;
|
|
696
|
+
export declare const assetTransferItxnFunction: TransactionFunctionType;
|
|
697
|
+
export declare const assetFreezeItxnFunction: TransactionFunctionType;
|
|
698
|
+
export declare const applicationCallItxnFunction: TransactionFunctionType;
|
|
695
699
|
export declare class InnerTransactionPType extends PType {
|
|
696
700
|
readonly [PType.IdSymbol] = "InnerTransactionPType";
|
|
697
701
|
get wtype(): wtypes.WInnerTransaction;
|
|
@@ -729,13 +733,13 @@ export declare const assetTransferItxnType: InnerTransactionPType;
|
|
|
729
733
|
export declare const assetFreezeItxnParamsType: ItxnParamsPType;
|
|
730
734
|
export declare const assetFreezeItxnType: InnerTransactionPType;
|
|
731
735
|
export declare const applicationCallItxnParamsType: ItxnParamsPType;
|
|
732
|
-
export declare const
|
|
736
|
+
export declare const applicationCallItxnType: InnerTransactionPType;
|
|
733
737
|
export declare const anyItxnParamsType: ItxnParamsPType;
|
|
734
738
|
export declare const anyItxnType: InnerTransactionPType;
|
|
735
739
|
export declare const inputOnlyObjects: ObjectWithOptionalFieldsType[];
|
|
736
740
|
export declare const submitGroupItxnFunction: LibFunctionType;
|
|
737
741
|
export declare const TemplateVarFunction: LibFunctionType;
|
|
738
|
-
export declare const
|
|
742
|
+
export declare const compileFunction: LibFunctionType;
|
|
739
743
|
export declare const compiledContractType: ImmutableObjectPType;
|
|
740
744
|
export declare const compiledLogicSigType: ImmutableObjectPType;
|
|
741
745
|
export declare const arc28EmitFunction: LibFunctionType;
|
|
@@ -762,15 +766,14 @@ export declare class ReferenceArrayType extends PType {
|
|
|
762
766
|
readonly singleton = false;
|
|
763
767
|
readonly sourceLocation: SourceLocation | undefined;
|
|
764
768
|
readonly elementType: PType;
|
|
765
|
-
constructor({ elementType, sourceLocation, name
|
|
769
|
+
constructor({ elementType, sourceLocation, name }: {
|
|
766
770
|
elementType: PType;
|
|
767
771
|
sourceLocation?: SourceLocation;
|
|
768
772
|
name?: string;
|
|
769
|
-
immutable?: boolean;
|
|
770
773
|
});
|
|
771
774
|
get wtype(): wtypes.ReferenceArray;
|
|
772
775
|
accept<T>(visitor: PTypeVisitor<T>): T;
|
|
773
776
|
}
|
|
774
777
|
export declare const itxnComposePType: LibObjType;
|
|
775
|
-
export declare const
|
|
776
|
-
export declare const
|
|
778
|
+
export declare const cloneFunction: LibFunctionType;
|
|
779
|
+
export declare const validateEncodingFunction: LibFunctionType;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PType } from './base';
|
|
1
|
+
import type { PType, PTypeField } from './base';
|
|
2
2
|
export declare const ptypeIn: (target: PType, ...ptypes: [PType, ...PType[]]) => boolean;
|
|
3
|
-
export declare function generateObjectHash(objectProperties:
|
|
3
|
+
export declare function generateObjectHash(objectProperties: PTypeField[]): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ARC4InstanceType, ARC4StructClass, ARC4StructType, ARC4TupleType, ContractProxyType, DynamicArrayType, StaticArrayType, UFixedNxMType, UintNType } from './arc4-types';
|
|
2
|
-
import type { AnyPType, ArrayLiteralPType, ArrayPType, BoxMapPType, BoxPType, BytesPType, ContractClassPType, FixedArrayPType, FunctionPType, GenericPType, GlobalStateType, GroupTransactionPType, ImmutableObjectPType, InnerTransactionPType, InstanceType, InternalType, IntrinsicEnumType, IntrinsicFunctionGroupType, IntrinsicFunctionGroupTypeType, IntrinsicFunctionType, IntrinsicFunctionTypeType, IterableIteratorType, ItxnParamsPType, LibClassType, LibFunctionType, LibObjType, LocalStateType, LogicSigPType, MutableObjectPType, MutableTuplePType, NamespacePType, ObjectLiteralPType, ReadonlyArrayPType, ReadonlyTuplePType, ReferenceArrayType, SuperPrototypeSelector, TransientType, TypeParameterType, Uint64EnumMemberType, Uint64EnumType, UnsupportedType } from './index';
|
|
2
|
+
import type { AnyPType, ArrayLiteralPType, ArrayPType, BoxMapPType, BoxPType, BytesPType, ContractClassPType, FixedArrayPType, FunctionPType, GenericPType, GlobalMapType, GlobalStateType, GroupTransactionPType, ImmutableObjectPType, InnerTransactionPType, InstanceType, InternalType, IntrinsicEnumType, IntrinsicFunctionGroupType, IntrinsicFunctionGroupTypeType, IntrinsicFunctionType, IntrinsicFunctionTypeType, IterableIteratorType, ItxnParamsPType, LibClassType, LibFunctionType, LibObjType, LocalMapType, LocalStateType, LogicSigPType, MutableObjectPType, MutableTuplePType, NamespacePType, ObjectLiteralPType, ReadonlyArrayPType, ReadonlyTuplePType, ReferenceArrayType, SuperPrototypeSelector, TransientType, TypeParameterType, Uint64EnumMemberType, Uint64EnumType, UnsupportedType } from './index';
|
|
3
3
|
export interface PTypeVisitor<T> {
|
|
4
4
|
visitGeneric(ptype: GenericPType): T;
|
|
5
5
|
visitMutableObjectPType(ptype: MutableObjectPType): T;
|
|
@@ -43,7 +43,9 @@ export interface PTypeVisitor<T> {
|
|
|
43
43
|
visitInstanceType(ptype: InstanceType): T;
|
|
44
44
|
visitContractClassPType(ptype: ContractClassPType): T;
|
|
45
45
|
visitGlobalStateType(ptype: GlobalStateType): T;
|
|
46
|
+
visitGlobalMapType(ptype: GlobalMapType): T;
|
|
46
47
|
visitLocalStateType(ptype: LocalStateType): T;
|
|
48
|
+
visitLocalMapType(ptype: LocalMapType): T;
|
|
47
49
|
visitBoxPType(ptype: BoxPType): T;
|
|
48
50
|
visitBoxMapPType(ptype: BoxMapPType): T;
|
|
49
51
|
visitTypeParameterType(ptype: TypeParameterType): T;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyPType, ArrayLiteralPType, ArrayPType, BoxMapPType, BoxPType, BytesPType, ContractClassPType, FixedArrayPType, FunctionPType, GlobalStateType, GroupTransactionPType, ImmutableObjectPType, InnerTransactionPType, InstanceType, InternalType, IntrinsicFunctionGroupType, IntrinsicFunctionGroupTypeType, IntrinsicFunctionType, IntrinsicFunctionTypeType, IterableIteratorType, ItxnParamsPType, LibClassType, LibFunctionType, LibObjType, LocalStateType, LogicSigPType, MutableObjectPType, MutableTuplePType, NamespacePType, ObjectLiteralPType, ReadonlyArrayPType, ReadonlyTuplePType, ReferenceArrayType, SuperPrototypeSelector, TransientType, TypeParameterType, Uint64EnumMemberType, Uint64EnumType, UnsupportedType } from '..';
|
|
1
|
+
import type { AnyPType, ArrayLiteralPType, ArrayPType, BoxMapPType, BoxPType, BytesPType, ContractClassPType, FixedArrayPType, FunctionPType, GlobalMapType, GlobalStateType, GroupTransactionPType, ImmutableObjectPType, InnerTransactionPType, InstanceType, InternalType, IntrinsicFunctionGroupType, IntrinsicFunctionGroupTypeType, IntrinsicFunctionType, IntrinsicFunctionTypeType, IterableIteratorType, ItxnParamsPType, LibClassType, LibFunctionType, LibObjType, LocalMapType, LocalStateType, LogicSigPType, MutableObjectPType, MutableTuplePType, NamespacePType, ObjectLiteralPType, ReadonlyArrayPType, ReadonlyTuplePType, ReferenceArrayType, SuperPrototypeSelector, TransientType, TypeParameterType, Uint64EnumMemberType, Uint64EnumType, UnsupportedType } from '..';
|
|
2
2
|
import type { ARC4InstanceType, ARC4StructClass, ARC4StructType, ARC4TupleType, ContractProxyType, DynamicArrayType, StaticArrayType, UFixedNxMType, UintNType } from '../arc4-types';
|
|
3
3
|
import type { GenericPType, PType } from '../base';
|
|
4
4
|
import type { IntrinsicEnumType } from '../intrinsic-enum-type';
|
|
@@ -49,7 +49,9 @@ export declare abstract class DefaultVisitor<T> implements PTypeVisitor<T> {
|
|
|
49
49
|
visitInstanceType(ptype: InstanceType): T;
|
|
50
50
|
visitContractClassPType(ptype: ContractClassPType): T;
|
|
51
51
|
visitGlobalStateType(ptype: GlobalStateType): T;
|
|
52
|
+
visitGlobalMapType(ptype: GlobalMapType): T;
|
|
52
53
|
visitLocalStateType(ptype: LocalStateType): T;
|
|
54
|
+
visitLocalMapType(ptype: LocalMapType): T;
|
|
53
55
|
visitBoxPType(ptype: BoxPType): T;
|
|
54
56
|
visitBoxMapPType(ptype: BoxMapPType): T;
|
|
55
57
|
visitTypeParameterType(ptype: TypeParameterType): T;
|
|
@@ -1,36 +1,5 @@
|
|
|
1
1
|
import type { SourceLocation } from '../../../awst/source-location';
|
|
2
|
-
import type { ARC4StructType, DynamicArrayType, StaticArrayType } from '../arc4-types';
|
|
3
2
|
import type { PType } from '../base';
|
|
4
|
-
import type { ArrayLiteralPType, ArrayPType, FixedArrayPType, ImmutableObjectPType, MutableObjectPType, MutableTuplePType, ObjectLiteralPType, ReadonlyArrayPType, ReadonlyTuplePType, ReferenceArrayType } from '../index';
|
|
5
|
-
import { DefaultVisitor } from './default-visitor';
|
|
6
|
-
export declare function hasProperty(ptype: PType, property: string, sourceLocation: SourceLocation): boolean;
|
|
7
3
|
export declare function hasPropertyOfType(ptype: PType, property: string, propType: PType, sourceLocation: SourceLocation): boolean;
|
|
8
4
|
export declare function getPropertyType(ptype: PType, property: string, sourceLocation: SourceLocation): PType;
|
|
9
5
|
export declare function getIndexType(ptype: PType, index: bigint | string, sourceLocation: SourceLocation): PType | undefined;
|
|
10
|
-
export declare class IndexTypeVisitor extends DefaultVisitor<PType | undefined> {
|
|
11
|
-
private readonly index;
|
|
12
|
-
private readonly sourceLocation;
|
|
13
|
-
constructor(index: string | bigint, sourceLocation: SourceLocation);
|
|
14
|
-
/**
|
|
15
|
-
* Return the type that would result from accessing the specified index of a value of this type.
|
|
16
|
-
*
|
|
17
|
-
* @param ptype
|
|
18
|
-
* @param index
|
|
19
|
-
* @param sourceLocation
|
|
20
|
-
*/
|
|
21
|
-
static accept(ptype: PType, index: string | bigint, sourceLocation: SourceLocation): PType | undefined;
|
|
22
|
-
defaultReturn(ptype: PType): PType | undefined;
|
|
23
|
-
visitARC4StructType(ptype: ARC4StructType): PType | undefined;
|
|
24
|
-
visitImmutableObjectPType(ptype: ImmutableObjectPType): PType | undefined;
|
|
25
|
-
visitMutableObjectPType(ptype: MutableObjectPType): PType | undefined;
|
|
26
|
-
visitObjectLiteralPType(ptype: ObjectLiteralPType): PType | undefined;
|
|
27
|
-
visitReferenceArrayType(ptype: ReferenceArrayType): PType | undefined;
|
|
28
|
-
visitDynamicArrayType(ptype: DynamicArrayType): PType | undefined;
|
|
29
|
-
visitStaticArrayType(ptype: StaticArrayType): PType | undefined;
|
|
30
|
-
visitFixedArrayPType(ptype: FixedArrayPType): PType | undefined;
|
|
31
|
-
visitReadonlyArrayPType(ptype: ReadonlyArrayPType): PType | undefined;
|
|
32
|
-
visitArrayPType(ptype: ArrayPType): PType | undefined;
|
|
33
|
-
visitReadonlyTuplePType(ptype: ReadonlyTuplePType): PType | undefined;
|
|
34
|
-
visitMutableTuplePType(ptype: MutableTuplePType): PType | undefined;
|
|
35
|
-
visitArrayLiteralPType(ptype: ArrayLiteralPType): PType | undefined;
|
|
36
|
-
}
|
|
@@ -32,7 +32,7 @@ export declare class TypeResolver {
|
|
|
32
32
|
private reflectStructType;
|
|
33
33
|
private reflectContractType;
|
|
34
34
|
private resolveClusteredPrototype;
|
|
35
|
-
getTypeName(type: ts.Type
|
|
35
|
+
getTypeName(type: ts.Type): SymbolName | undefined;
|
|
36
36
|
private getLocationOfSymbol;
|
|
37
37
|
private tryGetLocalSymbolName;
|
|
38
38
|
private getSymbolFullName;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { arc32ToArc56 } from '@algorandfoundation/algokit-utils/app-spec';
|
|
3
|
+
import { ArgumentParser } from 'argparse';
|
|
4
|
+
import { readFile } from 'fs/promises';
|
|
5
|
+
import { w as writeARC4Client } from '../arc4-clientgen-BMCeFyNd.js';
|
|
6
|
+
import { a as appVersion } from '../semver-DpFo0aCr.js';
|
|
7
|
+
import { c as checkNodeVersion } from '../check-node-version-BP_a9Mv8.js';
|
|
8
|
+
import { a as addEnumArg, C as ConsoleLogSink } from '../util-JPoBh0Op.js';
|
|
9
|
+
import { L as LogLevel, l as logger, A as AbsolutePath, P as PuyaError, a as LoggingContext } from '../contract-class-model-pgJctz5F.js';
|
|
10
|
+
import '@algorandfoundation/algokit-utils/abi';
|
|
11
|
+
import 'fs';
|
|
12
|
+
import 'node:url';
|
|
13
|
+
import 'pathe';
|
|
14
|
+
import 'chalk';
|
|
15
|
+
import 'typescript';
|
|
16
|
+
import 'node:fs';
|
|
17
|
+
import 'node:util';
|
|
18
|
+
import 'node:crypto';
|
|
19
|
+
import 'polytype';
|
|
20
|
+
import 'node:async_hooks';
|
|
21
|
+
|
|
22
|
+
async function parseCliArguments() {
|
|
23
|
+
checkNodeVersion();
|
|
24
|
+
const parser = new ArgumentParser({
|
|
25
|
+
prog: 'puya-ts-clientgen',
|
|
26
|
+
});
|
|
27
|
+
addEnumArg(parser, {
|
|
28
|
+
name: '--log-level',
|
|
29
|
+
default: LogLevel.Info,
|
|
30
|
+
enumType: LogLevel,
|
|
31
|
+
help: 'The minimum log level to output',
|
|
32
|
+
});
|
|
33
|
+
parser.add_argument('--version', {
|
|
34
|
+
action: 'store_const',
|
|
35
|
+
help: 'Show application version',
|
|
36
|
+
const: 'version',
|
|
37
|
+
dest: 'command',
|
|
38
|
+
});
|
|
39
|
+
parser.add_argument('specs', {
|
|
40
|
+
metavar: 'SPECS',
|
|
41
|
+
nargs: '+',
|
|
42
|
+
help: 'The path, or paths to the .arc32.json or .arc56.json files',
|
|
43
|
+
});
|
|
44
|
+
parser.add_argument('--out-dir', {
|
|
45
|
+
action: 'store',
|
|
46
|
+
help: 'Where to output clientgen artifacts',
|
|
47
|
+
default: 'out',
|
|
48
|
+
});
|
|
49
|
+
parser.set_defaults({
|
|
50
|
+
command: 'clientgen',
|
|
51
|
+
});
|
|
52
|
+
const result = parser.parse_args();
|
|
53
|
+
switch (result.command) {
|
|
54
|
+
case 'clientgen':
|
|
55
|
+
await outputStubs(result.specs, result.out_dir, result.log_level);
|
|
56
|
+
break;
|
|
57
|
+
case 'version':
|
|
58
|
+
/* eslint-disable-next-line no-console */
|
|
59
|
+
console.log(appVersion());
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
parser.print_help();
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function outputStubs(paths, outDir, logLevel) {
|
|
67
|
+
const logCtx = LoggingContext.create();
|
|
68
|
+
return logCtx.run(async () => {
|
|
69
|
+
logger.configure([new ConsoleLogSink(logLevel, AbsolutePath.resolve({ path: '' }))]);
|
|
70
|
+
for (const appSpecPath of paths) {
|
|
71
|
+
try {
|
|
72
|
+
const appSpecJSON = JSON.parse(await readFile(appSpecPath, { encoding: 'utf-8' }));
|
|
73
|
+
let appSpec;
|
|
74
|
+
if (appSpecPath.endsWith('.arc56.json')) {
|
|
75
|
+
appSpec = appSpecJSON;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
appSpec = arc32ToArc56(appSpecJSON);
|
|
79
|
+
}
|
|
80
|
+
const sourceFile = AbsolutePath.resolve({ path: appSpecPath });
|
|
81
|
+
const outFile = AbsolutePath.resolve({ path: outDir, workingDirectory: sourceFile.resolve('..') }).join(`${appSpec.name}.client.ts`);
|
|
82
|
+
await writeARC4Client(appSpec, outFile);
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
if (e instanceof PuyaError) {
|
|
86
|
+
logger.error(e);
|
|
87
|
+
}
|
|
88
|
+
else if (e instanceof Error) {
|
|
89
|
+
logger.error(e);
|
|
90
|
+
throw e;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
throw e;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
logCtx.exitIfErrors();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
void parseCliArguments();
|
|
101
|
+
//# sourceMappingURL=puyats-clientgen.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"puyats-clientgen.mjs","sources":["../../src/clientgen.ts"],"sourcesContent":["import type { Arc56Contract } from '@algorandfoundation/algokit-utils/abi'\nimport { arc32ToArc56 } from '@algorandfoundation/algokit-utils/app-spec'\nimport { ArgumentParser } from 'argparse'\nimport { readFile } from 'fs/promises'\nimport { writeARC4Client } from './arc4-clientgen'\nimport { appVersion } from './cli/app-version'\nimport { checkNodeVersion } from './cli/check-node-version'\nimport { addEnumArg } from './cli/util'\nimport { PuyaError } from './errors'\nimport { logger, LoggingContext, LogLevel } from './logger'\nimport { ConsoleLogSink } from './logger/sinks/console-log-sink'\nimport { AbsolutePath } from './util/absolute-path'\n\ninterface ClientgenCommandArgs {\n command: 'clientgen'\n specs: string[]\n out_dir: string\n log_level: LogLevel\n}\n\ninterface VersionCommand {\n command: 'version'\n}\n\ntype PuyaTsClientgenCommand = ClientgenCommandArgs | VersionCommand\n\nasync function parseCliArguments() {\n checkNodeVersion()\n const parser = new ArgumentParser({\n prog: 'puya-ts-clientgen',\n })\n\n addEnumArg(parser, {\n name: '--log-level',\n default: LogLevel.Info,\n enumType: LogLevel,\n help: 'The minimum log level to output',\n })\n parser.add_argument('--version', {\n action: 'store_const',\n help: 'Show application version',\n const: 'version',\n dest: 'command',\n })\n parser.add_argument('specs', {\n metavar: 'SPECS',\n nargs: '+',\n help: 'The path, or paths to the .arc32.json or .arc56.json files',\n })\n parser.add_argument('--out-dir', {\n action: 'store',\n help: 'Where to output clientgen artifacts',\n default: 'out',\n })\n parser.set_defaults({\n command: 'clientgen',\n })\n const result: PuyaTsClientgenCommand = parser.parse_args()\n switch (result.command) {\n case 'clientgen':\n await outputStubs(result.specs, result.out_dir, result.log_level)\n break\n case 'version':\n /* eslint-disable-next-line no-console */\n console.log(appVersion())\n break\n default:\n parser.print_help()\n break\n }\n}\n\nasync function outputStubs(paths: string[], outDir: string, logLevel: LogLevel) {\n const logCtx = LoggingContext.create()\n return logCtx.run(async () => {\n logger.configure([new ConsoleLogSink(logLevel, AbsolutePath.resolve({ path: '' }))])\n for (const appSpecPath of paths) {\n try {\n const appSpecJSON = JSON.parse(await readFile(appSpecPath, { encoding: 'utf-8' }))\n let appSpec: Arc56Contract\n if (appSpecPath.endsWith('.arc56.json')) {\n appSpec = appSpecJSON\n } else {\n appSpec = arc32ToArc56(appSpecJSON)\n }\n const sourceFile = AbsolutePath.resolve({ path: appSpecPath })\n const outFile = AbsolutePath.resolve({ path: outDir, workingDirectory: sourceFile.resolve('..') }).join(`${appSpec.name}.client.ts`)\n await writeARC4Client(appSpec, outFile)\n } catch (e) {\n if (e instanceof PuyaError) {\n logger.error(e)\n } else if (e instanceof Error) {\n logger.error(e)\n throw e\n } else {\n throw e\n }\n }\n }\n logCtx.exitIfErrors()\n })\n}\n\nvoid parseCliArguments()\n"],"names":[],"mappings":"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"}
|