@algorandfoundation/puya-ts 1.0.0-alpha.76 → 1.0.0-alpha.78

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.
@@ -1,5 +1,5 @@
1
1
  import ts from 'typescript';
2
- import type { DecoratorData, DecoratorDataForType } from '../models/decorator-data';
2
+ import type { DecoratorData, RoutingDecoratorData } from '../models/decorator-data';
3
3
  import { BaseVisitor } from './base-visitor';
4
4
  export declare class DecoratorVisitor extends BaseVisitor {
5
5
  private accept;
@@ -8,6 +8,6 @@ export declare class DecoratorVisitor extends BaseVisitor {
8
8
  private static buildDecoratorData;
9
9
  static buildContractData(target: ts.ClassDeclaration): import("../models/decorator-data").ContractOptionsDecoratorData | undefined;
10
10
  static buildLogicSigData(target: ts.ClassDeclaration): import("../models/decorator-data").LogicSigOptionsDecoratorData | undefined;
11
- static buildContractMethodData(target: ts.MethodDeclaration): DecoratorDataForType<"arc4.baremethod" | "arc4.abimethod"> | undefined;
11
+ static buildContractMethodData(target: ts.MethodDeclaration): RoutingDecoratorData | undefined;
12
12
  private static filterDecoratorData;
13
13
  }
@@ -20,7 +20,7 @@ export declare class MethodSelectorFunctionBuilder extends FunctionBuilder {
20
20
  readonly ptype: import("../../ptypes").LibFunctionType;
21
21
  call(args: ReadonlyArray<NodeBuilder>, typeArgs: ReadonlyArray<PType>, sourceLocation: SourceLocation): NodeBuilder;
22
22
  }
23
- export declare class Arc4EncodedLengthFunctionBuilder extends FunctionBuilder {
23
+ export declare class SizeOfFunctionBuilder extends FunctionBuilder {
24
24
  readonly ptype: import("../../ptypes").LibFunctionType;
25
25
  call(args: ReadonlyArray<NodeBuilder>, typeArgs: ReadonlyArray<PType>, sourceLocation: SourceLocation): NodeBuilder;
26
26
  }
@@ -1,11 +1,15 @@
1
1
  import type { SourceLocation } from '../../awst/source-location';
2
2
  import type { PType } from '../ptypes';
3
- import { NodeBuilder } from './index';
3
+ import { DecoratorDataBuilder, NodeBuilder } from './index';
4
4
  export declare class Arc4BareMethodDecoratorBuilder extends NodeBuilder {
5
- get ptype(): PType;
5
+ readonly ptype: import("../ptypes").LibFunctionType;
6
6
  call(args: ReadonlyArray<NodeBuilder>, typeArgs: ReadonlyArray<PType>, sourceLocation: SourceLocation): NodeBuilder;
7
7
  }
8
+ export declare class ReadonlyDecoratorBuilder extends DecoratorDataBuilder {
9
+ readonly ptype: import("../ptypes").LibFunctionType;
10
+ constructor(sourceLocation: SourceLocation);
11
+ }
8
12
  export declare class Arc4AbiMethodDecoratorBuilder extends NodeBuilder {
9
- get ptype(): PType;
13
+ readonly ptype: import("../ptypes").LibFunctionType;
10
14
  call(args: ReadonlyArray<NodeBuilder>, typeArgs: ReadonlyArray<PType>, sourceLocation: SourceLocation): NodeBuilder;
11
15
  }
@@ -132,7 +132,7 @@ export declare function isReferableExpression(expr: awst.Expression): boolean;
132
132
  export declare function requireLValue(expr: awst.Expression): awst.LValue;
133
133
  export declare class DecoratorDataBuilder extends NodeBuilder {
134
134
  private readonly data;
135
- get ptype(): PType | undefined;
135
+ readonly ptype: PType | undefined;
136
136
  constructor(sourceLocation: SourceLocation, data: DecoratorData);
137
137
  resolveDecoratorData(): DecoratorData;
138
138
  }
@@ -11,7 +11,7 @@ export type Arc4AbiDecoratorData = {
11
11
  allowedCompletionTypes?: OnCompletionAction[];
12
12
  allowedCompletionTypesLocation?: SourceLocation;
13
13
  sourceLocation: SourceLocation;
14
- readonly: boolean;
14
+ readonly: boolean | undefined;
15
15
  nameOverride: string | undefined;
16
16
  resourceEncoding?: ResourceEncoding;
17
17
  defaultArguments: Record<string, {
@@ -30,6 +30,11 @@ export type Arc4BareDecoratorData = {
30
30
  allowedCompletionTypesLocation?: SourceLocation;
31
31
  sourceLocation: SourceLocation;
32
32
  };
33
+ export type ReadonlyDecoratorData = {
34
+ type: typeof Constants.symbolNames.readonlyDecoratorName;
35
+ sourceLocation: SourceLocation;
36
+ readonly: true;
37
+ };
33
38
  export type LogicSigOptionsDecoratorData = {
34
39
  type: typeof Constants.symbolNames.logicSigOptionsDecoratorName;
35
40
  sourceLocation: SourceLocation;
@@ -50,8 +55,8 @@ export type ContractOptionsDecoratorData = {
50
55
  localBytes?: bigint;
51
56
  };
52
57
  };
53
- export type DecoratorData = Arc4BareDecoratorData | Arc4AbiDecoratorData | LogicSigOptionsDecoratorData | ContractOptionsDecoratorData;
54
- export type RoutingDecoratorData = Arc4AbiDecoratorData | Arc4BareDecoratorData;
58
+ export type DecoratorData = Arc4BareDecoratorData | Arc4AbiDecoratorData | LogicSigOptionsDecoratorData | ContractOptionsDecoratorData | ReadonlyDecoratorData;
59
+ export type RoutingDecoratorData = Arc4AbiDecoratorData | Arc4BareDecoratorData | ReadonlyDecoratorData;
55
60
  export type DecoratorType = DecoratorData['type'];
56
61
  export type DecoratorDataForType<TType extends DecoratorType> = DecoratorData extends infer TDec ? TDec extends {
57
62
  type: TType;
@@ -191,7 +191,7 @@ export declare const DynamicBytesConstructor: LibClassType;
191
191
  export declare const DynamicBytesType: DynamicArrayType;
192
192
  export declare const interpretAsArc4Function: LibFunctionType;
193
193
  export declare const encodeArc4Function: LibFunctionType;
194
- export declare const arc4EncodedLengthFunction: LibFunctionType;
194
+ export declare const sizeOfFunction: LibFunctionType;
195
195
  export declare const decodeArc4Function: LibFunctionType;
196
196
  export declare const methodSelectorFunction: LibFunctionType;
197
197
  export declare const abiCallFunction: LibFunctionType;
@@ -592,6 +592,7 @@ export declare const arc4BaseContractType: BaseContractClassType;
592
592
  export declare const itoaMethod: LibFunctionType;
593
593
  export declare const arc4BareMethodDecorator: LibFunctionType;
594
594
  export declare const arc4AbiMethodDecorator: LibFunctionType;
595
+ export declare const readonlyDecorator: LibFunctionType;
595
596
  export declare const contractOptionsDecorator: LibFunctionType;
596
597
  export declare const logicSigOptionsDecorator: LibFunctionType;
597
598
  export declare class GroupTransactionPType extends PType implements ABICompatiblePType {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { l as logger, L as LogLevel, r as resolvePuyaPath } from '../resolve-puya-path-BhHWvo7r.js';
3
- import { C as ConsoleLogSink } from '../console-log-sink-CfAhr7OE.js';
2
+ import { l as logger, L as LogLevel, r as resolvePuyaPath } from '../resolve-puya-path-CaVLCfDd.js';
3
+ import { C as ConsoleLogSink } from '../console-log-sink-BTGmdQzW.js';
4
4
  import 'tslib';
5
5
  import 'fs';
6
6
  import 'node:async_hooks';
package/bin/puyats-ls.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { ArgumentParser } from 'argparse';
3
- import { c as checkNodeVersion, a as appVersion } from '../check-node-version-ZyGkyCLd.js';
3
+ import { c as checkNodeVersion, a as appVersion } from '../check-node-version-8aEfSGwC.js';
4
4
  import { Observable, debounceTime, map, concatMap } from 'rxjs';
5
5
  import { TextDocument } from 'vscode-languageserver-textdocument';
6
6
  import { TextDocuments, TextDocumentSyncKind, createConnection, ProposedFeatures, createClientSocketTransport } from 'vscode-languageserver/node.js';
7
7
  import { URI } from 'vscode-uri';
8
- import { a as LoggingContext, L as LogLevel, C as Constants } from '../resolve-puya-path-BhHWvo7r.js';
8
+ import { a as LoggingContext, L as LogLevel, C as Constants } from '../resolve-puya-path-CaVLCfDd.js';
9
9
  import upath from 'upath';
10
10
  import { DiagnosticSeverity } from 'vscode-languageserver';
11
- import { cI as processInputPaths, cH as compile, cJ as CompileOptions } from '../options-Bl9Dfnsn.js';
11
+ import { cJ as processInputPaths, cI as compile, cK as CompileOptions } from '../options--REGWlBH.js';
12
12
  import 'fs';
13
13
  import 'node:url';
14
14
  import 'chalk';
package/bin/run-cli.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import '../cli.mjs';
3
3
  import 'argparse';
4
- import '../check-node-version-ZyGkyCLd.js';
4
+ import '../check-node-version-8aEfSGwC.js';
5
5
  import 'fs';
6
6
  import 'node:url';
7
7
  import 'upath';
8
- import '../resolve-puya-path-BhHWvo7r.js';
8
+ import '../resolve-puya-path-CaVLCfDd.js';
9
9
  import 'tslib';
10
10
  import 'node:async_hooks';
11
11
  import 'typescript';
@@ -19,7 +19,7 @@ import 'glob';
19
19
  import 'node:zlib';
20
20
  import 'os';
21
21
  import 'chalk';
22
- import '../options-Bl9Dfnsn.js';
22
+ import '../options--REGWlBH.js';
23
23
  import 'polytype';
24
24
  import 'change-case';
25
25
  import 'node:path';
@@ -29,5 +29,5 @@ import 'arcsecond';
29
29
  import 'cross-spawn';
30
30
  import 'zod';
31
31
  import 'minimatch';
32
- import '../console-log-sink-CfAhr7OE.js';
32
+ import '../console-log-sink-BTGmdQzW.js';
33
33
  //# sourceMappingURL=run-cli.mjs.map
@@ -1,7 +1,7 @@
1
1
  import fs__default from 'fs';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import upath from 'upath';
4
- import { C as Constants, p as parseSemVer } from './resolve-puya-path-BhHWvo7r.js';
4
+ import { C as Constants, p as parseSemVer } from './resolve-puya-path-CaVLCfDd.js';
5
5
  import chalk from 'chalk';
6
6
 
7
7
  function appVersion(name = 'puya-ts') {
@@ -40,4 +40,4 @@ function checkNodeVersion() {
40
40
  }
41
41
 
42
42
  export { appVersion as a, checkNodeVersion as c };
43
- //# sourceMappingURL=check-node-version-ZyGkyCLd.js.map
43
+ //# sourceMappingURL=check-node-version-8aEfSGwC.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"check-node-version-ZyGkyCLd.js","sources":["../src/cli/app-version.ts","../src/cli/check-node-version.ts"],"sourcesContent":["import fs from 'fs'\nimport { fileURLToPath } from 'node:url'\nimport upath from 'upath'\nimport { Constants } from '../constants'\n\nexport function appVersion(name: string = 'puya-ts') {\n let dirName = upath.dirname(fileURLToPath(import.meta.url))\n\n while (true) {\n const packageJsonPath = upath.join(dirName, 'package.json')\n if (fs.existsSync(packageJsonPath)) {\n const version = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).version\n return [\n `${name} ${version}`,\n '',\n 'Targets:',\n `puya ${Constants.targetedPuyaVersion}`,\n `AVM ${Constants.supportedAvmVersions.join(', ')}`,\n ].join('\\r\\n')\n }\n if (dirName === upath.dirname(dirName)) break\n dirName = upath.dirname(dirName)\n }\n return `Cannot determine puya-ts version`\n}\n","import chalk from 'chalk'\nimport { Constants } from '../constants'\nimport { parseSemVer } from '../puya/semver'\n\nfunction writeError(text: string) {\n // eslint-disable-next-line no-console\n console.error(chalk.red(text))\n}\n\nexport function checkNodeVersion() {\n const min = parseSemVer(Constants.minNodeVersion)\n const actual = parseSemVer(process.versions.node)\n\n if (\n actual.major < min.major ||\n (actual.major === min.major && actual.minor < min.minor) ||\n (actual.major === min.major && actual.minor === min.minor && actual.rev < min.rev)\n ) {\n writeError(\n `Installed node version ${process.versions.node} is older than the minimum required version ${Constants.minNodeVersion}. You may experience compatability issues.`,\n )\n }\n}\n"],"names":["fs"],"mappings":";;;;;;AAKM,SAAU,UAAU,CAAC,IAAA,GAAe,SAAS,EAAA;AACjD,IAAA,IAAI,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE3D,OAAO,IAAI,EAAE;QACX,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC;AAC3D,QAAA,IAAIA,WAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;AAClC,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAACA,WAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO;YAC5E,OAAO;gBACL,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,OAAO,CAAA,CAAE;gBACpB,EAAE;gBACF,UAAU;gBACV,CAAA,KAAA,EAAQ,SAAS,CAAC,mBAAmB,CAAA,CAAE;gBACvC,CAAA,IAAA,EAAO,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE;AACnD,aAAA,CAAC,IAAI,CAAC,MAAM,CAAC;QAChB;AACA,QAAA,IAAI,OAAO,KAAK,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE;AACxC,QAAA,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;IAClC;AACA,IAAA,OAAO,kCAAkC;AAC3C;;ACpBA,SAAS,UAAU,CAAC,IAAY,EAAA;;IAE9B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAChC;SAEgB,gBAAgB,GAAA;IAC9B,MAAM,GAAG,GAAG,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC;IACjD,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;AAEjD,IAAA,IACE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;AACxB,SAAC,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;SACvD,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,EAClF;AACA,QAAA,UAAU,CACR,CAAA,uBAAA,EAA0B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAA,4CAAA,EAA+C,SAAS,CAAC,cAAc,CAAA,0CAAA,CAA4C,CACnK;IACH;AACF;;;;"}
1
+ {"version":3,"file":"check-node-version-8aEfSGwC.js","sources":["../src/cli/app-version.ts","../src/cli/check-node-version.ts"],"sourcesContent":["import fs from 'fs'\nimport { fileURLToPath } from 'node:url'\nimport upath from 'upath'\nimport { Constants } from '../constants'\n\nexport function appVersion(name: string = 'puya-ts') {\n let dirName = upath.dirname(fileURLToPath(import.meta.url))\n\n while (true) {\n const packageJsonPath = upath.join(dirName, 'package.json')\n if (fs.existsSync(packageJsonPath)) {\n const version = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).version\n return [\n `${name} ${version}`,\n '',\n 'Targets:',\n `puya ${Constants.targetedPuyaVersion}`,\n `AVM ${Constants.supportedAvmVersions.join(', ')}`,\n ].join('\\r\\n')\n }\n if (dirName === upath.dirname(dirName)) break\n dirName = upath.dirname(dirName)\n }\n return `Cannot determine puya-ts version`\n}\n","import chalk from 'chalk'\nimport { Constants } from '../constants'\nimport { parseSemVer } from '../puya/semver'\n\nfunction writeError(text: string) {\n // eslint-disable-next-line no-console\n console.error(chalk.red(text))\n}\n\nexport function checkNodeVersion() {\n const min = parseSemVer(Constants.minNodeVersion)\n const actual = parseSemVer(process.versions.node)\n\n if (\n actual.major < min.major ||\n (actual.major === min.major && actual.minor < min.minor) ||\n (actual.major === min.major && actual.minor === min.minor && actual.rev < min.rev)\n ) {\n writeError(\n `Installed node version ${process.versions.node} is older than the minimum required version ${Constants.minNodeVersion}. You may experience compatability issues.`,\n )\n }\n}\n"],"names":["fs"],"mappings":";;;;;;AAKM,SAAU,UAAU,CAAC,IAAA,GAAe,SAAS,EAAA;AACjD,IAAA,IAAI,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE3D,OAAO,IAAI,EAAE;QACX,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC;AAC3D,QAAA,IAAIA,WAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;AAClC,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAACA,WAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO;YAC5E,OAAO;gBACL,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,OAAO,CAAA,CAAE;gBACpB,EAAE;gBACF,UAAU;gBACV,CAAA,KAAA,EAAQ,SAAS,CAAC,mBAAmB,CAAA,CAAE;gBACvC,CAAA,IAAA,EAAO,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE;AACnD,aAAA,CAAC,IAAI,CAAC,MAAM,CAAC;QAChB;AACA,QAAA,IAAI,OAAO,KAAK,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE;AACxC,QAAA,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;IAClC;AACA,IAAA,OAAO,kCAAkC;AAC3C;;ACpBA,SAAS,UAAU,CAAC,IAAY,EAAA;;IAE9B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAChC;SAEgB,gBAAgB,GAAA;IAC9B,MAAM,GAAG,GAAG,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC;IACjD,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;AAEjD,IAAA,IACE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;AACxB,SAAC,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;SACvD,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,EAClF;AACA,QAAA,UAAU,CACR,CAAA,uBAAA,EAA0B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAA,4CAAA,EAA+C,SAAS,CAAC,cAAc,CAAA,0CAAA,CAA4C,CACnK;IACH;AACF;;;;"}
package/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BooleanOptionalAction, ArgumentParser } from 'argparse';
2
- import { c as checkNodeVersion, a as appVersion } from './check-node-version-ZyGkyCLd.js';
3
- import { cK as defaultPuyaOptions, cI as processInputPaths, cH as compile, cJ as CompileOptions, cL as parseCliTemplateVar, cM as LocalsCoalescingStrategy } from './options-Bl9Dfnsn.js';
4
- import { j as enumFromValue, a as LoggingContext, l as logger, L as LogLevel } from './resolve-puya-path-BhHWvo7r.js';
5
- import { C as ConsoleLogSink } from './console-log-sink-CfAhr7OE.js';
2
+ import { c as checkNodeVersion, a as appVersion } from './check-node-version-8aEfSGwC.js';
3
+ import { cL as defaultPuyaOptions, cJ as processInputPaths, cI as compile, cK as CompileOptions, cM as parseCliTemplateVar, cN as LocalsCoalescingStrategy } from './options--REGWlBH.js';
4
+ import { j as enumFromValue, a as LoggingContext, l as logger, L as LogLevel } from './resolve-puya-path-CaVLCfDd.js';
5
+ import { C as ConsoleLogSink } from './console-log-sink-BTGmdQzW.js';
6
6
  import 'fs';
7
7
  import 'node:url';
8
8
  import 'upath';
@@ -1,5 +1,5 @@
1
1
  import chalk from 'chalk';
2
- import { i as isMinLevel, L as LogLevel, a as LoggingContext } from './resolve-puya-path-BhHWvo7r.js';
2
+ import { i as isMinLevel, L as LogLevel, a as LoggingContext } from './resolve-puya-path-CaVLCfDd.js';
3
3
 
4
4
  const levelConfig = {
5
5
  /* eslint-disable no-console */
@@ -42,4 +42,4 @@ class ConsoleLogSink {
42
42
  }
43
43
 
44
44
  export { ConsoleLogSink as C };
45
- //# sourceMappingURL=console-log-sink-CfAhr7OE.js.map
45
+ //# sourceMappingURL=console-log-sink-BTGmdQzW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"console-log-sink-CfAhr7OE.js","sources":["../src/logger/sinks/console-log-sink.ts"],"sourcesContent":["import chalk from 'chalk'\nimport type { SourceLocation } from '../../awst/source-location'\nimport type { LogEvent } from '../index'\nimport { isMinLevel, LoggingContext, LogLevel } from '../index'\nimport type { LogSink } from './index'\n\ntype ColorFn = (text: string) => string\nconst levelConfig: Record<LogEvent['level'], { colorFn: ColorFn; writeFn: (...args: unknown[]) => void }> = {\n /* eslint-disable no-console */\n debug: { colorFn: chalk.green, writeFn: console.debug },\n info: { colorFn: chalk.green, writeFn: console.info },\n warning: { colorFn: chalk.yellow, writeFn: console.warn },\n error: { colorFn: chalk.red, writeFn: console.error },\n critical: { colorFn: chalk.red, writeFn: console.error },\n /* eslint-enable no-console */\n}\n\nexport class ConsoleLogSink implements LogSink {\n constructor(public readonly minLogLevel: LogLevel) {}\n\n add(logEvent: LogEvent): void {\n const config = levelConfig[logEvent.level]\n\n let logText = `${config.colorFn(logEvent.level)}: ${logEvent.message}`\n if (logEvent.sourceLocation) {\n const sourceLocationText = logEvent.sourceLocation.toString()\n const indentSize = sourceLocationText.length + logEvent.level.length + 4\n\n const sourceSummary = isMinLevel(logEvent.level, LogLevel.Warning) ? this.getSourceSummary(logEvent.sourceLocation, indentSize) : ''\n logText = `${sourceLocationText} ${logText}${sourceSummary}`\n }\n if (isMinLevel(LogLevel.Debug, this.minLogLevel) && logEvent.stack) {\n logText += `\\n ${logEvent.stack}`\n }\n config.writeFn(logText)\n }\n\n getSourceSummary(sourceLocation: SourceLocation, indent: number): string {\n const sourceFile = sourceLocation.file && LoggingContext.current.sourcesByPath[sourceLocation.file]\n if (!sourceFile || sourceLocation.scope === 'file') return ''\n\n const line = sourceFile[sourceLocation.line - 1]\n const trimmedLine = line.trimStart()\n const marker = `${''.padStart(sourceLocation.column - (line.length - trimmedLine.length))}^${''.padStart(Math.max(sourceLocation.endColumn - sourceLocation.column - 1, 0), '~')}`\n const indentChars = ''.padStart(indent, ' ')\n return `\\n${indentChars}${trimmedLine}\\n${indentChars}${marker}`\n }\n}\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"console-log-sink-BTGmdQzW.js","sources":["../src/logger/sinks/console-log-sink.ts"],"sourcesContent":["import chalk from 'chalk'\nimport type { SourceLocation } from '../../awst/source-location'\nimport type { LogEvent } from '../index'\nimport { isMinLevel, LoggingContext, LogLevel } from '../index'\nimport type { LogSink } from './index'\n\ntype ColorFn = (text: string) => string\nconst levelConfig: Record<LogEvent['level'], { colorFn: ColorFn; writeFn: (...args: unknown[]) => void }> = {\n /* eslint-disable no-console */\n debug: { colorFn: chalk.green, writeFn: console.debug },\n info: { colorFn: chalk.green, writeFn: console.info },\n warning: { colorFn: chalk.yellow, writeFn: console.warn },\n error: { colorFn: chalk.red, writeFn: console.error },\n critical: { colorFn: chalk.red, writeFn: console.error },\n /* eslint-enable no-console */\n}\n\nexport class ConsoleLogSink implements LogSink {\n constructor(public readonly minLogLevel: LogLevel) {}\n\n add(logEvent: LogEvent): void {\n const config = levelConfig[logEvent.level]\n\n let logText = `${config.colorFn(logEvent.level)}: ${logEvent.message}`\n if (logEvent.sourceLocation) {\n const sourceLocationText = logEvent.sourceLocation.toString()\n const indentSize = sourceLocationText.length + logEvent.level.length + 4\n\n const sourceSummary = isMinLevel(logEvent.level, LogLevel.Warning) ? this.getSourceSummary(logEvent.sourceLocation, indentSize) : ''\n logText = `${sourceLocationText} ${logText}${sourceSummary}`\n }\n if (isMinLevel(LogLevel.Debug, this.minLogLevel) && logEvent.stack) {\n logText += `\\n ${logEvent.stack}`\n }\n config.writeFn(logText)\n }\n\n getSourceSummary(sourceLocation: SourceLocation, indent: number): string {\n const sourceFile = sourceLocation.file && LoggingContext.current.sourcesByPath[sourceLocation.file]\n if (!sourceFile || sourceLocation.scope === 'file') return ''\n\n const line = sourceFile[sourceLocation.line - 1]\n const trimmedLine = line.trimStart()\n const marker = `${''.padStart(sourceLocation.column - (line.length - trimmedLine.length))}^${''.padStart(Math.max(sourceLocation.endColumn - sourceLocation.column - 1, 0), '~')}`\n const indentChars = ''.padStart(indent, ' ')\n return `\\n${indentChars}${trimmedLine}\\n${indentChars}${marker}`\n }\n}\n"],"names":[],"mappings":"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"}
package/constants.d.ts CHANGED
@@ -35,6 +35,7 @@ export declare const Constants: {
35
35
  readonly symbolNames: {
36
36
  readonly approvalProgramMethodName: "approvalProgram";
37
37
  readonly clearStateProgramMethodName: "clearStateProgram";
38
+ readonly readonlyDecoratorName: "arc4.readonly";
38
39
  readonly arc4BareDecoratorName: "arc4.baremethod";
39
40
  readonly arc4AbiDecoratorName: "arc4.abimethod";
40
41
  readonly contractOptionsDecoratorName: "contract";
package/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { u as uint8ArrayToBigInt, b as uint8ArrayToBase64, c as uint8ArrayToBase32, d as uint8ArrayToUtf8, e as base64ToUint8Array, f as base32ToUint8Array, g as bigIntToUint8Array, h as utf8ToUint8Array } from './resolve-puya-path-BhHWvo7r.js';
2
- export { a as LoggingContext, S as SourceLocation } from './resolve-puya-path-BhHWvo7r.js';
3
- import { A as ABICompatibleInstanceType, a as ALL_OP_ENUMS, b as ARC4ArrayType, c as ARC4BoolClass, d as ARC4EncodedType, e as ARC4InstanceType, f as ARC4StrClass, g as ARC4StructClass, h as ARC4StructType, i as ARC4TupleType, j as AccountFunction, k as AddressClass, l as AnyPType, m as ApplicationFunctionType, n as ApplicationTxnFunction, o as ApprovalProgram, p as Arc4TupleGeneric, q as ArrayGeneric, r as ArrayLiteralPType, s as ArrayPType, t as AssetConfigTxnFunction, u as AssetFreezeTxnFunction, v as AssetFunction, w as AssetTransferTxnFunction, B as BaseContractClassType, x as BigIntLiteralPType, y as BigIntPType, z as BigUintFunction, C as BooleanFunction, D as BoxGeneric, E as BoxMapGeneric, F as BoxMapPType, G as BoxPType, H as BoxRefFunction, I as BoxRefPType, J as ByteClass, K as BytesFunction, L as BytesGeneric, M as BytesPType, N as ClassMethodDecoratorContext, O as ClearStateProgram, P as ClusteredContractClassType, Q as ClusteredPrototype, R as ContractClassPType, S as ContractProxyGeneric, T as ContractProxyType, U as DynamicArrayGeneric, V as DynamicArrayType, W as DynamicBytesConstructor, X as DynamicBytesType, Y as FixedArrayGeneric, Z as FixedArrayPType, _ as FunctionPType, $ as GeneratorGeneric, a0 as GeneratorType, a1 as GenericPType, a2 as GlobalStateGeneric, a3 as GlobalStateType, a4 as GroupTransactionPType, a5 as ImmutableObjectPType, a6 as InnerTransactionPType, a7 as InstanceType, a8 as InternalType, a9 as IntersectionPType, aa as IntrinsicEnumType, ab as IntrinsicFunctionGroupType, ac as IntrinsicFunctionGroupTypeType, ad as IntrinsicFunctionType, ae as IntrinsicFunctionTypeType, af as IterableIteratorGeneric, ag as IterableIteratorType, ah as ItxnParamsPType, ai as KeyRegistrationTxnFunction, aj as LibClassType, ak as LibFunctionType, al as LibObjType, am as LocalStateGeneric, an as LocalStateType, ao as LogicSigPType, ap as MutableObjectPType, aq as MutableTuplePType, ar as NamespacePType, as as NumberPType, at as NumericLiteralPType, au as ObjectLiteralPType, av as ObjectWithOptionalFieldsType, aw as PType, ax as PaymentTxnFunction, ay as PolytypeClassMethodHelper, az as PromiseGeneric, aA as PromiseType, aB as ReadonlyArrayGeneric, aC as ReadonlyArrayPType, aD as ReadonlyGeneric, aE as ReadonlyTuplePType, aF as ReferenceArrayGeneric, aG as ReferenceArrayType, aH as StaticArrayGeneric, aI as StaticArrayType, aJ as StaticBytesGeneric, aK as StaticBytesType, aL as StringFunction, aM as SuperPrototypeSelector, aN as SuperPrototypeSelectorGeneric, aO as TemplateVarFunction, aP as TransactionFunction, aQ as TransactionFunctionType, aR as TransientType, aS as TypeParameterType, aT as TypedApplicationCallResponseGeneric, aU as TypedApplicationCallResponseType, aV as UFixedNxMGeneric, aW as UFixedNxMType, aX as Uint64EnumMemberLiteralType, aY as Uint64EnumMemberType, aZ as Uint64EnumType, a_ as Uint64Function, a$ as UintN128Class, b0 as UintN16Class, b1 as UintN256Class, b2 as UintN32Class, b3 as UintN64Class, b4 as UintN8Class, b5 as UintNGeneric, b6 as UintNType, b7 as UnionPType, b8 as UnsupportedType, b9 as abiCallFunction, ba as accountPType, bb as anyGtxnType, bc as anyItxnParamsType, bd as anyItxnType, be as anyPType, bf as applicationCallGtxnType, bg as applicationCallItxnFn, bh as applicationCallItxnParamsType, bi as applicationItxnType, bj as applicationPType, bk as arc28EmitFunction, bl as arc4AbiMethodDecorator, bm as arc4AddressAlias, bn as arc4BareMethodDecorator, bo as arc4BaseContractType, bp as arc4BooleanType, bq as arc4ByteAlias, br as arc4EncodedLengthFunction, bs as arc4StringType, bt as arc4StructBaseType, bu as arc4Uint64, bv as assertFunction, bw as assertMatchFunction, bx as assetConfigGtxnType, by as assetConfigItxnFn, bz as assetConfigItxnParamsType, bA as assetConfigItxnType, bB as assetFreezeGtxnType, bC as assetFreezeItxnFn, bD as assetFreezeItxnParamsType, bE as assetFreezeItxnType, bF as assetPType, bG as assetTransferGtxnType, bH as assetTransferItxnFn, bI as assetTransferItxnParamsType, bJ as assetTransferItxnType, bK as base64PType, bL as baseContractType, bM as bigIntPType, bN as biguintPType, bO as boolPType, bP as boxRefType, bQ as bytesPType, bR as cloneFunctionPType, bS as compileArc4Function, bT as compileFunctionType, bU as compiledContractType, bV as compiledLogicSigType, bW as contractOptionsDecorator, bX as decodeArc4Function, bY as ecPType, bZ as ecdsaPType, b_ as encodeArc4Function, b$ as ensureBudgetFunction, c0 as errFunction, c1 as esSymbol, c2 as inputOnlyObjects, c3 as interpretAsArc4Function, c4 as isArrayType, c5 as isObjectType, c6 as isTupleLike, c7 as itoaMethod, c8 as itxnComposePType, c9 as keyRegistrationGtxnType, ca as keyRegistrationItxnFn, cb as keyRegistrationItxnParamsType, cc as keyRegistrationItxnType, cd as logFunction, ce as logicSigBaseType, cf as logicSigOptionsDecorator, cg as matchFunction, ch as methodSelectorFunction, ci as mimcConfigurationsPType, cj as neverPType, ck as nullPType, cl as numberPType, cm as onCompleteActionType, cn as opUpFeeSourceType, co as paymentGtxnType, cp as paymentItxnFn, cq as paymentItxnParamsType, cr as paymentItxnType, cs as ptypeToArc4EncodedType, ct as stringPType, cu as submitGroupItxnFunction, cv as transactionTypeType, cw as uint64PType, cx as undefinedPType, cy as unknownPType, cz as urangeFunction, cA as voidPType, cB as vrfVerifyPType, cC as uint8ArrayToHex, cD as hexToUint8Array } from './options-Bl9Dfnsn.js';
4
- export { cJ as CompileOptions, cG as TypeResolver, cH as compile, cI as processInputPaths, cE as registerPTypes, cF as typeRegistry } from './options-Bl9Dfnsn.js';
1
+ import { u as uint8ArrayToBigInt, b as uint8ArrayToBase64, c as uint8ArrayToBase32, d as uint8ArrayToUtf8, e as base64ToUint8Array, f as base32ToUint8Array, g as bigIntToUint8Array, h as utf8ToUint8Array } from './resolve-puya-path-CaVLCfDd.js';
2
+ export { a as LoggingContext, S as SourceLocation } from './resolve-puya-path-CaVLCfDd.js';
3
+ import { A as ABICompatibleInstanceType, a as ALL_OP_ENUMS, b as ARC4ArrayType, c as ARC4BoolClass, d as ARC4EncodedType, e as ARC4InstanceType, f as ARC4StrClass, g as ARC4StructClass, h as ARC4StructType, i as ARC4TupleType, j as AccountFunction, k as AddressClass, l as AnyPType, m as ApplicationFunctionType, n as ApplicationTxnFunction, o as ApprovalProgram, p as Arc4TupleGeneric, q as ArrayGeneric, r as ArrayLiteralPType, s as ArrayPType, t as AssetConfigTxnFunction, u as AssetFreezeTxnFunction, v as AssetFunction, w as AssetTransferTxnFunction, B as BaseContractClassType, x as BigIntLiteralPType, y as BigIntPType, z as BigUintFunction, C as BooleanFunction, D as BoxGeneric, E as BoxMapGeneric, F as BoxMapPType, G as BoxPType, H as BoxRefFunction, I as BoxRefPType, J as ByteClass, K as BytesFunction, L as BytesGeneric, M as BytesPType, N as ClassMethodDecoratorContext, O as ClearStateProgram, P as ClusteredContractClassType, Q as ClusteredPrototype, R as ContractClassPType, S as ContractProxyGeneric, T as ContractProxyType, U as DynamicArrayGeneric, V as DynamicArrayType, W as DynamicBytesConstructor, X as DynamicBytesType, Y as FixedArrayGeneric, Z as FixedArrayPType, _ as FunctionPType, $ as GeneratorGeneric, a0 as GeneratorType, a1 as GenericPType, a2 as GlobalStateGeneric, a3 as GlobalStateType, a4 as GroupTransactionPType, a5 as ImmutableObjectPType, a6 as InnerTransactionPType, a7 as InstanceType, a8 as InternalType, a9 as IntersectionPType, aa as IntrinsicEnumType, ab as IntrinsicFunctionGroupType, ac as IntrinsicFunctionGroupTypeType, ad as IntrinsicFunctionType, ae as IntrinsicFunctionTypeType, af as IterableIteratorGeneric, ag as IterableIteratorType, ah as ItxnParamsPType, ai as KeyRegistrationTxnFunction, aj as LibClassType, ak as LibFunctionType, al as LibObjType, am as LocalStateGeneric, an as LocalStateType, ao as LogicSigPType, ap as MutableObjectPType, aq as MutableTuplePType, ar as NamespacePType, as as NumberPType, at as NumericLiteralPType, au as ObjectLiteralPType, av as ObjectWithOptionalFieldsType, aw as PType, ax as PaymentTxnFunction, ay as PolytypeClassMethodHelper, az as PromiseGeneric, aA as PromiseType, aB as ReadonlyArrayGeneric, aC as ReadonlyArrayPType, aD as ReadonlyGeneric, aE as ReadonlyTuplePType, aF as ReferenceArrayGeneric, aG as ReferenceArrayType, aH as StaticArrayGeneric, aI as StaticArrayType, aJ as StaticBytesGeneric, aK as StaticBytesType, aL as StringFunction, aM as SuperPrototypeSelector, aN as SuperPrototypeSelectorGeneric, aO as TemplateVarFunction, aP as TransactionFunction, aQ as TransactionFunctionType, aR as TransientType, aS as TypeParameterType, aT as TypedApplicationCallResponseGeneric, aU as TypedApplicationCallResponseType, aV as UFixedNxMGeneric, aW as UFixedNxMType, aX as Uint64EnumMemberLiteralType, aY as Uint64EnumMemberType, aZ as Uint64EnumType, a_ as Uint64Function, a$ as UintN128Class, b0 as UintN16Class, b1 as UintN256Class, b2 as UintN32Class, b3 as UintN64Class, b4 as UintN8Class, b5 as UintNGeneric, b6 as UintNType, b7 as UnionPType, b8 as UnsupportedType, b9 as abiCallFunction, ba as accountPType, bb as anyGtxnType, bc as anyItxnParamsType, bd as anyItxnType, be as anyPType, bf as applicationCallGtxnType, bg as applicationCallItxnFn, bh as applicationCallItxnParamsType, bi as applicationItxnType, bj as applicationPType, bk as arc28EmitFunction, bl as arc4AbiMethodDecorator, bm as arc4AddressAlias, bn as arc4BareMethodDecorator, bo as arc4BaseContractType, bp as arc4BooleanType, bq as arc4ByteAlias, br as arc4StringType, bs as arc4StructBaseType, bt as arc4Uint64, bu as assertFunction, bv as assertMatchFunction, bw as assetConfigGtxnType, bx as assetConfigItxnFn, by as assetConfigItxnParamsType, bz as assetConfigItxnType, bA as assetFreezeGtxnType, bB as assetFreezeItxnFn, bC as assetFreezeItxnParamsType, bD as assetFreezeItxnType, bE as assetPType, bF as assetTransferGtxnType, bG as assetTransferItxnFn, bH as assetTransferItxnParamsType, bI as assetTransferItxnType, bJ as base64PType, bK as baseContractType, bL as bigIntPType, bM as biguintPType, bN as boolPType, bO as boxRefType, bP as bytesPType, bQ as cloneFunctionPType, bR as compileArc4Function, bS as compileFunctionType, bT as compiledContractType, bU as compiledLogicSigType, bV as contractOptionsDecorator, bW as decodeArc4Function, bX as ecPType, bY as ecdsaPType, bZ as encodeArc4Function, b_ as ensureBudgetFunction, b$ as errFunction, c0 as esSymbol, c1 as inputOnlyObjects, c2 as interpretAsArc4Function, c3 as isArrayType, c4 as isObjectType, c5 as isTupleLike, c6 as itoaMethod, c7 as itxnComposePType, c8 as keyRegistrationGtxnType, c9 as keyRegistrationItxnFn, ca as keyRegistrationItxnParamsType, cb as keyRegistrationItxnType, cc as logFunction, cd as logicSigBaseType, ce as logicSigOptionsDecorator, cf as matchFunction, cg as methodSelectorFunction, ch as mimcConfigurationsPType, ci as neverPType, cj as nullPType, ck as numberPType, cl as onCompleteActionType, cm as opUpFeeSourceType, cn as paymentGtxnType, co as paymentItxnFn, cp as paymentItxnParamsType, cq as paymentItxnType, cr as ptypeToArc4EncodedType, cs as readonlyDecorator, ct as sizeOfFunction, cu as stringPType, cv as submitGroupItxnFunction, cw as transactionTypeType, cx as uint64PType, cy as undefinedPType, cz as unknownPType, cA as urangeFunction, cB as voidPType, cC as vrfVerifyPType, cD as uint8ArrayToHex, cE as hexToUint8Array } from './options--REGWlBH.js';
4
+ export { cK as CompileOptions, cH as TypeResolver, cI as compile, cJ as processInputPaths, cF as registerPTypes, cG as typeRegistry } from './options--REGWlBH.js';
5
5
  import 'tslib';
6
6
  import 'fs';
7
7
  import 'node:async_hooks';
@@ -176,7 +176,6 @@ var forExport = /*#__PURE__*/Object.freeze({
176
176
  arc4BaseContractType: arc4BaseContractType,
177
177
  arc4BooleanType: arc4BooleanType,
178
178
  arc4ByteAlias: arc4ByteAlias,
179
- arc4EncodedLengthFunction: arc4EncodedLengthFunction,
180
179
  arc4StringType: arc4StringType,
181
180
  arc4StructBaseType: arc4StructBaseType,
182
181
  arc4Uint64: arc4Uint64,
@@ -242,6 +241,8 @@ var forExport = /*#__PURE__*/Object.freeze({
242
241
  paymentItxnParamsType: paymentItxnParamsType,
243
242
  paymentItxnType: paymentItxnType,
244
243
  ptypeToArc4EncodedType: ptypeToArc4EncodedType,
244
+ readonlyDecorator: readonlyDecorator,
245
+ sizeOfFunction: sizeOfFunction,
245
246
  stringPType: stringPType,
246
247
  submitGroupItxnFunction: submitGroupItxnFunction,
247
248
  transactionTypeType: transactionTypeType,
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/awst_build/ptypes/for-export.ts","../src/index.ts"],"sourcesContent":["/* This file aggregates all ptypes into a single export for external consumption of the compiler api */\nexport { ptypeToArc4EncodedType } from '../arc4-util'\nexport * from './arc4-types'\nexport * from './index'\n","import {\n base32ToUint8Array,\n base64ToUint8Array,\n bigIntToUint8Array,\n hexToUint8Array,\n uint8ArrayToBase32,\n uint8ArrayToBase64,\n uint8ArrayToBigInt,\n uint8ArrayToHex,\n uint8ArrayToUtf8,\n utf8ToUint8Array,\n} from './util'\n\nexport { SourceLocation } from './awst/source-location'\nexport * as ptypes from './awst_build/ptypes/for-export'\nexport { registerPTypes } from './awst_build/ptypes/register'\nexport { typeRegistry } from './awst_build/type-registry'\nexport { TypeResolver } from './awst_build/type-resolver'\nexport { compile } from './compile'\nexport { processInputPaths } from './input-paths/process-input-paths'\nexport { LoggingContext } from './logger'\nexport { CompileOptions } from './options'\n\nexport const encodingUtil = {\n utf8ToUint8Array,\n bigIntToUint8Array,\n hexToUint8Array,\n base32ToUint8Array,\n base64ToUint8Array,\n uint8ArrayToUtf8,\n uint8ArrayToHex,\n uint8ArrayToBase32,\n uint8ArrayToBase64,\n uint8ArrayToBigInt,\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACuBO,MAAM,YAAY,GAAG;IAC1B,gBAAgB;IAChB,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;IAChB,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/awst_build/ptypes/for-export.ts","../src/index.ts"],"sourcesContent":["/* This file aggregates all ptypes into a single export for external consumption of the compiler api */\nexport { ptypeToArc4EncodedType } from '../arc4-util'\nexport * from './arc4-types'\nexport * from './index'\n","import {\n base32ToUint8Array,\n base64ToUint8Array,\n bigIntToUint8Array,\n hexToUint8Array,\n uint8ArrayToBase32,\n uint8ArrayToBase64,\n uint8ArrayToBigInt,\n uint8ArrayToHex,\n uint8ArrayToUtf8,\n utf8ToUint8Array,\n} from './util'\n\nexport { SourceLocation } from './awst/source-location'\nexport * as ptypes from './awst_build/ptypes/for-export'\nexport { registerPTypes } from './awst_build/ptypes/register'\nexport { typeRegistry } from './awst_build/type-registry'\nexport { TypeResolver } from './awst_build/type-resolver'\nexport { compile } from './compile'\nexport { processInputPaths } from './input-paths/process-input-paths'\nexport { LoggingContext } from './logger'\nexport { CompileOptions } from './options'\n\nexport const encodingUtil = {\n utf8ToUint8Array,\n bigIntToUint8Array,\n hexToUint8Array,\n base32ToUint8Array,\n base64ToUint8Array,\n uint8ArrayToUtf8,\n uint8ArrayToHex,\n uint8ArrayToBase32,\n uint8ArrayToBase64,\n uint8ArrayToBigInt,\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACuBO,MAAM,YAAY,GAAG;IAC1B,gBAAgB;IAChB,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;IAChB,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;;;;;"}
@@ -1,4 +1,4 @@
1
- import { k as invariant, m as CodeError, z as zipStrict, C as Constants, S as SourceLocation, n as codeInvariant, N as NotSupported, t as throwError, I as InternalError, o as distinctByEquality, s as sortBy, q as instanceOfAny, l as logger, g as bigIntToUint8Array, v as tryConvertEnum, w as wrapInCodeError, f as base32ToUint8Array, x as hasFlags, y as isIn, A as intersectsFlags, B as normalisePath, D as toSubScript, j as enumFromValue, h as utf8ToUint8Array, d as uint8ArrayToUtf8, e as base64ToUint8Array, E as enumKeyFromValue, c as uint8ArrayToBase32, F as mkDirIfNotExists, G as patchErrorLocation, H as sameSets, J as expandMaybeArray, a as LoggingContext, L as LogLevel, r as resolvePuyaPath, K as generateTempDir, P as PuyaError } from './resolve-puya-path-BhHWvo7r.js';
1
+ import { k as invariant, m as CodeError, z as zipStrict, C as Constants, S as SourceLocation, n as codeInvariant, N as NotSupported, t as throwError, I as InternalError, o as distinctByEquality, s as sortBy, q as instanceOfAny, l as logger, g as bigIntToUint8Array, v as tryConvertEnum, w as wrapInCodeError, f as base32ToUint8Array, x as hasFlags, y as isIn, A as intersectsFlags, B as normalisePath, D as toSubScript, j as enumFromValue, h as utf8ToUint8Array, d as uint8ArrayToUtf8, e as base64ToUint8Array, E as enumKeyFromValue, c as uint8ArrayToBase32, F as mkDirIfNotExists, G as patchErrorLocation, H as sameSets, J as expandMaybeArray, a as LoggingContext, L as LogLevel, r as resolvePuyaPath, K as generateTempDir, P as PuyaError } from './resolve-puya-path-CaVLCfDd.js';
2
2
  import { classes } from 'polytype';
3
3
  import { snakeCase } from 'change-case';
4
4
  import path from 'node:path';
@@ -1850,6 +1850,10 @@ const arc4AbiMethodDecorator = new LibFunctionType({
1850
1850
  module: Constants.moduleNames.algoTs.arc4.index,
1851
1851
  name: 'abimethod',
1852
1852
  });
1853
+ const readonlyDecorator = new LibFunctionType({
1854
+ module: Constants.moduleNames.algoTs.arc4.index,
1855
+ name: 'readonly',
1856
+ });
1853
1857
  const contractOptionsDecorator = new LibFunctionType({
1854
1858
  module: Constants.moduleNames.algoTs.baseContract,
1855
1859
  name: 'contract',
@@ -4713,8 +4717,8 @@ const encodeArc4Function = new LibFunctionType({
4713
4717
  name: 'encodeArc4',
4714
4718
  module: Constants.moduleNames.algoTs.arc4.index,
4715
4719
  });
4716
- const arc4EncodedLengthFunction = new LibFunctionType({
4717
- name: 'arc4EncodedLength',
4720
+ const sizeOfFunction = new LibFunctionType({
4721
+ name: 'sizeOf',
4718
4722
  module: Constants.moduleNames.algoTs.arc4.index,
4719
4723
  });
4720
4724
  const decodeArc4Function = new LibFunctionType({
@@ -5848,9 +5852,7 @@ function requireLValue(expr) {
5848
5852
  }
5849
5853
  class DecoratorDataBuilder extends NodeBuilder {
5850
5854
  data;
5851
- get ptype() {
5852
- return undefined;
5853
- }
5855
+ ptype = undefined;
5854
5856
  constructor(sourceLocation, data) {
5855
5857
  super(sourceLocation);
5856
5858
  this.data = data;
@@ -6771,16 +6773,14 @@ const resourceEncodingMap = {
6771
6773
  value: 'value',
6772
6774
  };
6773
6775
  class Arc4BareMethodDecoratorBuilder extends NodeBuilder {
6774
- get ptype() {
6775
- return arc4BareMethodDecorator;
6776
- }
6776
+ ptype = arc4BareMethodDecorator;
6777
6777
  call(args, typeArgs, sourceLocation) {
6778
6778
  const { args: [{ allowActions, onCreate }], } = parseFunctionArgs({
6779
6779
  args,
6780
6780
  typeArgs,
6781
6781
  genericTypeArgs: 1,
6782
6782
  callLocation: sourceLocation,
6783
- funcName: 'arc4.baremethod',
6783
+ funcName: this.typeDescription,
6784
6784
  argSpec: (a) => [
6785
6785
  a.obj({
6786
6786
  allowActions: a.optional(stringPType, new ReadonlyArrayPType({ elementType: stringPType })),
@@ -6798,10 +6798,18 @@ class Arc4BareMethodDecoratorBuilder extends NodeBuilder {
6798
6798
  });
6799
6799
  }
6800
6800
  }
6801
- class Arc4AbiMethodDecoratorBuilder extends NodeBuilder {
6802
- get ptype() {
6803
- return arc4AbiMethodDecorator;
6801
+ class ReadonlyDecoratorBuilder extends DecoratorDataBuilder {
6802
+ ptype = readonlyDecorator;
6803
+ constructor(sourceLocation) {
6804
+ super(sourceLocation, {
6805
+ type: Constants.symbolNames.readonlyDecoratorName,
6806
+ readonly: true,
6807
+ sourceLocation,
6808
+ });
6804
6809
  }
6810
+ }
6811
+ class Arc4AbiMethodDecoratorBuilder extends NodeBuilder {
6812
+ ptype = arc4AbiMethodDecorator;
6805
6813
  call(args, typeArgs, sourceLocation) {
6806
6814
  const { args: [{ allowActions, onCreate, readonly, name, resourceEncoding, defaultArguments }], } = parseFunctionArgs({
6807
6815
  args,
@@ -6829,7 +6837,7 @@ class Arc4AbiMethodDecoratorBuilder extends NodeBuilder {
6829
6837
  sourceLocation: sourceLocation,
6830
6838
  nameOverride: name ? requireStringConstant(name).value : undefined,
6831
6839
  resourceEncoding: resourceEncoding && mapStringConstant(resourceEncodingMap, resourceEncoding.resolve()),
6832
- readonly: readonly ? requireBooleanConstant(readonly).value : false,
6840
+ readonly: readonly ? requireBooleanConstant(readonly).value : undefined,
6833
6841
  defaultArguments: resolveDefaultArguments(defaultArguments, sourceLocation),
6834
6842
  });
6835
6843
  }
@@ -10825,8 +10833,8 @@ class MethodSelectorFunctionBuilder extends FunctionBuilder {
10825
10833
  }
10826
10834
  }
10827
10835
  }
10828
- class Arc4EncodedLengthFunctionBuilder extends FunctionBuilder {
10829
- ptype = arc4EncodedLengthFunction;
10836
+ class SizeOfFunctionBuilder extends FunctionBuilder {
10837
+ ptype = sizeOfFunction;
10830
10838
  call(args, typeArgs, sourceLocation) {
10831
10839
  const { ptypes: [typeToEncode], } = parseFunctionArgs({
10832
10840
  args,
@@ -12848,6 +12856,10 @@ function bytesToFixed(builder, fixedType, sourceLocation) {
12848
12856
  }),
12849
12857
  }), fixedType);
12850
12858
  }
12859
+ const fixedConversionStrategyMap = {
12860
+ 'assert-length': 'assert-length',
12861
+ 'unsafe-cast': 'unsafe-cast',
12862
+ };
12851
12863
  class ToFixedLengthFunctionBuilder extends FunctionBuilder {
12852
12864
  builder;
12853
12865
  constructor(builder) {
@@ -12855,7 +12867,7 @@ class ToFixedLengthFunctionBuilder extends FunctionBuilder {
12855
12867
  this.builder = builder;
12856
12868
  }
12857
12869
  call(args, typeArgs, sourceLocation) {
12858
- const { args: [{ length, checked }], } = parseFunctionArgs({
12870
+ const { args: [{ length, strategy }], } = parseFunctionArgs({
12859
12871
  args,
12860
12872
  typeArgs,
12861
12873
  callLocation: sourceLocation,
@@ -12864,14 +12876,14 @@ class ToFixedLengthFunctionBuilder extends FunctionBuilder {
12864
12876
  argSpec: (a) => [
12865
12877
  a.obj({
12866
12878
  length: a.required(NumericLiteralPType),
12867
- checked: a.optional(boolPType),
12879
+ strategy: a.optional(stringPType),
12868
12880
  }),
12869
12881
  ],
12870
12882
  });
12871
12883
  const sizeConst = requireIntegerConstant(length);
12872
- const assertLength = checked === undefined ? true : requireBooleanConstant(checked);
12884
+ const parsedStrategy = strategy === undefined ? 'assert-length' : mapStringConstant(fixedConversionStrategyMap, strategy.resolve());
12873
12885
  const ptype = new BytesPType({ length: sizeConst.value });
12874
- if (assertLength) {
12886
+ if (parsedStrategy === 'assert-length') {
12875
12887
  return bytesToFixed(this.builder, ptype, sourceLocation);
12876
12888
  }
12877
12889
  else {
@@ -20507,6 +20519,7 @@ function registerPTypes(typeRegistry) {
20507
20519
  typeRegistry.register({ ptype: AssetFunction, singletonEb: AssetFunctionBuilder });
20508
20520
  typeRegistry.register({ ptype: assetPType, instanceEb: AssetExpressionBuilder });
20509
20521
  // ARC4 encoded
20522
+ typeRegistry.register({ ptype: readonlyDecorator, singletonEb: ReadonlyDecoratorBuilder });
20510
20523
  typeRegistry.register({ ptype: arc4AbiMethodDecorator, singletonEb: Arc4AbiMethodDecoratorBuilder });
20511
20524
  typeRegistry.register({ ptype: arc4BareMethodDecorator, singletonEb: Arc4BareMethodDecoratorBuilder });
20512
20525
  typeRegistry.register({ ptype: ByteClass, singletonEb: classBuilderForUintNAlias(ByteClass, arc4ByteAlias) });
@@ -20571,7 +20584,7 @@ function registerPTypes(typeRegistry) {
20571
20584
  typeRegistry.register({ ptype: encodeArc4Function, singletonEb: EncodeArc4FunctionBuilder });
20572
20585
  typeRegistry.register({ ptype: decodeArc4Function, singletonEb: DecodeArc4FunctionBuilder });
20573
20586
  typeRegistry.register({ ptype: methodSelectorFunction, singletonEb: MethodSelectorFunctionBuilder });
20574
- typeRegistry.register({ ptype: arc4EncodedLengthFunction, singletonEb: Arc4EncodedLengthFunctionBuilder });
20587
+ typeRegistry.register({ ptype: sizeOfFunction, singletonEb: SizeOfFunctionBuilder });
20575
20588
  typeRegistry.register({ ptype: compileArc4Function, singletonEb: CompileArc4FunctionBuilder });
20576
20589
  typeRegistry.register({ ptype: abiCallFunction, singletonEb: AbiCallFunctionBuilder });
20577
20590
  typeRegistry.registerGeneric({ ptype: ContractProxyType, generic: ContractProxyGeneric, instanceEb: ContractProxyExpressionBuilder });
@@ -22580,8 +22593,66 @@ class DecoratorVisitor extends BaseVisitor {
22580
22593
  return DecoratorVisitor.filterDecoratorData(data, ['logicsig'], (t) => `${t} is not supported on logic signatures`, 'Only one decorator is allowed per logic signature.');
22581
22594
  }
22582
22595
  static buildContractMethodData(target) {
22583
- const data = DecoratorVisitor.buildDecoratorData(target);
22584
- return DecoratorVisitor.filterDecoratorData(data, ['arc4.abimethod', 'arc4.baremethod'], (t) => `${t} is not supported on contract methods`, 'Only one decorator is allowed per method. Multiple on complete actions can be provided in a single decorator');
22596
+ let abiDecorator = undefined;
22597
+ let bareDecorator = undefined;
22598
+ let readonlyDecorator = undefined;
22599
+ for (const data of DecoratorVisitor.buildDecoratorData(target)) {
22600
+ switch (data.type) {
22601
+ case 'arc4.abimethod':
22602
+ if (abiDecorator) {
22603
+ logger.error(data.sourceLocation, 'Only one abimethod decorator is allowed per method. Multiple on complete actions can be provided in a single decorator');
22604
+ }
22605
+ else if (bareDecorator) {
22606
+ logger.error(data.sourceLocation, 'abimethod and baremethod decorators can not be combined on the one method');
22607
+ }
22608
+ else {
22609
+ abiDecorator = data;
22610
+ }
22611
+ break;
22612
+ case 'arc4.baremethod':
22613
+ if (bareDecorator) {
22614
+ logger.error(data.sourceLocation, 'Only one baremethod decorator is allowed per method. Multiple on complete actions can be provided in a single decorator');
22615
+ }
22616
+ else if (abiDecorator) {
22617
+ logger.error(data.sourceLocation, 'abimethod and baremethod decorators can not be combined on the one method');
22618
+ }
22619
+ else {
22620
+ bareDecorator = data;
22621
+ }
22622
+ break;
22623
+ case 'arc4.readonly':
22624
+ if (readonlyDecorator) {
22625
+ logger.error(data.sourceLocation, 'Only one readonly decorator is allowed per method');
22626
+ }
22627
+ else {
22628
+ readonlyDecorator = data;
22629
+ }
22630
+ break;
22631
+ default:
22632
+ logger.error(data.sourceLocation, `${data.type} is not supported on contract methods`);
22633
+ }
22634
+ }
22635
+ if (abiDecorator) {
22636
+ if (readonlyDecorator) {
22637
+ if (abiDecorator.readonly === false) {
22638
+ logger.error(readonlyDecorator.sourceLocation, 'abimethod decorator readonly config conflicts with presence of readonly decorator');
22639
+ }
22640
+ else {
22641
+ abiDecorator.readonly = true;
22642
+ }
22643
+ }
22644
+ return abiDecorator;
22645
+ }
22646
+ else if (bareDecorator) {
22647
+ if (readonlyDecorator) {
22648
+ logger.error(readonlyDecorator.sourceLocation, 'baremethod cannot be annotated with readonly decorator');
22649
+ }
22650
+ return bareDecorator;
22651
+ }
22652
+ else if (readonlyDecorator) {
22653
+ return readonlyDecorator;
22654
+ }
22655
+ return undefined;
22585
22656
  }
22586
22657
  static filterDecoratorData(decoratorData, types, notSupportedMessage, duplicateMessage) {
22587
22658
  let data;
@@ -23144,7 +23215,7 @@ class ContractMethodVisitor extends ContractMethodBaseVisitor {
23144
23215
  if (decorator?.type === 'arc4.abimethod') {
23145
23216
  this.checkABIMethodTypes(functionType, decorator.resourceEncoding ?? 'value', methodLocation);
23146
23217
  return new ARC4ABIMethodConfig({
23147
- readonly: decorator.readonly,
23218
+ readonly: decorator.readonly ?? false,
23148
23219
  sourceLocation: decorator.sourceLocation,
23149
23220
  allowedCompletionTypes: decorator.allowedCompletionTypes ?? conventionalDefaults?.allowedCompletionTypes ?? unspecifiedDefaults.allowedCompletionTypes,
23150
23221
  create: decorator.create ?? conventionalDefaults?.create ?? unspecifiedDefaults.create,
@@ -23169,14 +23240,14 @@ class ContractMethodVisitor extends ContractMethodBaseVisitor {
23169
23240
  sourceLocation: methodLocation,
23170
23241
  name: functionType.name,
23171
23242
  resourceEncoding: 'value',
23172
- readonly: false,
23243
+ readonly: decorator?.readonly ?? false,
23173
23244
  defaultArgs: new Map(),
23174
23245
  });
23175
23246
  }
23176
23247
  return null;
23177
23248
  }
23178
23249
  validateDecoratorRoutingData(functionType, decorator, impliedByConvention) {
23179
- if (!decorator || !impliedByConvention)
23250
+ if (!decorator || !impliedByConvention || decorator.type === 'arc4.readonly')
23180
23251
  return;
23181
23252
  if (decorator.allowedCompletionTypes !== undefined &&
23182
23253
  impliedByConvention.allowedCompletionTypes !== undefined &&
@@ -24487,5 +24558,5 @@ class PuyaOptions {
24487
24558
  }
24488
24559
  }
24489
24560
 
24490
- export { GeneratorGeneric as $, ABICompatibleInstanceType as A, BaseContractClassType as B, BooleanFunction as C, BoxGeneric as D, BoxMapGeneric as E, BoxMapPType as F, BoxPType as G, BoxRefFunction as H, BoxRefPType as I, ByteClass as J, BytesFunction as K, BytesGeneric as L, BytesPType as M, ClassMethodDecoratorContext as N, ClearStateProgram as O, ClusteredContractClassType as P, ClusteredPrototype as Q, ContractClassPType as R, ContractProxyGeneric as S, ContractProxyType as T, DynamicArrayGeneric as U, DynamicArrayType as V, DynamicBytesConstructor as W, DynamicBytesType as X, FixedArrayGeneric as Y, FixedArrayPType as Z, FunctionPType as _, ALL_OP_ENUMS as a, UintN128Class as a$, GeneratorType as a0, GenericPType as a1, GlobalStateGeneric as a2, GlobalStateType as a3, GroupTransactionPType as a4, ImmutableObjectPType as a5, InnerTransactionPType as a6, InstanceType as a7, InternalType as a8, IntersectionPType as a9, PromiseType as aA, ReadonlyArrayGeneric as aB, ReadonlyArrayPType as aC, ReadonlyGeneric as aD, ReadonlyTuplePType as aE, ReferenceArrayGeneric as aF, ReferenceArrayType as aG, StaticArrayGeneric as aH, StaticArrayType as aI, StaticBytesGeneric as aJ, StaticBytesType as aK, StringFunction as aL, SuperPrototypeSelector as aM, SuperPrototypeSelectorGeneric as aN, TemplateVarFunction as aO, TransactionFunction as aP, TransactionFunctionType as aQ, TransientType as aR, TypeParameterType as aS, TypedApplicationCallResponseGeneric as aT, TypedApplicationCallResponseType as aU, UFixedNxMGeneric as aV, UFixedNxMType as aW, Uint64EnumMemberLiteralType as aX, Uint64EnumMemberType as aY, Uint64EnumType as aZ, Uint64Function as a_, IntrinsicEnumType as aa, IntrinsicFunctionGroupType as ab, IntrinsicFunctionGroupTypeType as ac, IntrinsicFunctionType as ad, IntrinsicFunctionTypeType as ae, IterableIteratorGeneric as af, IterableIteratorType as ag, ItxnParamsPType as ah, KeyRegistrationTxnFunction as ai, LibClassType as aj, LibFunctionType as ak, LibObjType as al, LocalStateGeneric as am, LocalStateType as an, LogicSigPType as ao, MutableObjectPType as ap, MutableTuplePType as aq, NamespacePType as ar, NumberPType as as, NumericLiteralPType as at, ObjectLiteralPType as au, ObjectWithOptionalFieldsType as av, PType as aw, PaymentTxnFunction as ax, PolytypeClassMethodHelper as ay, PromiseGeneric as az, ARC4ArrayType as b, ensureBudgetFunction as b$, UintN16Class as b0, UintN256Class as b1, UintN32Class as b2, UintN64Class as b3, UintN8Class as b4, UintNGeneric as b5, UintNType as b6, UnionPType as b7, UnsupportedType as b8, abiCallFunction as b9, assetConfigItxnType as bA, assetFreezeGtxnType as bB, assetFreezeItxnFn as bC, assetFreezeItxnParamsType as bD, assetFreezeItxnType as bE, assetPType as bF, assetTransferGtxnType as bG, assetTransferItxnFn as bH, assetTransferItxnParamsType as bI, assetTransferItxnType as bJ, base64PType as bK, baseContractType as bL, bigIntPType as bM, biguintPType as bN, boolPType as bO, boxRefType as bP, bytesPType as bQ, cloneFunctionPType as bR, compileArc4Function as bS, compileFunctionType as bT, compiledContractType as bU, compiledLogicSigType as bV, contractOptionsDecorator as bW, decodeArc4Function as bX, ecPType as bY, ecdsaPType as bZ, encodeArc4Function as b_, accountPType as ba, anyGtxnType as bb, anyItxnParamsType as bc, anyItxnType as bd, anyPType as be, applicationCallGtxnType as bf, applicationCallItxnFn as bg, applicationCallItxnParamsType as bh, applicationItxnType as bi, applicationPType as bj, arc28EmitFunction as bk, arc4AbiMethodDecorator as bl, arc4AddressAlias as bm, arc4BareMethodDecorator as bn, arc4BaseContractType as bo, arc4BooleanType as bp, arc4ByteAlias as bq, arc4EncodedLengthFunction as br, arc4StringType as bs, arc4StructBaseType as bt, arc4Uint64 as bu, assertFunction as bv, assertMatchFunction as bw, assetConfigGtxnType as bx, assetConfigItxnFn as by, assetConfigItxnParamsType as bz, ARC4BoolClass as c, errFunction as c0, esSymbol as c1, inputOnlyObjects as c2, interpretAsArc4Function as c3, isArrayType as c4, isObjectType$1 as c5, isTupleLike as c6, itoaMethod as c7, itxnComposePType as c8, keyRegistrationGtxnType as c9, voidPType as cA, vrfVerifyPType as cB, uint8ArrayToHex as cC, hexToUint8Array as cD, registerPTypes as cE, typeRegistry as cF, TypeResolver as cG, compile as cH, processInputPaths as cI, CompileOptions as cJ, defaultPuyaOptions as cK, parseCliTemplateVar as cL, LocalsCoalescingStrategy as cM, keyRegistrationItxnFn as ca, keyRegistrationItxnParamsType as cb, keyRegistrationItxnType as cc, logFunction as cd, logicSigBaseType as ce, logicSigOptionsDecorator as cf, matchFunction as cg, methodSelectorFunction as ch, mimcConfigurationsPType as ci, neverPType as cj, nullPType as ck, numberPType as cl, onCompleteActionType as cm, opUpFeeSourceType as cn, paymentGtxnType as co, paymentItxnFn as cp, paymentItxnParamsType as cq, paymentItxnType as cr, ptypeToArc4EncodedType as cs, stringPType as ct, submitGroupItxnFunction as cu, transactionTypeType as cv, uint64PType as cw, undefinedPType as cx, unknownPType as cy, urangeFunction as cz, ARC4EncodedType as d, ARC4InstanceType as e, ARC4StrClass as f, ARC4StructClass as g, ARC4StructType as h, ARC4TupleType as i, AccountFunction as j, AddressClass as k, AnyPType as l, ApplicationFunctionType as m, ApplicationTxnFunction as n, ApprovalProgram as o, Arc4TupleGeneric as p, ArrayGeneric as q, ArrayLiteralPType as r, ArrayPType as s, AssetConfigTxnFunction as t, AssetFreezeTxnFunction as u, AssetFunction as v, AssetTransferTxnFunction as w, BigIntLiteralPType as x, BigIntPType as y, BigUintFunction as z };
24491
- //# sourceMappingURL=options-Bl9Dfnsn.js.map
24561
+ export { GeneratorGeneric as $, ABICompatibleInstanceType as A, BaseContractClassType as B, BooleanFunction as C, BoxGeneric as D, BoxMapGeneric as E, BoxMapPType as F, BoxPType as G, BoxRefFunction as H, BoxRefPType as I, ByteClass as J, BytesFunction as K, BytesGeneric as L, BytesPType as M, ClassMethodDecoratorContext as N, ClearStateProgram as O, ClusteredContractClassType as P, ClusteredPrototype as Q, ContractClassPType as R, ContractProxyGeneric as S, ContractProxyType as T, DynamicArrayGeneric as U, DynamicArrayType as V, DynamicBytesConstructor as W, DynamicBytesType as X, FixedArrayGeneric as Y, FixedArrayPType as Z, FunctionPType as _, ALL_OP_ENUMS as a, UintN128Class as a$, GeneratorType as a0, GenericPType as a1, GlobalStateGeneric as a2, GlobalStateType as a3, GroupTransactionPType as a4, ImmutableObjectPType as a5, InnerTransactionPType as a6, InstanceType as a7, InternalType as a8, IntersectionPType as a9, PromiseType as aA, ReadonlyArrayGeneric as aB, ReadonlyArrayPType as aC, ReadonlyGeneric as aD, ReadonlyTuplePType as aE, ReferenceArrayGeneric as aF, ReferenceArrayType as aG, StaticArrayGeneric as aH, StaticArrayType as aI, StaticBytesGeneric as aJ, StaticBytesType as aK, StringFunction as aL, SuperPrototypeSelector as aM, SuperPrototypeSelectorGeneric as aN, TemplateVarFunction as aO, TransactionFunction as aP, TransactionFunctionType as aQ, TransientType as aR, TypeParameterType as aS, TypedApplicationCallResponseGeneric as aT, TypedApplicationCallResponseType as aU, UFixedNxMGeneric as aV, UFixedNxMType as aW, Uint64EnumMemberLiteralType as aX, Uint64EnumMemberType as aY, Uint64EnumType as aZ, Uint64Function as a_, IntrinsicEnumType as aa, IntrinsicFunctionGroupType as ab, IntrinsicFunctionGroupTypeType as ac, IntrinsicFunctionType as ad, IntrinsicFunctionTypeType as ae, IterableIteratorGeneric as af, IterableIteratorType as ag, ItxnParamsPType as ah, KeyRegistrationTxnFunction as ai, LibClassType as aj, LibFunctionType as ak, LibObjType as al, LocalStateGeneric as am, LocalStateType as an, LogicSigPType as ao, MutableObjectPType as ap, MutableTuplePType as aq, NamespacePType as ar, NumberPType as as, NumericLiteralPType as at, ObjectLiteralPType as au, ObjectWithOptionalFieldsType as av, PType as aw, PaymentTxnFunction as ax, PolytypeClassMethodHelper as ay, PromiseGeneric as az, ARC4ArrayType as b, errFunction as b$, UintN16Class as b0, UintN256Class as b1, UintN32Class as b2, UintN64Class as b3, UintN8Class as b4, UintNGeneric as b5, UintNType as b6, UnionPType as b7, UnsupportedType as b8, abiCallFunction as b9, assetFreezeGtxnType as bA, assetFreezeItxnFn as bB, assetFreezeItxnParamsType as bC, assetFreezeItxnType as bD, assetPType as bE, assetTransferGtxnType as bF, assetTransferItxnFn as bG, assetTransferItxnParamsType as bH, assetTransferItxnType as bI, base64PType as bJ, baseContractType as bK, bigIntPType as bL, biguintPType as bM, boolPType as bN, boxRefType as bO, bytesPType as bP, cloneFunctionPType as bQ, compileArc4Function as bR, compileFunctionType as bS, compiledContractType as bT, compiledLogicSigType as bU, contractOptionsDecorator as bV, decodeArc4Function as bW, ecPType as bX, ecdsaPType as bY, encodeArc4Function as bZ, ensureBudgetFunction as b_, accountPType as ba, anyGtxnType as bb, anyItxnParamsType as bc, anyItxnType as bd, anyPType as be, applicationCallGtxnType as bf, applicationCallItxnFn as bg, applicationCallItxnParamsType as bh, applicationItxnType as bi, applicationPType as bj, arc28EmitFunction as bk, arc4AbiMethodDecorator as bl, arc4AddressAlias as bm, arc4BareMethodDecorator as bn, arc4BaseContractType as bo, arc4BooleanType as bp, arc4ByteAlias as bq, arc4StringType as br, arc4StructBaseType as bs, arc4Uint64 as bt, assertFunction as bu, assertMatchFunction as bv, assetConfigGtxnType as bw, assetConfigItxnFn as bx, assetConfigItxnParamsType as by, assetConfigItxnType as bz, ARC4BoolClass as c, esSymbol as c0, inputOnlyObjects as c1, interpretAsArc4Function as c2, isArrayType as c3, isObjectType$1 as c4, isTupleLike as c5, itoaMethod as c6, itxnComposePType as c7, keyRegistrationGtxnType as c8, keyRegistrationItxnFn as c9, urangeFunction as cA, voidPType as cB, vrfVerifyPType as cC, uint8ArrayToHex as cD, hexToUint8Array as cE, registerPTypes as cF, typeRegistry as cG, TypeResolver as cH, compile as cI, processInputPaths as cJ, CompileOptions as cK, defaultPuyaOptions as cL, parseCliTemplateVar as cM, LocalsCoalescingStrategy as cN, keyRegistrationItxnParamsType as ca, keyRegistrationItxnType as cb, logFunction as cc, logicSigBaseType as cd, logicSigOptionsDecorator as ce, matchFunction as cf, methodSelectorFunction as cg, mimcConfigurationsPType as ch, neverPType as ci, nullPType as cj, numberPType as ck, onCompleteActionType as cl, opUpFeeSourceType as cm, paymentGtxnType as cn, paymentItxnFn as co, paymentItxnParamsType as cp, paymentItxnType as cq, ptypeToArc4EncodedType as cr, readonlyDecorator as cs, sizeOfFunction as ct, stringPType as cu, submitGroupItxnFunction as cv, transactionTypeType as cw, uint64PType as cx, undefinedPType as cy, unknownPType as cz, ARC4EncodedType as d, ARC4InstanceType as e, ARC4StrClass as f, ARC4StructClass as g, ARC4StructType as h, ARC4TupleType as i, AccountFunction as j, AddressClass as k, AnyPType as l, ApplicationFunctionType as m, ApplicationTxnFunction as n, ApprovalProgram as o, Arc4TupleGeneric as p, ArrayGeneric as q, ArrayLiteralPType as r, ArrayPType as s, AssetConfigTxnFunction as t, AssetFreezeTxnFunction as u, AssetFunction as v, AssetTransferTxnFunction as w, BigIntLiteralPType as x, BigIntPType as y, BigUintFunction as z };
24562
+ //# sourceMappingURL=options--REGWlBH.js.map