diff --git a/src/dapp.js b/src/dapp.js index d1f8fee..257940a 100644 --- a/src/dapp.js +++ b/src/dapp.js @@ -4,6 +4,8 @@ import { HashRouter as Router } from 'react-router-dom' import EmbarkJS from './embarkArtifacts/embarkjs' import LiquidPledging from './embarkArtifacts/contracts/LiquidPledging' import Snackbar from '@material-ui/core/Snackbar' +import { ApolloProvider } from '@apollo/react-hooks' +import ApolloClient, { gql } from 'apollo-boost' import { initVaultAndLP, vaultPledgingNeedsInit, standardTokenApproval } from './utils/initialize' import { getAuthorizedPayments } from './utils/events' import { FundingContext } from './context' @@ -39,6 +41,9 @@ class App extends React.Component { if (environment === 'development') console.log('mock_time:', await LiquidPledging.mock_time.call()) const graphUri = uris[network] + this.client = new ApolloClient({ + uri: graphUri, + }) const account = await web3.eth.getCoinbase() this.getAndSetPrices() this.setState({ account }) @@ -98,14 +103,13 @@ class App extends React.Component { } render() { - const { account, needsInit, lpAllowance: _lpAllowance, loading, authorizedPayments, snackbar, prices, graphUri } = this.state - const { appendFundProfile, appendPledges, transferPledgeAmounts, openSnackBar, closeSnackBar, syncWithRemote, updateUsdPrice } = this + const { account, needsInit, lpAllowance: _lpAllowance, loading, authorizedPayments, snackbar, prices } = this.state + const { appendFundProfile, appendPledges, transferPledgeAmounts, openSnackBar, closeSnackBar, syncWithRemote, updateUsdPrice, client } = this const fundingContext = { appendPledges, appendFundProfile, account, transferPledgeAmounts, - graphUri, authorizedPayments, needsInit, initVaultAndLP, @@ -116,27 +120,31 @@ class App extends React.Component { prices, updateUsdPrice } - return ( - - - - - {snackbar && - - } - + + if (client) return ( + + + + + + {snackbar && + + } + + ) + return
Loading
} } diff --git a/src/remote/graph.js b/src/remote/graph.js index 702df60..2e6b070 100644 --- a/src/remote/graph.js +++ b/src/remote/graph.js @@ -1,3 +1,3 @@ export const uris = { - ropsten: 'wss://api.thegraph.com/subgraphs/name/bgits/liquid-funding-rinkeby' + ropsten: 'https://api.thegraph.com/subgraphs/name/bgits/liquid-funding-rinkeby' }