-
Notifications
You must be signed in to change notification settings - Fork 244
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
Expose state stake and account balance breakdown #298
Comments
One way to do this is to add this getAccountBalance function to the
Originally posted by @vgrichina in near/near-wallet#534 (comment) Should return a
Or add the above |
Note that there is generally no changes needed in near-api-js to get info from experimental endpoints.
|
@kcole16 for regular users state stake is usually quite small (something like 0.01), do you think it is still good to display that? |
@bowenwang1996 We're planning to display as "minimum balance". The total balance will be displayed in most places by default, and spendable will be highlighted on TX and "Send Money" pages. |
Add account balance to account state (#298)
Overview
We currently do not expose an account's complete balance breakdown, specifically the "state stake". This is necessary to compute the account's spendable balance.
Both the Wallet and Explorer need to retrieve and display the state stake amount, and it's likely app devs will want the same data (so they can determine if users have a sufficient NEAR balance for a TX).
account/<account_id>
RPC exampleThe spendable balance =
amount
-state_stake
The state stake can be calculated from
storage_usage * storage_amount_per_byte
.cost_per_byte
can be retrieved from RPC method = EXPERIMENTAL_genesis_config which exposesruntime_config.storage_amount_per_byte
cc @Patrick1904 @vgrichina
The text was updated successfully, but these errors were encountered: