diff --git a/.eslintrc.json b/.eslintrc.json index 88a2bbcb..f92fcd6c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,6 +7,26 @@ "jest": true, "es6": true }, + "extends": ["next/core-web-vitals", "plugin:prettier/recommended"], + "rules": { + "prettier/prettier": ["error", { + "endOfLine": "auto", + "semi": true, + "trailingComma": "all", + "singleQuote": true, + "printWidth": 100, + "tabWidth": 2, + "importOrderSeparation": true, + "importOrderSortSpecifiers": true, + "importOrder": [ + "", + "^@autonolas/(.*)$", + "^libs/*", + "^(store|util|common-util|components|data|hooks|context|types)/(.*)$", + "^[./]" + ] + }] + }, "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index ed5f0104..00000000 --- a/.prettierrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "semi": true, - "trailingComma": "all", - "singleQuote": true, - "printWidth": 100, - "tabWidth": 2, - "importOrderSeparation": true, - "importOrderSortSpecifiers": true, - "importOrder": [ - "", - "^@autonolas/(.*)$", - "^libs/*", - "^(store|util|common-util|components|data|hooks|context|types)/(.*)$", - "^[./]" - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..c317dc8a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, + "editor.defaultFormatter": "dbaeumer.vscode-eslint", + "editor.formatOnSave": true +} \ No newline at end of file diff --git a/apps/autonolas-registry/common-util/AbiAndAddresses/MultiSend.jsx b/apps/autonolas-registry/common-util/AbiAndAddresses/MultiSend.jsx index 062d9503..7c6e1816 100644 --- a/apps/autonolas-registry/common-util/AbiAndAddresses/MultiSend.jsx +++ b/apps/autonolas-registry/common-util/AbiAndAddresses/MultiSend.jsx @@ -1,8 +1,7 @@ export const MULTI_SEND_CONTRACT = { _format: 'hh-sol-artifact-1', contractName: 'MultiSendCallOnly', - sourceName: - '@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol', + sourceName: '@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol', abi: [ { inputs: [ diff --git a/apps/autonolas-registry/common-util/ContractUtils/myList.jsx b/apps/autonolas-registry/common-util/ContractUtils/myList.jsx index 2ee243a2..ecad07be 100644 --- a/apps/autonolas-registry/common-util/ContractUtils/myList.jsx +++ b/apps/autonolas-registry/common-util/ContractUtils/myList.jsx @@ -2,29 +2,24 @@ import includes from 'lodash/includes'; import { getFirstAndLastIndex } from '../List/functions'; -export const filterByOwner = (results, { searchValue, account }) => (results || []).filter((e) => { - const search = (searchValue || '').trim().toLowerCase(); - const ownerL = (e.owner || '').trim().toLowerCase(); - const hashL = (e.unitHash || '').trim().toLowerCase(); - - // for "my components/agents" search only by Account - if (account) { - return ownerL === account.trim().toLowerCase() && includes(hashL, search); - } - - return includes(ownerL, search) || includes(hashL, search); -}); +export const filterByOwner = (results, { searchValue, account }) => + (results || []).filter((e) => { + const search = (searchValue || '').trim().toLowerCase(); + const ownerL = (e.owner || '').trim().toLowerCase(); + const hashL = (e.unitHash || '').trim().toLowerCase(); + + // for "my components/agents" search only by Account + if (account) { + return ownerL === account.trim().toLowerCase() && includes(hashL, search); + } + + return includes(ownerL, search) || includes(hashL, search); + }); /** * get all the list and filter by owner */ -export const getListByAccount = async ({ - searchValue, - total, - getUnit, - getOwner, - account, -}) => { +export const getListByAccount = async ({ searchValue, total, getUnit, getOwner, account }) => { const allListPromise = []; for (let i = 1; i <= total; i += 1) { const id = `${i}`; diff --git a/apps/autonolas-registry/common-util/Contracts/addresses.tsx b/apps/autonolas-registry/common-util/Contracts/addresses.tsx index d494cf55..5e5525e0 100644 --- a/apps/autonolas-registry/common-util/Contracts/addresses.tsx +++ b/apps/autonolas-registry/common-util/Contracts/addresses.tsx @@ -1,9 +1,5 @@ import { Address } from 'viem'; -import { - LOCAL_FORK_ID, - LOCAL_FORK_ID_GNOSIS, - LOCAL_FORK_ID_POLYGON, -} from '../../util/constants'; +import { LOCAL_FORK_ID, LOCAL_FORK_ID_GNOSIS, LOCAL_FORK_ID_POLYGON } from '../../util/constants'; type Addresses = { serviceManagerToken: Address; diff --git a/apps/autonolas-registry/common-util/Details/DetailsSubInfo/RewardsSection.tsx b/apps/autonolas-registry/common-util/Details/DetailsSubInfo/RewardsSection.tsx index 130853e6..1654d1be 100644 --- a/apps/autonolas-registry/common-util/Details/DetailsSubInfo/RewardsSection.tsx +++ b/apps/autonolas-registry/common-util/Details/DetailsSubInfo/RewardsSection.tsx @@ -65,7 +65,13 @@ const getColumns = ( }, ]; -export const RewardsSection: FC = ({ ownerAddress, isOwner, id, type, dataTestId }) => { +export const RewardsSection: FC = ({ + ownerAddress, + isOwner, + id, + type, + dataTestId, +}) => { const { account } = useHelpers(); const [isClaimLoading, setIsClaimLoading] = useState(false); diff --git a/apps/autonolas-registry/common-util/Details/ServiceDetails/useOperatorWhitelistComponent.jsx b/apps/autonolas-registry/common-util/Details/ServiceDetails/useOperatorWhitelistComponent.jsx index 083c07e7..03e110f8 100644 --- a/apps/autonolas-registry/common-util/Details/ServiceDetails/useOperatorWhitelistComponent.jsx +++ b/apps/autonolas-registry/common-util/Details/ServiceDetails/useOperatorWhitelistComponent.jsx @@ -1,10 +1,7 @@ import { useCallback, useEffect, useState } from 'react'; import { Switch } from 'antd'; -import { - checkIfServiceRequiresWhitelisting, - setOperatorsCheckRequest, -} from '../utils'; +import { checkIfServiceRequiresWhitelisting, setOperatorsCheckRequest } from '../utils'; import { useHelpers } from '../../hooks'; import { OperatorWhitelist, SetOperatorStatus } from './OperatorWhitelist'; @@ -94,20 +91,14 @@ export const useOperatorWhitelistComponent = (id, isOwner) => { * Operator Whitelist component */ const operatorWhitelistValue = ( - + ); /** * * Operator Status component */ - const operatorStatusValue = ( - - ); + const operatorStatusValue = ; return { operatorWhitelistTitle, diff --git a/apps/autonolas-registry/common-util/Details/styles.tsx b/apps/autonolas-registry/common-util/Details/styles.tsx index 8fd27d73..9706ed15 100644 --- a/apps/autonolas-registry/common-util/Details/styles.tsx +++ b/apps/autonolas-registry/common-util/Details/styles.tsx @@ -74,4 +74,4 @@ export const SectionContainer = styled.div` .ant-form-item-label > label { left: -4px; } -`; \ No newline at end of file +`; diff --git a/apps/autonolas-registry/common-util/List/ListTable/useExtraTabContent.tsx b/apps/autonolas-registry/common-util/List/ListTable/useExtraTabContent.tsx index 221c561b..9591c4b8 100644 --- a/apps/autonolas-registry/common-util/List/ListTable/useExtraTabContent.tsx +++ b/apps/autonolas-registry/common-util/List/ListTable/useExtraTabContent.tsx @@ -31,7 +31,7 @@ export const useExtraTabContent = ({ const { account, isMainnet } = useHelpers(); // search query is supported only in mainnet for now (as subgraph is available only in mainnet) - const searchQuery = isMainnet ? router.query.search ?? '' : ''; + const searchQuery = isMainnet ? (router.query.search ?? '') : ''; const [searchValue, setSearchValue] = useState(searchQuery); // to control the search const [value, setValue] = useState(searchQuery); // to control the input field diff --git a/apps/autonolas-registry/common-util/List/RegisterForm/helpers.jsx b/apps/autonolas-registry/common-util/List/RegisterForm/helpers.jsx index 9d3a95b8..dc41fbe1 100644 --- a/apps/autonolas-registry/common-util/List/RegisterForm/helpers.jsx +++ b/apps/autonolas-registry/common-util/List/RegisterForm/helpers.jsx @@ -25,21 +25,12 @@ export const FormItemHash = ({ listType, hashValue }) => ( disabled addonBefore={HASH_PREFIX} addonAfter={ - + { if (hashValue) { - window.open( - `${GATEWAY_URL}${HASH_PREFIX}${hashValue}`, - '_blank', - ); + window.open(`${GATEWAY_URL}${HASH_PREFIX}${hashValue}`, '_blank'); } }} /> diff --git a/apps/autonolas-registry/common-util/hooks/useHandleRoute.jsx b/apps/autonolas-registry/common-util/hooks/useHandleRoute.jsx index 0ddc4e2a..af0676ef 100644 --- a/apps/autonolas-registry/common-util/hooks/useHandleRoute.jsx +++ b/apps/autonolas-registry/common-util/hooks/useHandleRoute.jsx @@ -2,31 +2,20 @@ import { useCallback, useEffect } from 'react'; import { useDispatch } from 'react-redux'; import { useRouter } from 'next/router'; import { toLower } from 'lodash'; - + import { setVmInfo, setChainId } from 'store/setup'; -import { - PAGES_TO_LOAD_WITHOUT_CHAINID, - SOLANA_CHAIN_NAMES, - URL, -} from 'util/constants'; +import { PAGES_TO_LOAD_WITHOUT_CHAINID, SOLANA_CHAIN_NAMES, URL } from 'util/constants'; import { useHelpers } from '../hooks'; import { ALL_SUPPORTED_CHAINS, EVM_SUPPORTED_CHAINS } from '../Login/config'; -import { - doesPathIncludesComponentsOrAgents, - isPageWithSolana, -} from '../functions'; +import { doesPathIncludesComponentsOrAgents, isPageWithSolana } from '../functions'; const isValidNetworkName = (name) => { - const isValid = ALL_SUPPORTED_CHAINS.some( - (e) => toLower(e.networkName) === toLower(name), - ); + const isValid = ALL_SUPPORTED_CHAINS.some((e) => toLower(e.networkName) === toLower(name)); return isValid; }; const getChainIdFromPath = (networkName) => - EVM_SUPPORTED_CHAINS.find( - (e) => toLower(e.networkName) === toLower(networkName), - )?.id; + EVM_SUPPORTED_CHAINS.find((e) => toLower(e.networkName) === toLower(networkName))?.id; const isValidL1NetworkName = (name) => { if (name === 'ethereum') return true; @@ -44,16 +33,22 @@ export const useHandleRoute = () => { const path = router?.pathname || ''; const networkNameFromUrl = router?.query?.network; - const dispatchWithDelay = useCallback((action) => { - setTimeout(() => { - dispatch(action); - }, 0); - }, [dispatch]); + const dispatchWithDelay = useCallback( + (action) => { + setTimeout(() => { + dispatch(action); + }, 0); + }, + [dispatch], + ); - const updateChainId = useCallback((id) => { - sessionStorage.setItem('chainId', id); - dispatchWithDelay(setChainId(id)); - }, [dispatchWithDelay]); + const updateChainId = useCallback( + (id) => { + sessionStorage.setItem('chainId', id); + dispatchWithDelay(setChainId(id)); + }, + [dispatchWithDelay], + ); // updating the blockchain information in redux useEffect(() => { @@ -115,13 +110,8 @@ export const useHandleRoute = () => { */ // User navigates to `/[network]` - if ( - !PAGES_TO_LOAD_WITHOUT_CHAINID.includes(router.asPath) && - pathArray.length === 1 - ) { - router.push( - `/${networkNameFromUrl}/${isL1Network ? 'components' : 'services'}`, - ); + if (!PAGES_TO_LOAD_WITHOUT_CHAINID.includes(router.asPath) && pathArray.length === 1) { + router.push(`/${networkNameFromUrl}/${isL1Network ? 'components' : 'services'}`); return; } @@ -136,10 +126,7 @@ export const useHandleRoute = () => { * because components & agents are not supported on gnosis */ - if ( - !isValidL1NetworkName(networkNameFromUrl) && - doesPathIncludesComponentsOrAgents(path) - ) { + if (!isValidL1NetworkName(networkNameFromUrl) && doesPathIncludesComponentsOrAgents(path)) { router.push(`/${networkNameFromUrl}/services`); } }, [path, networkNameFromUrl, isL1Network, router]); diff --git a/apps/autonolas-registry/common-util/hooks/useHelpers.jsx b/apps/autonolas-registry/common-util/hooks/useHelpers.jsx index 84566efd..d1cf330b 100644 --- a/apps/autonolas-registry/common-util/hooks/useHelpers.jsx +++ b/apps/autonolas-registry/common-util/hooks/useHelpers.jsx @@ -53,8 +53,7 @@ export const useHelpers = () => { chainName, isL1OnlyNetwork: isL1OnlyNetworkFn(chainId), isL1Network: isL1NetworkFn(chainId), - doesNetworkHaveValidServiceManagerToken: - doesNetworkHaveValidServiceManagerTokenFn(chainId), + doesNetworkHaveValidServiceManagerToken: doesNetworkHaveValidServiceManagerTokenFn(chainId), links: updatedLinks, isConnectedToWrongNetwork, isMainnet: chainId === 1, diff --git a/apps/autonolas-registry/common-util/hooks/useMetadata.jsx b/apps/autonolas-registry/common-util/hooks/useMetadata.jsx index ae77c767..f08cdc71 100644 --- a/apps/autonolas-registry/common-util/hooks/useMetadata.jsx +++ b/apps/autonolas-registry/common-util/hooks/useMetadata.jsx @@ -4,8 +4,7 @@ import { notifyError, NA } from '@autonolas/frontend-library'; import { GATEWAY_URL, HASH_DETAILS_STATE } from '../../util/constants'; const pattern = /https:\/\/localhost\/(agent|component|service)\/+/g; -const getAutonolasTokenUri = (tokenUri) => - (tokenUri || '').replace(pattern, GATEWAY_URL); +const getAutonolasTokenUri = (tokenUri) => (tokenUri || '').replace(pattern, GATEWAY_URL); /** * NFT details: hook to fetch metadata from IPFS @@ -13,9 +12,7 @@ const getAutonolasTokenUri = (tokenUri) => */ export const useMetadata = (tokenUri) => { const [metadata, setMetadata] = useState(null); - const [metadataLoadState, setMetadataState] = useState( - HASH_DETAILS_STATE.IS_LOADING, - ); + const [metadataLoadState, setMetadataState] = useState(HASH_DETAILS_STATE.IS_LOADING); // fetch metadata from IPFS useEffect(() => { diff --git a/apps/autonolas-registry/common-util/hooks/useScreen.jsx b/apps/autonolas-registry/common-util/hooks/useScreen.jsx index c8399597..ce60458a 100644 --- a/apps/autonolas-registry/common-util/hooks/useScreen.jsx +++ b/apps/autonolas-registry/common-util/hooks/useScreen.jsx @@ -4,17 +4,11 @@ const { useBreakpoint } = Grid; export const useScreen = () => { const screens = useBreakpoint(); - const isMobile = (screens.sm || screens.xs) - && !screens.md - && !screens.lg - && !screens.xl - && !screens.xxl; + const isMobile = + (screens.sm || screens.xs) && !screens.md && !screens.lg && !screens.xl && !screens.xxl; - const isTablet = (screens.md || screens.lg) - && !screens.xs - && !screens.sm - && !screens.xl - && !screens.xxl; + const isTablet = + (screens.md || screens.lg) && !screens.xs && !screens.sm && !screens.xl && !screens.xxl; return { isMobile, isTablet, ...screens }; }; diff --git a/apps/autonolas-registry/common-util/hooks/useSubgraph.jsx b/apps/autonolas-registry/common-util/hooks/useSubgraph.jsx index 45745f99..e301fb7d 100644 --- a/apps/autonolas-registry/common-util/hooks/useSubgraph.jsx +++ b/apps/autonolas-registry/common-util/hooks/useSubgraph.jsx @@ -1,16 +1,13 @@ import { GraphQLClient } from 'graphql-request'; import { HASH_PREFIX } from '../../util/constants'; -export const GRAPHQL_CLIENT = new GraphQLClient( - process.env.NEXT_PUBLIC_AUTONOLAS_SUB_GRAPH_URL, - { - method: 'POST', - jsonSerializer: { - parse: JSON.parse, - stringify: JSON.stringify, - }, +export const GRAPHQL_CLIENT = new GraphQLClient(process.env.NEXT_PUBLIC_AUTONOLAS_SUB_GRAPH_URL, { + method: 'POST', + jsonSerializer: { + parse: JSON.parse, + stringify: JSON.stringify, }, -); +}); export const UNIT_FIELDS = `{ id diff --git a/apps/autonolas-registry/common-util/hooks/useSvmConnectivity.jsx b/apps/autonolas-registry/common-util/hooks/useSvmConnectivity.jsx index f494119e..36d10d81 100644 --- a/apps/autonolas-registry/common-util/hooks/useSvmConnectivity.jsx +++ b/apps/autonolas-registry/common-util/hooks/useSvmConnectivity.jsx @@ -7,16 +7,11 @@ import { web3, setProvider } from '@coral-xyz/anchor'; import { SOLANA_CHAIN_NAMES } from '../../util/constants'; import idl from '../AbiAndAddresses/ServiceRegistrySolana.json'; -import { - SOLANA_ADDRESSES, - SOLANA_DEVNET_ADDRESSES, -} from '../Contracts/addresses'; +import { SOLANA_ADDRESSES, SOLANA_DEVNET_ADDRESSES } from '../Contracts/addresses'; import { useHelpers } from './index'; const NODE_WALLET = new NodeWallet(Keypair.generate()); -const TEMP_PUBLIC_KEY = new web3.PublicKey( - process.env.NEXT_PUBLIC_SVM_PUBLIC_KEY, -); +const TEMP_PUBLIC_KEY = new web3.PublicKey(process.env.NEXT_PUBLIC_SVM_PUBLIC_KEY); /** * hook to get svm info @@ -30,9 +25,7 @@ export const useSvmConnectivity = () => { // program addresses const solanaAddresses = useMemo( - () => (chainName === SOLANA_CHAIN_NAMES.MAINNET - ? SOLANA_ADDRESSES - : SOLANA_DEVNET_ADDRESSES), + () => (chainName === SOLANA_CHAIN_NAMES.MAINNET ? SOLANA_ADDRESSES : SOLANA_DEVNET_ADDRESSES), [chainName], ); @@ -63,10 +56,7 @@ export const useSvmConnectivity = () => { [customProvider, programId], ); - const walletPublicKey = useMemo( - () => actualWallet || TEMP_PUBLIC_KEY, - [actualWallet], - ); + const walletPublicKey = useMemo(() => actualWallet || TEMP_PUBLIC_KEY, [actualWallet]); return { walletPublicKey, diff --git a/apps/autonolas-registry/components/Disclaimer/index.jsx b/apps/autonolas-registry/components/Disclaimer/index.jsx index c409b0e8..d6b7fc49 100644 --- a/apps/autonolas-registry/components/Disclaimer/index.jsx +++ b/apps/autonolas-registry/components/Disclaimer/index.jsx @@ -22,54 +22,46 @@ export const Disclaimer = () => (
  1. This App is owned by the Autonolas DAO and operated by  - + Centrality Labs - . This App is for the Autonolas community to encourage Autonolas - ecosystem contributors and users to unlock Autonolas governance. + . This App is for the Autonolas community to encourage Autonolas ecosystem contributors + and users to unlock Autonolas governance.
  2. - THIS APP IS PROVIDED "AS IS" AND "AS AVAILABLE," - AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. Neither - Autonolas nor Centrality Labs will be liable for any loss, whether - such loss is direct, indirect, special or consequential, suffered by - any party as a result of their use of this app. + THIS APP IS PROVIDED "AS IS" AND "AS AVAILABLE," AT YOUR OWN RISK, AND + WITHOUT WARRANTIES OF ANY KIND. Neither Autonolas nor Centrality Labs will be liable for + any loss, whether such loss is direct, indirect, special or consequential, suffered by any + party as a result of their use of this app.
  3. By accessing this app, you represent and warrant
    1. - that you are of legal age and that you will comply with any laws - applicable to you and not engage in any illegal activities; + that you are of legal age and that you will comply with any laws applicable to you and + not engage in any illegal activities;
    2. - that you are claiming OLAS tokens to participate in the Autonolas - DAO governance process and that they do not represent - consideration for past or future services; + that you are claiming OLAS tokens to participate in the Autonolas DAO governance + process and that they do not represent consideration for past or future services;
    3. - that you, the country you are a resident of and your wallet - address is not on any sanctions lists maintained by the United - Nations, Switzerland, the EU, UK or the US; + that you, the country you are a resident of and your wallet address is not on any + sanctions lists maintained by the United Nations, Switzerland, the EU, UK or the US;
    4. - that you are responsible for any tax obligations arising out of - the interaction with this app. + that you are responsible for any tax obligations arising out of the interaction with + this app.
  4. - None of the information available on this app, or made otherwise - available to you in relation to its use, constitutes any legal, tax, - financial or other advice. Where in doubt as to the action you should - take, please consult your own legal, financial, tax or other + None of the information available on this app, or made otherwise available to you in + relation to its use, constitutes any legal, tax, financial or other advice. Where in doubt + as to the action you should take, please consult your own legal, financial, tax or other professional advisors.
diff --git a/apps/autonolas-registry/components/HomePage/AutonolasServicesArchitected.jsx b/apps/autonolas-registry/components/HomePage/AutonolasServicesArchitected.jsx index 5e9bcf90..da4e3eda 100644 --- a/apps/autonolas-registry/components/HomePage/AutonolasServicesArchitected.jsx +++ b/apps/autonolas-registry/components/HomePage/AutonolasServicesArchitected.jsx @@ -39,14 +39,8 @@ export const AutonolasServicesArchitected = () => { How are Autonolas services architected? - {LIST.map(({ - title, desc, link, type, - }) => ( - + {LIST.map(({ title, desc, link, type }) => ( + { {isL1Network ? ( {`View all ${type}`} ) : ( - - {`Switch network (to Ethereum or Goerli) to view ${type}`} - + {`Switch network (to Ethereum or Goerli) to view ${type}`} )} )} diff --git a/apps/autonolas-registry/components/Layout/Footer.jsx b/apps/autonolas-registry/components/Layout/Footer.jsx index afaae277..126e72a2 100644 --- a/apps/autonolas-registry/components/Layout/Footer.jsx +++ b/apps/autonolas-registry/components/Layout/Footer.jsx @@ -1,10 +1,7 @@ import { useRouter } from 'next/router'; import Link from 'next/link'; import Image from 'next/image'; -import { - Footer as CommonFooter, - getExplorerURL, -} from '@autonolas/frontend-library'; +import { Footer as CommonFooter, getExplorerURL } from '@autonolas/frontend-library'; import { PAGES_TO_LOAD_WITHOUT_CHAINID } from 'util/constants'; import { ADDRESSES } from 'common-util/Contracts/addresses'; @@ -45,9 +42,7 @@ const ContractInfo = () => { return { registryText: 'ServiceRegistry', managerText: 'ServiceManager', - registry: isL1Network - ? addresses.serviceRegistry - : addresses.serviceRegistryL2, + registry: isL1Network ? addresses.serviceRegistry : addresses.serviceRegistryL2, manager: doesNetworkHaveValidServiceManagerToken ? addresses.serviceManagerToken : addresses.serviceManager, @@ -75,21 +70,14 @@ const ContractInfo = () => { ); - const { - registry, manager, managerText, registryText, - } = getCurrentPageAddresses(); + const { registry, manager, managerText, registryText } = getCurrentPageAddresses(); return ( {!PAGES_TO_LOAD_WITHOUT_CHAINID.includes(pathname) && ( <>
- Etherscan link + Etherscan link Contracts
{getContractInfo(registryText, registry)} @@ -104,7 +92,7 @@ const Footer = () => ( } rightContent={} - centerContent={( + centerContent={ <> © Autonolas DAO  {new Date().getFullYear()} @@ -119,7 +107,7 @@ const Footer = () => ( DAO Constitution - )} + } /> ); diff --git a/apps/autonolas-registry/components/Layout/index.jsx b/apps/autonolas-registry/components/Layout/index.jsx index e25dd420..c4d45f58 100644 --- a/apps/autonolas-registry/components/Layout/index.jsx +++ b/apps/autonolas-registry/components/Layout/index.jsx @@ -5,27 +5,15 @@ import dynamic from 'next/dynamic'; import PropTypes from 'prop-types'; import { Layout as AntdLayout, Select } from 'antd'; import { VM_TYPE, useScreen } from '@autonolas/frontend-library'; -import { - ConnectionProvider, - WalletProvider, -} from '@solana/wallet-adapter-react'; +import { ConnectionProvider, WalletProvider } from '@solana/wallet-adapter-react'; import { PhantomWalletAdapter } from '@solana/wallet-adapter-wallets'; import { PAGES_TO_LOAD_WITHOUT_CHAINID } from '../../util/constants'; import { useHelpers } from '../../common-util/hooks'; -import { - ALL_SUPPORTED_CHAINS, - getSvmEndpoint, -} from '../../common-util/Login/config'; +import { ALL_SUPPORTED_CHAINS, getSvmEndpoint } from '../../common-util/Login/config'; import { useHandleRoute } from '../../common-util/hooks/useHandleRoute'; import { LogoSvg, LogoIconSvg } from '../Logos'; -import { - CustomLayout, - Logo, - OlasHeader, - RightMenu, - SelectContainer, -} from './styles'; +import { CustomLayout, Logo, OlasHeader, RightMenu, SelectContainer } from './styles'; const Login = dynamic(() => import('../Login'), { ssr: false }); const NavigationMenu = dynamic(() => import('./Menu'), { ssr: false }); @@ -44,11 +32,7 @@ const Layout = ({ children }) => { return ( - + {isMobile || isTablet ? : } @@ -60,17 +44,13 @@ const Layout = ({ children }) => { listHeight={800} value={chainName} placeholder="Select Network" - disabled={PAGES_TO_LOAD_WITHOUT_CHAINID.some((e) => - path.includes(e), - )} + disabled={PAGES_TO_LOAD_WITHOUT_CHAINID.some((e) => path.includes(e))} options={ALL_SUPPORTED_CHAINS.map((e) => ({ label: e.networkDisplayName, value: e.networkName, }))} onChange={(value) => { - const currentChainInfo = ALL_SUPPORTED_CHAINS.find( - (e) => e.networkName === value, - ); + const currentChainInfo = ALL_SUPPORTED_CHAINS.find((e) => e.networkName === value); if (!currentChainInfo) return; @@ -117,9 +97,7 @@ const Layout = ({ children }) => { {/* chainId has to be set in redux before rendering any components OR the page doesn't depends on the chain Id OR it is SOLANA */} - {chainId || - isSvm || - PAGES_TO_LOAD_WITHOUT_CHAINID.some((e) => e === path) + {chainId || isSvm || PAGES_TO_LOAD_WITHOUT_CHAINID.some((e) => e === path) ? children : null} diff --git a/apps/autonolas-registry/components/ListAgents/index.jsx b/apps/autonolas-registry/components/ListAgents/index.jsx index ba3718e4..f6ffcbae 100644 --- a/apps/autonolas-registry/components/ListAgents/index.jsx +++ b/apps/autonolas-registry/components/ListAgents/index.jsx @@ -8,12 +8,7 @@ import { isMyTab } from 'common-util/List/ListTable/helpers'; import { ListTable, useExtraTabContent } from 'common-util/List/ListTable'; import { useHelpers } from 'common-util/hooks'; import { useAllAgents, useMyAgents, useSearchAgents } from './useAgentsList'; -import { - getAgents, - getFilteredAgents, - getTotalForAllAgents, - getTotalForMyAgents, -} from './utils'; +import { getAgents, getFilteredAgents, getTotalForAllAgents, getTotalForMyAgents } from './utils'; const ALL_AGENTS = 'all-agents'; const MY_AGENTS = 'my-agents'; @@ -21,12 +16,9 @@ const MY_AGENTS = 'my-agents'; const ListAgents = () => { const router = useRouter(); - const [currentTab, setCurrentTab] = useState( - isMyTab(router) ? MY_AGENTS : ALL_AGENTS, - ); + const [currentTab, setCurrentTab] = useState(isMyTab(router) ? MY_AGENTS : ALL_AGENTS); - const { account, chainId, links, isL1OnlyNetwork, isSvm, isMainnet } = - useHelpers(); + const { account, chainId, links, isL1OnlyNetwork, isSvm, isMainnet } = useHelpers(); const getAllAgents = useAllAgents(); const getMyAgents = useMyAgents(); @@ -160,14 +152,7 @@ const ListAgents = () => { setIsLoading(false); } })(); - }, [ - account, - searchValue, - currentTab, - currentPage, - getAgentsBySearch, - isMainnet, - ]); + }, [account, searchValue, currentTab, currentPage, getAgentsBySearch, isMainnet]); const tableCommonProps = { type: NAV_TYPES.AGENT, @@ -207,11 +192,7 @@ const ListAgents = () => { label: 'All', disabled: isLoading, children: ( - + ), }, { diff --git a/apps/autonolas-registry/components/ListAgents/mint.jsx b/apps/autonolas-registry/components/ListAgents/mint.jsx index e50bcbd4..35e7e8ae 100644 --- a/apps/autonolas-registry/components/ListAgents/mint.jsx +++ b/apps/autonolas-registry/components/ListAgents/mint.jsx @@ -29,10 +29,7 @@ const MintAgent = () => { setInformation(null); try { - const isValid = await checkIfERC721Receive( - account, - values.owner_address, - ); + const isValid = await checkIfERC721Receive(account, values.owner_address); if (!isValid) { setIsMinting(false); return; diff --git a/apps/autonolas-registry/components/ListAgents/useAgentsList.jsx b/apps/autonolas-registry/components/ListAgents/useAgentsList.jsx index 093bac57..9300227e 100644 --- a/apps/autonolas-registry/components/ListAgents/useAgentsList.jsx +++ b/apps/autonolas-registry/components/ListAgents/useAgentsList.jsx @@ -38,9 +38,7 @@ const getAgentsBySearchQuery = (searchValue, ownerAddress = null) => { and: [ { packageType: "agent" } ${getSearchFilterSubQueryForUnitFields(searchValue)} - ${ - ownerAddress ? `{ owner_contains_nocase: "${ownerAddress}" }` : '' - } + ${ownerAddress ? `{ owner_contains_nocase: "${ownerAddress}" }` : ''} ] } orderBy: tokenId diff --git a/apps/autonolas-registry/components/ListComponents/index.jsx b/apps/autonolas-registry/components/ListComponents/index.jsx index e1a0d125..ab908e4c 100644 --- a/apps/autonolas-registry/components/ListComponents/index.jsx +++ b/apps/autonolas-registry/components/ListComponents/index.jsx @@ -7,11 +7,7 @@ import { NAV_TYPES } from 'util/constants'; import { isMyTab } from 'common-util/List/ListTable/helpers'; import { ListTable, useExtraTabContent } from 'common-util/List/ListTable'; import { useHelpers } from 'common-util/hooks'; -import { - useAllComponents, - useMyComponents, - useSearchComponents, -} from './useComponentsList'; +import { useAllComponents, useMyComponents, useSearchComponents } from './useComponentsList'; import { getComponents, getFilteredComponents, @@ -25,12 +21,9 @@ const MY_COMPONENTS = 'my-components'; const ListComponents = () => { const router = useRouter(); - const [currentTab, setCurrentTab] = useState( - isMyTab(router) ? MY_COMPONENTS : ALL_COMPONENTS, - ); + const [currentTab, setCurrentTab] = useState(isMyTab(router) ? MY_COMPONENTS : ALL_COMPONENTS); - const { account, chainId, links, isL1OnlyNetwork, isSvm, isMainnet } = - useHelpers(); + const { account, chainId, links, isL1OnlyNetwork, isSvm, isMainnet } = useHelpers(); const getAllComponents = useAllComponents(); const getMyComponents = useMyComponents(); @@ -163,14 +156,7 @@ const ListComponents = () => { setIsLoading(false); } })(); - }, [ - account, - searchValue, - currentTab, - currentPage, - getComponentsBySearch, - isMainnet, - ]); + }, [account, searchValue, currentTab, currentPage, getComponentsBySearch, isMainnet]); const tableCommonProps = { type: NAV_TYPES.COMPONENT, @@ -210,11 +196,7 @@ const ListComponents = () => { label: 'All', disabled: isLoading, children: ( - + ), }, { diff --git a/apps/autonolas-registry/components/ListComponents/mint.jsx b/apps/autonolas-registry/components/ListComponents/mint.jsx index 3e344f64..4b9fa4af 100644 --- a/apps/autonolas-registry/components/ListComponents/mint.jsx +++ b/apps/autonolas-registry/components/ListComponents/mint.jsx @@ -29,10 +29,7 @@ const MintComponent = () => { setInformation(null); try { - const isValid = await checkIfERC721Receive( - account, - values.owner_address, - ); + const isValid = await checkIfERC721Receive(account, values.owner_address); if (!isValid) { setIsMinting(false); return; diff --git a/apps/autonolas-registry/components/ListComponents/useComponentsList.jsx b/apps/autonolas-registry/components/ListComponents/useComponentsList.jsx index c648efb7..876c9d7b 100644 --- a/apps/autonolas-registry/components/ListComponents/useComponentsList.jsx +++ b/apps/autonolas-registry/components/ListComponents/useComponentsList.jsx @@ -13,8 +13,7 @@ import { } from '../../common-util/hooks/useSubgraph'; import { TOTAL_VIEW_COUNT } from '../../util/constants'; -const componentPackageType = - 'packageType_in: [connection,skill,protocol,contract,custom,unknown]'; +const componentPackageType = 'packageType_in: [connection,skill,protocol,contract,custom,unknown]'; const getAllAndMyComponentsQuery = (currentPage, ownerAddress = null) => { return gql` @@ -41,9 +40,7 @@ const getComponentsBySearchQuery = (searchValue, ownerAddress = null) => { and: [ { ${componentPackageType} } ${getSearchFilterSubQueryForUnitFields(searchValue)} - ${ - ownerAddress ? `{ owner_contains_nocase: "${ownerAddress}" }` : '' - } + ${ownerAddress ? `{ owner_contains_nocase: "${ownerAddress}" }` : ''} ] } orderBy: tokenId diff --git a/apps/autonolas-registry/components/ListServices/ServiceState/1StepPreRegistration/index.jsx b/apps/autonolas-registry/components/ListServices/ServiceState/1StepPreRegistration/index.jsx index cbac04a4..f82a8701 100644 --- a/apps/autonolas-registry/components/ListServices/ServiceState/1StepPreRegistration/index.jsx +++ b/apps/autonolas-registry/components/ListServices/ServiceState/1StepPreRegistration/index.jsx @@ -2,11 +2,7 @@ import { useState } from 'react'; import PropTypes from 'prop-types'; import { useRouter } from 'next/router'; import { Space } from 'antd'; -import { - isLocalNetwork, - notifyError, - notifySuccess, -} from '@autonolas/frontend-library'; +import { isLocalNetwork, notifyError, notifySuccess } from '@autonolas/frontend-library'; import { useHelpers } from 'common-util/hooks'; import { SendTransactionButton } from 'common-util/TransactionHelpers/SendTransactionButton'; @@ -49,11 +45,7 @@ export const PreRegistration = ({ } // any amount if not ETH token substitute with 1 - await onActivateRegistration( - serviceId, - account, - isEthToken ? securityDeposit : '1', - ); + await onActivateRegistration(serviceId, account, isEthToken ? securityDeposit : '1'); await updateDetails(); notifySuccess('Activated successfully'); diff --git a/apps/autonolas-registry/components/ListServices/ServiceState/3rdStepFinishedRegistration/helpers.jsx b/apps/autonolas-registry/components/ListServices/ServiceState/3rdStepFinishedRegistration/helpers.jsx index d8c1bfde..59cd663e 100644 --- a/apps/autonolas-registry/components/ListServices/ServiceState/3rdStepFinishedRegistration/helpers.jsx +++ b/apps/autonolas-registry/components/ListServices/ServiceState/3rdStepFinishedRegistration/helpers.jsx @@ -1,28 +1,29 @@ /* eslint-disable consistent-return */ -export const isHashApproved = (contract, startingBlock, op) => new Promise((resolve, reject) => { - /** - * poll until the hash has been approved before deploy - */ - const interval = setInterval(async () => { - window.console.log('Attempting to getPastEvents...'); +export const isHashApproved = (contract, startingBlock, op) => + new Promise((resolve, reject) => { + /** + * poll until the hash has been approved before deploy + */ + const interval = setInterval(async () => { + window.console.log('Attempting to getPastEvents...'); - try { - const pastEvents = await contract.getPastEvents('ApproveHash', { - filter: op, - fromBlock: startingBlock - 10, - toBlock: 'latest', - }); - window.console.log('pastEvents:', pastEvents); + try { + const pastEvents = await contract.getPastEvents('ApproveHash', { + filter: op, + fromBlock: startingBlock - 10, + toBlock: 'latest', + }); + window.console.log('pastEvents:', pastEvents); - const hashApproved = pastEvents.length !== 0; - if (hashApproved) { - window.console.log('hashApproved'); + const hashApproved = pastEvents.length !== 0; + if (hashApproved) { + window.console.log('hashApproved'); + clearInterval(interval); + return resolve(); + } + } catch (error) { clearInterval(interval); - return resolve(); + return reject(error); } - } catch (error) { - clearInterval(interval); - return reject(error); - } - }, 5000); -}); + }, 5000); + }); diff --git a/apps/autonolas-registry/components/ListServices/ServiceState/5StepUnbond/index.jsx b/apps/autonolas-registry/components/ListServices/ServiceState/5StepUnbond/index.jsx index 0a100cbe..6b9eaddf 100644 --- a/apps/autonolas-registry/components/ListServices/ServiceState/5StepUnbond/index.jsx +++ b/apps/autonolas-registry/components/ListServices/ServiceState/5StepUnbond/index.jsx @@ -7,12 +7,7 @@ import { useHelpers } from 'common-util/hooks'; import { SendTransactionButton } from 'common-util/TransactionHelpers/SendTransactionButton'; import { useUnbond } from '../useSvmServiceStateManagement'; -export const Unbond = ({ - serviceId, - updateDetails, - getButton, - getOtherBtnProps, -}) => { +export const Unbond = ({ serviceId, updateDetails, getButton, getOtherBtnProps }) => { const { account } = useHelpers(); const operators = useSelector( (state) => state?.service?.serviceState?.agentInstancesAndOperators, @@ -46,11 +41,7 @@ export const Unbond = ({ ); return getButton( - + Unbond , { diff --git a/apps/autonolas-registry/components/ListServices/ServiceState/useSvmServiceStateManagement.jsx b/apps/autonolas-registry/components/ListServices/ServiceState/useSvmServiceStateManagement.jsx index 7e04e080..e73e8313 100644 --- a/apps/autonolas-registry/components/ListServices/ServiceState/useSvmServiceStateManagement.jsx +++ b/apps/autonolas-registry/components/ListServices/ServiceState/useSvmServiceStateManagement.jsx @@ -70,26 +70,20 @@ export const useRegisterAgents = () => { ); if (operator !== SVM_EMPTY_ADDRESS) { - notifyError( - 'The operator is registered as an agent instance already.', - ); + notifyError('The operator is registered as an agent instance already.'); return false; } - const agentInstanceAddressesPromises = agentInstances.map( - async (agentInstance) => { - const eachAgentInstance = await readSvmData( - 'mapAgentInstanceOperators', - [new PublicKey(agentInstance)], - 'publicKey', - ); - return eachAgentInstance; - }, - ); + const agentInstanceAddressesPromises = agentInstances.map(async (agentInstance) => { + const eachAgentInstance = await readSvmData( + 'mapAgentInstanceOperators', + [new PublicKey(agentInstance)], + 'publicKey', + ); + return eachAgentInstance; + }); - const agentInstanceAddresses = await Promise.all( - agentInstanceAddressesPromises, - ); + const agentInstanceAddresses = await Promise.all(agentInstanceAddressesPromises); const ifValidArray = agentInstanceAddresses.some( (eachAgentInstance) => eachAgentInstance === SVM_EMPTY_ADDRESS, ); @@ -112,9 +106,7 @@ export const useRegisterAgents = () => { ); const registerAgents = useCallback( - async ({ - account, serviceId, agentIds, agentInstances, dataSource, - }) => { + async ({ account, serviceId, agentIds, agentInstances, dataSource }) => { if (isSvm) { const pdaEscrow = new PublicKey(solanaAddresses.pda); @@ -166,9 +158,7 @@ export const useFinishRegistration = () => { const fn = program.methods .deploy(id, new PublicKey(multisigKey)) .accounts({ dataAccount: solanaAddresses.storageAccount }) - .remainingAccounts([ - { pubkey: walletPublicKey, isSigner: true, isWritable: true }, - ]); + .remainingAccounts([{ pubkey: walletPublicKey, isSigner: true, isWritable: true }]); const response = await sendTransaction(fn, account || undefined, { vmType, diff --git a/apps/autonolas-registry/components/ListServices/helpers/RegisterForm.jsx b/apps/autonolas-registry/components/ListServices/helpers/RegisterForm.jsx index bdffc5f7..23481e29 100644 --- a/apps/autonolas-registry/components/ListServices/helpers/RegisterForm.jsx +++ b/apps/autonolas-registry/components/ListServices/helpers/RegisterForm.jsx @@ -298,11 +298,7 @@ const RegisterForm = ({ // agentIds should be sorted before submitting the form const agentIdsArray = value.split(',').map((val) => val.trim()); if (!isEqual(agentIdsArray, sortBy(agentIdsArray))) { - return Promise.reject( - new Error( - 'Agent IDs should be sorted from low to high.', - ), - ); + return Promise.reject(new Error('Agent IDs should be sorted from low to high.')); } return Promise.resolve(); diff --git a/apps/autonolas-registry/components/ListServices/helpers/ThresholdInput.tsx b/apps/autonolas-registry/components/ListServices/helpers/ThresholdInput.tsx index 3be26ca2..f40ec708 100644 --- a/apps/autonolas-registry/components/ListServices/helpers/ThresholdInput.tsx +++ b/apps/autonolas-registry/components/ListServices/helpers/ThresholdInput.tsx @@ -31,9 +31,7 @@ const validateThreshold = ( } return Promise.reject( - new Error( - 'Threshold must be at least 2/3 and not exceed the sum of no. of slots', - ), + new Error('Threshold must be at least 2/3 and not exceed the sum of no. of slots'), ); }; diff --git a/apps/autonolas-registry/components/ListServices/helpers/functions.jsx b/apps/autonolas-registry/components/ListServices/helpers/functions.jsx index 639f28c2..721fadd2 100644 --- a/apps/autonolas-registry/components/ListServices/helpers/functions.jsx +++ b/apps/autonolas-registry/components/ListServices/helpers/functions.jsx @@ -52,11 +52,7 @@ export const getNumberOfAgentAddress = (agentAddresses) => { * bonds: [100, 200] * output: 2 * 100 + 3 * 200 = 800 */ -export const transformSlotsAndBonds = ( - slotsArray, - bondsArray, - tableDataSource, -) => { +export const transformSlotsAndBonds = (slotsArray, bondsArray, tableDataSource) => { let totalBonds = 0; (tableDataSource || []).forEach((data) => { const { agentAddresses, bond } = data; diff --git a/apps/autonolas-registry/components/ListServices/hooks/useService.jsx b/apps/autonolas-registry/components/ListServices/hooks/useService.jsx index 30672bf8..7f36ccdd 100644 --- a/apps/autonolas-registry/components/ListServices/hooks/useService.jsx +++ b/apps/autonolas-registry/components/ListServices/hooks/useService.jsx @@ -7,11 +7,7 @@ import { useHelpers } from 'common-util/hooks'; import { notifyError } from '@autonolas/frontend-library'; import { getServiceDetails, getServiceOwner, getTokenUri } from '../utils'; -import { - useGetSvmServiceDetails, - useServiceOwner, - useTokenUri, -} from './useSvmService'; +import { useGetSvmServiceDetails, useServiceOwner, useTokenUri } from './useSvmService'; /** * hooks to get service details function @@ -25,9 +21,7 @@ export const useGetServiceDetails = () => { async (id) => { if (!id) notifyError('No service id provided'); - const serviceDetails = isSvm - ? await getSvmServiceDetails(id) - : await getServiceDetails(id); + const serviceDetails = isSvm ? await getSvmServiceDetails(id) : await getServiceDetails(id); return serviceDetails; }, [isSvm, getSvmServiceDetails], @@ -46,9 +40,7 @@ export const useGetServiceOwner = () => { async (id) => { if (!id) notifyError('No service id provided'); - const serviceOwner = isSvm - ? await getSvmServiceOwner(id) - : await getServiceOwner(id); + const serviceOwner = isSvm ? await getSvmServiceOwner(id) : await getServiceOwner(id); return serviceOwner; }, [isSvm, getSvmServiceOwner], @@ -67,9 +59,7 @@ export const useGetServiceTokenUri = () => { async (id) => { if (!id) notifyError('No service id provided'); - const serviceTokenUri = isSvm - ? await getSvmTokenUri(id) - : await getTokenUri(id); + const serviceTokenUri = isSvm ? await getSvmTokenUri(id) : await getTokenUri(id); return serviceTokenUri; }, [isSvm, getSvmTokenUri], diff --git a/apps/autonolas-registry/components/ListServices/hooks/useServicesList.jsx b/apps/autonolas-registry/components/ListServices/hooks/useServicesList.jsx index 1c12e49e..34a36b78 100644 --- a/apps/autonolas-registry/components/ListServices/hooks/useServicesList.jsx +++ b/apps/autonolas-registry/components/ListServices/hooks/useServicesList.jsx @@ -28,11 +28,7 @@ const getAllAndMyServicesQuery = (currentPage, ownerAddress = null) => { skip: ${TOTAL_VIEW_COUNT * (currentPage - 1)} orderBy: serviceId orderDirection: desc - ${ - ownerAddress - ? `where: { owner_contains_nocase: "${ownerAddress}" }` - : '' - } + ${ownerAddress ? `where: { owner_contains_nocase: "${ownerAddress}" }` : ''} ) ${SERVICE_FIELDS} } `; @@ -60,11 +56,7 @@ export const getSearchFilterSubQueryForServices = (searchValue) => { }`; }; -const getServicesBySearchQuery = ( - searchValue, - currentPage, - ownerAddress = null, -) => { +const getServicesBySearchQuery = (searchValue, currentPage, ownerAddress = null) => { return gql` { services ( @@ -72,9 +64,7 @@ const getServicesBySearchQuery = ( skip: ${TOTAL_VIEW_COUNT * (currentPage - 1)} where: { and: [ - ${ - ownerAddress ? `{ owner_contains_nocase: "${ownerAddress}" }` : '' - } + ${ownerAddress ? `{ owner_contains_nocase: "${ownerAddress}" }` : ''} ${getSearchFilterSubQueryForServices(searchValue)}, ] } @@ -128,11 +118,7 @@ export const useAllServicesBySearch = () => { */ export const useMyServicesBySearch = () => { return useCallback(async (searchValue, currentPage, ownerAddress) => { - const query = getServicesBySearchQuery( - searchValue, - currentPage, - ownerAddress, - ); + const query = getServicesBySearchQuery(searchValue, currentPage, ownerAddress); const response = await GRAPHQL_CLIENT.request(query); return response?.services || []; }, []); diff --git a/apps/autonolas-registry/components/ListServices/hooks/useSvmService.jsx b/apps/autonolas-registry/components/ListServices/hooks/useSvmService.jsx index 6fd4a786..6445731a 100644 --- a/apps/autonolas-registry/components/ListServices/hooks/useSvmService.jsx +++ b/apps/autonolas-registry/components/ListServices/hooks/useSvmService.jsx @@ -5,21 +5,14 @@ import { useCallback } from 'react'; import { BorshCoder } from '@project-serum/anchor'; -import { - TransactionMessage, - VersionedTransaction, - PublicKey, -} from '@solana/web3.js'; +import { TransactionMessage, VersionedTransaction, PublicKey } from '@solana/web3.js'; import { memoize } from 'lodash'; import { areAddressesEqual } from '@autonolas/frontend-library'; import { SERVICE_STATE_KEY_MAP, TOTAL_VIEW_COUNT } from 'util/constants'; import idl from 'common-util/AbiAndAddresses/ServiceRegistrySolana.json'; import { useSvmConnectivity } from 'common-util/hooks/useSvmConnectivity'; -import { - transformDatasourceForServiceTable, - transformSlotsAndBonds, -} from '../helpers/functions'; +import { transformDatasourceForServiceTable, transformSlotsAndBonds } from '../helpers/functions'; const getLatestBlockhash = memoize(async (connection) => { const block = await connection.getLatestBlockhash(); @@ -53,10 +46,7 @@ const deseralizeProgramData = (serializedValue, decodeTypeName) => { } const borshCoder = new BorshCoder(idl); - const decodedResult = borshCoder.types.decode( - decodeTypeName, - serializedValue, - ); + const decodedResult = borshCoder.types.decode(decodeTypeName, serializedValue); return decodedResult; }; @@ -64,9 +54,7 @@ const deseralizeProgramData = (serializedValue, decodeTypeName) => { // hook to only READ data from the SVM (Solana) export const useSvmDataFetch = () => { // NOTE: Using `tempWalletPublicKey` to read data from the program - const { - tempWalletPublicKey, connection, program, solanaAddresses, - } = useSvmConnectivity(); + const { tempWalletPublicKey, connection, program, solanaAddresses } = useSvmConnectivity(); const getTransactionLogs = useCallback( async (fn, fnArgs) => { @@ -198,9 +186,7 @@ const transformServiceData = (service, serviceId) => { // convert to base58 ie. readable format const multisig = new PublicKey(service.multisig).toBase58(); // convert configHash u32 to hex string - const decodedConfigHash = Buffer.from(service.configHash, 'utf8').toString( - 'hex', - ); + const decodedConfigHash = Buffer.from(service.configHash, 'utf8').toString('hex'); return { ...service, @@ -235,9 +221,7 @@ const useGetServices = () => { async (total, nextPage, fetchAll = false) => { const promises = []; const first = fetchAll ? 1 : (nextPage - 1) * TOTAL_VIEW_COUNT + 1; - const last = fetchAll - ? total - : Math.min(nextPage * TOTAL_VIEW_COUNT, total); + const last = fetchAll ? total : Math.min(nextPage * TOTAL_VIEW_COUNT, total); for (let i = first; i <= last; i += 1) { promises.push(getSvmServiceDetails(i)); @@ -326,11 +310,7 @@ export const useSvmBonds = () => { const getSvmBonds = useCallback( async (id, tableDataSource) => { - const response = await readSvmData( - 'getAgentParams', - [id], - 'getAgentParams_returns', - ); + const response = await readSvmData('getAgentParams', [id], 'getAgentParams_returns'); const bondsArray = []; const slotsArray = []; @@ -395,11 +375,7 @@ export const useAgentInstanceAndOperator = () => { const getSvmAgentInstanceAndOperator = useCallback( async (id) => { - const response = await readSvmData( - 'getAgentInstances', - [id], - 'getAgentInstances_returns', - ); + const response = await readSvmData('getAgentInstances', [id], 'getAgentInstances_returns'); const data = await Promise.all( (response?.agentInstances || []).map(async (agentInstance, index) => { diff --git a/apps/autonolas-registry/components/ListServices/utils.jsx b/apps/autonolas-registry/components/ListServices/utils.jsx index 6a7d4ecb..531f0650 100644 --- a/apps/autonolas-registry/components/ListServices/utils.jsx +++ b/apps/autonolas-registry/components/ListServices/utils.jsx @@ -56,7 +56,7 @@ export const getServices = async (total, nextPage, fetchAll = false) => { const existsResult = await Promise.allSettled(existsPromises); // filter services which don't exists (deleted or destroyed) const validTokenIds = []; - + existsResult.forEach((item, index) => { const serviceId = `${total - (index + first - 1)}`; if (item.status === 'fulfilled' && !!item.value) { @@ -78,11 +78,7 @@ export const getServices = async (total, nextPage, fetchAll = false) => { export const getFilteredServices = async (searchValue, account) => { const total = await getTotalForAllServices(); - const list = await getServices( - total, - Math.round(total / TOTAL_VIEW_COUNT + 1), - true, - ); + const list = await getServices(total, Math.round(total / TOTAL_VIEW_COUNT + 1), true); return new Promise((resolve) => { const filteredList = filterByOwner(list, { searchValue, account }); diff --git a/apps/autonolas-registry/components/Login/index.jsx b/apps/autonolas-registry/components/Login/index.jsx index 2d7e7375..f069cc57 100644 --- a/apps/autonolas-registry/components/Login/index.jsx +++ b/apps/autonolas-registry/components/Login/index.jsx @@ -1,12 +1,7 @@ import { useEffect, useCallback } from 'react'; import { useDispatch } from 'react-redux'; import { useAccount, useBalance } from 'wagmi'; -import { - setUserAccount, - setUserBalance, - setErrorMessage, - setLogout, -} from 'store/setup'; +import { setUserAccount, setUserBalance, setErrorMessage, setLogout } from 'store/setup'; import { LoginV2 } from 'common-util/Login'; import { useHelpers } from 'common-util/hooks'; @@ -47,12 +42,7 @@ const Login = () => { return (
- +
); }; diff --git a/apps/autonolas-registry/components/Logos/index.jsx b/apps/autonolas-registry/components/Logos/index.jsx index 58ea987c..3f83be7c 100644 --- a/apps/autonolas-registry/components/Logos/index.jsx +++ b/apps/autonolas-registry/components/Logos/index.jsx @@ -1,11 +1,19 @@ export const LogoSvg = () => ( - + ); export const LogoIconSvg = () => ( - + ); diff --git a/apps/autonolas-registry/jest.setup.js b/apps/autonolas-registry/jest.setup.js index f309ea93..7c8b9411 100644 --- a/apps/autonolas-registry/jest.setup.js +++ b/apps/autonolas-registry/jest.setup.js @@ -1,6 +1,6 @@ import '@testing-library/jest-dom/jest-globals'; import '@testing-library/jest-dom'; -import { TextEncoder } from 'util'; +import { TextEncoder } from 'util'; global.TextEncoder = TextEncoder; diff --git a/apps/autonolas-registry/pages/[network]/agents/[id].jsx b/apps/autonolas-registry/pages/[network]/agents/[id].jsx index a6ca6c61..cfcf6d42 100644 --- a/apps/autonolas-registry/pages/[network]/agents/[id].jsx +++ b/apps/autonolas-registry/pages/[network]/agents/[id].jsx @@ -1,10 +1,7 @@ import dynamic from 'next/dynamic'; -const AgentDetails = dynamic( - () => import('../../../components/ListAgents/details'), - { - ssr: false, - }, -); +const AgentDetails = dynamic(() => import('../../../components/ListAgents/details'), { + ssr: false, +}); export default AgentDetails; diff --git a/apps/autonolas-registry/pages/[network]/components/[id].jsx b/apps/autonolas-registry/pages/[network]/components/[id].jsx index 74d100c1..c1aa2727 100644 --- a/apps/autonolas-registry/pages/[network]/components/[id].jsx +++ b/apps/autonolas-registry/pages/[network]/components/[id].jsx @@ -1,10 +1,7 @@ import dynamic from 'next/dynamic'; -const ComponentDetails = dynamic( - () => import('../../../components/ListComponents/details'), - { - ssr: false, - }, -); +const ComponentDetails = dynamic(() => import('../../../components/ListComponents/details'), { + ssr: false, +}); export default ComponentDetails; diff --git a/apps/autonolas-registry/pages/[network]/components/index.jsx b/apps/autonolas-registry/pages/[network]/components/index.jsx index 63d29c38..6130af16 100644 --- a/apps/autonolas-registry/pages/[network]/components/index.jsx +++ b/apps/autonolas-registry/pages/[network]/components/index.jsx @@ -1,10 +1,7 @@ import dynamic from 'next/dynamic'; -const ListComponents = dynamic( - () => import('../../../components/ListComponents'), - { - ssr: false, - }, -); +const ListComponents = dynamic(() => import('../../../components/ListComponents'), { + ssr: false, +}); export default ListComponents; diff --git a/apps/autonolas-registry/pages/[network]/components/mint.jsx b/apps/autonolas-registry/pages/[network]/components/mint.jsx index 0eb77c76..04943649 100644 --- a/apps/autonolas-registry/pages/[network]/components/mint.jsx +++ b/apps/autonolas-registry/pages/[network]/components/mint.jsx @@ -1,10 +1,7 @@ import dynamic from 'next/dynamic'; -const MintComponent = dynamic( - () => import('../../../components/ListComponents/mint'), - { - ssr: false, - }, -); +const MintComponent = dynamic(() => import('../../../components/ListComponents/mint'), { + ssr: false, +}); export default MintComponent; diff --git a/apps/autonolas-registry/store/index.js b/apps/autonolas-registry/store/index.js index 7d79b954..2617bdab 100644 --- a/apps/autonolas-registry/store/index.js +++ b/apps/autonolas-registry/store/index.js @@ -1,13 +1,13 @@ -import { createWrapper } from 'next-redux-wrapper' -import { configureStore } from '@reduxjs/toolkit' -import { setupReducer } from './setup' -import { serviceReducer } from './service' +import { createWrapper } from 'next-redux-wrapper'; +import { configureStore } from '@reduxjs/toolkit'; +import { setupReducer } from './setup'; +import { serviceReducer } from './service'; export const store = configureStore({ reducer: { setup: setupReducer, - service: serviceReducer - } -}) + service: serviceReducer, + }, +}); -export const wrapper = createWrapper(() => store) +export const wrapper = createWrapper(() => store); diff --git a/apps/autonolas-registry/store/service.js b/apps/autonolas-registry/store/service.js index d5d327b2..ad956d0f 100644 --- a/apps/autonolas-registry/store/service.js +++ b/apps/autonolas-registry/store/service.js @@ -1,7 +1,7 @@ import { createSlice } from '@reduxjs/toolkit'; const initialState = { - agentInstancesAndOperators: [] + agentInstancesAndOperators: [], }; export const serviceSlice = createSlice({ @@ -17,8 +17,5 @@ export const serviceSlice = createSlice({ }, }); -export const { - setAgentInstancesAndOperators, - setStoreState, -} = serviceSlice.actions; -export const serviceReducer = serviceSlice.reducer; +export const { setAgentInstancesAndOperators, setStoreState } = serviceSlice.actions; +export const serviceReducer = serviceSlice.reducer; diff --git a/apps/autonolas-registry/store/setup.js b/apps/autonolas-registry/store/setup.js index 11181e34..c93876e6 100644 --- a/apps/autonolas-registry/store/setup.js +++ b/apps/autonolas-registry/store/setup.js @@ -1,7 +1,7 @@ import { createSlice } from '@reduxjs/toolkit'; import { VM_TYPE } from 'util/constants'; -import { ALL_SUPPORTED_CHAINS, EVM_SUPPORTED_CHAINS, } from 'common-util/Login/config'; +import { ALL_SUPPORTED_CHAINS, EVM_SUPPORTED_CHAINS } from 'common-util/Login/config'; const initialState = { account: null, @@ -27,9 +27,7 @@ export const setupSlice = createSlice({ }, setChainId: (state, action) => { const chainId = action.payload; - const networkInfo = EVM_SUPPORTED_CHAINS.find( - (item) => item.id === chainId, - ); + const networkInfo = EVM_SUPPORTED_CHAINS.find((item) => item.id === chainId); state.chainId = chainId; state.chainDisplayName = networkInfo?.networkDisplayName || null; @@ -37,16 +35,14 @@ export const setupSlice = createSlice({ }, setVmInfo: (state, action) => { const networkName = action.payload; - const info = ALL_SUPPORTED_CHAINS.find( - (item) => item.networkName === networkName, - ); + const info = ALL_SUPPORTED_CHAINS.find((item) => item.networkName === networkName); if (info?.vmType === VM_TYPE.SVM) { - state.vmType = VM_TYPE.SVM - state.chainDisplayName = info.networkDisplayName - state.chainName = info.networkName + state.vmType = VM_TYPE.SVM; + state.chainDisplayName = info.networkDisplayName; + state.chainName = info.networkName; } else { - state.vmType = VM_TYPE.EVM + state.vmType = VM_TYPE.EVM; } }, setErrorMessage: (state, action) => { @@ -70,4 +66,4 @@ export const { setLogout, setStoreState, } = setupSlice.actions; -export const setupReducer = setupSlice.reducer; +export const setupReducer = setupSlice.reducer; diff --git a/apps/autonolas-registry/tests/common-util/List/ListCommon.test.jsx b/apps/autonolas-registry/tests/common-util/List/ListCommon.test.jsx index 58880c4f..40cf1688 100644 --- a/apps/autonolas-registry/tests/common-util/List/ListCommon.test.jsx +++ b/apps/autonolas-registry/tests/common-util/List/ListCommon.test.jsx @@ -60,9 +60,7 @@ describe('', () => { output: /Minted successfully. This is being indexed and will take a few minutes to show./, }, ])('expects valid object (input=$input)', ({ type, input, output }) => { - const { getByText } = render( - , - ); + const { getByText } = render(); expect(getByText(output)).toBeInTheDocument(); }); }); @@ -85,9 +83,7 @@ describe('', () => { output: /Minted successfully./, }, ])('expects valid object (input=$input)', ({ type, input, output }) => { - const { getByText } = render( - , - ); + const { getByText } = render(); expect(getByText(output)).toBeInTheDocument(); }); }); @@ -102,13 +98,14 @@ describe('', () => { }); describe('', () => { - it.each([ - { input: new Error('Exception occurred'), output: /Exception occurred/ }, - ])('expects valid error object (input=$input)', ({ input, output }) => { - const { getByText, getByTestId } = render(); - expect(getByText(output)).toBeInTheDocument(); - expect(getByTestId('alert-error-container')).toBeInTheDocument(); - }); + it.each([{ input: new Error('Exception occurred'), output: /Exception occurred/ }])( + 'expects valid error object (input=$input)', + ({ input, output }) => { + const { getByText, getByTestId } = render(); + expect(getByText(output)).toBeInTheDocument(); + expect(getByTestId('alert-error-container')).toBeInTheDocument(); + }, + ); it.each([{ input: null }, { input: undefined }])( 'expects invalid object (input=$input)', diff --git a/apps/autonolas-registry/tests/common-util/List/RegisterForm.test.jsx b/apps/autonolas-registry/tests/common-util/List/RegisterForm.test.jsx index 03510815..13e1a313 100644 --- a/apps/autonolas-registry/tests/common-util/List/RegisterForm.test.jsx +++ b/apps/autonolas-registry/tests/common-util/List/RegisterForm.test.jsx @@ -1,8 +1,6 @@ import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import RegisterForm, { - FORM_NAME, -} from '../../../common-util/List/RegisterForm'; +import RegisterForm, { FORM_NAME } from '../../../common-util/List/RegisterForm'; import { fillIpfsGenerationModal } from '../../tests-helpers/prefillForm'; import { wrapProvider, dummyAddress, mockV1Hash } from '../../tests-helpers'; @@ -23,31 +21,19 @@ describe.skip('', () => { it('should submit the form successfully', async () => { const { container, getByRole, getByText } = render( wrapProvider( - , + , ), ); // add the hash in the beginning userEvent.click(getByRole('button', { name: 'Generate Hash & File' })); - expect( - getByText('Generate IPFS Hash of Metadata File'), - ).toBeInTheDocument(); + expect(getByText('Generate IPFS Hash of Metadata File')).toBeInTheDocument(); fillIpfsGenerationModal(); // adding input - userEvent.type( - container.querySelector(`#${FORM_NAME}_owner_address`), - dummyAddress, - ); - userEvent.type( - container.querySelector(`#${FORM_NAME}_dependencies`), - '1, 2', - ); + userEvent.type(container.querySelector(`#${FORM_NAME}_owner_address`), dummyAddress); + userEvent.type(container.querySelector(`#${FORM_NAME}_dependencies`), '1, 2'); // submit const formSubmitBtn = getByRole('button', { name: 'Submit' }); diff --git a/apps/autonolas-registry/tests/components/ListAgents/index.test.tsx b/apps/autonolas-registry/tests/components/ListAgents/index.test.tsx index 9ac0d137..2e38a13e 100644 --- a/apps/autonolas-registry/tests/components/ListAgents/index.test.tsx +++ b/apps/autonolas-registry/tests/components/ListAgents/index.test.tsx @@ -120,40 +120,25 @@ describe('listAgents/index.jsx', () => { it('should display all agents without search', async () => { const { container, findByTestId } = render(wrapProvider()); - await checkAndGetTabComponent( - container, - '.ant-tabs-tab:nth-child(1)', - 'All', - ); + await checkAndGetTabComponent(container, '.ant-tabs-tab:nth-child(1)', 'All'); const firstAgent = allAgentsResponse[0]; const allAgentsTable = await findByTestId('all-agents-table'); - expect( - within(allAgentsTable).getByText(firstAgent.tokenId), - ).toBeInTheDocument(); - expect( - within(allAgentsTable).getByText(/0x8626...9C1199/), - ).toBeInTheDocument(); - expect( - within(allAgentsTable).getByText(/0x9cf4...315ab0/), - ).toBeInTheDocument(); - expect( - within(allAgentsTable).getByText(firstAgent.publicId), - ).toBeInTheDocument(); + expect(within(allAgentsTable).getByText(firstAgent.tokenId)).toBeInTheDocument(); + expect(within(allAgentsTable).getByText(/0x8626...9C1199/)).toBeInTheDocument(); + expect(within(allAgentsTable).getByText(/0x9cf4...315ab0/)).toBeInTheDocument(); + expect(within(allAgentsTable).getByText(firstAgent.publicId)).toBeInTheDocument(); expect(within(allAgentsTable).getByText('View')).toBeInTheDocument(); }); it('should display all agents search', async () => { - const { container, getByRole, findByTestId, getByPlaceholderText } = - render(wrapProvider()); - - await checkAndGetTabComponent( - container, - '.ant-tabs-tab:nth-child(1)', - 'All', + const { container, getByRole, findByTestId, getByPlaceholderText } = render( + wrapProvider(), ); + await checkAndGetTabComponent(container, '.ant-tabs-tab:nth-child(1)', 'All'); + const searchInput = getByPlaceholderText('Search...'); await userEvent.type(searchInput, '!'); @@ -163,18 +148,10 @@ describe('listAgents/index.jsx', () => { const firstAgent = allAgentsSearchResponse[0]; const allAgentsTable = await findByTestId('all-agents-table'); - expect( - within(allAgentsTable).getByText(firstAgent.tokenId), - ).toBeInTheDocument(); - expect( - within(allAgentsTable).getByText(/0x8626...9C1199/), - ).toBeInTheDocument(); - expect( - within(allAgentsTable).getByText(/0x9cf4...315ab0/), - ).toBeInTheDocument(); - expect( - within(allAgentsTable).getByText(firstAgent.publicId), - ).toBeInTheDocument(); + expect(within(allAgentsTable).getByText(firstAgent.tokenId)).toBeInTheDocument(); + expect(within(allAgentsTable).getByText(/0x8626...9C1199/)).toBeInTheDocument(); + expect(within(allAgentsTable).getByText(/0x9cf4...315ab0/)).toBeInTheDocument(); + expect(within(allAgentsTable).getByText(firstAgent.publicId)).toBeInTheDocument(); expect(within(allAgentsTable).getByText('View')).toBeInTheDocument(); }); @@ -192,8 +169,7 @@ describe('listAgents/index.jsx', () => { const { findByPlaceholderText } = render(wrapProvider()); const searchInput = await findByPlaceholderText('Search...'); - if (!searchInput) - throw new Error('Search input not found in `All` tab'); + if (!searchInput) throw new Error('Search input not found in `All` tab'); expect(searchInput).toHaveValue('Random search string'); }); }); @@ -203,33 +179,22 @@ describe('listAgents/index.jsx', () => { it('should display my agents', async () => { const { container, findByTestId } = render(wrapProvider()); - await checkAndGetTabComponent( - container, - '.ant-tabs-tab:nth-child(2)', - 'My Agents', - ); + await checkAndGetTabComponent(container, '.ant-tabs-tab:nth-child(2)', 'My Agents'); const firstAgent = myAgentsResponse[0]; const myAgentsTable = await findByTestId('my-agents-table'); - expect( - within(myAgentsTable).getByText(firstAgent.tokenId), - ).toBeInTheDocument(); - expect( - within(myAgentsTable).getByText(/0x8626...9C1000/), - ).toBeInTheDocument(); - expect( - within(myAgentsTable).getByText(/0x9cf4...315ab0/), - ).toBeInTheDocument(); - expect( - within(myAgentsTable).getByText(firstAgent.publicId), - ).toBeInTheDocument(); + expect(within(myAgentsTable).getByText(firstAgent.tokenId)).toBeInTheDocument(); + expect(within(myAgentsTable).getByText(/0x8626...9C1000/)).toBeInTheDocument(); + expect(within(myAgentsTable).getByText(/0x9cf4...315ab0/)).toBeInTheDocument(); + expect(within(myAgentsTable).getByText(firstAgent.publicId)).toBeInTheDocument(); expect(within(myAgentsTable).getByText('View')).toBeInTheDocument(); }); it('should display my agents search', async () => { - const { container, getByRole, findByTestId, getByPlaceholderText } = - render(wrapProvider()); + const { container, getByRole, findByTestId, getByPlaceholderText } = render( + wrapProvider(), + ); const myAgentsTab = await checkAndGetTabComponent( container, @@ -249,18 +214,10 @@ describe('listAgents/index.jsx', () => { const firstAgent = allAgentsSearchResponse[0]; const myAgentsTable = await findByTestId('my-agents-table'); - expect( - within(myAgentsTable).getByText(firstAgent.tokenId), - ).toBeInTheDocument(); - expect( - within(myAgentsTable).getByText(/0x8626...9C1199/), - ).toBeInTheDocument(); - expect( - within(myAgentsTable).getByText(/0x9cf4...315ab0/), - ).toBeInTheDocument(); - expect( - within(myAgentsTable).getByText(firstAgent.publicId), - ).toBeInTheDocument(); + expect(within(myAgentsTable).getByText(firstAgent.tokenId)).toBeInTheDocument(); + expect(within(myAgentsTable).getByText(/0x8626...9C1199/)).toBeInTheDocument(); + expect(within(myAgentsTable).getByText(/0x9cf4...315ab0/)).toBeInTheDocument(); + expect(within(myAgentsTable).getByText(firstAgent.publicId)).toBeInTheDocument(); expect(within(myAgentsTable).getByText('View')).toBeInTheDocument(); }); @@ -275,19 +232,12 @@ describe('listAgents/index.jsx', () => { }); it('should switch to `My Agents` tab if `tab` query is available and `search` query is available', async () => { - const { container, findByPlaceholderText } = render( - wrapProvider(), - ); + const { container, findByPlaceholderText } = render(wrapProvider()); - await checkAndGetTabComponent( - container, - '.ant-tabs-tab:nth-child(2)', - 'My Agents', - ); + await checkAndGetTabComponent(container, '.ant-tabs-tab:nth-child(2)', 'My Agents'); const searchInput = await findByPlaceholderText('Search...'); - if (!searchInput) - throw new Error('Search input not found in `My Agents` tab'); + if (!searchInput) throw new Error('Search input not found in `My Agents` tab'); expect(searchInput).toHaveValue('Random search string'); }); diff --git a/apps/autonolas-registry/tests/components/ListAgents/mint.test.jsx b/apps/autonolas-registry/tests/components/ListAgents/mint.test.jsx index 339439bf..f9b4f1bd 100644 --- a/apps/autonolas-registry/tests/components/ListAgents/mint.test.jsx +++ b/apps/autonolas-registry/tests/components/ListAgents/mint.test.jsx @@ -41,9 +41,7 @@ describe('listAgents/mint.jsx', () => { }, })); - const { container, getByRole, getByText } = render( - wrapProvider(), - ); + const { container, getByRole, getByText } = render(wrapProvider()); // title expect(getByText(/Mint Agent/i)).toBeInTheDocument(); @@ -59,18 +57,10 @@ describe('listAgents/mint.jsx', () => { fillIpfsGenerationModal(); // other fields - expect( - getByRole('button', { name: 'Prefill Address' }), - ).toBeInTheDocument(); - userEvent.type( - container.querySelector(`#${FORM_NAME}_owner_address`), - dummyAddress, - ); + expect(getByRole('button', { name: 'Prefill Address' })).toBeInTheDocument(); + userEvent.type(container.querySelector(`#${FORM_NAME}_owner_address`), dummyAddress); userEvent.type(container.querySelector(`#${FORM_NAME}_hash`), mockV1Hash); - userEvent.type( - container.querySelector(`#${FORM_NAME}_dependencies`), - '1, 2', - ); + userEvent.type(container.querySelector(`#${FORM_NAME}_dependencies`), '1, 2'); // submit button const submitButton = getByRole('button', { name: 'Submit' }); diff --git a/apps/autonolas-registry/tests/components/ListComponents/index.test.tsx b/apps/autonolas-registry/tests/components/ListComponents/index.test.tsx index e4fa2ffd..84005818 100644 --- a/apps/autonolas-registry/tests/components/ListComponents/index.test.tsx +++ b/apps/autonolas-registry/tests/components/ListComponents/index.test.tsx @@ -79,17 +79,13 @@ describe('listComponents/index.jsx', () => { (useRouter as jest.Mock).mockReturnValue({ query: {}, push: jest.fn() }); (getComponents as jest.Mock).mockResolvedValue(allComponentsResponse); - (getFilteredComponents as jest.Mock).mockResolvedValue( - myComponentsResponse, - ); + (getFilteredComponents as jest.Mock).mockResolvedValue(myComponentsResponse); (getTotalForAllComponents as jest.Mock).mockResolvedValue(1); (getTotalForMyComponents as jest.Mock).mockResolvedValue(1); }); it('should display the column names', async () => { - const { container, findByTestId } = render( - wrapProvider(), - ); + const { container, findByTestId } = render(wrapProvider()); if (!container) { throw new Error('`All tab` is null'); @@ -102,9 +98,7 @@ describe('listComponents/index.jsx', () => { expect(within(allComponentsTable).getByText('Owner')).toBeInTheDocument(); expect(within(allComponentsTable).getByText('Hash')).toBeInTheDocument(); expect(within(allComponentsTable).getByText('Name')).toBeInTheDocument(); - expect( - within(allComponentsTable).getByText('Action'), - ).toBeInTheDocument(); + expect(within(allComponentsTable).getByText('Action')).toBeInTheDocument(); }); }); @@ -124,44 +118,27 @@ describe('listComponents/index.jsx', () => { describe('All Components', () => { it('should display all components', async () => { - const { container, findByTestId } = render( - wrapProvider(), - ); + const { container, findByTestId } = render(wrapProvider()); - await checkAndGetTabComponent( - container, - '.ant-tabs-tab:nth-child(1)', - 'All', - ); + await checkAndGetTabComponent(container, '.ant-tabs-tab:nth-child(1)', 'All'); const firstComponent = allComponentsResponse[0]; const allComponentsTable = await findByTestId('all-components-table'); - expect( - within(allComponentsTable).getByText(firstComponent.tokenId), - ).toBeInTheDocument(); - expect( - within(allComponentsTable).getByText(/0x8626...9C1199/), - ).toBeInTheDocument(); - expect( - within(allComponentsTable).getByText(/0x9cf4...315ab0/), - ).toBeInTheDocument(); - expect( - within(allComponentsTable).getByText(firstComponent.publicId), - ).toBeInTheDocument(); + expect(within(allComponentsTable).getByText(firstComponent.tokenId)).toBeInTheDocument(); + expect(within(allComponentsTable).getByText(/0x8626...9C1199/)).toBeInTheDocument(); + expect(within(allComponentsTable).getByText(/0x9cf4...315ab0/)).toBeInTheDocument(); + expect(within(allComponentsTable).getByText(firstComponent.publicId)).toBeInTheDocument(); expect(within(allComponentsTable).getByText('View')).toBeInTheDocument(); }); it('should display all components search', async () => { - const { container, getByRole, findByTestId, getByPlaceholderText } = - render(wrapProvider()); - - await checkAndGetTabComponent( - container, - '.ant-tabs-tab:nth-child(1)', - 'All', + const { container, getByRole, findByTestId, getByPlaceholderText } = render( + wrapProvider(), ); + await checkAndGetTabComponent(container, '.ant-tabs-tab:nth-child(1)', 'All'); + const searchInput = getByPlaceholderText('Search...'); await userEvent.type(searchInput, '!'); @@ -171,18 +148,10 @@ describe('listComponents/index.jsx', () => { const firstComponent = allComponentsSearchResponse[0]; const allComponentsTable = await findByTestId('all-components-table'); - expect( - within(allComponentsTable).getByText(firstComponent.tokenId), - ).toBeInTheDocument(); - expect( - within(allComponentsTable).getByText(/0x8626...9C1199/), - ).toBeInTheDocument(); - expect( - within(allComponentsTable).getByText(/0x9cf4...315ab0/), - ).toBeInTheDocument(); - expect( - within(allComponentsTable).getByText(firstComponent.publicId), - ).toBeInTheDocument(); + expect(within(allComponentsTable).getByText(firstComponent.tokenId)).toBeInTheDocument(); + expect(within(allComponentsTable).getByText(/0x8626...9C1199/)).toBeInTheDocument(); + expect(within(allComponentsTable).getByText(/0x9cf4...315ab0/)).toBeInTheDocument(); + expect(within(allComponentsTable).getByText(firstComponent.publicId)).toBeInTheDocument(); expect(within(allComponentsTable).getByText('View')).toBeInTheDocument(); }); @@ -197,13 +166,10 @@ describe('listComponents/index.jsx', () => { }); it('should have search input if "search" query string is available', async () => { - const { findByPlaceholderText } = render( - wrapProvider(), - ); + const { findByPlaceholderText } = render(wrapProvider()); const searchInput = await findByPlaceholderText('Search...'); - if (!searchInput) - throw new Error('Search input not found in `All` tab'); + if (!searchInput) throw new Error('Search input not found in `All` tab'); expect(searchInput).toHaveValue('Random search string'); }); }); @@ -211,44 +177,27 @@ describe('listComponents/index.jsx', () => { describe('My Components', () => { it('should display my components', async () => { - const { container, findByTestId } = render( - wrapProvider(), - ); + const { container, findByTestId } = render(wrapProvider()); - await checkAndGetTabComponent( - container, - '.ant-tabs-tab:nth-child(2)', - 'My Components', - ); + await checkAndGetTabComponent(container, '.ant-tabs-tab:nth-child(2)', 'My Components'); const firstComponent = myComponentsResponse[0]; const myComponentsTable = await findByTestId('my-components-table'); - expect( - within(myComponentsTable).getByText(firstComponent.tokenId), - ).toBeInTheDocument(); - expect( - within(myComponentsTable).getByText(/0x8626...9C1000/), - ).toBeInTheDocument(); - expect( - within(myComponentsTable).getByText(/0x9cf4...315ab0/), - ).toBeInTheDocument(); - expect( - within(myComponentsTable).getByText(firstComponent.publicId), - ).toBeInTheDocument(); + expect(within(myComponentsTable).getByText(firstComponent.tokenId)).toBeInTheDocument(); + expect(within(myComponentsTable).getByText(/0x8626...9C1000/)).toBeInTheDocument(); + expect(within(myComponentsTable).getByText(/0x9cf4...315ab0/)).toBeInTheDocument(); + expect(within(myComponentsTable).getByText(firstComponent.publicId)).toBeInTheDocument(); expect(within(myComponentsTable).getByText('View')).toBeInTheDocument(); }); it('should display my components search', async () => { - const { container, getByRole, findByTestId, getByPlaceholderText } = - render(wrapProvider()); - - await checkAndGetTabComponent( - container, - '.ant-tabs-tab:nth-child(2)', - 'My Components', + const { container, getByRole, findByTestId, getByPlaceholderText } = render( + wrapProvider(), ); + await checkAndGetTabComponent(container, '.ant-tabs-tab:nth-child(2)', 'My Components'); + const searchInput = getByPlaceholderText('Search...'); await userEvent.type(searchInput, '!'); @@ -258,18 +207,10 @@ describe('listComponents/index.jsx', () => { const firstComponent = allComponentsSearchResponse[0]; const myComponentsTable = await findByTestId('my-components-table'); - expect( - within(myComponentsTable).getByText(firstComponent.tokenId), - ).toBeInTheDocument(); - expect( - within(myComponentsTable).getByText(/0x8626...9C1199/), - ).toBeInTheDocument(); - expect( - within(myComponentsTable).getByText(/0x9cf4...315ab0/), - ).toBeInTheDocument(); - expect( - within(myComponentsTable).getByText(firstComponent.publicId), - ).toBeInTheDocument(); + expect(within(myComponentsTable).getByText(firstComponent.tokenId)).toBeInTheDocument(); + expect(within(myComponentsTable).getByText(/0x8626...9C1199/)).toBeInTheDocument(); + expect(within(myComponentsTable).getByText(/0x9cf4...315ab0/)).toBeInTheDocument(); + expect(within(myComponentsTable).getByText(firstComponent.publicId)).toBeInTheDocument(); expect(within(myComponentsTable).getByText('View')).toBeInTheDocument(); }); @@ -284,19 +225,12 @@ describe('listComponents/index.jsx', () => { }); it('should switch to `My Components` tab if `tab` query is available and `search` query is available', async () => { - const { container, findByPlaceholderText } = render( - wrapProvider(), - ); + const { container, findByPlaceholderText } = render(wrapProvider()); - await checkAndGetTabComponent( - container, - '.ant-tabs-tab:nth-child(2)', - 'My Components', - ); + await checkAndGetTabComponent(container, '.ant-tabs-tab:nth-child(2)', 'My Components'); const searchInput = await findByPlaceholderText('Search...'); - if (!searchInput) - throw new Error('Search input not found in `My Components` tab'); + if (!searchInput) throw new Error('Search input not found in `My Components` tab'); expect(searchInput).toHaveValue('Random search string'); }); diff --git a/apps/autonolas-registry/tests/components/ListComponents/mint.test.jsx b/apps/autonolas-registry/tests/components/ListComponents/mint.test.jsx index 650acba5..47c0f4fa 100644 --- a/apps/autonolas-registry/tests/components/ListComponents/mint.test.jsx +++ b/apps/autonolas-registry/tests/components/ListComponents/mint.test.jsx @@ -40,9 +40,7 @@ describe('listComponents/mint.jsx', () => { }, })); - const { container, getByText, getByRole } = render( - wrapProvider(), - ); + const { container, getByText, getByRole } = render(wrapProvider()); // title expect(getByText(/Mint Component/i)).toBeInTheDocument(); @@ -58,17 +56,9 @@ describe('listComponents/mint.jsx', () => { fillIpfsGenerationModal(); // other fields - expect( - getByRole('button', { name: 'Prefill Address' }), - ).toBeInTheDocument(); - userEvent.type( - container.querySelector(`#${FORM_NAME}_owner_address`), - dummyAddress, - ); - userEvent.type( - container.querySelector(`#${FORM_NAME}_dependencies`), - '1, 2', - ); + expect(getByRole('button', { name: 'Prefill Address' })).toBeInTheDocument(); + userEvent.type(container.querySelector(`#${FORM_NAME}_owner_address`), dummyAddress); + userEvent.type(container.querySelector(`#${FORM_NAME}_dependencies`), '1, 2'); const submitButton = getByRole('button', { name: 'Submit' }); expect(submitButton).toBeInTheDocument(); diff --git a/apps/autonolas-registry/tests/components/ListServices/details.test.jsx b/apps/autonolas-registry/tests/components/ListServices/details.test.jsx index 9f96808f..5b91a738 100644 --- a/apps/autonolas-registry/tests/components/ListServices/details.test.jsx +++ b/apps/autonolas-registry/tests/components/ListServices/details.test.jsx @@ -78,7 +78,6 @@ jest.mock('common-util/Details/DetailsSubInfo/utils', () => ({ getTokenomicsUnitType: jest.fn(() => 1), })); - jest.mock('common-util/hooks/useSvmConnectivity', () => ({ useSvmConnectivity: jest.fn(), })); diff --git a/apps/autonolas-registry/tests/components/ListServices/index.test.tsx b/apps/autonolas-registry/tests/components/ListServices/index.test.tsx index 41c866d0..3c7b171f 100644 --- a/apps/autonolas-registry/tests/components/ListServices/index.test.tsx +++ b/apps/autonolas-registry/tests/components/ListServices/index.test.tsx @@ -4,7 +4,11 @@ import { useRouter } from 'next/router'; import ListServices from 'components/ListServices'; import { useServiceInfo } from 'components/ListServices/hooks/useSvmService'; -import { useAllServices, useMyServices, useSearchServices } from 'components/ListServices/hooks/useServicesList'; +import { + useAllServices, + useMyServices, + useSearchServices, +} from 'components/ListServices/hooks/useServicesList'; import { useHelpers } from 'common-util/hooks/useHelpers'; import { getServices, @@ -86,15 +90,15 @@ jest.mock('components/ListServices/hooks/useSvmService', () => ({ describe('listServices/index.jsx - EVM', () => { beforeEach(() => { - (useAllServices as jest.Mock).mockReturnValue(() => Promise.resolve(allServicesResponse)); (useMyServices as jest.Mock).mockReturnValue(() => Promise.resolve(myServicesResponse)); - (useSearchServices as jest.Mock).mockReturnValue(() => Promise.resolve(allServicesSearchResponse)); - + (useSearchServices as jest.Mock).mockReturnValue(() => + Promise.resolve(allServicesSearchResponse), + ); (useRouter as jest.Mock).mockReturnValue({ query: {}, push: jest.fn() }); (useHelpers as jest.Mock).mockReturnValue(useHelpersEvmMock); - (useServiceInfo as jest.Mock).mockReturnValue(jest.fn(() => { })); + (useServiceInfo as jest.Mock).mockReturnValue(jest.fn(() => {})); }); it('should display tabs with `All Tab` & Mint button', async () => { @@ -122,9 +126,7 @@ describe('listServices/index.jsx - EVM', () => { }); it('should display columns for mainnet', async () => { - const { container, findByTestId } = render( - wrapProvider(), - ); + const { container, findByTestId } = render(wrapProvider()); const allServicesTable = await findByTestId('all-services-table'); if (!container) { @@ -133,28 +135,16 @@ describe('listServices/index.jsx - EVM', () => { await waitFor(async () => { expect(within(allServicesTable).getByText('ID')).toBeInTheDocument(); - expect( - within(allServicesTable).getByText('Name'), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText('Owner'), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText('Hash'), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText('State'), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText('Action'), - ).toBeInTheDocument(); + expect(within(allServicesTable).getByText('Name')).toBeInTheDocument(); + expect(within(allServicesTable).getByText('Owner')).toBeInTheDocument(); + expect(within(allServicesTable).getByText('Hash')).toBeInTheDocument(); + expect(within(allServicesTable).getByText('State')).toBeInTheDocument(); + expect(within(allServicesTable).getByText('Action')).toBeInTheDocument(); }); }); it('should display all services information', async () => { - const { container, findByTestId } = render( - wrapProvider(), - ); + const { container, findByTestId } = render(wrapProvider()); if (!container) { throw new Error('`All tab` is null'); @@ -169,21 +159,11 @@ describe('listServices/index.jsx - EVM', () => { const allServicesTable = await findByTestId('all-services-table'); await waitFor(async () => { - expect( - within(allServicesTable).getByText(firstService.serviceId), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText(/0x8626...9C1199/), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText(/0x9cf4...315ab0/), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText(/Deployed/), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText(/View/), - ).toBeInTheDocument(); + expect(within(allServicesTable).getByText(firstService.serviceId)).toBeInTheDocument(); + expect(within(allServicesTable).getByText(/0x8626...9C1199/)).toBeInTheDocument(); + expect(within(allServicesTable).getByText(/0x9cf4...315ab0/)).toBeInTheDocument(); + expect(within(allServicesTable).getByText(/Deployed/)).toBeInTheDocument(); + expect(within(allServicesTable).getByText(/View/)).toBeInTheDocument(); }); }); @@ -194,21 +174,17 @@ describe('listServices/index.jsx - EVM', () => { push: jest.fn(), }); - const { findByPlaceholderText } = render( - wrapProvider(), - ); + const { findByPlaceholderText } = render(wrapProvider()); const searchInput = await findByPlaceholderText('Search...'); - if (!searchInput) - throw new Error('Search input not found in `All` tab'); + if (!searchInput) throw new Error('Search input not found in `All` tab'); expect(searchInput).toHaveValue('Random search string'); }); }); - }) + }); describe('non-mainnet', () => { beforeEach(() => { - (useHelpers as jest.Mock).mockReturnValue(useHelpersBaseMock); (getTotalForAllServices as jest.Mock).mockResolvedValue(1); (getTotalForMyServices as jest.Mock).mockResolvedValue(1); @@ -218,9 +194,7 @@ describe('listServices/index.jsx - EVM', () => { }); it('should display service columns', async () => { - const { container, findByTestId } = render( - wrapProvider(), - ); + const { container, findByTestId } = render(wrapProvider()); const allServicesTable = await findByTestId('all-services-table'); if (!container) { @@ -230,23 +204,15 @@ describe('listServices/index.jsx - EVM', () => { await waitFor(async () => { expect(within(allServicesTable).getByText('ID')).toBeInTheDocument(); expect(within(allServicesTable).queryByText('Name')).toBeNull(); - expect( - within(allServicesTable).getByText('Owner'), - ).toBeInTheDocument(); + expect(within(allServicesTable).getByText('Owner')).toBeInTheDocument(); expect(within(allServicesTable).queryByText('Hash')).toBeNull(); - expect( - within(allServicesTable).getByText('State'), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText('Action'), - ).toBeInTheDocument(); + expect(within(allServicesTable).getByText('State')).toBeInTheDocument(); + expect(within(allServicesTable).getByText('Action')).toBeInTheDocument(); }); }); it('should display all services information', async () => { - const { container, findByTestId } = render( - wrapProvider(), - ); + const { container, findByTestId } = render(wrapProvider()); if (!container) { throw new Error('`All tab` is null'); @@ -260,18 +226,10 @@ describe('listServices/index.jsx - EVM', () => { const allServicesTable = await findByTestId('all-services-table'); await waitFor(async () => { - expect( - within(allServicesTable).getByText('5001'), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText(/0x8626...9C1199/), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText(/Terminated Bonded/), - ).toBeInTheDocument(); - expect( - within(allServicesTable).getByText(/View/), - ).toBeInTheDocument(); + expect(within(allServicesTable).getByText('5001')).toBeInTheDocument(); + expect(within(allServicesTable).getByText(/0x8626...9C1199/)).toBeInTheDocument(); + expect(within(allServicesTable).getByText(/Terminated Bonded/)).toBeInTheDocument(); + expect(within(allServicesTable).getByText(/View/)).toBeInTheDocument(); }); }); }); @@ -281,7 +239,9 @@ describe('listServices/index.jsx - SVM', () => { beforeEach(() => { (useAllServices as jest.Mock).mockReturnValue(() => Promise.resolve(allServicesResponse)); (useMyServices as jest.Mock).mockReturnValue(() => Promise.resolve(myServicesResponse)); - (useSearchServices as jest.Mock).mockReturnValue(() => Promise.resolve(allServicesSearchResponse)); + (useSearchServices as jest.Mock).mockReturnValue(() => + Promise.resolve(allServicesSearchResponse), + ); (useRouter as jest.Mock).mockReturnValue({ query: {}, push: jest.fn() }); (useHelpers as jest.Mock).mockReturnValue({ @@ -293,12 +253,8 @@ describe('listServices/index.jsx - SVM', () => { (useServiceInfo as jest.Mock).mockReturnValue({ getTotalForAllSvmServices: jest.fn(() => 1), getTotalForMySvmServices: jest.fn(() => 1), - getSvmServices: jest.fn(() => [ - { id: '1', owner: mockSvmAddress, state: '5' }, - ]), - getMySvmServices: jest.fn(() => [ - { id: '2', owner: mockSvmAddress, state: '5' }, - ]), + getSvmServices: jest.fn(() => [{ id: '1', owner: mockSvmAddress, state: '5' }]), + getMySvmServices: jest.fn(() => [{ id: '2', owner: mockSvmAddress, state: '5' }]), }); // below functions are required to be mocked as they are used by EVM @@ -333,11 +289,7 @@ describe('listServices/index.jsx - SVM', () => { it('should display service columns and rows', async () => { const { container, getByText } = render(wrapProvider()); - await checkAndGetTabComponent( - container, - '.ant-tabs-tab:nth-child(1)', - 'All', - ); + await checkAndGetTabComponent(container, '.ant-tabs-tab:nth-child(1)', 'All'); await waitFor(async () => { // column names @@ -352,4 +304,4 @@ describe('listServices/index.jsx - SVM', () => { expect(getByText(/View/)).toBeInTheDocument(); }); }); -}); \ No newline at end of file +}); diff --git a/apps/autonolas-registry/tests/components/ListServices/mint.test.jsx b/apps/autonolas-registry/tests/components/ListServices/mint.test.jsx index d8266e6a..5bfdc4a7 100644 --- a/apps/autonolas-registry/tests/components/ListServices/mint.test.jsx +++ b/apps/autonolas-registry/tests/components/ListServices/mint.test.jsx @@ -45,9 +45,7 @@ describe('listServices/mint.jsx', () => { }); it('should submit the form successfully', async () => { - const { container, getByText, getByRole, getByTestId } = render( - wrapProvider(), - ); + const { container, getByText, getByRole, getByTestId } = render(wrapProvider()); // title expect(getByText(/Mint Service/i)).toBeInTheDocument(); @@ -62,15 +60,9 @@ describe('listServices/mint.jsx', () => { fillIpfsGenerationModal(); // other fields - userEvent.type( - container.querySelector(`#${FORM_NAME}_owner_address`), - dummyAddress, - ); + userEvent.type(container.querySelector(`#${FORM_NAME}_owner_address`), dummyAddress); userEvent.type(container.querySelector(`#${FORM_NAME}_agent_ids`), '1'); - userEvent.type( - container.querySelector(`#${FORM_NAME}_agent_num_slots`), - '1', - ); + userEvent.type(container.querySelector(`#${FORM_NAME}_agent_num_slots`), '1'); userEvent.type(container.querySelector(`#${FORM_NAME}_bonds`), '1'); userEvent.type(container.querySelector(`#${FORM_NAME}_threshold`), '1'); diff --git a/apps/autonolas-registry/tests/components/ListServices/update.test.jsx b/apps/autonolas-registry/tests/components/ListServices/update.test.jsx index 59029b09..3ea03af8 100644 --- a/apps/autonolas-registry/tests/components/ListServices/update.test.jsx +++ b/apps/autonolas-registry/tests/components/ListServices/update.test.jsx @@ -4,14 +4,8 @@ import userEvent from '@testing-library/user-event'; import Update from '../../../components/ListServices/update'; import { FORM_NAME } from '../../../components/ListServices/helpers/RegisterForm'; -import { - getServiceContract, - getServiceManagerContract, -} from '../../../common-util/Contracts'; -import { - getServiceDetails, - getServiceOwner, -} from '../../../components/ListServices/utils'; +import { getServiceContract, getServiceManagerContract } from '../../../common-util/Contracts'; +import { getServiceDetails, getServiceOwner } from '../../../components/ListServices/utils'; import { wrapProvider, dummyAddress, @@ -50,8 +44,7 @@ const SERVICE_1 = { agentParams: [['1', '1000']], threshold: '5', id: 1, - configHash: - '0x1348530ee33734f1d85cf0cdab13181c8c18c051a589a185f52fc0c740a4d5fa', + configHash: '0x1348530ee33734f1d85cf0cdab13181c8c18c051a589a185f52fc0c740a4d5fa', }; // TODO: fix with antd form @@ -85,27 +78,15 @@ describe.skip('listServices/service.jsx', () => { }); it('should update the service successfully', async () => { - const { container, getByRole } = render( - wrapProvider(), - ); + const { container, getByRole } = render(wrapProvider()); await waitFor(async () => { - expect(container.querySelector(`#${FORM_NAME}_owner_address`).value).toBe( - dummyAddress, - ); - expect(container.querySelector(`#${FORM_NAME}_agent_ids`).value).toBe( - '1', - ); - expect( - container.querySelector(`#${FORM_NAME}_agent_num_slots`).value, - ).toBe('1'); - expect(container.querySelector(`#${FORM_NAME}_hash`).value).toBe( - SERVICE_1.configHash, - ); + expect(container.querySelector(`#${FORM_NAME}_owner_address`).value).toBe(dummyAddress); + expect(container.querySelector(`#${FORM_NAME}_agent_ids`).value).toBe('1'); + expect(container.querySelector(`#${FORM_NAME}_agent_num_slots`).value).toBe('1'); + expect(container.querySelector(`#${FORM_NAME}_hash`).value).toBe(SERVICE_1.configHash); expect(container.querySelector(`#${FORM_NAME}_bonds`).value).toBe('1000'); - expect(container.querySelector(`#${FORM_NAME}_threshold`).value).toBe( - '5', - ); + expect(container.querySelector(`#${FORM_NAME}_threshold`).value).toBe('5'); const submitButton = getByRole('button', { name: 'Submit' }); expect(submitButton).toBeInTheDocument(); diff --git a/apps/autonolas-registry/tests/components/ListServices/utils.test.jsx b/apps/autonolas-registry/tests/components/ListServices/utils.test.jsx index 2615eccf..5cf039fd 100644 --- a/apps/autonolas-registry/tests/components/ListServices/utils.test.jsx +++ b/apps/autonolas-registry/tests/components/ListServices/utils.test.jsx @@ -1,13 +1,6 @@ import { getServiceContract } from '../../../common-util/Contracts'; -import { - getServices, - getFilteredServices, -} from '../../../components/ListServices/utils'; -import { - dummyAddress, - svmConnectivityEmptyMock, - useHelpersEvmMock, -} from '../../tests-helpers'; +import { getServices, getFilteredServices } from '../../../components/ListServices/utils'; +import { dummyAddress, svmConnectivityEmptyMock, useHelpersEvmMock } from '../../tests-helpers'; const SERVICE_1 = { name: 'Service One' }; @@ -31,9 +24,7 @@ describe('listServices/utils.jsx', () => { call: jest.fn(() => Promise.resolve(1)), })), exists: jest.fn(() => ({ - call: jest.fn(() => - Promise.resolve({ status: 'fulfilled', value: true }), - ), + call: jest.fn(() => Promise.resolve({ status: 'fulfilled', value: true })), })), balanceOf: jest.fn(() => ({ call: jest.fn(() => Promise.resolve(1)), @@ -61,9 +52,7 @@ describe('listServices/utils.jsx', () => { call: jest.fn(() => Promise.resolve(1)), })), exists: jest.fn(() => ({ - call: jest.fn(() => - Promise.resolve({ status: 'fulfilled', value: true }), - ), + call: jest.fn(() => Promise.resolve({ status: 'fulfilled', value: true })), })), getService: jest.fn(() => ({ call: jest.fn(() => Promise.resolve(SERVICE_1)), diff --git a/apps/autonolas-registry/tests/tests-helpers/index.jsx b/apps/autonolas-registry/tests/tests-helpers/index.jsx index ec52a8d1..4ad4116a 100644 --- a/apps/autonolas-registry/tests/tests-helpers/index.jsx +++ b/apps/autonolas-registry/tests/tests-helpers/index.jsx @@ -30,20 +30,16 @@ export const errorStore = mockStore({ setup: { account: dummyAddress, errorMessage: 'Error in store' }, }); -export const wrapProviderError = (component) => ( - {component} -); +export const wrapProviderError = (component) => {component}; export const getTableTh = (i) => `.ant-table-thead > tr > th:nth-child(${i})`; export const getTableTd = (i) => `.ant-table-tbody > tr.ant-table-row.ant-table-row-level-0 > td:nth-child(${i})`; -export const mockV1Hash = - '6f3212908f2e7a0249b67b05f237a40b76b7d8ef36d5620b281ceb47dcb6b122'; +export const mockV1Hash = '6f3212908f2e7a0249b67b05f237a40b76b7d8ef36d5620b281ceb47dcb6b122'; -export const mockNftImageHash = - 'Qmbh9SQLbNRawh9Km3PMEDSxo77k1wib8fYZUdZkhPBiev'; +export const mockNftImageHash = 'Qmbh9SQLbNRawh9Km3PMEDSxo77k1wib8fYZUdZkhPBiev'; export const mockCodeUri = 'f017012209cf4ae0b5d082843b3b34d0d400abbeffcb5a98b68ea89f3abf151f182315ab0'; @@ -127,8 +123,7 @@ export const svmServiceStateMock = { serviceOwner: 'DrGvsAxY8ehyXjE6qSZXcT5A9pTsUkVm3en5ZQD3Wm5x', securityDeposit: '01', multisig: 'CsZ2ZbCGALZ2p8Np9hFmgMDXVYg4X9i5zYN8nvbPYJ6D', - configHash: - '327277b25e86f19a5e4e5cf4bee643f3eb219067af05ca8929cb1cfcbf673b08', + configHash: '327277b25e86f19a5e4e5cf4bee643f3eb219067af05ca8929cb1cfcbf673b08', threshold: 1, maxNumAgentInstances: 1, numAgentInstances: 1, diff --git a/apps/autonolas-registry/tests/tests-helpers/prefillForm.jsx b/apps/autonolas-registry/tests/tests-helpers/prefillForm.jsx index 14b90fd8..0ed1e49e 100644 --- a/apps/autonolas-registry/tests/tests-helpers/prefillForm.jsx +++ b/apps/autonolas-registry/tests/tests-helpers/prefillForm.jsx @@ -6,14 +6,8 @@ export const fillIpfsGenerationModal = () => { userEvent.type(screen.getByRole('textbox', { name: 'Name' }), '1'); userEvent.type(screen.getByRole('textbox', { name: 'Description' }), '1'); userEvent.type(screen.getByRole('textbox', { name: 'Version' }), '1'); - userEvent.type( - screen.getByRole('textbox', { name: 'Package hash' }), - mockV1Hash, - ); - userEvent.type( - screen.getByRole('textbox', { name: 'NFT Image URL' }), - mockV1Hash, - ); + userEvent.type(screen.getByRole('textbox', { name: 'Package hash' }), mockV1Hash); + userEvent.type(screen.getByRole('textbox', { name: 'NFT Image URL' }), mockV1Hash); userEvent.click( screen.getByRole('button', { name: 'Save File & Generate Hash', diff --git a/apps/autonolas-registry/tests/tests-helpers/utils.tsx b/apps/autonolas-registry/tests/tests-helpers/utils.tsx index c4a6847b..cb5e2d4e 100644 --- a/apps/autonolas-registry/tests/tests-helpers/utils.tsx +++ b/apps/autonolas-registry/tests/tests-helpers/utils.tsx @@ -15,17 +15,13 @@ export const checkAndGetTabComponent = async ( } // wait until the tab is enabled - await waitFor(async () => - expect(unitTab).not.toHaveAttribute('aria-disabled'), - ); + await waitFor(async () => expect(unitTab).not.toHaveAttribute('aria-disabled')); // click the tab await userEvent.click(unitTab); // check if the selected tab is active - await waitFor(async () => - expect(container.querySelector(ACTIVE_TAB)?.textContent).toBe(tabName), - ); + await waitFor(async () => expect(container.querySelector(ACTIVE_TAB)?.textContent).toBe(tabName)); return unitTab; }; diff --git a/apps/bond/common-util/config/wagmi.js b/apps/bond/common-util/config/wagmi.js index 2167e811..1a6050c0 100644 --- a/apps/bond/common-util/config/wagmi.js +++ b/apps/bond/common-util/config/wagmi.js @@ -1,11 +1,6 @@ import { http, createConfig } from 'wagmi'; import { mainnet, goerli } from 'wagmi/chains'; -import { - safe, - walletConnect, - injected, - coinbaseWallet, -} from 'wagmi/connectors'; +import { safe, walletConnect, injected, coinbaseWallet } from 'wagmi/connectors'; import { RPC_URLS } from 'common-util/constants/rpcs'; export const SUPPORTED_CHAINS = [mainnet, goerli]; @@ -39,8 +34,7 @@ export const wagmiConfig = createConfig({ }), ], transports: SUPPORTED_CHAINS.reduce( - (acc, chain) => - Object.assign(acc, { [chain.id]: http(RPC_URLS[chain.id]) }), + (acc, chain) => Object.assign(acc, { [chain.id]: http(RPC_URLS[chain.id]) }), {}, ), }); diff --git a/apps/bond/common-util/constants/rpcs.js b/apps/bond/common-util/constants/rpcs.js index 843acb77..3fe7a1cc 100644 --- a/apps/bond/common-util/constants/rpcs.js +++ b/apps/bond/common-util/constants/rpcs.js @@ -1,12 +1,4 @@ -import { - mainnet, - goerli, - optimism, - gnosis, - polygon, - base, - arbitrum, -} from 'wagmi/chains'; +import { mainnet, goerli, optimism, gnosis, polygon, base, arbitrum } from 'wagmi/chains'; import { LOCAL_FORK_ID } from '@autonolas/frontend-library'; @@ -17,7 +9,6 @@ export const RPC_URLS = { 100: process.env.NEXT_PUBLIC_GNOSIS_URL ?? gnosis.rpcUrls.default.http[0], 137: process.env.NEXT_PUBLIC_POLYGON_URL ?? polygon.rpcUrls.default.http[0], 8453: process.env.NEXT_PUBLIC_BASE_URL ?? base.rpcUrls.default.http[0], - 42161: - process.env.NEXT_PUBLIC_ARBITRUM_URL ?? arbitrum.rpcUrls.default.http[0], + 42161: process.env.NEXT_PUBLIC_ARBITRUM_URL ?? arbitrum.rpcUrls.default.http[0], [LOCAL_FORK_ID]: 'http://127.0.0.1:8545', }; diff --git a/apps/bond/common-util/functions/chains.js b/apps/bond/common-util/functions/chains.js index df8fcff8..40e8bbf8 100644 --- a/apps/bond/common-util/functions/chains.js +++ b/apps/bond/common-util/functions/chains.js @@ -1,4 +1,3 @@ import { LOCAL_FORK_ID } from '@autonolas/frontend-library'; -export const isL1Network = (chainId) => - chainId === 1 || chainId === 5 || chainId === LOCAL_FORK_ID; +export const isL1Network = (chainId) => chainId === 1 || chainId === 5 || chainId === LOCAL_FORK_ID; diff --git a/apps/bond/common-util/functions/errors.jsx b/apps/bond/common-util/functions/errors.jsx index b815c901..463bf238 100644 --- a/apps/bond/common-util/functions/errors.jsx +++ b/apps/bond/common-util/functions/errors.jsx @@ -97,8 +97,8 @@ export const notifyCustomErrors = ( const errorList = types.map((type) => errorTypes[type]).flat(); const message = - errorList.find((cError) => error?.message?.includes(cError.message)) - ?.toDisplay || defaultMessage; + errorList.find((cError) => error?.message?.includes(cError.message))?.toDisplay || + defaultMessage; if (message) { const errorInString = JSON.stringify(error, null, 2); diff --git a/apps/bond/common-util/functions/ethers.js b/apps/bond/common-util/functions/ethers.js index 1427ac64..6815cb67 100644 --- a/apps/bond/common-util/functions/ethers.js +++ b/apps/bond/common-util/functions/ethers.js @@ -4,20 +4,17 @@ import { ethers } from 'ethers'; * Same as `formatToEth` but doesn't fixes the decimal to 8 * @returns {String} eg: 1000000000000000000 => 1 */ -export const parseToEth = (amount) => - amount ? ethers.formatEther(`${amount}`) : 0; +export const parseToEth = (amount) => (amount ? ethers.formatEther(`${amount}`) : 0); /** * multiplies the amount by 10^18 */ -export const parseToWei = (amount) => - ethers.parseUnits(`${amount}`, 18).toString(); +export const parseToWei = (amount) => ethers.parseUnits(`${amount}`, 18).toString(); /** * multiplies the amount by 10^8 */ -export const parseToSolDecimals = (amount) => - ethers.parseUnits(`${amount}`, 8).toString(); +export const parseToSolDecimals = (amount) => ethers.parseUnits(`${amount}`, 8).toString(); /** * TODO: move to autonolas-library and figure out a better way diff --git a/apps/bond/common-util/graphql/clients.js b/apps/bond/common-util/graphql/clients.js index 873f7d64..69f494c1 100644 --- a/apps/bond/common-util/graphql/clients.js +++ b/apps/bond/common-util/graphql/clients.js @@ -1,12 +1,5 @@ import { GraphQLClient } from 'graphql-request'; -import { - arbitrum, - base, - gnosis, - mainnet, - optimism, - polygon, -} from 'viem/chains'; +import { arbitrum, base, gnosis, mainnet, optimism, polygon } from 'viem/chains'; const requestConfig = { jsonSerializer: { @@ -16,36 +9,18 @@ const requestConfig = { }; export const AUTONOLAS_GRAPH_CLIENTS = { - 1: new GraphQLClient( - process.env.NEXT_PUBLIC_GRAPH_ENDPOINT_MAINNET, - requestConfig, - ), + 1: new GraphQLClient(process.env.NEXT_PUBLIC_GRAPH_ENDPOINT_MAINNET, requestConfig), }; // https://docs.balancer.fi/reference/subgraph/ for future subgraph endpoints export const BALANCER_GRAPH_CLIENTS = { - [mainnet.id]: new GraphQLClient( - process.env.NEXT_PUBLIC_MAINNET_BALANCER_URL, - requestConfig, - ), - [optimism.id]: new GraphQLClient( - process.env.NEXT_PUBLIC_OPTIMISM_BALANCER_URL, - requestConfig, - ), - [gnosis.id]: new GraphQLClient( - process.env.NEXT_PUBLIC_GNOSIS_BALANCER_URL, - requestConfig, - ), - [polygon.id]: new GraphQLClient( - process.env.NEXT_PUBLIC_POLYGON_BALANCER_URL, - requestConfig, - ), + [mainnet.id]: new GraphQLClient(process.env.NEXT_PUBLIC_MAINNET_BALANCER_URL, requestConfig), + [optimism.id]: new GraphQLClient(process.env.NEXT_PUBLIC_OPTIMISM_BALANCER_URL, requestConfig), + [gnosis.id]: new GraphQLClient(process.env.NEXT_PUBLIC_GNOSIS_BALANCER_URL, requestConfig), + [polygon.id]: new GraphQLClient(process.env.NEXT_PUBLIC_POLYGON_BALANCER_URL, requestConfig), [base.id]: new GraphQLClient( 'https://api.studio.thegraph.com/query/24660/balancer-base-v2/version/latest', requestConfig, ), - [arbitrum.id]: new GraphQLClient( - process.env.NEXT_PUBLIC_ARBITRUM_BALANCER_URL, - requestConfig, - ), + [arbitrum.id]: new GraphQLClient(process.env.NEXT_PUBLIC_ARBITRUM_BALANCER_URL, requestConfig), }; diff --git a/apps/bond/common-util/hooks/useSvmConnectivity.jsx b/apps/bond/common-util/hooks/useSvmConnectivity.jsx index cd4f84e3..572222fb 100644 --- a/apps/bond/common-util/hooks/useSvmConnectivity.jsx +++ b/apps/bond/common-util/hooks/useSvmConnectivity.jsx @@ -1,9 +1,5 @@ import { useMemo } from 'react'; -import { - useAnchorWallet, - useConnection, - useWallet, -} from '@solana/wallet-adapter-react'; +import { useAnchorWallet, useConnection, useWallet } from '@solana/wallet-adapter-react'; import { AnchorProvider } from '@project-serum/anchor'; import { Keypair } from '@solana/web3.js'; import NodeWallet from '@project-serum/anchor/dist/cjs/nodewallet'; diff --git a/apps/bond/components/Address.jsx b/apps/bond/components/Address.jsx index a8bb949e..4e7b0660 100644 --- a/apps/bond/components/Address.jsx +++ b/apps/bond/components/Address.jsx @@ -18,9 +18,7 @@ const Address = ({ address, networkId, customExplorerUrl }) => { <> - {truncateAddress(address)} - {' '} - ↗ + {truncateAddress(address)} ↗   diff --git a/apps/bond/components/BondingProducts/Bonding/BondingList/useBondingList.jsx b/apps/bond/components/BondingProducts/Bonding/BondingList/useBondingList.jsx index c9ceb602..e9f72207 100644 --- a/apps/bond/components/BondingProducts/Bonding/BondingList/useBondingList.jsx +++ b/apps/bond/components/BondingProducts/Bonding/BondingList/useBondingList.jsx @@ -179,7 +179,9 @@ const getCurrentPriceBalancerFn = memoize(async (tokenAddress) => { const { pool } = await BALANCER_GRAPH_CLIENTS[lpChainId].request(balancerGetPoolQuery(poolId)); if (!pool) { - throw new Error(`Pool not found on Balancer for poolId: ${poolId} and chainId: ${lpChainId}.`); + throw new Error( + `Pool not found on Balancer for poolId: ${poolId} and chainId: ${lpChainId}.`, + ); } const totalSupply = pool.totalShares; diff --git a/apps/bond/components/BondingProducts/Bonding/TokenManagement/constants.jsx b/apps/bond/components/BondingProducts/Bonding/TokenManagement/constants.jsx index 9ffa0d1e..18629196 100644 --- a/apps/bond/components/BondingProducts/Bonding/TokenManagement/constants.jsx +++ b/apps/bond/components/BondingProducts/Bonding/TokenManagement/constants.jsx @@ -4,18 +4,10 @@ import { VM_TYPE } from '@autonolas/frontend-library'; import { ADDRESSES } from 'common-util/constants/addresses'; -export const PROGRAM_ID = new web3.PublicKey( - '1BoXeb8hobfLCHNsyCoG1jpEv41ez4w4eDrJ48N1jY3', -); -export const ORCA = new web3.PublicKey( - 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc', -); -export const WHIRLPOOL = new web3.PublicKey( - ADDRESSES[VM_TYPE.SVM].balancerVault, -); -export const SOL = new web3.PublicKey( - 'So11111111111111111111111111111111111111112', -); +export const PROGRAM_ID = new web3.PublicKey('1BoXeb8hobfLCHNsyCoG1jpEv41ez4w4eDrJ48N1jY3'); +export const ORCA = new web3.PublicKey('whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'); +export const WHIRLPOOL = new web3.PublicKey(ADDRESSES[VM_TYPE.SVM].balancerVault); +export const SOL = new web3.PublicKey('So11111111111111111111111111111111111111112'); export const BRIDGED_TOKEN_MINT = new web3.PublicKey( 'CeZ77ti3nPAmcgRkBkUC1JcoAhR8jRti2DHaCcuyUnzR', ); @@ -28,33 +20,18 @@ export const FEE_COLLECTOR_TOKEN_OWNER_ACCOUNT_A = new web3.PublicKey( export const FEE_COLLECTOR_TOKEN_OWNER_ACCOUNT_B = new web3.PublicKey( 'FPaBgHbaJR39WBNn6xZRAmurQCBH9QSNWZ5Kk26cGs9d', ); -export const LOCKBOX = new web3.PublicKey( - '3UaaD3puPemoZk7qFYJWWCvmN6diS7P63YR4Si9QRpaW', -); -export const POSITION = new web3.PublicKey( - 'EHQbFx7m5gPBqXXiViNBfHJDRUuFgqqYsLzuWu18ckaR', -); -export const POSITION_MINT = new web3.PublicKey( - '36WxSP8trn5czobJaa2Ka7jN58B7sCN7xx2HDom6TDEh', -); -export const TOKEN_VAULT_A = new web3.PublicKey( - 'CLA8hU8SkdCZ9cJVLMfZQfcgAsywZ9txBJ6qrRAqthLx', -); -export const TOKEN_VAULT_B = new web3.PublicKey( - '6E8pzDK8uwpENc49kp5xo5EGydYjtamPSmUKXxum4ybb', -); -export const TICK_ARRAY_LOWER = new web3.PublicKey( - '3oJAqTKTCdGvLS9zpoBquWvMjwthu9Np67Qp4W8AT843', -); -export const TICK_ARRAY_UPPER = new web3.PublicKey( - 'J3eMJUQWLmSsG5VnXVFHCGwakpKmzi4jkNvi3vbCZQ3o', -); +export const LOCKBOX = new web3.PublicKey('3UaaD3puPemoZk7qFYJWWCvmN6diS7P63YR4Si9QRpaW'); +export const POSITION = new web3.PublicKey('EHQbFx7m5gPBqXXiViNBfHJDRUuFgqqYsLzuWu18ckaR'); +export const POSITION_MINT = new web3.PublicKey('36WxSP8trn5czobJaa2Ka7jN58B7sCN7xx2HDom6TDEh'); +export const TOKEN_VAULT_A = new web3.PublicKey('CLA8hU8SkdCZ9cJVLMfZQfcgAsywZ9txBJ6qrRAqthLx'); +export const TOKEN_VAULT_B = new web3.PublicKey('6E8pzDK8uwpENc49kp5xo5EGydYjtamPSmUKXxum4ybb'); +export const TICK_ARRAY_LOWER = new web3.PublicKey('3oJAqTKTCdGvLS9zpoBquWvMjwthu9Np67Qp4W8AT843'); +export const TICK_ARRAY_UPPER = new web3.PublicKey('J3eMJUQWLmSsG5VnXVFHCGwakpKmzi4jkNvi3vbCZQ3o'); export const TICK_SPACING = 64; export const WHIRLPOOL_CONFIG_ID = new web3.PublicKey( '2LecshUwdy9xi7meFgHtFJQNSKk4KdTrcpvaB56dP2NQ', ); -export const [tickLowerIndex, tickUpperIndex] = - TickUtil.getFullRangeTickIndex(TICK_SPACING); +export const [tickLowerIndex, tickUpperIndex] = TickUtil.getFullRangeTickIndex(TICK_SPACING); export const CONNECT_SVM_WALLET = 'Please connect your phantom wallet'; export const SVM_AMOUNT_DIVISOR = 100000000; diff --git a/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useGetOrCreateAssociatedTokenAccount.jsx b/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useGetOrCreateAssociatedTokenAccount.jsx index 73e75cff..b023dd84 100644 --- a/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useGetOrCreateAssociatedTokenAccount.jsx +++ b/apps/bond/components/BondingProducts/Bonding/TokenManagement/hooks/useGetOrCreateAssociatedTokenAccount.jsx @@ -27,10 +27,7 @@ export const useGetOrCreateAssociatedTokenAccount = () => { return null; } - const associatedToken = await getAssociatedTokenAddress( - mintToken, - owner, - ); + const associatedToken = await getAssociatedTokenAddress(mintToken, owner); const accountInfo = await connection.getAccountInfo(associatedToken); if (accountInfo) return associatedToken; diff --git a/apps/bond/components/BondingProducts/Bonding/TokenManagement/utils.jsx b/apps/bond/components/BondingProducts/Bonding/TokenManagement/utils.jsx index 11d65400..2286d26f 100644 --- a/apps/bond/components/BondingProducts/Bonding/TokenManagement/utils.jsx +++ b/apps/bond/components/BondingProducts/Bonding/TokenManagement/utils.jsx @@ -48,21 +48,14 @@ export const configureAndSendCurrentTransaction = async ( export const notifySvmSpecificError = (errorMessage, errorObject) => { const transactionStack = 'stack' in errorObject ? errorObject.stack : null; - if ( - transactionStack && - transactionStack.includes('TransactionExpiredTimeoutError') - ) { + if (transactionStack && transactionStack.includes('TransactionExpiredTimeoutError')) { // Extract the signature using a regex in the error message const signature = transactionStack.match(/Check signature (\S+)/)[1]; const message = ( <> - Transaction was not confirmed in 30.00 seconds. It is unknown if it - succeeded or failed. Check signature{' '} - + Transaction was not confirmed in 30.00 seconds. It is unknown if it succeeded or failed. + Check signature{' '} + {signature} {' '} here. diff --git a/apps/bond/components/BondingProducts/requests.js b/apps/bond/components/BondingProducts/requests.js index 5a6f3044..0b124cb5 100644 --- a/apps/bond/components/BondingProducts/requests.js +++ b/apps/bond/components/BondingProducts/requests.js @@ -1,5 +1,9 @@ import { notifyError } from '@autonolas/frontend-library'; -import { getDepositoryContract, getTokenomicsContract, sendTransaction } from 'common-util/functions'; +import { + getDepositoryContract, + getTokenomicsContract, + sendTransaction, +} from 'common-util/functions'; export const getBondInfoRequest = async (bondList) => { const contract = getDepositoryContract(); @@ -30,9 +34,7 @@ export const getBondInfoRequest = async (bondList) => { const getBondsRequest = async ({ account, isActive: isBondMatured }) => { const contract = getDepositoryContract(); - const response = await contract.methods - .getBonds(account, isBondMatured) - .call(); + const response = await contract.methods.getBonds(account, isBondMatured).call(); const { bondIds } = response; const allListPromise = []; diff --git a/apps/bond/components/Branding/Logo.jsx b/apps/bond/components/Branding/Logo.jsx index a0822c68..82de84a3 100644 --- a/apps/bond/components/Branding/Logo.jsx +++ b/apps/bond/components/Branding/Logo.jsx @@ -1,31 +1,13 @@ export const Logo = () => ( - + - - - + + + ); diff --git a/apps/bond/components/Branding/PoweredByOlas.jsx b/apps/bond/components/Branding/PoweredByOlas.jsx index 8a2154cc..46464d9c 100644 --- a/apps/bond/components/Branding/PoweredByOlas.jsx +++ b/apps/bond/components/Branding/PoweredByOlas.jsx @@ -1,5 +1,10 @@ export const PoweredByOlas = () => ( - + ( - { - handleCopy(copyText); - }} + { + handleCopy(copyText); + }} /> ); diff --git a/apps/bond/components/Login/index.jsx b/apps/bond/components/Login/index.jsx index fcf3ddd8..887d9264 100644 --- a/apps/bond/components/Login/index.jsx +++ b/apps/bond/components/Login/index.jsx @@ -1,12 +1,7 @@ import { useEffect } from 'react'; import { useDispatch } from 'react-redux'; import { useAccount, useBalance } from 'wagmi'; -import { - setUserAccount, - setUserBalance, - setErrorMessage, - setLogout, -} from 'store/setup'; +import { setUserAccount, setUserBalance, setErrorMessage, setLogout } from 'store/setup'; import { LoginV2 } from 'common-util/Login'; const Login = () => { @@ -38,11 +33,7 @@ const Login = () => { return (
- +
); }; diff --git a/apps/bond/context/ConfigProvider.jsx b/apps/bond/context/ConfigProvider.jsx index 85edc9a4..fb93aa2d 100644 --- a/apps/bond/context/ConfigProvider.jsx +++ b/apps/bond/context/ConfigProvider.jsx @@ -10,9 +10,5 @@ export const ThemeConfigProvider = ({ children }) => { setIsMounted(true); }, []); - return ( - - {isMounted ? children : ''} - - ); + return {isMounted ? children : ''}; }; diff --git a/apps/bond/jest.config.js b/apps/bond/jest.config.js index cf02ca6d..8cbeb115 100644 --- a/apps/bond/jest.config.js +++ b/apps/bond/jest.config.js @@ -18,11 +18,14 @@ module.exports = { setupFilesAfterEnv: ['/jest.setup.js'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], transform: { - '^.+\\.[tj]sx?$': ['ts-jest', { - presets: ['@nx/next/babel'], - tsconfig: '/tsconfig.spec.json', - useESM: true, - }], + '^.+\\.[tj]sx?$': [ + 'ts-jest', + { + presets: ['@nx/next/babel'], + tsconfig: '/tsconfig.spec.json', + useESM: true, + }, + ], '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', }, globals: { fetch }, diff --git a/apps/bond/store/index.js b/apps/bond/store/index.js index 3dae2d2b..6d7d1d09 100644 --- a/apps/bond/store/index.js +++ b/apps/bond/store/index.js @@ -1,8 +1,8 @@ -import { configureStore } from '@reduxjs/toolkit' -import { setupReducer } from './setup' +import { configureStore } from '@reduxjs/toolkit'; +import { setupReducer } from './setup'; export const store = configureStore({ reducer: { setup: setupReducer, - } -}) + }, +}); diff --git a/apps/bond/store/setup.js b/apps/bond/store/setup.js index 9842ec60..44a4c190 100644 --- a/apps/bond/store/setup.js +++ b/apps/bond/store/setup.js @@ -40,4 +40,4 @@ export const { setLogout, setStoreState, } = setupSlice.actions; -export const setupReducer = setupSlice.reducer; +export const setupReducer = setupSlice.reducer; diff --git a/apps/bond/util/helpers.js b/apps/bond/util/helpers.js index cc8f0b3c..fbf5a624 100644 --- a/apps/bond/util/helpers.js +++ b/apps/bond/util/helpers.js @@ -6,9 +6,8 @@ import { message } from 'antd'; * @param {string} address - The Ethereum address to truncate * @returns {string} The truncated address */ -export const truncateAddress = (address) => ( - address ? `${address.substring(0, 7)}...${address.substring(address.length - 3)}` : '--' -); +export const truncateAddress = (address) => + address ? `${address.substring(0, 7)}...${address.substring(address.length - 3)}` : '--'; /** * Handles copying text to the clipboard diff --git a/apps/bond/util/meta.js b/apps/bond/util/meta.js index a7ad8f5c..12327a88 100644 --- a/apps/bond/util/meta.js +++ b/apps/bond/util/meta.js @@ -2,7 +2,7 @@ export const SITE = { URL: 'https://bond.olas.network', TITLE: 'Olas Bond', DESCRIPTION: 'Get access to discounted OLAS by bonding capital into the Olas protocol.', - SITE_IMAGE_URL: '/images/meta-image.png' + SITE_IMAGE_URL: '/images/meta-image.png', }; export const OPERATOR_NAME = 'Olas (aka Autonolas) DAO'; diff --git a/apps/govern/components/VeOlas/ProjectedVeOlas.tsx b/apps/govern/components/VeOlas/ProjectedVeOlas.tsx index 11bfebe2..4d81e911 100644 --- a/apps/govern/components/VeOlas/ProjectedVeOlas.tsx +++ b/apps/govern/components/VeOlas/ProjectedVeOlas.tsx @@ -1,14 +1,9 @@ import { useMemo } from 'react'; - - import { getCommaSeparatedNumber } from 'common-util/functions'; - - import { InfoCard } from './InfoCard'; - const SECONDS_IN_A_YEAR = 31536000; type ProjectedVeOlasProps = { @@ -45,4 +40,4 @@ export const ProjectedVeOlas = ({ olasAmount, unlockTime }: ProjectedVeOlasProps value={`${projectedVeOlas} veOLAS`} /> ); -}; \ No newline at end of file +}; diff --git a/apps/govern/jest.config.js b/apps/govern/jest.config.js index 70785ef0..3a4a4534 100644 --- a/apps/govern/jest.config.js +++ b/apps/govern/jest.config.js @@ -21,7 +21,8 @@ module.exports = { setupFilesAfterEnv: ['/jest.setup.js'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], transform: { - '^.+\\.[tj]sx?$': ['ts-jest', + '^.+\\.[tj]sx?$': [ + 'ts-jest', { presets: ['@nx/next/babel'], tsconfig: '/tsconfig.spec.json', diff --git a/apps/govern/tenderly.config.ts b/apps/govern/tenderly.config.ts index b1a00836..505d447d 100644 --- a/apps/govern/tenderly.config.ts +++ b/apps/govern/tenderly.config.ts @@ -1,46 +1,46 @@ -import { defineChain } from 'viem' +import { defineChain } from 'viem'; export const virtualMainnet = defineChain({ id: 1, name: 'Virtual Mainnet', nativeCurrency: { name: 'vETH', symbol: 'vETH', decimals: 18 }, rpcUrls: { - default: { http: [`${process.env.NEXT_PUBLIC_MAINNET_TEST_RPC}`] } + default: { http: [`${process.env.NEXT_PUBLIC_MAINNET_TEST_RPC}`] }, }, blockExplorers: { default: { name: 'Tenderly Explorer', - url: '' - } + url: '', + }, }, -}) +}); export const virtualGnosis = defineChain({ id: 100, name: 'Virtual Gnosis Chain', nativeCurrency: { name: 'vXDAI', symbol: 'vXDAI', decimals: 18 }, rpcUrls: { - default: { http: [`${process.env.NEXT_PUBLIC_GNOSIS_TEST_RPC}`] } + default: { http: [`${process.env.NEXT_PUBLIC_GNOSIS_TEST_RPC}`] }, }, blockExplorers: { default: { name: 'Tenderly Explorer', - url: '' - } + url: '', + }, }, -}) +}); export const virtualPolygon = defineChain({ id: 137, name: 'Virtual Polygon', nativeCurrency: { name: 'vMATIC', symbol: 'vMATIC', decimals: 18 }, rpcUrls: { - default: { http: [`${process.env.NEXT_PUBLIC_POLYGON_TEST_RPC}`] } + default: { http: [`${process.env.NEXT_PUBLIC_POLYGON_TEST_RPC}`] }, }, blockExplorers: { default: { name: 'Tenderly Explorer', - url: '' - } + url: '', + }, }, -}) \ No newline at end of file +}); diff --git a/apps/launch/components/Layout/Menu.tsx b/apps/launch/components/Layout/Menu.tsx index fcdd4a9f..5246ecf1 100644 --- a/apps/launch/components/Layout/Menu.tsx +++ b/apps/launch/components/Layout/Menu.tsx @@ -54,7 +54,9 @@ const MenuInstance: FC = ({ selectedMenu, handleMenuItemClick handleMenuItemClick({ label: '', key, - path: PAGES_TO_LOAD_WITH_CHAIN_ID.includes(key) ? `/${networkName || 'ethereum'}/${key}` : `/${key}`, + path: PAGES_TO_LOAD_WITH_CHAIN_ID.includes(key) + ? `/${networkName || 'ethereum'}/${key}` + : `/${key}`, }) } /> diff --git a/apps/launch/components/Login/YellowButton.tsx b/apps/launch/components/Login/YellowButton.tsx index 7d7304be..c674162a 100644 --- a/apps/launch/components/Login/YellowButton.tsx +++ b/apps/launch/components/Login/YellowButton.tsx @@ -17,6 +17,8 @@ export const YellowButton: FC = ({ children, ...props }) => ( }, }} > - + ); diff --git a/apps/launch/components/Path/StepContent.tsx b/apps/launch/components/Path/StepContent.tsx index 6f8a51bb..42a19f0e 100644 --- a/apps/launch/components/Path/StepContent.tsx +++ b/apps/launch/components/Path/StepContent.tsx @@ -40,7 +40,6 @@ const StepIcon = ({ icon: Icon }: StepIconProps) => ( ); - type StepListProps = { title: string; items: (string | React.ReactNode)[]; diff --git a/apps/launch/jest.config.js b/apps/launch/jest.config.js index 70785ef0..3a4a4534 100644 --- a/apps/launch/jest.config.js +++ b/apps/launch/jest.config.js @@ -21,7 +21,8 @@ module.exports = { setupFilesAfterEnv: ['/jest.setup.js'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], transform: { - '^.+\\.[tj]sx?$': ['ts-jest', + '^.+\\.[tj]sx?$': [ + 'ts-jest', { presets: ['@nx/next/babel'], tsconfig: '/tsconfig.spec.json', diff --git a/apps/operate/components/Layout/Menu.tsx b/apps/operate/components/Layout/Menu.tsx index 9a1396f3..e0803791 100644 --- a/apps/operate/components/Layout/Menu.tsx +++ b/apps/operate/components/Layout/Menu.tsx @@ -3,7 +3,6 @@ import { MenuItemType } from 'antd/es/menu/hooks/useItems'; import { useRouter } from 'next/router'; import { FC, useEffect, useState } from 'react'; - const items: MenuItemType[] = [ { label: 'Live staking contracts', key: 'contracts' }, { label: 'Agents', key: 'agents' }, diff --git a/apps/operate/jest.setup.js b/apps/operate/jest.setup.js index ad1e31fe..a1c426b5 100644 --- a/apps/operate/jest.setup.js +++ b/apps/operate/jest.setup.js @@ -21,7 +21,6 @@ Object.defineProperty(window, 'matchMedia', { })), }); - const { gnosis, mainnet, polygon } = require('viem/chains'); jest.mock('wagmi/chains', () => ({ @@ -29,4 +28,3 @@ jest.mock('wagmi/chains', () => ({ mainnet, polygon, })); - diff --git a/apps/tokenomics/common-util/config/wagmi.js b/apps/tokenomics/common-util/config/wagmi.js index 8ae0420c..3cce47b1 100644 --- a/apps/tokenomics/common-util/config/wagmi.js +++ b/apps/tokenomics/common-util/config/wagmi.js @@ -1,11 +1,6 @@ import { http, createConfig } from 'wagmi'; import { mainnet, goerli } from 'wagmi/chains'; -import { - safe, - walletConnect, - injected, - coinbaseWallet, -} from 'wagmi/connectors'; +import { safe, walletConnect, injected, coinbaseWallet } from 'wagmi/connectors'; import { RPC_URLS } from 'common-util/constants/rpcs'; export const SUPPORTED_CHAINS = [mainnet, goerli]; @@ -39,8 +34,7 @@ export const wagmiConfig = createConfig({ }), ], transports: SUPPORTED_CHAINS.reduce( - (acc, chain) => - Object.assign(acc, { [chain.id]: http(RPC_URLS[chain.id]) }), + (acc, chain) => Object.assign(acc, { [chain.id]: http(RPC_URLS[chain.id]) }), {}, ), }); diff --git a/apps/tokenomics/common-util/constants/rpcs.js b/apps/tokenomics/common-util/constants/rpcs.js index 843acb77..3fe7a1cc 100644 --- a/apps/tokenomics/common-util/constants/rpcs.js +++ b/apps/tokenomics/common-util/constants/rpcs.js @@ -1,12 +1,4 @@ -import { - mainnet, - goerli, - optimism, - gnosis, - polygon, - base, - arbitrum, -} from 'wagmi/chains'; +import { mainnet, goerli, optimism, gnosis, polygon, base, arbitrum } from 'wagmi/chains'; import { LOCAL_FORK_ID } from '@autonolas/frontend-library'; @@ -17,7 +9,6 @@ export const RPC_URLS = { 100: process.env.NEXT_PUBLIC_GNOSIS_URL ?? gnosis.rpcUrls.default.http[0], 137: process.env.NEXT_PUBLIC_POLYGON_URL ?? polygon.rpcUrls.default.http[0], 8453: process.env.NEXT_PUBLIC_BASE_URL ?? base.rpcUrls.default.http[0], - 42161: - process.env.NEXT_PUBLIC_ARBITRUM_URL ?? arbitrum.rpcUrls.default.http[0], + 42161: process.env.NEXT_PUBLIC_ARBITRUM_URL ?? arbitrum.rpcUrls.default.http[0], [LOCAL_FORK_ID]: 'http://127.0.0.1:8545', }; diff --git a/apps/tokenomics/common-util/functions/contract-functions.js b/apps/tokenomics/common-util/functions/contract-functions.js index 42826c57..7c30cc69 100644 --- a/apps/tokenomics/common-util/functions/contract-functions.js +++ b/apps/tokenomics/common-util/functions/contract-functions.js @@ -1,5 +1,5 @@ -import { notifyError } from "@autonolas/frontend-library"; -import { getTokenomicsContract } from "./web3"; +import { notifyError } from '@autonolas/frontend-library'; +import { getTokenomicsContract } from './web3'; export const getEpochCounter = async () => { const contract = getTokenomicsContract(); diff --git a/apps/tokenomics/common-util/functions/ethers.js b/apps/tokenomics/common-util/functions/ethers.js index 1427ac64..6815cb67 100644 --- a/apps/tokenomics/common-util/functions/ethers.js +++ b/apps/tokenomics/common-util/functions/ethers.js @@ -4,20 +4,17 @@ import { ethers } from 'ethers'; * Same as `formatToEth` but doesn't fixes the decimal to 8 * @returns {String} eg: 1000000000000000000 => 1 */ -export const parseToEth = (amount) => - amount ? ethers.formatEther(`${amount}`) : 0; +export const parseToEth = (amount) => (amount ? ethers.formatEther(`${amount}`) : 0); /** * multiplies the amount by 10^18 */ -export const parseToWei = (amount) => - ethers.parseUnits(`${amount}`, 18).toString(); +export const parseToWei = (amount) => ethers.parseUnits(`${amount}`, 18).toString(); /** * multiplies the amount by 10^8 */ -export const parseToSolDecimals = (amount) => - ethers.parseUnits(`${amount}`, 8).toString(); +export const parseToSolDecimals = (amount) => ethers.parseUnits(`${amount}`, 8).toString(); /** * TODO: move to autonolas-library and figure out a better way diff --git a/apps/tokenomics/common-util/functions/units.js b/apps/tokenomics/common-util/functions/units.js index ef127c8b..70512663 100644 --- a/apps/tokenomics/common-util/functions/units.js +++ b/apps/tokenomics/common-util/functions/units.js @@ -4,8 +4,6 @@ */ export const sortUnitIdsAndTypes = (unitIds, unitTypes) => { const sortedUnitIds = [...unitIds].sort((a, b) => a - b); - const sortedUnitTypes = sortedUnitIds.map( - (e) => unitTypes[unitIds.indexOf(e)], - ); + const sortedUnitTypes = sortedUnitIds.map((e) => unitTypes[unitIds.indexOf(e)]); return [sortedUnitIds, sortedUnitTypes]; }; diff --git a/apps/tokenomics/common-util/functions/web3.js b/apps/tokenomics/common-util/functions/web3.js index 03264a04..5516bbff 100644 --- a/apps/tokenomics/common-util/functions/web3.js +++ b/apps/tokenomics/common-util/functions/web3.js @@ -12,10 +12,7 @@ import { } from 'libs/util-contracts/src/lib/abiAndAddresses'; import { ADDRESSES } from 'common-util/constants/addresses'; -import { - getChainId, - getProvider, -} from 'common-util/functions/frontend-library'; +import { getChainId, getProvider } from 'common-util/functions/frontend-library'; import { RPC_URLS } from 'common-util/constants/rpcs'; /** @@ -75,23 +72,16 @@ export const getAgentContract = () => { export const getComponentContract = () => { const { chainId } = getWeb3Details(); - const contract = getContract( - COMPONENT_REGISTRY.abi, - ADDRESSES[chainId].component, - ); + const contract = getContract(COMPONENT_REGISTRY.abi, ADDRESSES[chainId].component); return contract; }; export const getServiceContract = () => { const { chainId } = getWeb3Details(); - const contract = getContract( - SERVICE_REGISTRY.abi, - ADDRESSES[chainId].service, - ); + const contract = getContract(SERVICE_REGISTRY.abi, ADDRESSES[chainId].service); return contract; }; - /** * * @returns ethers provider for ethereum diff --git a/apps/tokenomics/components/Layout/Disclaimer.jsx b/apps/tokenomics/components/Layout/Disclaimer.jsx index c409b0e8..d6b7fc49 100644 --- a/apps/tokenomics/components/Layout/Disclaimer.jsx +++ b/apps/tokenomics/components/Layout/Disclaimer.jsx @@ -22,54 +22,46 @@ export const Disclaimer = () => (
  1. This App is owned by the Autonolas DAO and operated by  - + Centrality Labs - . This App is for the Autonolas community to encourage Autonolas - ecosystem contributors and users to unlock Autonolas governance. + . This App is for the Autonolas community to encourage Autonolas ecosystem contributors + and users to unlock Autonolas governance.
  2. - THIS APP IS PROVIDED "AS IS" AND "AS AVAILABLE," - AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. Neither - Autonolas nor Centrality Labs will be liable for any loss, whether - such loss is direct, indirect, special or consequential, suffered by - any party as a result of their use of this app. + THIS APP IS PROVIDED "AS IS" AND "AS AVAILABLE," AT YOUR OWN RISK, AND + WITHOUT WARRANTIES OF ANY KIND. Neither Autonolas nor Centrality Labs will be liable for + any loss, whether such loss is direct, indirect, special or consequential, suffered by any + party as a result of their use of this app.
  3. By accessing this app, you represent and warrant
    1. - that you are of legal age and that you will comply with any laws - applicable to you and not engage in any illegal activities; + that you are of legal age and that you will comply with any laws applicable to you and + not engage in any illegal activities;
    2. - that you are claiming OLAS tokens to participate in the Autonolas - DAO governance process and that they do not represent - consideration for past or future services; + that you are claiming OLAS tokens to participate in the Autonolas DAO governance + process and that they do not represent consideration for past or future services;
    3. - that you, the country you are a resident of and your wallet - address is not on any sanctions lists maintained by the United - Nations, Switzerland, the EU, UK or the US; + that you, the country you are a resident of and your wallet address is not on any + sanctions lists maintained by the United Nations, Switzerland, the EU, UK or the US;
    4. - that you are responsible for any tax obligations arising out of - the interaction with this app. + that you are responsible for any tax obligations arising out of the interaction with + this app.
  4. - None of the information available on this app, or made otherwise - available to you in relation to its use, constitutes any legal, tax, - financial or other advice. Where in doubt as to the action you should - take, please consult your own legal, financial, tax or other + None of the information available on this app, or made otherwise available to you in + relation to its use, constitutes any legal, tax, financial or other advice. Where in doubt + as to the action you should take, please consult your own legal, financial, tax or other professional advisors.
diff --git a/apps/tokenomics/components/Layout/Footer.jsx b/apps/tokenomics/components/Layout/Footer.jsx index ea5fc6ec..d324cecb 100644 --- a/apps/tokenomics/components/Layout/Footer.jsx +++ b/apps/tokenomics/components/Layout/Footer.jsx @@ -2,10 +2,7 @@ import { useRouter } from 'next/router'; import { Grid } from 'antd'; import Link from 'next/link'; import Image from 'next/image'; -import { - Footer as CommonFooter, - getExplorerURL, -} from '@autonolas/frontend-library'; +import { Footer as CommonFooter, getExplorerURL } from '@autonolas/frontend-library'; import { ADDRESSES } from 'common-util/constants/addresses'; import { useHelpers } from 'common-util/hooks/useHelpers'; @@ -68,19 +65,13 @@ const ContractInfo = () => { ); - const { textOne, addressOne, textTwo, addressTwo } = - getCurrentPageAddresses(); + const { textOne, addressOne, textTwo, addressTwo } = getCurrentPageAddresses(); return ( {!PATHS_NOT_TO_SHOW.includes(pathname) && ( <> - Etherscan link + Etherscan link Contracts  •  {getContractInfo(textOne, addressOne)} diff --git a/apps/tokenomics/components/Login/index.jsx b/apps/tokenomics/components/Login/index.jsx index fcf3ddd8..887d9264 100644 --- a/apps/tokenomics/components/Login/index.jsx +++ b/apps/tokenomics/components/Login/index.jsx @@ -1,12 +1,7 @@ import { useEffect } from 'react'; import { useDispatch } from 'react-redux'; import { useAccount, useBalance } from 'wagmi'; -import { - setUserAccount, - setUserBalance, - setErrorMessage, - setLogout, -} from 'store/setup'; +import { setUserAccount, setUserBalance, setErrorMessage, setLogout } from 'store/setup'; import { LoginV2 } from 'common-util/Login'; const Login = () => { @@ -38,11 +33,7 @@ const Login = () => { return (
- +
); }; diff --git a/apps/tokenomics/jest.config.js b/apps/tokenomics/jest.config.js index cab1dc2e..3085c19e 100644 --- a/apps/tokenomics/jest.config.js +++ b/apps/tokenomics/jest.config.js @@ -18,11 +18,14 @@ module.exports = { setupFilesAfterEnv: ['/jest.setup.js'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], transform: { - '^.+\\.[tj]sx?$': ['ts-jest', { - presets: ['@nx/next/babel'], - tsconfig: '/tsconfig.spec.json', - useESM: true, - }], + '^.+\\.[tj]sx?$': [ + 'ts-jest', + { + presets: ['@nx/next/babel'], + tsconfig: '/tsconfig.spec.json', + useESM: true, + }, + ], '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', }, globals: { fetch }, diff --git a/apps/tokenomics/next.config.js b/apps/tokenomics/next.config.js index 7603316d..5f34542f 100644 --- a/apps/tokenomics/next.config.js +++ b/apps/tokenomics/next.config.js @@ -33,7 +33,7 @@ const nextConfig = { destination: '/dev-incentives', permanent: false, }, - { + { source: '/donate', destination: 'https://govern.olas.network/donate', permanent: true, @@ -57,7 +57,7 @@ const nextConfig = { source: '/my-bonds', destination: 'https://bond.olas.network/my-bonds', permanent: true, - } + }, ]; }, }; diff --git a/apps/tokenomics/store/index.js b/apps/tokenomics/store/index.js index 3dae2d2b..6d7d1d09 100644 --- a/apps/tokenomics/store/index.js +++ b/apps/tokenomics/store/index.js @@ -1,8 +1,8 @@ -import { configureStore } from '@reduxjs/toolkit' -import { setupReducer } from './setup' +import { configureStore } from '@reduxjs/toolkit'; +import { setupReducer } from './setup'; export const store = configureStore({ reducer: { setup: setupReducer, - } -}) + }, +}); diff --git a/apps/tokenomics/store/setup.js b/apps/tokenomics/store/setup.js index 9842ec60..44a4c190 100644 --- a/apps/tokenomics/store/setup.js +++ b/apps/tokenomics/store/setup.js @@ -40,4 +40,4 @@ export const { setLogout, setStoreState, } = setupSlice.actions; -export const setupReducer = setupSlice.reducer; +export const setupReducer = setupSlice.reducer; diff --git a/libs/feature-service-status-info/src/lib/helpers/MinimizedStatus.tsx b/libs/feature-service-status-info/src/lib/helpers/MinimizedStatus.tsx index d1d5e34f..ca18ac1f 100644 --- a/libs/feature-service-status-info/src/lib/helpers/MinimizedStatus.tsx +++ b/libs/feature-service-status-info/src/lib/helpers/MinimizedStatus.tsx @@ -37,15 +37,8 @@ export const MinimizedStatus = ({ }} onClick={() => window.open('https://autonolas.network')} /> - {showStatus && ( - - )} - + {showStatus && } + {showStatus && ( @@ -78,9 +69,7 @@ export const MinimizedStatus = ({ r="4" fill={isOperational ? COLOR.GREEN_2 : COLOR.ORANGE} /> -
- {timerCountdown} -
+
{timerCountdown}
)} diff --git a/package.json b/package.json index 65426961..234c716c 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "bignumber.js": "^9.1.2", "cors": "^2.8.5", "decimal.js": "^10.4.3", + "eslint-plugin-prettier": "^5.2.1", "ethers": "^6.11.1", "ethers-v5": "npm:ethers@5.7.2", "express": "^4.18.2", @@ -126,7 +127,7 @@ "jsdom": "~22.1.0", "next-router-mock": "^0.9.12", "nx": "v17.2.5", - "prettier": "^2.6.2", + "prettier": "^3.3.3", "redux-mock-store": "^1.5.4", "ts-jest": "^29.1.0", "ts-node": "10.9.1", diff --git a/yarn.lock b/yarn.lock index dcda672c..97d5b7bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4941,6 +4941,11 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== +"@pkgr/core@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== + "@polka/url@^1.0.0-next.20", "@polka/url@^1.0.0-next.24": version "1.0.0-next.25" resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.25.tgz#f077fdc0b5d0078d30893396ff4827a13f99e817" @@ -13730,6 +13735,14 @@ eslint-plugin-jsx-a11y@^6.7.1: object.entries "^1.1.7" object.fromentries "^2.0.7" +eslint-plugin-prettier@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz#d1c8f972d8f60e414c25465c163d16f209411f95" + integrity sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw== + dependencies: + prettier-linter-helpers "^1.0.0" + synckit "^0.9.1" + eslint-plugin-react-hooks@4.6.0, "eslint-plugin-react-hooks@^4.5.0 || 5.0.0-canary-7118f5dd7-20230705": version "4.6.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3" @@ -14062,7 +14075,43 @@ ethereumjs-util@^7.0.10, ethereumjs-util@^7.1.0, ethereumjs-util@^7.1.5: ethereum-cryptography "^0.1.3" rlp "^2.2.4" -"ethers-v5@npm:ethers@5.7.2", ethers@^5.7.0, ethers@^5.7.2: +"ethers-v5@npm:ethers@5.7.2": + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== + dependencies: + "@ethersproject/abi" "5.7.0" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/address" "5.7.0" + "@ethersproject/base64" "5.7.0" + "@ethersproject/basex" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@ethersproject/bytes" "5.7.0" + "@ethersproject/constants" "5.7.0" + "@ethersproject/contracts" "5.7.0" + "@ethersproject/hash" "5.7.0" + "@ethersproject/hdnode" "5.7.0" + "@ethersproject/json-wallets" "5.7.0" + "@ethersproject/keccak256" "5.7.0" + "@ethersproject/logger" "5.7.0" + "@ethersproject/networks" "5.7.1" + "@ethersproject/pbkdf2" "5.7.0" + "@ethersproject/properties" "5.7.0" + "@ethersproject/providers" "5.7.2" + "@ethersproject/random" "5.7.0" + "@ethersproject/rlp" "5.7.0" + "@ethersproject/sha2" "5.7.0" + "@ethersproject/signing-key" "5.7.0" + "@ethersproject/solidity" "5.7.0" + "@ethersproject/strings" "5.7.0" + "@ethersproject/transactions" "5.7.0" + "@ethersproject/units" "5.7.0" + "@ethersproject/wallet" "5.7.0" + "@ethersproject/web" "5.7.1" + "@ethersproject/wordlists" "5.7.0" + +ethers@^5.7.0, ethers@^5.7.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -14448,6 +14497,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== + fast-fifo@^1.0.0: version "1.3.2" resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" @@ -21342,10 +21396,17 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA== -prettier@^2.6.2: - version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== pretty-bytes@^4.0.2: version "4.0.2" @@ -23838,8 +23899,7 @@ string-length@^5.0.1: char-regex "^2.0.0" strip-ansi "^7.0.1" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: - name string-width-cjs +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -23857,6 +23917,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^3.0.0, string-width@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" @@ -23947,7 +24016,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -23968,6 +24037,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -24246,6 +24322,14 @@ synchronous-promise@^2.0.15: resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.17.tgz#38901319632f946c982152586f2caf8ddc25c032" integrity sha512-AsS729u2RHUfEra9xJrE39peJcc2stq2+poBXX8bcM08Y6g9j/i/PUzwNQqkaJde7Ntg1TO7bSREbR5sdosQ+g== +synckit@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.1.tgz#febbfbb6649979450131f64735aa3f6c14575c88" + integrity sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A== + dependencies: + "@pkgr/core" "^0.1.0" + tslib "^2.6.2" + system-architecture@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/system-architecture/-/system-architecture-0.1.0.tgz#71012b3ac141427d97c67c56bc7921af6bff122d" @@ -24752,6 +24836,11 @@ tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3 resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== +tslib@^2.6.2: + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== + tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" @@ -26410,8 +26499,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: - name wrap-ansi-cjs +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -26438,6 +26526,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"