From aa890df01fe73a57307b241d73ea1b5cce7c26ed Mon Sep 17 00:00:00 2001 From: 0xgun Date: Thu, 28 Mar 2024 20:52:52 +0530 Subject: [PATCH] add signer to transaction --- challenge/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/challenge/index.ts b/challenge/index.ts index e459cef..02e4d07 100644 --- a/challenge/index.ts +++ b/challenge/index.ts @@ -6,11 +6,12 @@ const algodClient = algokit.getAlgoClient() // Retrieve 2 accounts from localnet kmd const sender = await algokit.getLocalNetDispenserAccount(algodClient) +const signer = algokit.getSenderTransactionSigner(sender) const receiver = await algokit.mnemonicAccountFromEnvironment( - {name: 'RECEIVER', fundWith: algokit.algos(100)}, + { name: 'RECEIVER', fundWith: algokit.algos(100) }, algodClient, - ) +) /* TODO: edit code below @@ -43,9 +44,10 @@ const ptxn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject({ }); const atc = new algosdk.AtomicTransactionComposer() -atc.addTransaction({txn: ptxn1, signer: sender}) -atc.addTransaction({txn: ptxn2, signer: sender}) +atc.addTransaction({ txn: ptxn1, signer }) +atc.addTransaction({ txn: ptxn2, signer }) -const result = await algokit.sendAtomicTransactionComposer({atc:atc, sendParams: {suppressLog:true}}, algodClient) + +const result = await algokit.sendAtomicTransactionComposer({ atc: atc, sendParams: { suppressLog: true } }, algodClient) console.log(`The first payment transaction sent ${result.transactions[0].amount} microAlgos and the second payment transaction sent ${result.transactions[1].amount} microAlgos`)