-
Notifications
You must be signed in to change notification settings - Fork 907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to calculate in advance the fee & rent? #979
Comments
You can use
|
Can rent pre-calculation be added as a feature request? |
@oleiba do you mean the rent charged every epoch? If so, yes we have an issue tracking this here: solana-labs/solana#7413 |
I mostly mean the rent to be charged immediately after receiving coins (e.g. for the first time) |
@oleiba would that be solved by knowing how much rent is charged in a single epoch? |
I would also need to know whether the specific receiving account is due to pay rent. |
@ryoqun is it possible that early on in an epoch, the receiving account might already exist but not be rent collected yet? Is it possible to compute that ahead of time? |
@jstarry Yeah, it's technically possible by checking @oleiba Thanks for developing with us. :) Normally, our rent fee is very small and normally rent aren't incurred, so this shouldn't be usually concern. Could you let us know the exact user story / system requirement for your wallet? Any Solana's system accounts with balance of larger than or equal to So, the rent concern is only for accounts with very low balance. Even if you want to care for the case, the transfer alone doesn't end here by itself. That's because rent is periodically collected (about Lastly, even if the account's pre rent could be reliably calculated using rpc, the rent calculation and actual transfer wouldn't be atomic at the moment. So, the destination account could be rent-collected by other activities just before your transaction with properly-rent-adjusted transfers, resulting in not exact amount of balance deltas in the block explorer page for your transfer transaction. Anyway, rent is a bit opaque to clients/users. That's true... But that's partly due to being so negligible as I explained for most of cases. I'm not that expert for UX, but I think if your user's accounts are expected to be with very small denomination (maybe, some micropayment?), you can pop-up friendly remainder that the destination account will slowly reduce its balance due to its rent collection. Also, it might be typo in your user transfer amount. To check that rent will be collected or not for the pop-up, we have aptly named For details: https://docs.solana.com/apps/rent |
The use case is simple. |
Thanks for sharing the clear use case. Yeah, your understanding of calculation of rent is correct. However, this is the case when the Vast majority of current transfers are ended up being rent-exempt.
Yeah, this might be useful if there are so many small-denominated transfers. I think we can support However, I'm afraid that due to relatively infrequent concern, the feature request might take some time to actually for us to get on it. If possible, could you share your idea? Why this is so much important, like basing on your customer's actual paying pattern, expected average transfer amount? |
@ryoqun agreed that |
Hi @oleiba, Thanks for your question! We want to make sure to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track issues that affect the development of the Solana JavaScript SDK itself. Questions like yours deserve a purpose-built Q&A forum. Unless there exists evidence that this is a bug with the Solana JavaScript SDK itself, please post your question to the Solana Stack Exchange using this link: https://solana.stackexchange.com/questions/ask This automated message is a result of having added the ‘question’ tag. |
Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up. |
For a transfer transaction (e.g. by using
SystemProgram.transfer
) I want to be able to calculate in advance the fee to be reduced from the sender's balance, together with the transfer amount itself.To highlight - I'm looking for a way to do it before the transaction is actually broadcast.
Also, I want to be able to calculate the rent to be reduced from the receiving account. I understand that paying rent depends on whether a receiving account is new or not - so I would like that to be included in the calculation.
How can these be done?
The text was updated successfully, but these errors were encountered: