Skip to content
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: add close empty spl-token accounts transaction #118

Merged
merged 14 commits into from
Jan 7, 2025

Conversation

thrishank
Copy link
Contributor

@thrishank thrishank commented Jan 2, 2025

Pull Request Description

Changes Made

This PR adds the following changes:

  • all the close instruction for empty token accounts
  • this instruction closes the token account and reclaim's the rent

Implementation Details

  • createCloseAccountInstruction from @solana/spl-token library to close the spl-token account

Transaction executed by agent

Screenshot 2025-01-04 at 11 22 20 PM

Example transaction:
transaction

Prompt Used

close my empty token accounts

Checklist

  • I have tested these changes locally
  • I have updated the documentation
  • I have added a transaction link
  • I have added the prompt used to test it

@@ -463,8 +470,15 @@ export class SolanaAgentKit {
async tensorListNFT(nftMint: PublicKey, price: number): Promise<string> {
return listNFTForSale(this, nftMint, price);
}

1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls remove.


const accountExceptions = [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", // USDT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think only USDC exception is fine since that's the prevalent stablecoin on Solana

@arihantbansal
Copy link
Member

Please pull latest changes from main and merge them. Also, run pnpm run lint:fix & pnpm run format.

@arihantbansal
Copy link
Member

@thrishank
Copy link
Contributor Author

@thearyanag @arihantbansal added the action file. This PR focuses on closing only empty ATA .
I’m considering building another tool that allows users to select specific tokens they want to get rid off, even if the accounts aren't empty. We can swap all this tokens to USDC(can take input from user) if there is a quote on jup or burn these tokens and reclaim the rent. This is similar to sol incinerator tokens feature. What do you guys think ?

@thearyanag thearyanag merged commit b57eb29 into sendaifun:main Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants