Files
smom-dbis-138/services/truth-bridge/dist/indexer.js
2026-03-02 12:14:09 -08:00

25 lines
1.2 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Truth Bridge indexer: watch Ethereum Lift events and (stub) correlate with Truth Network.
* In production: also subscribe to TN burn events and push to proof builder.
* See: docs/07-ccip/TRUTH_NETWORK_BRIDGE_SPEC.md
*/
require("dotenv/config");
const ethereum_adapter_1 = require("./ethereum-adapter");
const POLL_MS = process.env.TRUTH_INDEXER_POLL_MS ? parseInt(process.env.TRUTH_INDEXER_POLL_MS, 10) : 12000;
function run() {
const bridge = (0, ethereum_adapter_1.getBridgeContract)();
console.log('[Truth indexer] Subscribing to Lift events on Truth Bridge...');
bridge.on('Lift', (sender, amount, recipient) => {
console.log('[Lift]', { sender, amount: amount.toString(), recipient });
// TODO: correlate with Truth Network mint/credit (e.g. call truth-adapter or store for proof)
});
bridge.on('LowerRequest', (recipient, amount) => {
console.log('[LowerRequest]', { recipient, amount: amount.toString() });
// TODO: build proof via proof-builder and submit lower on Ethereum
});
console.log('[Truth indexer] Running (poll interval %d ms). Stop with Ctrl+C.', POLL_MS);
}
run();