@algorandfoundation/puya-ts 1.0.0-alpha.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/awst/index.d.ts +0 -1
- package/awst/intrinsic-factory.d.ts +1 -1
- package/awst/models.d.ts +4 -4
- package/awst/node-factory.d.ts +15 -7
- package/awst/nodes.d.ts +16 -17
- package/awst/source-location.d.ts +8 -4
- package/awst/to-code-visitor.d.ts +2 -1
- package/awst/txn-fields.d.ts +1 -1
- package/awst/wtypes.d.ts +167 -126
- package/awst_build/arc4-util.d.ts +9 -0
- package/awst_build/{base-visitor.d.ts → ast-visitors/base-visitor.d.ts} +14 -8
- package/awst_build/{constructor-visitor.d.ts → ast-visitors/constructor-visitor.d.ts} +3 -3
- package/awst_build/{contract-method-visitor.d.ts → ast-visitors/contract-method-visitor.d.ts} +10 -11
- package/awst_build/{contract-visitor.d.ts → ast-visitors/contract-visitor.d.ts} +11 -15
- package/awst_build/{decorator-visitor.d.ts → ast-visitors/decorator-visitor.d.ts} +4 -4
- package/awst_build/{function-visitor.d.ts → ast-visitors/function-visitor.d.ts} +9 -9
- package/awst_build/ast-visitors/logic-sig-program-visitor.d.ts +10 -0
- package/awst_build/ast-visitors/logic-sig-visitor.d.ts +24 -0
- package/awst_build/{source-file-visitor.d.ts → ast-visitors/source-file-visitor.d.ts} +4 -4
- package/awst_build/ast-visitors/struct-visitor.d.ts +20 -0
- package/awst_build/{subroutine-visitor.d.ts → ast-visitors/subroutine-visitor.d.ts} +2 -2
- package/awst_build/{text-visitor.d.ts → ast-visitors/text-visitor.d.ts} +3 -3
- package/awst_build/constant-store.d.ts +9 -0
- package/awst_build/context/awst-build-context.d.ts +11 -7
- package/awst_build/eb/arc4/arrays.d.ts +30 -15
- package/awst_build/eb/arc4/base.d.ts +11 -0
- package/awst_build/eb/arc4/bool.d.ts +14 -0
- package/awst_build/eb/arc4/string.d.ts +14 -0
- package/awst_build/eb/arc4/struct.d.ts +16 -0
- package/awst_build/eb/arc4/tuple.d.ts +15 -0
- package/awst_build/eb/arc4/ufixed.d.ts +13 -0
- package/awst_build/eb/arc4/uintn.d.ts +18 -0
- package/awst_build/eb/arc4-bare-method-decorator-builder.d.ts +3 -4
- package/awst_build/eb/assert-function-builder.d.ts +3 -3
- package/awst_build/eb/assert-match-function-builder.d.ts +1 -2
- package/awst_build/eb/biguint-expression-builder.d.ts +3 -4
- package/awst_build/eb/boolean-expression-builder.d.ts +1 -1
- package/awst_build/eb/bytes-expression-builder.d.ts +7 -10
- package/awst_build/eb/contract-builder.d.ts +3 -2
- package/awst_build/eb/ensure-budget.d.ts +2 -2
- package/awst_build/eb/free-subroutine-expression-builder.d.ts +2 -2
- package/awst_build/eb/index.d.ts +11 -6
- package/awst_build/eb/literal/big-int-literal-expression-builder.d.ts +3 -0
- package/awst_build/eb/literal/object-literal-expression-builder.d.ts +1 -2
- package/awst_build/eb/literal-expression-builder.d.ts +1 -2
- package/awst_build/eb/log-function-builder.d.ts +2 -2
- package/awst_build/eb/op-module-builder.d.ts +11 -3
- package/awst_build/eb/reference/account.d.ts +1 -1
- package/awst_build/eb/reference/application.d.ts +2 -2
- package/awst_build/eb/reference/asset.d.ts +2 -2
- package/awst_build/eb/shared/at-function-builder.d.ts +15 -0
- package/awst_build/eb/shared/slice-function-builder.d.ts +14 -0
- package/awst_build/eb/storage/box/base.d.ts +25 -0
- package/awst_build/eb/storage/box/box-map.d.ts +13 -0
- package/awst_build/eb/storage/box/box-ref.d.ts +35 -0
- package/awst_build/eb/storage/box/box.d.ts +13 -0
- package/awst_build/eb/storage/box/index.d.ts +4 -0
- package/awst_build/eb/storage/global-state.d.ts +2 -2
- package/awst_build/eb/storage/local-state.d.ts +5 -5
- package/awst_build/eb/storage/util.d.ts +3 -3
- package/awst_build/eb/storage/value-proxy.d.ts +1 -1
- package/awst_build/eb/string-expression-builder.d.ts +2 -2
- package/awst_build/eb/template-var.d.ts +8 -0
- package/awst_build/eb/transactions/group-transactions.d.ts +2 -2
- package/awst_build/eb/transactions/inner-transaction-params.d.ts +3 -3
- package/awst_build/eb/uint64-enum-type-builder.d.ts +4 -1
- package/awst_build/eb/uint64-expression-builder.d.ts +2 -3
- package/awst_build/eb/urange-function.d.ts +2 -2
- package/awst_build/eb/util/arg-parsing.d.ts +17 -8
- package/awst_build/eb/util/get-bigint-or-uint64-expr.d.ts +2 -0
- package/awst_build/eb/util/index.d.ts +1 -1
- package/awst_build/index.d.ts +1 -1
- package/awst_build/lib/index.d.ts +2 -2
- package/awst_build/{contract-data.d.ts → models/app-storage-declaration.d.ts} +5 -5
- package/awst_build/models/contract-class-model.d.ts +36 -0
- package/awst_build/models/logic-sig-class-model.d.ts +17 -0
- package/awst_build/ptypes/arc4-types.d.ts +110 -21
- package/awst_build/ptypes/base.d.ts +13 -2
- package/awst_build/ptypes/index.d.ts +72 -36
- package/awst_build/ptypes/util.d.ts +4 -0
- package/awst_build/type-registry.d.ts +6 -10
- package/awst_build/type-resolver.d.ts +6 -2
- package/bin/run-cli.mjs +4 -4
- package/cli.mjs +112 -27
- package/cli.mjs.map +1 -1
- package/constants.d.ts +8 -0
- package/errors.d.ts +1 -0
- package/{index-QWk75fJN.js → index-3stwXqkP.js} +7530 -5480
- package/index-3stwXqkP.js.map +1 -0
- package/index.d.ts +23 -6
- package/index.mjs +3 -3
- package/{logger.d.ts → logger/index.d.ts} +18 -13
- package/logger/sinks/console-log-sink.d.ts +9 -0
- package/logger/sinks/index.d.ts +5 -0
- package/package.json +1 -1
- package/parser/index.d.ts +2 -6
- package/puya/build-compilation-set-mapping.d.ts +1 -1
- package/puya/index.d.ts +1 -1
- package/puya/{run-child-proc.d.ts → run-puya.d.ts} +1 -1
- package/util/custom-key-map.d.ts +17 -0
- package/util/generate-temp-file.d.ts +5 -0
- package/util/index.d.ts +5 -0
- package/awst_build/eb/arc4/uint-n-constructor-builder.d.ts +0 -14
- package/awst_build/eb/storage/box.d.ts +0 -50
- package/index-QWk75fJN.js.map +0 -1
package/awst/index.d.ts
CHANGED
package/awst/models.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContractClassPType } from '../awst_build/ptypes';
|
|
1
|
+
import type { ContractClassPType, LogicSigPType } from '../awst_build/ptypes';
|
|
2
2
|
import type { Props } from '../typescript-helpers';
|
|
3
3
|
import type { SourceLocation } from './source-location';
|
|
4
4
|
export declare enum OnCompletionAction {
|
|
@@ -21,7 +21,7 @@ export declare class ARC4BareMethodConfig extends ModelBase {
|
|
|
21
21
|
readonly sourceLocation: SourceLocation | undefined;
|
|
22
22
|
readonly allowedCompletionTypes: OnCompletionAction[];
|
|
23
23
|
readonly create: ARC4CreateOption;
|
|
24
|
-
readonly isBare
|
|
24
|
+
readonly isBare = true;
|
|
25
25
|
constructor(props: Omit<Props<ARC4BareMethodConfig>, 'isBare'>);
|
|
26
26
|
}
|
|
27
27
|
export type DefaultArgumentSource = {
|
|
@@ -40,7 +40,7 @@ export type DefaultArgumentSource = {
|
|
|
40
40
|
export declare class ARC4ABIMethodConfig extends ModelBase {
|
|
41
41
|
readonly sourceLocation: SourceLocation | undefined;
|
|
42
42
|
readonly name: string;
|
|
43
|
-
readonly isBare
|
|
43
|
+
readonly isBare = false;
|
|
44
44
|
readonly create: ARC4CreateOption;
|
|
45
45
|
readonly readonly: boolean;
|
|
46
46
|
readonly allowedCompletionTypes: OnCompletionAction[];
|
|
@@ -72,8 +72,8 @@ export declare class LogicSigReference extends ModelBase {
|
|
|
72
72
|
readonly moduleName: string;
|
|
73
73
|
get id(): string;
|
|
74
74
|
toString(): string;
|
|
75
|
+
static fromPType(logicSigPType: LogicSigPType): LogicSigReference;
|
|
75
76
|
}
|
|
76
|
-
export type CompilationSet = ReadonlyArray<ContractReference | LogicSigReference>;
|
|
77
77
|
export declare enum TransactionKind {
|
|
78
78
|
pay = 1,
|
|
79
79
|
keyreg = 2,
|
package/awst/node-factory.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Props } from '../typescript-helpers';
|
|
2
2
|
import type { Expression, Statement } from './nodes';
|
|
3
|
-
import { AssignmentExpression, AssignmentStatement, BigUIntBinaryOperation, Block, BoolConstant, BooleanBinaryOperation, BytesComparisonExpression, BytesConstant, BytesEncoding, CheckedMaybe, concreteNodes, Copy, ExpressionStatement, IntegerConstant, IntrinsicCall, MethodDocumentation, Not, NumericComparisonExpression, SingleEvaluation, StringConstant, TupleExpression, TupleItemExpression, UInt64BinaryOperation, VoidConstant } from './nodes';
|
|
3
|
+
import { AssignmentExpression, AssignmentStatement, BigUIntBinaryOperation, Block, BoolConstant, BooleanBinaryOperation, BytesComparisonExpression, BytesConstant, BytesEncoding, CheckedMaybe, concreteNodes, Copy, ExpressionStatement, IntegerConstant, IntrinsicCall, MethodDocumentation, Not, NumericComparisonExpression, ReinterpretCast, SingleEvaluation, StringConstant, TupleExpression, TupleItemExpression, UInt64BinaryOperation, VoidConstant } from './nodes';
|
|
4
4
|
import type { SourceLocation } from './source-location';
|
|
5
|
-
import
|
|
5
|
+
import { wtypes } from './wtypes';
|
|
6
6
|
type ConcreteNodes = typeof concreteNodes;
|
|
7
7
|
declare const explicitNodeFactory: {
|
|
8
8
|
voidConstant(props: {
|
|
@@ -12,18 +12,19 @@ declare const explicitNodeFactory: {
|
|
|
12
12
|
value: Uint8Array;
|
|
13
13
|
encoding?: BytesEncoding;
|
|
14
14
|
sourceLocation: SourceLocation;
|
|
15
|
-
wtype?: WType;
|
|
15
|
+
wtype?: wtypes.WType;
|
|
16
16
|
}): BytesConstant;
|
|
17
17
|
stringConstant(props: {
|
|
18
18
|
value: string;
|
|
19
19
|
sourceLocation: SourceLocation;
|
|
20
|
+
wtype?: wtypes.WType;
|
|
20
21
|
}): StringConstant;
|
|
21
|
-
uInt64Constant(
|
|
22
|
+
uInt64Constant({ value, tealAlias, sourceLocation, }: {
|
|
22
23
|
value: bigint;
|
|
23
24
|
tealAlias?: string;
|
|
24
25
|
sourceLocation: SourceLocation;
|
|
25
26
|
}): IntegerConstant;
|
|
26
|
-
bigUIntConstant(
|
|
27
|
+
bigUIntConstant({ value, sourceLocation }: {
|
|
27
28
|
value: bigint;
|
|
28
29
|
sourceLocation: SourceLocation;
|
|
29
30
|
}): IntegerConstant;
|
|
@@ -44,7 +45,7 @@ declare const explicitNodeFactory: {
|
|
|
44
45
|
}): SingleEvaluation;
|
|
45
46
|
expressionStatement({ expr }: {
|
|
46
47
|
expr: Expression;
|
|
47
|
-
}): ExpressionStatement;
|
|
48
|
+
}): ExpressionStatement | AssignmentStatement;
|
|
48
49
|
block({ sourceLocation, comment, label }: {
|
|
49
50
|
sourceLocation: SourceLocation;
|
|
50
51
|
comment?: string;
|
|
@@ -61,7 +62,9 @@ declare const explicitNodeFactory: {
|
|
|
61
62
|
value: Expression;
|
|
62
63
|
sourceLocation: SourceLocation;
|
|
63
64
|
}): AssignmentStatement;
|
|
64
|
-
tupleExpression(props: Omit<Props<TupleExpression>, "wtype">
|
|
65
|
+
tupleExpression(props: Omit<Props<TupleExpression>, "wtype"> & {
|
|
66
|
+
wtype?: wtypes.WTuple;
|
|
67
|
+
}): TupleExpression;
|
|
65
68
|
methodDocumentation(props?: {
|
|
66
69
|
description?: string | null;
|
|
67
70
|
args?: Map<string, string>;
|
|
@@ -79,6 +82,11 @@ declare const explicitNodeFactory: {
|
|
|
79
82
|
comment: string;
|
|
80
83
|
}): CheckedMaybe;
|
|
81
84
|
tupleItemExpression(props: Omit<Props<TupleItemExpression>, "wtype">): TupleItemExpression;
|
|
85
|
+
reinterpretCast({ expr, wtype, sourceLocation }: {
|
|
86
|
+
expr: Expression;
|
|
87
|
+
wtype: wtypes.WType;
|
|
88
|
+
sourceLocation: SourceLocation;
|
|
89
|
+
}): BytesConstant | ReinterpretCast;
|
|
82
90
|
};
|
|
83
91
|
type ExplicitNodeFactory = typeof explicitNodeFactory;
|
|
84
92
|
type DefaultNodeFactory<TKey extends keyof ConcreteNodes> = (...args: ConstructorParameters<ConcreteNodes[TKey]>) => InstanceType<ConcreteNodes[TKey]>;
|
package/awst/nodes.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Props } from '../typescript-helpers';
|
|
|
2
2
|
import type { ARC4ABIMethodConfig, ARC4BareMethodConfig, ContractReference, LogicSigReference } from './models';
|
|
3
3
|
import type { SourceLocation } from './source-location';
|
|
4
4
|
import type { TxnField } from './txn-fields';
|
|
5
|
-
import type
|
|
5
|
+
import type { wtypes } from './wtypes';
|
|
6
6
|
export declare class SubroutineID {
|
|
7
7
|
constructor(props: Props<SubroutineID>);
|
|
8
8
|
target: string;
|
|
@@ -80,7 +80,7 @@ export declare class IntegerConstant extends Expression {
|
|
|
80
80
|
export declare class DecimalConstant extends Expression {
|
|
81
81
|
constructor(props: Props<DecimalConstant>);
|
|
82
82
|
wtype: wtypes.ARC4UFixedNxM;
|
|
83
|
-
value:
|
|
83
|
+
value: string;
|
|
84
84
|
accept<T>(visitor: ExpressionVisitor<T>): T;
|
|
85
85
|
}
|
|
86
86
|
export declare class BoolConstant extends Expression {
|
|
@@ -586,8 +586,6 @@ export declare class ContractMethod extends ContractMethod_base {
|
|
|
586
586
|
cref: ContractReference;
|
|
587
587
|
memberName: string;
|
|
588
588
|
arc4MethodConfig: ARC4BareMethodConfig | ARC4ABIMethodConfig | null;
|
|
589
|
-
synthetic: boolean;
|
|
590
|
-
inheritable: boolean;
|
|
591
589
|
accept<T>(visitor: ContractMemberNodeVisitor<T>): T;
|
|
592
590
|
}
|
|
593
591
|
export declare enum AppStorageKind {
|
|
@@ -611,6 +609,7 @@ export declare class LogicSignature extends RootNode {
|
|
|
611
609
|
shortName: string;
|
|
612
610
|
program: Subroutine;
|
|
613
611
|
docstring: string | null;
|
|
612
|
+
avmVersion: bigint | null;
|
|
614
613
|
accept<T>(visitor: RootNodeVisitor<T>): T;
|
|
615
614
|
}
|
|
616
615
|
export declare class CompiledContract extends Expression {
|
|
@@ -639,24 +638,24 @@ export declare class ARC4Router extends Expression {
|
|
|
639
638
|
constructor(props: Props<ARC4Router>);
|
|
640
639
|
accept<T>(visitor: ExpressionVisitor<T>): T;
|
|
641
640
|
}
|
|
642
|
-
export declare class
|
|
643
|
-
constructor(props: Props<
|
|
641
|
+
export declare class Contract extends RootNode {
|
|
642
|
+
constructor(props: Props<Contract>);
|
|
644
643
|
id: ContractReference;
|
|
645
644
|
name: string;
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
approvalProgram: ContractMethod
|
|
649
|
-
clearProgram: ContractMethod
|
|
650
|
-
|
|
651
|
-
appState:
|
|
652
|
-
reservedScratchSpace: Set<bigint>;
|
|
645
|
+
description: string | null;
|
|
646
|
+
methodResolutionOrder: Array<ContractReference>;
|
|
647
|
+
approvalProgram: ContractMethod;
|
|
648
|
+
clearProgram: ContractMethod;
|
|
649
|
+
methods: Array<ContractMethod>;
|
|
650
|
+
appState: Array<AppStorageDefinition>;
|
|
653
651
|
stateTotals: StateTotals | null;
|
|
654
|
-
|
|
652
|
+
reservedScratchSpace: Set<bigint>;
|
|
653
|
+
avmVersion: bigint | null;
|
|
655
654
|
accept<T>(visitor: RootNodeVisitor<T>): T;
|
|
656
655
|
}
|
|
657
656
|
export type LValue = VarExpression | FieldExpression | IndexExpression | TupleExpression | AppStateExpression | AppAccountStateExpression;
|
|
658
657
|
export type Constant = IntegerConstant | BoolConstant | BytesConstant | StringConstant;
|
|
659
|
-
export type AWST =
|
|
658
|
+
export type AWST = Contract | LogicSignature | Subroutine;
|
|
660
659
|
export declare const concreteNodes: {
|
|
661
660
|
readonly subroutineID: typeof SubroutineID;
|
|
662
661
|
readonly expressionStatement: typeof ExpressionStatement;
|
|
@@ -746,7 +745,7 @@ export declare const concreteNodes: {
|
|
|
746
745
|
readonly compiledLogicSig: typeof CompiledLogicSig;
|
|
747
746
|
readonly stateTotals: typeof StateTotals;
|
|
748
747
|
readonly aRC4Router: typeof ARC4Router;
|
|
749
|
-
readonly
|
|
748
|
+
readonly contract: typeof Contract;
|
|
750
749
|
readonly uInt64Constant: typeof IntegerConstant;
|
|
751
750
|
readonly bigUIntConstant: typeof IntegerConstant;
|
|
752
751
|
};
|
|
@@ -836,6 +835,6 @@ export interface ContractMemberNodeVisitor<T> {
|
|
|
836
835
|
export interface RootNodeVisitor<T> {
|
|
837
836
|
visitSubroutine(rootNode: Subroutine): T;
|
|
838
837
|
visitLogicSignature(rootNode: LogicSignature): T;
|
|
839
|
-
|
|
838
|
+
visitContract(rootNode: Contract): T;
|
|
840
839
|
}
|
|
841
840
|
export {};
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ts from 'typescript';
|
|
2
2
|
export declare class SourceLocation {
|
|
3
|
-
file: string;
|
|
3
|
+
file: string | null;
|
|
4
4
|
line: number;
|
|
5
5
|
endLine: number;
|
|
6
6
|
column: number;
|
|
7
7
|
endColumn: number;
|
|
8
|
+
scope: 'file' | 'range';
|
|
8
9
|
constructor(props: {
|
|
9
|
-
file
|
|
10
|
+
file?: string | null;
|
|
10
11
|
line: number;
|
|
11
12
|
endLine: number;
|
|
12
13
|
column: number;
|
|
13
14
|
endColumn: number;
|
|
15
|
+
scope: SourceLocation['scope'];
|
|
14
16
|
});
|
|
15
|
-
static
|
|
17
|
+
private static getStartAndEnd;
|
|
18
|
+
static fromNode(node: ts.Node, programDirectory: string): SourceLocation;
|
|
16
19
|
static fromFile(sourceFile: ts.SourceFile, programDirectory: string): SourceLocation;
|
|
17
20
|
static fromTextRange(sourceFile: ts.SourceFile, textRange: ts.TextRange, programDirectory: string): SourceLocation;
|
|
18
21
|
static fromDiagnostic(diagnostic: ts.DiagnosticWithLocation, programDirectory: string): SourceLocation;
|
|
19
22
|
toString(): string;
|
|
20
23
|
static fromLocations(...sourceLocation: SourceLocation[]): SourceLocation;
|
|
24
|
+
static None: SourceLocation;
|
|
21
25
|
}
|
|
@@ -82,6 +82,7 @@ export declare class ToCodeVisitor implements RootNodeVisitor<string[]>, Contrac
|
|
|
82
82
|
visitSubroutine(moduleStatement: nodes.Subroutine): string[];
|
|
83
83
|
visitContractMethod(statement: nodes.ContractMethod): string[];
|
|
84
84
|
visitLogicSignature(moduleStatement: nodes.LogicSignature): string[];
|
|
85
|
-
|
|
85
|
+
private currentContract;
|
|
86
|
+
visitContract(c: nodes.Contract): string[];
|
|
86
87
|
visitSpecialMethod(statement: nodes.ContractMethod, name: string): string[];
|
|
87
88
|
}
|
package/awst/txn-fields.d.ts
CHANGED
package/awst/wtypes.d.ts
CHANGED
|
@@ -5,132 +5,173 @@ export declare enum AVMType {
|
|
|
5
5
|
uint64 = 2,
|
|
6
6
|
any = 3
|
|
7
7
|
}
|
|
8
|
-
export declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export declare class WStructType extends WType {
|
|
57
|
-
fields: Record<string, WType>;
|
|
58
|
-
constructor({ fields, name }: {
|
|
8
|
+
export declare namespace wtypes {
|
|
9
|
+
class WType {
|
|
10
|
+
constructor(props: {
|
|
11
|
+
name: string;
|
|
12
|
+
immutable?: boolean;
|
|
13
|
+
scalarType: AVMType | null;
|
|
14
|
+
ephemeral?: boolean;
|
|
15
|
+
});
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly immutable: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* ephemeral types are not suitable for naive storage / persistence,
|
|
20
|
+
* even if their underlying type is a simple stack value
|
|
21
|
+
*/
|
|
22
|
+
readonly ephemeral: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The AVM stack type of this type (if any)
|
|
25
|
+
*/
|
|
26
|
+
readonly scalarType: AVMType | null;
|
|
27
|
+
equals(other: WType): boolean;
|
|
28
|
+
toString(): string;
|
|
29
|
+
get id(): string;
|
|
30
|
+
}
|
|
31
|
+
const voidWType: WType;
|
|
32
|
+
const boolWType: WType;
|
|
33
|
+
const uint64WType: WType;
|
|
34
|
+
const uint64RangeWType: WType;
|
|
35
|
+
const bytesWType: WType;
|
|
36
|
+
const stateKeyWType: WType;
|
|
37
|
+
const boxKeyWType: WType;
|
|
38
|
+
const stringWType: WType;
|
|
39
|
+
const biguintWType: WType;
|
|
40
|
+
const assetWType: WType;
|
|
41
|
+
const accountWType: WType;
|
|
42
|
+
const applicationWType: WType;
|
|
43
|
+
class ARC4Type extends WType {
|
|
44
|
+
readonly nativeType: WType | null;
|
|
45
|
+
readonly arc4Name: string;
|
|
46
|
+
constructor({ nativeType, arc4Name, ...rest }: {
|
|
47
|
+
nativeType: WType | null;
|
|
48
|
+
arc4Name: string;
|
|
49
|
+
name: string;
|
|
50
|
+
immutable?: boolean;
|
|
51
|
+
scalarType?: AVMType | null;
|
|
52
|
+
ephemeral?: boolean;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
class WStructType extends WType {
|
|
59
56
|
fields: Record<string, WType>;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
readonly frozen = true;
|
|
58
|
+
constructor({ fields, name }: {
|
|
59
|
+
fields: Record<string, WType>;
|
|
60
|
+
name: string;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
class WTuple extends WType {
|
|
66
64
|
types: WType[];
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
sourceLocation
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
65
|
+
names: string[] | undefined;
|
|
66
|
+
constructor(props: {
|
|
67
|
+
names?: string[];
|
|
68
|
+
types: WType[];
|
|
69
|
+
immutable?: boolean;
|
|
70
|
+
name?: string;
|
|
71
|
+
});
|
|
72
|
+
equals(other: WType): boolean;
|
|
73
|
+
toString(): string;
|
|
74
|
+
}
|
|
75
|
+
class WArray extends WType {
|
|
76
|
+
readonly elementType: WType;
|
|
77
|
+
constructor(props: {
|
|
78
|
+
itemType: WType;
|
|
79
|
+
immutable: boolean;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
class WEnumeration extends WType {
|
|
83
|
+
readonly sequenceType: WType;
|
|
84
|
+
constructor(props: {
|
|
85
|
+
sequenceType: WType;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
class WGroupTransaction extends WType {
|
|
89
|
+
transactionType: TransactionKind | null;
|
|
90
|
+
constructor({ transactionType }: {
|
|
91
|
+
transactionType?: TransactionKind;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
class WInnerTransaction extends WType {
|
|
95
|
+
transactionType: TransactionKind | null;
|
|
96
|
+
constructor({ transactionType }: {
|
|
97
|
+
transactionType?: TransactionKind;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
class WInnerTransactionFields extends WType {
|
|
101
|
+
transactionType: TransactionKind | null;
|
|
102
|
+
constructor({ transactionType }: {
|
|
103
|
+
transactionType?: TransactionKind;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
class ARC4UIntN extends ARC4Type {
|
|
107
|
+
readonly n: bigint;
|
|
108
|
+
constructor({ n, arc4Name }: {
|
|
109
|
+
n: bigint;
|
|
110
|
+
arc4Name?: string;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
class ARC4UFixedNxM extends ARC4Type {
|
|
114
|
+
readonly n: bigint;
|
|
115
|
+
readonly m: bigint;
|
|
116
|
+
constructor({ n, m }: {
|
|
117
|
+
n: bigint;
|
|
118
|
+
m: bigint;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
class ARC4Struct extends ARC4Type {
|
|
122
|
+
fields: Record<string, ARC4Type>;
|
|
123
|
+
sourceLocation: SourceLocation | null;
|
|
124
|
+
frozen: boolean;
|
|
125
|
+
constructor({ fields, sourceLocation, name, frozen, }: {
|
|
126
|
+
frozen: boolean;
|
|
127
|
+
name: string;
|
|
128
|
+
fields: Record<string, ARC4Type>;
|
|
129
|
+
sourceLocation?: SourceLocation;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
class ARC4Tuple extends ARC4Type {
|
|
133
|
+
readonly types: ARC4Type[];
|
|
134
|
+
readonly sourceLocation: SourceLocation | null;
|
|
135
|
+
constructor({ types, sourceLocation }: {
|
|
136
|
+
types: ARC4Type[];
|
|
137
|
+
sourceLocation?: SourceLocation;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
abstract class ARC4Array extends ARC4Type {
|
|
141
|
+
readonly elementType: ARC4Type;
|
|
142
|
+
protected constructor(props: {
|
|
143
|
+
arc4Name: string;
|
|
144
|
+
otherEncodeableTypes: WType[];
|
|
145
|
+
name: string;
|
|
146
|
+
elementType: ARC4Type;
|
|
147
|
+
nativeType?: WType;
|
|
148
|
+
immutable?: boolean;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
class ARC4DynamicArray extends ARC4Array {
|
|
152
|
+
readonly sourceLocation: SourceLocation | null;
|
|
153
|
+
constructor({ elementType, sourceLocation, arc4Name, nativeType, immutable, }: {
|
|
154
|
+
elementType: ARC4Type;
|
|
155
|
+
sourceLocation?: SourceLocation;
|
|
156
|
+
arc4Name?: string;
|
|
157
|
+
nativeType?: WType;
|
|
158
|
+
immutable?: boolean;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
class ARC4StaticArray extends ARC4Array {
|
|
162
|
+
readonly sourceLocation: SourceLocation | null;
|
|
163
|
+
readonly arraySize: bigint;
|
|
164
|
+
constructor({ elementType, sourceLocation, arraySize, arc4Name, nativeType, immutable, }: {
|
|
165
|
+
arraySize: bigint;
|
|
166
|
+
elementType: ARC4Type;
|
|
167
|
+
sourceLocation?: SourceLocation;
|
|
168
|
+
arc4Name?: string;
|
|
169
|
+
nativeType?: WType;
|
|
170
|
+
immutable?: boolean;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
const arc4ByteAliasWType: ARC4UIntN;
|
|
174
|
+
const arc4AddressAliasWType: ARC4StaticArray;
|
|
175
|
+
const arc4BooleanWType: ARC4Type;
|
|
176
|
+
const arc4StringAliasWType: ARC4DynamicArray;
|
|
136
177
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ARC32StructDef } from '../awst/models';
|
|
2
|
+
import type { SourceLocation } from '../awst/source-location';
|
|
3
|
+
import type { FunctionPType, PType } from './ptypes';
|
|
4
|
+
import { ARC4EncodedType, ARC4StructType } from './ptypes/arc4-types';
|
|
5
|
+
export declare function ptypeToArc4PType(ptype: PType, sourceLocation: SourceLocation): PType;
|
|
6
|
+
export declare function isArc4EncodableType(ptype: PType): boolean;
|
|
7
|
+
export declare function ptypeToArc4EncodedType(ptype: PType, sourceLocation: SourceLocation): ARC4EncodedType;
|
|
8
|
+
export declare function getFunctionTypes(ptype: FunctionPType, sourceLocation: SourceLocation): Record<string, PType>;
|
|
9
|
+
export declare function getArc4StructDef(ptype: ARC4StructType): ARC32StructDef;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import type { Expression, LValue, Statement } from '
|
|
3
|
-
import type { SourceLocation } from '
|
|
4
|
-
import type { Expressions } from '
|
|
5
|
-
import type { Visitor } from '
|
|
6
|
-
import type { AwstBuildContext } from '
|
|
7
|
-
import type { InstanceBuilder } from '
|
|
8
|
-
import { NodeBuilder } from '
|
|
9
|
-
import type { PType } from '
|
|
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
10
|
import { TextVisitor } from './text-visitor';
|
|
11
11
|
export declare abstract class BaseVisitor implements Visitor<Expressions, NodeBuilder> {
|
|
12
12
|
context: AwstBuildContext;
|
|
@@ -84,4 +84,10 @@ export declare abstract class BaseVisitor implements Visitor<Expressions, NodeBu
|
|
|
84
84
|
*/
|
|
85
85
|
private buildAssignmentExpressionType;
|
|
86
86
|
buildLValue(target: InstanceBuilder, assignmentType: PType, sourceLocation: SourceLocation): LValue;
|
|
87
|
+
protected parseMemberModifiers(node: {
|
|
88
|
+
modifiers?: readonly ts.ModifierLike[];
|
|
89
|
+
}): {
|
|
90
|
+
isStatic: boolean;
|
|
91
|
+
isPublic: boolean;
|
|
92
|
+
};
|
|
87
93
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import type { ContractReference } from '
|
|
3
|
-
import * as awst from '
|
|
4
|
-
import type { AwstBuildContext } from '
|
|
2
|
+
import type { ContractReference } from '../../awst/models';
|
|
3
|
+
import * as awst from '../../awst/nodes';
|
|
4
|
+
import type { AwstBuildContext } from '../context/awst-build-context';
|
|
5
5
|
import { ContractMethodBaseVisitor } from './contract-method-visitor';
|
|
6
6
|
export interface ConstructorInfo {
|
|
7
7
|
propertyInitializerStatements: awst.Statement[];
|
package/awst_build/{contract-method-visitor.d.ts → ast-visitors/contract-method-visitor.d.ts}
RENAMED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
5
|
-
import
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import * as awst from '../../awst/nodes';
|
|
3
|
+
import type { AwstBuildContext } from '../context/awst-build-context';
|
|
4
|
+
import type { NodeBuilder } from '../eb';
|
|
5
|
+
import { ContractClassPType } from '../ptypes';
|
|
6
6
|
import { FunctionVisitor } from './function-visitor';
|
|
7
|
-
export type ContractMethodInfo = {
|
|
8
|
-
cref: ContractReference;
|
|
9
|
-
arc4MethodConfig?: awst.ContractMethod['arc4MethodConfig'];
|
|
10
|
-
};
|
|
11
7
|
export declare class ContractMethodBaseVisitor extends FunctionVisitor {
|
|
12
8
|
visitSuperKeyword(node: ts.SuperExpression): NodeBuilder;
|
|
13
9
|
visitThisKeyword(node: ts.ThisExpression): NodeBuilder;
|
|
14
10
|
}
|
|
15
11
|
export declare class ContractMethodVisitor extends ContractMethodBaseVisitor {
|
|
16
12
|
private readonly _result;
|
|
17
|
-
|
|
13
|
+
private readonly _contractType;
|
|
14
|
+
constructor(ctx: AwstBuildContext, node: ts.MethodDeclaration, contractType: ContractClassPType);
|
|
18
15
|
get result(): awst.ContractMethod;
|
|
19
|
-
static buildContractMethod(parentCtx: AwstBuildContext, node: ts.MethodDeclaration,
|
|
16
|
+
static buildContractMethod(parentCtx: AwstBuildContext, node: ts.MethodDeclaration, contractType: ContractClassPType): awst.ContractMethod;
|
|
17
|
+
private buildArc4Config;
|
|
18
|
+
private buildDefaultArgument;
|
|
20
19
|
}
|