fix(sdk-coin-sol): support Token-2022 close ATA - #9667
Conversation
|
|
|
@claude review this PR |
|
Claude finished @ArunBala-Bitgo's task —— View job PR Review for Token-2022 Close ATA SupportReviewing PR #9667: Support for specifying SPL token program in ATA close operations Todo List:
Code Review SummaryThis PR successfully adds support for specifying custom SPL token programs (like Token-2022) when closing associated token accounts. The implementation is well-structured and maintains backward compatibility. Strengths ✅1. Clean Architecture & API Design
2. Robust Implementation
3. Good Test Coverage
4. Type Safety & Documentation
Areas for Improvement 🔍1. Minor: Method Name ConsistencyThe new 2. Minor: Error Message EnhancementThe validation in 3. Optimization: Conditional Spread UsageThe conditional spread operators are used correctly ( Technical Correctness ✅1. Proper SPL Token Program Handling
2. State Management
3. Instruction Building
Security Considerations ✅
Performance Impact ✅
Test Quality ✅The test coverage effectively validates:
Final Recommendation: APPROVE ✅This is a well-implemented enhancement that:
The implementation correctly enables BitGoJS users to close Token-2022 ATAs while preserving all existing functionality for legacy SPL token accounts. Branch: CHALO-1417-close-ata-flow |
Ticket: CHALO-1417
This pull request enhances the Solana SDK's handling of closing associated token accounts (ATAs) by adding support for specifying a custom SPL token program (such as Token-2022) in both single and bulk close operations. It updates the builder, instruction factories, and related interfaces to allow for this flexibility and adds corresponding tests to ensure correct behavior.
Support for specifying SPL token program in ATA close operations:
The
CloseAtaBuilderclass and related interfaces now accept an optionalprogramIdparameter, allowing users to specify which SPL token program (legacy or Token-2022) should be used when closing ATAs. This applies to both single and bulk close scenarios. [1] [2] [3] [4] [5]The
closeATAInstructionfunction now uses the providedprogramId(if any) to determine which SPL token program to use for the close instruction, defaulting to the legacy program if not specified.Instruction parsing and serialization improvements:
instructionParamsFactory.ts) are updated to extract and serialize theprogramIdwhen present, ensuring correct round-trip handling of instructions involving Token-2022 or other SPL token programs. [1] [2] [3] [4]Expanded test coverage:
These changes make the SDK more robust and future-proof by supporting multiple SPL token programs for ATA management.