0

Event:

 event published(string indexed username,uint8 indexed age);

in front-end (browser) :

  instance.events                                                                                                                      
            .published(                                                                                                                      
                { fromBlock: 0, filter: { age: 15 } },                                                                                       
               function (err, evt) {                                                                                                        
                    console.log(evt);
                }                                                                                                                            
           );

sending values:

await instance.methods.publish("ezio", 15).send({ from: accounts[0] });

no events get captured even though the transaction is successful. and when i use a listen to the same event with no filters i get an empty returnValues object.

1 Answer 1

1

I found out the problem it's because i was using ganache Ui, i switched to using ganache in the console and it is working fine.

PS: using string as an indexed parameter is wrong since you can never filter dynamic types such as string or array.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.