22 weiToEther ,
33 etherToWei ,
44 isFeeKey ,
5+ isMaxLiquidityKey ,
6+ validateMaxLiquidity ,
57 validateConfig ,
68 formatGeneralConfig ,
79 postConfig ,
@@ -49,7 +51,12 @@ const createInput = (section, key, value) => {
4951
5052 const label = document . createElement ( 'label' ) ;
5153 label . classList . add ( 'form-label' ) ;
52- label . textContent = key ;
54+ label . textContent = getDisplayLabel ( key ) ;
55+
56+ // Make Maximum Liquidity label bold
57+ if ( isMaxLiquidityKey ( key ) ) {
58+ label . style . fontWeight = 'bold' ;
59+ }
5360
5461 const inputContainer = document . createElement ( 'div' ) ;
5562 inputContainer . classList . add ( 'input-container' ) ;
@@ -139,8 +146,11 @@ const createFeeInput = (inputContainer, label, section, key, value) => {
139146 input . value = isFeeKey ( key ) ? weiToEther ( value ) : value ;
140147 input . addEventListener ( 'input' , ( ) => setChanged ( section . id ) ) ;
141148 inputContainer . appendChild ( input ) ;
142- const questionIcon = createQuestionIcon ( getTooltipText ( key ) ) ;
143- label . appendChild ( questionIcon ) ;
149+ // Skip tooltip for maxLiquidity
150+ if ( ! isMaxLiquidityKey ( key ) ) {
151+ const questionIcon = createQuestionIcon ( getTooltipText ( key ) ) ;
152+ label . appendChild ( questionIcon ) ;
153+ }
144154} ;
145155
146156const createFeePercentageInput = ( inputContainer , section , key , value ) => {
@@ -184,6 +194,13 @@ const createQuestionIcon = (tooltipText) => {
184194 return questionIcon ;
185195} ;
186196
197+ const getDisplayLabel = ( key ) => {
198+ const labels = {
199+ maxLiquidity : 'Maximum Liquidity'
200+ } ;
201+ return labels [ key ] || key ;
202+ } ;
203+
187204const getTooltipText = ( key ) => {
188205 const tooltips = {
189206 timeForDeposit : 'The time (in seconds) for which a deposit is considered valid.' ,
@@ -195,7 +212,8 @@ const getTooltipText = (key) => {
195212 expireBlocks : 'The number of blocks after which a quote is considered expired.' ,
196213 bridgeTransactionMin : 'The amount of rBTC that needs to be gathered in peg out refunds before executing a native peg out.' ,
197214 fixedFee : 'A fixed fee charged for transactions.' ,
198- feePercentage : 'A percentage fee charged based on the transaction amount.'
215+ feePercentage : 'A percentage fee charged based on the transaction amount.' ,
216+ maxLiquidity : 'The maximum liquidity (in rBTC) the provider is willing to offer. Must be a positive value with up to 18 decimal places.'
199217 } ;
200218 return tooltips [ key ] || 'No description available' ;
201219} ;
@@ -472,7 +490,20 @@ function getRegularConfig(sectionId) {
472490 value = '0' ;
473491 }
474492 } else {
475- if ( isFeeKey ( key ) ) {
493+ if ( isMaxLiquidityKey ( key ) ) {
494+ // Validate maxLiquidity: must be positive and max 18 decimal places
495+ const validation = validateMaxLiquidity ( input . value ) ;
496+ if ( ! validation . isValid ) {
497+ showErrorToast ( `"${ sectionId } ": ${ validation . error } ` ) ;
498+ throw new Error ( validation . error ) ;
499+ }
500+ try {
501+ value = etherToWei ( input . value ) . toString ( ) ;
502+ } catch ( error ) {
503+ showErrorToast ( `"${ sectionId } ": Invalid input "${ input . value } " for field "${ key } ". Please enter a valid number.` ) ;
504+ throw error ;
505+ }
506+ } else if ( isFeeKey ( key ) ) {
476507 try {
477508 value = etherToWei ( input . value ) . toString ( ) ;
478509 } catch ( error ) {
0 commit comments