If I've programId
(Pubkey) of a program, is it possible to get AccountInfo
(or Program
) object somehow?
Or conversely, is it possible to somehow invoke a (view) method on program if its programId
is known?
Accounts can't be loaded on the runtime, rather they can only be pre-loaded and passed unto it. You'd have to pass in all the accounts you need(or think you might need) in from the client. There's no other way to access an account's data.
is it possible to somehow invoke a (view) method on program if its programId is known?
If such a method existed it would still need to be passed all the accountInfos it needs. One of those would need to be the accountInfo of the program, which would defeat the purpose. As of now there's simply no way on Solana to access an account's info without loading it pre-execution.