Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Dec 27, 2024
1 parent 0532402 commit 2e50b13
Show file tree
Hide file tree
Showing 4 changed files with 2,152 additions and 3 deletions.
44 changes: 44 additions & 0 deletions apps/web/src/components/transactions/TxDetails/TxNote.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { DataRow } from '@/components/common/Table/DataRow'
import useAsync from '@/hooks/useAsync'
import { useCurrentChain } from '@/hooks/useChains'
import { isMultisigDetailedExecutionInfo } from '@/utils/transaction-guards'
import { Box, Divider } from '@mui/material'
import type { TransactionDetails } from '@safe-global/safe-gateway-typescript-sdk'

const TxNote = ({ txDetails }: { txDetails: TransactionDetails }) => {
const currentChain = useCurrentChain()
const txService = currentChain?.transactionService

let safeTxHash = ''
if (isMultisigDetailedExecutionInfo(txDetails.detailedExecutionInfo)) {
safeTxHash = txDetails.detailedExecutionInfo?.safeTxHash
}

const [data] = useAsync(() => {
if (!safeTxHash || !txService) return
return fetch(`${txService}/api/v1/multisig-transactions/${safeTxHash}`).then((res) => res.json())
}, [safeTxHash, txService])

let note = ''
if (data) {
try {
const origin = JSON.parse(data.origin)
const parsedName = JSON.parse(origin.name)
note = parsedName.note
} catch {
// Ignore, no note
}
}

return note ? (
<>
<Box m={2} py={1}>
<DataRow title="Proposer note:">{note}</DataRow>
</Box>

<Divider sx={{ mb: 2 }} />
</>
) : null
}

export default TxNote
3 changes: 3 additions & 0 deletions apps/web/src/components/transactions/TxDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { FEATURES } from '@/utils/chains'
import { useGetTransactionDetailsQuery } from '@/store/api/gateway'
import { asError } from '@/services/exceptions/utils'
import { POLLING_INTERVAL } from '@/config/constants'
import TxNote from './TxNote'

export const NOT_AVAILABLE = 'n/a'

Expand Down Expand Up @@ -82,6 +83,8 @@ const TxDetailsBlock = ({ txSummary, txDetails }: TxDetailsProps): ReactElement
<>
{/* /Details */}
<div className={`${css.details} ${isUnsigned ? css.noSigners : ''}`}>
<TxNote txDetails={txDetails} />

<div className={css.shareLink}>
<TxShareLink id={txSummary.id} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
}

.gridContainer.conflictGroup {
grid-template-columns: var(--grid-type) var(--grid-info) var(--grid-date) var(--grid-confirmations) var(--grid-status) var(
--grid-actions
);
grid-template-columns: var(--grid-type) var(--grid-info) var(--grid-date) var(--grid-confirmations) var(
--grid-status
) var(--grid-actions);
grid-template-areas: 'type info date confirmations status actions';
}

Expand Down
Loading

0 comments on commit 2e50b13

Please sign in to comment.