skynetcap/solanaj

Unable to Close Native SOL Accounts and Reclaim Rent-Exempt Balance

Opened this issue · 0 comments

When using the solanaj library (version 1.19.2) to manage native SOL accounts, it appears there is no available method to fully close these accounts and reclaim the rent-exempt balance. This limitation means that, even when attempting to transfer the full balance, a small rent-exempt amount remains locked in the account, which cannot be retrieved or released.

There should be a way to close native SOL accounts in solanaj, similar to the closeAccount functionality available for SPL token accounts. Ideally, this would allow the remaining lamports, including the rent-exempt reserve, to be transferred out, fully emptying and "closing" the account.

Currently, the library lacks any mechanism to reclaim the rent-exempt balance for native SOL accounts. After attempting to transfer all lamports from the account, the rent-exempt balance remains, effectively leaving the account in a "locked" state on the blockchain with an irretrievable minimum balance.

Library Version: 1.19.2
Java Version: 21

A method similar to closeAccount for SPL token accounts must be implemented, allowing native SOL accounts to be closed and for the rent-exempt balance to be reclaimed. If Solana itself does not support closing native accounts directly, consider adding documentation or guidance to clarify this limitation.

Additional Notes: This issue restricts applications that manage SOL accounts from fully reclaiming funds tied up in inactive accounts, leading to inefficiencies when managing a large number of wallets.