diff --git a/package-lock.json b/package-lock.json index 975dee5f29..5b3e54e765 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,7 +72,6 @@ "clsx": "^2.1.1", "color": "^4.2.3", "colorthief": "^2.3.2", - "embla-carousel-autoplay": "^8.1.6", "embla-carousel-react": "^8.1.6", "events": "^3.3.0", "framer-motion": "^7.10.3", @@ -100,7 +99,6 @@ "react-hook-form": "7.43.9", "react-live-chat-loader": "^2.9.1", "react-markdown": "^8.0.7", - "react-papaparse": "^4.4.0", "react-window": "^1.8.8", "remark-gfm": "^4.0.0", "slugify": "^1.6.5", @@ -144,9 +142,6 @@ "husky": "^8.0.3", "lint-staged": "^13.0.0", "postcss": "^8.4.38", - "prettier": "^3.3.2", - "prettier-plugin-jsdoc": "^1.3.0", - "prettier-plugin-tailwindcss": "^0.6.5", "storybook": "^8.1.11", "tailwindcss": "^3.4.4", "typescript": "^5.5.3", @@ -13989,15 +13984,6 @@ "integrity": "sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==", "license": "MIT" }, - "node_modules/@types/papaparse": { - "version": "5.3.14", - "resolved": "https://registry.npmjs.org/@types/papaparse/-/papaparse-5.3.14.tgz", - "integrity": "sha512-LxJ4iEFcpqc6METwp9f6BV6VVc43m6MfH0VqFosHvrUgfXiFe6ww7R3itkOQ+TCK6Y+Iv/+RnnvtRZnkc5Kc9g==", - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/parse-json": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", @@ -17221,13 +17207,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/binary-searching": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/binary-searching/-/binary-searching-2.0.5.tgz", - "integrity": "sha512-v4N2l3RxL+m4zDxyxz3Ne2aTmiPn8ZUpKFpdPtO+ItW1NcTCXA7JeHG5GMBSvoKSkQZ9ycS+EouDVxYB9ufKWA==", - "dev": true, - "license": "MIT" - }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -18733,16 +18712,6 @@ "node": ">= 12" } }, - "node_modules/comment-parser": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", - "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 12.0.0" - } - }, "node_modules/common-path-prefix": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", @@ -20457,15 +20426,6 @@ "integrity": "sha512-9mTDtyMZJhFuuW5pixhTT4iLiJB1l3dH3IpXUKCsgLlRlHCiySf/wLKy5xIAzmxIsokcQ50xea8wi7BCt0+Rxg==", "license": "MIT" }, - "node_modules/embla-carousel-autoplay": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/embla-carousel-autoplay/-/embla-carousel-autoplay-8.2.1.tgz", - "integrity": "sha512-jhE2aNz5pbmICVkz3XyB3uACgkk4YvbnOZeMcoeIMjfycierQvmcice107w73kYaPrQSzCrHLNkKNmq9eA2iOQ==", - "license": "MIT", - "peerDependencies": { - "embla-carousel": "8.2.1" - } - }, "node_modules/embla-carousel-react": { "version": "8.2.1", "resolved": "https://registry.npmjs.org/embla-carousel-react/-/embla-carousel-react-8.2.1.tgz", @@ -28993,119 +28953,6 @@ "url": "https://opencollective.com/preact" } }, - "node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/prettier-plugin-jsdoc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/prettier-plugin-jsdoc/-/prettier-plugin-jsdoc-1.3.0.tgz", - "integrity": "sha512-cQm8xIa0fN9ieJFMXACQd6JPycl+8ouOijAqUqu44EF/s4fXL3Wi9sKXuEaodsEWgCN42Xby/bNhqgM1iWx4uw==", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-searching": "^2.0.5", - "comment-parser": "^1.4.0", - "mdast-util-from-markdown": "^2.0.0" - }, - "engines": { - "node": ">=14.13.1 || >=16.0.0" - }, - "peerDependencies": { - "prettier": "^3.0.0" - } - }, - "node_modules/prettier-plugin-tailwindcss": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.6.6.tgz", - "integrity": "sha512-OPva5S7WAsPLEsOuOWXATi13QrCKACCiIonFgIR6V4lYv4QLp++UXVhZSzRbZxXGimkQtQT86CC6fQqTOybGng==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.21.3" - }, - "peerDependencies": { - "@ianvs/prettier-plugin-sort-imports": "*", - "@prettier/plugin-pug": "*", - "@shopify/prettier-plugin-liquid": "*", - "@trivago/prettier-plugin-sort-imports": "*", - "@zackad/prettier-plugin-twig-melody": "*", - "prettier": "^3.0", - "prettier-plugin-astro": "*", - "prettier-plugin-css-order": "*", - "prettier-plugin-import-sort": "*", - "prettier-plugin-jsdoc": "*", - "prettier-plugin-marko": "*", - "prettier-plugin-multiline-arrays": "*", - "prettier-plugin-organize-attributes": "*", - "prettier-plugin-organize-imports": "*", - "prettier-plugin-sort-imports": "*", - "prettier-plugin-style-order": "*", - "prettier-plugin-svelte": "*" - }, - "peerDependenciesMeta": { - "@ianvs/prettier-plugin-sort-imports": { - "optional": true - }, - "@prettier/plugin-pug": { - "optional": true - }, - "@shopify/prettier-plugin-liquid": { - "optional": true - }, - "@trivago/prettier-plugin-sort-imports": { - "optional": true - }, - "@zackad/prettier-plugin-twig-melody": { - "optional": true - }, - "prettier-plugin-astro": { - "optional": true - }, - "prettier-plugin-css-order": { - "optional": true - }, - "prettier-plugin-import-sort": { - "optional": true - }, - "prettier-plugin-jsdoc": { - "optional": true - }, - "prettier-plugin-marko": { - "optional": true - }, - "prettier-plugin-multiline-arrays": { - "optional": true - }, - "prettier-plugin-organize-attributes": { - "optional": true - }, - "prettier-plugin-organize-imports": { - "optional": true - }, - "prettier-plugin-sort-imports": { - "optional": true - }, - "prettier-plugin-style-order": { - "optional": true - }, - "prettier-plugin-svelte": { - "optional": true - } - } - }, "node_modules/pretty-error": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz", @@ -30289,20 +30136,6 @@ "node": ">=12" } }, - "node_modules/react-papaparse": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/react-papaparse/-/react-papaparse-4.4.0.tgz", - "integrity": "sha512-xTEwHZYJ+1dh9mQDQjjwJXmWyX20DdZ52u+ddw75V+Xm5qsjXSvWmC7c8K82vRwMjKAOH2S9uFyGpHEyEztkUQ==", - "license": "MIT", - "dependencies": { - "@types/papaparse": "^5.3.9", - "papaparse": "^5.4.1" - }, - "engines": { - "node": ">=8", - "npm": ">=5" - } - }, "node_modules/react-reconciler": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.27.0.tgz", diff --git a/package.json b/package.json index d162aa1bed..c0359c9b3a 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,6 @@ "clsx": "^2.1.1", "color": "^4.2.3", "colorthief": "^2.3.2", - "embla-carousel-autoplay": "^8.1.6", "embla-carousel-react": "^8.1.6", "events": "^3.3.0", "framer-motion": "^7.10.3", @@ -112,7 +111,6 @@ "react-hook-form": "7.43.9", "react-live-chat-loader": "^2.9.1", "react-markdown": "^8.0.7", - "react-papaparse": "^4.4.0", "react-window": "^1.8.8", "remark-gfm": "^4.0.0", "slugify": "^1.6.5", @@ -156,9 +154,6 @@ "husky": "^8.0.3", "lint-staged": "^13.0.0", "postcss": "^8.4.38", - "prettier": "^3.3.2", - "prettier-plugin-jsdoc": "^1.3.0", - "prettier-plugin-tailwindcss": "^0.6.5", "storybook": "^8.1.11", "tailwindcss": "^3.4.4", "typescript": "^5.5.3", diff --git a/src/app/(marketing)/profile/_hooks/useExperienceProgression.ts b/src/app/(marketing)/profile/_hooks/useExperienceProgression.ts index fc11c44c4a..a030296933 100644 --- a/src/app/(marketing)/profile/_hooks/useExperienceProgression.ts +++ b/src/app/(marketing)/profile/_hooks/useExperienceProgression.ts @@ -11,7 +11,7 @@ const generateExponentialArray = ( return Array.from({ length: steps }, (_, i) => Math.pow(exponent, i) * scaleFactor) } -export const calculateXpProgression = ({ +const calculateXpProgression = ({ experienceCount, }: { experienceCount: number }) => { if (MAX_LEVEL < 1) throw new Error(`max level must be positive`) diff --git a/src/app/explorer/_components/YourGuilds.tsx b/src/app/explorer/_components/YourGuilds.tsx index af6828a6fd..9a18a43b69 100644 --- a/src/app/explorer/_components/YourGuilds.tsx +++ b/src/app/explorer/_components/YourGuilds.tsx @@ -69,5 +69,3 @@ export const YourGuilds = () => { ) } - -export { useYourGuilds } diff --git a/src/app/oauth/page.tsx b/src/app/oauth/page.tsx index 0dfd706d27..0d02fbefa8 100644 --- a/src/app/oauth/page.tsx +++ b/src/app/oauth/page.tsx @@ -2,12 +2,11 @@ import { usePostHogContext } from "@/components/Providers/PostHogProvider" import { useErrorToast } from "@/components/ui/hooks/useErrorToast" -import type { Message } from "@/hooks/useOauthPopupWindow" import { PlatformName } from "@guildxyz/types" import { useRouter } from "next/navigation" import { useCallback, useEffect } from "react" import timeoutPromise from "utils/timeoutPromise" -import { OAuthLocalStorageInfo, OAuthResponse } from "./types" +import { Message, OAuthLocalStorageInfo, OAuthResponse } from "./types" const OAUTH_CONFIRMATION_TIMEOUT_MS = 500 diff --git a/src/app/oauth/types.ts b/src/app/oauth/types.ts index 138e00d39a..cb9121cb8d 100644 --- a/src/app/oauth/types.ts +++ b/src/app/oauth/types.ts @@ -1,4 +1,5 @@ import { PlatformName } from "@guildxyz/types" +import { OneOf } from "types" export type OAuthResponse = { error_description?: string @@ -13,3 +14,8 @@ export type OAuthLocalStorageInfo = { redirect_url: string scope: string } + +export type Message = OneOf< + { type: "OAUTH_ERROR"; data: { error: string; errorDescription: string } }, + { type: "OAUTH_SUCCESS"; data: any } +> diff --git a/src/components/[guild]/AddRewardButton/hooks/useAddRewardDiscardAlert.ts b/src/components/[guild]/AddRewardButton/hooks/useAddRewardDiscardAlert.ts index 19ff54f93a..c7de403e28 100644 --- a/src/components/[guild]/AddRewardButton/hooks/useAddRewardDiscardAlert.ts +++ b/src/components/[guild]/AddRewardButton/hooks/useAddRewardDiscardAlert.ts @@ -1,7 +1,7 @@ import { atom, useAtom } from "jotai" import { useEffect } from "react" -export const isAddRewardPanelDirtyAtom = atom(false) +const isAddRewardPanelDirtyAtom = atom(false) export const useAddRewardDiscardAlert = (isDirty?: boolean) => { const [isAddRewardPanelDirty, setIsAddRewardPanelDirty] = useAtom( diff --git a/src/components/[guild]/EditGuild/hooks/useEditGuild.ts b/src/components/[guild]/EditGuild/hooks/useEditGuild.ts index baba66424e..73c125aa1e 100644 --- a/src/components/[guild]/EditGuild/hooks/useEditGuild.ts +++ b/src/components/[guild]/EditGuild/hooks/useEditGuild.ts @@ -14,10 +14,10 @@ type Props = { guildId?: string | number } -export const countFailed = (arr: Record[]) => +const countFailed = (arr: Record[]) => arr.filter((res) => !!res.error).length -export const getCorrelationId = (arr: Record[]) => +const getCorrelationId = (arr: Record[]) => arr.filter((res) => !!res.error)[0]?.correlationId const getError = (arr: Record[]) => diff --git a/src/components/[guild]/RequirementHandlerContext.tsx b/src/components/[guild]/RequirementHandlerContext.tsx index a767681f10..05d0f26c37 100644 --- a/src/components/[guild]/RequirementHandlerContext.tsx +++ b/src/components/[guild]/RequirementHandlerContext.tsx @@ -85,6 +85,5 @@ const ApiRequirementHandlerProvider = ({ export { ApiRequirementHandlerProvider, ClientStateRequirementHandlerProvider, - RequirementHandlerContext, useRequirementHandlerContext, } diff --git a/src/components/[guild]/Requirements/components/GuildCheckout/MintGuildPin/Fuel/hooks/useMintFuelGuildPin.ts b/src/components/[guild]/Requirements/components/GuildCheckout/MintGuildPin/Fuel/hooks/useMintFuelGuildPin.ts index 05fbcb1921..58354f7e5c 100644 --- a/src/components/[guild]/Requirements/components/GuildCheckout/MintGuildPin/Fuel/hooks/useMintFuelGuildPin.ts +++ b/src/components/[guild]/Requirements/components/GuildCheckout/MintGuildPin/Fuel/hooks/useMintFuelGuildPin.ts @@ -6,7 +6,7 @@ import useSubmit from "hooks/useSubmit" import { useToastWithShareButtons } from "hooks/useToastWithShareButtons" import { useState } from "react" import fetcher from "utils/fetcher" -import parseFuelAddress from "utils/parseFuelAddress" +import { parseFuelAddress } from "utils/parseFuelAddress" import { useMintGuildPinContext } from "../../../MintGuildPinContext" import type { ClaimParametersInput, GuildActionInput } from "../GuildPinContractAbi" import { GuildPinContractAbi__factory } from "../GuildPinContractAbi_factory" diff --git a/src/components/[guild]/RoleCard/components/EditRole/components/EditRolePlatforms.tsx b/src/components/[guild]/RoleCard/components/EditRole/components/EditRolePlatforms.tsx index bc51762840..3e74b7ea90 100644 --- a/src/components/[guild]/RoleCard/components/EditRole/components/EditRolePlatforms.tsx +++ b/src/components/[guild]/RoleCard/components/EditRole/components/EditRolePlatforms.tsx @@ -11,7 +11,6 @@ import useRole from "components/[guild]/hooks/useRole" import AddCard from "components/common/AddCard" import Button from "components/common/Button" import Section from "components/common/Section" -import { atom } from "jotai" import useAddRolePlatform from "../hooks/useAddRolePlatform" import ExistingRolePlatformCard from "./ExistingRolePlatformCard" @@ -19,8 +18,6 @@ type Props = { roleId?: number } -export const openRewardSettingsGuildPlatformIdAtom = atom(0) - const EditRolePlatforms = ({ roleId }: Props) => { const { onOpen } = useAddRewardContext() const { id: guildId } = useGuild() diff --git a/src/components/[guild]/RoleCard/components/Reward.tsx b/src/components/[guild]/RoleCard/components/Reward.tsx index 3bbf34cb4d..2a51c769c4 100644 --- a/src/components/[guild]/RoleCard/components/Reward.tsx +++ b/src/components/[guild]/RoleCard/components/Reward.tsx @@ -195,5 +195,5 @@ const RewardWrapper = ({ platform, ...props }: RewardProps) => { ) } -export { Reward, RewardIcon, getRewardLabel } +export { RewardIcon } export default RewardWrapper diff --git a/src/components/[guild]/RolePlatforms/AddRolePlatforms.tsx b/src/components/[guild]/RolePlatforms/AddRolePlatforms.tsx index 1c26399e7d..d8dd3024b7 100644 --- a/src/components/[guild]/RolePlatforms/AddRolePlatforms.tsx +++ b/src/components/[guild]/RolePlatforms/AddRolePlatforms.tsx @@ -4,15 +4,12 @@ import TransitioningPlatformIcons from "components/[guild]/RolePlatforms/compone import AddCard from "components/common/AddCard" import Button from "components/common/Button" import Section from "components/common/Section" -import { atom } from "jotai" import { useFieldArray, useFormContext } from "react-hook-form" import { RoleFormType, RolePlatform } from "types" import NewRolePlatformCard from "../AddAndOrderRoles/components/NewRolePlatformCard" import { AddRewardProvider, useAddRewardContext } from "../AddRewardContext" import AddRoleRewardModal from "./components/AddRoleRewardModal" -export const openRewardSettingsGuildPlatformIdAtom = atom(0) - const AddRolePlatforms = () => { const { onOpen } = useAddRewardContext() diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/DefaultAddRewardPanelWrapper.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/DefaultAddRewardPanelWrapper.tsx index 945e2666ea..3c4986c3c1 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/DefaultAddRewardPanelWrapper.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/DefaultAddRewardPanelWrapper.tsx @@ -45,5 +45,3 @@ export const DefaultAddRewardPanelWrapper = ({ ) } - -export default DefaultAddRewardPanelWrapper diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddContractCallPanel/AddContractCallPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddContractCallPanel/AddContractCallPanel.tsx index ed6171fd0b..69a13c9d76 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddContractCallPanel/AddContractCallPanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddContractCallPanel/AddContractCallPanel.tsx @@ -1,5 +1,5 @@ import { AddRewardPanelProps } from "rewards" -import DefaultAddRewardPanelWrapper from "../../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../../DefaultAddRewardPanelWrapper" import CreateNftForm from "./components/CreateNftForm" const AddContractCallPanel = ({ onAdd }: AddRewardPanelProps) => ( diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddContractCallPanel/components/CreateNftForm/hooks/useCreateNft.ts b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddContractCallPanel/components/CreateNftForm/hooks/useCreateNft.ts index 892ff6b943..16fb14a7bd 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddContractCallPanel/components/CreateNftForm/hooks/useCreateNft.ts +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddContractCallPanel/components/CreateNftForm/hooks/useCreateNft.ts @@ -59,7 +59,7 @@ export enum ContractCallFunction { SIMPLE_CLAIM = "function claim(uint256 amount, address receiver, uint256 userId, uint256 signedAt, bytes calldata signature) payable", } -export const CONTRACT_CALL_ARGS_TO_SIGN: Record = { +const CONTRACT_CALL_ARGS_TO_SIGN: Record = { [ContractCallFunction.DEPRECATED_SIMPLE_CLAIM]: [], [ContractCallFunction.SIMPLE_CLAIM]: ["uint256"], } diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddDiscordPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddDiscordPanel.tsx index e66bbc1645..94f7af0411 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddDiscordPanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddDiscordPanel.tsx @@ -3,7 +3,7 @@ import { useWatch } from "react-hook-form" import { AddRewardPanelProps } from "rewards" import { ConnectPlatformFallback } from "solutions/components/ConnectPlatformFallback" import { PlatformGuildData, PlatformType } from "types" -import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper" const AddDiscordPanel = ({ onAdd }: AddRewardPanelProps) => { // TODO: we could somehow extract this piece of logis from here to make sure that AddDiscordPanel doesn't depend on the role form's state diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddFormPanel/AddFormPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddFormPanel/AddFormPanel.tsx index 7183169f5b..99891834eb 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddFormPanel/AddFormPanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddFormPanel/AddFormPanel.tsx @@ -11,7 +11,7 @@ import { AddRewardPanelProps } from "rewards" import { PlatformGuildData, PlatformType } from "types" import { uuidv7 } from "uuidv7" import { CreateForm } from "." -import DefaultAddRewardPanelWrapper from "../../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../../DefaultAddRewardPanelWrapper" import ContinueWithExistingFormAlert from "./components/ContinueWithExistingFormAlert" const defaultValues: CreateForm = { diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGatherPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGatherPanel.tsx index 569e386b33..49e6b92118 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGatherPanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGatherPanel.tsx @@ -9,7 +9,7 @@ import { gatherSpaceUrlToSpaceId, } from "rewards/Gather/useGatherCardProps" import { PlatformType } from "types" -import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper" export type AddGatherFormType = { gatherApiKey: string diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGithubPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGithubPanel.tsx index 95e08a6849..9d4ca62a62 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGithubPanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGithubPanel.tsx @@ -4,7 +4,7 @@ import { FormProvider, useForm } from "react-hook-form" import { AddRewardPanelProps } from "rewards" import { ConnectPlatformFallback } from "solutions/components/ConnectPlatformFallback" import { PlatformType } from "types" -import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper" const defaultValues = { platformGuildId: null, diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGooglePanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGooglePanel.tsx index 63ba5c6d45..ad7324ef2c 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGooglePanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddGooglePanel.tsx @@ -4,7 +4,7 @@ import { FormProvider, useForm } from "react-hook-form" import { AddRewardPanelProps } from "rewards" import { ConnectPlatformFallback } from "solutions/components/ConnectPlatformFallback" import { PlatformType } from "types" -import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper" const defaultValues = { platformGuildId: null, diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPoapPanel/AddPoapPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPoapPanel/AddPoapPanel.tsx index dc8d0651d5..f99e444d57 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPoapPanel/AddPoapPanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPoapPanel/AddPoapPanel.tsx @@ -23,7 +23,7 @@ import { FormProvider, useController, useForm, useWatch } from "react-hook-form" import usePoapById from "requirements/Poap/hooks/usePoapById" import rewards, { AddRewardPanelProps } from "rewards" import { PlatformGuildData, PlatformType } from "types" -import DefaultAddRewardPanelWrapper from "../../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../../DefaultAddRewardPanelWrapper" import UploadMintLinks from "./components/UploadMintLinks" export type ImportPoapForm = { diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPoapPanel/components/UploadMintLinks.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPoapPanel/components/UploadMintLinks.tsx index b6007a97e7..6440da5848 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPoapPanel/components/UploadMintLinks.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPoapPanel/components/UploadMintLinks.tsx @@ -9,7 +9,7 @@ import { ImportPoapForm } from "../AddPoapPanel" const LEGACY_POAP_MINT_LINK_BASE = "http://poap.xyz/claim/" const POAP_MINT_LINK_BASE = "http://poap.xyz/mint/" -export const validatePoapLinks = (links: string[]) => +const validatePoapLinks = (links: string[]) => links .filter(Boolean) .map((link) => link.toLowerCase()) diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPointsPanel/AddPointsPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPointsPanel/AddPointsPanel.tsx index a2fa3dea12..7a32a94835 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPointsPanel/AddPointsPanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddPointsPanel/AddPointsPanel.tsx @@ -6,7 +6,7 @@ import Button from "components/common/Button" import { FormProvider, useForm, useWatch } from "react-hook-form" import { AddRewardPanelProps } from "rewards" import { PlatformGuildData, PlatformType } from "types" -import DefaultAddRewardPanelWrapper from "../../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../../DefaultAddRewardPanelWrapper" import AddNewPointsType from "./components/AddNewPointsType" import ExistingPointsTypeSelect, { CREATE_NEW_OPTION, diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddSecretTextPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddSecretTextPanel.tsx index ab720e5808..256cbea3ec 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddSecretTextPanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddSecretTextPanel.tsx @@ -11,7 +11,7 @@ import UniqueTextDataForm, { UniqueTextRewardForm, } from "rewards/UniqueText/UniqueTextDataForm" import { PlatformGuildData, PlatformName, PlatformType } from "types" -import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper" enum TextPlatformName { TEXT, diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddTelegramPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddTelegramPanel.tsx index 36bbbef079..1394cfbf08 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddTelegramPanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddTelegramPanel.tsx @@ -4,7 +4,7 @@ import TelegramGroup from "components/create-guild/TelegramGroup" import { FormProvider, useForm, useWatch } from "react-hook-form" import { AddRewardPanelProps } from "rewards" import { PlatformType } from "types" -import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper" const AddTelegramPanel = ({ onAdd }: AddRewardPanelProps) => { const methods = useForm({ diff --git a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddTokenPanel/AddTokenPanel.tsx b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddTokenPanel/AddTokenPanel.tsx index 1d75a04dbd..b5d640fab4 100644 --- a/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddTokenPanel/AddTokenPanel.tsx +++ b/src/components/[guild]/RolePlatforms/components/AddRoleRewardModal/components/AddTokenPanel/AddTokenPanel.tsx @@ -20,7 +20,7 @@ import { FormProvider, useForm } from "react-hook-form" import { AddRewardPanelProps } from "rewards" import { PlatformGuildData, PlatformType } from "types" import { ERC20_CONTRACTS } from "utils/guildCheckout/constants" -import DefaultAddRewardPanelWrapper from "../../DefaultAddRewardPanelWrapper" +import { DefaultAddRewardPanelWrapper } from "../../DefaultAddRewardPanelWrapper" import PoolStep from "./components/PoolStep" import SetTokenStep from "./components/SetTokenStep" import TokenAmountStep from "./components/TokenAmountStep" diff --git a/src/components/[guild]/Roles.tsx b/src/components/[guild]/Roles.tsx index db1313d372..f67e9db5e3 100644 --- a/src/components/[guild]/Roles.tsx +++ b/src/components/[guild]/Roles.tsx @@ -1,7 +1,7 @@ import { Center, Spinner, Stack } from "@chakra-ui/react" import CollapsibleRoleSection from "components/[guild]/CollapsibleRoleSection" import { RequirementErrorConfigProvider } from "components/[guild]/Requirements/RequirementErrorConfigContext" -import RoleCard from "components/[guild]/RoleCard/RoleCard" +import RoleCard from "components/[guild]/RoleCard" import useGuild from "components/[guild]/hooks/useGuild" import { useScrollBatchedRendering } from "hooks/useScrollBatchedRendering" import dynamic from "next/dynamic" diff --git a/src/components/[guild]/[group]/EditCampaignButton.tsx b/src/components/[guild]/[group]/EditCampaignButton.tsx deleted file mode 100644 index f999f08c5f..0000000000 --- a/src/components/[guild]/[group]/EditCampaignButton.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { IconButton, useDisclosure } from "@chakra-ui/react" -import { GearSix } from "@phosphor-icons/react" -import { useRouter } from "next/router" -import { Group } from "types" -import EditCampaignModal from "../AccessHub/components/CampaignCards/components/EditCampaignModal" -import { useThemeContext } from "../ThemeContext" -import useGuild from "../hooks/useGuild" -import useRoleGroup from "../hooks/useRoleGroup" - -const EditCampaignButton = () => { - const group = useRoleGroup() - const { urlName } = useGuild() - const { replace } = useRouter() - - const { textColor, buttonColorScheme } = useThemeContext() - - const { isOpen, onOpen, onClose } = useDisclosure() - - const onSuccess = (response: Group) => { - onClose() - replace(`/${urlName}/${response.urlName}`) - } - - return ( - <> - } - aria-label="Edit page" - minW="44px" - rounded="full" - colorScheme={buttonColorScheme} - color={textColor} - onClick={onOpen} - /> - - - - ) -} -export default EditCampaignButton diff --git a/src/components/[guild]/activity/ActivityLogFiltersBar/components/ActivityLogFiltersContext.tsx b/src/components/[guild]/activity/ActivityLogFiltersBar/components/ActivityLogFiltersContext.tsx index 04da4f9d19..6e055a2772 100644 --- a/src/components/[guild]/activity/ActivityLogFiltersBar/components/ActivityLogFiltersContext.tsx +++ b/src/components/[guild]/activity/ActivityLogFiltersBar/components/ActivityLogFiltersContext.tsx @@ -34,7 +34,7 @@ export const FILTER_NAMES: Record = { action: "Action", } -export const SUPPORTED_QUERY_PARAMS = [ +const SUPPORTED_QUERY_PARAMS = [ "order", "limit", "offset", diff --git a/src/components/[guild]/crm/CRMTable/CrmTbody.tsx b/src/components/[guild]/crm/CRMTable/CrmTbody.tsx index 9584c4d0cf..c56636c3a9 100644 --- a/src/components/[guild]/crm/CRMTable/CrmTbody.tsx +++ b/src/components/[guild]/crm/CRMTable/CrmTbody.tsx @@ -119,7 +119,7 @@ export const CrmSkeletonRow = ({ columns }) => ( ) -export const CrmTd = ({ children, ...rest }) => { +const CrmTd = ({ children, ...rest }) => { const tdBg = useColorModeValue(`gray.50`, "#3A3A40") // dark color is from blackAlpha.200, but without opacity so it can overlay when sticky return ( @@ -129,7 +129,7 @@ export const CrmTd = ({ children, ...rest }) => { ) } -export const CrmInteractiveTd = ({ children, ...rest }) => { +const CrmInteractiveTd = ({ children, ...rest }) => { const tdHoverBg = useColorModeValue(`blackAlpha.50`, "whiteAlpha.50") return ( diff --git a/src/components/[guild]/crm/MemberModal.tsx b/src/components/[guild]/crm/MemberModal.tsx index 2b5bef82fd..c1cace46ca 100644 --- a/src/components/[guild]/crm/MemberModal.tsx +++ b/src/components/[guild]/crm/MemberModal.tsx @@ -19,7 +19,7 @@ import useResolveAddress from "hooks/useResolveAddress" import useGuild from "../hooks/useGuild" import { WalletTag } from "./Identities" import { ClickableCrmRoleTag } from "./RoleTags" -import UserPlatformTags from "./UserPlatformTags" +import { UserPlatformTags } from "./UserPlatformTags" import { Member } from "./useMembers" type Props = { diff --git a/src/components/[guild]/crm/RoleTags.tsx b/src/components/[guild]/crm/RoleTags.tsx index a0934c6a75..27449e0c19 100644 --- a/src/components/[guild]/crm/RoleTags.tsx +++ b/src/components/[guild]/crm/RoleTags.tsx @@ -167,7 +167,7 @@ const CrmTbodyRoleTag = memo( }) ) -export const CrmRoleTag = memo( +const CrmRoleTag = memo( forwardRef(({ role, amount: amountProp, ...rest }, ref) => { if (!role) return null diff --git a/src/components/[guild]/crm/UserPlatformTags.tsx b/src/components/[guild]/crm/UserPlatformTags.tsx index d3c91ca901..38f2e98693 100644 --- a/src/components/[guild]/crm/UserPlatformTags.tsx +++ b/src/components/[guild]/crm/UserPlatformTags.tsx @@ -70,5 +70,3 @@ const getPlatformUrl = (platformAccount: PlatformAccountDetails) => { return platformUrls[platformId] } - -export default UserPlatformTags diff --git a/src/components/[guild]/forms/responses/CollapsibleIdentityTags.tsx b/src/components/[guild]/forms/responses/CollapsibleIdentityTags.tsx index 5ccf5a8820..f7776c12a3 100644 --- a/src/components/[guild]/forms/responses/CollapsibleIdentityTags.tsx +++ b/src/components/[guild]/forms/responses/CollapsibleIdentityTags.tsx @@ -1,7 +1,7 @@ import { Center, Collapse, Icon, IconButton } from "@chakra-ui/react" import { CaretDown } from "@phosphor-icons/react" import { WalletTag } from "components/[guild]/crm/Identities" -import UserPlatformTags from "components/[guild]/crm/UserPlatformTags" +import { UserPlatformTags } from "components/[guild]/crm/UserPlatformTags" import useGuild from "components/[guild]/hooks/useGuild" import { LinkButton } from "components/common/LinkMenuItem" import useResolveAddress from "hooks/useResolveAddress" diff --git a/src/components/[guild]/leaderboard/LeaderboardAirdropCard.tsx b/src/components/[guild]/leaderboard/LeaderboardAirdropCard.tsx index 14c8680497..83cc91a6ba 100644 --- a/src/components/[guild]/leaderboard/LeaderboardAirdropCard.tsx +++ b/src/components/[guild]/leaderboard/LeaderboardAirdropCard.tsx @@ -1,14 +1,10 @@ import { Box, - Center, Flex, HStack, Heading, - Skeleton, - SkeletonCircle, Stack, Text, - VStack, useColorModeValue, } from "@chakra-ui/react" import Card, { useCardBg } from "components/common/Card" @@ -152,36 +148,6 @@ const LeaderboardAirdropCard = () => { ) } -const LeaderboardAirdopSkeleton = () => { - const positionBgColor = useColorModeValue("gray.50", "blackAlpha.300") - const positionBorderColor = useColorModeValue("gray.200", "gray.600") - - return ( - - -
- -
- - - - - - - - -
-
- ) -} - const LeaderboardAirdropCardWrapper = ({ guildPlatform, }: { @@ -200,7 +166,4 @@ const LeaderboardAirdropCardWrapper = ({ ) } -export { - LeaderboardAirdopSkeleton, - LeaderboardAirdropCardWrapper as LeaderboardAirdropCard, -} +export { LeaderboardAirdropCardWrapper as LeaderboardAirdropCard } diff --git a/src/components/common/ErrorAnimation.tsx b/src/components/common/ErrorAnimation.tsx deleted file mode 100644 index 360ff2fc46..0000000000 --- a/src/components/common/ErrorAnimation.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { LazyMotion, domAnimation, m } from "framer-motion" -import { PropsWithChildren, useEffect, useState } from "react" - -type Props = { - errors: any -} - -const ErrorAnimation = ({ - errors, - children, -}: PropsWithChildren): JSX.Element => { - const [errorAnimation, setErrorAnimation] = useState( - "translateX(0px)" - ) - - useEffect(() => { - if (errors) - setErrorAnimation([ - "translateX(0px) translateY(0px)", - "translateX(-25px) translateY(0)", - "translateX(25px) translateY(20px)", - "translateX(-25px) translateY(10px)", - "translateX(25px) translateY(10px)", - "translateX(-25px) translateY(20px)", - "translateX(25px) translateY(0px)", - "translateX(0px) translateY(0px)", - ]) - }, [errors]) - - return ( - - setErrorAnimation("translateX(0px)")} - style={{ - position: "relative", - transformOrigin: "bottom center", - transform: "translateX(0px)", - }} - animate={{ - transform: errorAnimation, - }} - transition={{ duration: 0.4 }} - > - {children} - - - ) -} - -export default ErrorAnimation diff --git a/src/components/common/FileInput.tsx b/src/components/common/FileInput.tsx deleted file mode 100644 index d64077a52a..0000000000 --- a/src/components/common/FileInput.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { InputGroup } from "@chakra-ui/react" -import { PropsWithChildren, useRef } from "react" -import { UseFormRegisterReturn } from "react-hook-form" - -type Props = { - register: UseFormRegisterReturn - accept?: string - onChange?: (e) => void -} - -const FileInput = ({ - register, - accept, - onChange: customOnChange, - children, -}: PropsWithChildren): JSX.Element => { - const inputRef = useRef(null) - const { ref, onChange, ...rest } = register - - const handleClick = () => inputRef.current?.click() - - return ( - - { - ref(e) - inputRef.current = e - }} - onChange={(e) => { - onChange(e) - customOnChange?.(e) - }} - /> - {children} - - ) -} - -export default FileInput diff --git a/src/components/common/RadioButtonGroup.tsx b/src/components/common/RadioButtonGroup.tsx index d52843c7f4..7b2c5314c1 100644 --- a/src/components/common/RadioButtonGroup.tsx +++ b/src/components/common/RadioButtonGroup.tsx @@ -77,7 +77,7 @@ type RadioButtonProps = { } & RadioButtonOptionProps & UseRadioProps -export const RadioButton = (props: RadioButtonProps & { isDisabled?: boolean }) => { +const RadioButton = (props: RadioButtonProps & { isDisabled?: boolean }) => { const { getInputProps, getCheckboxProps } = useRadio(props) const input = getInputProps() diff --git a/src/components/create-guild/IconSelector/utils.ts b/src/components/create-guild/IconSelector/utils.ts index 8513d3d85d..ed1feb26e7 100644 --- a/src/components/create-guild/IconSelector/utils.ts +++ b/src/components/create-guild/IconSelector/utils.ts @@ -33,7 +33,7 @@ export const imageDimensionsValidator = ( return null } -export const getDimensionErrorMessage = (minW?: number, minH?: number): string => { +const getDimensionErrorMessage = (minW?: number, minH?: number): string => { if (minW && minH) return `Image should be at least ${minW}x${minH}px` return `Image ${minW ? "width" : "height"} should be at least ${minW || minH}px` } diff --git a/src/components/create-guild/Requirements/hooks/useBalancy.ts b/src/components/create-guild/Requirements/hooks/useBalancy.ts index b736bd0b2a..250f39c65f 100644 --- a/src/components/create-guild/Requirements/hooks/useBalancy.ts +++ b/src/components/create-guild/Requirements/hooks/useBalancy.ts @@ -275,5 +275,4 @@ const useBalancy = ( } } -export { BALANCY_SUPPORTED_CHAINS } export default useBalancy diff --git a/src/hooks/useNftBalance.ts b/src/hooks/useNftBalance.ts deleted file mode 100644 index 4c8c38dfce..0000000000 --- a/src/hooks/useNftBalance.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { erc721Abi } from "viem" -import { useAccount, useReadContract } from "wagmi" - -const useNftBalance = ({ - nftAddress, - chainId: chainIdFromParam, -}: { - nftAddress: `0x${string}` - chainId?: number -}) => { - const { address, chainId: chainIdFromHook } = useAccount() - const chainId = chainIdFromParam ?? chainIdFromHook - - return useReadContract({ - abi: erc721Abi, - chainId, - address: nftAddress, - functionName: "balanceOf", - args: [address], - query: { - enabled: Boolean(nftAddress && address), - }, - }) -} - -export default useNftBalance diff --git a/src/hooks/useQueryState.ts b/src/hooks/useQueryState.ts deleted file mode 100644 index 12536e1dd4..0000000000 --- a/src/hooks/useQueryState.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { useRouter } from "next/router" -import { useCallback, useEffect, useState } from "react" - -export const useQueryState = ( - name: string, - defaultState: State -) => { - const router = useRouter() - - const getInitialState = useCallback(() => { - const queries = router.query[name] - const query = Array.isArray(queries) ? queries[0] : queries - return query ? (query as State) : defaultState - }, [router.query, name, defaultState]) - - const [state, setState] = useState(getInitialState) - - useEffect(() => { - if (router.isReady) setState(getInitialState) - }, [router.isReady, getInitialState]) - - const toggle = useCallback( - (newState: State) => { - setState(newState) - router.query[name] = newState - router.replace({ query: router.query }, undefined, { - scroll: false, - }) - }, - // router is intentionally left out - // eslint-disable-next-line react-hooks/exhaustive-deps - [name] - ) - - return [state, toggle] as const -} diff --git a/src/hooks/useSubmit/useSubmit.ts b/src/hooks/useSubmit/useSubmit.ts index 75a5f630bb..75abb1781e 100644 --- a/src/hooks/useSubmit/useSubmit.ts +++ b/src/hooks/useSubmit/useSubmit.ts @@ -211,4 +211,4 @@ const useSubmitWithSign = ( } export default useSubmit -export { useSubmitWithSign, useSubmitWithSignWithParamKeyPair } +export { useSubmitWithSign } diff --git a/src/hooks/useSubmit/utils.ts b/src/hooks/useSubmit/utils.ts index 51e0eafa8b..9298877f6f 100644 --- a/src/hooks/useSubmit/utils.ts +++ b/src/hooks/useSubmit/utils.ts @@ -12,7 +12,7 @@ import { Chain, Chains, supportedChains } from "wagmiConfig/chains" import { DEFAULT_MESSAGE } from "./constants" import { FuelSignProps, MessageParams, SignProps, Validation } from "./types" -export const signWithKeyPair = (keyPair: CryptoKeyPair, params: MessageParams) => +const signWithKeyPair = (keyPair: CryptoKeyPair, params: MessageParams) => window.crypto.subtle .sign( { name: "ECDSA", hash: "SHA-512" }, @@ -34,7 +34,7 @@ export const getMessage = ({ chainId ? `\nChainId: ${chainId}` : "" }${hash ? `\nHash: ${hash}` : ""}\nNonce: ${nonce}\nTimestamp: ${ts}` -export const createMessageParams = ( +const createMessageParams = ( address: `0x${string}`, ts: number, msg: string, @@ -104,7 +104,7 @@ export const sign = async ({ return [payload, { params, sig }] } -export const chainsOfAddressWithDeployedContract = async ( +const chainsOfAddressWithDeployedContract = async ( address: `0x${string}` ): Promise => { const LOCALSTORAGE_KEY = `chainsWithByteCode_${address.toLowerCase()}` diff --git a/src/hooks/useTokens.ts b/src/hooks/useTokens.ts index 033e6b5aac..5e8c1aa6ef 100644 --- a/src/hooks/useTokens.ts +++ b/src/hooks/useTokens.ts @@ -12,7 +12,7 @@ type CoingeckoToken = { logoURI: string } -export const TokenApiURLs: Record = { +const TokenApiURLs: Record = { ETHEREUM: ["https://tokens.coingecko.com/uniswap/all.json"], BSC: ["https://tokens.coingecko.com/binance-smart-chain/all.json"], GNOSIS: [ diff --git a/src/hooks/useUniqueMembers.ts b/src/hooks/useUniqueMembers.ts deleted file mode 100644 index e41c62eb2a..0000000000 --- a/src/hooks/useUniqueMembers.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { useMemo } from "react" -import { Role } from "types" - -const useUniqueMembers = (roles: Role[], additionalMembers: string[] = []) => - useMemo(() => { - const allMembers = (roles?.flatMap((role) => role.members) ?? []).concat( - additionalMembers - ) - const uniqueMembers = [...new Set(allMembers)] - const r = uniqueMembers?.filter((member) => typeof member === "string") - return r - }, [roles, additionalMembers]) - -export default useUniqueMembers diff --git a/src/requirements/CoinbaseEAS/CoinbaseEASForm.tsx b/src/requirements/CoinbaseEAS/CoinbaseEASForm.tsx index 22c4deaf13..d9d4f8f2d7 100644 --- a/src/requirements/CoinbaseEAS/CoinbaseEASForm.tsx +++ b/src/requirements/CoinbaseEAS/CoinbaseEASForm.tsx @@ -15,10 +15,10 @@ import parseFromObject from "utils/parseFromObject" import { countryCodes } from "./countryCodes" const VERIFICATIONS_COINBASE_ETH = "0x357458739F90461b99789350868CD7CF330Dd7EE" +const EAS_CB_VERIFIED_COUNTRY_SCHEMA_ID = + "0x1801901fabd0e6189356b4fb52bb0ab855276d84f7ec140839fbd1f6801ca065" export const EAS_CB_VERIFIED_ACCOUNT_SCHEMA_ID = "0xf8b05c79f090979bf4a80270aba232dff11a10d9ca55c4f88de95317970f0de9" -export const EAS_CB_VERIFIED_COUNTRY_SCHEMA_ID = - "0x1801901fabd0e6189356b4fb52bb0ab855276d84f7ec140839fbd1f6801ca065" const options: SelectOption[] = [ { diff --git a/src/requirements/Nft/components/UploadIDs.tsx b/src/requirements/Nft/components/UploadIDs.tsx index 0f08572c9d..ecb5950b15 100644 --- a/src/requirements/Nft/components/UploadIDs.tsx +++ b/src/requirements/Nft/components/UploadIDs.tsx @@ -2,7 +2,7 @@ import { File } from "@phosphor-icons/react" import Button from "components/common/Button" import useDropzone from "hooks/useDropzone" -export const INVALID_TOKEN_IDS_ERROR = { +const INVALID_TOKEN_IDS_ERROR = { type: "validate", message: "Token IDs must only contain numbers", } diff --git a/src/requirements/Nft/providedValue/NftAmountProvidedValue.tsx b/src/requirements/Nft/providedValue/NftAmountProvidedValue.tsx index 89d99ad7e1..f6f8bcf2e3 100644 --- a/src/requirements/Nft/providedValue/NftAmountProvidedValue.tsx +++ b/src/requirements/Nft/providedValue/NftAmountProvidedValue.tsx @@ -7,7 +7,7 @@ import { isGuildPinSupportedChain } from "utils/guildCheckout/utils" import { Chain } from "wagmiConfig/chains" import useNftMetadata, { useNftMetadataWithTraits } from "../hooks/useNftMetadata" -export function hasOnlyTypeProperty(obj) { +function hasOnlyTypeProperty(obj) { const keys = Object.keys(obj) return keys.length === 1 && keys[0] === "type" } diff --git a/src/requirements/Uniswap/hooks/useParsePoolChain.ts b/src/requirements/Uniswap/hooks/useParsePoolChain.ts index f6b273a362..68b2524983 100644 --- a/src/requirements/Uniswap/hooks/useParsePoolChain.ts +++ b/src/requirements/Uniswap/hooks/useParsePoolChain.ts @@ -3,7 +3,7 @@ import { useMemo } from "react" import { useWatch } from "react-hook-form" export const UNISWAP_POOL_URL = /https:\/\/app\.uniswap\.org\/pools\/([0-9]+)/i -export const UNISWAP_POOL_EXPLORER_URL = +const UNISWAP_POOL_EXPLORER_URL = /^https:\/\/app\.uniswap\.org\/explore\/pools\/([^\/]+)\// export type UniswapChains = (typeof consts.UniswapV3PositionsChains)[number] diff --git a/src/requirements/Unlock/UnlockForm.tsx b/src/requirements/Unlock/UnlockForm.tsx index 4bd36d9d28..6ac883af7d 100644 --- a/src/requirements/Unlock/UnlockForm.tsx +++ b/src/requirements/Unlock/UnlockForm.tsx @@ -91,5 +91,4 @@ const UnlockForm = ({ baseFieldPath }: RequirementFormProps): JSX.Element => { ) } -export { supportedChains as unlockSupportedChains } export default UnlockForm diff --git a/src/requirements/WalletActivity/WalletActivityForm.tsx b/src/requirements/WalletActivity/WalletActivityForm.tsx index 1e7661373f..ba09bd929a 100644 --- a/src/requirements/WalletActivity/WalletActivityForm.tsx +++ b/src/requirements/WalletActivity/WalletActivityForm.tsx @@ -16,7 +16,7 @@ import CovalentTxCount from "./components/CovalentTxCount" import CovalentTxCountRelative from "./components/CovalentTxCountRelative" // These can be extended for additional Covalent support -export const COVALENT_CHAINS = new Set([ +const COVALENT_CHAINS = new Set([ "ETHEREUM", "POLYGON", "POLYGON_ZKEVM", diff --git a/src/requirements/Web3Inbox/Web3InboxForm.tsx b/src/requirements/Web3Inbox/Web3InboxForm.tsx index 8259c323a5..e24c005bfb 100644 --- a/src/requirements/Web3Inbox/Web3InboxForm.tsx +++ b/src/requirements/Web3Inbox/Web3InboxForm.tsx @@ -11,7 +11,7 @@ import { useFormState, useWatch } from "react-hook-form" import { RequirementFormProps } from "requirements/types" import parseFromObject from "utils/parseFromObject" -export const WEB3INBOX_APPS = ["GUILD", "WEB3INBOX", "SHEFI"] as const +const WEB3INBOX_APPS = ["GUILD", "WEB3INBOX", "SHEFI"] as const export const APP_DETAILS: Record< (typeof WEB3INBOX_APPS)[number], { diff --git a/src/requirements/index.ts b/src/requirements/index.ts index 73a31c4db0..2cb3c24941 100644 --- a/src/requirements/index.ts +++ b/src/requirements/index.ts @@ -1,4 +1,4 @@ -import REQUIREMENTS_DATA from "./requirements" +import { REQUIREMENTS_DATA } from "./requirements" import { RequirementData, RequirementType } from "./types" // transform it to an object with types as keys so we don't have to use .find() every time diff --git a/src/requirements/requirements.ts b/src/requirements/requirements.ts index e2c68a6232..33288ef7e9 100644 --- a/src/requirements/requirements.ts +++ b/src/requirements/requirements.ts @@ -339,5 +339,3 @@ export const REQUIREMENTS_DATA = [ isNegatable: true, }, ] as const satisfies RequirementData[] - -export default REQUIREMENTS_DATA diff --git a/src/rewards/hooks/usePlatformUsageInfo.ts b/src/rewards/hooks/usePlatformUsageInfo.ts deleted file mode 100644 index 988424571f..0000000000 --- a/src/rewards/hooks/usePlatformUsageInfo.ts +++ /dev/null @@ -1,30 +0,0 @@ -import useGuild from "components/[guild]/hooks/useGuild" -import useSWRWithOptionalAuth from "hooks/useSWRWithOptionalAuth" -import { Guild, PlatformName } from "types" - -const usePlatformUsageInfo = ( - platform: PlatformName, - platformId: string -): { - isAlreadyInUse: boolean - isUsedInCurrentGuild: boolean - guildUrlName?: string - isValidating: boolean -} => { - const { urlName } = useGuild() - const shouldFetch = platformId?.length > 0 - const { data: guildByPlatform, isValidating } = useSWRWithOptionalAuth< - Partial - >(shouldFetch ? `/v2/platforms/${platform}/guilds/${platformId}` : null, { - shouldRetryOnError: false, - }) - - return { - isAlreadyInUse: !!guildByPlatform?.id, - isUsedInCurrentGuild: !!guildByPlatform && urlName === guildByPlatform.urlName, - guildUrlName: guildByPlatform?.urlName, - isValidating, - } -} - -export default usePlatformUsageInfo diff --git a/src/static/abis/gnosisSafeL2.ts b/src/static/abis/gnosisSafeL2.ts deleted file mode 100644 index 94f6c14d26..0000000000 --- a/src/static/abis/gnosisSafeL2.ts +++ /dev/null @@ -1,684 +0,0 @@ -const gnosisSafeL2Abi = [ - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "AddedOwner", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "approvedHash", - type: "bytes32", - }, - { - indexed: true, - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "ApproveHash", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "handler", - type: "address", - }, - ], - name: "ChangedFallbackHandler", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "guard", - type: "address", - }, - ], - name: "ChangedGuard", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "threshold", - type: "uint256", - }, - ], - name: "ChangedThreshold", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "module", - type: "address", - }, - ], - name: "DisabledModule", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "module", - type: "address", - }, - ], - name: "EnabledModule", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "bytes32", - name: "txHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "uint256", - name: "payment", - type: "uint256", - }, - ], - name: "ExecutionFailure", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "module", - type: "address", - }, - ], - name: "ExecutionFromModuleFailure", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "module", - type: "address", - }, - ], - name: "ExecutionFromModuleSuccess", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "bytes32", - name: "txHash", - type: "bytes32", - }, - { - indexed: false, - internalType: "uint256", - name: "payment", - type: "uint256", - }, - ], - name: "ExecutionSuccess", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "RemovedOwner", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "module", - type: "address", - }, - { - indexed: false, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "value", - type: "uint256", - }, - { indexed: false, internalType: "bytes", name: "data", type: "bytes" }, - { - indexed: false, - internalType: "enum Enum.Operation", - name: "operation", - type: "uint8", - }, - ], - name: "SafeModuleTransaction", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "to", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "value", - type: "uint256", - }, - { indexed: false, internalType: "bytes", name: "data", type: "bytes" }, - { - indexed: false, - internalType: "enum Enum.Operation", - name: "operation", - type: "uint8", - }, - { - indexed: false, - internalType: "uint256", - name: "safeTxGas", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "baseGas", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "gasPrice", - type: "uint256", - }, - { - indexed: false, - internalType: "address", - name: "gasToken", - type: "address", - }, - { - indexed: false, - internalType: "address payable", - name: "refundReceiver", - type: "address", - }, - { - indexed: false, - internalType: "bytes", - name: "signatures", - type: "bytes", - }, - { - indexed: false, - internalType: "bytes", - name: "additionalInfo", - type: "bytes", - }, - ], - name: "SafeMultiSigTransaction", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "sender", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "value", - type: "uint256", - }, - ], - name: "SafeReceived", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "initiator", - type: "address", - }, - { - indexed: false, - internalType: "address[]", - name: "owners", - type: "address[]", - }, - { - indexed: false, - internalType: "uint256", - name: "threshold", - type: "uint256", - }, - { - indexed: false, - internalType: "address", - name: "initializer", - type: "address", - }, - { - indexed: false, - internalType: "address", - name: "fallbackHandler", - type: "address", - }, - ], - name: "SafeSetup", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "bytes32", - name: "msgHash", - type: "bytes32", - }, - ], - name: "SignMsg", - type: "event", - }, - { stateMutability: "nonpayable", type: "fallback" }, - { - inputs: [], - name: "VERSION", - outputs: [{ internalType: "string", name: "", type: "string" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "owner", type: "address" }, - { internalType: "uint256", name: "_threshold", type: "uint256" }, - ], - name: "addOwnerWithThreshold", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "bytes32", name: "hashToApprove", type: "bytes32" }], - name: "approveHash", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "", type: "address" }, - { internalType: "bytes32", name: "", type: "bytes32" }, - ], - name: "approvedHashes", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint256", name: "_threshold", type: "uint256" }], - name: "changeThreshold", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "bytes32", name: "dataHash", type: "bytes32" }, - { internalType: "bytes", name: "data", type: "bytes" }, - { internalType: "bytes", name: "signatures", type: "bytes" }, - { internalType: "uint256", name: "requiredSignatures", type: "uint256" }, - ], - name: "checkNSignatures", - outputs: [], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "bytes32", name: "dataHash", type: "bytes32" }, - { internalType: "bytes", name: "data", type: "bytes" }, - { internalType: "bytes", name: "signatures", type: "bytes" }, - ], - name: "checkSignatures", - outputs: [], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "prevModule", type: "address" }, - { internalType: "address", name: "module", type: "address" }, - ], - name: "disableModule", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "domainSeparator", - outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "module", type: "address" }], - name: "enableModule", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "to", type: "address" }, - { internalType: "uint256", name: "value", type: "uint256" }, - { internalType: "bytes", name: "data", type: "bytes" }, - { - internalType: "enum Enum.Operation", - name: "operation", - type: "uint8", - }, - { internalType: "uint256", name: "safeTxGas", type: "uint256" }, - { internalType: "uint256", name: "baseGas", type: "uint256" }, - { internalType: "uint256", name: "gasPrice", type: "uint256" }, - { internalType: "address", name: "gasToken", type: "address" }, - { internalType: "address", name: "refundReceiver", type: "address" }, - { internalType: "uint256", name: "_nonce", type: "uint256" }, - ], - name: "encodeTransactionData", - outputs: [{ internalType: "bytes", name: "", type: "bytes" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "to", type: "address" }, - { internalType: "uint256", name: "value", type: "uint256" }, - { internalType: "bytes", name: "data", type: "bytes" }, - { - internalType: "enum Enum.Operation", - name: "operation", - type: "uint8", - }, - { internalType: "uint256", name: "safeTxGas", type: "uint256" }, - { internalType: "uint256", name: "baseGas", type: "uint256" }, - { internalType: "uint256", name: "gasPrice", type: "uint256" }, - { internalType: "address", name: "gasToken", type: "address" }, - { - internalType: "address payable", - name: "refundReceiver", - type: "address", - }, - { internalType: "bytes", name: "signatures", type: "bytes" }, - ], - name: "execTransaction", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "payable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "to", type: "address" }, - { internalType: "uint256", name: "value", type: "uint256" }, - { internalType: "bytes", name: "data", type: "bytes" }, - { internalType: "enum Enum.Operation", name: "operation", type: "uint8" }, - ], - name: "execTransactionFromModule", - outputs: [{ internalType: "bool", name: "success", type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "to", type: "address" }, - { internalType: "uint256", name: "value", type: "uint256" }, - { internalType: "bytes", name: "data", type: "bytes" }, - { internalType: "enum Enum.Operation", name: "operation", type: "uint8" }, - ], - name: "execTransactionFromModuleReturnData", - outputs: [ - { internalType: "bool", name: "success", type: "bool" }, - { internalType: "bytes", name: "returnData", type: "bytes" }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "getChainId", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "start", type: "address" }, - { internalType: "uint256", name: "pageSize", type: "uint256" }, - ], - name: "getModulesPaginated", - outputs: [ - { internalType: "address[]", name: "array", type: "address[]" }, - { internalType: "address", name: "next", type: "address" }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getOwners", - outputs: [{ internalType: "address[]", name: "", type: "address[]" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "offset", type: "uint256" }, - { internalType: "uint256", name: "length", type: "uint256" }, - ], - name: "getStorageAt", - outputs: [{ internalType: "bytes", name: "", type: "bytes" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getThreshold", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "to", type: "address" }, - { internalType: "uint256", name: "value", type: "uint256" }, - { internalType: "bytes", name: "data", type: "bytes" }, - { - internalType: "enum Enum.Operation", - name: "operation", - type: "uint8", - }, - { internalType: "uint256", name: "safeTxGas", type: "uint256" }, - { internalType: "uint256", name: "baseGas", type: "uint256" }, - { internalType: "uint256", name: "gasPrice", type: "uint256" }, - { internalType: "address", name: "gasToken", type: "address" }, - { internalType: "address", name: "refundReceiver", type: "address" }, - { internalType: "uint256", name: "_nonce", type: "uint256" }, - ], - name: "getTransactionHash", - outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "module", type: "address" }], - name: "isModuleEnabled", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "owner", type: "address" }], - name: "isOwner", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "nonce", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "prevOwner", type: "address" }, - { internalType: "address", name: "owner", type: "address" }, - { internalType: "uint256", name: "_threshold", type: "uint256" }, - ], - name: "removeOwner", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "to", type: "address" }, - { internalType: "uint256", name: "value", type: "uint256" }, - { internalType: "bytes", name: "data", type: "bytes" }, - { internalType: "enum Enum.Operation", name: "operation", type: "uint8" }, - ], - name: "requiredTxGas", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "handler", type: "address" }], - name: "setFallbackHandler", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "guard", type: "address" }], - name: "setGuard", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address[]", name: "_owners", type: "address[]" }, - { internalType: "uint256", name: "_threshold", type: "uint256" }, - { internalType: "address", name: "to", type: "address" }, - { internalType: "bytes", name: "data", type: "bytes" }, - { internalType: "address", name: "fallbackHandler", type: "address" }, - { internalType: "address", name: "paymentToken", type: "address" }, - { internalType: "uint256", name: "payment", type: "uint256" }, - { - internalType: "address payable", - name: "paymentReceiver", - type: "address", - }, - ], - name: "setup", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], - name: "signedMessages", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "targetContract", type: "address" }, - { internalType: "bytes", name: "calldataPayload", type: "bytes" }, - ], - name: "simulateAndRevert", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "prevOwner", type: "address" }, - { internalType: "address", name: "oldOwner", type: "address" }, - { internalType: "address", name: "newOwner", type: "address" }, - ], - name: "swapOwner", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { stateMutability: "payable", type: "receive" }, -] as const - -export default gnosisSafeL2Abi diff --git a/src/static/abis/uniswapV3Factory.ts b/src/static/abis/uniswapV3Factory.ts deleted file mode 100644 index 54f2374bd3..0000000000 --- a/src/static/abis/uniswapV3Factory.ts +++ /dev/null @@ -1,99 +0,0 @@ -const UNISWAP_V3_FACTORY_ABI = [ - { inputs: [], stateMutability: "nonpayable", type: "constructor" }, - { - anonymous: false, - inputs: [ - { indexed: true, internalType: "uint24", name: "fee", type: "uint24" }, - { indexed: true, internalType: "int24", name: "tickSpacing", type: "int24" }, - ], - name: "FeeAmountEnabled", - type: "event", - }, - { - anonymous: false, - inputs: [ - { indexed: true, internalType: "address", name: "oldOwner", type: "address" }, - { indexed: true, internalType: "address", name: "newOwner", type: "address" }, - ], - name: "OwnerChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { indexed: true, internalType: "address", name: "token0", type: "address" }, - { indexed: true, internalType: "address", name: "token1", type: "address" }, - { indexed: true, internalType: "uint24", name: "fee", type: "uint24" }, - { indexed: false, internalType: "int24", name: "tickSpacing", type: "int24" }, - { indexed: false, internalType: "address", name: "pool", type: "address" }, - ], - name: "PoolCreated", - type: "event", - }, - { - inputs: [ - { internalType: "address", name: "tokenA", type: "address" }, - { internalType: "address", name: "tokenB", type: "address" }, - { internalType: "uint24", name: "fee", type: "uint24" }, - ], - name: "createPool", - outputs: [{ internalType: "address", name: "pool", type: "address" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "uint24", name: "fee", type: "uint24" }, - { internalType: "int24", name: "tickSpacing", type: "int24" }, - ], - name: "enableFeeAmount", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "uint24", name: "", type: "uint24" }], - name: "feeAmountTickSpacing", - outputs: [{ internalType: "int24", name: "", type: "int24" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "", type: "address" }, - { internalType: "address", name: "", type: "address" }, - { internalType: "uint24", name: "", type: "uint24" }, - ], - name: "getPool", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "parameters", - outputs: [ - { internalType: "address", name: "factory", type: "address" }, - { internalType: "address", name: "token0", type: "address" }, - { internalType: "address", name: "token1", type: "address" }, - { internalType: "uint24", name: "fee", type: "uint24" }, - { internalType: "int24", name: "tickSpacing", type: "int24" }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "_owner", type: "address" }], - name: "setOwner", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, -] as const diff --git a/src/utils/guildCheckout/constants.ts b/src/utils/guildCheckout/constants.ts index ffee3eadf1..6334bb697d 100644 --- a/src/utils/guildCheckout/constants.ts +++ b/src/utils/guildCheckout/constants.ts @@ -84,17 +84,8 @@ export const ZEROX_API_URLS: Partial< SEPOLIA: "https://sepolia.api.0x.org", } -export const RESERVOIR_API_URLS: Partial> = { - // ETHEREUM: "https://api.reservoir.tools", - // GOERLI: "https://api-goerli.reservoir.tools", - // POLYGON: "https://api-polygon.reservoir.tools", - // OPTIMISM: "https://api-optimism.reservoir.tools", -} - export const purchaseSupportedChains: Partial> = { ERC20: Object.keys(ZEROX_API_URLS), - ERC721: Object.keys(RESERVOIR_API_URLS), - ERC1155: Object.keys(RESERVOIR_API_URLS), } export const allPurchaseSupportedChains: Chain[] = [ @@ -135,7 +126,7 @@ export type PurchaseAssetData = { export type BuyTokenType = "COIN" | "ERC20" // amount: bigint, expiration: bigint, nonce: bigint, spender: string, sigDeadline: bigint, data: Uint8Array -export const permit2PermitFakeParams = [ +const permit2PermitFakeParams = [ BigInt("1461501637330902918203684832716283019655932542975"), BigInt("1706751423"), BigInt(0), diff --git a/src/utils/joinWithUniqueLastSeparator.ts b/src/utils/joinWithUniqueLastSeparator.ts deleted file mode 100644 index 7ec23e37c7..0000000000 --- a/src/utils/joinWithUniqueLastSeparator.ts +++ /dev/null @@ -1,14 +0,0 @@ -const joinWithUniqueLastSeparator = ( - array: string[], - separator = ", ", - lastSeparator = " and " -) => - array.reduce( - (acc, item, i, arr) => - `${acc}${item}${ - i === arr.length - 1 ? "" : i === arr.length - 2 ? lastSeparator : separator - }`, - "" - ) - -export default joinWithUniqueLastSeparator diff --git a/src/utils/mapRealRequirementIdToRolePlatform.ts b/src/utils/mapRealRequirementIdToRolePlatform.ts index b5012c985a..1ccfc49516 100644 --- a/src/utils/mapRealRequirementIdToRolePlatform.ts +++ b/src/utils/mapRealRequirementIdToRolePlatform.ts @@ -8,7 +8,7 @@ type Props = { onMissingId?: () => void } -export const mapRealRequirementIdToRolePlatform = ({ +const mapRealRequirementIdToRolePlatform = ({ rolePlatform, requirementIdMap, roleId, diff --git a/src/utils/msToDayHourMinute.ts b/src/utils/msToDayHourMinute.ts deleted file mode 100644 index 751008434d..0000000000 --- a/src/utils/msToDayHourMinute.ts +++ /dev/null @@ -1,18 +0,0 @@ -const MINUTE_IN_MS = 60 * 1000 -const HOUR_IN_MS = 60 * MINUTE_IN_MS -const DAY_IN_MS = 24 * HOUR_IN_MS -const UNIT_LABELS = ["day", "hour", "minute"] - -const msToDayHourMinute = (ms: number) => { - let msToWorkWith = ms - const days = Math.floor(msToWorkWith / DAY_IN_MS) - msToWorkWith -= days * DAY_IN_MS - const hours = Math.floor(msToWorkWith / HOUR_IN_MS) - msToWorkWith -= hours * HOUR_IN_MS - const minutes = Math.ceil(msToWorkWith / MINUTE_IN_MS) - - return [days, hours, minutes] -} - -export { UNIT_LABELS } -export default msToDayHourMinute diff --git a/src/utils/newNamedError.ts b/src/utils/newNamedError.ts deleted file mode 100644 index 8b994eece1..0000000000 --- a/src/utils/newNamedError.ts +++ /dev/null @@ -1,6 +0,0 @@ -const newNamedError = (name: string, message: string) => { - const error = new Error(message) - error.name = name - return error -} -export default newNamedError diff --git a/src/utils/numberToOrdinal.ts b/src/utils/numberToOrdinal.ts deleted file mode 100644 index e19ef3b66c..0000000000 --- a/src/utils/numberToOrdinal.ts +++ /dev/null @@ -1,19 +0,0 @@ -export default function numberToOrdinal(num: number): string { - const lastDigit = num % 10 - const lastTwoDigits = num % 100 - - if (lastTwoDigits === 11 || lastTwoDigits === 12 || lastTwoDigits === 13) { - return `${num}th` - } - - switch (lastDigit) { - case 1: - return `${num}st` - case 2: - return `${num}nd` - case 3: - return `${num}rd` - default: - return `${num}th` - } -} diff --git a/src/utils/parseFuelAddress.ts b/src/utils/parseFuelAddress.ts index 68322dd05f..e8d9b1bd8b 100644 --- a/src/utils/parseFuelAddress.ts +++ b/src/utils/parseFuelAddress.ts @@ -8,5 +8,3 @@ export function parseFuelAddress(bech32?: string): `0x${string}` | undefined { return undefined } } - -export default parseFuelAddress diff --git a/src/utils/rolePlatformHelpers.ts b/src/utils/rolePlatformHelpers.ts index abbc38e0a0..097d68aeff 100644 --- a/src/utils/rolePlatformHelpers.ts +++ b/src/utils/rolePlatformHelpers.ts @@ -36,6 +36,3 @@ export const getRolePlatformTimeframeInfo = ( return { isAvailable, startTimeDiff, endTimeDiff } } - -// eslint-disable-next-line import/no-anonymous-default-export -export default { getRolePlatformStatus, getRolePlatformTimeframeInfo } diff --git a/src/v2/components/Web3ConnectionManager/Web3ConnectionManager.tsx b/src/v2/components/Web3ConnectionManager/Web3ConnectionManager.tsx index 9af7e50190..7c97cb0b8f 100644 --- a/src/v2/components/Web3ConnectionManager/Web3ConnectionManager.tsx +++ b/src/v2/components/Web3ConnectionManager/Web3ConnectionManager.tsx @@ -4,7 +4,7 @@ import { walletSelectorModalAtom } from "../Providers/atoms" import { PlatformMergeErrorAlert } from "./PlatformMergeErrorAlert" import WalletLinkHelperModal from "./WalletLinkHelperModal" import WalletSelectorModal from "./WalletSelectorModal" -import useConnectFromLocalStorage from "./hooks/useConnectFromLocalStorage" +import { useConnectFromLocalStorage } from "./hooks/useConnectFromLocalStorage" import { useTriggerWalletSelectorModal } from "./hooks/useTriggerWalletSelectorModal" export function Web3ConnectionManagerBase() { diff --git a/src/v2/components/Web3ConnectionManager/hooks/useConnectFromLocalStorage.ts b/src/v2/components/Web3ConnectionManager/hooks/useConnectFromLocalStorage.ts index d5b89d68e1..eda14c9554 100644 --- a/src/v2/components/Web3ConnectionManager/hooks/useConnectFromLocalStorage.ts +++ b/src/v2/components/Web3ConnectionManager/hooks/useConnectFromLocalStorage.ts @@ -1,7 +1,7 @@ import { usePostHogContext } from "@/components/Providers/PostHogProvider" import { useToast } from "@/components/ui/hooks/useToast" -import type { Message } from "@/hooks/useOauthPopupWindow" import { useUserPublic } from "@/hooks/useUserPublic" +import { Message } from "@app/oauth/types" import { useConnect } from "components/[guild]/JoinModal/hooks/useConnectPlatform" import useUser from "components/[guild]/hooks/useUser" import { useEffect } from "react" @@ -57,4 +57,4 @@ const useConnectFromLocalStorage = () => { }, [keyPair, platformUsers, onSubmit, toast, captureEvent]) } -export default useConnectFromLocalStorage +export { useConnectFromLocalStorage } diff --git a/src/v2/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager.ts b/src/v2/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager.ts index 8ad19307dd..0296e8aa6c 100644 --- a/src/v2/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager.ts +++ b/src/v2/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager.ts @@ -7,7 +7,7 @@ import { import { UserProfile } from "@guildxyz/types" import { atom, useAtom } from "jotai" import { useEffect } from "react" -import parseFuelAddress from "utils/parseFuelAddress" +import { parseFuelAddress } from "utils/parseFuelAddress" import { useAccount, useDisconnect, useSignMessage } from "wagmi" const safeContextAtom = atom(false) diff --git a/src/v2/components/ui/AlertDialog.tsx b/src/v2/components/ui/AlertDialog.tsx index e6d27dbe69..7a217cacd2 100644 --- a/src/v2/components/ui/AlertDialog.tsx +++ b/src/v2/components/ui/AlertDialog.tsx @@ -132,8 +132,6 @@ export { AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, - AlertDialogOverlay, - AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, } diff --git a/src/v2/components/ui/Badge.tsx b/src/v2/components/ui/Badge.tsx index 2818a1391e..3e574134ef 100644 --- a/src/v2/components/ui/Badge.tsx +++ b/src/v2/components/ui/Badge.tsx @@ -51,4 +51,4 @@ const Badge = forwardRef, BadgeProps>( ) ) -export { Badge, badgeVariants } +export { Badge } diff --git a/src/v2/components/ui/Card.tsx b/src/v2/components/ui/Card.tsx index ffdbb82e21..6d8d28bac6 100644 --- a/src/v2/components/ui/Card.tsx +++ b/src/v2/components/ui/Card.tsx @@ -1,12 +1,16 @@ import { cn } from "@/lib/utils" import { HTMLAttributes, forwardRef } from "react" -export const cardClassName = - "overflow-hidden rounded-2xl bg-card text-card-foreground shadow-md" - const Card = forwardRef>( ({ className, ...props }, ref) => ( -
+
) ) Card.displayName = "Card" diff --git a/src/v2/components/ui/Dialog.tsx b/src/v2/components/ui/Dialog.tsx index 345f257c69..da3eecbedc 100644 --- a/src/v2/components/ui/Dialog.tsx +++ b/src/v2/components/ui/Dialog.tsx @@ -182,8 +182,6 @@ export { DialogDescription, DialogFooter, DialogHeader, - DialogOverlay, - DialogPortal, DialogTitle, DialogTrigger, } diff --git a/src/v2/components/ui/hooks/useToast.ts b/src/v2/components/ui/hooks/useToast.ts index 7d2fa818d3..5f9a52cbf4 100644 --- a/src/v2/components/ui/hooks/useToast.ts +++ b/src/v2/components/ui/hooks/useToast.ts @@ -69,7 +69,7 @@ const addToRemoveQueue = (toastId: string) => { toastTimeouts.set(toastId, timeout) } -export const reducer = (state: State, action: Action): State => { +const reducer = (state: State, action: Action): State => { switch (action.type) { case "ADD_TOAST": return { diff --git a/src/v2/hooks/useOauthPopupWindow.ts b/src/v2/hooks/useOauthPopupWindow.ts index afc10dd7c0..e69de29bb2 100644 --- a/src/v2/hooks/useOauthPopupWindow.ts +++ b/src/v2/hooks/useOauthPopupWindow.ts @@ -1,136 +0,0 @@ -import { useToast } from "@/components/ui/hooks/useToast" -import usePopupWindow from "hooks/usePopupWindow" -import randomBytes from "randombytes" -import { useEffect, useState } from "react" -import { OneOf, PlatformName } from "types" - -type OAuthData = { - redirect_url: string - scope?: string -} & Data - -type OAuthError = { error: string; errorDescription: string } - -export type Message = OneOf< - { type: "OAUTH_ERROR"; data: OAuthError }, - { type: "OAUTH_SUCCESS"; data: any } -> - -type OAuthState = { - error: OAuthError - authData: OAuthData - isAuthenticating: boolean -} - -const useOauthPopupWindow = ( - platformName: PlatformName, - url: string, - params: Record -): OAuthState & { - onOpen: () => Promise> -} => { - const { toast } = useToast() - - const redirectUri = - typeof window !== "undefined" && - `${window.location.href.split("/").slice(0, 3).join("/")}/oauth` - - params.response_type = params.response_type ?? "code" - - const { onOpen } = usePopupWindow() - - const [oauthState, setOauthState] = useState>({ - error: null, - authData: null, - isAuthenticating: false, - }) - - const oauthPopupHandler = async () => { - let result: OAuthState = { - isAuthenticating: true, - authData: null, - error: null, - } - setOauthState(result) - - const csrfToken = randomBytes(32).toString("hex") - const localStorageKey = `${platformName}_oauthinfo` - - const infoToPassInLocalStorage = { - csrfToken, - from: window.location.toString(), - platformName, - redirect_url: redirectUri, - scope: params.scope ?? "", - } - - window.localStorage.setItem( - localStorageKey, - JSON.stringify(infoToPassInLocalStorage) - ) - - const channel = new BroadcastChannel( - platformName === "TWITTER_V1" ? "TWITTER_V1" : csrfToken - ) - - const hasReceivedResponse = new Promise((resolve) => { - channel.onmessage = (event: MessageEvent) => { - const { type, data } = event.data - - if (type === "OAUTH_ERROR") { - result = { - isAuthenticating: false, - error: data, - authData: null, - } - setOauthState(result) - } else { - result = { - isAuthenticating: false, - error: null, - authData: data, - } - setOauthState(result) - } - - resolve() - } - }) - - const searchParams = new URLSearchParams({ - ...params, - redirect_uri: redirectUri, - state: `${platformName}-${csrfToken}`, - }).toString() - - onOpen(`${url}?${searchParams}`) - - await hasReceivedResponse.finally(() => { - channel.postMessage({ type: "OAUTH_CONFIRMATION" }) - window.localStorage.removeItem(localStorageKey) - // Close Broadcast Channel - channel.close() - }) - - return result - } - - useEffect(() => { - if (!oauthState.error) return - - const title = oauthState.error.error ?? "Unknown error" - const errorDescription = oauthState.error.errorDescription ?? "" - - toast({ variant: "error", title, description: errorDescription }) - - // toast is left out on purpose, it causes the toast to be shown twice - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [oauthState.error]) - - return { - ...oauthState, - onOpen: oauthPopupHandler, - } -} - -export default useOauthPopupWindow