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
3 Replies
Percy
Percy16mo ago
Please provide your project ID or reply with N/A. Thread will automatically be closed if no reply is received within 10 minutes. You can copy your project's id by pressing Ctrl/Cmd + K -> Copy Project ID.
luna
luna16mo ago
Just a heads up use three backticks before and after the code block to make it more readable instead of just one.
Percy
Percy16mo ago
No project ID was provided. Closing thread.
Want results from more Discord servers?
Add your server