fix: resolve solana rent exempt simulation error when sweeping native full balances
This commit is contained in:
@@ -264,9 +264,11 @@ export class CryptoEngine {
|
||||
const destPubKey = new PublicKey(destinationAddress);
|
||||
|
||||
if (tokenSymbol === 'SOL' || tokenSymbol === 'NATIVE') {
|
||||
// Get balance and send almost all (leave 5000 lamports for rent)
|
||||
// Get balance and send almost all (leave exactly 0 to avoid rent-exempt errors)
|
||||
// A standard Solana signature costs exactly 5000 lamports
|
||||
const balance = await this.solConnection.getBalance(senderKeypair.publicKey);
|
||||
const sendAmount = balance - 10000; // leave 0.00001 SOL for fees
|
||||
const fee = 5000;
|
||||
const sendAmount = balance - fee;
|
||||
|
||||
if (sendAmount <= 0) {
|
||||
return { success: false, txHash: null, error: 'Insufficient SOL balance' };
|
||||
|
||||
Reference in New Issue
Block a user