Wallet cleaning
Cleaning a wallet, means extracting its hidden solana.
So, where exactly is this hidden solana?
Token accounts
For each token a wallet holds, it has to have an assosiated token account. There is a fee to create one. However, by closing it, the payed SOL can be redeemed. This is essentially what the tool does - closes token accounts.
There are 3 possibilities for any token account in a wallet when cleaning: exchange for sol, burn, leave untouched.
Exchanging token accounts
The tool checks every token's price on the market with Jupiter
If the expected solana profit for exchanging the token is greater than the profit expected from burning the account, the tool will attempt to exchange the token by doing the Jupiter's proposed transaction.
Burning a token account
The only way to redeem a token account's solana is to close it. That is only possible when the account does not hold any tokens.
If a token is worthless, or its worth is too little, the token is burned and the account is closed. Thus still redeeming some solana from token account, even if its tokens are worthless on the market
Liquidity pool tokens
Liquidity pool tokens are also stored in token accounts. The tool currently attempts to ignore those accounts.
Liquidity pool tokens usually do not have metadata. The tool checks the token's metadata, and if it does not have any, the tool assumes it is a liquidity pool token. Then it simply leaves the token account and does not burn any tokens.
In the future, the tool will exchange/check Raydium liquidity pool tokens too, but for now, this functionality is yet not implemented.