Files
smom-dbis-138/services/checkpoint-aggregator/dist/leafCodec.js
defiQUG c336809676
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
Add mainnet checkpoint stack: ISO attestation, participant Etherscan surface, and services.
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>
2026-05-25 00:30:45 -07:00

61 lines
2.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.effectiveValue = effectiveValue;
exports.leafHashes = leafHashes;
exports.paymentsRoot = paymentsRoot;
exports.leavesToTuples = leavesToTuples;
exports.encodeExtensionLeavesV1 = encodeExtensionLeavesV1;
exports.encodeExtensionLeavesV2 = encodeExtensionLeavesV2;
const ethers_1 = require("ethers");
const checkpoint_core_1 = require("@dbis/checkpoint-core");
function effectiveValue(leaf) {
return (0, checkpoint_core_1.effectiveTokenOrNativeWei)(leaf);
}
function leafHashes(chainId, leaves) {
return leaves.map((l) => (0, checkpoint_core_1.paymentLeafV1Hash)(chainId, {
txHash: l.txHash,
from: l.from,
to: l.to,
value: effectiveValue(l),
blockNumber: l.blockNumber,
blockTimestamp: l.blockTimestamp,
gasUsed: l.gasUsed,
success: l.success,
}));
}
function paymentsRoot(chainId, leaves) {
return (0, checkpoint_core_1.buildMerkleRoot)(leafHashes(chainId, leaves));
}
const PAYMENT_LEAF_TUPLE = 'tuple(bytes32,address,address,uint256,uint256,uint64,uint256,bool)';
function leavesToTuples(leaves) {
return leaves.map((l) => [
l.txHash,
l.from,
l.to,
effectiveValue(l),
BigInt(l.blockNumber),
BigInt(l.blockTimestamp),
l.gasUsed,
l.success,
]);
}
function encodeExtensionLeavesV1(leaves) {
return ethers_1.ethers.AbiCoder.defaultAbiCoder().encode([PAYMENT_LEAF_TUPLE + '[]'], [leavesToTuples(leaves)]);
}
function encodeExtensionLeavesV2(leaves) {
const PAYMENT_LEAF_V2_TUPLE = 'tuple(bytes32,address,address,address,uint256,uint256,uint64,uint256,bool,uint32)';
const tuples = leaves.map((l) => [
l.txHash,
l.from,
l.to,
l.token ?? ethers_1.ethers.ZeroAddress,
effectiveValue(l),
BigInt(l.blockNumber),
BigInt(l.blockTimestamp),
l.gasUsed,
l.success,
l.tokenLogIndex ?? 0,
]);
return ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['bytes1', PAYMENT_LEAF_V2_TUPLE + '[]'], [ethers_1.ethers.toBeHex(0x02, 1), tuples]);
}