This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
wallet.html
executable file
·185 lines (172 loc) · 5.75 KB
/
wallet.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!-- @file wallet.html
* @authors Saurabh Gupta [[email protected]]
* Awadhut Thube [[email protected]]
* Jheel Nagaria [[email protected]]
* Ashish Kamble [[email protected]]
*-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>CoE Blockchain</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="./public/css/bootstrap.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">
<link href="./public/css/font-awesome.min.css" rel="stylesheet">
<link href="./public/css/style.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-default">
<div class="container"></div>
<div class="navbar-header">
<a class="navbar-brand" href="#"><img src="./public/images/oldlogo.png" alt="CoE Blockchain" width="122" height="60"></a></div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="defaultNavbar1">
<ul class="nav navbar-nav navbar-right">
<!-- Enter your IP Address. Leave the port number same. -->
<li><a href="http://192.168.43.50:4000">Go to Energy Marketplace</a></li>
<li><a href="http://localhost:3000">Logout</a></li>
</ul>
</div>
</div>
</nav>
<section>
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2>Wallet</h2>
</div>
</div>
<div class="row">
<div class="col-md-4 col-xs-12">
<div class="card">
<h3 id="my_Etokens"></h3>
<p align="center">Energy tokens</p>
</div>
</div>
<div class="col-md-4 col-xs-12">
<div class="card">
<h3 id="current_generation"></h3>
<p align="center">Current Generation</p>
</div>
</div>
<div class="col-md-4 col-xs-12">
<div class="card">
<h3 id="ether_balance"></h3>
<p align="center">Account Balance</p>
</div>
</div>
</div>
</div>
</section>
<section class="sub-section">
<div class="container">
<div class="row">
<div class="col-xs-4">
<h2 class="alt-h2">Pending Transactions</h2>
</div>
<div class="col-xs-12">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th style="text-align:center">Transaction Number</th>
<th style="text-align:center">Transaction Hash</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">1</td>
<td align="center" id = "trans_hash1"></td>
</tr>
<tr>
<td align="center">2</td>
<td align="center" id = "trans_hash2"></td>
</tr>
<tr>
<td align="center">3</td>
<td align="center" id = "trans_hash3"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-4">
<h2 class="alt-h2">Ethereum Mining Options</h2>
<button class="btn btn-secondary" onclick="startmine()">Start Mining</button>
<button class="btn btn-danger" onclick="stopmine()">Stop Mining</button>
<hr></hr>
</div>
</div>
<div class="row">
<div class="col-xs-4">
<h2 class="alt-h2">Ethereum Wallet Transaction</h2>
</div>
<div class="modal-body">
<div class="form-group">
<input type="text" class="form-control" placeholder="To Account" id="To_address">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Ether Amount" id="Value">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal" onclick="basic_tx();">Send</button>
</div>
</div>
</div>
</section>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="./public/js/jquery-1.11.3.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="./public/js/bootstrap.js"></script>
<script src="./public/js/script.js"></script>
<script src="./consumer.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="/node_modules/web3/dist/web3.min.js"></script>
<script>
var energy_KWH;
var energy_tokens;
var socket = io();
function startmine()
{
socket.emit('startmine', 'user');
}
function stopmine()
{
socket.emit('stopmine', 'user');
}
setInterval(function()
{
document.getElementById("current_generation").innerHTML = energy_KWH;
document.getElementById("my_Etokens").innerHTML = energy_tokens;
document.getElementById("ether_balance").innerHTML = ether_balance;
}, 1000);
socket.on('pending_tx_list', function(data)
{
var tx_1 = data.tx_1;
var tx_2 = data.tx_2;
var tx_3 = data.tx_3;
document.getElementById("trans_hash1").innerHTML = tx_1;
document.getElementById("trans_hash2").innerHTML = tx_2;
document.getElementById("trans_hash3").innerHTML = tx_3;
});
socket.on('energy_token_balance', function (data)
{
energy_KWH = data.energy;
energy_tokens = data.tok;
ether_balance = data.bal;
})
function basic_tx()
{
var to_address = document.getElementById("To_address").value;
var value = document.getElementById("Value").value;
socket.emit('basic_tx', {add:to_address, val:value});
}
</script>
</body>
</html>