mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
move Graph sync status to asset details only
This commit is contained in:
parent
2d16841967
commit
270f567879
@ -40,17 +40,17 @@ export default function App({
|
|||||||
const { warning } = useSiteMetadata()
|
const { warning } = useSiteMetadata()
|
||||||
const { accountId } = useWeb3()
|
const { accountId } = useWeb3()
|
||||||
const { isInPurgatory, purgatoryData } = useAccountPurgatory(accountId)
|
const { isInPurgatory, purgatoryData } = useAccountPurgatory(accountId)
|
||||||
// const { isGraphSynced, blockHead, blockGraph } = useGraphSyncStatus()
|
const { isGraphSynced, blockHead, blockGraph } = useGraphSyncStatus()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Styles>
|
<Styles>
|
||||||
<div className={styles.app}>
|
<div className={styles.app}>
|
||||||
{/* {!isGraphSynced && (
|
{(props as PageProps).uri.includes('/asset') && !isGraphSynced && (
|
||||||
<AnnouncementBanner
|
<AnnouncementBanner
|
||||||
text={`The data for this network has only synced to Ethereum block ${blockGraph} (out of ${blockHead}). Please check back soon.`}
|
text={`The data for this network has only synced to Ethereum block ${blockGraph} (out of ${blockHead}). Please check back soon.`}
|
||||||
state="error"
|
state="error"
|
||||||
/>
|
/>
|
||||||
)} */}
|
)}
|
||||||
|
|
||||||
{(props as PageProps).uri === '/' && (
|
{(props as PageProps).uri === '/' && (
|
||||||
<AnnouncementBanner text={warning.main} />
|
<AnnouncementBanner text={warning.main} />
|
||||||
|
@ -3,7 +3,6 @@ import Web3Provider from '../providers/Web3'
|
|||||||
import { UserPreferencesProvider } from '../providers/UserPreferences'
|
import { UserPreferencesProvider } from '../providers/UserPreferences'
|
||||||
import PricesProvider from '../providers/Prices'
|
import PricesProvider from '../providers/Prices'
|
||||||
import ApolloClientProvider from '../providers/ApolloClientProvider'
|
import ApolloClientProvider from '../providers/ApolloClientProvider'
|
||||||
import OceanProvider from '../providers/Ocean'
|
|
||||||
|
|
||||||
export default function wrapRootElement({
|
export default function wrapRootElement({
|
||||||
element
|
element
|
||||||
@ -12,13 +11,11 @@ export default function wrapRootElement({
|
|||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
return (
|
return (
|
||||||
<Web3Provider>
|
<Web3Provider>
|
||||||
{/* <OceanProvider> */}
|
|
||||||
<ApolloClientProvider>
|
<ApolloClientProvider>
|
||||||
<UserPreferencesProvider>
|
<UserPreferencesProvider>
|
||||||
<PricesProvider>{element}</PricesProvider>
|
<PricesProvider>{element}</PricesProvider>
|
||||||
</UserPreferencesProvider>
|
</UserPreferencesProvider>
|
||||||
</ApolloClientProvider>
|
</ApolloClientProvider>
|
||||||
{/* </OceanProvider> */}
|
|
||||||
</Web3Provider>
|
</Web3Provider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ export function useGraphSyncStatus(): UseGraphSyncStatus {
|
|||||||
|
|
||||||
// Get and set head block
|
// Get and set head block
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!config || !config.nodeUri || web3Loading) return
|
if (!config?.nodeUri || web3Loading) return
|
||||||
|
|
||||||
async function initBlockHead() {
|
async function initBlockHead() {
|
||||||
const blockHead = block || (await getBlockHead(config))
|
const blockHead = block || (await getBlockHead(config))
|
||||||
@ -72,11 +72,11 @@ export function useGraphSyncStatus(): UseGraphSyncStatus {
|
|||||||
Logger.log('[GraphStatus] Head block: ', blockHead)
|
Logger.log('[GraphStatus] Head block: ', blockHead)
|
||||||
}
|
}
|
||||||
initBlockHead()
|
initBlockHead()
|
||||||
}, [web3Loading, block, config.nodeUri])
|
}, [web3Loading, block, config])
|
||||||
|
|
||||||
// Get and set subgraph block
|
// Get and set subgraph block
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!config || !config.subgraphUri) return
|
if (!config?.subgraphUri) return
|
||||||
|
|
||||||
async function initBlockSubgraph() {
|
async function initBlockSubgraph() {
|
||||||
setSubgraphLoading(true)
|
setSubgraphLoading(true)
|
||||||
@ -86,7 +86,7 @@ export function useGraphSyncStatus(): UseGraphSyncStatus {
|
|||||||
Logger.log('[GraphStatus] Latest block from subgraph: ', blockGraph)
|
Logger.log('[GraphStatus] Latest block from subgraph: ', blockGraph)
|
||||||
}
|
}
|
||||||
initBlockSubgraph()
|
initBlockSubgraph()
|
||||||
}, [config.subgraphUri])
|
}, [config])
|
||||||
|
|
||||||
// Set sync status
|
// Set sync status
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -7,13 +7,7 @@ import React, {
|
|||||||
ReactNode,
|
ReactNode,
|
||||||
useEffect
|
useEffect
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import {
|
import { Ocean, Logger, Account, ConfigHelperConfig } from '@oceanprotocol/lib'
|
||||||
Ocean,
|
|
||||||
Logger,
|
|
||||||
Account,
|
|
||||||
Config,
|
|
||||||
ConfigHelperConfig
|
|
||||||
} from '@oceanprotocol/lib'
|
|
||||||
|
|
||||||
import { useWeb3 } from './Web3'
|
import { useWeb3 } from './Web3'
|
||||||
import { getDevelopmentConfig, getOceanConfig } from '../utils/ocean'
|
import { getDevelopmentConfig, getOceanConfig } from '../utils/ocean'
|
||||||
@ -22,8 +16,8 @@ import { useAsset } from './Asset'
|
|||||||
interface OceanProviderValue {
|
interface OceanProviderValue {
|
||||||
ocean: Ocean
|
ocean: Ocean
|
||||||
account: Account
|
account: Account
|
||||||
config: Config
|
config: ConfigHelperConfig
|
||||||
connect: (config: Config) => Promise<void>
|
connect: (config: ConfigHelperConfig) => Promise<void>
|
||||||
}
|
}
|
||||||
|
|
||||||
const OceanContext = createContext({} as OceanProviderValue)
|
const OceanContext = createContext({} as OceanProviderValue)
|
||||||
@ -34,16 +28,16 @@ function OceanProvider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
|
|
||||||
const [ocean, setOcean] = useState<Ocean>()
|
const [ocean, setOcean] = useState<Ocean>()
|
||||||
const [account, setAccount] = useState<Account>()
|
const [account, setAccount] = useState<Account>()
|
||||||
const [config, setConfig] = useState<Config>()
|
const [config, setConfig] = useState<ConfigHelperConfig>()
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
// Helper: Create Ocean instance
|
// Helper: Create Ocean instance
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
const connect = useCallback(
|
const connect = useCallback(
|
||||||
async (config: ConfigHelperConfig | Config) => {
|
async (config: ConfigHelperConfig) => {
|
||||||
if (!web3 || !ddo) return
|
if (!web3 || !ddo) return
|
||||||
|
|
||||||
const newConfig: Config = {
|
const newConfig: ConfigHelperConfig = {
|
||||||
...config,
|
...config,
|
||||||
web3Provider: web3
|
web3Provider: web3
|
||||||
}
|
}
|
||||||
@ -65,13 +59,13 @@ function OceanProvider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
// Initial connection
|
// Initial connection
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ddo?.chainId) return
|
// if (!ddo?.chainId) return
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
...getOceanConfig(ddo.chainId),
|
...getOceanConfig(ddo?.chainId || 1),
|
||||||
|
|
||||||
// add local dev values
|
// add local dev values
|
||||||
...(ddo.chainId === 8996 && {
|
...(ddo?.chainId === 8996 && {
|
||||||
...getDevelopmentConfig()
|
...getDevelopmentConfig()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user