-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchz.html
More file actions
256 lines (242 loc) · 10.4 KB
/
chz.html
File metadata and controls
256 lines (242 loc) · 10.4 KB
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
<!DOCTYPE html>
<html>
<head>
<title>CHZ Wallet Generator</title>
<!--<script src="https://cdn.ethers.io/lib/ethers-5.6.umd.min.js" type="text/javascript"></script>-->
<!--<script src="https://unpkg.com/aptos@latest/dist/index.global.js"></script>-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.8.0/web3.min.js" integrity="sha512-bSQ2kf76XufUYS/4XinoHLp5S4lNOyRv0/x5UJACiOMy8ueqTNwRFfUZWmWpwnczjRp9SjiF1jrXbGEim7Y0Xg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
<body>
<div class="wrapper">
<input type="slider" min="0.001" max="10" step="0.1" value="0.01" name="count">
<label for="count">CHZ amount to send</label>
<input id="ok" type="button" value="Generate wallets">
<pre id="out" user-select="all" onclick="navigator.clipboard.writeText(this.innerText)"></pre>
</div>
<script>
/*
DIMA NE PIZDI PJJJJJ
DIMA NE PIZDI PJJJJJ
DIMA NE PIZDI PJJJJJ
DIMA NE PIZDI PJJJJJ
DIMA NE PIZDI PJJJJJ
DIMA NE PIZDI PJJJJJ
DIMA NE PIZDI PJJJJJ
DIMA NE PIZDI PJJJJJ
DIMA NE PIZDI PJJJJJ
*/
let out = document.querySelector('#out');
//let web3 = new Web3();
function log(a) {
out.innerText += '\n'+JSON.stringify(a);
}
let accounts;
function notifyMe(a) {
if (!("Notification" in window)) {
// Check if the browser supports notifications
alert("This browser does not support desktop notification");
} else if (Notification.permission === "granted") {
// Check whether notification permissions have already been granted;
// if so, create a notification
const notification = new Notification(a);
// …
} else if (Notification.permission !== "denied") {
// We need to ask the user for permission
Notification.requestPermission().then((permission) => {
// If the user accepts, let's create a notification
if (permission === "granted") {
const notification = new Notification(a);
// …
}
});
}
// At last, if the user has denied notifications, and you
// want to be respectful there is no need to bother them anymore.
}
let limit = 1;
document.addEventListener('DOMContentLoaded',async (event) => {
if(ethereum) accounts = await ethereum.request({ method: 'eth_requestAccounts' });
else alert('No Web3');
try {
await ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: '0x15b30' }],
});
} catch (switchError) {
// This error code indicates that the chain has not been added to MetaMask.
if (switchError.code === 4902) {
try {
await ethereum.request({
method: 'wallet_addEthereumChain',
params: [
{
chainId: '0x15b30',
chainName: 'Chiliz testnet',
rpcUrls: ['https://scoville-rpc.chiliz.com/'] /* ... */,
nativeCurrency: {
name: 'Chiliz',
symbol: 'CHZ', // 2-6 characters long
decimals: 18,
},
blockExplorerUrls: ['https://scoville-explorer.chiliz.com/']
},
],
});
} catch (addError) {
// handle "add" error
}
}
// handle other "switch" errors
}
Notification.requestPermission();
let web3 = new Web3("https://scoville-rpc.chiliz.com/");
const address = accounts[0];
const transactions = await web3.eth.getBalance(address);
accounts_cnt = Math.min(Math.floor(Number((BigInt(transactions)/BigInt(10**15)).toString())/1000/Number(document.querySelector('input').value)),Math.min(25,limit));
out.innerText += `\nBalance = ${Number(BigInt(transactions)/BigInt(10**15))/1000}`;
out.innerText += `\nAccounts = ${accounts_cnt}, max 25`;
document.querySelector('#ok').addEventListener('click',async ()=>{
//const address = accounts[0];
const transactions = await web3.eth.getBalance(address);
accounts_cnt = Math.min(Math.floor(Number((BigInt(transactions)/BigInt(10**15)).toString())/1000/Number(document.querySelector('input').value)),Math.min(25,limit));
out.innerText += `\nBalance = ${Number(BigInt(transactions)/BigInt(10**15))/1000}`;
out.innerText += `\nAccounts = ${accounts_cnt}, max 25`;
// accounts_cnt = 3; // test
accounts = Array(accounts_cnt).fill('').map(x=>(web3.eth.accounts.create() ));
let i = 1;
log('Step 2: Begin transactioning');
acc_index = 1;
try {
await accounts.reduce(async (memo, x) => {
const results = await memo;
const transactionParameters = {
to: x.address, // Required except during contract publications.
from: address, // must match user's active address.
value: (BigInt(Number(document.querySelector('input').value)*1000)*BigInt(10**15)).toString(16),
gasLimit: '21001',
gasPrice: '5000000000'
};
// txHash is a hex string
// As with any RPC call, it may throw an error
const txHash = await ethereum.request({
method: 'eth_sendTransaction',
params: [transactionParameters],
});
await new Promise(r=> {
const interval = setInterval(function() {
console.log("Attempting to get transaction receipt...");
web3.eth.getTransactionReceipt(txHash, function(err, rec) {
if (rec) {
console.log(rec);
clearInterval(interval);
r();
}
});
}, 1000);
});
log(`${acc_index} account transaction done`);
acc_index++;
return [...results, x];
}, []);
} catch(e) {
console.error(e);
log(`Step 2: got error, skip to step 3`);
}
delta = accounts.length - acc_index + 1;
for (i = 0; i < delta; i++) {
accounts.pop();
}
log('Step 2: Finish transactioning');
log('Step 3: working');
log(accounts.map((x,i)=> (i+1) + " private " + x.privateKey + ', ' + "public " + x.address).join('\n'));
let meta = [
"https://scoville-nft.chiliz.com/chiliz-lights-on/nft-metadata-1.json",
"https://scoville-nft.chiliz.com/chiliz-lights-on/nft-metadata-2.json",
"https://scoville-nft.chiliz.com/chiliz-lights-on/nft-metadata-3.json",
"https://scoville-nft.chiliz.com/chiliz-lights-on/nft-metadata-4.json",
"https://scoville-nft.chiliz.com/chiliz-lights-on/nft-metadata-5.json"
], contracts = meta.map((x,i)=>new web3.eth.Contract([
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "mint",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function",
"signature": "0x40c10f19"
},{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "tokenURI",
"type": "string"
}
],
"name": "mintSingle",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function",
"signature": "0x0d9cc275"
}
],['0xdC50294C5dC2F0111cfCbB1d2823cA7446072892', '0x78373d699EF6a4BAEB5202c6cDc87629A38c57c1', '0x11E9C4B9FCE640c094e6f853B08773cb2561835b', '0x520023B2715dc05D6A57bE2C7529dA49A4Fc7193', '0xB82cbf5F9346140217c4D2d9ab38A40CB4c28aB0'][i]))
acc_index = 1;
for (const x of accounts) {
log(`Step 3: start account ${acc_index}`);
web3.eth.accounts.wallet.add(x);
const sleep = ms => new Promise(r => setTimeout(r, ms));
async function makeDomain(i){
if(i>5) return;
const inputs = [x.address, meta[i-1]];
const sendArgs = { from: x.address, gas: '500000', gasPrice: '5000000000' };
let h = await contracts[i-1].methods.mintSingle(...inputs).send(sendArgs);
console.log(h);
log(`mint ${i} ok`);
//await client.waitForTransactionWithResult(txnHash.hash,{checkSuccess:true});
}
async function recu_domain(a, b = 1) {
try {
await makeDomain(a)
} catch(e) {
log(`${a}, try ${b+1}`);
// notifyMe(e.message||e);
await sleep(5000);
return await recu_domain(a, b+1)
}
log(`${a}, ok`);
}
for(let a = 1;a < 6; a++) {
await makeDomain(a);
}
log(`Step 3: account ${acc_index} finished`);
acc_index++;
}
notifyMe('ААА БЛЕАТЬ Done нах')
});
});
</script>
</body></html>