Skip to content

use js sdk to listen transfer event error #78

Closed Answered by idea404
shaobinyao asked this question in SDKs
Discussion options

You must be logged in to vote

Also, @shaobinyao please specify what you expect. The code you provided does not need the line where provider is declared. Running the following creates the web socket:

const WebSocket = require("ws");

// Connect to the event server.
const ws = new WebSocket("wss://mainnet.era.zksync.io/ws"); //wss://events.zksync.io/ wss://testnet.era.zksync.dev/ws wss://mainnet.era.zksync.io/ws
console.log("Connection established");
// Change the address to the account you're intrested in.
const ACCOUNT_ADDRESS = "0x**********";

// Once connected, start sending ping frames.
setInterval(function () {
  ws.ping();
}, 10000);

// Register filters.
ws.on("open", function open() {
  console.log("open...");
  

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@AlbionaHoti
Comment options

@idea404
Comment options

Answer selected by idea404
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
SDKs
Labels
sdk Questions for the SDKs
4 participants