@@ -4,7 +4,7 @@ import { G } from '@mobily/ts-belt';
44
55import { NetworkSymbol , getNetworkType } from '@suite-common/wallet-config' ;
66import { FeesRootState , selectConvertedNetworkFeeInfo } from '@suite-common/wallet-core' ;
7- import { getFeeUnits } from '@suite-common/wallet-utils' ;
7+ import { getFeeUnits , isEip1559 } from '@suite-common/wallet-utils' ;
88import { Hint , Text , VStack } from '@suite-native/atoms' ;
99import { TextInputField , useFormContext } from '@suite-native/forms' ;
1010import { integerTransformer , useAmountInputTransformers } from '@suite-native/helpers' ;
@@ -32,11 +32,14 @@ export const CustomFeeInputs = ({ symbol }: CustomFeeInputsProps) => {
3232
3333 const customFeeLimitName = 'customFeeLimit' ;
3434 const feePerUnitFieldName = 'customFeePerUnit' ;
35+ const maxFeePerGasFieldName = 'customMaxFeePerGas' ;
36+ const maxPriorityFeePerGasFieldName = 'customMaxPriorityFeePerGas' ;
3537 const hasFeePerByteError = G . isNotNullable ( errors [ feePerUnitFieldName ] ) ;
3638
3739 const networkType = getNetworkType ( symbol ) ;
3840 const feeUnits = getFeeUnits ( networkType ) ;
3941 const formattedFeePerUnit = `${ feeInfo ?. minFee } ${ feeUnits } ` ;
42+ const isEip1559Fee = networkType === 'ethereum' && isEip1559 ( feeInfo ?. levels [ 0 ] ) ;
4043
4144 const handleFieldChangeValue =
4245 ( fieldName : keyof FeesFormValues , transformer : ( value : string ) => string ) =>
@@ -61,19 +64,57 @@ export const CustomFeeInputs = ({ symbol }: CustomFeeInputsProps) => {
6164 onChangeText = { handleFieldChangeValue ( customFeeLimitName , integerTransformer ) }
6265 />
6366 ) }
64- < TextInputField
65- label = {
66- networkType === 'ethereum'
67- ? translate ( 'transactionManagement.fees.custom.bottomSheet.label.gasPrice' )
68- : translate ( 'transactionManagement.fees.custom.bottomSheet.label.feeRate' )
69- }
70- name = { feePerUnitFieldName }
71- testID = { `@transactionManagement/${ feePerUnitFieldName } -input` }
72- accessibilityLabel = "address input"
73- keyboardType = { networkType === 'bitcoin' ? 'decimal-pad' : 'number-pad' }
74- rightIcon = { < Text color = "textSubdued" > { feeUnits } </ Text > }
75- onChangeText = { handleFieldChangeValue ( feePerUnitFieldName , cryptoAmountTransformer ) }
76- />
67+ { isEip1559Fee ? (
68+ < >
69+ < TextInputField
70+ label = { translate (
71+ 'transactionManagement.fees.custom.bottomSheet.label.maxFeePerGas' ,
72+ ) }
73+ name = { maxFeePerGasFieldName }
74+ testID = { `@transactionManagement/${ maxFeePerGasFieldName } -input` }
75+ accessibilityLabel = "address input"
76+ keyboardType = "number-pad"
77+ onChangeText = { handleFieldChangeValue (
78+ maxFeePerGasFieldName ,
79+ integerTransformer ,
80+ ) }
81+ />
82+ < TextInputField
83+ label = { translate (
84+ 'transactionManagement.fees.custom.bottomSheet.label.maxPriorityFeePerGas' ,
85+ ) }
86+ name = { maxPriorityFeePerGasFieldName }
87+ testID = { `@transactionManagement/${ maxPriorityFeePerGasFieldName } -input` }
88+ accessibilityLabel = "address input"
89+ keyboardType = "number-pad"
90+ onChangeText = { handleFieldChangeValue (
91+ maxPriorityFeePerGasFieldName ,
92+ integerTransformer ,
93+ ) }
94+ />
95+ </ >
96+ ) : (
97+ < TextInputField
98+ label = {
99+ networkType === 'ethereum'
100+ ? translate (
101+ 'transactionManagement.fees.custom.bottomSheet.label.gasPrice' ,
102+ )
103+ : translate (
104+ 'transactionManagement.fees.custom.bottomSheet.label.feeRate' ,
105+ )
106+ }
107+ name = { feePerUnitFieldName }
108+ testID = { `@transactionManagement/${ feePerUnitFieldName } -input` }
109+ accessibilityLabel = "address input"
110+ keyboardType = { networkType === 'bitcoin' ? 'decimal-pad' : 'number-pad' }
111+ rightIcon = { < Text color = "textSubdued" > { feeUnits } </ Text > }
112+ onChangeText = { handleFieldChangeValue (
113+ feePerUnitFieldName ,
114+ cryptoAmountTransformer ,
115+ ) }
116+ />
117+ ) }
77118 { networkType !== 'ethereum' && ! hasFeePerByteError && (
78119 < Hint variant = "info" >
79120 < Translation
0 commit comments