Open enddynayn opened 5 months ago
There was an alternative to the 2nd checkbox suggested by @harry-evans, which I also prefer: an RPC call for asking what your maximum allowable stake is (which is free), and then requiring you to submit a value that will work. To me the Issue as written is just slightly less of a surprise than before, and can still leave you with no token left for transaction fees.
Of course, one can check an account balance but IMO it would be more helpful to app developers to provide an endpoint that lets you ask what you can stake instead of having them query (or worse, store it and risk it going out of date) what the minimum stake is, get an estimate of transaction fee and then query their balance and do the math client side. Instead it's just two calls. It simplifies the stake
extrinsic logic, nobody is surprised by the result, and nobody has to field support calls why it doesn't stake the amount they asked for.
When a user attempts to stake more than their available balance, an error is thrown, and no amount is staked. Example: Balance: 10, Stake: 11. Nothing is staked, and an error is thrown.
When a user attempts to stake an amount that is within the range of their balance minus the minimum required for unstaking, the system stakes the maximum allowable amount while leaving the minimum balance untouched. Example: Balance: 10, Minimum: 1, Stake: 9.5. The actual amount staked is 9, leaving the minimum balance of 1.
First Checkbox: Throwing an error
and don't do this part of itOnly do the first First Checkbox: Throwing an error
for now.
When a user attempts to stake more than their available balance, an error is thrown, and no amount is staked. Example: Balance: 10, Stake: 11. Nothing is staked, and an error is thrown.
Description Currently, when a user attempts to stake an amount greater than their total account balance, the system stakes the entire balance minus a minimum amount required for unstaking. This behavior can confuse users who expect an error instead of staking the whole amount.
Acceptance Criteria
~When a user attempts to stake an amount that is within the range of their balance minus the minimum required for unstaking, the system stakes the maximum allowable amount while leaving the minimum balance untouched. Example: Balance: 10, Minimum: 1, Stake: 9.5. The actual amount staked is 9, leaving the minimum balance of 1.~