DEV Community

Discussion on: The Complete Guide to Full Stack Solana Development with React, Anchor, Rust, and Phantom

Collapse
 
ahmedali profile image
Ahmed Ali

One of the most useful Solana related tutorials. Thank you!
I have couple of questions though:

  • At this point I am getting an AccountNotProgramOwned error which I can understand why, but I don't know how to fix
  • How can we change the program so that it maintains the state between browser sessions? i.e if I close the browser, re-open and connect my wallet, it would restore my last state instead of starting from scratch?
Collapse
 
thalesbmc profile image
Thales Brederodes

local storage.

Collapse
 
0cv profile image
Christophe Vidal • Edited

sounds like a terrible idea for anything beyond a demo. What if the user clears his cookies or use another browser, then he loses his account data and starts from new? I could imagine that a base account could be generated from the public key of the provider/user to have something deterministic which can be safely retrieved and reused

EDIT: the method PublicKey.createWithSeed based on the user address, the program ID and a deterministic storage key that can be hardcoded in the front end app, is actually the solution to this

Thread Thread
 
thalesbmc profile image
Thales Brederodes

I agree, just for demo purpose. Thanks for sharing the right way.

Collapse
 
egemengol profile image
Egemen Göl

Have you managed to solve the AccountNotProgramOwned error? I seem to stuck on that error as well.