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

아무거나 #5

Open
wants to merge 1 commit 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
25 changes: 18 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,16 @@ export function create(
sender,
receiver: createResult.appAddress,
amount: algokit.algos(0.1 + 0.1),
extraFee: '여기에 코드 작성',
extraFee: algokit.algos(1),
})

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

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

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

const state = await dmClient.getGlobalState()
Expand Down Expand Up @@ -173,8 +184,8 @@ export function deleteApp(dmClient: DigitalMarketplaceClient, setAppId: (id: num
*/

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