uniswap-interface-uncensored/src/index.tsx

66 lines
1.9 KiB
TypeScript
Raw Normal View History

import { Web3Provider } from '@ethersproject/providers'
import { createWeb3ReactRoot, Web3ReactProvider } from '@web3-react/core'
import React from 'react'
import { isMobile } from 'react-device-detect'
import ReactDOM from 'react-dom'
import ReactGA from 'react-ga'
import { Provider } from 'react-redux'
import { NetworkContextName } from './constants'
import './i18n'
import App from './pages/App'
import store from './state'
import ApplicationUpdater from './state/application/updater'
import TransactionUpdater from './state/transactions/updater'
import UserUpdater from './state/user/updater'
import MulticallUpdater from './state/multicall/updater'
import ThemeProvider, { FixedGlobalStyle, ThemedGlobalStyle } from './theme'
2018-03-11 08:50:54 +03:00
const Web3ProviderNetwork = createWeb3ReactRoot(NetworkContextName)
function getLibrary(provider: any): Web3Provider {
const library = new Web3Provider(provider)
library.pollingInterval = 15000
return library
}
const GOOGLE_ANALYTICS_ID: string | undefined = process.env.REACT_APP_GOOGLE_ANALYTICS_ID
if (typeof GOOGLE_ANALYTICS_ID === 'string') {
ReactGA.initialize(GOOGLE_ANALYTICS_ID)
ReactGA.set({
customBrowserType: !isMobile ? 'desktop' : 'web3' in window || 'ethereum' in window ? 'mobileWeb3' : 'mobileRegular'
})
} else {
ReactGA.initialize('test', { testMode: true, debug: true })
2018-10-28 14:12:59 +03:00
}
function Updaters() {
return (
<>
<UserUpdater />
<ApplicationUpdater />
<TransactionUpdater />
<MulticallUpdater />
</>
)
}
ReactDOM.render(
<>
<FixedGlobalStyle />
<Web3ReactProvider getLibrary={getLibrary}>
<Web3ProviderNetwork getLibrary={getLibrary}>
<Provider store={store}>
<Updaters />
<ThemeProvider>
<>
<ThemedGlobalStyle />
<App />
</>
</ThemeProvider>
</Provider>
</Web3ProviderNetwork>
</Web3ReactProvider>
</>,
document.getElementById('root')
)