Skip to content

Commit

Permalink
feat(suite): use min fee for bump evm chain fee
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasklim committed Dec 29, 2024
1 parent 1afa35b commit 7e08d1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions packages/suite/src/components/wallet/Fees/CustomFee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,13 @@ export const CustomFee = <TFieldValues extends FormState>({
except: networkType !== 'ethereum',
}),
range: (value: string) => {
const feeBig = new BigNumber(value);
if (feeBig.isGreaterThan(maxFee) || feeBig.isLessThan(minFee)) {
return translationString('CUSTOM_FEE_NOT_IN_RANGE', { minFee, maxFee });
const customFee = new BigNumber(value);

if (customFee.isGreaterThan(maxFee) || customFee.isLessThan(minFee)) {
return translationString('CUSTOM_FEE_NOT_IN_RANGE', {
minFee: new BigNumber(minFee).toString(),
maxFee: new BigNumber(maxFee).toString(),
});
}
},
},
Expand Down
6 changes: 3 additions & 3 deletions packages/suite/src/hooks/wallet/useRbfForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const getEthereumFeeInfo = (info: FeeInfo, gasPrice: string) => {
const minFeeFromNetwork = new BigNumber(feeInfo.levels[0].feePerUnit);

const getFee = () => {
if (minFeeFromNetwork.lte(current.plus(1))) {
return current.plus(1);
if (minFeeFromNetwork.lte(current.plus(feeInfo.minFee))) {
return current.plus(feeInfo.minFee);
}

return minFeeFromNetwork;
Expand All @@ -72,7 +72,7 @@ const getEthereumFeeInfo = (info: FeeInfo, gasPrice: string) => {
return {
...feeInfo,
levels,
minFee: current.plus(1).toNumber(), // increase required minFee rate
minFee: current.plus(feeInfo.minFee).toNumber(), // increase required minFee rate
};
};

Expand Down

0 comments on commit 7e08d1e

Please sign in to comment.