-
Notifications
You must be signed in to change notification settings - Fork 411
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: warn if tx was already signed by connected wallet #2322
Changes from all commits
a4cb4b2
6a399c7
2bd2b1c
f908252
c52ef07
98fb83e
439d655
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.container { | ||
margin-top: 42px; | ||
margin-top: 10px; | ||
} | ||
|
||
.header { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
.container { | ||
margin-top: 50px; | ||
} | ||
|
||
.chain { | ||
align-self: flex-end; | ||
margin-bottom: var(--space-2); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import ErrorMessage from '@/components/tx/ErrorMessage' | |
import { logError, Errors } from '@/services/exceptions' | ||
import useIsSafeOwner from '@/hooks/useIsSafeOwner' | ||
import CheckWallet from '@/components/common/CheckWallet' | ||
import { useTxActions } from './hooks' | ||
import { useAlreadySigned, useTxActions } from './hooks' | ||
import type { SignOrExecuteProps } from '.' | ||
import type { SafeTransaction } from '@safe-global/safe-core-sdk-types' | ||
import { TxModalContext } from '@/components/tx-flow' | ||
|
@@ -32,6 +32,7 @@ const SignForm = ({ | |
const { signTx } = useTxActions() | ||
const { setTxFlow } = useContext(TxModalContext) | ||
const { needsRiskConfirmation, isRiskConfirmed, setIsRiskIgnored } = useContext(TxSecurityContext) | ||
const hasSigned = useAlreadySigned(safeTx) | ||
|
||
// On modal submit | ||
const handleSubmit = async (e: SyntheticEvent) => { | ||
|
@@ -64,6 +65,8 @@ const SignForm = ({ | |
|
||
return ( | ||
<form onSubmit={handleSubmit}> | ||
{hasSigned && <ErrorMessage level="warning">You have already signed this transaction.</ErrorMessage>} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we not move it into the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CheckWallet doesn't know anything about transactions, it only checks the wallet itself. |
||
|
||
{cannotPropose ? ( | ||
<NonOwnerError /> | ||
) : ( | ||
|
@@ -79,7 +82,7 @@ const SignForm = ({ | |
<CheckWallet> | ||
{(isOk) => ( | ||
<Button variant="contained" type="submit" disabled={!isOk || submitDisabled}> | ||
Submit | ||
Sign | ||
</Button> | ||
)} | ||
</CheckWallet> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { RedefineMessage } from './redefine' | ||
import { TxSimulationMessage } from './tenderly' | ||
|
||
const SecurityWarnings = () => ( | ||
<> | ||
<RedefineMessage /> | ||
<TxSimulationMessage /> | ||
</> | ||
) | ||
|
||
export default SecurityWarnings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modal alignment no longer matches: