-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbk.html
More file actions
60 lines (55 loc) · 1.95 KB
/
dbk.html
File metadata and controls
60 lines (55 loc) · 1.95 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dbyob</title>
// web3.js library
<script src="https://cdn.jsdelivr.net/npm/web3@1.3.5/dist/web3.min.js"></script>
</head>
<body>
<input type="range" min="1" max="100" value="50" class="slider" id="myRange">
<p id="demo">Logs</p>
<script>
var slider = document.getElementById("myRange");
var output = document.getElementById("demo");
output.innerHTML = slider.value;
slider.oninput = function () {
output.innerHTML = this.value;
// chainid 20240603
let contractAddress = "0x633b7472E1641D59334886a7692107D6332B1ff0";
// abi mint no params
let abi = [
{
"constant": false,
"inputs": [],
"name": "mint",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
];
let web3 = new Web3(window.ethereum);
let contract = new web3.eth.Contract(abi, contractAddress);
if (!window.ethereum) {
console.log("No ethereum provider");
return;
}
ethereum.enable();
let batchProvider = new web3.BatchRequest();
for (let i = 0; i < this.value; i++) {
let request = contract.methods.mint().send.request({ from: ethereum.selectedAddress }, (err, txHash) => {
if (err) {
console.log(err);
} else {
console.log("Transaction hash:", txHash);
}
});
batchProvider.add(request);
}
batchProvider.execute();
}
</script>
</body>
</html>