uniswap-interface-uncensored/src/index.js

74 lines
2.4 KiB
JavaScript
Raw Normal View History

import React from 'react'
import ReactDOM from 'react-dom'
import ReactGA from 'react-ga'
import Web3Provider, { Connectors } from 'web3-react'
import ThemeProvider, { GlobalStyle } from './theme'
import LocalStorageContextProvider, { Updater as LocalStorageContextUpdater } from './contexts/LocalStorage'
import ApplicationContextProvider, { Updater as ApplicationContextUpdater } from './contexts/Application'
import TransactionContextProvider, { Updater as TransactionContextUpdater } from './contexts/Transactions'
import TokensContextProvider from './contexts/Tokens'
import BalancesContextProvider from './contexts/Balances'
import AllowancesContextProvider from './contexts/Allowances'
2019-08-13 03:37:32 +03:00
import AllBalancesContextProvider from './contexts/AllBalances'
import App from './pages/App'
import InjectedConnector from './InjectedConnector'
import './i18n'
2018-03-11 08:50:54 +03:00
if (process.env.NODE_ENV === 'production') {
ReactGA.initialize('UA-128182339-1')
} else {
ReactGA.initialize('test', { testMode: true })
2018-10-28 14:12:59 +03:00
}
ReactGA.pageview(window.location.pathname + window.location.search)
2018-10-28 14:05:08 +03:00
const { NetworkOnlyConnector } = Connectors
const Injected = new InjectedConnector({ supportedNetworks: [Number(process.env.REACT_APP_NETWORK_ID || '1')] })
const Network = new NetworkOnlyConnector({ providerURL: process.env.REACT_APP_NETWORK_URL || '' })
const connectors = { Injected, Network }
function ContextProviders({ children }) {
return (
<LocalStorageContextProvider>
<ApplicationContextProvider>
<TransactionContextProvider>
<TokensContextProvider>
<BalancesContextProvider>
2019-08-13 03:37:32 +03:00
<AllBalancesContextProvider>
<AllowancesContextProvider>{children}</AllowancesContextProvider>
</AllBalancesContextProvider>
</BalancesContextProvider>
</TokensContextProvider>
</TransactionContextProvider>
</ApplicationContextProvider>
</LocalStorageContextProvider>
)
}
function Updaters() {
return (
<>
<LocalStorageContextUpdater />
<ApplicationContextUpdater />
<TransactionContextUpdater />
</>
)
}
ReactDOM.render(
2019-07-31 21:11:58 +03:00
<Web3Provider connectors={connectors} libraryName="ethers.js">
<ContextProviders>
<Updaters />
<ThemeProvider>
<>
<GlobalStyle />
<App />
2019-07-31 21:11:58 +03:00
</>
</ThemeProvider>
</ContextProviders>
</Web3Provider>,
document.getElementById('root')
)