I am trying to do a Dapp with Nodejs and truffle. I have a solidity contract that works fine and I would like to use the method getTransactionReceipt() from the web3 library to print in console the result, but I dont know how.
The thing is that I have different functions in the nodejs app that call the functions in the solidity contract, and just after I call those contract function and the transaction is finished, I want to print that transaction info, but to use the method getTransactionReceipt() I need the transaction hash, ¿how can I get it?
as per web3.js documentation
web3.eth.getTransaction(transactionHash [, callback])
above line returns a transaction matching the given transaction hash.
also
web3.eth.getTransactionReceipt(hash [, callback])
above line returns the receipt of a transaction by transaction hash.
Note: The receipt is not available for pending transactions and returns null.