帮助用户关闭无用的 Solana 账户并回收租金。技术简单但解决了真实痛点。
ClaimYourSOL 帮助用户关闭无用的 Solana 账户并回收租金(SOL)。
在 Solana 上,每个 Token Account 创建时都需要锁定一定 SOL 作为租金。交易完成后如果不主动关闭这些账户,锁定的 SOL 就无法回收。
部分平台(如 ME)会自动关闭空 Token Account,但部分不会。
| 概念 | 说明 |
|---|---|
| Account | Solana 链上的存储区域 |
| Rent | 存储数据需支付的租金 |
| Rent Exempt | 持有超过 2 年租金则免租(SOL 被锁定) |
| Token Account | 存储特定 SPL Token 的账户 |
// 获取用户所有 Token 账户
const parsedTokenAccounts = await connection.getParsedTokenAccountsByOwner(
new PublicKey(walletAddress),
{ programId: new PublicKey(TOKEN_PROGRAM_ID) }
);
// 筛选余额为 0 的空账户
const emptyTokenAccounts = parsedTokenAccounts.value.filter(
accountInfo => accountInfo.account.data.parsed.info.tokenAmount.amount === '0'
);const totalRent = emptyTokenAccounts.reduce(
(total, item) => total + item.account.lamports, 0
);
console.log(`可回收: ${totalRent / 1e9} SOL`);for (const accountInfo of emptyTokenAccounts) {
const closeAccountInstruction = createCloseAccountInstruction(
accountInfo.pubkey, // 要关闭的账户
feePayer, // 接收余额的账户
feePayer, // 关闭权限
);
transaction.add(closeAccountInstruction);
}| 项目 | 比例 |
|---|---|
| 用户收到 | 80% |
| 平台抽成 | 20% |
| 邀请返佣 | 平台抽成的 20%(即总额的 4%) |