-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathindex2.html
189 lines (162 loc) · 4.29 KB
/
index2.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
<!DOCTYPE html>
<html>
<head>
<title>Sphinx Relay</title>
<link rel="icon" href="/static/sphinx-logo.png" />
<style>
html {
font-family: Arial, Helvetica, sans-serif;
color: white;
}
body {
background: #292a2d;
display: flex;
flex-direction: column;
align-items: center;
}
#qr-wrap {
background: white;
width: 300px;
height: 300px;
border-radius: 5px;
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
}
canvas {
height: 280px;
width: 280px;
}
pre {
margin-top: 8px;
border-radius: 10px;
max-width: 250px;
padding: 18px 25px 0px 25px;
border: 1px solid tan;
background: white;
overflow: hidden;
overflow-wrap: break-word;
display: block;
white-space: pre-wrap;
color: darkslategray;
}
img {
height: 100px;
width: 100px;
margin-top: 20px;
}
p {
margin-top: 30px;
max-width: 300px;
text-align: center;
}
ul {
list-style: none;
max-width: 333px;
}
li {
margin-top: 8px;
}
input[type='checkbox'] {
pointer-events: none;
}
</style>
<script>
var hi = 'hello'
</script>
</head>
<body>
<img src="/static/sphinx-logo.png" alt="logo" />
<ul>
<li>
<input id="chan" type="checkbox" />
<span id="chan-text"></span>
<pre id="chan-pre" style="display: none">
lncli connect SPHINX_HUB_PUBKEY@54.159.193.149:9735
lncli openchannel SPHINX_HUB_PUBKEY --local_amt=*** --push_amt=*** --sat_per_byte=***
</pre
>
</li>
<li>
<input id="fees" type="checkbox" />
<span id="fees-text"></span>
<pre id="fees-pre" style="display: none">
lncli updatechanpolicy --base_fee_msat=0 --fee_rate=0.000001 --time_lock_delta=40 --chan_point=***
</pre
>
</li>
<li>
<input id="bal" type="checkbox" />
<span id="bal-text"></span>
</li>
</ul>
<div id="qr-wrap" style="display: none">
<canvas id="qr"></canvas>
</div>
<p id="qr-text">
Scan the QR or copy the connection string into your Sphinx app
</p>
<pre id="connection-string" style="display: none">
CONNECTION_STRING
</pre
>
<script src="/static/js/qrious.js"></script>
<script>
;(function () {
var qr = new QRious({
element: document.getElementById('qr'),
value: 'CONNECTION_STRING',
size: 300,
})
})()
</script>
<script>
function get(id) {
return document.getElementById(id)
}
const chan = get('chan')
const chanText = get('chan-text')
const chanPre = get('chan-pre')
if (window.channelIsOpen) {
chan.checked = true
chanText.innerHTML = 'You have an open channel'
} else {
chanText.innerHTML = 'You need to open a channel'
chanPre.style.display = 'block'
}
const fees = get('fees')
const feesText = get('fees-text')
const feesPre = get('fees-pre')
if (window.channelFeesBaseZero) {
fees.checked = true
feesText.innerHTML = 'You have set your fee base to 0'
} else {
feesText.innerHTML = 'You need to set your fee base to 0'
feesPre.style.display = 'block'
}
const bal = get('bal')
const balText = get('bal-text')
if (window.hasRemoteBalance) {
bal.checked = true
balText.innerHTML = 'You have remote balance'
} else {
balText.innerHTML =
'You need remote balance (2% of channel size recommended)'
}
const qrWrap = get('qr-wrap')
const connString = get('connection-string')
const qrText = get('qr-text')
const readyToGo =
window.hasRemoteBalance &&
window.channelFeesBaseZero &&
window.channelIsOpen
if (window.isSignedUp) {
qrText.innerHTML = 'You have connected your app!'
} else if (readyToGo) {
qrWrap.style.display = 'flex'
connString.style.display = 'block'
}
</script>
</body>
</html>