0

When trying to subscribe to events through websocket connection against binance smart chain testnet, I'm getting the following error:

{
  "error": {
    "code": 2,
    "msg": "Invalid request: unknown variant `eth_subscribe`, expected one of `SUBSCRIBE`, `UNSUBSCRIBE`, `LIST_SUBSCRIPTIONS`, `SET_PROPERTY`, `GET_PROPERTY` at line 1 column 49"
  },
  "id": 16
}

This is a simplified version of my code:

  const web3Socket = new Web3("wss://testnet.binance.vision/ws");
  const socketInstance = new web3Socket.eth.Contract(
    correct_abi,
    "correct_address"
  );
  web3Socket.eth.subscribe("logs", {}, (error, result) => {
    if (error) throw error;
    console.log(result);
  });

I'm using web3js 1.7.x and Metamask 10.11.1 on Brave (chromium based browser).

R01010010
  • 5,670
  • 11
  • 47
  • 77
  • Possible typo in the provided method or provided method was neither of the expected values – Mohit S Mar 17 '22 at 03:29
  • @MohitS yes I know that's what the error says. But I have no idea of how to fix it. I've been reading through the documentation and couldn't find anything to specify the method requested. – R01010010 Mar 17 '22 at 03:32

0 Answers0