Files
smom-dbis-138/services/settlement-middleware/dist/adapters/omnl.js
zaragoza444 458f3b420b
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m31s
CI/CD Pipeline / Security Scanning (push) Successful in 3m4s
CI/CD Pipeline / Lint and Format (push) Failing after 45s
CI/CD Pipeline / Terraform Validation (push) Failing after 28s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 28s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 44s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 36s
Validation / validate-genesis (push) Successful in 30s
Validation / validate-terraform (push) Failing after 30s
Validation / validate-kubernetes (push) Failing after 10s
Validation / validate-smart-contracts (push) Failing after 12s
Validation / validate-security (push) Failing after 1m52s
Validation / validate-documentation (push) Failing after 18s
Verify Deployment / Verify Deployment (push) Failing after 57s
feat: wire production settlement rails for M2 mint, transfers, and bank SWIFT
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 02:54:53 -07:00

68 lines
2.8 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.archiveIso20022 = archiveIso20022;
exports.requestTokenMint = requestTokenMint;
exports.requestTokenTransfer = requestTokenTransfer;
const axios_1 = __importDefault(require("axios"));
async function archiveIso20022(payload) {
const base = (process.env.TOKEN_AGGREGATION_URL || 'http://localhost:3000').replace(/\/$/, '');
const key = process.env.OMNL_API_KEY || '';
const headers = { 'Content-Type': 'application/json' };
if (key)
headers.Authorization = `Bearer ${key}`;
const { data } = await axios_1.default.post(`${base}/api/v1/omnl/iso20022/messages`, {
messageType: payload.messageType,
direction: payload.direction,
payload: payload.raw,
metadata: { settlementRef: payload.settlementRef },
}, { headers, timeout: 60000 });
return { messageId: String(data.messageId ?? data.id ?? payload.settlementRef) };
}
async function requestTokenMint(payload) {
const base = (process.env.TOKEN_AGGREGATION_URL || 'http://localhost:3000').replace(/\/$/, '');
const key = process.env.OMNL_API_KEY || '';
const headers = { 'Content-Type': 'application/json' };
if (key)
headers.Authorization = `Bearer ${key}`;
try {
const { data } = await axios_1.default.post(`${base}/api/v1/omnl/settlement/token-load`, payload, { headers, timeout: 120000 });
return {
txHash: data.txHash,
status: String(data.status ?? (payload.dryRun ? 'DRY_RUN' : 'SUBMITTED')),
};
}
catch (err) {
if (axios_1.default.isAxiosError(err) && err.response?.status === 404) {
return {
status: payload.dryRun ? 'DRY_RUN' : 'PENDING_CHAIN_ENDPOINT',
};
}
throw err;
}
}
async function requestTokenTransfer(payload) {
const base = (process.env.TOKEN_AGGREGATION_URL || 'http://localhost:3000').replace(/\/$/, '');
const key = process.env.OMNL_API_KEY || '';
const headers = { 'Content-Type': 'application/json' };
if (key)
headers.Authorization = `Bearer ${key}`;
try {
const { data } = await axios_1.default.post(`${base}/api/v1/omnl/settlement/token-transfer`, payload, { headers, timeout: 120000 });
return {
txHash: data.txHash,
status: String(data.status ?? (payload.dryRun ? 'DRY_RUN' : 'SUBMITTED')),
};
}
catch (err) {
if (axios_1.default.isAxiosError(err) && err.response?.status === 404) {
return {
status: payload.dryRun ? 'DRY_RUN' : 'PENDING_CHAIN_ENDPOINT',
};
}
throw err;
}
}