Skip to content

Commit

Permalink
chore(suite): prepare for independent from eip1559 merge
Browse files Browse the repository at this point in the history
  • Loading branch information
enjojoy committed Feb 26, 2025
1 parent f58856e commit 3de2b0a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { formatDurationStrict } from '@suite-common/suite-utils';
import { NetworkType, getNetworkFeatures, networks } from '@suite-common/wallet-config';
import { NetworkType, networks } from '@suite-common/wallet-config';
import { FeeInfo, GeneralPrecomposedTransactionFinal, StakeType } from '@suite-common/wallet-types';
import { getFee, getFeeUnits } from '@suite-common/wallet-utils';
import { Box, IconButton, Note, Row, Text } from '@trezor/components';
Expand Down Expand Up @@ -51,10 +51,10 @@ export const TransactionReviewSummary = ({
const network = networks[symbol];

const baseFee = fees[symbol].levels[0].baseFeePerGas;
const hasEip1559Feature = getNetworkFeatures(symbol).includes('eip1559');
const hasEip1559Feature = false;
// getNetworkFeatures(symbol).includes('eip1559')
const shouldUsePriorityFees = !!tx.fee && hasEip1559Feature && !!baseFee;
console.log('shouldUsePriorityFees', shouldUsePriorityFees, tx, hasEip1559Feature, baseFee);
const fee = getFee({ account, tx, shouldUsePriorityFees });
const fee = getFee(networkType, tx);

const estimateTime = getEstimatedTime(networkType, fees[account.symbol], tx);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ export const CustomFeeEthereum = <TFieldValues extends FormState>({
const estimatedFeeLimit = getValues('estimatedFeeLimit');
const feePerUnitError = errors.feePerUnit;
const feeLimitError = errors.feeLimit;
const customMaxBaseFeePerGasError = errors.customMaxBaseFeePerGas;
const customMaxPriorityFeePerGasError = errors.customMaxPriorityFeePerGas;
const customMaxBaseFeePerGasError = undefined; // prepared for when priority fee is implemented
const customMaxPriorityFeePerGasError = undefined; // prepared for when priority fee is implemented
// const customMaxBaseFeePerGasError = errors.customMaxBaseFeePerGas;
// const customMaxPriorityFeePerGasError = errors.customMaxPriorityFeePerGas;

const feeLimitRules = {
required: translationString('GAS_LIMIT_IS_NOT_SET'),
Expand Down Expand Up @@ -109,19 +111,18 @@ export const CustomFeeEthereum = <TFieldValues extends FormState>({
const feeLimitValidationButtonProps =
feeLimitError?.type === 'feeLimit' ? feeLimitValidationProps : undefined;

const customMaxBaseFeeValidationProps = {
onClick: () =>
estimatedFeeLimit &&
setValue(CUSTOM_MAX_BASE_FEE_PER_GAS, currentBaseFee, {
shouldValidate: true,
}),
text: translationString('TR_CUSTOM_MAX_BASE_FEE_USE_NETWORK_BASE_FEE'),
};
// const customMaxBaseFeeValidationProps = {
// onClick: () =>
// estimatedFeeLimit &&
// setValue(CUSTOM_MAX_BASE_FEE_PER_GAS, currentBaseFee, {
// shouldValidate: true,
// }),
// text: translationString('TR_CUSTOM_MAX_BASE_FEE_USE_NETWORK_BASE_FEE'),
// };

const customMaxBaseFeeValidationButtonProps =
customMaxBaseFeePerGasError?.type === 'customMaxBaseFeePerGas'
? customMaxBaseFeeValidationProps
: undefined;
// const customMaxBaseFeeValidationButtonProps = customMaxBaseFeePerGasError?.type === 'customMaxBaseFeePerGas'
// ? customMaxBaseFeeValidationProps
// : undefined;

const gasLimitInput = (
<NumberInput
Expand Down Expand Up @@ -160,12 +161,13 @@ export const CustomFeeEthereum = <TFieldValues extends FormState>({
data-testid={CUSTOM_MAX_BASE_FEE_PER_GAS}
rules={customMaxBaseFeePerGasRules}
bottomText={
customMaxBaseFeePerGasError?.message ? (
<InputError
message={customMaxBaseFeePerGasError?.message}
buttonProps={customMaxBaseFeeValidationButtonProps}
/>
) : null
// customMaxBaseFeePerGasError?.message ? (
// <InputError
// message={customMaxBaseFeePerGasError?.message}
// buttonProps={customMaxBaseFeeValidationButtonProps}
// />
// ) :
null
}
/>
<NumberInput
Expand All @@ -181,7 +183,10 @@ export const CustomFeeEthereum = <TFieldValues extends FormState>({
name={CUSTOM_MAX_PRIORITY_FEE_PER_GAS}
data-testid={CUSTOM_MAX_PRIORITY_FEE_PER_GAS}
rules={customMaxPriorityFeePerGasRules}
bottomText={customMaxPriorityFeePerGasError?.message || null}
bottomText={
// customMaxPriorityFeePerGasError?.message ||
null
}
/>
</>
);
Expand Down
5 changes: 0 additions & 5 deletions packages/suite/src/support/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3430,11 +3430,6 @@ export default defineMessages({
id: 'TR_CUSTOM_MAX_BASE_FEE_USE_NETWORK_BASE_FEE',
defaultMessage: 'Use network base fee',
},

TR_MINIMUM_FEE_PER_GAS: {
id: 'TR_MINIMUM_FEE_PER_GAS',
defaultMessage: 'Minimum fee per gas',
},
GAS_LIMIT_IS_NOT_SET: {
id: 'GAS_LIMIT_IS_NOT_SET',
defaultMessage: 'Set gas limit for this transaction',
Expand Down

0 comments on commit 3de2b0a

Please sign in to comment.