-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add error state for RBF when previous transaction gets mined be…
…for user sends the modal
- Loading branch information
1 parent
bc47eef
commit 2db04c3
Showing
14 changed files
with
257 additions
and
114 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
packages/suite/src/actions/wallet/send/replaceByFeeErrorThunk.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { createThunk } from '@suite-common/redux-utils'; | ||
import TrezorConnect from '@trezor/connect'; | ||
|
||
import { MODULE_PREFIX } from './sendThunksConsts'; | ||
import { openModal } from '../../suite/modalActions'; | ||
|
||
export const RBF_ERROR_ALREADY_MINED = 'replace-by-fee-error-transaction-already-mined'; | ||
|
||
export const replaceByFeeErrorThunk = createThunk( | ||
`${MODULE_PREFIX}/replaceByFeeErrorThunk`, | ||
(_, { dispatch }) => { | ||
TrezorConnect.cancel(RBF_ERROR_ALREADY_MINED); | ||
|
||
dispatch( | ||
openModal({ | ||
type: 'review-transaction-rbf-previous-transaction-mined-error', | ||
}), | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const MODULE_PREFIX = '@send'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
...s/ReduxModal/UserContextModal/TxDetailModal/CancelTransaction/CancelTransactionFailed.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...odals/ReduxModal/UserContextModal/TxDetailModal/ReplaceByFeeFailedOriginalTxConfirmed.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Box, Card, Column, IconCircle, Text } from '@trezor/components'; | ||
import { spacings } from '@trezor/theme'; | ||
import { | ||
HELP_CENTER_CANCEL_TRANSACTION, | ||
HELP_CENTER_REPLACE_BY_FEE_BITCOIN, | ||
Url, | ||
} from '@trezor/urls'; | ||
|
||
import { Translation, TranslationKey } from '../../../../Translation'; | ||
import { TrezorLink } from '../../../../TrezorLink'; | ||
|
||
type ReplaceByFeeFailedOriginalTxConfirmedProps = { | ||
type: 'replace-by-fee' | 'cancel-transaction'; | ||
}; | ||
|
||
const titleMap: Record<ReplaceByFeeFailedOriginalTxConfirmedProps['type'], TranslationKey> = { | ||
'replace-by-fee': 'TR_REPLACE_BY_FEE_FAILED_ALREADY_MINED', | ||
'cancel-transaction': 'TR_CANCEL_TX_FAILED_ALREADY_MINED', | ||
}; | ||
|
||
const descriptionMap: Record<ReplaceByFeeFailedOriginalTxConfirmedProps['type'], TranslationKey> = { | ||
'replace-by-fee': 'TR_REPLACE_BY_FEE_FAILED_ALREADY_MINED_DESCRIPTION', | ||
'cancel-transaction': 'TR_CANCEL_TX_FAILED_ALREADY_MINED_DESCRIPTION', | ||
}; | ||
|
||
const helpLink: Record<ReplaceByFeeFailedOriginalTxConfirmedProps['type'], Url> = { | ||
'replace-by-fee': HELP_CENTER_REPLACE_BY_FEE_BITCOIN, | ||
'cancel-transaction': HELP_CENTER_CANCEL_TRANSACTION, | ||
}; | ||
|
||
export const ReplaceByFeeFailedOriginalTxConfirmed = ({ | ||
type, | ||
}: ReplaceByFeeFailedOriginalTxConfirmedProps) => ( | ||
<Card fillType="flat"> | ||
<Column gap={spacings.xs}> | ||
<Box margin={{ bottom: spacings.md }}> | ||
<IconCircle name="warning" size={110} variant="destructive" /> | ||
</Box> | ||
|
||
<Text typographyStyle="titleSmall"> | ||
<Translation id={titleMap[type]} /> | ||
</Text> | ||
<Translation id={descriptionMap[type]} /> | ||
|
||
<TrezorLink typographyStyle="hint" href={helpLink[type]} icon="arrowUpRight"> | ||
<Translation id="TR_LEARN_MORE" /> | ||
</TrezorLink> | ||
</Column> | ||
</Card> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.