From 63695ad24bd8739bce91601872084227199c4f4c Mon Sep 17 00:00:00 2001 From: Usame Algan Date: Thu, 7 Nov 2024 12:42:03 +0100 Subject: [PATCH] fix: Delete proposer as proposer, adjust status widget --- .../tx-flow/common/TxStatusWidget/index.tsx | 12 ++++++++++-- .../proposers/components/DeleteProposerDialog.tsx | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/tx-flow/common/TxStatusWidget/index.tsx b/src/components/tx-flow/common/TxStatusWidget/index.tsx index 8a19a2eff8..11847b6ee9 100644 --- a/src/components/tx-flow/common/TxStatusWidget/index.tsx +++ b/src/components/tx-flow/common/TxStatusWidget/index.tsx @@ -11,6 +11,8 @@ import CloseIcon from '@mui/icons-material/Close' import useWallet from '@/hooks/wallets/useWallet' import SafeLogo from '@/public/images/logo-no-text.svg' import { SafeTxContext } from '@/components/tx-flow/SafeTxProvider' +import useIsSafeOwner from '@/hooks/useIsSafeOwner' +import { useIsWalletProposer } from '@/hooks/useProposers' const TxStatusWidget = ({ step, @@ -29,12 +31,18 @@ const TxStatusWidget = ({ const { safe } = useSafeInfo() const { nonceNeeded } = useContext(SafeTxContext) const { threshold } = safe + const isSafeOwner = useIsSafeOwner() + const isProposer = useIsWalletProposer() + const isProposing = isProposer && !isSafeOwner const { executionInfo = undefined } = txSummary || {} const { confirmationsSubmitted = 0 } = isMultisigExecutionInfo(executionInfo) ? executionInfo : {} - const canConfirm = txSummary ? isConfirmableBy(txSummary, wallet?.address || '') : safe.threshold === 1 - const canSign = txSummary ? isSignableBy(txSummary, wallet?.address || '') : true + const canConfirm = txSummary + ? isConfirmableBy(txSummary, wallet?.address || '') + : safe.threshold === 1 && !isProposing + + const canSign = txSummary ? isSignableBy(txSummary, wallet?.address || '') : !isProposing return ( diff --git a/src/features/proposers/components/DeleteProposerDialog.tsx b/src/features/proposers/components/DeleteProposerDialog.tsx index b809c7a45a..ac79ae1aec 100644 --- a/src/features/proposers/components/DeleteProposerDialog.tsx +++ b/src/features/proposers/components/DeleteProposerDialog.tsx @@ -67,7 +67,7 @@ const _DeleteProposer = ({ wallet, safeAddress, chainId, proposer }: DeletePropo await deleteProposer({ chainId, delegateAddress: proposer.delegate, - delegator: wallet.address, + delegator: proposer.delegator, safeAddress, signature, isHardwareWallet: hardwareWallet,