Files
CurrenciCombo/src/config/endpoints.ts
nsatoshi b66ec0a78f
Some checks failed
CI / Frontend Lint (push) Failing after 6s
CI / Frontend Type Check (push) Failing after 6s
CI / Frontend Build (push) Failing after 6s
CI / Frontend E2E Tests (push) Failing after 9s
CI / Orchestrator Build (push) Failing after 6s
CI / Contracts Compile (push) Failing after 6s
CI / Contracts Test (push) Failing after 6s
Security Scan / Dependency Vulnerability Scan (push) Failing after 4s
Security Scan / OWASP ZAP Scan (push) Failing after 4s
PR G: portal /transactions page + 12-state machine view (#11)
2026-04-22 17:18:52 +00:00

131 lines
4.4 KiB
TypeScript

/**
* 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;
};
orchestrator: {
/** CurrenciCombo/orchestrator base URL (plan-state + event stream
* for /transactions page). Empty string means "not deployed —
* fall back to mock demo data". */
baseUrl: string;
deployed: boolean;
};
}
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,
},
orchestrator: {
baseUrl: env.VITE_ORCHESTRATOR_URL || '',
deployed: Boolean(env.VITE_ORCHESTRATOR_URL),
},
};
export type BackendStatus = 'live' | 'bff-required' | 'mocked' | 'degraded';
export interface BackendDescriptor {
id: 'chain138' | 'explorer' | 'proxmox' | 'dbisCore' | 'orchestrator';
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.',
},
{
id: 'orchestrator',
name: 'Transaction Orchestrator',
status: endpoints.orchestrator.deployed ? 'live' : 'mocked',
url: endpoints.orchestrator.baseUrl || '(not deployed)',
note: endpoints.orchestrator.deployed
? 'CurrenciCombo orchestrator — plan state + event stream.'
: 'Orchestrator not yet deployed. /transactions page renders demo plans.',
},
];