Questions tagged [on-chain-views]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
46 views

REST API for querying smart contract view

I created a smart contract (currently on ghostnet) with an on-chain view get_latest_hash which, once executed, returns a string, i.e. "test_hash_x" I would like to query this get_latest_hash ...
ktorn's user avatar
  • 435
3 votes
1 answer
63 views

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

I am exploring an FA2 implementation where the storage and the business logic are in different smart contracts (a pattern for upgradability) This case could see instance of both updating the item in ...
hlvntn's user avatar
  • 111
1 vote
2 answers
37 views

Could the protocol be upgraded to allow contract creators (or perhaps anyone) to add views functions after deploying?

I think it would be helpful to be able to add views after deploying a contract. There are many cases where another contract could use storage information that is not originally viewable in the ...
Chas Smith's user avatar
-1 votes
1 answer
67 views

calling onchain view through other contract

I am facing a weird issue on smartpy. This is the onchain view added on fa2Fungible contract. @sp.onchain_view() def check_operator(self, params): sp.set_type(params, sp.TRecord(owner=sp....
Kin's user avatar
  • 184
1 vote
1 answer
90 views

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

I have been contemplating replacing off-chain views entirely with on-chain views in my contracts since the former leads to unnecessary work of having an otherwise redundant metadata big-map with a ...
Anshu Jalan's user avatar
0 votes
1 answer
48 views

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

Considering the following SmartPy decorators: @sp.utils.view @sp.onchain_view @sp.offchain_view What are the differences in use between them?
Corpodev's user avatar
1 vote
2 answers
38 views

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

When performing self.init_metadata("metadata", some_metadata) on contract metadata inside smartpy, should the list of views inside the TZIP-16 metadata only contain off-chain views, or must ...
0x10's user avatar
  • 359
1 vote
2 answers
84 views

Can off-chain views call on-chain views?

Is it possible to call and process the result of an on-chain view inside an off-chain view that is stored inside contract metadata?
0x10's user avatar
  • 359
1 vote
1 answer
20 views

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

Is it possible for a contract to offer a "Pay per View" on-chain view that will only respond if a certain amount of Mutez is sent with the call, or are on-chain view calls always free?
0x10's user avatar
  • 359