diff --git a/.all-contributorsrc b/.all-contributorsrc index d1ede2d1..8197231a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1,6 +1,6 @@ { - "projectName": "joyboy", - "projectOwner": "keep-starknet-strange", + "projectName": "afk_monorepo", + "projectOwner": "AFK-AlignedFamKernel", "repoType": "github", "repoHost": "https://github.com", "files": [ @@ -8,216 +8,18 @@ ], "imageSize": 100, "commit": true, - "commitConvention": "gitmoji", + "commitConvention": "none", "contributors": [ - { - "login": "AbdelStark", - "name": "Abdel @ StarkWare ", - "avatar_url": "https://avatars.githubusercontent.com/u/45264458?v=4", - "profile": "https://github.com/AbdelStark", - "contributions": [ - "code" - ] - }, - { - "login": "maciejka", - "name": "Maciej Kamiński @ StarkWare", - "avatar_url": "https://avatars.githubusercontent.com/u/190855?v=4", - "profile": "https://github.com/maciejka", - "contributions": [ - "code" - ] - }, { "login": "MSghais", "name": "MSG", "avatar_url": "https://avatars.githubusercontent.com/u/59928086?v=4", "profile": "https://github.com/MSghais", "contributions": [ - "code" - ] - }, - { - "login": "kateberryd", - "name": "Catherine Jonathan", - "avatar_url": "https://avatars.githubusercontent.com/u/35270183?v=4", - "profile": "https://github.com/kateberryd", - "contributions": [ - "code" - ] - }, - { - "login": "ayushtom", - "name": "Ayush Tomar", - "avatar_url": "https://avatars.githubusercontent.com/u/41674634?v=4", - "profile": "https://github.com/ayushtom", - "contributions": [ - "code" - ] - }, - { - "login": "mubarak23", - "name": "Mubarak Muhammad Aminu", - "avatar_url": "https://avatars.githubusercontent.com/u/7858376?v=4", - "profile": "http://mubarak23.github.io/", - "contributions": [ - "code" - ] - }, - { - "login": "ugur-eren", - "name": "Uğur Eren", - "avatar_url": "https://avatars.githubusercontent.com/u/86152092?v=4", - "profile": "https://ugureren.net/", - "contributions": [ - "code" - ] - }, - { - "login": "Oshioke-Salaki", - "name": "Oshioke Salaki", - "avatar_url": "https://avatars.githubusercontent.com/u/105825121?v=4", - "profile": "https://github.com/Oshioke-Salaki", - "contributions": [ - "code" - ] - }, - { - "login": "bhavyagosai", - "name": "Bhavya Gosai", - "avatar_url": "https://avatars.githubusercontent.com/u/64588227?v=4", - "profile": "https://github.com/bhavyagosai", - "contributions": [ - "code" - ] - }, - { - "login": "BlackStarkGoku", - "name": "BlackStarkGoku", - "avatar_url": "https://avatars.githubusercontent.com/u/165695008?v=4", - "profile": "https://github.com/BlackStarkGoku", - "contributions": [ - "code" - ] - }, - { - "login": "Israelrex9", - "name": "IsraelRex", - "avatar_url": "https://avatars.githubusercontent.com/u/46507005?v=4", - "profile": "https://github.com/Israelrex9", - "contributions": [ - "design" - ] - }, - { - "login": "EjembiEmmanuel", - "name": "Emmaunuel Ejembi", - "avatar_url": "https://avatars.githubusercontent.com/u/83036156?v=4", - "profile": "https://github.com/EjembiEmmanuel", - "contributions": [ - "code" - ] - }, - { - "login": "Ayoazeez26", - "name": "Abdulhakeem Abdulazeez Ayodeji", - "avatar_url": "https://avatars.githubusercontent.com/u/44169294?v=4", - "profile": "https://github.com/Ayoazeez26", - "contributions": [ - "code" - ] - }, - { - "login": "josephchimebuka", - "name": "Joseph Chimebuka", - "avatar_url": "https://avatars.githubusercontent.com/u/87217051?v=4", - "profile": "https://github.com/josephchimebuka", - "contributions": [ - "code" - ] - }, - { - "login": "omahs", - "name": "omahs", - "avatar_url": "https://avatars.githubusercontent.com/u/73983677?v=4", - "profile": "https://github.com/omahs", - "contributions": [ - "code" - ] - }, - { - "login": "Calebux", - "name": "Caleb ", - "avatar_url": "https://avatars.githubusercontent.com/u/119738245?v=4", - "profile": "https://github.com/Calebux", - "contributions": [ - "code" - ] - }, - { - "login": "benbaruka", - "name": "Ben Ickah", - "avatar_url": "https://avatars.githubusercontent.com/u/89651828?v=4", - "profile": "https://developer.mozilla.org/", - "contributions": [ - "code" - ] - }, - { - "login": "Shoetan", - "name": "Emmanuel Soetan", - "avatar_url": "https://avatars.githubusercontent.com/u/17912134?v=4", - "profile": "https://soetandev.netlify.app/", - "contributions": [ - "code" - ] - }, - { - "login": "princeibs", - "name": "princeibs", - "avatar_url": "https://avatars.githubusercontent.com/u/64266194?v=4", - "profile": "https://github.com/princeibs", - "contributions": [ - "code" - ] - }, - { - "login": "goofylfg", - "name": "goofylfg", - "avatar_url": "https://avatars.githubusercontent.com/u/165781272?v=4", - "profile": "https://github.com/goofylfg", - "contributions": [ - "code" - ] - }, - { - "login": "lfgtwo", - "name": "lfg2", - "avatar_url": "https://avatars.githubusercontent.com/u/171595475?v=4", - "profile": "https://github.com/lfgtwo", - "contributions": [ - "code" - ] - }, - { - "login": "devcollinss", - "name": "Collins Ikechukwu (devcollins)", - "avatar_url": "https://avatars.githubusercontent.com/u/90073781?v=4", - "profile": "https://github.com/devcollinss", - "contributions": [ - "code" - ] - }, - { - "login": "petersssong", - "name": "petersssong", - "avatar_url": "https://avatars.githubusercontent.com/u/171840752?v=4", - "profile": "https://github.com/petersssong", - "contributions": [ - "code" + "doc" ] } ], "contributorsPerLine": 7, - "linkToUsage": false + "linkToUsage": true } diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 84ee0eca..48ebc19d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -3,7 +3,7 @@ - Claiming a task - Comment on the task you would like to take, include the estimated delivery timeline (start date and estimated completion date), describe how you would approach this task and a include brief summary of relevant skills. - - Join the Telegram group for updates and discussions. https://t.me/JoyboyStarknet + - Join the Telegram group for updates and discussions. https://t.me/afk_aligned_fam_kernel - Task Assignment @@ -23,7 +23,7 @@ ### Setup - Clone the repository -- Navigate to the JoyboyCommunity directory. `cd JoyboyCommunity` +- Navigate to the AFK Mobile directory. `cd apps/mobile` - Install the dependencies using yarn `yarn install` - Start the development server `yarn start` - Open the app in your browser / device / emulator. diff --git a/.github/workflows/joyboy-community.yml b/.github/workflows/afk-community.yml similarity index 61% rename from .github/workflows/joyboy-community.yml rename to .github/workflows/afk-community.yml index 14b5bbce..0c9b6bc1 100644 --- a/.github/workflows/joyboy-community.yml +++ b/.github/workflows/afk-community.yml @@ -5,12 +5,12 @@ on: branches: - main paths: - - "JoyboyCommunity/**" + - "apps/mobile/**" pull_request: branches: - main paths: - - "JoyboyCommunity/**" + - "apps/mobile/**" jobs: check-app: @@ -18,7 +18,7 @@ jobs: defaults: run: - working-directory: ./JoyboyCommunity + working-directory: ./apps/mobile steps: - name: Checkout Code @@ -28,17 +28,16 @@ jobs: uses: actions/setup-node@v3 with: node-version: "20.x" - cache: "yarn" - cache-dependency-path: ./JoyboyCommunity/yarn.lock + cache: "pnpm" - name: Install Dependencies - run: yarn install --frozen-lockfile + run: pnpm install --frozen-lockfile - name: Prettier Format Check - run: yarn format:check + run: pnpm format:check - name: ESLint Check - run: yarn lint + run: pnpm lint - name: TypeScript Check - run: yarn ts:check + run: pnpm ts:check diff --git a/.gitignore b/.gitignore index 9eb3c6de..3cbcf312 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,4 @@ node_modules/ .turbo -pnpm-lock.yaml \ No newline at end of file +.env diff --git a/.npmrc b/.npmrc index bf2e7648..16076dea 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ shamefully-hoist=true +package-manager=pnpm@8.15.9 \ No newline at end of file diff --git a/Backend copy.Dockerfile b/Backend copy.Dockerfile new file mode 100644 index 00000000..68a760ce --- /dev/null +++ b/Backend copy.Dockerfile @@ -0,0 +1,66 @@ +# Use a Node.js base image +FROM node:18-alpine AS base + +# Set the working directory inside the container +WORKDIR /app + +# Add an argument for the Telegram bot token +ARG TELEGRAM_BOT_TOKEN + +# Set the environment variable +ENV TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN} + +# Add an argument for th Indexer postgres url +ARG INDEXER_DATABASE_URL + +# Set the environment variable +ENV INDEXER_DATABASE_URL=${INDEXER_DATABASE_URL} + + +# Add an argument for Telegram webapp +ARG TELEGRAM_WEB_APP + +# Set the environment variable +ENV TELEGRAM_WEB_APP=${TELEGRAM_WEB_APP} + +# Copy root-level package files +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ + +# Install pnpm globally +RUN npm install -g pnpm + +# Install all dependencies for the workspace, including common and data-backend +RUN pnpm install --frozen-lockfile + +# Copy the entire repository into the Docker container +COPY . . + +# Build the indexer-prisma package +RUN pnpm --filter indexer-prisma build + +# Build the data-backend package +RUN pnpm --filter data-backend build + +# Use a smaller production base image +FROM node:18-alpine AS production + +# Set the working directory in the production container +WORKDIR /app + +# Copy the node_modules and built files from the base stage +COPY --from=base /app/node_modules ./node_modules +COPY --from=base /app/packages/common ./packages/common +COPY --from=base /app/packages/indexer-prisma ./packages/indexer-prisma +COPY --from=base /app/apps/data-backend/dist ./apps/data-backend/dist + +# Copy only necessary files for the application to run +COPY apps/data-backend/package.json ./ + +# Set the environment variable to production +ENV NODE_ENV=production + +# Expose the port your app runs on +EXPOSE 3000 + +# Command to start the application +CMD ["node", "apps/data-backend/dist/index.js"] diff --git a/Backend.Dockerfile b/Backend.Dockerfile new file mode 100644 index 00000000..68a760ce --- /dev/null +++ b/Backend.Dockerfile @@ -0,0 +1,66 @@ +# Use a Node.js base image +FROM node:18-alpine AS base + +# Set the working directory inside the container +WORKDIR /app + +# Add an argument for the Telegram bot token +ARG TELEGRAM_BOT_TOKEN + +# Set the environment variable +ENV TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN} + +# Add an argument for th Indexer postgres url +ARG INDEXER_DATABASE_URL + +# Set the environment variable +ENV INDEXER_DATABASE_URL=${INDEXER_DATABASE_URL} + + +# Add an argument for Telegram webapp +ARG TELEGRAM_WEB_APP + +# Set the environment variable +ENV TELEGRAM_WEB_APP=${TELEGRAM_WEB_APP} + +# Copy root-level package files +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ + +# Install pnpm globally +RUN npm install -g pnpm + +# Install all dependencies for the workspace, including common and data-backend +RUN pnpm install --frozen-lockfile + +# Copy the entire repository into the Docker container +COPY . . + +# Build the indexer-prisma package +RUN pnpm --filter indexer-prisma build + +# Build the data-backend package +RUN pnpm --filter data-backend build + +# Use a smaller production base image +FROM node:18-alpine AS production + +# Set the working directory in the production container +WORKDIR /app + +# Copy the node_modules and built files from the base stage +COPY --from=base /app/node_modules ./node_modules +COPY --from=base /app/packages/common ./packages/common +COPY --from=base /app/packages/indexer-prisma ./packages/indexer-prisma +COPY --from=base /app/apps/data-backend/dist ./apps/data-backend/dist + +# Copy only necessary files for the application to run +COPY apps/data-backend/package.json ./ + +# Set the environment variable to production +ENV NODE_ENV=production + +# Expose the port your app runs on +EXPOSE 3000 + +# Command to start the application +CMD ["node", "apps/data-backend/dist/index.js"] diff --git a/LICENSE b/LICENSE index 885707a8..49c3b38d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Keep Starknet Strange +Copyright (c) 2024 AFK Aligned Fam Kernel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 6e9ab6bf..fbfb9e7d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,14 @@
+ +[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) + + +[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors-) + afk_aligned_fam_kernel logo -[![Starknet Test Workflow Status](https://github.com/keep-starknet-strange/joyboy/actions/workflows/starknet-contracts.yml/badge.svg)](https://github.com/keep-starknet-strange/joyboy/actions/workflows/starknet-contracts.yml) +[![Starknet Test Workflow Status](https://github.com/AFK-AlignedFamKernel/afk_monorepo/actions/workflows/starknet-contracts.yml/badge.svg)](https://github.com/AFK-AlignedFamKernel/afk_monorepo/actions/workflows/starknet-contracts.yml) -[![Exploration_Team](https://img.shields.io/badge/Exploration_Team-29296E.svg?&style=for-the-badge&logo=data:image/svg%2bxml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJhIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODEgMTgxIj48ZGVmcz48c3R5bGU+LmJ7ZmlsbDojZmZmO308L3N0eWxlPjwvZGVmcz48cGF0aCBjbGFzcz0iYiIgZD0iTTE3Ni43Niw4OC4xOGwtMzYtMzcuNDNjLTEuMzMtMS40OC0zLjQxLTIuMDQtNS4zMS0xLjQybC0xMC42MiwyLjk4LTEyLjk1LDMuNjNoLjc4YzUuMTQtNC41Nyw5LjktOS41NSwxNC4yNS0xNC44OSwxLjY4LTEuNjgsMS44MS0yLjcyLDAtNC4yN0w5Mi40NSwuNzZxLTEuOTQtMS4wNC00LjAxLC4xM2MtMTIuMDQsMTIuNDMtMjMuODMsMjQuNzQtMzYsMzcuNjktMS4yLDEuNDUtMS41LDMuNDQtLjc4LDUuMThsNC4yNywxNi41OGMwLDIuNzIsMS40Miw1LjU3LDIuMDcsOC4yOS00LjczLTUuNjEtOS43NC0xMC45Ny0xNS4wMi0xNi4wNi0xLjY4LTEuODEtMi41OS0xLjgxLTQuNCwwTDQuMzksODguMDVjLTEuNjgsMi4zMy0xLjgxLDIuMzMsMCw0LjUzbDM1Ljg3LDM3LjNjMS4zNiwxLjUzLDMuNSwyLjEsNS40NCwxLjQybDExLjQtMy4xMSwxMi45NS0zLjYzdi45MWMtNS4yOSw0LjE3LTEwLjIyLDguNzYtMTQuNzYsMTMuNzNxLTMuNjMsMi45OC0uNzgsNS4zMWwzMy40MSwzNC44NGMyLjIsMi4yLDIuOTgsMi4yLDUuMTgsMGwzNS40OC0zNy4xN2MxLjU5LTEuMzgsMi4xNi0zLjYsMS40Mi01LjU3LTEuNjgtNi4wOS0zLjI0LTEyLjMtNC43OS0xOC4zOS0uNzQtMi4yNy0xLjIyLTQuNjItMS40Mi02Ljk5LDQuMyw1LjkzLDkuMDcsMTEuNTIsMTQuMjUsMTYuNzEsMS42OCwxLjY4LDIuNzIsMS42OCw0LjQsMGwzNC4zMi0zNS43NHExLjU1LTEuODEsMC00LjAxWm0tNzIuMjYsMTUuMTVjLTMuMTEtLjc4LTYuMDktMS41NS05LjE5LTIuNTktMS43OC0uMzQtMy42MSwuMy00Ljc5LDEuNjhsLTEyLjk1LDEzLjg2Yy0uNzYsLjg1LTEuNDUsMS43Ni0yLjA3LDIuNzJoLS42NWMxLjMtNS4zMSwyLjcyLTEwLjYyLDQuMDEtMTUuOGwxLjY4LTYuNzNjLjg0LTIuMTgsLjE1LTQuNjUtMS42OC02LjA5bC0xMi45NS0xNC4xMmMtLjY0LS40NS0xLjE0LTEuMDgtMS40Mi0xLjgxbDE5LjA0LDUuMTgsMi41OSwuNzhjMi4wNCwuNzYsNC4zMywuMTQsNS43LTEuNTVsMTIuOTUtMTQuMzhzLjc4LTEuMDQsMS42OC0xLjE3Yy0xLjgxLDYuNi0yLjk4LDE0LjEyLTUuNDQsMjAuNDYtMS4wOCwyLjk2LS4wOCw2LjI4LDIuNDYsOC4xNiw0LjI3LDQuMTQsOC4yOSw4LjU1LDEyLjk1LDEyLjk1LDAsMCwxLjMsLjkxLDEuNDIsMi4wN2wtMTMuMzQtMy42M1oiLz48L3N2Zz4=)](https://github.com/keep-starknet-strange) [![Built with React Native](https://img.shields.io/badge/Built%20with-React%20Native-%2361DAFB?style=for-the-badge&logo=react)](https://reactnative.dev/) @@ -171,6 +176,20 @@ Select Expo web, Android or IOS. You can scan it with Expo GO on your phone. - [Smart Vaults - Bitcoin multi-custody signature orchestration - website](https://www.smartvaults.io/) - [Smart Vaults - Bitcoin multi-custody signature orchestration - repo](https://github.com/smartvaults/smartvaults) +## Fork + +We build into the Joyboy repo here from the Exploration team: + +[![Exploration team repo](https://github.com/keep-starknet-strange/joyboy)] + + +[![Exploration_Team](https://img.shields.io/badge/Exploration_Team-29296E.svg?&style=for-the-badge&logo=data:image/svg%2bxml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJhIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODEgMTgxIj48ZGVmcz48c3R5bGU+LmJ7ZmlsbDojZmZmO308L3N0eWxlPjwvZGVmcz48cGF0aCBjbGFzcz0iYiIgZD0iTTE3Ni43Niw4OC4xOGwtMzYtMzcuNDNjLTEuMzMtMS40OC0zLjQxLTIuMDQtNS4zMS0xLjQybC0xMC42MiwyLjk4LTEyLjk1LDMuNjNoLjc4YzUuMTQtNC41Nyw5LjktOS41NSwxNC4yNS0xNC44OSwxLjY4LTEuNjgsMS44MS0yLjcyLDAtNC4yN0w5Mi40NSwuNzZxLTEuOTQtMS4wNC00LjAxLC4xM2MtMTIuMDQsMTIuNDMtMjMuODMsMjQuNzQtMzYsMzcuNjktMS4yLDEuNDUtMS41LDMuNDQtLjc4LDUuMThsNC4yNywxNi41OGMwLDIuNzIsMS40Miw1LjU3LDIuMDcsOC4yOS00LjczLTUuNjEtOS43NC0xMC45Ny0xNS4wMi0xNi4wNi0xLjY4LTEuODEtMi41OS0xLjgxLTQuNCwwTDQuMzksODguMDVjLTEuNjgsMi4zMy0xLjgxLDIuMzMsMCw0LjUzbDM1Ljg3LDM3LjNjMS4zNiwxLjUzLDMuNSwyLjEsNS40NCwxLjQybDExLjQtMy4xMSwxMi45NS0zLjYzdi45MWMtNS4yOSw0LjE3LTEwLjIyLDguNzYtMTQuNzYsMTMuNzNxLTMuNjMsMi45OC0uNzgsNS4zMWwzMy40MSwzNC44NGMyLjIsMi4yLDIuOTgsMi4yLDUuMTgsMGwzNS40OC0zNy4xN2MxLjU5LTEuMzgsMi4xNi0zLjYsMS40Mi01LjU3LTEuNjgtNi4wOS0zLjI0LTEyLjMtNC43OS0xOC4zOS0uNzQtMi4yNy0xLjIyLTQuNjItMS40Mi02Ljk5LDQuMyw1LjkzLDkuMDcsMTEuNTIsMTQuMjUsMTYuNzEsMS42OCwxLjY4LDIuNzIsMS42OCw0LjQsMGwzNC4zMi0zNS43NHExLjU1LTEuODEsMC00LjAxWm0tNzIuMjYsMTUuMTVjLTMuMTEtLjc4LTYuMDktMS41NS05LjE5LTIuNTktMS43OC0uMzQtMy42MSwuMy00Ljc5LDEuNjhsLTEyLjk1LDEzLjg2Yy0uNzYsLjg1LTEuNDUsMS43Ni0yLjA3LDIuNzJoLS42NWMxLjMtNS4zMSwyLjcyLTEwLjYyLDQuMDEtMTUuOGwxLjY4LTYuNzNjLjg0LTIuMTgsLjE1LTQuNjUtMS42OC02LjA5bC0xMi45NS0xNC4xMmMtLjY0LS40NS0xLjE0LTEuMDgtMS40Mi0xLjgxbDE5LjA0LDUuMTgsMi41OSwuNzhjMi4wNCwuNzYsNC4zMywuMTQsNS43LTEuNTVsMTIuOTUtMTQuMzhzLjc4LTEuMDQsMS42OC0xLjE3Yy0xLjgxLDYuNi0yLjk4LDE0LjEyLTUuNDQsMjAuNDYtMS4wOCwyLjk2LS4wOCw2LjI4LDIuNDYsOC4xNiw0LjI3LDQuMTQsOC4yOSw4LjU1LDEyLjk1LDEyLjk1LDAsMCwxLjMsLjkxLDEuNDIsMi4wN2wtMTMuMzQtMy42M1oiLz48L3N2Zz4=)](https://github.com/keep-starknet-strange) + + +AFK Aligned Fam Kernel is born from this open source project. + +Now we keep building and move forward! + ## Contributors ✨ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): @@ -181,37 +200,18 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - + - +
Abdel @ StarkWare
Abdel @ StarkWare

💻
Maciej Kamiński @ StarkWare
Maciej Kamiński @ StarkWare

💻
MSG
MSG

💻
Catherine Jonathan
Catherine Jonathan

💻
Ayush Tomar
Ayush Tomar

💻
Mubarak Muhammad Aminu
Mubarak Muhammad Aminu

💻
UÄŸur Eren
UÄŸur Eren

💻
Oshioke Salaki
Oshioke Salaki

💻
Bhavya Gosai
Bhavya Gosai

💻
BlackStarkGoku
BlackStarkGoku

💻
IsraelRex
IsraelRex

🎨
Emmaunuel Ejembi
Emmaunuel Ejembi

💻
Abdulhakeem Abdulazeez Ayodeji
Abdulhakeem Abdulazeez Ayodeji

💻
Joseph Chimebuka
Joseph Chimebuka

💻
omahs
omahs

💻
Caleb
Caleb

💻
Ben Ickah
Ben Ickah

💻
Emmanuel Soetan
Emmanuel Soetan

💻
princeibs
princeibs

💻
goofylfg
goofylfg

💻
lfg2
lfg2

💻
MSG
MSG

📖
Collins Ikechukwu (devcollins)
Collins Ikechukwu (devcollins)

💻
petersssong
petersssong

💻
+ + Add your contributions + +
@@ -219,4 +219,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! \ No newline at end of file diff --git a/apps/data-backend/.env.example b/apps/data-backend/.env.example index e69de29b..0e5be5d7 100644 --- a/apps/data-backend/.env.example +++ b/apps/data-backend/.env.example @@ -0,0 +1,6 @@ +TELEGRAM_WEB_APP="https://tg.afk-community.xyz" + +INDEXER_DATABASE_URL="postgresql://postgres" +TELEGRAM_BOT_TOKEN=TG_BOT_FATHER +TG_ADMIN_CHAT_ID= +WEBHOOK_DOMAIN=https://data-backend.xyz diff --git a/apps/data-backend/.npmrc b/apps/data-backend/.npmrc new file mode 100644 index 00000000..16076dea --- /dev/null +++ b/apps/data-backend/.npmrc @@ -0,0 +1,2 @@ +shamefully-hoist=true +package-manager=pnpm@8.15.9 \ No newline at end of file diff --git a/apps/data-backend/Dockerfile b/apps/data-backend/Dockerfile new file mode 100644 index 00000000..e2d4a059 --- /dev/null +++ b/apps/data-backend/Dockerfile @@ -0,0 +1,46 @@ +# Use a Node.js base image +FROM node:18-alpine AS base + +# Set the working directory inside the container +WORKDIR /app + +# Copy root-level package files +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ + +# Install pnpm globally +RUN npm install -g pnpm + +# Install all dependencies for the workspace, including common and data-backend +RUN pnpm install --frozen-lockfile + +# Copy the entire repository into the Docker container +COPY . . + +# Build the common package first +RUN pnpm --filter common build + +# Build the data-backend package +RUN pnpm --filter data-backend build + +# Use a smaller production base image +FROM node:18-alpine AS production + +# Set the working directory in the production container +WORKDIR /app + +# Copy the node_modules and built files from the base stage +COPY --from=base /app/node_modules ./node_modules +COPY --from=base /app/packages/common/ ./packages/common/ +COPY --from=base /app/apps/data-backend/dist ./apps/data-backend/dist + +# Copy only necessary files for the application to run +COPY apps/data-backend/package.json ./ + +# Set the environment variable to production +ENV NODE_ENV=production + +# Expose the port your app runs on +EXPOSE 3000 + +# Command to start the application +CMD ["node", "apps/data-backend/dist/index.js"] diff --git a/apps/data-backend/package.json b/apps/data-backend/package.json index 1f35a83f..1083f22b 100644 --- a/apps/data-backend/package.json +++ b/apps/data-backend/package.json @@ -5,15 +5,19 @@ "main": "./src/index.ts", "scripts": { "build": "tsc", - "start": "ts-node src/index.ts", + "build:index": "tsc", + "build:all": "pnpm run build:indexer-prisma && cd ../../apps/data-backend tsc", + "start": "ts-node src/index.js", "start:dev": "ts-node-dev src/index.ts", "start:prod": "ts-node dist/index.js", + "start:node": "node dist/index.js", "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { + "@telegraf/types": "^7.1.0", "apollo-server": "^3.13.0", "cors": "^2.8.5", "dotenv": "^16.4.5", @@ -24,15 +28,16 @@ "indexer-prisma": "workspace:*", "pg": "^8.12.0", "pg-promise": "^11.9.1", - "common":"workspace:*" + "telegraf": "^4.16.3", + "typescript": "^5.5.4" }, "devDependencies": { "@types/express": "^4.17.21", - "@types/node": "^20", + "@types/node": "^20.16.1", "ts-node": "^10.9.2", "ts-node-dev": "^2.0.0", - "typescript": "^5.5.4", - "tsx": "^4.7.3" - + "tsup": "^8.0.2", + "tsx": "^4.7.3", + "typescript": "^5.5.4" } } diff --git a/apps/data-backend/src/graphql.ts b/apps/data-backend/src/graphql.ts index cd5b223b..306bd096 100644 --- a/apps/data-backend/src/graphql.ts +++ b/apps/data-backend/src/graphql.ts @@ -1,15 +1,14 @@ import { ApolloServer, gql } from 'apollo-server'; -import prisma from 'indexer-prisma'; +// import prisma from 'indexer-prisma'; +const { prisma } = require("indexer-prisma"); import { MutationBuyToken, TypeBuyToken } from './schema/indexer/buy_token'; - - // Define your resolvers const resolvers = { Query: { buyTokens: () => prisma.buy_token.findMany(), - buyToken: (_parent, args) => prisma.buy_token.findUnique({ - where: { memecoin_address: args.memecoin_address }, - }), + // buyToken: (_parent, args) => prisma.buy_token.findUnique({ + // // where: { memecoin_address: args.memecoin_address }, + // }), }, // Mutation: { // createBuyToken: (_parent, args) => prisma.buy_token.create({ diff --git a/apps/data-backend/src/index.js b/apps/data-backend/src/index.js new file mode 100644 index 00000000..ce75ce5d --- /dev/null +++ b/apps/data-backend/src/index.js @@ -0,0 +1,40 @@ +import express from "express"; +import {server} from "./graphql" +import dotenv from "dotenv"; +import router from "./router"; +import helmet from "helmet" +import { launchBot, sendWebAppButton } from "./services/telegram-app"; +const cors = require("cors") +dotenv.config(); +const app = express(); +app.use(cors()) +app.use(helmet()) +// Alternatively, you can configure CORS for specific routes or origins +app.use(cors({ + origin: 'http://localhost:8081' // Adjust this to match the URL of your React Native web version if necessary +})); +app.use(express.urlencoded({ extended: false })) +app.use(express.json()) +// app.use(cors) +// app.use(express.urlencoded({ extended: false })) +// app.use(express.json()) +// Start the Backend +const port = process.env.PORT || 5050; +app.use('/', router) +app.use('/telegram-app', router) + +app.listen(port, () => { + console.log(`🚀 Backend server running at http://localhost:${port}`); + try { + launchBot(process.env.TELEGRAM_BOT_TOKEN) + + }catch(e) { + + } + // sendWebAppButton(process.env.TG_ADMIN_CHAT_ID) +}); + +// Start the server GraphQL +// server.listen().then(({ url }) => { +// console.log(`🚀 Backend server running at http://localhost:${port}/graphql`); +// }); diff --git a/apps/data-backend/src/index.ts b/apps/data-backend/src/index.ts index 65089c52..ce75ce5d 100644 --- a/apps/data-backend/src/index.ts +++ b/apps/data-backend/src/index.ts @@ -2,8 +2,8 @@ import express from "express"; import {server} from "./graphql" import dotenv from "dotenv"; import router from "./router"; -// import cors from "cors"; import helmet from "helmet" +import { launchBot, sendWebAppButton } from "./services/telegram-app"; const cors = require("cors") dotenv.config(); const app = express(); @@ -21,9 +21,17 @@ app.use(express.json()) // Start the Backend const port = process.env.PORT || 5050; app.use('/', router) +app.use('/telegram-app', router) app.listen(port, () => { console.log(`🚀 Backend server running at http://localhost:${port}`); + try { + launchBot(process.env.TELEGRAM_BOT_TOKEN) + + }catch(e) { + + } + // sendWebAppButton(process.env.TG_ADMIN_CHAT_ID) }); // Start the server GraphQL diff --git a/apps/data-backend/src/router.ts b/apps/data-backend/src/router.ts index 845c31c1..ddce93da 100644 --- a/apps/data-backend/src/router.ts +++ b/apps/data-backend/src/router.ts @@ -3,10 +3,12 @@ import express from 'express' import deploy from './routes/deploy-token' import deployLaunch from './routes/deploy-launch' import buyCoin from './routes/buy-coin' +import telegramApp from './routes/telegram-app' const Router = express.Router() Router.use('/deploy', deploy) Router.use('/deploy-launch', deployLaunch) Router.use("/buy-coin", buyCoin) +Router.use("/telegram-app", telegramApp) export default Router diff --git a/apps/data-backend/src/routes/buy-coin.ts b/apps/data-backend/src/routes/buy-coin.ts index f02fab76..53cbc55b 100644 --- a/apps/data-backend/src/routes/buy-coin.ts +++ b/apps/data-backend/src/routes/buy-coin.ts @@ -1,5 +1,7 @@ import express from 'express' -import prisma from 'indexer-prisma'; +// import prisma from 'indexer-prisma'; +const { prisma } = require("indexer-prisma"); + import { HTTPStatus } from '../utils/http'; const Router = express.Router() @@ -17,7 +19,4 @@ Router.get('/', async (req, res) => { }) - - - export default Router diff --git a/apps/data-backend/src/routes/deploy-launch.ts b/apps/data-backend/src/routes/deploy-launch.ts index c70af4f4..6cd2aacc 100644 --- a/apps/data-backend/src/routes/deploy-launch.ts +++ b/apps/data-backend/src/routes/deploy-launch.ts @@ -1,5 +1,7 @@ import express from 'express' -import prisma from 'indexer-prisma'; +// import prisma from 'indexer-prisma'; +const { prisma } = require("indexer-prisma"); + import { HTTPStatus } from '../utils/http'; import { isValidStarknetAddress } from '../utils/starknet'; diff --git a/apps/data-backend/src/routes/deploy-token.ts b/apps/data-backend/src/routes/deploy-token.ts index 51308d46..56eed8a7 100644 --- a/apps/data-backend/src/routes/deploy-token.ts +++ b/apps/data-backend/src/routes/deploy-token.ts @@ -1,5 +1,7 @@ import express from 'express' -import prisma from 'indexer-prisma'; +// import prisma from 'indexer-prisma'; +const { prisma } = require("indexer-prisma"); + import { HTTPStatus } from '../utils/http'; import { isValidStarknetAddress } from '../utils/starknet'; diff --git a/apps/data-backend/src/routes/telegram-app.ts b/apps/data-backend/src/routes/telegram-app.ts new file mode 100644 index 00000000..7a3e7c12 --- /dev/null +++ b/apps/data-backend/src/routes/telegram-app.ts @@ -0,0 +1,82 @@ +import express from 'express' +import { HTTPStatus } from '../utils/http'; +import { launchBot, sendMessage, sendWebAppButton } from '../services/telegram-app'; +import dotenv from "dotenv" +import { TELEGRAM_API_URL, WEBHOOK_DOMAIN } from '../utils/constants'; +dotenv.config(); +const Router = express.Router() + +Router.post('/launch-bot', async (req, res) => { + try { + console.log("gm") + + launchBot(process.env.TELEGRAM_BOT_TOKEN) + + } catch (error) { + res.status(HTTPStatus.InternalServerError).send(error) + } +}) + +Router.get('/launch-bot', async (req, res) => { + try { + console.log("gm") + + launchBot(process.env.TELEGRAM_BOT_TOKEN) + + } catch (error) { + res.status(HTTPStatus.InternalServerError).send(error) + } +}) + + +Router.get('/', async (req, res) => { + try { + + sendWebAppButton(process.env.TG_ADMIN_CHAT_ID) + + } catch (error) { + res.status(HTTPStatus.InternalServerError).send(error) + } +}) + + +// Webhook route to handle incoming updates from Telegram +Router.post('/webhook', async (req, res) => { + const message = req.body.message; + + if (message) { + const chatId = message.chat.id; + const text = message.text; + console.log(`Received message from chat_id ${chatId}: ${text}`); + // Respond with a Web App button or another action + if (text === '/start') { + await sendWebAppButton(chatId); + } else { + await sendMessage(chatId, "I received your message: " + text); + } + } + + // Return a 200 response to acknowledge the update + res.sendStatus(200); +}); + +Router.get('/setWebhook', async (req, res) => { + const url = `${TELEGRAM_API_URL}/setWebhook`; + const webhookUrl = `${WEBHOOK_DOMAIN}/webhook`; // Replace with your server's public URL + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ url: webhookUrl }), + }); + + if (response.ok) { + res.send('Webhook set successfully!'); + } else { + res.status(500).send('Failed to set webhook'); + } +}); + + +export default Router diff --git a/apps/data-backend/src/services/telegram-app.ts b/apps/data-backend/src/services/telegram-app.ts new file mode 100644 index 00000000..156c82f2 --- /dev/null +++ b/apps/data-backend/src/services/telegram-app.ts @@ -0,0 +1,300 @@ +import dotenv from "dotenv"; +dotenv.config() +const TELEGRAM_API_URL = `https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}`; +const WEB_APP_URL = process.env.TELEGRAM_WEB_APP ?? "https://tg.afk-community.xyz"; // Replace with your web app's URL + +// Use require instead of import because of the error "Cannot use import statement outside a module" +import { Telegraf } from 'telegraf' +import { message } from 'telegraf/filters' + +/** + * Creates and launches Telegram bot, and assigns all the required listeners + * + * @param token HTTP API token received from @BotFather(https://t.me/BotFather) after creating a bot + * + * @remarks + * Make sure to save the token in a safe and secure place. Anyone with the access can control your bot. + * + */ +export function launchBot(token:string) { + try { + // Create a bot using the token received from @BotFather(https://t.me/BotFather) + const bot = new Telegraf(token) + + // Assign bot listeners + listenToCommands(bot) + listenToMessages(bot) + listenToQueries(bot) + listenToMiniAppData(bot) + + // Launch the bot + bot.launch().then(() => console.log('bot launched')) + + // Handle stop events + enableGracefulStop(bot) + + return bot + } catch (e) { + console.log("launchBot error", e) + } + +} + +/** + * Assigns command listeners such as /start and /help + * + * @param bot Telegraf bot instance + * + */ +function listenToCommands(bot) { + try { + // Register a listener for the /start command, and reply with a message whenever it's used + bot.start(async (ctx) => { + await ctx.reply("Welcome to MiniAppSample bot!", { + reply_markup: { + keyboard: [ + [{ text: "Start Mini App", web_app: { url: process.env.TELEGRAM_WEB_APP } }], + ] + } + }) + + await ctx.reply("Click on the button below to launch our mini app", { + reply_markup: { + inline_keyboard: [ + [{ text: "Start Mini App", web_app: { url: process.env.TELEGRAM_WEB_APP } }], + ] + } + }) + }) + + // Register a listener for the /help command, and reply with a message whenever it's used + bot.help(async (ctx) => { + await ctx.reply("Run the /start command to use our mini app") + }) + } catch (e) { + + } + +} + +/** + * Assigns message listeners such as text and stickers + * + * @param bot Telegraf bot instance + * + */ +function listenToMessages(bot: Telegraf) { + try { + // Listen to messages and reply with something when ever you receive them + bot.hears("hi", async (ctx) => { + await ctx.reply('Hey there!') + }) + + // Listen to messages with the type 'sticker' and reply whenever you receive them + bot.on(message("text"), async (ctx) => { + await ctx.reply("I don't understand text but I like stickers, send me some!") + await ctx.reply("Or you can send me one of these commands \n/start\n/help") + }); + + // Listen to messages with the type 'sticker' and reply whenever you receive them + bot.on(message("sticker"), async (ctx) => { + await ctx.reply("I like your sticker! 🔥") + }) + } catch (e) { + console.log("listenToMessages", e) + } + +} + + +/** + * Listen to messages send by MiniApp through sendData(data) + * @see https://core.telegram.org/bots/webapps#initializing-mini-apps + * + * @param bot Telegraf bot instance + */ +function listenToMiniAppData(bot) { + try { + bot.on("message", async (ctx) => { + if (ctx.message?.web_app_data?.data) { + try { + const data = ctx.message?.web_app_data?.data + await ctx.telegram.sendMessage(ctx.message.chat.id, 'Got message from MiniApp') + await ctx.telegram.sendMessage(ctx.message.chat.id, data) + } catch (e) { + await ctx.telegram.sendMessage(ctx.message.chat.id, 'Got message from MiniApp but failed to read') + await ctx.telegram.sendMessage(ctx.message.chat.id, e) + } + } + }); + } catch (e) { + + } + +} + + +/** + * Assigns query listeners such inlines and callbacks + * + * @param bot Telegraf bot instance + * + */ +function listenToQueries(bot) { + try { + bot.on("callback_query", async (ctx) => { + // Explicit usage + await ctx.telegram.answerCbQuery(ctx.callbackQuery.id) + + // Using context shortcut + await ctx.answerCbQuery() + }) + + bot.on("inline_query", async (ctx) => { + const article = { + type: 'article', + id: ctx.inlineQuery.id, + title: 'Message for query', + input_message_content: { + message_text: `Message for query` + } + } + + const result = [article] + // Explicit usage + await ctx.telegram.answerInlineQuery(ctx.inlineQuery.id, result) + + // Using context shortcut + await ctx.answerInlineQuery(result) + }) + } catch (e) { + + } + +} +/** + * Listens to process stop events and performs a graceful bot stop + * + * @param bot Telegraf bot instance + * + */ +function enableGracefulStop(bot) { + try { + // Enable graceful stop + process.once('SIGINT', () => bot.stop('SIGINT')) + process.once('SIGTERM', () => bot.stop('SIGTERM')) + } catch (e) { + + } + +} + +/** + * Receives data from the mini app and sends a simple message using answerWebAppQuery + * @see https://core.telegram.org/bots/api#answerwebappquery + * + * We will use InlineQueryResult to create our message + * @see https://core.telegram.org/bots/api#inlinequeryresult + */ +export const handleMessageRequest = async (bot, request, response) => { + try { + // Read data from the request body received by the mini app + const { queryId, message } = request.body + + + // We are creating InlineQueryResultArticle + // See https://core.telegram.org/bots/api#inlinequeryresultarticle + const article = { + type: 'article', + id: queryId, + title: 'Message from the mini app', + input_message_content: { + message_text: `MiniApp: ${message}` + } + } + + // Use queryId and data to send a message to the bot chat + await bot.answerWebAppQuery(queryId, article) + + // End the request with a success code + await response.status(200).json({ + message: 'success!' + }) + + } catch (e) { + const errorJson = JSON.stringify(e) + console.log(`handleMessageRequest error ${errorJson}`) + + await response.status(500).json({ + error: errorJson + }) + } +} + + +export async function sendWebAppButton(chatId) { + try { + const url = `${TELEGRAM_API_URL}/sendMessage`; + console.log("web app url", WEB_APP_URL) + const body = { + chat_id: chatId, + text: 'Click the button below to open the web app:', + reply_markup: { + inline_keyboard: [ + [ + { + text: 'Open Web App', + web_app: { + url: WEB_APP_URL, + }, + }, + ], + ], + }, + }; + + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(body), + }); + + if (!response.ok) { + throw new Error(`Error sending web app button: ${response.statusText}`); + } + + const result = await response.json(); + console.log(result); + } catch (e) { + console.log("Error sendWebApp", e) + } + +} + +// Function to send a message to a chat +export async function sendMessage(chatId, text) { + try { + const url = `${TELEGRAM_API_URL}/sendMessage`; + const body = { + chat_id: chatId, + text: text, + }; + + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(body), + }); + + if (!response.ok) { + console.error(`Error sending message: ${response.statusText}`); + } + } catch (e) { + console.log("sendMessage error", e) + } + +} \ No newline at end of file diff --git a/apps/data-backend/src/utils/constants.ts b/apps/data-backend/src/utils/constants.ts new file mode 100644 index 00000000..73fcaec0 --- /dev/null +++ b/apps/data-backend/src/utils/constants.ts @@ -0,0 +1,5 @@ +import dotenv from "dotenv"; +dotenv.config() + +export const TELEGRAM_API_URL = `https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}`; +export const WEBHOOK_DOMAIN = `https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}`; diff --git a/apps/data-backend/tsconfig copy.json b/apps/data-backend/tsconfig copy.json new file mode 100644 index 00000000..3ee3fda4 --- /dev/null +++ b/apps/data-backend/tsconfig copy.json @@ -0,0 +1,43 @@ +{ + "compilerOptions": { + "target": "ESNext", + "lib": [ + "dom", + "esnext" + ], + "moduleResolution": "Node", + "allowJs": true, + "useUnknownInCatchVariables": false, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "outDir": "dist", + "rootDir": "./src", + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "declaration": true + }, + "exclude": [ + "node_modules", + "dist" + ], + "include": [ + "src/**/*.graphql", + "src/**/*", + "src/**/*.js", + "src/**/*.ts", + "/src/**/*.ts", + "**/*.ts", + "**/*.tsx", + "**/*.js", + "**/*.jsx" + ], + "paths": { + "indexer-prisma": [ + "packages/indexer-prisma/src" + ], + "common": [ + "packages/common/src" + ] + }, +} \ No newline at end of file diff --git a/apps/data-backend/tsconfig.json b/apps/data-backend/tsconfig.json index d4818a63..3ee3fda4 100644 --- a/apps/data-backend/tsconfig.json +++ b/apps/data-backend/tsconfig.json @@ -1,22 +1,43 @@ { "compilerOptions": { "target": "ESNext", - "lib": ["dom", "esnext"], + "lib": [ + "dom", + "esnext" + ], + "moduleResolution": "Node", "allowJs": true, - "module": "CommonJS", "useUnknownInCatchVariables": false, - "moduleResolution": "node", "resolveJsonModule": true, - "isolatedModules": true, "allowSyntheticDefaultImports": true, "outDir": "dist", "rootDir": "./src", "esModuleInterop": true, - "skipLibCheck": true + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "declaration": true }, - "exclude": ["node_modules", "dist"], - "include": [ "src/**/*.graphql", "src/**/*", "src/**/*.ts", "/src/**/*.ts", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"], + "exclude": [ + "node_modules", + "dist" + ], + "include": [ + "src/**/*.graphql", + "src/**/*", + "src/**/*.js", + "src/**/*.ts", + "/src/**/*.ts", + "**/*.ts", + "**/*.tsx", + "**/*.js", + "**/*.jsx" + ], "paths": { - "indexer-prisma": ["packages/indexer-prisma/src"] + "indexer-prisma": [ + "packages/indexer-prisma/src" + ], + "common": [ + "packages/common/src" + ] }, -} +} \ No newline at end of file diff --git a/apps/indexer/README.md b/apps/indexer/README.md index 2befe31d..944bfb9a 100644 --- a/apps/indexer/README.md +++ b/apps/indexer/README.md @@ -5,7 +5,7 @@ ## Install Postgres and Init the tables ``` -docker run --name my-postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 -v /afk-indexer:/docker-entrypoint-initdb.d postgres:16 +docker run --name afk-indexer -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 -v /afk-indexer:/docker-entrypoint-initdb.d postgres:16 ``` # Test @@ -22,7 +22,7 @@ apibara run ./src/pump-buy-coin.js -A dna_XXX ## Docker test ``` - docker build -t pump-indexer . + docker build -t afk-indexer . ``` diff --git a/apps/indexer/init copy 2.sql b/apps/indexer/init copy 2.sql deleted file mode 100644 index 9bc03b87..00000000 --- a/apps/indexer/init copy 2.sql +++ /dev/null @@ -1,93 +0,0 @@ - -create table token_launch( - id SERIAL PRIMARY KEY DEFAULT nextval('token_launch_id_seq'), - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text, - quote_token text, - exchange_name text, - created_at timestamp default current_timestamp, - _cursor bigint -); - -create table token_deploy( - id SERIAL PRIMARY KEY DEFAULT nextval('token_deploy_id_seq'), - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text, - owner_address text, - name text, - symbol text, - initial_supply text, - total_supply text, - created_at timestamp default current_timestamp, - _cursor bigint -); - - -create table buy_token( - id SERIAL PRIMARY KEY DEFAULT nextval('buy_token_id_seq'), - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text, - owner_address text, - last_price text, - price text, - quote_amount text, - coin_received text, - initial_supply text, - created_at timestamp default current_timestamp, - _cursor bigint -); - -create table unrugmeme_transfers( - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - transfer_id text unique primary key, - from_address text, - to_address text, - memecoin_address text, - amount text, - created_at timestamp default current_timestamp, - _cursor bigint -); - -create table unrugmeme_deploy( - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text unique primary key, - owner_address text, - name text, - symbol text, - initial_supply text, - created_at timestamp default current_timestamp, - _cursor bigint -); - -create table unrugmeme_launch( - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text unique primary key, - quote_token text, - exchange_name text, - created_at timestamp default current_timestamp, - _cursor bigint -); diff --git a/apps/indexer/init copy.sql b/apps/indexer/init copy.sql deleted file mode 100644 index e45bec5e..00000000 --- a/apps/indexer/init copy.sql +++ /dev/null @@ -1,93 +0,0 @@ - -create table token_launch( - id BIGSERIAL PRIMARY KEY, - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text, - quote_token text, - exchange_name text, - created_at timestamp default current_timestamp, - _cursor bigint -); - -create table token_deploy( - id BIGSERIAL PRIMARY KEY, - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text primary key, - owner_address text, - name text, - symbol text, - initial_supply text, - total_supply text, - created_at timestamp default current_timestamp, - _cursor bigint -); - - -create table buy_token( - id BIGSERIAL PRIMARY KEY, - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text unique primary key, - owner_address text, - last_price text, - price text, - quote_amount text, - coin_received text, - initial_supply text, - created_at timestamp default current_timestamp, - _cursor bigint -); - -create table unrugmeme_transfers( - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - transfer_id text unique primary key, - from_address text, - to_address text, - memecoin_address text, - amount text, - created_at timestamp default current_timestamp, - _cursor bigint -); - -create table unrugmeme_deploy( - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text unique primary key, - owner_address text, - name text, - symbol text, - initial_supply text, - created_at timestamp default current_timestamp, - _cursor bigint -); - -create table unrugmeme_launch( - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text unique primary key, - quote_token text, - exchange_name text, - created_at timestamp default current_timestamp, - _cursor bigint -); diff --git a/apps/indexer/init.sql b/apps/indexer/init.sql index 73cbf45c..92b9256b 100644 --- a/apps/indexer/init.sql +++ b/apps/indexer/init.sql @@ -1,58 +1,57 @@ -CREATE SEQUENCE token_launch_id_seq; - create table token_launch( + memecoin_address text unique, + id serial primary key, network text, block_hash text, block_number bigint, block_timestamp timestamp, transaction_hash text, - memecoin_address text, quote_token text, exchange_name text, created_at timestamp default current_timestamp, total_supply text, current_supply text, liquidity_raised text, - price text, - _cursor bigint + price text ); create table token_deploy( + memecoin_address text unique, + id serial primary key, network text, block_hash text, block_number bigint, block_timestamp timestamp, transaction_hash text, - memecoin_address text, owner_address text, name text, symbol text, initial_supply text, total_supply text, - created_at timestamp default current_timestamp, - _cursor bigint + created_at timestamp default current_timestamp ); -create table buy_token( - network text, - block_hash text, - block_number bigint, - block_timestamp timestamp, - transaction_hash text, - memecoin_address text, - owner_address text, - last_price text, - quote_amount text, - coin_received text, - initial_supply text, - created_at timestamp default current_timestamp, - total_supply text, - current_supply text, - liquidity_raised text, - price text, - amount text, - _cursor bigint +CREATE TABLE buy_token ( + id SERIAL PRIMARY KEY UNIQUE, -- `serial` automatically creates a unique sequence with primary key + transfer_id text unique, + network TEXT, + block_hash TEXT, + block_number BIGINT, + block_timestamp TIMESTAMP, + transaction_hash TEXT, + memecoin_address TEXT, + owner_address TEXT, + last_price TEXT, + quote_amount TEXT, + coin_received TEXT, + initial_supply TEXT, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + total_supply TEXT, + current_supply TEXT, + liquidity_raised TEXT, + price TEXT, + amount TEXT ); create table unrugmeme_transfers( diff --git a/apps/indexer/pump-buy-coin.js b/apps/indexer/pump-buy-coin.js deleted file mode 100644 index dbbeda94..00000000 --- a/apps/indexer/pump-buy-coin.js +++ /dev/null @@ -1,92 +0,0 @@ -// import { Block, Config, hash, shortString, uint256, NetworkOptions, Console } from './src/deps.js' -// import { FACTORY_ADDRESS, LAUNCHPAD_ADDRESS, STARTING_BLOCK } from './src/constants.js' -export const FACTORY_ADDRESS = '0x01a46467a9246f45c8c340f1f155266a26a71c07bd55d36e8d1c7d0d438a2dbc' -export const STARTING_BLOCK = 615556 - - -export const LAUNCHPAD_ADDRESS = { - SEPOLIA:"0x74acb6752abb734a7b3388567429217988e02409d9bf43c5586dc2c4f8baf40", -} -import { hash, uint256 } from "https://esm.run/starknet@5.14"; -import { formatUnits } from "https://esm.run/viem@1.4"; - - -const filter = { - header: { - weak: true, - }, - events: [ - { - fromAddress: LAUNCHPAD_ADDRESS.SEPOLIA, - keys: [hash.getSelectorFromName('BuyToken')], - // includeReceipt: false, - }, - ], -} - -export const config = { - streamUrl: 'https://sepolia.starknet.a5a.ch', - startingBlock: STARTING_BLOCK, - network: 'starknet', - finality: 'DATA_STATUS_ACCEPTED', - filter, - sinkType: "console", - sinkOptions: {}, - // sinkType: 'postgres', - // sinkOptions: { - // connectionString: '', - // tableName: 'buy_token', - // }, -} - -export default function DecodeBuyToken({ header, events }) { - const { blockNumber, blockHash, timestamp } = header - - return (events ?? []).map(({ event, transaction }) => { - if (!event.data) return - - const transactionHash = transaction.meta.hash - - - return { - transactionHash, - block_hash: blockHash, - block_number: +blockNumber, - block_timestamp: timestamp, - transaction_hash: transactionHash, - transfer_id: transferId, - from_address: fromAddress, - } - - // const [caller, token_address, - // amount_low, amount_high, - // price_low, price_high, - // protocol_fee_low, protocol_fee_high, - - // initial_supply_low, initial_supply_high, - // // total_supply_low, total_supply_high, - - // ] = event.data; - // const amount = uint256.uint256ToBN({ low: amount_low, high: amount_high }).toString() - // const initial_supply = uint256.uint256ToBN({ low: initial_supply_low, high: initial_supply_high }).toString() - // // const total_supply = uint256.uint256ToBN({ low: total_supply_low, high: total_supply_high }).toString() - // const price = uint256.uint256ToBN({ low: price_low, high: price_higt }).toString() - // const protocol_fee = uint256.uint256ToBN({ low: protocol_fee_low, high: protocol_fee_high }).toString() - - // return { - // network: 'starknet-sepolia', - // block_hash: blockHash, - // block_number: Number(blockNumber), - // block_timestamp: timestamp, - // transaction_hash: transactionHash, - // memecoin_address: token_address, - // owner_address: caller, - // initial_supply: initial_supply, - // // total_supply: total_supply, - // price:price, - // protocol_fee:protocol_fee, - // timestamp: new Date().toISOString(), - // created_at: new Date().toISOString(), - // } - }) -} diff --git a/apps/mobile/README.md b/apps/mobile/README.md index 2786c192..415f6a20 100644 --- a/apps/mobile/README.md +++ b/apps/mobile/README.md @@ -1,6 +1,6 @@ ## Mobile -Joyboy Mobile folder in React-native with Expo. +AFK Mobile folder in React-native with Expo. Pick a good first issue with the mobile labels, and let's contribute and keep building cool things in Open-source. ### Test @@ -35,9 +35,9 @@ WIP: - DM with private message: NIP-17 - Public chat: NIP-28 -[UI/UX proposal for video discussions](https://github.com/keep-starknet-strange/joyboy/discussions/48#discussion-6683225) +[UI/UX proposal for video discussions](https://github.com/AFK-AlignedFamKernel/afk_monorepo/discussions/24) -[UI video discussions](https://t.me/JoyboyStarknet/206/397) +[UI video discussions](https://t.me/afk_aligned_fam_kernel) Home page: diff --git a/apps/mobile/app.json b/apps/mobile/app.json index 6ede30c2..364b9a2b 100644 --- a/apps/mobile/app.json +++ b/apps/mobile/app.json @@ -7,7 +7,7 @@ "icon": "./assets/icon.png", "userInterfaceStyle": "light", "splash": { - "image": "./assets/splash.png", + "image": "./assets/icon.png", "backgroundColor": "#ffffff" }, "assetBundlePatterns": ["**/*"], @@ -19,7 +19,7 @@ "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#ffffff" }, - "package": "com.test_joyboy" + "package": "com.test_afk" }, "web": { "favicon": "./assets/favicon.png", diff --git a/apps/mobile/assets/expo_favicon.png b/apps/mobile/assets/expo_favicon.png new file mode 100644 index 00000000..e75f697b Binary files /dev/null and b/apps/mobile/assets/expo_favicon.png differ diff --git a/apps/mobile/assets/favicon.ico b/apps/mobile/assets/favicon.ico new file mode 100644 index 00000000..d7673024 Binary files /dev/null and b/apps/mobile/assets/favicon.ico differ diff --git a/apps/mobile/assets/favicon.png b/apps/mobile/assets/favicon.png index e75f697b..6774e87b 100644 Binary files a/apps/mobile/assets/favicon.png and b/apps/mobile/assets/favicon.png differ diff --git a/apps/mobile/assets/goal.png b/apps/mobile/assets/goal.png new file mode 100644 index 00000000..a0b1526f Binary files /dev/null and b/apps/mobile/assets/goal.png differ diff --git a/apps/mobile/assets/icon.png b/apps/mobile/assets/icon.png index a0b1526f..acad8174 100644 Binary files a/apps/mobile/assets/icon.png and b/apps/mobile/assets/icon.png differ diff --git a/apps/mobile/src/app/App.tsx b/apps/mobile/src/app/App.tsx index fe99179b..b7f12378 100644 --- a/apps/mobile/src/app/App.tsx +++ b/apps/mobile/src/app/App.tsx @@ -6,7 +6,6 @@ import * as SplashScreen from 'expo-splash-screen'; import {useCallback, useEffect, useState} from 'react'; import {View} from 'react-native'; -import {CHAIN_ID} from '../constants/env'; import {useTips} from '../hooks'; import {useDialog, useToast} from '../hooks/modals'; import {Router} from './Router'; @@ -91,7 +90,7 @@ export default function App() { if (!appIsReady) return null; return ( - + ); diff --git a/apps/mobile/src/app/Router.tsx b/apps/mobile/src/app/Router.tsx index fa75f1f1..276d85b3 100644 --- a/apps/mobile/src/app/Router.tsx +++ b/apps/mobile/src/app/Router.tsx @@ -1,36 +1,37 @@ -import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; -import { NavigationContainer } from '@react-navigation/native'; -import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import { useEffect, useMemo, useState } from 'react'; -import { Dimensions, Platform, StyleSheet, useWindowDimensions, View } from 'react-native'; -import { Icon } from '../components'; -import { useStyles, useTheme } from '../hooks'; -import { CreateAccount } from '../screens/Auth/CreateAccount'; -import { ImportKeys } from '../screens/Auth/ImportKeys'; -import { Login } from '../screens/Auth/Login'; -import { SaveKeys } from '../screens/Auth/SaveKeys'; -import { ChannelDetail } from '../screens/ChannelDetail'; -import { ChannelsFeed } from '../screens/ChannelsFeed'; -import { CreateChannel } from '../screens/CreateChannel'; -import { CreateForm } from '../screens/CreateForm'; -import { CreatePost } from '../screens/CreatePost'; -import { EditProfile } from '../screens/EditProfile'; -import { Feed } from '../screens/Feed'; -import { PostDetail } from '../screens/PostDetail'; -import { Profile } from '../screens/Profile'; -import { Search } from '../screens/Search'; -import { Tips } from '../screens/Tips'; -import { ThemedStyleSheet } from '../styles'; -import { AuthStackParams, HomeBottomStackParams, MainStackParams, RootStackParams } from '../types'; -import { retrievePublicKey } from '../utils/storage'; +import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; +import {createDrawerNavigator} from '@react-navigation/drawer'; +import {NavigationContainer} from '@react-navigation/native'; +import {createNativeStackNavigator} from '@react-navigation/native-stack'; +import {useAuth} from 'afk_nostr_sdk'; +import {useEffect, useMemo, useState} from 'react'; +import {Dimensions, Platform, StyleSheet, useWindowDimensions, View} from 'react-native'; + +import {Icon} from '../components'; +import {Navbar} from '../components/Navbar'; +import {useStyles, useTheme} from '../hooks'; import Sidebar from '../modules/Layout/sidebar'; -import { Defi } from '../screens/Defi'; -import { Games } from '../screens/Games'; -import { useAuth } from 'afk_nostr_sdk'; -import { createDrawerNavigator } from '@react-navigation/drawer'; -import { Navbar } from '../components/Navbar'; -import { Settings } from '../screens/Settings'; -import { LaunchDetail } from '../screens/LaunchDetail'; +import {CreateAccount} from '../screens/Auth/CreateAccount'; +import {ImportKeys} from '../screens/Auth/ImportKeys'; +import {Login} from '../screens/Auth/Login'; +import {SaveKeys} from '../screens/Auth/SaveKeys'; +import {ChannelDetail} from '../screens/ChannelDetail'; +import {ChannelsFeed} from '../screens/ChannelsFeed'; +import {CreateChannel} from '../screens/CreateChannel'; +import {CreateForm} from '../screens/CreateForm'; +import {CreatePost} from '../screens/CreatePost'; +import {Defi} from '../screens/Defi'; +import {EditProfile} from '../screens/EditProfile'; +import {Feed} from '../screens/Feed'; +import {Games} from '../screens/Games'; +import {LaunchDetail} from '../screens/LaunchDetail'; +import {PostDetail} from '../screens/PostDetail'; +import {Profile} from '../screens/Profile'; +import {Search} from '../screens/Search'; +import {Settings} from '../screens/Settings'; +import {Tips} from '../screens/Tips'; +import {ThemedStyleSheet} from '../styles'; +import {AuthStackParams, HomeBottomStackParams, MainStackParams, RootStackParams} from '../types'; +import {retrievePublicKey} from '../utils/storage'; const DrawerStack = createDrawerNavigator(); const RootStack = createNativeStackNavigator(); @@ -41,8 +42,8 @@ const HomeBottomTabsStack = createBottomTabNavigator(); const HomeBottomTabNavigator: React.FC = () => { const styles = useStyles(stylesheet); - const { publicKey } = useAuth(); - const { theme } = useTheme(); + const {publicKey} = useAuth(); + const {theme} = useTheme(); return ( { options={{ tabBarActiveTintColor: 'white', tabBarInactiveTintColor: theme.colors.background, - tabBarIcon: ({ focused }) => ( + tabBarIcon: ({focused}) => ( { options={{ tabBarActiveTintColor: 'white', tabBarInactiveTintColor: 'grey', - tabBarIcon: ({ focused }) => ( + tabBarIcon: ({focused}) => ( { options={{ tabBarActiveTintColor: 'white', tabBarInactiveTintColor: 'grey', - tabBarIcon: ({ focused }) => ( + tabBarIcon: ({focused}) => ( { }} /> - {publicKey && + {publicKey && ( ( + tabBarIcon: ({focused}) => ( { ), }} /> - } + )} - {!publicKey && + {!publicKey && ( ( + tabBarIcon: ({focused}) => ( { ), }} /> - } + )} ); }; @@ -169,7 +170,7 @@ const AuthNavigator: React.FC = () => { if (publicKey === undefined) return null; return ( - + {publicKey && } @@ -181,39 +182,37 @@ const AuthNavigator: React.FC = () => { const MainNavigator: React.FC = () => { const dimensions = useWindowDimensions(); const isDesktop = useMemo(() => { - return dimensions.width >= 1024 + return dimensions.width >= 1024; }, [dimensions]); // Adjust based on your breakpoint for desktop - const theme = useTheme() + const theme = useTheme(); return ( } - screenOptions={({ navigation }) => ({ + drawerContent={(props) => } + screenOptions={({navigation}) => ({ // headerShown:false, header: () => , headerStyle: { - backgroundColor: theme.theme.colors.background + backgroundColor: theme.theme.colors.background, }, - drawerType: isDesktop ? "permanent" : "front", + drawerType: isDesktop ? 'permanent' : 'front', // drawerType:"permanent", headerTintColor: theme.theme.colors.text, - overlayColor: isDesktop ? 'transparent' : theme.theme.colors.background, // Make sure overlay settings are correct + overlayColor: isDesktop ? 'transparent' : theme.theme.colors.background, // Make sure overlay settings are correct // swipeEdgeWidth: 0 drawerStyle: { width: 200, // Adjust width or other styling as necessary - } + }, })} > - {!isDesktop ? + {!isDesktop ? ( - : + ) : ( - } + )} @@ -230,7 +229,6 @@ const MainNavigator: React.FC = () => { - ); }; @@ -268,28 +266,26 @@ const linking = { Menu: 'menu', Search: 'search', Details: { - path: 'profile/:publicKey', // Example of a path with a parameter + path: 'profile/:publicKey', // Example of a path with a parameter parse: { - id: (id: any) => `${id}`, // Convert the id from the URL to a string, if needed + id: (id: any) => `${id}`, // Convert the id from the URL to a string, if needed }, }, Profile: { - path: 'details/:id', // Example of a path with a parameter + path: 'details/:id', // Example of a path with a parameter parse: { - id: (id: any) => `${id}`, // Convert the id from the URL to a string, if needed + id: (id: any) => `${id}`, // Convert the id from the URL to a string, if needed }, }, }, - }, }; - const RootNavigator: React.FC = () => { - const { publicKey } = useAuth(); + const {publicKey} = useAuth(); return ( - + {/* */} {publicKey ? ( @@ -321,11 +317,11 @@ const stylesheet = ThemedStyleSheet((theme) => ({ }, container: { flex: 1, - flexDirection: 'row' + flexDirection: 'row', }, content: { flex: 1, - padding: 20 + padding: 20, }, tabBar: { diff --git a/apps/mobile/src/app/Wrapper.tsx b/apps/mobile/src/app/Wrapper.tsx index f0f96502..714ffbb7 100644 --- a/apps/mobile/src/app/Wrapper.tsx +++ b/apps/mobile/src/app/Wrapper.tsx @@ -1,28 +1,28 @@ -import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { GestureHandlerRootView } from 'react-native-gesture-handler'; -import { Host as PortalizeProvider } from 'react-native-portalize'; -import { SafeAreaProvider } from 'react-native-safe-area-context'; +import {QueryClient} from '@tanstack/react-query'; +// import { NostrProvider } from '../context/NostrContext'; +import {TanstackProvider} from 'afk_nostr_sdk'; +import {NostrProvider} from 'afk_nostr_sdk'; +import {GestureHandlerRootView} from 'react-native-gesture-handler'; +import {Host as PortalizeProvider} from 'react-native-portalize'; +import {SafeAreaProvider} from 'react-native-safe-area-context'; -import { RootScreenContainer } from '../components'; -import { DialogProvider } from '../context/Dialog'; -import { KeyModalProvider } from '../context/KeysModal'; -import { ThemeProvider } from '../context/Theme'; -import { TipModalProvider } from '../context/TipModal'; -import { ToastProvider } from '../context/Toast/ToastContext'; -import { TransactionModalProvider } from '../context/TransactionModal'; -import { WalletModalProvider } from '../context/WalletModal'; +import {RootScreenContainer} from '../components'; +import {DialogProvider} from '../context/Dialog'; +import {KeyModalProvider} from '../context/KeysModal'; +import {ThemeProvider} from '../context/Theme'; +import {TipModalProvider} from '../context/TipModal'; +import {TipModalStarknetProvider} from '../context/TipModalStarknet'; +import {ToastProvider} from '../context/Toast/ToastContext'; +import {TokenCreateModalProvider} from '../context/TokenCreateModal'; +import {TransactionModalProvider} from '../context/TransactionModal'; +import {WalletModalProvider} from '../context/WalletModal'; import App from './App'; -import { StarknetProvider } from './StarknetProvider'; -// import { NostrProvider } from '../context/NostrContext'; -import { TanstackProvider } from 'afk_nostr_sdk'; -import { NostrProvider } from 'afk_nostr_sdk'; -import { TipModalStarknetProvider } from '../context/TipModalStarknet'; -import { TokenCreateModalProvider } from '../context/TokenCreateModal'; +import {StarknetProvider} from './StarknetProvider'; const queryClient = new QueryClient({ - defaultOptions: { queries: { retry: 2 } }, + defaultOptions: {queries: {retry: 2}}, }); -const ModalProviders = ({ children }: { children: React.ReactNode }) => { +const ModalProviders = ({children}: {children: React.ReactNode}) => { return ( @@ -42,11 +42,10 @@ const ModalProviders = ({ children }: { children: React.ReactNode }) => { export const Wrapper: React.FC = () => { return ( - + - {/* */} {/* */} @@ -66,7 +65,6 @@ export const Wrapper: React.FC = () => { {/* */} {/* */} - diff --git a/apps/mobile/src/assets/icons.tsx b/apps/mobile/src/assets/icons.tsx index 089321e6..bb32ff1d 100644 --- a/apps/mobile/src/assets/icons.tsx +++ b/apps/mobile/src/assets/icons.tsx @@ -1,4 +1,4 @@ -import Svg, { G, Path, Rect, SvgProps } from 'react-native-svg'; +import Svg, {G, Path, Rect, SvgProps} from 'react-native-svg'; export const AddPostIcon: React.FC = (props) => ( @@ -17,18 +17,23 @@ export const AddPostIcon: React.FC = (props) => ( export const GameIcon: React.FC = (props) => { return ( - + fill="none" + viewBox="0 0 32 32" + > + d="M 16 3 C 14.55 3 13.336007 3.5797556 12.552734 4.4609375 C 11.769462 5.3421194 11.400391 6.4773872 11.400391 7.5996094 C 11.400391 8.7218315 11.769462 9.8590529 12.552734 10.740234 C 12.684189 10.888121 12.845202 11.013079 13 11.142578 L 13 11.632812 L 2.4023438 15.722656 C 1.5531496 16.050203 1.0301181 16.859848 1.0019531 17.664062 C 1.0011783 17.686188 1.0097926 17.708288 1.0097656 17.730469 L 1 17.730469 L 1 22.152344 C 1 22.772954 1.3647211 23.338196 1.921875 23.599609 L 11.005859 27.882812 C 14.164346 29.372377 17.835654 29.372377 20.994141 27.882812 L 30.082031 23.597656 C 30.633469 23.336312 31 22.772954 31 22.152344 L 31 17.732422 L 30.990234 17.732422 C 30.990226 17.709596 30.998844 17.68683 30.998047 17.664062 C 30.969877 16.859848 30.44685 16.050203 29.597656 15.722656 L 19 11.632812 L 19 11.142578 C 19.154798 11.013079 19.315811 10.888121 19.447266 10.740234 C 20.230538 9.8590529 20.599609 8.7218315 20.599609 7.5996094 C 20.599609 6.4773872 20.230538 5.3421194 19.447266 4.4609375 C 18.663993 3.5797556 17.45 3 16 3 z M 16 5 C 16.949999 5 17.536398 5.3202444 17.953125 5.7890625 C 18.369852 6.2578806 18.599609 6.9218315 18.599609 7.5996094 C 18.599609 8.2773872 18.369852 8.9413383 17.953125 9.4101562 C 17.536398 9.8789744 16.949999 10.199219 16 10.199219 C 15.050001 10.199219 14.463602 9.8789744 14.046875 9.4101562 C 13.630148 8.9413382 13.400391 8.2773872 13.400391 7.5996094 C 13.400391 6.9218315 13.630148 6.2578806 14.046875 5.7890625 C 14.463602 5.3202444 15.050001 5 16 5 z M 15 12.101562 C 15.318018 12.164288 15.652124 12.199219 16 12.199219 C 16.347876 12.199219 16.681982 12.164288 17 12.101562 L 17 17.548828 C 17 18.113858 16.56503 18.548828 16 18.548828 C 15.43497 18.548828 15 18.113858 15 17.548828 L 15 12.101562 z M 13 13.777344 L 13 17.548828 C 13 19.193798 14.35503 20.548828 16 20.548828 C 17.64497 20.548828 19 19.193798 19 17.548828 L 19 13.777344 L 28.878906 17.587891 C 29.008074 17.637709 28.99826 17.674197 29 17.732422 C 29.000022 17.73316 28.999974 17.733629 29 17.734375 C 29.0021 17.793905 29.01757 17.826805 28.892578 17.884766 L 19.537109 22.222656 C 17.304967 23.257064 14.693875 23.256941 12.462891 22.222656 L 3.109375 17.884766 C 2.9843856 17.826805 2.997915 17.793909 3 17.734375 C 3.0000519 17.732896 2.9999605 17.73192 3 17.730469 C 3.0015514 17.673511 2.9954893 17.637091 3.1230469 17.587891 L 13 13.777344 z M 8 17 A 2 1 0 0 0 8 19 A 2 1 0 0 0 8 17 z M 3 20.039062 L 11.623047 24.037109 C 14.392063 25.320825 17.609049 25.320702 20.378906 24.037109 L 29 20.039062 L 29 21.896484 L 20.140625 26.074219 C 17.523111 27.308656 14.476889 27.308656 11.859375 26.074219 L 3 21.896484 L 3 20.039062 z" + > - ) -} + ); +}; export const HomeIcon: React.FC = (props) => ( @@ -101,8 +106,8 @@ export const AFKIcon: React.FC = (props) => ( ); @@ -580,17 +585,19 @@ export const MoonIcon: React.FC = (props) => ( // /> // // ); -{/* +{ + /* - */} + */ +} // export const GameIcon: React.FC = (props) => { // return ( // // = (props) => ( // ) // } -{/* +{ + /* @@ -619,7 +627,8 @@ export const MoonIcon: React.FC = (props) => ( - */} + */ +} export const MenuIcon: React.FC = (props) => ( @@ -640,12 +649,10 @@ export const MenuIcon: React.FC = (props) => ( // d="M79.9,36.5c0,0,3.6,0,6.1,0s4.5-2,4.5-4.5c0-2.3-1.8-4.2-4.1-4.5c0-0.2,0.1-0.4,0.1-0.5c0-2.5-2-4.5-4.5-4.5 c-1.4,0-2.7,0.7-3.5,1.7c-0.1-2.6-2.3-4.7-5-4.7c-2.8,0-5,2.2-5,5c0,0.4,0.1,0.9,0.2,1.3C68,25,67.1,24.5,66,24.5 c-1.8,0-3.2,1.3-3.5,3.1c-0.2,0-0.4-0.1-0.5-0.1c-2.5,0-4.5,2-4.5,4.5s2,4.5,4.5,4.5s9.5,0,9.5,0h5.4V37h3V36.5z"> // - /> - {/* d="M87.2,56.7c1.1-2.2,1.8-4.6,1.8-7.2c0-6.6-4.2-12.3-10-14.5c0,0,0,0,0,0c0-11.6-9.4-21-21-21 c-9.8,0-18,6.7-20.3,15.8c-1.5-0.5-3-0.8-4.7-0.8c-7.7,0-14,5.8-14.9,13.3C12.9,43.4,9,48,9,53.5C9,59.9,14.1,65,20.5,65 c0.2,0,0.4,0,0.5,0c0,0.2,0,0.3,0,0.5C21,76.8,30.2,86,41.5,86c6.4,0,12.2-3,15.9-7.6c2.2,2.2,5.2,3.6,8.6,3.6 c4.7,0,8.7-2.7,10.7-6.5c1.1,0.3,2.2,0.5,3.3,0.5c6.1,0,11-4.9,11-11C91,61.7,89.5,58.7,87.2,56.7z" */} - {/* d="M87.2,56.7c1.1-2.2,1.8-4.6,1.8-7.2c0-6.6-4.2-12.3-10-14.5c0,0,0,0,0,0c0-11.6-9.4-21-21-21 c-9.8,0-18,6.7-20.3,15.8c-1.5-0.5-3-0.8-4.7-0.8c-7.7,0-14,5.8-14.9,13.3C12.9,43.4,9,48,9,53.5C9,59.9,14.1,65,20.5,65 c0.2,0,0.4,0,0.5,0c0,0.2,0,0.3,0,0.5C21,76.8,30.2,86,41.5,86c6.4,0,12.2-3,15.9-7.6c2.2,2.2,5.2,3.6,8.6,3.6 c4.7,0,8.7-2.7,10.7-6.5c1.1,0.3,2.2,0.5,3.3,0.5c6.1,0,11-4.9,11-11C91,61.7,89.5,58.7,87.2,56.7z" */} + {/* d="M87.2,56.7c1.1-2.2,1.8-4.6,1.8-7.2c0-6.6-4.2-12.3-10-14.5c0,0,0,0,0,0c0-11.6-9.4-21-21-21 c-9.8,0-18,6.7-20.3,15.8c-1.5-0.5-3-0.8-4.7-0.8c-7.7,0-14,5.8-14.9,13.3C12.9,43.4,9,48,9,53.5C9,59.9,14.1,65,20.5,65 c0.2,0,0.4,0,0.5,0c0,0.2,0,0.3,0,0.5C21,76.8,30.2,86,41.5,86c6.4,0,12.2-3,15.9-7.6c2.2,2.2,5.2,3.6,8.6,3.6 c4.7,0,8.7-2.7,10.7-6.5c1.1,0.3,2.2,0.5,3.3,0.5c6.1,0,11-4.9,11-11C91,61.7,89.5,58.7,87.2,56.7z" */} ); // export const MenuIcon: React.FC = (props) => ( @@ -661,4 +668,4 @@ export const MenuIcon: React.FC = (props) => ( // d="M87.2,56.7c1.1-2.2,1.8-4.6,1.8-7.2c0-6.6-4.2-12.3-10-14.5c0,0,0,0,0,0c0-11.6-9.4-21-21-21 c-9.8,0-18,6.7-20.3,15.8c-1.5-0.5-3-0.8-4.7-0.8c-7.7,0-14,5.8-14.9,13.3C12.9,43.4,9,48,9,53.5C9,59.9,14.1,65,20.5,65 c0.2,0,0.4,0,0.5,0c0,0.2,0,0.3,0,0.5C21,76.8,30.2,86,41.5,86c6.4,0,12.2-3,15.9-7.6c2.2,2.2,5.2,3.6,8.6,3.6 c4.7,0,8.7-2.7,10.7-6.5c1.1,0.3,2.2,0.5,3.3,0.5c6.1,0,11-4.9,11-11C91,61.7,89.5,58.7,87.2,56.7z" // /> // -// ); \ No newline at end of file +// ); diff --git a/apps/mobile/src/components/BubbleLive/index.tsx b/apps/mobile/src/components/BubbleLive/index.tsx index 282f3ce9..ddeb62ef 100644 --- a/apps/mobile/src/components/BubbleLive/index.tsx +++ b/apps/mobile/src/components/BubbleLive/index.tsx @@ -1,12 +1,12 @@ import {NDKEvent, NDKUserProfile} from '@nostr-dev-kit/ndk'; import {useNavigation} from '@react-navigation/native'; +import {useProfile} from 'afk_nostr_sdk'; import {Image, ImageSourcePropType, Pressable, View} from 'react-native'; // import {useProfile} from '../../hooks'; import {MainStackNavigationProps} from '../../types'; import {Text} from '../Text'; import styles from './styles'; -import {useProfile} from "afk_nostr_sdk" export type StoryProps = { imageProps?: ImageSourcePropType; diff --git a/apps/mobile/src/components/BubbleLive/styles.ts b/apps/mobile/src/components/BubbleLive/styles.ts index 4f0f1965..e9c6ddbe 100644 --- a/apps/mobile/src/components/BubbleLive/styles.ts +++ b/apps/mobile/src/components/BubbleLive/styles.ts @@ -1,4 +1,5 @@ import {StyleSheet} from 'react-native'; + import {Spacing} from '../../styles'; export default StyleSheet.create({ @@ -17,13 +18,13 @@ export default StyleSheet.create({ display: 'flex', alignItems: 'center', justifyContent: 'center', - borderRadius:15 + borderRadius: 15, }, image: { position: 'absolute', width: 35, height: 35, - borderRadius:15 + borderRadius: 15, }, name: { diff --git a/apps/mobile/src/components/BubbleUser/index.tsx b/apps/mobile/src/components/BubbleUser/index.tsx index 86a262de..9e528d3d 100644 --- a/apps/mobile/src/components/BubbleUser/index.tsx +++ b/apps/mobile/src/components/BubbleUser/index.tsx @@ -1,12 +1,12 @@ import {NDKEvent, NDKUserProfile} from '@nostr-dev-kit/ndk'; import {useNavigation} from '@react-navigation/native'; +import {useProfile} from 'afk_nostr_sdk'; import {Image, ImageSourcePropType, Pressable, View} from 'react-native'; // import {useProfile} from '../../hooks'; import {MainStackNavigationProps} from '../../types'; import {Text} from '../Text'; import styles from './styles'; -import {useProfile} from "afk_nostr_sdk" export type StoryProps = { imageProps?: ImageSourcePropType; diff --git a/apps/mobile/src/components/BubbleUser/styles.ts b/apps/mobile/src/components/BubbleUser/styles.ts index 4f0f1965..e9c6ddbe 100644 --- a/apps/mobile/src/components/BubbleUser/styles.ts +++ b/apps/mobile/src/components/BubbleUser/styles.ts @@ -1,4 +1,5 @@ import {StyleSheet} from 'react-native'; + import {Spacing} from '../../styles'; export default StyleSheet.create({ @@ -17,13 +18,13 @@ export default StyleSheet.create({ display: 'flex', alignItems: 'center', justifyContent: 'center', - borderRadius:15 + borderRadius: 15, }, image: { position: 'absolute', width: 35, height: 35, - borderRadius:15 + borderRadius: 15, }, name: { diff --git a/apps/mobile/src/components/Embed/EmbedWebsite.tsx b/apps/mobile/src/components/Embed/EmbedWebsite.tsx index 160ccc17..1ded334b 100644 --- a/apps/mobile/src/components/Embed/EmbedWebsite.tsx +++ b/apps/mobile/src/components/Embed/EmbedWebsite.tsx @@ -1,33 +1,30 @@ import React from 'react'; -import { Platform, StyleSheet, View } from 'react-native'; +import {Platform, StyleSheet, View} from 'react-native'; import WebView from 'react-native-webview'; interface EmbedWebsiteInterface { - uri?: string + uri?: string; } -const EmbedWebsite = ({ uri }: EmbedWebsiteInterface) => { +const EmbedWebsite = ({uri}: EmbedWebsiteInterface) => { + const isWeb = Platform.OS == 'web'; - const isWeb = Platform.OS == "web" - - if (isWeb) { - return - } - return ( - - - - ); + if (isWeb) { + return ; + } + return ( + + + + ); }; const styles = StyleSheet.create({ - container: { - flex: 1, - }, + container: { + flex: 1, + }, }); export default EmbedWebsite; diff --git a/apps/mobile/src/components/Embed/index.tsx b/apps/mobile/src/components/Embed/index.tsx index b3d347c9..be31f916 100644 --- a/apps/mobile/src/components/Embed/index.tsx +++ b/apps/mobile/src/components/Embed/index.tsx @@ -1,80 +1,62 @@ -import React, { useState } from 'react'; -import { Platform, StyleSheet, View, Text, Pressable, Image } from 'react-native'; -import WebView from 'react-native-webview'; -import { Button } from '../Button'; -import EmbedWebsite from './EmbedWebsite'; -import stylesheet from "./styles" -import { useStyles } from '../../hooks'; -import { Link } from '@react-navigation/native'; import * as Linking from 'expo-linking'; -import { Avatar } from '../Avatar'; +import React, {useState} from 'react'; +import {Image, StyleSheet, Text, View} from 'react-native'; + +import {useStyles} from '../../hooks'; +import {Button} from '../Button'; +import EmbedWebsite from './EmbedWebsite'; +import stylesheet from './styles'; interface EmbedWebsiteInterface { - uri?: string - title?: string; - twitter?: string; - description?: string; - img?: string; + uri?: string; + title?: string; + twitter?: string; + description?: string; + img?: string; } -const EmbedCard = ({ uri, title, twitter, description, img }: EmbedWebsiteInterface) => { - const [isOpen, setIsOpen] = useState(false) - const styles = useStyles(stylesheet) - const handleOpen = () => { - setIsOpen(!isOpen) - } - - const handleGoTo = () => { - if(uri) { - Linking.openURL(uri) - } +const EmbedCard = ({uri, title, twitter, description, img}: EmbedWebsiteInterface) => { + const [isOpen, setIsOpen] = useState(false); + const styles = useStyles(stylesheet); + const handleOpen = () => { + setIsOpen(!isOpen); + }; + + const handleGoTo = () => { + if (uri) { + Linking.openURL(uri); } - return ( - - - - {img && - - } - - - {title && - {title} - } - - {description && - {description} - } - - - - - {/* */} - - - - - {isOpen && - - - - } - - + }; + return ( + + {img && } + + {title && {title}} + + {description && {description}} + + + {/* */} + + + + {isOpen && ( + + - ) + )} + + ); }; const styles = StyleSheet.create({ - container: { - flex: 1, - }, + container: { + flex: 1, + }, }); -export default EmbedCard; \ No newline at end of file +export default EmbedCard; diff --git a/apps/mobile/src/components/Embed/styles.ts b/apps/mobile/src/components/Embed/styles.ts index 885078b9..ed77b21f 100644 --- a/apps/mobile/src/components/Embed/styles.ts +++ b/apps/mobile/src/components/Embed/styles.ts @@ -6,9 +6,9 @@ export default ThemedStyleSheet((theme) => ({ container: { backgroundColor: theme.colors.surface, color: theme.colors.text, - padding:Spacing.medium, + padding: Spacing.medium, marginHorizontal: Spacing.medium, - marginBottom:Spacing.normal, + marginBottom: Spacing.normal, borderRadius: 16, borderBottomColor: theme.colors.divider, }, @@ -35,11 +35,10 @@ export default ThemedStyleSheet((theme) => ({ title: { flex: 1, - color:theme.colors.text, - + color: theme.colors.text, }, - text:{ - color:theme.colors.text + text: { + color: theme.colors.text, }, buttons: { diff --git a/apps/mobile/src/components/Header/index.tsx b/apps/mobile/src/components/Header/index.tsx index ccfd6bac..07b15268 100644 --- a/apps/mobile/src/components/Header/index.tsx +++ b/apps/mobile/src/components/Header/index.tsx @@ -1,10 +1,9 @@ -import { Image, View } from 'react-native'; -import { SafeAreaView } from 'react-native-safe-area-context'; +import {Image, View} from 'react-native'; +import {SafeAreaView} from 'react-native-safe-area-context'; -import { useStyles, useTheme } from '../../hooks'; -import { Text } from '../Text'; +import {useStyles, useTheme} from '../../hooks'; +import {Text} from '../Text'; import stylesheet from './styles'; -import { AFKIcon } from '../../assets/icons'; export type HeaderProps = { showLogo?: boolean; @@ -13,8 +12,8 @@ export type HeaderProps = { title?: string; }; -export const Header: React.FC = ({ showLogo = true, left, right, title }) => { - const { theme } = useTheme(); +export const Header: React.FC = ({showLogo = true, left, right, title}) => { + const {theme} = useTheme(); const styles = useStyles(stylesheet); return ( @@ -24,10 +23,7 @@ export const Header: React.FC = ({ showLogo = true, left, right, ti {showLogo && ( - + {/* */} )} diff --git a/apps/mobile/src/components/HeaderScreen/index.tsx b/apps/mobile/src/components/HeaderScreen/index.tsx index a2763476..37092539 100644 --- a/apps/mobile/src/components/HeaderScreen/index.tsx +++ b/apps/mobile/src/components/HeaderScreen/index.tsx @@ -1,10 +1,9 @@ -import { Image, View } from 'react-native'; -import { SafeAreaView } from 'react-native-safe-area-context'; +import {Image, View} from 'react-native'; +import {SafeAreaView} from 'react-native-safe-area-context'; -import { useStyles, useTheme } from '../../hooks'; -import { Text } from '../Text'; +import {useStyles, useTheme} from '../../hooks'; +import {Text} from '../Text'; import stylesheet from './styles'; -import { AFKIcon } from '../../assets/icons'; export type HeaderProps = { showLogo?: boolean; @@ -13,8 +12,8 @@ export type HeaderProps = { title?: string; }; -export const HeaderScreen: React.FC = ({ showLogo = true, left, right, title }) => { - const { theme } = useTheme(); +export const HeaderScreen: React.FC = ({showLogo = true, left, right, title}) => { + const {theme} = useTheme(); const styles = useStyles(stylesheet); return ( @@ -24,10 +23,7 @@ export const HeaderScreen: React.FC = ({ showLogo = true, left, rig {showLogo && ( - + {/* */} )} diff --git a/apps/mobile/src/components/HeaderScreen/styles.ts b/apps/mobile/src/components/HeaderScreen/styles.ts index 721c587b..88127c2e 100644 --- a/apps/mobile/src/components/HeaderScreen/styles.ts +++ b/apps/mobile/src/components/HeaderScreen/styles.ts @@ -3,8 +3,7 @@ import {StyleSheet} from 'react-native'; import {Spacing, ThemedStyleSheet} from '../../styles'; export default ThemedStyleSheet((theme) => ({ - container: { - }, + container: {}, content: { width: '100%', flexDirection: 'row', diff --git a/apps/mobile/src/components/KeyCardUser/index.tsx b/apps/mobile/src/components/KeyCardUser/index.tsx index 0a1f1b7f..e0b7f0b4 100644 --- a/apps/mobile/src/components/KeyCardUser/index.tsx +++ b/apps/mobile/src/components/KeyCardUser/index.tsx @@ -1,45 +1,49 @@ -import { NDKEvent, NDKUserProfile } from '@nostr-dev-kit/ndk'; -import { useNavigation } from '@react-navigation/native'; -import { Image, ImageSourcePropType, Pressable, TextInput, View, } from 'react-native'; - +import {NDKEvent, NDKUserProfile} from '@nostr-dev-kit/ndk'; +import {useNavigation} from '@react-navigation/native'; +import {useAccount} from '@starknet-react/core'; +import {Fraction} from '@uniswap/sdk-core'; +import {useProfile} from 'afk_nostr_sdk'; +import {useState} from 'react'; +import {ImageSourcePropType, View} from 'react-native'; + +import {useStyles, useWaitConnection} from '../../hooks'; +import {useBuyKeys} from '../../hooks/keys/useBuyKeys'; +import {useSellKeys} from '../../hooks/keys/useSellKeys'; +import {useWalletModal} from '../../hooks/modals'; // import {useProfile} from '../../hooks'; -import { MainStackNavigationProps } from '../../types'; -import { Text } from '../Text'; -import { useProfile } from "afk_nostr_sdk" -import { KeysUser } from '../../types/keys'; -import { Fraction } from '@uniswap/sdk-core'; -import { decimalsScale } from '../../utils/helpers'; -import { cairo, uint256 } from 'starknet'; -import { feltToAddress } from '../../utils/format'; -import { useSellKeys } from '../../hooks/keys/useSellKeys'; -import { useBuyKeys } from '../../hooks/keys/useBuyKeys'; -import { useAccount } from '@starknet-react/core'; -import { useState } from 'react'; -import { Button } from '../Button'; +import {MainStackNavigationProps} from '../../types'; +import {KeysUser} from '../../types/keys'; +import {feltToAddress} from '../../utils/format'; +import {decimalsScale} from '../../utils/helpers'; +import {Button} from '../Button'; +import {Input} from '../Input'; +import {Text} from '../Text'; import stylesheet from './styles'; -import { useStyles, useWaitConnection } from '../../hooks'; -import { useWalletModal } from '../../hooks/modals'; -import { Input } from '../Input'; export type StoryProps = { imageProps?: ImageSourcePropType; name?: string; event?: NDKEvent; profileProps?: NDKUserProfile; - keyUser?: KeysUser + keyUser?: KeysUser; }; -export const KeyCardUser: React.FC = ({ keyUser, imageProps, name, profileProps, event }) => { - const { data: profile } = useProfile({ publicKey: event?.pubkey }); - const account = useAccount() - - const styles = useStyles(stylesheet) +export const KeyCardUser: React.FC = ({ + keyUser, + imageProps, + name, + profileProps, + event, +}) => { + const {data: profile} = useProfile({publicKey: event?.pubkey}); + const account = useAccount(); - const [amount, setAmount] = useState() + const styles = useStyles(stylesheet); + const [amount, setAmount] = useState(); - const { handleSellKeys } = useSellKeys() - const { handleBuyKeys } = useBuyKeys() + const {handleSellKeys} = useSellKeys(); + const {handleBuyKeys} = useBuyKeys(); const waitConnection = useWaitConnection(); const walletModal = useWalletModal(); @@ -54,7 +58,7 @@ export const KeyCardUser: React.FC = ({ keyUser, imageProps, name, p const sellKeys = async () => { if (!amount) return; - await onConnect() + await onConnect(); if (!account || !account?.account) return; if (!keyUser?.owner) return; @@ -62,14 +66,19 @@ export const KeyCardUser: React.FC = ({ keyUser, imageProps, name, p if (!keyUser?.token_quote) return; // handleSellKeys(account?.account, keyUser?.owner, Number(amount), keyUser?.token_quote, undefined) - handleSellKeys(account?.account, feltToAddress(BigInt(keyUser?.owner)), Number(amount), keyUser?.token_quote, undefined) - - } + handleSellKeys( + account?.account, + feltToAddress(BigInt(keyUser?.owner)), + Number(amount), + keyUser?.token_quote, + undefined, + ); + }; const buyKeys = async () => { if (!amount) return; - await onConnect() + await onConnect(); if (!account || !account?.account) return; @@ -77,8 +86,13 @@ export const KeyCardUser: React.FC = ({ keyUser, imageProps, name, p if (!keyUser?.token_quote) return; // handleBuyKeys(account?.account, keyUser?.owner, keyUser?.token_quote, Number(amount),) - handleBuyKeys(account?.account, feltToAddress(BigInt(keyUser?.owner)), Number(amount), keyUser?.token_quote,) - } + handleBuyKeys( + account?.account, + feltToAddress(BigInt(keyUser?.owner)), + Number(amount), + keyUser?.token_quote, + ); + }; const navigation = useNavigation(); // const handleNavigateToProfile = () => { // if (!event?.id) return; @@ -92,19 +106,12 @@ export const KeyCardUser: React.FC = ({ keyUser, imageProps, name, p if (keyUser?.created_at) { created_at = new Fraction(String(keyUser.created_at), decimalsScale(18)).toFixed(18); - } return ( - - {keyUser?.owner && - - Owner: {feltToAddress(BigInt(keyUser.owner))} - - - } + {keyUser?.owner && Owner: {feltToAddress(BigInt(keyUser.owner))}} {/* = ({ keyUser, imageProps, name, p {profile?.name ?? profile?.nip05 ?? profile?.displayName ?? 'Anon AFK'} */} - - Supply: {Number(keyUser?.total_supply) / 10 ** 18} - - - Supply: {Number(keyUser?.total_supply)} - - - Price: {Number(keyUser?.price) / 10 ** 18} - + Supply: {Number(keyUser?.total_supply) / 10 ** 18} + Supply: {Number(keyUser?.total_supply)} + Price: {Number(keyUser?.price) / 10 ** 18} {/* {keyUser?.created_at && Created at {Number(keyUser?.created_at) / 10 ** 18} } */} - - {keyUser?.token_quote && - + {keyUser?.token_quote && ( + Token quote - - Quote token: {feltToAddress(BigInt(keyUser.token_quote?.token_address))} - - - Step increase: {Number(keyUser.token_quote?.step_increase_linear) / 10 ** 18} - - } - - { - setAmount(Number(e)) - // if (e && Number(e) ) { - // setAmount(Number(e)) - // } - - // if (e ) { - // setAmount(Number(0)) - // } - }} placeholder="Amount" /> - - - - diff --git a/apps/mobile/src/components/KeyCardUser/styles.ts b/apps/mobile/src/components/KeyCardUser/styles.ts index 4f4fbeeb..3f506db2 100644 --- a/apps/mobile/src/components/KeyCardUser/styles.ts +++ b/apps/mobile/src/components/KeyCardUser/styles.ts @@ -1,4 +1,4 @@ -import { Spacing, ThemedStyleSheet } from '../../styles'; +import {Spacing, ThemedStyleSheet} from '../../styles'; export default ThemedStyleSheet((theme) => ({ container: { // alignItems: 'center', @@ -6,25 +6,24 @@ export default ThemedStyleSheet((theme) => ({ padding: Spacing.xsmall, borderRadius: 8, gap: Spacing.xsmall, - overflowWrap:"break-word", - width:300, + overflowWrap: 'break-word', + width: 300, }, imageContainer: { // position: 'relative', // display: 'flex', // alignItems: 'center', // justifyContent: 'center', - borderRadius: 15 - }, - text:{ + borderRadius: 15, }, + text: {}, image: { position: 'absolute', width: 35, height: 35, - borderRadius: 15 + borderRadius: 15, }, name: { paddingTop: Spacing.xxsmall, }, -})) +})); diff --git a/apps/mobile/src/components/Menu/index.tsx b/apps/mobile/src/components/Menu/index.tsx index 832d2f65..07765d77 100644 --- a/apps/mobile/src/components/Menu/index.tsx +++ b/apps/mobile/src/components/Menu/index.tsx @@ -81,7 +81,6 @@ const Menu: React.FC & MenuSubComponents = ({handle, open, onClose, c left: X, }; } - }, [width, animation]); return ( diff --git a/apps/mobile/src/components/Modalize/styles.ts b/apps/mobile/src/components/Modalize/styles.ts index 98aff482..aecd4b74 100644 --- a/apps/mobile/src/components/Modalize/styles.ts +++ b/apps/mobile/src/components/Modalize/styles.ts @@ -1,4 +1,4 @@ -import {Dimensions, Platform} from 'react-native'; +import {Platform} from 'react-native'; import {Spacing, ThemedStyleSheet} from '../../styles'; @@ -6,9 +6,9 @@ export default ThemedStyleSheet((theme) => ({ modal: { backgroundColor: theme.colors.surface, // width:Dimensions.get("window").width >= 1024 ? 300 : "100%", - // flex: 1, - // justifyContent: 'center', - // alignItems: 'center' + // flex: 1, + // justifyContent: 'center', + // alignItems: 'center' }, header: { diff --git a/apps/mobile/src/components/Navbar/index.tsx b/apps/mobile/src/components/Navbar/index.tsx index f09d1764..cc75cfb1 100644 --- a/apps/mobile/src/components/Navbar/index.tsx +++ b/apps/mobile/src/components/Navbar/index.tsx @@ -1,34 +1,29 @@ import * as React from 'react'; -import { View, Text, TouchableOpacity, StyleSheet, Image } from 'react-native'; -import { useStyles } from '../../hooks'; +import {Image, Text, TouchableOpacity, View} from 'react-native'; -import stylesheet from "./styles"; -import { Icon } from '../Icon'; +import {useStyles} from '../../hooks'; +import {Icon} from '../Icon'; +import stylesheet from './styles'; interface CustomHeaderInterface { - title?: string - navigation?: any - showLogo?: boolean; + title?: string; + navigation?: any; + showLogo?: boolean; } -export const Navbar = ({ title, navigation, showLogo }: CustomHeaderInterface) => { - const styles = useStyles(stylesheet) - // const navigation = useNavigation() - return ( - - {showLogo && ( - - - {/* */} - - )} - {title} - - navigation?.openDrawer() - } style={styles.burgerIcon}> - - +export const Navbar = ({title, navigation, showLogo}: CustomHeaderInterface) => { + const styles = useStyles(stylesheet); + // const navigation = useNavigation() + return ( + + {showLogo && ( + + + {/* */} - ); -} \ No newline at end of file + )} + {title} + navigation?.openDrawer()} style={styles.burgerIcon}> + + + + ); +}; diff --git a/apps/mobile/src/components/Navbar/styles.ts b/apps/mobile/src/components/Navbar/styles.ts index 7cd9b11e..389ea8cb 100644 --- a/apps/mobile/src/components/Navbar/styles.ts +++ b/apps/mobile/src/components/Navbar/styles.ts @@ -1,37 +1,33 @@ -import { Spacing, ThemedStyleSheet } from "../../styles"; +import {Spacing, ThemedStyleSheet} from '../../styles'; export default ThemedStyleSheet((theme) => ({ - - - // const styles = StyleSheet.create({ - header: { - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'space-between', - height: 60, - paddingHorizontal: 15, - backgroundColor: theme.colors.background, - color: theme.colors.text, - borderBottomWidth: 1, - // borderBottomColor: '#ddd', - }, - headerTitle: { - fontSize: 20, - fontWeight: 'bold', - color:theme.colors.text, - }, - burgerIcon: { - padding: 5, - }, - logoContainer: { - flexDirection: 'row', - alignItems: 'center', - }, - logo: { - width: 40, - height: 40, - marginRight: Spacing.xsmall, - }, - - -})) \ No newline at end of file + // const styles = StyleSheet.create({ + header: { + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + height: 60, + paddingHorizontal: 15, + backgroundColor: theme.colors.background, + color: theme.colors.text, + borderBottomWidth: 1, + // borderBottomColor: '#ddd', + }, + headerTitle: { + fontSize: 20, + fontWeight: 'bold', + color: theme.colors.text, + }, + burgerIcon: { + padding: 5, + }, + logoContainer: { + flexDirection: 'row', + alignItems: 'center', + }, + logo: { + width: 40, + height: 40, + marginRight: Spacing.xsmall, + }, +})); diff --git a/apps/mobile/src/components/PrivateKeyImport/index.tsx b/apps/mobile/src/components/PrivateKeyImport/index.tsx new file mode 100644 index 00000000..be8c31a7 --- /dev/null +++ b/apps/mobile/src/components/PrivateKeyImport/index.tsx @@ -0,0 +1,98 @@ +import {useTheme} from '@react-navigation/native'; +import {useAuth} from 'afk_nostr_sdk'; +import * as Clipboard from 'expo-clipboard'; +import {useState} from 'react'; +import {Pressable, TouchableOpacity, View} from 'react-native'; + +import {CopyIconStack, LockIcon} from '../../assets/icons'; +import {useToast} from '../../hooks/modals'; +import {getPublicKeyFromSecret} from '../../utils/keypair'; +import { + retrieveAndDecryptPrivateKey, + retrievePassword, + retrievePublicKey, +} from '../../utils/storage'; +import {Input} from '../Input'; +import {Text} from '../Text'; +import styles from './styles'; +import { Button } from '../Button'; + +export const PrivateKeyImport: React.FC = () => { + const {publicKey, isExtension, privateKey, setAuth} = useAuth(); + const [isPasswordOk, setIsPasswordOk] = useState(false); + const theme = useTheme(); + const {showToast} = useToast(); + const [password, setPassword] = useState(''); + + const handleCopy = async (type: 'privateKey' | 'publicKey') => { + await Clipboard.setStringAsync(type === 'privateKey' ? privateKey : publicKey); + showToast({type: 'info', title: 'Copied to clipboard'}); + }; + + const handlePassword = async () => { + if (!password) { + showToast({type: 'error', title: 'Password is required'}); + return; + } + const passwordRetrieve = await retrievePassword(); + if (password != passwordRetrieve) { + showToast({type: 'error', title: 'Invalid password'}); + return; + } + const privateKey = await retrieveAndDecryptPrivateKey(password); + if (!privateKey || privateKey.length !== 32) { + showToast({type: 'error', title: 'Invalid password'}); + return; + } + const privateKeyHex = privateKey.toString('hex'); + const storedPublicKey = await retrievePublicKey(); + const publicKey = getPublicKeyFromSecret(privateKeyHex); + + if (publicKey !== storedPublicKey) { + setIsPasswordOk(false); + showToast({type: 'error', title: 'Invalid password'}); + return; + } + setIsPasswordOk(true); + }; + + return ( + + Enter your password to import your private key + + } + value={password} + onChangeText={setPassword} + secureTextEntry + placeholder="Password" + /> + + + + {isPasswordOk && ( + <> + + Your private key + + handleCopy('privateKey')} + style={{ + marginRight: 10, + }} + > + + + } + /> + + )} + + ); +}; diff --git a/apps/mobile/src/components/PrivateKeyImport/styles.ts b/apps/mobile/src/components/PrivateKeyImport/styles.ts new file mode 100644 index 00000000..e9c6ddbe --- /dev/null +++ b/apps/mobile/src/components/PrivateKeyImport/styles.ts @@ -0,0 +1,33 @@ +import {StyleSheet} from 'react-native'; + +import {Spacing} from '../../styles'; + +export default StyleSheet.create({ + container: { + alignItems: 'center', + // width: 100, // Set a fixed width for each item + // height: 100, // Set a fixed height for each item + // justifyContent: 'center', + // // alignItems: 'center', + // marginHorizontal: 10, + // backgroundColor: '#ddd', + }, + + imageContainer: { + position: 'relative', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + borderRadius: 15, + }, + image: { + position: 'absolute', + width: 35, + height: 35, + borderRadius: 15, + }, + + name: { + paddingTop: Spacing.xxsmall, + }, +}); diff --git a/apps/mobile/src/components/RelaysConfig/index.tsx b/apps/mobile/src/components/RelaysConfig/index.tsx new file mode 100644 index 00000000..3cda6296 --- /dev/null +++ b/apps/mobile/src/components/RelaysConfig/index.tsx @@ -0,0 +1,129 @@ +import { useSettingsStore } from 'afk_nostr_sdk'; +import { useState } from 'react'; +import { View } from 'react-native'; +import { useToast } from '../../hooks/modals'; +import { Input } from '../Input'; +import { Text } from '../Text'; +import { useStyles } from '../../hooks'; +import { Button } from '../Button'; +import { AFK_RELAYS } from 'afk_nostr_sdk/src/utils/relay'; +import stylesheet from './styles'; + +export const RelaysConfig: React.FC = () => { + const { showToast } = useToast(); + const styles = useStyles(stylesheet) + const { relays, setRelays } = useSettingsStore(); + const RELAYS_USED = relays; + const AFK_DEFAULT_RELAYS = AFK_RELAYS; + const [relaysUpdated, setRelaysUpdated] = useState(relays) + const [openUpdateMenu, setOpenUpdateMenu] = useState(false) + const [relayToAdd, setRelayToAdd] = useState() + + const removeRelay = (relay: string) => { + const newRelays = relaysUpdated.filter((r) => r != relay) + console.log("newRelays") + setRelaysUpdated(newRelays) + } + + const addRelay = (relay?: string) => { + if (!relay) { + showToast({ type: "error", title: 'Add a relay' }); + return; + } + if (!relay?.includes("wss://")) { + showToast({ type: "error", title: 'add wss://' }); + return; + } + const newRelays = [...relaysUpdated, relay] + /** @TODO add verify validity of the relayer */ + + setRelaysUpdated(newRelays) + } + + const updateRelayToUsed = () => { + setRelays(relaysUpdated) + } + + const resetDefault = () => { + setRelays(AFK_DEFAULT_RELAYS) + setRelaysUpdated(AFK_DEFAULT_RELAYS) + } + + const handleOpenMenu = () => { + setOpenUpdateMenu(!openUpdateMenu) + } + + return ( + + + AFK: All relays used + {RELAYS_USED?.map((r, i) => { + return ( + + + Relay: {r} + + + ); + })} + + + You can setup your relays + + + + {openUpdateMenu && + + {relaysUpdated?.map((r, i) => { + return ( + + + Relay: {r} + + + + + ); + })} + addRelay(relayToAdd)}> + Add this relay + + } + value={relayToAdd} + onChangeText={setRelayToAdd} + placeholder="Relay" + /> + + + + + + } + + + ); +}; diff --git a/apps/mobile/src/components/RelaysConfig/styles.ts b/apps/mobile/src/components/RelaysConfig/styles.ts new file mode 100644 index 00000000..0910ac3c --- /dev/null +++ b/apps/mobile/src/components/RelaysConfig/styles.ts @@ -0,0 +1,46 @@ +import { Spacing, ThemedStyleSheet } from '../../styles'; +export default ThemedStyleSheet((theme) => ({ + container: { + marginHorizontal: 10, + alignItems:"center" + }, + relayItem: { + flex:1, + flexDirection:"row", + gap:3, + alignItems:"center" + }, + relayText: { + width:"100%" + }, + relayButton: { + }, + title: { + color: theme.colors.text, + fontSize: 24, + marginBottom: 4, + }, + text: { + color: theme.colors.text, + }, + imageContainer: { + position: 'relative', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + borderRadius: 15, + }, + image: { + position: 'absolute', + width: 35, + height: 35, + borderRadius: 15, + }, + button: { + marginVertical: 5 + }, + + name: { + paddingTop: Spacing.xxsmall, + }, +})); diff --git a/apps/mobile/src/components/Skeleton/RootScreenContainer.tsx b/apps/mobile/src/components/Skeleton/RootScreenContainer.tsx index fd3665bc..fd22604e 100644 --- a/apps/mobile/src/components/Skeleton/RootScreenContainer.tsx +++ b/apps/mobile/src/components/Skeleton/RootScreenContainer.tsx @@ -1,11 +1,9 @@ -import { Dimensions, Platform, View, ViewProps } from 'react-native'; +import {Dimensions, Platform, View, ViewProps} from 'react-native'; -import { WEB_MAX_WIDTH } from '../../constants/misc'; -import { useStyles } from '../../hooks'; -import { ThemedStyleSheet } from '../../styles'; -import Sidebar from '../../modules/Layout/sidebar'; +import {useStyles} from '../../hooks'; +import {ThemedStyleSheet} from '../../styles'; -export const RootScreenContainer: React.FC = ({ style, children, ...props }) => { +export const RootScreenContainer: React.FC = ({style, children, ...props}) => { const styles = useStyles(stylesheet); const isWeb = Platform.OS === 'web'; const windowWidth = Dimensions.get('window').width; @@ -14,7 +12,8 @@ export const RootScreenContainer: React.FC = ({ style, children, ...p {/* {shouldShowSidebar && } */} - {children} + {children} + ); }; @@ -23,15 +22,14 @@ const stylesheet = ThemedStyleSheet((theme) => ({ container: { flex: 1, backgroundColor: theme.colors.background, - flexDirection: "row", + flexDirection: 'row', width: '100%', - }, content: { flex: 1, width: '100%', maxWidth: '100%', - flexDirection: "row", + flexDirection: 'row', // width: '100%', }, })); diff --git a/apps/mobile/src/components/TokenLaunchCard/index.tsx b/apps/mobile/src/components/TokenLaunchCard/index.tsx index 883e940c..5b6aae71 100644 --- a/apps/mobile/src/components/TokenLaunchCard/index.tsx +++ b/apps/mobile/src/components/TokenLaunchCard/index.tsx @@ -1,27 +1,24 @@ -import { NDKEvent, NDKUserProfile } from '@nostr-dev-kit/ndk'; -import { useNavigation } from '@react-navigation/native'; -import { Image, ImageSourcePropType, Pressable, TextInput, View, } from 'react-native'; - +import {NDKEvent, NDKUserProfile} from '@nostr-dev-kit/ndk'; +import {useNavigation} from '@react-navigation/native'; +import {useAccount} from '@starknet-react/core'; +import {Fraction} from '@uniswap/sdk-core'; +import {useProfile} from 'afk_nostr_sdk'; +import {useState} from 'react'; +import {ImageSourcePropType, View} from 'react-native'; + +import {useStyles, useWaitConnection} from '../../hooks'; +import {useBuyCoinByQuoteAmount} from '../../hooks/launchpad/useBuyCoinByQuoteAmount'; +import {useSellCoin} from '../../hooks/launchpad/useSellCoin'; +import {useWalletModal} from '../../hooks/modals'; // import {useProfile} from '../../hooks'; -import { MainStackNavigationProps } from '../../types'; -import { Text } from '../Text'; -import { useProfile } from "afk_nostr_sdk" -import { KeysUser, TokenLaunchInterface } from '../../types/keys'; -import { Fraction } from '@uniswap/sdk-core'; -import { decimalsScale } from '../../utils/helpers'; -import { cairo, uint256 } from 'starknet'; -import { feltToAddress } from '../../utils/format'; -import { useSellKeys } from '../../hooks/keys/useSellKeys'; -import { useBuyKeys } from '../../hooks/keys/useBuyKeys'; -import { useAccount } from '@starknet-react/core'; -import { useState } from 'react'; -import { Button } from '../Button'; +import {MainStackNavigationProps} from '../../types'; +import {TokenLaunchInterface} from '../../types/keys'; +import {feltToAddress} from '../../utils/format'; +import {decimalsScale} from '../../utils/helpers'; +import {Button} from '../Button'; +import {Input} from '../Input'; +import {Text} from '../Text'; import stylesheet from './styles'; -import { useStyles, useWaitConnection } from '../../hooks'; -import { useWalletModal } from '../../hooks/modals'; -import { Input } from '../Input'; -import { useBuyCoinByQuoteAmount } from '../../hooks/launchpad/useBuyCoinByQuoteAmount'; -import { useSellCoin } from '../../hooks/launchpad/useSellCoin'; export type LaunchCoinProps = { imageProps?: ImageSourcePropType; @@ -34,20 +31,27 @@ export type LaunchCoinProps = { enum AmountType { QUOTE_AMOUNT, - COIN_AMOUNT_TO_BUY + COIN_AMOUNT_TO_BUY, } -export const TokenLaunchCard: React.FC = ({ launch, imageProps, name, profileProps, event, isViewDetailDisabled }) => { - const { data: profile } = useProfile({ publicKey: event?.pubkey }); - const account = useAccount() - - const styles = useStyles(stylesheet) - - const [amount, setAmount] = useState() - const [typeAmount, setTypeAmount] = useState(AmountType.QUOTE_AMOUNT) - - const { handleSellCoins } = useSellCoin() +export const TokenLaunchCard: React.FC = ({ + launch, + imageProps, + name, + profileProps, + event, + isViewDetailDisabled, +}) => { + const {data: profile} = useProfile({publicKey: event?.pubkey}); + const account = useAccount(); + + const styles = useStyles(stylesheet); + + const [amount, setAmount] = useState(); + const [typeAmount, setTypeAmount] = useState(AmountType.QUOTE_AMOUNT); + + const {handleSellCoins} = useSellCoin(); // const { handleBuyKeys } = useBuyKeys() - const { handleBuyCoins } = useBuyCoinByQuoteAmount() + const {handleBuyCoins} = useBuyCoinByQuoteAmount(); const waitConnection = useWaitConnection(); const walletModal = useWalletModal(); @@ -63,7 +67,7 @@ export const TokenLaunchCard: React.FC = ({ launch, imageProps, const sellKeys = async () => { if (!amount) return; - await onConnect() + await onConnect(); if (!account || !account?.account) return; if (!launch?.owner) return; @@ -71,14 +75,19 @@ export const TokenLaunchCard: React.FC = ({ launch, imageProps, if (!launch?.token_quote) return; // handleSellKeys(account?.account, launch?.owner, Number(amount), launch?.token_quote, undefined) - handleSellCoins(account?.account, feltToAddress(BigInt(launch?.token_address)), Number(amount), launch?.token_quote, undefined) - - } + handleSellCoins( + account?.account, + feltToAddress(BigInt(launch?.token_address)), + Number(amount), + launch?.token_quote, + undefined, + ); + }; const buyCoin = async () => { if (!amount) return; - await onConnect() + await onConnect(); if (!account || !account?.account) return; @@ -86,10 +95,15 @@ export const TokenLaunchCard: React.FC = ({ launch, imageProps, if (!launch?.token_quote) return; - console.log("launch", launch) + console.log('launch', launch); // handleBuyKeys(account?.account, launch?.owner, launch?.token_quote, Number(amount),) - handleBuyCoins(account?.account, feltToAddress(BigInt(launch?.token_address)), Number(amount), launch?.token_quote,) - } + handleBuyCoins( + account?.account, + feltToAddress(BigInt(launch?.token_address)), + Number(amount), + launch?.token_quote, + ); + }; const navigation = useNavigation(); // const handleNavigateToProfile = () => { // if (!event?.id) return; @@ -103,26 +117,16 @@ export const TokenLaunchCard: React.FC = ({ launch, imageProps, if (launch?.created_at) { created_at = new Fraction(String(launch.created_at), decimalsScale(18)).toFixed(18); - } return ( + {launch?.token_address && ( + Coin address: {feltToAddress(BigInt(launch.token_address))} + )} - {launch?.token_address && - - Coin address: {feltToAddress(BigInt(launch.token_address))} - - - } - - {launch?.owner && - - Owner: {feltToAddress(BigInt(launch.owner))} - - - } + {launch?.owner && Owner: {feltToAddress(BigInt(launch.owner))}} {/* @@ -148,40 +152,31 @@ export const TokenLaunchCard: React.FC = ({ launch, imageProps, Price: {Number(launch?.price)} */} - - Supply: {Number(launch?.total_supply) / 10 ** 18} - - - Price: {Number(launch?.price)} - + Supply: {Number(launch?.total_supply) / 10 ** 18} + Price: {Number(launch?.price)} {/* {launch?.created_at && Created at {Number(launch?.created_at) / 10 ** 18} } */} - - {launch?.token_quote && + {launch?.token_quote && ( Token quote - - Quote token: {feltToAddress(BigInt(launch.token_quote?.token_address))} - - - Step increase: {Number(launch.token_quote?.step_increase_linear) / 10 ** 18} - - } + Quote token: {feltToAddress(BigInt(launch.token_quote?.token_address))} + Step increase: {Number(launch.token_quote?.step_increase_linear) / 10 ** 18} + + )} { - setAmount(Number(e)) + setAmount(Number(e)); // if (e && Number(e) ) { // setAmount(Number(e)) // } @@ -189,36 +184,36 @@ export const TokenLaunchCard: React.FC = ({ launch, imageProps, // if (e ) { // setAmount(Number(0)) // } - }} placeholder="Amount" /> - - - - - - {!isViewDetailDisabled && - + {!isViewDetailDisabled && ( + + {' '} + - } - - - + )} ); }; diff --git a/apps/mobile/src/components/TokenLaunchCard/styles.ts b/apps/mobile/src/components/TokenLaunchCard/styles.ts index f29a502f..434bbc17 100644 --- a/apps/mobile/src/components/TokenLaunchCard/styles.ts +++ b/apps/mobile/src/components/TokenLaunchCard/styles.ts @@ -1,5 +1,4 @@ -import { Dimensions } from 'react-native'; -import { Spacing, ThemedStyleSheet } from '../../styles'; +import {Spacing, ThemedStyleSheet} from '../../styles'; export default ThemedStyleSheet((theme) => ({ container: { // alignItems: 'center', @@ -7,27 +6,26 @@ export default ThemedStyleSheet((theme) => ({ padding: Spacing.xsmall, borderRadius: 8, gap: Spacing.xsmall, - overflowWrap:"break-word", + overflowWrap: 'break-word', // width:Dimensions.get("window").width >= 1024 ? 300 : "100%" // width:"100%" - width:300, + width: 300, }, imageContainer: { // position: 'relative', // display: 'flex', // alignItems: 'center', // justifyContent: 'center', - borderRadius: 15 - }, - text:{ + borderRadius: 15, }, + text: {}, image: { position: 'absolute', width: 35, height: 35, - borderRadius: 15 + borderRadius: 15, }, name: { paddingTop: Spacing.xxsmall, }, -})) +})); diff --git a/apps/mobile/src/components/TokenLaunchDetail/index.tsx b/apps/mobile/src/components/TokenLaunchDetail/index.tsx index e14265fc..bef57f9d 100644 --- a/apps/mobile/src/components/TokenLaunchDetail/index.tsx +++ b/apps/mobile/src/components/TokenLaunchDetail/index.tsx @@ -1,27 +1,24 @@ -import { NDKEvent, NDKUserProfile } from '@nostr-dev-kit/ndk'; -import { useNavigation } from '@react-navigation/native'; -import { Image, ImageSourcePropType, Pressable, TextInput, View, } from 'react-native'; - +import {NDKEvent, NDKUserProfile} from '@nostr-dev-kit/ndk'; +import {useNavigation} from '@react-navigation/native'; +import {useAccount} from '@starknet-react/core'; +import {Fraction} from '@uniswap/sdk-core'; +import {useProfile} from 'afk_nostr_sdk'; +import {useState} from 'react'; +import {ImageSourcePropType, View} from 'react-native'; + +import {useStyles, useWaitConnection} from '../../hooks'; +import {useBuyCoinByQuoteAmount} from '../../hooks/launchpad/useBuyCoinByQuoteAmount'; +import {useSellCoin} from '../../hooks/launchpad/useSellCoin'; +import {useWalletModal} from '../../hooks/modals'; // import {useProfile} from '../../hooks'; -import { MainStackNavigationProps } from '../../types'; -import { Text } from '../Text'; -import { useProfile } from "afk_nostr_sdk" -import { KeysUser, TokenLaunchInterface } from '../../types/keys'; -import { Fraction } from '@uniswap/sdk-core'; -import { decimalsScale } from '../../utils/helpers'; -import { cairo, uint256 } from 'starknet'; -import { feltToAddress } from '../../utils/format'; -import { useSellKeys } from '../../hooks/keys/useSellKeys'; -import { useBuyKeys } from '../../hooks/keys/useBuyKeys'; -import { useAccount } from '@starknet-react/core'; -import { useState } from 'react'; -import { Button } from '../Button'; +import {MainStackNavigationProps} from '../../types'; +import {TokenLaunchInterface} from '../../types/keys'; +import {feltToAddress} from '../../utils/format'; +import {decimalsScale} from '../../utils/helpers'; +import {Button} from '../Button'; +import {Input} from '../Input'; +import {Text} from '../Text'; import stylesheet from './styles'; -import { useStyles, useWaitConnection } from '../../hooks'; -import { useWalletModal } from '../../hooks/modals'; -import { Input } from '../Input'; -import { useBuyCoinByQuoteAmount } from '../../hooks/launchpad/useBuyCoinByQuoteAmount'; -import { useSellCoin } from '../../hooks/launchpad/useSellCoin'; export type LaunchCoinProps = { imageProps?: ImageSourcePropType; @@ -34,20 +31,27 @@ export type LaunchCoinProps = { enum AmountType { QUOTE_AMOUNT, - COIN_AMOUNT_TO_BUY + COIN_AMOUNT_TO_BUY, } -export const TokenLaunchDetail: React.FC = ({ launch, imageProps, name, profileProps, event, isViewDetailDisabled }) => { - const { data: profile } = useProfile({ publicKey: event?.pubkey }); - const account = useAccount() - - const styles = useStyles(stylesheet) - - const [amount, setAmount] = useState() - const [typeAmount, setTypeAmount] = useState(AmountType.QUOTE_AMOUNT) - - const { handleSellCoins } = useSellCoin() +export const TokenLaunchDetail: React.FC = ({ + launch, + imageProps, + name, + profileProps, + event, + isViewDetailDisabled, +}) => { + const {data: profile} = useProfile({publicKey: event?.pubkey}); + const account = useAccount(); + + const styles = useStyles(stylesheet); + + const [amount, setAmount] = useState(); + const [typeAmount, setTypeAmount] = useState(AmountType.QUOTE_AMOUNT); + + const {handleSellCoins} = useSellCoin(); // const { handleBuyKeys } = useBuyKeys() - const { handleBuyCoins } = useBuyCoinByQuoteAmount() + const {handleBuyCoins} = useBuyCoinByQuoteAmount(); const waitConnection = useWaitConnection(); const walletModal = useWalletModal(); @@ -63,7 +67,7 @@ export const TokenLaunchDetail: React.FC = ({ launch, imageProp const sellKeys = async () => { if (!amount) return; - await onConnect() + await onConnect(); if (!account || !account?.account) return; if (!launch?.owner) return; @@ -71,14 +75,19 @@ export const TokenLaunchDetail: React.FC = ({ launch, imageProp if (!launch?.token_quote) return; // handleSellKeys(account?.account, launch?.owner, Number(amount), launch?.token_quote, undefined) - handleSellCoins(account?.account, feltToAddress(BigInt(launch?.token_address)), Number(amount), launch?.token_quote, undefined) - - } + handleSellCoins( + account?.account, + feltToAddress(BigInt(launch?.token_address)), + Number(amount), + launch?.token_quote, + undefined, + ); + }; const buyCoin = async () => { if (!amount) return; - await onConnect() + await onConnect(); if (!account || !account?.account) return; @@ -86,10 +95,15 @@ export const TokenLaunchDetail: React.FC = ({ launch, imageProp if (!launch?.token_quote) return; - console.log("launch", launch) + console.log('launch', launch); // handleBuyKeys(account?.account, launch?.owner, launch?.token_quote, Number(amount),) - handleBuyCoins(account?.account, feltToAddress(BigInt(launch?.token_address)), Number(amount), launch?.token_quote,) - } + handleBuyCoins( + account?.account, + feltToAddress(BigInt(launch?.token_address)), + Number(amount), + launch?.token_quote, + ); + }; const navigation = useNavigation(); // const handleNavigateToProfile = () => { // if (!event?.id) return; @@ -103,26 +117,16 @@ export const TokenLaunchDetail: React.FC = ({ launch, imageProp if (launch?.created_at) { created_at = new Fraction(String(launch.created_at), decimalsScale(18)).toFixed(18); - } return ( + {launch?.token_address && ( + Coin address: {feltToAddress(BigInt(launch.token_address))} + )} - {launch?.token_address && - - Coin address: {feltToAddress(BigInt(launch.token_address))} - - - } - - {launch?.owner && - - Owner: {feltToAddress(BigInt(launch.owner))} - - - } + {launch?.owner && Owner: {feltToAddress(BigInt(launch.owner))}} {/* @@ -148,40 +152,31 @@ export const TokenLaunchDetail: React.FC = ({ launch, imageProp Price: {Number(launch?.price)} */} - - Supply: {Number(launch?.total_supply) / 10 ** 18} - - - Price: {Number(launch?.price)} - + Supply: {Number(launch?.total_supply) / 10 ** 18} + Price: {Number(launch?.price)} {/* {launch?.created_at && Created at {Number(launch?.created_at) / 10 ** 18} } */} - - {launch?.token_quote && + {launch?.token_quote && ( Token quote - - Quote token: {feltToAddress(BigInt(launch.token_quote?.token_address))} - - - Step increase: {Number(launch.token_quote?.step_increase_linear) / 10 ** 18} - - } + Quote token: {feltToAddress(BigInt(launch.token_quote?.token_address))} + Step increase: {Number(launch.token_quote?.step_increase_linear) / 10 ** 18} + + )} { - setAmount(Number(e)) + setAmount(Number(e)); // if (e && Number(e) ) { // setAmount(Number(e)) // } @@ -189,36 +184,36 @@ export const TokenLaunchDetail: React.FC = ({ launch, imageProp // if (e ) { // setAmount(Number(0)) // } - }} placeholder="Amount" /> - - - - - - {!isViewDetailDisabled && - + {!isViewDetailDisabled && ( + + {' '} + - } - - - + )} ); }; diff --git a/apps/mobile/src/components/TokenLaunchDetail/styles.ts b/apps/mobile/src/components/TokenLaunchDetail/styles.ts index d4fd305d..1e434bd0 100644 --- a/apps/mobile/src/components/TokenLaunchDetail/styles.ts +++ b/apps/mobile/src/components/TokenLaunchDetail/styles.ts @@ -1,5 +1,4 @@ -import { Dimensions } from 'react-native'; -import { Spacing, ThemedStyleSheet } from '../../styles'; +import {Spacing, ThemedStyleSheet} from '../../styles'; export default ThemedStyleSheet((theme) => ({ container: { // alignItems: 'center', @@ -7,7 +6,7 @@ export default ThemedStyleSheet((theme) => ({ padding: Spacing.xsmall, borderRadius: 8, gap: Spacing.xsmall, - overflowWrap:"break-word", + overflowWrap: 'break-word', // width:Dimensions.get("window").width >= 1024 ? 300 : "100%" // width:"100%" // width:300, @@ -17,17 +16,16 @@ export default ThemedStyleSheet((theme) => ({ // display: 'flex', // alignItems: 'center', // justifyContent: 'center', - borderRadius: 15 - }, - text:{ + borderRadius: 15, }, + text: {}, image: { position: 'absolute', width: 35, height: 35, - borderRadius: 15 + borderRadius: 15, }, name: { paddingTop: Spacing.xxsmall, }, -})) +})); diff --git a/apps/mobile/src/components/Twitter/TwitterCard.tsx b/apps/mobile/src/components/Twitter/TwitterCard.tsx index a32d68cc..52ddb514 100644 --- a/apps/mobile/src/components/Twitter/TwitterCard.tsx +++ b/apps/mobile/src/components/Twitter/TwitterCard.tsx @@ -1,14 +1,13 @@ import React from 'react'; -import { StyleSheet, Dimensions } from 'react-native'; -import { WebView } from 'react-native-webview'; +import {Dimensions, StyleSheet} from 'react-native'; +import {WebView} from 'react-native-webview'; // const tweetId = '20'; // Example Tweet ID - interface TwitterCardInterface { - tweetId?:string; + tweetId?: string; } -const TwitterCard = ({tweetId}:TwitterCardInterface) => { +const TwitterCard = ({tweetId}: TwitterCardInterface) => { const tweetHtml = ` @@ -26,7 +25,7 @@ const TwitterCard = ({tweetId}:TwitterCardInterface) => { ); diff --git a/apps/mobile/src/components/UserCard/index.tsx b/apps/mobile/src/components/UserCard/index.tsx index 86a262de..9e528d3d 100644 --- a/apps/mobile/src/components/UserCard/index.tsx +++ b/apps/mobile/src/components/UserCard/index.tsx @@ -1,12 +1,12 @@ import {NDKEvent, NDKUserProfile} from '@nostr-dev-kit/ndk'; import {useNavigation} from '@react-navigation/native'; +import {useProfile} from 'afk_nostr_sdk'; import {Image, ImageSourcePropType, Pressable, View} from 'react-native'; // import {useProfile} from '../../hooks'; import {MainStackNavigationProps} from '../../types'; import {Text} from '../Text'; import styles from './styles'; -import {useProfile} from "afk_nostr_sdk" export type StoryProps = { imageProps?: ImageSourcePropType; diff --git a/apps/mobile/src/components/UserCard/styles.ts b/apps/mobile/src/components/UserCard/styles.ts index 4f0f1965..e9c6ddbe 100644 --- a/apps/mobile/src/components/UserCard/styles.ts +++ b/apps/mobile/src/components/UserCard/styles.ts @@ -1,4 +1,5 @@ import {StyleSheet} from 'react-native'; + import {Spacing} from '../../styles'; export default StyleSheet.create({ @@ -17,13 +18,13 @@ export default StyleSheet.create({ display: 'flex', alignItems: 'center', justifyContent: 'center', - borderRadius:15 + borderRadius: 15, }, image: { position: 'absolute', width: 35, height: 35, - borderRadius:15 + borderRadius: 15, }, name: { diff --git a/apps/mobile/src/components/search/index.tsx b/apps/mobile/src/components/search/index.tsx index 3252f3aa..0f2753d1 100644 --- a/apps/mobile/src/components/search/index.tsx +++ b/apps/mobile/src/components/search/index.tsx @@ -1,15 +1,15 @@ import React from 'react'; -import { StyleSheet, TextInput, View } from 'react-native'; -import Svg, { Path } from 'react-native-svg'; -import { ThemedStyleSheet } from '../../styles'; +import {TextInput, View} from 'react-native'; +import Svg, {Path} from 'react-native-svg'; + +import {useStyles} from '../../hooks'; import stylesheet from './styles'; -import { useStyles } from '../../hooks'; interface ISearchComponent { searchQuery?: string; setSearchQuery: (search: string) => void; } -const SearchComponent = ({ searchQuery, setSearchQuery }: ISearchComponent) => { +const SearchComponent = ({searchQuery, setSearchQuery}: ISearchComponent) => { // const [searchQuery, setSearchQuery] = useState(''); const styles = useStyles(stylesheet); @@ -45,4 +45,4 @@ const SearchComponent = ({ searchQuery, setSearchQuery }: ISearchComponent) => { ); }; -export default SearchComponent; \ No newline at end of file +export default SearchComponent; diff --git a/apps/mobile/src/components/search/styles.ts b/apps/mobile/src/components/search/styles.ts index f00ab024..3175c35e 100644 --- a/apps/mobile/src/components/search/styles.ts +++ b/apps/mobile/src/components/search/styles.ts @@ -1,15 +1,12 @@ -import React from 'react'; -import { StyleSheet, TextInput, View } from 'react-native'; -import Svg, { Path } from 'react-native-svg'; -import { ThemedStyleSheet } from '../../styles'; +import {ThemedStyleSheet} from '../../styles'; export default ThemedStyleSheet((theme) => ({ container: { flexDirection: 'row', alignItems: 'center', // backgroundColor: '#f0f0f0', - background:theme.colors.background, - color:theme.colors.text, + background: theme.colors.background, + color: theme.colors.text, borderRadius: 20, marginHorizontal: 10, paddingHorizontal: 10, @@ -20,13 +17,12 @@ export default ThemedStyleSheet((theme) => ({ }, input: { flex: 1, - background:theme.colors.background, - borderColor:theme.colors.background, + background: theme.colors.background, + borderColor: theme.colors.background, - color:theme.colors.text, + color: theme.colors.text, paddingVertical: 8, paddingHorizontal: 10, fontSize: 16, }, })); - diff --git a/apps/mobile/src/constants/contracts.ts b/apps/mobile/src/constants/contracts.ts index 06b85c65..980336f0 100644 --- a/apps/mobile/src/constants/contracts.ts +++ b/apps/mobile/src/constants/contracts.ts @@ -1,4 +1,4 @@ -import { constants } from 'starknet'; +import {constants} from 'starknet'; export const ESCROW_ADDRESSES = { [constants.StarknetChainId.SN_MAIN]: '', // TODO: Add mainnet escrow address @@ -19,7 +19,8 @@ export const KEYS_ADDRESS = { // '0x4dc8fec43040951a22702ef5ad94e76b6fb6692558fc59cd80790c7b21865a1', /** NEW KEY MARKETPLACE */ - [constants.StarknetChainId.SN_SEPOLIA]: "0x70a168bae281a7eb0cdcb8c2c8c5708e180ae4c62ff46a4f7cb005fa634cb61", + [constants.StarknetChainId.SN_SEPOLIA]: + '0x70a168bae281a7eb0cdcb8c2c8c5708e180ae4c62ff46a4f7cb005fa634cb61', [constants.StarknetChainId.SN_MAIN]: '', // [constants.StarknetChainId.SN_SEPOLIA]: "0x5e89dc74f1a40d7814966b028a9b1853d39006a954b27828a9de7e333ec8119", @@ -35,14 +36,14 @@ export const UNRUGGABLE_FACTORY_ADDRESS = { }; export const NAMESPACE_ADDRESS = { - [constants.StarknetChainId.SN_SEPOLIA]: "0x6e8ecfa6872bd27a7517077069b401a494687e66e2a98d37311eee1d96f1b57", - [constants.StarknetChainId.SN_MAIN]: "" -} + [constants.StarknetChainId.SN_SEPOLIA]: + '0x6e8ecfa6872bd27a7517077069b401a494687e66e2a98d37311eee1d96f1b57', + [constants.StarknetChainId.SN_MAIN]: '', +}; export const LAUNCHPAD_ADDRESS = { - [constants.StarknetChainId.SN_MAIN]: "", + [constants.StarknetChainId.SN_MAIN]: '', // [constants.StarknetChainId.SN_SEPOLIA]:"0x5cf19613d54ae5e7c229c87cc26322f2ff6c473d2183723010676b8337c0af3", - [constants.StarknetChainId.SN_SEPOLIA]:"0x19084523bd7307c2169ee32a336be3f9d9eb6bf24197156cb6fc7a42feb7a5" - - -} \ No newline at end of file + [constants.StarknetChainId.SN_SEPOLIA]: + '0x19084523bd7307c2169ee32a336be3f9d9eb6bf24197156cb6fc7a42feb7a5', +}; diff --git a/apps/mobile/src/constants/docusaurus.config.ts b/apps/mobile/src/constants/docusaurus.config.ts index 9983ff2c..3383a900 100644 --- a/apps/mobile/src/constants/docusaurus.config.ts +++ b/apps/mobile/src/constants/docusaurus.config.ts @@ -1,55 +1,52 @@ -import { themes as prismThemes } from "prism-react-renderer"; -import type { Config } from "@docusaurus/types"; -import type * as Preset from "@docusaurus/preset-classic"; +import type * as Preset from '@docusaurus/preset-classic'; +import type {Config} from '@docusaurus/types'; +import {themes as prismThemes} from 'prism-react-renderer'; const config: Config = { - title: "AFK", - tagline: - "Decentralized social built with Nostr and powered by Starknet Account Abstraction", - favicon: "img/favicon.ico", + title: 'AFK', + tagline: 'Decentralized social built with Nostr and powered by Starknet Account Abstraction', + favicon: 'img/favicon.ico', // Set the production url of your site here - url: "https://docs.afk-community", + url: 'https://docs.afk-community', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: "/", + baseUrl: '/', // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. - organizationName: "afk-labs", // Usually your GitHub org/user name. - projectName: "AFK", // Usually your repo name. + organizationName: 'afk-labs', // Usually your GitHub org/user name. + projectName: 'AFK', // Usually your repo name. - onBrokenLinks: "throw", - onBrokenMarkdownLinks: "warn", + onBrokenLinks: 'throw', + onBrokenMarkdownLinks: 'warn', // Even if you don't use internationalization, you can use this field to set // useful metadata like html lang. For example, if your site is Chinese, you // may want to replace "en" with "zh-Hans". i18n: { - defaultLocale: "en", - locales: ["en"], + defaultLocale: 'en', + locales: ['en'], }, presets: [ [ - "classic", + 'classic', { docs: { - sidebarPath: "./sidebars.ts", + sidebarPath: './sidebars.ts', // Please change this to your repo. // Remove this to remove the "edit this page" links. - editUrl: - "https://github.com/AFK-AlignedFamKernel/afk_monorepo/blob/main/docs/", + editUrl: 'https://github.com/AFK-AlignedFamKernel/afk_monorepo/blob/main/docs/', }, blog: { showReadingTime: true, // Please change this to your repo. // Remove this to remove the "edit this page" links. - editUrl: - "https://github.com/keep-starknet-strange/afk_monorepo/blob/main/docs/", + editUrl: 'https://github.com/keep-starknet-strange/afk_monorepo/blob/main/docs/', }, theme: { - customCss: "./src/css/custom.css", + customCss: './src/css/custom.css', }, } satisfies Preset.Options, ], @@ -57,63 +54,63 @@ const config: Config = { themeConfig: { // Replace with your project's social card - image: "img/AFK.png", + image: 'img/AFK.png', navbar: { - title: "AFK", + title: 'AFK', logo: { - alt: "AFK Logo", - src: "img/AFK.png", + alt: 'AFK Logo', + src: 'img/AFK.png', }, items: [ { - type: "docSidebar", - sidebarId: "tutorialSidebar", - position: "left", - label: "Documentation", + type: 'docSidebar', + sidebarId: 'tutorialSidebar', + position: 'left', + label: 'Documentation', }, { - href: "https://github.com/keep-starknet-strange/AFK", - label: "GitHub", - position: "right", + href: 'https://github.com/keep-starknet-strange/AFK', + label: 'GitHub', + position: 'right', }, ], }, footer: { - style: "dark", + style: 'dark', links: [ { - title: "Docs", + title: 'Docs', items: [ { - label: "Documentation", - to: "/docs/intro", + label: 'Documentation', + to: '/docs/intro', }, ], }, { - title: "Community", + title: 'Community', items: [ { - label: "Telegram", - href: "https://t.me/AFKStarknet/1", + label: 'Telegram', + href: 'https://t.me/AFKStarknet/1', }, { - label: "Twitter", - href: "https://twitter.com/AFKStarknet", + label: 'Twitter', + href: 'https://twitter.com/AFKStarknet', }, ], }, { - title: "More", + title: 'More', items: [ { - label: "Blog", - to: "/blog", + label: 'Blog', + to: '/blog', }, { - label: "GitHub", - href: "https://github.com/keep-starknet-strange/AFK", + label: 'GitHub', + href: 'https://github.com/keep-starknet-strange/AFK', }, ], }, diff --git a/apps/mobile/src/constants/env.ts b/apps/mobile/src/constants/env.ts index 8977e576..02118955 100644 --- a/apps/mobile/src/constants/env.ts +++ b/apps/mobile/src/constants/env.ts @@ -17,5 +17,3 @@ if (!Object.keys(constants.NetworkName).includes(NETWORK_NAME)) { if (!PROVIDER_URL) throw new Error('Missing PROVIDER_URL env variable'); if (!BACKEND_URL) throw new Error('Missing BACKEND_URL env variable'); if (!WALLET_CONNECT_ID) throw new Error('Missing WALLET_CONNECT_ID env variable'); - - diff --git a/apps/mobile/src/constants/misc.ts b/apps/mobile/src/constants/misc.ts index 09b686f4..6afacb93 100644 --- a/apps/mobile/src/constants/misc.ts +++ b/apps/mobile/src/constants/misc.ts @@ -22,9 +22,6 @@ export const DEFAULT_TIMELOCK = 7 * 24 * 60 * 60 * 1_000; // 7 days export const WEB_MAX_WIDTH = 520; - - export enum EventKeyForKeysMarketplace { CreateKeys = '0x10847dcd18ec5858348344447324265bf28e3f8c5fa6f6863f5210845821914', } - diff --git a/apps/mobile/src/context/TipModal.tsx b/apps/mobile/src/context/TipModal.tsx index 4bac9f5b..7d47c973 100644 --- a/apps/mobile/src/context/TipModal.tsx +++ b/apps/mobile/src/context/TipModal.tsx @@ -2,7 +2,6 @@ import {NDKEvent} from '@nostr-dev-kit/ndk'; import {createContext, useCallback, useMemo, useRef, useState} from 'react'; import {TipModal} from '../modules/TipModal'; - import {TipSuccessModal, TipSuccessModalProps} from '../modules/TipSuccessModal'; export type TipModalContextType = { diff --git a/apps/mobile/src/context/Toast/ToastContext.tsx b/apps/mobile/src/context/Toast/ToastContext.tsx index 67e4e7b4..db9df552 100644 --- a/apps/mobile/src/context/Toast/ToastContext.tsx +++ b/apps/mobile/src/context/Toast/ToastContext.tsx @@ -5,7 +5,8 @@ import {SafeAreaView} from 'react-native-safe-area-context'; import {ToastProps} from '../../components/Toast'; import {AnimatedToast} from './AnimatedToast'; -import styles from './styles'; +import stylesheet from './styles'; +import { useStyles } from '../../hooks'; export type ToastConfig = ToastProps & { key: string; @@ -20,8 +21,8 @@ export type ToastContextType = { export const ToastContext = createContext(null); export const ToastProvider: React.FC<{children: React.ReactNode}> = ({children}) => { + const styles = useStyles(stylesheet) const [toasts, setToasts] = useState([]); - const hideToast = useCallback((key: string) => { setToasts((prev) => prev.filter((t) => t.key !== key)); }, []); diff --git a/apps/mobile/src/context/Toast/styles.ts b/apps/mobile/src/context/Toast/styles.ts index eabe0677..60cb0a44 100644 --- a/apps/mobile/src/context/Toast/styles.ts +++ b/apps/mobile/src/context/Toast/styles.ts @@ -1,8 +1,11 @@ import {StyleSheet} from 'react-native'; -import {Spacing} from '../../styles'; +import {Spacing, ThemedStyleSheet} from '../../styles'; -export default StyleSheet.create({ +// export default StyleSheet.create({ +export default ThemedStyleSheet((theme) => ({ + + // export default StyleSheet.create({ container: { position: 'absolute', top: 0, @@ -15,4 +18,4 @@ export default StyleSheet.create({ paddingHorizontal: Spacing.pagePadding, gap: Spacing.xsmall, }, -}); +})); diff --git a/apps/mobile/src/context/TokenCreateModal.tsx b/apps/mobile/src/context/TokenCreateModal.tsx index 5c7293ec..d2f90407 100644 --- a/apps/mobile/src/context/TokenCreateModal.tsx +++ b/apps/mobile/src/context/TokenCreateModal.tsx @@ -1,10 +1,10 @@ import {NDKEvent} from '@nostr-dev-kit/ndk'; import {createContext, useCallback, useMemo, useRef, useState} from 'react'; +import {Modalize} from 'react-native-modalize'; -import { KeyModalAction} from '../modules/KeyModal'; +import {KeyModalAction} from '../modules/KeyModal'; import {TipSuccessModal, TipSuccessModalProps} from '../modules/TipSuccessModal'; -import { TokenCreateModal } from '../modules/TokenCreatedModal'; -import { Modalize } from 'react-native-modalize'; +import {TokenCreateModal} from '../modules/TokenCreatedModal'; export type TokenCreateModal = Modalize; @@ -26,11 +26,14 @@ export const TokenCreateModalProvider: React.FC = ({chi const [action, setAction] = useState(); const [successModal, setSuccessModal] = useState(null); - const show = useCallback((event?: NDKEvent, starknetAddress?: string, action?: KeyModalAction) => { - setEvent(event); - setStarknetAddress(starknetAddress); - tokenModalRef.current?.open(); - }, []); + const show = useCallback( + (event?: NDKEvent, starknetAddress?: string, action?: KeyModalAction) => { + setEvent(event); + setStarknetAddress(starknetAddress); + tokenModalRef.current?.open(); + }, + [], + ); const hide = useCallback(() => { tokenModalRef.current?.close(); diff --git a/apps/mobile/src/hooks/api/indexer/useLaunchTokens.ts b/apps/mobile/src/hooks/api/indexer/useLaunchTokens.ts index 4802d8ae..43eb2f62 100644 --- a/apps/mobile/src/hooks/api/indexer/useLaunchTokens.ts +++ b/apps/mobile/src/hooks/api/indexer/useLaunchTokens.ts @@ -1,8 +1,6 @@ -import {NostrEvent} from '@nostr-dev-kit/ndk'; +import {useQuery} from '@tanstack/react-query'; import {ApiIndexerInstance} from '../../../services/api'; -import {useApiMutation} from '../useApiMutation'; -import { useMutation, useQuery } from '@tanstack/react-query'; export const useGetTokenLaunch = () => { return useQuery({ @@ -14,7 +12,7 @@ export const useGetTokenLaunch = () => { queryFn: async () => { const res = await ApiIndexerInstance.get('/deploy-launch'); // console.log("res get launch",res) - return res + return res; }, }); }; diff --git a/apps/mobile/src/hooks/keys/useBuyKeys.ts b/apps/mobile/src/hooks/keys/useBuyKeys.ts index 5b94718e..baf084bf 100644 --- a/apps/mobile/src/hooks/keys/useBuyKeys.ts +++ b/apps/mobile/src/hooks/keys/useBuyKeys.ts @@ -1,8 +1,7 @@ import {useAccount, useNetwork, useProvider} from '@starknet-react/core'; -import {AccountInterface, cairo, CallData, constants, RpcProvider, uint256} from 'starknet'; - // import {KEYS_ADDRESS} from '../../constants/contracts'; -import {KEYS_ADDRESS} from "common" +import {KEYS_ADDRESS} from 'common'; +import {AccountInterface, cairo, CallData, constants, RpcProvider, uint256} from 'starknet'; import {TokenQuoteBuyKeys} from '../../types/keys'; import {feltToAddress, formatFloatToUint256} from '../../utils/format'; @@ -19,7 +18,7 @@ export const useBuyKeys = () => { // console.log("chainId", chainId) // const provider = rpcProvider?.provider ?? new RpcProvider({ nodeUrl: process.env.EXPO_PUBLIC_PROVIDER_URL }); // const provider = rpcProvider?.provider ?? new RpcProvider(); - const provider = new RpcProvider({nodeUrl:process.env.EXPO_PUBLIC_PROVIDER_URL}); + const provider = new RpcProvider({nodeUrl: process.env.EXPO_PUBLIC_PROVIDER_URL}); const handleBuyKeys = async ( account: AccountInterface, diff --git a/apps/mobile/src/hooks/keys/useDataKeys.ts b/apps/mobile/src/hooks/keys/useDataKeys.ts index 7eb087e4..480a2a1f 100644 --- a/apps/mobile/src/hooks/keys/useDataKeys.ts +++ b/apps/mobile/src/hooks/keys/useDataKeys.ts @@ -1,8 +1,9 @@ -import { useAccount, useNetwork, useProvider } from '@starknet-react/core'; -import { AccountInterface, constants, Contract, ProviderInterface, RpcProvider } from 'starknet'; -import {KEYS_ADDRESS} from "common" -import { useQuery } from '@tanstack/react-query'; -import { CHAIN_ID } from '../../constants/env'; +import {useAccount, useNetwork, useProvider} from '@starknet-react/core'; +import {useQuery} from '@tanstack/react-query'; +import {KEYS_ADDRESS} from 'common'; +import {AccountInterface, constants, Contract, ProviderInterface, RpcProvider} from 'starknet'; + +import {CHAIN_ID} from '../../constants/env'; /** @TODO determine paymaster master specs to send the TX */ export const prepareAndConnectContract = async ( provider: ProviderInterface, @@ -13,7 +14,7 @@ export const prepareAndConnectContract = async ( // console.log('contractAddress', contractAddress); // console.log("provider",await provider.getChainId()) - const { abi: testAbi } = await provider.getClassAt(contractAddress); + const {abi: testAbi} = await provider.getClassAt(contractAddress); if (testAbi === undefined) { throw new Error('no abi.'); } @@ -37,21 +38,16 @@ export const useDataKeys = () => { // const provider = rpcProvider?.provider ?? new RpcProvider(); const provider = new RpcProvider(); - - const queryDataKeys = () => { + const useQueryDataKeys = () => { return useQuery({ queryKey: ['get_all_keys', CHAIN_ID], - queryFn:async () => { - - const keys= await getAllKeys() - return keys + queryFn: async () => { + const keys = await getAllKeys(); + return keys; }, - placeholderData:[] - - - }) - - } + placeholderData: [], + }); + }; /** Indexer with Key contract event */ const getAllKeys = async (account?: AccountInterface, contractAddress?: string) => { @@ -111,5 +107,5 @@ export const useDataKeys = () => { } }; - return { getAllKeys, getMySharesOfUser, getKeyByAddress, queryDataKeys}; + return {getAllKeys, getMySharesOfUser, getKeyByAddress, useQueryDataKeys}; }; diff --git a/apps/mobile/src/hooks/keys/useInstantiateKeys.ts b/apps/mobile/src/hooks/keys/useInstantiateKeys.ts index e0a5e0e6..dd49dfc6 100644 --- a/apps/mobile/src/hooks/keys/useInstantiateKeys.ts +++ b/apps/mobile/src/hooks/keys/useInstantiateKeys.ts @@ -1,8 +1,7 @@ -import {useAccount, useNetwork} from '@starknet-react/core'; -import {AccountInterface, CallData, constants} from 'starknet'; - +import {useNetwork} from '@starknet-react/core'; // import {KEYS_ADDRESS} from '../../constants/contracts'; -import {KEYS_ADDRESS} from "common" +import {KEYS_ADDRESS} from 'common'; +import {AccountInterface, CallData, constants} from 'starknet'; export const useInstantiateKeys = () => { const chain = useNetwork(); diff --git a/apps/mobile/src/hooks/keys/useQueryAllKeys.ts b/apps/mobile/src/hooks/keys/useQueryAllKeys.ts index 3e827ce1..79f84b62 100644 --- a/apps/mobile/src/hooks/keys/useQueryAllKeys.ts +++ b/apps/mobile/src/hooks/keys/useQueryAllKeys.ts @@ -1,25 +1,22 @@ -import { useAccount, useNetwork, useProvider } from '@starknet-react/core'; -import { AccountInterface, constants, Contract, ProviderInterface, RpcProvider } from 'starknet'; - +import {useAccount, useNetwork, useProvider} from '@starknet-react/core'; // import { KEYS_ADDRESS } from '../../constants/contracts'; +import {useQuery} from '@tanstack/react-query'; -import { useQuery } from '@tanstack/react-query'; -import { CHAIN_ID } from '../../constants/env'; -import { prepareAndConnectContract, useDataKeys } from './useDataKeys'; +import {CHAIN_ID} from '../../constants/env'; +import {useDataKeys} from './useDataKeys'; export const useQueryAllKeys = () => { const account = useAccount(); const chain = useNetwork(); const rpcProvider = useProvider(); - const {getAllKeys} = useDataKeys() + const {getAllKeys} = useDataKeys(); const chainId = chain?.chain?.id; return useQuery({ queryKey: ['get_all_keys', CHAIN_ID], - queryFn:async () => { - - const keys= await getAllKeys() - return keys + queryFn: async () => { + const keys = await getAllKeys(); + return keys; }, - placeholderData:[] - }) + placeholderData: [], + }); }; diff --git a/apps/mobile/src/hooks/keys/useSellKeys.ts b/apps/mobile/src/hooks/keys/useSellKeys.ts index 5a639bf7..0b69e02e 100644 --- a/apps/mobile/src/hooks/keys/useSellKeys.ts +++ b/apps/mobile/src/hooks/keys/useSellKeys.ts @@ -1,8 +1,8 @@ import {useAccount, useNetwork, useProvider} from '@starknet-react/core'; +// import {KEYS_ADDRESS} from '../../constants/contracts'; +import {KEYS_ADDRESS} from 'common'; import {AccountInterface, CallData, constants, RpcProvider, uint256} from 'starknet'; -// import {KEYS_ADDRESS} from '../../constants/contracts'; -import {KEYS_ADDRESS} from "common" import {TokenQuoteBuyKeys} from '../../types/keys'; import {formatFloatToUint256} from '../../utils/format'; diff --git a/apps/mobile/src/hooks/launchpad/useBuyCoin.ts b/apps/mobile/src/hooks/launchpad/useBuyCoin.ts index a87938a9..18095faa 100644 --- a/apps/mobile/src/hooks/launchpad/useBuyCoin.ts +++ b/apps/mobile/src/hooks/launchpad/useBuyCoin.ts @@ -1,15 +1,16 @@ -import {useAccount, useNetwork, useProvider} from '@starknet-react/core'; +import {useNetwork} from '@starknet-react/core'; +import {LAUNCHPAD_ADDRESS} from 'common'; import {AccountInterface, cairo, CallData, constants, RpcProvider, uint256} from 'starknet'; + // import { LAUNCHPAD_ADDRESS} from '../../constants/contracts'; import {TokenQuoteBuyKeys} from '../../types/keys'; import {feltToAddress, formatFloatToUint256} from '../../utils/format'; import {prepareAndConnectContract} from './useDataCoins'; -import {LAUNCHPAD_ADDRESS} from "common" export const useBuyCoin = () => { const chain = useNetwork(); const chainId = chain?.chain?.id; - const provider = new RpcProvider({nodeUrl:process.env.EXPO_PUBLIC_PROVIDER_URL}); + const provider = new RpcProvider({nodeUrl: process.env.EXPO_PUBLIC_PROVIDER_URL}); const handleBuyCoins = async ( account: AccountInterface, user_address: string, @@ -19,7 +20,8 @@ export const useBuyCoin = () => { ) => { if (!account) return; - const addressContract = contractAddress ?? LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; + const addressContract = + contractAddress ?? LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; console.log('addressContract', addressContract); console.log('read asset'); const asset = await prepareAndConnectContract( @@ -51,7 +53,11 @@ export const useBuyCoin = () => { let amountToPaid; try { /** @TODO fix CORS issue */ - amountToPaid = await launchpad_contract.get_price_of_supply_key(user_address, amountUint256, false); + amountToPaid = await launchpad_contract.get_price_of_supply_key( + user_address, + amountUint256, + false, + ); } catch (error) { console.log('Error get amount to paid', error); } diff --git a/apps/mobile/src/hooks/launchpad/useBuyCoinByQuoteAmount.ts b/apps/mobile/src/hooks/launchpad/useBuyCoinByQuoteAmount.ts index cea74458..27a4f3ca 100644 --- a/apps/mobile/src/hooks/launchpad/useBuyCoinByQuoteAmount.ts +++ b/apps/mobile/src/hooks/launchpad/useBuyCoinByQuoteAmount.ts @@ -1,7 +1,7 @@ -import {useAccount, useNetwork, useProvider} from '@starknet-react/core'; -import {AccountInterface, cairo, CallData, constants, RpcProvider, uint256} from 'starknet'; +import {useNetwork} from '@starknet-react/core'; // import { LAUNCHPAD_ADDRESS} from '../../constants/contracts'; -import {LAUNCHPAD_ADDRESS} from "common" +import {LAUNCHPAD_ADDRESS} from 'common'; +import {AccountInterface, CallData, constants, RpcProvider} from 'starknet'; import {TokenQuoteBuyKeys} from '../../types/keys'; import {feltToAddress, formatFloatToUint256} from '../../utils/format'; @@ -10,7 +10,7 @@ import {prepareAndConnectContract} from './useDataCoins'; export const useBuyCoinByQuoteAmount = () => { const chain = useNetwork(); const chainId = chain?.chain?.id; - const provider = new RpcProvider({nodeUrl:process.env.EXPO_PUBLIC_PROVIDER_URL}); + const provider = new RpcProvider({nodeUrl: process.env.EXPO_PUBLIC_PROVIDER_URL}); const handleBuyCoins = async ( account: AccountInterface, coin_address: string, @@ -20,7 +20,8 @@ export const useBuyCoinByQuoteAmount = () => { ) => { if (!account) return; - const addressContract = contractAddress ?? LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; + const addressContract = + contractAddress ?? LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; console.log('addressContract', addressContract); console.log('read asset'); const asset = await prepareAndConnectContract( @@ -35,12 +36,12 @@ export const useBuyCoinByQuoteAmount = () => { // const launchpad_contract = await prepareAndConnectContract(provider, addressContract, account); console.log('amount', amount); - let amountUint256 = formatFloatToUint256(amount); + const amountUint256 = formatFloatToUint256(amount); console.log('amountuint256', amountUint256); // amountUint256 = uint256.bnToUint256(BigInt('0x' + amount*10**18)); // console.log('amountuint256', amountUint256); const buyCoinParams = { - coin_address:coin_address, // token address + coin_address, // token address amount: amountUint256, }; console.log('buyCoinParams', buyCoinParams); @@ -54,21 +55,16 @@ export const useBuyCoinByQuoteAmount = () => { }), }; - const buyCoinCall = { contractAddress: addressContract, entrypoint: 'buy_coin_by_quote_amount', calldata: CallData.compile({ coin_address: buyCoinParams.coin_address, - quote_amount:amountUint256 + quote_amount: amountUint256, }), }; - - const tx = await account?.execute([ - approveCall, - buyCoinCall - ], undefined, {}); + const tx = await account?.execute([approveCall, buyCoinCall], undefined, {}); console.log('tx hash', tx.transaction_hash); const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); }; diff --git a/apps/mobile/src/hooks/launchpad/useCreateToken.ts b/apps/mobile/src/hooks/launchpad/useCreateToken.ts index f2303e0f..512810b2 100644 --- a/apps/mobile/src/hooks/launchpad/useCreateToken.ts +++ b/apps/mobile/src/hooks/launchpad/useCreateToken.ts @@ -1,96 +1,99 @@ -import { AccountInterface, CallData, Calldata, cairo, constants } from "starknet" +import {LAUNCHPAD_ADDRESS} from 'common'; +import {AccountInterface, CallData, constants} from 'starknet'; + // import { LAUNCHPAD_ADDRESS, UNRUGGABLE_FACTORY_ADDRESS } from "../../constants/contracts"; -import { formatFloatToUint256 } from "../../utils/format"; -import {LAUNCHPAD_ADDRESS} from "common" +import {formatFloatToUint256} from '../../utils/format'; export type DeployTokenFormValues = { - recipient?: string; - name: string | undefined; - symbol: string | undefined; - initialSupply: number | undefined; - contract_address_salt: string | undefined + recipient?: string; + name: string | undefined; + symbol: string | undefined; + initialSupply: number | undefined; + contract_address_salt: string | undefined; }; export const useCreateToken = () => { - - const deployToken = async (account: AccountInterface, data: DeployTokenFormValues) => { - const CONTRACT_ADDRESS_SALT_DEFAULT = data?.contract_address_salt ?? await account?.getChainId() == constants.StarknetChainId.SN_MAIN ? - "0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6" : - "0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6" - - console.log("deployCall") - - const initial_supply = formatFloatToUint256(data?.initialSupply ?? 100_000_000) - - console.log("initial supply", initial_supply) - const deployCall = { - contractAddress: LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA], - entrypoint: 'create_token', - calldata: CallData.compile({ - owner: data?.recipient ?? account?.address, - symbol: data.symbol ?? "LFG", - name: data.name ?? "LFG", - initialSupply: initial_supply, - // initialSupply: cairo.uint256(data?.initialSupply ?? 100_000_000), - contract_address_salt: new Date().getTime(), - // contract_address_salt:CONTRACT_ADDRESS_SALT_DEFAULT + Math.random() + Math.random() / 1000 - // contract_address_salt:cairo.felt(Math.random()) - }), - }; - console.log("deployCall", deployCall) - - const tx = await account.execute(deployCall) - console.log("tx", tx) - - console.log('tx hash', tx.transaction_hash); - const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); - return wait_tx - } - - const deployTokenAndLaunch = async (account: AccountInterface, data: DeployTokenFormValues) => { - const CONTRACT_ADDRESS_SALT_DEFAULT = data?.contract_address_salt ?? await account?.getChainId() == constants.StarknetChainId.SN_MAIN ? - "0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6" : - "0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6" - - const initial_supply = formatFloatToUint256(data?.initialSupply ?? 100_000_000) - - console.log("initial supply", initial_supply) - const deployCall = { - contractAddress: LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA], - entrypoint: 'create_and_launch_token', - calldata: CallData.compile({ - name: data.name ?? "LFG", - symbol: data.symbol ?? "LFG", - initialSupply: initial_supply, - contract_address_salt: new Date().getTime(), - }), - }; - - const tx = await account.execute(deployCall) - console.log('tx hash', tx.transaction_hash); - const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); - return wait_tx - } - - const launchToken = async (account: AccountInterface, coin_address: string) => { - const deployCall = { - contractAddress: LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA], - entrypoint: 'launch_token', - calldata: CallData.compile({ - coin_address: coin_address - }), - }; - - const tx = await account.execute(deployCall) - console.log('tx hash', tx.transaction_hash); - const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); - return wait_tx - } - - return { - deployToken, - deployTokenAndLaunch, - launchToken - - } -} \ No newline at end of file + const deployToken = async (account: AccountInterface, data: DeployTokenFormValues) => { + const CONTRACT_ADDRESS_SALT_DEFAULT = + data?.contract_address_salt ?? + (await account?.getChainId()) == constants.StarknetChainId.SN_MAIN + ? '0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6' + : '0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6'; + + console.log('deployCall'); + + const initial_supply = formatFloatToUint256(data?.initialSupply ?? 100_000_000); + + console.log('initial supply', initial_supply); + const deployCall = { + contractAddress: LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA], + entrypoint: 'create_token', + calldata: CallData.compile({ + owner: data?.recipient ?? account?.address, + symbol: data.symbol ?? 'LFG', + name: data.name ?? 'LFG', + initialSupply: initial_supply, + // initialSupply: cairo.uint256(data?.initialSupply ?? 100_000_000), + contract_address_salt: new Date().getTime(), + // contract_address_salt:CONTRACT_ADDRESS_SALT_DEFAULT + Math.random() + Math.random() / 1000 + // contract_address_salt:cairo.felt(Math.random()) + }), + }; + console.log('deployCall', deployCall); + + const tx = await account.execute(deployCall); + console.log('tx', tx); + + console.log('tx hash', tx.transaction_hash); + const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); + return wait_tx; + }; + + const deployTokenAndLaunch = async (account: AccountInterface, data: DeployTokenFormValues) => { + const CONTRACT_ADDRESS_SALT_DEFAULT = + data?.contract_address_salt ?? + (await account?.getChainId()) == constants.StarknetChainId.SN_MAIN + ? '0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6' + : '0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6'; + + const initial_supply = formatFloatToUint256(data?.initialSupply ?? 100_000_000); + + console.log('initial supply', initial_supply); + const deployCall = { + contractAddress: LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA], + entrypoint: 'create_and_launch_token', + calldata: CallData.compile({ + name: data.name ?? 'LFG', + symbol: data.symbol ?? 'LFG', + initialSupply: initial_supply, + contract_address_salt: new Date().getTime(), + }), + }; + + const tx = await account.execute(deployCall); + console.log('tx hash', tx.transaction_hash); + const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); + return wait_tx; + }; + + const launchToken = async (account: AccountInterface, coin_address: string) => { + const deployCall = { + contractAddress: LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA], + entrypoint: 'launch_token', + calldata: CallData.compile({ + coin_address, + }), + }; + + const tx = await account.execute(deployCall); + console.log('tx hash', tx.transaction_hash); + const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); + return wait_tx; + }; + + return { + deployToken, + deployTokenAndLaunch, + launchToken, + }; +}; diff --git a/apps/mobile/src/hooks/launchpad/useDataCoins.ts b/apps/mobile/src/hooks/launchpad/useDataCoins.ts index cac4d7a3..4eb2ca00 100644 --- a/apps/mobile/src/hooks/launchpad/useDataCoins.ts +++ b/apps/mobile/src/hooks/launchpad/useDataCoins.ts @@ -1,10 +1,9 @@ -import { useAccount, useNetwork, useProvider } from '@starknet-react/core'; -import { AccountInterface, constants, Contract, ProviderInterface, RpcProvider } from 'starknet'; +import {useAccount, useNetwork, useProvider} from '@starknet-react/core'; +import {useQuery} from '@tanstack/react-query'; +import {LAUNCHPAD_ADDRESS} from 'common'; +import {AccountInterface, constants, Contract, ProviderInterface, RpcProvider} from 'starknet'; -import {LAUNCHPAD_ADDRESS} from "common" - -import { useQuery } from '@tanstack/react-query'; -import { CHAIN_ID } from '../../constants/env'; +import {CHAIN_ID} from '../../constants/env'; /** @TODO determine paymaster master specs to send the TX */ export const prepareAndConnectContract = async ( provider: ProviderInterface, @@ -15,7 +14,7 @@ export const prepareAndConnectContract = async ( console.log('contractAddress', contractAddress); // console.log("provider",await provider.getChainId()) - const { abi: testAbi } = await provider.getClassAt(contractAddress); + const {abi: testAbi} = await provider.getClassAt(contractAddress); if (testAbi === undefined) { throw new Error('no abi.'); } @@ -39,42 +38,33 @@ export const useDataCoins = () => { // const provider = rpcProvider?.provider ?? new RpcProvider(); const provider = new RpcProvider(); - - const queryDataCoins = () => { + const useQueryDataCoins = () => { return useQuery({ queryKey: ['get_all_coins', CHAIN_ID], - queryFn:async () => { - - const keys= await getAllCoins() - return keys + queryFn: async () => { + const keys = await getAllCoins(); + return keys; }, - placeholderData:[] - - - }) - - } + placeholderData: [], + }); + }; - const queryDataLaunch = () => { + const useQueryDataLaunch = () => { return useQuery({ queryKey: ['get_all_launched_coins', CHAIN_ID], - queryFn:async () => { - - const keys= await getAllCoins() - return keys + queryFn: async () => { + const keys = await getAllCoins(); + return keys; }, - placeholderData:[] - - - }) - - } - + placeholderData: [], + }); + }; /** Indexer with Key contract event */ const getAllCoins = async (account?: AccountInterface, contractAddress?: string) => { console.log('getAllCoins'); - const addressContract = contractAddress ?? LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; + const addressContract = + contractAddress ?? LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; const contract = await prepareAndConnectContract(provider, addressContract, account); // if (!account) return; // console.log('get key all keys'); @@ -83,10 +73,11 @@ export const useDataCoins = () => { return all_keys; }; - /** Indexer with Key contract event */ - const getAllLaunch = async (account?: AccountInterface, contractAddress?: string) => { + /** Indexer with Key contract event */ + const getAllLaunch = async (account?: AccountInterface, contractAddress?: string) => { console.log('getAllLaunch'); - const addressContract = contractAddress ?? LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; + const addressContract = + contractAddress ?? LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; const contract = await prepareAndConnectContract(provider, addressContract, account); // if (!account) return; // console.log('get key all keys'); @@ -95,7 +86,6 @@ export const useDataCoins = () => { return all_launch; }; - const getMySharesOfUser = async ( address_user: string, account?: AccountInterface, @@ -155,5 +145,13 @@ export const useDataCoins = () => { } }; - return { getAllCoins, getMySharesOfUser, getCoinByAddress, queryDataCoins, queryDataLaunch, getAllLaunch, getCoinLaunchByAddress}; + return { + getAllCoins, + getMySharesOfUser, + getCoinByAddress, + useQueryDataCoins, + useQueryDataLaunch, + getAllLaunch, + getCoinLaunchByAddress, + }; }; diff --git a/apps/mobile/src/hooks/launchpad/useInstantiateKeys.ts b/apps/mobile/src/hooks/launchpad/useInstantiateKeys.ts index de9dcf65..c1ba0ae3 100644 --- a/apps/mobile/src/hooks/launchpad/useInstantiateKeys.ts +++ b/apps/mobile/src/hooks/launchpad/useInstantiateKeys.ts @@ -1,8 +1,7 @@ -import {useAccount, useNetwork} from '@starknet-react/core'; -import {AccountInterface, CallData, constants} from 'starknet'; - +import {useNetwork} from '@starknet-react/core'; // import { LAUNCHPAD_ADDRESS} from '../../constants/contracts'; -import {LAUNCHPAD_ADDRESS} from "common" +import {LAUNCHPAD_ADDRESS} from 'common'; +import {AccountInterface, CallData, constants} from 'starknet'; export const useInstantiateKeys = () => { const chain = useNetwork(); @@ -11,7 +10,8 @@ export const useInstantiateKeys = () => { const handleInstantiateKeys = async (account: AccountInterface, addressContract?: string) => { if (!account) return; - const contractAddress = addressContract ?? LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; + const contractAddress = + addressContract ?? LAUNCHPAD_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; const call = { contractAddress, diff --git a/apps/mobile/src/hooks/launchpad/useQueryAllCoins.ts b/apps/mobile/src/hooks/launchpad/useQueryAllCoins.ts index 37b97891..a39105db 100644 --- a/apps/mobile/src/hooks/launchpad/useQueryAllCoins.ts +++ b/apps/mobile/src/hooks/launchpad/useQueryAllCoins.ts @@ -1,18 +1,18 @@ -import { useNetwork } from '@starknet-react/core'; -import { useQuery } from '@tanstack/react-query'; -import { CHAIN_ID } from '../../constants/env'; -import { useDataCoins } from './useDataCoins'; +import {useNetwork} from '@starknet-react/core'; +import {useQuery} from '@tanstack/react-query'; + +import {CHAIN_ID} from '../../constants/env'; +import {useDataCoins} from './useDataCoins'; export const useQueryAllCoins = () => { const chain = useNetwork(); - const {getAllCoins} = useDataCoins() + const {getAllCoins} = useDataCoins(); return useQuery({ queryKey: ['get_all_coins', CHAIN_ID], - queryFn:async () => { - - const coins= await getAllCoins() - return coins + queryFn: async () => { + const coins = await getAllCoins(); + return coins; }, - placeholderData:[] - }) + placeholderData: [], + }); }; diff --git a/apps/mobile/src/hooks/launchpad/useQueryAllLaunch.ts b/apps/mobile/src/hooks/launchpad/useQueryAllLaunch.ts index ba257118..9911726d 100644 --- a/apps/mobile/src/hooks/launchpad/useQueryAllLaunch.ts +++ b/apps/mobile/src/hooks/launchpad/useQueryAllLaunch.ts @@ -1,22 +1,19 @@ -import { useAccount, useNetwork, useProvider } from '@starknet-react/core'; -import { AccountInterface, constants, Contract, ProviderInterface, RpcProvider } from 'starknet'; +import {useNetwork} from '@starknet-react/core'; +import {useQuery} from '@tanstack/react-query'; -import { KEYS_ADDRESS } from '../../constants/contracts'; -import { useQuery } from '@tanstack/react-query'; -import { CHAIN_ID } from '../../constants/env'; -import { prepareAndConnectContract, useDataCoins } from './useDataCoins'; +import {CHAIN_ID} from '../../constants/env'; +import {useDataCoins} from './useDataCoins'; export const useQueryAllLaunch = () => { const chain = useNetwork(); - const { getAllLaunch} = useDataCoins() + const {getAllLaunch} = useDataCoins(); const chainId = chain?.chain?.id; return useQuery({ queryKey: ['get_all_launch', CHAIN_ID], - queryFn:async () => { - - const launches= await getAllLaunch() - return launches + queryFn: async () => { + const launches = await getAllLaunch(); + return launches; }, - placeholderData:[] - }) + placeholderData: [], + }); }; diff --git a/apps/mobile/src/hooks/launchpad/useSellCoin.ts b/apps/mobile/src/hooks/launchpad/useSellCoin.ts index 183c550d..c75af670 100644 --- a/apps/mobile/src/hooks/launchpad/useSellCoin.ts +++ b/apps/mobile/src/hooks/launchpad/useSellCoin.ts @@ -1,8 +1,9 @@ import {useAccount, useNetwork, useProvider} from '@starknet-react/core'; +import {LAUNCHPAD_ADDRESS} from 'common'; import {AccountInterface, CallData, constants, RpcProvider, uint256} from 'starknet'; + import {TokenQuoteBuyKeys} from '../../types/keys'; import {formatFloatToUint256} from '../../utils/format'; -import {LAUNCHPAD_ADDRESS} from "common" export const useSellCoin = () => { const account = useAccount(); diff --git a/apps/mobile/src/hooks/unruggable/useDeploy.ts b/apps/mobile/src/hooks/unruggable/useDeploy.ts index cc3ca0d4..5f6849c7 100644 --- a/apps/mobile/src/hooks/unruggable/useDeploy.ts +++ b/apps/mobile/src/hooks/unruggable/useDeploy.ts @@ -1,38 +1,37 @@ -import { UNRUGGABLE_FACTORY_ADDRESS } from "common"; -import { AccountInterface, CallData, Calldata, cairo, constants } from "starknet" +import {UNRUGGABLE_FACTORY_ADDRESS} from 'common'; +import {AccountInterface, cairo, CallData, constants} from 'starknet'; export type DeployTokenFormValues = { - name: string | undefined; - symbol: string | undefined; - initialSupply: number | undefined; - contract_address_salt: string | undefined + name: string | undefined; + symbol: string | undefined; + initialSupply: number | undefined; + contract_address_salt: string | undefined; }; export const useDeployTokenUnruggable = () => { + const deployTokenUnruggable = async (account: AccountInterface, data: DeployTokenFormValues) => { + // const CONTRACT_ADDRESS_SALT_DEFAULT = data?.contract_address_salt ?? await account?.getChainId() == constants.StarknetChainId.SN_MAIN ? + // "0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6" : + // "0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6" + const deployCall = { + contractAddress: UNRUGGABLE_FACTORY_ADDRESS[constants.StarknetChainId.SN_MAIN], + entrypoint: 'create_memecoin', + calldata: CallData.compile({ + owner: account?.address, + name: data.name ?? 'LFG', + symbol: data.symbol ?? 'LFG', + initialSupply: cairo.uint256(data?.initialSupply ?? 100), + contract_address_salt: new Date().getTime(), + }), + }; - const deployTokenUnruggable = async (account: AccountInterface, data: DeployTokenFormValues) => { - // const CONTRACT_ADDRESS_SALT_DEFAULT = data?.contract_address_salt ?? await account?.getChainId() == constants.StarknetChainId.SN_MAIN ? - // "0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6" : - // "0x36d8be2991d685af817ef9d127ffb00fbb98a88d910195b04ec4559289a99f6" - const deployCall = { - contractAddress: UNRUGGABLE_FACTORY_ADDRESS[constants.StarknetChainId.SN_MAIN], - entrypoint: 'create_memecoin', - calldata: CallData.compile({ - owner: account?.address, - name: data.name ?? "LFG", - symbol: data.symbol ?? "LFG", - initialSupply: cairo.uint256(data?.initialSupply ?? 100), - contract_address_salt:new Date().getTime() - }), - }; + const tx = await account.execute(deployCall); + console.log('tx hash', tx.transaction_hash); + const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); + return wait_tx; + }; - const tx = await account.execute(deployCall) - console.log('tx hash', tx.transaction_hash); - const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); - return wait_tx - } - - return { - deployTokenUnruggable - } -} \ No newline at end of file + return { + deployTokenUnruggable, + }; +}; diff --git a/apps/mobile/src/hooks/useKeysEvents.ts b/apps/mobile/src/hooks/useKeysEvents.ts index 76844e40..59e805ae 100644 --- a/apps/mobile/src/hooks/useKeysEvents.ts +++ b/apps/mobile/src/hooks/useKeysEvents.ts @@ -1,12 +1,11 @@ import {useQuery} from '@tanstack/react-query'; -import {uint256} from 'starknet'; +// import {useAuth} from '../store/auth'; +import {useAuth} from 'afk_nostr_sdk'; -import {ESCROW_ADDRESSES, KEYS_ADDRESS} from '../constants/contracts'; +import {KEYS_ADDRESS} from '../constants/contracts'; import {CHAIN_ID} from '../constants/env'; -import {EventKey, EventKeyForKeysMarketplace} from '../constants/misc'; -// import {useAuth} from '../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; -import { parseCreatedKeyEvent} from '../utils/events'; +import {EventKeyForKeysMarketplace} from '../constants/misc'; +import {parseCreatedKeyEvent} from '../utils/events'; import {useRpcProvider} from './useRpcProvider'; export const useKeysEvents = () => { @@ -36,7 +35,7 @@ export const useKeysEvents = () => { chunk_size: 1000, continuation_token: continuationToken, }); - console.log("keys created",keysCreated) + console.log('keys created', keysCreated); if (keysCreated.continuation_token) { const next = await getKeyEvents(keysCreated.continuation_token); return [...keysCreated.events, ...next]; diff --git a/apps/mobile/src/hooks/useTips.ts b/apps/mobile/src/hooks/useTips.ts index c1d17a4e..d51bf38e 100644 --- a/apps/mobile/src/hooks/useTips.ts +++ b/apps/mobile/src/hooks/useTips.ts @@ -1,11 +1,11 @@ import {useQuery} from '@tanstack/react-query'; +// import {useAuth} from '../store/auth'; +import {useAuth} from 'afk_nostr_sdk'; import {uint256} from 'starknet'; import {ESCROW_ADDRESSES} from '../constants/contracts'; import {CHAIN_ID} from '../constants/env'; import {EventKey} from '../constants/misc'; -// import {useAuth} from '../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; import {parseClaimEvent, parseDepositEvent} from '../utils/events'; import {useRpcProvider} from './useRpcProvider'; diff --git a/apps/mobile/src/hooks/useWindowDimensions.ts b/apps/mobile/src/hooks/useWindowDimensions.ts index a125feb8..6eede3ef 100644 --- a/apps/mobile/src/hooks/useWindowDimensions.ts +++ b/apps/mobile/src/hooks/useWindowDimensions.ts @@ -1,8 +1,6 @@ +import {useMemo} from 'react'; import {Dimensions, Platform, useWindowDimensions as useRNWindowDimensions} from 'react-native'; -import {WEB_MAX_WIDTH} from '../constants/misc'; -import { useMemo, useState } from 'react'; - export const useWindowDimensions = () => { const dimensions = useRNWindowDimensions(); @@ -16,16 +14,15 @@ export const useWindowDimensions = () => { export const useDimensions = () => { // const [dimension, setDimension] = useState() const width = useMemo(() => { - return Dimensions.get("window").width - - },[Dimensions.get("window").width]) + return Dimensions.get('window').width; + }, [Dimensions.get('window').width]); const isDesktop = useMemo(() => { - return width>= 1024 ? true :false - },[width]) + return width >= 1024 ? true : false; + }, [width]); - return { - width, - isDesktop - } -} \ No newline at end of file + return { + width, + isDesktop, + }; +}; diff --git a/apps/mobile/src/modules/Auth/index.tsx b/apps/mobile/src/modules/Auth/index.tsx index 16784314..0358b7f8 100644 --- a/apps/mobile/src/modules/Auth/index.tsx +++ b/apps/mobile/src/modules/Auth/index.tsx @@ -23,10 +23,7 @@ export const Auth: React.FC = ({title, children}) => { - + diff --git a/apps/mobile/src/modules/ChannelCard/Card/ChannelInfo.tsx b/apps/mobile/src/modules/ChannelCard/Card/ChannelInfo.tsx index 219cd478..75359d88 100644 --- a/apps/mobile/src/modules/ChannelCard/Card/ChannelInfo.tsx +++ b/apps/mobile/src/modules/ChannelCard/Card/ChannelInfo.tsx @@ -1,6 +1,9 @@ import {NDKEvent} from '@nostr-dev-kit/ndk'; import {useNavigation} from '@react-navigation/native'; import {useQueryClient} from '@tanstack/react-query'; +// import {useAuth} from '../../../store/auth'; +import {useAuth} from 'afk_nostr_sdk'; +import {useProfile, useReact, useReactions, useReplyNotes} from 'afk_nostr_sdk'; import {useEffect, useMemo, useState} from 'react'; import {Pressable, View} from 'react-native'; import Animated, { @@ -14,24 +17,13 @@ import Animated, { import {LikeFillIcon, LikeIcon} from '../../../assets/icons'; import {Avatar, Text} from '../../../components'; -import { - useStyles, - useTheme, -} from '../../../hooks'; +import {useStyles, useTheme} from '../../../hooks'; import {useTipModal} from '../../../hooks/modals'; -// import {useAuth} from '../../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; - import {MainStackNavigationProps} from '../../../types'; import {IChannelsMetadata} from '../../../types/channels'; import {shortenPubkey} from '../../../utils/helpers'; import {getElapsedTimeStringFull} from '../../../utils/timestamp'; import stylesheet from './styles'; -import {useProfile, - useReact, - useReactions, - useReplyNotes, -} from "afk_nostr_sdk" export type PostProps = { asComment?: boolean; @@ -164,41 +156,38 @@ export const ChannelInfo: React.FC = ({asComment, event}) => { )} - - - - - Created {getElapsedTimeStringFull((event?.created_at ?? Date.now()) * 1000)} - - {profile?.image && ( - - )} - - {(profile?.nip05 || profile?.name) && ( - <> - - By @{profile?.nip05 ?? profile.name} - + + + Created {getElapsedTimeStringFull((event?.created_at ?? Date.now()) * 1000)} + + {profile?.image && ( + + )} - {/* */} - - )} + {(profile?.nip05 || profile?.name) && ( + <> + + By @{profile?.nip05 ?? profile.name} + + + {/* */} + + )} + - - @@ -219,7 +208,6 @@ export const ChannelInfo: React.FC = ({asComment, event}) => { - diff --git a/apps/mobile/src/modules/ChannelCard/Card/index.tsx b/apps/mobile/src/modules/ChannelCard/Card/index.tsx index c757bcba..46fd0af3 100644 --- a/apps/mobile/src/modules/ChannelCard/Card/index.tsx +++ b/apps/mobile/src/modules/ChannelCard/Card/index.tsx @@ -1,6 +1,9 @@ import {NDKEvent} from '@nostr-dev-kit/ndk'; import {useNavigation} from '@react-navigation/native'; import {useQueryClient} from '@tanstack/react-query'; +// import {useAuth} from '../../../store/auth'; +import {useAuth} from 'afk_nostr_sdk'; +import {useMessagesChannels, useProfile, useReact, useReactions} from 'afk_nostr_sdk'; import {useEffect, useMemo, useState} from 'react'; import {Pressable, View} from 'react-native'; import { @@ -16,19 +19,10 @@ import {CommentIcon} from '../../../assets/icons'; import {IconButton, Menu, Text} from '../../../components'; import {useStyles, useTheme} from '../../../hooks'; import {useTipModal} from '../../../hooks/modals'; -// import {useAuth} from '../../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; - import {MainStackNavigationProps} from '../../../types'; import {IChannelsMetadata} from '../../../types/channels'; import {ChannelInfo} from './ChannelInfo'; import stylesheet from './styles'; -import {useProfile, - useReact, - useReactions, - useReplyNotes, - useMessagesChannels -} from "afk_nostr_sdk" export type PostProps = { asComment?: boolean; event?: NDKEvent; diff --git a/apps/mobile/src/modules/ChannelCard/Card/styles.ts b/apps/mobile/src/modules/ChannelCard/Card/styles.ts index 2f5a0641..6c741163 100644 --- a/apps/mobile/src/modules/ChannelCard/Card/styles.ts +++ b/apps/mobile/src/modules/ChannelCard/Card/styles.ts @@ -3,10 +3,10 @@ import {Spacing, ThemedStyleSheet} from '../../../styles'; export default ThemedStyleSheet((theme) => ({ container: { // backgroundColor: theme.colors.surface, - border:5, - shadowRadius:5, - shadowColor:theme.colors.surface, - shadowOpacity:0.5, + border: 5, + shadowRadius: 5, + shadowColor: theme.colors.surface, + shadowOpacity: 0.5, shadowOffset: {width: -2, height: 4}, }, diff --git a/apps/mobile/src/modules/ChannelDetailPage/index.tsx b/apps/mobile/src/modules/ChannelDetailPage/index.tsx index ac08910d..2e406287 100644 --- a/apps/mobile/src/modules/ChannelDetailPage/index.tsx +++ b/apps/mobile/src/modules/ChannelDetailPage/index.tsx @@ -1,12 +1,12 @@ import {NDKKind} from '@nostr-dev-kit/ndk'; import {useQueryClient} from '@tanstack/react-query'; +import {useMessagesChannels, useNote, useReplyNotes, useSendMessageChannel} from 'afk_nostr_sdk'; import {useEffect, useState} from 'react'; import {FlatList, RefreshControl, View} from 'react-native'; import {Divider, IconButton, Input, KeyboardFixedView} from '../../components'; import {useStyles, useTheme} from '../../hooks'; import {useToast} from '../../hooks/modals'; -import {useSendMessageChannel, useMessagesChannels, useNote, useReplyNotes,} from 'afk_nostr_sdk' import {IChannelsMetadata} from '../../types/channels'; import {ChannelInfo} from '../ChannelCard/Card/ChannelInfo'; import {Post} from '../Post'; diff --git a/apps/mobile/src/modules/KeyModal/FormInstantiateKey.tsx b/apps/mobile/src/modules/KeyModal/FormInstantiateKey.tsx index 6c5605f7..5860ebce 100644 --- a/apps/mobile/src/modules/KeyModal/FormInstantiateKey.tsx +++ b/apps/mobile/src/modules/KeyModal/FormInstantiateKey.tsx @@ -1,27 +1,24 @@ -import { NDKEvent } from '@nostr-dev-kit/ndk'; -import { useAccount } from '@starknet-react/core'; -import { useEffect, useState } from 'react'; +import {NDKEvent} from '@nostr-dev-kit/ndk'; +import {useAccount} from '@starknet-react/core'; +import {useProfile} from 'afk_nostr_sdk'; +import {useEffect, useState} from 'react'; import React from 'react'; -import { View } from 'react-native'; -import { CallData, constants } from 'starknet'; - -import { Button, Text } from '../../components'; -import { KEYS_ADDRESS } from '../../constants/contracts'; -import { TokenSymbol } from '../../constants/tokens'; -import { useStyles, useWaitConnection } from '../../hooks'; -import { useDataKeys } from '../../hooks/keys/useDataKeys'; -import { - useProfile, -} from "afk_nostr_sdk" -import { useInstantiateKeys } from '../../hooks/keys/useInstantiateKeys'; -import { useTransactionModal } from '../../hooks/modals'; -import { useDialog } from '../../hooks/modals/useDialog'; -import { useTransaction } from '../../hooks/modals/useTransaction'; -import { useWalletModal } from '../../hooks/modals/useWalletModal'; -import { KeysUser } from '../../types/keys'; -import { feltToAddress } from '../../utils/format'; -import { TipSuccessModalProps } from '../TipSuccessModal'; -import { KeyModalAction } from '.'; +import {View} from 'react-native'; +import {CallData, constants} from 'starknet'; + +import {Button, Text} from '../../components'; +import {KEYS_ADDRESS} from '../../constants/contracts'; +import {TokenSymbol} from '../../constants/tokens'; +import {useStyles, useWaitConnection} from '../../hooks'; +import {useDataKeys} from '../../hooks/keys/useDataKeys'; +import {useInstantiateKeys} from '../../hooks/keys/useInstantiateKeys'; +import {useTransactionModal} from '../../hooks/modals'; +import {useDialog} from '../../hooks/modals/useDialog'; +import {useTransaction} from '../../hooks/modals/useTransaction'; +import {useWalletModal} from '../../hooks/modals/useWalletModal'; +import {KeysUser} from '../../types/keys'; +import {TipSuccessModalProps} from '../TipSuccessModal'; +import {KeyModalAction} from '.'; import stylesheet from './styles'; export type FormInstantiateKeyProps = { @@ -47,7 +44,7 @@ export const FormInstantiateKey = ({ const [token, setToken] = useState(TokenSymbol.ETH); const [amount, setAmount] = useState(''); - const { data: profile } = useProfile({ publicKey: event?.pubkey }); + const {data: profile} = useProfile({publicKey: event?.pubkey}); const [myKey, setMyKey] = useState(); const [keySelected, setKeySelected] = useState(); const [isCanInstantiateKey, setCanInstantiateKey] = useState(false); @@ -55,11 +52,11 @@ export const FormInstantiateKey = ({ const account = useAccount(); const walletModal = useWalletModal(); const sendTransaction = useTransaction(); - const { hide: hideTransactionModal } = useTransactionModal(); + const {hide: hideTransactionModal} = useTransactionModal(); const waitConnection = useWaitConnection(); - const { handleInstantiateKeys } = useInstantiateKeys(); - const { getAllKeys, getKeyByAddress } = useDataKeys(); - const { showDialog, hideDialog } = useDialog(); + const {handleInstantiateKeys} = useInstantiateKeys(); + const {getAllKeys, getKeyByAddress} = useDataKeys(); + const {showDialog, hideDialog} = useDialog(); const isActive = !!amount && !!token; useEffect(() => { @@ -99,10 +96,9 @@ export const FormInstantiateKey = ({ }; if (!account || !account?.account) return; - const receipt = await sendTransaction({ calls: [ - call + call, // { // contractAddress: ESCROW_ADDRESSES[CHAIN_ID], // entrypoint: Entrypoint.DEPOSIT, @@ -127,9 +123,11 @@ export const FormInstantiateKey = ({ profile?.displayName ?? profile?.name ?? event?.pubkey, - children:(<> - Your key is instantiate! - ), + children: ( + <> + Your key is instantiate! + + ), hide: hideSuccess, }); } else { @@ -141,10 +139,9 @@ export const FormInstantiateKey = ({ showDialog({ title: 'Failed to send the tip', description, - buttons: [{ type: 'secondary', label: 'Close', onPress: () => hideDialog() }], + buttons: [{type: 'secondary', label: 'Close', onPress: () => hideDialog()}], }); } - }; return ( @@ -190,13 +187,10 @@ export const FormInstantiateKey = ({ Instantiate your key - - {account?.address && - Connect: {account?.address} - } + {account?.address && Connect: {account?.address}} {(myKey && BigInt(myKey?.owner) == BigInt(0)) || diff --git a/apps/mobile/src/modules/KeyModal/index.tsx b/apps/mobile/src/modules/KeyModal/index.tsx index 0d011985..883f6d3e 100644 --- a/apps/mobile/src/modules/KeyModal/index.tsx +++ b/apps/mobile/src/modules/KeyModal/index.tsx @@ -1,11 +1,11 @@ import {NDKEvent} from '@nostr-dev-kit/ndk'; import {useAccount} from '@starknet-react/core'; +import {useProfile} from 'afk_nostr_sdk'; import {forwardRef, useEffect, useState} from 'react'; import {Modalize, Text} from '../../components'; import {TokenSymbol} from '../../constants/tokens'; import {useStyles, useWaitConnection} from '../../hooks'; -import {useProfile} from "afk_nostr_sdk" import {useDataKeys} from '../../hooks/keys/useDataKeys'; import {useInstantiateKeys} from '../../hooks/keys/useInstantiateKeys'; import {useTransactionModal} from '../../hooks/modals'; diff --git a/apps/mobile/src/modules/LaunchTokenPump/FormLaunchToken.tsx b/apps/mobile/src/modules/LaunchTokenPump/FormLaunchToken.tsx index 99797cb2..7baa49a4 100644 --- a/apps/mobile/src/modules/LaunchTokenPump/FormLaunchToken.tsx +++ b/apps/mobile/src/modules/LaunchTokenPump/FormLaunchToken.tsx @@ -1,22 +1,19 @@ -import { useNavigation } from '@react-navigation/native'; -import { useQueryClient } from '@tanstack/react-query'; -import { Formik, FormikProps } from 'formik'; -import { useRef, useState } from 'react'; -import { ScrollView, View } from 'react-native'; - -import { Button, SquareInput, Text } from '../../components'; -import { useStyles, useWaitConnection } from '../../hooks'; -import { useProfile } from "afk_nostr_sdk" -import { useToast, useWalletModal } from '../../hooks/modals'; -import stylesheet from '../../screens/CreateChannel/styles'; +import {NDKEvent} from '@nostr-dev-kit/ndk'; +import {useAccount} from '@starknet-react/core'; +import {useQueryClient} from '@tanstack/react-query'; +import {useProfile} from 'afk_nostr_sdk'; // import { useAuth } from '../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; - -import { MainStackNavigationProps } from '../../types'; -import { useAccount } from '@starknet-react/core'; -import { useCreateToken, DeployTokenFormValues } from '../../hooks/launchpad/useCreateToken'; -import { TipSuccessModalProps } from '../TipSuccessModal'; -import { NDKEvent } from '@nostr-dev-kit/ndk'; +import {useAuth} from 'afk_nostr_sdk'; +import {Formik, FormikProps} from 'formik'; +import {useRef, useState} from 'react'; +import {ScrollView, View} from 'react-native'; + +import {Button, SquareInput, Text} from '../../components'; +import {useStyles, useWaitConnection} from '../../hooks'; +import {DeployTokenFormValues, useCreateToken} from '../../hooks/launchpad/useCreateToken'; +import {useToast, useWalletModal} from '../../hooks/modals'; +import stylesheet from '../../screens/CreateChannel/styles'; +import {TipSuccessModalProps} from '../TipSuccessModal'; const UsernameInputLeft = ( @@ -27,7 +24,7 @@ const UsernameInputLeft = ( enum TypeCreate { LAUNCH, CREATE, - CREATE_AND_LAUNCH + CREATE_AND_LAUNCH, } export type FormTokenCreatedProps = { event?: NDKEvent; @@ -37,32 +34,31 @@ export type FormTokenCreatedProps = { hideSuccess?: () => void; }; - type FormValues = DeployTokenFormValues; export const FormLaunchToken: React.FC = () => { const formikRef = useRef>(null); + const walletModal = useWalletModal(); const styles = useStyles(stylesheet); const publicKey = useAuth((state) => state.publicKey); - const profile = useProfile({ publicKey }); + const profile = useProfile({publicKey}); const queryClient = useQueryClient(); - const { showToast } = useToast(); - const account = useAccount() - const waitConnection = useWaitConnection() - const { deployToken, deployTokenAndLaunch } = useCreateToken() + const {showToast} = useToast(); + const account = useAccount(); + const waitConnection = useWaitConnection(); + const {deployToken, deployTokenAndLaunch} = useCreateToken(); - const [type, setType] = useState(TypeCreate.CREATE) - if (profile.isLoading) return null; + const [type, setType] = useState(TypeCreate.CREATE); const initialFormValues: FormValues = { name: 'My Man', symbol: 'MY_MAN', // ticker: '', initialSupply: 100_000_000, contract_address_salt: undefined, - recipient: account?.address + recipient: account?.address, }; const onSubmitPress = (type: TypeCreate) => { - setType(type) + setType(type); formikRef.current?.handleSubmit(); }; @@ -75,7 +71,7 @@ export const FormLaunchToken: React.FC = () => { const onFormSubmit = async (values: FormValues) => { try { - console.log("onFormSubmit deploy") + console.log('onFormSubmit deploy'); if (!account.address) { walletModal.show(); const result = await waitConnection(); @@ -87,31 +83,27 @@ export const FormLaunchToken: React.FC = () => { name: values.name, symbol: values.symbol, initialSupply: values?.initialSupply, - contract_address_salt: values.contract_address_salt + contract_address_salt: values.contract_address_salt, }; if (!account || !account?.account) return; - console.log("test deploy") + console.log('test deploy'); let tx; - if(type == TypeCreate.CREATE) { + if (type == TypeCreate.CREATE) { tx = await deployToken(account?.account, data); - } else { tx = await deployTokenAndLaunch(account?.account, data); - } if (tx) { - showToast({ type: 'success', title: 'Token launch created successfully' }); - + showToast({type: 'success', title: 'Token launch created successfully'}); } } catch (error) { - showToast({ type: 'error', title: 'Failed to create token and launch' }); + showToast({type: 'error', title: 'Failed to create token and launch'}); } }; - const walletModal = useWalletModal(); - + if (profile.isLoading) return null; return ( @@ -123,8 +115,7 @@ export const FormLaunchToken: React.FC = () => { onSubmit={onFormSubmit} validate={validateForm} > - - {({ handleChange, handleBlur, values, errors }) => ( + {({handleChange, handleBlur, values, errors}) => ( = () => { error={errors.initialSupply?.toString()} /> - + - + diff --git a/apps/mobile/src/modules/LaunchTokenUnruggable/FormLaunchTokenUnruggable.tsx b/apps/mobile/src/modules/LaunchTokenUnruggable/FormLaunchTokenUnruggable.tsx index 27f89f8c..19363947 100644 --- a/apps/mobile/src/modules/LaunchTokenUnruggable/FormLaunchTokenUnruggable.tsx +++ b/apps/mobile/src/modules/LaunchTokenUnruggable/FormLaunchTokenUnruggable.tsx @@ -1,20 +1,19 @@ -import { useNavigation } from '@react-navigation/native'; -import { useQueryClient } from '@tanstack/react-query'; -import { Formik, FormikProps } from 'formik'; -import { useRef } from 'react'; -import { ScrollView, View } from 'react-native'; - -import { Button, SquareInput, Text } from '../../components'; -import { useStyles, useWaitConnection } from '../../hooks'; -import {useProfile} from "afk_nostr_sdk" -import { useToast, useWalletModal } from '../../hooks/modals'; -import stylesheet from '../../screens/CreateChannel/styles'; +import {useNavigation} from '@react-navigation/native'; +import {useAccount} from '@starknet-react/core'; +import {useQueryClient} from '@tanstack/react-query'; +import {useProfile} from 'afk_nostr_sdk'; // import { useAuth } from '../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; - -import { MainStackNavigationProps } from '../../types'; -import { DeployTokenFormValues, useDeployTokenUnruggable } from '../../hooks/unruggable/useDeploy'; -import { useAccount } from '@starknet-react/core'; +import {useAuth} from 'afk_nostr_sdk'; +import {Formik, FormikProps} from 'formik'; +import {useRef} from 'react'; +import {ScrollView, View} from 'react-native'; + +import {Button, SquareInput, Text} from '../../components'; +import {useStyles, useWaitConnection} from '../../hooks'; +import {useToast, useWalletModal} from '../../hooks/modals'; +import {DeployTokenFormValues, useDeployTokenUnruggable} from '../../hooks/unruggable/useDeploy'; +import stylesheet from '../../screens/CreateChannel/styles'; +import {MainStackNavigationProps} from '../../types'; const UsernameInputLeft = ( @@ -27,20 +26,19 @@ export const FormLaunchTokenUnruggable: React.FC = () => { const formikRef = useRef>(null); const styles = useStyles(stylesheet); const publicKey = useAuth((state) => state.publicKey); - const profile = useProfile({ publicKey }); + const profile = useProfile({publicKey}); const queryClient = useQueryClient(); - const { showToast } = useToast(); + const {showToast} = useToast(); const navigation = useNavigation(); - const account = useAccount() - const waitConnection = useWaitConnection() - const { deployTokenUnruggable } = useDeployTokenUnruggable() - if (profile.isLoading) return null; + const account = useAccount(); + const waitConnection = useWaitConnection(); + const {deployTokenUnruggable} = useDeployTokenUnruggable(); const initialFormValues: FormValues = { name: 'My Man is AFK or !AFK', symbol: 'MMNAFK', // ticker: '', initialSupply: 100, - contract_address_salt: "" + contract_address_salt: '', }; const onSubmitPress = () => { @@ -57,7 +55,7 @@ export const FormLaunchTokenUnruggable: React.FC = () => { const onFormSubmit = async (values: FormValues) => { try { - console.log("onFormSubmit deploy") + console.log('onFormSubmit deploy'); if (!account.address) { walletModal.show(); const result = await waitConnection(); @@ -68,18 +66,18 @@ export const FormLaunchTokenUnruggable: React.FC = () => { name: values.name, symbol: values.symbol, initialSupply: values?.initialSupply, - contract_address_salt: values.contract_address_salt + contract_address_salt: values.contract_address_salt, }; if (!account || !account?.account) return; deployTokenUnruggable(account?.account, data); - showToast({ type: 'success', title: 'Token launch created successfully' }); + showToast({type: 'success', title: 'Token launch created successfully'}); } catch (error) { - showToast({ type: 'error', title: 'Failed to create token and launch' }); + showToast({type: 'error', title: 'Failed to create token and launch'}); } }; const walletModal = useWalletModal(); - + if (profile.isLoading) return null; return ( @@ -91,8 +89,7 @@ export const FormLaunchTokenUnruggable: React.FC = () => { onSubmit={onFormSubmit} validate={validateForm} > - - {({ handleChange, handleBlur, values, errors }) => ( + {({handleChange, handleBlur, values, errors}) => ( { + // onPress={() => onSubmitPress} + > + Launch coming soon + diff --git a/apps/mobile/src/modules/Layout/sidebar/index.tsx b/apps/mobile/src/modules/Layout/sidebar/index.tsx index 8bede9a2..924a82e7 100644 --- a/apps/mobile/src/modules/Layout/sidebar/index.tsx +++ b/apps/mobile/src/modules/Layout/sidebar/index.tsx @@ -1,75 +1,70 @@ -import React, { useEffect } from 'react'; -import { View, Text, StyleSheet, Pressable } from 'react-native'; -import stylesheet from './styles'; -import { useStyles, useTheme } from '../../../hooks'; -import { Icon } from '../../../components/Icon'; -import { useNavigation } from '@react-navigation/native'; -import { DrawerStackNavigationProps, MainStackNavigationProps } from '../../../types'; // import { useAuth } from '../../../store/auth'; -import { useAuth, useNostrContext } from 'afk_nostr_sdk'; -import { DrawerNavigationHelpers } from '@react-navigation/drawer/lib/typescript/src/types'; +import {useAuth, useNostrContext} from 'afk_nostr_sdk'; +import React, {useEffect} from 'react'; +import {Pressable, Text, View} from 'react-native'; + +import {Icon} from '../../../components/Icon'; +import {useStyles, useTheme} from '../../../hooks'; +import stylesheet from './styles'; interface SidebarInterface { - // navigation:MainStackNavigationProps | DrawerNavigationHelpers - navigation: any + // navigation:MainStackNavigationProps | DrawerNavigationHelpers + navigation: any; } -const Sidebar = ( - { navigation }: SidebarInterface - -) => { - const styles = useStyles(stylesheet); - const publicKey = useAuth((state) => state.publicKey); - const ndk = useNostrContext() - // const navigation = useNavigation() - // const navigation = useNavigation() - const handleNavigateProfile = () => { - navigation.navigate("Profile", { publicKey: publicKey }); - }; - - const handleAuth = () => { - navigation.navigate("Auth"); - }; - const theme = useTheme() - // const handleNavigateHome = () => { - // navigation.navigate("Home"); - // }; - const handleDefiScreen = () => { - navigation.navigate("Defi"); - }; - const handleGameScreen = () => { - navigation.navigate("Games"); - }; - const handleHomeScreen = () => { - navigation.navigate("Feed"); - }; - - const handleTipsScreen = () => { - navigation.navigate("Tips"); - }; - useEffect(() => { - const unsubscribe = navigation.addListener('drawerClose', () => { - // Code to handle drawer closing - }); - - return unsubscribe; - }, [navigation]); - - return ( - - AFK - Features coming soon - {/* +const Sidebar = ({navigation}: SidebarInterface) => { + const styles = useStyles(stylesheet); + const publicKey = useAuth((state) => state.publicKey); + const ndk = useNostrContext(); + // const navigation = useNavigation() + // const navigation = useNavigation() + const handleNavigateProfile = () => { + navigation.navigate('Profile', {publicKey}); + }; + + const handleAuth = () => { + navigation.navigate('Auth'); + }; + const theme = useTheme(); + // const handleNavigateHome = () => { + // navigation.navigate("Home"); + // }; + const handleDefiScreen = () => { + navigation.navigate('Defi'); + }; + const handleGameScreen = () => { + navigation.navigate('Games'); + }; + const handleHomeScreen = () => { + navigation.navigate('Feed'); + }; + + const handleTipsScreen = () => { + navigation.navigate('Tips'); + }; + useEffect(() => { + const unsubscribe = navigation.addListener('drawerClose', () => { + // Code to handle drawer closing + }); + + return unsubscribe; + }, [navigation]); + + return ( + + AFK + Features coming soon + {/* Launchpad Notifications */} - {/* */} - {/* */} - - - - Feed - - - - - - - - Tips - - - - - - - - ? - - - - - - - - Onramp & DeFI - - - - {publicKey && - - - - Profile - - - - } - - {!publicKey && !ndk?.ndk?.signer && - - - - Login - - - } - - - ); + + + Feed + + + + + Tips + + + + + ? + + + + + Onramp & DeFI + + + {publicKey && ( + + + Profile + + )} + + {!publicKey && !ndk?.ndk?.signer && ( + + + Login + + )} + + ); }; export default Sidebar; diff --git a/apps/mobile/src/modules/Layout/sidebar/styles.ts b/apps/mobile/src/modules/Layout/sidebar/styles.ts index fc200254..ecfd2f1f 100644 --- a/apps/mobile/src/modules/Layout/sidebar/styles.ts +++ b/apps/mobile/src/modules/Layout/sidebar/styles.ts @@ -1,83 +1,83 @@ -import { Spacing, ThemedStyleSheet } from "../../../styles"; +import {Spacing, ThemedStyleSheet} from '../../../styles'; export default ThemedStyleSheet((theme) => ({ - container: {}, - sidebar: { - width: "100%", - height: '100%', - backgroundColor: theme.colors.background, - padding: 20, - gap:1, - // borderRight:"1" - }, - sidebarText: { - fontSize: 18, - color: theme.colors.text - }, - title: { - fontWeight: 'bold', - marginBottom: 16, - color: theme.colors.text - }, - item: { - display: 'flex', - width:"100%", - height:100, - backgroundColor: theme.colors.background, - // flex - // flex: 1, - flexDirection: "row", - // paddingVertical: 8, - color: theme.colors.text, - }, - textItem: { - backgroundColor: theme.colors.background, - color: theme.colors.text, - }, - outsideContainer: { - position: 'absolute', - top: 0, - right: 0, - bottom: 0, - left: 0, - width: '100%', - height: '100%', - }, + container: {}, + sidebar: { + width: '100%', + height: '100%', + backgroundColor: theme.colors.background, + padding: 20, + gap: 1, + // borderRight:"1" + }, + sidebarText: { + fontSize: 18, + color: theme.colors.text, + }, + title: { + fontWeight: 'bold', + marginBottom: 16, + color: theme.colors.text, + }, + item: { + display: 'flex', + width: '100%', + height: 100, + backgroundColor: theme.colors.background, + // flex + // flex: 1, + flexDirection: 'row', + // paddingVertical: 8, + color: theme.colors.text, + }, + textItem: { + backgroundColor: theme.colors.background, + color: theme.colors.text, + }, + outsideContainer: { + position: 'absolute', + top: 0, + right: 0, + bottom: 0, + left: 0, + width: '100%', + height: '100%', + }, - outside: { - width: '100%', - height: '100%', - }, + outside: { + width: '100%', + height: '100%', + }, - menuContainer: { - position: 'absolute', - zIndex: 1, - }, - menu: { - position: 'absolute', - height: 'auto', - backgroundColor: theme.colors.divider, - borderRadius: 16, - overflow: 'hidden', - shadowColor: theme.colors.shadow, - shadowOffset: { width: 0, height: 2 }, - shadowRadius: 4, - elevation: 2, - }, + menuContainer: { + position: 'absolute', + zIndex: 1, + }, + menu: { + position: 'absolute', + height: 'auto', + backgroundColor: theme.colors.divider, + borderRadius: 16, + overflow: 'hidden', + shadowColor: theme.colors.shadow, + shadowOffset: {width: 0, height: 2}, + shadowRadius: 4, + elevation: 2, + }, - menuItem: { - flex: 1, - flexDirection: 'row', - alignItems: 'center', - gap: Spacing.xxsmall, - backgroundColor: theme.colors.surface, - paddingHorizontal: Spacing.medium, - paddingVertical: Spacing.small, - }, - menuItemLabel: { - flex: 1, - fontSize: 17, - lineHeight: 22, - color: theme.colors.text, - }, + menuItem: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + gap: Spacing.xxsmall, + backgroundColor: theme.colors.surface, + paddingHorizontal: Spacing.medium, + paddingVertical: Spacing.small, + }, + menuItemLabel: { + flex: 1, + fontSize: 17, + lineHeight: 22, + color: theme.colors.text, + }, })); diff --git a/apps/mobile/src/modules/Post/index.tsx b/apps/mobile/src/modules/Post/index.tsx index 9d117a10..aeb457ff 100644 --- a/apps/mobile/src/modules/Post/index.tsx +++ b/apps/mobile/src/modules/Post/index.tsx @@ -1,8 +1,11 @@ -import { NDKEvent } from '@nostr-dev-kit/ndk'; -import { useNavigation } from '@react-navigation/native'; -import { useQueryClient } from '@tanstack/react-query'; -import { useMemo, useState } from 'react'; -import { Image, Pressable, View } from 'react-native'; +import {NDKEvent} from '@nostr-dev-kit/ndk'; +import {useNavigation} from '@react-navigation/native'; +import {useQueryClient} from '@tanstack/react-query'; +import {useProfile, useReact, useReactions, useReplyNotes} from 'afk_nostr_sdk'; +// import { useAuth } from '../../store/auth'; +import {useAuth} from 'afk_nostr_sdk'; +import {useMemo, useState} from 'react'; +import {Image, Pressable, View} from 'react-native'; import Animated, { Easing, useAnimatedStyle, @@ -12,17 +15,13 @@ import Animated, { withTiming, } from 'react-native-reanimated'; -import { CommentIcon, LikeFillIcon, LikeIcon, RepostIcon } from '../../assets/icons'; -import { Avatar, Icon, IconButton, Menu, Text } from '../../components'; -import { useStyles, useTheme } from '../../hooks'; -import { useProfile, useReact, useReactions, useReplyNotes, } from "afk_nostr_sdk" -import { useTipModal } from '../../hooks/modals'; -// import { useAuth } from '../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; - -import { MainStackNavigationProps } from '../../types'; -import { getImageRatio, shortenPubkey } from '../../utils/helpers'; -import { getElapsedTimeStringFull } from '../../utils/timestamp'; +import {CommentIcon, LikeFillIcon, LikeIcon, RepostIcon} from '../../assets/icons'; +import {Avatar, Icon, IconButton, Menu, Text} from '../../components'; +import {useStyles, useTheme} from '../../hooks'; +import {useTipModal} from '../../hooks/modals'; +import {MainStackNavigationProps} from '../../types'; +import {getImageRatio, shortenPubkey} from '../../utils/helpers'; +import {getElapsedTimeStringFull} from '../../utils/timestamp'; import stylesheet from './styles'; export type PostProps = { @@ -30,21 +29,21 @@ export type PostProps = { event?: NDKEvent; }; -export const Post: React.FC = ({ asComment, event }) => { +export const Post: React.FC = ({asComment, event}) => { const repostedEvent = undefined; - const { theme } = useTheme(); + const {theme} = useTheme(); const styles = useStyles(stylesheet); const navigation = useNavigation(); - const [dimensionsMedia, setMediaDimensions] = useState([250,300]) - const { publicKey } = useAuth(); - const { show: showTipModal } = useTipModal(); - const { data: profile } = useProfile({ publicKey: event?.pubkey }); - const reactions = useReactions({ noteId: event?.id }); - const userReaction = useReactions({ authors: [publicKey], noteId: event?.id }); - const comments = useReplyNotes({ noteId: event?.id }); + const [dimensionsMedia, setMediaDimensions] = useState([250, 300]); + const {publicKey} = useAuth(); + const {show: showTipModal} = useTipModal(); + const {data: profile} = useProfile({publicKey: event?.pubkey}); + const reactions = useReactions({noteId: event?.id}); + const userReaction = useReactions({authors: [publicKey], noteId: event?.id}); + const comments = useReplyNotes({noteId: event?.id}); const react = useReact(); const queryClient = useQueryClient(); @@ -79,41 +78,41 @@ export const Post: React.FC = ({ asComment, event }) => { const imageTag = event.tags.find((tag) => tag[0] === 'image'); if (!imageTag) return; /** @TODO finish good dimensions with correct ratio and base on the Platform */ - let dimensions = [250, 300] + let dimensions = [250, 300]; if (imageTag[2]) { - dimensions = imageTag[2].split('x').map(Number) - setMediaDimensions(dimensions) + dimensions = imageTag[2].split('x').map(Number); + setMediaDimensions(dimensions); } - return { uri: imageTag[1], width: dimensions[0], height: dimensions[1] }; + return {uri: imageTag[1], width: dimensions[0], height: dimensions[1]}; }, [event?.tags]); const animatedIconStyle = useAnimatedStyle(() => ({ - transform: [{ scale: scale.value }], + transform: [{scale: scale.value}], })); const handleProfilePress = (userId?: string) => { if (userId) { - navigation.navigate('Profile', { publicKey: userId }); + navigation.navigate('Profile', {publicKey: userId}); } }; const handleNavigateToPostDetails = () => { if (!event?.id) return; - navigation.navigate('PostDetail', { postId: event?.id, post: event }); + navigation.navigate('PostDetail', {postId: event?.id, post: event}); }; const toggleLike = async () => { if (!event?.id) return; await react.mutateAsync( - { event, type: isLiked ? 'dislike' : 'like' }, + {event, type: isLiked ? 'dislike' : 'like'}, { onSuccess: () => { - queryClient.invalidateQueries({ queryKey: ['reactions', event?.id] }); + queryClient.invalidateQueries({queryKey: ['reactions', event?.id]}); scale.value = withSequence( - withTiming(1.5, { duration: 100, easing: Easing.out(Easing.ease) }), // Scale up - withSpring(1, { damping: 6, stiffness: 200 }), // Bounce back + withTiming(1.5, {duration: 100, easing: Easing.out(Easing.ease)}), // Scale up + withSpring(1, {damping: 6, stiffness: 200}), // Bounce back ); }, }, @@ -123,8 +122,6 @@ export const Post: React.FC = ({ asComment, event }) => { const content = event?.content || ''; const truncatedContent = content.length > 200 ? `${content.slice(0, 200)}...` : content; - - return ( {repostedEvent && ( @@ -140,7 +137,7 @@ export const Post: React.FC = ({ asComment, event }) => { @@ -222,8 +219,8 @@ export const Post: React.FC = ({ asComment, event }) => { styles.contentImage, { // width:dimensionsMedia[0], - height:dimensionsMedia[1], - aspectRatio: getImageRatio(postSource.width, postSource.height) + height: dimensionsMedia[1], + aspectRatio: getImageRatio(postSource.width, postSource.height), }, ]} /> @@ -235,12 +232,14 @@ export const Post: React.FC = ({ asComment, event }) => { {!asComment && ( - + @@ -252,28 +251,25 @@ export const Post: React.FC = ({ asComment, event }) => { { if (!event) return; showTipModal(event); }} > - { // if (!event) return; // showTipModal(event); // }} /> - - - - {/* { diff --git a/apps/mobile/src/modules/Post/styles.ts b/apps/mobile/src/modules/Post/styles.ts index ebba3ee8..102beb52 100644 --- a/apps/mobile/src/modules/Post/styles.ts +++ b/apps/mobile/src/modules/Post/styles.ts @@ -1,4 +1,4 @@ -import { Spacing, ThemedStyleSheet } from '../../styles'; +import {Spacing, ThemedStyleSheet} from '../../styles'; export default ThemedStyleSheet((theme) => ({ container: {}, @@ -78,5 +78,5 @@ export default ThemedStyleSheet((theme) => ({ color: theme.colors.primary, fontSize: 13, marginTop: Spacing.xsmall, - } + }, })); diff --git a/apps/mobile/src/modules/TipModal/index.tsx b/apps/mobile/src/modules/TipModal/index.tsx index ac71bc5a..c6320c17 100644 --- a/apps/mobile/src/modules/TipModal/index.tsx +++ b/apps/mobile/src/modules/TipModal/index.tsx @@ -1,102 +1,84 @@ -import { NDKEvent } from '@nostr-dev-kit/ndk'; -import { useAccount } from '@starknet-react/core'; -import { forwardRef, useState } from 'react'; -import { Pressable, View } from 'react-native'; -import { CallData, uint256 } from 'starknet'; +import {NDKEvent} from '@nostr-dev-kit/ndk'; +import {forwardRef, useState} from 'react'; +import {Pressable, View} from 'react-native'; -import { Avatar, Button, Input, Modalize, Picker, Text } from '../../components'; -import { ESCROW_ADDRESSES } from '../../constants/contracts'; -import { CHAIN_ID } from '../../constants/env'; -import { DEFAULT_TIMELOCK, Entrypoint } from '../../constants/misc'; -import { TOKENS, TokenSymbol } from '../../constants/tokens'; -import { useStyles, useTheme, useWaitConnection } from '../../hooks'; -import { useProfile } from "afk_nostr_sdk" - -import { useTransactionModal } from '../../hooks/modals'; -import { useDialog } from '../../hooks/modals/useDialog'; -import { useTransaction } from '../../hooks/modals/useTransaction'; -import { useWalletModal } from '../../hooks/modals/useWalletModal'; -import { TipSuccessModalProps } from '../TipSuccessModal'; +import {Modalize, Text} from '../../components'; +import {useStyles, useTheme} from '../../hooks'; +import {TipSuccessModalProps} from '../TipSuccessModal'; +import {FormTipStarknet} from './starknet/form'; import stylesheet from './styles'; -import { FormTipStarknet } from './starknet/form'; -import { TipModalStarknet } from './starknet'; export type TipModal = Modalize; enum TipTypeMode { - ZAP, - STARKNET + ZAP, + STARKNET, } export type TipModalProps = { - event?: NDKEvent; + event?: NDKEvent; - show: (event: NDKEvent) => void; - hide: () => void; - showSuccess: (props: TipSuccessModalProps) => void; - hideSuccess: () => void; + show: (event: NDKEvent) => void; + hide: () => void; + showSuccess: (props: TipSuccessModalProps) => void; + hideSuccess: () => void; }; export const TipModal = forwardRef( - ({ event, hide: hideTipModal, showSuccess, hideSuccess, show, hide }, ref) => { - const styles = useStyles(stylesheet); - const [tipType, setTipType] = useState(TipTypeMode.STARKNET); - const theme = useTheme() - return ( - - - - - Starknet tip - - - - - Zap coming soon - - - - - { - tipType == TipTypeMode.STARKNET && - - - } - - - ); - }, + ({event, hide: hideTipModal, showSuccess, hideSuccess, show, hide}, ref) => { + const styles = useStyles(stylesheet); + const [tipType, setTipType] = useState(TipTypeMode.STARKNET); + const theme = useTheme(); + return ( + + + + Starknet tip + + + Zap coming soon + + + {tipType == TipTypeMode.STARKNET && ( + + )} + + ); + }, ); TipModal.displayName = 'TipModal'; diff --git a/apps/mobile/src/modules/TipModal/starknet/form.tsx b/apps/mobile/src/modules/TipModal/starknet/form.tsx index 14358662..ae1808d5 100644 --- a/apps/mobile/src/modules/TipModal/starknet/form.tsx +++ b/apps/mobile/src/modules/TipModal/starknet/form.tsx @@ -1,51 +1,55 @@ -import { NDKEvent } from '@nostr-dev-kit/ndk'; -import { useAccount } from '@starknet-react/core'; -import React, { forwardRef, useState } from 'react'; -import { Pressable, View } from 'react-native'; -import { CallData, uint256 } from 'starknet'; - -import { Avatar, Button, Input, Modalize, Picker, Text } from '../../../components'; -import { ESCROW_ADDRESSES } from '../../../constants/contracts'; -import { CHAIN_ID } from '../../../constants/env'; -import { DEFAULT_TIMELOCK, Entrypoint } from '../../../constants/misc'; -import { TOKENS, TokenSymbol } from '../../../constants/tokens'; -import { useStyles, useWaitConnection } from '../../../hooks'; -import { useProfile } from "afk_nostr_sdk" - -import { useTransactionModal } from '../../../hooks/modals'; -import { useDialog } from '../../../hooks/modals/useDialog'; -import { useTransaction } from '../../../hooks/modals/useTransaction'; -import { useWalletModal } from '../../../hooks/modals/useWalletModal'; -import { TipSuccessModalProps } from '../../TipSuccessModal'; +import {NDKEvent} from '@nostr-dev-kit/ndk'; +import {useAccount} from '@starknet-react/core'; +import {useProfile} from 'afk_nostr_sdk'; +import React, {useState} from 'react'; +import {View} from 'react-native'; +import {CallData, uint256} from 'starknet'; + +import {Avatar, Button, Input, Modalize, Picker, Text} from '../../../components'; +import {ESCROW_ADDRESSES} from '../../../constants/contracts'; +import {CHAIN_ID} from '../../../constants/env'; +import {DEFAULT_TIMELOCK, Entrypoint} from '../../../constants/misc'; +import {TOKENS, TokenSymbol} from '../../../constants/tokens'; +import {useStyles, useWaitConnection} from '../../../hooks'; +import {useTransactionModal} from '../../../hooks/modals'; +import {useDialog} from '../../../hooks/modals/useDialog'; +import {useTransaction} from '../../../hooks/modals/useTransaction'; +import {useWalletModal} from '../../../hooks/modals/useWalletModal'; +import {TipSuccessModalProps} from '../../TipSuccessModal'; import stylesheet from './styles'; export type TipModalStarknet = Modalize; export type FormTipModalStarknetProps = { event?: NDKEvent; - ref?: any + ref?: any; show: (event: NDKEvent) => void; hide: () => void; showSuccess: (props: TipSuccessModalProps) => void; hideSuccess: () => void; }; -export const FormTipStarknet: React.FC = ( - { event, hide: hideTipModal, showSuccess, hideSuccess, ref }: FormTipModalStarknetProps,) => { +export const FormTipStarknet: React.FC = ({ + event, + hide: hideTipModal, + showSuccess, + hideSuccess, + ref, +}: FormTipModalStarknetProps) => { const styles = useStyles(stylesheet); const [token, setToken] = useState(TokenSymbol.ETH); const [amount, setAmount] = useState(''); - const { data: profile } = useProfile({ publicKey: event?.pubkey }); + const {data: profile} = useProfile({publicKey: event?.pubkey}); const account = useAccount(); const walletModal = useWalletModal(); const sendTransaction = useTransaction(); - const { hide: hideTransactionModal } = useTransactionModal(); + const {hide: hideTransactionModal} = useTransactionModal(); const waitConnection = useWaitConnection(); - const { showDialog, hideDialog } = useDialog(); + const {showDialog, hideDialog} = useDialog(); const isActive = !!amount && !!token; @@ -110,7 +114,7 @@ export const FormTipStarknet: React.FC = ( showDialog({ title: 'Failed to send the tip', description, - buttons: [{ type: 'secondary', label: 'Close', onPress: () => hideDialog() }], + buttons: [{type: 'secondary', label: 'Close', onPress: () => hideDialog()}], }); } }; @@ -118,7 +122,6 @@ export const FormTipStarknet: React.FC = ( return ( - @@ -222,5 +225,5 @@ export const FormTipStarknet: React.FC = ( ); -} - // FormTipStarknet.displayName = 'FormTipStarknet'; +}; +// FormTipStarknet.displayName = 'FormTipStarknet'; diff --git a/apps/mobile/src/modules/TipModal/starknet/index.tsx b/apps/mobile/src/modules/TipModal/starknet/index.tsx index ea126641..93237c04 100644 --- a/apps/mobile/src/modules/TipModal/starknet/index.tsx +++ b/apps/mobile/src/modules/TipModal/starknet/index.tsx @@ -1,22 +1,21 @@ -import { NDKEvent } from '@nostr-dev-kit/ndk'; -import { useAccount } from '@starknet-react/core'; -import { forwardRef, useState } from 'react'; -import { Pressable, View } from 'react-native'; -import { CallData, uint256 } from 'starknet'; - -import { Avatar, Button, Input, Modalize, Picker, Text } from '../../../components'; -import { ESCROW_ADDRESSES } from '../../../constants/contracts'; -import { CHAIN_ID } from '../../../constants/env'; -import { DEFAULT_TIMELOCK, Entrypoint } from '../../../constants/misc'; -import { TOKENS, TokenSymbol } from '../../../constants/tokens'; -import { useStyles, useWaitConnection } from '../../../hooks'; -import { useProfile } from "afk_nostr_sdk" - -import { useTransactionModal } from '../../../hooks/modals'; -import { useDialog } from '../../../hooks/modals/useDialog'; -import { useTransaction } from '../../../hooks/modals/useTransaction'; -import { useWalletModal } from '../../../hooks/modals/useWalletModal'; -import { TipSuccessModalProps } from '../../TipSuccessModal'; +import {NDKEvent} from '@nostr-dev-kit/ndk'; +import {useAccount} from '@starknet-react/core'; +import {useProfile} from 'afk_nostr_sdk'; +import {forwardRef, useState} from 'react'; +import {Pressable, View} from 'react-native'; +import {CallData, uint256} from 'starknet'; + +import {Avatar, Button, Input, Modalize, Picker, Text} from '../../../components'; +import {ESCROW_ADDRESSES} from '../../../constants/contracts'; +import {CHAIN_ID} from '../../../constants/env'; +import {DEFAULT_TIMELOCK, Entrypoint} from '../../../constants/misc'; +import {TOKENS, TokenSymbol} from '../../../constants/tokens'; +import {useStyles, useWaitConnection} from '../../../hooks'; +import {useTransactionModal} from '../../../hooks/modals'; +import {useDialog} from '../../../hooks/modals/useDialog'; +import {useTransaction} from '../../../hooks/modals/useTransaction'; +import {useWalletModal} from '../../../hooks/modals/useWalletModal'; +import {TipSuccessModalProps} from '../../TipSuccessModal'; import stylesheet from './styles'; export type TipModalStarknet = Modalize; @@ -31,21 +30,21 @@ export type TipModalStarknetProps = { }; export const TipModalStarknet = forwardRef( - ({ event, hide: hideTipModal, showSuccess, hideSuccess }, ref) => { + ({event, hide: hideTipModal, showSuccess, hideSuccess}, ref) => { const styles = useStyles(stylesheet); const [token, setToken] = useState(TokenSymbol.ETH); const [amount, setAmount] = useState(''); - const { data: profile } = useProfile({ publicKey: event?.pubkey }); + const {data: profile} = useProfile({publicKey: event?.pubkey}); const account = useAccount(); const walletModal = useWalletModal(); const sendTransaction = useTransaction(); - const { hide: hideTransactionModal } = useTransactionModal(); + const {hide: hideTransactionModal} = useTransactionModal(); const waitConnection = useWaitConnection(); - const { showDialog, hideDialog } = useDialog(); + const {showDialog, hideDialog} = useDialog(); const isActive = !!amount && !!token; @@ -110,27 +109,19 @@ export const TipModalStarknet = forwardRef( showDialog({ title: 'Failed to send the tip', description, - buttons: [{ type: 'secondary', label: 'Close', onPress: () => hideDialog() }], + buttons: [{type: 'secondary', label: 'Close', onPress: () => hideDialog()}], }); } }; return ( + + Starknet tip - - - Starknet tip - - - - - Zap coming soon - - + Zap coming soon - diff --git a/apps/mobile/src/modules/TipModal/styles.ts b/apps/mobile/src/modules/TipModal/styles.ts index e0b3da01..88d43177 100644 --- a/apps/mobile/src/modules/TipModal/styles.ts +++ b/apps/mobile/src/modules/TipModal/styles.ts @@ -1,4 +1,4 @@ -import {Dimensions, Platform} from 'react-native'; +import {Platform} from 'react-native'; import {Spacing, ThemedStyleSheet} from '../../styles'; diff --git a/apps/mobile/src/modules/TipSuccessModal/index.tsx b/apps/mobile/src/modules/TipSuccessModal/index.tsx index afbf066f..f27736d5 100644 --- a/apps/mobile/src/modules/TipSuccessModal/index.tsx +++ b/apps/mobile/src/modules/TipSuccessModal/index.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { Image, View } from 'react-native'; +import {Image, View} from 'react-native'; -import { Button, Modal, Text } from '../../components'; -import { useStyles } from '../../hooks'; +import {Button, Modal, Text} from '../../components'; +import {useStyles} from '../../hooks'; import stylesheet from './styles'; export type TipSuccessModalProps = { @@ -10,10 +10,16 @@ export type TipSuccessModalProps = { symbol?: string; amount?: number; hide: () => void; - children?: React.ReactNode + children?: React.ReactNode; }; -export const TipSuccessModal: React.FC = ({ user, symbol, amount, hide, children }) => { +export const TipSuccessModal: React.FC = ({ + user, + symbol, + amount, + hide, + children, +}) => { const styles = useStyles(stylesheet); return ( @@ -30,11 +36,8 @@ export const TipSuccessModal: React.FC = ({ user, symbol, - - {children && - children - } - {amount && symbol && + {children && children} + {amount && symbol && ( <> = ({ user, symbol, {amount} {symbol} - } + )} Keep spreading love diff --git a/apps/mobile/src/modules/TipSuccessModal/styles.ts b/apps/mobile/src/modules/TipSuccessModal/styles.ts index 1cb7e1fb..2b9739a0 100644 --- a/apps/mobile/src/modules/TipSuccessModal/styles.ts +++ b/apps/mobile/src/modules/TipSuccessModal/styles.ts @@ -9,7 +9,7 @@ export default ThemedStyleSheet((theme) => ({ }, logo: { position: 'absolute', - top: -(LOGO_SIZE -50), + top: -(LOGO_SIZE - 50), left: '50%', width: LOGO_SIZE, height: LOGO_SIZE, diff --git a/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx b/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx index 6c5605f7..5860ebce 100644 --- a/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx +++ b/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx @@ -1,27 +1,24 @@ -import { NDKEvent } from '@nostr-dev-kit/ndk'; -import { useAccount } from '@starknet-react/core'; -import { useEffect, useState } from 'react'; +import {NDKEvent} from '@nostr-dev-kit/ndk'; +import {useAccount} from '@starknet-react/core'; +import {useProfile} from 'afk_nostr_sdk'; +import {useEffect, useState} from 'react'; import React from 'react'; -import { View } from 'react-native'; -import { CallData, constants } from 'starknet'; - -import { Button, Text } from '../../components'; -import { KEYS_ADDRESS } from '../../constants/contracts'; -import { TokenSymbol } from '../../constants/tokens'; -import { useStyles, useWaitConnection } from '../../hooks'; -import { useDataKeys } from '../../hooks/keys/useDataKeys'; -import { - useProfile, -} from "afk_nostr_sdk" -import { useInstantiateKeys } from '../../hooks/keys/useInstantiateKeys'; -import { useTransactionModal } from '../../hooks/modals'; -import { useDialog } from '../../hooks/modals/useDialog'; -import { useTransaction } from '../../hooks/modals/useTransaction'; -import { useWalletModal } from '../../hooks/modals/useWalletModal'; -import { KeysUser } from '../../types/keys'; -import { feltToAddress } from '../../utils/format'; -import { TipSuccessModalProps } from '../TipSuccessModal'; -import { KeyModalAction } from '.'; +import {View} from 'react-native'; +import {CallData, constants} from 'starknet'; + +import {Button, Text} from '../../components'; +import {KEYS_ADDRESS} from '../../constants/contracts'; +import {TokenSymbol} from '../../constants/tokens'; +import {useStyles, useWaitConnection} from '../../hooks'; +import {useDataKeys} from '../../hooks/keys/useDataKeys'; +import {useInstantiateKeys} from '../../hooks/keys/useInstantiateKeys'; +import {useTransactionModal} from '../../hooks/modals'; +import {useDialog} from '../../hooks/modals/useDialog'; +import {useTransaction} from '../../hooks/modals/useTransaction'; +import {useWalletModal} from '../../hooks/modals/useWalletModal'; +import {KeysUser} from '../../types/keys'; +import {TipSuccessModalProps} from '../TipSuccessModal'; +import {KeyModalAction} from '.'; import stylesheet from './styles'; export type FormInstantiateKeyProps = { @@ -47,7 +44,7 @@ export const FormInstantiateKey = ({ const [token, setToken] = useState(TokenSymbol.ETH); const [amount, setAmount] = useState(''); - const { data: profile } = useProfile({ publicKey: event?.pubkey }); + const {data: profile} = useProfile({publicKey: event?.pubkey}); const [myKey, setMyKey] = useState(); const [keySelected, setKeySelected] = useState(); const [isCanInstantiateKey, setCanInstantiateKey] = useState(false); @@ -55,11 +52,11 @@ export const FormInstantiateKey = ({ const account = useAccount(); const walletModal = useWalletModal(); const sendTransaction = useTransaction(); - const { hide: hideTransactionModal } = useTransactionModal(); + const {hide: hideTransactionModal} = useTransactionModal(); const waitConnection = useWaitConnection(); - const { handleInstantiateKeys } = useInstantiateKeys(); - const { getAllKeys, getKeyByAddress } = useDataKeys(); - const { showDialog, hideDialog } = useDialog(); + const {handleInstantiateKeys} = useInstantiateKeys(); + const {getAllKeys, getKeyByAddress} = useDataKeys(); + const {showDialog, hideDialog} = useDialog(); const isActive = !!amount && !!token; useEffect(() => { @@ -99,10 +96,9 @@ export const FormInstantiateKey = ({ }; if (!account || !account?.account) return; - const receipt = await sendTransaction({ calls: [ - call + call, // { // contractAddress: ESCROW_ADDRESSES[CHAIN_ID], // entrypoint: Entrypoint.DEPOSIT, @@ -127,9 +123,11 @@ export const FormInstantiateKey = ({ profile?.displayName ?? profile?.name ?? event?.pubkey, - children:(<> - Your key is instantiate! - ), + children: ( + <> + Your key is instantiate! + + ), hide: hideSuccess, }); } else { @@ -141,10 +139,9 @@ export const FormInstantiateKey = ({ showDialog({ title: 'Failed to send the tip', description, - buttons: [{ type: 'secondary', label: 'Close', onPress: () => hideDialog() }], + buttons: [{type: 'secondary', label: 'Close', onPress: () => hideDialog()}], }); } - }; return ( @@ -190,13 +187,10 @@ export const FormInstantiateKey = ({ Instantiate your key - - {account?.address && - Connect: {account?.address} - } + {account?.address && Connect: {account?.address}} {(myKey && BigInt(myKey?.owner) == BigInt(0)) || diff --git a/apps/mobile/src/modules/TokenCreatedModal/index.tsx b/apps/mobile/src/modules/TokenCreatedModal/index.tsx index 31b76689..4acd1cb2 100644 --- a/apps/mobile/src/modules/TokenCreatedModal/index.tsx +++ b/apps/mobile/src/modules/TokenCreatedModal/index.tsx @@ -1,22 +1,17 @@ import {NDKEvent} from '@nostr-dev-kit/ndk'; import {useAccount} from '@starknet-react/core'; -import {forwardRef, useEffect, useState} from 'react'; +import {useProfile} from 'afk_nostr_sdk'; +import {forwardRef, useState} from 'react'; import {Modalize, Text} from '../../components'; import {TokenSymbol} from '../../constants/tokens'; -import {useStyles, useWaitConnection} from '../../hooks'; -import {useProfile} from "afk_nostr_sdk" -import {useDataKeys} from '../../hooks/keys/useDataKeys'; -import {useInstantiateKeys} from '../../hooks/keys/useInstantiateKeys'; -import {useTransactionModal} from '../../hooks/modals'; +import {useStyles} from '../../hooks'; import {useDialog} from '../../hooks/modals/useDialog'; -import {useTransaction} from '../../hooks/modals/useTransaction'; import {useWalletModal} from '../../hooks/modals/useWalletModal'; import {KeysUser} from '../../types/keys'; +import {FormLaunchToken} from '../LaunchTokenPump/FormLaunchToken'; import {TipSuccessModalProps} from '../TipSuccessModal'; -import {FormInstantiateKey} from './FormInstantiateKey'; import stylesheet from './styles'; -import { FormLaunchToken } from '../LaunchTokenPump/FormLaunchToken'; export type KeyModal = Modalize; @@ -48,7 +43,6 @@ export const TokenCreateModal = forwardRef( const {showDialog, hideDialog} = useDialog(); const isActive = !!amount && !!token; - return ( ( align="center" style={styles.comment} > - Launch & pump the coins! + Launch & pump the coins! ); diff --git a/apps/mobile/src/modules/UserCard/Card/index.tsx b/apps/mobile/src/modules/UserCard/Card/index.tsx index 8f19d31c..1b53f4c7 100644 --- a/apps/mobile/src/modules/UserCard/Card/index.tsx +++ b/apps/mobile/src/modules/UserCard/Card/index.tsx @@ -1,6 +1,9 @@ import {NDKEvent} from '@nostr-dev-kit/ndk'; import {useNavigation} from '@react-navigation/native'; import {useQueryClient} from '@tanstack/react-query'; +// import {useAuth} from '../../../store/auth'; +import {useAuth} from 'afk_nostr_sdk'; +import {useProfile, useReact, useReactions, useReplyNotes} from 'afk_nostr_sdk/hooks'; import {useMemo, useState} from 'react'; import {Image, Pressable, View} from 'react-native'; import Animated, { @@ -14,23 +17,12 @@ import Animated, { import {CommentIcon, LikeFillIcon, LikeIcon, RepostIcon} from '../../../assets/icons'; import {Avatar, IconButton, Menu, Text} from '../../../components'; -import { - useStyles, - useTheme, -} from '../../../hooks'; +import {useStyles, useTheme} from '../../../hooks'; import {useTipModal} from '../../../hooks/modals'; -// import {useAuth} from '../../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; - import {MainStackNavigationProps} from '../../../types'; import {getImageRatio, shortenPubkey} from '../../../utils/helpers'; import {getElapsedTimeStringFull} from '../../../utils/timestamp'; import stylesheet from './styles'; -import {useProfile, - useReact, - useReactions, - useReplyNotes, -} from "afk_nostr_sdk/hooks" export type CardProps = { asComment?: boolean; @@ -131,9 +123,7 @@ export const Card: React.FC = ({asComment, event}) => { handleProfilePress(event?.pubkey)}> diff --git a/apps/mobile/src/screens/Auth/CreateAccount.tsx b/apps/mobile/src/screens/Auth/CreateAccount.tsx index a7ad4a09..55058134 100644 --- a/apps/mobile/src/screens/Auth/CreateAccount.tsx +++ b/apps/mobile/src/screens/Auth/CreateAccount.tsx @@ -1,4 +1,5 @@ import {NDKPrivateKeySigner} from '@nostr-dev-kit/ndk'; +import {useNostrContext} from 'afk_nostr_sdk'; import {canUseBiometricAuthentication} from 'expo-secure-store'; import {useState} from 'react'; import {Platform} from 'react-native'; @@ -11,7 +12,6 @@ import {Auth} from '../../modules/Auth'; import {AuthCreateAccountScreenProps} from '../../types'; import {generateRandomKeypair} from '../../utils/keypair'; import {storePassword, storePrivateKey, storePublicKey} from '../../utils/storage'; -import { useNostrContext } from 'afk_nostr_sdk'; export const CreateAccount: React.FC = ({navigation}) => { const {theme} = useTheme(); @@ -97,9 +97,7 @@ export const CreateAccount: React.FC = ({navigatio Import account - + ); }; diff --git a/apps/mobile/src/screens/Auth/ImportKeys.tsx b/apps/mobile/src/screens/Auth/ImportKeys.tsx index 1aa18921..e77bb896 100644 --- a/apps/mobile/src/screens/Auth/ImportKeys.tsx +++ b/apps/mobile/src/screens/Auth/ImportKeys.tsx @@ -91,9 +91,7 @@ export const ImportKeys: React.FC = ({navigation}) => Import Account - + ); }; diff --git a/apps/mobile/src/screens/Auth/Login.tsx b/apps/mobile/src/screens/Auth/Login.tsx index e5fc78d6..c955236d 100644 --- a/apps/mobile/src/screens/Auth/Login.tsx +++ b/apps/mobile/src/screens/Auth/Login.tsx @@ -1,3 +1,5 @@ +import {useNavigation} from '@react-navigation/native'; +import {useAuth, useNip07Extension} from 'afk_nostr_sdk'; import {canUseBiometricAuthentication} from 'expo-secure-store'; import {useEffect, useState} from 'react'; import {Platform} from 'react-native'; @@ -7,17 +9,13 @@ import {Button, Input, TextButton} from '../../components'; import {useTheme} from '../../hooks'; import {useDialog, useToast} from '../../hooks/modals'; import {Auth} from '../../modules/Auth'; -// import {useAuth} from '../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; - -import {AuthLoginScreenProps, MainStackNavigationProps, MainStackParams} from '../../types'; +import {AuthLoginScreenProps, MainStackNavigationProps} from '../../types'; import {getPublicKeyFromSecret} from '../../utils/keypair'; import { retrieveAndDecryptPrivateKey, retrievePassword, retrievePublicKey, } from '../../utils/storage'; -import { useNavigation } from '@react-navigation/native'; export const Login: React.FC = ({navigation}) => { const {theme} = useTheme(); @@ -27,8 +25,9 @@ export const Login: React.FC = ({navigation}) => { const {showToast} = useToast(); const {showDialog, hideDialog} = useDialog(); + const {getPublicKey} = useNip07Extension(); - const navigationMain = useNavigation() + const navigationMain = useNavigation(); useEffect(() => { (async () => { @@ -64,9 +63,8 @@ export const Login: React.FC = ({navigation}) => { setAuth(publicKey, privateKeyHex); - - if(publicKey && privateKeyHex ) { - navigationMain.navigate("Feed"); + if (publicKey && privateKeyHex) { + navigationMain.navigate('Feed'); } }; @@ -108,6 +106,25 @@ export const Login: React.FC = ({navigation}) => { }); }; + const handleExtensionConnect = () => { + showDialog({ + title: 'WARNING', + description: 'Used your Nostr extension.', + buttons: [ + { + type: 'primary', + label: 'Continue', + onPress: () => { + getPublicKey(); + // navigation.navigate('ImportKeys'); + // hideDialog(); + }, + }, + {type: 'default', label: 'Cancel', onPress: hideDialog}, + ], + }); + }; + return ( = ({navigation}) => { Create Account Import Account + Nostr extension ); }; diff --git a/apps/mobile/src/screens/Auth/SaveKeys.tsx b/apps/mobile/src/screens/Auth/SaveKeys.tsx index 91c0a667..f0de4751 100644 --- a/apps/mobile/src/screens/Auth/SaveKeys.tsx +++ b/apps/mobile/src/screens/Auth/SaveKeys.tsx @@ -1,3 +1,5 @@ +// import {useAuth} from '../../store/auth'; +import {useAuth} from 'afk_nostr_sdk'; import * as Clipboard from 'expo-clipboard'; import {TouchableOpacity, View} from 'react-native'; @@ -7,9 +9,6 @@ import {Button, Input, Text} from '../../components'; import {useStyles, useTheme} from '../../hooks'; import {useToast} from '../../hooks/modals'; import {Auth} from '../../modules/Auth'; -// import {useAuth} from '../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; - import {AuthSaveKeysScreenProps} from '../../types'; import stylesheet from './styles'; diff --git a/apps/mobile/src/screens/ChannelDetail/index.tsx b/apps/mobile/src/screens/ChannelDetail/index.tsx index 8eb7ff73..f3cb569c 100644 --- a/apps/mobile/src/screens/ChannelDetail/index.tsx +++ b/apps/mobile/src/screens/ChannelDetail/index.tsx @@ -1,6 +1,5 @@ import {View} from 'react-native'; -import {Header, IconButton} from '../../components'; import {useStyles} from '../../hooks'; import {ChannelDetailComponent} from '../../modules/ChannelDetailPage'; import {ChannelDetailScreenProps} from '../../types'; diff --git a/apps/mobile/src/screens/ChannelsFeed/ChannelsFeedComponent.tsx b/apps/mobile/src/screens/ChannelsFeed/ChannelsFeedComponent.tsx index 83d32571..59827d53 100644 --- a/apps/mobile/src/screens/ChannelsFeed/ChannelsFeedComponent.tsx +++ b/apps/mobile/src/screens/ChannelsFeed/ChannelsFeedComponent.tsx @@ -1,9 +1,9 @@ import {useNavigation} from '@react-navigation/native'; +import {useAllProfiles, useChannels, useRootNotes} from 'afk_nostr_sdk'; import {FlatList, RefreshControl, View} from 'react-native'; import {BubbleUser} from '../../components/BubbleUser'; import {useStyles, useTheme} from '../../hooks'; -import {useAllProfiles, useChannels, useRootNotes} from "afk_nostr_sdk" import {ChannelComponent} from '../../modules/ChannelCard'; import {MainStackNavigationProps} from '../../types'; import stylesheet from './styles'; diff --git a/apps/mobile/src/screens/ChannelsFeed/index.tsx b/apps/mobile/src/screens/ChannelsFeed/index.tsx index 3433f472..31de6c4f 100644 --- a/apps/mobile/src/screens/ChannelsFeed/index.tsx +++ b/apps/mobile/src/screens/ChannelsFeed/index.tsx @@ -1,7 +1,7 @@ import {Image, Pressable, View} from 'react-native'; import {AddPostIcon} from '../../assets/icons'; -import {Header, TextButton} from '../../components'; +import {TextButton} from '../../components'; import {useStyles, useTheme} from '../../hooks'; import {ChannelsFeedScreenProps} from '../../types'; import {ChannelsFeedComponent} from './ChannelsFeedComponent'; diff --git a/apps/mobile/src/screens/CreateChannel/FormCreateChannel/index.tsx b/apps/mobile/src/screens/CreateChannel/FormCreateChannel/index.tsx index 6d67e7e8..71138b78 100644 --- a/apps/mobile/src/screens/CreateChannel/FormCreateChannel/index.tsx +++ b/apps/mobile/src/screens/CreateChannel/FormCreateChannel/index.tsx @@ -1,26 +1,20 @@ -import { useQueryClient } from '@tanstack/react-query'; +import {useQueryClient} from '@tanstack/react-query'; +import {useCreateChannel, useProfile, useSettingsStore} from 'afk_nostr_sdk'; +// import { useAuth } from '../../../store/auth'; +import {useAuth} from 'afk_nostr_sdk'; +import {AFK_RELAYS} from 'afk_nostr_sdk/src/utils/relay'; import * as Clipboard from 'expo-clipboard'; import * as ImagePicker from 'expo-image-picker'; -import { Formik, FormikProps } from 'formik'; -import { useRef, useState } from 'react'; -import { ScrollView, TouchableOpacity, View } from 'react-native'; - -import { CopyIconStack } from '../../../assets/icons'; -import { Button, SquareInput, Text } from '../../../components'; -import { useStyles, useTheme } from '../../../hooks'; -import { useFileUpload } from '../../../hooks/api'; -import { useToast } from '../../../hooks/modals'; -import { - useCreateChannel, - useProfile, - useSettingsStore -} from "afk_nostr_sdk" -// import { useAuth } from '../../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; - -import { ChannelHead } from '../Head'; +import {Formik, FormikProps} from 'formik'; +import {useRef, useState} from 'react'; +import {ScrollView, View} from 'react-native'; + +import {Button, SquareInput, Text} from '../../../components'; +import {useStyles, useTheme} from '../../../hooks'; +import {useFileUpload} from '../../../hooks/api'; +import {useToast} from '../../../hooks/modals'; +import {ChannelHead} from '../Head'; import stylesheet from './styles'; -import { AFK_RELAYS } from 'afk_nostr_sdk/src/utils/relay'; const UsernameInputLeft = ( @@ -41,35 +35,35 @@ type FormValues = { tags: string[][]; picture?: string; relays: string[]; - }; - interface IFormCreateChannel { showBackButton?: boolean; } -export const FormCreateChannel: React.FC = ({ showBackButton }: IFormCreateChannel) => { +export const FormCreateChannel: React.FC = ({ + showBackButton, +}: IFormCreateChannel) => { const formikRef = useRef>(null); - const { theme } = useTheme(); + const {theme} = useTheme(); const styles = useStyles(stylesheet); const [profilePhoto, setProfilePhoto] = useState(); const [coverPhoto, setCoverPhoto] = useState(); const publicKey = useAuth((state) => state.publicKey); - const profile = useProfile({ publicKey }); + const profile = useProfile({publicKey}); const fileUpload = useFileUpload(); const createChannel = useCreateChannel(); const queryClient = useQueryClient(); - const { showToast } = useToast(); - const {relays } = useSettingsStore() + const {showToast} = useToast(); + const {relays} = useSettingsStore(); if (profile.isLoading) return null; const onPublicKeyCopyPress = async () => { await Clipboard.setStringAsync(publicKey); - showToast({ type: 'info', title: 'Public Key Copied to clipboard' }); + showToast({type: 'info', title: 'Public Key Copied to clipboard'}); }; const handlePhotoSelect = async (type: 'profile' | 'cover') => { @@ -124,7 +118,7 @@ export const FormCreateChannel: React.FC = ({ showBackButton }; const onFormSubmit = async (values: FormValues) => { - let { image, banner } = values; + let {image, banner} = values; try { if (profilePhoto) { @@ -159,9 +153,9 @@ export const FormCreateChannel: React.FC = ({ showBackButton // queryClient.invalidateQueries({queryKey: ['profile', publicKey]}); - showToast({ type: 'success', title: 'Channel created successfully' }); + showToast({type: 'success', title: 'Channel created successfully'}); } catch (error) { - showToast({ type: 'error', title: 'Failed to create Channel' }); + showToast({type: 'error', title: 'Failed to create Channel'}); } }; @@ -171,12 +165,12 @@ export const FormCreateChannel: React.FC = ({ showBackButton onProfilePhotoUpload={onProfilePhotoUpload} onCoverPhotoUpload={onCoverPhotoUpload} profilePhoto={ - (profilePhoto?.uri ? { uri: profilePhoto.uri } : undefined) || - (profile.data?.image ? { uri: profile.data?.image } : undefined) + (profilePhoto?.uri ? {uri: profilePhoto.uri} : undefined) || + (profile.data?.image ? {uri: profile.data?.image} : undefined) } coverPhoto={ - (coverPhoto?.uri ? { uri: coverPhoto.uri } : undefined) || - (profile.data?.banner ? { uri: profile.data?.banner } : undefined) + (coverPhoto?.uri ? {uri: coverPhoto.uri} : undefined) || + (profile.data?.banner ? {uri: profile.data?.banner} : undefined) } buttons={ - } + )} = ({ isButton ItemSeparatorComponent={() => } // keyExtractor={(item, i) => {`${item.owner + item?.created_at}`}} keyExtractor={(item, i) => i.toString()} - numColumns={isDesktop ? 3 : 1} - - renderItem={({ item }) => { + numColumns={isDesktop ? 3 : 1} + renderItem={({item}) => { // console.log("key item", item) return ( <> @@ -59,12 +61,12 @@ export const AllKeysComponent: React.FC = ({ isButton */} - ); }} - refreshControl={} - // onEndReached={() => queryDataKeys.fetchNextPage()} - + refreshControl={ + + } + // onEndReached={() => queryDataKeys.fetchNextPage()} /> {/* = () => { const {theme} = useTheme(); @@ -33,7 +32,6 @@ export const KeysMarketplace: React.FC = () => { const {showToast} = useToast(); const navigation = useNavigation(); - const [selectedTab, setSelectedTab] = useState(SelectedTab.TIPS); const handleTabSelected = (tab: string | SelectedTab, screen?: string) => { setSelectedTab(tab as any); @@ -46,7 +44,10 @@ export const KeysMarketplace: React.FC = () => { {/*
*/} Key pass for Starknet user - Buy or sell the keys of content creator to get perks and rewards from them. + + {' '} + Buy or sell the keys of content creator to get perks and rewards from them. + {/* {selectedTab == SelectedTab.TIPS ? ( diff --git a/apps/mobile/src/screens/KeysMarketplace/styles.ts b/apps/mobile/src/screens/KeysMarketplace/styles.ts index 7dbb46e2..5e751ecb 100644 --- a/apps/mobile/src/screens/KeysMarketplace/styles.ts +++ b/apps/mobile/src/screens/KeysMarketplace/styles.ts @@ -5,13 +5,13 @@ export default ThemedStyleSheet((theme) => ({ position: 'relative', flex: 1, backgroundColor: theme.colors.background, - color:theme.colors.text, + color: theme.colors.text, }, flatListContent: { paddingHorizontal: Spacing.pagePadding, paddingVertical: Spacing.medium, - gap:3 + gap: 3, }, separator: { @@ -47,8 +47,8 @@ export default ThemedStyleSheet((theme) => ({ text: { color: theme.colors.text, - fontSize:12, - backgroundColor:theme.colors.background + fontSize: 12, + backgroundColor: theme.colors.background, }, buttonIndicator: { diff --git a/apps/mobile/src/screens/LaunchDetail/index.tsx b/apps/mobile/src/screens/LaunchDetail/index.tsx index 365bb67f..0658a091 100644 --- a/apps/mobile/src/screens/LaunchDetail/index.tsx +++ b/apps/mobile/src/screens/LaunchDetail/index.tsx @@ -1,52 +1,28 @@ -import { useAccount, useProvider } from '@starknet-react/core'; -import { useEffect, useState } from 'react'; -import { View, Text } from 'react-native'; -import { useStyles, useTheme, useTips, useWaitConnection } from '../../hooks'; -import { useToast, useTransaction, useTransactionModal, useWalletModal } from '../../hooks/modals'; -import { LaunchDetailScreenProps, MainStackNavigationProps } from '../../types'; +import {useAccount, useProvider} from '@starknet-react/core'; +import {useNostrContext} from 'afk_nostr_sdk'; +import {useEffect, useState} from 'react'; +import {Text, View} from 'react-native'; + +import {TokenLaunchDetail} from '../../components/TokenLaunchDetail'; +import {useStyles, useTheme} from '../../hooks'; +import {useDataCoins} from '../../hooks/launchpad/useDataCoins'; +import {LaunchDetailScreenProps} from '../../types'; +import {TokenLaunchInterface} from '../../types/keys'; +import {SelectedTab} from '../../types/tab'; import stylesheet from './styles'; -import { useNostrContext } from 'afk_nostr_sdk'; -import { SelectedTab } from '../../types/tab'; -import { useDataCoins } from '../../hooks/launchpad/useDataCoins'; -import { TokenLaunchInterface } from '../../types/keys'; -import { TokenLaunchDetail } from '../../components/TokenLaunchDetail'; -export const LaunchDetail: React.FC = ({ navigation, route, }) => { +export const LaunchDetail: React.FC = ({navigation, route}) => { // export const LaunchDetails: React.FC = () => { - - const { coinAddress, launch: launchParams } = route.params - - if (!coinAddress) { - return <> - - No coin address found - - } - - const { theme } = useTheme(); + const {theme} = useTheme(); const styles = useStyles(stylesheet); const [loading, setLoading] = useState(false); - const { ndk } = useNostrContext(); - const { provider } = useProvider(); + const {ndk} = useNostrContext(); + const {provider} = useProvider(); const account = useAccount(); - const [launch, setLaunch] = useState(launchParams) - - const { getCoinLaunchByAddress } = useDataCoins(); - const [firstLoadDone, setFirstLoadDone] = useState(false) - - useEffect(() => { - const getData = async () => { - const launchData = await getCoinLaunchByAddress(coinAddress) - console.log("launchData", launchData) - setLaunch(launchData) - setFirstLoadDone(true) - } - - if (coinAddress && !launch) { - getData() - - } - }, [coinAddress]) + const {coinAddress, launch: launchParams} = route.params; + const [launch, setLaunch] = useState(launchParams); + const {getCoinLaunchByAddress} = useDataCoins(); + const [firstLoadDone, setFirstLoadDone] = useState(false); // const navigation = useNavigation(); const [selectedTab, setSelectedTab] = useState(SelectedTab.TIPS); @@ -57,26 +33,54 @@ export const LaunchDetail: React.FC = ({ navigation, ro } }; + useEffect(() => { + const getData = async () => { + const launchData = await getCoinLaunchByAddress(coinAddress); + console.log('launchData', launchData); + setLaunch(launchData); + setFirstLoadDone(true); + }; + + if (coinAddress && !launch) { + getData(); + } + }, [coinAddress]); + + if (!coinAddress) { + return ( + <> + + No coin address found + + + ); + } + return ( {/*
*/} Launchpad to Pump it LFG - {launch && + {launch && ( - - } + )} Coming soon - - Overview - - Graph - Holders - TX + + + Overview + + + Graph + + + Holders + + + TX + ); diff --git a/apps/mobile/src/screens/LaunchDetail/styles.ts b/apps/mobile/src/screens/LaunchDetail/styles.ts index 96ab1019..a8fdd128 100644 --- a/apps/mobile/src/screens/LaunchDetail/styles.ts +++ b/apps/mobile/src/screens/LaunchDetail/styles.ts @@ -5,7 +5,7 @@ export default ThemedStyleSheet((theme) => ({ position: 'relative', flex: 1, backgroundColor: theme.colors.background, - color:theme.colors.text, + color: theme.colors.text, }, flatListContent: { @@ -46,7 +46,7 @@ export default ThemedStyleSheet((theme) => ({ text: { color: theme.colors.text, - fontSize:12, + fontSize: 12, }, buttonIndicator: { diff --git a/apps/mobile/src/screens/LaunchToken/FormCreateChannel/index.tsx b/apps/mobile/src/screens/LaunchToken/FormCreateChannel/index.tsx index ebaf0051..4a6fe7a9 100644 --- a/apps/mobile/src/screens/LaunchToken/FormCreateChannel/index.tsx +++ b/apps/mobile/src/screens/LaunchToken/FormCreateChannel/index.tsx @@ -1,21 +1,21 @@ -import { useQueryClient } from '@tanstack/react-query'; +import {useQueryClient} from '@tanstack/react-query'; +import {useCreateChannel, useProfile, useSettingsStore} from 'afk_nostr_sdk'; +// import { useAuth } from '../../../store/auth'; +import {useAuth} from 'afk_nostr_sdk'; +import {AFK_RELAYS} from 'afk_nostr_sdk/src/utils/relay'; import * as Clipboard from 'expo-clipboard'; import * as ImagePicker from 'expo-image-picker'; -import { Formik, FormikProps } from 'formik'; -import { useRef, useState } from 'react'; -import { ScrollView, TouchableOpacity, View } from 'react-native'; - -import { CopyIconStack } from '../../../assets/icons'; -import { Button, SquareInput, Text } from '../../../components'; -import { useStyles, useTheme } from '../../../hooks'; -import { useCreateChannel, useProfile, useSettingsStore } from 'afk_nostr_sdk'; -import { useFileUpload } from '../../../hooks/api'; -import { useToast } from '../../../hooks/modals'; -// import { useAuth } from '../../../store/auth'; -import { useAuth } from 'afk_nostr_sdk'; -import { ChannelHead } from '../Head'; +import {Formik, FormikProps} from 'formik'; +import {useRef, useState} from 'react'; +import {ScrollView, TouchableOpacity, View} from 'react-native'; + +import {CopyIconStack} from '../../../assets/icons'; +import {Button, SquareInput, Text} from '../../../components'; +import {useStyles, useTheme} from '../../../hooks'; +import {useFileUpload} from '../../../hooks/api'; +import {useToast} from '../../../hooks/modals'; +import {ChannelHead} from '../Head'; import stylesheet from './styles'; -import { AFK_RELAYS } from 'afk_nostr_sdk/src/utils/relay'; const UsernameInputLeft = ( @@ -41,25 +41,25 @@ type FormValues = { export const FormCreateChannel: React.FC = () => { const formikRef = useRef>(null); - const { theme } = useTheme(); + const {theme} = useTheme(); const styles = useStyles(stylesheet); const [profilePhoto, setProfilePhoto] = useState(); const [coverPhoto, setCoverPhoto] = useState(); const publicKey = useAuth((state) => state.publicKey); - const profile = useProfile({ publicKey }); + const profile = useProfile({publicKey}); const fileUpload = useFileUpload(); const createChannel = useCreateChannel(); const queryClient = useQueryClient(); - const { showToast } = useToast(); - const {relays } = useSettingsStore() + const {showToast} = useToast(); + const {relays} = useSettingsStore(); if (profile.isLoading) return null; const onPublicKeyCopyPress = async () => { await Clipboard.setStringAsync(publicKey); - showToast({ type: 'info', title: 'Public Key Copied to clipboard' }); + showToast({type: 'info', title: 'Public Key Copied to clipboard'}); }; const handlePhotoSelect = async (type: 'profile' | 'cover') => { @@ -114,7 +114,7 @@ export const FormCreateChannel: React.FC = () => { }; const onFormSubmit = async (values: FormValues) => { - let { image, banner } = values; + let {image, banner} = values; try { if (profilePhoto) { @@ -150,9 +150,9 @@ export const FormCreateChannel: React.FC = () => { // queryClient.invalidateQueries({queryKey: ['profile', publicKey]}); - showToast({ type: 'success', title: 'Channel created successfully' }); + showToast({type: 'success', title: 'Channel created successfully'}); } catch (error) { - showToast({ type: 'error', title: 'Failed to create Channel' }); + showToast({type: 'error', title: 'Failed to create Channel'}); } }; @@ -163,12 +163,12 @@ export const FormCreateChannel: React.FC = () => { onProfilePhotoUpload={onProfilePhotoUpload} onCoverPhotoUpload={onCoverPhotoUpload} profilePhoto={ - (profilePhoto?.uri ? { uri: profilePhoto.uri } : undefined) || - (profile.data?.image ? { uri: profile.data?.image } : undefined) + (profilePhoto?.uri ? {uri: profilePhoto.uri} : undefined) || + (profile.data?.image ? {uri: profile.data?.image} : undefined) } coverPhoto={ - (coverPhoto?.uri ? { uri: coverPhoto.uri } : undefined) || - (profile.data?.banner ? { uri: profile.data?.banner } : undefined) + (coverPhoto?.uri ? {uri: coverPhoto.uri} : undefined) || + (profile.data?.banner ? {uri: profile.data?.banner} : undefined) } buttons={ - } - {menuOpen && - - } + )} + {menuOpen && } = ({ isButt // keyExtractor={(item, i) => {`${item.owner + item?.created_at}`}} keyExtractor={(item, i) => i.toString()} numColumns={isDesktop ? 3 : 1} - renderItem={({ item, index }) => { + renderItem={({item, index}) => { // console.log("key item", item) - return ( - - ); + return ; }} - refreshControl={} - // onEndReached={() => queryDataLaunch.fetchNextPage()} - + refreshControl={ + + } + // onEndReached={() => queryDataLaunch.fetchNextPage()} /> {/* = () => { const {theme} = useTheme(); @@ -26,7 +25,6 @@ export const LaunchpadScreen: React.FC = () => { const {showToast} = useToast(); const navigation = useNavigation(); - const [selectedTab, setSelectedTab] = useState(SelectedTab.TIPS); const handleTabSelected = (tab: string | SelectedTab, screen?: string) => { setSelectedTab(tab as any); @@ -39,7 +37,10 @@ export const LaunchpadScreen: React.FC = () => { {/*
*/} Launchpad to Pump it - Buy or sell a memecoin of content creator/community + + {' '} + Buy or sell a memecoin of content creator/community + {/* {selectedTab == SelectedTab.TIPS ? ( diff --git a/apps/mobile/src/screens/Launchpad/styles.ts b/apps/mobile/src/screens/Launchpad/styles.ts index 195feedc..07bed6f6 100644 --- a/apps/mobile/src/screens/Launchpad/styles.ts +++ b/apps/mobile/src/screens/Launchpad/styles.ts @@ -5,7 +5,7 @@ export default ThemedStyleSheet((theme) => ({ position: 'relative', flex: 1, backgroundColor: theme.colors.background, - color:theme.colors.text, + color: theme.colors.text, }, flatListContent: { @@ -46,8 +46,8 @@ export default ThemedStyleSheet((theme) => ({ text: { color: theme.colors.text, - fontSize:12, - backgroundColor:theme.colors.background + fontSize: 12, + backgroundColor: theme.colors.background, }, buttonIndicator: { diff --git a/apps/mobile/src/screens/PostDetail/index.tsx b/apps/mobile/src/screens/PostDetail/index.tsx index 497dcf67..8db9c776 100644 --- a/apps/mobile/src/screens/PostDetail/index.tsx +++ b/apps/mobile/src/screens/PostDetail/index.tsx @@ -1,40 +1,40 @@ -import { useQueryClient } from '@tanstack/react-query'; -import { useState } from 'react'; -import { FlatList, RefreshControl, View } from 'react-native'; +import {useQueryClient} from '@tanstack/react-query'; +import {useNote, useReplyNotes, useSendNote} from 'afk_nostr_sdk'; +import {useState} from 'react'; +import {FlatList, RefreshControl, View} from 'react-native'; -import { Divider, Header, IconButton, Input, KeyboardFixedView } from '../../components'; -import { useStyles } from '../../hooks'; -import { useToast } from '../../hooks/modals'; -import { Post } from '../../modules/Post'; -import { PostDetailScreenProps } from '../../types'; +import {Divider, IconButton, Input, KeyboardFixedView} from '../../components'; +import {useStyles} from '../../hooks'; +import {useToast} from '../../hooks/modals'; +import {Post} from '../../modules/Post'; +import {PostDetailScreenProps} from '../../types'; import stylesheet from './styles'; -import { useNote, useReplyNotes, useSendNote, } from 'afk_nostr_sdk'; -export const PostDetail: React.FC = ({ navigation, route }) => { - const { postId, post } = route.params; +export const PostDetail: React.FC = ({navigation, route}) => { + const {postId, post} = route.params; const styles = useStyles(stylesheet); const [comment, setComment] = useState(''); const sendNote = useSendNote(); - const { data: note = post } = useNote({ noteId: postId }); - const comments = useReplyNotes({ noteId: note?.id }); + const {data: note = post} = useNote({noteId: postId}); + const comments = useReplyNotes({noteId: note?.id}); const queryClient = useQueryClient(); - const { showToast } = useToast(); + const {showToast} = useToast(); const handleSendComment = async () => { if (!comment || comment?.trim().length == 0) { - showToast({ type: 'error', title: 'Please write your comment' }); + showToast({type: 'error', title: 'Please write your comment'}); return; } sendNote.mutate( - { content: comment, tags: [['e', note?.id ?? '', '', 'root', note?.pubkey ?? '']] }, + {content: comment, tags: [['e', note?.id ?? '', '', 'root', note?.pubkey ?? '']]}, { onSuccess() { - showToast({ type: 'success', title: 'Comment sent successfully' }); - queryClient.invalidateQueries({ queryKey: ['replyNotes', note?.id] }); + showToast({type: 'success', title: 'Comment sent successfully'}); + queryClient.invalidateQueries({queryKey: ['replyNotes', note?.id]}); setComment(''); }, onError() { @@ -73,7 +73,7 @@ export const PostDetail: React.FC = ({ navigation, route } ItemSeparatorComponent={() => } - renderItem={({ item }) => ( + renderItem={({item}) => ( @@ -85,7 +85,7 @@ export const PostDetail: React.FC = ({ navigation, route /> - + diff --git a/apps/mobile/src/screens/Profile/Head/index.tsx b/apps/mobile/src/screens/Profile/Head/index.tsx index 42d93d87..1fe55bef 100644 --- a/apps/mobile/src/screens/Profile/Head/index.tsx +++ b/apps/mobile/src/screens/Profile/Head/index.tsx @@ -1,13 +1,13 @@ -import { useNavigation } from '@react-navigation/native'; -import { useState } from 'react'; -import { Image, ImageSourcePropType, Pressable, View } from 'react-native'; -import { SafeAreaView } from 'react-native-safe-area-context'; +import {useNavigation} from '@react-navigation/native'; +import {useState} from 'react'; +import {Image, ImageSourcePropType, Pressable, View} from 'react-native'; +import {SafeAreaView} from 'react-native-safe-area-context'; -import { SettingsIcon, UploadIcon } from '../../../assets/icons'; -import { Avatar, IconButton, Menu, Text } from '../../../components'; -import { useStyles, useTheme } from '../../../hooks'; -import stylesheet, { AVATAR_SIZE } from './styles'; -import { MainStackNavigationProps } from '../../../types'; +import {UploadIcon} from '../../../assets/icons'; +import {Avatar, IconButton} from '../../../components'; +import {useStyles, useTheme} from '../../../hooks'; +import {MainStackNavigationProps} from '../../../types'; +import stylesheet, {AVATAR_SIZE} from './styles'; export type ProfileHeadProps = { profilePhoto?: ImageSourcePropType; @@ -28,7 +28,7 @@ export const ProfileHead: React.FC = ({ showSettingsButton, buttons, }) => { - const { theme, toggleTheme } = useTheme(); + const {theme, toggleTheme} = useTheme(); const styles = useStyles(stylesheet); const navigation = useNavigation(); @@ -61,7 +61,6 @@ export const ProfileHead: React.FC = ({ /> )} - {/* {showSettingsButton && ( = ({publicKey: userPublicKe showToast({type: 'info', title: 'Public key copied to the clipboard'}); }; const handleSettings = () => { - navigation.navigate("Settings") - } + navigation.navigate('Settings'); + }; return ( = ({publicKey: userPublicKe + icon="SettingsIcon" + size={20} + // style={styles.backButton} + onPress={handleSettings} + /> = ({ route }) => { - const { publicKey } = route.params ?? {}; +export const Profile: React.FC = ({route}) => { + const {publicKey} = route.params ?? {}; const styles = useStyles(stylesheet); - const notes = useRootNotes({ authors: [publicKey] }); + const notes = useRootNotes({authors: [publicKey]}); return ( @@ -20,7 +20,7 @@ export const Profile: React.FC = ({ route }) => { ListHeaderComponent={} data={notes.data?.pages.flat()} keyExtractor={(item) => item.id} - renderItem={({ item }) => } + renderItem={({item}) => } refreshControl={ notes.refetch()} /> } diff --git a/apps/mobile/src/screens/Search/index.tsx b/apps/mobile/src/screens/Search/index.tsx index e7262064..0aec068d 100644 --- a/apps/mobile/src/screens/Search/index.tsx +++ b/apps/mobile/src/screens/Search/index.tsx @@ -1,9 +1,9 @@ import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; +import {useAllProfiles, useSearchNotes} from 'afk_nostr_sdk'; import {useState} from 'react'; import {FlatList, Image, Pressable, RefreshControl, ScrollView, View} from 'react-native'; import {AddPostIcon} from '../../assets/icons'; -import {Header} from '../../components'; import {BubbleUser} from '../../components/BubbleUser'; import SearchComponent from '../../components/search'; import {useStyles, useTheme} from '../../hooks'; @@ -12,7 +12,6 @@ import {PostCard} from '../../modules/PostCard'; import {SearchScreenProps} from '../../types'; import {SelectedTab} from '../../types/tab'; import stylesheet from './styles'; -import { useSearchNotes , useAllProfiles} from 'afk_nostr_sdk' export const Search: React.FC = ({navigation}) => { const {theme} = useTheme(); @@ -81,7 +80,7 @@ export const Search: React.FC = ({navigation}) => { horizontal showsHorizontalScrollIndicator={false} > - {profilesSearch.map((item: NDKEvent, i:number) => { + {profilesSearch.map((item: NDKEvent, i: number) => { console.log('item profile', item); console.log('search', search); if (search && search?.length > 0 && item?.content?.includes(search)) { diff --git a/apps/mobile/src/screens/Settings/index.tsx b/apps/mobile/src/screens/Settings/index.tsx index e650ad2d..051d8db6 100644 --- a/apps/mobile/src/screens/Settings/index.tsx +++ b/apps/mobile/src/screens/Settings/index.tsx @@ -1,35 +1,35 @@ -import { useQueryClient } from '@tanstack/react-query'; -import { useState } from 'react'; -import { View, Text, Pressable } from 'react-native'; +import { useAuth, useSettingsStore } from 'afk_nostr_sdk'; +import { Text, View } from 'react-native'; +import { ScrollView } from 'react-native-gesture-handler'; import { SafeAreaView } from 'react-native-safe-area-context'; -import { Button, Divider, Header, Icon, IconButton, Input, KeyboardFixedView } from '../../components'; +import { Button, Divider, Icon, IconButton } from '../../components'; +import { HeaderScreen } from '../../components/HeaderScreen'; +import { PrivateKeyImport } from '../../components/PrivateKeyImport'; import { useStyles, useTheme } from '../../hooks'; import { useToast } from '../../hooks/modals'; import { SettingsScreenProps } from '../../types'; import stylesheet from './styles'; -import { HeaderScreen } from '../../components/HeaderScreen'; -import { useAuth, useSettingsStore } from 'afk_nostr_sdk'; -import { AFK_RELAYS } from 'afk_nostr_sdk/src/utils/relay'; +import { RelaysConfig } from '../../components/RelaysConfig'; export const Settings: React.FC = ({ navigation }) => { const styles = useStyles(stylesheet); - const { showToast } = useToast(); const { theme, toggleTheme } = useTheme(); - const { relays, setRelays } = useSettingsStore() - const { publicKey } = useAuth() - // const RELAYS_USED = relays ?? AFK_RELAYS - const RELAYS_USED = relays + const { publicKey, isExtension } = useAuth(); return ( { - navigation.navigate("Profile", { publicKey }) - // navigation.goBack - } - } />} + left={ + { + navigation.navigate('Profile', { publicKey }); + // navigation.goBack + }} + /> + } // right={} title="Settings" /> @@ -47,52 +47,25 @@ export const Settings: React.FC = ({ navigation }) => { - - - - - { - navigation.navigate("Profile", { publicKey }) - }} - /> - - - - - - - - AFK: All relays used - - {RELAYS_USED?.map((r, i) => { - return ( - - Relay: {r} - - ) - })} - + {!isExtension && } + + ); }; diff --git a/apps/mobile/src/screens/Settings/styles.ts b/apps/mobile/src/screens/Settings/styles.ts index 07e75fb6..3857716d 100644 --- a/apps/mobile/src/screens/Settings/styles.ts +++ b/apps/mobile/src/screens/Settings/styles.ts @@ -4,50 +4,29 @@ export default ThemedStyleSheet((theme) => ({ container: { flex: 1, backgroundColor: theme.colors.background, - padding:Spacing.pagePadding, + padding: Spacing.pagePadding, color: theme.colors.text, - + gap:3 }, content: { flex: 1, color: theme.colors.text, - padding:Spacing.medium, - + padding: Spacing.medium, }, - relaysSettings: { - flex: 1, - color: theme.colors.text, - backgroundColor: theme.colors.surface, - borderRadius:10, - padding:Spacing.medium, - height:"100%" - - }, - coverButtons: { - // position: 'relative', - width: '100%', - height: '100%', - }, backButton: { position: 'absolute', top: Spacing.pagePadding, left: Spacing.pagePadding, }, - themeButton: { - // flex: 1, - // flexDirection: 'row', - justifyContent: 'flex-end', - alignItems: 'center', - justifyItems:"baseline" - }, - title:{ + + title: { color: theme.colors.text, - fontSize:24, - marginBottom:4 + fontSize: 24, + marginBottom: 4, }, - text:{ + text: { color: theme.colors.text, }, buttons: { diff --git a/apps/mobile/src/screens/Slink/SlinksMap.tsx b/apps/mobile/src/screens/Slink/SlinksMap.tsx index f9086c80..fee27ace 100644 --- a/apps/mobile/src/screens/Slink/SlinksMap.tsx +++ b/apps/mobile/src/screens/Slink/SlinksMap.tsx @@ -1,27 +1,27 @@ -import { KeyboardAvoidingView, FlatList } from 'react-native'; -import { SafeAreaView } from 'react-native-safe-area-context'; -import { Divider } from '../../components'; -import { useStyles, useTheme } from '../../hooks'; -import stylesheet from './styles'; +import {FlatList, KeyboardAvoidingView} from 'react-native'; +import {SafeAreaView} from 'react-native-safe-area-context'; + +import {Divider} from '../../components'; import EmbedCard from '../../components/Embed'; +import {useStyles, useTheme} from '../../hooks'; +import stylesheet from './styles'; export const ECOSYSTEM_INTEGRATION = { raize: { - title:"Raize", - uri: "https://www.raize.club", - twitter: "", - description:"Prediction Market" + title: 'Raize', + uri: 'https://www.raize.club', + twitter: '', + description: 'Prediction Market', }, ekubo: { - uri: "https://app.ekubo.org/", - title:"Ekubo", - twitter: "", - description:"DEX on Starknet" - + uri: 'https://app.ekubo.org/', + title: 'Ekubo', + twitter: '', + description: 'DEX on Starknet', }, -} +}; export const SlinksMap: React.FC = () => { - const theme = useTheme() + const theme = useTheme(); const styles = useStyles(stylesheet); return ( @@ -32,20 +32,18 @@ export const SlinksMap: React.FC = () => { showsHorizontalScrollIndicator={false} // data={stories} ItemSeparatorComponent={() => } - renderItem={({ item }) => { + renderItem={({item}) => { // console.log("item", item) return ( - - - ) + description={item?.description} + > + ); }} /> - ); diff --git a/apps/mobile/src/screens/Slink/index.tsx b/apps/mobile/src/screens/Slink/index.tsx index 4e654b52..25cb512c 100644 --- a/apps/mobile/src/screens/Slink/index.tsx +++ b/apps/mobile/src/screens/Slink/index.tsx @@ -1,18 +1,21 @@ -import { useState } from 'react'; -import { KeyboardAvoidingView, View, Text } from 'react-native'; -import { SafeAreaView } from 'react-native-safe-area-context'; -import { TextButton } from '../../components'; +import {useState} from 'react'; +import {KeyboardAvoidingView, View} from 'react-native'; +import {SafeAreaView} from 'react-native-safe-area-context'; + +import {TextButton} from '../../components'; import TabSelector from '../../components/TabSelector'; -import { useStyles, useTheme } from '../../hooks'; -import { GameSreenProps } from '../../types'; -import { SelectedTab, TABS_MENU } from '../../types/tab'; +import {useStyles, useTheme} from '../../hooks'; +import {GameSreenProps} from '../../types'; +import {SelectedTab, TABS_MENU} from '../../types/tab'; +import {SlinksMap} from './SlinksMap'; import stylesheet from './styles'; -import { SlinksMap } from './SlinksMap'; -export const Slink: React.FC = ({ navigation }) => { - const theme = useTheme() +export const Slink: React.FC = ({navigation}) => { + const theme = useTheme(); const styles = useStyles(stylesheet); - const [selectedTab, setSelectedTab] = useState(SelectedTab.VIEW_KEYS_MARKETPLACE); + const [selectedTab, setSelectedTab] = useState( + SelectedTab.VIEW_KEYS_MARKETPLACE, + ); const handleTabSelected = (tab: string | SelectedTab, screen?: string) => { setSelectedTab(tab as any); if (screen) { diff --git a/apps/mobile/src/screens/Slink/styles.ts b/apps/mobile/src/screens/Slink/styles.ts index 20033b80..2071a1fd 100644 --- a/apps/mobile/src/screens/Slink/styles.ts +++ b/apps/mobile/src/screens/Slink/styles.ts @@ -5,8 +5,8 @@ import {Spacing, ThemedStyleSheet, Typography} from '../../styles'; export default ThemedStyleSheet((theme) => ({ container: { flex: 1, - color:theme.colors.text, - padding:3, + color: theme.colors.text, + padding: 3, }, header: { flexDirection: 'row', @@ -62,7 +62,7 @@ export default ThemedStyleSheet((theme) => ({ right: Spacing.pagePadding, bottom: '110%', }, - text:{ + text: { color: theme.colors.text, - } + }, })); diff --git a/apps/mobile/src/screens/Tips/TipsComponent.tsx b/apps/mobile/src/screens/Tips/TipsComponent.tsx index 1647c7b5..b56d67a5 100644 --- a/apps/mobile/src/screens/Tips/TipsComponent.tsx +++ b/apps/mobile/src/screens/Tips/TipsComponent.tsx @@ -2,6 +2,8 @@ import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; import {useNavigation} from '@react-navigation/native'; import {useAccount, useProvider} from '@starknet-react/core'; import {Fraction} from '@uniswap/sdk-core'; +// import {useNostrContext} from '../../context/NostrContext'; +import {useNostrContext} from 'afk_nostr_sdk'; import {useState} from 'react'; import {ActivityIndicator, FlatList, RefreshControl, View} from 'react-native'; import {byteArray, cairo, CallData, getChecksumAddress, uint256} from 'starknet'; @@ -11,8 +13,6 @@ import {ESCROW_ADDRESSES} from '../../constants/contracts'; import {CHAIN_ID} from '../../constants/env'; import {Entrypoint} from '../../constants/misc'; import {ETH, STRK} from '../../constants/tokens'; -// import {useNostrContext} from '../../context/NostrContext'; -import {useNostrContext} from "afk_nostr_sdk" import {useStyles, useTheme, useTips, useWaitConnection} from '../../hooks'; import {useClaim, useEstimateClaim} from '../../hooks/api'; import {useToast, useTransaction, useTransactionModal, useWalletModal} from '../../hooks/modals'; diff --git a/apps/mobile/src/screens/Tips/index.tsx b/apps/mobile/src/screens/Tips/index.tsx index f43a59a2..d87b2495 100644 --- a/apps/mobile/src/screens/Tips/index.tsx +++ b/apps/mobile/src/screens/Tips/index.tsx @@ -1,20 +1,19 @@ -import { useNavigation } from '@react-navigation/native'; -import { useState } from 'react'; -import { Pressable, View } from 'react-native'; +import {useNavigation} from '@react-navigation/native'; +import {useState} from 'react'; +import {Pressable, View} from 'react-native'; -import { Header } from '../../components'; +import {AddPostIcon} from '../../assets/icons'; import TabSelector from '../../components/TabSelector'; -import { useStyles, useTheme } from '../../hooks'; -import { MainStackNavigationProps } from '../../types'; -import { SelectedTab, TABS_LIST } from '../../types/tab'; -import { ChannelsFeedComponent } from '../ChannelsFeed/ChannelsFeedComponent'; +import {useStyles, useTheme} from '../../hooks'; +import {MainStackNavigationProps} from '../../types'; +import {SelectedTab, TABS_LIST} from '../../types/tab'; +import {ChannelsFeedComponent} from '../ChannelsFeed/ChannelsFeedComponent'; import stylesheet from './styles'; -import { TipsComponent } from './TipsComponent'; -import { AddPostIcon } from '../../assets/icons'; +import {TipsComponent} from './TipsComponent'; export const Tips: React.FC = () => { const styles = useStyles(stylesheet); - const theme = useTheme() + const theme = useTheme(); const navigation = useNavigation(); const [selectedTab, setSelectedTab] = useState(SelectedTab.TIPS); const handleTabSelected = (tab: string | SelectedTab, screen?: string) => { @@ -43,14 +42,11 @@ export const Tips: React.FC = () => { <> )} - navigation.navigate('MainStack', { screen: 'CreateForm' })} + onPress={() => navigation.navigate('MainStack', {screen: 'CreateForm'})} > - + ); diff --git a/apps/mobile/src/screens/Whatever/index.tsx b/apps/mobile/src/screens/Whatever/index.tsx index d3733d4d..27f32dc7 100644 --- a/apps/mobile/src/screens/Whatever/index.tsx +++ b/apps/mobile/src/screens/Whatever/index.tsx @@ -5,7 +5,6 @@ import {useState} from 'react'; import {View} from 'react-native'; import {byteArray, cairo, CallData, getChecksumAddress, uint256} from 'starknet'; -import {Header} from '../../components'; import TabSelector from '../../components/TabSelector'; import {ESCROW_ADDRESSES} from '../../constants/contracts'; import {CHAIN_ID} from '../../constants/env'; diff --git a/apps/mobile/src/services/api.ts b/apps/mobile/src/services/api.ts index 36a0fb20..074a59c3 100644 --- a/apps/mobile/src/services/api.ts +++ b/apps/mobile/src/services/api.ts @@ -18,4 +18,3 @@ export const ApiIndexerInstance = axios.create({ // 'Access-Control-Allow-Origin':'*' }, }); - diff --git a/apps/mobile/src/types/routes.ts b/apps/mobile/src/types/routes.ts index 787c7c6c..5e453a3a 100644 --- a/apps/mobile/src/types/routes.ts +++ b/apps/mobile/src/types/routes.ts @@ -1,8 +1,9 @@ import {NDKEvent} from '@nostr-dev-kit/ndk'; -import {CompositeScreenProps, NavigatorScreenParams} from '@react-navigation/native'; import {DrawerNavigationProp, DrawerScreenProps} from '@react-navigation/drawer'; +import {CompositeScreenProps, NavigatorScreenParams} from '@react-navigation/native'; import {NativeStackNavigationProp, NativeStackScreenProps} from '@react-navigation/native-stack'; -import { TokenLaunchInterface } from './keys'; + +import {TokenLaunchInterface} from './keys'; export type RootStackParams = { MainStack: NavigatorScreenParams; @@ -32,25 +33,23 @@ export type MainStackParams = { ChannelDetail: {postId: string; post?: NDKEvent}; CreateForm: undefined; Defi: undefined; - Games:undefined, - KeysMarketplace:undefined; - Slinks:undefined; + Games: undefined; + KeysMarketplace: undefined; + Slinks: undefined; Tips: undefined; Home: undefined; Feed: undefined; - Settings:undefined; - Launchpad:undefined; - LaunchDetail: {coinAddress:string, launch?:TokenLaunchInterface}; + Settings: undefined; + Launchpad: undefined; + LaunchDetail: {coinAddress: string; launch?: TokenLaunchInterface}; Login: undefined; CreateAccount: undefined; SaveKeys: { privateKey: string; publicKey: string; }; - ImportKeys:undefined; - Auth:NavigatorScreenParams - - + ImportKeys: undefined; + Auth: NavigatorScreenParams; }; export type HomeBottomStackParams = { @@ -59,22 +58,22 @@ export type HomeBottomStackParams = { Notifications: undefined; Tips: undefined; Search: undefined; - Games:undefined, + Games: undefined; Defi: undefined; Home: undefined; - Settings:undefined; - Profile:{publicKey:string}; - Launchpad:undefined; - LaunchDetail: {coinAddress:string, launch?:TokenLaunchInterface}; + Settings: undefined; + Profile: {publicKey: string}; + Launchpad: undefined; + LaunchDetail: {coinAddress: string; launch?: TokenLaunchInterface}; Login: undefined; CreateAccount: undefined; SaveKeys: { privateKey: string; publicKey: string; }; - ImportKeys:undefined; - Auth:NavigatorScreenParams; - Main:NavigatorScreenParams; + ImportKeys: undefined; + Auth: NavigatorScreenParams; + Main: NavigatorScreenParams; // ChannelsFeed:undefined; // CreateChannel:undefined; }; @@ -89,7 +88,10 @@ export type AuthLoginScreenProps = CompositeScreenProps< NativeStackScreenProps >; export type AuthCreateAccountScreenProps = CompositeScreenProps< - NativeStackScreenProps, + NativeStackScreenProps< + AuthStackParams | HomeBottomStackParams | MainStackParams, + 'CreateAccount' + >, NativeStackScreenProps >; export type AuthSaveKeysScreenProps = CompositeScreenProps< @@ -134,7 +136,6 @@ export type SearchScreenProps = CompositeScreenProps< // NativeStackScreenProps // >; - // export type CreateChannelScreenProps = CompositeScreenProps< // NativeStackScreenProps, // NativeStackScreenProps @@ -188,7 +189,6 @@ export type CreateFormScreenProps = CompositeScreenProps< NativeStackScreenProps >; - export type DefiScreenProps = CompositeScreenProps< NativeStackScreenProps, NativeStackScreenProps @@ -209,13 +209,11 @@ export type SlinkScreenProps = CompositeScreenProps< NativeStackScreenProps >; - export type SettingsScreenProps = CompositeScreenProps< NativeStackScreenProps, NativeStackScreenProps >; - export type LaunchpadScreenProps = CompositeScreenProps< NativeStackScreenProps, NativeStackScreenProps @@ -226,14 +224,11 @@ export type LaunchDetailScreenProps = CompositeScreenProps< NativeStackScreenProps >; - // export type TipsMainScreenProps = CompositeScreenProps< // NativeStackScreenProps, // NativeStackScreenProps // >; - // Drawer desktop stack export type DrawerStackNavigationProps = DrawerNavigationProp; - diff --git a/apps/mobile/src/types/tab.ts b/apps/mobile/src/types/tab.ts index 2c202459..0f50b461 100644 --- a/apps/mobile/src/types/tab.ts +++ b/apps/mobile/src/types/tab.ts @@ -11,12 +11,10 @@ export enum SelectedTab { VIEW_KEYS_MARKETPLACE, LAUNCH_TOKEN_PUMP, SLINK, - LAUNCHPAD_VIEW - - + LAUNCHPAD_VIEW, } -export const TABS_LIST: { screen?: string; title: string; tab: SelectedTab }[] = [ +export const TABS_LIST: {screen?: string; title: string; tab: SelectedTab}[] = [ { title: 'Tips', screen: 'Tips', @@ -35,7 +33,7 @@ export const TABS_LIST: { screen?: string; title: string; tab: SelectedTab }[] = // }, ]; -export const TABS_LIST_SEARCH: { screen?: string; title: string; tab: SelectedTab }[] = [ +export const TABS_LIST_SEARCH: {screen?: string; title: string; tab: SelectedTab}[] = [ { title: 'Notes', screen: 'Feed', @@ -59,7 +57,7 @@ export const TABS_LIST_SEARCH: { screen?: string; title: string; tab: SelectedTa // }, ]; -export const TABS_FORM_CREATE: { screen?: string; title: string; tab: SelectedTab }[] = [ +export const TABS_FORM_CREATE: {screen?: string; title: string; tab: SelectedTab}[] = [ { title: 'Notes', screen: 'PostCreate', @@ -84,9 +82,7 @@ export const TABS_FORM_CREATE: { screen?: string; title: string; tab: SelectedTa // }, ]; - -export const TABS_MENU: { screen?: string; title: string; tab: SelectedTab }[] = [ - +export const TABS_MENU: {screen?: string; title: string; tab: SelectedTab}[] = [ { title: 'Pump', screen: 'Launchpad', @@ -96,7 +92,8 @@ export const TABS_MENU: { screen?: string; title: string; tab: SelectedTab }[] = title: 'Keys', screen: 'KeysMarketplace', tab: SelectedTab.VIEW_KEYS_MARKETPLACE, - }, { + }, + { title: 'Slink', screen: 'Slink', tab: SelectedTab.SLINK, @@ -127,4 +124,4 @@ export const TABS_MENU: { screen?: string; title: string; tab: SelectedTab }[] = // tab: SelectedTab.MESSAGES // }, -]; \ No newline at end of file +]; diff --git a/apps/mobile/src/utils/events.ts b/apps/mobile/src/utils/events.ts index 634d9713..1274f27e 100644 --- a/apps/mobile/src/utils/events.ts +++ b/apps/mobile/src/utils/events.ts @@ -51,8 +51,6 @@ export const parseClaimEvent = (event: ContractEvent) => { return undefined; }; - - export const parseCreatedKeyEvent = (event: ContractEvent) => { if (event.keys[0] === EventKeyForKeysMarketplace.CreateKeys) { return { diff --git a/apps/telegram-app/.env.example b/apps/telegram-app/.env.example new file mode 100644 index 00000000..e69de29b diff --git a/apps/telegram-app/.eslintrc.cjs b/apps/telegram-app/.eslintrc.cjs new file mode 100644 index 00000000..04253717 --- /dev/null +++ b/apps/telegram-app/.eslintrc.cjs @@ -0,0 +1,20 @@ +require('@uniswap/eslint-config/load'); + +module.exports = { + extends: ['next/core-web-vitals', '@uniswap/eslint-config/node'], + overrides: [ + { + files: ['*.ts', '*.tsx', '*.js', '*.jsx'], + rules: { + 'import/no-unused-modules': 'off', + + 'prettier/prettier': [ + 'error', + { + endOfLine: 'auto', + }, + ], + }, + }, + ], +}; diff --git a/apps/telegram-app/.gitignore b/apps/telegram-app/.gitignore new file mode 100644 index 00000000..eb1bcb87 --- /dev/null +++ b/apps/telegram-app/.gitignore @@ -0,0 +1,134 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +# next +.next +next-env.d.ts diff --git a/apps/telegram-app/.npmrc b/apps/telegram-app/.npmrc new file mode 100644 index 00000000..2f5f2ba9 --- /dev/null +++ b/apps/telegram-app/.npmrc @@ -0,0 +1,2 @@ +shamefully-hoist=true +registry=https://registry.npmjs.org/ diff --git a/apps/telegram-app/.prettierrc b/apps/telegram-app/.prettierrc new file mode 100644 index 00000000..dfa3383a --- /dev/null +++ b/apps/telegram-app/.prettierrc @@ -0,0 +1,8 @@ +{ + "bracketSpacing": false, + "singleQuote": true, + "trailingComma": "all", + "printWidth": 100, + "semi": true, + "endOfLine": "lf" +} diff --git a/apps/telegram-app/next.config.mjs b/apps/telegram-app/next.config.mjs new file mode 100644 index 00000000..0ace741f --- /dev/null +++ b/apps/telegram-app/next.config.mjs @@ -0,0 +1,30 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + async headers() { + return [ + { + source: '/api/:path*', + headers: [ + { + key: 'Content-Security-Policy', + value: "default-src 'self'; frame-ancestors 'self' https://web.telegram.org;", + }, + { + key: 'Access-Control-Allow-Origin', + value: '*', // Set your origin + }, + { + key: 'Access-Control-Allow-Methods', + value: 'GET, POST, PUT, DELETE, OPTIONS', + }, + { + key: 'Access-Control-Allow-Headers', + value: 'Content-Type, Authorization', + }, + ], + }, + ]; + }, +}; + +export default nextConfig; diff --git a/apps/telegram-app/package.json b/apps/telegram-app/package.json new file mode 100644 index 00000000..522d8d29 --- /dev/null +++ b/apps/telegram-app/package.json @@ -0,0 +1,55 @@ +{ + "name": "telegram-app", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "start": "next start", + "build:app": "pnpm run build:nostr_sdk && next build", + "build": "next build", + "build:nostr_sdk": "cd ../.. && pnpm run build:nostr_sdk", + "lint": "next lint", + "lint:fix": "next lint --fix", + "prettier:fix": "pnpm prettier --write 'src/**/*.tsx'", + "prettier:fix:ts": "pnpm prettier --write 'src/**/*.ts'", + "check-types": "tsc --noEmit" + }, + "dependencies": { + "@avnu/avnu-sdk": "^2.0.0", + "@chakra-ui/react": "^2.8.2", + "@emotion/react": "^11.13.0", + "@emotion/styled": "^11.13.0", + "@nostr-dev-kit/ndk": "^2.8.2", + "@pinata/sdk": "^2.1.0", + "@tanstack/react-query": "^5.40.0", + "afk_nostr_sdk": "workspace:*", + "common": "workspace:*", + "ethers": "^6.13.1", + "framer-motion": "^11.3.28", + "next": "^14.2.3", + "nostr-tools": "^2.7.0", + "qs": "^6.12.3", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "starknet": "6.9.0", + "telegraf": "^4.16.3", + "zod": "^3.23.8", + "zustand": "^4.5.2" + }, + "devDependencies": { + "@types/node": "^20", + "@types/react": "^18.3.1", + "@types/react-dom": "^18.3.0", + "@uniswap/eslint-config": "^1.2.0", + "autoprefixer": "^10.4.19", + "eslint": "^8.57.0", + "eslint-config-next": "^14.2.4", + "framer-motion": "^11.2.4", + "postcss": "^8.4.38", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "tailwindcss": "^3.4.3", + "typescript": "^5", + "web-vitals": "^2.1.4" + } +} diff --git a/apps/telegram-app/postcss.config.js b/apps/telegram-app/postcss.config.js new file mode 100644 index 00000000..12a703d9 --- /dev/null +++ b/apps/telegram-app/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/apps/telegram-app/public/DroidSans-Bold.ttf b/apps/telegram-app/public/DroidSans-Bold.ttf new file mode 100644 index 00000000..7ac04b6f Binary files /dev/null and b/apps/telegram-app/public/DroidSans-Bold.ttf differ diff --git a/apps/telegram-app/public/DroidSans.ttf b/apps/telegram-app/public/DroidSans.ttf new file mode 100644 index 00000000..b4b4eda3 Binary files /dev/null and b/apps/telegram-app/public/DroidSans.ttf differ diff --git a/apps/telegram-app/public/android-chrome-192x192.png b/apps/telegram-app/public/android-chrome-192x192.png new file mode 100644 index 00000000..aae98c36 Binary files /dev/null and b/apps/telegram-app/public/android-chrome-192x192.png differ diff --git a/apps/telegram-app/public/android-chrome-512x512.png b/apps/telegram-app/public/android-chrome-512x512.png new file mode 100644 index 00000000..66fb1a5c Binary files /dev/null and b/apps/telegram-app/public/android-chrome-512x512.png differ diff --git a/apps/telegram-app/public/apple-touch-icon.png b/apps/telegram-app/public/apple-touch-icon.png new file mode 100644 index 00000000..5e48fe0d Binary files /dev/null and b/apps/telegram-app/public/apple-touch-icon.png differ diff --git a/apps/telegram-app/public/assets/Faq.tsx b/apps/telegram-app/public/assets/Faq.tsx new file mode 100644 index 00000000..f358a435 --- /dev/null +++ b/apps/telegram-app/public/assets/Faq.tsx @@ -0,0 +1,44 @@ +'use client'; + +import { FaqBar } from "@/app/components/FaqBar"; + + +export function Faq() { + return ( +
+

+ Frequently asked Questions +

+
+ + + + + + + {/* + + + */} +
+
+ ); +} diff --git a/apps/telegram-app/public/assets/Screenshot 2024-07-29 at 14-22-39 CreateAccount.png b/apps/telegram-app/public/assets/Screenshot 2024-07-29 at 14-22-39 CreateAccount.png new file mode 100644 index 00000000..6b8ff7a3 Binary files /dev/null and b/apps/telegram-app/public/assets/Screenshot 2024-07-29 at 14-22-39 CreateAccount.png differ diff --git a/apps/telegram-app/public/assets/afkMascot.png b/apps/telegram-app/public/assets/afkMascot.png new file mode 100644 index 00000000..acad8174 Binary files /dev/null and b/apps/telegram-app/public/assets/afkMascot.png differ diff --git a/apps/telegram-app/public/assets/appStoreBtn.png b/apps/telegram-app/public/assets/appStoreBtn.png new file mode 100644 index 00000000..09d9eff8 Binary files /dev/null and b/apps/telegram-app/public/assets/appStoreBtn.png differ diff --git a/apps/telegram-app/public/assets/appStoreBtn.svg b/apps/telegram-app/public/assets/appStoreBtn.svg new file mode 100644 index 00000000..35f51c0d --- /dev/null +++ b/apps/telegram-app/public/assets/appStoreBtn.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/telegram-app/public/assets/cancel-icon.svg b/apps/telegram-app/public/assets/cancel-icon.svg new file mode 100644 index 00000000..9516ea16 --- /dev/null +++ b/apps/telegram-app/public/assets/cancel-icon.svg @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/apps/telegram-app/public/assets/contributeBg.svg b/apps/telegram-app/public/assets/contributeBg.svg new file mode 100644 index 00000000..53e4d8f3 --- /dev/null +++ b/apps/telegram-app/public/assets/contributeBg.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/telegram-app/public/assets/degen-logo.png b/apps/telegram-app/public/assets/degen-logo.png new file mode 100644 index 00000000..1ce3c662 Binary files /dev/null and b/apps/telegram-app/public/assets/degen-logo.png differ diff --git a/apps/telegram-app/public/assets/down-cheveron.svg b/apps/telegram-app/public/assets/down-cheveron.svg new file mode 100644 index 00000000..1cb9fa49 --- /dev/null +++ b/apps/telegram-app/public/assets/down-cheveron.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/telegram-app/public/assets/facebookIcon.svg b/apps/telegram-app/public/assets/facebookIcon.svg new file mode 100644 index 00000000..c669e4a2 --- /dev/null +++ b/apps/telegram-app/public/assets/facebookIcon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/telegram-app/public/assets/footerBg.jpeg b/apps/telegram-app/public/assets/footerBg.jpeg new file mode 100644 index 00000000..06a9f8ff Binary files /dev/null and b/apps/telegram-app/public/assets/footerBg.jpeg differ diff --git a/apps/telegram-app/public/assets/footerBg.svg b/apps/telegram-app/public/assets/footerBg.svg new file mode 100644 index 00000000..a5334a58 --- /dev/null +++ b/apps/telegram-app/public/assets/footerBg.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/apps/telegram-app/public/assets/githubLogo.svg b/apps/telegram-app/public/assets/githubLogo.svg new file mode 100644 index 00000000..a0841c60 --- /dev/null +++ b/apps/telegram-app/public/assets/githubLogo.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/telegram-app/public/assets/githubLogoDark.svg b/apps/telegram-app/public/assets/githubLogoDark.svg new file mode 100644 index 00000000..5324fb6f --- /dev/null +++ b/apps/telegram-app/public/assets/githubLogoDark.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/telegram-app/public/assets/go-to.svg b/apps/telegram-app/public/assets/go-to.svg new file mode 100644 index 00000000..f54a5c8b --- /dev/null +++ b/apps/telegram-app/public/assets/go-to.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/apps/telegram-app/public/assets/googlePlaybtn.png b/apps/telegram-app/public/assets/googlePlaybtn.png new file mode 100644 index 00000000..0b0fea93 Binary files /dev/null and b/apps/telegram-app/public/assets/googlePlaybtn.png differ diff --git a/apps/telegram-app/public/assets/googlePlaybtn.svg b/apps/telegram-app/public/assets/googlePlaybtn.svg new file mode 100644 index 00000000..54761f46 --- /dev/null +++ b/apps/telegram-app/public/assets/googlePlaybtn.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/telegram-app/public/assets/gradientBg.svg b/apps/telegram-app/public/assets/gradientBg.svg new file mode 100644 index 00000000..9b1e390f --- /dev/null +++ b/apps/telegram-app/public/assets/gradientBg.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/telegram-app/public/assets/hamburger-icon.svg b/apps/telegram-app/public/assets/hamburger-icon.svg new file mode 100644 index 00000000..6a26801b --- /dev/null +++ b/apps/telegram-app/public/assets/hamburger-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/telegram-app/public/assets/heroBg.jpeg b/apps/telegram-app/public/assets/heroBg.jpeg new file mode 100644 index 00000000..7019b244 Binary files /dev/null and b/apps/telegram-app/public/assets/heroBg.jpeg differ diff --git a/apps/telegram-app/public/assets/heroBg.svg b/apps/telegram-app/public/assets/heroBg.svg new file mode 100644 index 00000000..e534427e --- /dev/null +++ b/apps/telegram-app/public/assets/heroBg.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/telegram-app/public/assets/heroBg2.jpeg b/apps/telegram-app/public/assets/heroBg2.jpeg new file mode 100644 index 00000000..0ef2a351 Binary files /dev/null and b/apps/telegram-app/public/assets/heroBg2.jpeg differ diff --git a/apps/telegram-app/public/assets/heroBg3.jpeg b/apps/telegram-app/public/assets/heroBg3.jpeg new file mode 100644 index 00000000..2df68319 Binary files /dev/null and b/apps/telegram-app/public/assets/heroBg3.jpeg differ diff --git a/apps/telegram-app/public/assets/home-page-feed.png b/apps/telegram-app/public/assets/home-page-feed.png new file mode 100644 index 00000000..f84e59b4 Binary files /dev/null and b/apps/telegram-app/public/assets/home-page-feed.png differ diff --git a/apps/telegram-app/public/assets/joyboyMascot.png b/apps/telegram-app/public/assets/joyboyMascot.png new file mode 100644 index 00000000..a759f990 Binary files /dev/null and b/apps/telegram-app/public/assets/joyboyMascot.png differ diff --git a/apps/telegram-app/public/assets/key.svg b/apps/telegram-app/public/assets/key.svg new file mode 100644 index 00000000..a29e7d48 --- /dev/null +++ b/apps/telegram-app/public/assets/key.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/telegram-app/public/assets/linkedinIcon.svg b/apps/telegram-app/public/assets/linkedinIcon.svg new file mode 100644 index 00000000..69cd5930 --- /dev/null +++ b/apps/telegram-app/public/assets/linkedinIcon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/telegram-app/public/assets/logo.svg b/apps/telegram-app/public/assets/logo.svg new file mode 100644 index 00000000..4d525343 --- /dev/null +++ b/apps/telegram-app/public/assets/logo.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/apps/telegram-app/public/assets/mobileHeroBg.svg b/apps/telegram-app/public/assets/mobileHeroBg.svg new file mode 100644 index 00000000..8d705def --- /dev/null +++ b/apps/telegram-app/public/assets/mobileHeroBg.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/telegram-app/public/assets/money-send.svg b/apps/telegram-app/public/assets/money-send.svg new file mode 100644 index 00000000..8c3f3589 --- /dev/null +++ b/apps/telegram-app/public/assets/money-send.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/apps/telegram-app/public/assets/moon.svg b/apps/telegram-app/public/assets/moon.svg new file mode 100644 index 00000000..97a8f319 --- /dev/null +++ b/apps/telegram-app/public/assets/moon.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/telegram-app/public/assets/noAdIcon.svg b/apps/telegram-app/public/assets/noAdIcon.svg new file mode 100644 index 00000000..6a7e65fa --- /dev/null +++ b/apps/telegram-app/public/assets/noAdIcon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/telegram-app/public/assets/pepe-logo.png b/apps/telegram-app/public/assets/pepe-logo.png new file mode 100644 index 00000000..d310d476 Binary files /dev/null and b/apps/telegram-app/public/assets/pepe-logo.png differ diff --git a/apps/telegram-app/public/assets/save-your-keys.png b/apps/telegram-app/public/assets/save-your-keys.png new file mode 100644 index 00000000..5ef92402 Binary files /dev/null and b/apps/telegram-app/public/assets/save-your-keys.png differ diff --git a/apps/telegram-app/public/assets/telegram.svg b/apps/telegram-app/public/assets/telegram.svg new file mode 100644 index 00000000..3e17ea56 --- /dev/null +++ b/apps/telegram-app/public/assets/telegram.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/apps/telegram-app/public/assets/telegramIcon.svg b/apps/telegram-app/public/assets/telegramIcon.svg new file mode 100644 index 00000000..c3e6a642 --- /dev/null +++ b/apps/telegram-app/public/assets/telegramIcon.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/apps/telegram-app/public/assets/twitterIcon.svg b/apps/telegram-app/public/assets/twitterIcon.svg new file mode 100644 index 00000000..7bc79ed8 --- /dev/null +++ b/apps/telegram-app/public/assets/twitterIcon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/telegram-app/public/favicon-16x16.png b/apps/telegram-app/public/favicon-16x16.png new file mode 100644 index 00000000..ab777694 Binary files /dev/null and b/apps/telegram-app/public/favicon-16x16.png differ diff --git a/apps/telegram-app/public/favicon-32x32.png b/apps/telegram-app/public/favicon-32x32.png new file mode 100644 index 00000000..edbb54af Binary files /dev/null and b/apps/telegram-app/public/favicon-32x32.png differ diff --git a/apps/telegram-app/public/favicon.ico b/apps/telegram-app/public/favicon.ico new file mode 100644 index 00000000..d7673024 Binary files /dev/null and b/apps/telegram-app/public/favicon.ico differ diff --git a/apps/telegram-app/public/index.html b/apps/telegram-app/public/index.html new file mode 100644 index 00000000..639e57e1 --- /dev/null +++ b/apps/telegram-app/public/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + AFK Aligned Fam Kernel + + + +
+ + + diff --git a/apps/telegram-app/public/manifest.json b/apps/telegram-app/public/manifest.json new file mode 100644 index 00000000..ec18f749 --- /dev/null +++ b/apps/telegram-app/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "AFK Community Telegram app", + "name": "Aligned Fam Kernel Community Telegram app", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "android-chrome-192x192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "android-chrome-512x512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/apps/telegram-app/public/robots.txt b/apps/telegram-app/public/robots.txt new file mode 100644 index 00000000..e9e57dc4 --- /dev/null +++ b/apps/telegram-app/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/apps/telegram-app/src/app/.well-known/nostr.json/route.ts b/apps/telegram-app/src/app/.well-known/nostr.json/route.ts new file mode 100644 index 00000000..a17733a5 --- /dev/null +++ b/apps/telegram-app/src/app/.well-known/nostr.json/route.ts @@ -0,0 +1,31 @@ +import {NextResponse, NextRequest} from 'next/server'; + +const nostr_keys = { + afk: { + pubkey: 'npub1nq5ckz62p4vxwu08lpx8ggu5k5qn6d7pdtcfyj7hae3wc6j30fwseex2rq', + }, + testnet: { + pubkey: 'b0635d6a9851d3aed0cd6c495b282167acf761729078d975fc341b22650b07b9', + }, +}; + +export async function GET(request: NextRequest) { + const {searchParams} = new URL(request.url); + const name = searchParams.get('name'); + + if (!name || !nostr_keys[name]) { + return NextResponse.json({error: 'User not found'}, {status: 404}); + } + + const nostr_key = nostr_keys[name]; + const response = { + names: { + [name]: nostr_key.pubkey, + }, + }; + + const nextResponse = NextResponse.json(response); + nextResponse.headers.set('Access-Control-Allow-Origin', '*'); + + return nextResponse; +} diff --git a/apps/telegram-app/src/app/App.css b/apps/telegram-app/src/app/App.css new file mode 100644 index 00000000..e69de29b diff --git a/apps/telegram-app/src/app/_app.tsx b/apps/telegram-app/src/app/_app.tsx new file mode 100644 index 00000000..f8f66a42 --- /dev/null +++ b/apps/telegram-app/src/app/_app.tsx @@ -0,0 +1,24 @@ +import './index.css'; + +import type {Metadata} from 'next'; + +import Providers from './providers'; + +export const metadata: Metadata = { + title: 'afk community portal', + description: 'afk community portal', +}; +import {AppProps} from 'next/app'; +import { launchBot } from '@/services/telegram'; + +function MyApp({Component, pageProps}: AppProps) { + console.log("process.env.TELEGRAM_BOT_TOKEN)", process.env.TELEGRAM_BOT_TOKEN) + launchBot(process.env.TELEGRAM_BOT_TOKEN) + return ( + + + + ); +} + +export default MyApp; diff --git a/apps/telegram-app/src/app/api/bot.ts b/apps/telegram-app/src/app/api/bot.ts new file mode 100644 index 00000000..69de9419 --- /dev/null +++ b/apps/telegram-app/src/app/api/bot.ts @@ -0,0 +1,44 @@ +import { Telegraf } from 'telegraf'; +import { NextApiRequest, NextApiResponse } from 'next'; + +let bot: Telegraf | null = null; + +export function launchBot(token: string) { + // Create a bot using the token received from @BotFather + const botInstance = new Telegraf(token); + + // Example: Listen to commands + botInstance.command('start', (ctx) => ctx.reply('Welcome!')); + + // Example: Listen to messages + botInstance.on('text', (ctx) => { + ctx.reply(`You said: ${ctx.message.text}`); + }); + + // Launch the bot + botInstance.launch().then(() => console.log('Bot launched')); + + // Enable graceful stop + process.once('SIGINT', () => botInstance.stop('SIGINT')); + process.once('SIGTERM', () => botInstance.stop('SIGTERM')); + + return botInstance; +} + +export default function handler(req: NextApiRequest, res: NextApiResponse) { + console.log("req", req) + if (req.method === 'POST') { + if (!bot) { + const token = process.env.TELEGRAM_BOT_TOKEN || ''; + if (!token) { + res.status(500).json({ error: 'Bot token not found' }); + return; + } + + bot = launchBot(token); + } + res.status(200).json({ status: 'Bot is running' }); + } else { + res.status(405).json({ error: 'Method Not Allowed' }); + } +} diff --git a/apps/telegram-app/src/app/api/telegram/message.ts b/apps/telegram-app/src/app/api/telegram/message.ts new file mode 100644 index 00000000..a4a8df63 --- /dev/null +++ b/apps/telegram-app/src/app/api/telegram/message.ts @@ -0,0 +1,10 @@ +import { handleMessageRequest, launchBot } from "@/services/telegram" +import { NextRequest, NextResponse } from "next/server" +export const MESSAGE_PATH = "/message" + + +export async function POST(request: NextRequest, res:NextResponse) { + + + +} \ No newline at end of file diff --git a/apps/telegram-app/src/app/api/webhook.ts b/apps/telegram-app/src/app/api/webhook.ts new file mode 100644 index 00000000..753a5c54 --- /dev/null +++ b/apps/telegram-app/src/app/api/webhook.ts @@ -0,0 +1,44 @@ +import { sendMessage, sendWebAppButton } from '@/services/telegram'; +import { NextApiRequest, NextApiResponse } from 'next'; + +const handler = async (req: NextApiRequest, res: NextApiResponse) => { + console.log('Request body:', req.body); + if (req.method === 'POST') { + // Parse the request body (ensure it's JSON) + const data = req.body; + // Log the received data (for debugging) + console.log('Webhook received:', data); + const message = req.body.message; + + if (message) { + const chatId = message.chat.id; + const text = message.text; + console.log(`Received message from chat_id ${chatId}: ${text}`); + // Respond with a Web App button or another action + if (text === '/start') { + await sendWebAppButton(chatId); + } else { + await sendMessage(chatId, "I received your message: " + text); + } + } + + // Process the webhook data as needed + const chatId = data?.message?.chat?.id; + const text = data?.message?.text; + + if (chatId && text) { + // Example: Respond back with a message or trigger an action + console.log(`Message from chat ID ${chatId}: ${text}`); + // Here, you could trigger an action, like sending a response back to Telegram or another system + } + + // Respond with a 200 status to acknowledge receipt + res.status(200).json({ status: 'success' }); + } else { + // If not a POST request, return 405 Method Not Allowed + res.setHeader('Allow', ['POST']); + res.status(405).end(`Method ${req.method} Not Allowed`); + } +}; + +export default handler; diff --git a/apps/telegram-app/src/app/api/webhook/index.ts b/apps/telegram-app/src/app/api/webhook/index.ts new file mode 100644 index 00000000..ce77927b --- /dev/null +++ b/apps/telegram-app/src/app/api/webhook/index.ts @@ -0,0 +1,44 @@ +import { launchBot, sendMessage, sendWebAppButton } from '@/services/telegram'; +import { NextApiRequest, NextApiResponse } from 'next'; +const handler = async (req: NextApiRequest, res: NextApiResponse) => { + console.log('Request body:', req.body); + + if (req.method === 'POST') { + // Parse the request body (ensure it's JSON) + const data = req.body; + // Log the received data (for debugging) + console.log('Webhook received:', data); + const message = req.body.message; + + if (message) { + const chatId = message.chat.id; + const text = message.text; + console.log(`Received message from chat_id ${chatId}: ${text}`); + // Respond with a Web App button or another action + if (text === '/start') { + await sendWebAppButton(chatId); + } else { + await sendMessage(chatId, "I received your message: " + text); + } + } + + // Process the webhook data as needed + const chatId = data?.message?.chat?.id; + const text = data?.message?.text; + + if (chatId && text) { + // Example: Respond back with a message or trigger an action + console.log(`Message from chat ID ${chatId}: ${text}`); + // Here, you could trigger an action, like sending a response back to Telegram or another system + } + + // Respond with a 200 status to acknowledge receipt + res.status(200).json({ status: 'success' }); + } else { + // If not a POST request, return 405 Method Not Allowed + res.setHeader('Allow', ['POST']); + res.status(405).end(`Method ${req.method} Not Allowed`); + } +}; + +export default handler; diff --git a/apps/telegram-app/src/app/api/webhook/telegram/index.ts b/apps/telegram-app/src/app/api/webhook/telegram/index.ts new file mode 100644 index 00000000..5e00efdc --- /dev/null +++ b/apps/telegram-app/src/app/api/webhook/telegram/index.ts @@ -0,0 +1,43 @@ +import { sendMessage, sendWebAppButton } from '@/services/telegram'; +import { NextApiRequest, NextApiResponse } from 'next'; + +const handler = async (req: NextApiRequest, res: NextApiResponse) => { + if (req.method === 'POST') { + // Parse the request body (ensure it's JSON) + const data = req.body; + // Log the received data (for debugging) + console.log('Webhook received:', data); + const message = req.body.message; + + if (message) { + const chatId = message.chat.id; + const text = message.text; + console.log(`Received message from chat_id ${chatId}: ${text}`); + // Respond with a Web App button or another action + if (text === '/start') { + await sendWebAppButton(chatId); + } else { + await sendMessage(chatId, "I received your message: " + text); + } + } + + // Process the webhook data as needed + const chatId = data?.message?.chat?.id; + const text = data?.message?.text; + + if (chatId && text) { + // Example: Respond back with a message or trigger an action + console.log(`Message from chat ID ${chatId}: ${text}`); + // Here, you could trigger an action, like sending a response back to Telegram or another system + } + + // Respond with a 200 status to acknowledge receipt + res.status(200).json({ status: 'success' }); + } else { + // If not a POST request, return 405 Method Not Allowed + res.setHeader('Allow', ['POST']); + res.status(405).end(`Method ${req.method} Not Allowed`); + } +}; + +export default handler; diff --git a/apps/telegram-app/src/app/app/page.tsx b/apps/telegram-app/src/app/app/page.tsx new file mode 100644 index 00000000..f18e9f08 --- /dev/null +++ b/apps/telegram-app/src/app/app/page.tsx @@ -0,0 +1,100 @@ +'use client'; + +import {NDKEvent, NDKFilter, NDKKind} from '@nostr-dev-kit/ndk'; +import {useNostrContext, useSearchNotes} from 'afk_nostr_sdk'; +import {useEffect} from 'react'; +import {useState} from 'react'; + +import {Footer} from '../components/Footer'; +import {Navbar} from '../components/Navbar'; +export default function AppHomepage() { + const nostr = useNostrContext(); + const [events, setEvents] = useState([]); + const [isInitDone, setIsInitDone] = useState(false); + useEffect(() => { + if (!isInitDone) { + fetch(); + setIsInitDone(true); + } + }); + const fetch = async () => { + const filter: NDKFilter = { + kinds: [NDKKind.Text, NDKKind.ChannelMetadata, NDKKind.Metadata], + }; + const events_package = await nostr?.ndk?.fetchEvents(filter); + // console.log("events_package", events_package) + setEvents([ + // ...events_package, + // [...eventsSearch?.data?.pages] + ]); + }; + + const eventsSearch = useSearchNotes({ + kinds: [ + NDKKind.Text, + // NDKKind.ChannelMetadata + ], + }); + // const events = useRootNotes(); + console.log('events hooks', eventsSearch?.data?.pages); + return ( + // +
+ + + +
+ {events?.length > 0 && + events.map((e: NDKEvent, i) => { + return ( + + ); + })} +
+ +
+ {eventsSearch?.data?.pages?.map((e: NDKEvent) => { + console.log('e', e); + return ( + + ); + })} +
+ +
+
+ //
+ ); +} diff --git a/apps/telegram-app/src/app/components/FaqBar.tsx b/apps/telegram-app/src/app/components/FaqBar.tsx new file mode 100644 index 00000000..d685b669 --- /dev/null +++ b/apps/telegram-app/src/app/components/FaqBar.tsx @@ -0,0 +1,30 @@ +'use client'; + +import {useState} from 'react'; +type Props = {answer: string; question: string}; + +export function FaqBar({question, answer}: Props) { + const [isOpen, setIsOpen] = useState(false); + const handleClick = () => { + if (isOpen === true) { + setIsOpen(false); + } else { + setIsOpen(true); + } + }; + return ( + <> + + + ); +} diff --git a/apps/telegram-app/src/app/components/Footer.tsx b/apps/telegram-app/src/app/components/Footer.tsx new file mode 100644 index 00000000..a92bc6a4 --- /dev/null +++ b/apps/telegram-app/src/app/components/Footer.tsx @@ -0,0 +1,55 @@ +export function Footer() { + return ( +
+
+
+ +

+ Free, open-source decentralized social media platform. +

+
+ + +
+
+
+
    +
  • Company
  • +
  • DAO and Community owned
  • +
  • Solutions
  • +
+
    +
  • Product
  • +
  • Nostr client
  • +
  • SocialFi features
  • +
+
+
+ + AFK Aligned Fam Community Twitter / X + + + {/* + + */} + + AFK Community Telegram + +
+
+
+ © 2024 AFK. All Rights Reserved. +
+
+ ); +} diff --git a/apps/telegram-app/src/app/components/MobileNavBar.tsx b/apps/telegram-app/src/app/components/MobileNavBar.tsx new file mode 100644 index 00000000..bafa3727 --- /dev/null +++ b/apps/telegram-app/src/app/components/MobileNavBar.tsx @@ -0,0 +1,58 @@ +'use client'; + +import {motion} from 'framer-motion'; +import {useEffect} from 'react'; + +type Props = {setToggle: any; toggle: boolean}; + +export function MobileNavBar({setToggle, toggle}: Props) { + const parentAnimationVariants = { + init: { + scale: 0, + }, + animate: { + scale: 1, + }, + }; + const toggleNav = () => { + setToggle((prev: any) => !prev); + }; + + useEffect(() => { + if (toggle) { + document.body.classList.add('no-scroll'); + } else { + document.body.classList.remove('no-scroll'); + } + + return () => { + document.body.classList.remove('no-scroll'); + }; + }, [toggle]); + + return ( +
+
+
+ +
+ + +
    + +
+
+
+
+ ); +} diff --git a/apps/telegram-app/src/app/components/Navbar.tsx b/apps/telegram-app/src/app/components/Navbar.tsx new file mode 100644 index 00000000..9e390699 --- /dev/null +++ b/apps/telegram-app/src/app/components/Navbar.tsx @@ -0,0 +1,48 @@ +'use client'; + +import Link from 'next/link'; +import React, {useState} from 'react'; +import {createPortal} from 'react-dom'; + +import {MobileNavBar} from './MobileNavBar'; +import {NavigationLinks} from './NavigationLinks'; +import { ToggleTheme } from './ToggleTheme'; + +export function Navbar() { + const [toggleNav, setToggleNav] = useState(false); + return ( +
+
+ + +
AFK
+ +
+ + {/* */} +
+ +
+ + + {toggleNav && + createPortal(, document.body)} +
+ ); +} diff --git a/apps/telegram-app/src/app/components/NavigationLinks.tsx b/apps/telegram-app/src/app/components/NavigationLinks.tsx new file mode 100644 index 00000000..a70d9653 --- /dev/null +++ b/apps/telegram-app/src/app/components/NavigationLinks.tsx @@ -0,0 +1,17 @@ +'use client'; +import Link from 'next/link'; + +export function NavigationLinks() { + return ( +
    + {/*
  • + Features +
  • */} + {/*
  • + App +
  • */} + {/*
  • Ecosystem
  • */} + {/*
  • Developers
  • */} +
+ ); +} diff --git a/apps/telegram-app/src/app/components/RetroLandingPage.tsx b/apps/telegram-app/src/app/components/RetroLandingPage.tsx new file mode 100644 index 00000000..131e25a0 --- /dev/null +++ b/apps/telegram-app/src/app/components/RetroLandingPage.tsx @@ -0,0 +1,21 @@ +import React from 'react'; + +export function RetroLandingPage() { + // Function to handle the click event + const handleClick = () => { + alert('Stay tuned, more coming soon.'); + }; + return ( +
+

Welcome to AFK

+

The treasure are friends we make along the way.

+

Freedom requires censorship resistance.

+ +
+ ); +} diff --git a/apps/telegram-app/src/app/components/ToggleTheme.tsx b/apps/telegram-app/src/app/components/ToggleTheme.tsx new file mode 100644 index 00000000..aa083a6f --- /dev/null +++ b/apps/telegram-app/src/app/components/ToggleTheme.tsx @@ -0,0 +1,12 @@ +import { Button, useColorMode } from "@chakra-ui/react" + +export function ToggleTheme() { + const { colorMode, toggleColorMode } = useColorMode() + return ( +
+ +
+ ) + } \ No newline at end of file diff --git a/apps/telegram-app/src/app/components/landing/About.tsx b/apps/telegram-app/src/app/components/landing/About.tsx new file mode 100644 index 00000000..0ed0ee93 --- /dev/null +++ b/apps/telegram-app/src/app/components/landing/About.tsx @@ -0,0 +1,22 @@ +'use client'; + +import {motion} from 'framer-motion'; + +export function About() { + return ( +
+ + The name "Aligned Fam Kernel" is inspired by our vision to align the web3 family + together, in one Social graph. We build and fight together, not against. What if the + treasure are the friends we made along the way? Then A decentralized social network should + be a treasure trove of memories and connections! + +
+ ); +} diff --git a/apps/telegram-app/src/app/components/landing/AboutUs.tsx b/apps/telegram-app/src/app/components/landing/AboutUs.tsx new file mode 100644 index 00000000..d75c22db --- /dev/null +++ b/apps/telegram-app/src/app/components/landing/AboutUs.tsx @@ -0,0 +1,161 @@ +import {motion} from 'framer-motion'; + +import {Footer} from '../Footer'; +import {Navbar} from '../Navbar'; + +const AboutUs: React.FC = () => { + return ( +
+ +
+ + +

+ Building for the Community, by the Community +

+

+ Welcome to Aligned Fam Kernel, a decentralized social media platform where your voice + matters. Entirely open-sourced and community-managed, Aligned Fam Kernel empowers you to + shape your social media experience +

+
+ +
+
+
+

About Us

+

+ Welcome to Aligned Fam Kernel, the decentralized social media platform built with Nostr + and powered by Starknet account abstraction. Aligned Fam Kernel aims to revolutionize + social networking by blending SocialFi (social finance) with cutting-edge blockchain + technology, bridging the gap between Web2 networks and decentralized finance (DeFi). + This integration allows users to earn rewards for their engagement while maintaining + control over their data and freedom of expression. +

+
+
+

Why Nostr

+

+ Nostr, short for "Notes and Other Stuff Transmitted by Relays," is a simple + yet powerful protocol enabling secure and censorship-resistant communication. Here’s a + brief guide to understanding Nostr: +

    +
  1. + Decentralized Network: No central authority controls Nostr, ensuring true + decentralization. +
  2. +
  3. + Pseudonymous Accounts: No need for an email or phone number to create an account. +
  4. +
  5. Monetization: Creators can earn tips directly from their content.
  6. +
  7. Open Source: Anyone can contribute to the development of Nostr.
  8. +
+

+
+
+

How does Nostr work ?

+

+ Nostr operates by allowing users to publish and query notes through independent servers + (relays), eliminating single points of failure and enhancing both privacy and + reliability. This decentralized approach addresses the censorship issues faced by + traditional social media platforms, offering a haven for controversial speech without + the risk of deplatforming. Nostr’s innovative approach to identity and user experience + allows individuals to view feeds from any public key, offering diverse perspectives and + a unique glimpse into other users’ thoughts and +

+
+
+

+ What is Aligned Fam Kernel? +

+

+ Aligned Fam Kernel is a decentralized SocialFi platform that combines the Nostr protocol + with Starknet’s native account abstraction. Nostr, often referred to as the + "Farcaster" of Bitcoin, emphasizes censorship resistance and is minimalistic + and pure in design. Utilizing Bitcoin cryptographic primitives such as Schnorr + signatures and concepts like NIP-13 Proof of Work as an anti-spam mechanism, Nostr is + integrated into various Lightning wallets like @getAlby, Wallet of Satoshi and Blue + wallet Leveraging the power of Starknet’s Account Abstraction, AFK enables users to + control their Starknet accounts with their Nostr keypair. This integration allows us to + build advanced features like fully trustless Social Pay and intent-based actions driven + by messages on the social app. We can even explore Al-driven intent-based systems with + trustless on-chain verification using ZKML provided by Giza Tech and Herodotus +

+
+
+

Understanding SocialFi

+

+ SocialFi is the fusion of social media and decentralized finance, empowering users +

    +
  1. Data Control: Users have complete ownership of their data.
  2. +
  3. Freedom of Expression: Censorship resistance ensures free speech.
  4. +
  5. + Earning Opportunities: Users can earn rewards for their engagement through various + monetization strategies. +
  6. +
+

+
+
+

Key Elements Include

+

+

    +
  1. + Digital Ownership with NFTs: Non-fungible tokens (NFTs) ensure secure and verifiable + digital ownership. +
  2. +
  3. + Decentralized Governance with DAOs: Decentralized autonomous organizations (DAOs) + facilitate community-driven decision-making. +
  4. +
+

+
+
+

Building Blocks of SocialFi

+

+ SocialFi relies on several core components: +

    +
  1. + Monetization through Social Tokens: Creators can earn directly from their content. +
  2. +
  3. Censorship Resistance: Decentralized curation ensures freedom of speech.
  4. +
  5. Digital Ownership: NFTs provide secure ownership of digital assets.
  6. +
+

+
+
+
+
+ ); +}; + +export default AboutUs; diff --git a/apps/telegram-app/src/app/components/landing/DescriptionSection.tsx b/apps/telegram-app/src/app/components/landing/DescriptionSection.tsx new file mode 100644 index 00000000..76a000e6 --- /dev/null +++ b/apps/telegram-app/src/app/components/landing/DescriptionSection.tsx @@ -0,0 +1,132 @@ +'use client'; + +import {motion} from 'framer-motion'; + +import {Feature} from './Feature'; + +export function DescriptionSection() { + return ( +
+
+ +

+ Your social network +

+

+ A decentralized and open social network. Without ads, toxic algorithms, or censorship, + AlIgnedFamKernel grants you access to the social network that a genuinely free and + healthy society necessitates — and merits. +

+
+ + + + + + +
+
+
+ +

+ Absolute Freedom +

+
+ Freedom requires censorship resistance, and Nostr provides exactly that. +
+

+ Freedom requires censorship resistance, and Nostr provides exactly that. + AlIgnedFamKernel leverages Nostr’s decentralized and open social network to give you a + platform free from ads, toxic algorithms, and censorship. With Nostr, your social + interactions are safeguarded from any centralized control, ensuring your voice is + heard without interference. +

+
+ +
+
+ + +

+ Enhanced by StarkNet Account Abstraction +

+
+ Combining the power of Nostr with StarkNet’s account abstraction +
+

+ AlIgnedFamKernel offers an unparalleled user experience. StarkNet’s layer 2 scaling + solutions ensure smooth, cost-efficient transactions and interactions, while account + abstraction simplifies user authentication and management. +

+
+
+
+
+ ); +} diff --git a/apps/telegram-app/src/app/components/landing/Faq.tsx b/apps/telegram-app/src/app/components/landing/Faq.tsx new file mode 100644 index 00000000..4239c37c --- /dev/null +++ b/apps/telegram-app/src/app/components/landing/Faq.tsx @@ -0,0 +1,43 @@ +'use client'; + +import {FaqBar} from '../FaqBar'; + +export function Faq() { + return ( +
+

+ Frequently asked Questions +

+
+ + + + + + + {/* + + + */} +
+
+ ); +} diff --git a/apps/telegram-app/src/app/components/landing/Feature.tsx b/apps/telegram-app/src/app/components/landing/Feature.tsx new file mode 100644 index 00000000..f12ed080 --- /dev/null +++ b/apps/telegram-app/src/app/components/landing/Feature.tsx @@ -0,0 +1,13 @@ +type Props = {img: string; title: string; description: string}; + +export function Feature({img, title, description}: Props) { + return ( +
+
+ +
+

{title}

+

{description}

+
+ ); +} diff --git a/apps/telegram-app/src/app/components/landing/HeroSection.tsx b/apps/telegram-app/src/app/components/landing/HeroSection.tsx new file mode 100644 index 00000000..4902113b --- /dev/null +++ b/apps/telegram-app/src/app/components/landing/HeroSection.tsx @@ -0,0 +1,60 @@ +'use client'; + +import {motion} from 'framer-motion'; + +export function HeroSection() { + return ( +
+ + +

+ Step into a New Era of Social Networking +

+

+ Decentralized social built with Nostr and powered by Starknet account abstraction. +

+
+ + {/* */} +
+
+ +
+ ); +} diff --git a/apps/telegram-app/src/app/index.css b/apps/telegram-app/src/app/index.css new file mode 100644 index 00000000..ead98744 --- /dev/null +++ b/apps/telegram-app/src/app/index.css @@ -0,0 +1,18 @@ +@tailwind base; +@tailwind components; +@font-face { + font-family: "Droid Sans"; + src: url("../../public/DroidSans.ttf"); +} +@tailwind utilities; + +.gradient-text { + background: linear-gradient( + 93.36deg, + #4564a4 -4.11%, + #b3bfda 40.24%, + #ffffff 71.14% + ); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; +} diff --git a/apps/telegram-app/src/app/layout.tsx b/apps/telegram-app/src/app/layout.tsx new file mode 100644 index 00000000..b31911a8 --- /dev/null +++ b/apps/telegram-app/src/app/layout.tsx @@ -0,0 +1,19 @@ +import './index.css'; + +import type {Metadata} from 'next'; + +import Providers from './providers'; +export const metadata: Metadata = { + title: 'afk community portal', + description: 'afk community portal', +}; + +export default function RootLayout({children}: {children: React.ReactNode}) { + return ( + + + {children} + + + ); +} diff --git a/apps/telegram-app/src/app/page.tsx b/apps/telegram-app/src/app/page.tsx new file mode 100644 index 00000000..93ff4fb7 --- /dev/null +++ b/apps/telegram-app/src/app/page.tsx @@ -0,0 +1,25 @@ +import { Box, Text } from '@chakra-ui/react'; +import { Footer } from './components/Footer'; +import { Navbar } from './components/Navbar'; + +export default function App() { + return ( + + + + + + AFK telegram app coming soon + Stay tuned and follow us! + LFG + + +