@algorandfoundation/algorand-typescript-testing 1.1.1-beta.1 → 1.1.1-beta.2

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.
@@ -2,7 +2,7 @@ import * as arc4$1 from '@algorandfoundation/algorand-typescript/arc4';
2
2
  import { OnCompleteAction } from '@algorandfoundation/algorand-typescript';
3
3
  import { b as getContractMethod, g as getContractMethodAbiMetadata, C as Contract, c as abimethod, d as baremethod, r as readonly } from './runtime-helpers-Dpv9_KsV.js';
4
4
  import { v as lazyContext, a0 as sizeOf } from './utils-DyUEnpf6.js';
5
- import { A as ApplicationCallInnerTxnContext, m as methodSelector } from './inner-transactions-DIR405zr.js';
5
+ import { A as ApplicationCallInnerTxnContext, m as methodSelector } from './inner-transactions-pcawvv6H.js';
6
6
  import { A as Address, B as Bool, c as Byte, d as DynamicArray, D as DynamicBytes, F as FixedArray, R as ReferenceArray, e as StaticArray, f as StaticBytes, S as Str, h as Struct, T as Tuple, i as UFixed, U as Uint, j as convertBytes, k as decodeArc4, l as encodeArc4 } from './asset-params-DV6t5Cy8.js';
7
7
 
