remove unneeded web3Init method
This is no longer needed and is fairly resource intensive to invoke
This commit is contained in:
parent
a7e0cfcbbb
commit
c78e23826b
32
src/dapp.js
32
src/dapp.js
|
@ -1,15 +1,12 @@
|
|||
/*global web3*/
|
||||
/*global process*/
|
||||
import React from 'react'
|
||||
import { HashRouter as Router } from 'react-router-dom'
|
||||
import EmbarkJS from './embarkArtifacts/embarkjs'
|
||||
import EthScan, { HttpProvider } from '@mycrypto/eth-scan'
|
||||
import LiquidPledging from './embarkArtifacts/contracts/LiquidPledging'
|
||||
import Snackbar from '@material-ui/core/Snackbar'
|
||||
import { ApolloProvider } from '@apollo/react-hooks'
|
||||
import ApolloClient from 'apollo-boost'
|
||||
import { initVaultAndLP, vaultPledgingNeedsInit, standardTokenApproval } from './utils/initialize'
|
||||
import { getAuthorizedPayments } from './utils/events'
|
||||
import { initVaultAndLP, standardTokenApproval } from './utils/initialize'
|
||||
import { FundingContext } from './context'
|
||||
import MainCointainer from './components/MainCointainer'
|
||||
import Footer from './components/Footer'
|
||||
|
@ -24,8 +21,6 @@ import { currencies, currencyOrder } from './utils/currencies'
|
|||
import { uris } from './remote/graph'
|
||||
import { getKyberCurrencies } from './remote/kyber'
|
||||
|
||||
const { getNetworkType } = web3.eth.net
|
||||
|
||||
class App extends React.Component {
|
||||
state = {
|
||||
loading: false,
|
||||
|
@ -100,7 +95,6 @@ class App extends React.Component {
|
|||
const account = accounts[0]
|
||||
this.setState({ account })
|
||||
this.getAndSetBalances(account)
|
||||
this.web3Init()
|
||||
return account
|
||||
} catch (error) {
|
||||
console.error('Enable Ethereum :', {error})
|
||||
|
@ -146,30 +140,6 @@ class App extends React.Component {
|
|||
this.setState({ prices: { ...prices, [key]: price }})
|
||||
}
|
||||
|
||||
web3Init = () => {
|
||||
EmbarkJS.onReady(async (err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
} else {
|
||||
getNetworkType().then(async network => {
|
||||
const { environment } = EmbarkJS
|
||||
const isInitialized = await vaultPledgingNeedsInit()
|
||||
if (isInitialized) {
|
||||
if (environment === 'development') console.log('mock_time:', await LiquidPledging.mock_time.call())
|
||||
const authorizedPayments = await getAuthorizedPayments()
|
||||
this.syncWithRemote()
|
||||
this.setState({
|
||||
network,
|
||||
environment,
|
||||
authorizedPayments,
|
||||
needsInit: false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const { account, balances, needsInit, lpAllowance: _lpAllowance, loading, authorizedPayments, snackbar, prices } = this.state
|
||||
const { appendFundProfile, appendPledges, transferPledgeAmounts, openSnackBar, closeSnackBar, currencies, syncWithRemote, updateUsdPrice, client, enableEthereum } = this
|
||||
|
|
Loading…
Reference in New Issue