1

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
  • 2
    Yes, you can call on-chain views from off-chain views. It uses run_code RPC endpoint. Commented Jul 6, 2022 at 15:31
  • thank you for the info, would you mind replying to the question with this information so that i can mark it as the accepted answer?
    – 0x10
    Commented Jul 7, 2022 at 5:11

2 Answers 2

1

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.

0

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

3
  • 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
    – 0x10
    Commented Jul 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
    – Thomas
    Commented Jul 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
    – 0x10
    Commented Jul 7, 2022 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.