Add optional Chain 2138 frontend support
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { CONTRACT_ADDRESSES } from '../../config/contracts'
|
||||
import { chain138 } from '../../config/networks'
|
||||
|
||||
interface ServiceStatus {
|
||||
name: string
|
||||
@@ -12,21 +13,23 @@ interface ServiceStatus {
|
||||
endpoint?: string
|
||||
}
|
||||
|
||||
const INITIAL_SERVICES: ServiceStatus[] = [
|
||||
{
|
||||
name: 'State Anchoring Service',
|
||||
status: 'unknown',
|
||||
lastUpdate: null,
|
||||
endpoint: 'http://192.168.11.221:8545', // Chain 138 RPC (VMID 2201, public/monitoring)
|
||||
},
|
||||
{
|
||||
name: 'Transaction Mirroring Service',
|
||||
status: 'unknown',
|
||||
lastUpdate: null,
|
||||
endpoint: 'http://192.168.11.221:8545',
|
||||
},
|
||||
]
|
||||
|
||||
export default function OffChainServices() {
|
||||
const [services, setServices] = useState<ServiceStatus[]>([
|
||||
{
|
||||
name: 'State Anchoring Service',
|
||||
status: 'unknown',
|
||||
lastUpdate: null,
|
||||
endpoint: 'http://192.168.11.221:8545', // Chain 138 RPC (VMID 2201, public/monitoring)
|
||||
},
|
||||
{
|
||||
name: 'Transaction Mirroring Service',
|
||||
status: 'unknown',
|
||||
lastUpdate: null,
|
||||
endpoint: 'http://192.168.11.221:8545',
|
||||
},
|
||||
])
|
||||
const [services, setServices] = useState<ServiceStatus[]>(INITIAL_SERVICES)
|
||||
|
||||
const checkServiceStatus = async (service: ServiceStatus): Promise<ServiceStatus> => {
|
||||
if (!service.endpoint) {
|
||||
@@ -86,7 +89,7 @@ export default function OffChainServices() {
|
||||
status: 'stopped' as 'running' | 'stopped' | 'unknown',
|
||||
lastUpdate: Date.now(),
|
||||
}
|
||||
} catch (error: any) {
|
||||
} catch (error: unknown) {
|
||||
// Timeout or network error
|
||||
console.error(`Health check failed for ${service.name}:`, error)
|
||||
return {
|
||||
@@ -99,7 +102,7 @@ export default function OffChainServices() {
|
||||
|
||||
useEffect(() => {
|
||||
const checkAllServices = async () => {
|
||||
const updated = await Promise.all(services.map(checkServiceStatus))
|
||||
const updated = await Promise.all(INITIAL_SERVICES.map(checkServiceStatus))
|
||||
setServices(updated)
|
||||
}
|
||||
|
||||
@@ -174,7 +177,7 @@ export default function OffChainServices() {
|
||||
<div>
|
||||
<p className="text-white/70 mb-1">State Anchoring Service</p>
|
||||
<p className="text-white/60 text-xs">
|
||||
Monitors ChainID 138 blocks and submits state proofs to MainnetTether contract.
|
||||
Monitors {chain138.name} blocks and submits state proofs to MainnetTether contract.
|
||||
</p>
|
||||
<p className="text-white/60 text-xs font-mono mt-1">
|
||||
Contract: {CONTRACT_ADDRESSES.mainnet.MAINNET_TETHER}
|
||||
@@ -183,7 +186,7 @@ export default function OffChainServices() {
|
||||
<div>
|
||||
<p className="text-white/70 mb-1">Transaction Mirroring Service</p>
|
||||
<p className="text-white/60 text-xs">
|
||||
Monitors ChainID 138 transactions and mirrors them to TransactionMirror contract.
|
||||
Monitors {chain138.name} transactions and mirrors them to TransactionMirror contract.
|
||||
</p>
|
||||
<p className="text-white/60 text-xs font-mono mt-1">
|
||||
Contract: {CONTRACT_ADDRESSES.mainnet.TRANSACTION_MIRROR}
|
||||
|
||||
Reference in New Issue
Block a user