Skip to main content

Payment with Teal Transaction

Create and sign a payment with teal transaction.

Preconditions

  • User has a wallet and has shared an account with the site

  • The transaction sender must match with one of the addresses shared by the user.

Interactive Example

Invalid Address
In order to run this example, you need to execute connect() method.
import algosdk from "algosdk";
import MyAlgoConnect from '@randlabs/myalgo-connect';
 
const algodClient = new algosdk.Algodv2("",'https://node.testnet.algoexplorerapi.io', '');
const params = await algodClient.getTransactionParams().do();

const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
    suggestedParams: {
        ...params,
    },
    from: sender,
    to: receiver, 
    amount: amount,
    note: note
});

const myAlgoConnect = new MyAlgoConnect();

const lsig = algosdk.makeLogicSig(new Uint8Array(Buffer.from(compiledTeal, "base64")));
lsig.sig = await myAlgoConnect.signLogicSig(lsig.logic, sender);

const signedTxn = algosdk.signLogicSigTransaction(txn, lsig);
txn Amount
int 0
>=
txn Fee
int 1000
==
&&
txn Type
byte "pay"
==
txn TxID
byte b32 $REPLACE_FOR_TXID
==
&&
&&