Ethsubscribing with websocket not working as intended

const { Web3 } = require('web3');

// Replace with your Infura project ID
const API_KEY = ''"
const web3 = new Web3(new Web3.providers.WebsocketProvider(`wss://mainnet.infura.io/ws/v3/${API_KEY}`));

const ERC20_TRANSFER_SIGNATURE = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef';
const TokenAddress = ''

var subscription = web3.eth.subscribe('logs', {
    address: TokenAddress, 
    topics: [ERC20_TRANSFER_SIGNATURE]
}, function(error, result){
    if (!error)
        console.log(result);
});

Im trying to subscribe to transfer events for a specific tokens, but nothing gets logged, ive done my hours of researching and cant see why. Any suggestions?

1 Like

Hi there,

Please see the following tutorial which I believe is what you are looking for:

Hope this helps.
Best regards,
Radu | Infura Support

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.