-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
88 lines (79 loc) · 2.21 KB
/
App.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
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
82
83
84
85
86
87
88
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React from 'react';
import type {Node} from 'react';
import { NavigationContainer, DefaultTheme } from '@react-navigation/native';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';
import Login from "./src/components/login/Login";
import Pages from "./src/components/pages/Pages";
import {AccountProvider, useAccount} from './src/services/Account';
import Background from "./src/components/Background";
import SubmitTransaction from "./src/components/tokens/SubmitTransaction";
const NavTheme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: 'transparent'
},
};
const App: () => Node = () => {
React.useEffect(()=>{
// (async()=>{
// await wallet.init();
// const token = {};
// const tokenTransaction = wallet.tokenTransaction("0x74FbeC958cf737468273B025B9b919b0ac2a7549");
// token.name = await tokenTransaction.name().catch(err=>{
// console.log(err);
// return "";
// });
// token.symbol = await tokenTransaction.symbol().catch(err=>{
// console.log(err)
// return "";
// });
// token.balance = parseFloat(wallet.formatEther(await tokenTransaction.balanceOf(wallet.account.address).catch(err=>{
// console.log(err);
// return 0;
// })));
// const myBalance = await wallet.provider.getBalance(wallet.account.address).catch(err=>{
// console.log(err);
// return 0;
// });
// console.log("token::", token);
// console.log("myBalance::", wallet.formatEther(myBalance));
// })();
}, []);
return (
<AccountProvider>
<Background>
<NavigationContainer theme={NavTheme}>
<AppContent />
</NavigationContainer>
</Background>
</AccountProvider>
);
};
const AppContent = ()=>{
const {authenticated} = useAccount();
return (
<React.Fragment>
{
authenticated()?<Pages/>:<Login/>
/*<SubmitTransaction />*/
}
</React.Fragment>
)
}
export default App;