How are platforms like phantom wallet able to withdraw 100% of the sol balance
How are platforms like phantom wallet able to withdraw 100% of the sol balance
Loading saved threads...
A1exey · External communityPost link
External question — Solana Stack Exchange
Author: A1exey
Original post: https://solana.stackexchange.com/questions/23014
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I understand the following:
There is a 'minimum rent' amount for every solana wallet, however different platforms are somehow able to let me transfer 100% of the sol amount to another wallet.
I'm doing this in node js, and my attempts have been:
Set higher compute lamports
Decrease the lamport amount from transaction fees (-5000 lamports)
The only method that works is subtracting around -900,000 lamports which seems to be the rent amount as a minimum
If someone is able to show me a relevant piece of documentation / an extract of node js code showing how its meant to be done correctly to achieve:
Being able to transfer the entire SOL balance of a wallet to another wallet.
Error for reference:
Transaction simulation failed: Transaction results in an account (0) with insufficient funds for rent
Quote
Report
Jon C · External communityPost link
External answer — Solana Stack Exchange
Author: Jon C
Original post: https://solana.stackexchange.com/a/23135
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
You can certainly transfer everything out of a wallet, but as you've noticed, you need to get the right value, because the wallet will be charged for transaction fees and priority fees.
This can be a tricky problem, so your best bet might be to use
getFeesForMessage
with your transaction, and then subtract that amount from the total balance in the wallet.
Quote
Report
Post Reply
Checking account access…