forked from near/multisig-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
503 lines (453 loc) · 20.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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Multisig Tool</title>
<!-- Font Awesome -->
<link
href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
rel="stylesheet"
/>
<!-- Google Fonts -->
<link
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
rel="stylesheet"
/>
<!-- MDB -->
<link
href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/1.0.0/mdb.min.css"
rel="stylesheet"
/>
<!-- import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css">
<!-- import the webpage's javascript file -->
<!-- MDB -->
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/1.0.0/mdb.min.js"
></script>
<script src="/script.js" defer></script>
</head>
<body>
<div class="container fluid">
<div class="row">
<div class="col-md-8 col-xs-12 mx-auto">
<div class="card">
<div class="card-body">
<h2 class="card-title text-center">Tool to manage multisigs</h2>
<hr/>
<p class="mb-0 text-center">
This is temporary until NEAR Wallet adds this functionality
</p>
</div>
</div>
<br/>
<div class="card">
<div class="card-body">
<h5 class="card-title">Keys</h5>
<p class="card-text">
<ul class="list-group list-group-flush">
<script id="template-keys" type="x-tmpl-mustache" style="flex-wrap: wrap;">
{{#keys}}
<li class="list-group-item"> <input class="form-check-input mr-1" type="checkbox" value="" aria-label="{{ publicKey }}
" /> {{ publicKey }} {{ path }}</li>
{{/keys}}
</script>
</ul>
</p>
<div class="row mb-4">
<div class="col d-flex w-100">
<div class="form-outline mb-4 w-100">
<input class="form-control " type="text" id="path"/>
<label class="form-label" for="path">Enter Ledger path</label>
</div>
</div>
<div class="col">
<div>
<button type="button" class="btn btn-primary" id="addPathBtn" data-toggle="modal"
data-target="#ledgerModal" onclick="addPath()">Add
</button>
</div>
</div>
<div class="text-danger" id="keysError"></div>
</div>
<div id="keys"></div>
<!-- Modal -->
<div
class="modal fade"
id="ledgerModal"
tabindex="-1"
aria-labelledby="ledgerModalLabel"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="ledgerModalLabel">Adding Ledger path</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Please connect your ledger, go to NEAR app and accept request, then click on 'Continue'
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-primary">Continue</button>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="card">
<div class="card-body">
<h5 class="card-title">Select or Add Account</h5>
<div id="accounts"></div>
<p class="card-text">
<ul class="list-group list-group-flush">
<script id="template1" type="x-tmpl-mustache">
{{#accounts}}
<li class="list-group-item {{ active }}"> <a href="#{{ accountId }}">{{ accountId }}</a> {{ amount }}</li>
{{/accounts}}
</script>
</ul>
</p>
<div class="row mb-4">
<div class="col d-flex w-100">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="account"/>
<label class="form-label" for="account">Enter account</label>
</div>
</div>
<div class="col">
<div>
<button type="button" class="btn btn-primary" onclick="addAccount()">Add</button>
</div>
</div>
</div>
</div>
</div>
<br>
<script id="template2" type="x-tmpl-mustache" style="word-wrap: break-word;">
<button type="button" class="btn btn-primary" onclick="window.location.href='#{{ accountId }}/staking'">Staking</button>
<hr/>
<div class="card">
<div class="card-body">
<h5 class="card-title">Account: {{ accountId }}</h5>
<p class="card-text">
<p>Balance: {{ balance }}</p>
{{#lockupBalance}}
<p>
Balance lockup: {{ lockupBalance }}
{{#lockupTransferDisabled}}
<button type="button" class="btn btn-warning" onclick="submitRequest('{{ accountId }}', 'transfer_lockup_enable')">Enable lockup transfers</button>
{{/lockupTransferDisabled}}
</p>
{{/lockupBalance}}
<p>Num confirmations: {{ numConfirmations }}</p>
<p>Keys</p>
<table class="table" style="table-layout: fixed; width: 100%">
{{#accessKeys}}
<tr><td>{{ public_key }}</td><td style="word-wrap: break-word">{{ access_key.permission.FunctionCall.method_names }}</td></tr>
{{/accessKeys}}
</table>
<br />
<br />
<h3>Requests</h3>
<div class="table-responsive">
<table class="table">
<thead class="table-dark">
<tr>
<td>Id</td>
<td>Receiver</td>
<td># conf</td>
<td>Actions</td>
<td>Confirm/Delete</td>
</tr>
</thead>
{{#requests}}
<tbody>
<tr>
<td>{{ request_id }}</td>
<td>{{ receiver_id }}</td>
<td>{{ numConfirms }}</td>
<td>{{ repr }}</td>
<td>
<button type="button" class="btn btn-success btn-floating" onclick="confirmRequest('{{ accountId }}', {{ request_id }})"><i class="fas fa-check"></i></button>
<button type="button" class="btn btn-danger btn-floating" onclick="deleteRequest('{{ accountId }}', {{ request_id }})"><i class="fas fa-trash-alt"></i></button>
</td>
</tr>
</tbody>
{{/requests}}
</table>
</div>
<br />
<h3>Actions</h3>
<p>Add new key:</p>
<div class="row mb-4">
<div class="col d-flex w-100">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="new-key" />
<label class="form-label" for="account">Enter new key</label>
</div>
</div>
<div class="col">
<div>
<button type="button" class="btn btn-primary" onclick="submitRequest('{{ accountId }}', 'add_key')">Add request & confirm</button>
<button type="button" class="btn btn-warning mt-1" onclick="submitRequest('{{ accountId }}', 'add_request_key')">Add request only</button>
</div>
</div>
</div>
<hr />
<br />
<p>Transfer:</p>
<div class="row mb-4">
<div class="col d-flex w-100">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="transfer-receiver" placeholder="Receiver" />
<label class="form-label" for="transfer-receiver">Enter receiver</label>
</div>
</div>
<div class="col d-flex w-100">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="transfer-amount" placeholder="Amount in NEAR">
<label class="form-label" for="transfer-amount">Amount in NEAR</label>
</div>
</div>
<div class="col-12 col-lg-6 text-left justify-content-left">
<div>
<button type="button" class="btn btn-primary" onclick="submitRequest('{{ accountId }}', 'transfer')">Transfer</button>
{{#lockupBalance}}
{{#lockupTransferEnabled}}
<button type="button" class="btn btn-warning" onclick="submitRequest('{{ accountId }}', 'transfer_lockup')">Transfer from lockup</button>
{{/lockupTransferEnabled}}
{{/lockupBalance}}
</div>
</div>
</div>
<hr />
<br />
<p>Change number of confirmations:</p>
<div class="row mb-4">
<div class="col-12 col-lg-6 d-flex">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="num-confirmations" placeholder="Number of confirmations" />
<label class="form-label" for="num-confirmations">Enter number of confirmations</label>
</div>
</div>
<div class="col-12 col-lg-6 text-left justify-content-left">
<div>
<button type="button" class="btn btn-primary" onclick="submitRequest('{{ accountId }}', 'num_confirmations')">Change</button>
</div>
</div>
</div>
<hr />
<br />
<p>Create account</p>
<div class="row mb-4">
<div class="col-12 col-lg-6 d-flex">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="create-account-name" placeholder="Account name" />
<label class="form-label" for="create-account-name">Account name</label>
</div>
</div>
<div class="col-12 col-lg-6 d-flex">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="create-account-public-key" placeholder="Public key" />
<label class="form-label" for="create-account-public-key">Public key</label>
</div>
</div>
<div class="col-12 col-lg-6 text-left justify-content-left">
<div>
<button type="button" class="btn btn-primary" onclick="submitRequest('{{ accountId }} ', 'create_account')">Create account</button>
</div>
</div>
</div>
<hr />
<br />
<p>Public vesting termination:</p>
<div class="row mb-4 justify-content-left">
<div class="col-12 col-lg-12 d-flex">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="lockup-account-id" placeholder="Lockup account" />
<label class="form-label" for="lockup-account-id">Enter lockup account</label>
</div>
</div>
<div class="col-12 col-lg-12 text-left justify-content-center mb-2">
<div>
<button type="button" class="btn btn-success" onclick="submitRequest('{{ accountId }}', 'terminate_vesting')">Terminate Public Vesting</button>
<button type="button" class="btn btn-warning ml-3" onclick="submitRequest('{{ accountId }}', 'termination_withdraw')">Withdraw</button>
</div>
</div>
<p>Private vesting termination:</p>
<div class="row mb-4 justify-content-left">
<div class="col-12 col-lg-3 d-flex">
<div class="form-outline mb-3 w-100">
<input class="form-control" type="text" id="lockup-vesting-start-date" placeholder="YYYY-MM-DD" />
<label class="form-label" for="lockup-vesting-start-date">Start Date</label>
</div>
</div>
<div class="col-12 col-lg-3 d-flex">
<div class="form-outline mb-3 w-100">
<input class="form-control" type="text" id="lockup-vesting-cliff-date" placeholder="YYYY-MM-DD" />
<label class="form-label" for="lockup-vesting-cliff-date">Cliff Date</label>
</div>
</div>
<div class="col-12 col-lg-3 d-flex">
<div class="form-outline mb-3 w-100">
<input class="form-control" type="text" id="lockup-vesting-end-date" placeholder="YYYY-MM-DD" />
<label class="form-label" for="lockup-vesting-end-date">End Date</label>
</div>
</div>
<div class="col-12 col-lg-12 d-flex">
<div class="form-outline mb-3 w-100">
<input class="form-control" type="text" id="lockup-vesting-salt" placeholder="" />
<label class="form-label" for="lockup-vesting-salt">Vesting Salt</label>
</div>
</div>
<div class="col-12 col-lg-4 text-left justify-content-center">
<div>
<button type="button" class="btn btn-danger" onclick="submitRequest('{{ accountId }}', 'terminate_private_vesting')">Terminate Private Vesting</button>
</div>
</div>
</div>
<br />
</div>
</div>
</script>
<!--
<p>Create new multisig account:</p>
<div class="row mb-4 justify-content-left">
<div class="col-12 col-lg-6 d-flex">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="multisig-account-id" placeholder="Account Id" />
<label class="form-label" for="multisig-account-id">Account Id</label>
</div>
</div>
<div class="col-12 col-lg-6 text-left justify-content-center">
<button type="button" class="btn btn-danger" onclick="submitRequest('{{ accountId }}', 'multisig')">Create multisig</button>
</div>
</div>
<hr />
<br />
<p>Deploy lockup:</p>
<div class="row mb-4 justify-content-left">
<div class="col-12 col-lg-6 d-flex">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="create-lockup-account-id" placeholder="Owner account for lockup contract" />
<label class="form-label" for="create-lockup-account-id">Owner account for lockup contract</label>
</div>
</div>
<div class="col-12 col-lg-6 d-flex">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="create-lockup-amount" placeholder="Lockup amount in NEAR" />
<label class="form-label" for="create-lockup-amount">Lockup amount in NEAR</label>
</div>
</div>
<div class="col-12 col-lg-6 d-flex">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="create-lockup-duration" placeholder="Lockup duration (in days)" />
<label class="form-label" for="create-lockup-duration">Lockup duration (in days)</label>
</div>
</div>
<div class="col-12 col-lg-6 d-flex">
<div class="form-outline mb-4 w-100">
<input type="checkbox" id="create-lockup-staking" placeholder="" checked />
<label for="create-lockup-staking">Enable staking</label>
</div>
</div>
<div class="col-12 col-lg-6 text-left justify-content-center">
<button type="button" class="btn btn-danger" onclick="submitRequest('{{ accountId }}', 'lockup')">Deploy lockup</button>
</div>
</div>
-->
<script id="template-staking" type="x-tmpl-mustache">
<button type="button" class="btn btn-primary" onclick="window.location.href='#{{ accountId }}'">Back</button>
<hr/>
<div class="card">
<div class="card-body">
<h5 class="card-title">Account: {{ accountId }}</h5>
<p class="card-text">
</p>
<div class="row mb-4">
<label>Select or Enter Pool Id</label>
<div class="col-12 col-lg-6 text-left justify-content-center">
<select style="width: 200px; float: left;" onchange="this.nextElementSibling.value=this.value">
<option></option>
{{#pools}}
<option value="{{ poolId }}">{{ poolId }} -- {{ fee }} -- {{ stake }}</option>
{{/pools}}
</select>
<input id="select-pool-id" style="width: 180px; margin-left: -199px; margin-top: 1px; border: none; float: left;"/>
</div>
</div>
<div class="row mb-4">
<div class="col d-flex w-100">
<div class="form-outline mb-4 w-100">
<input class="form-control" type="text" id="stake-amount" placeholder="Amount in NEAR">
<label class="form-label" for="stake-amount">Amount in NEAR</label>
</div>
</div>
<div class="col-12 col-lg-6 text-left justify-content-left">
<div>
<button type="button" class="btn btn-primary" onclick="depositAndStake('{{ accountId }}')">Despoit & Stake</button>
<button type="button" class="btn btn-primary" onclick="unstake('{{ accountId }}')">Unstake</button>
<button type="button" class="btn btn-primary" onclick="stakeWithdraw('{{ accountId }}')">Withdraw</button>
</div>
</div>
</div>
<hr />
<br />
<div class="row mb-4">
<div class="col-12 col-lg-6 text-left justify-content-center">
<table>
<tr>
<td>Pool Id</td>
<td>Staked</td>
<td>Unstaked</td>
</tr>
{{#staking}}
<tr>
<td>{{ poolId }}</td>
<td>{{ totalStaked }}</td>
<td>{{ totalUnstaked }}</td>
<td>
<button type="button" class="btn btn-primary" onclick='unstakeAll("{{ accountId }}", "{{ poolId }}")'>Unstake all</button>
<button type="button" class="btn btn-danger" onclick='withdrawAll("{{ accountId }}", "{{ poolId }}")'>Withdraw all</button>
</td>
</tr>
{{/staking}}
</table>
</div>
</div>
</div>
</div>
</script>
<div id="requests"></div>
<footer class="bg-light text-center text-lg-left">
<!-- Copyright -->
<div class="text-center p-3" style="background-color: rgba(0, 0, 0, 0.2);">
© 2021 Copyright:
<a class="text-dark" target="_blank" href="https://near.org/">Near.org</a>
</div>
<!-- Copyright -->
</footer>
</div>
</div>
</div>
</body>
</html>
<script type="application/javascript">
function initInputs() {
document.querySelectorAll('.form-outline').forEach((formOutline) => {
new window.mdb.Input(formOutline).init();
});
}
window.initInputs = initInputs;
document.addEventListener("DOMContentLoaded", () => {
initInputs();
})
</script>