dfinity / nns-dapp

The Dapp of the Internet Computer's Network Nervous System.
https://nns.ic0.app/
Other
112 stars 38 forks source link

Load minimum stake when staking from staking table #5413

Closed dskloetd closed 1 month ago

dskloetd commented 1 month ago

Motivation

In https://github.com/dfinity/nns-dapp/pull/5339 we added the staking button to the staking table. This opens the SNS staking modal via a different code path, which didn't load the SNS parameters. This meant that the minimum neuron stake wasn't available. Instead of requiring the minimum stake to be available, the SnsStakeNeuronModal component happily ignores this and allows the user to try staking any amount. But if the amount it too small, claiming the neuron after transferring the tokens fails.

This PR makes sure the parameters are loaded. We should additionally fix SnsStakeNeuronModal to require the minimum stake to be present but that will be a separate PR.

Changes

Make sure the SNS parameters (which include the minimum stake) are loaded before opening the SnsStakeNeuronModal from the Staking page.

Tests

  1. Unit test added.
  2. Tested manually.
  3. Also tested that staking ICP was not affected and already enforced the minimum stake.

Todos