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

과제 4 완성했습니다 #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion projects/coding-assignment/src/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import algosdk from 'algosdk'
import React, { useEffect, useState } from 'react'
import ConnectWallet from './components/ConnectWallet'
import MethodCall from './components/MethodCall'
import { DigitalMarketplaceClient } from './contracts/DigitalMarketplace'
import * as methods from './methods'
import { getAlgodConfigFromViteEnvironment } from './utils/network/getAlgoClientConfigs'

Expand Down Expand Up @@ -83,7 +84,14 @@ const Home: React.FC<HomeProps> = () => {
*/

// 문제 1 시작
const dmClient = '여기에 코드 작성'
const dmClient = new DigitalMarketplaceClient(
{
resolveBy: 'id',
id: appId,
sender: { addr: activeAddress!, signer },
},
algorand.client.algod,
)
// 문제 1 끝

const toggleWalletModal = () => {
Expand Down
21 changes: 14 additions & 7 deletions projects/coding-assignment/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function create(
*/

// 문제 2 시작
const createResult = '여기에 코드 작성'
const createResult = await dmClient.create.bare()
// 문제 2 끝

/*
Expand All @@ -85,10 +85,14 @@ export function create(
sender,
receiver: createResult.appAddress,
amount: algokit.algos(0.1 + 0.1),
extraFee: '여기에 코드 작성',
extraFee: algokit.algos(0.001),
})

;('여기에 bootstrap 메서드 호출 코드 작성')
await dmClient.bootstrap({
asset: assetId,
unitaryPrice: unitaryPrice,
mbrPay: mbrTxn,
})
// 문제 3 끝

await algorand.send.assetTransfer({
Expand Down Expand Up @@ -130,10 +134,13 @@ export function buy(
sender,
receiver: appAddress,
amount: algokit.microAlgos(Number(quantity * unitaryPrice)),
extraFee: '여기에 코드 작성',
extraFee: algokit.algos(0.001),
})

;('여기에 buy 메서드 호출 코드 작성')
await dmClient.buy({
buyerTxn: buyerTxn,
quantity: quantity,
})
// 문제 4 끝

const state = await dmClient.getGlobalState()
Expand All @@ -156,7 +163,7 @@ export function deleteApp(dmClient: DigitalMarketplaceClient, setAppId: (id: num
2. Additional Parameters: 앱 클라이언트 메서드 호출시 추가적인 설정을 넣는 곳입니다.

abi argument:
withdrawAndDelete는 전닯값이 필요없는 메서드입니다. 따라서 빈 객체를 넣어주세요.
withdrawAndDelete는 전달값이 필요없는 메서드입니다. 따라서 빈 객체를 넣어주세요.

additional parameters:
withdrawAndDelete는 2개의 inner txn를 보냅니다.
Expand All @@ -173,7 +180,7 @@ export function deleteApp(dmClient: DigitalMarketplaceClient, setAppId: (id: num
*/

// 문제 5 시작
'여기에 코드 작성'
await dmClient.delete.withdrawAndDelete({}, { sendParams: { fee: algokit.transactionFees(3) } })
// 문제 5 끝
setAppId(0)
}
Expand Down