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

fix(staking-tx): Add staking condition back into the confirmation view #4463

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 1 addition & 8 deletions src/components/tx/SignOrExecuteForm/SignOrExecuteForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,7 @@ 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)

4
clovisdasilvaneto marked this conversation as resolved.
Show resolved Hide resolved
const isBatchable = props.isBatchable !== false && safeTx && !isDelegateCall(safeTx)

const isDelegate = useIsWalletDelegate()
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
Loading