From f7afb4fe882bdb6602582931125c42e5015411a8 Mon Sep 17 00:00:00 2001 From: katspaugh <381895+katspaugh@users.noreply.github.com> Date: Mon, 30 Dec 2024 14:24:41 +0300 Subject: [PATCH] Use CGW --- .../transactions/TxDetails/TxNote.tsx | 35 +------------------ .../transactions/TxDetails/styles.module.css | 4 +++ 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/apps/web/src/components/transactions/TxDetails/TxNote.tsx b/apps/web/src/components/transactions/TxDetails/TxNote.tsx index 3828c63b03..468e671713 100644 --- a/apps/web/src/components/transactions/TxDetails/TxNote.tsx +++ b/apps/web/src/components/transactions/TxDetails/TxNote.tsx @@ -1,42 +1,9 @@ import { Tooltip, Typography } from '@mui/material' import type { TransactionDetails } from '@safe-global/safe-gateway-typescript-sdk' -import useAsync from '@/hooks/useAsync' -import { useCurrentChain } from '@/hooks/useChains' -import { isMultisigDetailedExecutionInfo } from '@/utils/transaction-guards' import InfoIcon from '@/public/images/notifications/info.svg' -function useTxNote(txDetails: TransactionDetails | undefined): string | undefined { - const currentChain = useCurrentChain() - const txService = currentChain?.transactionService - - let safeTxHash = '' - if (txDetails && 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: string | undefined - if (data) { - try { - const origin = JSON.parse(data.origin) - const parsedName = JSON.parse(origin.name) - if (typeof parsedName.note === 'string') { - note = parsedName.note - } - } catch { - // Ignore, no note - } - } - - return note -} - const TxNote = ({ txDetails }: { txDetails: TransactionDetails | undefined }) => { - const note = useTxNote(txDetails) + const note = (txDetails as TransactionDetails & { note: string | null })?.note return note ? (