$ cat package.json
"dependencies": {
"@algorandfoundation/algokit-utils": "^5.5.0",
.
.
.
$ algokit --version
algokit, version 2.0.1
From the test run I see:
- testAccount is used to create the app.
- app checks if Algo is sent to creator – but when is does the check, the test_account (the supposed creator) is already changed by
const { algod, testAccount } = fixture.context; and money is sent to that address, and the app fails.
So now, I allocate an account from KMD to buy the NFT, and another account to create the app. Now my TEAL assertations don’t fail at once. But I get the same error: logic eval error: unavailable Asset 1079. Details: app=1075, pc=438, opcodes=bytec_0 // "asset"; app_global_get; itxn_field XferAsset
Full test run is here:
@A-Maugli ➜ .../akt02/biz_kor/projects/biz_kor-contracts (main) $ npm run test
> biz_kor-contracts@0.0.0 test
> npm run build && jest
> biz_kor-contracts@0.0.0 build
> npm run compile-contract && npm run generate-client
> biz_kor-contracts@0.0.0 compile-contract
> tealscript contracts/*.algo.ts contracts/artifacts
> biz_kor-contracts@0.0.0 generate-client
> algokit generate client contracts/artifacts/ --language typescript --output contracts/clients/{contract_name}Client.ts
Generating TypeScript client code for application specified in /workspaces/akt02/biz_kor/projects/biz_kor-contracts/contracts/artifacts/BizKor.arc32.json and writing to contracts/clients/BizKorClient.ts
Reading application.json file from path /workspaces/akt02/biz_kor/projects/biz_kor-contracts/contracts/artifacts/BizKor.arc32.json
Generating TS client for BizKor
Writing TS client to /workspaces/akt02/biz_kor/projects/biz_kor-contracts/contracts/clients/BizKorClient.ts
Operation completed successfully
console.log
acc1.addr (token buyer): DDQALG7PFHBOPL2RW77CNBGMC7HFW34K7BPQGT4IFY6EUKWHDWYAGTTRSM
at __test__/BizKor.test.ts:34:13
console.log
acc2.addr (app creator): I4SYCPJGSRPJX2RDQI77R7XMRXF3L46WP76IDSVFJRLSALMI4BX47FZF4I
at __test__/BizKor.test.ts:52:13
console.debug
Created app 1075 from creator I4SYCPJGSRPJX2RDQI77R7XMRXF3L46WP76IDSVFJRLSALMI4BX47FZF4I
at Object.createApp (node_modules/@algorandfoundation/src/app.ts:115:48)
console.debug
Transferring 400000µALGOs from I4SYCPJGSRPJX2RDQI77R7XMRXF3L46WP76IDSVFJRLSALMI4BX47FZF4I to ZKIOSI4LNXPPOGVRZDI2THOZUDCDXGUI7PJEBCN7TMM3R5FE5XDG4XOGJU
at Object.transferAlgos (node_modules/@algorandfoundation/src/transfer/transfer-algos.ts:38:46)
console.log
getGlobalState assetAmountInitial: 10
at __test__/BizKor.test.ts:98:13
console.log
getGlobalState assetAmount: 10
at __test__/BizKor.test.ts:99:13
console.log
getGlobalState assetPrice: 1000000
at __test__/BizKor.test.ts:100:13
console.log
getGlobalState asset: 1079
at __test__/BizKor.test.ts:101:13
console.log
getGlobalState sellPeriodEnd: 1712047631
at __test__/BizKor.test.ts:102:13
console.debug
Transferring 400000µALGOs from I4SYCPJGSRPJX2RDQI77R7XMRXF3L46WP76IDSVFJRLSALMI4BX47FZF4I to ZKIOSI4LNXPPOGVRZDI2THOZUDCDXGUI7PJEBCN7TMM3R5FE5XDG4XOGJU
at Object.transferAlgos (node_modules/@algorandfoundation/src/transfer/transfer-algos.ts:38:46)
console.log
Try to opt in to asset: 1079 SHWD6OQPXA76TGTGOIEEICCVBG2DVZC74TWR7PBQCVCASVBY2CFSP6UXHU
at __test__/BizKor.test.ts:112:13
console.log
buyAsset: testAccount.addr SHWD6OQPXA76TGTGOIEEICCVBG2DVZC74TWR7PBQCVCASVBY2CFSP6UXHU
at __test__/BizKor.test.ts:127:13
console.log
buyAsset: appRef.appAddress ZKIOSI4LNXPPOGVRZDI2THOZUDCDXGUI7PJEBCN7TMM3R5FE5XDG4XOGJU
at __test__/BizKor.test.ts:128:13
console.log
buyAsset: appCreatorAddr I4SYCPJGSRPJX2RDQI77R7XMRXF3L46WP76IDSVFJRLSALMI4BX47FZF4I
at __test__/BizKor.test.ts:129:13
FAIL __test__/BizKor.test.ts (11.901 s)
BizKor
✓ bootstrap (1484 ms)
✓ getGlobalState (1580 ms)
✕ buyAsset (1725 ms)
○ skipped deleteApplication
● BizKor › buyAsset
URLTokenBaseHTTPError: Network request error. Received status 400 (Bad Request): TransactionPool.Remember: transaction RHXFJLWHN4FYR5CXM7ZN46HBRECHRYO7GXED3LKFF73Y6O6PUDKA: logic eval error: unavailable Asset 1079. Details: app=1075, pc=438, opcodes=bytec_0 // "asset"; app_global_get; itxn_field XferAsset
at Function.checkHttpError (node_modules/@algorandfoundation/src/types/urlTokenBaseHTTPClient.ts:129:11)
at Function.formatFetchResponse (node_modules/@algorandfoundation/src/types/urlTokenBaseHTTPClient.ts:137:5)
at AlgoHttpClientWithRetry.callWithRetry (node_modules/@algorandfoundation/src/types/algo-http-client-with-retry.ts:30:20)
at AlgoHttpClientWithRetry.post (node_modules/@algorandfoundation/src/types/algo-http-client-with-retry.ts:68:12)
at HTTPClient.post (node_modules/algosdk/src/client/client.ts:269:19)
at SendRawTransaction.do (node_modules/algosdk/src/client/v2/algod/sendRawTransaction.ts:53:17)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 skipped, 2 passed, 4 total
Snapshots: 0 total
Time: 11.961 s, estimated 13 s
Ran all test suites.
@A-Maugli ➜ .../akt02/biz_kor/projects/biz_kor-contracts (main) $
@joe-p As my app is a “variation” on @joe-p Tealscript DOA example (proposal, voting), it would help a lot, if you could give me the repository, where this example is.