How to use the algosdk.signTransaction function in algosdk

To help you get started, we’ve selected a few algosdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PureStake / api-examples / javascript-examples / submit_tx.js View on Github external
let txn = {
        "from": recoveredAccount.addr,
        "to": "AEC4WDHXCDF4B5LBNXXRTB3IJTVJSWUZ4VJ4THPU2QGRJGTA3MIDFN3CQA",
        "fee": 10,
        "amount": 2,
        "firstRound": params.lastRound,
        "lastRound": endRound,
        "genesisID": params.genesisID,
        "genesisHash": params.genesishashb64,
        "note": new Uint8Array(0),
    };

    const txHeaders = {
        'Content-Type' : 'application/x-binary'
    }
    let signedTxn = algosdk.signTransaction(txn, recoveredAccount.sk);
    let tx = (await algodclient.sendRawTransaction(signedTxn.blob, txHeaders));
    console.log("Transaction : " + tx.txId);
})().catch(e => {
    console.log(e);
github PureStake / api-examples / javascript-examples / v2 / algod_submit_tx.js View on Github external
var mnemonic = "code thrive mouse code badge example pride stereo sell viable adjust planet text close erupt embrace nature upon february weekend humble surprise shrug absorb faint"; 
    var recoveredAccount = algosdk.mnemonicToSecretKey(mnemonic); 
    
    let txn = {
        "from": recoveredAccount.addr,
        "to": "UUOB7ZC2IEE4A7JO4WY4TXKXWDFNATM43TL73IZRAFIFFOE6ORPKC7Q62E",
        "fee": 1,
        "amount": amount,
        "firstRound": params.firstRound,
        "lastRound": params.lastRound,
        "genesisID": params.genesisID,
        "genesisHash": params.genesisHash,
        "note": new Uint8Array(0),
    };

    let signedTxn = algosdk.signTransaction(txn, recoveredAccount.sk);
    let sendTx = await algodClient.sendRawTransaction(signedTxn.blob).do();

    console.log("Transaction : " + sendTx.txId);
})().catch(e => {
    console.log(e);