How do display all the events logs from a smart contract?

2.8k views Asked by At
web3.eth.sendTransaction({from : web3.eth.accounts[0], to : c.address, value : web3.toWei(50)}, console.log);

I am able to return the transaction hash.

But how do I capture all the event logs from that transaction that the smart contract returns?

1

There are 1 answers

0
Dane Pilcher On

You'll need to watch the events.

const filter = { address: web3.eth.accounts[0] }; // filter for your address
const events = c.allEvents(filter); // get all events

events.watch(function(error, result) {
  if (!error)
    console.log(log);
  });
});

You can read more about it here.