-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.js
More file actions
81 lines (71 loc) · 1.57 KB
/
Copy pathnode.js
File metadata and controls
81 lines (71 loc) · 1.57 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
const Web3 = require("web3");
//console.log(Web3);
const rpcUrl = "HTTP://127.0.0.1:7545";
let web = new Web3(rpcUrl);
//console.log("new web 3 instance " + web);
let address = "0x3fad61CE76dC9453eE3829C8Be5c9B6974940a09";
//console.log(web.eth.getBalance(address));
web.eth.getBalance(address, (err, wei) => {
if (err) {
console.log("Error Recieved");
} else {
console.log("Wei", wei);
var balance = web.utils.fromWei(wei, "ether");
console.log(balance);
}
});
const abi = [
{
constant: true,
inputs: [],
name: "getAccountStatus",
outputs: [
{
internalType: "enum enmeration.status",
name: "",
type: "uint8"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
{
constant: false,
inputs: [],
name: "getApprovedStatus",
outputs: [],
payable: false,
stateMutability: "nonpayable",
type: "function"
},
{
constant: false,
inputs: [],
name: "inActiveAccount",
outputs: [],
payable: false,
stateMutability: "nonpayable",
type: "function"
},
{
constant: false,
inputs: [
{
internalType: "enum enmeration.status",
name: "_status",
type: "uint8"
}
],
name: "setAccountStatus",
outputs: [],
payable: false,
stateMutability: "nonpayable",
type: "function"
}
];
const address1 = "0x7ee7e6c5f27aB5C831a2d2706b5bB408cb02667b";
const contract = new web.eth.Contract(abi, address1);
contract.methods.getAccountStatus().call((err, result) => {
console.log(result);
});