-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: skip recovery transactions (#2837)
- Loading branch information
Showing
5 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
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
38 changes: 38 additions & 0 deletions
38
src/components/tx-flow/flows/SkipRecovery/SkipRecoveryFlowReview.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,38 @@ | ||
import { Typography } from '@mui/material' | ||
import { useContext, useEffect } from 'react' | ||
import type { ReactElement } from 'react' | ||
|
||
import { SafeTxContext } from '../../SafeTxProvider' | ||
import SignOrExecuteForm from '@/components/tx/SignOrExecuteForm' | ||
import { useWeb3ReadOnly } from '@/hooks/wallets/web3' | ||
import { getRecoverySkipTransaction } from '@/services/recovery/transaction' | ||
import { createTx } from '@/services/tx/tx-sender' | ||
import type { RecoveryQueueItem } from '@/store/recoverySlice' | ||
|
||
export function SkipRecoveryFlowReview({ recovery }: { recovery: RecoveryQueueItem }): ReactElement { | ||
const web3ReadOnly = useWeb3ReadOnly() | ||
const { setSafeTx, setSafeTxError } = useContext(SafeTxContext) | ||
|
||
useEffect(() => { | ||
if (!web3ReadOnly) { | ||
return | ||
} | ||
const transaction = getRecoverySkipTransaction(recovery, web3ReadOnly) | ||
createTx(transaction).then(setSafeTx).catch(setSafeTxError) | ||
}, [setSafeTx, setSafeTxError, recovery, web3ReadOnly]) | ||
|
||
return ( | ||
<SignOrExecuteForm onSubmit={() => null} isBatchable={false}> | ||
<Typography mb={2}> | ||
To reject the recovery attempt, a separate transaction will be created to increase the nonce beyond the | ||
proposal. | ||
</Typography> | ||
|
||
<Typography mb={2}> | ||
Queue nonce: <b>{recovery.args.queueNonce.toNumber()}</b> | ||
</Typography> | ||
|
||
<Typography mb={2}>You will need to confirm the transaction with your currently connected wallet.</Typography> | ||
</SignOrExecuteForm> | ||
) | ||
} |
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,13 @@ | ||
import type { ReactElement } from 'react' | ||
|
||
import TxLayout from '../../common/TxLayout' | ||
import { SkipRecoveryFlowReview } from './SkipRecoveryFlowReview' | ||
import type { RecoveryQueueItem } from '@/store/recoverySlice' | ||
|
||
export function SkipRecoveryFlow({ recovery }: { recovery: RecoveryQueueItem }): ReactElement { | ||
return ( | ||
<TxLayout title="Confirm transaction" subtitle="Skip recovery" step={0}> | ||
<SkipRecoveryFlowReview recovery={recovery} /> | ||
</TxLayout> | ||
) | ||
} |
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