anchor
anchor copied to clipboard
Add support to close cpi accounts, such as TokenAccount
Fixes #851
Changes:
- Implement a new trait
AccountCloseso CPI Accounts can implement a custom close function - Add an
Ourstrait marker to be able to tag accounts generated by our program and provide a defaultAccountCloseimplementation - Embed that
Ourstrait into the codegen for accounts - Add unit test to be make sure we are able to close a TokenAccount
Shoutout to @cqfd for the assistance!
This would definitely be a nice feature to have!
This is interesting, did the close constraint ever get support for CPI accounts, like TokenAccount. I have a feeling they did but not sure?