3 votes
Accepted

Are contract views typechecked when only the main contract code is called?

Yes, I think that currently, all the code and views are type-checked. A workaround is to declare views are global constants. But there is no support for this in high-level SC languages for the moment ...
iguerNL's user avatar
  • 1,151
2 votes
Accepted

Can you send Mutez along with a call to an on-chain view?

on-chain views do not mutate any state (storage, balances, etc.). But it is possible to have a subscription system, where you can have an on-chain view that verifies if the caller has an active ...
Rodrigo Quelhas's user avatar
2 votes
Accepted

REST API for querying smart contract view

Upon further research I found that the tzkt API does support executing views. It is documented under the Helpers section. The syntax is as follows: POST to /v1/helpers/view/{contract}/{name} where {...
ktorn's user avatar
  • 435
2 votes

Can you update the storage of an external contract and retrieve the updated storage item via on-chain view in the same contract call?

View calls are executed immediately but the transfers are not (they are delayed until the end of the execution of the script) so in particular, calling the same view of the same contract several times ...
Raphaël Cauderlier's user avatar
2 votes
Accepted

What are the differences between the chain view decorators in SmartPy?

@sp.utils.view: An old helper that simplifies the creation of an entrypoint that callback a contract with a value. Do not use it except if you know what you are doing. @sp.onchain_view: an on-chain ...
Jordan_tez's user avatar
  • 1,065
1 vote
Accepted

When generating contract metadata with `sp.init_metadata` do you include or exclude on-chain views in the `views` array in the metadata?

Internally, the compiler interprets on-chain views the same way as off-chain views when it comes to metadata (not included in the contract code). If the off-chain view has the same logic as the on-...
Rodrigo Quelhas's user avatar
1 vote
Accepted

Can off-chain views call on-chain views?

Yes, you can call on-chain views from off-chain views. off-chain views use run_code RPC endpoint, which runs some instructions against a given context provided by you, similar to calling an entrypoint....
Rodrigo Quelhas's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible