-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrhombus.js
More file actions
51 lines (45 loc) · 1.03 KB
/
rhombus.js
File metadata and controls
51 lines (45 loc) · 1.03 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
const Web3 = require('web3');
const web3 = new Web3(
new Web3.providers.HttpProvider('https://rinkeby.infura.io'),
);
let abi = [
{
constant: true,
inputs: [],
name: 'myLighthouse',
outputs: [{ name: '', type: 'address' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
{
constant: true,
inputs: [],
name: 'read',
outputs: [{ name: 'v', type: 'uint128' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
{
inputs: [{ name: '_myLighthouse', type: 'address' }],
payable: false,
stateMutability: 'nonpayable',
type: 'constructor',
},
];
let address = '0x244F9881680c952ACF16ec07849370289AdeD440';
let reader = web3.eth.contract(abi).at(address);
function readLighthouse(cb) {
reader.read((err, res) => {
if (err) {
console.log('Error reading lighthouse ' + err);
cb(err, res);
} else {
console.log('RES', res);
let number = res.c[0];
cb(null, number);
}
});
}
module.exports = readLighthouse;