@algorandfoundation/algorand-typescript-testing 1.1.1-beta.3 → 1.2.0-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.
package/index.mjs CHANGED
@@ -8,7 +8,7 @@ export { A as AssertError, a as AvmError, C as CodeError, N as NotImplementedErr
8
8
  import { Address as Address$1 } from '@algorandfoundation/algorand-typescript/arc4';
9
9
  import { encodingUtil } from '@algorandfoundation/puya-ts';
10
10
  import { G as GlobalData, V as VoterData, B as BlockData, b as btoi } from './pure-BGAOjiS7.js';
11
- import { t as toUint8Array, A as Address, U as Uint, D as DynamicBytes, S as Str } from './asset-params-C64LPAdX.js';
11
+ import { t as toUint8Array, A as Address, U as Uint, D as DynamicBytes, S as Str, a as toBytes } from './asset-params-C64LPAdX.js';
12
12
  import { randomBytes } from 'crypto';
13
13
  import 'js-sha512';
14
14
  import 'assert';
@@ -1645,13 +1645,18 @@ class TestExecutionContext {
1645
1645
  * Executes a logic signature with the given arguments.
1646
1646
  *
1647
1647
  * @param {LogicSig} logicSig - The logic signature to execute.
1648
- * @param {...bytes[]} args - The arguments for the logic signature.
1648
+ * @param {...unknown[]} args - The arguments for the logic signature.
1649
1649
  * @returns {boolean | uint64}
1650
1650
  */
1651
1651
  executeLogicSig(logicSig, ...args) {
1652
- this.#activeLogicSigArgs = args;
1652
+ this.#activeLogicSigArgs = args.map((a) => toBytes(a));
1653
1653
  try {
1654
- return logicSig.program();
1654
+ if (logicSig.program.length === 0) {
1655
+ return logicSig.program();
1656
+ }
1657
+ else {
1658
+ return logicSig.program(...args);
1659
+ }
1655
1660
  }
1656
1661
  finally {
1657
1662
  this.#activeLogicSigArgs = [];
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/application-spy.ts","../src/set-up.ts","../src/subcontexts/ledger-context.ts","../src/decode-logs.ts","../src/subcontexts/transaction-context.ts","../src/value-generators/avm.ts","../src/value-generators/arc4.ts","../src/value-generators/txn.ts","../src/value-generators/index.ts","../src/test-execution-context.ts"],"sourcesContent":["import type { bytes, Contract } from '@algorandfoundation/algorand-typescript'\nimport { OnCompleteAction } from '@algorandfoundation/algorand-typescript'\nimport { getContractMethodAbiMetadata } from './abi-metadata'\nimport type { ApplicationCallInnerTxnContext } from './impl/inner-transactions'\nimport { methodSelector } from './impl/method-selector'\nimport type { AnyFunction, ConstructorFor } from './typescript-helpers'\nimport { asNumber } from './util'\n\nexport type AppSpyCb = (itxnContext: ApplicationCallInnerTxnContext) => void\n\nconst predicates = {\n bareCall: (cb: AppSpyCb, ocas: OnCompleteAction[]): AppSpyCb => {\n return (ctx) => {\n if (asNumber(ctx.numAppArgs) === 0 && ocas.includes(ctx.onCompletion)) {\n cb(ctx as ApplicationCallInnerTxnContext)\n }\n }\n },\n methodSelector: (cb: AppSpyCb, selectorBytes: bytes, ocas: OnCompleteAction[]): AppSpyCb => {\n return (ctx) => {\n if (selectorBytes.equals(ctx.appArgs(0)) && ocas.includes(ctx.onCompletion)) {\n cb(ctx)\n }\n }\n },\n}\n\n/*\n * The `ApplicationSpy` class is a utility for testing Algorand smart contracts.\n * It allows you to spy on application calls and register callbacks for specific method signatures.\n *\n * @template TContract - The type of the contract being spied on.\n */\nexport class ApplicationSpy<TContract extends Contract = Contract> {\n #spyFns: AppSpyCb[] = []\n\n /**\n * The `on` property is a proxy that allows you to register callbacks for specific method signatures.\n * It dynamically creates methods based on the contract's methods.\n */\n readonly on: TypedApplicationSpyCallBacks<TContract>\n\n /** @internal */\n contract?: TContract | ConstructorFor<TContract>\n\n constructor(contract?: TContract | ConstructorFor<TContract>) {\n this.contract = contract\n this.on = this.createOnProxy()\n }\n\n /** @internal */\n notify(itxn: ApplicationCallInnerTxnContext) {\n for (const cb of this.#spyFns) {\n cb(itxn)\n }\n }\n\n /**\n * Registers a callback for a bare call (no arguments).\n * @param callback - The callback to be executed when a bare call is detected.\n */\n onBareCall(callback: AppSpyCb): void\n onBareCall(ocas: OnCompleteAction[], callback: AppSpyCb): void\n onBareCall(...args: [AppSpyCb] | [OnCompleteAction[], AppSpyCb]): void {\n let callback: AppSpyCb\n let ocas: OnCompleteAction[] = [OnCompleteAction.NoOp]\n if (args.length === 2) {\n ;[ocas, callback] = args\n } else {\n ;[callback] = args\n }\n this.#spyFns.push(predicates.bareCall(callback, ocas))\n }\n\n /**\n * Registers a callback for a specific method signature.\n * @param methodSignature\n * @param callback\n */\n onAbiCall(methodSignature: bytes, callback: AppSpyCb): void\n onAbiCall(methodSignature: bytes, ocas: OnCompleteAction[], callback: AppSpyCb): void\n onAbiCall(...args: [bytes, AppSpyCb] | [bytes, OnCompleteAction[], AppSpyCb]): void {\n let methodSignature: bytes\n let callback: AppSpyCb\n let ocas: OnCompleteAction[] = [OnCompleteAction.NoOp]\n if (args.length === 3) {\n ;[methodSignature, ocas, callback] = args\n } else {\n ;[methodSignature, callback] = args\n }\n this.#spyFns.push(predicates.methodSelector(callback, methodSignature, ocas))\n }\n\n private _tryGetMethod(name: string | symbol) {\n if (this.contract === undefined) return undefined\n if (typeof this.contract === 'function') {\n return this.contract.prototype[name]\n } else {\n return Reflect.get(this.contract, name)\n }\n }\n\n private createOnProxy(spy: ApplicationSpy<TContract> = this): TypedApplicationSpyCallBacks<TContract> {\n return new Proxy({} as TypedApplicationSpyCallBacks<TContract>, {\n get(_: TypedApplicationSpyCallBacks<TContract>, methodName) {\n const fn = spy._tryGetMethod(methodName)\n if (fn === undefined) return fn\n return function (callback: AppSpyCb) {\n let ocas: OnCompleteAction[] = [OnCompleteAction.NoOp]\n if (spy.contract !== undefined) {\n const metadata = getContractMethodAbiMetadata(spy.contract, methodName as string)\n ocas = metadata.allowActions?.map((action) => OnCompleteAction[action]) ?? [OnCompleteAction.NoOp]\n }\n\n const selector = methodSelector({ method: fn, contract: spy.contract })\n spy.onAbiCall(selector, ocas, callback)\n }\n },\n }) as TypedApplicationSpyCallBacks<TContract>\n }\n}\n\nexport type TypedApplicationSpyCallBacks<TContract> = {\n [key in keyof TContract as key extends 'approvalProgram' | 'clearStateProgram'\n ? never\n : TContract[key] extends AnyFunction\n ? key extends string\n ? key\n : never\n : never]: (callback: AppSpyCb) => void\n}\n","import { Address } from '@algorandfoundation/algorand-typescript/arc4'\nimport { encodingUtil } from '@algorandfoundation/puya-ts'\nimport { AlgoTsPrimitiveCls, BigUintCls, BytesCls, Uint64Cls } from './impl/primitives'\nimport { AccountCls, ApplicationCls, AssetCls } from './impl/reference'\n\ntype Tester = (this: TesterContext, a: unknown, b: unknown, customTesters: Array<Tester>) => boolean | undefined\ninterface TesterContext {\n equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean\n}\ninterface ExpectObj {\n addEqualityTesters: (testers: Array<Tester>) => void\n}\n\nfunction doAddEqualityTesters(expectObj: ExpectObj) {\n expectObj.addEqualityTesters([\n function IsSamePrimitiveTypeAndValue(this: TesterContext, subject, test, customTesters): boolean | undefined {\n const subjectIsPrimitive = subject instanceof AlgoTsPrimitiveCls\n const testIsPrimitive = test instanceof AlgoTsPrimitiveCls\n const isSamePrimitive = subjectIsPrimitive && test instanceof Object.getPrototypeOf(subject).constructor\n if (subjectIsPrimitive && testIsPrimitive) {\n if (!isSamePrimitive) return false\n return this.equals(subject.valueOf(), test.valueOf(), customTesters)\n }\n // Defer to other testers\n return undefined\n },\n function NumericPrimitiveIsNumericLiteral(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof Uint64Cls || subject instanceof BigUintCls) {\n const testValue = typeof test === 'bigint' ? test : typeof test === 'number' ? BigInt(test) : undefined\n if (testValue !== undefined) return this.equals(subject.valueOf(), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function NumericLiteralIsNumericPrimitive(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (typeof subject === 'bigint' || typeof subject === 'number') {\n const testValue = test instanceof Uint64Cls || test instanceof BigUintCls ? test.valueOf() : undefined\n if (testValue !== undefined) return this.equals(BigInt(subject), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function BytesPrimitiveIsUint8Array(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof BytesCls) {\n const testValue = test instanceof Uint8Array ? test : undefined\n if (testValue !== undefined) return this.equals(subject.asUint8Array(), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function BytesPrimitiveIsArray(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof BytesCls) {\n const testValue =\n Array.isArray(test) && test.every((i) => typeof i === 'number' && i >= 0 && i < 256) ? new Uint8Array(test) : undefined\n if (testValue !== undefined) return this.equals(subject.asUint8Array(), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function BytesPrimitiveIsString(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof BytesCls) {\n const testValue = typeof test === 'string' ? encodingUtil.utf8ToUint8Array(test) : undefined\n if (testValue !== undefined) return this.equals(subject.asUint8Array(), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function Uint8ArrayIsBytesPrimitive(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof Uint8Array) {\n const testValue = test instanceof BytesCls ? test : undefined\n if (testValue !== undefined) return this.equals(subject, testValue.asUint8Array(), customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AccountIsAddressStr(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof AccountCls) {\n const testValue = typeof test === 'string' ? encodingUtil.base32ToUint8Array(test).slice(0, 32) : undefined\n if (testValue !== undefined) return this.equals(subject.bytes, testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AccountIsAddressBytes(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof AccountCls) {\n const testValue = test instanceof BytesCls ? test.asUint8Array().slice(0, 32) : undefined\n if (testValue !== undefined) return this.equals(subject.bytes, testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AddressIsAccountStr(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof Address) {\n const testValue = typeof test === 'string' ? encodingUtil.base32ToUint8Array(test).slice(0, 32) : undefined\n if (testValue !== undefined) return this.equals(subject.native.bytes, testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AddressIsAccountBytes(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof Address) {\n const testValue = test instanceof BytesCls ? test.asUint8Array().slice(0, 32) : undefined\n if (testValue !== undefined) return this.equals(subject.native.bytes, testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AddressIsAccount(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof Address) {\n const testValue = test instanceof AccountCls ? test.bytes : undefined\n if (testValue !== undefined) return this.equals(subject.native.bytes, testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function BigIntIsNumber(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (typeof subject === 'bigint') {\n const testValue = typeof test === 'number' ? test : undefined\n if (testValue !== undefined) return this.equals(subject, BigInt(testValue), customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function NumberIsBigInt(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (typeof subject === 'number') {\n const testValue = typeof test === 'bigint' ? test : undefined\n if (testValue !== undefined) return this.equals(BigInt(subject), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AccountIsAccount(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof AccountCls) {\n const testValue = test instanceof AccountCls ? test : undefined\n if (testValue !== undefined) return this.equals(subject['data'], testValue['data'], customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function ApplicationIsApplication(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof ApplicationCls) {\n const testValue = test instanceof ApplicationCls ? test : undefined\n if (testValue !== undefined) return this.equals(subject['data'], testValue['data'], customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AssetIsAsset(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof AssetCls) {\n const testValue = test instanceof AssetCls ? test : undefined\n if (testValue !== undefined) return this.equals(subject['data'], testValue['data'], customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n ])\n}\n\n/**\n * Adds custom equality testers for Algorand types to vitest's expect function.\n * This allows vitest to properly compare Algorand types such as uint64, biguint, and bytes\n * against JS native types such as number, bigint and Uint8Array, in tests.\n *\n * @param {Object} params - The parameters object\n * @param {ExpectObj} params.expect - vitest's expect object to extend with custom equality testers\n *\n * @example\n * ```ts\n * import { beforeAll, expect } from 'vitest'\n * import { addEqualityTesters } from '@algorandfoundation/algorand-typescript-testing';\n *\n * beforeAll(() => {\n * addEqualityTesters({ expect });\n * });\n * ```\n *\n * @returns {void}\n */\nexport function addEqualityTesters({ expect }: { expect: ExpectObj }) {\n doAddEqualityTesters(expect)\n}\n","import type {\n Account as AccountType,\n Application as ApplicationType,\n Asset as AssetType,\n BaseContract,\n bytes,\n BytesCompat,\n LocalStateForAccount,\n uint64,\n Uint64Compat,\n} from '@algorandfoundation/algorand-typescript'\nimport { AccountMap, Uint64Map } from '../collections/custom-key-map'\nimport { MAX_UINT64 } from '../constants'\nimport { InternalError } from '../errors'\nimport { BlockData } from '../impl/block'\nimport { toUint8Array } from '../impl/encoded-types/encoded-types'\nimport { GlobalData } from '../impl/global'\nimport { Uint64Cls } from '../impl/primitives'\nimport type { AssetData } from '../impl/reference'\nimport {\n AccountCls,\n AccountData,\n Application,\n ApplicationCls,\n ApplicationData,\n Asset,\n AssetHolding,\n getDefaultAssetData,\n} from '../impl/reference'\nimport { GlobalStateCls, LocalStateCls } from '../impl/state'\nimport { VoterData } from '../impl/voter-params'\nimport type { PickPartial } from '../typescript-helpers'\nimport { asBigInt, asBytes, asMaybeBytesCls, asMaybeUint64Cls, asUint64, asUint64Cls, asUint8Array, iterBigInt } from '../util'\n\nexport class LedgerContext {\n /** @internal */\n appIdIter = iterBigInt(1001n, MAX_UINT64)\n /** @internal */\n assetIdIter = iterBigInt(1001n, MAX_UINT64)\n /** @internal */\n applicationDataMap = new Uint64Map<ApplicationData>()\n /** @internal */\n appIdContractMap = new Uint64Map<BaseContract>()\n /** @internal */\n accountDataMap = new AccountMap<AccountData>()\n /** @internal */\n assetDataMap = new Uint64Map<AssetData>()\n /** @internal */\n voterDataMap = new AccountMap<VoterData>()\n /** @internal */\n blocks = new Uint64Map<BlockData>()\n /** @internal */\n globalData = new GlobalData()\n onlineStake = 0\n\n /**\n * Adds a contract to the application ID contract map.\n * @internal\n * @param appId - The application ID.\n * @param contract - The contract to add.\n */\n addAppIdContractMap(appId: Uint64Compat, contract: BaseContract): void {\n this.appIdContractMap.set(appId, contract)\n }\n\n /**\n * Retrieves an account by address.\n * @param address - The account address.\n * @returns The account.\n */\n getAccount(address: AccountType | BytesCompat): AccountType {\n return new AccountCls(address instanceof AccountCls ? address.bytes : asBytes(address as BytesCompat))\n }\n\n /**\n * Retrieves an asset by asset ID.\n * @param assetId - The asset ID.\n * @returns The asset.\n * @throws If the asset is unknown.\n */\n getAsset(assetId: Uint64Compat): AssetType {\n if (this.assetDataMap.has(assetId)) {\n return Asset(asUint64(assetId))\n }\n throw new InternalError('Unknown asset, check correct testing context is active')\n }\n\n /**\n * Retrieves an application by application ID.\n * @param applicationId - The application ID.\n * @returns The application.\n * @throws If the application is unknown.\n */\n getApplication(applicationId: Uint64Compat): ApplicationType {\n if (this.applicationDataMap.has(applicationId)) {\n return Application(asUint64(applicationId))\n }\n throw new InternalError('Unknown application, check correct testing context is active')\n }\n\n /**\n * Retrieves an application for a given contract.\n * @param contract - The contract.\n * @returns The application.\n * @throws If the contract is unknown.\n */\n getApplicationForContract(contract: BaseContract): ApplicationType {\n for (const [appId, c] of this.appIdContractMap) {\n if (c === contract) {\n if (this.applicationDataMap.has(appId)) {\n return Application(asUint64(appId))\n }\n }\n }\n throw new InternalError('Unknown contract, check correct testing context is active')\n }\n\n /**\n * Retrieves an application for a given approval program.\n * @param approvalProgram - The approval program.\n * @returns The application or undefined if not found.\n */\n getApplicationForApprovalProgram(approvalProgram: bytes | readonly bytes[] | undefined): ApplicationType | undefined {\n if (approvalProgram === undefined) {\n return undefined\n }\n const entries = this.applicationDataMap.entries()\n let next = entries.next()\n let found = false\n while (!next.done && !found) {\n found = next.value[1].application.approvalProgram === approvalProgram\n if (!found) {\n next = entries.next()\n }\n }\n if (found && next?.value) {\n const appId = asUint64(next.value[0])\n if (this.applicationDataMap.has(appId)) {\n return Application(appId)\n }\n }\n return undefined\n }\n\n /**\n * Update asset holdings for account, only specified values will be updated.\n * AccountType will also be opted-in to asset\n * @param account\n * @param assetId\n * @param balance\n * @param frozen\n */\n updateAssetHolding(account: AccountType, assetId: Uint64Compat | AssetType, balance?: Uint64Compat, frozen?: boolean): void {\n const id = (asMaybeUint64Cls(assetId) ?? asUint64Cls((assetId as AssetType).id)).asAlgoTs()\n const accountData = this.accountDataMap.get(account)!\n const asset = this.assetDataMap.get(id)!\n const holding = accountData.optedAssets.get(id) ?? new AssetHolding(0n, asset.defaultFrozen)\n if (balance !== undefined) holding.balance = asUint64(balance)\n if (frozen !== undefined) holding.frozen = frozen\n accountData.optedAssets.set(id, holding)\n }\n\n /**\n * Patches global data with the provided partial data.\n * @param data - The partial global data.\n */\n patchGlobalData(data: Partial<GlobalData>) {\n this.globalData = {\n ...this.globalData,\n ...data,\n }\n }\n\n /**\n * Patches account data with the provided partial data.\n * @param account - The account.\n * @param data - The partial account data.\n */\n patchAccountData(account: AccountType, data: Partial<Omit<AccountData, 'account'>> & Partial<PickPartial<AccountData, 'account'>>): void {\n const accountData = this.accountDataMap.get(account) ?? new AccountData()\n this.accountDataMap.set(account, {\n ...accountData,\n ...data,\n account: {\n ...accountData.account,\n ...data.account,\n },\n })\n }\n\n /**\n * Patches application data with the provided partial data.\n * @param app - The application.\n * @param data - The partial application data.\n */\n patchApplicationData(\n app: ApplicationType,\n data: Partial<Omit<ApplicationData, 'application'>> & Partial<PickPartial<ApplicationData, 'application'>>,\n ): void {\n const applicationData = this.applicationDataMap.get(app.id) ?? new ApplicationData()\n this.applicationDataMap.set(app.id, {\n ...applicationData,\n ...data,\n application: {\n ...applicationData.application,\n ...data.application,\n },\n })\n }\n\n /**\n * Patches asset data with the provided partial data.\n * @param asset - The asset.\n * @param data - The partial asset data.\n */\n patchAssetData(asset: AssetType, data: Partial<AssetData>) {\n const assetData = this.assetDataMap.get(asset.id) ?? getDefaultAssetData()\n this.assetDataMap.set(asset.id, {\n ...assetData,\n ...data,\n })\n }\n\n /**\n * Patches voter data with the provided partial data.\n * @param account - The account.\n * @param data - The partial voter data.\n */\n patchVoterData(account: AccountType, data: Partial<VoterData>) {\n const voterData = this.voterDataMap.get(account) ?? new VoterData()\n this.voterDataMap.set(account, {\n ...voterData,\n ...data,\n })\n }\n\n /**\n * Patches block data with the provided partial data.\n * @param index - The block index.\n * @param data - The partial block data.\n */\n patchBlockData(index: Uint64Compat, data: Partial<BlockData>): void {\n const i = asUint64(index)\n const blockData = this.blocks.get(i) ?? new BlockData()\n this.blocks.set(i, {\n ...blockData,\n ...data,\n })\n }\n\n /**\n * Retrieves block data by index.\n * @param index - The block index.\n * @returns The block data.\n * @throws If the block is not set.\n */\n getBlockData(index: Uint64Compat): BlockData {\n const i = asBigInt(index)\n if (this.blocks.has(i)) {\n return this.blocks.get(i)!\n }\n throw new InternalError(`Block ${i} not set`)\n }\n\n /**\n * Retrieves global state for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @returns The global state and a boolean indicating if it was found.\n */\n getGlobalState(app: ApplicationType | BaseContract, key: BytesCompat): [GlobalStateCls<unknown>, true] | [undefined, false] {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.get(appId)\n if (!appData?.application.globalStates.has(key)) {\n return [undefined, false]\n }\n return [appData.application.globalStates.getOrFail(key), true]\n }\n\n /**\n * Sets global state for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @param value - The value (optional).\n */\n setGlobalState(app: ApplicationType | BaseContract, key: BytesCompat, value: Uint64Compat | BytesCompat | undefined): void {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n const globalState = appData.application.globalStates.get(key)\n if (value === undefined) {\n globalState?.delete()\n } else if (globalState === undefined) {\n appData.application.globalStates.set(key, new GlobalStateCls(asBytes(key), asMaybeUint64Cls(value) ?? asMaybeBytesCls(value)))\n } else {\n globalState.value = asMaybeUint64Cls(value) ?? asMaybeBytesCls(value)\n }\n }\n\n /**\n * Retrieves local state for an application and account by key.\n * @param app - The application.\n * @param account - The account.\n * @param key - The key.\n * @returns The local state and a boolean indicating if it was found.\n */\n getLocalState(\n app: ApplicationType | BaseContract | uint64,\n account: AccountType,\n key: BytesCompat,\n ): [LocalStateForAccount<unknown>, true] | [undefined, false] {\n const appId = app instanceof Uint64Cls ? app.asAlgoTs() : this.getAppId(app as ApplicationType | BaseContract)\n const appData = this.applicationDataMap.get(appId)\n if (!appData?.application.localStates.has(key)) {\n return [undefined, false]\n }\n const localState = appData.application.localStateMaps.getOrFail(key)\n const accountLocalState = localState.get(account)\n return [accountLocalState as LocalStateForAccount<unknown>, true]\n }\n\n /**\n * Sets local state for an application and account by key.\n * @param app - The application.\n * @param account - The account.\n * @param key - The key.\n * @param value - The value (optional).\n */\n setLocalState<T>(app: ApplicationType | BaseContract | uint64, account: AccountType, key: BytesCompat, value: T | undefined): void {\n const appId = app instanceof Uint64Cls ? app.asAlgoTs() : this.getAppId(app as ApplicationType | BaseContract)\n const appData = this.applicationDataMap.getOrFail(appId)\n if (!appData.application.localStateMaps.has(key)) {\n appData.application.localStateMaps.set(key, new AccountMap())\n }\n const localState = appData.application.localStateMaps.getOrFail(key)\n if (!localState.has(account)) {\n localState.set(account, new LocalStateCls())\n }\n const accountLocalState = localState.getOrFail(account)\n if (value === undefined) {\n accountLocalState.delete()\n } else {\n accountLocalState.value = asMaybeUint64Cls(value) ?? asMaybeBytesCls(value)\n }\n }\n\n /**\n * Retrieves a box for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @returns The box data.\n */\n getBox(app: ApplicationType | BaseContract, key: BytesCompat): Uint8Array {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n const materialised = appData.application.materialisedBoxes.get(key)\n if (materialised !== undefined) {\n const uint8ArrayValue = toUint8Array(materialised)\n appData.application.boxes.set(key, uint8ArrayValue)\n appData.application.materialisedBoxes.set(key, undefined)\n }\n return appData.application.boxes.get(key) ?? new Uint8Array()\n }\n\n /**\n * Retrieves a materialised box for an application by key.\n * @internal\n * @param app - The application.\n * @param key - The key.\n * @returns The materialised box data if exists or undefined.\n */\n getMaterialisedBox<T>(app: ApplicationType | BaseContract, key: BytesCompat): T | undefined {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n return appData.application.materialisedBoxes.get(key) as T | undefined\n }\n\n /**\n * Sets a box for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @param value - The box data.\n */\n setBox(app: ApplicationType | BaseContract, key: BytesCompat, value: BytesCompat | Uint8Array): void {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n const uint8ArrayValue = value instanceof Uint8Array ? value : asUint8Array(value)\n appData.application.boxes.set(key, uint8ArrayValue)\n appData.application.materialisedBoxes.set(key, undefined)\n }\n\n /**\n\n * Cache the materialised box for an application by key.\n* @internal\n * @param app - The application.\n * @param key - The key.\n * @param value - The box data.\n */\n setMaterialisedBox<TValue>(app: ApplicationType | BaseContract, key: BytesCompat, value: TValue | undefined): void {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n appData.application.materialisedBoxes.set(key, value)\n }\n\n /**\n * Deletes a box for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @returns True if the box was deleted, false otherwise.\n */\n deleteBox(app: ApplicationType | BaseContract, key: BytesCompat): boolean {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n appData.application.materialisedBoxes.delete(key)\n return appData.application.boxes.delete(key)\n }\n\n /**\n * Checks if a box exists for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @returns True if the box exists, false otherwise.\n */\n boxExists(app: ApplicationType | BaseContract, key: BytesCompat): boolean {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n return appData.application.boxes.has(key)\n }\n\n /** @internal */\n private getAppId(app: ApplicationType | BaseContract): uint64 {\n return app instanceof ApplicationCls ? app.id : this.getApplicationForContract(app as BaseContract).id\n }\n}\n","import type { bytes } from '@algorandfoundation/algorand-typescript'\nimport { ABI_RETURN_VALUE_LOG_PREFIX } from './constants'\nimport { btoi } from './impl/pure'\nimport { asNumber } from './util'\n\nexport type LogDecoding = 'i' | 's' | 'b'\nexport type DecodedLog<T extends LogDecoding> = T extends 'i' ? bigint : T extends 's' ? string : Uint8Array\nexport type DecodedLogs<T extends [...LogDecoding[]]> = {\n [Index in keyof T]: DecodedLog<T[Index]>\n} & { length: T['length'] }\n\nconst ABI_RETURN_VALUE_LOG_PREFIX_LENGTH = asNumber(ABI_RETURN_VALUE_LOG_PREFIX.length)\n/** @internal */\nexport function decodeLogs<const T extends [...LogDecoding[]]>(logs: bytes[], decoding: T): DecodedLogs<T> {\n return logs.map((log, i) => {\n const value = log.slice(0, ABI_RETURN_VALUE_LOG_PREFIX_LENGTH).equals(ABI_RETURN_VALUE_LOG_PREFIX)\n ? log.slice(ABI_RETURN_VALUE_LOG_PREFIX_LENGTH)\n : log\n switch (decoding[i]) {\n case 'i':\n return btoi(value)\n case 's':\n return value.toString()\n default:\n return value\n }\n }) as DecodedLogs<T>\n}\n","import type { bytes, Contract, uint64, Uint64Compat } from '@algorandfoundation/algorand-typescript'\nimport { OnCompleteAction, TransactionType } from '@algorandfoundation/algorand-typescript'\nimport { getContractAbiMetadata, type AbiMetadata } from '../abi-metadata'\nimport { TRANSACTION_GROUP_MAX_SIZE } from '../constants'\nimport { checkRoutingConditions } from '../context-helpers/context-util'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport type { DecodedLogs, LogDecoding } from '../decode-logs'\nimport { decodeLogs } from '../decode-logs'\nimport { InternalError, invariant } from '../errors'\nimport type {\n ApplicationCallInnerTxn,\n AssetConfigInnerTxn,\n AssetFreezeInnerTxn,\n AssetTransferInnerTxn,\n KeyRegistrationInnerTxn,\n PaymentInnerTxn,\n} from '../impl/inner-transactions'\nimport { ApplicationCallInnerTxnContext, createInnerTxn, ItxnParams } from '../impl/inner-transactions'\nimport type { InnerTxn, InnerTxnFields } from '../impl/itxn'\nimport type { StubBytesCompat } from '../impl/primitives'\nimport type {\n AllTransactionFields,\n ApplicationCallTransaction,\n AssetConfigTransaction,\n AssetFreezeTransaction,\n AssetTransferTransaction,\n KeyRegistrationTransaction,\n PaymentTransaction,\n Transaction,\n} from '../impl/transactions'\nimport type { DeliberateAny, FunctionKeys } from '../typescript-helpers'\nimport { asBigInt, asNumber, asUint64 } from '../util'\nimport { ContractContext } from './contract-context'\n\nfunction ScopeGenerator(dispose: () => void) {\n function* internal() {\n try {\n yield\n } finally {\n dispose()\n }\n }\n const scope = internal()\n scope.next()\n return {\n done: () => {\n scope.return()\n },\n }\n}\n\ninterface ExecutionScope {\n execute: <TReturn>(body: () => TReturn) => TReturn\n}\n\n/**\n * Represents a deferred application call.\n */\nexport class DeferredAppCall<TParams extends unknown[], TReturn> {\n /** @internal */\n constructor(\n /** @internal */\n private readonly appId: uint64,\n /** @internal */\n readonly txns: Transaction[],\n /** @internal */\n private readonly method: (...args: TParams) => TReturn,\n /** @internal */\n private readonly abiMetadata: AbiMetadata,\n /** @internal */\n private readonly args: TParams,\n ) {}\n\n /**\n * Submits the deferred application call.\n * @returns The result of the application call.\n */\n submit(): TReturn {\n checkRoutingConditions(this.appId, this.abiMetadata)\n return this.method(...this.args)\n }\n}\n\n/**\n * Manages transaction contexts and groups.\n */\nexport class TransactionContext {\n readonly groups: TransactionGroup[] = []\n #activeGroup: TransactionGroup | undefined\n\n /**\n * Creates a new execution scope for a group of transactions.\n * @param group The group of transactions or deferred application calls.\n * @param activeTransactionIndex The index of the active transaction.\n * @returns The execution scope.\n */\n createScope(\n group: Array<Transaction | DeferredAppCall<DeliberateAny[], DeliberateAny>>,\n activeTransactionIndex?: number,\n ): ExecutionScope {\n let activeIndex = activeTransactionIndex\n const transactions = group.map((t) => (t instanceof DeferredAppCall ? t.txns : [t])).flat()\n if (activeIndex === undefined) {\n const lastAppCall = group\n .filter((t) => t instanceof DeferredAppCall)\n .at(-1)\n ?.txns.at(-1)\n if (lastAppCall) {\n activeIndex = transactions.indexOf(lastAppCall)\n }\n }\n const transactionGroup = new TransactionGroup(transactions, activeIndex)\n\n this.#activeGroup = transactionGroup\n\n const scope = ScopeGenerator(() => {\n if (this.#activeGroup?.transactions?.length) {\n this.groups.push(this.#activeGroup)\n }\n this.#activeGroup = undefined\n })\n return {\n execute: <TReturn>(body: () => TReturn) => {\n const result = body()\n scope.done()\n return result\n },\n }\n }\n\n /**\n * Ensures that a scope is created for the given group of transactions.\n * @internal\n * @param group The group of transactions.\n * @param activeTransactionIndex The index of the active transaction.\n * @returns The execution scope.\n */\n ensureScope(group: Transaction[], activeTransactionIndex?: number): ExecutionScope {\n if (!this.#activeGroup || !this.#activeGroup.transactions.length) {\n return this.createScope(group, activeTransactionIndex)\n }\n return {\n execute: <TReturn>(body: () => TReturn) => {\n return body()\n },\n }\n }\n\n get hasActiveGroup(): boolean {\n return !!this.#activeGroup\n }\n\n /**\n * Gets the active transaction group.\n * @returns The active transaction group.\n * @throws If there is no active transaction group.\n */\n get activeGroup(): TransactionGroup {\n if (this.#activeGroup) {\n return this.#activeGroup\n }\n throw new InternalError('no active txn group')\n }\n\n /**\n * Gets the last transaction group.\n * @returns The last transaction group.\n * @throws If there are no transaction groups.\n */\n get lastGroup(): TransactionGroup {\n if (this.groups.length === 0) {\n throw new InternalError('No group transactions found!')\n }\n return this.groups.at(-1)!\n }\n\n /**\n * Gets the last active transaction.\n * @returns The last active transaction.\n */\n get lastActive(): Transaction {\n return this.lastGroup.activeTransaction\n }\n\n /**\n * Appends a log to the active transaction.\n * @internal\n * @param value The log value.\n * @throws If the active transaction is not an application call.\n */\n appendLog(value: StubBytesCompat): void {\n const activeTransaction = this.activeGroup.activeTransaction\n if (activeTransaction.type !== TransactionType.ApplicationCall) {\n throw new InternalError('Can only add logs to ApplicationCallTransaction!')\n }\n activeTransaction.appendLog(value)\n }\n\n /**\n * Defers an application call.\n * @param contract The contract.\n * @param method The method to call.\n * @param methodName The name of the method.\n * @param args The arguments for the method.\n * @returns The deferred application call.\n */\n deferAppCall<TContract extends Contract, TParams extends unknown[], TReturn>(\n contract: TContract,\n method: (...args: TParams) => TReturn,\n methodName: FunctionKeys<TContract>,\n ...args: TParams\n ): DeferredAppCall<TParams, TReturn> {\n const appId = lazyContext.ledger.getApplicationForContract(contract)\n const abiMetadata = getContractAbiMetadata(contract)[methodName as string]\n const txns = ContractContext.createMethodCallTxns(contract, abiMetadata, ...args)\n return new DeferredAppCall(appId.id, txns, method, abiMetadata, args)\n }\n\n /**\n * Exports logs for the given application ID.\n * @param appId The application ID.\n * @param decoding The log decoding.\n * @returns The decoded logs.\n */\n exportLogs<const T extends [...LogDecoding[]]>(appId: uint64, ...decoding: T): DecodedLogs<T> {\n const transaction = this.lastGroup.transactions\n .filter((t) => t.type === TransactionType.ApplicationCall)\n .find((t) => asBigInt(t.appId.id) === asBigInt(appId))\n let logs = []\n if (transaction) {\n logs = transaction.appLogs\n } else {\n logs = lazyContext.getApplicationData(appId).application.appLogs\n }\n\n return decodeLogs(logs, decoding)\n }\n}\n\n/**\n * Represents a group of transactions.\n */\nexport class TransactionGroup {\n latestTimestamp: number\n transactions: Transaction[]\n itxnGroups: ItxnGroup[] = []\n /** @internal */\n activeTransactionIndex: number\n /** @internal */\n constructingItxnGroup: InnerTxnFields[] = []\n\n /** @internal */\n constructor(transactions: Transaction[], activeTransactionIndex?: number) {\n this.latestTimestamp = Date.now()\n if (transactions.length > TRANSACTION_GROUP_MAX_SIZE) {\n throw new InternalError(`Transaction group can have at most ${TRANSACTION_GROUP_MAX_SIZE} transactions, as per AVM limits.`)\n }\n transactions.forEach((txn, index) => Object.assign(txn, { groupIndex: asUint64(index) }))\n this.activeTransactionIndex = activeTransactionIndex === undefined ? transactions.length - 1 : activeTransactionIndex\n this.transactions = transactions\n }\n\n /**\n * Gets the active transaction.\n * @returns The active transaction.\n */\n get activeTransaction() {\n return this.transactions[this.activeTransactionIndex]\n }\n\n /**\n * Gets the active application ID.\n * @returns The active application ID.\n * @throws If there are no transactions in the group or the active transaction is not an application call.\n */\n get activeApplicationId() {\n // this should return the true app_id and not 0 if the app is in the creation phase\n if (this.transactions.length === 0) {\n throw new InternalError('No transactions in the group')\n }\n invariant(this.activeTransaction.type === TransactionType.ApplicationCall, 'No app_id found in the active transaction')\n return (this.activeTransaction as ApplicationCallTransaction).backingAppId.id\n }\n\n /* @internal */\n get constructingItxn() {\n if (!this.constructingItxnGroup.length) {\n throw new InternalError('itxn field without itxn begin')\n }\n return this.constructingItxnGroup.at(-1)!\n }\n\n /**\n * Gets the scratch space of the active transaction.\n * @returns The scratch space.\n */\n getScratchSpace() {\n return this.activeTransaction.scratchSpace\n }\n\n /**\n * Gets the scratch slot of the active transaction.\n * @param index The index of the scratch slot.\n * @returns The scratch slot value.\n */\n getScratchSlot(index: Uint64Compat): bytes | uint64 {\n return this.activeTransaction.getScratchSlot(index)\n }\n\n /**\n * Patches the fields of the active transaction.\n * @param fields The fields to patch.\n */\n patchActiveTransactionFields(fields: AllTransactionFields) {\n const activeTransaction = this.activeTransaction as unknown as AllTransactionFields\n const filteredFields = Object.fromEntries(Object.entries(fields).filter(([_, value]) => value !== undefined))\n Object.assign(activeTransaction, filteredFields)\n }\n\n /**\n * Adds a group of inner transactions.\n * @internal\n * @param itxns The inner transactions.\n */\n addInnerTransactionGroup(...itxns: InnerTxn[]) {\n this.itxnGroups.push(new ItxnGroup(itxns))\n }\n\n /**\n * Begins a new inner transaction group.\n * @internal\n * @throws If there is already an inner transaction group being constructed or the active transaction is not an application call.\n */\n beginInnerTransactionGroup() {\n if (this.constructingItxnGroup.length) {\n throw new InternalError('itxn begin without itxn submit')\n }\n invariant(this.activeTransaction.type === TransactionType.ApplicationCall, 'No active application call transaction')\n if (this.activeTransaction.onCompletion === OnCompleteAction.ClearState) {\n throw new InternalError('Cannot begin inner transaction group in a clear state call')\n }\n this.constructingItxnGroup.push({} as InnerTxnFields)\n }\n\n /**\n * Appends a new inner transaction to the current group.\n * @internal\n * @throws If there is no inner transaction group being constructed.\n */\n appendInnerTransactionGroup() {\n if (!this.constructingItxnGroup.length) {\n throw new InternalError('itxn next without itxn begin')\n }\n this.constructingItxnGroup.push({ type: TransactionType.Payment } as InnerTxnFields)\n }\n\n /**\n * Submits the current inner transaction group.\n * @internal\n * @throws If there is no inner transaction group being constructed or the group exceeds the maximum size.\n */\n submitInnerTransactionGroup() {\n if (!this.constructingItxnGroup.length) {\n throw new InternalError('itxn submit without itxn begin')\n }\n if (this.constructingItxnGroup.length > TRANSACTION_GROUP_MAX_SIZE) {\n throw new InternalError(`Cannot submit more than ${TRANSACTION_GROUP_MAX_SIZE} inner transactions at once`)\n }\n const itxns = this.constructingItxnGroup.flatMap((t) =>\n t instanceof ApplicationCallInnerTxnContext\n ? [...(t.itxns ?? []), t]\n : t instanceof ItxnParams\n ? t.createInnerTxns()\n : [createInnerTxn(t)],\n )\n itxns.forEach((itxn, index) => Object.assign(itxn, { groupIndex: asUint64(index) }))\n for (const itxn of itxns) {\n if (itxn instanceof ApplicationCallInnerTxnContext) {\n lazyContext.value.notifyApplicationSpies(itxn)\n }\n }\n this.itxnGroups.push(new ItxnGroup(itxns))\n this.constructingItxnGroup = []\n }\n\n /**\n * Gets the last inner transaction group.\n * @returns The last inner transaction group.\n */\n lastItxnGroup() {\n return this.getItxnGroup()\n }\n\n /**\n * Gets an inner transaction group by index.\n * @param index The index of the group. If not provided, the last group is returned.\n * @returns The inner transaction group.\n * @throws If the index is invalid or there are no previous inner transactions.\n */\n getItxnGroup(index?: Uint64Compat): ItxnGroup {\n const i = index !== undefined ? asNumber(index) : undefined\n\n invariant(this.itxnGroups.length > 0, 'no previous inner transactions')\n if (i !== undefined && i >= this.itxnGroups.length) {\n throw new InternalError('Invalid group index')\n }\n const group = i !== undefined ? this.itxnGroups[i] : this.itxnGroups.at(-1)!\n invariant(group.itxns.length > 0, 'no previous inner transactions')\n\n return group\n }\n\n /**\n * Gets an application transaction by index.\n * @param index The index of the transaction.\n * @returns The application transaction.\n */\n getApplicationCallTransaction(index?: Uint64Compat): ApplicationCallTransaction {\n return this._getTransaction({ type: TransactionType.ApplicationCall, index }) as ApplicationCallTransaction\n }\n\n /**\n * Gets an asset configuration transaction by index.\n * @param index The index of the transaction.\n * @returns The asset configuration transaction.\n */\n getAssetConfigTransaction(index?: Uint64Compat): AssetConfigTransaction {\n return this._getTransaction({ type: TransactionType.AssetConfig, index }) as AssetConfigTransaction\n }\n\n /**\n * Gets an asset transfer transaction by index.\n * @param index The index of the transaction.\n * @returns The asset transfer transaction.\n */\n getAssetTransferTransaction(index?: Uint64Compat): AssetTransferTransaction {\n return this._getTransaction({ type: TransactionType.AssetTransfer, index }) as AssetTransferTransaction\n }\n\n /**\n * Gets an asset freeze transaction by index.\n * @param index The index of the transaction.\n * @returns The asset freeze transaction.\n */\n getAssetFreezeTransaction(index?: Uint64Compat): AssetFreezeTransaction {\n return this._getTransaction({ type: TransactionType.AssetFreeze, index }) as AssetFreezeTransaction\n }\n\n /**\n * Gets a key registration transaction by index.\n * @param index The index of the transaction.\n * @returns The key registration transaction.\n */\n getKeyRegistrationTransaction(index?: Uint64Compat): KeyRegistrationTransaction {\n return this._getTransaction({ type: TransactionType.KeyRegistration, index }) as KeyRegistrationTransaction\n }\n\n /**\n * Gets a payment transaction by index.\n * @param index The index of the transaction.\n * @returns The payment transaction.\n */\n getPaymentTransaction(index?: Uint64Compat): PaymentTransaction {\n return this._getTransaction({ type: TransactionType.Payment, index }) as PaymentTransaction\n }\n\n /**\n * Gets a transaction by index.\n * @param index The index of the transaction.\n * @returns The transaction.\n */\n getTransaction(index?: Uint64Compat): Transaction {\n return this._getTransaction({ index })\n }\n /** @internal */\n private _getTransaction({ type, index }: { type?: TransactionType; index?: Uint64Compat }) {\n const i = index !== undefined ? asNumber(index) : undefined\n if (i !== undefined && i >= lazyContext.activeGroup.transactions.length) {\n throw new InternalError('Invalid group index')\n }\n const transaction = i !== undefined ? lazyContext.activeGroup.transactions[i] : lazyContext.activeGroup.activeTransaction\n if (type === undefined) {\n return transaction\n }\n if (transaction.type !== type) {\n throw new InternalError(`Invalid transaction type: ${transaction.type}`)\n }\n switch (type) {\n case TransactionType.ApplicationCall:\n return transaction as ApplicationCallTransaction\n case TransactionType.Payment:\n return transaction as PaymentTransaction\n case TransactionType.AssetConfig:\n return transaction as AssetConfigTransaction\n case TransactionType.AssetTransfer:\n return transaction as AssetTransferTransaction\n case TransactionType.AssetFreeze:\n return transaction as AssetFreezeTransaction\n case TransactionType.KeyRegistration:\n return transaction as KeyRegistrationTransaction\n default:\n throw new InternalError(`Invalid transaction type: ${type}`)\n }\n }\n}\n\n/**\n * Represents a group of inner transactions.\n */\nexport class ItxnGroup {\n itxns: InnerTxn[] = []\n /** @internal */\n constructor(itxns: InnerTxn[]) {\n this.itxns = itxns\n }\n\n /**\n * Gets an application inner transaction by index.\n * @param index The index of the transaction.\n * @returns The application inner transaction.\n */\n getApplicationCallInnerTxn(index?: Uint64Compat): ApplicationCallInnerTxn {\n return this._getInnerTxn({ type: TransactionType.ApplicationCall, index }) as ApplicationCallInnerTxn\n }\n\n /**\n * Gets an asset configuration inner transaction by index.\n * @param index The index of the transaction.\n * @returns The asset configuration inner transaction.\n */\n getAssetConfigInnerTxn(index?: Uint64Compat): AssetConfigInnerTxn {\n return this._getInnerTxn({ type: TransactionType.AssetConfig, index }) as AssetConfigInnerTxn\n }\n\n /**\n * Gets an asset transfer inner transaction by index.\n * @param index The index of the transaction.\n * @returns The asset transfer inner transaction.\n */\n getAssetTransferInnerTxn(index?: Uint64Compat): AssetTransferInnerTxn {\n return this._getInnerTxn({ type: TransactionType.AssetTransfer, index }) as AssetTransferInnerTxn\n }\n\n /**\n * Gets an asset freeze inner transaction by index.\n * @param index The index of the transaction.\n * @returns The asset freeze inner transaction.\n */\n getAssetFreezeInnerTxn(index?: Uint64Compat): AssetFreezeInnerTxn {\n return this._getInnerTxn({ type: TransactionType.AssetFreeze, index }) as AssetFreezeInnerTxn\n }\n\n /**\n * Gets a key registration inner transaction by index.\n * @param index The index of the transaction.\n * @returns The key registration inner transaction.\n */\n getKeyRegistrationInnerTxn(index?: Uint64Compat): KeyRegistrationInnerTxn {\n return this._getInnerTxn({ type: TransactionType.KeyRegistration, index }) as KeyRegistrationInnerTxn\n }\n\n /**\n * Gets a payment inner transaction by index.\n * @param index The index of the transaction.\n * @returns The payment inner transaction.\n */\n getPaymentInnerTxn(index?: Uint64Compat): PaymentInnerTxn {\n return this._getInnerTxn({ type: TransactionType.Payment, index }) as PaymentInnerTxn\n }\n\n /**\n * Gets an inner transaction by index.\n * @param index The index of the transaction.\n * @returns The inner transaction.\n */\n getInnerTxn(index?: Uint64Compat): InnerTxn {\n return this._getInnerTxn({ index })\n }\n\n /** @internal */\n private _getInnerTxn({ type, index }: { type?: TransactionType; index?: Uint64Compat }) {\n invariant(this.itxns.length > 0, 'no previous inner transactions')\n const i = index !== undefined ? asNumber(index) : undefined\n if (i !== undefined && i >= this.itxns.length) {\n throw new InternalError('Invalid group index')\n }\n const transaction = i !== undefined ? this.itxns[i] : this.itxns.at(-1)!\n if (type === undefined) {\n return transaction\n }\n if (transaction.type !== type) {\n throw new InternalError(`Invalid transaction type: ${transaction.type}`)\n }\n switch (type) {\n case TransactionType.ApplicationCall:\n return transaction as ApplicationCallInnerTxn\n case TransactionType.Payment:\n return transaction as PaymentInnerTxn\n case TransactionType.AssetConfig:\n return transaction as AssetConfigInnerTxn\n case TransactionType.AssetTransfer:\n return transaction as AssetTransferInnerTxn\n case TransactionType.AssetFreeze:\n return transaction as AssetFreezeInnerTxn\n case TransactionType.KeyRegistration:\n return transaction as KeyRegistrationInnerTxn\n default:\n throw new InternalError(`Invalid transaction type: ${type}`)\n }\n }\n}\n","import type {\n Account as AccountType,\n Application as ApplicationType,\n Asset as AssetType,\n biguint,\n BigUintCompat,\n bytes,\n uint64,\n Uint64Compat,\n} from '@algorandfoundation/algorand-typescript'\nimport { randomBytes } from 'crypto'\nimport { MAX_BYTES_SIZE, MAX_UINT512, MAX_UINT64 } from '../constants'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { InternalError } from '../errors'\nimport { BigUint, Bytes, Uint64 } from '../impl/primitives'\nimport type { AssetData } from '../impl/reference'\nimport { Account, AccountData, ApplicationCls, ApplicationData, AssetCls, getDefaultAssetData } from '../impl/reference'\nimport { asBigInt, asBigUintCls, asUint64, asUint64Cls, getRandomBigInt, getRandomBytes } from '../util'\n\ntype AccountContextData = Partial<AccountData['account']> & {\n address?: bytes\n incentiveEligible?: boolean\n lastProposed?: uint64\n lastHeartbeat?: uint64\n optedAssetBalances?: Map<Uint64Compat, Uint64Compat>\n optedApplications?: ApplicationType[]\n}\n\ntype AssetContextData = Partial<AssetData> & { assetId?: Uint64Compat }\n\ntype ApplicationContextData = Partial<ApplicationData['application']> & { applicationId?: Uint64Compat }\n\nexport class AvmValueGenerator {\n /**\n * Generates a random uint64 value within the specified range.\n * @param {Uint64Compat} [minValue=0n] - The minimum value (inclusive).\n * @param {Uint64Compat} [maxValue=MAX_UINT64] - The maximum value (inclusive).\n * @returns {uint64} - A random uint64 value.\n */\n uint64(minValue: Uint64Compat = 0n, maxValue: Uint64Compat = MAX_UINT64): uint64 {\n const min = asBigInt(minValue)\n const max = asBigInt(maxValue)\n if (max > MAX_UINT64) {\n throw new InternalError('maxValue must be less than or equal to 2n ** 64n - 1n')\n }\n if (min > max) {\n throw new InternalError('minValue must be less than or equal to maxValue')\n }\n if (min < 0n || max < 0n) {\n throw new InternalError('minValue and maxValue must be greater than or equal to 0')\n }\n return Uint64(getRandomBigInt(min, max))\n }\n\n /**\n * Generates a random biguint value within the specified range.\n * @param {BigUintCompat} [minValue=0n] - The minimum value (inclusive).\n * @returns {biguint} - A random biguint value.\n */\n biguint(minValue: BigUintCompat = 0n): biguint {\n const min = asBigUintCls(minValue).asBigInt()\n if (min < 0n) {\n throw new InternalError('minValue must be greater than or equal to 0')\n }\n\n return BigUint(getRandomBigInt(min, MAX_UINT512))\n }\n\n /**\n * Generates a random bytes of the specified length.\n * @param {number} [length=MAX_BYTES_SIZE] - The length of the bytes.\n * @returns {bytes} - A random bytes.\n */\n bytes(length = MAX_BYTES_SIZE): bytes {\n return Bytes(new Uint8Array(randomBytes(length)))\n }\n\n /**\n * Generates a random string of the specified length.\n * @param {number} [length=11] - The length of the string.\n * @returns {string} - A random string.\n */\n string(length = 11): string {\n const setLength = 11\n return Array(Math.ceil(length / setLength))\n .fill(0)\n .map(() => Math.random().toString(36).substring(2))\n .join('')\n .substring(0, length)\n }\n\n /**\n * Generates a random account with the specified context data.\n * @param {AccountContextData} [input] - The context data for the account.\n * @returns {Account} - A random account.\n */\n account(input?: AccountContextData): AccountType {\n const account = input?.address ? Account(input.address) : Account(getRandomBytes(32).asAlgoTs())\n\n if (input?.address && lazyContext.ledger.accountDataMap.has(account)) {\n throw new InternalError(\n 'Account with such address already exists in testing context. Use `context.ledger.getAccount(address)` to retrieve the existing account.',\n )\n }\n\n const data = new AccountData()\n const { address, optedAssetBalances, optedApplications, incentiveEligible, lastProposed, lastHeartbeat, ...accountData } = input ?? {}\n data.incentiveEligible = incentiveEligible ?? false\n data.lastProposed = lastProposed\n data.lastHeartbeat = lastHeartbeat\n data.account = {\n ...data.account,\n ...accountData,\n }\n lazyContext.ledger.accountDataMap.set(account, data)\n\n if (input?.optedAssetBalances) {\n for (const [assetId, balance] of input.optedAssetBalances) {\n lazyContext.ledger.updateAssetHolding(account, assetId, balance)\n }\n }\n if (input?.optedApplications) {\n for (const app of input.optedApplications) {\n data.optedApplications.set(asBigInt(app.id), app)\n }\n }\n return account\n }\n\n /**\n * Generates a random asset with the specified context data.\n * @param {AssetContextData} [input] - The context data for the asset.\n * @returns {Asset} - A random asset.\n */\n asset(input?: AssetContextData): AssetType {\n const id = input?.assetId\n if (id && lazyContext.ledger.assetDataMap.has(asUint64(id))) {\n throw new InternalError('Asset with such ID already exists in testing context!')\n }\n const assetId = asUint64Cls(id ?? lazyContext.ledger.assetIdIter.next().value).asAlgoTs()\n const defaultAssetData = getDefaultAssetData()\n const { assetId: _, ...assetData } = input ?? {}\n lazyContext.ledger.assetDataMap.set(assetId, {\n ...defaultAssetData,\n ...assetData,\n })\n return new AssetCls(assetId)\n }\n\n /**\n * Generates a random application with the specified context data.\n * @param {ApplicationContextData} [input] - The context data for the application.\n * @returns {Application} - A random application.\n */\n application(input?: ApplicationContextData): ApplicationType {\n const id = input?.applicationId\n if (id && lazyContext.ledger.applicationDataMap.has(id)) {\n throw new InternalError('Application with such ID already exists in testing context!')\n }\n const applicationId = asUint64Cls(id ?? lazyContext.ledger.appIdIter.next().value).asAlgoTs()\n const data = new ApplicationData()\n const { applicationId: _, ...applicationData } = input ?? {}\n data.application = {\n ...data.application,\n ...applicationData,\n }\n lazyContext.ledger.applicationDataMap.set(applicationId, data)\n return new ApplicationCls(applicationId)\n }\n}\n","import type { arc4 } from '@algorandfoundation/algorand-typescript'\nimport { BITS_IN_BYTE, MAX_UINT128, MAX_UINT16, MAX_UINT256, MAX_UINT32, MAX_UINT512, MAX_UINT64, MAX_UINT8 } from '../constants'\nimport { Address, DynamicBytes, Str, Uint } from '../impl/encoded-types'\nimport { getRandomBigInt, getRandomBytes } from '../util'\nimport { AvmValueGenerator } from './avm'\n\nexport class Arc4ValueGenerator {\n /**\n * Generate a random Algorand address.\n * @returns: A new, random Algorand address.\n * */\n address(): arc4.Address {\n const source = new AvmValueGenerator().account()\n const result = new Address(\n { name: 'Address', genericArgs: { elementType: { name: 'Byte', genericArgs: [{ name: '8' }] }, size: { name: '32' } } },\n source,\n )\n return result\n }\n\n /**\n * Generate a random Uint8 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2 ** 8 - 1.\n * @returns: A random Uint8 value.\n * */\n uint8(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT8): arc4.Uint8 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '8' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint8\n }\n\n /**\n * Generate a random Uint16 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2 ** 16 - 1.\n * @returns: A random Uint16 value.\n * */\n uint16(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT16): arc4.Uint16 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '16' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint16\n }\n\n /**\n * Generate a random Uint32 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2 ** 32 - 1.\n * @returns: A random Uint32 value.\n * */\n uint32(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT32): arc4.Uint32 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '32' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint32\n }\n\n /**\n * Generate a random Uint64 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2n ** 64n - 1n.\n * @returns: A random Uint64 value.\n * */\n uint64(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT64): arc4.Uint64 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '64' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint64\n }\n\n /**\n * Generate a random Uint128 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2n ** 128n - 1n.\n * @returns A random Uint128 value.\n * */\n uint128(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT128): arc4.Uint128 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '128' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint128\n }\n\n /**\n * Generate a random Uint256 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2n ** 256n - 1n.\n * @returns A random Uint256 value.\n * */\n uint256(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT256): arc4.Uint256 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '256' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint256\n }\n\n /**\n * Generate a random Uint512 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2n ** 512n - 1n.\n * @returns A random Uint512 value.\n * */\n uint512(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT512): arc4.Uint<512> {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '512' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint<512>\n }\n\n /**\n * Generate a random dynamic bytes of size `n` bits.\n * @param n The number of bits for the dynamic bytes. Must be a multiple of 8, otherwise\n * the last byte will be truncated.\n * @returns A new, random dynamic bytes of size `n` bits.\n * */\n dynamicBytes(n: number): arc4.DynamicBytes {\n return new DynamicBytes(\n { name: 'DynamicBytes', genericArgs: { elementType: { name: 'Byte', genericArgs: [{ name: '8' }] } } },\n getRandomBytes(n / BITS_IN_BYTE).asAlgoTs(),\n )\n }\n\n /**\n * Generate a random dynamic string of size `n` bits.\n * @param n The number of bits for the string.\n * @returns A new, random string of size `n` bits.\n * */\n str(n: number): arc4.Str {\n // Calculate the number of characters needed (rounding up)\n const numChars = n + 7 // 8\n\n // Generate random string\n const bytes = getRandomBytes(numChars)\n return new Str(JSON.stringify(undefined), bytes.toString()) as unknown as arc4.Str\n }\n}\n","import type { Application as ApplicationType, BaseContract as BaseContractType, gtxn } from '@algorandfoundation/algorand-typescript'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { InternalError } from '../errors'\nimport { BaseContract } from '../impl/base-contract'\nimport { ApplicationCls } from '../impl/reference'\nimport type { ApplicationCallTransactionFields, TxnFields } from '../impl/transactions'\nimport {\n ApplicationCallTransaction,\n AssetConfigTransaction,\n AssetFreezeTransaction,\n AssetTransferTransaction,\n KeyRegistrationTransaction,\n PaymentTransaction,\n} from '../impl/transactions'\n\nexport class TxnValueGenerator {\n /**\n * Generates a random application call transaction with the specified fields.\n * @param {ApplicationCallTransactionFields} [fields] - The fields for the application call transaction where `appId` value can be instance of Application or BaseContract.\n * @returns {ApplicationCallTransaction} - A random application call transaction.\n */\n applicationCall(\n fields?: Partial<Omit<ApplicationCallTransactionFields, 'appId'> & { appId: ApplicationType | BaseContractType }>,\n ): ApplicationCallTransaction {\n const params = fields ?? {}\n let appId =\n params.appId instanceof ApplicationCls\n ? params.appId\n : params.appId instanceof BaseContract\n ? lazyContext.ledger.getApplicationForContract(params.appId)\n : undefined\n if (appId && !lazyContext.ledger.applicationDataMap.has(appId.id)) {\n throw new InternalError(`Application ID ${appId.id} not found in test context`)\n }\n if (!appId) {\n appId = lazyContext.any.application()\n }\n\n return ApplicationCallTransaction.create({ ...params, appId })\n }\n\n /**\n * Generates a random payment transaction with the specified fields.\n * @param {TxnFields<gtxn.PaymentTxn>} [fields] - The fields for the payment transaction.\n * @returns {PaymentTransaction} - A random payment transaction.\n */\n payment(fields?: TxnFields<gtxn.PaymentTxn>): PaymentTransaction {\n return PaymentTransaction.create(fields ?? {})\n }\n\n /**\n * Generates a random key registration transaction with the specified fields.\n * @param {TxnFields<gtxn.KeyRegistrationTxn>} [fields] - The fields for the key registration transaction.\n * @returns {KeyRegistrationTransaction} - A random key registration transaction.\n */\n keyRegistration(fields?: TxnFields<gtxn.KeyRegistrationTxn>): KeyRegistrationTransaction {\n return KeyRegistrationTransaction.create(fields ?? {})\n }\n\n /**\n * Generates a random asset configuration transaction with the specified fields.\n * @param {TxnFields<gtxn.AssetConfigTxn>} [fields] - The fields for the asset configuration transaction.\n * @returns {AssetConfigTransaction} - A random asset configuration transaction.\n */\n assetConfig(fields?: TxnFields<gtxn.AssetConfigTxn>): AssetConfigTransaction {\n return AssetConfigTransaction.create(fields ?? {})\n }\n\n /**\n * Generates a random asset transfer transaction with the specified fields.\n * @param {TxnFields<gtxn.AssetTransferTxn>} [fields] - The fields for the asset transfer transaction.\n * @returns {AssetTransferTransaction} - A random asset transfer transaction.\n */\n assetTransfer(fields?: TxnFields<gtxn.AssetTransferTxn>): AssetTransferTransaction {\n return AssetTransferTransaction.create(fields ?? {})\n }\n\n /**\n * Generates a random asset freeze transaction with the specified fields.\n * @param {TxnFields<gtxn.AssetFreezeTxn>} [fields] - The fields for the asset freeze transaction.\n * @returns {AssetFreezeTransaction} - A random asset freeze transaction.\n */\n assetFreeze(fields?: TxnFields<gtxn.AssetFreezeTxn>): AssetFreezeTransaction {\n return AssetFreezeTransaction.create(fields ?? {})\n }\n}\n","import { Arc4ValueGenerator } from './arc4'\nimport { AvmValueGenerator } from './avm'\nimport { TxnValueGenerator } from './txn'\n\nexport class ValueGenerator extends AvmValueGenerator {\n txn: TxnValueGenerator\n arc4: Arc4ValueGenerator\n\n /** @internal */\n constructor() {\n super()\n this.txn = new TxnValueGenerator()\n this.arc4 = new Arc4ValueGenerator()\n }\n}\n","import type { Account as AccountType, BaseContract, bytes, Contract, LogicSig, uint64 } from '@algorandfoundation/algorand-typescript'\nimport type { ApplicationSpy } from './application-spy'\nimport { DEFAULT_TEMPLATE_VAR_PREFIX } from './constants'\nimport { ContextManager } from './context-helpers/context-manager'\nimport type { DecodedLogs, LogDecoding } from './decode-logs'\nimport type { ApplicationCallInnerTxnContext } from './impl/inner-transactions'\nimport { AccountCls } from './impl/reference'\nimport { ContractContext } from './subcontexts/contract-context'\nimport { LedgerContext } from './subcontexts/ledger-context'\nimport { TransactionContext } from './subcontexts/transaction-context'\nimport type { ConstructorFor, DeliberateAny } from './typescript-helpers'\nimport { getRandomBytes } from './util'\nimport { ValueGenerator } from './value-generators'\n\n/**\n * The `TestExecutionContext` class provides a context for executing tests in an Algorand environment.\n * It manages various contexts such as contract, ledger, and transaction contexts, and provides utilities\n * for generating values, managing accounts, and handling logic signatures.\n *\n * @class\n */\nexport class TestExecutionContext {\n #contractContext: ContractContext\n #ledgerContext: LedgerContext\n #txnContext: TransactionContext\n #valueGenerator: ValueGenerator\n #defaultSender: AccountType\n #activeLogicSigArgs: bytes[]\n #templateVars: Record<string, DeliberateAny> = {}\n #compiledApps: Array<{ key: ConstructorFor<BaseContract>; value: uint64 }> = []\n #compiledLogicSigs: Array<{ key: ConstructorFor<LogicSig>; value: AccountType }> = []\n #applicationSpies: Array<ApplicationSpy<Contract>> = []\n\n /**\n * Creates an instance of `TestExecutionContext`.\n *\n * @param {bytes} [defaultSenderAddress] - The default sender address.\n */\n constructor(defaultSenderAddress?: bytes) {\n ContextManager.instance = this\n this.#contractContext = new ContractContext()\n this.#ledgerContext = new LedgerContext()\n this.#txnContext = new TransactionContext()\n this.#valueGenerator = new ValueGenerator()\n this.#defaultSender = this.any.account({ address: defaultSenderAddress ?? getRandomBytes(32).asAlgoTs() })\n this.#activeLogicSigArgs = []\n }\n\n /**\n * Exports logs for a given application ID and decoding.\n *\n * @template T\n * @param {uint64} appId - The application ID.\n * @param {...T} decoding - The log decoding.\n * @returns {DecodedLogs<T>}\n */\n exportLogs<const T extends [...LogDecoding[]]>(appId: uint64, ...decoding: T): DecodedLogs<T> {\n return this.txn.exportLogs(appId, ...decoding)\n }\n\n /**\n * Returns the contract context.\n *\n * @type {ContractContext}\n */\n get contract() {\n return this.#contractContext\n }\n\n /**\n * Returns the ledger context.\n *\n * @type {LedgerContext}\n */\n get ledger() {\n return this.#ledgerContext\n }\n\n /**\n * Returns the transaction context.\n *\n * @type {TransactionContext}\n */\n get txn() {\n return this.#txnContext\n }\n\n /**\n * Returns the value generator.\n *\n * @type {ValueGenerator}\n */\n get any() {\n return this.#valueGenerator\n }\n\n /**\n * Returns the default sender account.\n *\n * @type {Account}\n */\n get defaultSender(): AccountType {\n return this.#defaultSender\n }\n\n /**\n * Sets the default sender account.\n *\n * @param {bytes | AccountType} val - The default sender account.\n */\n set defaultSender(val: bytes | AccountType) {\n if (val instanceof AccountCls) {\n this.#defaultSender = val\n } else if (this.#defaultSender.bytes !== val) {\n this.#defaultSender = new AccountCls(val as bytes)\n }\n }\n\n /**\n * Returns the active logic signature arguments.\n *\n * @type {bytes[]}\n */\n get activeLogicSigArgs(): bytes[] {\n return this.#activeLogicSigArgs\n }\n\n /**\n * Returns the template variables.\n *\n * @type {Record<string, DeliberateAny>}\n */\n get templateVars(): Record<string, DeliberateAny> {\n return this.#templateVars\n }\n\n /**\n * Executes a logic signature with the given arguments.\n *\n * @param {LogicSig} logicSig - The logic signature to execute.\n * @param {...bytes[]} args - The arguments for the logic signature.\n * @returns {boolean | uint64}\n */\n executeLogicSig(logicSig: LogicSig, ...args: bytes[]): boolean | uint64 {\n this.#activeLogicSigArgs = args\n try {\n return logicSig.program()\n } finally {\n this.#activeLogicSigArgs = []\n }\n }\n\n /**\n * Sets a template variable.\n *\n * @param {string} name - The name of the template variable.\n * @param {DeliberateAny} value - The value of the template variable.\n * @param {string} [prefix] - The prefix for the template variable.\n */\n setTemplateVar(name: string, value: DeliberateAny, prefix?: string) {\n this.#templateVars[(prefix ?? DEFAULT_TEMPLATE_VAR_PREFIX) + name] = value\n }\n\n /**\n * Gets a compiled application by contract.\n *\n * @param {ConstructorFor<BaseContract>} contract - The contract class.\n * @returns {[ConstructorFor<BaseContract>, uint64] | undefined}\n */\n getCompiledAppEntry(contract: ConstructorFor<BaseContract>) {\n return this.#compiledApps.find(({ key: k }) => k === contract)\n }\n\n /**\n * Sets a compiled application.\n *\n * @param {ConstructorFor<BaseContract>} c - The contract class.\n * @param {uint64} appId - The application ID.\n */\n setCompiledApp(c: ConstructorFor<BaseContract>, appId: uint64) {\n const existing = this.getCompiledAppEntry(c)\n if (existing) {\n existing.value = appId\n } else {\n this.#compiledApps.push({ key: c, value: appId })\n }\n }\n\n /** @internal */\n notifyApplicationSpies(itxn: ApplicationCallInnerTxnContext) {\n for (const spy of this.#applicationSpies) {\n spy.notify(itxn)\n }\n }\n\n /**\n * Adds an application spy to the context.\n *\n * @param {ApplicationSpy<TContract>} spy - The application spy to add.\n */\n addApplicationSpy<TContract extends Contract>(spy: ApplicationSpy<TContract>) {\n this.#applicationSpies.push(spy)\n }\n\n /**\n * Gets a compiled logic signature.\n *\n * @param {ConstructorFor<LogicSig>} logicsig - The logic signature class.\n * @returns {[ConstructorFor<LogicSig>, Account] | undefined}\n */\n getCompiledLogicSigEntry(logicsig: ConstructorFor<LogicSig>) {\n return this.#compiledLogicSigs.find(({ key: k }) => k === logicsig)\n }\n\n /**\n * Sets a compiled logic signature.\n *\n * @param {ConstructorFor<LogicSig>} c - The logic signature class.\n * @param {Account} account - The account associated with the logic signature.\n */\n setCompiledLogicSig(c: ConstructorFor<LogicSig>, account: AccountType) {\n const existing = this.getCompiledLogicSigEntry(c)\n if (existing) {\n existing.value = account\n } else {\n this.#compiledLogicSigs.push({ key: c, value: account })\n }\n }\n\n /**\n * Reinitializes the execution context, clearing all state variables and resetting internal components.\n * Invoked between test cases to ensure isolation.\n */\n reset() {\n this.#contractContext = new ContractContext()\n this.#ledgerContext = new LedgerContext()\n this.#txnContext = new TransactionContext()\n this.#activeLogicSigArgs = []\n this.#templateVars = {}\n this.#compiledApps = []\n this.#compiledLogicSigs = []\n this.#applicationSpies = []\n this.#defaultSender = this.any.account({ address: this.#defaultSender.bytes }) // reset default sender account data in ledger context\n ContextManager.reset()\n ContextManager.instance = this\n }\n}\n"],"names":["Address"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,MAAM,U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CAAC,aAAa,GAAG,EAAE;AACvB,QAAA,IAAI,CAAC,aAAa,GAAG,EAAE;AACvB,QAAA,IAAI,CAAC,kBAAkB,GAAG,EAAE;AAC5B,QAAA,IAAI,CAAC,iBAAiB,GAAG,EAAE;QAC3B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,CAAA;QAC9E,cAAc,CAAC,KAAK,EAAE;AACtB,QAAA,cAAc,CAAC,QAAQ,GAAG,IAAI;IAChC;AACD;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/application-spy.ts","../src/set-up.ts","../src/subcontexts/ledger-context.ts","../src/decode-logs.ts","../src/subcontexts/transaction-context.ts","../src/value-generators/avm.ts","../src/value-generators/arc4.ts","../src/value-generators/txn.ts","../src/value-generators/index.ts","../src/test-execution-context.ts"],"sourcesContent":["import type { bytes, Contract } from '@algorandfoundation/algorand-typescript'\nimport { OnCompleteAction } from '@algorandfoundation/algorand-typescript'\nimport { getContractMethodAbiMetadata } from './abi-metadata'\nimport type { ApplicationCallInnerTxnContext } from './impl/inner-transactions'\nimport { methodSelector } from './impl/method-selector'\nimport type { AnyFunction, ConstructorFor } from './typescript-helpers'\nimport { asNumber } from './util'\n\nexport type AppSpyCb = (itxnContext: ApplicationCallInnerTxnContext) => void\n\nconst predicates = {\n bareCall: (cb: AppSpyCb, ocas: OnCompleteAction[]): AppSpyCb => {\n return (ctx) => {\n if (asNumber(ctx.numAppArgs) === 0 && ocas.includes(ctx.onCompletion)) {\n cb(ctx as ApplicationCallInnerTxnContext)\n }\n }\n },\n methodSelector: (cb: AppSpyCb, selectorBytes: bytes, ocas: OnCompleteAction[]): AppSpyCb => {\n return (ctx) => {\n if (selectorBytes.equals(ctx.appArgs(0)) && ocas.includes(ctx.onCompletion)) {\n cb(ctx)\n }\n }\n },\n}\n\n/*\n * The `ApplicationSpy` class is a utility for testing Algorand smart contracts.\n * It allows you to spy on application calls and register callbacks for specific method signatures.\n *\n * @template TContract - The type of the contract being spied on.\n */\nexport class ApplicationSpy<TContract extends Contract = Contract> {\n #spyFns: AppSpyCb[] = []\n\n /**\n * The `on` property is a proxy that allows you to register callbacks for specific method signatures.\n * It dynamically creates methods based on the contract's methods.\n */\n readonly on: TypedApplicationSpyCallBacks<TContract>\n\n /** @internal */\n contract?: TContract | ConstructorFor<TContract>\n\n constructor(contract?: TContract | ConstructorFor<TContract>) {\n this.contract = contract\n this.on = this.createOnProxy()\n }\n\n /** @internal */\n notify(itxn: ApplicationCallInnerTxnContext) {\n for (const cb of this.#spyFns) {\n cb(itxn)\n }\n }\n\n /**\n * Registers a callback for a bare call (no arguments).\n * @param callback - The callback to be executed when a bare call is detected.\n */\n onBareCall(callback: AppSpyCb): void\n onBareCall(ocas: OnCompleteAction[], callback: AppSpyCb): void\n onBareCall(...args: [AppSpyCb] | [OnCompleteAction[], AppSpyCb]): void {\n let callback: AppSpyCb\n let ocas: OnCompleteAction[] = [OnCompleteAction.NoOp]\n if (args.length === 2) {\n ;[ocas, callback] = args\n } else {\n ;[callback] = args\n }\n this.#spyFns.push(predicates.bareCall(callback, ocas))\n }\n\n /**\n * Registers a callback for a specific method signature.\n * @param methodSignature\n * @param callback\n */\n onAbiCall(methodSignature: bytes, callback: AppSpyCb): void\n onAbiCall(methodSignature: bytes, ocas: OnCompleteAction[], callback: AppSpyCb): void\n onAbiCall(...args: [bytes, AppSpyCb] | [bytes, OnCompleteAction[], AppSpyCb]): void {\n let methodSignature: bytes\n let callback: AppSpyCb\n let ocas: OnCompleteAction[] = [OnCompleteAction.NoOp]\n if (args.length === 3) {\n ;[methodSignature, ocas, callback] = args\n } else {\n ;[methodSignature, callback] = args\n }\n this.#spyFns.push(predicates.methodSelector(callback, methodSignature, ocas))\n }\n\n private _tryGetMethod(name: string | symbol) {\n if (this.contract === undefined) return undefined\n if (typeof this.contract === 'function') {\n return this.contract.prototype[name]\n } else {\n return Reflect.get(this.contract, name)\n }\n }\n\n private createOnProxy(spy: ApplicationSpy<TContract> = this): TypedApplicationSpyCallBacks<TContract> {\n return new Proxy({} as TypedApplicationSpyCallBacks<TContract>, {\n get(_: TypedApplicationSpyCallBacks<TContract>, methodName) {\n const fn = spy._tryGetMethod(methodName)\n if (fn === undefined) return fn\n return function (callback: AppSpyCb) {\n let ocas: OnCompleteAction[] = [OnCompleteAction.NoOp]\n if (spy.contract !== undefined) {\n const metadata = getContractMethodAbiMetadata(spy.contract, methodName as string)\n ocas = metadata.allowActions?.map((action) => OnCompleteAction[action]) ?? [OnCompleteAction.NoOp]\n }\n\n const selector = methodSelector({ method: fn, contract: spy.contract })\n spy.onAbiCall(selector, ocas, callback)\n }\n },\n }) as TypedApplicationSpyCallBacks<TContract>\n }\n}\n\nexport type TypedApplicationSpyCallBacks<TContract> = {\n [key in keyof TContract as key extends 'approvalProgram' | 'clearStateProgram'\n ? never\n : TContract[key] extends AnyFunction\n ? key extends string\n ? key\n : never\n : never]: (callback: AppSpyCb) => void\n}\n","import { Address } from '@algorandfoundation/algorand-typescript/arc4'\nimport { encodingUtil } from '@algorandfoundation/puya-ts'\nimport { AlgoTsPrimitiveCls, BigUintCls, BytesCls, Uint64Cls } from './impl/primitives'\nimport { AccountCls, ApplicationCls, AssetCls } from './impl/reference'\n\ntype Tester = (this: TesterContext, a: unknown, b: unknown, customTesters: Array<Tester>) => boolean | undefined\ninterface TesterContext {\n equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean\n}\ninterface ExpectObj {\n addEqualityTesters: (testers: Array<Tester>) => void\n}\n\nfunction doAddEqualityTesters(expectObj: ExpectObj) {\n expectObj.addEqualityTesters([\n function IsSamePrimitiveTypeAndValue(this: TesterContext, subject, test, customTesters): boolean | undefined {\n const subjectIsPrimitive = subject instanceof AlgoTsPrimitiveCls\n const testIsPrimitive = test instanceof AlgoTsPrimitiveCls\n const isSamePrimitive = subjectIsPrimitive && test instanceof Object.getPrototypeOf(subject).constructor\n if (subjectIsPrimitive && testIsPrimitive) {\n if (!isSamePrimitive) return false\n return this.equals(subject.valueOf(), test.valueOf(), customTesters)\n }\n // Defer to other testers\n return undefined\n },\n function NumericPrimitiveIsNumericLiteral(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof Uint64Cls || subject instanceof BigUintCls) {\n const testValue = typeof test === 'bigint' ? test : typeof test === 'number' ? BigInt(test) : undefined\n if (testValue !== undefined) return this.equals(subject.valueOf(), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function NumericLiteralIsNumericPrimitive(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (typeof subject === 'bigint' || typeof subject === 'number') {\n const testValue = test instanceof Uint64Cls || test instanceof BigUintCls ? test.valueOf() : undefined\n if (testValue !== undefined) return this.equals(BigInt(subject), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function BytesPrimitiveIsUint8Array(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof BytesCls) {\n const testValue = test instanceof Uint8Array ? test : undefined\n if (testValue !== undefined) return this.equals(subject.asUint8Array(), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function BytesPrimitiveIsArray(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof BytesCls) {\n const testValue =\n Array.isArray(test) && test.every((i) => typeof i === 'number' && i >= 0 && i < 256) ? new Uint8Array(test) : undefined\n if (testValue !== undefined) return this.equals(subject.asUint8Array(), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function BytesPrimitiveIsString(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof BytesCls) {\n const testValue = typeof test === 'string' ? encodingUtil.utf8ToUint8Array(test) : undefined\n if (testValue !== undefined) return this.equals(subject.asUint8Array(), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function Uint8ArrayIsBytesPrimitive(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof Uint8Array) {\n const testValue = test instanceof BytesCls ? test : undefined\n if (testValue !== undefined) return this.equals(subject, testValue.asUint8Array(), customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AccountIsAddressStr(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof AccountCls) {\n const testValue = typeof test === 'string' ? encodingUtil.base32ToUint8Array(test).slice(0, 32) : undefined\n if (testValue !== undefined) return this.equals(subject.bytes, testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AccountIsAddressBytes(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof AccountCls) {\n const testValue = test instanceof BytesCls ? test.asUint8Array().slice(0, 32) : undefined\n if (testValue !== undefined) return this.equals(subject.bytes, testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AddressIsAccountStr(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof Address) {\n const testValue = typeof test === 'string' ? encodingUtil.base32ToUint8Array(test).slice(0, 32) : undefined\n if (testValue !== undefined) return this.equals(subject.native.bytes, testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AddressIsAccountBytes(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof Address) {\n const testValue = test instanceof BytesCls ? test.asUint8Array().slice(0, 32) : undefined\n if (testValue !== undefined) return this.equals(subject.native.bytes, testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AddressIsAccount(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof Address) {\n const testValue = test instanceof AccountCls ? test.bytes : undefined\n if (testValue !== undefined) return this.equals(subject.native.bytes, testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function BigIntIsNumber(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (typeof subject === 'bigint') {\n const testValue = typeof test === 'number' ? test : undefined\n if (testValue !== undefined) return this.equals(subject, BigInt(testValue), customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function NumberIsBigInt(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (typeof subject === 'number') {\n const testValue = typeof test === 'bigint' ? test : undefined\n if (testValue !== undefined) return this.equals(BigInt(subject), testValue, customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AccountIsAccount(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof AccountCls) {\n const testValue = test instanceof AccountCls ? test : undefined\n if (testValue !== undefined) return this.equals(subject['data'], testValue['data'], customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function ApplicationIsApplication(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof ApplicationCls) {\n const testValue = test instanceof ApplicationCls ? test : undefined\n if (testValue !== undefined) return this.equals(subject['data'], testValue['data'], customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n function AssetIsAsset(this: TesterContext, subject, test, customTesters): boolean | undefined {\n if (subject instanceof AssetCls) {\n const testValue = test instanceof AssetCls ? test : undefined\n if (testValue !== undefined) return this.equals(subject['data'], testValue['data'], customTesters)\n return undefined\n }\n // Defer to other testers\n return undefined\n },\n ])\n}\n\n/**\n * Adds custom equality testers for Algorand types to vitest's expect function.\n * This allows vitest to properly compare Algorand types such as uint64, biguint, and bytes\n * against JS native types such as number, bigint and Uint8Array, in tests.\n *\n * @param {Object} params - The parameters object\n * @param {ExpectObj} params.expect - vitest's expect object to extend with custom equality testers\n *\n * @example\n * ```ts\n * import { beforeAll, expect } from 'vitest'\n * import { addEqualityTesters } from '@algorandfoundation/algorand-typescript-testing';\n *\n * beforeAll(() => {\n * addEqualityTesters({ expect });\n * });\n * ```\n *\n * @returns {void}\n */\nexport function addEqualityTesters({ expect }: { expect: ExpectObj }) {\n doAddEqualityTesters(expect)\n}\n","import type {\n Account as AccountType,\n Application as ApplicationType,\n Asset as AssetType,\n BaseContract,\n bytes,\n BytesCompat,\n LocalStateForAccount,\n uint64,\n Uint64Compat,\n} from '@algorandfoundation/algorand-typescript'\nimport { AccountMap, Uint64Map } from '../collections/custom-key-map'\nimport { MAX_UINT64 } from '../constants'\nimport { InternalError } from '../errors'\nimport { BlockData } from '../impl/block'\nimport { toUint8Array } from '../impl/encoded-types/encoded-types'\nimport { GlobalData } from '../impl/global'\nimport { Uint64Cls } from '../impl/primitives'\nimport type { AssetData } from '../impl/reference'\nimport {\n AccountCls,\n AccountData,\n Application,\n ApplicationCls,\n ApplicationData,\n Asset,\n AssetHolding,\n getDefaultAssetData,\n} from '../impl/reference'\nimport { GlobalStateCls, LocalStateCls } from '../impl/state'\nimport { VoterData } from '../impl/voter-params'\nimport type { PickPartial } from '../typescript-helpers'\nimport { asBigInt, asBytes, asMaybeBytesCls, asMaybeUint64Cls, asUint64, asUint64Cls, asUint8Array, iterBigInt } from '../util'\n\nexport class LedgerContext {\n /** @internal */\n appIdIter = iterBigInt(1001n, MAX_UINT64)\n /** @internal */\n assetIdIter = iterBigInt(1001n, MAX_UINT64)\n /** @internal */\n applicationDataMap = new Uint64Map<ApplicationData>()\n /** @internal */\n appIdContractMap = new Uint64Map<BaseContract>()\n /** @internal */\n accountDataMap = new AccountMap<AccountData>()\n /** @internal */\n assetDataMap = new Uint64Map<AssetData>()\n /** @internal */\n voterDataMap = new AccountMap<VoterData>()\n /** @internal */\n blocks = new Uint64Map<BlockData>()\n /** @internal */\n globalData = new GlobalData()\n onlineStake = 0\n\n /**\n * Adds a contract to the application ID contract map.\n * @internal\n * @param appId - The application ID.\n * @param contract - The contract to add.\n */\n addAppIdContractMap(appId: Uint64Compat, contract: BaseContract): void {\n this.appIdContractMap.set(appId, contract)\n }\n\n /**\n * Retrieves an account by address.\n * @param address - The account address.\n * @returns The account.\n */\n getAccount(address: AccountType | BytesCompat): AccountType {\n return new AccountCls(address instanceof AccountCls ? address.bytes : asBytes(address as BytesCompat))\n }\n\n /**\n * Retrieves an asset by asset ID.\n * @param assetId - The asset ID.\n * @returns The asset.\n * @throws If the asset is unknown.\n */\n getAsset(assetId: Uint64Compat): AssetType {\n if (this.assetDataMap.has(assetId)) {\n return Asset(asUint64(assetId))\n }\n throw new InternalError('Unknown asset, check correct testing context is active')\n }\n\n /**\n * Retrieves an application by application ID.\n * @param applicationId - The application ID.\n * @returns The application.\n * @throws If the application is unknown.\n */\n getApplication(applicationId: Uint64Compat): ApplicationType {\n if (this.applicationDataMap.has(applicationId)) {\n return Application(asUint64(applicationId))\n }\n throw new InternalError('Unknown application, check correct testing context is active')\n }\n\n /**\n * Retrieves an application for a given contract.\n * @param contract - The contract.\n * @returns The application.\n * @throws If the contract is unknown.\n */\n getApplicationForContract(contract: BaseContract): ApplicationType {\n for (const [appId, c] of this.appIdContractMap) {\n if (c === contract) {\n if (this.applicationDataMap.has(appId)) {\n return Application(asUint64(appId))\n }\n }\n }\n throw new InternalError('Unknown contract, check correct testing context is active')\n }\n\n /**\n * Retrieves an application for a given approval program.\n * @param approvalProgram - The approval program.\n * @returns The application or undefined if not found.\n */\n getApplicationForApprovalProgram(approvalProgram: bytes | readonly bytes[] | undefined): ApplicationType | undefined {\n if (approvalProgram === undefined) {\n return undefined\n }\n const entries = this.applicationDataMap.entries()\n let next = entries.next()\n let found = false\n while (!next.done && !found) {\n found = next.value[1].application.approvalProgram === approvalProgram\n if (!found) {\n next = entries.next()\n }\n }\n if (found && next?.value) {\n const appId = asUint64(next.value[0])\n if (this.applicationDataMap.has(appId)) {\n return Application(appId)\n }\n }\n return undefined\n }\n\n /**\n * Update asset holdings for account, only specified values will be updated.\n * AccountType will also be opted-in to asset\n * @param account\n * @param assetId\n * @param balance\n * @param frozen\n */\n updateAssetHolding(account: AccountType, assetId: Uint64Compat | AssetType, balance?: Uint64Compat, frozen?: boolean): void {\n const id = (asMaybeUint64Cls(assetId) ?? asUint64Cls((assetId as AssetType).id)).asAlgoTs()\n const accountData = this.accountDataMap.get(account)!\n const asset = this.assetDataMap.get(id)!\n const holding = accountData.optedAssets.get(id) ?? new AssetHolding(0n, asset.defaultFrozen)\n if (balance !== undefined) holding.balance = asUint64(balance)\n if (frozen !== undefined) holding.frozen = frozen\n accountData.optedAssets.set(id, holding)\n }\n\n /**\n * Patches global data with the provided partial data.\n * @param data - The partial global data.\n */\n patchGlobalData(data: Partial<GlobalData>) {\n this.globalData = {\n ...this.globalData,\n ...data,\n }\n }\n\n /**\n * Patches account data with the provided partial data.\n * @param account - The account.\n * @param data - The partial account data.\n */\n patchAccountData(account: AccountType, data: Partial<Omit<AccountData, 'account'>> & Partial<PickPartial<AccountData, 'account'>>): void {\n const accountData = this.accountDataMap.get(account) ?? new AccountData()\n this.accountDataMap.set(account, {\n ...accountData,\n ...data,\n account: {\n ...accountData.account,\n ...data.account,\n },\n })\n }\n\n /**\n * Patches application data with the provided partial data.\n * @param app - The application.\n * @param data - The partial application data.\n */\n patchApplicationData(\n app: ApplicationType,\n data: Partial<Omit<ApplicationData, 'application'>> & Partial<PickPartial<ApplicationData, 'application'>>,\n ): void {\n const applicationData = this.applicationDataMap.get(app.id) ?? new ApplicationData()\n this.applicationDataMap.set(app.id, {\n ...applicationData,\n ...data,\n application: {\n ...applicationData.application,\n ...data.application,\n },\n })\n }\n\n /**\n * Patches asset data with the provided partial data.\n * @param asset - The asset.\n * @param data - The partial asset data.\n */\n patchAssetData(asset: AssetType, data: Partial<AssetData>) {\n const assetData = this.assetDataMap.get(asset.id) ?? getDefaultAssetData()\n this.assetDataMap.set(asset.id, {\n ...assetData,\n ...data,\n })\n }\n\n /**\n * Patches voter data with the provided partial data.\n * @param account - The account.\n * @param data - The partial voter data.\n */\n patchVoterData(account: AccountType, data: Partial<VoterData>) {\n const voterData = this.voterDataMap.get(account) ?? new VoterData()\n this.voterDataMap.set(account, {\n ...voterData,\n ...data,\n })\n }\n\n /**\n * Patches block data with the provided partial data.\n * @param index - The block index.\n * @param data - The partial block data.\n */\n patchBlockData(index: Uint64Compat, data: Partial<BlockData>): void {\n const i = asUint64(index)\n const blockData = this.blocks.get(i) ?? new BlockData()\n this.blocks.set(i, {\n ...blockData,\n ...data,\n })\n }\n\n /**\n * Retrieves block data by index.\n * @param index - The block index.\n * @returns The block data.\n * @throws If the block is not set.\n */\n getBlockData(index: Uint64Compat): BlockData {\n const i = asBigInt(index)\n if (this.blocks.has(i)) {\n return this.blocks.get(i)!\n }\n throw new InternalError(`Block ${i} not set`)\n }\n\n /**\n * Retrieves global state for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @returns The global state and a boolean indicating if it was found.\n */\n getGlobalState(app: ApplicationType | BaseContract, key: BytesCompat): [GlobalStateCls<unknown>, true] | [undefined, false] {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.get(appId)\n if (!appData?.application.globalStates.has(key)) {\n return [undefined, false]\n }\n return [appData.application.globalStates.getOrFail(key), true]\n }\n\n /**\n * Sets global state for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @param value - The value (optional).\n */\n setGlobalState(app: ApplicationType | BaseContract, key: BytesCompat, value: Uint64Compat | BytesCompat | undefined): void {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n const globalState = appData.application.globalStates.get(key)\n if (value === undefined) {\n globalState?.delete()\n } else if (globalState === undefined) {\n appData.application.globalStates.set(key, new GlobalStateCls(asBytes(key), asMaybeUint64Cls(value) ?? asMaybeBytesCls(value)))\n } else {\n globalState.value = asMaybeUint64Cls(value) ?? asMaybeBytesCls(value)\n }\n }\n\n /**\n * Retrieves local state for an application and account by key.\n * @param app - The application.\n * @param account - The account.\n * @param key - The key.\n * @returns The local state and a boolean indicating if it was found.\n */\n getLocalState(\n app: ApplicationType | BaseContract | uint64,\n account: AccountType,\n key: BytesCompat,\n ): [LocalStateForAccount<unknown>, true] | [undefined, false] {\n const appId = app instanceof Uint64Cls ? app.asAlgoTs() : this.getAppId(app as ApplicationType | BaseContract)\n const appData = this.applicationDataMap.get(appId)\n if (!appData?.application.localStates.has(key)) {\n return [undefined, false]\n }\n const localState = appData.application.localStateMaps.getOrFail(key)\n const accountLocalState = localState.get(account)\n return [accountLocalState as LocalStateForAccount<unknown>, true]\n }\n\n /**\n * Sets local state for an application and account by key.\n * @param app - The application.\n * @param account - The account.\n * @param key - The key.\n * @param value - The value (optional).\n */\n setLocalState<T>(app: ApplicationType | BaseContract | uint64, account: AccountType, key: BytesCompat, value: T | undefined): void {\n const appId = app instanceof Uint64Cls ? app.asAlgoTs() : this.getAppId(app as ApplicationType | BaseContract)\n const appData = this.applicationDataMap.getOrFail(appId)\n if (!appData.application.localStateMaps.has(key)) {\n appData.application.localStateMaps.set(key, new AccountMap())\n }\n const localState = appData.application.localStateMaps.getOrFail(key)\n if (!localState.has(account)) {\n localState.set(account, new LocalStateCls())\n }\n const accountLocalState = localState.getOrFail(account)\n if (value === undefined) {\n accountLocalState.delete()\n } else {\n accountLocalState.value = asMaybeUint64Cls(value) ?? asMaybeBytesCls(value)\n }\n }\n\n /**\n * Retrieves a box for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @returns The box data.\n */\n getBox(app: ApplicationType | BaseContract, key: BytesCompat): Uint8Array {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n const materialised = appData.application.materialisedBoxes.get(key)\n if (materialised !== undefined) {\n const uint8ArrayValue = toUint8Array(materialised)\n appData.application.boxes.set(key, uint8ArrayValue)\n appData.application.materialisedBoxes.set(key, undefined)\n }\n return appData.application.boxes.get(key) ?? new Uint8Array()\n }\n\n /**\n * Retrieves a materialised box for an application by key.\n * @internal\n * @param app - The application.\n * @param key - The key.\n * @returns The materialised box data if exists or undefined.\n */\n getMaterialisedBox<T>(app: ApplicationType | BaseContract, key: BytesCompat): T | undefined {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n return appData.application.materialisedBoxes.get(key) as T | undefined\n }\n\n /**\n * Sets a box for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @param value - The box data.\n */\n setBox(app: ApplicationType | BaseContract, key: BytesCompat, value: BytesCompat | Uint8Array): void {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n const uint8ArrayValue = value instanceof Uint8Array ? value : asUint8Array(value)\n appData.application.boxes.set(key, uint8ArrayValue)\n appData.application.materialisedBoxes.set(key, undefined)\n }\n\n /**\n\n * Cache the materialised box for an application by key.\n* @internal\n * @param app - The application.\n * @param key - The key.\n * @param value - The box data.\n */\n setMaterialisedBox<TValue>(app: ApplicationType | BaseContract, key: BytesCompat, value: TValue | undefined): void {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n appData.application.materialisedBoxes.set(key, value)\n }\n\n /**\n * Deletes a box for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @returns True if the box was deleted, false otherwise.\n */\n deleteBox(app: ApplicationType | BaseContract, key: BytesCompat): boolean {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n appData.application.materialisedBoxes.delete(key)\n return appData.application.boxes.delete(key)\n }\n\n /**\n * Checks if a box exists for an application by key.\n * @param app - The application.\n * @param key - The key.\n * @returns True if the box exists, false otherwise.\n */\n boxExists(app: ApplicationType | BaseContract, key: BytesCompat): boolean {\n const appId = this.getAppId(app)\n const appData = this.applicationDataMap.getOrFail(appId)\n return appData.application.boxes.has(key)\n }\n\n /** @internal */\n private getAppId(app: ApplicationType | BaseContract): uint64 {\n return app instanceof ApplicationCls ? app.id : this.getApplicationForContract(app as BaseContract).id\n }\n}\n","import type { bytes } from '@algorandfoundation/algorand-typescript'\nimport { ABI_RETURN_VALUE_LOG_PREFIX } from './constants'\nimport { btoi } from './impl/pure'\nimport { asNumber } from './util'\n\nexport type LogDecoding = 'i' | 's' | 'b'\nexport type DecodedLog<T extends LogDecoding> = T extends 'i' ? bigint : T extends 's' ? string : Uint8Array\nexport type DecodedLogs<T extends [...LogDecoding[]]> = {\n [Index in keyof T]: DecodedLog<T[Index]>\n} & { length: T['length'] }\n\nconst ABI_RETURN_VALUE_LOG_PREFIX_LENGTH = asNumber(ABI_RETURN_VALUE_LOG_PREFIX.length)\n/** @internal */\nexport function decodeLogs<const T extends [...LogDecoding[]]>(logs: bytes[], decoding: T): DecodedLogs<T> {\n return logs.map((log, i) => {\n const value = log.slice(0, ABI_RETURN_VALUE_LOG_PREFIX_LENGTH).equals(ABI_RETURN_VALUE_LOG_PREFIX)\n ? log.slice(ABI_RETURN_VALUE_LOG_PREFIX_LENGTH)\n : log\n switch (decoding[i]) {\n case 'i':\n return btoi(value)\n case 's':\n return value.toString()\n default:\n return value\n }\n }) as DecodedLogs<T>\n}\n","import type { bytes, Contract, uint64, Uint64Compat } from '@algorandfoundation/algorand-typescript'\nimport { OnCompleteAction, TransactionType } from '@algorandfoundation/algorand-typescript'\nimport { getContractAbiMetadata, type AbiMetadata } from '../abi-metadata'\nimport { TRANSACTION_GROUP_MAX_SIZE } from '../constants'\nimport { checkRoutingConditions } from '../context-helpers/context-util'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport type { DecodedLogs, LogDecoding } from '../decode-logs'\nimport { decodeLogs } from '../decode-logs'\nimport { InternalError, invariant } from '../errors'\nimport type {\n ApplicationCallInnerTxn,\n AssetConfigInnerTxn,\n AssetFreezeInnerTxn,\n AssetTransferInnerTxn,\n KeyRegistrationInnerTxn,\n PaymentInnerTxn,\n} from '../impl/inner-transactions'\nimport { ApplicationCallInnerTxnContext, createInnerTxn, ItxnParams } from '../impl/inner-transactions'\nimport type { InnerTxn, InnerTxnFields } from '../impl/itxn'\nimport type { StubBytesCompat } from '../impl/primitives'\nimport type {\n AllTransactionFields,\n ApplicationCallTransaction,\n AssetConfigTransaction,\n AssetFreezeTransaction,\n AssetTransferTransaction,\n KeyRegistrationTransaction,\n PaymentTransaction,\n Transaction,\n} from '../impl/transactions'\nimport type { DeliberateAny, FunctionKeys } from '../typescript-helpers'\nimport { asBigInt, asNumber, asUint64 } from '../util'\nimport { ContractContext } from './contract-context'\n\nfunction ScopeGenerator(dispose: () => void) {\n function* internal() {\n try {\n yield\n } finally {\n dispose()\n }\n }\n const scope = internal()\n scope.next()\n return {\n done: () => {\n scope.return()\n },\n }\n}\n\ninterface ExecutionScope {\n execute: <TReturn>(body: () => TReturn) => TReturn\n}\n\n/**\n * Represents a deferred application call.\n */\nexport class DeferredAppCall<TParams extends unknown[], TReturn> {\n /** @internal */\n constructor(\n /** @internal */\n private readonly appId: uint64,\n /** @internal */\n readonly txns: Transaction[],\n /** @internal */\n private readonly method: (...args: TParams) => TReturn,\n /** @internal */\n private readonly abiMetadata: AbiMetadata,\n /** @internal */\n private readonly args: TParams,\n ) {}\n\n /**\n * Submits the deferred application call.\n * @returns The result of the application call.\n */\n submit(): TReturn {\n checkRoutingConditions(this.appId, this.abiMetadata)\n return this.method(...this.args)\n }\n}\n\n/**\n * Manages transaction contexts and groups.\n */\nexport class TransactionContext {\n readonly groups: TransactionGroup[] = []\n #activeGroup: TransactionGroup | undefined\n\n /**\n * Creates a new execution scope for a group of transactions.\n * @param group The group of transactions or deferred application calls.\n * @param activeTransactionIndex The index of the active transaction.\n * @returns The execution scope.\n */\n createScope(\n group: Array<Transaction | DeferredAppCall<DeliberateAny[], DeliberateAny>>,\n activeTransactionIndex?: number,\n ): ExecutionScope {\n let activeIndex = activeTransactionIndex\n const transactions = group.map((t) => (t instanceof DeferredAppCall ? t.txns : [t])).flat()\n if (activeIndex === undefined) {\n const lastAppCall = group\n .filter((t) => t instanceof DeferredAppCall)\n .at(-1)\n ?.txns.at(-1)\n if (lastAppCall) {\n activeIndex = transactions.indexOf(lastAppCall)\n }\n }\n const transactionGroup = new TransactionGroup(transactions, activeIndex)\n\n this.#activeGroup = transactionGroup\n\n const scope = ScopeGenerator(() => {\n if (this.#activeGroup?.transactions?.length) {\n this.groups.push(this.#activeGroup)\n }\n this.#activeGroup = undefined\n })\n return {\n execute: <TReturn>(body: () => TReturn) => {\n const result = body()\n scope.done()\n return result\n },\n }\n }\n\n /**\n * Ensures that a scope is created for the given group of transactions.\n * @internal\n * @param group The group of transactions.\n * @param activeTransactionIndex The index of the active transaction.\n * @returns The execution scope.\n */\n ensureScope(group: Transaction[], activeTransactionIndex?: number): ExecutionScope {\n if (!this.#activeGroup || !this.#activeGroup.transactions.length) {\n return this.createScope(group, activeTransactionIndex)\n }\n return {\n execute: <TReturn>(body: () => TReturn) => {\n return body()\n },\n }\n }\n\n get hasActiveGroup(): boolean {\n return !!this.#activeGroup\n }\n\n /**\n * Gets the active transaction group.\n * @returns The active transaction group.\n * @throws If there is no active transaction group.\n */\n get activeGroup(): TransactionGroup {\n if (this.#activeGroup) {\n return this.#activeGroup\n }\n throw new InternalError('no active txn group')\n }\n\n /**\n * Gets the last transaction group.\n * @returns The last transaction group.\n * @throws If there are no transaction groups.\n */\n get lastGroup(): TransactionGroup {\n if (this.groups.length === 0) {\n throw new InternalError('No group transactions found!')\n }\n return this.groups.at(-1)!\n }\n\n /**\n * Gets the last active transaction.\n * @returns The last active transaction.\n */\n get lastActive(): Transaction {\n return this.lastGroup.activeTransaction\n }\n\n /**\n * Appends a log to the active transaction.\n * @internal\n * @param value The log value.\n * @throws If the active transaction is not an application call.\n */\n appendLog(value: StubBytesCompat): void {\n const activeTransaction = this.activeGroup.activeTransaction\n if (activeTransaction.type !== TransactionType.ApplicationCall) {\n throw new InternalError('Can only add logs to ApplicationCallTransaction!')\n }\n activeTransaction.appendLog(value)\n }\n\n /**\n * Defers an application call.\n * @param contract The contract.\n * @param method The method to call.\n * @param methodName The name of the method.\n * @param args The arguments for the method.\n * @returns The deferred application call.\n */\n deferAppCall<TContract extends Contract, TParams extends unknown[], TReturn>(\n contract: TContract,\n method: (...args: TParams) => TReturn,\n methodName: FunctionKeys<TContract>,\n ...args: TParams\n ): DeferredAppCall<TParams, TReturn> {\n const appId = lazyContext.ledger.getApplicationForContract(contract)\n const abiMetadata = getContractAbiMetadata(contract)[methodName as string]\n const txns = ContractContext.createMethodCallTxns(contract, abiMetadata, ...args)\n return new DeferredAppCall(appId.id, txns, method, abiMetadata, args)\n }\n\n /**\n * Exports logs for the given application ID.\n * @param appId The application ID.\n * @param decoding The log decoding.\n * @returns The decoded logs.\n */\n exportLogs<const T extends [...LogDecoding[]]>(appId: uint64, ...decoding: T): DecodedLogs<T> {\n const transaction = this.lastGroup.transactions\n .filter((t) => t.type === TransactionType.ApplicationCall)\n .find((t) => asBigInt(t.appId.id) === asBigInt(appId))\n let logs = []\n if (transaction) {\n logs = transaction.appLogs\n } else {\n logs = lazyContext.getApplicationData(appId).application.appLogs\n }\n\n return decodeLogs(logs, decoding)\n }\n}\n\n/**\n * Represents a group of transactions.\n */\nexport class TransactionGroup {\n latestTimestamp: number\n transactions: Transaction[]\n itxnGroups: ItxnGroup[] = []\n /** @internal */\n activeTransactionIndex: number\n /** @internal */\n constructingItxnGroup: InnerTxnFields[] = []\n\n /** @internal */\n constructor(transactions: Transaction[], activeTransactionIndex?: number) {\n this.latestTimestamp = Date.now()\n if (transactions.length > TRANSACTION_GROUP_MAX_SIZE) {\n throw new InternalError(`Transaction group can have at most ${TRANSACTION_GROUP_MAX_SIZE} transactions, as per AVM limits.`)\n }\n transactions.forEach((txn, index) => Object.assign(txn, { groupIndex: asUint64(index) }))\n this.activeTransactionIndex = activeTransactionIndex === undefined ? transactions.length - 1 : activeTransactionIndex\n this.transactions = transactions\n }\n\n /**\n * Gets the active transaction.\n * @returns The active transaction.\n */\n get activeTransaction() {\n return this.transactions[this.activeTransactionIndex]\n }\n\n /**\n * Gets the active application ID.\n * @returns The active application ID.\n * @throws If there are no transactions in the group or the active transaction is not an application call.\n */\n get activeApplicationId() {\n // this should return the true app_id and not 0 if the app is in the creation phase\n if (this.transactions.length === 0) {\n throw new InternalError('No transactions in the group')\n }\n invariant(this.activeTransaction.type === TransactionType.ApplicationCall, 'No app_id found in the active transaction')\n return (this.activeTransaction as ApplicationCallTransaction).backingAppId.id\n }\n\n /* @internal */\n get constructingItxn() {\n if (!this.constructingItxnGroup.length) {\n throw new InternalError('itxn field without itxn begin')\n }\n return this.constructingItxnGroup.at(-1)!\n }\n\n /**\n * Gets the scratch space of the active transaction.\n * @returns The scratch space.\n */\n getScratchSpace() {\n return this.activeTransaction.scratchSpace\n }\n\n /**\n * Gets the scratch slot of the active transaction.\n * @param index The index of the scratch slot.\n * @returns The scratch slot value.\n */\n getScratchSlot(index: Uint64Compat): bytes | uint64 {\n return this.activeTransaction.getScratchSlot(index)\n }\n\n /**\n * Patches the fields of the active transaction.\n * @param fields The fields to patch.\n */\n patchActiveTransactionFields(fields: AllTransactionFields) {\n const activeTransaction = this.activeTransaction as unknown as AllTransactionFields\n const filteredFields = Object.fromEntries(Object.entries(fields).filter(([_, value]) => value !== undefined))\n Object.assign(activeTransaction, filteredFields)\n }\n\n /**\n * Adds a group of inner transactions.\n * @internal\n * @param itxns The inner transactions.\n */\n addInnerTransactionGroup(...itxns: InnerTxn[]) {\n this.itxnGroups.push(new ItxnGroup(itxns))\n }\n\n /**\n * Begins a new inner transaction group.\n * @internal\n * @throws If there is already an inner transaction group being constructed or the active transaction is not an application call.\n */\n beginInnerTransactionGroup() {\n if (this.constructingItxnGroup.length) {\n throw new InternalError('itxn begin without itxn submit')\n }\n invariant(this.activeTransaction.type === TransactionType.ApplicationCall, 'No active application call transaction')\n if (this.activeTransaction.onCompletion === OnCompleteAction.ClearState) {\n throw new InternalError('Cannot begin inner transaction group in a clear state call')\n }\n this.constructingItxnGroup.push({} as InnerTxnFields)\n }\n\n /**\n * Appends a new inner transaction to the current group.\n * @internal\n * @throws If there is no inner transaction group being constructed.\n */\n appendInnerTransactionGroup() {\n if (!this.constructingItxnGroup.length) {\n throw new InternalError('itxn next without itxn begin')\n }\n this.constructingItxnGroup.push({ type: TransactionType.Payment } as InnerTxnFields)\n }\n\n /**\n * Submits the current inner transaction group.\n * @internal\n * @throws If there is no inner transaction group being constructed or the group exceeds the maximum size.\n */\n submitInnerTransactionGroup() {\n if (!this.constructingItxnGroup.length) {\n throw new InternalError('itxn submit without itxn begin')\n }\n if (this.constructingItxnGroup.length > TRANSACTION_GROUP_MAX_SIZE) {\n throw new InternalError(`Cannot submit more than ${TRANSACTION_GROUP_MAX_SIZE} inner transactions at once`)\n }\n const itxns = this.constructingItxnGroup.flatMap((t) =>\n t instanceof ApplicationCallInnerTxnContext\n ? [...(t.itxns ?? []), t]\n : t instanceof ItxnParams\n ? t.createInnerTxns()\n : [createInnerTxn(t)],\n )\n itxns.forEach((itxn, index) => Object.assign(itxn, { groupIndex: asUint64(index) }))\n for (const itxn of itxns) {\n if (itxn instanceof ApplicationCallInnerTxnContext) {\n lazyContext.value.notifyApplicationSpies(itxn)\n }\n }\n this.itxnGroups.push(new ItxnGroup(itxns))\n this.constructingItxnGroup = []\n }\n\n /**\n * Gets the last inner transaction group.\n * @returns The last inner transaction group.\n */\n lastItxnGroup() {\n return this.getItxnGroup()\n }\n\n /**\n * Gets an inner transaction group by index.\n * @param index The index of the group. If not provided, the last group is returned.\n * @returns The inner transaction group.\n * @throws If the index is invalid or there are no previous inner transactions.\n */\n getItxnGroup(index?: Uint64Compat): ItxnGroup {\n const i = index !== undefined ? asNumber(index) : undefined\n\n invariant(this.itxnGroups.length > 0, 'no previous inner transactions')\n if (i !== undefined && i >= this.itxnGroups.length) {\n throw new InternalError('Invalid group index')\n }\n const group = i !== undefined ? this.itxnGroups[i] : this.itxnGroups.at(-1)!\n invariant(group.itxns.length > 0, 'no previous inner transactions')\n\n return group\n }\n\n /**\n * Gets an application transaction by index.\n * @param index The index of the transaction.\n * @returns The application transaction.\n */\n getApplicationCallTransaction(index?: Uint64Compat): ApplicationCallTransaction {\n return this._getTransaction({ type: TransactionType.ApplicationCall, index }) as ApplicationCallTransaction\n }\n\n /**\n * Gets an asset configuration transaction by index.\n * @param index The index of the transaction.\n * @returns The asset configuration transaction.\n */\n getAssetConfigTransaction(index?: Uint64Compat): AssetConfigTransaction {\n return this._getTransaction({ type: TransactionType.AssetConfig, index }) as AssetConfigTransaction\n }\n\n /**\n * Gets an asset transfer transaction by index.\n * @param index The index of the transaction.\n * @returns The asset transfer transaction.\n */\n getAssetTransferTransaction(index?: Uint64Compat): AssetTransferTransaction {\n return this._getTransaction({ type: TransactionType.AssetTransfer, index }) as AssetTransferTransaction\n }\n\n /**\n * Gets an asset freeze transaction by index.\n * @param index The index of the transaction.\n * @returns The asset freeze transaction.\n */\n getAssetFreezeTransaction(index?: Uint64Compat): AssetFreezeTransaction {\n return this._getTransaction({ type: TransactionType.AssetFreeze, index }) as AssetFreezeTransaction\n }\n\n /**\n * Gets a key registration transaction by index.\n * @param index The index of the transaction.\n * @returns The key registration transaction.\n */\n getKeyRegistrationTransaction(index?: Uint64Compat): KeyRegistrationTransaction {\n return this._getTransaction({ type: TransactionType.KeyRegistration, index }) as KeyRegistrationTransaction\n }\n\n /**\n * Gets a payment transaction by index.\n * @param index The index of the transaction.\n * @returns The payment transaction.\n */\n getPaymentTransaction(index?: Uint64Compat): PaymentTransaction {\n return this._getTransaction({ type: TransactionType.Payment, index }) as PaymentTransaction\n }\n\n /**\n * Gets a transaction by index.\n * @param index The index of the transaction.\n * @returns The transaction.\n */\n getTransaction(index?: Uint64Compat): Transaction {\n return this._getTransaction({ index })\n }\n /** @internal */\n private _getTransaction({ type, index }: { type?: TransactionType; index?: Uint64Compat }) {\n const i = index !== undefined ? asNumber(index) : undefined\n if (i !== undefined && i >= lazyContext.activeGroup.transactions.length) {\n throw new InternalError('Invalid group index')\n }\n const transaction = i !== undefined ? lazyContext.activeGroup.transactions[i] : lazyContext.activeGroup.activeTransaction\n if (type === undefined) {\n return transaction\n }\n if (transaction.type !== type) {\n throw new InternalError(`Invalid transaction type: ${transaction.type}`)\n }\n switch (type) {\n case TransactionType.ApplicationCall:\n return transaction as ApplicationCallTransaction\n case TransactionType.Payment:\n return transaction as PaymentTransaction\n case TransactionType.AssetConfig:\n return transaction as AssetConfigTransaction\n case TransactionType.AssetTransfer:\n return transaction as AssetTransferTransaction\n case TransactionType.AssetFreeze:\n return transaction as AssetFreezeTransaction\n case TransactionType.KeyRegistration:\n return transaction as KeyRegistrationTransaction\n default:\n throw new InternalError(`Invalid transaction type: ${type}`)\n }\n }\n}\n\n/**\n * Represents a group of inner transactions.\n */\nexport class ItxnGroup {\n itxns: InnerTxn[] = []\n /** @internal */\n constructor(itxns: InnerTxn[]) {\n this.itxns = itxns\n }\n\n /**\n * Gets an application inner transaction by index.\n * @param index The index of the transaction.\n * @returns The application inner transaction.\n */\n getApplicationCallInnerTxn(index?: Uint64Compat): ApplicationCallInnerTxn {\n return this._getInnerTxn({ type: TransactionType.ApplicationCall, index }) as ApplicationCallInnerTxn\n }\n\n /**\n * Gets an asset configuration inner transaction by index.\n * @param index The index of the transaction.\n * @returns The asset configuration inner transaction.\n */\n getAssetConfigInnerTxn(index?: Uint64Compat): AssetConfigInnerTxn {\n return this._getInnerTxn({ type: TransactionType.AssetConfig, index }) as AssetConfigInnerTxn\n }\n\n /**\n * Gets an asset transfer inner transaction by index.\n * @param index The index of the transaction.\n * @returns The asset transfer inner transaction.\n */\n getAssetTransferInnerTxn(index?: Uint64Compat): AssetTransferInnerTxn {\n return this._getInnerTxn({ type: TransactionType.AssetTransfer, index }) as AssetTransferInnerTxn\n }\n\n /**\n * Gets an asset freeze inner transaction by index.\n * @param index The index of the transaction.\n * @returns The asset freeze inner transaction.\n */\n getAssetFreezeInnerTxn(index?: Uint64Compat): AssetFreezeInnerTxn {\n return this._getInnerTxn({ type: TransactionType.AssetFreeze, index }) as AssetFreezeInnerTxn\n }\n\n /**\n * Gets a key registration inner transaction by index.\n * @param index The index of the transaction.\n * @returns The key registration inner transaction.\n */\n getKeyRegistrationInnerTxn(index?: Uint64Compat): KeyRegistrationInnerTxn {\n return this._getInnerTxn({ type: TransactionType.KeyRegistration, index }) as KeyRegistrationInnerTxn\n }\n\n /**\n * Gets a payment inner transaction by index.\n * @param index The index of the transaction.\n * @returns The payment inner transaction.\n */\n getPaymentInnerTxn(index?: Uint64Compat): PaymentInnerTxn {\n return this._getInnerTxn({ type: TransactionType.Payment, index }) as PaymentInnerTxn\n }\n\n /**\n * Gets an inner transaction by index.\n * @param index The index of the transaction.\n * @returns The inner transaction.\n */\n getInnerTxn(index?: Uint64Compat): InnerTxn {\n return this._getInnerTxn({ index })\n }\n\n /** @internal */\n private _getInnerTxn({ type, index }: { type?: TransactionType; index?: Uint64Compat }) {\n invariant(this.itxns.length > 0, 'no previous inner transactions')\n const i = index !== undefined ? asNumber(index) : undefined\n if (i !== undefined && i >= this.itxns.length) {\n throw new InternalError('Invalid group index')\n }\n const transaction = i !== undefined ? this.itxns[i] : this.itxns.at(-1)!\n if (type === undefined) {\n return transaction\n }\n if (transaction.type !== type) {\n throw new InternalError(`Invalid transaction type: ${transaction.type}`)\n }\n switch (type) {\n case TransactionType.ApplicationCall:\n return transaction as ApplicationCallInnerTxn\n case TransactionType.Payment:\n return transaction as PaymentInnerTxn\n case TransactionType.AssetConfig:\n return transaction as AssetConfigInnerTxn\n case TransactionType.AssetTransfer:\n return transaction as AssetTransferInnerTxn\n case TransactionType.AssetFreeze:\n return transaction as AssetFreezeInnerTxn\n case TransactionType.KeyRegistration:\n return transaction as KeyRegistrationInnerTxn\n default:\n throw new InternalError(`Invalid transaction type: ${type}`)\n }\n }\n}\n","import type {\n Account as AccountType,\n Application as ApplicationType,\n Asset as AssetType,\n biguint,\n BigUintCompat,\n bytes,\n uint64,\n Uint64Compat,\n} from '@algorandfoundation/algorand-typescript'\nimport { randomBytes } from 'crypto'\nimport { MAX_BYTES_SIZE, MAX_UINT512, MAX_UINT64 } from '../constants'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { InternalError } from '../errors'\nimport { BigUint, Bytes, Uint64 } from '../impl/primitives'\nimport type { AssetData } from '../impl/reference'\nimport { Account, AccountData, ApplicationCls, ApplicationData, AssetCls, getDefaultAssetData } from '../impl/reference'\nimport { asBigInt, asBigUintCls, asUint64, asUint64Cls, getRandomBigInt, getRandomBytes } from '../util'\n\ntype AccountContextData = Partial<AccountData['account']> & {\n address?: bytes\n incentiveEligible?: boolean\n lastProposed?: uint64\n lastHeartbeat?: uint64\n optedAssetBalances?: Map<Uint64Compat, Uint64Compat>\n optedApplications?: ApplicationType[]\n}\n\ntype AssetContextData = Partial<AssetData> & { assetId?: Uint64Compat }\n\ntype ApplicationContextData = Partial<ApplicationData['application']> & { applicationId?: Uint64Compat }\n\nexport class AvmValueGenerator {\n /**\n * Generates a random uint64 value within the specified range.\n * @param {Uint64Compat} [minValue=0n] - The minimum value (inclusive).\n * @param {Uint64Compat} [maxValue=MAX_UINT64] - The maximum value (inclusive).\n * @returns {uint64} - A random uint64 value.\n */\n uint64(minValue: Uint64Compat = 0n, maxValue: Uint64Compat = MAX_UINT64): uint64 {\n const min = asBigInt(minValue)\n const max = asBigInt(maxValue)\n if (max > MAX_UINT64) {\n throw new InternalError('maxValue must be less than or equal to 2n ** 64n - 1n')\n }\n if (min > max) {\n throw new InternalError('minValue must be less than or equal to maxValue')\n }\n if (min < 0n || max < 0n) {\n throw new InternalError('minValue and maxValue must be greater than or equal to 0')\n }\n return Uint64(getRandomBigInt(min, max))\n }\n\n /**\n * Generates a random biguint value within the specified range.\n * @param {BigUintCompat} [minValue=0n] - The minimum value (inclusive).\n * @returns {biguint} - A random biguint value.\n */\n biguint(minValue: BigUintCompat = 0n): biguint {\n const min = asBigUintCls(minValue).asBigInt()\n if (min < 0n) {\n throw new InternalError('minValue must be greater than or equal to 0')\n }\n\n return BigUint(getRandomBigInt(min, MAX_UINT512))\n }\n\n /**\n * Generates a random bytes of the specified length.\n * @param {number} [length=MAX_BYTES_SIZE] - The length of the bytes.\n * @returns {bytes} - A random bytes.\n */\n bytes(length = MAX_BYTES_SIZE): bytes {\n return Bytes(new Uint8Array(randomBytes(length)))\n }\n\n /**\n * Generates a random string of the specified length.\n * @param {number} [length=11] - The length of the string.\n * @returns {string} - A random string.\n */\n string(length = 11): string {\n const setLength = 11\n return Array(Math.ceil(length / setLength))\n .fill(0)\n .map(() => Math.random().toString(36).substring(2))\n .join('')\n .substring(0, length)\n }\n\n /**\n * Generates a random account with the specified context data.\n * @param {AccountContextData} [input] - The context data for the account.\n * @returns {Account} - A random account.\n */\n account(input?: AccountContextData): AccountType {\n const account = input?.address ? Account(input.address) : Account(getRandomBytes(32).asAlgoTs())\n\n if (input?.address && lazyContext.ledger.accountDataMap.has(account)) {\n throw new InternalError(\n 'Account with such address already exists in testing context. Use `context.ledger.getAccount(address)` to retrieve the existing account.',\n )\n }\n\n const data = new AccountData()\n const { address, optedAssetBalances, optedApplications, incentiveEligible, lastProposed, lastHeartbeat, ...accountData } = input ?? {}\n data.incentiveEligible = incentiveEligible ?? false\n data.lastProposed = lastProposed\n data.lastHeartbeat = lastHeartbeat\n data.account = {\n ...data.account,\n ...accountData,\n }\n lazyContext.ledger.accountDataMap.set(account, data)\n\n if (input?.optedAssetBalances) {\n for (const [assetId, balance] of input.optedAssetBalances) {\n lazyContext.ledger.updateAssetHolding(account, assetId, balance)\n }\n }\n if (input?.optedApplications) {\n for (const app of input.optedApplications) {\n data.optedApplications.set(asBigInt(app.id), app)\n }\n }\n return account\n }\n\n /**\n * Generates a random asset with the specified context data.\n * @param {AssetContextData} [input] - The context data for the asset.\n * @returns {Asset} - A random asset.\n */\n asset(input?: AssetContextData): AssetType {\n const id = input?.assetId\n if (id && lazyContext.ledger.assetDataMap.has(asUint64(id))) {\n throw new InternalError('Asset with such ID already exists in testing context!')\n }\n const assetId = asUint64Cls(id ?? lazyContext.ledger.assetIdIter.next().value).asAlgoTs()\n const defaultAssetData = getDefaultAssetData()\n const { assetId: _, ...assetData } = input ?? {}\n lazyContext.ledger.assetDataMap.set(assetId, {\n ...defaultAssetData,\n ...assetData,\n })\n return new AssetCls(assetId)\n }\n\n /**\n * Generates a random application with the specified context data.\n * @param {ApplicationContextData} [input] - The context data for the application.\n * @returns {Application} - A random application.\n */\n application(input?: ApplicationContextData): ApplicationType {\n const id = input?.applicationId\n if (id && lazyContext.ledger.applicationDataMap.has(id)) {\n throw new InternalError('Application with such ID already exists in testing context!')\n }\n const applicationId = asUint64Cls(id ?? lazyContext.ledger.appIdIter.next().value).asAlgoTs()\n const data = new ApplicationData()\n const { applicationId: _, ...applicationData } = input ?? {}\n data.application = {\n ...data.application,\n ...applicationData,\n }\n lazyContext.ledger.applicationDataMap.set(applicationId, data)\n return new ApplicationCls(applicationId)\n }\n}\n","import type { arc4 } from '@algorandfoundation/algorand-typescript'\nimport { BITS_IN_BYTE, MAX_UINT128, MAX_UINT16, MAX_UINT256, MAX_UINT32, MAX_UINT512, MAX_UINT64, MAX_UINT8 } from '../constants'\nimport { Address, DynamicBytes, Str, Uint } from '../impl/encoded-types'\nimport { getRandomBigInt, getRandomBytes } from '../util'\nimport { AvmValueGenerator } from './avm'\n\nexport class Arc4ValueGenerator {\n /**\n * Generate a random Algorand address.\n * @returns: A new, random Algorand address.\n * */\n address(): arc4.Address {\n const source = new AvmValueGenerator().account()\n const result = new Address(\n { name: 'Address', genericArgs: { elementType: { name: 'Byte', genericArgs: [{ name: '8' }] }, size: { name: '32' } } },\n source,\n )\n return result\n }\n\n /**\n * Generate a random Uint8 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2 ** 8 - 1.\n * @returns: A random Uint8 value.\n * */\n uint8(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT8): arc4.Uint8 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '8' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint8\n }\n\n /**\n * Generate a random Uint16 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2 ** 16 - 1.\n * @returns: A random Uint16 value.\n * */\n uint16(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT16): arc4.Uint16 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '16' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint16\n }\n\n /**\n * Generate a random Uint32 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2 ** 32 - 1.\n * @returns: A random Uint32 value.\n * */\n uint32(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT32): arc4.Uint32 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '32' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint32\n }\n\n /**\n * Generate a random Uint64 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2n ** 64n - 1n.\n * @returns: A random Uint64 value.\n * */\n uint64(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT64): arc4.Uint64 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '64' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint64\n }\n\n /**\n * Generate a random Uint128 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2n ** 128n - 1n.\n * @returns A random Uint128 value.\n * */\n uint128(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT128): arc4.Uint128 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '128' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint128\n }\n\n /**\n * Generate a random Uint256 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2n ** 256n - 1n.\n * @returns A random Uint256 value.\n * */\n uint256(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT256): arc4.Uint256 {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '256' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint256\n }\n\n /**\n * Generate a random Uint512 within the specified range.\n * @param minValue Minimum value (inclusive). Defaults to 0.\n * @param maxValue Maximum value (inclusive). Defaults to 2n ** 512n - 1n.\n * @returns A random Uint512 value.\n * */\n uint512(minValue: number | bigint = 0, maxValue: number | bigint = MAX_UINT512): arc4.Uint<512> {\n return new Uint({ name: 'Uint', genericArgs: [{ name: '512' }] }, getRandomBigInt(minValue, maxValue)) as arc4.Uint<512>\n }\n\n /**\n * Generate a random dynamic bytes of size `n` bits.\n * @param n The number of bits for the dynamic bytes. Must be a multiple of 8, otherwise\n * the last byte will be truncated.\n * @returns A new, random dynamic bytes of size `n` bits.\n * */\n dynamicBytes(n: number): arc4.DynamicBytes {\n return new DynamicBytes(\n { name: 'DynamicBytes', genericArgs: { elementType: { name: 'Byte', genericArgs: [{ name: '8' }] } } },\n getRandomBytes(n / BITS_IN_BYTE).asAlgoTs(),\n )\n }\n\n /**\n * Generate a random dynamic string of size `n` bits.\n * @param n The number of bits for the string.\n * @returns A new, random string of size `n` bits.\n * */\n str(n: number): arc4.Str {\n // Calculate the number of characters needed (rounding up)\n const numChars = n + 7 // 8\n\n // Generate random string\n const bytes = getRandomBytes(numChars)\n return new Str(JSON.stringify(undefined), bytes.toString()) as unknown as arc4.Str\n }\n}\n","import type { Application as ApplicationType, BaseContract as BaseContractType, gtxn } from '@algorandfoundation/algorand-typescript'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { InternalError } from '../errors'\nimport { BaseContract } from '../impl/base-contract'\nimport { ApplicationCls } from '../impl/reference'\nimport type { ApplicationCallTransactionFields, TxnFields } from '../impl/transactions'\nimport {\n ApplicationCallTransaction,\n AssetConfigTransaction,\n AssetFreezeTransaction,\n AssetTransferTransaction,\n KeyRegistrationTransaction,\n PaymentTransaction,\n} from '../impl/transactions'\n\nexport class TxnValueGenerator {\n /**\n * Generates a random application call transaction with the specified fields.\n * @param {ApplicationCallTransactionFields} [fields] - The fields for the application call transaction where `appId` value can be instance of Application or BaseContract.\n * @returns {ApplicationCallTransaction} - A random application call transaction.\n */\n applicationCall(\n fields?: Partial<Omit<ApplicationCallTransactionFields, 'appId'> & { appId: ApplicationType | BaseContractType }>,\n ): ApplicationCallTransaction {\n const params = fields ?? {}\n let appId =\n params.appId instanceof ApplicationCls\n ? params.appId\n : params.appId instanceof BaseContract\n ? lazyContext.ledger.getApplicationForContract(params.appId)\n : undefined\n if (appId && !lazyContext.ledger.applicationDataMap.has(appId.id)) {\n throw new InternalError(`Application ID ${appId.id} not found in test context`)\n }\n if (!appId) {\n appId = lazyContext.any.application()\n }\n\n return ApplicationCallTransaction.create({ ...params, appId })\n }\n\n /**\n * Generates a random payment transaction with the specified fields.\n * @param {TxnFields<gtxn.PaymentTxn>} [fields] - The fields for the payment transaction.\n * @returns {PaymentTransaction} - A random payment transaction.\n */\n payment(fields?: TxnFields<gtxn.PaymentTxn>): PaymentTransaction {\n return PaymentTransaction.create(fields ?? {})\n }\n\n /**\n * Generates a random key registration transaction with the specified fields.\n * @param {TxnFields<gtxn.KeyRegistrationTxn>} [fields] - The fields for the key registration transaction.\n * @returns {KeyRegistrationTransaction} - A random key registration transaction.\n */\n keyRegistration(fields?: TxnFields<gtxn.KeyRegistrationTxn>): KeyRegistrationTransaction {\n return KeyRegistrationTransaction.create(fields ?? {})\n }\n\n /**\n * Generates a random asset configuration transaction with the specified fields.\n * @param {TxnFields<gtxn.AssetConfigTxn>} [fields] - The fields for the asset configuration transaction.\n * @returns {AssetConfigTransaction} - A random asset configuration transaction.\n */\n assetConfig(fields?: TxnFields<gtxn.AssetConfigTxn>): AssetConfigTransaction {\n return AssetConfigTransaction.create(fields ?? {})\n }\n\n /**\n * Generates a random asset transfer transaction with the specified fields.\n * @param {TxnFields<gtxn.AssetTransferTxn>} [fields] - The fields for the asset transfer transaction.\n * @returns {AssetTransferTransaction} - A random asset transfer transaction.\n */\n assetTransfer(fields?: TxnFields<gtxn.AssetTransferTxn>): AssetTransferTransaction {\n return AssetTransferTransaction.create(fields ?? {})\n }\n\n /**\n * Generates a random asset freeze transaction with the specified fields.\n * @param {TxnFields<gtxn.AssetFreezeTxn>} [fields] - The fields for the asset freeze transaction.\n * @returns {AssetFreezeTransaction} - A random asset freeze transaction.\n */\n assetFreeze(fields?: TxnFields<gtxn.AssetFreezeTxn>): AssetFreezeTransaction {\n return AssetFreezeTransaction.create(fields ?? {})\n }\n}\n","import { Arc4ValueGenerator } from './arc4'\nimport { AvmValueGenerator } from './avm'\nimport { TxnValueGenerator } from './txn'\n\nexport class ValueGenerator extends AvmValueGenerator {\n txn: TxnValueGenerator\n arc4: Arc4ValueGenerator\n\n /** @internal */\n constructor() {\n super()\n this.txn = new TxnValueGenerator()\n this.arc4 = new Arc4ValueGenerator()\n }\n}\n","import type { Account as AccountType, BaseContract, bytes, Contract, LogicSig, uint64 } from '@algorandfoundation/algorand-typescript'\nimport type { ApplicationSpy } from './application-spy'\nimport { DEFAULT_TEMPLATE_VAR_PREFIX } from './constants'\nimport { ContextManager } from './context-helpers/context-manager'\nimport type { DecodedLogs, LogDecoding } from './decode-logs'\nimport { toBytes } from './impl/encoded-types'\nimport type { ApplicationCallInnerTxnContext } from './impl/inner-transactions'\nimport { AccountCls } from './impl/reference'\nimport { ContractContext } from './subcontexts/contract-context'\nimport { LedgerContext } from './subcontexts/ledger-context'\nimport { TransactionContext } from './subcontexts/transaction-context'\nimport type { ConstructorFor, DeliberateAny } from './typescript-helpers'\nimport { getRandomBytes } from './util'\nimport { ValueGenerator } from './value-generators'\n\n/**\n * The `TestExecutionContext` class provides a context for executing tests in an Algorand environment.\n * It manages various contexts such as contract, ledger, and transaction contexts, and provides utilities\n * for generating values, managing accounts, and handling logic signatures.\n *\n * @class\n */\nexport class TestExecutionContext {\n #contractContext: ContractContext\n #ledgerContext: LedgerContext\n #txnContext: TransactionContext\n #valueGenerator: ValueGenerator\n #defaultSender: AccountType\n #activeLogicSigArgs: bytes[]\n #templateVars: Record<string, DeliberateAny> = {}\n #compiledApps: Array<{ key: ConstructorFor<BaseContract>; value: uint64 }> = []\n #compiledLogicSigs: Array<{ key: ConstructorFor<LogicSig>; value: AccountType }> = []\n #applicationSpies: Array<ApplicationSpy<Contract>> = []\n\n /**\n * Creates an instance of `TestExecutionContext`.\n *\n * @param {bytes} [defaultSenderAddress] - The default sender address.\n */\n constructor(defaultSenderAddress?: bytes) {\n ContextManager.instance = this\n this.#contractContext = new ContractContext()\n this.#ledgerContext = new LedgerContext()\n this.#txnContext = new TransactionContext()\n this.#valueGenerator = new ValueGenerator()\n this.#defaultSender = this.any.account({ address: defaultSenderAddress ?? getRandomBytes(32).asAlgoTs() })\n this.#activeLogicSigArgs = []\n }\n\n /**\n * Exports logs for a given application ID and decoding.\n *\n * @template T\n * @param {uint64} appId - The application ID.\n * @param {...T} decoding - The log decoding.\n * @returns {DecodedLogs<T>}\n */\n exportLogs<const T extends [...LogDecoding[]]>(appId: uint64, ...decoding: T): DecodedLogs<T> {\n return this.txn.exportLogs(appId, ...decoding)\n }\n\n /**\n * Returns the contract context.\n *\n * @type {ContractContext}\n */\n get contract() {\n return this.#contractContext\n }\n\n /**\n * Returns the ledger context.\n *\n * @type {LedgerContext}\n */\n get ledger() {\n return this.#ledgerContext\n }\n\n /**\n * Returns the transaction context.\n *\n * @type {TransactionContext}\n */\n get txn() {\n return this.#txnContext\n }\n\n /**\n * Returns the value generator.\n *\n * @type {ValueGenerator}\n */\n get any() {\n return this.#valueGenerator\n }\n\n /**\n * Returns the default sender account.\n *\n * @type {Account}\n */\n get defaultSender(): AccountType {\n return this.#defaultSender\n }\n\n /**\n * Sets the default sender account.\n *\n * @param {bytes | AccountType} val - The default sender account.\n */\n set defaultSender(val: bytes | AccountType) {\n if (val instanceof AccountCls) {\n this.#defaultSender = val\n } else if (this.#defaultSender.bytes !== val) {\n this.#defaultSender = new AccountCls(val as bytes)\n }\n }\n\n /**\n * Returns the active logic signature arguments.\n *\n * @type {bytes[]}\n */\n get activeLogicSigArgs(): bytes[] {\n return this.#activeLogicSigArgs\n }\n\n /**\n * Returns the template variables.\n *\n * @type {Record<string, DeliberateAny>}\n */\n get templateVars(): Record<string, DeliberateAny> {\n return this.#templateVars\n }\n\n /**\n * Executes a logic signature with the given arguments.\n *\n * @param {LogicSig} logicSig - The logic signature to execute.\n * @param {...unknown[]} args - The arguments for the logic signature.\n * @returns {boolean | uint64}\n */\n executeLogicSig(logicSig: LogicSig, ...args: unknown[]): boolean | uint64 {\n this.#activeLogicSigArgs = args.map((a) => toBytes(a))\n try {\n if (logicSig.program.length === 0) {\n return logicSig.program()\n } else {\n return logicSig.program(...args)\n }\n } finally {\n this.#activeLogicSigArgs = []\n }\n }\n\n /**\n * Sets a template variable.\n *\n * @param {string} name - The name of the template variable.\n * @param {DeliberateAny} value - The value of the template variable.\n * @param {string} [prefix] - The prefix for the template variable.\n */\n setTemplateVar(name: string, value: DeliberateAny, prefix?: string) {\n this.#templateVars[(prefix ?? DEFAULT_TEMPLATE_VAR_PREFIX) + name] = value\n }\n\n /**\n * Gets a compiled application by contract.\n *\n * @param {ConstructorFor<BaseContract>} contract - The contract class.\n * @returns {[ConstructorFor<BaseContract>, uint64] | undefined}\n */\n getCompiledAppEntry(contract: ConstructorFor<BaseContract>) {\n return this.#compiledApps.find(({ key: k }) => k === contract)\n }\n\n /**\n * Sets a compiled application.\n *\n * @param {ConstructorFor<BaseContract>} c - The contract class.\n * @param {uint64} appId - The application ID.\n */\n setCompiledApp(c: ConstructorFor<BaseContract>, appId: uint64) {\n const existing = this.getCompiledAppEntry(c)\n if (existing) {\n existing.value = appId\n } else {\n this.#compiledApps.push({ key: c, value: appId })\n }\n }\n\n /** @internal */\n notifyApplicationSpies(itxn: ApplicationCallInnerTxnContext) {\n for (const spy of this.#applicationSpies) {\n spy.notify(itxn)\n }\n }\n\n /**\n * Adds an application spy to the context.\n *\n * @param {ApplicationSpy<TContract>} spy - The application spy to add.\n */\n addApplicationSpy<TContract extends Contract>(spy: ApplicationSpy<TContract>) {\n this.#applicationSpies.push(spy)\n }\n\n /**\n * Gets a compiled logic signature.\n *\n * @param {ConstructorFor<LogicSig>} logicsig - The logic signature class.\n * @returns {[ConstructorFor<LogicSig>, Account] | undefined}\n */\n getCompiledLogicSigEntry(logicsig: ConstructorFor<LogicSig>) {\n return this.#compiledLogicSigs.find(({ key: k }) => k === logicsig)\n }\n\n /**\n * Sets a compiled logic signature.\n *\n * @param {ConstructorFor<LogicSig>} c - The logic signature class.\n * @param {Account} account - The account associated with the logic signature.\n */\n setCompiledLogicSig(c: ConstructorFor<LogicSig>, account: AccountType) {\n const existing = this.getCompiledLogicSigEntry(c)\n if (existing) {\n existing.value = account\n } else {\n this.#compiledLogicSigs.push({ key: c, value: account })\n }\n }\n\n /**\n * Reinitializes the execution context, clearing all state variables and resetting internal components.\n * Invoked between test cases to ensure isolation.\n */\n reset() {\n this.#contractContext = new ContractContext()\n this.#ledgerContext = new LedgerContext()\n this.#txnContext = new TransactionContext()\n this.#activeLogicSigArgs = []\n this.#templateVars = {}\n this.#compiledApps = []\n this.#compiledLogicSigs = []\n this.#applicationSpies = []\n this.#defaultSender = this.any.account({ address: this.#defaultSender.bytes }) // reset default sender account data in ledger context\n ContextManager.reset()\n ContextManager.instance = this\n }\n}\n"],"names":["Address"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,MAAM,UAAU,GAAG;AACjB,IAAA,QAAQ,EAAE,CAAC,EAAY,EAAE,IAAwB,KAAc;QAC7D,OAAO,CAAC,GAAG,KAAI;AACb,YAAA,IAAI,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;gBACrE,EAAE,CAAC,GAAqC,CAAC;YAC3C;AACF,QAAA,CAAC;IACH,CAAC;IACD,cAAc,EAAE,CAAC,EAAY,EAAE,aAAoB,EAAE,IAAwB,KAAc;QACzF,OAAO,CAAC,GAAG,KAAI;YACb,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;gBAC3E,EAAE,CAAC,GAAG,CAAC;YACT;AACF,QAAA,CAAC;IACH,CAAC;CACF;AAED;;;;;AAKG;MACU,cAA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l as Application, j as Asset, P as BaseContract, C as Big
5
5
  import { a as toBytes, g as getEncoder, b as getArc4Encoded, s as sha512_256, F as FixedArray } from '../asset-params-C64LPAdX.js';
6
6
  import { b as getContractMethod } from '../runtime-helpers-qYkqK3cG.js';
7
7
  export { C as Contract, c as abimethod, d as baremethod, r as readonly } from '../runtime-helpers-qYkqK3cG.js';
8
- import { C as CodeError } from '../typescript-helpers-sobuICoc.js';
8
+ import { A as AssertError, a as AvmError, C as CodeError } from '../typescript-helpers-sobuICoc.js';
9
9
  export { a as Global } from '../pure-BGAOjiS7.js';
10
10
  import { ARC4Encoded } from '@algorandfoundation/algorand-typescript/arc4';
11
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-BNbmDFGO.js';
@@ -83,6 +83,36 @@ function compile(artefact, options) {
83
83
  function log(...args) {
84
84
  lazyContext.txn.appendLog(args.map((a) => toBytes(a)).reduce((left, right) => left.concat(right)));
85
85
  }
86
+ /** @internal */
87
+ function loggedAssert(condition, code, messageOrOptions) {
88
+ if (!condition) {
89
+ const errorMessage = resolveErrorMessage(code, messageOrOptions);
90
+ log(errorMessage);
91
+ throw new AssertError(errorMessage);
92
+ }
93
+ }
94
+ /** @internal */
95
+ function loggedErr(code, messageOrOptions) {
96
+ const errorMessage = resolveErrorMessage(code, messageOrOptions);
97
+ log(errorMessage);
98
+ throw new AvmError(errorMessage);
99
+ }
100
+ const VALID_PREFIXES = new Set(['ERR', 'AER']);
101
+ function resolveErrorMessage(code, messageOrOptions) {
102
+ const message = typeof messageOrOptions === 'string' ? messageOrOptions : messageOrOptions?.message;
103
+ const prefix = typeof messageOrOptions === 'string' ? undefined : (messageOrOptions?.prefix ?? 'ERR');
104
+ if (code.includes(':')) {
105
+ throw new CodeError("error code must not contain domain separator ':'");
106
+ }
107
+ if (message && message.includes(':')) {
108
+ throw new CodeError("error message must not contain domain separator ':'");
109
+ }
110
+ const prefixStr = prefix || 'ERR';
111
+ if (!VALID_PREFIXES.has(prefixStr)) {
112
+ throw new CodeError('error prefix must be one of AER, ERR');
113
+ }
114
+ return message ? `${prefixStr}:${code}:${message}` : `${prefixStr}:${code}`;
115
+ }
86
116
 
87
117
  /** @internal */
88
118
  function emit(typeInfoString, event, ...eventProps) {
@@ -260,5 +290,5 @@ const itxn = {
260
290
  applicationCall,
261
291
  };
262
292
 
263
- export { TemplateVar, assert, assertMatch, clone, compile, emit, ensureBudget, gtxn, itxn, itxnCompose, log, match, urange, validateEncoding };
293
+ export { TemplateVar, assert, assertMatch, clone, compile, emit, ensureBudget, gtxn, itxn, itxnCompose, log, loggedAssert, loggedErr, match, urange, validateEncoding };
264
294
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/impl/clone.ts","../../src/impl/validate-encoding.ts","../../src/impl/compiled.ts","../../src/impl/log.ts","../../src/impl/emit.ts","../../src/impl/ensure-budget.ts","../../src/impl/match.ts","../../src/impl/template-var.ts","../../src/impl/urange.ts","../../src/impl/itxn-compose.ts","../../src/internal/index.ts"],"sourcesContent":["import { getEncoder, toBytes } from './encoded-types'\n\n/** @internal */\nexport function clone<T>(typeInfoString: string, value: T): T {\n if (value && typeof value === 'object' && 'copy' in value && typeof value.copy === 'function') {\n return value.copy() as T\n }\n const bytes = toBytes(value, typeInfoString)\n const typeInfo = JSON.parse(typeInfoString)\n const encoder = getEncoder(typeInfo)\n return encoder(bytes, typeInfo) as T\n}\n","/** @internal */\nexport function validateEncoding<T>(_value: T) {}\n","import type {\n Account,\n BaseContract,\n CompileContractOptions,\n CompiledContract,\n CompiledLogicSig,\n CompileLogicSigOptions,\n LogicSig,\n} from '@algorandfoundation/algorand-typescript'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport type { ConstructorFor } from '../typescript-helpers'\nimport type { ApplicationData } from './reference'\n\n/** @internal */\nexport function compile(\n artefact: ConstructorFor<BaseContract> | ConstructorFor<LogicSig>,\n options?: CompileContractOptions | CompileLogicSigOptions,\n): CompiledLogicSig | CompiledContract {\n let app: ApplicationData | undefined\n let account: Account | undefined\n const compiledAppEntry = lazyContext.value.getCompiledAppEntry(artefact as ConstructorFor<BaseContract>)\n const compiledLogicSigEntry = lazyContext.value.getCompiledLogicSigEntry(artefact as ConstructorFor<LogicSig>)\n if (compiledAppEntry !== undefined) {\n app = lazyContext.ledger.applicationDataMap.get(compiledAppEntry.value)\n }\n if (compiledLogicSigEntry !== undefined) {\n account = compiledLogicSigEntry.value\n }\n if (options?.templateVars) {\n Object.entries(options.templateVars).forEach(([key, value]) => {\n lazyContext.value.setTemplateVar(key, value, options.templateVarsPrefix)\n })\n }\n return new Proxy({} as CompiledLogicSig | CompiledContract, {\n get: (_target, prop) => {\n switch (prop) {\n case 'approvalProgram':\n return app?.application.approvalProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)]\n case 'clearStateProgram':\n return app?.application.clearStateProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)]\n case 'extraProgramPages':\n return (options as CompileContractOptions)?.extraProgramPages ?? app?.application.extraProgramPages ?? lazyContext.any.uint64()\n case 'globalUints':\n return (options as CompileContractOptions)?.globalUints ?? app?.application.globalNumUint ?? lazyContext.any.uint64()\n case 'globalBytes':\n return (options as CompileContractOptions)?.globalBytes ?? app?.application.globalNumBytes ?? lazyContext.any.uint64()\n case 'localUints':\n return (options as CompileContractOptions)?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64()\n case 'localBytes':\n return (options as CompileContractOptions)?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64()\n case 'account':\n return account ?? lazyContext.any.account()\n }\n },\n })\n}\n","import type { BytesBacked, StringCompat } from '@algorandfoundation/algorand-typescript'\nimport { lazyContext } from '../context-helpers/internal-context'\n\nimport { toBytes } from './encoded-types'\nimport type { StubBigUintCompat, StubBytesCompat, StubUint64Compat } from './primitives'\n\n/** @internal */\nexport function log(...args: Array<StubUint64Compat | StubBytesCompat | StubBigUintCompat | StringCompat | BytesBacked>): void {\n lazyContext.txn.appendLog(args.map((a) => toBytes(a)).reduce((left, right) => left.concat(right)))\n}\n","import { CodeError } from '../errors'\nimport type { DeliberateAny } from '../typescript-helpers'\nimport { sha512_256 } from './crypto'\nimport { getArc4Encoded, getArc4TypeName } from './encoded-types'\nimport { log } from './log'\n\n/** @internal */\nexport function emit<T>(typeInfoString: string, event: T | string, ...eventProps: unknown[]) {\n let eventData\n let eventName\n if (typeof event === 'string') {\n eventData = getArc4Encoded(eventProps)\n eventName = event\n const argTypes = getArc4TypeName((eventData as DeliberateAny).typeInfo)!\n if (eventName.indexOf('(') === -1) {\n eventName += argTypes\n } else if (event.indexOf(argTypes) === -1) {\n throw new CodeError(`Event signature ${event} does not match arg types ${argTypes}`)\n }\n } else {\n eventData = getArc4Encoded(event)\n const typeInfo = JSON.parse(typeInfoString)\n const argTypes = getArc4TypeName((eventData as DeliberateAny).typeInfo)!\n eventName = typeInfo.name.replace(/.*</, '').replace(/>.*/, '') + argTypes\n }\n\n const eventHash = sha512_256(eventName)\n log(eventHash.slice(0, 4).concat(eventData.bytes))\n}\n","import type { uint64 } from '@algorandfoundation/algorand-typescript'\nimport { OpUpFeeSource } from '@algorandfoundation/algorand-typescript'\n\n/** @internal */\nexport function ensureBudget(_budget: uint64, _feeSource: OpUpFeeSource = OpUpFeeSource.GroupCredit) {\n // ensureBudget function is emulated to be a no-op\n}\n","import type { assertMatch as _assertMatch, match as _match } from '@algorandfoundation/algorand-typescript'\nimport { ARC4Encoded } from '@algorandfoundation/algorand-typescript/arc4'\nimport type { DeliberateAny } from '../typescript-helpers'\nimport { asBytes, asMaybeBigUintCls, assert } from '../util'\nimport { BytesBackedCls, Uint64BackedCls } from './base'\nimport { FixedArray } from './encoded-types/encoded-types'\nimport type { StubBytesCompat, Uint64Cls } from './primitives'\nimport { BytesCls } from './primitives'\n\n/** @internal */\nexport const match: typeof _match = (subject, test): boolean => {\n if (Object.hasOwn(test, 'not')) {\n return !match(subject, (test as DeliberateAny).not)\n }\n const bigIntSubjectValue = getBigIntValue(subject)\n if (bigIntSubjectValue !== undefined) {\n const bigIntTestValue = getBigIntValue(test)\n if (bigIntTestValue !== undefined) {\n return bigIntSubjectValue === bigIntTestValue\n } else if (Object.hasOwn(test, 'lessThan')) {\n return bigIntSubjectValue < getBigIntValue((test as DeliberateAny).lessThan)!\n } else if (Object.hasOwn(test, 'greaterThan')) {\n return bigIntSubjectValue > getBigIntValue((test as DeliberateAny).greaterThan)!\n } else if (Object.hasOwn(test, 'lessThanEq')) {\n return bigIntSubjectValue <= getBigIntValue((test as DeliberateAny).lessThanEq)!\n } else if (Object.hasOwn(test, 'greaterThanEq')) {\n return bigIntSubjectValue >= getBigIntValue((test as DeliberateAny).greaterThanEq)!\n } else if (Object.hasOwn(test, 'between')) {\n const [start, end] = (test as DeliberateAny).between\n return bigIntSubjectValue >= getBigIntValue(start)! && bigIntSubjectValue <= getBigIntValue(end)!\n }\n } else if (subject instanceof BytesCls) {\n return subject.equals(asBytes(test as unknown as StubBytesCompat))\n } else if (typeof subject === 'string') {\n return subject === test\n } else if (subject instanceof BytesBackedCls) {\n return subject.bytes.equals((test as unknown as BytesBackedCls).bytes)\n } else if (subject instanceof Uint64BackedCls) {\n return match(\n getBigIntValue(subject.uint64 as unknown as Uint64Cls),\n getBigIntValue((test as unknown as Uint64BackedCls).uint64 as unknown as Uint64Cls),\n )\n } else if (test instanceof ARC4Encoded) {\n return (subject as unknown as ARC4Encoded).bytes.equals(test.bytes)\n } else if (Array.isArray(test)) {\n return (\n (subject as DeliberateAny).length === test.length &&\n test.map((x, i) => match((subject as DeliberateAny)[i], x as DeliberateAny)).every((x) => x)\n )\n } else if (test instanceof FixedArray) {\n return test.items.map((x, i) => match((subject as DeliberateAny[])[i], x as DeliberateAny)).every((x) => x)\n } else if (typeof test === 'object') {\n return Object.entries(test!)\n .map(([k, v]) => match((subject as DeliberateAny)[k], v as DeliberateAny))\n .every((x) => x)\n }\n return false\n}\n\n/** @internal */\nexport const assertMatch: typeof _assertMatch = (subject, test, message): void => {\n const isMatching = match(subject, test)\n assert(isMatching, message)\n}\n\nconst getBigIntValue = (x: unknown) => {\n return asMaybeBigUintCls(x)?.asBigInt()\n}\n","import { DEFAULT_TEMPLATE_VAR_PREFIX } from '../constants'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { CodeError } from '../errors'\n\n/** @internal */\nexport function TemplateVar<T>(variableName: string, prefix = DEFAULT_TEMPLATE_VAR_PREFIX): T {\n const key = prefix + variableName\n if (!Object.hasOwn(lazyContext.value.templateVars, key)) {\n throw new CodeError(`Template variable ${key} not found in test context!`)\n }\n return lazyContext.value.templateVars[prefix + variableName] as T\n}\n","import { asBigInt, asUint64 } from '../util'\nimport type { StubUint64Compat } from './primitives'\n\n/** @internal */\nexport function* urange(a: StubUint64Compat, b?: StubUint64Compat, c?: StubUint64Compat) {\n const start = b ? asBigInt(a) : BigInt(0)\n const end = b ? asBigInt(b) : asBigInt(a)\n const step = c ? asBigInt(c) : BigInt(1)\n let iterationCount = 0\n for (let i = start; i < end; i += step) {\n iterationCount++\n yield asUint64(i)\n }\n return iterationCount\n}\n","import type {\n ItxnCompose as _ItxnCompose,\n AnyTransactionComposeFields,\n ApplicationCallComposeFields,\n AssetConfigComposeFields,\n AssetFreezeComposeFields,\n AssetTransferComposeFields,\n ComposeItxnParams,\n Contract,\n KeyRegistrationComposeFields,\n PaymentComposeFields,\n} from '@algorandfoundation/algorand-typescript'\nimport type { AbiCallOptions, TypedApplicationCallFields } from '@algorandfoundation/algorand-typescript/arc4'\nimport { getContractMethod } from '../abi-metadata'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport type { DeliberateAny, InstanceMethod } from '../typescript-helpers'\nimport { getApplicationCallInnerTxnContext } from './c2c'\n\nclass ItxnCompose {\n begin(fields: PaymentComposeFields): void\n begin(fields: KeyRegistrationComposeFields): void\n begin(fields: AssetConfigComposeFields): void\n begin(fields: AssetTransferComposeFields): void\n begin(fields: AssetFreezeComposeFields): void\n begin(fields: ApplicationCallComposeFields): void\n begin(fields: AnyTransactionComposeFields): void\n begin(fields: ComposeItxnParams): void\n begin<TArgs extends DeliberateAny[]>(\n method: InstanceMethod<Contract, TArgs>,\n fields: TypedApplicationCallFields<TArgs>,\n contract?: Contract | { new (): Contract },\n ): void\n begin<TMethod>(options: AbiCallOptions<TMethod>, contract: string, method: string): void\n begin(...args: unknown[]): void {\n this.addInnerTransaction(...args)\n }\n\n next(fields: PaymentComposeFields): void\n next(fields: KeyRegistrationComposeFields): void\n next(fields: AssetConfigComposeFields): void\n next(fields: AssetTransferComposeFields): void\n next(fields: AssetFreezeComposeFields): void\n next(fields: ApplicationCallComposeFields): void\n next(fields: AnyTransactionComposeFields): void\n next(fields: ComposeItxnParams): void\n next<TArgs extends DeliberateAny[]>(\n _method: InstanceMethod<Contract, TArgs>,\n _fields: TypedApplicationCallFields<TArgs>,\n contract?: Contract | { new (): Contract },\n ): void\n next<TMethod>(options: AbiCallOptions<TMethod>, contract: string, method: string): void\n next(...args: unknown[]): void {\n this.addInnerTransaction(...args)\n }\n\n submit(): void {\n lazyContext.txn.activeGroup.submitInnerTransactionGroup()\n }\n\n private addInnerTransaction<TArgs extends DeliberateAny[]>(...args: unknown[]): void {\n let innerTxnFields\n\n // Single argument: direct transaction fields\n if (args.length === 1) {\n innerTxnFields = args[0] as AnyTransactionComposeFields\n }\n // Three arguments with object fields (deprecated signature):\n // e.g. `itxnCompose.begin(Hello.prototype.greet, { appId, args: ['ho'] })`\n else if (args.length === 3 && typeof args[1] === 'object') {\n innerTxnFields = getApplicationCallInnerTxnContext(\n args[0] as InstanceMethod<Contract, TArgs>,\n args[1] as TypedApplicationCallFields<TArgs>,\n args[2] as Contract | { new (): Contract },\n )\n }\n // Three arguments with string contract name:\n // e.g. `itxnCompose.next({ method: Hello.prototype.greet, appId, args: ['ho'] })`\n // or `itxnCompose.next<typeof Hello.prototype.greet>({ appId, args: ['ho'] })`\n else {\n const contractFullName = args[1] as string\n const methodName = args[2] as string\n const { method, contract } = getContractMethod(contractFullName, methodName)\n\n innerTxnFields = getApplicationCallInnerTxnContext(method, args[0] as TypedApplicationCallFields<TArgs>, contract)\n }\n\n lazyContext.txn.activeGroup.constructingItxnGroup.push(innerTxnFields)\n }\n}\n\n/** @internal */\nexport const itxnCompose: _ItxnCompose = new ItxnCompose()\n","/** @internal */\nexport * from '@algorandfoundation/algorand-typescript'\n/** @internal */\nexport { BaseContract, contract } from '../impl/base-contract'\n/** @internal */\nexport { clone } from '../impl/clone'\n/** @internal */\nexport { validateEncoding } from '../impl/validate-encoding'\n/** @internal */\nexport { compile } from '../impl/compiled'\n/** @internal */\nexport { abimethod, baremethod, Contract, readonly } from '../impl/contract'\n/** @internal */\nexport { emit } from '../impl/emit'\n/** @internal */\nexport { ensureBudget } from '../impl/ensure-budget'\n/** @internal */\nexport { Global } from '../impl/global'\n/** @internal */\nexport { log } from '../impl/log'\n/** @internal */\nexport { assertMatch, match } from '../impl/match'\n/** @internal */\nexport { BigUint, Bytes, Uint64 } from '../impl/primitives'\n/** @internal */\nexport { Account, Application, Asset } from '../impl/reference'\n/** @internal */\nexport { Box, BoxMap, GlobalState, LocalState } from '../impl/state'\n/** @internal */\nexport { TemplateVar } from '../impl/template-var'\n/** @internal */\nexport { Txn } from '../impl/txn'\n/** @internal */\nexport { urange } from '../impl/urange'\n/** @internal */\nexport { assert, err } from '../util'\n/** @internal */\nexport * as arc4 from './arc4'\n/** @internal */\nexport * as op from './op'\nimport {\n ApplicationCallTxn,\n AssetConfigTxn,\n AssetFreezeTxn,\n AssetTransferTxn,\n KeyRegistrationTxn,\n PaymentTxn,\n Transaction,\n} from '../impl/gtxn'\n/** @internal */\nexport const gtxn = {\n Transaction,\n PaymentTxn,\n KeyRegistrationTxn,\n AssetConfigTxn,\n AssetTransferTxn,\n AssetFreezeTxn,\n ApplicationCallTxn,\n}\n\nimport { applicationCall, assetConfig, assetFreeze, assetTransfer, keyRegistration, payment, submitGroup } from '../impl/inner-transactions'\n/** @internal */\nexport const itxn = {\n submitGroup,\n payment,\n keyRegistration,\n assetConfig,\n assetTransfer,\n assetFreeze,\n applicationCall,\n}\n\n/** @internal */\nexport { itxnCompose } from '../impl/itxn-compose'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACM,SAAU,KAAK,CAAI,cAAsB,EAAE,KAAQ,EAAA;AACvD,IAAA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;AAC7F,QAAA,OAAO,KAAK,CAAC,IAAI,EAAO;IAC1B;IACA,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;AAC3C,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC;AACpC,IAAA,OAAO,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAM;AACtC;;ACXA;AACM,SAAU,gBAAgB,CAAI,MAAS,IAAG;;ACYhD;AACM,SAAU,OAAO,CACrB,QAAiE,EACjE,OAAyD,EAAA;AAEzD,IAAA,IAAI,GAAgC;AACpC,IAAA,IAAI,OAA4B;IAChC,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAwC,CAAC;IACxG,MAAM,qBAAqB,GAAG,WAAW,CAAC,KAAK,CAAC,wBAAwB,CAAC,QAAoC,CAAC;AAC9G,IAAA,IAAI,gBAAgB,KAAK,SAAS,EAAE;AAClC,QAAA,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC;IACzE;AACA,IAAA,IAAI,qBAAqB,KAAK,SAAS,EAAE;AACvC,QAAA,OAAO,GAAG,qBAAqB,CAAC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Q,mBAAmB,CAAgC,GAAG,IAAe,EAAA;AAC3E,QAAA,IAAI,cAAc;;AAGlB,QAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACrB,YAAA,cAAc,GAAG,IAAI,CAAC,CAAC,CAAgC;QACzD;;;AAGK,aAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;AACzD,YAAA,cAAc,GAAG,iCAAiC,CAChD,IAAI,CAAC,CAAC,CAAoC,EAC1C,IAAI,CAAC,CAAC,CAAsC,EAC5C,IAAI,CAAC,CAAC,CAAoC,CAC3C;QACH;;;;aAIK;AACH,YAAA,MAAM,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAW;AAC1C,YAAA,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAW;AACpC,YAAA,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,iBAAiB,CAAC,gBAAgB,EAAE,UAAU,CAAC;AAE5E,YAAA,cAAc,GAAG,iCAAiC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAsC,EAAE,QAAQ,CAAC;QACpH;QAEA,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,qBAAqB,CAAC,IAAI,CAAC,cAAc,CAAC;IACxE;AACD;AAED;AACO,MAAM,WAAW,GAAiB,IAAI,WAAW;;AC3FxD;AAiDA;AACO,MAAM,IAAI,GAAG;IAClB,WAAW;IACX,UAAU;IACV,kBAAkB;IAClB,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,kBAAkB;;AAIpB;AACO,MAAM,IAAI,GAAG;IAClB,WAAW;IACX,OAAO;IACP,eAAe;IACf,WAAW;IACX,aAAa;IACb,WAAW;IACX,eAAe;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/impl/clone.ts","../../src/impl/validate-encoding.ts","../../src/impl/compiled.ts","../../src/impl/log.ts","../../src/impl/emit.ts","../../src/impl/ensure-budget.ts","../../src/impl/match.ts","../../src/impl/template-var.ts","../../src/impl/urange.ts","../../src/impl/itxn-compose.ts","../../src/internal/index.ts"],"sourcesContent":["import { getEncoder, toBytes } from './encoded-types'\n\n/** @internal */\nexport function clone<T>(typeInfoString: string, value: T): T {\n if (value && typeof value === 'object' && 'copy' in value && typeof value.copy === 'function') {\n return value.copy() as T\n }\n const bytes = toBytes(value, typeInfoString)\n const typeInfo = JSON.parse(typeInfoString)\n const encoder = getEncoder(typeInfo)\n return encoder(bytes, typeInfo) as T\n}\n","/** @internal */\nexport function validateEncoding<T>(_value: T) {}\n","import type {\n Account,\n BaseContract,\n CompileContractOptions,\n CompiledContract,\n CompiledLogicSig,\n CompileLogicSigOptions,\n LogicSig,\n} from '@algorandfoundation/algorand-typescript'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport type { ConstructorFor } from '../typescript-helpers'\nimport type { ApplicationData } from './reference'\n\n/** @internal */\nexport function compile(\n artefact: ConstructorFor<BaseContract> | ConstructorFor<LogicSig>,\n options?: CompileContractOptions | CompileLogicSigOptions,\n): CompiledLogicSig | CompiledContract {\n let app: ApplicationData | undefined\n let account: Account | undefined\n const compiledAppEntry = lazyContext.value.getCompiledAppEntry(artefact as ConstructorFor<BaseContract>)\n const compiledLogicSigEntry = lazyContext.value.getCompiledLogicSigEntry(artefact as ConstructorFor<LogicSig>)\n if (compiledAppEntry !== undefined) {\n app = lazyContext.ledger.applicationDataMap.get(compiledAppEntry.value)\n }\n if (compiledLogicSigEntry !== undefined) {\n account = compiledLogicSigEntry.value\n }\n if (options?.templateVars) {\n Object.entries(options.templateVars).forEach(([key, value]) => {\n lazyContext.value.setTemplateVar(key, value, options.templateVarsPrefix)\n })\n }\n return new Proxy({} as CompiledLogicSig | CompiledContract, {\n get: (_target, prop) => {\n switch (prop) {\n case 'approvalProgram':\n return app?.application.approvalProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)]\n case 'clearStateProgram':\n return app?.application.clearStateProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)]\n case 'extraProgramPages':\n return (options as CompileContractOptions)?.extraProgramPages ?? app?.application.extraProgramPages ?? lazyContext.any.uint64()\n case 'globalUints':\n return (options as CompileContractOptions)?.globalUints ?? app?.application.globalNumUint ?? lazyContext.any.uint64()\n case 'globalBytes':\n return (options as CompileContractOptions)?.globalBytes ?? app?.application.globalNumBytes ?? lazyContext.any.uint64()\n case 'localUints':\n return (options as CompileContractOptions)?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64()\n case 'localBytes':\n return (options as CompileContractOptions)?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64()\n case 'account':\n return account ?? lazyContext.any.account()\n }\n },\n })\n}\n","import type { BytesBacked, StringCompat } from '@algorandfoundation/algorand-typescript'\nimport { lazyContext } from '../context-helpers/internal-context'\n\nimport { AssertError, AvmError, CodeError } from '../errors'\nimport { toBytes } from './encoded-types'\nimport type { StubBigUintCompat, StubBytesCompat, StubUint64Compat } from './primitives'\n\n/** @internal */\nexport function log(...args: Array<StubUint64Compat | StubBytesCompat | StubBigUintCompat | StringCompat | BytesBacked>): void {\n lazyContext.txn.appendLog(args.map((a) => toBytes(a)).reduce((left, right) => left.concat(right)))\n}\n\n/** @internal */\nexport function loggedAssert(\n condition: unknown,\n code: string,\n messageOrOptions?: string | { message?: string | undefined; prefix?: 'ERR' | 'AER' },\n): asserts condition {\n if (!condition) {\n const errorMessage = resolveErrorMessage(code, messageOrOptions)\n log(errorMessage)\n throw new AssertError(errorMessage)\n }\n}\n\n/** @internal */\nexport function loggedErr(code: string, messageOrOptions?: string | { message?: string; prefix?: 'ERR' | 'AER' }): never {\n const errorMessage = resolveErrorMessage(code, messageOrOptions)\n log(errorMessage)\n throw new AvmError(errorMessage)\n}\n\nconst VALID_PREFIXES = new Set(['ERR', 'AER'])\nfunction resolveErrorMessage(code: string, messageOrOptions?: string | { message?: string | undefined; prefix?: 'ERR' | 'AER' }): string {\n const message = typeof messageOrOptions === 'string' ? messageOrOptions : messageOrOptions?.message\n const prefix = typeof messageOrOptions === 'string' ? undefined : (messageOrOptions?.prefix ?? 'ERR')\n\n if (code.includes(':')) {\n throw new CodeError(\"error code must not contain domain separator ':'\")\n }\n\n if (message && message.includes(':')) {\n throw new CodeError(\"error message must not contain domain separator ':'\")\n }\n\n const prefixStr = prefix || 'ERR'\n if (!VALID_PREFIXES.has(prefixStr)) {\n throw new CodeError('error prefix must be one of AER, ERR')\n }\n return message ? `${prefixStr}:${code}:${message}` : `${prefixStr}:${code}`\n}\n","import { CodeError } from '../errors'\nimport type { DeliberateAny } from '../typescript-helpers'\nimport { sha512_256 } from './crypto'\nimport { getArc4Encoded, getArc4TypeName } from './encoded-types'\nimport { log } from './log'\n\n/** @internal */\nexport function emit<T>(typeInfoString: string, event: T | string, ...eventProps: unknown[]) {\n let eventData\n let eventName\n if (typeof event === 'string') {\n eventData = getArc4Encoded(eventProps)\n eventName = event\n const argTypes = getArc4TypeName((eventData as DeliberateAny).typeInfo)!\n if (eventName.indexOf('(') === -1) {\n eventName += argTypes\n } else if (event.indexOf(argTypes) === -1) {\n throw new CodeError(`Event signature ${event} does not match arg types ${argTypes}`)\n }\n } else {\n eventData = getArc4Encoded(event)\n const typeInfo = JSON.parse(typeInfoString)\n const argTypes = getArc4TypeName((eventData as DeliberateAny).typeInfo)!\n eventName = typeInfo.name.replace(/.*</, '').replace(/>.*/, '') + argTypes\n }\n\n const eventHash = sha512_256(eventName)\n log(eventHash.slice(0, 4).concat(eventData.bytes))\n}\n","import type { uint64 } from '@algorandfoundation/algorand-typescript'\nimport { OpUpFeeSource } from '@algorandfoundation/algorand-typescript'\n\n/** @internal */\nexport function ensureBudget(_budget: uint64, _feeSource: OpUpFeeSource = OpUpFeeSource.GroupCredit) {\n // ensureBudget function is emulated to be a no-op\n}\n","import type { assertMatch as _assertMatch, match as _match } from '@algorandfoundation/algorand-typescript'\nimport { ARC4Encoded } from '@algorandfoundation/algorand-typescript/arc4'\nimport type { DeliberateAny } from '../typescript-helpers'\nimport { asBytes, asMaybeBigUintCls, assert } from '../util'\nimport { BytesBackedCls, Uint64BackedCls } from './base'\nimport { FixedArray } from './encoded-types/encoded-types'\nimport type { StubBytesCompat, Uint64Cls } from './primitives'\nimport { BytesCls } from './primitives'\n\n/** @internal */\nexport const match: typeof _match = (subject, test): boolean => {\n if (Object.hasOwn(test, 'not')) {\n return !match(subject, (test as DeliberateAny).not)\n }\n const bigIntSubjectValue = getBigIntValue(subject)\n if (bigIntSubjectValue !== undefined) {\n const bigIntTestValue = getBigIntValue(test)\n if (bigIntTestValue !== undefined) {\n return bigIntSubjectValue === bigIntTestValue\n } else if (Object.hasOwn(test, 'lessThan')) {\n return bigIntSubjectValue < getBigIntValue((test as DeliberateAny).lessThan)!\n } else if (Object.hasOwn(test, 'greaterThan')) {\n return bigIntSubjectValue > getBigIntValue((test as DeliberateAny).greaterThan)!\n } else if (Object.hasOwn(test, 'lessThanEq')) {\n return bigIntSubjectValue <= getBigIntValue((test as DeliberateAny).lessThanEq)!\n } else if (Object.hasOwn(test, 'greaterThanEq')) {\n return bigIntSubjectValue >= getBigIntValue((test as DeliberateAny).greaterThanEq)!\n } else if (Object.hasOwn(test, 'between')) {\n const [start, end] = (test as DeliberateAny).between\n return bigIntSubjectValue >= getBigIntValue(start)! && bigIntSubjectValue <= getBigIntValue(end)!\n }\n } else if (subject instanceof BytesCls) {\n return subject.equals(asBytes(test as unknown as StubBytesCompat))\n } else if (typeof subject === 'string') {\n return subject === test\n } else if (subject instanceof BytesBackedCls) {\n return subject.bytes.equals((test as unknown as BytesBackedCls).bytes)\n } else if (subject instanceof Uint64BackedCls) {\n return match(\n getBigIntValue(subject.uint64 as unknown as Uint64Cls),\n getBigIntValue((test as unknown as Uint64BackedCls).uint64 as unknown as Uint64Cls),\n )\n } else if (test instanceof ARC4Encoded) {\n return (subject as unknown as ARC4Encoded).bytes.equals(test.bytes)\n } else if (Array.isArray(test)) {\n return (\n (subject as DeliberateAny).length === test.length &&\n test.map((x, i) => match((subject as DeliberateAny)[i], x as DeliberateAny)).every((x) => x)\n )\n } else if (test instanceof FixedArray) {\n return test.items.map((x, i) => match((subject as DeliberateAny[])[i], x as DeliberateAny)).every((x) => x)\n } else if (typeof test === 'object') {\n return Object.entries(test!)\n .map(([k, v]) => match((subject as DeliberateAny)[k], v as DeliberateAny))\n .every((x) => x)\n }\n return false\n}\n\n/** @internal */\nexport const assertMatch: typeof _assertMatch = (subject, test, message): void => {\n const isMatching = match(subject, test)\n assert(isMatching, message)\n}\n\nconst getBigIntValue = (x: unknown) => {\n return asMaybeBigUintCls(x)?.asBigInt()\n}\n","import { DEFAULT_TEMPLATE_VAR_PREFIX } from '../constants'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { CodeError } from '../errors'\n\n/** @internal */\nexport function TemplateVar<T>(variableName: string, prefix = DEFAULT_TEMPLATE_VAR_PREFIX): T {\n const key = prefix + variableName\n if (!Object.hasOwn(lazyContext.value.templateVars, key)) {\n throw new CodeError(`Template variable ${key} not found in test context!`)\n }\n return lazyContext.value.templateVars[prefix + variableName] as T\n}\n","import { asBigInt, asUint64 } from '../util'\nimport type { StubUint64Compat } from './primitives'\n\n/** @internal */\nexport function* urange(a: StubUint64Compat, b?: StubUint64Compat, c?: StubUint64Compat) {\n const start = b ? asBigInt(a) : BigInt(0)\n const end = b ? asBigInt(b) : asBigInt(a)\n const step = c ? asBigInt(c) : BigInt(1)\n let iterationCount = 0\n for (let i = start; i < end; i += step) {\n iterationCount++\n yield asUint64(i)\n }\n return iterationCount\n}\n","import type {\n ItxnCompose as _ItxnCompose,\n AnyTransactionComposeFields,\n ApplicationCallComposeFields,\n AssetConfigComposeFields,\n AssetFreezeComposeFields,\n AssetTransferComposeFields,\n ComposeItxnParams,\n Contract,\n KeyRegistrationComposeFields,\n PaymentComposeFields,\n} from '@algorandfoundation/algorand-typescript'\nimport type { AbiCallOptions, TypedApplicationCallFields } from '@algorandfoundation/algorand-typescript/arc4'\nimport { getContractMethod } from '../abi-metadata'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport type { DeliberateAny, InstanceMethod } from '../typescript-helpers'\nimport { getApplicationCallInnerTxnContext } from './c2c'\n\nclass ItxnCompose {\n begin(fields: PaymentComposeFields): void\n begin(fields: KeyRegistrationComposeFields): void\n begin(fields: AssetConfigComposeFields): void\n begin(fields: AssetTransferComposeFields): void\n begin(fields: AssetFreezeComposeFields): void\n begin(fields: ApplicationCallComposeFields): void\n begin(fields: AnyTransactionComposeFields): void\n begin(fields: ComposeItxnParams): void\n begin<TArgs extends DeliberateAny[]>(\n method: InstanceMethod<Contract, TArgs>,\n fields: TypedApplicationCallFields<TArgs>,\n contract?: Contract | { new (): Contract },\n ): void\n begin<TMethod>(options: AbiCallOptions<TMethod>, contract: string, method: string): void\n begin(...args: unknown[]): void {\n this.addInnerTransaction(...args)\n }\n\n next(fields: PaymentComposeFields): void\n next(fields: KeyRegistrationComposeFields): void\n next(fields: AssetConfigComposeFields): void\n next(fields: AssetTransferComposeFields): void\n next(fields: AssetFreezeComposeFields): void\n next(fields: ApplicationCallComposeFields): void\n next(fields: AnyTransactionComposeFields): void\n next(fields: ComposeItxnParams): void\n next<TArgs extends DeliberateAny[]>(\n _method: InstanceMethod<Contract, TArgs>,\n _fields: TypedApplicationCallFields<TArgs>,\n contract?: Contract | { new (): Contract },\n ): void\n next<TMethod>(options: AbiCallOptions<TMethod>, contract: string, method: string): void\n next(...args: unknown[]): void {\n this.addInnerTransaction(...args)\n }\n\n submit(): void {\n lazyContext.txn.activeGroup.submitInnerTransactionGroup()\n }\n\n private addInnerTransaction<TArgs extends DeliberateAny[]>(...args: unknown[]): void {\n let innerTxnFields\n\n // Single argument: direct transaction fields\n if (args.length === 1) {\n innerTxnFields = args[0] as AnyTransactionComposeFields\n }\n // Three arguments with object fields (deprecated signature):\n // e.g. `itxnCompose.begin(Hello.prototype.greet, { appId, args: ['ho'] })`\n else if (args.length === 3 && typeof args[1] === 'object') {\n innerTxnFields = getApplicationCallInnerTxnContext(\n args[0] as InstanceMethod<Contract, TArgs>,\n args[1] as TypedApplicationCallFields<TArgs>,\n args[2] as Contract | { new (): Contract },\n )\n }\n // Three arguments with string contract name:\n // e.g. `itxnCompose.next({ method: Hello.prototype.greet, appId, args: ['ho'] })`\n // or `itxnCompose.next<typeof Hello.prototype.greet>({ appId, args: ['ho'] })`\n else {\n const contractFullName = args[1] as string\n const methodName = args[2] as string\n const { method, contract } = getContractMethod(contractFullName, methodName)\n\n innerTxnFields = getApplicationCallInnerTxnContext(method, args[0] as TypedApplicationCallFields<TArgs>, contract)\n }\n\n lazyContext.txn.activeGroup.constructingItxnGroup.push(innerTxnFields)\n }\n}\n\n/** @internal */\nexport const itxnCompose: _ItxnCompose = new ItxnCompose()\n","/** @internal */\nexport * from '@algorandfoundation/algorand-typescript'\n/** @internal */\nexport { BaseContract, contract } from '../impl/base-contract'\n/** @internal */\nexport { clone } from '../impl/clone'\n/** @internal */\nexport { validateEncoding } from '../impl/validate-encoding'\n/** @internal */\nexport { compile } from '../impl/compiled'\n/** @internal */\nexport { abimethod, baremethod, Contract, readonly } from '../impl/contract'\n/** @internal */\nexport { emit } from '../impl/emit'\n/** @internal */\nexport { ensureBudget } from '../impl/ensure-budget'\n/** @internal */\nexport { Global } from '../impl/global'\n/** @internal */\nexport { log, loggedAssert, loggedErr } from '../impl/log'\n/** @internal */\nexport { assertMatch, match } from '../impl/match'\n/** @internal */\nexport { BigUint, Bytes, Uint64 } from '../impl/primitives'\n/** @internal */\nexport { Account, Application, Asset } from '../impl/reference'\n/** @internal */\nexport { Box, BoxMap, GlobalState, LocalState } from '../impl/state'\n/** @internal */\nexport { TemplateVar } from '../impl/template-var'\n/** @internal */\nexport { Txn } from '../impl/txn'\n/** @internal */\nexport { urange } from '../impl/urange'\n/** @internal */\nexport { assert, err } from '../util'\n/** @internal */\nexport * as arc4 from './arc4'\n/** @internal */\nexport * as op from './op'\nimport {\n ApplicationCallTxn,\n AssetConfigTxn,\n AssetFreezeTxn,\n AssetTransferTxn,\n KeyRegistrationTxn,\n PaymentTxn,\n Transaction,\n} from '../impl/gtxn'\n/** @internal */\nexport const gtxn = {\n Transaction,\n PaymentTxn,\n KeyRegistrationTxn,\n AssetConfigTxn,\n AssetTransferTxn,\n AssetFreezeTxn,\n ApplicationCallTxn,\n}\n\nimport { applicationCall, assetConfig, assetFreeze, assetTransfer, keyRegistration, payment, submitGroup } from '../impl/inner-transactions'\n/** @internal */\nexport const itxn = {\n submitGroup,\n payment,\n keyRegistration,\n assetConfig,\n assetTransfer,\n assetFreeze,\n applicationCall,\n}\n\n/** @internal */\nexport { itxnCompose } from '../impl/itxn-compose'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACM,SAAU,KAAK,CAAI,cAAsB,EAAE,KAAQ,EAAA;AACvD,IAAA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;AAC7F,QAAA,OAAO,KAAK,CAAC,IAAI,EAAO;IAC1B;IACA,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;AAC3C,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC;AACpC,IAAA,OAAO,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAM;AACtC;;ACXA;AACM,SAAU,gBAAgB,CAAI,MAAS,IAAG;;ACYhD;AACM,SAAU,OAAO,CACrB,QAAiE,EACjE,OAAyD,EAAA;AAEzD,IAAA,IAAI,GAAgC;AACpC,IAAA,IAAI,OAA4B;IAChC,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAwC,CAAC;IACxG,MAAM,qBAAqB,GAAG,WAAW,CAAC,KAAK,CAAC,wB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AM,WAAW,GAAiB,IAAI,WAAW;;AC3FxD;AAiDA;AACO,MAAM,IAAI,GAAG;IAClB,WAAW;IACX,UAAU;IACV,kBAAkB;IAClB,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,kBAAkB;;AAIpB;AACO,MAAM,IAAI,GAAG;IAClB,WAAW;IACX,OAAO;IACP,eAAe;IACf,WAAW;IACX,aAAa;IACb,WAAW;IACX,eAAe;;;;;"}
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.3",
7
+ "version": "1.2.0-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": {
@@ -82,10 +82,10 @@ export declare class TestExecutionContext {
82
82
  * Executes a logic signature with the given arguments.
83
83
  *
84
84
  * @param {LogicSig} logicSig - The logic signature to execute.
85
- * @param {...bytes[]} args - The arguments for the logic signature.
85
+ * @param {...unknown[]} args - The arguments for the logic signature.
86
86
  * @returns {boolean | uint64}
87
87
  */
88
- executeLogicSig(logicSig: LogicSig, ...args: bytes[]): boolean | uint64;
88
+ executeLogicSig(logicSig: LogicSig, ...args: unknown[]): boolean | uint64;
89
89
  /**
90
90
  * Sets a template variable.
91
91
  *