SDK & Integration
Indexing
Build an independent, replayable PressChain projection layer from contract events and authoritative reads.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Build an independent, replayable PressChain projection layer from contract events and authoritative reads.
type IndexCursor = {
chainId: number;
blockNumber: bigint;
blockHash: string;
};
type EventOrigin = {
transactionHash: string;
logIndex: number;
contractAddress: string;
};
for (let from = START_BLOCK; from <= head; from += RANGE) {
const to = Math.min(from + RANGE - 1, head);
const logs = await getPressChainLogs(from, to);
await database.transaction(async (tx) => {
for (const log of logs) {
await applyEventIdempotently(tx, log);
}
await saveCursor(tx, to, await blockHash(to));
});
}
{
"canonical": { "status": 2, "capsuleId": "0x..." },
"projection": { "indexedAt": "..." },
"enrichment": { "topics": ["water", "public-records"] }
}