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
Add example for remaining_accounts in anchor doc #2350
Add example for remaining_accounts in anchor doc #2350
Conversation
Someone is attempting to deploy a commit to the coral-xyz Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thanks for the PR! Honestly though, I'm not sure that As a compromise, is there some example in the |
I see, just thought to add cause saw quite some issues on discord and solana stack for the same. Can maybe point to multisig one of the multisig examples if thats okay? |
Can you share a link to the multisig example you're thinking of? |
This one anchor/ts/tests/src/spl/token.ts Line 80 in 4bef8c4
(Not explicitly implying the dynamic account part, but the multisig gives the context of the same which could be something to refer) |
hmm yeh, not much of an example in the multisig test tbh. If you wanted to add your program function + typescript test to the Minor nitpicks:
Reading this example even more, i'm not even sure the program function compiles or makes sense. It's bad practice to manually move lamports out of a program account that stores data on it. It'll be a lot cleaner once you just switch to transfering from the signing accounts and fix some of the nitpicks. Thanks! |
Hey thanks for the comments -
If you find it would be good to add in the tests section, I can make the changes and would be happy to add a working example there (for token/lamport transfer to dynamic accounts). Or can simply revise my example and put a blog for that :) |
It's up to yourself but if you cleaned it up a bit and added it as a test to |
On it, let me add the test |
Hi @Henry-E , any contributor guide of anchor? or for unit tests, can i just run the test/misc and push? |
This is the rough sequence of commands I call to run stuff locally when modifying However I don't think your tests rely on any core changes, so I think you can just do |
let me try , thanks ! |
Test working in private local anchor project. |
corrected cli error. |
I adjusted the program id to my localnet, How do i make the ci tests pass. Locally its passing in misc folder |
Sorry but i'm really not sure. Maybe let's just leave the PR for now. |
Created a section for remaining_accounts in the program-module.md
Added code example of distribution of lamports from PDA to dynamic number of accounts
(Useful to have in doc to highlight the feature of keeping number of accounts variable in solana through remaining_accounts which is otherwise difficult)
Let me know your suggestions on PR (any other place to add the code example if the current one doesn't look apt)