diff --git a/src/components/dapp-analytics/dapp-analytics.controller.ts b/src/components/dapp-analytics/dapp-analytics.controller.ts index c26a26b..d9b87f7 100644 --- a/src/components/dapp-analytics/dapp-analytics.controller.ts +++ b/src/components/dapp-analytics/dapp-analytics.controller.ts @@ -615,6 +615,8 @@ async function checkDockerContainerStatus(dApps) { async function checkKubernetesPodStatus(dApps) { const namespace = 'dapp-analytics'; const labelSelector = 'managed-by=dapp-analytics-admin'; + + // Fetch pods in the dapp-analytics namespace const pods = await k8sApi.listNamespacedPod( namespace, undefined, @@ -624,14 +626,36 @@ async function checkKubernetesPodStatus(dApps) { labelSelector, ); + // Fetch all pods in the subsquid namespace + const subsquidPods = await k8sApi.listNamespacedPod('subsquid'); + + // Map over dApps to get their statuses return dApps.map((dApp) => { + // Check for the related pod in dapp-analytics namespace const relatedPod = pods.body.items.find( (pod) => pod.metadata.labels && pod.metadata.labels['dapp-id'] === dApp.id, ); + + const relatedSubsquidPod = subsquidPods.body.items.find( + (pod) => + pod.metadata.labels && + pod.metadata.labels['app'].startsWith('wasabi') && + pod.metadata.labels['app'].includes( + dApp.slug === 'hydration' ? 'hydradx' : dApp.slug, + ), + ); + + // Determine the container status + const containerStatus = relatedPod + ? relatedPod.status.phase + : relatedSubsquidPod + ? relatedSubsquidPod.status.phase + : 'not found'; + return { ...dApp, - containerStatus: relatedPod ? relatedPod.status.phase : 'not found', + containerStatus, }; }); } diff --git a/src/components/node-api/chainstate.ts b/src/components/node-api/chainstate.ts index 4f7b45e..e97287b 100644 --- a/src/components/node-api/chainstate.ts +++ b/src/components/node-api/chainstate.ts @@ -6,7 +6,11 @@ const rpcEndpoints: { [key: string]: string } = { kusama: 'wss://kusama-rpc.polkadot.io', 'aleph-zero': 'wss://rpc.azero.dev', moonbeam: 'wss://moonbeam.api.onfinality.io/public-ws', - 'arbitrum-one': 'https://arbitrum.api.onfinality.io/public', + 'arbitrum-one': 'https://arb1.arbitrum.io/rpc', + 'arbitrum-nova': 'https://nova.arbitrum.io/rpc', + optimism: 'https://optimism.api.onfinality.io/public', + bifrost: 'wss://bifrost-rpc.dwellir.com', + hydration: 'wss://hydradx-rpc.dwellir.com', }; export async function getCurrentBlock(chain: string): Promise { @@ -15,13 +19,22 @@ export async function getCurrentBlock(chain: string): Promise { throw new Error(`RPC endpoint for chain ${chain} not found`); } - if (['polkadot', 'kusama', 'aleph-zero', 'moonbeam'].includes(chain)) { + if ( + [ + 'polkadot', + 'kusama', + 'aleph-zero', + 'moonbeam', + 'bifrost', + 'hydration', + ].includes(chain) + ) { // Substrate-based chains const wsProvider = new WsProvider(endpoint); const api = await ApiPromise.create({ provider: wsProvider }); const currentBlock = await api.rpc.chain.getHeader(); return currentBlock.number.toNumber(); - } else if (['arbitrum-one'].includes(chain)) { + } else if (['arbitrum-one', 'arbitrum-nova', 'optimism'].includes(chain)) { // Ethereum-compatible chains (e.g., Arbitrum) const provider = new ethers.JsonRpcProvider(endpoint); const currentBlockNumber = await provider.getBlockNumber();