795caac4fd
* basic support for desktop and mobile, with or without web3 * stable before mobile view update * mobile modal views * remove unused modules * create global context for wallet modal, update to click button to connect * first pass * drag with react pose * try without pose * replace context with new syntax, basic setup * stable version on all browser types * remove dev flags * fix swap broken * update to clickable connect button if logged out * stable, good entry * fix bugs, exit animations * prep for merge * stable version with updated application context * update animations with correct gesture package * refactor wallet logic to multi-root * small fixes * Style Updates * remove unused imports * refactor wallet page
78 lines
2.4 KiB
JavaScript
78 lines
2.4 KiB
JavaScript
import React from 'react'
|
|
import ReactDOM from 'react-dom'
|
|
import ReactGA from 'react-ga'
|
|
import { Web3ReactProvider, createWeb3ReactRoot } from '@web3-react/core'
|
|
import { ethers } from 'ethers'
|
|
|
|
import { NetworkContextName } from './constants'
|
|
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'
|
|
import AllBalancesContextProvider from './contexts/AllBalances'
|
|
import App from './pages/App'
|
|
import ThemeProvider, { GlobalStyle } from './theme'
|
|
import './i18n'
|
|
|
|
const Web3ProviderNetwork = createWeb3ReactRoot(NetworkContextName)
|
|
|
|
function getLibrary(provider) {
|
|
const library = new ethers.providers.Web3Provider(provider)
|
|
library.pollingInterval = 10000
|
|
return library
|
|
}
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
ReactGA.initialize('UA-128182339-1')
|
|
} else {
|
|
ReactGA.initialize('test', { testMode: true })
|
|
}
|
|
ReactGA.pageview(window.location.pathname + window.location.search)
|
|
|
|
function ContextProviders({ children }) {
|
|
return (
|
|
<LocalStorageContextProvider>
|
|
<ApplicationContextProvider>
|
|
<TransactionContextProvider>
|
|
<TokensContextProvider>
|
|
<BalancesContextProvider>
|
|
<AllBalancesContextProvider>
|
|
<AllowancesContextProvider>{children}</AllowancesContextProvider>
|
|
</AllBalancesContextProvider>
|
|
</BalancesContextProvider>
|
|
</TokensContextProvider>
|
|
</TransactionContextProvider>
|
|
</ApplicationContextProvider>
|
|
</LocalStorageContextProvider>
|
|
)
|
|
}
|
|
|
|
function Updaters() {
|
|
return (
|
|
<>
|
|
<LocalStorageContextUpdater />
|
|
<ApplicationContextUpdater />
|
|
<TransactionContextUpdater />
|
|
</>
|
|
)
|
|
}
|
|
|
|
ReactDOM.render(
|
|
<Web3ReactProvider getLibrary={getLibrary}>
|
|
<Web3ProviderNetwork getLibrary={getLibrary}>
|
|
<ContextProviders>
|
|
<Updaters />
|
|
<ThemeProvider>
|
|
<>
|
|
<GlobalStyle />
|
|
<App />
|
|
</>
|
|
</ThemeProvider>
|
|
</ContextProviders>
|
|
</Web3ProviderNetwork>
|
|
</Web3ReactProvider>,
|
|
document.getElementById('root')
|
|
)
|