From 25ddd7fdfd4c0ba635dd433e15e098136858fde1 Mon Sep 17 00:00:00 2001 From: Atatakai Date: Wed, 23 Oct 2024 12:52:05 +0400 Subject: [PATCH] (registry) feat: update address links to support mode --- .gitleaksignore | 8 ++++- .../common-util/List/ListTable/helpers.jsx | 5 ++-- .../ServiceState/4thStepDeployed/index.jsx | 29 ++++++------------- libs/ui-components/src/lib/AddressLink.tsx | 2 ++ libs/util-constants/src/lib/exploreUrls.ts | 26 ++++++++++++++++- 5 files changed, 46 insertions(+), 24 deletions(-) diff --git a/.gitleaksignore b/.gitleaksignore index d225677f..cfe17a36 100644 --- a/.gitleaksignore +++ b/.gitleaksignore @@ -158,4 +158,10 @@ c286a015e94a4abfa474749e6d0d38d944b25e8b:apps/govern/common-util/Contracts/addre 6cf8d7df061c4bdb1e3ccbb8dbf3585b715ad874:apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWsolDeposit.jsx:generic-api-key:53 dcc2ad3b708d9ac49cf82b6e0401fdf78531fa05:apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useWsolDeposit.jsx:generic-api-key:53 bc71dcb01b1c2619cc3805ad410fabc6f97b6e6d:apps/bond/components/Paths/data.json:generic-api-key:208 -613a7a61c1721d690c3ab3055e8fe97471c91a58:apps/bond/components/Paths/data.json:generic-api-key:168 \ No newline at end of file +613a7a61c1721d690c3ab3055e8fe97471c91a58:apps/bond/components/Paths/data.json:generic-api-key:168 +d8375c535fba0ffcd1161714448dc92a84b17858:apps/autonolas-registry/common-util/Contracts/addresses.tsx:generic-api-key:63 +d8375c535fba0ffcd1161714448dc92a84b17858:apps/autonolas-registry/common-util/Contracts/addresses.tsx:generic-api-key:65 +d8375c535fba0ffcd1161714448dc92a84b17858:apps/autonolas-registry/common-util/Contracts/addresses.tsx:generic-api-key:125 +d8375c535fba0ffcd1161714448dc92a84b17858:apps/autonolas-registry/common-util/Contracts/addresses.tsx:generic-api-key:127 +d8375c535fba0ffcd1161714448dc92a84b17858:apps/autonolas-registry/common-util/Contracts/addresses.tsx:generic-api-key:131 +d8375c535fba0ffcd1161714448dc92a84b17858:apps/autonolas-registry/common-util/Contracts/addresses.tsx:generic-api-key:133 \ No newline at end of file diff --git a/apps/autonolas-registry/common-util/List/ListTable/helpers.jsx b/apps/autonolas-registry/common-util/List/ListTable/helpers.jsx index 0aba1b53..378db89b 100644 --- a/apps/autonolas-registry/common-util/List/ListTable/helpers.jsx +++ b/apps/autonolas-registry/common-util/List/ListTable/helpers.jsx @@ -1,6 +1,7 @@ import { Button, Space } from 'antd'; import { AddressLink, NA, areAddressesEqual } from '@autonolas/frontend-library'; +import { AddressLink as AddressLinkSimple } from 'libs/ui-components/src'; import { HASH_PREFIX, @@ -145,9 +146,9 @@ export const getTableColumns = ( dataIndex: 'owner', key: 'owner', width: 200, - render: (text) => { + render: (text, record) => { if (!text || text === NA) return NA; - return ; + return ; }, }; diff --git a/apps/autonolas-registry/components/ListServices/ServiceState/4thStepDeployed/index.jsx b/apps/autonolas-registry/components/ListServices/ServiceState/4thStepDeployed/index.jsx index e6b5a714..bd027418 100644 --- a/apps/autonolas-registry/components/ListServices/ServiceState/4thStepDeployed/index.jsx +++ b/apps/autonolas-registry/components/ListServices/ServiceState/4thStepDeployed/index.jsx @@ -1,13 +1,12 @@ -import { Space, Table } from 'antd'; +import { Space, Table, Flex } from 'antd'; import PropTypes from 'prop-types'; -import { useEffect, useMemo, useState } from 'react'; +import { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { AddressLink } from '@autonolas/frontend-library'; +import { AddressLink } from 'libs/ui-components/src'; import { SendTransactionButton } from 'common-util/TransactionHelpers/SendTransactionButton'; import { useHelpers } from 'common-util/hooks/useHelpers'; -import { useScreen } from 'common-util/hooks/useScreen'; import { setAgentInstancesAndOperators } from '../../../../store/service'; import { useAgentInstanceAndOperator } from '../../hooks/useSvmService'; @@ -24,8 +23,7 @@ export const Deployed = ({ handleTerminate, }) => { const dispatch = useDispatch(); - const { account, chainId, isSvm, chainName } = useHelpers(); - const { isMobile } = useScreen(); + const { account, chainId, isSvm } = useHelpers(); const data = useSelector((state) => state?.service?.agentInstancesAndOperators); const [isTerminating, setIsTerminating] = useState(false); const { getSvmAgentInstanceAndOperator } = useAgentInstanceAndOperator(); @@ -60,15 +58,6 @@ export const Deployed = ({ } }; - const addressLinkProps = useMemo( - () => ({ - chainId, - chainName, - suffixCount: isMobile ? 4 : 6, - }), - [chainName, isMobile, chainId], - ); - return (
@@ -83,23 +72,23 @@ export const Deployed = ({ title: 'Agent Instances', dataIndex: 'agentInstance', key: 'agentInstance', - render: (text) => , + render: (text) => , width: '50%', }, { title: 'Operators', dataIndex: 'operatorAddress', key: 'operatorAddress', - render: (text) => , + render: (text) => , width: '50%', }, ]} /> )} -
+ {`${isSvm ? 'Squads' : 'Safe'} contract address:`} - -
+ + {getButton( {`${truncateAddress(address)} ${UNICODE_SYMBOLS.EXTERNAL_LINK}`} diff --git a/libs/util-constants/src/lib/exploreUrls.ts b/libs/util-constants/src/lib/exploreUrls.ts index 33dab51e..bcdcaf8c 100644 --- a/libs/util-constants/src/lib/exploreUrls.ts +++ b/libs/util-constants/src/lib/exploreUrls.ts @@ -1,4 +1,20 @@ -import { arbitrum, base, celo, gnosis, mainnet, optimism, polygon } from 'viem/chains'; +import { + arbitrum, + arbitrumSepolia, + base, + baseSepolia, + celo, + celoAlfajores, + gnosis, + gnosisChiado, + goerli, + mainnet, + mode, + optimism, + optimismSepolia, + polygon, + polygonMumbai, +} from 'viem/chains'; export const EXPLORER_URLS: Record = { [mainnet.id]: mainnet.blockExplorers.default.url, @@ -8,4 +24,12 @@ export const EXPLORER_URLS: Record = { [base.id]: base.blockExplorers.default.url, [arbitrum.id]: arbitrum.blockExplorers.default.url, [celo.id]: celo.blockExplorers.default.url, + [mode.id]: mode.blockExplorers.default.url, + [goerli.id]: goerli.blockExplorers.default.url, + [gnosisChiado.id]: gnosisChiado.blockExplorers.default.url, + [polygonMumbai.id]: polygonMumbai.blockExplorers.default.url, + [baseSepolia.id]: baseSepolia.blockExplorers.default.url, + [arbitrumSepolia.id]: arbitrumSepolia.blockExplorers.default.url, + [optimismSepolia.id]: optimismSepolia.blockExplorers.default.url, + [celoAlfajores.id]: celoAlfajores.blockExplorers.default.url, };