-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinteract.js
32 lines (27 loc) · 833 Bytes
/
interact.js
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
const {web3,myAccount} = require('./utils');
const {abi,address} = require('./artifacts');
let contract = new web3.eth.Contract(abi,address)
//console.log(address)
async function get(){
let r = await contract.methods.get().call()
return r;
}
async function Increment(){
let r = await contract.methods.Increment().send({
from : myAccount.address,
gas : 80000
})
}
window.addEventListener('load', () =>{
document.getElementById("get").onclick = () =>{
get().then((r) =>{
document.getElementById("resultofget").innerHTML = r
})
}
document.getElementById("set").onclick = ()=>{
val = document.getElementById("value").value
Increment().then((r) =>{
document.getElementById("resultofset").innerHTML = r
})
}
})