Как получить транзакции в Мемпуле и декодировать с помощью Ethers JS
const {providers} = require("ethers");
const abiDecoder = require('abi-decoder');
abiDecoder.addABI(contractABI)// you can get it from the etherScan
const customWsProvider =
new providers.WebSocketProvider
('ws://localhost:8546');//replace this with alchemy/Infura endpoint
const init = function () {
customWsProvider.on("pending", async (tx) => {
let transaction = await customWsProvider.getTransaction(tx)
if (!transaction) {
let data = abiDecoder.decodeMethod(transaction.data);
if (!data) {
console.log(data)
}
}
});
};
init();
BurRaq101325