@@ -31,15 +31,18 @@ type Props = {
3131 } ,
3232 onContinue : ( amount : bigint ) => void ,
3333 hasInsufficientFees : boolean ,
34+ value : string ,
35+ onValueChange : ( value : string ) => void ,
3436} ;
3537
36- const SelectAmountPage = ( { onContinue, token, hasInsufficientFees } : Props ) => {
38+ const SelectAmountPage = ( { onContinue, token, hasInsufficientFees, value , onValueChange } : Props ) => {
3739 const { address } = useWallet ( ) ;
3840 const chainConfig = useChain ( ) ;
3941
40- const [ value , setValue ] = useState ( '' ) ;
4142 const [ isExceedingBalance , setIsExceedingBalance ] = useState ( false ) ;
4243
44+ const amount = token . decimals ? fromDecimals ( value , token . decimals ) : 0n ;
45+
4346 const { fees, totalFee, isLoading } = useShielderFees ( { token, operation : 'send' } ) ;
4447
4548 const {
@@ -56,7 +59,6 @@ const SelectAmountPage = ({ onContinue, token, hasInsufficientFees }: Props) =>
5659 return result > 0n ? result : 0n ;
5760 } , [ token , totalFee ] ) ;
5861
59- const amount = token . decimals ? fromDecimals ( value , token . decimals ) : 0n ;
6062 const hasNotSelectedAmount = amount <= 0n ;
6163 const isButtonDisabled = hasNotSelectedAmount || isExceedingBalance || hasInsufficientFees ;
6264
@@ -80,7 +82,7 @@ const SelectAmountPage = ({ onContinue, token, hasInsufficientFees }: Props) =>
8082 maxAmount = { maxAmountToSend }
8183 token = { token }
8284 effectiveAssetValue = { value }
83- onAssetValueChange = { setValue }
85+ onAssetValueChange = { onValueChange }
8486 accountAddress = { address }
8587 onAssetBalanceExceeded = { setIsExceedingBalance }
8688 />
0 commit comments