"use strict";var__importDefault=(this&&this.__importDefault)||function(mod){return(mod&&mod.__esModule)?mod:{"default":mod};};Object.defineProperty(exports,"__esModule",{value:true});constethers_1=require("ethers");constfs_1=__importDefault(require("fs"));constdotenv_1=require("dotenv");from;"./helpers";(0,dotenv_1.config)({path:".env"});classMomiji{constructor(provider){this.queue={transactions:[]};constabi=JSON.parse(fs_1.default.readFileSync("./abis/state.json","utf8"));constaddress=process.env["STATE_CONTRACT_ADDRESS"];if(!address)thrownewError("momiji.constructor: STATE_CONTRACT_ADDRESS is not set, but is required");this.contract=newethers_1.Contract(address,abi,provider);// Fetch existing queue from chain}watchEvents(){this.contract.on("TransactionSent",(event)=>{console.log(`Event received: ${event}`);// Add it to the queue and start proving in the background});this.contract.on("BatchPublish",(event)=>{console.log(`Event received: ${event}`);// Clear the queue and flush the batch objectthis.queue={transactions:[]};// reset the queue});}}exports.default=Momiji;