-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
62 lines (55 loc) · 1.49 KB
/
App.js
File metadata and controls
62 lines (55 loc) · 1.49 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
import React, { useState, useEffect } from "react";
import { StyleSheet, Text, View } from "react-native";
import Web3 from "web3";
const App = () => {
const [data, setData] = useState({
manager: "",
players: [],
balance: "",
});
const [entryValue, setEntryValue] = useState("");
const [message, setMessage] = useState("");
useEffect(() => {
fetchData();
}, []);
// SANITY CHECK
useEffect(() => {
console.log(data);
}, [data]);
//only run on first render
const fetchData = async () => {
console.log("fetching data");
const web3 = new Web3(
new Web3.providers.HttpProvider(
"https://rinkeby.infura.io/v3/025cc9bab8f8425fb1799bf13f16054f"
)
);
web3.eth.getBlock("latest").then(console.log);
// const [manager, players, balance] = await Promise.all([
// chainlinkLottery.methods.manager().call(),
// chainlinkLottery.methods.getPlayers().call(),
// await web3.eth.getBalance(chainlinkLottery.options.address),
// ]);
// console.log(manager, players, balance);
// setData({
// manager,
// players,
// balance,
// });
};
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Text>This is new and seems to work hurrah \\\</Text>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});
export default App;