Skip to content

Commit

Permalink
refactor: remove avm version check as algod latest image is now v4
Browse files Browse the repository at this point in the history
  • Loading branch information
boblat committed Jan 17, 2025
1 parent e9498bf commit d69a6ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
8 changes: 0 additions & 8 deletions tests/avm-invoker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ const algorandClient = Lazy(() => {

export const INITIAL_BALANCE_MICRO_ALGOS = Number(20e6)

export const getAlgorandAppClientV11 = async (appSpec: AppSpec) => {
if ((await getAlgodMajorVersion()) < 4) {
return undefined
}
const [appClient, _] = await getAlgorandAppClientWithApp(appSpec)
return appClient
}

export const getAlgorandAppClient = async (appSpec: AppSpec) => {
const [appClient, _] = await getAlgorandAppClientWithApp(appSpec)
return appClient
Expand Down
14 changes: 5 additions & 9 deletions tests/state-op-codes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ import { StateAcctParamsGetContract } from './artifacts/state-ops/state-acct-par
import {
generateTestAccount,
generateTestAsset,
getAlgodMajorVersion,
getAlgorandAppClient,
getAlgorandAppClientV11,
getAlgorandAppClientWithApp,
getAvmResult,
getLocalNetDefaultAccount,
Expand All @@ -49,15 +47,13 @@ import {

describe('State op codes', async () => {
const ctx = new TestExecutionContext()
const algodVersion = await getAlgodMajorVersion()
const isV11Supported = algodVersion > 4

afterEach(() => {
ctx.reset()
})

describe.skipIf(!isV11Supported)('AcctParams', async () => {
const [appClient, dummyAccount] = await Promise.all([getAlgorandAppClientV11(acctParamsAppSpecJson as AppSpec), generateTestAccount()])
describe('AcctParams', async () => {
const [appClient, dummyAccount] = await Promise.all([getAlgorandAppClient(acctParamsAppSpecJson as AppSpec), generateTestAccount()])

test.each([
['verify_acct_balance', INITIAL_BALANCE_MICRO_ALGOS + 100_000],
Expand Down Expand Up @@ -90,7 +86,7 @@ describe('State op codes', async () => {
})

const avmResult = await getAvmResult(
{ appClient: appClient!, sendParams: { staticFee: AlgoAmount.Algos(1000) } },
{ appClient, sendParams: { staticFee: AlgoAmount.Algos(1000) } },
methodName,
asUint8Array(dummyAccount.bytes),
)
Expand All @@ -113,7 +109,7 @@ describe('State op codes', async () => {
expect(op.AcctParams.acctIncentiveEligible(mockAccount)).toEqual([true, true])
})

await appClient!.algorand.send.onlineKeyRegistration({
await appClient.algorand.send.onlineKeyRegistration({
sender: encodeAddress(asUint8Array(dummyAccount.bytes)),
voteKey: getRandomBytes(32).asUint8Array(),
selectionKey: getRandomBytes(32).asUint8Array(),
Expand All @@ -124,7 +120,7 @@ describe('State op codes', async () => {
staticFee: AlgoAmount.Algos(10),
})
const avmResult = await getAvmResult(
{ appClient: appClient!, sendParams: { staticFee: AlgoAmount.Algos(10) } },
{ appClient, sendParams: { staticFee: AlgoAmount.Algos(10) } },
'verify_acct_incentive_eligible',
asUint8Array(dummyAccount.bytes),
)
Expand Down

0 comments on commit d69a6ce

Please sign in to comment.