-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathsingle_nft_marketplace.py
36 lines (25 loc) · 1.39 KB
/
single_nft_marketplace.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from src.blockchain_utils.credentials import get_client, get_account_credentials
from src.services.nft_service import NFTService
from src.services.nft_marketplace import NFTMarketplace
client = get_client()
acc_pk, acc_address, _ = get_account_credentials(account_id=2)
nft_buyer_pk, nft_buyer_address, _ = get_account_credentials(account_id=3)
nft_service = NFTService(nft_creator_pk=acc_pk,
nft_creator_address=acc_address,
client=client,
unit_name="TOK",
asset_name="Tokility",
nft_url="https://ipfs.io/ipfs/QmSg13NNtvpL6ebgeGKxZUHTCxcg4ut6k4dcMrUu5sG664?filename=6.png")
nft_service.create_nft()
nft_marketplace = NFTMarketplace(admin_pk=acc_pk,
admin_address=acc_address,
nft_id=nft_service.nft_id,
client=client)
nft_marketplace.app_initialization(nft_owner_address=acc_address)
nft_service.change_nft_credentials_txn(escrow_address=nft_marketplace.escrow_address)
nft_marketplace.initialize_escrow()
nft_marketplace.fund_escrow()
nft_marketplace.make_sell_offer(sell_price=10000, nft_owner_pk=acc_pk)
nft_service.opt_in(nft_buyer_pk)
nft_marketplace.buy_nft(nft_owner_address=acc_address, buyer_address=nft_buyer_address,
buyer_pk=nft_buyer_pk, buy_price=10000)