From 16b06b78a5be3b0be096fa4baadbf0aefe672445 Mon Sep 17 00:00:00 2001 From: Douglas Daniel Date: Wed, 18 Dec 2024 01:51:23 -0600 Subject: [PATCH] fix(wallet): Speedup Transaction (uplift to 1.74.x) (#27047) Merge pull request #26967 from brave/fix-wallet-speedup-transaction fix(wallet): Speedup Transaction --- .../common/speed_up_alert.tsx | 41 +++++++++++++++---- .../submitted_or_signed.tsx | 2 +- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/components/brave_wallet_ui/components/extension/post-confirmation/common/speed_up_alert.tsx b/components/brave_wallet_ui/components/extension/post-confirmation/common/speed_up_alert.tsx index d6ad9cec74d7..c89b8cc798f2 100644 --- a/components/brave_wallet_ui/components/extension/post-confirmation/common/speed_up_alert.tsx +++ b/components/brave_wallet_ui/components/extension/post-confirmation/common/speed_up_alert.tsx @@ -4,29 +4,56 @@ // You can obtain one at https://mozilla.org/MPL/2.0/. import * as React from 'react' import Button from '@brave/leo/react/button' +import { useDispatch } from 'react-redux' + +// Actions +import * as WalletPanelActions from '../../../../panel/actions/wallet_panel_actions' // Utils import { getLocale } from '$web-common/locale' +import { getCoinFromTxDataUnion } from '../../../../utils/network-utils' + +// Types +import { SerializableTransactionInfo } from '../../../../constants/types' + +// Hooks +import { + useSpeedupTransactionMutation // +} from '../../../../common/slices/api.slice' // Styled Components import { Alert } from './common.style' interface Props { - onSpeedUp?: () => void + transaction: SerializableTransactionInfo } export const SpeedUpAlert = (props: Props) => { - const { onSpeedUp } = props + const { transaction } = props + + // Computed + const txCoinType = getCoinFromTxDataUnion(transaction.txDataUnion) + + // Hooks + const [speedupTx] = useSpeedupTransactionMutation() + const dispatch = useDispatch() + + // Methods + const onClickSpeedUpTransaction = () => { + speedupTx({ + coinType: txCoinType, + chainId: transaction.chainId, + transactionId: transaction.id + }) + dispatch(WalletPanelActions.setSelectedTransactionId(undefined)) + } return ( - + {getLocale('braveWalletTransactionTakingLongTime')}