-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat(associated token pda search): add tokenProgramId param #12
feat(associated token pda search): add tokenProgramId param #12
Conversation
Not sure if it’s correct or necessary. But I have some suggestions to simplify the usage of
or
Also I’m not sure whether specific |
Hi there, have you seen this? |
Hello there! No, not before you've shown this. |
My point before was that this manually written function follows the convention of what is generated by Kinobi and therefore allows devs to swap program via Umi's program repository. This change would break that convention and that function would now behave differently then the rest of the Umi's PDA helpers which I wouldn't recommend. If you don't like the idea of using the program repository, I would at least suggest accepting the token program as an input and, when not provided, resolving it from Umi's program repository as a fallback so this doesn't introduce a breaking chance. |
Yes but doing it via the program repository wouldn't work for programs using both SPL token programs at the same time. Token22 set the pretend of spl-token no longer being special, which this change reflects. |
You could bind and unbind afterwards but I understand that having an explicit input might be better for Devex. However, if the token program is not provided explicitly, we should fallback to resolving the program via the repository so that this change isn't a breaking one and so that this function is still consistent with the rest of the generated function. |
@blockiosaurus I've made some changes according to @lorisleiva recommendations. Let me, please, know if it's OK with you both, guys. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thank you!
BREAKING CHANGE: the tokenProgramId param for the findAssociatedTokenPda() function breaks js tests which use instructions generated by Kinobi. It will also break any code relying on this function.
db889b0
to
6021d47
Compare
Thank you! @blockiosaurus @lorisleiva Appreciate all the help! |
Description:
findAssociatedTokenPda()
is updated. Now it accepts another seed -tokenProgramId
. It’s a specific public key for either Token or Token2022 Program as we discussed with @blockiosaurus. Tests are updated accordingly.NB! JS tests will fail because
findAssociatedTokenPda()
is used in generated by Kinobi instructions. Specifically:src/generated/instructions/createAssociatedToken.ts
src/generated/instructions/createTokenIfMissing.ts
And generated files shouldn’t be changed manually.
BREAKING CHANGE: the
tokenProgramId
param for thefindAssociatedTokenPda()
function breaks js tests which use instructions generated by Kinobi. It will also break any code relying on this function.