From 6516c6a2db7a6a512d2df167855106a66a5d7914 Mon Sep 17 00:00:00 2001 From: Bobby Lat Date: Wed, 22 Jan 2025 13:34:05 +0800 Subject: [PATCH] refactor: export stub implementation of op codes under internal namespace --- src/decode-logs.ts | 4 +-- src/impl/acct-params.ts | 5 ++- src/impl/app-global.ts | 4 +-- src/impl/app-local.ts | 4 +-- src/impl/app-params.ts | 7 ++-- src/impl/asset-holding.ts | 4 +-- src/impl/asset-params.ts | 4 +-- src/impl/block.ts | 4 +-- src/impl/box.ts | 4 +-- src/impl/crypto.ts | 4 +-- src/impl/encoded-types.ts | 8 ++++- src/impl/global.ts | 9 +++--- src/impl/gtxn.ts | 4 +-- src/impl/itxn.ts | 18 ++++++++--- src/impl/online-stake.ts | 4 +-- src/impl/pure.ts | 4 +-- src/impl/scratch.ts | 8 ++--- src/impl/txn.ts | 4 +-- src/impl/voter-params.ts | 5 ++- src/internal-arc4.ts | 1 + src/internal-op.ts | 61 +++++++++++++++++++++++++++++++++++ src/internal.ts | 2 ++ src/test-execution-context.ts | 3 +- 23 files changed, 128 insertions(+), 47 deletions(-) diff --git a/src/decode-logs.ts b/src/decode-logs.ts index 6ac5db2..6bd0f9b 100644 --- a/src/decode-logs.ts +++ b/src/decode-logs.ts @@ -1,6 +1,6 @@ import type { bytes } from '@algorandfoundation/algorand-typescript' -import { op } from '@algorandfoundation/algorand-typescript' import { ABI_RETURN_VALUE_LOG_PREFIX } from './constants' +import { btoi } from './impl/pure' import { asNumber } from './util' export type LogDecoding = 'i' | 's' | 'b' @@ -18,7 +18,7 @@ export function decodeLogs(logs: bytes[], de : log switch (decoding[i]) { case 'i': - return op.btoi(value) + return btoi(value) case 's': return value.toString() default: diff --git a/src/impl/acct-params.ts b/src/impl/acct-params.ts index 952ce4b..fe0f33f 100644 --- a/src/impl/acct-params.ts +++ b/src/impl/acct-params.ts @@ -1,5 +1,4 @@ -import type { gtxn, internal, uint64 } from '@algorandfoundation/algorand-typescript' -import type { Account, Application } from '@algorandfoundation/algorand-typescript' +import type { Account, Application, gtxn, internal, op, uint64 } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' import { asMaybeUint64Cls } from '../util' import { getApp } from './app-params' @@ -37,7 +36,7 @@ export const appOptedIn = ( return account.isOptedIn(app) } -export const AcctParams: internal.opTypes.AcctParamsType = { +export const AcctParams: typeof op.AcctParams = { acctBalance(a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] { const acct = getAccount(a) return [acct.balance, acct.balance !== 0] diff --git a/src/impl/app-global.ts b/src/impl/app-global.ts index baa30c6..2a6b6a2 100644 --- a/src/impl/app-global.ts +++ b/src/impl/app-global.ts @@ -1,11 +1,11 @@ -import type { Application, bytes, internal, uint64 } from '@algorandfoundation/algorand-typescript' +import type { Application, bytes, internal, op, uint64 } from '@algorandfoundation/algorand-typescript' import { Bytes, Uint64 } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' import { toBytes } from '../encoders' import { asBytes } from '../util' import { getApp } from './app-params' -export const AppGlobal: internal.opTypes.AppGlobalType = { +export const AppGlobal: typeof op.AppGlobal = { delete(a: internal.primitives.StubBytesCompat): void { lazyContext.ledger.setGlobalState(lazyContext.activeApplication, a, undefined) }, diff --git a/src/impl/app-local.ts b/src/impl/app-local.ts index 3ee604e..47da7ee 100644 --- a/src/impl/app-local.ts +++ b/src/impl/app-local.ts @@ -1,4 +1,4 @@ -import type { bytes, internal, uint64, Account, Application } from '@algorandfoundation/algorand-typescript' +import type { Account, Application, bytes, internal, op, uint64 } from '@algorandfoundation/algorand-typescript' import { Bytes, Uint64 } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' import { toBytes } from '../encoders' @@ -6,7 +6,7 @@ import { asBytes } from '../util' import { getAccount } from './acct-params' import { getApp } from './app-params' -export const AppLocal: internal.opTypes.AppLocalType = { +export const AppLocal: typeof op.AppLocal = { delete: function (a: Account | internal.primitives.StubUint64Compat, b: internal.primitives.StubBytesCompat): void { const app = lazyContext.activeApplication const account = getAccount(a) diff --git a/src/impl/app-params.ts b/src/impl/app-params.ts index 72438d9..19c6d0c 100644 --- a/src/impl/app-params.ts +++ b/src/impl/app-params.ts @@ -1,10 +1,11 @@ import type { + Account as AccountType, + Application as ApplicationType, bytes, gtxn, internal, + op, uint64, - Account as AccountType, - Application as ApplicationType, } from '@algorandfoundation/algorand-typescript' import { Bytes, Uint64 } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' @@ -32,7 +33,7 @@ export const getApp = (app: ApplicationType | internal.primitives.StubUint64Comp } } -export const AppParams: internal.opTypes.AppParamsType = { +export const AppParams: typeof op.AppParams = { appApprovalProgram(a: ApplicationType | internal.primitives.StubUint64Compat): readonly [bytes, boolean] { const app = getApp(a) return app === undefined ? [Bytes(), false] : [app.approvalProgram, true] diff --git a/src/impl/asset-holding.ts b/src/impl/asset-holding.ts index eb0ad3f..21fc1c7 100644 --- a/src/impl/asset-holding.ts +++ b/src/impl/asset-holding.ts @@ -1,4 +1,4 @@ -import type { internal, uint64, Account, Asset } from '@algorandfoundation/algorand-typescript' +import type { Account, Asset, internal, op, uint64 } from '@algorandfoundation/algorand-typescript' import { Uint64 } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' import { getAccount } from './acct-params' @@ -23,7 +23,7 @@ const getAssetHolding = ( return holding } -export const AssetHolding: internal.opTypes.AssetHoldingType = { +export const AssetHolding: typeof op.AssetHolding = { assetBalance( a: Account | internal.primitives.StubUint64Compat, b: Asset | internal.primitives.StubUint64Compat, diff --git a/src/impl/asset-params.ts b/src/impl/asset-params.ts index 43ff235..4d42d29 100644 --- a/src/impl/asset-params.ts +++ b/src/impl/asset-params.ts @@ -1,4 +1,4 @@ -import type { bytes, gtxn, internal, uint64 } from '@algorandfoundation/algorand-typescript' +import type { bytes, gtxn, internal, op, uint64 } from '@algorandfoundation/algorand-typescript' import { type Account as AccountType, type Asset as AssetType, Bytes, Uint64 } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' import { asMaybeUint64Cls, asUint64 } from '../util' @@ -25,7 +25,7 @@ export const getAsset = (asset: AssetType | internal.primitives.StubUint64Compat } } -export const AssetParams: internal.opTypes.AssetParamsType = { +export const AssetParams: typeof op.AssetParams = { assetTotal(a: AssetType | internal.primitives.StubUint64Compat): readonly [uint64, boolean] { const asset = getAsset(a) return asset === undefined ? [Uint64(0), false] : [asset.total, true] diff --git a/src/impl/block.ts b/src/impl/block.ts index 1d22757..d756ce5 100644 --- a/src/impl/block.ts +++ b/src/impl/block.ts @@ -1,4 +1,4 @@ -import type { bytes, internal, uint64, Account as AccountType } from '@algorandfoundation/algorand-typescript' +import type { Account as AccountType, bytes, internal, op, uint64 } from '@algorandfoundation/algorand-typescript' import { Uint64 } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' import { asUint64, getRandomBytes } from '../util' @@ -30,7 +30,7 @@ export class BlockData { } } -export const Block: internal.opTypes.BlockType = { +export const Block: typeof op.Block = { blkSeed: function (a: internal.primitives.StubUint64Compat): bytes { return lazyContext.ledger.getBlockData(a).seed }, diff --git a/src/impl/box.ts b/src/impl/box.ts index d6fa53c..ceba6eb 100644 --- a/src/impl/box.ts +++ b/src/impl/box.ts @@ -1,11 +1,11 @@ -import type { bytes, uint64 } from '@algorandfoundation/algorand-typescript' +import type { bytes, op, uint64 } from '@algorandfoundation/algorand-typescript' import { internal } from '@algorandfoundation/algorand-typescript' import { MAX_BOX_SIZE } from '../constants' import { lazyContext } from '../context-helpers/internal-context' import { toBytes } from '../encoders' import { asBytes, asBytesCls, asNumber, asUint8Array, conactUint8Arrays } from '../util' -export const Box: internal.opTypes.BoxType = { +export const Box: typeof op.Box = { create(a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat): boolean { const name = asBytes(a) const size = asNumber(b) diff --git a/src/impl/crypto.ts b/src/impl/crypto.ts index 7199d34..c381e15 100644 --- a/src/impl/crypto.ts +++ b/src/impl/crypto.ts @@ -1,4 +1,4 @@ -import type { bytes, gtxn, MimcConfigurations, VrfVerify } from '@algorandfoundation/algorand-typescript' +import type { bytes, gtxn, MimcConfigurations, op, VrfVerify } from '@algorandfoundation/algorand-typescript' import { arc4, Bytes, Ecdsa, internal } from '@algorandfoundation/algorand-typescript' import elliptic from 'elliptic' import js_sha256 from 'js-sha256' @@ -138,7 +138,7 @@ export const vrfVerify = ( notImplementedError('vrfVerify') } -export const EllipticCurve = new Proxy({} as internal.opTypes.EllipticCurveType, { +export const EllipticCurve = new Proxy({} as typeof op.EllipticCurve, { get: (_target, prop) => { notImplementedError(`EllipticCurve.${prop.toString()}`) }, diff --git a/src/impl/encoded-types.ts b/src/impl/encoded-types.ts index 80b82b4..8d8d102 100644 --- a/src/impl/encoded-types.ts +++ b/src/impl/encoded-types.ts @@ -1,10 +1,11 @@ import type { + Account as AccountType, + arc4, BigUintCompat, bytes, StringCompat, uint64, Uint64Compat, - Account as AccountType, } from '@algorandfoundation/algorand-typescript' import { Bytes, internal } from '@algorandfoundation/algorand-typescript' import type { BitSize } from '@algorandfoundation/algorand-typescript/arc4' @@ -36,6 +37,7 @@ import { lazyContext } from '../context-helpers/internal-context' import type { fromBytes, TypeInfo } from '../encoders' import type { DeliberateAny } from '../typescript-helpers' import { asBigInt, asBigUint, asBigUintCls, asBytesCls, asUint64, asUint8Array, conactUint8Arrays, uint8ArrayToNumber } from '../util' +import { sha512_256 } from './crypto' import { Account, AccountCls, ApplicationCls, AssetCls } from './reference' import type { ApplicationTransaction } from './transactions' @@ -1278,3 +1280,7 @@ export const getArc4Encoded = (value: DeliberateAny): ARC4Encoded => { throw internal.errors.codeError(`Unsupported type for encoding: ${typeof value}`) } + +export const methodSelector: typeof arc4.methodSelector = (methodSignature: string): bytes => { + return sha512_256(Bytes(encodingUtil.utf8ToUint8Array(methodSignature))).slice(0, 4) +} diff --git a/src/impl/global.ts b/src/impl/global.ts index bb1acd5..0466098 100644 --- a/src/impl/global.ts +++ b/src/impl/global.ts @@ -1,5 +1,5 @@ -import type { bytes, uint64, Account as AccountType, Application as ApplicationType } from '@algorandfoundation/algorand-typescript' -import { Bytes, internal, op, Uint64 } from '@algorandfoundation/algorand-typescript' +import type { Account as AccountType, Application as ApplicationType, bytes, uint64, op } from '@algorandfoundation/algorand-typescript' +import { Bytes, internal, Uint64 } from '@algorandfoundation/algorand-typescript' import { DEFAULT_ACCOUNT_MIN_BALANCE, DEFAULT_ASSET_CREATE_MIN_BALANCE, @@ -11,6 +11,7 @@ import { } from '../constants' import { lazyContext } from '../context-helpers/internal-context' import { getObjectReference } from '../util' +import { sha256 } from './crypto' import { Account, getApplicationAddress } from './reference' export class GlobalData { @@ -54,7 +55,7 @@ const getGlobalData = (): GlobalData => { const getMissingValueErrorMessage = (name: keyof GlobalData) => `'Global' object has no value set for attribute named '${name}'. Use \`context.ledger.patchGlobalData({${name}: your_value})\` to set the value in your test setup."` -export const Global: internal.opTypes.GlobalType = { +export const Global: typeof op.Global = { /** * microalgos */ @@ -148,7 +149,7 @@ export const Global: internal.opTypes.GlobalType = { if (data.groupId !== undefined) return data.groupId const reference = getObjectReference(lazyContext.activeGroup) const referenceBytes = Bytes(internal.encodingUtil.bigIntToUint8Array(reference)) - return op.sha256(referenceBytes) + return sha256(referenceBytes) }, /** diff --git a/src/impl/gtxn.ts b/src/impl/gtxn.ts index d715fb3..912bc93 100644 --- a/src/impl/gtxn.ts +++ b/src/impl/gtxn.ts @@ -1,9 +1,9 @@ -import type { bytes, internal, uint64, Account, Application, Asset } from '@algorandfoundation/algorand-typescript' +import type { Account, Application, Asset, bytes, internal, op, uint64 } from '@algorandfoundation/algorand-typescript' import { arc4 } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' import { asUint64, asUint64Cls } from '../util' -export const GTxn: internal.opTypes.GTxnType = { +export const GTxn: typeof op.GTxn = { sender(t: internal.primitives.StubUint64Compat): Account { return lazyContext.activeGroup.getTransaction(t).sender }, diff --git a/src/impl/itxn.ts b/src/impl/itxn.ts index dc34857..1f82dc0 100644 --- a/src/impl/itxn.ts +++ b/src/impl/itxn.ts @@ -1,4 +1,14 @@ -import type { bytes, internal, itxn, TransactionType, uint64, Account, Application, Asset } from '@algorandfoundation/algorand-typescript' +import type { + Account, + Application, + Asset, + bytes, + internal, + itxn, + op, + TransactionType, + uint64, +} from '@algorandfoundation/algorand-typescript' import { arc4 } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' import { asBytes, asBytesCls, asUint64, asUint64Cls } from '../util' @@ -22,7 +32,7 @@ export type InnerTxnFields = ( | itxn.ApplicationCallFields ) & { type?: TransactionType } -export const GITxn: internal.opTypes.GITxnType = { +export const GITxn: typeof op.GITxn = { sender: function (t: internal.primitives.StubUint64Compat): Account { return lazyContext.activeGroup.getItxnGroup().getInnerTxn(t).sender }, @@ -229,7 +239,7 @@ export const GITxn: internal.opTypes.GITxnType = { return lazyContext.activeGroup.getItxnGroup().getApplicationInnerTxn(t).numClearStateProgramPages }, } -export const ITxn: internal.opTypes.ITxnType = { +export const ITxn: typeof op.ITxn = { /** * 32 byte address */ @@ -649,7 +659,7 @@ const getConstructingItxn = (): T => { return lazyContext.activeGroup.constructingItxn as T } -export const ITxnCreate: internal.opTypes.ITxnCreateType = { +export const ITxnCreate: typeof op.ITxnCreate = { begin: function (): void { lazyContext.activeGroup.beginInnerTransactionGroup() }, diff --git a/src/impl/online-stake.ts b/src/impl/online-stake.ts index 8a7a529..4c47437 100644 --- a/src/impl/online-stake.ts +++ b/src/impl/online-stake.ts @@ -1,6 +1,6 @@ -import type { internal } from '@algorandfoundation/algorand-typescript' +import type { op } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' -export const onlineStake: internal.opTypes.OnlineStakeType = () => { +export const onlineStake: typeof op.onlineStake = () => { return lazyContext.ledger.onlineStake } diff --git a/src/impl/pure.ts b/src/impl/pure.ts index 79a67b8..3e1ff7b 100644 --- a/src/impl/pure.ts +++ b/src/impl/pure.ts @@ -1,4 +1,4 @@ -import type { biguint, bytes, uint64 } from '@algorandfoundation/algorand-typescript' +import type { biguint, bytes, op, uint64 } from '@algorandfoundation/algorand-typescript' import { Base64, Bytes, internal, Uint64 } from '@algorandfoundation/algorand-typescript' import { BITS_IN_BYTE, MAX_BYTES_SIZE, MAX_UINT64, MAX_UINT8, UINT64_SIZE } from '../constants' import { notImplementedError, testInvariant } from '../errors' @@ -329,7 +329,7 @@ export const substring = ( return bytesValue.slice(start, end).asAlgoTs() } -export const JsonRef = new Proxy({} as internal.opTypes.JsonRefType, { +export const JsonRef = new Proxy({} as typeof op.JsonRef, { get: (_target, prop) => { notImplementedError(`JsonRef.${prop.toString()}`) }, diff --git a/src/impl/scratch.ts b/src/impl/scratch.ts index 2a34964..51cb0ba 100644 --- a/src/impl/scratch.ts +++ b/src/impl/scratch.ts @@ -1,8 +1,8 @@ -import type { bytes, uint64 } from '@algorandfoundation/algorand-typescript' +import type { bytes, op, uint64 } from '@algorandfoundation/algorand-typescript' import { internal } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' -export const gloadUint64: internal.opTypes.GloadUint64Type = ( +export const gloadUint64: typeof op.gloadUint64 = ( a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat, ): uint64 => { @@ -14,7 +14,7 @@ export const gloadUint64: internal.opTypes.GloadUint64Type = ( throw new internal.errors.InternalError('invalid scratch slot type') } -export const gloadBytes: internal.opTypes.GloadBytesType = ( +export const gloadBytes: typeof op.gloadBytes = ( a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat, ): bytes => { @@ -26,7 +26,7 @@ export const gloadBytes: internal.opTypes.GloadBytesType = ( throw new internal.errors.InternalError('invalid scratch slot type') } -export const Scratch: internal.opTypes.ScratchType = { +export const Scratch: typeof op.Scratch = { loadBytes: function (a: internal.primitives.StubUint64Compat): bytes { const result = lazyContext.activeGroup.activeTransaction.getScratchSlot(a) if (result instanceof internal.primitives.BytesCls) { diff --git a/src/impl/txn.ts b/src/impl/txn.ts index 7102494..f444984 100644 --- a/src/impl/txn.ts +++ b/src/impl/txn.ts @@ -1,4 +1,4 @@ -import type { bytes, uint64, Account, Application, Asset } from '@algorandfoundation/algorand-typescript' +import type { Account, Application, Asset, bytes, op, uint64 } from '@algorandfoundation/algorand-typescript' import { arc4, internal, TransactionType } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' import { asNumber, asUint64, asUint64Cls } from '../util' @@ -15,7 +15,7 @@ export const gaid = (a: internal.primitives.StubUint64Compat): uint64 => { } } -export const Txn: internal.opTypes.TxnType = { +export const Txn: typeof op.Txn = { get sender(): Account { return lazyContext.activeGroup.getTransaction().sender }, diff --git a/src/impl/voter-params.ts b/src/impl/voter-params.ts index ecaa810..876f3da 100644 --- a/src/impl/voter-params.ts +++ b/src/impl/voter-params.ts @@ -1,5 +1,4 @@ -import type { internal, uint64 } from '@algorandfoundation/algorand-typescript' -import type { Account } from '@algorandfoundation/algorand-typescript' +import type { Account, internal, op, uint64 } from '@algorandfoundation/algorand-typescript' import { lazyContext } from '../context-helpers/internal-context' import { getAccount } from './acct-params' @@ -18,7 +17,7 @@ const getVoterData = (a: Account | internal.primitives.StubUint64Compat): VoterD return lazyContext.getVoterData(acct) } -export const VoterParams: internal.opTypes.VoterParamsType = { +export const VoterParams: typeof op.VoterParams = { voterBalance: function (a: Account | internal.primitives.StubUint64Compat): readonly [uint64, boolean] { const data = getVoterData(a) return [data.balance, data.balance !== 0] diff --git a/src/internal-arc4.ts b/src/internal-arc4.ts index 8b856b1..5b2c916 100644 --- a/src/internal-arc4.ts +++ b/src/internal-arc4.ts @@ -1 +1,2 @@ export * from '@algorandfoundation/algorand-typescript/arc4' +export { methodSelector } from './impl/encoded-types' diff --git a/src/internal-op.ts b/src/internal-op.ts index 711dfe3..343e5cc 100644 --- a/src/internal-op.ts +++ b/src/internal-op.ts @@ -1 +1,62 @@ export * from '@algorandfoundation/algorand-typescript/op' +export { AcctParams, appOptedIn, balance, minBalance } from './impl/acct-params' +export { AppGlobal } from './impl/app-global' +export { AppLocal } from './impl/app-local' +export { AppParams } from './impl/app-params' +export { AssetHolding } from './impl/asset-holding' +export { AssetParams } from './impl/asset-params' +export { Block } from './impl/block' +export { Box } from './impl/box' +export { + ecdsaPkDecompress, + ecdsaPkRecover, + ecdsaVerify, + ed25519verify, + ed25519verifyBare, + EllipticCurve, + keccak256, + mimc, + sha256, + sha3_256, + sha512_256, + vrfVerify, +} from './impl/crypto' +export { Global } from './impl/global' +export { GTxn } from './impl/gtxn' +export { GITxn, ITxn, ITxnCreate } from './impl/itxn' +export { arg } from './impl/logicSigArg' +export { onlineStake } from './impl/online-stake' +export { + addw, + base64Decode, + bitLength, + bsqrt, + btoi, + bzero, + concat, + divmodw, + divw, + exp, + expw, + extract, + extractUint16, + extractUint32, + extractUint64, + getBit, + getByte, + itob, + JsonRef, + len, + mulw, + replace, + select, + setBit, + setByte, + shl, + shr, + sqrt, + substring, +} from './impl/pure' +export { gloadBytes, gloadUint64, Scratch } from './impl/scratch' +export { gaid, Txn } from './impl/txn' +export { VoterParams } from './impl/voter-params' diff --git a/src/internal.ts b/src/internal.ts index 37b0058..420ea22 100644 --- a/src/internal.ts +++ b/src/internal.ts @@ -1,10 +1,12 @@ export * from '@algorandfoundation/algorand-typescript' export { compileImpl as compile } from './impl/compiled' export { ensureBudgetImpl as ensureBudget } from './impl/ensure-budget' +export { Global } from './impl/global' export { log } from './impl/log' export { assertMatchImpl as assertMatch, matchImpl as match } from './impl/match' export { Account, Application, Asset } from './impl/reference' export { TemplateVarImpl as TemplateVar } from './impl/template-var' +export { Txn } from './impl/txn' export { urangeImpl as urange } from './impl/urange' export * as arc4 from './internal-arc4' export * as op from './internal-op' diff --git a/src/test-execution-context.ts b/src/test-execution-context.ts index e98641b..5293c23 100644 --- a/src/test-execution-context.ts +++ b/src/test-execution-context.ts @@ -1,4 +1,4 @@ -import type { BaseContract, bytes, LogicSig, uint64, Account as AccountType } from '@algorandfoundation/algorand-typescript' +import type { Account as AccountType, BaseContract, bytes, LogicSig, uint64 } from '@algorandfoundation/algorand-typescript' import { internal } from '@algorandfoundation/algorand-typescript' import { captureMethodConfig } from './abi-metadata' import { DEFAULT_TEMPLATE_VAR_PREFIX } from './constants' @@ -51,6 +51,7 @@ export class TestExecutionContext implements internal.ExecutionContext { get op() { return ops } + get contract() { return this.#contractContext }