Skip to content

Commit

Permalink
Update tx details
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Dec 16, 2024
1 parent 7841f12 commit eaf8808
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import MethodCall from './MethodCall'
import useSafeAddress from '@/hooks/useSafeAddress'
import { sameAddress } from '@/utils/addresses'
import { DelegateCallWarning } from '@/components/transactions/Warning'
import { isMigrateToL2TxData } from '@/utils/transaction-guards'

interface Props {
txData: TransactionDetails['txData']
Expand Down Expand Up @@ -59,11 +58,9 @@ export const DecodedData = ({ txData, toInfo }: Props): ReactElement | null => {
decodedData = <HexEncodedData title="Data (hex-encoded)" hexData={txData.hexData} />
}

const isL2Migration = isMigrateToL2TxData(txData, chainInfo?.chainId)

return (
<Stack spacing={2}>
{isDelegateCall && <DelegateCallWarning showWarning={!txData.trustedDelegateCallTarget && !isL2Migration} />}
{isDelegateCall && <DelegateCallWarning showWarning={!txData.trustedDelegateCallTarget} />}

{method ? (
<MethodCall contractAddress={toAddress} contractName={name} contractLogo={avatar} method={method} />
Expand Down
16 changes: 16 additions & 0 deletions src/components/transactions/TxDetails/TxData/SafeUpdate/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Stack } from '@mui/material'
import type { TransactionData } from '@safe-global/safe-gateway-typescript-sdk'
import UpdateSafe from '@/components/tx/confirmation-views/UpdateSafe'
import DecodedData from '../DecodedData'

function SafeUpdate({ txData }: { txData?: TransactionData }) {
return (
<Stack mr={5} spacing={2}>
<UpdateSafe />

<DecodedData txData={txData} toInfo={txData?.to} />
</Stack>
)
}

export default SafeUpdate
12 changes: 11 additions & 1 deletion src/components/transactions/TxDetails/TxData/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import SettingsChangeTxInfo from '@/components/transactions/TxDetails/TxData/SettingsChange'
import type { SpendingLimitMethods } from '@/utils/transaction-guards'
import { isExecTxData, isOnChainConfirmationTxData, isStakingTxWithdrawInfo } from '@/utils/transaction-guards'
import {
isExecTxData,
isOnChainConfirmationTxData,
isSafeUpdateTxData,
isStakingTxWithdrawInfo,
} from '@/utils/transaction-guards'
import { isStakingTxExitInfo } from '@/utils/transaction-guards'
import {
isCancellationTxInfo,
Expand Down Expand Up @@ -28,6 +33,7 @@ import StakingTxExitDetails from '@/features/stake/components/StakingTxExitDetai
import StakingTxWithdrawDetails from '@/features/stake/components/StakingTxWithdrawDetails'
import { OnChainConfirmation } from './NestedTransaction/OnChainConfirmation'
import { ExecTransaction } from './NestedTransaction/ExecTransaction'
import SafeUpdate from './SafeUpdate'

const TxData = ({
txDetails,
Expand Down Expand Up @@ -87,6 +93,10 @@ const TxData = ({
return <ExecTransaction data={txDetails.txData} />
}

if (isSafeUpdateTxData(txDetails.txData)) {
return <SafeUpdate txData={txDetails.txData} />
}

return <DecodedData txData={txDetails.txData} toInfo={toInfo} />
}

Expand Down

0 comments on commit eaf8808

Please sign in to comment.