@@ -40,6 +40,7 @@ export const feesFormValidationSchema = yup.object({
4040 customFeePerUnit : yup
4141 . string ( )
4242 . test ( 'too-many-decimals' , 'Too many decimals.' , function ( value ) {
43+ if ( ! value ) return true ;
4344 const { translate, ...context } = this . options . context as FeesFormContext ;
4445 if ( ! validateFeeDecimalLength ( value , context ) ) {
4546 return this . createError ( {
@@ -69,9 +70,10 @@ export const feesFormValidationSchema = yup.object({
6970 return true ;
7071 } )
7172 . test ( 'fee-too-high' , 'Fee is too high.' , function ( value ) {
73+ if ( ! value ) return true ;
7274 const { networkFeeInfo, translate } = this . options . context as FeesFormContext ;
7375
74- if ( ! value || ! networkFeeInfo ) return false ;
76+ if ( ! networkFeeInfo ) return false ;
7577
7678 const feeBig = new BigNumber ( value ) ;
7779 const { maxFee } = networkFeeInfo ;
@@ -92,6 +94,7 @@ export const feesFormValidationSchema = yup.object({
9294 'Value is too low.' ,
9395
9496 function ( value ) {
97+ if ( ! value ) return true ;
9598 const { symbol, minimalFeeLimit, translate } = this . options . context as FeesFormContext ;
9699
97100 if ( ! symbol ) return true ;
@@ -120,6 +123,8 @@ export const feesFormValidationSchema = yup.object({
120123 customMaxFeePerGas : yup
121124 . string ( )
122125 . test ( 'too-many-decimals' , 'Too many decimals.' , function ( value ) {
126+ if ( ! value ) return true ;
127+
123128 const { translate, ...context } = this . options . context as FeesFormContext ;
124129 if ( ! validateFeeDecimalLength ( value , context ) ) {
125130 return this . createError ( {
@@ -132,8 +137,11 @@ export const feesFormValidationSchema = yup.object({
132137 return true ;
133138 } )
134139 . test ( 'max-fee-per-gas-range' , 'Max fee per gas is out of range.' , function ( value ) {
135- const { translate, networkFeeInfo } = this . options . context as FeesFormContext ;
136- if ( ! value || ! networkFeeInfo ) return false ;
140+ if ( ! value ) return true ;
141+
142+ const { translate, networkFeeInfo, symbol } = this . options . context as FeesFormContext ;
143+
144+ if ( ! networkFeeInfo || ! symbol ) return false ;
137145
138146 const { maxFee, minFee } = networkFeeInfo ;
139147
0 commit comments