I am currently developing a web application using angular, Algosigner, and TEAL stateless smart contract. I started with a basic attempt to develop a smart contract that writes a string on the global state then updates it if an update request is sent from Algosigner. However, I got the following error message:
"errors : {"message":"TransactionPool.Remember: transaction 244HDWNY5BMNMRXAKM5KZX2KXOAALUDJ56JCA2AICS6CNXHKU2CA: check failed on ClearStateProgram: program version 10 greater than max supported version 4"}"
It is to be noted that the same transaction works fine with algosdk (version 1.9.1). However, I would like to sign it with Algosigner.
The adopted versions are:
Algosigner 1.5.1
Angular:12.0.3
nodejs: v14.16.0
Below are the codes of the teal approval and clear programs along with the Algosigner method and the transaction parameters details.
Approval program
Clear state program:
Transaction parameters details:
{
"type": "appl",
"from": "ROY4QWRX44K2EBJ7P7FB63TKTMXLBEPPL2BKPBHAVUBJCC4XH5H5DENFIE",
"fee": 1000,
"firstRound": 14632823,
"lastRound": 14633823,
"note": "note",
"genesisID": "testnet-v1.0",
"genesisHash": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
"group": null,
"lease": null,
"reKeyTo": null,
"flatFee": null,
"name": null,
"tag": null,
"appIndex": 16037988,
"appOnComplete": 4,
"appAccounts": null,
"appApprovalProgram": "AiADAAQBJgMEbmFtZQZoYWxpbWEEc2FmYSIxGRJAAAgjMRkSQAAGACgpZyRDKCpnJEM=",
"appClearProgram": "CopyAiABASJD",
"appForeignApps": null,
"appForeignAssets": null,
"appGlobalInts": null,
"appGlobalByteSlices": null,
"appLocalInts": null,
"appLocalByteSlices": null
}
Algosigner update method:
`updateApplicationTxn = () => {
// @ts-ignore
AlgoSigner.algod({
ledger: this.ledger,
path: '/v2/transactions/params'
})
.then((d) => {
let txParams = d;
// @ts-ignore
AlgoSigner.sign({
type: 'appl',
from: this.connectedAccount,
fee: txParams['min-fee'],
firstRound: txParams['last-round'],
lastRound: txParams['last-round'] + 1000,
genesisID: txParams['genesis-id'],
genesisHash: txParams['genesis-hash'],
appIndex: 16037988,
note: 'note',
appApprovalProgram: "AiADAAQBJgMEbmFtZQZoYWxpbWEEc2FmYSIxGRJAAAgjMRkSQAAGACgpZyRDKCpnJEM=",
appClearProgram: "CopyAiABASJD",
appOnComplete: 4
})
.then((signedTx) => {
// @ts-ignore
AlgoSigner.send({
ledger: this.ledger,
tx: signedTx.blob
})
.then((d) => {
this.signedTx = d;
this.lastmessage = " Transaction sent : " + JSON.stringify(d);
this.txId = d.txId;
})
.catch(
err => {
console.log(JSON.stringify(err))
this.message = JSON.stringify(err)
})
})
.catch(
err => {
console.log(JSON.stringify(err))
this.message = JSON.stringify(err)
})
})
.catch(
err => {
console.log(JSON.stringify(err))
this.message = JSON.stringify(err)
})
}`
If it can help, please find below the algosdk method that worked just fine:
`
_publics.updateSSC = async (sender) =>{
let params = await client.getTransactionParams().do();
let approvalProgram=new Uint8Array(Buffer.from("AiADAAQBJgMEbmFtZQZoYWxpbWEEc2FmYSIxGRJAAAgjMRkSQAAGACgpZyRDKCpnJEM=", "base64"));
let index=16037988
let clearProgram= new Uint8Array(Buffer.from("AiABASJD", "base64"));
let txn = algosdk.makeApplicationUpdateTxn(sender, params, index, approvalProgram, clearProgram);
let myAccount = algosdk.mnemonicToSecretKey("my passphrase")
let signedTxn = txn.signTxn(myAccount.sk);
let txId = txn.txID().toString();
await client.sendRawTransaction(signedTxn).do();
return txn
}
`
I would be grateful if you can help resolve this issue. Please feel free to ask for any additional information.