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?
2 Answers
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.
You can access onchain views through run_view
RPC on Octez
Not very well documented but you have info in this PR
https://gitlab.com/tezos/tezos/-/merge_requests/4810
You can use it via Taquito also https://tezostaquito.io/docs/lambda_view
-
i'm looking to call an off-chain view and have that off-chain view call an on-chain view in a totally different contract and process the result– 0x10Jul 6, 2022 at 10:04
-
I'm curious about the use case? Cause onchain views can call other onchain views. Offchain views are overset by onchain views for most use cases. Main interest is custom views when you wanna create a view on a older contract– ThomasJul 6, 2022 at 22:20
-
use case shouldn't matter on a technical forum, but in this instance i have a utility contract that provides a generic but computationally complex service for other contracts to consume via an on-chain view and i would also like to use this computation inside an off-chain view without having to re-implement– 0x10Jul 7, 2022 at 5:15
on-chain
views fromoff-chain
views. It usesrun_code
RPC endpoint.