Skip to content

Commit

Permalink
fix: show contract name when it is a multisend transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
clovisdasilvaneto committed Sep 17, 2024
1 parent e511c1c commit 458ba59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
26 changes: 1 addition & 25 deletions src/components/tx/DecodedTx/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ import { Accordion, AccordionDetails, AccordionSummary, Box, Skeleton, Stack } f
import { OperationType, type SafeTransaction } from '@safe-global/safe-core-sdk-types'
import type { DecodedDataResponse, TransactionDetails } from '@safe-global/safe-gateway-typescript-sdk'
import { Operation } from '@safe-global/safe-gateway-typescript-sdk'
import useChainId from '@/hooks/useChainId'
import ErrorMessage from '../ErrorMessage'
import Summary, { PartialSummary } from '@/components/transactions/TxDetails/Summary'
import { trackEvent, MODALS_EVENTS } from '@/services/analytics'
import Multisend from '@/components/transactions/TxDetails/TxData/DecodedData/Multisend'
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
import DecodedData from '@/components/transactions/TxDetails/TxData/DecodedData'
import accordionCss from '@/styles/accordion.module.css'
import HelpToolTip from './HelpTooltip'
import { useGetTransactionDetailsQuery } from '@/store/gateway'
import { skipToken } from '@reduxjs/toolkit/query/react'
import { asError } from '@/services/exceptions/utils'

type DecodedTxProps = {
Expand All @@ -37,28 +33,14 @@ export const Divider = () => (

const DecodedTx = ({
tx,
txId,
txDetails,
decodedData,
showMultisend = true,
showMethodCall = false,
}: DecodedTxProps): ReactElement => {
const chainId = useChainId()
const isMultisend = !!decodedData?.parameters?.[0]?.valueDecoded
const isMethodCallInAdvanced = !showMethodCall || (isMultisend && showMultisend)

const {
data: txDetails,
error: txDetailsError,
isLoading: txDetailsLoading,
} = useGetTransactionDetailsQuery(
chainId && txId
? {
chainId,
txId,
}
: skipToken,
)

const onChangeExpand = (_: SyntheticEvent, expanded: boolean) => {
trackEvent({ ...MODALS_EVENTS.TX_DETAILS, label: expanded ? 'Open' : 'Close' })
}
Expand Down Expand Up @@ -116,12 +98,6 @@ const DecodedTx = ({
)}

{txDetails ? <Summary txDetails={txDetails} defaultExpanded /> : tx && <PartialSummary safeTx={tx} />}

{txDetailsLoading && <Skeleton />}

{txDetailsError && (
<ErrorMessage error={asError(txDetailsError)}>Failed loading all transaction details</ErrorMessage>
)}
</AccordionDetails>
</Accordion>
</Box>
Expand Down
3 changes: 1 addition & 2 deletions src/components/tx/SignOrExecuteForm/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export const useProposeTx = (safeTx?: SafeTransaction, txId?: string, origin?: s

return useAsync(
() => {
if (!safeTx) return
if (txId) return getTransactionDetails(safe.chainId, txId)
if (!safeTx) return

return proposeTx(safeTx, txId, origin)
},
Expand Down Expand Up @@ -78,7 +78,6 @@ export const useTxActions = (): TxActions => {

const proposeTx: TxActions['proposeTx'] = async (safeTx, txId, origin) => {
assertTx(safeTx)
// assertWallet(wallet)
return _propose(wallet?.address || safe.owners[0].value, safeTx, txId, origin)
}

Expand Down

0 comments on commit 458ba59

Please sign in to comment.