diff --git a/package.json b/package.json index 55d13e0af4..6fde28c067 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "@safe-global/protocol-kit": "^4.1.0", "@safe-global/safe-apps-sdk": "^9.1.0", "@safe-global/safe-deployments": "^1.37.3", - "@safe-global/safe-gateway-typescript-sdk": "3.22.1", + "@safe-global/safe-gateway-typescript-sdk": "3.22.2", "@safe-global/safe-modules-deployments": "^1.2.0", "@sentry/react": "^7.91.0", "@spindl-xyz/attribution-lite": "^1.4.0", diff --git a/src/components/common/CheckWallet/index.tsx b/src/components/common/CheckWallet/index.tsx index 9da8c9700e..59ab6e7c30 100644 --- a/src/components/common/CheckWallet/index.tsx +++ b/src/components/common/CheckWallet/index.tsx @@ -1,3 +1,4 @@ +import { useIsWalletDelegate } from '@/hooks/useDelegates' import { type ReactElement } from 'react' import { Tooltip } from '@mui/material' import useIsOnlySpendingLimitBeneficiary from '@/hooks/useIsOnlySpendingLimitBeneficiary' @@ -24,12 +25,15 @@ const CheckWallet = ({ children, allowSpendingLimit, allowNonOwner, noTooltip }: const isSafeOwner = useIsSafeOwner() const isSpendingLimit = useIsOnlySpendingLimitBeneficiary() const connectWallet = useConnectWallet() + const isDelegate = useIsWalletDelegate() const { safe } = useSafeInfo() const isCounterfactualMultiSig = !allowNonOwner && !safe.deployed && safe.threshold > 1 const message = - wallet && (isSafeOwner || allowNonOwner || (isSpendingLimit && allowSpendingLimit)) && !isCounterfactualMultiSig + wallet && + (isSafeOwner || allowNonOwner || (isSpendingLimit && allowSpendingLimit) || isDelegate) && + !isCounterfactualMultiSig ? '' : !wallet ? Message.WalletNotConnected diff --git a/src/components/common/WalletProvider/index.tsx b/src/components/common/WalletProvider/index.tsx index f1c360c68d..6e14266d1a 100644 --- a/src/components/common/WalletProvider/index.tsx +++ b/src/components/common/WalletProvider/index.tsx @@ -13,6 +13,7 @@ const WalletProvider = ({ children }: { children: ReactNode }): ReactElement => const walletSubscription = onboard.state.select('wallets').subscribe((wallets) => { const newWallet = getConnectedWallet(wallets) + setWallet(newWallet) }) diff --git a/src/components/settings/DelegatesList/index.tsx b/src/components/settings/DelegatesList/index.tsx index 1610e2db82..9aa65bb02c 100644 --- a/src/components/settings/DelegatesList/index.tsx +++ b/src/components/settings/DelegatesList/index.tsx @@ -1,28 +1,14 @@ -import { getDelegates } from '@safe-global/safe-gateway-typescript-sdk' -import useAsync from '@/hooks/useAsync' -import useSafeInfo from '@/hooks/useSafeInfo' +import useDelegates from '@/hooks/useDelegates' import { Box, Grid, Paper, SvgIcon, Tooltip, Typography } from '@mui/material' import EthHashInfo from '@/components/common/EthHashInfo' import InfoIcon from '@/public/images/notifications/info.svg' import ExternalLink from '@/components/common/ExternalLink' import { HelpCenterArticle } from '@/config/constants' -const useDelegates = () => { - const { - safe: { chainId }, - safeAddress, - } = useSafeInfo() - const [delegates] = useAsync(() => { - if (!chainId || !safeAddress) return - return getDelegates(chainId, { safe: safeAddress }) - }, [chainId, safeAddress]) - return delegates -} - const DelegatesList = () => { const delegates = useDelegates() - if (!delegates?.results.length) return null + if (!delegates.data?.results) return null return ( @@ -55,7 +41,7 @@ const DelegatesList = () => {