feat(portal): wire DashboardPage to live Chain-138 RPC + SolaceScan Explorer

- Add services/{http,chain138,explorer,proxmox,dbisCore} + hooks/{useLiveChain,useOnChainBalances}
- Add BackendStatusBar + LiveNetworkPanel components on DashboardPage
- Overlay on-chain META balance on account rows carrying a walletAddress
- Normalize EIP-55 checksum in chain138.getNativeBalance so hand-typed
  sample custody addresses (e.g. 0x742d35Cc...bD38) don't silently drop
  out of the balance map
- Default RPC: https://rpc.d-bis.org (user-preferred gateway)
- proxmox.ts stays mocked (CF-Access, needs BFF); dbisCore.ts stays
  mocked (no public deployment yet)

Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
This commit is contained in:
Devin AI
2026-04-19 00:33:46 +00:00
parent 52676016fb
commit 007c79d7a9
11 changed files with 781 additions and 14 deletions

110
src/config/endpoints.ts Normal file
View File

@@ -0,0 +1,110 @@
/**
* Central endpoint configuration for the Solace Bank Group PLC portal.
*
* All URLs can be overridden at build time via Vite env vars (VITE_*) so the
* same codebase can target staging / production / local mocks without a rebuild.
*
* Live backend status (verified 2026-04-19):
* - chain138.rpc LIVE (Besu QBFT, ChainID 138 / 0x8a)
* - explorer.api LIVE (SolaceScan / Blockscout v2; CORS *)
* - proxmox.api LIVE but CF-Access protected — browser calls
* cannot carry CF-Access JWTs without an SSO flow,
* so this is only reachable via a BFF today.
* - dbisCore.api NOT DEPLOYED (api.dbis-core.d-bis.org 404/DNS)
*/
export interface EndpointConfig {
chain138: {
rpcUrl: string;
chainId: number;
chainIdHex: `0x${string}`;
name: string;
nativeCurrency: { name: string; symbol: string; decimals: number };
blockExplorerUrl: string;
};
explorer: {
baseUrl: string;
apiBaseUrl: string; // Blockscout v2
};
proxmox: {
apiBaseUrl: string;
/** proxmox-api.d-bis.org is behind Cloudflare Access — direct browser calls
* are blocked. Must be proxied through a BFF that holds a CF-Access
* Service Token, or the user must complete CF-Access SSO in-browser. */
requiresBff: true;
};
dbisCore: {
apiBaseUrl: string;
/** dbis_core has no deployed public API yet. All methods fall back to
* mock data with a console.warn. Flip this to `false` once the core
* banking API is stood up. */
mocked: true;
};
}
const env = (import.meta as unknown as { env?: Record<string, string> }).env ?? {};
export const endpoints: EndpointConfig = {
chain138: {
// Public gateway; `rpc-core.d-bis.org` is a working internal alias.
rpcUrl: env.VITE_CHAIN138_RPC_URL || 'https://rpc.d-bis.org',
chainId: 138,
chainIdHex: '0x8a',
name: 'DeFi Oracle Meta Mainnet',
nativeCurrency: { name: 'Meta', symbol: 'META', decimals: 18 },
blockExplorerUrl: env.VITE_EXPLORER_BASE_URL || 'https://explorer.d-bis.org',
},
explorer: {
baseUrl: env.VITE_EXPLORER_BASE_URL || 'https://explorer.d-bis.org',
apiBaseUrl: env.VITE_EXPLORER_API_BASE_URL || 'https://api.explorer.d-bis.org',
},
proxmox: {
apiBaseUrl: env.VITE_PROXMOX_API_BASE_URL || 'https://proxmox-api.d-bis.org',
requiresBff: true,
},
dbisCore: {
apiBaseUrl: env.VITE_DBIS_CORE_API_BASE_URL || 'https://api.dbis-core.d-bis.org',
mocked: true,
},
};
export type BackendStatus = 'live' | 'bff-required' | 'mocked' | 'degraded';
export interface BackendDescriptor {
id: 'chain138' | 'explorer' | 'proxmox' | 'dbisCore';
name: string;
status: BackendStatus;
url: string;
note: string;
}
export const backendCatalog: BackendDescriptor[] = [
{
id: 'chain138',
name: 'Chain 138 RPC',
status: 'live',
url: endpoints.chain138.rpcUrl,
note: 'DeFi Oracle Meta Mainnet — Besu / QBFT. Read-only browser calls via ethers.',
},
{
id: 'explorer',
name: 'SolaceScan Explorer',
status: 'live',
url: endpoints.explorer.apiBaseUrl,
note: 'Blockscout v2 API. CORS * — safe for direct browser calls.',
},
{
id: 'proxmox',
name: 'Proxmox API',
status: 'bff-required',
url: endpoints.proxmox.apiBaseUrl,
note: 'Live but behind Cloudflare Access. Needs a BFF/service token; mocked in the browser.',
},
{
id: 'dbisCore',
name: 'DBIS Core Banking',
status: 'mocked',
url: endpoints.dbisCore.apiBaseUrl,
note: 'No public deployment yet. UI falls back to sample portal data.',
},
];