-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
145 lines (126 loc) · 5.84 KB
/
index.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>MPA-MOK project Kolaja</title>
<link rel="icon" type="image/x-icon" href="/static/eth.ico"/>
<link rel="stylesheet" href="static/style.css"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@200&display=swap" rel="stylesheet">
</head>
<body>
<div class="top_heading">
<h1>Smart NFT project implementation in Python UI - DEMO</h1>
</div>
<!-- BLOCKCHAIN REPRESENTATION -->
<h3>Blocks of blockchain:</h3>
<div class="slider">
<div class="slides">
</div>
</div>
<hr/>
<!-- ADDRESS SELECTS -->
<div class="addresses">
<label for="ownerAddressSelect">Choose an owner address:</label>
<select name="ownerAddressSelect" id="ownerAddressSelect" size="4" disabled="disabled" multiple>
<option selected="selected">Owner addresses</option>
</select>
</div>
<div class="addresses">
<label for="userAddressSelect">Choose a user address:</label>
<select name="userAddressSelect" id="userAddressSelect" disabled="disabled">
<option selected="selected">User addresses</option>
</select>
</div>
<!-- BLOCKCHAIN ACTIONS -->
<h3 style="clear: left">Actions of the blockchain:</h3>
<div class="blockchain_actions">
<label for="blockchainDifficulty">Difficulty (0 - 8):</label>
<input type="number" id="blockchainDifficulty" name="blockchainDifficulty"
min="0" max="8" value="0" required>
<button id="setDifficulty" onClick="setDifficulty()">Set blockchain difficulty</button>
<button id="addBlock" onclick="computeNewBlock()">Compute a block</button>
<button id="fetchBlockchain" onclick="fetchBlockchain()" style="background-color: #ceedbb;">Fetch blocks into table</button>
<label for="trxAmountInput">Transaction amount [SNFT]:</label>
<input type="number" id="trxAmountInput" name="trxAmountInput"
min="1" value="1" required>
<button id="postTransaction" onClick="postTransaction()">Post transaction to blockchain</button>
</div>
<!-- ADDRESS ACTIONS -->
<div class="blockchain_actions">
<h4>Addresses actions</h4>
<label for="addressCount">Count of addresses:</label>
<input type="number" id="addressCount" name="ownerAddressCount"
min="1" max="50" value="1" required>
<button id="createOwnerAddresses"
onclick="generateAddresses('ownerAddresses', '/api/createNewOwnerAddresses', 'ownerAddressSelect', '/api/getOwnerAddresses')">
Create owner addresses
</button>
<button id="getOwnerAddresses" onclick="fetchAddressesAndFillSelect('ownerAddressSelect', '/api/getOwnerAddresses')" style="background-color: #ceedbb;">
Refresh owner addresses
</button>
<button id="createUserAddresses"
onclick="generateAddresses('userAddresses', '/api/createNewUserAddresses', 'userAddressSelect', '/api/getUserAddresses')">
Create user addresses
</button>
<button id="getUserAddresses" onclick="fetchAddressesAndFillSelect('userAddressSelect', '/api/getUserAddresses')" style="background-color: #ceedbb;">Refresh
user addresses
</button>
</div>
<!-- TOKEN ACTIONS -->
<div class="blockchain_actions">
<h4>NFT actions</h4>
<label for="nftTimeout">Timeout (100-5000):</label>
<input style="width:4em" type="number" id="nftTimeout" name="nftTimeout"
min="100" max="5000" value="100" required>
<button id="addToken" onclick="createAToken()">Add a new token</button>
<button id="fetchTokens" onclick="getAllTokens()" style="background-color: #ceedbb;">Fetch NFTs into table</button>
<label for="nftTokenIdInput">TokenId: </label>
<input id="nftTokenIdInput" type="number" min="0" name="NFT_TokenID" value="0" required>
<label for="nftTokenIdInput">Owner address engagement:</label>
<input id="nftUseOwnerAddress" type="checkbox" name="nftUseOwnerAddress">
<button type="button" id="assignNFTUserButton" onclick="assignUserToNFT()">Change user of NFT</button>
<button type="button" id="changeNFTOwnerButton" onclick="changeNFTOwner()">Change owner of NFT</button>
<button type="button" id="engageNFTOwnerButton" onclick="engageNFT('ownerAddressSelect', '/api/engageNFTOwner')">Owner engagement</button>
<button type="button" id="engageNFTUserButton" onclick="engageNFT('userAddressSelect', '/api/engageNFTUser')">User engagement</button>
</div>
<hr>
<button type="button" id="showTable">Hide table with nfts</button>
<!-- TABLES -->
<div class="tables">
<table id="NFTTable">
<caption style="font-weight:bold; padding: 3px;">Smart NFTs table</caption>
<tr>
<th id="TH_deviceAddress">Device address</th>
<th id="TH_ownerAddress">Owner address</th>
<th id="TH_userAddress">User address</th>
<th id="TH_tokenId">Token ID</th>
<th id="TH_state">State</th>
<th id="TH_timeout">Timeout</th>
</tr>
<tr>
<td colspan="6" style="text-align: center">Empty table so far</td>
</tr>
</table>
</div>
<div class="tables">
<table style="display: none" id="blocksTable">
<caption style="font-weight:bold; padding: 3px;">Blocks Table</caption>
<tr>
<th id="TH_block_hash">Block hash</th>
<th id="TH_index">Index</th>
<th id="TH_nonce">Block nonce</th>
<th id="TH_timestamp">Timestamp</th>
<th id="TH_no_transactions"># transactions</th>
<th id="TH_nft_present">NFT present (y/n)</th>
</tr>
<tr>
<td colspan="6" style="text-align: center">Empty table so far</td>
</tr>
</table>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="static/client.js"></script>
</body>
</html>