-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Typescript complains when .accounts()
from MethodNamespace is missing an account
#1547
Comments
ah yep, i'll fix this...just needs an |
I like that solution much better. I'm far from good when it comes to Typescript complex types... As a hotfix for my use case, I did the My concern with |
My thinking was that if we have an account resolver built in for things like |
Totally agree with |
This would be a patch to prevent purely for the global chain programs mentions above from being manually added. |
That means PDA accounts would still need to be manually added? |
Looking at this condition it seems like we need to Exclude global chain programs and accounts at PDAs should be optional, so |
I'm almost done with the PR and will link to this issue to see what my resolution was. |
Just read the PR and it seems to cover the global chain programs part. But I don't think it solves the issue for accounts at PDAs, the |
Description
MethodsNamespace
has a mechanism to resolve accounts, with this we can avoid common accounts likeSystemProgram
, as well as PDAs since they are auto-populated.Problem
Due to this change, the accounts parameter is no longer any, which is awesome but now Typescript complains when not all the accounts are provided. This makes it impossible to use the account resolver logic.
Proposed Solution
While it isn't pretty, we could wrap the accounts method parameter with
Partial
. This would bypass the error but makes it possible for developers to make a method call with required accounts missing. I think a better solution would be a mechanism to differentiate mandatory from optional accounts.NOTE: I'm creating this issue without a PR because I'm not entirely sure which would be the best way to go.
The text was updated successfully, but these errors were encountered: