-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
334 lines (293 loc) · 15.1 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
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<html data-arp-injected="true">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/main.css">
<!-- <link href="css/output.css" rel="stylesheet"> -->
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
<script>
function loadAddEndpoint() {
document.getElementById("newEndpoint").readOnly = false;
document.getElementById("addEndpoint").innerHTML = "Adding endpoint...";
setTimeout(() => {
document.getElementById("addEndpoint").disabled = true;
document.getElementById("reloadAddEndpoint").style.display = 'block';
document.getElementById("addEndpoint").innerHTML = "Add endpoint to start";
}, 2999)
}
</script>
<script>
function loadCreate() {
document.getElementById("create").innerHTML = "Creating wallet...";
setTimeout(() => {
document.getElementById("create").innerHTML = "Create new";
}, 2999)
}
</script>
<script>
function loadAddkey() {
document.getElementById("newkey").readOnly = false;
document.getElementById("addkey").innerHTML = "Loading wallet...";
setTimeout(() => {
document.getElementById("addkey").disabled = true;
document.getElementById("reloadAddkey").style.display = 'block';
document.getElementById("addkey").innerHTML = "Load wallet";
}, 2999)
}
</script>
<script>
function loadGetBalance() {
document.getElementById("getBalance").innerHTML = "Fetching balance...";
setTimeout(() => {
document.getElementById("getBalance").innerHTML = "Check balance";
}, 2999)
}
</script>
<script>
function loadAddPassword() {
document.getElementById("newPassword").readOnly = false;
document.getElementById("addPassword").innerHTML = "Setting password...";
setTimeout(() => {
document.getElementById("addPassword").disabled = true;
document.getElementById("reloadAddPassword").style.display = 'block';
document.getElementById("addPassword").innerHTML = "Set keystore password";
}, 2999)
}
</script>
<script>
function loadEncrypt() {
document.getElementById("encrypt").innerHTML = "Encrypting keystore...";
setTimeout(() => {
document.getElementById("encrypt").innerHTML = "Create keystore";
}, 2999)
}
</script>
<script>
function loadDecrypt() {
document.getElementById("decrypt").innerHTML = "Decrypting keystore...";
setTimeout(() => {
document.getElementById("decrypt").innerHTML = "Decrypt keystore";
}, 2999)
}
</script>
<script>
function loadAddReceiver() {
document.getElementById("receiver").readOnly = false;
document.getElementById("addReceiver").innerHTML = "Estimating costs...";
setTimeout(() => {
document.getElementById("addReceiver").disabled = true;
document.getElementById("reloadEstimate").style.display = 'block';
document.getElementById("addReceiver").innerHTML = "Estimate costs";
}, 2999)
}
</script>
<script>
function loadAddTxReceiver() {
document.getElementById("txReceiver").readOnly = false;
document.getElementById("addTxReceiver").innerHTML = "Sending transaction...";
setTimeout(() => {
document.getElementById("addTxReceiver").disabled = true;
document.getElementById("reloadTx").style.display = 'block';
document.getElementById("addTxReceiver").innerHTML = "Send transaction";
}, 2999)
}
</script>
<!-- json-first key storage for compatibility -->
<script>
function loadEndpoint() {
fetch('./dls/newendpoint.json')
.then((response) => response.json())
.then(function(json) {
var endpointStr = JSON.stringify(json.endpoint);
document.getElementById("endpoint").value = endpointStr.slice(1, endpointStr.length - 1);
}).catch(err => alert(err));
}
</script>
<script>
function loadPassword() {
fetch('./dls/newpassword.json')
.then((response) => response.json())
.then(function(json) {
var passStr = JSON.stringify(json.password);
document.getElementById("password").value = passStr.slice(1, passStr.length - 1);
}).catch(err => alert(err));
}
</script>
<script>
function loadAddress() {
fetch('./dls/keys.json')
.then((response) => response.json())
.then(function(json) {
var addressStr = JSON.stringify(json.address);
document.getElementById("address").value = addressStr.slice(1, addressStr.length - 1);
});
}
</script>
<script>
function loadVitals() {
fetch('./dls/keys.json')
.then((response) => response.json())
.then(function(json) {
var addressStr = JSON.stringify(json.address);
document.getElementById("address").value = addressStr.slice(1, addressStr.length - 1);
});
fetch('./dls/newendpoint.json')
.then((response) => response.json())
.then(function(json) {
var endpointStr = JSON.stringify(json.endpoint);
document.getElementById("endpoint").value = endpointStr.slice(1, endpointStr.length - 1);
});
fetch('./dls/balance.json')
.then((response) => response.json())
.then(function(json) {
var balanceStr = JSON.stringify(json.ethersBalance);
document.getElementById("balance").value = balanceStr.slice(1, balanceStr.length - 1);
});
}
</script>
<script>
function loadConsole() {
window.open("https://console.chainstack.com/", "_blank");
}
</script>
<script>
function loadEndpointTip() {
document.getElementById("endpoint").value = "Click me to get a free endpoint from chainstack.com"
}
</script>
<script>
function loadWalletTip() {
document.getElementById("wallet-label").innerHTML = "Click to copy wallet address"
}
</script>
<script>
function loadWalletLabel() {
document.getElementById("wallet-label").innerHTML = "Wallet address"
}
</script>
<script>
function loadBalanceTip() {
document.getElementById("balance").value = "Click to show your transaction history on Etherscan"
}
</script>
<script>
function loadExplorer() {
window.open("https://etherscan.com/address/" + document.getElementById("address").value, "_blank");
}
</script>
<script>
function loadWalletCopy() {
var copyText = document.getElementById("address");
copyText.select();
copyText.setSelectionRange(0, 99999);
navigator.clipboard.writeText(copyText.value);
alert("Wallet address copied to clipoard: " + copyText.value);
}
</script>
</head>
<!-- add triggers and on-click actions -->
<body onload="loadVitals()" >
<div class="wrapper" style="
margin: 0.5% auto;
padding: 0.5% 5%;
border-radius: 3%;
border-style: outset;
--tw-drop-shadow: 1 1 cornsilk;
filter: drop-shadow(22px 33px 22px rgb(0 0 0 / 0.55));
border-color: currentColor;
background-color: rgba(255,255,255,0.77)!important;
}">
<!-- <h1 class="text-3xl font-bold underline" style="margin-bottom: 3%">BUIDL YOUR OWN WALLET</h1> -->
<div class="vitals" style="width: -webkit-fill-available;">
<img src="/buidl-yow-logo.png" style="
width: 40rem;
margin: auto;
"></img>
<label class="action-label text-l font-bold" style="padding-left: 5px; padding-right:5px"><strong style="font-weight: bold; font-size: larger!important">Node endpoint</strong>
<input class="vitals-txt border-solid border-2 text-input border rounded p-1 border-slate-500/75" style="margin-bottom:3%!important" id="endpoint" readonly="true" value="Get a free endpoint on click here or set it below..." onclick="loadConsole()" onmouseover="loadEndpointTip()" onmouseout="loadVitals()"></input>
<label class="action-label text-l font-bold" style="padding-left: 5px; padding-right:5px"><strong style="font-weight: bold; font-size: larger!important" id="wallet-label">Wallet address</strong>
<input class="vitals-txt border-solid border-2 text-input border rounded p-1 border-slate-500/75" style="margin-bottom:3%!important" id="address" readonly="true" value="Create a new wallet or add an existing address..." onclick="loadWalletCopy()" onmouseover="loadWalletTip()" onmouseout="loadWalletLabel()"></input>
</label>
<label class="action-label text-l font-bold" style="padding-left: 5px; padding-right:5px"><strong style="font-weight: bold; font-size: larger!important">Latest balance</strong>
<input class="vitals-txt border-solid border-2 text-input border rounded p-1 border-slate-500/75" style="margin-bottom:3%!important" id="balance" readonly="true" value="Load wallet to get balance & send transactions..." onclick="loadExplorer()" onmouseover="loadBalanceTip()" onmouseout="loadVitals()"></input>
</label>
</div>
<div class="actions">
<div class="action-wrapper" id="endpoint-cat">
<h2>Manage</h2>
<label class="action-label text-l font-bold text-l font-bold" ><strong class="!text-base">Access wallets</strong>
<form action="/pages/create" method="GET" class="action-form" style="margin-bottom: 3%!important">
<button id="create" onclick="loadCreate()" class="action-btn border border-solid rounded p-1 border-3 border-slate-500/75">Create new</button>
</form>
<form action="/pages/addkey" method="POST" class="action-form">
<input class="text-input border !text-xs border-solid rounded p-1 border-3 border-slate-500/75" id="newkey" name="newkey" placeholder="Enter private key" maxlength="66"></input>
<button id="addkey" onclick="loadAddkey()" class="action-btn border border-solid rounded p-1 border-3 border-slate-500/75">Load wallet</button>
</form>
<button id="reloadAddkey" onclick="location.reload()" class="reload-btn">Unlock input</button>
<label class="action-label text-l font-bold text-l font-bold"><strong class="!text-base">Update assets</strong>
<form action="/pages/balance" method="GET" class="action-form" >
<button id="getBalance" onclick="loadGetBalance()" class="action-btn border border-solid rounded p-1 border-3 border-slate-500/75">Print balance</button>
</form>
</label>
</label>
</div>
</br>
<div class="action-wrapper" id="transaction-wrapper">
<h2>Execute</h2>
<label class="action-label text-l font-bold"><strong class="!text-base">Create transaction</strong>
<form action="/pages/receipt" method="POST" class="action-form">
<input class="text-input border !text-xs border-solid rounded p-1 border-3 border-slate-500/75" id="txReceiver" name="txReceiver" placeholder="Enter receiver address" maxlength="42"></input>
<input class="text-input border !text-xs border-solid rounded p-1 border-3 border-slate-500/75" id="txValue" name="txValue" placeholder="Enter amount to send"></input>
<input class="text-input border !text-xs border-solid rounded p-1 border-3 border-slate-500/75" id="txData" name="txData" placeholder="Enter tx data (optional)"></input>
<input class="text-input border !text-xs border-solid rounded p-1 border-3 border-slate-500/75" id="txGas" name="txGas" placeholder="Enter gas amount"></input>
<button id="addTxReceiver" onclick="loadAddTxReceiver()" class="action-btn border border-solid rounded p-1 border-3 border-slate-500/75">Send transaction</button>
</form>
<button id="reloadTx" onclick="location.reload()" class="reload-btn">Unlock input</button>
</label>
</div>
</br>
<div class="action-wrapper" id="security-cat">
<h2>Protect</h2>
<label class="action-label text-l font-bold"><strong class="text-base">Encrypt keystore</strong>
<input class="text-input border !text-xs border-solid rounded p-1 border-3 border-slate-500/75" id="password" readonly="true" placeholder="Click to show password" onclick="loadPassword()"></input>
<form action="/pages/encrypt" method="GET" class="action-form">
<button id="encrypt" onclick="loadEncrypt()" class="action-btn border border-solid rounded p-1 border-3 border-slate-500/75">Create keystore</button>
</form>
<label class="action-label text-l font-bold "><strong class="!text-base">Decrypt keystore</strong>
<input class="text-input border !text-xs border-solid rounded p-1 border-3 border-slate-500/75" id="keystore" readonly="true" value="./dls/encryptedKeyStore" onclick="loadKeystore()"></input>
<form action="/pages/decrypt" method="GET" class="action-form">
<button id="decrypt" onclick="loadDecrypt()" class="action-btn border border-solid rounded p-1 border-3 border-slate-500/75">Decrypt keystore</button>
</form>
</label>
</div>
</div>
<div class="flex flex-row flex-wrap items center">
<div>
<label class="action-label text-l font-bold"><strong class="!text-base">Change endpoint</strong>
<form action="/pages/addendpoint" method="POST" class="action-form">
<input class="text-input border !text-xs border-solid rounded p-1 border-3 border-slate-500/75" id="newEndpoint" name="newEndpoint" placeholder="Enter node endpoint"></input>
<button id="addEndpoint" onclick="loadAddEndpoint()" class="action-btn border border-solid rounded p-1 border-3 border-slate-500/75">Set endpoint</button>
</form>
<button id="reloadAddEndpoint" onclick="location.reload()" class="reload-btn">Unlock input</button>
</label>
</div>
<div>
<label class="action-label text-l font-bold" style="margin-left: 3%; margin-right: 3%"><strong class="!text-base">Estimate gas</strong>
<form action="/pages/estimate" method="POST" class="action-form">
<input class="text-input border !text-xs border-solid rounded p-1 border-3 border-slate-500/75" id="receiver" name="receiver" placeholder="Enter receiver address" maxlength="42"></input>
<button id="addReceiver" onclick="loadAddReceiver()" class="action-btn border border-solid rounded p-1 border-3 border-slate-500/75">Estimate costs</button>
</form>
<button id="reloadEstimate" onclick="location.reload()" class="reload-btn">Unlock input</button>
</label>
</div>
<div >
<label class="action-label text-l font-bold " ><strong class="!text-base">Change password</strong>
<form action="/pages/addpassword" method="POST" class="action-form ">
<input class="text-input border !text-xs border-solid rounded p-1 border-3 border-slate-500/75" id="newPassword" name="newPassword" placeholder="Enter keystore pass"></input>
<button id="addPassword" onclick="loadAddPassword()" class="action-btn border border-solid rounded p-1 border-3 border-slate-500/75">Set password</button>
</form>
<button id="reloadAddPassword" onclick="location.reload()" class="reload-btn">Unlock input</button>
</label>
</div>
</div>
</body>
</html>