diff --git a/apps/web/src/features/bundle/index.tsx b/apps/web/src/features/bundle/index.tsx index 4f2336f8d8..87c045387b 100644 --- a/apps/web/src/features/bundle/index.tsx +++ b/apps/web/src/features/bundle/index.tsx @@ -1,13 +1,17 @@ import EthHashInfo from '@/components/common/EthHashInfo' import FiatValue from '@/components/common/FiatValue' import Identicon from '@/components/common/Identicon' +import PaginatedTxns from '@/components/common/PaginatedTxns' import { TxModalContext } from '@/components/tx-flow' import TokenTransferFlow from '@/components/tx-flow/flows/TokenTransfer' import { AppRoutes } from '@/config/routes' import type { SafeItem } from '@/features/myAccounts/hooks/useAllSafes' import useSafeInfo from '@/hooks/useSafeInfo' +import useTxQueue from '@/hooks/useTxQueue' import useWallet from '@/hooks/wallets/useWallet' +import { useAppSelector } from '@/store' import { useGetMultipleSafeOverviewsQuery } from '@/store/api/gateway' +import { selectCurrency } from '@/store/settingsSlice' import { parsePrefixedAddress, sameAddress } from '@/utils/addresses' import { Box, @@ -28,8 +32,6 @@ import { import Button from '@mui/material/Button' import ListItemButton from '@mui/material/ListItemButton' import { networks } from '@safe-global/protocol-kit/dist/src/utils/eip-3770/config' -import { type SafeOverview } from '@safe-global/safe-gateway-typescript-sdk' -import classNames from 'classnames' import Link from 'next/link' import { useRouter } from 'next/router' import { useContext, useState } from 'react' @@ -38,30 +40,14 @@ import IosShareIcon from '@mui/icons-material/IosShare' type Chains = Record -type OwnerCount = { - address: string - safeCount: number -} - -function getOwnersWithMultipleSafes(safes?: SafeOverview[]): OwnerCount[] { - if (!safes) return [] - - // Count occurrences of each owner across all safes - const ownerCounts = safes.reduce((acc: Record, safe) => { - safe.owners.forEach((owner) => { - acc[owner.value] = (acc[owner.value] || 0) + 1 - }) - return acc - }, {}) - - // Filter owners who are part of at least two safes and format the result - return Object.entries(ownerCounts) - .map(([owner, count]) => ({ address: owner, safeCount: count })) - .sort((a, b) => b.safeCount - a.safeCount) -} +const chains = networks.reduce((result, { shortName, chainId }) => { + result[chainId.toString()] = shortName.toString() + return result +}, {}) const Bundle = () => { const [tooltipText, setTooltipText] = useState('Share Safe Bundle') + const currency = useAppSelector(selectCurrency) const { setTxFlow, setFullWidth } = useContext(TxModalContext) const { safe: safeInfo } = useSafeInfo() @@ -88,18 +74,12 @@ const Bundle = () => { const { address: selectedSafe } = parsePrefixedAddress(selectedSafeAddress) const { data: safeOverviews } = useGetMultipleSafeOverviewsQuery({ - currency: 'usd', + currency, walletAddress: wallet?.address, safes: parsedSafes, }) - const chains = networks.reduce((result, { shortName, chainId }) => { - result[chainId.toString()] = shortName.toString() - return result - }, {}) - const totalBalance = safeOverviews?.reduce((prev, current) => prev + Number(current.fiatTotal), Number(0)) - const sharedOwners = getOwnersWithMultipleSafes(safeOverviews) const onNewTxClick = async () => { setFullWidth(true) @@ -139,6 +119,7 @@ const Bundle = () => { + @@ -206,31 +187,33 @@ const Bundle = () => { - {sharedOwners.length > 0 && ( - - - - Signers - + + + + Queue + + + + + + + + + + Signers + + {currentSafeOwners.length > 0 ? ( - {sharedOwners?.map((owner) => { + {currentSafeOwners.map((owner) => { return ( - - sameAddress(currentOwner.value, owner.address), - ), - })} - > + {
-
-
- )} + ) : ( + Select a Safe to see the signers + )} +
+
) diff --git a/apps/web/src/features/bundle/styles.module.css b/apps/web/src/features/bundle/styles.module.css index d1ab38c366..b0dfc6d385 100644 --- a/apps/web/src/features/bundle/styles.module.css +++ b/apps/web/src/features/bundle/styles.module.css @@ -36,7 +36,3 @@ border: 1px solid var(--color-border-light); border-radius: 4px; } - -.currentOwner { - background: var(--color-background-light); -}