Got Error when send All balance from wallet,when i try send all sol balance using Phantom wallet its success, but when i try to send using solana/web3 i got this error : "failed to send transaction: Transaction simulation failed: Transaction results in an account (0) with insufficient funds for rent",
here mycode :
let tx = new Transaction({ feePayer: senderaddress.publicKey, recentBlockhash: (await sol_connection.getLatestBlockhash()).blockhash, }).add( SystemProgram.transfer({ fromPubkey: senderaddress.publicKey, toPubkey: new PublicKey(req.body.toaddress), lamports: req.body.amountSOL * LAMPORTS_PER_SOL - fees , }) ); let txhash = await sol_connection.sendTransaction(tx, [senderaddress]);