You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am going to subscribe event from polygon mainnet token contract, but connection not open to send() error comes out
`
const { contractAddress } = process.env;
const Web3 = require('web3');
const url = 'wss://ws-mumbai.matic.today/';
const web3 = new Web3(url);
I am going to subscribe event from polygon mainnet token contract, but connection not open to send() error comes out
`
const { contractAddress } = process.env;
const Web3 = require('web3');
const url = 'wss://ws-mumbai.matic.today/';
const web3 = new Web3(url);
const options = {
reconnect: {
auto: true,
delay: 1000, // ms
maxAttempts: 1,
onTimeout: false,
},
address: contractAddress,
topics: [
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
],
function initSubscription() {
web3.eth
.subscribe('logs', options, (error, result) => {
if (!error) console.log('got result');
else console.log('error - ', error);
})
.on('data', (log) => {
console.log('got data', log);
})
.on('changed', (log) => {
console.log('changed');
});
}
};`
wss url is not right?
The text was updated successfully, but these errors were encountered: