This repository has been archived by the owner on Aug 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
import.html
229 lines (215 loc) · 11.2 KB
/
import.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
<html>
<head>
<meta charset="UTF-8">
<title>Material-Eleos</title>
<link rel="stylesheet" href="./material.min.css">
<link rel="stylesheet" href="./styles.css">
<link rel="stylesheet" href="./w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>
<div class="demo-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
<header class="demo-header mdl-layout__header mdl-color--grey-100 mdl-color-text--grey-600">
<div class="mdl-layout__header-row">
<span class="mdl-layout-title" id="currentBalanceValue"></span> <span class="coin"></span>
<a> (Transparent: <span id="transparentAvailableValue"></span> <span class="coin"></span> / Private: <span id="privateBalanceValue"></span> <span class="coin"></span>)</a>
<a> <span id="connectionsField">| Connections: <span id="connectionsValue"></span></span></a>
<a> | <span id="syncStatusLabel">Sync Status: <span id="syncStatusValue"></span>%</span></span> <span class="alertSpan" id="alertSpan"></span></a>
<a> </a><span id="spinner"><div id="p2" style="width: 200px" class="mdl-progress mdl-js-progress mdl-progress__indeterminate"></div></span>
<div class="mdl-layout-spacer"></div>
</div>
</header>
<div class="demo-drawer mdl-layout__drawer mdl-color--blue-grey-900 mdl-color-text--blue-grey-50">
<header class="demo-drawer-header">
<img src="zcl.png" class="demo-avatar">
<div class="demo-avatar-dropdown">
<span>ZCLASSIC</span>
<div class="mdl-layout-spacer"></div>
<button id="accbtn" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
<i class="material-icons" role="presentation">arrow_drop_down</i>
<span class="visuallyhidden">Wallet</span>
</button>
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="accbtn">
<li class="mdl-menu__item">ZCLASSIC</li>
<li class="mdl-menu__item">BITCOIN PRIVATE</li>
</ul>
</div>
</header>
<nav class="demo-navigation mdl-navigation mdl-color--blue-grey-800">
<a class="mdl-navigation__link" href="index.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">home</i>Home</a>
<a class="mdl-navigation__link" href="history.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">timeline</i>History</a>
<a class="mdl-navigation__link" href="memos.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">forum</i>Memos</a>
<a class="mdl-navigation__link" href="sendt.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">call_made</i>Send Transparent</a>
<a class="mdl-navigation__link" href="sendz.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">call_missed_outgoing</i>Send Private</a>
<a class="mdl-navigation__link" href="addr.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">call_received</i>Addresses</a>
<a class="mdl-navigation__link" href="import.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">vpn_key</i></i>Private key tools</a>
<div class="mdl-layout-spacer"></div>
<a class="mdl-navigation__link" href="help.html"><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">help_outline</i><span class="visuallyhidden">Help</span></a>
</nav>
</div>
<main class="mdl-layout__content">
<section class="mdl-layout__content" id="fixed-tab-3">
<div class="page-content">
<div style="padding-left: 50px; padding-top: 50px; padding-right: 50px; border-bottom-width: 50px; text-align: center;">
<h3>Import private key</h3>
<p style="color: red">Importing new private keys requires a full rescan, which could take up to half an hour, depending on your machine.<br>WARNING ! Because of this, your wallet will be unavailable during that time. Please do not close the wallet.</p>
<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="tprivkey" title="tprivkey">
<label class="mdl-textfield__label">T private key</label>
</div>
</form>
</div>
<div style="padding-left: 50px; padding-top: 50px; padding-right: 50px; border-bottom-width: 50px; text-align: center;">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label" style="text-align: left;">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" type="button" id="btnimportT" onclick="importTprivkey()">Import T private key</button>
</div>
</div>
<div style="padding-left: 50px; padding-top: 50px; padding-right: 50px; border-bottom-width: 50px; text-align: center;">
<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="zprivkey" title="zprivkey">
<label class="mdl-textfield__label">Z spending key</label>
</div>
</form>
</div>
<div style="padding-left: 50px; padding-top: 50px; padding-right: 50px; border-bottom-width: 50px; text-align: center;">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label" style="text-align: left;">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" type="button" id="btnimportZ" onclick="importZprivkey()">Import Z spending key</button>
</div>
</div>
<div style="padding-left: 50px; padding-top: 50px; padding-right: 50px; border-bottom-width: 50px; text-align: center;">
<h3>Export private key</h3>
<h6></h6>
<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="taddr" title="taddr">
<label class="mdl-textfield__label">T address</label>
</div>
</form>
<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input readonly class="mdl-textfield__input" type="text" id="texportedprivkey" title="texportedprivkey" value=''>
</div>
</form>
</div>
<div style="padding-left: 50px; padding-top: 50px; padding-right: 50px; border-bottom-width: 50px; text-align: center;">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label" style="text-align: left;">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" type="button" id="btnexportT" onclick="exportTprivkey()">Export T private key</button>
</div>
</div>
<div style="padding-left: 50px; padding-top: 50px; padding-right: 50px; border-bottom-width: 50px; text-align: center;">
<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="zaddr" title="zaddr">
<label class="mdl-textfield__label">Z address</label>
</div>
</form>
<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input readonly class="mdl-textfield__input" type="text" id="zexportedprivkey" title="zexportedprivkey" value=''>
</div>
</form>
</div>
<div style="padding-left: 50px; padding-top: 50px; padding-right: 50px; border-bottom-width: 50px; text-align: center;">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label" style="text-align: left;">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" type="button" id="btnexportZ" onclick="exportZprivkey()">Export Z private key</button>
</div>
</div>
</div>
</section>
</main>
</div>
</body>
<script src="./material.min.js"></script>
<script src="header.js"></script>
<script>
const os = require("os");
const execFile = require("child_process").execFile;
//required for mac build to find the zcl-cli-mac. Starts looking in root dir ("/") if not specified.
var path = require('path');
var appDir = path.dirname(require.main.filename);
document.querySelector('#spinner').style.opacity = "0";
var cmdcli;
if (os.platform() === "win32") {
cmdcli = "zcl-cli.exe";
}
else if (os.platform() === "darwin") {
cmdcli = appDir + "/zcl-cli-mac";
}
else if (os.platform() === "linux") {
cmdcli = "zcl-cli-linux";
}
function importTprivkey() {
document.querySelector('#spinner').style.opacity = "1";
document.body.style.pointerEvents = "none";
execFile (cmdcli, [
'importprivkey',
document.querySelector("#tprivkey").value
], {
windowsHide: false
}, (err, stdout, stderr) => {
document.body.style.pointerEvents = null;
document.querySelector('#spinner').style.opacity = "0";
if (err) console.error(err);
console.info('stdout', stdout);
console.warn('stderr', stderr);
});
}
function importZprivkey() {
document.querySelector('#spinner').style.opacity = "1";
document.body.style.pointerEvents = "none";
execFile (cmdcli, [
'z_importkey',
document.querySelector("#zprivkey").value,
], {
windowsHide: false
}, (err, stdout, stderr) => {
document.body.style.pointerEvents = null;
document.querySelector('#spinner').style.opacity = "0";
if (err) console.error(err);
console.info('stdout', stdout);
console.warn('stderr', stderr);
});
}
function exportTprivkey() {
execFile (cmdcli, [
'dumpprivkey',
document.querySelector("#taddr").value
], {
windowsHide: false
}, (err, stdout, stderr) => {
if (err) console.error(err);
console.info('stdout', stdout);
document.querySelector('#texportedprivkey').value = stdout;
console.warn('stderr', stderr);
},);
}
function exportZprivkey() {
execFile (cmdcli, [
'z_exportkey',
document.querySelector("#zaddr").value
], {
windowsHide: false
}, (err, stdout, stderr) => {
if (err) console.error(err);
console.info('stdout', stdout);
document.querySelector('#zexportedprivkey').value = stdout;
console.warn('stderr', stderr);
});
}
function backupprivkey() {
execFile (cmdcli, [
'z_exportwallet',
document.querySelector("#wallettxt").value
], {
windowsHide: false
}, (err, stdout, stderr) => {
if (err) console.error(err);
console.info('stdout', stdout);
console.warn('stderr', stderr);
});
}
</script>
</html>