Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow calling getAuthAccount() in view functions #3610

Open
joshuahannan opened this issue Oct 10, 2024 · 1 comment
Open

Allow calling getAuthAccount() in view functions #3610

joshuahannan opened this issue Oct 10, 2024 · 1 comment

Comments

@joshuahannan
Copy link
Member

Issue to be solved

Being able to get authorized account objects has been pretty useful for scripts since it was introduced. In a similar vein, view functions are not allowed to modify state, so it seems like it could be useful to allow calling getAuthAccount within view functions also. This would allow even transactions to access the private information in accounts without being able to modify it. It could be very useful.

Suggested Solution

???

@bluesign
Copy link
Contributor

this is tricky; their result can leave view scope.

 var ref = view fun(): auth(Storage) &Account{
    return getAuthAccount<auth(Storage) &Account>(0x1) 
  }()

  ref.storage.save("deniz", to: /storage/x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants