@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.
Files changed (105) hide show
  1. package/awst/index.d.ts +0 -1
  2. package/awst/intrinsic-factory.d.ts +1 -1
  3. package/awst/models.d.ts +4 -4
  4. package/awst/node-factory.d.ts +15 -7
  5. package/awst/nodes.d.ts +16 -17
  6. package/awst/source-location.d.ts +8 -4
  7. package/awst/to-code-visitor.d.ts +2 -1
  8. package/awst/txn-fields.d.ts +1 -1
  9. package/awst/wtypes.d.ts +167 -126
  10. package/awst_build/arc4-util.d.ts +9 -0
  11. package/awst_build/{base-visitor.d.ts → ast-visitors/base-visitor.d.ts} +14 -8
  12. package/awst_build/{constructor-visitor.d.ts → ast-visitors/constructor-visitor.d.ts} +3 -3
  13. package/awst_build/{contract-method-visitor.d.ts → ast-visitors/contract-method-visitor.d.ts} +10 -11
  14. package/awst_build/{contract-visitor.d.ts → ast-visitors/contract-visitor.d.ts} +11 -15
  15. package/awst_build/{decorator-visitor.d.ts → ast-visitors/decorator-visitor.d.ts} +4 -4
  16. package/awst_build/{function-visitor.d.ts → ast-visitors/function-visitor.d.ts} +9 -9
  17. package/awst_build/ast-visitors/logic-sig-program-visitor.d.ts +10 -0
  18. package/awst_build/ast-visitors/logic-sig-visitor.d.ts +24 -0
  19. package/awst_build/{source-file-visitor.d.ts → ast-visitors/source-file-visitor.d.ts} +4 -4
  20. package/awst_build/ast-visitors/struct-visitor.d.ts +20 -0
  21. package/awst_build/{subroutine-visitor.d.ts → ast-visitors/subroutine-visitor.d.ts} +2 -2
  22. package/awst_build/{text-visitor.d.ts → ast-visitors/text-visitor.d.ts} +3 -3
  23. package/awst_build/constant-store.d.ts +9 -0
  24. package/awst_build/context/awst-build-context.d.ts +11 -7
  25. package/awst_build/eb/arc4/arrays.d.ts +30 -15
  26. package/awst_build/eb/arc4/base.d.ts +11 -0
  27. package/awst_build/eb/arc4/bool.d.ts +14 -0
  28. package/awst_build/eb/arc4/string.d.ts +14 -0
  29. package/awst_build/eb/arc4/struct.d.ts +16 -0
  30. package/awst_build/eb/arc4/tuple.d.ts +15 -0
  31. package/awst_build/eb/arc4/ufixed.d.ts +13 -0
  32. package/awst_build/eb/arc4/uintn.d.ts +18 -0
  33. package/awst_build/eb/arc4-bare-method-decorator-builder.d.ts +3 -4
  34. package/awst_build/eb/assert-function-builder.d.ts +3 -3
  35. package/awst_build/eb/assert-match-function-builder.d.ts +1 -2
  36. package/awst_build/eb/biguint-expression-builder.d.ts +3 -4
  37. package/awst_build/eb/boolean-expression-builder.d.ts +1 -1
  38. package/awst_build/eb/bytes-expression-builder.d.ts +7 -10
  39. package/awst_build/eb/contract-builder.d.ts +3 -2
  40. package/awst_build/eb/ensure-budget.d.ts +2 -2
  41. package/awst_build/eb/free-subroutine-expression-builder.d.ts +2 -2
  42. package/awst_build/eb/index.d.ts +11 -6
  43. package/awst_build/eb/literal/big-int-literal-expression-builder.d.ts +3 -0
  44. package/awst_build/eb/literal/object-literal-expression-builder.d.ts +1 -2
  45. package/awst_build/eb/literal-expression-builder.d.ts +1 -2
  46. package/awst_build/eb/log-function-builder.d.ts +2 -2
  47. package/awst_build/eb/op-module-builder.d.ts +11 -3
  48. package/awst_build/eb/reference/account.d.ts +1 -1
  49. package/awst_build/eb/reference/application.d.ts +2 -2
  50. package/awst_build/eb/reference/asset.d.ts +2 -2
  51. package/awst_build/eb/shared/at-function-builder.d.ts +15 -0
  52. package/awst_build/eb/shared/slice-function-builder.d.ts +14 -0
  53. package/awst_build/eb/storage/box/base.d.ts +25 -0
  54. package/awst_build/eb/storage/box/box-map.d.ts +13 -0
  55. package/awst_build/eb/storage/box/box-ref.d.ts +35 -0
  56. package/awst_build/eb/storage/box/box.d.ts +13 -0
  57. package/awst_build/eb/storage/box/index.d.ts +4 -0
  58. package/awst_build/eb/storage/global-state.d.ts +2 -2
  59. package/awst_build/eb/storage/local-state.d.ts +5 -5
  60. package/awst_build/eb/storage/util.d.ts +3 -3
  61. package/awst_build/eb/storage/value-proxy.d.ts +1 -1
  62. package/awst_build/eb/string-expression-builder.d.ts +2 -2
  63. package/awst_build/eb/template-var.d.ts +8 -0
  64. package/awst_build/eb/transactions/group-transactions.d.ts +2 -2
  65. package/awst_build/eb/transactions/inner-transaction-params.d.ts +3 -3
  66. package/awst_build/eb/uint64-enum-type-builder.d.ts +4 -1
  67. package/awst_build/eb/uint64-expression-builder.d.ts +2 -3
  68. package/awst_build/eb/urange-function.d.ts +2 -2
  69. package/awst_build/eb/util/arg-parsing.d.ts +17 -8
  70. package/awst_build/eb/util/get-bigint-or-uint64-expr.d.ts +2 -0
  71. package/awst_build/eb/util/index.d.ts +1 -1
  72. package/awst_build/index.d.ts +1 -1
  73. package/awst_build/lib/index.d.ts +2 -2
  74. package/awst_build/{contract-data.d.ts → models/app-storage-declaration.d.ts} +5 -5
  75. package/awst_build/models/contract-class-model.d.ts +36 -0
  76. package/awst_build/models/logic-sig-class-model.d.ts +17 -0
  77. package/awst_build/ptypes/arc4-types.d.ts +110 -21
  78. package/awst_build/ptypes/base.d.ts +13 -2
  79. package/awst_build/ptypes/index.d.ts +72 -36
  80. package/awst_build/ptypes/util.d.ts +4 -0
  81. package/awst_build/type-registry.d.ts +6 -10
  82. package/awst_build/type-resolver.d.ts +6 -2
  83. package/bin/run-cli.mjs +4 -4
  84. package/cli.mjs +112 -27
  85. package/cli.mjs.map +1 -1
  86. package/constants.d.ts +8 -0
  87. package/errors.d.ts +1 -0
  88. package/{index-QWk75fJN.js → index-3stwXqkP.js} +7530 -5480
  89. package/index-3stwXqkP.js.map +1 -0
  90. package/index.d.ts +23 -6
  91. package/index.mjs +3 -3
  92. package/{logger.d.ts → logger/index.d.ts} +18 -13
  93. package/logger/sinks/console-log-sink.d.ts +9 -0
  94. package/logger/sinks/index.d.ts +5 -0
  95. package/package.json +1 -1
  96. package/parser/index.d.ts +2 -6
  97. package/puya/build-compilation-set-mapping.d.ts +1 -1
  98. package/puya/index.d.ts +1 -1
  99. package/puya/{run-child-proc.d.ts → run-puya.d.ts} +1 -1
  100. package/util/custom-key-map.d.ts +17 -0
  101. package/util/generate-temp-file.d.ts +5 -0
  102. package/util/index.d.ts +5 -0
  103. package/awst_build/eb/arc4/uint-n-constructor-builder.d.ts +0 -14
  104. package/awst_build/eb/storage/box.d.ts +0 -50
  105. package/index-QWk75fJN.js.map +0 -1
