diff --git a/challenge/index.ts b/challenge/index.ts index 73e28a5..fa6964f 100644 --- a/challenge/index.ts +++ b/challenge/index.ts @@ -26,14 +26,22 @@ const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({ from: sender.addr, suggestedParams, to: receiver.addr, - amount: 1000000, + amount: 1000000 }); +console.log(txn); -await algodClient.sendRawTransaction(txn).do(); +// Sign the transaction with sender's secret key +const signedTxn = txn.signTxn(sender.sk); + +// And send the now Signed transaction! +const txId = await algodClient.sendRawTransaction(signedTxn).do(); +console.log("Transaction ID: ", txId); + +// Wait for confirmation const result = await algosdk.waitForConfirmation( algodClient, - txn.txID().toString(), + txId.txId, 3 ); -console.log(`Payment of ${result.txn.txn.amt} microAlgos was sent to ${receiver.addr} at confirmed round ${result['confirmed-round']}`); \ No newline at end of file +console.log(`Payment of ${result.txn.txn.amt} microAlgos was sent to ${receiver.addr} at confirmed round ${result['confirmed-round']}`);