Skip to content

Commit f0df400

Browse files
fix(native): fixed BTC fees rounding, correct decimal pad for custom fee
1 parent 098b206 commit f0df400

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

suite-native/transaction-management/src/components/fees/CustomFee/CustomFeeInputs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const CustomFeeInputs = ({ symbol }: CustomFeeInputsProps) => {
7070
name={feePerUnitFieldName}
7171
testID={`@transactionManagement/${feePerUnitFieldName}-input`}
7272
accessibilityLabel="address input"
73-
keyboardType="number-pad"
73+
keyboardType={networkType === 'bitcoin' ? 'decimal-pad' : 'number-pad'}
7474
rightIcon={<Text color="textSubdued">{feeUnits}</Text>}
7575
onChangeText={handleFieldChangeValue(feePerUnitFieldName, cryptoAmountTransformer)}
7676
/>

suite-native/transaction-management/src/components/fees/FeeOptionList/FeeOption.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ const valuesWrapperStyle = prepareNativeStyle(utils => ({
6262
const getFeePerUnit = ({
6363
networkType,
6464
feeLevel,
65-
transactionBytes,
6665
backendFeePerUnit = '0',
6766
}: {
6867
networkType: NetworkType;
6968
feeLevel: GeneralPrecomposedTransaction;
70-
transactionBytes: number;
7169
backendFeePerUnit: string;
7270
}): string => {
7371
if (!isFinalPrecomposedTransaction(feeLevel)) {
7472
return backendFeePerUnit;
7573
}
7674

7775
if (networkType === 'bitcoin') {
78-
return String(Math.round(Number(feeLevel.fee) / transactionBytes));
76+
return Number.isInteger(Number(feeLevel.feePerByte))
77+
? feeLevel.feePerByte
78+
: Number(feeLevel.feePerByte).toFixed(2);
7979
}
8080

8181
return feeLevel.feePerByte;
@@ -138,7 +138,6 @@ export const FeeOption = ({
138138
const feePerUnit = getFeePerUnit({
139139
networkType,
140140
feeLevel,
141-
transactionBytes,
142141
backendFeePerUnit: backendFeePerUnit ?? '0',
143142
});
144143

0 commit comments

Comments
 (0)