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

Backmerge main -> dev #4503

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "safe-wallet-web",
"homepage": "https://github.com/safe-global/safe-wallet-web",
"license": "GPL-3.0",
"version": "1.45.3",
"version": "1.46.0",
"type": "module",
"scripts": {
"dev": "next dev",
Expand Down
12 changes: 10 additions & 2 deletions src/components/tx-flow/common/TxStatusWidget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 (
<Paper>
Expand Down
8 changes: 0 additions & 8 deletions src/components/tx/SignOrExecuteForm/SignOrExecuteForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ export const SignOrExecuteForm = ({
const [shouldExecute, setShouldExecute] = useState<boolean>(transactionExecution)
const isNewExecutableTx = useImmediatelyExecutable() && isCreation
const isCorrectNonce = useValidateNonce(safeTx)

console.log(props.txDetails)

// TODO: move it to the confirmation view
// const showTxDetails =
// !isAnyStakingTxInfo(txDetails.txInfo) &&
// !isOrderTxInfo(txDetails.txInfo)

const isBatchable = props.isBatchable !== false && safeTx && !isDelegateCall(safeTx)

const [trigger] = useLazyGetTransactionDetailsQuery()
Expand Down
27 changes: 17 additions & 10 deletions src/components/tx/confirmation-views/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import DecodedTx from '../DecodedTx'
import ConfirmationOrder from '../ConfirmationOrder'
import useDecodeTx from '@/hooks/useDecodeTx'
import type { SafeTransaction } from '@safe-global/safe-core-sdk-types'
import { isCustomTxInfo, isGenericConfirmation } from '@/utils/transaction-guards'
import { isAnyStakingTxInfo, isCustomTxInfo, isGenericConfirmation, isOrderTxInfo } from '@/utils/transaction-guards'
import { type ReactNode, useContext, useMemo } from 'react'
import TxData from '@/components/transactions/TxDetails/TxData'
import type { NarrowConfirmationViewProps } from './types'
Expand Down Expand Up @@ -38,36 +38,43 @@ const getConfirmationViewComponent = ({
return null
}

const ConfirmationView = (props: ConfirmationViewProps) => {
const { txId } = props.txDetails || {}
const ConfirmationView = ({ txDetails, ...props }: ConfirmationViewProps) => {
const { txId } = txDetails || {}
const [decodedData] = useDecodeTx(props.safeTx)
const { txFlow } = useContext(TxModalContext)

const ConfirmationViewComponent = useMemo(
() =>
props.txDetails
txDetails
? getConfirmationViewComponent({
txDetails: props.txDetails,
txInfo: props.txDetails.txInfo,
txDetails,
txInfo: txDetails.txInfo,
txFlow,
})
: undefined,
[props.txDetails, txFlow],
[txDetails, txFlow],
)
const showTxDetails = txId && !props.isCreation && props.txDetails && !isCustomTxInfo(props.txDetails.txInfo)

const showTxDetails =
txId &&
!props.isCreation &&
txDetails &&
!isCustomTxInfo(txDetails.txInfo) &&
!isAnyStakingTxInfo(txDetails.txInfo) &&
!isOrderTxInfo(txDetails.txInfo)

return (
<>
{ConfirmationViewComponent ||
(showTxDetails && props.txDetails && <TxData txDetails={props.txDetails} imitation={false} trusted />)}
(showTxDetails && txDetails && <TxData txDetails={txDetails} imitation={false} trusted />)}

{decodedData && <ConfirmationOrder decodedData={decodedData} toAddress={props.safeTx?.data.to ?? ''} />}

{props.children}

<DecodedTx
tx={props.safeTx}
txDetails={props.txDetails}
txDetails={txDetails}
decodedData={decodedData}
showMultisend={!props.isBatch}
showMethodCall={
Expand Down
2 changes: 1 addition & 1 deletion src/features/proposers/components/DeleteProposerDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading