Actually in my App.js I have called my contract function like this:

this.state.swapcontract.methods.sendFunds(address).send({ from: this.state.account , value:amount}) 

The function is called perfectly and does the work correctly but it also emits an event.

How do I access that event in my app.js?

Also if some function returned something then how to access it also?

Also this is not a async call and the call back function which many sites suggest is doing nothing.

1 Answer 1


Function send returns a Promise object which, when resolved, returns the transaction-receipt.

The transaction-receipt contains all events emitted by your contract function (sendFunds).

So first, save that Promise object:

const promise = this.state.swapcontract.methods.sendFunds(address).send(...);

Then, resolve it in order to get the receipt.

You can do so by calling this from an async function:

const receipt = await promise;
console.log(JSON.stringify(receipt, null, 4));

Or by calling this from anywhere:

promise.then(function(receipt) {
    console.log(JSON.stringify(receipt, null, 4));

Finally, read the printout in order to learn exactly where the events are stored within the receipt.

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.