Skip to content

Commit

Permalink
refactor: remove default values from TxFeeOptions form fields
Browse files Browse the repository at this point in the history
  • Loading branch information
nelitow committed Feb 6, 2025
1 parent f3a2d9e commit 866f9b0
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,11 @@ export const TxFeeOptions = ({
const { field: tip, fieldState: tipState } = useController({
control,
name: 'fees.tip',
defaultValue: {
amount: regularTip,
text: formatTip(regularTip),
},
});

const { field: gasLimit, fieldState: gasLimitState } = useController({
control,
name: 'fees.gasLimit',
defaultValue: {
amount: gasLimitInput,
text: gasLimitInput.toString(),
},
});

const advancedFee = baseFee.add(tip.value?.amount || bn(0));
Expand Down Expand Up @@ -96,14 +88,14 @@ export const TxFeeOptions = ({
'fees.gasLimit.amount',
]);

if (!currentGasLimit?.eq(previousGasLimit.current)) {
if (!currentGasLimit.eq(previousGasLimit.current)) {
setValue('fees.gasLimit', {
amount: previousGasLimit.current,
text: previousGasLimit.current.toString(),
});
}

if (!currentTip?.eq(previousDefaultTip.current)) {
if (!currentTip.eq(previousDefaultTip.current)) {
setValue('fees.tip', {
amount: previousDefaultTip.current,
text: formatTip(previousDefaultTip.current),
Expand Down

0 comments on commit 866f9b0

Please sign in to comment.