import type { InMemoryCacheConfig } from '@apollo/client'; import { AppFailure, AppLoader, DocsLinks, NetworkLoader, NodeFailure, NodeGuard, useEnvironment, } from '@vegaprotocol/environment'; import { t } from '@vegaprotocol/i18n'; import { VegaWalletProvider } from '@vegaprotocol/wallet'; import { Suspense, type ReactNode } from 'react'; import { Web3Provider } from './web3-provider'; export const Bootstrapper = ({ children }: { children: ReactNode }) => { const { error, VEGA_URL, VEGA_ENV, VEGA_WALLET_URL, VEGA_EXPLORER_URL, MOZILLA_EXTENSION_URL, CHROME_EXTENSION_URL, } = useEnvironment(); if ( !VEGA_URL || !VEGA_WALLET_URL || !VEGA_EXPLORER_URL || !CHROME_EXTENSION_URL || !MOZILLA_EXTENSION_URL || !DocsLinks ) { return ; } return ( }> } failure={ } > } failure={} > } failure={ } > {children} ); }; const cacheConfig: InMemoryCacheConfig = { typePolicies: { Statistics: { merge: true, }, Account: { keyFields: false, fields: { balanceFormatted: {}, }, }, Instrument: { keyFields: false, }, TradableInstrument: { keyFields: false, }, Product: { keyFields: ['settlementAsset', ['id']], }, MarketData: { keyFields: ['market', ['id']], }, Node: { keyFields: false, }, Withdrawal: { fields: { pendingOnForeignChain: { read: (isPending = false) => isPending, }, }, }, ERC20: { keyFields: ['contractAddress'], }, Party: { keyFields: false, }, Position: { keyFields: ['market', ['id'], 'party', ['id']], }, Fees: { keyFields: false, }, // The folling types are cached by the data provider and not by apollo PositionUpdate: { keyFields: false, }, TradeUpdate: { keyFields: false, }, AccountUpdate: { keyFields: false, }, OrderUpdate: { keyFields: false, }, }, };