package/awst/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * as awst from './nodes';
2
- export * as wtypes from './wtypes';
3
2
  export * from './util';
4
3
  export type ConstantValue = bigint | Uint8Array | boolean | string;
@@ -1,5 +1,5 @@
1
- import * as awst from './nodes';
2
1
  import type { Expression } from './nodes';
2
+ import * as awst from './nodes';
3
3
  import type { SourceLocation } from './source-location';
4
4
  export declare const intrinsicFactory: {
5
5
  bytesConcat({ left, right, sourceLocation, }: {
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: true;
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: false;
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,
@@ -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 type { WType } from './wtypes';
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(props: {
22
+ uInt64Constant({ value, tealAlias, sourceLocation, }: {
22
23
  value: bigint;
23
24
  tealAlias?: string;
24
25
  sourceLocation: SourceLocation;
25
26
  }): IntegerConstant;
26
- bigUIntConstant(props: {
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">): TupleExpression;
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 * as wtypes from './wtypes';
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: number;
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 ContractFragment extends RootNode {
643
- constructor(props: Props<ContractFragment>);
641
+ export declare class Contract extends RootNode {
642
+ constructor(props: Props<Contract>);
644
643
  id: ContractReference;
645
644
  name: string;
646
- bases: Array<ContractReference>;
647
- init: ContractMethod | null;
648
- approvalProgram: ContractMethod | null;
649
- clearProgram: ContractMethod | null;
650
- subroutines: Array<ContractMethod>;
651
- appState: Map<string, AppStorageDefinition>;
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
- docstring: string | null;
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 = ContractFragment | LogicSignature | Subroutine;
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 contractFragment: typeof ContractFragment;
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
- visitContractFragment(rootNode: ContractFragment): T;
838
+ visitContract(rootNode: Contract): T;
840
839
  }
841
840
  export {};
@@ -1,21 +1,25 @@
1
- import type ts from 'typescript';
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: string;
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 fromNode(sourceFile: ts.SourceFile, node: ts.Node, programDirectory: string): SourceLocation;
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
- visitContractFragment(c: nodes.ContractFragment): string[];
85
+ private currentContract;
86
+ visitContract(c: nodes.Contract): string[];
86
87
  visitSpecialMethod(statement: nodes.ContractMethod, name: string): string[];
87
88
  }
@@ -1,4 +1,4 @@
1
- import { wtypes } from './index';
1
+ import { wtypes } from './wtypes';
2
2
  export declare class TxnFieldData {
3
3
  readonly immediate: string;
4
4
  readonly wtype: wtypes.WType;
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 class WType {
9
- constructor(props: {
10
- name: string;
11
- immutable?: boolean;
12
- scalarType: AVMType | null;
13
- ephemeral?: boolean;
14
- });
15
- readonly name: string;
16
- readonly immutable: boolean;
17
- /**
18
- * ephemeral types are not suitable for naive storage / persistence,
19
- * even if their underlying type is a simple stack value
20
- */
21
- readonly ephemeral: boolean;
22
- /**
23
- * The AVM stack type of this type (if any)
24
- */
25
- readonly scalarType: AVMType | null;
26
- equals(other: WType): boolean;
27
- toString(): string;
28
- get id(): string;
29
- }
30
- export declare const voidWType: WType;
31
- export declare const boolWType: WType;
32
- export declare const uint64WType: WType;
33
- export declare const uint64RangeWType: WType;
34
- export declare const bytesWType: WType;
35
- export declare const stateKeyWType: WType;
36
- export declare const boxKeyWType: WType;
37
- export declare const stringWType: WType;
38
- export declare const biguintWType: WType;
39
- export declare const assetWType: WType;
40
- export declare const accountWType: WType;
41
- export declare const applicationWType: WType;
42
- export declare abstract class ARC4Type extends WType {
43
- readonly decodeType: WType | null;
44
- readonly arc4Name: string;
45
- readonly otherEncodeableTypes: WType[];
46
- constructor({ decodeType, arc4Name, otherEncodeableTypes, ...rest }: {
47
- decodeType: WType | null;
48
- arc4Name: string;
49
- otherEncodeableTypes: WType[];
50
- name: string;
51
- immutable?: boolean;
52
- scalarType: AVMType | null;
53
- ephemeral?: boolean;
54
- });
55
- }
56
- export declare class WStructType extends WType {
57
- 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
- name: string;
61
- });
62
- }
63
- export declare class WTuple extends WType {
64
- types: WType[];
65
- constructor(props: {
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
- immutable?: boolean;
68
- });
69
- toString(): string;
70
- }
71
- export declare class WArray extends WType {
72
- readonly elementType: WType;
73
- constructor(props: {
74
- itemType: WType;
75
- immutable: boolean;
76
- });
77
- }
78
- export declare class WEnumeration extends WType {
79
- readonly sequenceType: WType;
80
- constructor(props: {
81
- sequenceType: WType;
82
- });
83
- }
84
- export declare class WGroupTransaction extends WType {
85
- transactionType: TransactionKind | null;
86
- constructor({ transactionType }: {
87
- transactionType?: TransactionKind;
88
- });
89
- }
90
- export declare class WInnerTransaction extends WType {
91
- transactionType: TransactionKind | null;
92
- constructor({ transactionType }: {
93
- transactionType?: TransactionKind;
94
- });
95
- }
96
- export declare class WInnerTransactionFields extends WType {
97
- transactionType: TransactionKind | null;
98
- constructor({ transactionType }: {
99
- transactionType?: TransactionKind;
100
- });
101
- }
102
- export declare class ARC4UIntN extends ARC4Type {
103
- readonly n: bigint;
104
- constructor({ n }: {
105
- n: bigint;
106
- });
107
- }
108
- export declare class ARC4UFixedNxM extends ARC4Type {
109
- }
110
- export declare class ARC4Struct extends ARC4Type {
111
- }
112
- export declare abstract class ARC4Array extends ARC4Type {
113
- readonly elementType: ARC4Type;
114
- protected constructor(props: {
115
- arc4Name: string;
116
- otherEncodeableTypes: WType[];
117
- name: string;
118
- elementType: ARC4Type;
119
- });
120
- }
121
- export declare class ARC4DynamicArray extends ARC4Array {
122
- readonly sourceLocation: SourceLocation | null;
123
- constructor({ elementType, sourceLocation }: {
124
- elementType: ARC4Type;
125
- sourceLocation?: SourceLocation;
126
- });
127
- }
128
- export declare class ARC4StaticArray extends ARC4Array {
129
- readonly sourceLocation: SourceLocation | null;
130
- readonly arraySize: bigint;
131
- constructor({ elementType, sourceLocation, arraySize }: {
132
- arraySize: bigint;
133
- elementType: ARC4Type;
134
- sourceLocation?: SourceLocation;
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 '../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';
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 '../awst/models';
3
- import * as awst from '../awst/nodes';
4
- import type { AwstBuildContext } from './context/awst-build-context';
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[];
@@ -1,20 +1,19 @@
1
- import type ts from 'typescript';
2
- import type { ContractReference } from '../awst/models';
3
- import * as awst from '../awst/nodes';
4
- import type { AwstBuildContext } from './context/awst-build-context';
5
- import type { NodeBuilder } from './eb';
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
- constructor(ctx: AwstBuildContext, node: ts.MethodDeclaration, contractInfo: ContractMethodInfo);
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, contractMethodInfo: ContractMethodInfo): awst.ContractMethod;
16
+ static buildContractMethod(parentCtx: AwstBuildContext, node: ts.MethodDeclaration, contractType: ContractClassPType): awst.ContractMethod;
17
+ private buildArc4Config;
18
+ private buildDefaultArgument;
20
19
  }