Reading contract state
The recommended way to read the contract state is to use the readContract
function and pass the Solidity method signature and the params. This is type-safe based on the Solidity method signature you define. You can get your desired contract method signature from the solidity code directly.
This will execute the read immediately and return the result from the blockchain.
Using the CLI, you can generate optimized functions for all the possible calls to a contract. This saves you time and precomputes all the necessary encoding.
Read more on how to generate extension functions using the CLI.