From 21dc46172207cc73087a9b17a13a6411aa9bc465 Mon Sep 17 00:00:00 2001
From: bigint <69431456+bigint@users.noreply.github.com>
Date: Thu, 7 Dec 2023 19:44:55 +0530
Subject: [PATCH] Revert "feat: add tba support (#4105)"
This reverts commit a10f3dfa2390ae976f1a60cbd08ba1682ab63275.
---
.../Common/Providers/TbaStatusProvider.tsx | 23 ------------
.../src/components/Common/Providers/index.tsx | 2 --
apps/web/src/components/Profile/Details.tsx | 2 --
apps/web/src/components/Profile/TbaBadge.tsx | 36 -------------------
.../Manager/LensManager/ToggleLensManager.tsx | 5 +--
.../ProfileManager/AddProfileManager.tsx | 5 +--
apps/web/src/store/persisted/useAuthStore.ts | 3 +-
.../src/store/persisted/useTbaStatusStore.ts | 30 ----------------
packages/data/storage.ts | 1 -
packages/lib/api/getTbaStatus.ts | 31 ----------------
10 files changed, 3 insertions(+), 135 deletions(-)
delete mode 100644 apps/web/src/components/Common/Providers/TbaStatusProvider.tsx
delete mode 100644 apps/web/src/components/Profile/TbaBadge.tsx
delete mode 100644 apps/web/src/store/persisted/useTbaStatusStore.ts
delete mode 100644 packages/lib/api/getTbaStatus.ts
diff --git a/apps/web/src/components/Common/Providers/TbaStatusProvider.tsx b/apps/web/src/components/Common/Providers/TbaStatusProvider.tsx
deleted file mode 100644
index 132cdc14feac..000000000000
--- a/apps/web/src/components/Common/Providers/TbaStatusProvider.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import type { FC } from 'react';
-
-import getTbaStatus from '@hey/lib/api/getTbaStatus';
-import { useQuery } from '@tanstack/react-query';
-import useProfileStore from 'src/store/persisted/useProfileStore';
-import { useTbaStatusStore } from 'src/store/persisted/useTbaStatusStore';
-
-const TbaStatusProvider: FC = () => {
- const currentProfile = useProfileStore((state) => state.currentProfile);
- const setIsTba = useTbaStatusStore((state) => state.setIsTba);
-
- useQuery({
- queryFn: () =>
- getTbaStatus(currentProfile?.ownedBy.address, (deployed) =>
- setIsTba(deployed)
- ),
- queryKey: ['getTbaStatus', currentProfile?.ownedBy.address]
- });
-
- return null;
-};
-
-export default TbaStatusProvider;
diff --git a/apps/web/src/components/Common/Providers/index.tsx b/apps/web/src/components/Common/Providers/index.tsx
index 4f28ddb51fb3..f6f62487d627 100644
--- a/apps/web/src/components/Common/Providers/index.tsx
+++ b/apps/web/src/components/Common/Providers/index.tsx
@@ -18,7 +18,6 @@ import LeafwatchProvider from './LeafwatchProvider';
import LensSubscriptionsProvider from './LensSubscriptionsProvider';
import PreferencesProvider from './PreferencesProvider';
import ServiceWorkerProvider from './ServiceWorkerProvider';
-import TbaStatusProvider from './TbaStatusProvider';
import Web3Provider from './Web3Provider';
const lensApolloClient = apolloClient(authLink);
@@ -39,7 +38,6 @@ const Providers = ({ children }: { children: ReactNode }) => {
-
diff --git a/apps/web/src/components/Profile/Details.tsx b/apps/web/src/components/Profile/Details.tsx
index c5c7a02747d8..4ba4c5848386 100644
--- a/apps/web/src/components/Profile/Details.tsx
+++ b/apps/web/src/components/Profile/Details.tsx
@@ -49,7 +49,6 @@ import ProfileMenu from './Menu';
import MutualFollowers from './MutualFollowers';
import MutualFollowersList from './MutualFollowers/List';
import ScamWarning from './ScamWarning';
-import TbaBadge from './TbaBadge';
interface DetailsProps {
profile: Profile;
@@ -104,7 +103,6 @@ const Details: FC = ({ profile }) => {
) : null}
-
{hasMisused(profile.id) ? (
diff --git a/apps/web/src/components/Profile/TbaBadge.tsx b/apps/web/src/components/Profile/TbaBadge.tsx
deleted file mode 100644
index c8870b374067..000000000000
--- a/apps/web/src/components/Profile/TbaBadge.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import type { Profile } from '@hey/lens';
-import type { FC } from 'react';
-
-import { STATIC_IMAGES_URL } from '@hey/data/constants';
-import getTbaStatus from '@hey/lib/api/getTbaStatus';
-import { Tooltip } from '@hey/ui';
-import { useQuery } from '@tanstack/react-query';
-
-interface TbaBadgeProps {
- profile: Profile;
-}
-
-const TbaBadge: FC = ({ profile }) => {
- const { data: isTba } = useQuery({
- queryFn: () => getTbaStatus(profile.ownedBy.address),
- queryKey: ['getTbaStatus', profile.ownedBy.address]
- });
-
- if (!isTba) {
- return null;
- }
-
- return (
-
-
-
- );
-};
-
-export default TbaBadge;
diff --git a/apps/web/src/components/Settings/Manager/LensManager/ToggleLensManager.tsx b/apps/web/src/components/Settings/Manager/LensManager/ToggleLensManager.tsx
index 9254d424be0d..115817b0abb1 100644
--- a/apps/web/src/components/Settings/Manager/LensManager/ToggleLensManager.tsx
+++ b/apps/web/src/components/Settings/Manager/LensManager/ToggleLensManager.tsx
@@ -19,7 +19,6 @@ import { useState } from 'react';
import toast from 'react-hot-toast';
import { useNonceStore } from 'src/store/non-persisted/useNonceStore';
import useProfileStore from 'src/store/persisted/useProfileStore';
-import { hydrateTbaStatus } from 'src/store/persisted/useTbaStatusStore';
import { useContractWrite, useSignTypedData } from 'wagmi';
interface ToggleLensManagerProps {
@@ -37,8 +36,6 @@ const ToggleLensManager: FC = ({
(state) => state.setLensHubOnchainSigNonce
);
const [isLoading, setIsLoading] = useState(false);
-
- const { isTba } = hydrateTbaStatus();
const { canBroadcast, canUseSignless } =
checkDispatcherPermissions(currentProfile);
@@ -97,7 +94,7 @@ const ToggleLensManager: FC = ({
switchToGivenConfig
];
- if (!isTba && canBroadcast) {
+ if (canBroadcast) {
const { data } = await broadcastOnchain({
variables: { request: { id, signature } }
});
diff --git a/apps/web/src/components/Settings/Manager/ProfileManager/AddProfileManager.tsx b/apps/web/src/components/Settings/Manager/ProfileManager/AddProfileManager.tsx
index 579e0f322aee..672e85fc5199 100644
--- a/apps/web/src/components/Settings/Manager/ProfileManager/AddProfileManager.tsx
+++ b/apps/web/src/components/Settings/Manager/ProfileManager/AddProfileManager.tsx
@@ -21,7 +21,6 @@ import toast from 'react-hot-toast';
import useHandleWrongNetwork from 'src/hooks/useHandleWrongNetwork';
import { useNonceStore } from 'src/store/non-persisted/useNonceStore';
import useProfileStore from 'src/store/persisted/useProfileStore';
-import { hydrateTbaStatus } from 'src/store/persisted/useTbaStatusStore';
import { isAddress } from 'viem';
import { useContractWrite, useSignTypedData } from 'wagmi';
@@ -43,8 +42,6 @@ const AddProfileManager: FC = ({
const [isLoading, setIsLoading] = useState(false);
const handleWrongNetwork = useHandleWrongNetwork();
-
- const { isTba } = hydrateTbaStatus();
const { canBroadcast } = checkDispatcherPermissions(currentProfile);
const onCompleted = (__typename?: 'RelayError' | 'RelaySuccess') => {
@@ -102,7 +99,7 @@ const AddProfileManager: FC = ({
switchToGivenConfig
];
- if (!isTba && canBroadcast) {
+ if (canBroadcast) {
const signature = await signTypedDataAsync(getSignature(typedData));
const { data } = await broadcastOnchain({
variables: { request: { id, signature } }
diff --git a/apps/web/src/store/persisted/useAuthStore.ts b/apps/web/src/store/persisted/useAuthStore.ts
index 2c27c013c452..cba17b15f184 100644
--- a/apps/web/src/store/persisted/useAuthStore.ts
+++ b/apps/web/src/store/persisted/useAuthStore.ts
@@ -43,8 +43,7 @@ export const useAuthStore = create(
(value) =>
value !== IndexDB.AlgorithmStore &&
value !== IndexDB.VerifiedMembersStore &&
- value !== IndexDB.FeaturedGroupsStore &&
- value !== IndexDB.TBAStore
+ value !== IndexDB.FeaturedGroupsStore
);
await delMany(allIndexedDBStores);
}
diff --git a/apps/web/src/store/persisted/useTbaStatusStore.ts b/apps/web/src/store/persisted/useTbaStatusStore.ts
deleted file mode 100644
index 769bfb081de9..000000000000
--- a/apps/web/src/store/persisted/useTbaStatusStore.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { IndexDB } from '@hey/data/storage';
-import { create } from 'zustand';
-import { persist } from 'zustand/middleware';
-
-import createIdbStorage from '../lib/createIdbStorage';
-
-interface TbaStatusState {
- hydrateTbaStatus: () => { isTba: boolean };
- isTba: boolean;
- setIsTba: (isTba: boolean) => void;
-}
-
-export const useTbaStatusStore = create(
- persist(
- (set, get) => ({
- hydrateTbaStatus: () => {
- return { isTba: get().isTba };
- },
- isTba: false,
- setIsTba: (isTba) => set(() => ({ isTba }))
- }),
- {
- name: IndexDB.TBAStore,
- storage: createIdbStorage()
- }
- )
-);
-
-export const hydrateTbaStatus = () =>
- useTbaStatusStore.getState().hydrateTbaStatus();
diff --git a/packages/data/storage.ts b/packages/data/storage.ts
index b84ef0333461..2782e4278cb1 100644
--- a/packages/data/storage.ts
+++ b/packages/data/storage.ts
@@ -13,6 +13,5 @@ export const IndexDB = {
FeaturedGroupsStore: 'featuredgroups.store',
FeatureFlagsStore: 'featureflags.store',
ProfileStore: 'profile.store',
- TBAStore: 'tba.store',
VerifiedMembersStore: 'verifiedmembers.store'
};
diff --git a/packages/lib/api/getTbaStatus.ts b/packages/lib/api/getTbaStatus.ts
deleted file mode 100644
index 34865f2456e7..000000000000
--- a/packages/lib/api/getTbaStatus.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { HEY_API_URL } from '@hey/data/constants';
-import axios from 'axios';
-
-/**
- * Get TBA status of an address
- * @param address address
- * @param callbackFn callback function
- * @returns TBA status
- */
-const getTbaStatus = async (
- address: string,
- callbackFn?: (deployed: boolean) => void
-): Promise => {
- if (!address) {
- return false;
- }
-
- try {
- const response = await axios.get(`${HEY_API_URL}/tba/deployed`, {
- params: { address }
- });
- const { data } = response;
- callbackFn?.(data?.deployed || []);
-
- return data?.deployed || [];
- } catch (error) {
- throw error;
- }
-};
-
-export default getTbaStatus;