diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json index e0e988484..9cef5f2d9 100644 --- a/frontend/.eslintrc.json +++ b/frontend/.eslintrc.json @@ -25,7 +25,8 @@ "no-unused-vars": "warn", "prettier/prettier": ["error", { "endOfLine": "auto", - "semi": true + "semi": true, + "singleQuote": true }], "react/jsx-props-no-spreading": "off", "react/no-array-index-key": "off", diff --git a/frontend/abi/index.ts b/frontend/abi/index.ts index ef5553da9..3cbcab8b1 100644 --- a/frontend/abi/index.ts +++ b/frontend/abi/index.ts @@ -1 +1 @@ -export * from "./multicall3Abi"; +export * from './multicall3Abi'; diff --git a/frontend/abi/multicall3Abi.ts b/frontend/abi/multicall3Abi.ts index 798857f26..7efd88d46 100644 --- a/frontend/abi/multicall3Abi.ts +++ b/frontend/abi/multicall3Abi.ts @@ -4,437 +4,437 @@ export const multicall3Abi = [ { components: [ { - internalType: "address", - name: "target", - type: "address", + internalType: 'address', + name: 'target', + type: 'address', }, { - internalType: "bytes", - name: "callData", - type: "bytes", + internalType: 'bytes', + name: 'callData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Call[]", - name: "calls", - type: "tuple[]", + internalType: 'struct Multicall3.Call[]', + name: 'calls', + type: 'tuple[]', }, ], - name: "aggregate", + name: 'aggregate', outputs: [ { - internalType: "uint256", - name: "blockNumber", - type: "uint256", + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', }, { - internalType: "bytes[]", - name: "returnData", - type: "bytes[]", + internalType: 'bytes[]', + name: 'returnData', + type: 'bytes[]', }, ], - stateMutability: "payable", - type: "function", + stateMutability: 'payable', + type: 'function', }, { inputs: [ { components: [ { - internalType: "address", - name: "target", - type: "address", + internalType: 'address', + name: 'target', + type: 'address', }, { - internalType: "bool", - name: "allowFailure", - type: "bool", + internalType: 'bool', + name: 'allowFailure', + type: 'bool', }, { - internalType: "bytes", - name: "callData", - type: "bytes", + internalType: 'bytes', + name: 'callData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Call3[]", - name: "calls", - type: "tuple[]", + internalType: 'struct Multicall3.Call3[]', + name: 'calls', + type: 'tuple[]', }, ], - name: "aggregate3", + name: 'aggregate3', outputs: [ { components: [ { - internalType: "bool", - name: "success", - type: "bool", + internalType: 'bool', + name: 'success', + type: 'bool', }, { - internalType: "bytes", - name: "returnData", - type: "bytes", + internalType: 'bytes', + name: 'returnData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Result[]", - name: "returnData", - type: "tuple[]", + internalType: 'struct Multicall3.Result[]', + name: 'returnData', + type: 'tuple[]', }, ], - stateMutability: "payable", - type: "function", + stateMutability: 'payable', + type: 'function', }, { inputs: [ { components: [ { - internalType: "address", - name: "target", - type: "address", + internalType: 'address', + name: 'target', + type: 'address', }, { - internalType: "bool", - name: "allowFailure", - type: "bool", + internalType: 'bool', + name: 'allowFailure', + type: 'bool', }, { - internalType: "uint256", - name: "value", - type: "uint256", + internalType: 'uint256', + name: 'value', + type: 'uint256', }, { - internalType: "bytes", - name: "callData", - type: "bytes", + internalType: 'bytes', + name: 'callData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Call3Value[]", - name: "calls", - type: "tuple[]", + internalType: 'struct Multicall3.Call3Value[]', + name: 'calls', + type: 'tuple[]', }, ], - name: "aggregate3Value", + name: 'aggregate3Value', outputs: [ { components: [ { - internalType: "bool", - name: "success", - type: "bool", + internalType: 'bool', + name: 'success', + type: 'bool', }, { - internalType: "bytes", - name: "returnData", - type: "bytes", + internalType: 'bytes', + name: 'returnData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Result[]", - name: "returnData", - type: "tuple[]", + internalType: 'struct Multicall3.Result[]', + name: 'returnData', + type: 'tuple[]', }, ], - stateMutability: "payable", - type: "function", + stateMutability: 'payable', + type: 'function', }, { inputs: [ { components: [ { - internalType: "address", - name: "target", - type: "address", + internalType: 'address', + name: 'target', + type: 'address', }, { - internalType: "bytes", - name: "callData", - type: "bytes", + internalType: 'bytes', + name: 'callData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Call[]", - name: "calls", - type: "tuple[]", + internalType: 'struct Multicall3.Call[]', + name: 'calls', + type: 'tuple[]', }, ], - name: "blockAndAggregate", + name: 'blockAndAggregate', outputs: [ { - internalType: "uint256", - name: "blockNumber", - type: "uint256", + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', }, { - internalType: "bytes32", - name: "blockHash", - type: "bytes32", + internalType: 'bytes32', + name: 'blockHash', + type: 'bytes32', }, { components: [ { - internalType: "bool", - name: "success", - type: "bool", + internalType: 'bool', + name: 'success', + type: 'bool', }, { - internalType: "bytes", - name: "returnData", - type: "bytes", + internalType: 'bytes', + name: 'returnData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Result[]", - name: "returnData", - type: "tuple[]", + internalType: 'struct Multicall3.Result[]', + name: 'returnData', + type: 'tuple[]', }, ], - stateMutability: "payable", - type: "function", + stateMutability: 'payable', + type: 'function', }, { inputs: [], - name: "getBasefee", + name: 'getBasefee', outputs: [ { - internalType: "uint256", - name: "basefee", - type: "uint256", + internalType: 'uint256', + name: 'basefee', + type: 'uint256', }, ], - stateMutability: "view", - type: "function", + stateMutability: 'view', + type: 'function', }, { inputs: [ { - internalType: "uint256", - name: "blockNumber", - type: "uint256", + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', }, ], - name: "getBlockHash", + name: 'getBlockHash', outputs: [ { - internalType: "bytes32", - name: "blockHash", - type: "bytes32", + internalType: 'bytes32', + name: 'blockHash', + type: 'bytes32', }, ], - stateMutability: "view", - type: "function", + stateMutability: 'view', + type: 'function', }, { inputs: [], - name: "getBlockNumber", + name: 'getBlockNumber', outputs: [ { - internalType: "uint256", - name: "blockNumber", - type: "uint256", + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', }, ], - stateMutability: "view", - type: "function", + stateMutability: 'view', + type: 'function', }, { inputs: [], - name: "getChainId", + name: 'getChainId', outputs: [ { - internalType: "uint256", - name: "chainid", - type: "uint256", + internalType: 'uint256', + name: 'chainid', + type: 'uint256', }, ], - stateMutability: "view", - type: "function", + stateMutability: 'view', + type: 'function', }, { inputs: [], - name: "getCurrentBlockCoinbase", + name: 'getCurrentBlockCoinbase', outputs: [ { - internalType: "address", - name: "coinbase", - type: "address", + internalType: 'address', + name: 'coinbase', + type: 'address', }, ], - stateMutability: "view", - type: "function", + stateMutability: 'view', + type: 'function', }, { inputs: [], - name: "getCurrentBlockDifficulty", + name: 'getCurrentBlockDifficulty', outputs: [ { - internalType: "uint256", - name: "difficulty", - type: "uint256", + internalType: 'uint256', + name: 'difficulty', + type: 'uint256', }, ], - stateMutability: "view", - type: "function", + stateMutability: 'view', + type: 'function', }, { inputs: [], - name: "getCurrentBlockGasLimit", + name: 'getCurrentBlockGasLimit', outputs: [ { - internalType: "uint256", - name: "gaslimit", - type: "uint256", + internalType: 'uint256', + name: 'gaslimit', + type: 'uint256', }, ], - stateMutability: "view", - type: "function", + stateMutability: 'view', + type: 'function', }, { inputs: [], - name: "getCurrentBlockTimestamp", + name: 'getCurrentBlockTimestamp', outputs: [ { - internalType: "uint256", - name: "timestamp", - type: "uint256", + internalType: 'uint256', + name: 'timestamp', + type: 'uint256', }, ], - stateMutability: "view", - type: "function", + stateMutability: 'view', + type: 'function', }, { inputs: [ { - internalType: "address", - name: "addr", - type: "address", + internalType: 'address', + name: 'addr', + type: 'address', }, ], - name: "getEthBalance", + name: 'getEthBalance', outputs: [ { - internalType: "uint256", - name: "balance", - type: "uint256", + internalType: 'uint256', + name: 'balance', + type: 'uint256', }, ], - stateMutability: "view", - type: "function", + stateMutability: 'view', + type: 'function', }, { inputs: [], - name: "getLastBlockHash", + name: 'getLastBlockHash', outputs: [ { - internalType: "bytes32", - name: "blockHash", - type: "bytes32", + internalType: 'bytes32', + name: 'blockHash', + type: 'bytes32', }, ], - stateMutability: "view", - type: "function", + stateMutability: 'view', + type: 'function', }, { inputs: [ { - internalType: "bool", - name: "requireSuccess", - type: "bool", + internalType: 'bool', + name: 'requireSuccess', + type: 'bool', }, { components: [ { - internalType: "address", - name: "target", - type: "address", + internalType: 'address', + name: 'target', + type: 'address', }, { - internalType: "bytes", - name: "callData", - type: "bytes", + internalType: 'bytes', + name: 'callData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Call[]", - name: "calls", - type: "tuple[]", + internalType: 'struct Multicall3.Call[]', + name: 'calls', + type: 'tuple[]', }, ], - name: "tryAggregate", + name: 'tryAggregate', outputs: [ { components: [ { - internalType: "bool", - name: "success", - type: "bool", + internalType: 'bool', + name: 'success', + type: 'bool', }, { - internalType: "bytes", - name: "returnData", - type: "bytes", + internalType: 'bytes', + name: 'returnData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Result[]", - name: "returnData", - type: "tuple[]", + internalType: 'struct Multicall3.Result[]', + name: 'returnData', + type: 'tuple[]', }, ], - stateMutability: "payable", - type: "function", + stateMutability: 'payable', + type: 'function', }, { inputs: [ { - internalType: "bool", - name: "requireSuccess", - type: "bool", + internalType: 'bool', + name: 'requireSuccess', + type: 'bool', }, { components: [ { - internalType: "address", - name: "target", - type: "address", + internalType: 'address', + name: 'target', + type: 'address', }, { - internalType: "bytes", - name: "callData", - type: "bytes", + internalType: 'bytes', + name: 'callData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Call[]", - name: "calls", - type: "tuple[]", + internalType: 'struct Multicall3.Call[]', + name: 'calls', + type: 'tuple[]', }, ], - name: "tryBlockAndAggregate", + name: 'tryBlockAndAggregate', outputs: [ { - internalType: "uint256", - name: "blockNumber", - type: "uint256", + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', }, { - internalType: "bytes32", - name: "blockHash", - type: "bytes32", + internalType: 'bytes32', + name: 'blockHash', + type: 'bytes32', }, { components: [ { - internalType: "bool", - name: "success", - type: "bool", + internalType: 'bool', + name: 'success', + type: 'bool', }, { - internalType: "bytes", - name: "returnData", - type: "bytes", + internalType: 'bytes', + name: 'returnData', + type: 'bytes', }, ], - internalType: "struct Multicall3.Result[]", - name: "returnData", - type: "tuple[]", + internalType: 'struct Multicall3.Result[]', + name: 'returnData', + type: 'tuple[]', }, ], - stateMutability: "payable", - type: "function", + stateMutability: 'payable', + type: 'function', }, ]; diff --git a/frontend/client/index.ts b/frontend/client/index.ts index 13e1105d6..968a28671 100644 --- a/frontend/client/index.ts +++ b/frontend/client/index.ts @@ -1,2 +1,2 @@ -export * from "./enums"; -export * from "./types"; +export * from './enums'; +export * from './types'; diff --git a/frontend/client/types.ts b/frontend/client/types.ts index cca2f83e4..a114ae5cc 100644 --- a/frontend/client/types.ts +++ b/frontend/client/types.ts @@ -1,4 +1,4 @@ -import { Ledger, Chain, DeploymentStatus } from "./enums"; +import { Ledger, Chain, DeploymentStatus } from './enums'; export type ServiceHash = string; diff --git a/frontend/components/Layout/Layout.tsx b/frontend/components/Layout/Layout.tsx index e690c1201..36dfd63cf 100644 --- a/frontend/components/Layout/Layout.tsx +++ b/frontend/components/Layout/Layout.tsx @@ -1,6 +1,6 @@ -import { PropsWithChildren } from "react"; -import { Navbar } from "./Navbar/Navbar"; -import { Flex } from "antd"; +import { PropsWithChildren } from 'react'; +import { Navbar } from './Navbar/Navbar'; +import { Flex } from 'antd'; export const Layout = ({ children }: PropsWithChildren) => { return ( diff --git a/frontend/components/Layout/Navbar/Navbar.tsx b/frontend/components/Layout/Navbar/Navbar.tsx index a6d8f8115..e39f5e8ac 100644 --- a/frontend/components/Layout/Navbar/Navbar.tsx +++ b/frontend/components/Layout/Navbar/Navbar.tsx @@ -1,12 +1,12 @@ -import { Flex } from "antd"; -import { SettingsButton } from "./SettingsButton/SettingsButton"; -import { NotificationButton } from "./NotificationButton/NotificationButton"; -import Image from "next/image"; +import { Flex } from 'antd'; +import { SettingsButton } from './SettingsButton/SettingsButton'; +import { NotificationButton } from './NotificationButton/NotificationButton'; +import Image from 'next/image'; export const Navbar = () => { return ( - - + + diff --git a/frontend/components/Layout/Navbar/NotificationButton/NotificationButton.tsx b/frontend/components/Layout/Navbar/NotificationButton/NotificationButton.tsx index 1702717e2..14286d876 100644 --- a/frontend/components/Layout/Navbar/NotificationButton/NotificationButton.tsx +++ b/frontend/components/Layout/Navbar/NotificationButton/NotificationButton.tsx @@ -1,7 +1,7 @@ -import { BellOutlined } from "@ant-design/icons"; -import { MenuProps, Dropdown, Button } from "antd"; +import { BellOutlined } from '@ant-design/icons'; +import { MenuProps, Dropdown, Button } from 'antd'; -const items: MenuProps["items"] = []; +const items: MenuProps['items'] = []; type NotificationButtonProps = { disabled?: boolean; diff --git a/frontend/components/Layout/Navbar/SettingsButton/SettingsButton.tsx b/frontend/components/Layout/Navbar/SettingsButton/SettingsButton.tsx index 539825c8e..ad94d0792 100644 --- a/frontend/components/Layout/Navbar/SettingsButton/SettingsButton.tsx +++ b/frontend/components/Layout/Navbar/SettingsButton/SettingsButton.tsx @@ -1,9 +1,9 @@ -import { SettingOutlined } from "@ant-design/icons"; -import { Button, Dropdown, MenuProps } from "antd"; -import { useMemo } from "react"; +import { SettingOutlined } from '@ant-design/icons'; +import { Button, Dropdown, MenuProps } from 'antd'; +import { useMemo } from 'react'; export const SettingsButton = ({ disabled }: { disabled: boolean }) => { - const items: MenuProps["items"] = useMemo(() => [], []); + const items: MenuProps['items'] = useMemo(() => [], []); return ( diff --git a/frontend/components/Marketplace/Marketplace.tsx b/frontend/components/Marketplace/Marketplace.tsx index b1e17d56d..253cf45b2 100644 --- a/frontend/components/Marketplace/Marketplace.tsx +++ b/frontend/components/Marketplace/Marketplace.tsx @@ -1,7 +1,7 @@ -import { Flex } from "antd"; -import { MarketplaceItemCard } from "./MarketplaceItemCard/MarketplaceItemCard"; -import { useMemo } from "react"; -import { useMarketplace } from "@/hooks"; +import { Flex } from 'antd'; +import { MarketplaceItemCard } from './MarketplaceItemCard/MarketplaceItemCard'; +import { useMemo } from 'react'; +import { useMarketplace } from '@/hooks'; export const Marketplace = () => { const { getServiceTemplates } = useMarketplace(); diff --git a/frontend/components/Marketplace/MarketplaceItemCard/MarketplaceItemCard.tsx b/frontend/components/Marketplace/MarketplaceItemCard/MarketplaceItemCard.tsx index 72a096789..b601e3d42 100644 --- a/frontend/components/Marketplace/MarketplaceItemCard/MarketplaceItemCard.tsx +++ b/frontend/components/Marketplace/MarketplaceItemCard/MarketplaceItemCard.tsx @@ -1,8 +1,8 @@ -import { ServiceTemplate } from "@/client"; -import { useServices } from "@/hooks"; -import { Button, Typography, Flex, Card } from "antd"; -import Image from "next/image"; -import { useMemo } from "react"; +import { ServiceTemplate } from '@/client'; +import { useServices } from '@/hooks'; +import { Button, Typography, Flex, Card } from 'antd'; +import Image from 'next/image'; +import { useMemo } from 'react'; export const MarketplaceItemCard = ({ serviceTemplate, @@ -38,10 +38,10 @@ export const MarketplaceItemCard = ({ Image - + {name} {description} - {button} + {button} diff --git a/frontend/components/Modals/QRModal/QRModal.tsx b/frontend/components/Modals/QRModal/QRModal.tsx index 94cf846a7..88ac329ca 100644 --- a/frontend/components/Modals/QRModal/QRModal.tsx +++ b/frontend/components/Modals/QRModal/QRModal.tsx @@ -1,8 +1,8 @@ -import { useModals } from "@/hooks"; -import { QRModalData } from "@/types"; -import { Flex, Modal, QRCode, Typography } from "antd"; -import { ethers } from "ethers"; -import { useMemo } from "react"; +import { useModals } from '@/hooks'; +import { QRModalData } from '@/types'; +import { Flex, Modal, QRCode, Typography } from 'antd'; +import { ethers } from 'ethers'; +import { useMemo } from 'react'; export const QRModal = ({ data: { amount, chainId, address, open, isERC20 }, @@ -26,7 +26,7 @@ export const QRModal = ({ }, [amount]); const metamaskAddress: string | undefined = useMemo(() => { - if (!address || !chainId || !parsedAmount) return ""; + if (!address || !chainId || !parsedAmount) return ''; if (isERC20) { return `https://metamask.app.link/send/token/${address}@${chainId}?value=${parsedAmount}`; } @@ -47,7 +47,7 @@ export const QRModal = ({ > - This QR code is currently only supported by{" "} + This QR code is currently only supported by{' '} Metamask Mobile. diff --git a/frontend/components/Modals/index.ts b/frontend/components/Modals/index.ts index 1e93b64ab..6e68fbf55 100644 --- a/frontend/components/Modals/index.ts +++ b/frontend/components/Modals/index.ts @@ -1 +1 @@ -export * from "./QRModal/QRModal"; +export * from './QRModal/QRModal'; diff --git a/frontend/components/Spawn/Funding/FundRequirement/FundRequirement.tsx b/frontend/components/Spawn/Funding/FundRequirement/FundRequirement.tsx index 09ce955a5..412c42642 100644 --- a/frontend/components/Spawn/Funding/FundRequirement/FundRequirement.tsx +++ b/frontend/components/Spawn/Funding/FundRequirement/FundRequirement.tsx @@ -1,14 +1,14 @@ -import { copyToClipboard } from "@/helpers/copyToClipboard"; -import { useModals, useServices } from "@/hooks"; -import { Button, Flex, Typography, message } from "antd"; +import { copyToClipboard } from '@/helpers/copyToClipboard'; +import { useModals, useServices } from '@/hooks'; +import { Button, Flex, Typography, message } from 'antd'; import { Dispatch, SetStateAction, useCallback, useMemo, useState, -} from "react"; -import { useInterval } from "usehooks-ts"; +} from 'react'; +import { useInterval } from 'usehooks-ts'; /** * Should be called by FundRequirementERC20 or FundRequirementETH only @@ -56,10 +56,10 @@ export const FundRequirement = ({ (): Promise => copyToClipboard(address) .then(() => { - message.success("Copied to clipboard"); + message.success('Copied to clipboard'); }) .catch(() => { - message.error("Failed to copy to clipboard"); + message.error('Failed to copy to clipboard'); }), [address], ); diff --git a/frontend/components/Spawn/Funding/FundRequirement/FundRequirementERC20.tsx b/frontend/components/Spawn/Funding/FundRequirement/FundRequirementERC20.tsx index df327c900..2f062dd13 100644 --- a/frontend/components/Spawn/Funding/FundRequirement/FundRequirementERC20.tsx +++ b/frontend/components/Spawn/Funding/FundRequirement/FundRequirementERC20.tsx @@ -1,6 +1,6 @@ -import { useEthers } from "@/hooks"; -import { Dispatch, SetStateAction } from "react"; -import { FundRequirement } from "./FundRequirement"; +import { useEthers } from '@/hooks'; +import { Dispatch, SetStateAction } from 'react'; +import { FundRequirement } from './FundRequirement'; export const FundRequirementERC20 = (props: { serviceHash: string; diff --git a/frontend/components/Spawn/Funding/FundRequirement/FundRequirementETH.tsx b/frontend/components/Spawn/Funding/FundRequirement/FundRequirementETH.tsx index 0cf215460..05a5454e0 100644 --- a/frontend/components/Spawn/Funding/FundRequirement/FundRequirementETH.tsx +++ b/frontend/components/Spawn/Funding/FundRequirement/FundRequirementETH.tsx @@ -1,6 +1,6 @@ -import { useEthers } from "@/hooks"; -import { Dispatch, SetStateAction } from "react"; -import { FundRequirement } from "./FundRequirement"; +import { useEthers } from '@/hooks'; +import { Dispatch, SetStateAction } from 'react'; +import { FundRequirement } from './FundRequirement'; export const FundRequirementETH = (props: { serviceHash?: string; diff --git a/frontend/components/Spawn/Funding/Funding.tsx b/frontend/components/Spawn/Funding/Funding.tsx index 03930f6cc..d0e134496 100644 --- a/frontend/components/Spawn/Funding/Funding.tsx +++ b/frontend/components/Spawn/Funding/Funding.tsx @@ -1,8 +1,8 @@ -import { Service } from "@/client"; -import { SpawnScreenState } from "@/enums"; -import { useSpawn } from "@/hooks"; -import { TimelineItemProps, Flex, Typography, Timeline } from "antd"; -import { useState, useMemo, useEffect, SetStateAction, Dispatch } from "react"; +import { Service } from '@/client'; +import { SpawnScreenState } from '@/enums'; +import { useSpawn } from '@/hooks'; +import { TimelineItemProps, Flex, Typography, Timeline } from 'antd'; +import { useState, useMemo, useEffect, SetStateAction, Dispatch } from 'react'; export const Funding = ({ service, @@ -55,7 +55,7 @@ export const Funding = ({ contractAddress={contractAddress} /> ), - color: receivedFunds[address] ? "green" : "red", + color: receivedFunds[address] ? 'green' : 'red', })) as TimelineItemProps[], [ FundRequirementComponent, diff --git a/frontend/components/Spawn/SpawnAgentFunding/SpawnAgentFunding.tsx b/frontend/components/Spawn/SpawnAgentFunding/SpawnAgentFunding.tsx index bcd5e3193..87d69af9d 100644 --- a/frontend/components/Spawn/SpawnAgentFunding/SpawnAgentFunding.tsx +++ b/frontend/components/Spawn/SpawnAgentFunding/SpawnAgentFunding.tsx @@ -1,7 +1,7 @@ -import { Service } from "@/client"; -import { Funding } from "../Funding/Funding"; -import { SpawnScreenState } from "@/enums"; -import { FundRequirementETH } from "../Funding/FundRequirement/FundRequirementETH"; +import { Service } from '@/client'; +import { Funding } from '../Funding/Funding'; +import { SpawnScreenState } from '@/enums'; +import { FundRequirementETH } from '../Funding/FundRequirement/FundRequirementETH'; export const SpawnAgentFunding = (props: { service: Service; @@ -10,7 +10,7 @@ export const SpawnAgentFunding = (props: { }) => ( diff --git a/frontend/components/Spawn/SpawnDone/SpawnDone.tsx b/frontend/components/Spawn/SpawnDone/SpawnDone.tsx index 4855c871a..75559b4c5 100644 --- a/frontend/components/Spawn/SpawnDone/SpawnDone.tsx +++ b/frontend/components/Spawn/SpawnDone/SpawnDone.tsx @@ -1,6 +1,6 @@ -import { useServices, useSpawn, useTabs } from "@/hooks"; -import { Button, Flex, message } from "antd"; -import { useRouter } from "next/router"; +import { useServices, useSpawn, useTabs } from '@/hooks'; +import { Button, Flex, message } from 'antd'; +import { useRouter } from 'next/router'; export const SpawnDone = () => { const router = useRouter(); @@ -10,11 +10,11 @@ export const SpawnDone = () => { const { updateServicesState } = useServices(); const handleViewAgent = () => - router.push("/").then(() => { + router.push('/').then(() => { resetSpawn(); resetTabs(); updateServicesState().catch(() => - message.error("Failed to update services"), + message.error('Failed to update services'), ); }); diff --git a/frontend/components/Spawn/SpawnError/SpawnError.tsx b/frontend/components/Spawn/SpawnError/SpawnError.tsx index 2fbbaf625..dd2104f0d 100644 --- a/frontend/components/Spawn/SpawnError/SpawnError.tsx +++ b/frontend/components/Spawn/SpawnError/SpawnError.tsx @@ -1,12 +1,12 @@ -import { Button, Flex, Typography } from "antd"; -import { useRouter } from "next/router"; +import { Button, Flex, Typography } from 'antd'; +import { useRouter } from 'next/router'; export const SpawnError = ({ message }: { message: string }) => { const router = useRouter(); return ( {message} - diff --git a/frontend/components/Spawn/SpawnHeader/SpawnHeader.tsx b/frontend/components/Spawn/SpawnHeader/SpawnHeader.tsx index 4fde330a1..f0bf6bfdd 100644 --- a/frontend/components/Spawn/SpawnHeader/SpawnHeader.tsx +++ b/frontend/components/Spawn/SpawnHeader/SpawnHeader.tsx @@ -1,14 +1,14 @@ -import { useSpawn } from "@/hooks"; -import { mainTheme } from "@/theme"; -import { Flex, Progress, Typography } from "antd"; -import Image from "next/image"; -import { useMemo } from "react"; +import { useSpawn } from '@/hooks'; +import { mainTheme } from '@/theme'; +import { Flex, Progress, Typography } from 'antd'; +import Image from 'next/image'; +import { useMemo } from 'react'; export const SpawnHeader = () => { const { spawnPercentage } = useSpawn(); const title: string = useMemo( - () => (spawnPercentage === 100 ? "Agent Spawned" : "Spawning your Agent"), + () => (spawnPercentage === 100 ? 'Agent Spawned' : 'Spawning your Agent'), [spawnPercentage], ); @@ -20,7 +20,7 @@ export const SpawnHeader = () => { percent={spawnPercentage} strokeColor={mainTheme.token?.colorPrimary} showInfo={false} - style={{ width: "50%" }} + style={{ width: '50%' }} /> ); diff --git a/frontend/components/Spawn/SpawnRPC/SpawnRPC.tsx b/frontend/components/Spawn/SpawnRPC/SpawnRPC.tsx index 1eb1930ec..24f6e09cb 100644 --- a/frontend/components/Spawn/SpawnRPC/SpawnRPC.tsx +++ b/frontend/components/Spawn/SpawnRPC/SpawnRPC.tsx @@ -7,21 +7,21 @@ import { TimelineItemProps, Typography, message, -} from "antd"; -import { NODIES_URL } from "@/constants/urls"; +} from 'antd'; +import { NODIES_URL } from '@/constants/urls'; import { Dispatch, SetStateAction, useCallback, useMemo, useState, -} from "react"; -import { useSpawn, useEthers } from "@/hooks"; -import { SpawnScreenState } from "@/enums"; -import { CheckSquareTwoTone, WarningFilled } from "@ant-design/icons"; -import { Service, ServiceTemplate } from "@/client"; -import { InputStatus } from "antd/es/_util/statusUtils"; -import _ from "lodash"; +} from 'react'; +import { useSpawn, useEthers } from '@/hooks'; +import { SpawnScreenState } from '@/enums'; +import { CheckSquareTwoTone, WarningFilled } from '@ant-design/icons'; +import { Service, ServiceTemplate } from '@/client'; +import { InputStatus } from 'antd/es/_util/statusUtils'; +import _ from 'lodash'; enum RPCState { LOADING, @@ -52,7 +52,7 @@ export const SpawnRPC = ({ .readText() .then((text) => setRpc(text)) .catch(() => { - message.error("Failed to read clipboard"); + message.error('Failed to read clipboard'); }), [setRpc], ); @@ -69,7 +69,7 @@ export const SpawnRPC = ({ ) .catch(() => { setRpcState(RPCState.INVALID); - message.error("Failed to check RPC"); + message.error('Failed to check RPC'); }) .finally(() => setIsCheckingRpc(false)); }, 1000), @@ -87,7 +87,7 @@ export const SpawnRPC = ({ const handleContinue = useCallback(async () => { if (!rpc || rpcState !== RPCState.VALID) { - message.error("Invalid RPC"); + message.error('Invalid RPC'); return; } setSpawnScreenState(nextPage); @@ -101,13 +101,13 @@ export const SpawnRPC = ({ const inputStatus: InputStatus = useMemo(() => { switch (rpcState) { case RPCState.LOADING: - return ""; + return ''; case RPCState.VALID: - return ""; + return ''; case RPCState.INVALID: - return "error"; + return 'error'; default: - return ""; + return ''; } }, [rpcState]); @@ -166,7 +166,7 @@ export const SpawnRPC = ({ Paste endpoint { if (isCreating) { - message.error("Service creation already in progress"); + message.error('Service creation already in progress'); return; } setIsCreating(true); @@ -113,7 +113,7 @@ export const SpawnStakingCheck = ({ */ const preflightStakingCheck = useCallback((): Promise => { if (!publicKey) { - return Promise.reject("No public key found"); + return Promise.reject('No public key found'); } return getERC20Balance(publicKey, rpc, TOKENS.gnosis.OLAS) .then((olasBalance: number) => { @@ -129,7 +129,7 @@ export const SpawnStakingCheck = ({ return Promise.resolve(hasBalance); } catch (e) { - return Promise.reject("Failed to calculate if user has balance"); + return Promise.reject('Failed to calculate if user has balance'); } }) .catch((e) => { @@ -150,12 +150,12 @@ export const SpawnStakingCheck = ({ const hasCreated: boolean = await create(true) .then(() => { { - message.success("Service created successfully"); + message.success('Service created successfully'); return true; } }) .catch(() => { - message.error("Failed to create service"); + message.error('Failed to create service'); return false; }); if (canStake && hasCreated) { @@ -169,11 +169,11 @@ export const SpawnStakingCheck = ({ setButtonClicked(ButtonOptions.NO); const hasCreated: boolean = await create(false) .then(() => { - message.success("Service created successfully"); + message.success('Service created successfully'); return true; }) .catch(() => { - message.error("Failed to create service"); + message.error('Failed to create service'); return false; }); if (hasCreated) { diff --git a/frontend/components/Spawn/index.tsx b/frontend/components/Spawn/index.tsx index dc42b1592..7f6acfca5 100644 --- a/frontend/components/Spawn/index.tsx +++ b/frontend/components/Spawn/index.tsx @@ -1,7 +1,7 @@ -export * from "./Funding/Funding"; -export * from "./SpawnAgentFunding/SpawnAgentFunding"; -export * from "./SpawnDone/SpawnDone"; -export * from "./SpawnError/SpawnError"; -export * from "./SpawnHeader/SpawnHeader"; -export * from "./SpawnRPC/SpawnRPC"; -export * from "./SpawnStakingCheck/SpawnStakingCheck"; +export * from './Funding/Funding'; +export * from './SpawnAgentFunding/SpawnAgentFunding'; +export * from './SpawnDone/SpawnDone'; +export * from './SpawnError/SpawnError'; +export * from './SpawnHeader/SpawnHeader'; +export * from './SpawnRPC/SpawnRPC'; +export * from './SpawnStakingCheck/SpawnStakingCheck'; diff --git a/frontend/components/YourAgents/HasAgents/HasAgents.tsx b/frontend/components/YourAgents/HasAgents/HasAgents.tsx index 0828175c6..0a90beb49 100644 --- a/frontend/components/YourAgents/HasAgents/HasAgents.tsx +++ b/frontend/components/YourAgents/HasAgents/HasAgents.tsx @@ -1,6 +1,6 @@ -import { Service } from "@/client"; -import { Flex } from "antd"; -import { ServiceCard } from "../ServiceCard/ServiceCard"; +import { Service } from '@/client'; +import { Flex } from 'antd'; +import { ServiceCard } from '../ServiceCard/ServiceCard'; export const HasAgents = ({ services, diff --git a/frontend/components/YourAgents/NoAgents/NoAgents.tsx b/frontend/components/YourAgents/NoAgents/NoAgents.tsx index 9e9ad0c41..e1a79f220 100644 --- a/frontend/components/YourAgents/NoAgents/NoAgents.tsx +++ b/frontend/components/YourAgents/NoAgents/NoAgents.tsx @@ -1,6 +1,6 @@ -import { Tab } from "@/enums"; -import { useTabs } from "@/hooks"; -import { Flex, Typography, Button } from "antd"; +import { Tab } from '@/enums'; +import { useTabs } from '@/hooks'; +import { Flex, Typography, Button } from 'antd'; export const NoAgents = (): JSX.Element => { const { setActiveTab } = useTabs(); diff --git a/frontend/components/YourAgents/ServiceCard/ServiceCard.tsx b/frontend/components/YourAgents/ServiceCard/ServiceCard.tsx index 40cd45fdd..7b58ff078 100644 --- a/frontend/components/YourAgents/ServiceCard/ServiceCard.tsx +++ b/frontend/components/YourAgents/ServiceCard/ServiceCard.tsx @@ -3,14 +3,14 @@ import { DeploymentStatus, Service, ServiceTemplate, -} from "@/client"; -import { useMarketplace } from "@/hooks/useMarketplace"; -import { useServices } from "@/hooks/useServices"; -import { Card, Flex, Typography, Button, Badge, Spin, message } from "antd"; -import Image from "next/image"; -import { useCallback, useMemo, useState } from "react"; -import { useInterval } from "usehooks-ts"; -import { ServiceCardTotalBalance } from "./ServiceCardTotalBalance"; +} from '@/client'; +import { useMarketplace } from '@/hooks/useMarketplace'; +import { useServices } from '@/hooks/useServices'; +import { Card, Flex, Typography, Button, Badge, Spin, message } from 'antd'; +import Image from 'next/image'; +import { useCallback, useMemo, useState } from 'react'; +import { useInterval } from 'usehooks-ts'; +import { ServiceCardTotalBalance } from './ServiceCardTotalBalance'; type ServiceCardProps = { service: Service; @@ -42,7 +42,7 @@ export const ServiceCard = ({ service }: ServiceCardProps) => { .then((r: Deployment) => setServiceStatus(r.status)) .catch(() => { setServiceStatus(undefined); - message.error("Failed to update service status"); + message.error('Failed to update service status'); }), [getServiceStatus, service.hash], ); @@ -54,17 +54,17 @@ export const ServiceCard = ({ service }: ServiceCardProps) => { setIsStarting(true); deployService(service.hash) .then(async () => { - message.success("Service started successfully"); + message.success('Service started successfully'); updateServicesState().catch(() => - message.error("Failed to update services"), + message.error('Failed to update services'), ); }) .catch(() => { - message.error("Failed to start service"); + message.error('Failed to start service'); }) .finally(() => { updateServiceStatus() - .catch(() => message.error("Failed to update service status")) + .catch(() => message.error('Failed to update service status')) .finally(() => setIsStarting(false)); }); }, [ @@ -81,15 +81,15 @@ export const ServiceCard = ({ service }: ServiceCardProps) => { stopService(service.hash) .then(() => { updateServicesState().catch(() => - message.error("Failed to update services"), + message.error('Failed to update services'), ); }) .catch(() => { - message.error("Failed to stop service"); + message.error('Failed to stop service'); }) .finally(() => { updateServiceStatus() - .catch(() => message.error("Failed to update service status")) + .catch(() => message.error('Failed to update service status')) .finally(() => setIsStopping(false)); }); }, [ @@ -106,10 +106,10 @@ export const ServiceCard = ({ service }: ServiceCardProps) => { deleteServices([service.hash]) .then(async () => { updateServicesState().catch(() => - message.error("Failed to update services"), + message.error('Failed to update services'), ); }) - .catch(() => message.error("Failed to delete service")) + .catch(() => message.error('Failed to delete service')) .finally(() => { updateServiceStatus().finally(() => setIsDeleting(false)); }); @@ -220,7 +220,7 @@ export const ServiceCard = ({ service }: ServiceCardProps) => { {serviceTemplate!.name} {serviceTemplate!.description} - + STATUS {serviceStatusBadge} @@ -232,7 +232,7 @@ export const ServiceCard = ({ service }: ServiceCardProps) => { */} - {buttons} + {buttons} diff --git a/frontend/components/YourAgents/ServiceCard/ServiceCardTotalBalance.tsx b/frontend/components/YourAgents/ServiceCard/ServiceCardTotalBalance.tsx index a2e7628a1..f18de6be2 100644 --- a/frontend/components/YourAgents/ServiceCard/ServiceCardTotalBalance.tsx +++ b/frontend/components/YourAgents/ServiceCard/ServiceCardTotalBalance.tsx @@ -1,8 +1,8 @@ -import { Service } from "@/client"; -import { useMulticall } from "@/hooks"; -import { Flex, Typography, message } from "antd"; -import { useMemo, useState } from "react"; -import { useInterval } from "usehooks-ts"; +import { Service } from '@/client'; +import { useMulticall } from '@/hooks'; +import { Flex, Typography, message } from 'antd'; +import { useMemo, useState } from 'react'; +import { useInterval } from 'usehooks-ts'; const BALANCE_POLLING_INTERVAL = 5000; diff --git a/frontend/components/YourAgents/YourAgents.tsx b/frontend/components/YourAgents/YourAgents.tsx index 69a9e96bd..0e3e892b2 100644 --- a/frontend/components/YourAgents/YourAgents.tsx +++ b/frontend/components/YourAgents/YourAgents.tsx @@ -1,15 +1,15 @@ -import { useServices } from "@/hooks/useServices"; -import { Service } from "@/client"; -import { useMemo } from "react"; -import dynamic from "next/dynamic"; +import { useServices } from '@/hooks/useServices'; +import { Service } from '@/client'; +import { useMemo } from 'react'; +import dynamic from 'next/dynamic'; const HasAgents = dynamic( - () => import("./HasAgents/HasAgents").then((mod) => mod.HasAgents), + () => import('./HasAgents/HasAgents').then((mod) => mod.HasAgents), { ssr: false }, ); const NoAgents = dynamic( - () => import("./NoAgents/NoAgents").then((mod) => mod.NoAgents), + () => import('./NoAgents/NoAgents').then((mod) => mod.NoAgents), { ssr: false }, ); diff --git a/frontend/components/YourAgents/index.ts b/frontend/components/YourAgents/index.ts index 2d7d57c31..b44237837 100644 --- a/frontend/components/YourAgents/index.ts +++ b/frontend/components/YourAgents/index.ts @@ -1,4 +1,4 @@ -export * from "./YourAgents"; -export * from "./HasAgents/HasAgents"; -export * from "./NoAgents/NoAgents"; -export * from "./ServiceCard/ServiceCard"; +export * from './YourAgents'; +export * from './HasAgents/HasAgents'; +export * from './NoAgents/NoAgents'; +export * from './ServiceCard/ServiceCard'; diff --git a/frontend/constants/chains.ts b/frontend/constants/chains.ts index 22190abfe..aeaf7b325 100644 --- a/frontend/constants/chains.ts +++ b/frontend/constants/chains.ts @@ -1,3 +1,3 @@ export const CHAINS = { - gnosis: { currency: "XDAI", chainId: 100 }, + gnosis: { currency: 'XDAI', chainId: 100 }, }; diff --git a/frontend/constants/contracts.ts b/frontend/constants/contracts.ts index e7749cd7b..4b2b572df 100644 --- a/frontend/constants/contracts.ts +++ b/frontend/constants/contracts.ts @@ -1,2 +1,2 @@ export const MULTICALL_CONTRACT: string = - "0xcA11bde05977b3631167028862bE2a173976CA11"; // https://github.com/mds1/multicall, https://www.multicall3.com/ + '0xcA11bde05977b3631167028862bE2a173976CA11'; // https://github.com/mds1/multicall, https://www.multicall3.com/ diff --git a/frontend/constants/index.ts b/frontend/constants/index.ts index 6010e93de..7cd14c438 100644 --- a/frontend/constants/index.ts +++ b/frontend/constants/index.ts @@ -1,5 +1,5 @@ -export * from "./chains"; -export * from "./contracts"; -export * from "./serviceTemplates"; -export * from "./tokens"; -export * from "./urls"; +export * from './chains'; +export * from './contracts'; +export * from './serviceTemplates'; +export * from './tokens'; +export * from './urls'; diff --git a/frontend/constants/serviceTemplates.ts b/frontend/constants/serviceTemplates.ts index 4a0c84f31..46fdab7b0 100644 --- a/frontend/constants/serviceTemplates.ts +++ b/frontend/constants/serviceTemplates.ts @@ -1,14 +1,14 @@ -import { ServiceTemplate } from "@/client"; +import { ServiceTemplate } from '@/client'; export const serviceTemplates: ServiceTemplate[] = [ { - name: "Trader Agent", - hash: "bafybeieagxzdbmea3nttlve3yxjne5z7tt7mp26tfpgepm7p2ezovtdx4a", - description: "Trader agent for omen prediction markets", + name: 'Trader Agent', + hash: 'bafybeieagxzdbmea3nttlve3yxjne5z7tt7mp26tfpgepm7p2ezovtdx4a', + description: 'Trader agent for omen prediction markets', image: - "https://operate.olas.network/_next/image?url=%2Fimages%2Fprediction-agent.png&w=3840&q=75", + 'https://operate.olas.network/_next/image?url=%2Fimages%2Fprediction-agent.png&w=3840&q=75', configuration: { - nft: "bafybeig64atqaladigoc3ds4arltdu63wkdrk3gesjfvnfdmz35amv7faq", + nft: 'bafybeig64atqaladigoc3ds4arltdu63wkdrk3gesjfvnfdmz35amv7faq', agent_id: 14, threshold: 1, use_staking: false, diff --git a/frontend/constants/tokens.ts b/frontend/constants/tokens.ts index aaec5707a..140047275 100644 --- a/frontend/constants/tokens.ts +++ b/frontend/constants/tokens.ts @@ -1,5 +1,5 @@ export const TOKENS = { gnosis: { - OLAS: "0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f", + OLAS: '0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f', }, }; diff --git a/frontend/constants/urls.ts b/frontend/constants/urls.ts index 477a7fde7..7ebebee01 100644 --- a/frontend/constants/urls.ts +++ b/frontend/constants/urls.ts @@ -1,2 +1,2 @@ -export const NODIES_URL: string = "https://nodies.app"; +export const NODIES_URL: string = 'https://nodies.app'; export const BACKEND_URL: string = `http://localhost:${process.env.NEXT_PUBLIC_BACKEND_PORT || 8000}/api`; diff --git a/frontend/context/ModalsProvider/ModalsProvider.test.tsx b/frontend/context/ModalsProvider/ModalsProvider.test.tsx index 1b4cc1798..28404e34a 100644 --- a/frontend/context/ModalsProvider/ModalsProvider.test.tsx +++ b/frontend/context/ModalsProvider/ModalsProvider.test.tsx @@ -1,9 +1,9 @@ -import React, { useContext } from "react"; -import { render, fireEvent } from "@testing-library/react"; -import { ModalsContext, ModalsProvider } from "./ModalsProvider"; +import React, { useContext } from 'react'; +import { render, fireEvent } from '@testing-library/react'; +import { ModalsContext, ModalsProvider } from './ModalsProvider'; -describe("ModalsProvider", () => { - it("renders children properly", () => { +describe('ModalsProvider', () => { + it('renders children properly', () => { const ChildComponent = () => { const { qrModalData } = useContext(ModalsContext); return
{qrModalData.open.toString()}
; @@ -15,10 +15,10 @@ describe("ModalsProvider", () => { , ); - expect(getByTestId("child").textContent).toBe("false"); + expect(getByTestId('child').textContent).toBe('false'); }); - it("correctly sets qrModalOpen value", () => { + it('correctly sets qrModalOpen value', () => { const ChildComponent = () => { const { qrModalData, setQrModalData } = useContext(ModalsContext); return ( @@ -28,7 +28,7 @@ describe("ModalsProvider", () => { setQrModalData((prev) => ({ ...prev, open: !prev.open })) } > - {qrModalData.open ? "open" : "closed"} + {qrModalData.open ? 'open' : 'closed'} ); }; @@ -39,21 +39,21 @@ describe("ModalsProvider", () => { , ); - const toggleButton = getByTestId("toggle"); + const toggleButton = getByTestId('toggle'); // Initially, qrModalOpen should be false - expect(toggleButton.textContent).toBe("closed"); + expect(toggleButton.textContent).toBe('closed'); // Click the button to toggle qrModalOpen fireEvent.click(toggleButton); // Now, qrModalOpen should be true - expect(toggleButton.textContent).toBe("open"); + expect(toggleButton.textContent).toBe('open'); // Click the button again to toggle qrModalOpen back to false fireEvent.click(toggleButton); // Now, qrModalOpen should be false again - expect(toggleButton.textContent).toBe("closed"); + expect(toggleButton.textContent).toBe('closed'); }); }); diff --git a/frontend/context/SpawnProvider/SpawnProvider.test.tsx b/frontend/context/SpawnProvider/SpawnProvider.test.tsx index 4b197a4dc..7a7eae53c 100644 --- a/frontend/context/SpawnProvider/SpawnProvider.test.tsx +++ b/frontend/context/SpawnProvider/SpawnProvider.test.tsx @@ -1,24 +1,24 @@ -import React from "react"; -import { render, fireEvent } from "@testing-library/react"; +import React from 'react'; +import { render, fireEvent } from '@testing-library/react'; import { FIRST_SPAWN_SCREEN_STATE, SpawnContext, SpawnProvider, -} from "./SpawnProvider"; -import { SpawnScreenState } from "@/enums"; -import "@testing-library/jest-dom"; +} from './SpawnProvider'; +import { SpawnScreenState } from '@/enums'; +import '@testing-library/jest-dom'; -describe("SpawnProvider", () => { - it("renders children correctly", () => { +describe('SpawnProvider', () => { + it('renders children correctly', () => { const { getByTestId } = render(
Child Component
, ); - expect(getByTestId("child")).toBeInTheDocument(); // Using toBeInTheDocument matcher + expect(getByTestId('child')).toBeInTheDocument(); }); - it("provides default context values", () => { + it('provides default context values', () => { const { getByTestId } = render( {(context) => ( @@ -26,12 +26,12 @@ describe("SpawnProvider", () => { )} , ); - expect(getByTestId("context-value")).toHaveTextContent( + expect(getByTestId('context-value')).toHaveTextContent( FIRST_SPAWN_SCREEN_STATE, ); // Using toHaveTextContent matcher }); - it("updates spawn state when setSpawnState is called", () => { + it('updates spawn state when setSpawnState is called', () => { const { getByTestId } = render( @@ -53,14 +53,14 @@ describe("SpawnProvider", () => { ); // Before clicking the button, context-value should have the initial value - expect(getByTestId("context-value")).toHaveTextContent( + expect(getByTestId('context-value')).toHaveTextContent( FIRST_SPAWN_SCREEN_STATE, ); - fireEvent.click(getByTestId("button")); + fireEvent.click(getByTestId('button')); // After clicking the button, context-value should have the updated value - expect(getByTestId("context-value")).toHaveTextContent( + expect(getByTestId('context-value')).toHaveTextContent( SpawnScreenState.RPC, ); }); diff --git a/frontend/context/SpawnProvider/SpawnProvider.tsx b/frontend/context/SpawnProvider/SpawnProvider.tsx index be16a31c7..3a1f5f21c 100644 --- a/frontend/context/SpawnProvider/SpawnProvider.tsx +++ b/frontend/context/SpawnProvider/SpawnProvider.tsx @@ -1,11 +1,11 @@ -import { SpawnScreenState } from "@/enums"; +import { SpawnScreenState } from '@/enums'; import { Dispatch, PropsWithChildren, SetStateAction, createContext, useState, -} from "react"; +} from 'react'; type SpawnContextType = { spawnScreenState: SpawnScreenState; diff --git a/frontend/context/TabsProvider/TabsProvider.test.tsx b/frontend/context/TabsProvider/TabsProvider.test.tsx index e5985e2f2..30dfcef27 100644 --- a/frontend/context/TabsProvider/TabsProvider.test.tsx +++ b/frontend/context/TabsProvider/TabsProvider.test.tsx @@ -1,11 +1,11 @@ -import React from "react"; -import { render, fireEvent } from "@testing-library/react"; -import { TabsContext, TabsProvider } from "./TabsProvider"; -import { Tab } from "@/enums"; -import "@testing-library/jest-dom"; +import React from 'react'; +import { render, fireEvent } from '@testing-library/react'; +import { TabsContext, TabsProvider } from './TabsProvider'; +import { Tab } from '@/enums'; +import '@testing-library/jest-dom'; -describe("TabsProvider", () => { - it("sets the active tab correctly", () => { +describe('TabsProvider', () => { + it('sets the active tab correctly', () => { const { getByTestId } = render( @@ -22,12 +22,12 @@ describe("TabsProvider", () => { ); // Assert that the initial active tab is Tab.YOUR_AGENTS - expect(getByTestId("active-tab")).toHaveTextContent(Tab.YOUR_AGENTS); + expect(getByTestId('active-tab')).toHaveTextContent(Tab.YOUR_AGENTS); // Trigger the onClick event to change the active tab - fireEvent.click(getByTestId("active-tab")); + fireEvent.click(getByTestId('active-tab')); // Assert that the active tab has been updated - expect(getByTestId("active-tab")).toHaveTextContent(Tab.MARKETPLACE); + expect(getByTestId('active-tab')).toHaveTextContent(Tab.MARKETPLACE); }); }); diff --git a/frontend/context/TabsProvider/TabsProvider.tsx b/frontend/context/TabsProvider/TabsProvider.tsx index fa01824ca..66c1d5ce6 100644 --- a/frontend/context/TabsProvider/TabsProvider.tsx +++ b/frontend/context/TabsProvider/TabsProvider.tsx @@ -1,11 +1,11 @@ -import { Tab } from "@/enums"; +import { Tab } from '@/enums'; import { Dispatch, PropsWithChildren, SetStateAction, createContext, useState, -} from "react"; +} from 'react'; export const TabsContext = createContext<{ activeTab: string; diff --git a/frontend/enums/SpawnState.ts b/frontend/enums/SpawnState.ts index 23563e0e0..a8454f8d0 100644 --- a/frontend/enums/SpawnState.ts +++ b/frontend/enums/SpawnState.ts @@ -1,6 +1,6 @@ export enum SpawnScreenState { - STAKING_CHECK = "staking-check", - RPC = "rpc", - AGENT_FUNDING = "agent-funding", - DONE = "done", + STAKING_CHECK = 'staking-check', + RPC = 'rpc', + AGENT_FUNDING = 'agent-funding', + DONE = 'done', } diff --git a/frontend/enums/Tabs.ts b/frontend/enums/Tabs.ts index 3a3eedb23..367e79f42 100644 --- a/frontend/enums/Tabs.ts +++ b/frontend/enums/Tabs.ts @@ -1,4 +1,4 @@ export enum Tab { - YOUR_AGENTS = "your-agents", - MARKETPLACE = "marketplace", + YOUR_AGENTS = 'your-agents', + MARKETPLACE = 'marketplace', } diff --git a/frontend/enums/index.ts b/frontend/enums/index.ts index b4cc61b3d..da8f50813 100644 --- a/frontend/enums/index.ts +++ b/frontend/enums/index.ts @@ -1,2 +1,2 @@ -export * from "./SpawnState"; -export * from "./Tabs"; +export * from './SpawnState'; +export * from './Tabs'; diff --git a/frontend/hooks/index.ts b/frontend/hooks/index.ts index 246809b3a..92d1a01ef 100644 --- a/frontend/hooks/index.ts +++ b/frontend/hooks/index.ts @@ -5,4 +5,4 @@ export * from "./useTabs"; export * from "./useMarketplace"; export * from "./useEthers"; export * from "./useMulticall"; -export * from "./useAppInfo"; +export * from "./useAppInfo"; \ No newline at end of file diff --git a/frontend/hooks/useAppInfo.tsx b/frontend/hooks/useAppInfo.tsx index 5e71a3220..a3ba9ff37 100644 --- a/frontend/hooks/useAppInfo.tsx +++ b/frontend/hooks/useAppInfo.tsx @@ -1,5 +1,5 @@ -import { AppInfoContext } from "@/context"; -import { useContext } from "react"; +import { AppInfoContext } from '@/context'; +import { useContext } from 'react'; export const useAppInfo = () => { const { appInfo } = useContext(AppInfoContext); diff --git a/frontend/hooks/useModals.tsx b/frontend/hooks/useModals.tsx index d43ee0b90..ff289df5b 100644 --- a/frontend/hooks/useModals.tsx +++ b/frontend/hooks/useModals.tsx @@ -1,6 +1,6 @@ -import { ModalsContext } from "@/context"; -import { QRModalData } from "@/types"; -import { useContext } from "react"; +import { ModalsContext } from '@/context'; +import { QRModalData } from '@/types'; +import { useContext } from 'react'; export const useModals = () => { const { qrModalData, setQrModalData } = useContext(ModalsContext); @@ -16,7 +16,7 @@ export const useModals = () => { isERC20: false, }); - const qrModalOpen = (data: Omit, "open">) => + const qrModalOpen = (data: Omit, 'open'>) => setQrModalData({ ...data, open: true }); return { qrModalData, setQrModalData, qrModalReset, qrModalOpen }; diff --git a/frontend/hooks/useMulticall.tsx b/frontend/hooks/useMulticall.tsx index bd27fd3b0..23cf2a187 100644 --- a/frontend/hooks/useMulticall.tsx +++ b/frontend/hooks/useMulticall.tsx @@ -1,7 +1,7 @@ -import { MULTICALL_CONTRACT } from "@/constants"; -import { BigNumber, ethers } from "ethers"; -import { Contract, ContractCall, Provider } from "ethers-multicall"; -import { multicall3Abi } from "@/abi"; +import { MULTICALL_CONTRACT } from '@/constants'; +import { BigNumber, ethers } from 'ethers'; +import { Contract, ContractCall, Provider } from 'ethers-multicall'; +import { multicall3Abi } from '@/abi'; export const useMulticall = () => { /** @@ -54,7 +54,7 @@ export const useMulticall = () => { const multicallContract = new Contract(MULTICALL_CONTRACT, multicall3Abi); const callData: ContractCall[] = addresses.map((address: string) => - multicallContract.call(contractAddress, "balanceOf(address):(uint256)", [ + multicallContract.call(contractAddress, 'balanceOf(address):(uint256)', [ address, ]), ); diff --git a/frontend/hooks/useSpawn.tsx b/frontend/hooks/useSpawn.tsx index 33b999422..f94877b2e 100644 --- a/frontend/hooks/useSpawn.tsx +++ b/frontend/hooks/useSpawn.tsx @@ -1,6 +1,6 @@ -import { SpawnContext } from "@/context"; -import { SpawnScreenState } from "@/enums"; -import { useCallback, useContext, useMemo } from "react"; +import { SpawnContext } from '@/context'; +import { SpawnScreenState } from '@/enums'; +import { useCallback, useContext, useMemo } from 'react'; export const useSpawn = () => { const { spawnScreenState, setSpawnScreenState, firstSpawnScreenState } = diff --git a/frontend/hooks/useTabs.tsx b/frontend/hooks/useTabs.tsx index 4d49003df..2171c0ad4 100644 --- a/frontend/hooks/useTabs.tsx +++ b/frontend/hooks/useTabs.tsx @@ -1,6 +1,6 @@ -import { TabsContext } from "@/context"; -import { Tab } from "@/enums"; -import { useContext } from "react"; +import { TabsContext } from '@/context'; +import { Tab } from '@/enums'; +import { useContext } from 'react'; export const useTabs = () => { const { activeTab, setActiveTab } = useContext(TabsContext); diff --git a/frontend/jest.config.ts b/frontend/jest.config.ts index 595f9e685..849f963f0 100644 --- a/frontend/jest.config.ts +++ b/frontend/jest.config.ts @@ -1,18 +1,18 @@ -import type { Config } from "jest"; -import nextJest from "next/jest.js"; +import type { Config } from 'jest'; +import nextJest from 'next/jest.js'; const createJestConfig = nextJest({ // Provide the path to your Next.js app to load next.config.js and .env files in your test environment - dir: "./", + dir: './', }); // Add any custom config to be passed to Jest const config: Config = { - coverageProvider: "v8", - testEnvironment: "jsdom", + coverageProvider: 'v8', + testEnvironment: 'jsdom', globals: { fetch }, // Add more setup options before each test is run - setupFilesAfterEnv: ["/jest.setup.ts"], + setupFilesAfterEnv: ['/jest.setup.ts'], }; // createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async diff --git a/frontend/jest.setup.ts b/frontend/jest.setup.ts index d0de870dc..7b0828bfa 100644 --- a/frontend/jest.setup.ts +++ b/frontend/jest.setup.ts @@ -1 +1 @@ -import "@testing-library/jest-dom"; +import '@testing-library/jest-dom'; diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs index 354989014..42cb7bbae 100644 --- a/frontend/next.config.mjs +++ b/frontend/next.config.mjs @@ -1,18 +1,20 @@ /** @type {import('next').NextConfig} */ const nextConfig = { images: { - remotePatterns: [{ - protocol: "https", - hostname: "**" - }], + remotePatterns: [ + { + protocol: 'https', + hostname: '**', + }, + ], }, reactStrictMode: true, transpilePackages: [ - "rc-util", - "@babel/runtime", - "@ant-design", - "rc-pagination", - "rc-picker", + 'rc-util', + '@babel/runtime', + '@ant-design', + 'rc-pagination', + 'rc-picker', ], }; diff --git a/frontend/pages/_document.tsx b/frontend/pages/_document.tsx index 8285a0e73..3398a52a8 100644 --- a/frontend/pages/_document.tsx +++ b/frontend/pages/_document.tsx @@ -1,7 +1,7 @@ -import React from "react"; -import { createCache, extractStyle, StyleProvider } from "@ant-design/cssinjs"; -import Document, { Head, Html, Main, NextScript } from "next/document"; -import type { DocumentContext } from "next/document"; +import React from 'react'; +import { createCache, extractStyle, StyleProvider } from '@ant-design/cssinjs'; +import Document, { Head, Html, Main, NextScript } from 'next/document'; +import type { DocumentContext } from 'next/document'; const MyDocument = () => ( diff --git a/frontend/theme/index.ts b/frontend/theme/index.ts index f9a6c243e..fdeaac41b 100644 --- a/frontend/theme/index.ts +++ b/frontend/theme/index.ts @@ -1 +1 @@ -export * from "./mainTheme"; +export * from './mainTheme'; diff --git a/frontend/theme/mainTheme.ts b/frontend/theme/mainTheme.ts index 4c1aa4be5..ac7e4f225 100644 --- a/frontend/theme/mainTheme.ts +++ b/frontend/theme/mainTheme.ts @@ -1,8 +1,8 @@ -import { ThemeConfig } from "antd"; +import { ThemeConfig } from 'antd'; export const mainTheme: ThemeConfig = { token: { - colorPrimary: "#334155", - colorText: "#0F172A ", + colorPrimary: '#334155', + colorText: '#0F172A ', }, };