Hello! I’m trying to upgrade contract version from 0 to 1.
At contract v0, I was able to get the model using getInstanceInfo(), but it is no longer available at v1. github - concordium-node-sdk-js
Maybe I should use the view function, but how can I use it with nodejs(actually client for browser)?
And let me ask another related question.
Command concordium-client contract show also no longer displays state.
Is there any command to retrieve the contract state?
contract show does not display the state for v1 contracts because the state can be very large and contract show is meant for getting an overview of the contract instance. Instead, you should use contract invoke and view functions.
Also, note that you can use the parameter to query for specific info from a view function. For example, you could pass in an account address to get a list of all the NFTs owned by that address.
InvokeContract does not cost any CCD. It still keeps track of how much energy was used, but only for informational purposes (and you can use it to limit the amount of time the node spends answering a query, if you want).
Even if InvokeContract involves communication with other contracts that is purely local on your node, it is not recorded on the blockchain, and thus does not cost any CCD.
Only transactions cost CCD, and those must be submitted via SubmitTransaction.