btcoin23 / LP-Raydium

This is a Raydium bot that can creat new pool with Open Book MarkeID, remove LP according to the configurations
https://t.me/BTC0in23
6 stars 0 forks source link

Solana web3.js issue #3

Closed btcoin23 closed 2 weeks ago

btcoin23 commented 5 months ago

While working on the below code, I met some issues. The issue is related to the Solana web3.js The below code tracks the Sol transfer transaction on Solana mainnet

const sigArray = ['JcVin1PEUJ4hz8wJoqPEaeR3P6yCmxe6VDxZVDWfBfdTwFnsyvS5VKfrHKQ2SJFTFgsLP2ox58GovzMq36Hj3aJ']
                const trxs = await connection.getParsedTransactions(sigArray, { maxSupportedTransactionVersion: 0 });
                const txs = trxs.filter(trx => trx?.transaction)
                txs.forEach(async (tx, index) => {
                    const isTransferred: any = tx.transaction.message.instructions.find((item: any) =>
                        item.parsed?.type === 'transfer'
                    )
                    if (isTransferred) {
                        const txAmount = tx.meta.postBalances[0] - tx.meta.preBalances[0];
                        if (txAmount >= -BotConfig.threshold * LAMPORTS_PER_SOL) {
                            const recipientPublicKey = tx.transaction.message.accountKeys[0].pubkey;
                            console.log(`\n * Over ${BotConfig.threshold} SOL transition is detected: ${tx.transaction.signatures}`);
                            console.log(` - Recipient Address: ${recipientPublicKey}`);
                            console.log(` - Amount: ${-txAmount / LAMPORTS_PER_SOL} SOL`);

Here, the maxSupportedTransactionVersion property is important, I think. But how can I track the transaction of Legacy version? It seems not support getParsedTransactions() function with Legacy verion Hope to hear from you...