I am trying to retrieve all new transactions from a specific wallet using the code provided. However, I am encountering an issue when using the function tx["transaction"]["from"]
to filter transactions based on the specified wallet.
I am utilizing Alchemy methods with websockets and have thoroughly reviewed the documentation on how to implement them. There seems to be a missing piece that I am overlooking.
const { Alchemy, Network, AlchemySubscription } = require("alchemy-sdk")
const {ethers, FixedNumber} = require("ethers")
const delay = require('delay')
require("dotenv").config()
const ARBI_WS_KEY = process.env.ARBI_WS_KEY
const settings = {
apiKey: ARBI_WS_KEY,
network: Network.ARB_MAINNET,
}
const alchemy = new Alchemy(settings)
// Subscription for Alchemy's minedTransactions API
const add = async () => {
alchemy.ws.on(
{
method: AlchemySubscription.MINED_TRANSACTIONS,
},
(tx) => {
let add0 = String(tx["transaction"]["from"])
if( add0 == "WALLET"){
console.log(tx["transaction"]["hash"])
}
}
)
}
The puzzling aspect is that everything functions properly when filtering based on tx["transaction"]["to"]
, specifying a wallet or contract. But when attempting to use "from"
as the filter criterion, no results are returned.