Skip to content
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
12 changes: 10 additions & 2 deletions 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,8 +84,15 @@ const Home: React.FC<HomeProps> = () => {
*/

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

const toggleWalletModal = () => {
setOpenWalletModal(!openWalletModal)
Expand Down
19 changes: 13 additions & 6 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 Down Expand Up @@ -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