Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thank you! #9

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
53 changes: 40 additions & 13 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ async function main() {
*/

// 문제 1 시작
const alice = "*** 여기에 코드 작성 ***"
const bob = "*** 여기에 코드 작성 ***"
const chris = "*** 여기에 코드 작성 ***"
const alice = algorand.account.random();
const bob = algorand.account.random();
const chris = algorand.account.random();
// 문제 1 끝
const accounts = [alice, bob, chris];

Expand All @@ -47,7 +47,12 @@ async function main() {
const dispenser = await algorand.account.dispenser();
for (const account of accounts) {
// 문제 2 시작
"*** 여기에 코드 작성 ***"
await algorand.send.payment({
sender: dispenser.addr,
receiver: account.addr,
amount: algokit.algos(120),
});

// 문제 2 끝
}

Expand All @@ -66,7 +71,14 @@ async function main() {
- assetCreateParam: https://github.com/algorandfoundation/algokit-utils-ts/blob/main/docs/code/modules/types_composer.md#assetcreateparams
*/
// 문제 3 시작
const createResult = "*** 여기에 코드 작성 ***"
const createResult = await algorand.send.assetCreate({
sender: bob.addr.toString(),
assetName: "Apple Vision Pro",
unitName: "AVP",
total: BigInt(1),
decimals: 0
});

// 문제 3 끝

// Get assetIndex from transaction
Expand All @@ -83,8 +95,11 @@ async function main() {
*/

// 문제 4 시작
"*** 여기에 코드 작성 ***"
// 문제 4 끝
await algorand.send.assetOptIn({
sender : alice.addr,
assetId: assetId
});
// 문제 4 끝

/*
문제 5
Expand Down Expand Up @@ -121,14 +136,26 @@ async function main() {

// 밥이 앨리스에게 애플 비전 프로 ASA를 송금하는 트랜잭션 객체 생성
// 문제 5 시작
const bobSendAssetTxnParam = "*** 여기에 코드 작성 ***"

const bobSendAssetTxnParam = {
sender: bob.addr,
receiver: alice.addr,
amount: BigInt(1), // Only 1 asset being transferred, as per the total created earlier
assetId: assetId // This is the ID of the ASA created by Bob
};
// 앨리스가 크리스에게 110 ALGO를 송금하는 트랜잭션 객체 생성
const alicePayTxnParam = "*** 여기에 코드 작성 ***"

const alicePayTxnParam = {
sender: alice.addr,
receiver: chris.addr,
amount: algokit.algos(110),
};

// 3개의 트랜잭션을 atomic transaction composer로 묶어서 전송
const atomicGroup = "*** 여기에 코드 작성 ***"
const result = "*** 여기에 코드 작성 ***"
const atomicGroup = algorand.newGroup();
await atomicGroup.addPayment(chrisPayTxnParam); // Chris pays Bob 100 ALGO
await atomicGroup.addAssetTransfer(bobSendAssetTxnParam); // Bob sends the ASA to Alice
await atomicGroup.addPayment(alicePayTxnParam); // Alice pays Chris 110 ALGO
const result = await atomicGroup.execute(); // Execute all transactions as a single atomic group

// 문제 5 끝

console.log("아래 트랜잭션 ID를 가진 3개의 트랜잭션이 어토믹 트랜잭션으로 동시 체결됬습니다!", result.txIds)
Expand Down