Skip to content

Commit 14cfe07

Browse files
authored
Revert "fix: add tx fee value loading indicators to panel (#16945)"
This reverts commit 2116c45.
1 parent ee9611c commit 14cfe07

File tree

10 files changed

+154
-267
lines changed

10 files changed

+154
-267
lines changed

components/brave_wallet/browser/brave_wallet_constants.h

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ constexpr char kTransakURL[] = "https://global.transak.com/";
4242
constexpr char kTransakApiKey[] = "985d14f0-4cf5-4a4c-8917-78107620d3b7";
4343

4444
constexpr webui::LocalizedString kLocalizedStrings[] = {
45-
{"braveWalletTransactionHasFeeEstimatesError",
46-
IDS_BRAVE_WALLET_TRANSACTION_HAS_FEE_ESTIMATES_ERROR},
4745
{"braveWalletGasFeeLimitLowerThanBaseFeeWarning",
4846
IDS_BRAVE_WALLET_GAS_FEE_LIMIT_LOWER_THAN_BASE_FEE_WARNING},
4947
{"braveWalletTokenMintAddress", IDS_BRAVE_WALLET_TOKEN_MINT_ADDRESS},

components/brave_wallet_ui/common/actions/wallet_actions.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
addFilecoinAccount,
1515
addSitePermission,
1616
addUserAsset,
17+
updateUserAsset,
1718
addUserAssetError,
1819
approveERC20Allowance,
1920
approveTransaction,
@@ -40,8 +41,8 @@
4041
keyringCreated,
4142
keyringReset,
4243
keyringRestored,
43-
locked,
4444
lockWallet,
45+
locked,
4546
nativeAssetBalancesUpdated,
4647
newUnapprovedTxAdded,
4748
portfolioPriceHistoryUpdated,
@@ -51,8 +52,8 @@
5152
refreshAccountInfo,
5253
refreshBalancesAndPriceHistory,
5354
refreshBalancesAndPrices,
54-
refreshGasEstimates,
5555
refreshNetworksAndTokens,
56+
refreshGasEstimates,
5657
rejectAllTransactions,
5758
rejectTransaction,
5859
removeFavoriteApp,
@@ -61,23 +62,22 @@
6162
retryTransaction,
6263
selectAccount,
6364
selectCurrency,
64-
selectedAccountChanged,
6565
selectNetwork,
6666
selectPortfolioTimeline,
67+
selectedAccountChanged,
6768
sendERC20Transfer,
6869
sendERC721TransferFrom,
6970
sendSPLTransfer,
7071
sendTransaction,
7172
setAccountTransactions,
72-
setAllHiddenNetworks,
7373
setAllNetworks,
74+
setAllHiddenNetworks,
7475
setAllTokensList,
7576
setAssetAutoDiscoveryCompleted,
7677
setCoinMarkets,
7778
setDefaultAccounts,
7879
setDefaultNetworks,
7980
setGasEstimates,
80-
setHasFeeEstimatesError,
8181
setMetaMaskInstalled,
8282
setNetwork,
8383
setOnRampCurrencies,
@@ -95,11 +95,10 @@
9595
tokenBalancesUpdated,
9696
transactionStatusChanged,
9797
unapprovedTxUpdated,
98-
unlocked,
9998
unlockWallet,
100-
updateTokenPinStatus,
99+
unlocked,
101100
updateUnapprovedTransactionGasFields,
102101
updateUnapprovedTransactionNonce,
103102
updateUnapprovedTransactionSpendAllowance,
104-
updateUserAsset
103+
updateTokenPinStatus
105104
} = WalletActions

