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>
31 lines
1.4 KiB
JavaScript
31 lines
1.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.dualWriteV1Mirror = dualWriteV1Mirror;
|
|
const ethers_1 = require("ethers");
|
|
const leafCodec_1 = require("./leafCodec");
|
|
const MIRROR_ABI = [
|
|
'function mirrorBatchTransactions(bytes32[] calldata txHashes, address[] calldata froms, address[] calldata tos, uint256[] calldata values, uint256[] calldata blockNumbers, uint256[] calldata blockTimestamps, uint256[] calldata gasUseds, bool[] calldata successes, bytes[] calldata datas) external',
|
|
'function processed(bytes32) view returns (bool)',
|
|
];
|
|
async function dualWriteV1Mirror(wallet, mirrorAddress, leaves) {
|
|
if (leaves.length === 0)
|
|
return null;
|
|
const mirror = new ethers_1.ethers.Contract(mirrorAddress, MIRROR_ABI, wallet);
|
|
const pending = [];
|
|
for (const leaf of leaves) {
|
|
try {
|
|
if (await mirror.processed(leaf.txHash))
|
|
continue;
|
|
}
|
|
catch {
|
|
/* continue */
|
|
}
|
|
pending.push(leaf);
|
|
}
|
|
if (pending.length === 0)
|
|
return null;
|
|
const tx = await mirror.mirrorBatchTransactions(pending.map((l) => l.txHash), pending.map((l) => l.from), pending.map((l) => l.to), pending.map((l) => (0, leafCodec_1.effectiveValue)(l)), pending.map((l) => l.blockNumber), pending.map((l) => l.blockTimestamp), pending.map((l) => l.gasUsed), pending.map((l) => l.success), pending.map((l) => '0x'));
|
|
await tx.wait();
|
|
return tx.hash;
|
|
}
|