diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 129366df0a8a..2a0184b690bb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,12 +13,6 @@ updates: schedule: interval: "daily" - - package-ecosystem: "npm" - directory: "apps/pro" - target-branch: "main" - schedule: - interval: "daily" - # Packages - package-ecosystem: "npm" directory: "packages/abis" diff --git a/apps/pro/.env.example b/apps/pro/.env.example deleted file mode 100644 index 01ec50883c4c..000000000000 --- a/apps/pro/.env.example +++ /dev/null @@ -1 +0,0 @@ -DATABASE_URL="" diff --git a/apps/pro/.eslintrc.js b/apps/pro/.eslintrc.js deleted file mode 100644 index ac8818912f23..000000000000 --- a/apps/pro/.eslintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: ['weblint'] -}; diff --git a/apps/pro/next-env.d.ts b/apps/pro/next-env.d.ts deleted file mode 100644 index 4f11a03dc6cc..000000000000 --- a/apps/pro/next-env.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -/// - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/apps/pro/next.config.js b/apps/pro/next.config.js deleted file mode 100644 index e22630663fce..000000000000 --- a/apps/pro/next.config.js +++ /dev/null @@ -1,21 +0,0 @@ -/** @type {import('next').NextConfig} */ - -module.exports = { - reactStrictMode: false, - trailingSlash: false, - async rewrites() { - return [{ source: '/:path*', destination: '/api/:path*' }]; - }, - async headers() { - return [ - { - source: '/:path*', - headers: [ - { key: 'Access-Control-Allow-Origin', value: '*' }, - { key: 'Access-Control-Max-Age', value: '1728000' }, - { key: 'Access-Control-Allow-Headers', value: 'Content-Type' } - ] - } - ]; - } -}; diff --git a/apps/pro/package.json b/apps/pro/package.json deleted file mode 100644 index 48b5a65e1b2a..000000000000 --- a/apps/pro/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "pro", - "version": "0.0.0", - "private": true, - "scripts": { - "dev": "next dev --port 4785", - "build": "npx prisma generate; next build", - "start": "next start", - "typecheck": "tsc --noEmit", - "lint": "eslint . --ext .js,.ts,.tsx", - "db:push": "npx prisma db push", - "db:seed": "npx prisma db seed", - "db:studio": "npx prisma studio", - "db:format": "npx prisma format" - }, - "prisma": { - "seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts" - }, - "dependencies": { - "@prisma/client": "^4.6.1", - "dotenv": "^16.0.3", - "ethers": "^5.7.2", - "next": "^13.0.2", - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "devDependencies": { - "@types/react": "^18.0.23", - "@types/react-dom": "^18.0.9", - "eslint-config-weblint": "*", - "tsconfig": "*", - "typescript": "^4.9.3" - } -} diff --git a/apps/pro/prisma/schema.prisma b/apps/pro/prisma/schema.prisma deleted file mode 100644 index 606f73326b68..000000000000 --- a/apps/pro/prisma/schema.prisma +++ /dev/null @@ -1,17 +0,0 @@ -datasource db { - provider = "mysql" - url = env("DATABASE_URL") - referentialIntegrity = "prisma" -} - -generator client { - provider = "prisma-client-js" - previewFeatures = ["referentialIntegrity"] -} - -model User { - id String @id @default(uuid()) - userId String @unique - txHash String? - proExpiresAt DateTime? -} diff --git a/apps/pro/prisma/seed.ts b/apps/pro/prisma/seed.ts deleted file mode 100644 index 51caff32701e..000000000000 --- a/apps/pro/prisma/seed.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { PrismaClient } from '@prisma/client'; - -const prisma = new PrismaClient(); - -async function main() { - await prisma.user.upsert({ - where: { userId: '0x0d' }, - create: { - userId: '0x0d', - proExpiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365) - }, - update: { - proExpiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365) - } - }); -} - -main() - .catch((error) => { - console.error(error); - process.exit(1); - }) - .finally(async () => { - await prisma.$disconnect(); - }); diff --git a/apps/pro/src/abis/FeeCollector.ts b/apps/pro/src/abis/FeeCollector.ts deleted file mode 100644 index fc976cefe849..000000000000 --- a/apps/pro/src/abis/FeeCollector.ts +++ /dev/null @@ -1,45 +0,0 @@ -export const FeeCollector = [ - { - inputs: [], - stateMutability: 'nonpayable', - type: 'constructor' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: '_from', - type: 'address' - }, - { - indexed: false, - internalType: 'uint256', - name: '_amount', - type: 'uint256' - }, - { - indexed: false, - internalType: 'string', - name: '_userId', - type: 'string' - } - ], - name: 'PaidForLensterPro', - type: 'event' - }, - { - inputs: [ - { - internalType: 'string', - name: 'userId', - type: 'string' - } - ], - name: 'payForLensterPro', - outputs: [], - stateMutability: 'payable', - type: 'function' - } -]; diff --git a/apps/pro/src/pages/api/index.ts b/apps/pro/src/pages/api/index.ts deleted file mode 100644 index 10556bdb5836..000000000000 --- a/apps/pro/src/pages/api/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { NextApiRequest, NextApiResponse } from 'next'; - -const handler = async (req: NextApiRequest, res: NextApiResponse) => { - return res.setHeader('Content-Type', 'text/html').setHeader('Cache-Control', 's-maxage=86400').send('gm'); -}; - -export default handler; diff --git a/apps/pro/src/pages/api/user/[id].ts b/apps/pro/src/pages/api/user/[id].ts deleted file mode 100644 index 82829bd56006..000000000000 --- a/apps/pro/src/pages/api/user/[id].ts +++ /dev/null @@ -1,34 +0,0 @@ -import { PrismaClient } from '@prisma/client'; -import type { NextApiRequest, NextApiResponse } from 'next'; - -const prisma = new PrismaClient(); - -const handler = async (req: NextApiRequest, res: NextApiResponse) => { - if (req.method === 'GET') { - try { - const { id } = req.query; - if (id) { - const data = await prisma.user.findFirst({ - where: { userId: id as string } - }); - - // Set cache for 1 day - res.setHeader('Cache-Control', 's-maxage=86400'); - - if (data?.proExpiresAt) { - return res.status(200).json({ isPro: data?.proExpiresAt > new Date() }); - } - - return res.status(200).json({ isPro: false }); - } - - return res.status(200).json({ message: 'User ID is empty' }); - } catch (error) { - return res.status(500).json({ message: 'Something went wrong' }); - } - } else { - return res.status(405).json({ message: 'Method not allowed' }); - } -}; - -export default handler; diff --git a/apps/pro/src/pages/api/webhook.ts b/apps/pro/src/pages/api/webhook.ts deleted file mode 100644 index 3788977ca75c..000000000000 --- a/apps/pro/src/pages/api/webhook.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { PrismaClient } from '@prisma/client'; -import { ethers } from 'ethers'; -import type { NextApiRequest, NextApiResponse } from 'next'; -import { FeeCollector } from 'src/abis/FeeCollector'; - -const prisma = new PrismaClient(); - -const handler = async (req: NextApiRequest, res: NextApiResponse) => { - if (req.method === 'POST') { - try { - const { hash } = req.body.event.activity[0]; - const iface = new ethers.utils.Interface(FeeCollector); - const provider = new ethers.providers.JsonRpcProvider('https://rpc.ankr.com/polygon'); - const tx = await provider.getTransactionReceipt(hash); - const userId = JSON.parse(JSON.stringify(iface.parseLog(tx.logs[2]))).args[2]; - - const updateData = { proExpiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), txHash: hash }; - const data = await prisma.user.upsert({ - where: { userId }, - create: { userId, ...updateData }, - update: updateData - }); - - return res.status(200).json({ data }); - } catch (error) { - return res.status(500).json({ message: 'Something went wrong' }); - } - } else { - return res.status(405).json({ message: 'Method not allowed' }); - } -}; - -export default handler; diff --git a/apps/pro/tsconfig.json b/apps/pro/tsconfig.json deleted file mode 100644 index d88ccc01a35d..000000000000 --- a/apps/pro/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "tsconfig/nextjs.json", - "compilerOptions": { - "baseUrl": ".", - "noEmit": true, - "paths": { - "@lib*": ["src/lib*"] - } - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"] -} diff --git a/apps/web/src/components/Common/Layout.tsx b/apps/web/src/components/Common/Layout.tsx index 168b37ccc165..25c63b0e10e5 100644 --- a/apps/web/src/components/Common/Layout.tsx +++ b/apps/web/src/components/Common/Layout.tsx @@ -1,8 +1,7 @@ import getIsAuthTokensAvailable from '@lib/getIsAuthTokensAvailable'; import getToastOptions from '@lib/getToastOptions'; import resetAuthData from '@lib/resetAuthData'; -import axios from 'axios'; -import { IS_MAINNET, PRO_STATUS_API_URL } from 'data/constants'; +import { IS_MAINNET } from 'data/constants'; import type { Profile } from 'lens'; import { ReferenceModules, useUserProfilesQuery } from 'lens'; import Head from 'next/head'; @@ -102,9 +101,7 @@ const Layout: FC = ({ children }) => { useEffect(() => { if (currentProfile?.id && currentProfile?.id === '0x0d') { if (IS_MAINNET) { - axios(`${PRO_STATUS_API_URL}/user/${currentProfile?.id}`) - .then(({ data }) => setIsPro(data.isPro)) - .catch(() => setIsPro(false)); + setIsPro(true); } else { setIsPro(true); } diff --git a/packages/data/constants.ts b/packages/data/constants.ts index b10d47ba68d9..f2c978983664 100644 --- a/packages/data/constants.ts +++ b/packages/data/constants.ts @@ -19,8 +19,6 @@ export const SERVERLESS_STAGING_SANDBOX_API_URL = 'https://api-staging-sandbox.l export const SERVERLESS_SANDBOX_API_URL = 'https://api-sandbox.lenster.xyz'; export const SERVERLESS_DEVELOPMENT_API_URL = 'http://localhost:4784'; -export const PRO_STATUS_API_URL = 'https://pro.lenster.xyz'; - export const SERVERLESS_URL = getEnvConfig().serverlessEndpoint; export const API_URL = getEnvConfig().apiEndpoint; export const LENSHUB_PROXY = getEnvConfig().lensHubProxyAddress;