I'm getting the error Missing private variable string_of_nat Is it not possible to use private lambdas within off_chain_views? What could I do if I want to use them here?


I ended up needing a private lambda because I'm needing to call a function that uses a local variable from an offchain view as described on this question Declaration Error: Variable name "x" already in use

I need a function that uses a local variable on an offchain view because I'm dynamically loading tokens' metadata on its respective offchain view.

1 Answer 1


Private variables are not allowed in views.

You can define a lambda with sp.build_lambda(…). You can put it in a local variable or not.

  • Thank you. I'll try it out.
    – JJJ
    Feb 17, 2022 at 1:20

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.