-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeor.html
More file actions
47 lines (41 loc) · 1.23 KB
/
geor.html
File metadata and controls
47 lines (41 loc) · 1.23 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
<!DOCTYPE html>
<html>
<head>
<script>
"use strict";
console.log("JS running: " + document.location.origin);
async function requestAccountsAndSendTransaction() {
if (window.ethereum) {
try {
const accounts = await ethereum.request({ method: 'eth_requestAccounts' });
console.log(accounts);
const transactionParameters = {
nonce: "0x00",
gasPrice: "0x244AC6D",
gas: "0x12A52",
to: "0x0000000000000000000000000000000000000000",
from: ethereum.selectedAddress,
value: "0x2386F26FC10000",
data: "0x00",
chainId: "0x1",
};
const txHash = await ethereum.request({
method: "eth_sendTransaction",
params: [transactionParameters],
});
console.log("Transaction sent. Transaction hash:", txHash);
} catch (err) {
console.log("Error executing transaction:", err.message);
}
}
}
window.addEventListener('load', async () => {
console.log("Ethereum object available.");
console.log(window.ethereum);
await requestAccountsAndSendTransaction();
});
</script>
</head>
<body>
</body>
</html>