@@ -316,14 +316,33 @@ const BridgeComponent = () => {
316
316
}
317
317
318
318
const handleShow = ( ) => {
319
+ console . log ( 'Transfer value: ' , transferValue ) ;
319
320
if (
320
321
( txType === 'deposit' &&
321
322
new BigFloat ( transferValue , token . decimals ) . toBigInt ( ) > l1Balance ) ||
322
323
( txType === 'withdraw' && new BigFloat ( transferValue , token . decimals ) . toBigInt ( ) > l2Balance )
323
- )
324
+ ) {
324
325
toast . error ( "Input value can't be greater than balance!" ) ;
325
- else if ( ! transferValue ) toast . warn ( 'Input a value for transfer, please.' ) ;
326
- else if ( transferValue === 0 ) toast . warn ( "Input a value can't be zero." ) ;
326
+ return ;
327
+ }
328
+
329
+ if ( txType === 'deposit' &&
330
+ new BigFloat ( transferValue , token . decimals ) . toBigInt ( ) > new BigFloat ( '0.25 ' , token . decimals ) . toBigInt ( )
331
+ ) {
332
+ toast . error ( "Input value can't be greater than 0.25" ) ;
333
+ return ;
334
+ }
335
+
336
+ if ( ! transferValue ) {
337
+ toast . warn ( 'Input a value for transfer, please.' ) ;
338
+ return ;
339
+ }
340
+
341
+ if ( transferValue === '0' ) {
342
+ toast . warn ( "Input a value can't be zero." ) ;
343
+ return ;
344
+ }
345
+
327
346
setShow ( true ) ;
328
347
} ;
329
348
@@ -358,11 +377,11 @@ const BridgeComponent = () => {
358
377
. shadowRoot . getElementById ( 'inputValue' ) ;
359
378
if ( txType === 'deposit' ) {
360
379
inputElement . value = new BigFloat ( l1Balance , token . decimals ) . toFixed ( 4 ) ;
361
- setTransferValue ( l1Balance ) ;
380
+ setTransferValue ( ( new BigFloat ( l1Balance , token . decimals ) . toFixed ( 4 ) ) . toString ( ) ) ;
362
381
return ;
363
382
}
364
- inputElement . value = new BigFloat ( l2Balance , token . decimals ) . toFixed ( 4 ) ;
365
- setTransferValue ( l2Balance ) ;
383
+ inputElement . value = new BigFloat ( l2Balance , token . decimals ) . toFixed ( 4 ) ;
384
+ setTransferValue ( ( new BigFloat ( l2Balance , token . decimals ) . toFixed ( 4 ) ) . toString ( ) ) ;
366
385
} ;
367
386
368
387
return (
@@ -538,16 +557,10 @@ const BridgeComponent = () => {
538
557
</ div >
539
558
540
559
{ /* TRANSFER BUTTON */ }
541
- < div >
542
- { Number ( transferValue ) > 0 ? (
543
- < button type = "button" className = "transfer_button" onClick = { handleShow } >
544
- < p > Transfer</ p >
545
- </ button >
546
- ) : (
547
- < button type = "button" className = "transfer_button" >
548
- < p > Transfer</ p >
549
- </ button >
550
- ) }
560
+ < div >
561
+ < button type = "button" className = "transfer_button" onClick = { handleShow } >
562
+ < p > Transfer</ p >
563
+ </ button >
551
564
</ div >
552
565
</ div >
553
566
{ show && (
0 commit comments