components/brave_wallet_ui/common/async/handlers.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -520,15 +520,12 @@ handler.on(WalletActions.refreshGasEstimates.type, async (store: Store, txInfo:
520520
const { ethTxManagerProxy, solanaTxManagerProxy } = getAPIProxy()
521521

522522
if (isSolanaTransaction(txInfo)) {
523-
const { fee, errorMessage } = await solanaTxManagerProxy.getEstimatedTxFee(
524-
txInfo.id
525-
)
526-
if (!fee) {
527-
console.error('Failed to fetch SOL Fee estimates: ' + errorMessage)
528-
store.dispatch(WalletActions.setHasFeeEstimatesError(true))
523+
const getSolFee = await solanaTxManagerProxy.getEstimatedTxFee(txInfo.id)
524+
if (!getSolFee.fee) {
525+
console.error('Failed to fetch SOL Fee estimates')
529526
return
530527
}
531-
store.dispatch(WalletActions.setSolFeeEstimates({ fee }))
528+
store.dispatch(WalletActions.setSolFeeEstimates({ fee: getSolFee.fee }))
532529
return
533530
}
534531

@@ -540,14 +537,13 @@ handler.on(WalletActions.refreshGasEstimates.type, async (store: Store, txInfo:
540537
return
541538
}
542539

543-
const { estimation } = await ethTxManagerProxy.getGasEstimation1559()
544-
if (!estimation) {
540+
const basicEstimates = await ethTxManagerProxy.getGasEstimation1559()
541+
if (!basicEstimates.estimation) {
545542
console.error('Failed to fetch gas estimates')
546-
store.dispatch(WalletActions.setHasFeeEstimatesError(true))
547543
return
548544
}
549545

550-
store.dispatch(WalletActions.setGasEstimates(estimation))
546+
store.dispatch(WalletActions.setGasEstimates(basicEstimates.estimation))
551547
})
552548

553549
handler.on(WalletActions.updateUnapprovedTransactionGasFields.type, async (store: Store, payload: UpdateUnapprovedTransactionGasFieldsType) => {

components/brave_wallet_ui/common/hooks/use-pending-transaction.ts

+2-16
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ import { findAccountName } from '../../utils/account-utils'
1616
import { getLocale } from '../../../common/locale'
1717
import { getNetworkFromTXDataUnion } from '../../utils/network-utils'
1818
import { reduceAddress } from '../../utils/reduce-address'
19-
import { WalletSelectors } from '../selectors'
2019

2120
// Custom Hooks
2221
import { useTransactionParser } from './transaction-parser'
2322
import usePricing from './pricing'
2423
import useTokenInfo from './token'
2524
import { useLib } from './useLib'
26-
import { useSafeWalletSelector } from './use-safe-selector'
2725

2826
// Constants
2927
import { WalletState, BraveWallet } from '../../constants/types'
@@ -48,10 +46,6 @@ export const usePendingTransactions = () => {
4846
pendingTransactions,
4947
defaultNetworks
5048
} = useSelector((state: { wallet: WalletState }) => state.wallet)
51-
const hasFeeEstimatesError = useSafeWalletSelector(
52-
WalletSelectors.hasFeeEstimatesError
53-
)
54-
5549
const transactionGasEstimates = transactionInfo?.txDataUnion.ethTxData1559?.gasEstimation
5650

5751
const transactionsNetwork = React.useMemo(() => {
@@ -180,13 +174,7 @@ export const usePendingTransactions = () => {
180174
: getLocale('braveWalletSend')
181175
, [isSolanaDappTransaction, transactionDetails?.isSwap])
182176

183-
const isLoadingGasFee = transactionDetails?.gasFee === ''
184-
185177
const isConfirmButtonDisabled = React.useMemo(() => {
186-
if (hasFeeEstimatesError || isLoadingGasFee) {
187-
return true
188-
}
189-
190178
if (!transactionDetails) {
191179
return true
192180
}
@@ -201,7 +189,7 @@ export const usePendingTransactions = () => {
201189
!!transactionDetails?.missingGasLimitError ||
202190
!canSelectedPendingTransactionBeApproved
203191
)
204-
}, [transactionDetails, hasFeeEstimatesError, isLoadingGasFee])
192+
}, [transactionDetails])
205193

206194
// effects
207195
React.useEffect(() => {
@@ -291,8 +279,6 @@ export const usePendingTransactions = () => {
291279
updateUnapprovedTransactionGasFields,
292280
updateUnapprovedTransactionNonce,
293281
groupTransactions,
294-
selectedPendingTransactionGroupIndex,
295-
hasFeeEstimatesError,
296-
selectedPendingTransaction: transactionInfo
282+
selectedPendingTransactionGroupIndex
297283
}
298284
}

components/brave_wallet_ui/common/selectors/wallet-selectors.ts

-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ export const isWalletLocked = ({ wallet }: State) => wallet.isWalletLocked
2626
export const passwordAttempts = ({ wallet }: State) => wallet.passwordAttempts
2727
export const selectedPortfolioTimeline = ({ wallet }: State) => wallet.selectedPortfolioTimeline
2828
export const assetAutoDiscoveryCompleted = ({ wallet }: State) => wallet.assetAutoDiscoveryCompleted
29-
export const hasFeeEstimatesError = ({ wallet }: State) =>
30-
wallet.hasFeeEstimatesError
3129

3230
// unsafe selectors (will cause re-render if not strictly equal "===") (objects and lists)
3331
export const accounts = ({ wallet }: State) => wallet.accounts

components/brave_wallet_ui/common/slices/wallet.slice.ts

-9
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ export const createWalletSlice = (initialState: WalletState = defaultState) => {
444444
},
445445

446446
setGasEstimates (state: WalletState, { payload }: PayloadAction<BraveWallet.GasEstimation1559>) {
447-
state.hasFeeEstimatesError = false
448447
state.gasEstimates = payload
449448
},
450449

@@ -477,17 +476,9 @@ export const createWalletSlice = (initialState: WalletState = defaultState) => {
477476
},
478477

479478
setSolFeeEstimates (state: WalletState, { payload }: PayloadAction<SolFeeEstimates>) {
480-
state.hasFeeEstimatesError = false
481479
state.solFeeEstimates = payload
482480
},
483481

484-
setHasFeeEstimatesError: (
485-
state: WalletState,
486-
{ payload }: PayloadAction<boolean>
487-
) => {
488-
state.hasFeeEstimatesError = payload
489-
},
490-
491482
setTransactionProviderError (state: WalletState, { payload }: PayloadAction<SetTransactionProviderErrorType>) {
492483
state.transactionProviderErrorRegistry[payload.transaction.id] = payload.providerError
493484
},

0 commit comments

Comments
 (0)