8
8
  function _mergeNamespaces(n, m) {
@@ -135,4 +135,4 @@ var arc4 = /*#__PURE__*/_mergeNamespaces({
135
135
  }, [arc4$1]);
136
136
 
137
137
  export { arc4 as a, abiCall as b, compileArc4 as c, getApplicationCallInnerTxnContext as g };
138
- //# sourceMappingURL=arc4-Uo4nu8mW.js.map
138
+ //# sourceMappingURL=arc4-BazlZFRK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"arc4-Uo4nu8mW.js","sources":["../src/impl/c2c.ts","../src/internal/arc4.ts"],"sourcesContent":["import { type CompileContractOptions, type Contract, OnCompleteAction } from '@algorandfoundation/algorand-typescript'\nimport type {\n BareCreateApplicationCallFields,\n ContractProxy,\n TypedApplicationCallFields,\n} from '@algorandfoundation/algorand-typescript/arc4'\nimport { getContractMethod, getContractMethodAbiMetadata } from '../abi-metadata'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport type { ConstructorFor, DeliberateAny, InstanceMethod } from '../typescript-helpers'\nimport type { ApplicationCallInnerTxn } from './inner-transactions'\nimport { ApplicationCallInnerTxnContext } from './inner-transactions'\nimport { methodSelector } from './method-selector'\nimport type { ApplicationData } from './reference'\n\n/** @internal */\nexport function compileArc4<TContract extends Contract>(\n contract: ConstructorFor<TContract>,\n options?: CompileContractOptions,\n): ContractProxy<TContract> {\n let app: ApplicationData | undefined\n const compiledAppEntry = lazyContext.value.getCompiledAppEntry(contract)\n if (compiledAppEntry !== undefined) {\n app = lazyContext.ledger.applicationDataMap.get(compiledAppEntry.value)\n }\n\n if (options?.templateVars) {\n Object.entries(options.templateVars).forEach(([key, value]) => {\n lazyContext.value.setTemplateVar(key, value, options.templateVarsPrefix)\n })\n }\n\n return {\n call: new Proxy({} as unknown as TContract, {\n get: (_target, prop) => {\n return (methodArgs: TypedApplicationCallFields<DeliberateAny[]>) => {\n const selector = methodSelector({ method: prop as string, contract })\n const abiMetadata = getContractMethodAbiMetadata(contract, prop as string)\n const onCompleteActions = abiMetadata?.allowActions?.map((action) => OnCompleteAction[action])\n const itxnContext = ApplicationCallInnerTxnContext.createFromTypedApplicationCallFields(\n {\n ...getCommonApplicationCallFields(app, options),\n onCompletion: onCompleteActions?.[0],\n ...methodArgs,\n },\n selector,\n abiMetadata?.resourceEncoding,\n )\n invokeAbiCall(itxnContext)\n return {\n itxn: itxnContext,\n returnValue: itxnContext.loggedReturnValue,\n }\n }\n },\n }),\n\n bareCreate: (methodArgs?: BareCreateApplicationCallFields) => {\n const itxnContext = ApplicationCallInnerTxnContext.createFromBareCreateApplicationCallFields({\n ...getCommonApplicationCallFields(app, options),\n ...methodArgs,\n })\n invokeAbiCall(itxnContext)\n return itxnContext\n },\n approvalProgram: app?.application.approvalProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n clearStateProgram: app?.application.clearStateProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n extraProgramPages: options?.extraProgramPages ?? app?.application.extraProgramPages ?? lazyContext.any.uint64(),\n globalUints: options?.globalUints ?? app?.application.globalNumUint ?? lazyContext.any.uint64(),\n globalBytes: options?.globalBytes ?? app?.application.globalNumBytes ?? lazyContext.any.uint64(),\n localUints: options?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64(),\n localBytes: options?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64(),\n } as unknown as ContractProxy<TContract>\n}\n\n/** @internal */\nexport const invokeAbiCall = (itxnContext: ApplicationCallInnerTxnContext) => {\n lazyContext.value.notifyApplicationSpies(itxnContext)\n lazyContext.txn.activeGroup.addInnerTransactionGroup(...(itxnContext.itxns ?? []), itxnContext)\n}\nconst getCommonApplicationCallFields = (app: ApplicationData | undefined, options: CompileContractOptions | undefined) => ({\n approvalProgram: app?.application.approvalProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n clearStateProgram: app?.application.clearStateProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n extraProgramPages: options?.extraProgramPages ?? app?.application.extraProgramPages ?? lazyContext.any.uint64(),\n globalNumUint: options?.globalUints ?? app?.application.globalNumUint ?? lazyContext.any.uint64(),\n globalNumBytes: options?.globalBytes ?? app?.application.globalNumBytes ?? lazyContext.any.uint64(),\n localNumUint: options?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64(),\n localNumBytes: options?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64(),\n})\n\n/** @internal */\nexport function getApplicationCallInnerTxnContext<TArgs extends DeliberateAny[], TReturn = void>(\n method: InstanceMethod<Contract, TArgs, TReturn>,\n methodArgs: TypedApplicationCallFields<TArgs>,\n contract?: Contract | { new (): Contract },\n) {\n const abiMetadata = contract ? getContractMethodAbiMetadata(contract, method.name) : undefined\n const selector = methodSelector({ method, contract })\n return ApplicationCallInnerTxnContext.createFromTypedApplicationCallFields<TReturn>(\n {\n ...methodArgs,\n onCompletion: methodArgs.onCompletion ?? abiMetadata?.allowActions?.map((action) => OnCompleteAction[action])[0],\n },\n selector,\n abiMetadata?.resourceEncoding,\n )\n}\n/** @internal */\nexport function abiCall<TArgs extends DeliberateAny[], TReturn>(\n contractFullName: string,\n method: string,\n methodArgs: TypedApplicationCallFields<TArgs>,\n): { itxn: ApplicationCallInnerTxn; returnValue: TReturn | undefined } {\n const { method: methodInstance, contract: contractInstance } = getContractMethod(contractFullName, method)\n\n const itxnContext = getApplicationCallInnerTxnContext<TArgs, TReturn>(methodInstance, methodArgs, contractInstance)\n\n invokeAbiCall(itxnContext)\n\n return {\n itxn: itxnContext,\n returnValue: itxnContext.loggedReturnValue,\n }\n}\n","/** @internal */\nexport * from '@algorandfoundation/algorand-typescript/arc4'\n/** @internal */\nexport { abiCall, compileArc4 } from '../impl/c2c'\n/** @internal */\nexport { abimethod, baremethod, Contract, readonly } from '../impl/contract'\n/** @internal */\nexport {\n Address,\n Bool,\n Byte,\n convertBytes,\n decodeArc4,\n DynamicArray,\n DynamicBytes,\n encodeArc4,\n FixedArray,\n ReferenceArray,\n sizeOf,\n StaticArray,\n StaticBytes,\n Str,\n Struct,\n Tuple,\n UFixed,\n Uint,\n} from '../impl/encoded-types'\n/** @internal */\nexport { methodSelector } from '../impl/method-selector'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAcA;AACM,SAAU,WAAW,CACzB,QAAmC,EACnC,OAAgC,EAAA;AAEhC,IAAA,IAAI,GAAgC;IACpC,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC;AACxE,IAAA,IAAI,gBAAgB,KAAK,SAAS,EAAE;AAClC,QAAA,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC;IACzE;AAEA,IAAA,IAAI,OAAO,EAAE,YAAY,EAAE;AACzB,QAAA,MAAM,CAAC,OAAO,CAAC,OA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AA4B,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS;IAC9F,MAAM,QAAQ,GAAG,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACrD,OAAO,8BAA8B,CAAC,oCAAoC,CACxE;AACE,QAAA,GAAG,UAAU;QACb,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,WAAW,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,MAAM,KAAK,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACjH,KAAA,EACD,QAAQ,EACR,WAAW,EAAE,gBAAgB,CAC9B;AACH;AACA;SACgB,OAAO,CACrB,gBAAwB,EACxB,MAAc,EACd,UAA6C,EAAA;AAE7C,IAAA,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAE1G,MAAM,WAAW,GAAG,iCAAiC,CAAiB,cAAc,EAAE,UAAU,EAAE,gBAAgB,CAAC;IAEnH,aAAa,CAAC,WAAW,CAAC;IAE1B,OAAO;AACL,QAAA,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,WAAW,CAAC,iBAAiB;KAC3C;AACH;;AC1HA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"arc4-BazlZFRK.js","sources":["../src/impl/c2c.ts","../src/internal/arc4.ts"],"sourcesContent":["import { type CompileContractOptions, type Contract, OnCompleteAction } from '@algorandfoundation/algorand-typescript'\nimport type {\n BareCreateApplicationCallFields,\n ContractProxy,\n TypedApplicationCallFields,\n} from '@algorandfoundation/algorand-typescript/arc4'\nimport { getContractMethod, getContractMethodAbiMetadata } from '../abi-metadata'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport type { ConstructorFor, DeliberateAny, InstanceMethod } from '../typescript-helpers'\nimport type { ApplicationCallInnerTxn } from './inner-transactions'\nimport { ApplicationCallInnerTxnContext } from './inner-transactions'\nimport { methodSelector } from './method-selector'\nimport type { ApplicationData } from './reference'\n\n/** @internal */\nexport function compileArc4<TContract extends Contract>(\n contract: ConstructorFor<TContract>,\n options?: CompileContractOptions,\n): ContractProxy<TContract> {\n let app: ApplicationData | undefined\n const compiledAppEntry = lazyContext.value.getCompiledAppEntry(contract)\n if (compiledAppEntry !== undefined) {\n app = lazyContext.ledger.applicationDataMap.get(compiledAppEntry.value)\n }\n\n if (options?.templateVars) {\n Object.entries(options.templateVars).forEach(([key, value]) => {\n lazyContext.value.setTemplateVar(key, value, options.templateVarsPrefix)\n })\n }\n\n return {\n call: new Proxy({} as unknown as TContract, {\n get: (_target, prop) => {\n return (methodArgs: TypedApplicationCallFields<DeliberateAny[]>) => {\n const selector = methodSelector({ method: prop as string, contract })\n const abiMetadata = getContractMethodAbiMetadata(contract, prop as string)\n const onCompleteActions = abiMetadata?.allowActions?.map((action) => OnCompleteAction[action])\n const itxnContext = ApplicationCallInnerTxnContext.createFromTypedApplicationCallFields(\n {\n ...getCommonApplicationCallFields(app, options),\n onCompletion: onCompleteActions?.[0],\n ...methodArgs,\n },\n selector,\n abiMetadata?.resourceEncoding,\n )\n invokeAbiCall(itxnContext)\n return {\n itxn: itxnContext,\n returnValue: itxnContext.loggedReturnValue,\n }\n }\n },\n }),\n\n bareCreate: (methodArgs?: BareCreateApplicationCallFields) => {\n const itxnContext = ApplicationCallInnerTxnContext.createFromBareCreateApplicationCallFields({\n ...getCommonApplicationCallFields(app, options),\n ...methodArgs,\n })\n invokeAbiCall(itxnContext)\n return itxnContext\n },\n approvalProgram: app?.application.approvalProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n clearStateProgram: app?.application.clearStateProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n extraProgramPages: options?.extraProgramPages ?? app?.application.extraProgramPages ?? lazyContext.any.uint64(),\n globalUints: options?.globalUints ?? app?.application.globalNumUint ?? lazyContext.any.uint64(),\n globalBytes: options?.globalBytes ?? app?.application.globalNumBytes ?? lazyContext.any.uint64(),\n localUints: options?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64(),\n localBytes: options?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64(),\n } as unknown as ContractProxy<TContract>\n}\n\n/** @internal */\nexport const invokeAbiCall = (itxnContext: ApplicationCallInnerTxnContext) => {\n lazyContext.value.notifyApplicationSpies(itxnContext)\n lazyContext.txn.activeGroup.addInnerTransactionGroup(...(itxnContext.itxns ?? []), itxnContext)\n}\nconst getCommonApplicationCallFields = (app: ApplicationData | undefined, options: CompileContractOptions | undefined) => ({\n approvalProgram: app?.application.approvalProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n clearStateProgram: app?.application.clearStateProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n extraProgramPages: options?.extraProgramPages ?? app?.application.extraProgramPages ?? lazyContext.any.uint64(),\n globalNumUint: options?.globalUints ?? app?.application.globalNumUint ?? lazyContext.any.uint64(),\n globalNumBytes: options?.globalBytes ?? app?.application.globalNumBytes ?? lazyContext.any.uint64(),\n localNumUint: options?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64(),\n localNumBytes: options?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64(),\n})\n\n/** @internal */\nexport function getApplicationCallInnerTxnContext<TArgs extends DeliberateAny[], TReturn = void>(\n method: InstanceMethod<Contract, TArgs, TReturn>,\n methodArgs: TypedApplicationCallFields<TArgs>,\n contract?: Contract | { new (): Contract },\n) {\n const abiMetadata = contract ? getContractMethodAbiMetadata(contract, method.name) : undefined\n const selector = methodSelector({ method, contract })\n return ApplicationCallInnerTxnContext.createFromTypedApplicationCallFields<TReturn>(\n {\n ...methodArgs,\n onCompletion: methodArgs.onCompletion ?? abiMetadata?.allowActions?.map((action) => OnCompleteAction[action])[0],\n },\n selector,\n abiMetadata?.resourceEncoding,\n )\n}\n/** @internal */\nexport function abiCall<TArgs extends DeliberateAny[], TReturn>(\n contractFullName: string,\n method: string,\n methodArgs: TypedApplicationCallFields<TArgs>,\n): { itxn: ApplicationCallInnerTxn; returnValue: TReturn | undefined } {\n const { method: methodInstance, contract: contractInstance } = getContractMethod(contractFullName, method)\n\n const itxnContext = getApplicationCallInnerTxnContext<TArgs, TReturn>(methodInstance, methodArgs, contractInstance)\n\n invokeAbiCall(itxnContext)\n\n return {\n itxn: itxnContext,\n returnValue: itxnContext.loggedReturnValue,\n }\n}\n","/** @internal */\nexport * from '@algorandfoundation/algorand-typescript/arc4'\n/** @internal */\nexport { abiCall, compileArc4 } from '../impl/c2c'\n/** @internal */\nexport { abimethod, baremethod, Contract, readonly } from '../impl/contract'\n/** @internal */\nexport {\n Address,\n Bool,\n Byte,\n convertBytes,\n decodeArc4,\n DynamicArray,\n DynamicBytes,\n encodeArc4,\n FixedArray,\n ReferenceArray,\n sizeOf,\n StaticArray,\n StaticBytes,\n Str,\n Struct,\n Tuple,\n UFixed,\n Uint,\n} from '../impl/encoded-types'\n/** @internal */\nexport { methodSelector } from '../impl/method-selector'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAcA;AACM,SAAU,WAAW,CACzB,QAAmC,EACnC,OAAgC,EAAA;AAEhC,IAAA,IAAI,GAAgC;IACpC,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC;AACxE,IAAA,IAAI,gBAAgB,KAAK,SAAS,EAAE;AAClC,QAAA,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC;IACzE;AAEA,IAAA,IAAI,OAAO,EAAE,YAAY,EAAE;AACzB,QAAA,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAC5D,YAAA,WAAW,CAAC,KAAK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EAAE,QAAQ,EAAE,CAAC;IACrD,OAAO,8BAA8B,CAAC,oCAAoC,CACxE;AACE,QAAA,GAAG,UAAU;QACb,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,WAAW,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,MAAM,KAAK,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACjH,KAAA,EACD,QAAQ,EACR,WAAW,EAAE,gBAAgB,CAC9B;AACH;AACA;SACgB,OAAO,CACrB,gBAAwB,EACxB,MAAc,EACd,UAA6C,EAAA;AAE7C,IAAA,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAE1G,MAAM,WAAW,GAAG,iCAAiC,CAAiB,cAAc,EAAE,UAAU,EAAE,gBAAgB,CAAC;IAEnH,aAAa,CAAC,WAAW,CAAC;IAE1B,OAAO;AACL,QAAA,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,WAAW,CAAC,iBAAiB;KAC3C;AACH;;AC1HA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { OnCompleteAction, TransactionType } from '@algorandfoundation/algorand-typescript';
2
2
  import { g as getContractMethodAbiMetadata, a as getContractAbiMetadata } from './runtime-helpers-Dpv9_KsV.js';
3
- import { m as methodSelector, G as GlobalStateCls, L as LocalStateCls, C as ContractContext, c as checkRoutingConditions, A as ApplicationCallInnerTxnContext, I as ItxnParams, a as createInnerTxn, b as ApplicationCallTransaction, P as PaymentTransaction, K as KeyRegistrationTransaction, d as AssetConfigTransaction, e as AssetTransferTransaction, f as AssetFreezeTransaction } from './inner-transactions-DIR405zr.js';
3
+ import { m as methodSelector, G as GlobalStateCls, L as LocalStateCls, C as ContractContext, c as checkRoutingConditions, A as ApplicationCallInnerTxnContext, I as ItxnParams, a as createInnerTxn, b as ApplicationCallTransaction, P as PaymentTransaction, K as KeyRegistrationTransaction, d as AssetConfigTransaction, e as AssetTransferTransaction, f as AssetFreezeTransaction } from './inner-transactions-pcawvv6H.js';
4
4
  import { a as asNumber, U as Uint64Cls, B as BigUintCls, b as BytesCls, A as AccountCls, c as AlgoTsPrimitiveCls, i as iterBigInt, d as Uint64Map, e as AccountMap, f as asBytes, g as Asset, h as asUint64, j as Application, k as asMaybeUint64Cls, l as asUint64Cls, m as AssetHolding, n as AccountData, o as ApplicationData, p as getDefaultAssetData, q as asBigInt, r as asMaybeBytesCls, s as asUint8Array, t as ApplicationCls, M as MAX_UINT64, u as ABI_RETURN_VALUE_LOG_PREFIX, v as lazyContext, T as TRANSACTION_GROUP_MAX_SIZE, w as Uint64, x as getRandomBigInt, y as asBigUintCls, z as BigUint, C as MAX_BYTES_SIZE, D as Bytes, E as Account, F as getRandomBytes, G as AssetCls, H as MAX_UINT512, I as MAX_UINT8, J as MAX_UINT16, K as MAX_UINT32, L as MAX_UINT128, N as MAX_UINT256, O as BITS_IN_BYTE, P as BaseContract, Q as ContextManager, R as DEFAULT_TEMPLATE_VAR_PREFIX } from './utils-DyUEnpf6.js';
5
5
  export { S as toExternalValue } from './utils-DyUEnpf6.js';
6
6
  import { I as InternalError, i as invariant } from './typescript-helpers-sobuICoc.js';
@@ -44,7 +44,7 @@ const methodSelector = ({ method, contract, }) => {
44
44
 
45
45
  /** @internal */
46
46
  const baseDefaultFields = () => ({
47
- sender: lazyContext.defaultSender,
47
+ sender: lazyContext.hasActiveGroup ? lazyContext.activeApplication.address : lazyContext.defaultSender,
48
48
  fee: Uint64(0),
49
49
  firstValid: Uint64(0),
50
50
  firstValidTime: Uint64(0),
@@ -896,7 +896,9 @@ class ContractContext {
896
896
  return {
897
897
  construct(target, args) {
898
898
  let t = undefined;
899
- const application = lazyContext.any.application();
899
+ const application = lazyContext.any.application({
900
+ creator: lazyContext.hasActiveGroup ? lazyContext.activeGroup.activeTransaction.sender : lazyContext.defaultSender,
901
+ });
900
902
  const txn = lazyContext.any.txn.applicationCall({ appId: application });
901
903
  const appData = lazyContext.ledger.applicationDataMap.getOrFail(application.id);
902
904
  appData.isCreating = true;
@@ -1231,4 +1233,4 @@ class ApplicationCallInnerTxnContext extends ApplicationCallInnerTxn {
1231
1233
  }
1232
1234
 
1233
1235
  export { ApplicationCallInnerTxnContext as A, Box as B, ContractContext as C, GlobalStateCls as G, ItxnParams as I, KeyRegistrationTransaction as K, LocalStateCls as L, PaymentTransaction as P, createInnerTxn as a, ApplicationCallTransaction as b, checkRoutingConditions as c, AssetConfigTransaction as d, AssetTransferTransaction as e, AssetFreezeTransaction as f, applicationCall as g, assetFreeze as h, assetTransfer as i, assetConfig as j, keyRegistration as k, BoxMap as l, methodSelector as m, GlobalState as n, LocalState as o, payment as p, submitGroup as s };
1234
- //# sourceMappingURL=inner-transactions-DIR405zr.js.map
1236
+ //# sourceMappingURL=inner-transactions-pcawvv6H.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inner-transactions-pcawvv6H.js","sources":["../src/impl/method-selector.ts","../src/impl/transactions.ts","../src/context-helpers/context-util.ts","../src/impl/state.ts","../src/subcontexts/contract-context.ts","../src/impl/inner-transactions.ts"],"sourcesContent":["import type { bytes } from '@algorandfoundation/algorand-typescript'\nimport { encodingUtil } from '@algorandfoundation/puya-ts'\nimport { getArc4Selector, getContractMethod, getContractMethodAbiMetadata } from '../abi-metadata'\nimport { CodeError } from '../errors'\nimport type { InstanceMethod } from '../typescript-helpers'\nimport type { Contract } from './contract'\nimport { sha512_256 } from './crypto'\nimport { Bytes } from './primitives'\n\n/**\n * Computes the method selector for an ARC-4 contract method.\n *\n * Supports three invocation patterns:\n * 1. `methodSelector('sink(string,uint8[])void')`:\n * Direct method signature string (no contract): Returns SHA-512/256 hash of signature\n * 2. `methodSelector<typeof SignaturesContract.prototype.sink>()`:\n * Contract name as string + method name as string: Looks up registered contract and returns ARC-4 selector\n * 3. `methodSelector(SignaturesContract.prototype.sink)`:\n * Contract class/instance + method instance/name: Returns ARC-4 selector from ABI metadata\n *\n * @internal\n */\nexport const methodSelector = <TContract extends Contract>({\n method,\n contract,\n}: {\n method?: string | InstanceMethod<Contract>\n contract?: string | TContract | { new (): TContract }\n}): bytes => {\n const isDirectSignature = typeof method === 'string' && contract === undefined\n const isContractNameLookup = typeof contract === 'string' && typeof method === 'string' && contract && method\n const isContractMethodLookup = typeof contract !== 'string' && contract && method\n\n // Pattern 1: Direct method signature string (e.g., \"add(uint64,uint64)uint64\")\n if (isDirectSignature) {\n const signatureBytes = Bytes(encodingUtil.utf8ToUint8Array(method as string))\n return sha512_256(signatureBytes).slice(0, 4)\n }\n\n // Pattern 2: Contract name as string with method name\n if (isContractNameLookup) {\n const { contract: registeredContract } = getContractMethod(contract, method)\n\n const abiMetadata = getContractMethodAbiMetadata(registeredContract, method)\n return Bytes(getArc4Selector(abiMetadata))\n }\n\n // Pattern 3: Contract class/instance with method signature or name\n if (isContractMethodLookup) {\n const methodName = typeof method === 'string' ? method : method.name\n\n const abiMetadata = getContractMethodAbiMetadata(contract, methodName)\n return Bytes(getArc4Selector(abiMetadata))\n }\n\n throw new CodeError('Invalid arguments to methodSelector')\n}\n","import type {\n Account as AccountType,\n Application as ApplicationType,\n Asset as AssetType,\n bytes,\n BytesCompat,\n gtxn,\n uint64,\n Uint64Compat,\n} from '@algorandfoundation/algorand-typescript'\nimport { OnCompleteAction, TransactionType } from '@algorandfoundation/algorand-typescript'\nimport { ABI_RETURN_VALUE_LOG_PREFIX, MAX_ITEMS_IN_LOG } from '../constants'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { InternalError } from '../errors'\nimport type { Mutable, ObjectKeys } from '../typescript-helpers'\nimport { asBytes, asMaybeBytesCls, asMaybeUint64Cls, asNumber, asUint64Cls, combineIntoMaxBytePages, getRandomBytes } from '../util'\nimport { toBytes } from './encoded-types'\nimport { Bytes, Uint64, type StubBytesCompat } from './primitives'\nimport { Account, Application, Asset } from './reference'\n\n/** @internal */\nconst baseDefaultFields = () => ({\n sender: lazyContext.hasActiveGroup ? lazyContext.activeApplication.address : lazyContext.defaultSender,\n fee: Uint64(0),\n firstValid: Uint64(0),\n firstValidTime: Uint64(0),\n lastValid: Uint64(0),\n note: Bytes(),\n lease: Bytes() as bytes<32>,\n groupIndex: Uint64(0),\n txnId: getRandomBytes(32).asAlgoTs().toFixed({ length: 32 }),\n rekeyTo: Account(),\n})\n\nexport type TxnFields<TTxn> = Partial<Mutable<Pick<TTxn, ObjectKeys<TTxn>>>>\n\nabstract class TransactionBase {\n /** @internal */\n protected constructor(fields: Partial<ReturnType<typeof baseDefaultFields>>) {\n const baseDefaults = baseDefaultFields()\n this.sender = fields.sender ?? baseDefaults.sender\n this.fee = fields.fee ?? baseDefaults.fee\n this.firstValid = fields.firstValid ?? baseDefaults.firstValid\n this.firstValidTime = fields.firstValidTime ?? baseDefaults.firstValidTime\n this.lastValid = fields.lastValid ?? baseDefaults.lastValid\n this.note = fields.note ?? baseDefaults.note\n this.lease = fields.lease ?? baseDefaults.lease\n this.groupIndex = fields.groupIndex ?? baseDefaults.groupIndex\n this.txnId = fields.txnId ?? baseDefaults.txnId\n this.rekeyTo = fields.rekeyTo ?? baseDefaults.rekeyTo\n this.scratchSpace = Array(256).fill(Uint64(0))\n }\n\n readonly sender: AccountType\n readonly fee: uint64\n readonly firstValid: uint64\n readonly firstValidTime: uint64\n readonly lastValid: uint64\n readonly note: bytes\n readonly lease: bytes<32>\n readonly groupIndex: uint64\n readonly txnId: bytes<32>\n readonly rekeyTo: AccountType\n readonly scratchSpace: Array<bytes | uint64>\n\n setScratchSlot(index: Uint64Compat, value: BytesCompat | Uint64Compat): void {\n const i = asNumber(index)\n if (i >= this.scratchSpace.length) {\n throw new InternalError('invalid scratch slot')\n }\n const bytesValue = asMaybeBytesCls(value)\n const uint64Value = asMaybeUint64Cls(value)\n this.scratchSpace[i] = bytesValue?.asAlgoTs() ?? uint64Value?.asAlgoTs() ?? Uint64(0)\n }\n\n getScratchSlot(index: Uint64Compat): bytes | uint64 {\n const i = asNumber(index)\n if (i >= this.scratchSpace.length) {\n throw new InternalError('invalid scratch slot')\n }\n return this.scratchSpace[i]\n }\n}\n\nexport class PaymentTransaction extends TransactionBase implements gtxn.PaymentTxn {\n /** @internal */\n static create(fields: TxnFields<gtxn.PaymentTxn>) {\n return new PaymentTransaction(fields)\n }\n\n /** @internal */\n protected constructor(fields: TxnFields<gtxn.PaymentTxn>) {\n super(fields)\n this.receiver = fields.receiver ?? Account()\n this.amount = fields.amount ?? Uint64(0)\n this.closeRemainderTo = fields.closeRemainderTo ?? Account()\n }\n\n readonly receiver: AccountType\n readonly amount: uint64\n readonly closeRemainderTo: AccountType\n readonly type: TransactionType.Payment = TransactionType.Payment\n readonly typeBytes: bytes = asUint64Cls(TransactionType.Payment).toBytes().asAlgoTs()\n}\n\nexport class KeyRegistrationTransaction extends TransactionBase implements gtxn.KeyRegistrationTxn {\n /** @internal */\n static create(fields: TxnFields<gtxn.KeyRegistrationTxn>) {\n return new KeyRegistrationTransaction(fields)\n }\n\n /** @internal */\n protected constructor(fields: TxnFields<gtxn.KeyRegistrationTxn>) {\n super(fields)\n this.voteKey = fields.voteKey ?? (Bytes() as bytes<32>)\n this.selectionKey = fields.selectionKey ?? (Bytes() as bytes<32>)\n this.voteFirst = fields.voteFirst ?? Uint64(0)\n this.voteLast = fields.voteLast ?? Uint64(0)\n this.voteKeyDilution = fields.voteKeyDilution ?? Uint64(0)\n this.nonparticipation = fields.nonparticipation ?? false\n this.stateProofKey = fields.stateProofKey ?? (Bytes() as bytes<64>)\n const globalData = lazyContext.ledger.globalData\n if (this.fee >= globalData.payoutsGoOnlineFee && globalData.payoutsEnabled) {\n lazyContext.ledger.patchAccountData(this.sender, {\n incentiveEligible: true,\n })\n }\n }\n\n readonly voteKey: bytes<32>\n readonly selectionKey: bytes<32>\n readonly voteFirst: uint64\n readonly voteLast: uint64\n readonly voteKeyDilution: uint64\n readonly nonparticipation: boolean\n readonly stateProofKey: bytes<64>\n readonly type: TransactionType.KeyRegistration = TransactionType.KeyRegistration\n readonly typeBytes: bytes = asUint64Cls(TransactionType.KeyRegistration).toBytes().asAlgoTs()\n}\n\nexport class AssetConfigTransaction extends TransactionBase implements gtxn.AssetConfigTxn {\n /** @internal */\n static create(fields: TxnFields<gtxn.AssetConfigTxn>) {\n return new AssetConfigTransaction(fields)\n }\n\n /** @internal */\n protected constructor(fields: TxnFields<gtxn.AssetConfigTxn>) {\n super(fields)\n this.configAsset = fields.configAsset ?? Asset()\n this.total = fields.total ?? Uint64(0)\n this.decimals = fields.decimals ?? Uint64(0)\n this.defaultFrozen = fields.defaultFrozen ?? false\n this.unitName = fields.unitName ?? Bytes()\n this.assetName = fields.assetName ?? Bytes()\n this.url = fields.url ?? Bytes()\n this.metadataHash = fields.metadataHash ?? (Bytes() as bytes<32>)\n this.manager = fields.manager ?? Account()\n this.reserve = fields.reserve ?? Account()\n this.freeze = fields.freeze ?? Account()\n this.clawback = fields.clawback ?? Account()\n this.createdAsset = fields.createdAsset ?? Asset()\n }\n\n readonly configAsset: AssetType\n readonly total: uint64\n readonly decimals: uint64\n readonly defaultFrozen: boolean\n readonly unitName: bytes\n readonly assetName: bytes\n readonly url: bytes\n readonly metadataHash: bytes<32>\n readonly manager: AccountType\n readonly reserve: AccountType\n readonly freeze: AccountType\n readonly clawback: AccountType\n readonly createdAsset: AssetType\n readonly type: TransactionType.AssetConfig = TransactionType.AssetConfig\n readonly typeBytes: bytes = asUint64Cls(TransactionType.AssetConfig).toBytes().asAlgoTs()\n}\n\nexport class AssetTransferTransaction extends TransactionBase implements gtxn.AssetTransferTxn {\n /** @internal */\n static create(fields: TxnFields<gtxn.AssetTransferTxn>) {\n return new AssetTransferTransaction(fields)\n }\n\n /** @internal */\n protected constructor(fields: TxnFields<gtxn.AssetTransferTxn>) {\n super(fields)\n this.xferAsset = fields.xferAsset ?? Asset()\n this.assetAmount = fields.assetAmount ?? Uint64(0)\n this.assetSender = fields.assetSender ?? Account()\n this.assetReceiver = fields.assetReceiver ?? Account()\n this.assetCloseTo = fields.assetCloseTo ?? Account()\n }\n\n readonly xferAsset: AssetType\n readonly assetAmount: uint64\n readonly assetSender: AccountType\n readonly assetReceiver: AccountType\n readonly assetCloseTo: AccountType\n\n readonly type: TransactionType.AssetTransfer = TransactionType.AssetTransfer\n readonly typeBytes: bytes = asUint64Cls(TransactionType.AssetTransfer).toBytes().asAlgoTs()\n}\n\nexport class AssetFreezeTransaction extends TransactionBase implements gtxn.AssetFreezeTxn {\n /** @internal */\n static create(fields: TxnFields<gtxn.AssetFreezeTxn>) {\n return new AssetFreezeTransaction(fields)\n }\n\n /** @internal */\n protected constructor(fields: TxnFields<gtxn.AssetFreezeTxn>) {\n super(fields)\n this.freezeAsset = fields.freezeAsset ?? Asset()\n this.freezeAccount = fields.freezeAccount ?? Account()\n this.frozen = fields.frozen ?? false\n }\n\n readonly freezeAsset: AssetType\n readonly freezeAccount: AccountType\n readonly frozen: boolean\n\n readonly type: TransactionType.AssetFreeze = TransactionType.AssetFreeze\n readonly typeBytes: bytes = asUint64Cls(TransactionType.AssetFreeze).toBytes().asAlgoTs()\n}\n\nexport type ApplicationCallTransactionFields = TxnFields<gtxn.ApplicationCallTxn> &\n Partial<{\n appArgs: Array<unknown>\n accounts: Array<AccountType>\n assets: Array<AssetType>\n apps: Array<ApplicationType>\n approvalProgramPages: Array<bytes>\n clearStateProgramPages: Array<bytes>\n appLogs: Array<bytes>\n scratchSpace: Record<number, bytes | uint64>\n }>\n\nexport class ApplicationCallTransaction extends TransactionBase implements gtxn.ApplicationCallTxn {\n /** @internal */\n static create(fields: ApplicationCallTransactionFields) {\n return new ApplicationCallTransaction(fields)\n }\n /** @internal */\n private args: Array<unknown>\n #accounts: Array<AccountType>\n #assets: Array<AssetType>\n #apps: Array<ApplicationType>\n #approvalProgramPages: Array<bytes>\n #clearStateProgramPages: Array<bytes>\n #appLogs: Array<bytes>\n #appId: ApplicationType\n #rejectVersion: uint64\n\n /** @internal */\n protected constructor(fields: ApplicationCallTransactionFields) {\n super(fields)\n this.#appId = fields.appId ?? Application()\n this.onCompletion = fields.onCompletion ?? OnCompleteAction.NoOp\n this.globalNumUint = fields.globalNumUint ?? Uint64(0)\n this.globalNumBytes = fields.globalNumBytes ?? Uint64(0)\n this.localNumUint = fields.localNumUint ?? Uint64(0)\n this.localNumBytes = fields.localNumBytes ?? Uint64(0)\n this.extraProgramPages = fields.extraProgramPages ?? Uint64(0)\n this.createdApp = fields.createdApp ?? Application()\n this.args = fields.appArgs ?? []\n this.#appLogs = fields.appLogs ?? []\n this.#accounts = fields.accounts ?? []\n this.#assets = fields.assets ?? []\n this.#apps = fields.apps ?? []\n this.#approvalProgramPages = fields.approvalProgramPages ?? (fields.approvalProgram ? [fields.approvalProgram] : [])\n this.#clearStateProgramPages = fields.clearStateProgramPages ?? (fields.clearStateProgram ? [fields.clearStateProgram] : [])\n this.#rejectVersion = fields.rejectVersion ?? Uint64(0)\n Object.entries(fields.scratchSpace ?? {}).forEach(([k, v]) => this.setScratchSlot(Number(k), v))\n }\n\n get backingAppId(): ApplicationType {\n return this.#appId\n }\n\n get appId(): ApplicationType {\n if (asNumber(this.#appId.id) === 0) {\n return this.#appId\n }\n const appData = lazyContext.getApplicationData(this.#appId.id)\n if (appData && appData.isCreating) {\n return Application(0)\n }\n return this.#appId\n }\n readonly onCompletion: OnCompleteAction\n readonly globalNumUint: uint64\n readonly globalNumBytes: uint64\n readonly localNumUint: uint64\n readonly localNumBytes: uint64\n readonly extraProgramPages: uint64\n createdApp: ApplicationType\n get approvalProgram() {\n return this.approvalProgramPages(0)\n }\n get clearStateProgram() {\n return this.clearStateProgramPages(0)\n }\n get numAppArgs() {\n return Uint64(this.args.length)\n }\n get numAccounts() {\n return Uint64(this.#accounts.length)\n }\n get numAssets() {\n return Uint64(this.#assets.length)\n }\n get numApps() {\n return Uint64(this.#apps.length)\n }\n get numApprovalProgramPages() {\n return Uint64(this.approvalProgramPages.length)\n }\n get numClearStateProgramPages() {\n return Uint64(this.clearStateProgramPages.length)\n }\n get numLogs() {\n return Uint64(this.appLogs.length || lazyContext.getApplicationData(this.appId.id).application.appLogs!.length)\n }\n get lastLog() {\n return this.appLogs.at(-1) ?? lazyContext.getApplicationData(this.appId.id).application.appLogs!.at(-1) ?? Bytes()\n }\n get apat() {\n return this.#accounts\n }\n get apas() {\n return this.#assets\n }\n get apfa() {\n return this.#apps\n }\n get rejectVersion() {\n return this.#rejectVersion\n }\n appArgs(index: Uint64Compat): bytes {\n return toBytes(this.args[asNumber(index)])\n }\n accounts(index: Uint64Compat): AccountType {\n return this.#accounts[asNumber(index)]\n }\n assets(index: Uint64Compat): AssetType {\n return this.#assets[asNumber(index)]\n }\n apps(index: Uint64Compat): ApplicationType {\n return this.#apps[asNumber(index)]\n }\n approvalProgramPages(index: Uint64Compat): bytes {\n return combineIntoMaxBytePages(this.#approvalProgramPages)[asNumber(index)]\n }\n clearStateProgramPages(index: Uint64Compat): bytes {\n return combineIntoMaxBytePages(this.#clearStateProgramPages)[asNumber(index)]\n }\n logs(index: Uint64Compat): bytes {\n const i = asNumber(index)\n return this.appLogs[i] ?? lazyContext.getApplicationData(this.appId.id).application.appLogs ?? Bytes()\n }\n readonly type: TransactionType.ApplicationCall = TransactionType.ApplicationCall\n readonly typeBytes: bytes = asUint64Cls(TransactionType.ApplicationCall).toBytes().asAlgoTs()\n\n /** @internal */\n get appLogs() {\n return this.#appLogs\n }\n /** @internal */\n appendLog(value: StubBytesCompat): void {\n if (this.#appLogs.length + 1 > MAX_ITEMS_IN_LOG) {\n throw new InternalError(`Too many log calls in program, up to ${MAX_ITEMS_IN_LOG} is allowed`)\n }\n this.#appLogs.push(asBytes(value))\n }\n /** @internal */\n logArc4ReturnValue(value: unknown): void {\n this.appendLog(ABI_RETURN_VALUE_LOG_PREFIX.concat(toBytes(value)))\n }\n}\n\nexport type Transaction =\n | PaymentTransaction\n | KeyRegistrationTransaction\n | AssetConfigTransaction\n | AssetTransferTransaction\n | AssetFreezeTransaction\n | ApplicationCallTransaction\n\nexport type AllTransactionFields = TxnFields<gtxn.PaymentTxn> &\n TxnFields<gtxn.KeyRegistrationTxn> &\n TxnFields<gtxn.AssetConfigTxn> &\n TxnFields<gtxn.AssetTransferTxn> &\n TxnFields<gtxn.AssetFreezeTxn> &\n ApplicationCallTransactionFields\n","import type { OnCompleteActionStr, uint64 } from '@algorandfoundation/algorand-typescript'\nimport { OnCompleteAction } from '@algorandfoundation/algorand-typescript'\nimport type { AbiMetadata } from '../abi-metadata'\nimport { AssertError } from '../errors'\nimport { ApplicationCallTransaction } from '../impl/transactions'\nimport { lazyContext } from './internal-context'\n\n/** @internal */\nexport const checkRoutingConditions = (appId: uint64, metadata: AbiMetadata) => {\n const appData = lazyContext.getApplicationData(appId)\n const isCreating = appData.isCreating\n if (isCreating && metadata.onCreate === 'disallow') {\n throw new AssertError('method can not be called while creating')\n }\n if (!isCreating && metadata.onCreate === 'require') {\n throw new AssertError('method can only be called while creating')\n }\n const txn = lazyContext.activeGroup.activeTransaction\n if (\n txn instanceof ApplicationCallTransaction &&\n metadata.allowActions &&\n !metadata.allowActions.includes(OnCompleteAction[txn.onCompletion] as OnCompleteActionStr)\n ) {\n throw new AssertError(`method can only be called with one of the following on_completion values: ${metadata.allowActions.join(', ')}`)\n }\n}\n","import type {\n Account,\n Application,\n BoxMap as BoxMapType,\n Box as BoxType,\n bytes,\n GlobalStateOptions,\n GlobalState as GlobalStateType,\n LocalStateForAccount,\n LocalState as LocalStateType,\n uint64,\n} from '@algorandfoundation/algorand-typescript'\nimport { AccountMap } from '../collections/custom-key-map'\nimport { MAX_BOX_SIZE } from '../constants'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { AssertError, CodeError, InternalError } from '../errors'\nimport type { TypeInfo } from '../impl/encoded-types'\nimport { toBytes } from '../impl/encoded-types'\nimport { getGenericTypeInfo } from '../runtime-helpers'\nimport { asBytes, asBytesCls, asNumber, asUint8Array, concatUint8Arrays } from '../util'\nimport { getEncoder, minLengthForType } from './encoded-types'\nimport type { StubBytesCompat, StubUint64Compat } from './primitives'\nimport { Bytes, Uint64, Uint64Cls } from './primitives'\n\nexport class GlobalStateCls<ValueType> {\n /** @internal */\n private readonly _type: string = GlobalStateCls.name\n\n /** @internal */\n #value: ValueType | undefined\n\n key: bytes | undefined\n\n get hasKey(): boolean {\n return this.key !== undefined && this.key.length > 0\n }\n\n delete: () => void = () => {\n if (this.#value instanceof Uint64Cls) {\n this.#value = Uint64(0) as ValueType\n } else {\n this.#value = undefined\n }\n }\n\n static [Symbol.hasInstance](x: unknown): x is GlobalStateCls<unknown> {\n return x instanceof Object && '_type' in x && (x as { _type: string })['_type'] === GlobalStateCls.name\n }\n\n get value(): ValueType {\n if (this.#value === undefined) {\n throw new AssertError('value is not set')\n }\n return this.#value\n }\n\n set value(v: ValueType) {\n this.#value = v\n }\n\n get hasValue(): boolean {\n return this.#value !== undefined\n }\n\n /** @internal */\n constructor(key?: bytes | string, value?: ValueType) {\n this.key = key !== undefined ? asBytes(key) : undefined\n this.#value = value\n }\n}\n\nexport class LocalStateCls<ValueType> {\n /** @internal */\n #value: ValueType | undefined\n\n delete: () => void = () => {\n if (this.#value instanceof Uint64Cls) {\n this.#value = Uint64(0) as ValueType\n } else {\n this.#value = undefined\n }\n }\n get value(): ValueType {\n if (this.#value === undefined) {\n throw new AssertError('value is not set')\n }\n return this.#value\n }\n\n set value(v: ValueType) {\n this.#value = v\n }\n\n get hasValue(): boolean {\n return this.#value !== undefined\n }\n}\n\nexport class LocalStateMapCls<ValueType> {\n /** @internal */\n private applicationId: uint64\n\n /** @internal */\n constructor() {\n this.applicationId = lazyContext.activeGroup.activeApplicationId\n }\n\n getValue(key: string | bytes | undefined, account: Account): LocalStateCls<ValueType> {\n const bytesKey = key === undefined ? Bytes() : asBytes(key)\n const localStateMap = this.ensureApplicationLocalStateMap(bytesKey)\n if (!localStateMap.has(account)) {\n localStateMap.set(account, new LocalStateCls())\n }\n return localStateMap.getOrFail(account) as LocalStateCls<ValueType>\n }\n\n /** @internal */\n private ensureApplicationLocalStateMap(key: bytes | string) {\n const applicationData = lazyContext.ledger.applicationDataMap.getOrFail(this.applicationId)!.application\n if (!applicationData.localStateMaps.has(key)) {\n applicationData.localStateMaps.set(key, new AccountMap<LocalStateCls<ValueType>>())\n }\n return applicationData.localStateMaps.getOrFail(key)\n }\n}\n\n/** @internal */\nexport function GlobalState<ValueType>(options?: GlobalStateOptions<ValueType>): GlobalStateType<ValueType> {\n return new GlobalStateCls(options?.key, options?.initialValue)\n}\n\n/** @internal */\nexport function LocalState<ValueType>(options?: { key?: bytes | string }): LocalStateType<ValueType> {\n function localStateInternal(account: Account): LocalStateForAccount<ValueType> {\n return localStateInternal.map.getValue(localStateInternal.key, account)\n }\n localStateInternal.key = options?.key\n localStateInternal.hasKey = options?.key !== undefined && options.key.length > 0\n localStateInternal.map = new LocalStateMapCls<ValueType>()\n return localStateInternal\n}\n\n/** @internal */\nexport class BoxCls<TValue> {\n #key: bytes | undefined\n #app: Application\n #valueType?: TypeInfo\n\n private readonly _type: string = BoxCls.name\n private get valueType(): TypeInfo {\n if (this.#valueType === undefined) {\n const typeInfo = getGenericTypeInfo(this)\n if (typeInfo === undefined || typeInfo.genericArgs === undefined || typeInfo.genericArgs.length !== 1) {\n throw new InternalError('Box value type is not set')\n }\n this.#valueType = (typeInfo.genericArgs as TypeInfo[])[0]\n }\n return this.#valueType\n }\n\n static [Symbol.hasInstance](x: unknown): x is BoxCls<unknown> {\n return x instanceof Object && '_type' in x && (x as { _type: string })['_type'] === BoxCls.name\n }\n\n constructor(key?: StubBytesCompat, app?: Application, valueType?: TypeInfo) {\n this.#key = key ? asBytes(key) : undefined\n this.#app = app ?? lazyContext.activeApplication\n this.#valueType = valueType\n }\n\n private get fromBytes() {\n return (val: Uint8Array) => getEncoder<TValue>(this.valueType)(val, this.valueType)\n }\n\n create(options?: { size?: StubUint64Compat }): boolean {\n const optionSize = options?.size !== undefined ? asNumber(options.size) : undefined\n const valueTypeSize = minLengthForType(this.valueType)\n if (valueTypeSize === undefined && optionSize === undefined) {\n throw new InternalError(`${this.valueType.name} does not have a fixed byte size. Please specify a size argument`)\n }\n if (valueTypeSize !== undefined && optionSize !== undefined) {\n if (optionSize < valueTypeSize) {\n throw new InternalError(`Box size cannot be less than ${valueTypeSize}`)\n }\n if (optionSize > valueTypeSize) {\n process.emitWarning(\n `Box size is set to ${optionSize} but the value type ${this.valueType.name} has a fixed size of ${valueTypeSize}`,\n )\n }\n }\n const size = asNumber(options?.size ?? 0)\n if (size > MAX_BOX_SIZE) {\n throw new InternalError(`Box size cannot exceed ${MAX_BOX_SIZE}`)\n }\n lazyContext.ledger.setBox(this.#app, this.key, new Uint8Array(Math.max(size, valueTypeSize ?? 0)))\n return true\n }\n\n get value(): TValue {\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n let materialised = lazyContext.ledger.getMaterialisedBox<TValue>(this.#app, this.key)\n if (materialised !== undefined) {\n return materialised\n }\n const original = lazyContext.ledger.getBox(this.#app, this.key)\n materialised = this.fromBytes(original)\n lazyContext.ledger.setMaterialisedBox(this.#app, this.key, materialised)\n return materialised\n }\n set value(v: TValue) {\n const isStaticValueType = minLengthForType(this.valueType) !== undefined\n const newValueBytes = asUint8Array(toBytes(v))\n if (isStaticValueType && this.exists) {\n const originalValueBytes = lazyContext.ledger.getBox(this.#app, this.key)\n if (originalValueBytes.length !== newValueBytes.length) {\n throw new CodeError(`attempt to box_put wrong size ${originalValueBytes.length} != ${newValueBytes.length}`)\n }\n }\n lazyContext.ledger.setBox(this.#app, this.key, newValueBytes)\n lazyContext.ledger.setMaterialisedBox(this.#app, this.key, v)\n }\n\n get hasKey(): boolean {\n return this.#key !== undefined && this.#key.length > 0\n }\n\n get key(): bytes {\n if (this.#key === undefined || this.#key.length === 0) {\n throw new InternalError('Box key is empty')\n }\n return this.#key\n }\n\n set key(key: StubBytesCompat) {\n this.#key = asBytes(key)\n }\n\n get exists(): boolean {\n return lazyContext.ledger.boxExists(this.#app, this.key)\n }\n\n get length(): uint64 {\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n return lazyContext.ledger.getBox(this.#app, this.key).length\n }\n\n get(options: { default: TValue }): TValue {\n const [value, exists] = this.maybe()\n return exists ? value : options.default\n }\n\n delete(): boolean {\n return lazyContext.ledger.deleteBox(this.#app, this.key)\n }\n\n maybe(): readonly [TValue, boolean] {\n const value = this.fromBytes(lazyContext.ledger.getBox(this.#app, this.key))\n return [value, lazyContext.ledger.boxExists(this.#app, this.key)]\n }\n\n splice(start: StubUint64Compat, length: StubUint64Compat, value: StubBytesCompat): void {\n const content = this.backingValue\n const startNumber = asNumber(start)\n const lengthNumber = asNumber(length)\n const valueBytes = asBytesCls(value)\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n if (startNumber > content.length) {\n throw new InternalError('Start index exceeds box size')\n }\n const end = Math.min(startNumber + lengthNumber, content.length)\n let updatedContent = concatUint8Arrays(content.slice(0, startNumber), valueBytes.asUint8Array(), content.slice(end))\n\n if (updatedContent.length > content.length) {\n updatedContent = updatedContent.slice(0, content.length)\n } else if (updatedContent.length < content.length) {\n updatedContent = concatUint8Arrays(updatedContent, new Uint8Array(content.length - updatedContent.length))\n }\n this.backingValue = updatedContent\n }\n\n replace(start: StubUint64Compat, value: StubBytesCompat): void {\n const content = this.backingValue\n const startNumber = asNumber(start)\n const valueBytes = asBytesCls(value)\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n if (startNumber + asNumber(valueBytes.length) > content.length) {\n throw new InternalError('Replacement content exceeds box size')\n }\n const updatedContent = concatUint8Arrays(\n content.slice(0, startNumber),\n valueBytes.asUint8Array(),\n content.slice(startNumber + valueBytes.length.asNumber()),\n )\n this.backingValue = updatedContent\n }\n\n extract(start: StubUint64Compat, length: StubUint64Compat): bytes {\n const content = this.backingValue\n const startNumber = asNumber(start)\n const lengthNumber = asNumber(length)\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n if (startNumber + lengthNumber > content.length) {\n throw new InternalError('Index out of bounds')\n }\n return toBytes(content.slice(startNumber, startNumber + lengthNumber))\n }\n\n resize(newSize: uint64): void {\n const newSizeNumber = asNumber(newSize)\n if (newSizeNumber > MAX_BOX_SIZE) {\n throw new InternalError(`Box size cannot exceed ${MAX_BOX_SIZE}`)\n }\n const content = this.backingValue\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n let updatedContent\n if (newSizeNumber > content.length) {\n updatedContent = concatUint8Arrays(content, new Uint8Array(newSizeNumber - content.length))\n } else {\n updatedContent = content.slice(0, newSize)\n }\n this.backingValue = updatedContent\n }\n\n private get backingValue(): Uint8Array {\n return lazyContext.ledger.getBox(this.#app, this.key)\n }\n\n private set backingValue(value: Uint8Array) {\n lazyContext.ledger.setBox(this.#app, this.key, value)\n }\n}\n\n/** @internal */\nexport class BoxMapCls<TKey, TValue> {\n private _keyPrefix: bytes | undefined\n #app: Application\n\n private readonly _type: string = BoxMapCls.name\n\n static [Symbol.hasInstance](x: unknown): x is BoxMapCls<unknown, unknown> {\n return x instanceof Object && '_type' in x && (x as { _type: string })['_type'] === BoxMapCls.name\n }\n\n constructor() {\n this.#app = lazyContext.activeApplication\n }\n\n get hasKeyPrefix(): boolean {\n return this._keyPrefix !== undefined && this._keyPrefix.length > 0\n }\n\n get keyPrefix(): bytes {\n if (this._keyPrefix === undefined || this._keyPrefix.length === 0) {\n throw new InternalError('Box key prefix is empty')\n }\n return this._keyPrefix\n }\n\n set keyPrefix(keyPrefix: StubBytesCompat) {\n this._keyPrefix = asBytes(keyPrefix)\n }\n\n call(key: TKey, proxy: (key: TKey) => BoxType<TValue>): BoxType<TValue> {\n const typeInfo = getGenericTypeInfo(proxy)\n const valueType = (typeInfo!.genericArgs! as TypeInfo[])[1]\n const box = new BoxCls<TValue>(this.getFullKey(key), this.#app, valueType)\n return box\n }\n\n private getFullKey(key: TKey): bytes {\n return this.keyPrefix.concat(toBytes(key))\n }\n}\n\n/** @internal */\nexport function Box<TValue>(options?: { key: bytes | string }): BoxType<TValue> {\n return new BoxCls<TValue>(options?.key)\n}\n\n/** @internal */\nexport function BoxMap<TKey, TValue>(options?: { keyPrefix: bytes | string }): BoxMapType<TKey, TValue> {\n const boxMap = new BoxMapCls<TKey, TValue>()\n if (options?.keyPrefix !== undefined) {\n boxMap.keyPrefix = options.keyPrefix\n }\n\n const x = (key: TKey): BoxType<TValue> => boxMap.call(key, x)\n return Object.setPrototypeOf(x, boxMap)\n}\n","import type { BaseContract as BaseContractType } from '@algorandfoundation/algorand-typescript'\nimport {\n OnCompleteAction,\n type Account,\n type Application,\n type Asset,\n type contract,\n type LocalState,\n} from '@algorandfoundation/algorand-typescript'\nimport type { ARC4Encoded, ResourceEncodingOptions } from '@algorandfoundation/algorand-typescript/arc4'\nimport type { AbiMetadata } from '../abi-metadata'\nimport { getArc4Selector, getContractAbiMetadata, getContractMethodAbiMetadata } from '../abi-metadata'\nimport { BytesMap } from '../collections/custom-key-map'\nimport { checkRoutingConditions } from '../context-helpers/context-util'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { CodeError } from '../errors'\nimport type { BaseContract } from '../impl/base-contract'\nimport { ContractOptionsSymbol } from '../impl/base-contract'\nimport type { Contract } from '../impl/contract'\nimport { getArc4Encoded, Uint, type TypeInfo } from '../impl/encoded-types'\nimport { Bytes } from '../impl/primitives'\nimport { AccountCls, ApplicationCls, AssetCls } from '../impl/reference'\nimport { BoxCls, BoxMapCls, GlobalStateCls } from '../impl/state'\nimport type { Transaction } from '../impl/transactions'\nimport {\n ApplicationCallTransaction,\n AssetConfigTransaction,\n AssetFreezeTransaction,\n AssetTransferTransaction,\n KeyRegistrationTransaction,\n PaymentTransaction,\n} from '../impl/transactions'\nimport { getGenericTypeInfo } from '../runtime-helpers'\nimport type { DeliberateAny, IConstructor } from '../typescript-helpers'\ntype ContractOptionsParameter = Parameters<typeof contract>[0]\n\ntype StateTotals = Pick<Application, 'globalNumBytes' | 'globalNumUint' | 'localNumBytes' | 'localNumUint'>\n\ninterface States {\n globalStates: BytesMap<GlobalStateCls<unknown>>\n localStates: BytesMap<LocalState<unknown>>\n totals: StateTotals\n}\n\nconst isUint64GenericType = (typeInfo: TypeInfo | undefined) => {\n if (!Array.isArray(typeInfo?.genericArgs) || !typeInfo?.genericArgs?.length) return false\n return typeInfo.genericArgs.some((t) => t.name.toLocaleLowerCase() === 'uint64')\n}\n\nconst extractStates = (contract: BaseContract, contractOptions: ContractOptionsParameter | undefined): States => {\n const stateTotals = { globalNumBytes: 0, globalNumUint: 0, localNumBytes: 0, localNumUint: 0 }\n const states = {\n globalStates: new BytesMap<GlobalStateCls<unknown>>(),\n localStates: new BytesMap<LocalState<unknown>>(),\n totals: stateTotals,\n }\n Object.entries(contract).forEach(([key, value]) => {\n const isLocalState = value instanceof Function && value.name === 'localStateInternal'\n const isGlobalState = value instanceof GlobalStateCls\n const isBox = value instanceof BoxCls\n const isBoxMap = value instanceof BoxMapCls\n if (isLocalState || isGlobalState || isBox) {\n // set key using property name if not already set\n if (!value.hasKey) value.key = Bytes(key)\n } else if (isBoxMap) {\n if (!value.hasKeyPrefix) value.keyPrefix = Bytes(key)\n }\n\n if (isLocalState || isGlobalState) {\n // capture state into the context\n if (isLocalState) states.localStates.set(value.key, value)\n else states.globalStates.set(value.key, value)\n\n // populate state totals\n const isUint64State = isUint64GenericType(getGenericTypeInfo(value)!)\n stateTotals.globalNumUint += isGlobalState && isUint64State ? 1 : 0\n stateTotals.globalNumBytes += isGlobalState && !isUint64State ? 1 : 0\n stateTotals.localNumUint += isLocalState && isUint64State ? 1 : 0\n stateTotals.localNumBytes += isLocalState && !isUint64State ? 1 : 0\n }\n })\n\n stateTotals.globalNumUint = contractOptions?.stateTotals?.globalUints ?? stateTotals.globalNumUint\n stateTotals.globalNumBytes = contractOptions?.stateTotals?.globalBytes ?? stateTotals.globalNumBytes\n stateTotals.localNumUint = contractOptions?.stateTotals?.localUints ?? stateTotals.localNumUint\n stateTotals.localNumBytes = contractOptions?.stateTotals?.localBytes ?? stateTotals.localNumBytes\n\n return states\n}\n\nconst getUint8 = (value: number) => new Uint({ name: 'Uint<8>', genericArgs: [{ name: '8' }] }, value)\n\n/**\n * @internal\n */\nexport const extractArraysFromArgs = (\n app: Application,\n methodSelector: Uint8Array,\n resourceEncoding: ResourceEncodingOptions | undefined,\n args: DeliberateAny[],\n) => {\n const transactions: Transaction[] = []\n const accounts: Account[] = [lazyContext.defaultSender]\n const apps: Application[] = [app]\n const assets: Asset[] = []\n let appArgs: ARC4Encoded[] = []\n\n for (const arg of args) {\n if (isTransaction(arg)) {\n transactions.push(arg)\n } else if (arg instanceof AccountCls) {\n if (resourceEncoding === 'index') {\n appArgs.push(getUint8(accounts.length))\n accounts.push(arg as Account)\n } else {\n appArgs.push(getArc4Encoded(arg.bytes))\n }\n } else if (arg instanceof ApplicationCls) {\n if (resourceEncoding === 'index') {\n appArgs.push(getUint8(apps.length))\n apps.push(arg as Application)\n } else {\n appArgs.push(getArc4Encoded(arg.id))\n }\n } else if (arg instanceof AssetCls) {\n if (resourceEncoding === 'index') {\n appArgs.push(getUint8(assets.length))\n assets.push(arg as Asset)\n } else {\n appArgs.push(getArc4Encoded(arg.id))\n }\n } else if (arg !== undefined) {\n appArgs.push(getArc4Encoded(arg))\n }\n }\n\n if (appArgs.length > 15) {\n const packed = getArc4Encoded(appArgs.slice(14))\n appArgs = [...appArgs.slice(0, 14), packed]\n }\n return {\n accounts,\n apps,\n assets,\n transactions,\n appArgs: [Bytes(methodSelector), ...appArgs.filter((a) => a !== undefined).map((a) => a.bytes)],\n }\n}\n\nfunction isTransaction(obj: unknown): obj is Transaction {\n return (\n obj instanceof PaymentTransaction ||\n obj instanceof KeyRegistrationTransaction ||\n obj instanceof AssetConfigTransaction ||\n obj instanceof AssetTransferTransaction ||\n obj instanceof AssetFreezeTransaction ||\n obj instanceof ApplicationCallTransaction\n )\n}\n\n/**\n * Provides a context for creating contracts and registering created contract instances\n * with test execution context.\n */\nexport class ContractContext {\n /**\n * Creates a new contract instance and register the created instance with test execution context.\n *\n * @template T Type of contract extending BaseContract\n * @param {IConstructor<T>} type The contract class constructor\n * @param {...any[]} args Constructor arguments for the contract\n * @returns {T} Proxied instance of the contract\n * @example\n * const ctx = new TestExecutionContext();\n * const contract = ctx.contract.create(MyContract);\n */\n create<T extends BaseContractType>(type: IConstructor<T>, ...args: DeliberateAny[]): T {\n const proxy = new Proxy(type, this.getContractProxyHandler<T>(this.isArc4(type)))\n return new proxy(...args)\n }\n\n /**\n * Creates an array of transactions for calling a contract method.\n *\n * @internal\n * @template TParams Array of parameter types\n * @param {BaseContract} contract The contract instance\n * @param {AbiMetadata | undefined} abiMetadata ABI metadata for the method\n * @param {...TParams} args Method arguments\n * @returns {Transaction[]} Array of transactions needed to execute the method\n * @example\n * const txns = ContractContext.createMethodCallTxns(\n * myContract,\n * methodAbiMetadata,\n * arg1,\n * arg2\n * );\n */\n static createMethodCallTxns<TParams extends unknown[]>(\n contract: BaseContract,\n abiMetadata: AbiMetadata | undefined,\n ...args: TParams\n ): Transaction[] {\n const app = lazyContext.ledger.getApplicationForContract(contract)\n const methodSelector = abiMetadata ? getArc4Selector(abiMetadata) : new Uint8Array()\n const { transactions, ...appCallArgs } = extractArraysFromArgs(app, methodSelector, abiMetadata?.resourceEncoding, args)\n const appTxn = lazyContext.any.txn.applicationCall({\n appId: app,\n ...appCallArgs,\n // TODO: This needs to be specifiable by the test code\n onCompletion: OnCompleteAction[(abiMetadata?.allowActions ?? [])[0]],\n })\n const txns = [...(transactions ?? []), appTxn]\n return txns\n }\n\n /**\n * @internal\n */\n private isArc4<T extends BaseContract>(type: IConstructor<T>): boolean {\n const result = (type as DeliberateAny as typeof BaseContract).isArc4\n if (result !== undefined && result !== null) {\n return result\n }\n\n throw new CodeError('Cannot create a contract for class as it does not extend Contract or BaseContract')\n }\n\n /**\n * @internal\n */\n private getContractProxyHandler<T extends BaseContract>(isArc4: boolean): ProxyHandler<IConstructor<T>> {\n const onConstructed = (application: Application, instance: T, conrtactOptions: ContractOptionsParameter | undefined) => {\n const states = extractStates(instance, conrtactOptions)\n\n const applicationData = lazyContext.ledger.applicationDataMap.getOrFail(application.id)\n applicationData.application = {\n ...applicationData.application,\n globalStates: states.globalStates,\n localStates: states.localStates,\n ...states.totals,\n }\n lazyContext.ledger.addAppIdContractMap(application.id, instance)\n }\n return {\n construct(target, args) {\n let t: T | undefined = undefined\n const application = lazyContext.any.application({\n creator: lazyContext.hasActiveGroup ? lazyContext.activeGroup.activeTransaction.sender : lazyContext.defaultSender,\n })\n const txn = lazyContext.any.txn.applicationCall({ appId: application })\n const appData = lazyContext.ledger.applicationDataMap.getOrFail(application.id)\n appData.isCreating = true\n lazyContext.txn.ensureScope([txn]).execute(() => {\n t = new target(...args)\n })\n appData.isCreating = isArc4 && hasCreateMethods(t! as Contract)\n const instance = new Proxy(t!, {\n get(target, prop, receiver) {\n const orig = Reflect.get(target, prop, receiver)\n const abiMetadata =\n isArc4 && typeof orig === 'function' ? getContractMethodAbiMetadata(target as Contract, orig.name) : undefined\n const isProgramMethod = prop === 'approvalProgram' || prop === 'clearStateProgram'\n const isAbiMethod = isArc4 && abiMetadata\n if (isAbiMethod || isProgramMethod) {\n return (...args: DeliberateAny[]): DeliberateAny => {\n const txns = ContractContext.createMethodCallTxns(receiver, abiMetadata, ...args)\n return lazyContext.txn.ensureScope(txns).execute(() => {\n if (isAbiMethod) {\n checkRoutingConditions(application.id, abiMetadata)\n }\n const returnValue = (orig as DeliberateAny).apply(target, args)\n if (!isProgramMethod && isAbiMethod && returnValue !== undefined) {\n ;(txns.at(-1) as ApplicationCallTransaction).logArc4ReturnValue(returnValue)\n }\n appData.isCreating = false\n return returnValue\n })\n }\n }\n return orig\n },\n })\n\n onConstructed(application, instance, getContractOptions(t!))\n\n return instance\n },\n }\n }\n}\n\nconst getContractOptions = (contract: BaseContract): ContractOptionsParameter | undefined => {\n const contractClass = contract.constructor as DeliberateAny\n return contractClass[ContractOptionsSymbol] as ContractOptionsParameter\n}\n\nconst hasCreateMethods = (contract: Contract) => {\n const createFn = Reflect.get(contract, 'createApplication')\n if (createFn !== undefined && typeof createFn === 'function') return true\n\n const metadatas = getContractAbiMetadata(contract)\n return Object.values(metadatas).some((metadata) => (metadata.onCreate ?? 'disallow') !== 'disallow')\n}\n","import type {\n Account as AccountType,\n Application as ApplicationType,\n Asset as AssetType,\n bytes,\n BytesCompat,\n itxn,\n} from '@algorandfoundation/algorand-typescript'\nimport { TransactionType } from '@algorandfoundation/algorand-typescript'\nimport type {\n BareCreateApplicationCallFields,\n ResourceEncodingOptions,\n TypedApplicationCallFields,\n} from '@algorandfoundation/algorand-typescript/arc4'\nimport { ABI_RETURN_VALUE_LOG_PREFIX } from '../constants'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { InternalError, invariant } from '../errors'\nimport { extractArraysFromArgs } from '../subcontexts/contract-context'\nimport type { DeliberateAny } from '../typescript-helpers'\nimport { asBytes, asNumber, asUint64, asUint8Array } from '../util'\nimport { getApp } from './app-params'\nimport { getAsset } from './asset-params'\nimport { encodeArc4 } from './encoded-types'\nimport type { InnerTxn, InnerTxnFields } from './itxn'\nimport { Uint64Cls } from './primitives'\nimport { Account, asAccount, asApplication, asAsset } from './reference'\nimport type { Transaction } from './transactions'\nimport {\n ApplicationCallTransaction,\n AssetConfigTransaction,\n AssetFreezeTransaction,\n AssetTransferTransaction,\n KeyRegistrationTransaction,\n PaymentTransaction,\n} from './transactions'\n\nconst mapCommonFields = <T extends InnerTxnFields>(\n fields: T,\n): Omit<T, 'sender' | 'note' | 'rekeyTo'> & { sender?: AccountType; note?: bytes; rekeyTo?: AccountType } => {\n const { sender, note, rekeyTo, ...rest } = fields\n\n return {\n sender: asAccount(sender),\n note: note !== undefined ? asBytes(note) : undefined,\n rekeyTo: asAccount(rekeyTo),\n ...rest,\n }\n}\n\nexport class PaymentInnerTxn extends PaymentTransaction implements itxn.PaymentInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: itxn.PaymentFields) {\n return new PaymentInnerTxn(fields)\n }\n\n /** @internal */\n constructor(fields: itxn.PaymentFields) {\n super({\n ...mapCommonFields(fields),\n receiver: asAccount(fields.receiver),\n closeRemainderTo: asAccount(fields.closeRemainderTo),\n })\n }\n}\n\nexport class KeyRegistrationInnerTxn extends KeyRegistrationTransaction implements itxn.KeyRegistrationInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: itxn.KeyRegistrationFields) {\n return new KeyRegistrationInnerTxn(fields)\n }\n\n /** @internal */\n constructor(fields: itxn.KeyRegistrationFields) {\n super(mapCommonFields(fields))\n }\n}\n\nexport class AssetConfigInnerTxn extends AssetConfigTransaction implements itxn.AssetConfigInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: itxn.AssetConfigFields) {\n return new AssetConfigInnerTxn(fields)\n }\n\n /** @internal */\n constructor(fields: itxn.AssetConfigFields) {\n const { assetName, unitName, url, manager, reserve, freeze, clawback, configAsset, ...rest } = mapCommonFields(fields)\n const createdAsset =\n !configAsset || !asNumber(asAsset(configAsset)!.id)\n ? lazyContext.any.asset({\n name: typeof assetName === 'string' ? asBytes(assetName) : assetName,\n unitName: typeof unitName === 'string' ? asBytes(unitName) : unitName,\n url: typeof url === 'string' ? asBytes(url) : url,\n manager: asAccount(manager),\n reserve: asAccount(reserve),\n freeze: asAccount(freeze),\n clawback: asAccount(clawback),\n ...rest,\n })\n : undefined\n\n super({\n assetName: typeof assetName === 'string' ? asBytes(assetName) : assetName,\n unitName: typeof unitName === 'string' ? asBytes(unitName) : unitName,\n url: typeof url === 'string' ? asBytes(url) : url,\n manager: asAccount(manager),\n reserve: asAccount(reserve),\n freeze: asAccount(freeze),\n clawback: asAccount(clawback),\n configAsset: asAsset(configAsset),\n ...rest,\n createdAsset: createdAsset,\n })\n }\n}\n\nexport class AssetTransferInnerTxn extends AssetTransferTransaction implements itxn.AssetTransferInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: Partial<itxn.AssetTransferFields>) {\n if (fields.xferAsset === undefined) {\n throw new Error('xferAsset is required')\n }\n return new AssetTransferInnerTxn(fields as itxn.AssetTransferFields)\n }\n\n /** @internal */\n constructor(fields: itxn.AssetTransferFields) {\n super({\n ...mapCommonFields(fields),\n assetSender: asAccount(fields.assetSender),\n assetReceiver: asAccount(fields.assetReceiver),\n assetCloseTo: asAccount(fields.assetCloseTo),\n xferAsset: asAsset(fields.xferAsset),\n })\n }\n}\n\nexport class AssetFreezeInnerTxn extends AssetFreezeTransaction implements itxn.AssetFreezeInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: Partial<itxn.AssetFreezeFields>) {\n if (fields.freezeAsset === undefined) {\n throw new Error('freezeAsset is required')\n }\n return new AssetFreezeInnerTxn(fields as itxn.AssetFreezeFields)\n }\n\n /** @internal */\n constructor(fields: itxn.AssetFreezeFields) {\n const { freezeAsset, freezeAccount, ...rest } = mapCommonFields(fields)\n const asset: AssetType | undefined = freezeAsset instanceof Uint64Cls ? getAsset(freezeAsset) : (freezeAsset as AssetType)\n const account: AccountType | undefined =\n typeof freezeAccount === 'string' ? Account(asBytes(freezeAccount)) : (freezeAccount as AccountType)\n super({\n freezeAsset: asset,\n freezeAccount: account,\n ...rest,\n })\n }\n}\n\n/** @internal */\nexport type ApplicationCallFields = itxn.ApplicationCallFields & {\n createdApp?: ApplicationType\n appLogs?: Array<bytes>\n}\n\nexport class ApplicationCallInnerTxn extends ApplicationCallTransaction implements itxn.ApplicationCallInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: Partial<ApplicationCallFields>) {\n return new ApplicationCallInnerTxn(fields)\n }\n\n /** @internal */\n constructor(fields: Partial<ApplicationCallFields>) {\n const { appId, approvalProgram, clearStateProgram, onCompletion, appArgs, accounts, assets, apps, ...rest } = mapCommonFields(fields)\n super({\n appId: appId instanceof Uint64Cls ? getApp(appId) : (appId as ApplicationType),\n onCompletion,\n approvalProgram: Array.isArray(approvalProgram) ? undefined : (approvalProgram as bytes),\n approvalProgramPages: Array.isArray(approvalProgram) ? approvalProgram : undefined,\n clearStateProgram: Array.isArray(clearStateProgram) ? undefined : (clearStateProgram as bytes),\n clearStateProgramPages: Array.isArray(clearStateProgram) ? clearStateProgram : undefined,\n appArgs: appArgs?.map((x) => x),\n accounts: accounts?.map((x) => asAccount(x)!),\n assets: assets?.map((x) => asAsset(x)!),\n apps: apps?.map((x) => asApplication(x)!),\n appLogs: fields.appLogs,\n createdApp: fields.createdApp,\n ...rest,\n })\n }\n}\n\n/** @internal */\nexport const createInnerTxn = <TFields extends InnerTxnFields>(fields: TFields) => {\n switch (fields.type) {\n case TransactionType.Payment:\n return new PaymentInnerTxn(fields)\n case TransactionType.AssetConfig:\n return new AssetConfigInnerTxn(fields)\n case TransactionType.AssetTransfer:\n return new AssetTransferInnerTxn(fields)\n case TransactionType.AssetFreeze:\n return new AssetFreezeInnerTxn(fields)\n case TransactionType.ApplicationCall:\n return new ApplicationCallInnerTxn(fields)\n case TransactionType.KeyRegistration:\n return new KeyRegistrationInnerTxn(fields)\n default:\n throw new InternalError(`Invalid inner transaction type: ${fields.type}`)\n }\n}\n\n/** @internal */\nexport function submitGroup<TFields extends [...itxn.ItxnParams[]]>(...transactionFields: TFields): itxn.TxnFor<TFields> {\n return transactionFields.map((f: (typeof transactionFields)[number]) => f.submit()) as itxn.TxnFor<TFields>\n}\n/** @internal */\nexport function payment(fields: itxn.PaymentFields): itxn.PaymentItxnParams {\n return new ItxnParams<itxn.PaymentFields, itxn.PaymentInnerTxn>(fields, TransactionType.Payment)\n}\n/** @internal */\nexport function keyRegistration(fields: itxn.KeyRegistrationFields): itxn.KeyRegistrationItxnParams {\n return new ItxnParams<itxn.KeyRegistrationFields, itxn.KeyRegistrationInnerTxn>(fields, TransactionType.KeyRegistration)\n}\n/** @internal */\nexport function assetConfig(fields: itxn.AssetConfigFields): itxn.AssetConfigItxnParams {\n return new ItxnParams<itxn.AssetConfigFields, itxn.AssetConfigInnerTxn>(fields, TransactionType.AssetConfig)\n}\n/** @internal */\nexport function assetTransfer(fields: itxn.AssetTransferFields): itxn.AssetTransferItxnParams {\n return new ItxnParams<itxn.AssetTransferFields, itxn.AssetTransferInnerTxn>(fields, TransactionType.AssetTransfer)\n}\n/** @internal */\nexport function assetFreeze(fields: itxn.AssetFreezeFields): itxn.AssetFreezeItxnParams {\n return new ItxnParams<itxn.AssetFreezeFields, itxn.AssetFreezeInnerTxn>(fields, TransactionType.AssetFreeze)\n}\n/** @internal */\nexport function applicationCall(fields: itxn.ApplicationCallFields): itxn.ApplicationCallItxnParams {\n return new ItxnParams<itxn.ApplicationCallFields, itxn.ApplicationCallInnerTxn>(fields, TransactionType.ApplicationCall)\n}\n\n/** @internal */\nexport class ItxnParams<TFields extends InnerTxnFields, TTransaction extends InnerTxn> {\n #fields: TFields & { type: TransactionType }\n constructor(fields: TFields, type: TransactionType) {\n this.#fields = { ...fields, type }\n }\n\n private isApplicationCall(): boolean {\n return this.#fields.type === TransactionType.ApplicationCall\n }\n\n createInnerTxns(): TTransaction[] {\n let itxnContext: ApplicationCallInnerTxnContext | undefined\n if (this.isApplicationCall()) {\n itxnContext = ApplicationCallInnerTxnContext.createFromFields(this.#fields)\n }\n const innerTxns = [\n ...(itxnContext?.itxns ?? []),\n itxnContext ?? createInnerTxn<InnerTxnFields>(this.#fields),\n ] as unknown as TTransaction[]\n return innerTxns\n }\n\n submit(): TTransaction {\n const innerTxns = this.createInnerTxns()\n innerTxns.forEach((itxn, index) => Object.assign(itxn, { groupIndex: asUint64(index) }))\n const lastInnerTxn = innerTxns.at(-1)\n if (lastInnerTxn instanceof ApplicationCallInnerTxnContext) {\n lazyContext.value.notifyApplicationSpies(lastInnerTxn)\n }\n lazyContext.txn.activeGroup.addInnerTransactionGroup(...innerTxns)\n return lastInnerTxn as TTransaction\n }\n\n set(p: Partial<TFields>) {\n Object.assign(this.#fields, p)\n }\n\n copy() {\n return new ItxnParams<TFields, TTransaction>(this.#fields, this.#fields.type)\n }\n}\n\n/** @internal */\nconst UNSET = Symbol('UNSET_SYMBOL')\n/**\n * The ApplicationCallInnerTxnContext class is a specialized version of the ApplicationCallInnerTxn class.\n * It is used to handle the context of an application call transaction, including managing the return value.\n */\nexport class ApplicationCallInnerTxnContext<TReturn = unknown> extends ApplicationCallInnerTxn {\n /** @internal */\n static createFromFields(fields: ApplicationCallFields) {\n return new ApplicationCallInnerTxnContext(fields)\n }\n /** @internal */\n static createFromTypedApplicationCallFields<TReturn = unknown>(\n methodArgs: TypedApplicationCallFields<DeliberateAny>,\n methodSelector: bytes,\n resourceEncoding: ResourceEncodingOptions | undefined,\n ) {\n const app =\n (methodArgs.appId instanceof Uint64Cls ? getApp(methodArgs.appId) : (methodArgs.appId as ApplicationType | undefined)) ??\n lazyContext.any.application()\n const args = (methodArgs.args ?? []).map((x: DeliberateAny) => (x instanceof ItxnParams ? x.submit() : x))\n const { transactions, ...appCallArgs } = extractArraysFromArgs(app, asUint8Array(methodSelector), resourceEncoding, args)\n const { args: _, ...methodArgsFields } = methodArgs\n const fields = {\n ...methodArgsFields,\n ...appCallArgs,\n }\n return new ApplicationCallInnerTxnContext<TReturn>(fields, transactions)\n }\n /** @internal */\n static createFromBareCreateApplicationCallFields(methodArgs: BareCreateApplicationCallFields) {\n return new ApplicationCallInnerTxnContext(methodArgs)\n }\n\n #returnValue: TReturn | typeof UNSET = UNSET\n /**\n * Sets the return value for the application call.\n * @param value\n * @returns\n */\n setReturnValue(value: TReturn) {\n // Ignore undefined (void) values\n if (value === undefined) return\n this.appendLog(ABI_RETURN_VALUE_LOG_PREFIX.concat(encodeArc4(undefined, value)))\n this.#returnValue = value\n }\n /** @internal */\n get loggedReturnValue(): TReturn {\n return this.#returnValue === UNSET ? (undefined as TReturn) : this.#returnValue\n }\n\n override appendLog(value: BytesCompat) {\n /*\n As per https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0004.md#implementing-a-method\n If the method is non-void, the Application MUST encode the return value as described in the Encoding section and then log it with the\n prefix 151f7c75. Other values MAY be logged before the return value, but other values MUST NOT be logged after the return value.\n */\n invariant(this.#returnValue === UNSET, 'Cannot add logs after a return value has been set')\n super.appendLog(value)\n }\n\n /** @internal */\n private constructor(\n fields: ApplicationCallFields,\n public itxns?: Transaction[],\n ) {\n super(fields)\n }\n}\n"],"names":[],"mappings":";;;;;;;AASA;;;;;;;;;;;;AAYG;AACI,MAAM,cAAc,GAAG,CAA6B,EACzD,MAAM,EACN,QAAQ,GAIT,KAAW;IACV,MAAM,iBAAiB,GAAG,OAAO,MAAM,KAAK,QAAQ,IAAI,QAAQ,KAAK,SAAS;AAC9E,IAAA,MAAM,oBAAoB,GAAG,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,QAAQ,IAAI,MAAM;IAC7G,MAAM,sBAAsB,GAAG,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,IAAI,MAAM;;IAGjF,IAAI,iBAAiB,EAAE;QACrB,MAAM,cAAc,GAAG,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,MAAgB,CAAC,CAAC;QAC7E,OAAO,UAAU,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/C;;IAGA,IAAI,oBAAoB,EAAE;AACxB,QAAA,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC;QAE5E,MAAM,WAAW,GAAG,4BAA4B,CAAC,kBAAkB,EAAE,MAAM,CAAC;AAC5E,QAAA,OAAO,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IAC5C;;IAGA,IAAI,sBAAsB,EAAE;AAC1B,QAAA,MAAM,UAAU,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC,IAAI;QAEpE,MAAM,WAAW,GAAG,4BAA4B,CAAC,QAAQ,EAAE,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;;"}
package/internal/arc4.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from '@algorandfoundation/algorand-typescript/arc4';
2
- export { b as abiCall, c as compileArc4 } from '../arc4-Uo4nu8mW.js';
2
+ export { b as abiCall, c as compileArc4 } from '../arc4-BazlZFRK.js';
3
3
  export { C as Contract, c as abimethod, d as baremethod, r as readonly } from '../runtime-helpers-Dpv9_KsV.js';
4
- export { m as methodSelector } from '../inner-transactions-DIR405zr.js';
4
+ export { m as methodSelector } from '../inner-transactions-pcawvv6H.js';
5
5
  export { A as Address, B as Bool, c as Byte, d as DynamicArray, D as DynamicBytes, F as FixedArray, R as ReferenceArray, e as StaticArray, f as StaticBytes, S as Str, h as Struct, T as Tuple, i as UFixed, U as Uint, j as convertBytes, k as decodeArc4, l as encodeArc4 } from '../asset-params-DV6t5Cy8.js';
6
6
  export { a0 as sizeOf } from '../utils-DyUEnpf6.js';
7
7
  import '@algorandfoundation/algorand-typescript';
@@ -8,12 +8,12 @@ export { C as Contract, c as abimethod, d as baremethod, r as readonly } from '.
8
8
  import { C as CodeError } from '../typescript-helpers-sobuICoc.js';
9
9
  export { a as Global } from '../pure-21u9pLrI.js';
10
10
  import { ARC4Encoded } from '@algorandfoundation/algorand-typescript/arc4';
11
- import { g as applicationCall, h as assetFreeze, i as assetTransfer, j as assetConfig, k as keyRegistration, p as payment, s as submitGroup } from '../inner-transactions-DIR405zr.js';
12
- export { B as Box, l as BoxMap, n as GlobalState, o as LocalState } from '../inner-transactions-DIR405zr.js';
11
+ import { g as applicationCall, h as assetFreeze, i as assetTransfer, j as assetConfig, k as keyRegistration, p as payment, s as submitGroup } from '../inner-transactions-pcawvv6H.js';
12
+ export { B as Box, l as BoxMap, n as GlobalState, o as LocalState } from '../inner-transactions-pcawvv6H.js';
13
13
  import { A as ApplicationCallTxn, a as AssetFreezeTxn, b as AssetTransferTxn, c as AssetConfigTxn, K as KeyRegistrationTxn, P as PaymentTxn, T as Transaction } from '../op-YL6H7DYI.js';
14
14
  export { d as Txn, o as op } from '../op-YL6H7DYI.js';
15
- import { g as getApplicationCallInnerTxnContext } from '../arc4-Uo4nu8mW.js';
16
- export { a as arc4 } from '../arc4-Uo4nu8mW.js';
15
+ import { g as getApplicationCallInnerTxnContext } from '../arc4-BazlZFRK.js';
16
+ export { a as arc4 } from '../arc4-BazlZFRK.js';
17
17
  import '@algorandfoundation/puya-ts';
18
18
  import 'js-sha512';
19
19
  import 'crypto';
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "**"
5
5
  ],
6
6
  "name": "@algorandfoundation/algorand-typescript-testing",
7
- "version": "1.1.1-beta.1",
7
+ "version": "1.1.1-beta.2",
8
8
  "description": "A library which allows you to execute Algorand TypeScript code locally under a test context either emulating or mocking AVM behaviour.",
9
9
  "private": false,
10
10
  "dependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"inner-transactions-DIR405zr.js","sources":["../src/impl/method-selector.ts","../src/impl/transactions.ts","../src/context-helpers/context-util.ts","../src/impl/state.ts","../src/subcontexts/contract-context.ts","../src/impl/inner-transactions.ts"],"sourcesContent":["import type { bytes } from '@algorandfoundation/algorand-typescript'\nimport { encodingUtil } from '@algorandfoundation/puya-ts'\nimport { getArc4Selector, getContractMethod, getContractMethodAbiMetadata } from '../abi-metadata'\nimport { CodeError } from '../errors'\nimport type { InstanceMethod } from '../typescript-helpers'\nimport type { Contract } from './contract'\nimport { sha512_256 } from './crypto'\nimport { Bytes } from './primitives'\n\n/**\n * Computes the method selector for an ARC-4 contract method.\n *\n * Supports three invocation patterns:\n * 1. `methodSelector('sink(string,uint8[])void')`:\n * Direct method signature string (no contract): Returns SHA-512/256 hash of signature\n * 2. `methodSelector<typeof SignaturesContract.prototype.sink>()`:\n * Contract name as string + method name as string: Looks up registered contract and returns ARC-4 selector\n * 3. `methodSelector(SignaturesContract.prototype.sink)`:\n * Contract class/instance + method instance/name: Returns ARC-4 selector from ABI metadata\n *\n * @internal\n */\nexport const methodSelector = <TContract extends Contract>({\n method,\n contract,\n}: {\n method?: string | InstanceMethod<Contract>\n contract?: string | TContract | { new (): TContract }\n}): bytes => {\n const isDirectSignature = typeof method === 'string' && contract === undefined\n const isContractNameLookup = typeof contract === 'string' && typeof method === 'string' && contract && method\n const isContractMethodLookup = typeof contract !== 'string' && contract && method\n\n // Pattern 1: Direct method signature string (e.g., \"add(uint64,uint64)uint64\")\n if (isDirectSignature) {\n const signatureBytes = Bytes(encodingUtil.utf8ToUint8Array(method as string))\n return sha512_256(signatureBytes).slice(0, 4)\n }\n\n // Pattern 2: Contract name as string with method name\n if (isContractNameLookup) {\n const { contract: registeredContract } = getContractMethod(contract, method)\n\n const abiMetadata = getContractMethodAbiMetadata(registeredContract, method)\n return Bytes(getArc4Selector(abiMetadata))\n }\n\n // Pattern 3: Contract class/instance with method signature or name\n if (isContractMethodLookup) {\n const methodName = typeof method === 'string' ? method : method.name\n\n const abiMetadata = getContractMethodAbiMetadata(contract, methodName)\n return Bytes(getArc4Selector(abiMetadata))\n }\n\n throw new CodeError('Invalid arguments to methodSelector')\n}\n","import type {\n Account as AccountType,\n Application as ApplicationType,\n Asset as AssetType,\n bytes,\n BytesCompat,\n gtxn,\n uint64,\n Uint64Compat,\n} from '@algorandfoundation/algorand-typescript'\nimport { OnCompleteAction, TransactionType } from '@algorandfoundation/algorand-typescript'\nimport { ABI_RETURN_VALUE_LOG_PREFIX, MAX_ITEMS_IN_LOG } from '../constants'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { InternalError } from '../errors'\nimport type { Mutable, ObjectKeys } from '../typescript-helpers'\nimport { asBytes, asMaybeBytesCls, asMaybeUint64Cls, asNumber, asUint64Cls, combineIntoMaxBytePages, getRandomBytes } from '../util'\nimport { toBytes } from './encoded-types'\nimport { Bytes, Uint64, type StubBytesCompat } from './primitives'\nimport { Account, Application, Asset } from './reference'\n\n/** @internal */\nconst baseDefaultFields = () => ({\n sender: lazyContext.defaultSender,\n fee: Uint64(0),\n firstValid: Uint64(0),\n firstValidTime: Uint64(0),\n lastValid: Uint64(0),\n note: Bytes(),\n lease: Bytes() as bytes<32>,\n groupIndex: Uint64(0),\n txnId: getRandomBytes(32).asAlgoTs().toFixed({ length: 32 }),\n rekeyTo: Account(),\n})\n\nexport type TxnFields<TTxn> = Partial<Mutable<Pick<TTxn, ObjectKeys<TTxn>>>>\n\nabstract class TransactionBase {\n /** @internal */\n protected constructor(fields: Partial<ReturnType<typeof baseDefaultFields>>) {\n const baseDefaults = baseDefaultFields()\n this.sender = fields.sender ?? baseDefaults.sender\n this.fee = fields.fee ?? baseDefaults.fee\n this.firstValid = fields.firstValid ?? baseDefaults.firstValid\n this.firstValidTime = fields.firstValidTime ?? baseDefaults.firstValidTime\n this.lastValid = fields.lastValid ?? baseDefaults.lastValid\n this.note = fields.note ?? baseDefaults.note\n this.lease = fields.lease ?? baseDefaults.lease\n this.groupIndex = fields.groupIndex ?? baseDefaults.groupIndex\n this.txnId = fields.txnId ?? baseDefaults.txnId\n this.rekeyTo = fields.rekeyTo ?? baseDefaults.rekeyTo\n this.scratchSpace = Array(256).fill(Uint64(0))\n }\n\n readonly sender: AccountType\n readonly fee: uint64\n readonly firstValid: uint64\n readonly firstValidTime: uint64\n readonly lastValid: uint64\n readonly note: bytes\n readonly lease: bytes<32>\n readonly groupIndex: uint64\n readonly txnId: bytes<32>\n readonly rekeyTo: AccountType\n readonly scratchSpace: Array<bytes | uint64>\n\n setScratchSlot(index: Uint64Compat, value: BytesCompat | Uint64Compat): void {\n const i = asNumber(index)\n if (i >= this.scratchSpace.length) {\n throw new InternalError('invalid scratch slot')\n }\n const bytesValue = asMaybeBytesCls(value)\n const uint64Value = asMaybeUint64Cls(value)\n this.scratchSpace[i] = bytesValue?.asAlgoTs() ?? uint64Value?.asAlgoTs() ?? Uint64(0)\n }\n\n getScratchSlot(index: Uint64Compat): bytes | uint64 {\n const i = asNumber(index)\n if (i >= this.scratchSpace.length) {\n throw new InternalError('invalid scratch slot')\n }\n return this.scratchSpace[i]\n }\n}\n\nexport class PaymentTransaction extends TransactionBase implements gtxn.PaymentTxn {\n /** @internal */\n static create(fields: TxnFields<gtxn.PaymentTxn>) {\n return new PaymentTransaction(fields)\n }\n\n /** @internal */\n protected constructor(fields: TxnFields<gtxn.PaymentTxn>) {\n super(fields)\n this.receiver = fields.receiver ?? Account()\n this.amount = fields.amount ?? Uint64(0)\n this.closeRemainderTo = fields.closeRemainderTo ?? Account()\n }\n\n readonly receiver: AccountType\n readonly amount: uint64\n readonly closeRemainderTo: AccountType\n readonly type: TransactionType.Payment = TransactionType.Payment\n readonly typeBytes: bytes = asUint64Cls(TransactionType.Payment).toBytes().asAlgoTs()\n}\n\nexport class KeyRegistrationTransaction extends TransactionBase implements gtxn.KeyRegistrationTxn {\n /** @internal */\n static create(fields: TxnFields<gtxn.KeyRegistrationTxn>) {\n return new KeyRegistrationTransaction(fields)\n }\n\n /** @internal */\n protected constructor(fields: TxnFields<gtxn.KeyRegistrationTxn>) {\n super(fields)\n this.voteKey = fields.voteKey ?? (Bytes() as bytes<32>)\n this.selectionKey = fields.selectionKey ?? (Bytes() as bytes<32>)\n this.voteFirst = fields.voteFirst ?? Uint64(0)\n this.voteLast = fields.voteLast ?? Uint64(0)\n this.voteKeyDilution = fields.voteKeyDilution ?? Uint64(0)\n this.nonparticipation = fields.nonparticipation ?? false\n this.stateProofKey = fields.stateProofKey ?? (Bytes() as bytes<64>)\n const globalData = lazyContext.ledger.globalData\n if (this.fee >= globalData.payoutsGoOnlineFee && globalData.payoutsEnabled) {\n lazyContext.ledger.patchAccountData(this.sender, {\n incentiveEligible: true,\n })\n }\n }\n\n readonly voteKey: bytes<32>\n readonly selectionKey: bytes<32>\n readonly voteFirst: uint64\n readonly voteLast: uint64\n readonly voteKeyDilution: uint64\n readonly nonparticipation: boolean\n readonly stateProofKey: bytes<64>\n readonly type: TransactionType.KeyRegistration = TransactionType.KeyRegistration\n readonly typeBytes: bytes = asUint64Cls(TransactionType.KeyRegistration).toBytes().asAlgoTs()\n}\n\nexport class AssetConfigTransaction extends TransactionBase implements gtxn.AssetConfigTxn {\n /** @internal */\n static create(fields: TxnFields<gtxn.AssetConfigTxn>) {\n return new AssetConfigTransaction(fields)\n }\n\n /** @internal */\n protected constructor(fields: TxnFields<gtxn.AssetConfigTxn>) {\n super(fields)\n this.configAsset = fields.configAsset ?? Asset()\n this.total = fields.total ?? Uint64(0)\n this.decimals = fields.decimals ?? Uint64(0)\n this.defaultFrozen = fields.defaultFrozen ?? false\n this.unitName = fields.unitName ?? Bytes()\n this.assetName = fields.assetName ?? Bytes()\n this.url = fields.url ?? Bytes()\n this.metadataHash = fields.metadataHash ?? (Bytes() as bytes<32>)\n this.manager = fields.manager ?? Account()\n this.reserve = fields.reserve ?? Account()\n this.freeze = fields.freeze ?? Account()\n this.clawback = fields.clawback ?? Account()\n this.createdAsset = fields.createdAsset ?? Asset()\n }\n\n readonly configAsset: AssetType\n readonly total: uint64\n readonly decimals: uint64\n readonly defaultFrozen: boolean\n readonly unitName: bytes\n readonly assetName: bytes\n readonly url: bytes\n readonly metadataHash: bytes<32>\n readonly manager: AccountType\n readonly reserve: AccountType\n readonly freeze: AccountType\n readonly clawback: AccountType\n readonly createdAsset: AssetType\n readonly type: TransactionType.AssetConfig = TransactionType.AssetConfig\n readonly typeBytes: bytes = asUint64Cls(TransactionType.AssetConfig).toBytes().asAlgoTs()\n}\n\nexport class AssetTransferTransaction extends TransactionBase implements gtxn.AssetTransferTxn {\n /** @internal */\n static create(fields: TxnFields<gtxn.AssetTransferTxn>) {\n return new AssetTransferTransaction(fields)\n }\n\n /** @internal */\n protected constructor(fields: TxnFields<gtxn.AssetTransferTxn>) {\n super(fields)\n this.xferAsset = fields.xferAsset ?? Asset()\n this.assetAmount = fields.assetAmount ?? Uint64(0)\n this.assetSender = fields.assetSender ?? Account()\n this.assetReceiver = fields.assetReceiver ?? Account()\n this.assetCloseTo = fields.assetCloseTo ?? Account()\n }\n\n readonly xferAsset: AssetType\n readonly assetAmount: uint64\n readonly assetSender: AccountType\n readonly assetReceiver: AccountType\n readonly assetCloseTo: AccountType\n\n readonly type: TransactionType.AssetTransfer = TransactionType.AssetTransfer\n readonly typeBytes: bytes = asUint64Cls(TransactionType.AssetTransfer).toBytes().asAlgoTs()\n}\n\nexport class AssetFreezeTransaction extends TransactionBase implements gtxn.AssetFreezeTxn {\n /** @internal */\n static create(fields: TxnFields<gtxn.AssetFreezeTxn>) {\n return new AssetFreezeTransaction(fields)\n }\n\n /** @internal */\n protected constructor(fields: TxnFields<gtxn.AssetFreezeTxn>) {\n super(fields)\n this.freezeAsset = fields.freezeAsset ?? Asset()\n this.freezeAccount = fields.freezeAccount ?? Account()\n this.frozen = fields.frozen ?? false\n }\n\n readonly freezeAsset: AssetType\n readonly freezeAccount: AccountType\n readonly frozen: boolean\n\n readonly type: TransactionType.AssetFreeze = TransactionType.AssetFreeze\n readonly typeBytes: bytes = asUint64Cls(TransactionType.AssetFreeze).toBytes().asAlgoTs()\n}\n\nexport type ApplicationCallTransactionFields = TxnFields<gtxn.ApplicationCallTxn> &\n Partial<{\n appArgs: Array<unknown>\n accounts: Array<AccountType>\n assets: Array<AssetType>\n apps: Array<ApplicationType>\n approvalProgramPages: Array<bytes>\n clearStateProgramPages: Array<bytes>\n appLogs: Array<bytes>\n scratchSpace: Record<number, bytes | uint64>\n }>\n\nexport class ApplicationCallTransaction extends TransactionBase implements gtxn.ApplicationCallTxn {\n /** @internal */\n static create(fields: ApplicationCallTransactionFields) {\n return new ApplicationCallTransaction(fields)\n }\n /** @internal */\n private args: Array<unknown>\n #accounts: Array<AccountType>\n #assets: Array<AssetType>\n #apps: Array<ApplicationType>\n #approvalProgramPages: Array<bytes>\n #clearStateProgramPages: Array<bytes>\n #appLogs: Array<bytes>\n #appId: ApplicationType\n #rejectVersion: uint64\n\n /** @internal */\n protected constructor(fields: ApplicationCallTransactionFields) {\n super(fields)\n this.#appId = fields.appId ?? Application()\n this.onCompletion = fields.onCompletion ?? OnCompleteAction.NoOp\n this.globalNumUint = fields.globalNumUint ?? Uint64(0)\n this.globalNumBytes = fields.globalNumBytes ?? Uint64(0)\n this.localNumUint = fields.localNumUint ?? Uint64(0)\n this.localNumBytes = fields.localNumBytes ?? Uint64(0)\n this.extraProgramPages = fields.extraProgramPages ?? Uint64(0)\n this.createdApp = fields.createdApp ?? Application()\n this.args = fields.appArgs ?? []\n this.#appLogs = fields.appLogs ?? []\n this.#accounts = fields.accounts ?? []\n this.#assets = fields.assets ?? []\n this.#apps = fields.apps ?? []\n this.#approvalProgramPages = fields.approvalProgramPages ?? (fields.approvalProgram ? [fields.approvalProgram] : [])\n this.#clearStateProgramPages = fields.clearStateProgramPages ?? (fields.clearStateProgram ? [fields.clearStateProgram] : [])\n this.#rejectVersion = fields.rejectVersion ?? Uint64(0)\n Object.entries(fields.scratchSpace ?? {}).forEach(([k, v]) => this.setScratchSlot(Number(k), v))\n }\n\n get backingAppId(): ApplicationType {\n return this.#appId\n }\n\n get appId(): ApplicationType {\n if (asNumber(this.#appId.id) === 0) {\n return this.#appId\n }\n const appData = lazyContext.getApplicationData(this.#appId.id)\n if (appData && appData.isCreating) {\n return Application(0)\n }\n return this.#appId\n }\n readonly onCompletion: OnCompleteAction\n readonly globalNumUint: uint64\n readonly globalNumBytes: uint64\n readonly localNumUint: uint64\n readonly localNumBytes: uint64\n readonly extraProgramPages: uint64\n createdApp: ApplicationType\n get approvalProgram() {\n return this.approvalProgramPages(0)\n }\n get clearStateProgram() {\n return this.clearStateProgramPages(0)\n }\n get numAppArgs() {\n return Uint64(this.args.length)\n }\n get numAccounts() {\n return Uint64(this.#accounts.length)\n }\n get numAssets() {\n return Uint64(this.#assets.length)\n }\n get numApps() {\n return Uint64(this.#apps.length)\n }\n get numApprovalProgramPages() {\n return Uint64(this.approvalProgramPages.length)\n }\n get numClearStateProgramPages() {\n return Uint64(this.clearStateProgramPages.length)\n }\n get numLogs() {\n return Uint64(this.appLogs.length || lazyContext.getApplicationData(this.appId.id).application.appLogs!.length)\n }\n get lastLog() {\n return this.appLogs.at(-1) ?? lazyContext.getApplicationData(this.appId.id).application.appLogs!.at(-1) ?? Bytes()\n }\n get apat() {\n return this.#accounts\n }\n get apas() {\n return this.#assets\n }\n get apfa() {\n return this.#apps\n }\n get rejectVersion() {\n return this.#rejectVersion\n }\n appArgs(index: Uint64Compat): bytes {\n return toBytes(this.args[asNumber(index)])\n }\n accounts(index: Uint64Compat): AccountType {\n return this.#accounts[asNumber(index)]\n }\n assets(index: Uint64Compat): AssetType {\n return this.#assets[asNumber(index)]\n }\n apps(index: Uint64Compat): ApplicationType {\n return this.#apps[asNumber(index)]\n }\n approvalProgramPages(index: Uint64Compat): bytes {\n return combineIntoMaxBytePages(this.#approvalProgramPages)[asNumber(index)]\n }\n clearStateProgramPages(index: Uint64Compat): bytes {\n return combineIntoMaxBytePages(this.#clearStateProgramPages)[asNumber(index)]\n }\n logs(index: Uint64Compat): bytes {\n const i = asNumber(index)\n return this.appLogs[i] ?? lazyContext.getApplicationData(this.appId.id).application.appLogs ?? Bytes()\n }\n readonly type: TransactionType.ApplicationCall = TransactionType.ApplicationCall\n readonly typeBytes: bytes = asUint64Cls(TransactionType.ApplicationCall).toBytes().asAlgoTs()\n\n /** @internal */\n get appLogs() {\n return this.#appLogs\n }\n /** @internal */\n appendLog(value: StubBytesCompat): void {\n if (this.#appLogs.length + 1 > MAX_ITEMS_IN_LOG) {\n throw new InternalError(`Too many log calls in program, up to ${MAX_ITEMS_IN_LOG} is allowed`)\n }\n this.#appLogs.push(asBytes(value))\n }\n /** @internal */\n logArc4ReturnValue(value: unknown): void {\n this.appendLog(ABI_RETURN_VALUE_LOG_PREFIX.concat(toBytes(value)))\n }\n}\n\nexport type Transaction =\n | PaymentTransaction\n | KeyRegistrationTransaction\n | AssetConfigTransaction\n | AssetTransferTransaction\n | AssetFreezeTransaction\n | ApplicationCallTransaction\n\nexport type AllTransactionFields = TxnFields<gtxn.PaymentTxn> &\n TxnFields<gtxn.KeyRegistrationTxn> &\n TxnFields<gtxn.AssetConfigTxn> &\n TxnFields<gtxn.AssetTransferTxn> &\n TxnFields<gtxn.AssetFreezeTxn> &\n ApplicationCallTransactionFields\n","import type { OnCompleteActionStr, uint64 } from '@algorandfoundation/algorand-typescript'\nimport { OnCompleteAction } from '@algorandfoundation/algorand-typescript'\nimport type { AbiMetadata } from '../abi-metadata'\nimport { AssertError } from '../errors'\nimport { ApplicationCallTransaction } from '../impl/transactions'\nimport { lazyContext } from './internal-context'\n\n/** @internal */\nexport const checkRoutingConditions = (appId: uint64, metadata: AbiMetadata) => {\n const appData = lazyContext.getApplicationData(appId)\n const isCreating = appData.isCreating\n if (isCreating && metadata.onCreate === 'disallow') {\n throw new AssertError('method can not be called while creating')\n }\n if (!isCreating && metadata.onCreate === 'require') {\n throw new AssertError('method can only be called while creating')\n }\n const txn = lazyContext.activeGroup.activeTransaction\n if (\n txn instanceof ApplicationCallTransaction &&\n metadata.allowActions &&\n !metadata.allowActions.includes(OnCompleteAction[txn.onCompletion] as OnCompleteActionStr)\n ) {\n throw new AssertError(`method can only be called with one of the following on_completion values: ${metadata.allowActions.join(', ')}`)\n }\n}\n","import type {\n Account,\n Application,\n BoxMap as BoxMapType,\n Box as BoxType,\n bytes,\n GlobalStateOptions,\n GlobalState as GlobalStateType,\n LocalStateForAccount,\n LocalState as LocalStateType,\n uint64,\n} from '@algorandfoundation/algorand-typescript'\nimport { AccountMap } from '../collections/custom-key-map'\nimport { MAX_BOX_SIZE } from '../constants'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { AssertError, CodeError, InternalError } from '../errors'\nimport type { TypeInfo } from '../impl/encoded-types'\nimport { toBytes } from '../impl/encoded-types'\nimport { getGenericTypeInfo } from '../runtime-helpers'\nimport { asBytes, asBytesCls, asNumber, asUint8Array, concatUint8Arrays } from '../util'\nimport { getEncoder, minLengthForType } from './encoded-types'\nimport type { StubBytesCompat, StubUint64Compat } from './primitives'\nimport { Bytes, Uint64, Uint64Cls } from './primitives'\n\nexport class GlobalStateCls<ValueType> {\n /** @internal */\n private readonly _type: string = GlobalStateCls.name\n\n /** @internal */\n #value: ValueType | undefined\n\n key: bytes | undefined\n\n get hasKey(): boolean {\n return this.key !== undefined && this.key.length > 0\n }\n\n delete: () => void = () => {\n if (this.#value instanceof Uint64Cls) {\n this.#value = Uint64(0) as ValueType\n } else {\n this.#value = undefined\n }\n }\n\n static [Symbol.hasInstance](x: unknown): x is GlobalStateCls<unknown> {\n return x instanceof Object && '_type' in x && (x as { _type: string })['_type'] === GlobalStateCls.name\n }\n\n get value(): ValueType {\n if (this.#value === undefined) {\n throw new AssertError('value is not set')\n }\n return this.#value\n }\n\n set value(v: ValueType) {\n this.#value = v\n }\n\n get hasValue(): boolean {\n return this.#value !== undefined\n }\n\n /** @internal */\n constructor(key?: bytes | string, value?: ValueType) {\n this.key = key !== undefined ? asBytes(key) : undefined\n this.#value = value\n }\n}\n\nexport class LocalStateCls<ValueType> {\n /** @internal */\n #value: ValueType | undefined\n\n delete: () => void = () => {\n if (this.#value instanceof Uint64Cls) {\n this.#value = Uint64(0) as ValueType\n } else {\n this.#value = undefined\n }\n }\n get value(): ValueType {\n if (this.#value === undefined) {\n throw new AssertError('value is not set')\n }\n return this.#value\n }\n\n set value(v: ValueType) {\n this.#value = v\n }\n\n get hasValue(): boolean {\n return this.#value !== undefined\n }\n}\n\nexport class LocalStateMapCls<ValueType> {\n /** @internal */\n private applicationId: uint64\n\n /** @internal */\n constructor() {\n this.applicationId = lazyContext.activeGroup.activeApplicationId\n }\n\n getValue(key: string | bytes | undefined, account: Account): LocalStateCls<ValueType> {\n const bytesKey = key === undefined ? Bytes() : asBytes(key)\n const localStateMap = this.ensureApplicationLocalStateMap(bytesKey)\n if (!localStateMap.has(account)) {\n localStateMap.set(account, new LocalStateCls())\n }\n return localStateMap.getOrFail(account) as LocalStateCls<ValueType>\n }\n\n /** @internal */\n private ensureApplicationLocalStateMap(key: bytes | string) {\n const applicationData = lazyContext.ledger.applicationDataMap.getOrFail(this.applicationId)!.application\n if (!applicationData.localStateMaps.has(key)) {\n applicationData.localStateMaps.set(key, new AccountMap<LocalStateCls<ValueType>>())\n }\n return applicationData.localStateMaps.getOrFail(key)\n }\n}\n\n/** @internal */\nexport function GlobalState<ValueType>(options?: GlobalStateOptions<ValueType>): GlobalStateType<ValueType> {\n return new GlobalStateCls(options?.key, options?.initialValue)\n}\n\n/** @internal */\nexport function LocalState<ValueType>(options?: { key?: bytes | string }): LocalStateType<ValueType> {\n function localStateInternal(account: Account): LocalStateForAccount<ValueType> {\n return localStateInternal.map.getValue(localStateInternal.key, account)\n }\n localStateInternal.key = options?.key\n localStateInternal.hasKey = options?.key !== undefined && options.key.length > 0\n localStateInternal.map = new LocalStateMapCls<ValueType>()\n return localStateInternal\n}\n\n/** @internal */\nexport class BoxCls<TValue> {\n #key: bytes | undefined\n #app: Application\n #valueType?: TypeInfo\n\n private readonly _type: string = BoxCls.name\n private get valueType(): TypeInfo {\n if (this.#valueType === undefined) {\n const typeInfo = getGenericTypeInfo(this)\n if (typeInfo === undefined || typeInfo.genericArgs === undefined || typeInfo.genericArgs.length !== 1) {\n throw new InternalError('Box value type is not set')\n }\n this.#valueType = (typeInfo.genericArgs as TypeInfo[])[0]\n }\n return this.#valueType\n }\n\n static [Symbol.hasInstance](x: unknown): x is BoxCls<unknown> {\n return x instanceof Object && '_type' in x && (x as { _type: string })['_type'] === BoxCls.name\n }\n\n constructor(key?: StubBytesCompat, app?: Application, valueType?: TypeInfo) {\n this.#key = key ? asBytes(key) : undefined\n this.#app = app ?? lazyContext.activeApplication\n this.#valueType = valueType\n }\n\n private get fromBytes() {\n return (val: Uint8Array) => getEncoder<TValue>(this.valueType)(val, this.valueType)\n }\n\n create(options?: { size?: StubUint64Compat }): boolean {\n const optionSize = options?.size !== undefined ? asNumber(options.size) : undefined\n const valueTypeSize = minLengthForType(this.valueType)\n if (valueTypeSize === undefined && optionSize === undefined) {\n throw new InternalError(`${this.valueType.name} does not have a fixed byte size. Please specify a size argument`)\n }\n if (valueTypeSize !== undefined && optionSize !== undefined) {\n if (optionSize < valueTypeSize) {\n throw new InternalError(`Box size cannot be less than ${valueTypeSize}`)\n }\n if (optionSize > valueTypeSize) {\n process.emitWarning(\n `Box size is set to ${optionSize} but the value type ${this.valueType.name} has a fixed size of ${valueTypeSize}`,\n )\n }\n }\n const size = asNumber(options?.size ?? 0)\n if (size > MAX_BOX_SIZE) {\n throw new InternalError(`Box size cannot exceed ${MAX_BOX_SIZE}`)\n }\n lazyContext.ledger.setBox(this.#app, this.key, new Uint8Array(Math.max(size, valueTypeSize ?? 0)))\n return true\n }\n\n get value(): TValue {\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n let materialised = lazyContext.ledger.getMaterialisedBox<TValue>(this.#app, this.key)\n if (materialised !== undefined) {\n return materialised\n }\n const original = lazyContext.ledger.getBox(this.#app, this.key)\n materialised = this.fromBytes(original)\n lazyContext.ledger.setMaterialisedBox(this.#app, this.key, materialised)\n return materialised\n }\n set value(v: TValue) {\n const isStaticValueType = minLengthForType(this.valueType) !== undefined\n const newValueBytes = asUint8Array(toBytes(v))\n if (isStaticValueType && this.exists) {\n const originalValueBytes = lazyContext.ledger.getBox(this.#app, this.key)\n if (originalValueBytes.length !== newValueBytes.length) {\n throw new CodeError(`attempt to box_put wrong size ${originalValueBytes.length} != ${newValueBytes.length}`)\n }\n }\n lazyContext.ledger.setBox(this.#app, this.key, newValueBytes)\n lazyContext.ledger.setMaterialisedBox(this.#app, this.key, v)\n }\n\n get hasKey(): boolean {\n return this.#key !== undefined && this.#key.length > 0\n }\n\n get key(): bytes {\n if (this.#key === undefined || this.#key.length === 0) {\n throw new InternalError('Box key is empty')\n }\n return this.#key\n }\n\n set key(key: StubBytesCompat) {\n this.#key = asBytes(key)\n }\n\n get exists(): boolean {\n return lazyContext.ledger.boxExists(this.#app, this.key)\n }\n\n get length(): uint64 {\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n return lazyContext.ledger.getBox(this.#app, this.key).length\n }\n\n get(options: { default: TValue }): TValue {\n const [value, exists] = this.maybe()\n return exists ? value : options.default\n }\n\n delete(): boolean {\n return lazyContext.ledger.deleteBox(this.#app, this.key)\n }\n\n maybe(): readonly [TValue, boolean] {\n const value = this.fromBytes(lazyContext.ledger.getBox(this.#app, this.key))\n return [value, lazyContext.ledger.boxExists(this.#app, this.key)]\n }\n\n splice(start: StubUint64Compat, length: StubUint64Compat, value: StubBytesCompat): void {\n const content = this.backingValue\n const startNumber = asNumber(start)\n const lengthNumber = asNumber(length)\n const valueBytes = asBytesCls(value)\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n if (startNumber > content.length) {\n throw new InternalError('Start index exceeds box size')\n }\n const end = Math.min(startNumber + lengthNumber, content.length)\n let updatedContent = concatUint8Arrays(content.slice(0, startNumber), valueBytes.asUint8Array(), content.slice(end))\n\n if (updatedContent.length > content.length) {\n updatedContent = updatedContent.slice(0, content.length)\n } else if (updatedContent.length < content.length) {\n updatedContent = concatUint8Arrays(updatedContent, new Uint8Array(content.length - updatedContent.length))\n }\n this.backingValue = updatedContent\n }\n\n replace(start: StubUint64Compat, value: StubBytesCompat): void {\n const content = this.backingValue\n const startNumber = asNumber(start)\n const valueBytes = asBytesCls(value)\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n if (startNumber + asNumber(valueBytes.length) > content.length) {\n throw new InternalError('Replacement content exceeds box size')\n }\n const updatedContent = concatUint8Arrays(\n content.slice(0, startNumber),\n valueBytes.asUint8Array(),\n content.slice(startNumber + valueBytes.length.asNumber()),\n )\n this.backingValue = updatedContent\n }\n\n extract(start: StubUint64Compat, length: StubUint64Compat): bytes {\n const content = this.backingValue\n const startNumber = asNumber(start)\n const lengthNumber = asNumber(length)\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n if (startNumber + lengthNumber > content.length) {\n throw new InternalError('Index out of bounds')\n }\n return toBytes(content.slice(startNumber, startNumber + lengthNumber))\n }\n\n resize(newSize: uint64): void {\n const newSizeNumber = asNumber(newSize)\n if (newSizeNumber > MAX_BOX_SIZE) {\n throw new InternalError(`Box size cannot exceed ${MAX_BOX_SIZE}`)\n }\n const content = this.backingValue\n if (!this.exists) {\n throw new InternalError('Box has not been created')\n }\n let updatedContent\n if (newSizeNumber > content.length) {\n updatedContent = concatUint8Arrays(content, new Uint8Array(newSizeNumber - content.length))\n } else {\n updatedContent = content.slice(0, newSize)\n }\n this.backingValue = updatedContent\n }\n\n private get backingValue(): Uint8Array {\n return lazyContext.ledger.getBox(this.#app, this.key)\n }\n\n private set backingValue(value: Uint8Array) {\n lazyContext.ledger.setBox(this.#app, this.key, value)\n }\n}\n\n/** @internal */\nexport class BoxMapCls<TKey, TValue> {\n private _keyPrefix: bytes | undefined\n #app: Application\n\n private readonly _type: string = BoxMapCls.name\n\n static [Symbol.hasInstance](x: unknown): x is BoxMapCls<unknown, unknown> {\n return x instanceof Object && '_type' in x && (x as { _type: string })['_type'] === BoxMapCls.name\n }\n\n constructor() {\n this.#app = lazyContext.activeApplication\n }\n\n get hasKeyPrefix(): boolean {\n return this._keyPrefix !== undefined && this._keyPrefix.length > 0\n }\n\n get keyPrefix(): bytes {\n if (this._keyPrefix === undefined || this._keyPrefix.length === 0) {\n throw new InternalError('Box key prefix is empty')\n }\n return this._keyPrefix\n }\n\n set keyPrefix(keyPrefix: StubBytesCompat) {\n this._keyPrefix = asBytes(keyPrefix)\n }\n\n call(key: TKey, proxy: (key: TKey) => BoxType<TValue>): BoxType<TValue> {\n const typeInfo = getGenericTypeInfo(proxy)\n const valueType = (typeInfo!.genericArgs! as TypeInfo[])[1]\n const box = new BoxCls<TValue>(this.getFullKey(key), this.#app, valueType)\n return box\n }\n\n private getFullKey(key: TKey): bytes {\n return this.keyPrefix.concat(toBytes(key))\n }\n}\n\n/** @internal */\nexport function Box<TValue>(options?: { key: bytes | string }): BoxType<TValue> {\n return new BoxCls<TValue>(options?.key)\n}\n\n/** @internal */\nexport function BoxMap<TKey, TValue>(options?: { keyPrefix: bytes | string }): BoxMapType<TKey, TValue> {\n const boxMap = new BoxMapCls<TKey, TValue>()\n if (options?.keyPrefix !== undefined) {\n boxMap.keyPrefix = options.keyPrefix\n }\n\n const x = (key: TKey): BoxType<TValue> => boxMap.call(key, x)\n return Object.setPrototypeOf(x, boxMap)\n}\n","import type { BaseContract as BaseContractType } from '@algorandfoundation/algorand-typescript'\nimport {\n OnCompleteAction,\n type Account,\n type Application,\n type Asset,\n type contract,\n type LocalState,\n} from '@algorandfoundation/algorand-typescript'\nimport type { ARC4Encoded, ResourceEncodingOptions } from '@algorandfoundation/algorand-typescript/arc4'\nimport type { AbiMetadata } from '../abi-metadata'\nimport { getArc4Selector, getContractAbiMetadata, getContractMethodAbiMetadata } from '../abi-metadata'\nimport { BytesMap } from '../collections/custom-key-map'\nimport { checkRoutingConditions } from '../context-helpers/context-util'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { CodeError } from '../errors'\nimport type { BaseContract } from '../impl/base-contract'\nimport { ContractOptionsSymbol } from '../impl/base-contract'\nimport type { Contract } from '../impl/contract'\nimport { getArc4Encoded, Uint, type TypeInfo } from '../impl/encoded-types'\nimport { Bytes } from '../impl/primitives'\nimport { AccountCls, ApplicationCls, AssetCls } from '../impl/reference'\nimport { BoxCls, BoxMapCls, GlobalStateCls } from '../impl/state'\nimport type { Transaction } from '../impl/transactions'\nimport {\n ApplicationCallTransaction,\n AssetConfigTransaction,\n AssetFreezeTransaction,\n AssetTransferTransaction,\n KeyRegistrationTransaction,\n PaymentTransaction,\n} from '../impl/transactions'\nimport { getGenericTypeInfo } from '../runtime-helpers'\nimport type { DeliberateAny, IConstructor } from '../typescript-helpers'\ntype ContractOptionsParameter = Parameters<typeof contract>[0]\n\ntype StateTotals = Pick<Application, 'globalNumBytes' | 'globalNumUint' | 'localNumBytes' | 'localNumUint'>\n\ninterface States {\n globalStates: BytesMap<GlobalStateCls<unknown>>\n localStates: BytesMap<LocalState<unknown>>\n totals: StateTotals\n}\n\nconst isUint64GenericType = (typeInfo: TypeInfo | undefined) => {\n if (!Array.isArray(typeInfo?.genericArgs) || !typeInfo?.genericArgs?.length) return false\n return typeInfo.genericArgs.some((t) => t.name.toLocaleLowerCase() === 'uint64')\n}\n\nconst extractStates = (contract: BaseContract, contractOptions: ContractOptionsParameter | undefined): States => {\n const stateTotals = { globalNumBytes: 0, globalNumUint: 0, localNumBytes: 0, localNumUint: 0 }\n const states = {\n globalStates: new BytesMap<GlobalStateCls<unknown>>(),\n localStates: new BytesMap<LocalState<unknown>>(),\n totals: stateTotals,\n }\n Object.entries(contract).forEach(([key, value]) => {\n const isLocalState = value instanceof Function && value.name === 'localStateInternal'\n const isGlobalState = value instanceof GlobalStateCls\n const isBox = value instanceof BoxCls\n const isBoxMap = value instanceof BoxMapCls\n if (isLocalState || isGlobalState || isBox) {\n // set key using property name if not already set\n if (!value.hasKey) value.key = Bytes(key)\n } else if (isBoxMap) {\n if (!value.hasKeyPrefix) value.keyPrefix = Bytes(key)\n }\n\n if (isLocalState || isGlobalState) {\n // capture state into the context\n if (isLocalState) states.localStates.set(value.key, value)\n else states.globalStates.set(value.key, value)\n\n // populate state totals\n const isUint64State = isUint64GenericType(getGenericTypeInfo(value)!)\n stateTotals.globalNumUint += isGlobalState && isUint64State ? 1 : 0\n stateTotals.globalNumBytes += isGlobalState && !isUint64State ? 1 : 0\n stateTotals.localNumUint += isLocalState && isUint64State ? 1 : 0\n stateTotals.localNumBytes += isLocalState && !isUint64State ? 1 : 0\n }\n })\n\n stateTotals.globalNumUint = contractOptions?.stateTotals?.globalUints ?? stateTotals.globalNumUint\n stateTotals.globalNumBytes = contractOptions?.stateTotals?.globalBytes ?? stateTotals.globalNumBytes\n stateTotals.localNumUint = contractOptions?.stateTotals?.localUints ?? stateTotals.localNumUint\n stateTotals.localNumBytes = contractOptions?.stateTotals?.localBytes ?? stateTotals.localNumBytes\n\n return states\n}\n\nconst getUint8 = (value: number) => new Uint({ name: 'Uint<8>', genericArgs: [{ name: '8' }] }, value)\n\n/**\n * @internal\n */\nexport const extractArraysFromArgs = (\n app: Application,\n methodSelector: Uint8Array,\n resourceEncoding: ResourceEncodingOptions | undefined,\n args: DeliberateAny[],\n) => {\n const transactions: Transaction[] = []\n const accounts: Account[] = [lazyContext.defaultSender]\n const apps: Application[] = [app]\n const assets: Asset[] = []\n let appArgs: ARC4Encoded[] = []\n\n for (const arg of args) {\n if (isTransaction(arg)) {\n transactions.push(arg)\n } else if (arg instanceof AccountCls) {\n if (resourceEncoding === 'index') {\n appArgs.push(getUint8(accounts.length))\n accounts.push(arg as Account)\n } else {\n appArgs.push(getArc4Encoded(arg.bytes))\n }\n } else if (arg instanceof ApplicationCls) {\n if (resourceEncoding === 'index') {\n appArgs.push(getUint8(apps.length))\n apps.push(arg as Application)\n } else {\n appArgs.push(getArc4Encoded(arg.id))\n }\n } else if (arg instanceof AssetCls) {\n if (resourceEncoding === 'index') {\n appArgs.push(getUint8(assets.length))\n assets.push(arg as Asset)\n } else {\n appArgs.push(getArc4Encoded(arg.id))\n }\n } else if (arg !== undefined) {\n appArgs.push(getArc4Encoded(arg))\n }\n }\n\n if (appArgs.length > 15) {\n const packed = getArc4Encoded(appArgs.slice(14))\n appArgs = [...appArgs.slice(0, 14), packed]\n }\n return {\n accounts,\n apps,\n assets,\n transactions,\n appArgs: [Bytes(methodSelector), ...appArgs.filter((a) => a !== undefined).map((a) => a.bytes)],\n }\n}\n\nfunction isTransaction(obj: unknown): obj is Transaction {\n return (\n obj instanceof PaymentTransaction ||\n obj instanceof KeyRegistrationTransaction ||\n obj instanceof AssetConfigTransaction ||\n obj instanceof AssetTransferTransaction ||\n obj instanceof AssetFreezeTransaction ||\n obj instanceof ApplicationCallTransaction\n )\n}\n\n/**\n * Provides a context for creating contracts and registering created contract instances\n * with test execution context.\n */\nexport class ContractContext {\n /**\n * Creates a new contract instance and register the created instance with test execution context.\n *\n * @template T Type of contract extending BaseContract\n * @param {IConstructor<T>} type The contract class constructor\n * @param {...any[]} args Constructor arguments for the contract\n * @returns {T} Proxied instance of the contract\n * @example\n * const ctx = new TestExecutionContext();\n * const contract = ctx.contract.create(MyContract);\n */\n create<T extends BaseContractType>(type: IConstructor<T>, ...args: DeliberateAny[]): T {\n const proxy = new Proxy(type, this.getContractProxyHandler<T>(this.isArc4(type)))\n return new proxy(...args)\n }\n\n /**\n * Creates an array of transactions for calling a contract method.\n *\n * @internal\n * @template TParams Array of parameter types\n * @param {BaseContract} contract The contract instance\n * @param {AbiMetadata | undefined} abiMetadata ABI metadata for the method\n * @param {...TParams} args Method arguments\n * @returns {Transaction[]} Array of transactions needed to execute the method\n * @example\n * const txns = ContractContext.createMethodCallTxns(\n * myContract,\n * methodAbiMetadata,\n * arg1,\n * arg2\n * );\n */\n static createMethodCallTxns<TParams extends unknown[]>(\n contract: BaseContract,\n abiMetadata: AbiMetadata | undefined,\n ...args: TParams\n ): Transaction[] {\n const app = lazyContext.ledger.getApplicationForContract(contract)\n const methodSelector = abiMetadata ? getArc4Selector(abiMetadata) : new Uint8Array()\n const { transactions, ...appCallArgs } = extractArraysFromArgs(app, methodSelector, abiMetadata?.resourceEncoding, args)\n const appTxn = lazyContext.any.txn.applicationCall({\n appId: app,\n ...appCallArgs,\n // TODO: This needs to be specifiable by the test code\n onCompletion: OnCompleteAction[(abiMetadata?.allowActions ?? [])[0]],\n })\n const txns = [...(transactions ?? []), appTxn]\n return txns\n }\n\n /**\n * @internal\n */\n private isArc4<T extends BaseContract>(type: IConstructor<T>): boolean {\n const result = (type as DeliberateAny as typeof BaseContract).isArc4\n if (result !== undefined && result !== null) {\n return result\n }\n\n throw new CodeError('Cannot create a contract for class as it does not extend Contract or BaseContract')\n }\n\n /**\n * @internal\n */\n private getContractProxyHandler<T extends BaseContract>(isArc4: boolean): ProxyHandler<IConstructor<T>> {\n const onConstructed = (application: Application, instance: T, conrtactOptions: ContractOptionsParameter | undefined) => {\n const states = extractStates(instance, conrtactOptions)\n\n const applicationData = lazyContext.ledger.applicationDataMap.getOrFail(application.id)\n applicationData.application = {\n ...applicationData.application,\n globalStates: states.globalStates,\n localStates: states.localStates,\n ...states.totals,\n }\n lazyContext.ledger.addAppIdContractMap(application.id, instance)\n }\n return {\n construct(target, args) {\n let t: T | undefined = undefined\n const application = lazyContext.any.application()\n const txn = lazyContext.any.txn.applicationCall({ appId: application })\n const appData = lazyContext.ledger.applicationDataMap.getOrFail(application.id)\n appData.isCreating = true\n lazyContext.txn.ensureScope([txn]).execute(() => {\n t = new target(...args)\n })\n appData.isCreating = isArc4 && hasCreateMethods(t! as Contract)\n const instance = new Proxy(t!, {\n get(target, prop, receiver) {\n const orig = Reflect.get(target, prop, receiver)\n const abiMetadata =\n isArc4 && typeof orig === 'function' ? getContractMethodAbiMetadata(target as Contract, orig.name) : undefined\n const isProgramMethod = prop === 'approvalProgram' || prop === 'clearStateProgram'\n const isAbiMethod = isArc4 && abiMetadata\n if (isAbiMethod || isProgramMethod) {\n return (...args: DeliberateAny[]): DeliberateAny => {\n const txns = ContractContext.createMethodCallTxns(receiver, abiMetadata, ...args)\n return lazyContext.txn.ensureScope(txns).execute(() => {\n if (isAbiMethod) {\n checkRoutingConditions(application.id, abiMetadata)\n }\n const returnValue = (orig as DeliberateAny).apply(target, args)\n if (!isProgramMethod && isAbiMethod && returnValue !== undefined) {\n ;(txns.at(-1) as ApplicationCallTransaction).logArc4ReturnValue(returnValue)\n }\n appData.isCreating = false\n return returnValue\n })\n }\n }\n return orig\n },\n })\n\n onConstructed(application, instance, getContractOptions(t!))\n\n return instance\n },\n }\n }\n}\n\nconst getContractOptions = (contract: BaseContract): ContractOptionsParameter | undefined => {\n const contractClass = contract.constructor as DeliberateAny\n return contractClass[ContractOptionsSymbol] as ContractOptionsParameter\n}\n\nconst hasCreateMethods = (contract: Contract) => {\n const createFn = Reflect.get(contract, 'createApplication')\n if (createFn !== undefined && typeof createFn === 'function') return true\n\n const metadatas = getContractAbiMetadata(contract)\n return Object.values(metadatas).some((metadata) => (metadata.onCreate ?? 'disallow') !== 'disallow')\n}\n","import type {\n Account as AccountType,\n Application as ApplicationType,\n Asset as AssetType,\n bytes,\n BytesCompat,\n itxn,\n} from '@algorandfoundation/algorand-typescript'\nimport { TransactionType } from '@algorandfoundation/algorand-typescript'\nimport type {\n BareCreateApplicationCallFields,\n ResourceEncodingOptions,\n TypedApplicationCallFields,\n} from '@algorandfoundation/algorand-typescript/arc4'\nimport { ABI_RETURN_VALUE_LOG_PREFIX } from '../constants'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { InternalError, invariant } from '../errors'\nimport { extractArraysFromArgs } from '../subcontexts/contract-context'\nimport type { DeliberateAny } from '../typescript-helpers'\nimport { asBytes, asNumber, asUint64, asUint8Array } from '../util'\nimport { getApp } from './app-params'\nimport { getAsset } from './asset-params'\nimport { encodeArc4 } from './encoded-types'\nimport type { InnerTxn, InnerTxnFields } from './itxn'\nimport { Uint64Cls } from './primitives'\nimport { Account, asAccount, asApplication, asAsset } from './reference'\nimport type { Transaction } from './transactions'\nimport {\n ApplicationCallTransaction,\n AssetConfigTransaction,\n AssetFreezeTransaction,\n AssetTransferTransaction,\n KeyRegistrationTransaction,\n PaymentTransaction,\n} from './transactions'\n\nconst mapCommonFields = <T extends InnerTxnFields>(\n fields: T,\n): Omit<T, 'sender' | 'note' | 'rekeyTo'> & { sender?: AccountType; note?: bytes; rekeyTo?: AccountType } => {\n const { sender, note, rekeyTo, ...rest } = fields\n\n return {\n sender: asAccount(sender),\n note: note !== undefined ? asBytes(note) : undefined,\n rekeyTo: asAccount(rekeyTo),\n ...rest,\n }\n}\n\nexport class PaymentInnerTxn extends PaymentTransaction implements itxn.PaymentInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: itxn.PaymentFields) {\n return new PaymentInnerTxn(fields)\n }\n\n /** @internal */\n constructor(fields: itxn.PaymentFields) {\n super({\n ...mapCommonFields(fields),\n receiver: asAccount(fields.receiver),\n closeRemainderTo: asAccount(fields.closeRemainderTo),\n })\n }\n}\n\nexport class KeyRegistrationInnerTxn extends KeyRegistrationTransaction implements itxn.KeyRegistrationInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: itxn.KeyRegistrationFields) {\n return new KeyRegistrationInnerTxn(fields)\n }\n\n /** @internal */\n constructor(fields: itxn.KeyRegistrationFields) {\n super(mapCommonFields(fields))\n }\n}\n\nexport class AssetConfigInnerTxn extends AssetConfigTransaction implements itxn.AssetConfigInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: itxn.AssetConfigFields) {\n return new AssetConfigInnerTxn(fields)\n }\n\n /** @internal */\n constructor(fields: itxn.AssetConfigFields) {\n const { assetName, unitName, url, manager, reserve, freeze, clawback, configAsset, ...rest } = mapCommonFields(fields)\n const createdAsset =\n !configAsset || !asNumber(asAsset(configAsset)!.id)\n ? lazyContext.any.asset({\n name: typeof assetName === 'string' ? asBytes(assetName) : assetName,\n unitName: typeof unitName === 'string' ? asBytes(unitName) : unitName,\n url: typeof url === 'string' ? asBytes(url) : url,\n manager: asAccount(manager),\n reserve: asAccount(reserve),\n freeze: asAccount(freeze),\n clawback: asAccount(clawback),\n ...rest,\n })\n : undefined\n\n super({\n assetName: typeof assetName === 'string' ? asBytes(assetName) : assetName,\n unitName: typeof unitName === 'string' ? asBytes(unitName) : unitName,\n url: typeof url === 'string' ? asBytes(url) : url,\n manager: asAccount(manager),\n reserve: asAccount(reserve),\n freeze: asAccount(freeze),\n clawback: asAccount(clawback),\n configAsset: asAsset(configAsset),\n ...rest,\n createdAsset: createdAsset,\n })\n }\n}\n\nexport class AssetTransferInnerTxn extends AssetTransferTransaction implements itxn.AssetTransferInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: Partial<itxn.AssetTransferFields>) {\n if (fields.xferAsset === undefined) {\n throw new Error('xferAsset is required')\n }\n return new AssetTransferInnerTxn(fields as itxn.AssetTransferFields)\n }\n\n /** @internal */\n constructor(fields: itxn.AssetTransferFields) {\n super({\n ...mapCommonFields(fields),\n assetSender: asAccount(fields.assetSender),\n assetReceiver: asAccount(fields.assetReceiver),\n assetCloseTo: asAccount(fields.assetCloseTo),\n xferAsset: asAsset(fields.xferAsset),\n })\n }\n}\n\nexport class AssetFreezeInnerTxn extends AssetFreezeTransaction implements itxn.AssetFreezeInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: Partial<itxn.AssetFreezeFields>) {\n if (fields.freezeAsset === undefined) {\n throw new Error('freezeAsset is required')\n }\n return new AssetFreezeInnerTxn(fields as itxn.AssetFreezeFields)\n }\n\n /** @internal */\n constructor(fields: itxn.AssetFreezeFields) {\n const { freezeAsset, freezeAccount, ...rest } = mapCommonFields(fields)\n const asset: AssetType | undefined = freezeAsset instanceof Uint64Cls ? getAsset(freezeAsset) : (freezeAsset as AssetType)\n const account: AccountType | undefined =\n typeof freezeAccount === 'string' ? Account(asBytes(freezeAccount)) : (freezeAccount as AccountType)\n super({\n freezeAsset: asset,\n freezeAccount: account,\n ...rest,\n })\n }\n}\n\n/** @internal */\nexport type ApplicationCallFields = itxn.ApplicationCallFields & {\n createdApp?: ApplicationType\n appLogs?: Array<bytes>\n}\n\nexport class ApplicationCallInnerTxn extends ApplicationCallTransaction implements itxn.ApplicationCallInnerTxn {\n readonly isItxn?: true\n\n /** @internal */\n static create(fields: Partial<ApplicationCallFields>) {\n return new ApplicationCallInnerTxn(fields)\n }\n\n /** @internal */\n constructor(fields: Partial<ApplicationCallFields>) {\n const { appId, approvalProgram, clearStateProgram, onCompletion, appArgs, accounts, assets, apps, ...rest } = mapCommonFields(fields)\n super({\n appId: appId instanceof Uint64Cls ? getApp(appId) : (appId as ApplicationType),\n onCompletion,\n approvalProgram: Array.isArray(approvalProgram) ? undefined : (approvalProgram as bytes),\n approvalProgramPages: Array.isArray(approvalProgram) ? approvalProgram : undefined,\n clearStateProgram: Array.isArray(clearStateProgram) ? undefined : (clearStateProgram as bytes),\n clearStateProgramPages: Array.isArray(clearStateProgram) ? clearStateProgram : undefined,\n appArgs: appArgs?.map((x) => x),\n accounts: accounts?.map((x) => asAccount(x)!),\n assets: assets?.map((x) => asAsset(x)!),\n apps: apps?.map((x) => asApplication(x)!),\n appLogs: fields.appLogs,\n createdApp: fields.createdApp,\n ...rest,\n })\n }\n}\n\n/** @internal */\nexport const createInnerTxn = <TFields extends InnerTxnFields>(fields: TFields) => {\n switch (fields.type) {\n case TransactionType.Payment:\n return new PaymentInnerTxn(fields)\n case TransactionType.AssetConfig:\n return new AssetConfigInnerTxn(fields)\n case TransactionType.AssetTransfer:\n return new AssetTransferInnerTxn(fields)\n case TransactionType.AssetFreeze:\n return new AssetFreezeInnerTxn(fields)\n case TransactionType.ApplicationCall:\n return new ApplicationCallInnerTxn(fields)\n case TransactionType.KeyRegistration:\n return new KeyRegistrationInnerTxn(fields)\n default:\n throw new InternalError(`Invalid inner transaction type: ${fields.type}`)\n }\n}\n\n/** @internal */\nexport function submitGroup<TFields extends [...itxn.ItxnParams[]]>(...transactionFields: TFields): itxn.TxnFor<TFields> {\n return transactionFields.map((f: (typeof transactionFields)[number]) => f.submit()) as itxn.TxnFor<TFields>\n}\n/** @internal */\nexport function payment(fields: itxn.PaymentFields): itxn.PaymentItxnParams {\n return new ItxnParams<itxn.PaymentFields, itxn.PaymentInnerTxn>(fields, TransactionType.Payment)\n}\n/** @internal */\nexport function keyRegistration(fields: itxn.KeyRegistrationFields): itxn.KeyRegistrationItxnParams {\n return new ItxnParams<itxn.KeyRegistrationFields, itxn.KeyRegistrationInnerTxn>(fields, TransactionType.KeyRegistration)\n}\n/** @internal */\nexport function assetConfig(fields: itxn.AssetConfigFields): itxn.AssetConfigItxnParams {\n return new ItxnParams<itxn.AssetConfigFields, itxn.AssetConfigInnerTxn>(fields, TransactionType.AssetConfig)\n}\n/** @internal */\nexport function assetTransfer(fields: itxn.AssetTransferFields): itxn.AssetTransferItxnParams {\n return new ItxnParams<itxn.AssetTransferFields, itxn.AssetTransferInnerTxn>(fields, TransactionType.AssetTransfer)\n}\n/** @internal */\nexport function assetFreeze(fields: itxn.AssetFreezeFields): itxn.AssetFreezeItxnParams {\n return new ItxnParams<itxn.AssetFreezeFields, itxn.AssetFreezeInnerTxn>(fields, TransactionType.AssetFreeze)\n}\n/** @internal */\nexport function applicationCall(fields: itxn.ApplicationCallFields): itxn.ApplicationCallItxnParams {\n return new ItxnParams<itxn.ApplicationCallFields, itxn.ApplicationCallInnerTxn>(fields, TransactionType.ApplicationCall)\n}\n\n/** @internal */\nexport class ItxnParams<TFields extends InnerTxnFields, TTransaction extends InnerTxn> {\n #fields: TFields & { type: TransactionType }\n constructor(fields: TFields, type: TransactionType) {\n this.#fields = { ...fields, type }\n }\n\n private isApplicationCall(): boolean {\n return this.#fields.type === TransactionType.ApplicationCall\n }\n\n createInnerTxns(): TTransaction[] {\n let itxnContext: ApplicationCallInnerTxnContext | undefined\n if (this.isApplicationCall()) {\n itxnContext = ApplicationCallInnerTxnContext.createFromFields(this.#fields)\n }\n const innerTxns = [\n ...(itxnContext?.itxns ?? []),\n itxnContext ?? createInnerTxn<InnerTxnFields>(this.#fields),\n ] as unknown as TTransaction[]\n return innerTxns\n }\n\n submit(): TTransaction {\n const innerTxns = this.createInnerTxns()\n innerTxns.forEach((itxn, index) => Object.assign(itxn, { groupIndex: asUint64(index) }))\n const lastInnerTxn = innerTxns.at(-1)\n if (lastInnerTxn instanceof ApplicationCallInnerTxnContext) {\n lazyContext.value.notifyApplicationSpies(lastInnerTxn)\n }\n lazyContext.txn.activeGroup.addInnerTransactionGroup(...innerTxns)\n return lastInnerTxn as TTransaction\n }\n\n set(p: Partial<TFields>) {\n Object.assign(this.#fields, p)\n }\n\n copy() {\n return new ItxnParams<TFields, TTransaction>(this.#fields, this.#fields.type)\n }\n}\n\n/** @internal */\nconst UNSET = Symbol('UNSET_SYMBOL')\n/**\n * The ApplicationCallInnerTxnContext class is a specialized version of the ApplicationCallInnerTxn class.\n * It is used to handle the context of an application call transaction, including managing the return value.\n */\nexport class ApplicationCallInnerTxnContext<TReturn = unknown> extends ApplicationCallInnerTxn {\n /** @internal */\n static createFromFields(fields: ApplicationCallFields) {\n return new ApplicationCallInnerTxnContext(fields)\n }\n /** @internal */\n static createFromTypedApplicationCallFields<TReturn = unknown>(\n methodArgs: TypedApplicationCallFields<DeliberateAny>,\n methodSelector: bytes,\n resourceEncoding: ResourceEncodingOptions | undefined,\n ) {\n const app =\n (methodArgs.appId instanceof Uint64Cls ? getApp(methodArgs.appId) : (methodArgs.appId as ApplicationType | undefined)) ??\n lazyContext.any.application()\n const args = (methodArgs.args ?? []).map((x: DeliberateAny) => (x instanceof ItxnParams ? x.submit() : x))\n const { transactions, ...appCallArgs } = extractArraysFromArgs(app, asUint8Array(methodSelector), resourceEncoding, args)\n const { args: _, ...methodArgsFields } = methodArgs\n const fields = {\n ...methodArgsFields,\n ...appCallArgs,\n }\n return new ApplicationCallInnerTxnContext<TReturn>(fields, transactions)\n }\n /** @internal */\n static createFromBareCreateApplicationCallFields(methodArgs: BareCreateApplicationCallFields) {\n return new ApplicationCallInnerTxnContext(methodArgs)\n }\n\n #returnValue: TReturn | typeof UNSET = UNSET\n /**\n * Sets the return value for the application call.\n * @param value\n * @returns\n */\n setReturnValue(value: TReturn) {\n // Ignore undefined (void) values\n if (value === undefined) return\n this.appendLog(ABI_RETURN_VALUE_LOG_PREFIX.concat(encodeArc4(undefined, value)))\n this.#returnValue = value\n }\n /** @internal */\n get loggedReturnValue(): TReturn {\n return this.#returnValue === UNSET ? (undefined as TReturn) : this.#returnValue\n }\n\n override appendLog(value: BytesCompat) {\n /*\n As per https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0004.md#implementing-a-method\n If the method is non-void, the Application MUST encode the return value as described in the Encoding section and then log it with the\n prefix 151f7c75. Other values MAY be logged before the return value, but other values MUST NOT be logged after the return value.\n */\n invariant(this.#returnValue === UNSET, 'Cannot add logs after a return value has been set')\n super.appendLog(value)\n }\n\n /** @internal */\n private constructor(\n fields: ApplicationCallFields,\n public itxns?: Transaction[],\n ) {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