anchor icon indicating copy to clipboard operation
anchor copied to clipboard

Add support to close cpi accounts, such as TokenAccount

Open davoclavo opened this issue 4 years ago • 1 comments

Fixes #851

Changes:

  • Implement a new trait AccountClose so CPI Accounts can implement a custom close function
  • Add an Ours trait marker to be able to tag accounts generated by our program and provide a default AccountClose implementation
  • Embed that Ours trait 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!

davoclavo avatar Oct 21 '21 05:10 davoclavo

This would definitely be a nice feature to have!

Henry-E avatar Jul 20 '22 09:07 Henry-E

This is interesting, did the close constraint ever get support for CPI accounts, like TokenAccount. I have a feeling they did but not sure?

Henry-E avatar Nov 30 '22 16:11 Henry-E