Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m22s
CI/CD Pipeline / Security Scanning (push) Successful in 2m30s
CI/CD Pipeline / Lint and Format (push) Failing after 44s
CI/CD Pipeline / Terraform Validation (push) Failing after 27s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 31s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 56s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 29s
Validation / validate-genesis (push) Successful in 34s
Validation / validate-terraform (push) Failing after 39s
Validation / validate-kubernetes (push) Failing after 14s
Validation / validate-smart-contracts (push) Failing after 20s
Validation / validate-security (push) Failing after 1m19s
Validation / validate-documentation (push) Failing after 27s
Verify Deployment / Verify Deployment (push) Failing after 1m13s
Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.9 KiB
JavaScript
45 lines
1.9 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;
|
|
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;
|
|
}
|
|
}
|