-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
34 lines (31 loc) · 1.24 KB
/
index.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
<html>
<head>
<meta charset="utf-8" />
<title>susDAO-deployment-demo</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" type="text/javascript"></script>
<script src="contract-address.js" type="text/javascript"></script>
<script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js" type="text/javascript"></script>
<script>
window.ethereum.enable();
let contract;
$.getJSON('build/contracts/DemoContract.json', json => {
let provider = new ethers.providers.Web3Provider(window.ethereum);
contract = new ethers.Contract(contractAddress, json.abi, provider.getSigner());
contract.foo().then(value => {
console.log(value);
});
});
function func() {
contract.setFoo(7).then(transaction => {
console.log('transaction:', transaction);
transaction.wait().then(receipt => {
console.log("receipt: ", receipt);
});
});
}
</script>
<button onclick="func()">do the thing</button>
</body>
</html>