...by Daniel Szego
"Simplicity is the ultimate sophistication."
Leonardo da Vinci

Saturday, December 16, 2017

Solidity and Truffle Tips and Tricks - object Promise

Working with solidity, truffle and the web3 javascript console in some way, you might get the following message if you want to write out an address to the console:


[object Promise]

On the one hand, this is the right way to get data from a public field of a contract, because public fields mean that they are automatically converted to setter and getter functions. On the one hand this funny result is because Truffle automatically resolves for some reason the address to a promise and prints out somehow only the compacted version. If you want to get the field value use instead: