Files
smom-dbis-138/services/checkpoint-indexer/src/participantSurfaceLogDecode.ts
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

67 lines
2.1 KiB
TypeScript

import { ethers } from 'ethers';
import { chain138ExplorerTxUrl, chain138TxHashFromLogTopic } from './chain138Explorer';
export type DecodedSurfaceNotificationLog = {
participant: string;
chain138TxHash: string;
chain138ExplorerUrl: string;
instructionId: string;
direction: number;
mainnetTxHash: string;
mainnetExplorerUrl: string;
blockNumber: string;
logIndex: string;
};
type EtherscanLogRow = {
topics?: string[];
transactionHash?: string;
blockNumber?: string;
logIndex?: string;
data?: string;
};
/** topic0 = Chain138ActivityNotified(address,bytes32,bytes32,uint8,uint64,uint256,uint64,bool) */
export const CHAIN138_ACTIVITY_NOTIFIED_TOPIC0 =
'0x8dfc8206f97c75e58117c233ab5193e49d50c17bd4d035cdafebcf6794168ffe';
export function decodeChain138ActivityNotifiedLogs(
envelope: { status: string; result: EtherscanLogRow[] },
explorerBase?: string
): DecodedSurfaceNotificationLog[] {
if (envelope.status !== '1' || !Array.isArray(envelope.result)) return [];
const out: DecodedSurfaceNotificationLog[] = [];
for (const log of envelope.result) {
const t = log.topics ?? [];
if (t.length < 4 || !log.transactionHash) continue;
const participant = t[1] ? ethers.getAddress('0x' + t[1].slice(-40)) : '';
const chain138TxHash = chain138TxHashFromLogTopic(t[2]);
if (!chain138TxHash) continue;
const instructionId = t[3] ?? '';
let direction = 0;
if (log.data && log.data.length >= 66) {
try {
const decoded = ethers.AbiCoder.defaultAbiCoder().decode(
['uint8', 'uint64', 'uint256', 'uint64', 'bool'],
log.data
);
direction = Number(decoded[0]);
} catch {
/* non-fatal */
}
}
out.push({
participant,
chain138TxHash,
chain138ExplorerUrl: chain138ExplorerTxUrl(chain138TxHash, explorerBase),
instructionId,
direction,
mainnetTxHash: log.transactionHash,
mainnetExplorerUrl: `https://etherscan.io/tx/${log.transactionHash}`,
blockNumber: String(log.blockNumber ?? ''),
logIndex: String(log.logIndex ?? ''),
});
}
return out;
}