Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Between those curly brackets, you can do something with result: .then(function(result) { console.log(JSON.stringify(result)); }, function(error)... But you don't need that, since you're already listening to the receipt. What's inside resultis the receipt. You can get more info here: web3js.readthedocs.io/en/v1.2.5/callbacks-promises-events.html
Just after the .once('transactionHash', function(hash) { console.log("TxHash: " + hash); }) Should be something like .once('transactionHash', function(hash) { console.log("TxHash: " + hash); }).on('receipt', function(receipt) { console.log("receipt: " + JSON.stringify(receipt)); }).then(function(instance) { return instance.getInsurerInfo.call() }) and so on
As a side note: you can get the receipt for your deploy by adding this to your promise chain: .on('receipt', function(receipt) { console.log("receipt: " + JSON.stringify(receipt)); })
You're welcome. You're right about the dotenv, it's required and I was importing it in another file. Ok, actually I don't think it's hanging. The contract has been deployed successfully and this output you posted proves so because what the code is doing there is calling the function getInsurerInfo from the deployed contract. That function should return exactly what you posted. So, yeah, success! :) It's deployed properly.