Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m3s
CI/CD Pipeline / Security Scanning (push) Successful in 2m18s
CI/CD Pipeline / Lint and Format (push) Failing after 34s
CI/CD Pipeline / Terraform Validation (push) Failing after 20s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 22s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 40s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 49s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 21s
Validation / validate-genesis (push) Successful in 25s
Validation / validate-terraform (push) Failing after 21s
Validation / validate-kubernetes (push) Failing after 8s
Validation / validate-smart-contracts (push) Failing after 8s
Validation / validate-security (push) Failing after 1m11s
Validation / validate-documentation (push) Failing after 14s
Verify Deployment / Verify Deployment (push) Failing after 45s
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface, checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services, relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts. Co-authored-by: Cursor <cursoragent@cursor.com>
50 lines
2.0 KiB
JavaScript
50 lines
2.0 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.persistIso20022ForLeaves = persistIso20022ForLeaves;
|
|
const crypto_1 = require("crypto");
|
|
const fs_1 = require("fs");
|
|
const path_1 = require("path");
|
|
const checkpoint_core_1 = require("@dbis/checkpoint-core");
|
|
function storeDir() {
|
|
const raw = process.env.OMNL_ISO20022_STORE_DIR?.trim();
|
|
if (raw)
|
|
return (0, path_1.resolve)(raw);
|
|
const root = process.env.PROXMOX_ROOT || process.cwd();
|
|
return (0, path_1.resolve)(root, 'config/iso20022-omnl/messages');
|
|
}
|
|
function retentionUntil(fromIso) {
|
|
const y = parseInt(process.env.OMNL_ISO20022_RETENTION_YEARS || '10', 10);
|
|
const d = new Date(fromIso);
|
|
d.setFullYear(d.getFullYear() + (Number.isFinite(y) && y > 0 ? y : 10));
|
|
return d.toISOString();
|
|
}
|
|
function persistIso20022ForLeaves(leaves, batchId) {
|
|
if (process.env.CHECKPOINT_ISO_OMNL_STORE === '0')
|
|
return [];
|
|
const dir = storeDir();
|
|
(0, fs_1.mkdirSync)(dir, { recursive: true });
|
|
const out = [];
|
|
for (const leaf of leaves) {
|
|
const iso = leaf.iso20022 ?? (0, checkpoint_core_1.mapPaymentLeafToCanonical)(leaf);
|
|
const xml = (0, checkpoint_core_1.canonicalToPacs008Xml)(iso);
|
|
const id = (0, crypto_1.randomUUID)();
|
|
const receivedAt = new Date().toISOString();
|
|
const record = {
|
|
id,
|
|
messageType: 'pacs.008',
|
|
receivedAt,
|
|
retentionUntil: retentionUntil(receivedAt),
|
|
uetr: iso.uetr,
|
|
instructionId: iso.instructionId,
|
|
settlementOrChainRef: leaf.txHash,
|
|
accountingRef: `checkpoint-batch-${batchId.toString()}`,
|
|
payloadSha256: (0, crypto_1.createHash)('sha256').update(xml, 'utf8').digest('hex'),
|
|
payload: xml,
|
|
canonical: iso,
|
|
};
|
|
(0, fs_1.writeFileSync)((0, path_1.join)(dir, `${id}.json`), JSON.stringify(record, null, 2), 'utf8');
|
|
out.push({ id, chain138TxHash: leaf.txHash, instructionId: iso.instructionId });
|
|
}
|
|
return out;
|
|
}
|