Skip to content

feat(cli): support recovering nested associated token accounts - #1384

Open
ink-splatters wants to merge 1 commit into
solana-program:mainfrom
ink-splatters:feat/cli/recover-nested
Open

feat(cli): support recovering nested associated token accounts#1384
ink-splatters wants to merge 1 commit into
solana-program:mainfrom
ink-splatters:feat/cli/recover-nested

Conversation

@ink-splatters

Copy link
Copy Markdown

Description

Add recover-nested CLI command that:

  • transfers the stranded balance into the user’s associated token account;
  • closes the nested account and returns its rent to the wallet owner.

The command invokes the existing instruction: RecoverNested of the Associated Token Account program.

Rationale

A sender can reuse the address of an associated token account which had been closed [e.g. to reclaim rent].

Some wallets treat such addresses as wallet owners and ask the Associated Token Account program to create another token account for the payment.

The resulting nested account is not listed under the recipient’s wallet, and recovering its balance currently requires custom code.

@ink-splatters
ink-splatters force-pushed the feat/cli/recover-nested branch 2 times, most recently from bae2799 to 05f38de Compare August 17, 2026 00:10
@ink-splatters
ink-splatters force-pushed the feat/cli/recover-nested branch 2 times, most recently from b59a5a6 to 558f180 Compare August 24, 2026 21:14
@ink-splatters
ink-splatters force-pushed the feat/cli/recover-nested branch from 558f180 to dde896a Compare August 29, 2026 09:38
@kimjune01

Copy link
Copy Markdown

recover-nested fails in the closed-owner-ATA case described by this PR. I closed the empty owner ATA before the CLI call, and the command failed with Provided owner is not allowed. The ATA processor said to recreate the owner ATA first.

The current test leaves that account open, and the command submits only the recover_nested instruction. In the same_mint case, the missing owner ATA is also the destination.

The closed-account setup should be covered by the test. The required ATA(s) should either be recreated by the command or documented as a prerequisite.

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.

2 participants