Type Size mismatch error when trying to subscribe to event

Hi there. Trying to get the event back on my Coinflip dapp, signaling whether the user won or lost, but having trouble.

On phase 1 of this project I got this from the transaction receipt, but now in phase two (using an oracle with real randomness) that approach won’t work. So I’m trying to subscribe to the event I set up. Everything else works fine in my dapp, but I keep getting this error back in the browser console when I try to subscribe:

MetaMask - RPC Error: data type size mismatch, expected 32 got 9 
Object { code: -32600, message: "data type size mismatch, expected 32 got 9" }

Have no idea what the heck this is. I can’t find anything searching online. Here is the js code for the subscription:

      contractInstance.methods.bet(choice).send(config)
        .once('transactionHash', function(hash){ })
        .once('receipt', function(receipt){ })
        .on('confirmation', function(confNumber, receipt){ })
        .on('error', function(error){})
        .then(function(){
          var subscription = web3.eth.subscribe('logs', {
              topics: ['WinOrLose']
          }, function(error, result){
              if (error) {console.log(error);}
              else {console.log(result);}
          })
          .on("data", function(txHash){
              console.log(txHash);
          });
        });

Any help would be appreciated.

1 Like

Hi @CryptoEatsTheWorld,

I assume that you resolved here: How to capture an event value with web3 js or is this still an issue?

Yes, I worked out that issue, thanks.

1 Like