Hi @Maugli@barnji@fabrice@liz
I have trouble creating escrow contract, can I have non-production escrow teal contract. And I have errors while optin asset-id to escrow by doing this:
AlgoSigner.connect()
.then(async(d) => {
AlgoSigner.accounts({
ledger: 'TestNet'
})
.then(async(d) => {
console.log("TestNet",d)
//new code added 191021
AlgoSigner.algod({
ledger: 'TestNet',
path: '/v2/transactions/params'
})
// sign new opt-in transaction
.then((txParams) => AlgoSigner.sign({
assetIndex: assetId,
from: lsig.address(),
amount: 0,
to: optInAccount,
type: 'axfer', // ASA Transfer (axfer)
fee: txParams['min-fee'],
firstRound: txParams['last-round'],
lastRound: txParams['last-round'] + 1000,
genesisID: txParams['genesis-id'],
genesisHash: txParams['genesis-hash'],
flatFee: true
}))
// send signed transaction
.then((signedTx) => AlgoSigner.send({
ledger: 'TestNet',
tx: signedTx.blob
}))
// wait for confirmation from the blockchain
.then((tx) => waitForAlgosignerConfirmation(tx)) // see algosignerutils.js
.then(async(d) => {
// was successful
//transfer
assetId = Number(parseInt(idget))
let from = localStorage.getItem("wallet");
let to = lsig.address();
let amount = 1;
let note = undefined;
AlgoSigner.algod({
ledger: 'TestNet',
path: '/v2/transactions/params'
})
.then((txParams) => AlgoSigner.sign({
assetIndex: assetId,
from: from,
to: to,
amount: +amount,
note: note,
type: 'axfer',
fee: txParams['min-fee'],
firstRound: txParams['last-round'],
lastRound: txParams['last-round'] + 1000,
genesisID: txParams['genesis-id'],
genesisHash: txParams['genesis-hash'],
flatFee: true
}))
.then((signedTx) => AlgoSigner.send({
ledger: 'TestNet',
tx: signedTx.blob
}))
// wait for confirmation from the blockchain
.then((tx) => waitForAlgosignerConfirmation(tx)) // see algosignerutils.js
.then((tx) => {
// our transaction was successful, we can now view it on the blockchain
console.log("transfer success",tx)
})
.catch((e) => {
console.error(e);
})
//end
})
.catch((e) => {
console.error(e);
})
.catch((e) => {
console.error(e);
});
//new code ended 191021
})
.catch((e) => {
console.error(e);
});
})
.catch((e) => {
console.error(e);
});
You need only need to import it yourself in order to make the opt-in. Opt-in is only needed to be done once per account, so you can do it by hand and remove it from the user-accesible code
Otherwise, it’s not supported to make transactions for other accounts without having access to them first. You can bring it up to the Algorand Foundation.