Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wallet): Speedup Transaction #26967

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +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 (
<Alert
type='info'
>
<Alert type='info'>
{getLocale('braveWalletTransactionTakingLongTime')}
<div slot='content-after'>
<Button
onClick={onSpeedUp}
onClick={onClickSpeedUpTransaction}
kind='outline'
size='tiny'
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const TransactionSubmittedOrSigned = (props: Props) => {
padding='0px 24px'
>
{txCoinType === BraveWallet.CoinType.ETH && showSpeedUpAlert ? (
<SpeedUpAlert />
<SpeedUpAlert transaction={transaction} />
) : (
<VerticalSpace space='114px' />
)}
Expand Down
Loading