@@ -136,7 +136,10 @@ const createFeeInput = (inputContainer, label, section, key, value) => {
136136
137137const createFeePercentageInput = ( inputContainer , section , key , value ) => {
138138 const input = document . createElement ( 'input' ) ;
139- input . type = 'text' ;
139+ input . type = 'number' ;
140+ input . min = '0' ;
141+ input . max = '100' ;
142+ input . step = 'any' ;
140143 input . style . width = '40%' ;
141144 input . classList . add ( 'form-control' ) ;
142145 input . dataset . key = key ;
@@ -389,7 +392,7 @@ function checkFeeWarnings() {
389392 const existingToast = document . getElementById ( 'warningToast' ) ;
390393 if ( shouldWarn ) {
391394 if ( ! existingToast ) {
392- showWarningToast ( 'You have configured a zero-fee setting. This means you won’ t earn fees from bridging transactions.' ) ;
395+ showWarningToast ( 'You have configured a zero-fee setting. This means you won\' t earn fees from bridging transactions.' ) ;
393396 } else {
394397 bootstrap . Toast . getOrCreateInstance ( existingToast ) . show ( ) ;
395398 }
@@ -464,13 +467,21 @@ function getRegularConfig(sectionId) {
464467 try {
465468 value = etherToWei ( input . value ) . toString ( ) ;
466469 } catch ( error ) {
467- showErrorToast ( `Invalid input "${ input . value } " for field "${ key } ". Please enter a valid number.` ) ;
470+ showErrorToast ( `" ${ sectionId } ": Invalid input "${ input . value } " for field "${ key } ". Please enter a valid number.` ) ;
468471 throw error ;
469472 }
470473 } else if ( isfeePercentageKey ( key ) ) {
471474 value = parseFloat ( input . value . trim ( ) ) ;
472475 if ( isNaN ( value ) ) {
473- showErrorToast ( `Invalid input "${ input . value } " for feePercentage. Please enter a valid number.` ) ;
476+ showErrorToast ( `"${ sectionId } ": Invalid percentage entered "${ input . value } ". Please provide a valid value between 0% and 100%.` ) ;
477+ throw new Error ( 'Invalid feePercentage' ) ;
478+ }
479+ if ( value < 0 ) {
480+ showErrorToast ( `"${ sectionId } ": Fee percentage cannot be negative. Please enter a value between 0% and 100%.` ) ;
481+ throw new Error ( 'Invalid feePercentage' ) ;
482+ }
483+ if ( value > 100 ) {
484+ showErrorToast ( `"${ sectionId } ": Fee percentage cannot exceed 100%. Please enter a value between 0% and 100%.` ) ;
474485 throw new Error ( 'Invalid feePercentage' ) ;
475486 }
476487 } else {
0 commit comments