INNER CODE UNIT · JavaScript
parseTransactionData
CleBeert/crypto-trading-bot-eth-bnb · swapWeb3.js:85
async function parseTransactionData(transactionDetails) {
if(transactionDetails.input){
fs.appendFileSync('transactions_hashes.txt', 'Trx hash : ' + transactionDetails.hash.toString() + '\r\n')
const transactionInput = transactionDetails.input
var path = 'transactions_hashes.txt';
var text = fs.readFileSync(path).toString();
var lines = text.split('\n');
var newlines_count = lines.length - 1;
process.stdout.clearLine();
process.stdout.cursorTo(0);
process.stdout.write(`\x1b[1m\x1b[37m[Bot]: Sweeping transaction hashes... \x1b[1m\x1b[32m${newlines_count}\x1b[37m passes. `);
if((transactionInput.length - 10) % 64 === 0){
const toTrx = transactionDetails.to
if(toTrx.toLowerCase() === EXCHANGE_ADDRESS.toLowerCase()
&& parseFloat(web3.utils.fromWei(transactionDetails.value, 'ether')) >= parseFloat(process.env.REACT_APP_TARGET_ETH_AMOUNT)){