diff --git a/projects/coding-assignment/src/Home.tsx b/projects/coding-assignment/src/Home.tsx index 5c77384..cb802dc 100644 --- a/projects/coding-assignment/src/Home.tsx +++ b/projects/coding-assignment/src/Home.tsx @@ -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' @@ -13,7 +14,6 @@ interface HomeProps {} const Home: React.FC = () => { AlgokitConfig.configure({ populateAppCallResources: true }) - const [openWalletModal, setOpenWalletModal] = useState(false) const [appId, setAppId] = useState(0) const [assetId, setAssetId] = useState(0n) @@ -83,7 +83,16 @@ const Home: React.FC = () => { */ // 문제 1 시작 - const dmClient = '여기에 코드 작성' + const dmClient = new DigitalMarketplaceClient( + { + resolveBy: 'id', + id: appId, + sender: { addr: activeAddress!, signer }, + name: 'AlternativeName', + }, + algorand.client.algod, + ) + // 문제 1 끝 const toggleWalletModal = () => { diff --git a/projects/coding-assignment/src/methods.ts b/projects/coding-assignment/src/methods.ts index b62e745..5e097e4 100644 --- a/projects/coding-assignment/src/methods.ts +++ b/projects/coding-assignment/src/methods.ts @@ -60,7 +60,7 @@ export function create( */ // 문제 2 시작 - const createResult = '여기에 코드 작성' + const createResult = await dmClient.create.bare() // 문제 2 끝 /* @@ -85,10 +85,10 @@ 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({ @@ -130,10 +130,10 @@ 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() @@ -173,7 +173,7 @@ export function deleteApp(dmClient: DigitalMarketplaceClient, setAppId: (id: num */ // 문제 5 시작 - '여기에 코드 작성' + dmClient.delete.withdrawAndDelete({}, { sendParams: { fee: algokit.algos(0.003) } }) // 문제 5 끝 setAppId(0) }