Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions challenge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']}`);
console.log(`Payment of ${result.txn.txn.amt} microAlgos was sent to ${receiver.addr} at confirmed round ${result['confirmed-round']}`);