diff --git a/src/app/user/Stake/StakeInput.tsx b/src/app/user/Stake/StakeInput.tsx index 5dd89a68..74bcaf55 100644 --- a/src/app/user/Stake/StakeInput.tsx +++ b/src/app/user/Stake/StakeInput.tsx @@ -17,6 +17,7 @@ export const StakeInput = ({ onChange, value, symbol = 'RIF', labelText }: Props value={value} name="amount-stake" fullWidth + inputProps={{ decimalScale: 18 }} /> ) } diff --git a/src/app/user/Stake/Steps/StepOne.tsx b/src/app/user/Stake/Steps/StepOne.tsx index 72b2cd85..ba771fb3 100644 --- a/src/app/user/Stake/Steps/StepOne.tsx +++ b/src/app/user/Stake/Steps/StepOne.tsx @@ -20,12 +20,11 @@ export const StepOne = ({ onGoNext = () => {} }: StepProps) => { (value: string) => { if (!value || value === '.') { onAmountChange('0') - return - } - - const regex = /^\d*\.?\d{0,8}$/ - if (regex.test(value)) { - onAmountChange(value) + } else { + const regex = /^\d*\.?\d{0,18}$/ + if (regex.test(value)) { + onAmountChange(value) + } } }, [onAmountChange], @@ -45,7 +44,7 @@ export const StepOne = ({ onGoNext = () => {} }: StepProps) => { // For other percentages, calculate with precision const rawAmount = Number(balance) * (percentage / 100) - const displayAmount = rawAmount.toFixed(8) + const displayAmount = rawAmount.toString() onAmountChange(displayAmount) }, [tokenToSend.balance, onAmountChange],