Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Use full algokit functionality #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
23 changes: 7 additions & 16 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,19 @@ const App: Component = () => {

onMount(() => reconnectWallet())

const transactionSignerAccount = createMemo<TransactionSignerAccount>(() => ({
addr: address(),
signer: transactionSigner,
}))
const transactionSignerAccount = createMemo(() => algokit.transactionSignerAccount(transactionSigner, address()))

async function sendTxn() {
setConfirmedTxn("")
const suggestedParams = await algodClient().getTransactionParams().do()

const payTxn = makePaymentTxnWithSuggestedParamsFromObject({
from: address(),
to: address(),
amount: 0,
suggestedParams,
})
const txn = await algokit.getTransactionWithSigner(payTxn, transactionSignerAccount())
const result = await algokit.transferAlgos({
amount: (0).algos(),
from: transactionSignerAccount(),
to: transactionSignerAccount()
}, algodClient())

const atc = new AtomicTransactionComposer()
atc.addTransaction(txn)
const result = await atc.execute(algodClient(), 4)
console.log("Txn confirmed: ", result)
setConfirmedTxn(result.txIDs[0])
setConfirmedTxn(result.transaction.txID())
}

return (
Expand Down