Add HO liquidity scheduler, snapshot enrichments, and compliance console panel.
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m27s
CI/CD Pipeline / Security Scanning (push) Successful in 2m37s
CI/CD Pipeline / Lint and Format (push) Failing after 53s
CI/CD Pipeline / Terraform Validation (push) Failing after 31s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 29s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 37s
Validation / validate-genesis (push) Successful in 34s
Validation / validate-terraform (push) Failing after 33s
Validation / validate-kubernetes (push) Failing after 13s
Validation / validate-smart-contracts (push) Failing after 11s
Validation / validate-security (push) Failing after 1m26s
Validation / validate-documentation (push) Failing after 19s
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m27s
CI/CD Pipeline / Security Scanning (push) Successful in 2m37s
CI/CD Pipeline / Lint and Format (push) Failing after 53s
CI/CD Pipeline / Terraform Validation (push) Failing after 31s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 29s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 37s
Validation / validate-genesis (push) Successful in 34s
Validation / validate-terraform (push) Failing after 33s
Validation / validate-kubernetes (push) Failing after 13s
Validation / validate-smart-contracts (push) Failing after 11s
Validation / validate-security (push) Failing after 1m26s
Validation / validate-documentation (push) Failing after 19s
Refreshes ho-liquidity-snapshot every 30 minutes with aggregate supplyNostroMatch and reserve alerts; embeds nostro/reserve KPIs in the OMNL compliance console; includes payout journal routes needed for token-aggregation build. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
import { Router, Request, Response } from 'express';
|
||||
import { omnlRateLimiter } from '../middleware/rate-limit';
|
||||
import { omnlRequireApiKeyInProduction } from '../middleware/omnl-guards';
|
||||
import { omnlAuditMiddleware } from '../middleware/omnl-audit-middleware';
|
||||
import {
|
||||
createJournalEntry,
|
||||
postJournalEntry,
|
||||
reverseJournalEntry,
|
||||
getJournalEntry,
|
||||
createBalanceReservation,
|
||||
releaseBalanceReservation,
|
||||
getBalanceReservation,
|
||||
} from '../../services/omnl-payout-journal';
|
||||
|
||||
const router = Router();
|
||||
router.use(omnlRateLimiter);
|
||||
router.use(omnlAuditMiddleware);
|
||||
router.use(omnlRequireApiKeyInProduction);
|
||||
|
||||
function routeParam(value: string | string[] | undefined): string {
|
||||
if (Array.isArray(value)) return value[0] ?? '';
|
||||
return value ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /journal-entries — payout orchestrator integration (CR-004).
|
||||
*/
|
||||
router.post('/journal-entries', (req: Request, res: Response) => {
|
||||
try {
|
||||
const record = createJournalEntry(req.body ?? {});
|
||||
res.status(201).json(record);
|
||||
} catch (e) {
|
||||
const msg = e instanceof Error ? e.message : String(e);
|
||||
res.status(msg.includes('invalid') ? 422 : 400).json({ error: msg });
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/journal-entries/:id', (req: Request, res: Response) => {
|
||||
const record = getJournalEntry(routeParam(req.params.id));
|
||||
if (!record) {
|
||||
res.status(404).json({ error: 'not found' });
|
||||
return;
|
||||
}
|
||||
res.json(record);
|
||||
});
|
||||
|
||||
router.post('/journal-entries/:id/post', (req: Request, res: Response) => {
|
||||
try {
|
||||
res.json(postJournalEntry(routeParam(req.params.id)));
|
||||
} catch (e) {
|
||||
const msg = e instanceof Error ? e.message : String(e);
|
||||
res.status(msg.includes('not found') ? 404 : 422).json({ error: msg });
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/journal-entries/:id/reverse', (req: Request, res: Response) => {
|
||||
try {
|
||||
res.json(reverseJournalEntry(routeParam(req.params.id)));
|
||||
} catch (e) {
|
||||
const msg = e instanceof Error ? e.message : String(e);
|
||||
res.status(msg.includes('not found') ? 404 : 422).json({ error: msg });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* POST /balance-reservations — reserve funds before payout dispatch.
|
||||
*/
|
||||
router.post('/balance-reservations', (req: Request, res: Response) => {
|
||||
try {
|
||||
const body = req.body ?? {};
|
||||
if (!body.instructionId || body.amount == null || !body.currency) {
|
||||
res.status(400).json({ error: 'instructionId, amount, currency required' });
|
||||
return;
|
||||
}
|
||||
const record = createBalanceReservation(body);
|
||||
res.status(201).json(record);
|
||||
} catch (e) {
|
||||
const msg = e instanceof Error ? e.message : String(e);
|
||||
res.status(400).json({ error: msg });
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/balance-reservations/:id', (req: Request, res: Response) => {
|
||||
const record = getBalanceReservation(routeParam(req.params.id));
|
||||
if (!record) {
|
||||
res.status(404).json({ error: 'not found' });
|
||||
return;
|
||||
}
|
||||
res.json(record);
|
||||
});
|
||||
|
||||
router.delete('/balance-reservations/:id', (req: Request, res: Response) => {
|
||||
try {
|
||||
res.json(releaseBalanceReservation(routeParam(req.params.id)));
|
||||
} catch (e) {
|
||||
const msg = e instanceof Error ? e.message : String(e);
|
||||
res.status(msg.includes('not found') ? 404 : 422).json({ error: msg });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
@@ -23,6 +23,7 @@ import partnerPayloadRoutes from './routes/partner-payloads';
|
||||
import plannerV2Routes from './routes/planner-v2';
|
||||
import omnlRoutes from './routes/omnl';
|
||||
import omnlIpsasRoutes from './routes/omnl-ipsas';
|
||||
import omnlPayoutJournalRoutes from './routes/omnl-payout-journal-routes';
|
||||
import omnlComplianceRoutes from './routes/omnl-compliance-routes';
|
||||
import omnlTerminalRoutes from './routes/omnl-terminal-routes';
|
||||
import checkpointRoutes from './routes/checkpoint';
|
||||
@@ -303,6 +304,7 @@ export class ApiServer {
|
||||
this.app.use('/api/v1', omnlTerminalRoutes);
|
||||
this.app.use('/api/v1', omnlRoutes);
|
||||
this.app.use('/api/v1', omnlIpsasRoutes);
|
||||
this.app.use('/api/v1', omnlPayoutJournalRoutes);
|
||||
this.app.use('/api/v2', plannerV2Routes);
|
||||
|
||||
// Admin routes (stricter rate limit)
|
||||
|
||||
Reference in New Issue
Block a user