Skip to content

Commit

Permalink
Validate Stake amount in frontend with human-readable error
Browse files Browse the repository at this point in the history
  • Loading branch information
JSKitty committed Dec 15, 2024
1 parent 72d1d47 commit 982dc64
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/stake/Stake.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ParsedSecret } from '../parsed_secret.js';
import { storeToRefs } from 'pinia';
import { ALERTS } from '../i18n';
import { useAlerts } from '../composables/use_alerts.js';
import { validateAmount } from '../legacy.js';
const { createAlert } = useAlerts();
const wallet = useWallet();
const { balance, coldBalance, price, currency, isViewOnly } =
Expand Down Expand Up @@ -52,6 +53,11 @@ watch(coldStakingAddress, async (coldStakingAddress) => {
await db.updateAccount(cAccount, true);
});
async function stake(value, ownerAddress) {
// Ensure the stake value meets the minimum delegation size
if (!validateAmount(value, COIN)) {
return;
}
// Don't allow attempts to stake using Ledger
if (wallet.isHardwareWallet) {
createAlert('warning', ALERTS.STAKING_LEDGER_NO_SUPPORT, 5000);
Expand Down

0 comments on commit 982dc64

Please sign in to comment.