Files
CurrenciCombo/src/services/dbisCore.ts
Devin AI 007c79d7a9 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>
2026-04-19 00:33:46 +00:00

64 lines
2.8 KiB
TypeScript

/**
* DBIS Core Banking client — STUB.
*
* The `d-bis/dbis_core` system is fully specified (707-line README describing
* Global Ledger, Accounts, Payments, FX Engine, CBDC, Compliance, Settlement)
* but it is not currently deployed at any resolvable hostname. `api.dbis-core.d-bis.org`
* fails DNS.
*
* Every method here returns the existing sample data from `src/data/portalData.ts`
* with a one-time console.warn so it's obvious the portal is not yet wired to
* the real ledger. Flip `endpoints.dbisCore.mocked = false` (and implement the
* fetch bodies below) when the core banking API is stood up.
*/
import type { Account, FinancialSummary, TreasuryPosition, CashForecast, SettlementRecord, ReportConfig } from '../types/portal';
import { sampleAccounts, financialSummary, treasuryPositions, cashForecasts, settlementRecords, reportConfigs } from '../data/portalData';
import { endpoints } from '../config/endpoints';
let warned = false;
function warnMock(method: string): void {
if (warned) return;
warned = true;
// eslint-disable-next-line no-console
console.warn(
`[dbisCore] Using sample data for ${method}() — dbis_core API is not deployed. ` +
`Set VITE_DBIS_CORE_API_BASE_URL and flip endpoints.dbisCore.mocked once available.`,
);
}
function delay<T>(value: T, ms = 150): Promise<T> {
return new Promise(resolve => setTimeout(() => resolve(value), ms));
}
export async function listAccounts(): Promise<Account[]> {
if (endpoints.dbisCore.mocked) { warnMock('listAccounts'); return delay(sampleAccounts); }
// TODO: fetch(`${endpoints.dbisCore.apiBaseUrl}/v1/accounts`)
throw new Error('dbis_core live mode not implemented');
}
export async function getFinancialSummary(): Promise<FinancialSummary> {
if (endpoints.dbisCore.mocked) { warnMock('getFinancialSummary'); return delay(financialSummary); }
throw new Error('dbis_core live mode not implemented');
}
export async function listTreasuryPositions(): Promise<TreasuryPosition[]> {
if (endpoints.dbisCore.mocked) { warnMock('listTreasuryPositions'); return delay(treasuryPositions); }
throw new Error('dbis_core live mode not implemented');
}
export async function listCashForecasts(): Promise<CashForecast[]> {
if (endpoints.dbisCore.mocked) { warnMock('listCashForecasts'); return delay(cashForecasts); }
throw new Error('dbis_core live mode not implemented');
}
export async function listSettlements(): Promise<SettlementRecord[]> {
if (endpoints.dbisCore.mocked) { warnMock('listSettlements'); return delay(settlementRecords); }
throw new Error('dbis_core live mode not implemented');
}
export async function listReports(): Promise<ReportConfig[]> {
if (endpoints.dbisCore.mocked) { warnMock('listReports'); return delay(reportConfigs); }
throw new Error('dbis_core live mode not implemented');
}