UNPKG

flashloan-profit-calculator

Version:

A library for analyzing flashloan transactions and calculating profits

26 lines (25 loc) 843 B
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("./index"); // Get transaction hash from command line argument const txHash = process.argv[2]; if (!txHash) { console.error("Please provide a transaction hash as an argument"); console.log("Usage: npx ts-node cli.ts <transaction-hash>"); process.exit(1); } // Calculate profit from transaction hash async function main() { try { console.log(`Calculating profit for transaction: ${txHash}`); const profit = await (0, index_1.calculateProfitFromTxHash)(txHash); console.log("\nAnalysis complete!"); await (0, index_1.displayProfitResults)(profit); } catch (error) { console.error("Error:", error); process.exit(1); } } main().catch(console.error);