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
17 changes: 4 additions & 13 deletions challenge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@ const receiver = await algokit.mnemonicAccountFromEnvironment(
algodClient,
)

/*
TODO: edit code below

Puzzle:
The below code is trying to send a payment from accounts[0] to accounts[1].
However, the code is not working. fix the code so that the payment is sent
successfully.

When solved correctly, the console should print out the following:
"Payment of 1000000 microAlgos was sent to RRYKB23LFR62G3P4SFINZDQ4FVDUNWWQ4NOF7K6TP5GO65BQCHYMNTR3CU at confirmed round 59"
*/
const suggestedParams = await algodClient.getTransactionParams().do();
const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
from: sender.addr,
Expand All @@ -29,10 +18,12 @@ const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
amount: 1000000,
});

await algodClient.sendRawTransaction(txn).do();
const signedTxn = txn.signTxn(sender.sk);

const { txId } = await algodClient.sendRawTransaction(signedTxn).do();
const result = await algosdk.waitForConfirmation(
algodClient,
txn.txID().toString(),
txId,
3
);

Expand Down