Skip to content

feat(sdk-coin-sol): add ATA closure support for Solana wallets#8582

Merged
abhijeet8986 merged 1 commit intomasterfrom
CHALO-174-sol-close-ata-support
Apr 24, 2026
Merged

feat(sdk-coin-sol): add ATA closure support for Solana wallets#8582
abhijeet8986 merged 1 commit intomasterfrom
CHALO-174-sol-close-ata-support

Conversation

@abhijeet8986
Copy link
Copy Markdown
Contributor

@abhijeet8986 abhijeet8986 commented Apr 21, 2026

Summary

  • CloseAtaBuilder: Bulk close via addCloseAtaInstruction(); legacy single-ATA setters unchanged. Cannot mix the two APIs (prevents corrupting _closeAtaEntries). Parsed txs repopulate entries without locking API mode.

  • getTransactionType: Any close-ATA instruction → CloseAssociatedTokenAccount (Phase 1: no transfer+close in same tx).

  • Sol.verifyCloseAtaTransaction: Every close instruction’s destinationAddress must equal wallet root; skips if root is missing. Hooked from verifyTransaction when tx type is close-ATA.

  • Wallet: prebuildTransactionTxRequests case closeAssociatedTokenAccount → prebuildTxWithIntent({ intentType: 'closeAssociatedTokenAccount', recipients, memo }) — aligned with public-types; no ataAddresses.

    Test plan

  • Unit: closeAtaBuilder (single, bulk, validation, API-mix errors, raw round-trip, fixture).

  • Manual: prebuildAndSignTransaction with type: 'closeAssociatedTokenAccount' and recipients (zero amounts) on testnet.

    Linear: CHALO-174

@linear
Copy link
Copy Markdown

linear Bot commented Apr 21, 2026

@abhijeet8986 abhijeet8986 force-pushed the CHALO-174-sol-close-ata-support branch 2 times, most recently from c773490 to 65efc72 Compare April 21, 2026 07:16
@abhijeet8986
Copy link
Copy Markdown
Contributor Author

@claude review

@abhijeet8986 abhijeet8986 marked this pull request as ready for review April 21, 2026 12:09
@abhijeet8986 abhijeet8986 requested review from a team as code owners April 21, 2026 12:09
Copy link
Copy Markdown
Contributor

@zahin-mohammad zahin-mohammad left a comment

Choose a reason for hiding this comment

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

Will discuss on slack.

@abhijeet8986 abhijeet8986 marked this pull request as draft April 21, 2026 12:29
@abhijeet8986 abhijeet8986 force-pushed the CHALO-174-sol-close-ata-support branch from 65efc72 to e7f136e Compare April 21, 2026 12:45
@abhijeet8986 abhijeet8986 marked this pull request as ready for review April 22, 2026 06:20
Copy link
Copy Markdown
Contributor

@zahin-mohammad zahin-mohammad left a comment

Choose a reason for hiding this comment

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

This approach is better then before, but I think we can take it further!

Comment thread modules/sdk-core/src/bitgo/baseCoin/iBaseCoin.ts Outdated
Comment thread modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts Outdated
Comment thread modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts Outdated
Comment thread modules/sdk-core/src/bitgo/wallet/iWallet.ts Outdated
@abhijeet8986 abhijeet8986 force-pushed the CHALO-174-sol-close-ata-support branch 3 times, most recently from f405493 to 1865880 Compare April 23, 2026 10:22
zahin-mohammad
zahin-mohammad previously approved these changes Apr 23, 2026
Copy link
Copy Markdown
Contributor

@zahin-mohammad zahin-mohammad left a comment

Choose a reason for hiding this comment

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

much better, thank you!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Solana Associated Token Account (ATA) closure support, including bulk close transactions and transaction verification/type detection.

Changes:

  • Extends CloseAtaBuilder to support multiple close-ATA instructions in a single transaction.
  • Adds Sol coin verification to enforce close-ATA rent destinations match the wallet root address.
  • Updates Sol transaction type detection to classify close-ATA transactions, and adds unit tests for single/bulk close flows.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
modules/sdk-core/src/bitgo/wallet/wallet.ts Adds a new prebuildTxWithIntent switch case for close-ATA prebuilds.
modules/sdk-coin-sol/src/lib/closeAtaBuilder.ts Refactors builder to support single + bulk close-ATA instruction construction.
modules/sdk-coin-sol/src/sol.ts Adds close-ATA verification logic during verifyTransaction().
modules/sdk-coin-sol/src/lib/utils.ts Updates Sol tx type detection to recognize close-ATA transactions.
modules/sdk-coin-sol/test/unit/transactionBuilder/closeAtaBuilder.ts Adds comprehensive unit tests for single/bulk close-ATA builder behavior and parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread modules/sdk-core/src/bitgo/wallet/wallet.ts
Comment thread modules/sdk-coin-sol/src/lib/utils.ts
Comment thread modules/sdk-coin-sol/src/sol.ts Outdated
Comment thread modules/sdk-coin-sol/src/lib/closeAtaBuilder.ts
Comment thread modules/sdk-coin-sol/src/lib/closeAtaBuilder.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread modules/sdk-coin-sol/src/lib/closeAtaBuilder.ts
Comment thread modules/sdk-coin-sol/src/sol.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread modules/sdk-coin-sol/src/sol.ts
Comment thread modules/sdk-coin-sol/src/sol.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@abhijeet8986 abhijeet8986 merged commit 05f7289 into master Apr 24, 2026
26 checks passed
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.

4 participants