steffqing
steffqing
RRailway
Created by steffqing on 8/18/2023 in #✋|help
Understanding Railway
I am deploying a Node.js script that indexes some events This is my code async function main() { console.log("Script start"); const BSC = bscContract(); const filter = BSC.filters["Deposit"](); BSC.on(filter, async (event) => { const [from, to, value] = event.args; console.log(from, to, value, "BSC Handler"); await BscToTrc(from, to, value.toString()); }); let currentBlock = 0; const contract = testConfig.trx.bridge; setInterval(async () => { try { const blockHex = await tronWeb.trx.getCurrentBlock(); const block = blockHex.block_header.raw_data.number; if (currentBlock == block) return; currentBlock = block; const events = await tronWeb.getEventResult(contract, { eventName: "Deposit", onlyConfirmed: true, blockNumber: block, }); for (let event of events) { const { from, to, value } = event.result; console.log(from, to, value, "Tron Handler"); await TrcToBsc(from, to, value.toString()); } } catch (error) { console.log(error); } }, 2000); } For some reason, my setInterval() and event listener aren't doing their jobs right Is it that Railway doesn't work that way or something? Sorry, it's my first time
5 replies