From 5b3fe46ae1c28b83a3ebc7e3c2543586d0524e0f Mon Sep 17 00:00:00 2001 From: Nicode Date: Thu, 12 Dec 2024 06:35:54 +0100 Subject: [PATCH] Fix formatting (#345) * fix: nostr sdk formatting * fix: data backend formatting * fix: mobile formatting * fix: pwa formatting * fix: typos --- .github/workflows/config/typos.toml | 1 + .github/workflows/data-backend.yml | 2 +- .github/workflows/pwa.yml | 2 +- apps/data-backend/package.json | 4 +- apps/data-backend/src/index.ts | 22 ++-- .../data-backend/src/plugins/twitter-oauth.ts | 87 ++++++++------- .../src/routes/indexer/all-transactions.ts | 6 +- .../src/routes/indexer/buy-coin.ts | 4 +- .../src/routes/indexer/deploy-launch.ts | 10 +- .../src/routes/indexer/deploy-token.ts | 7 +- apps/data-backend/src/routes/indexer/graph.ts | 3 +- .../src/routes/indexer/holdings.ts | 5 +- apps/data-backend/src/routes/indexer/index.ts | 9 +- .../routes/indexer/nameservice/nameservice.ts | 9 +- .../src/routes/indexer/token_stats.ts | 4 +- .../src/routes/indexer/transactions.ts | 8 +- .../src/routes/indexer/unruggable/index.ts | 11 +- apps/data-backend/src/routes/otp/getOtp.ts | 27 +++-- apps/data-backend/src/routes/otp/verifyOtp.ts | 49 +++++---- .../src/routes/stripe/createPaymentIntent.ts | 12 +- .../src/routes/stripe/paymentSheet.ts | 12 +- .../src/services/auth/signature.service.ts | 3 - .../data-backend/src/services/telegram-app.ts | 20 ++-- .../src/services/twitter-client.ts | 16 +-- apps/indexer/src/name-claimed.ts | 8 +- apps/indexer/src/nameservice.ts | 8 +- apps/indexer/src/nameservice/claimed.ts | 8 +- apps/indexer/src/nameservice/renew.ts | 16 +-- .../src/components/AddLiquidityForm/index.tsx | 54 ++++----- .../src/components/AddLiquidityForm/styles.ts | 4 +- .../components/AddLiquidityForm/validation.ts | 9 +- apps/mobile/src/components/Filter/index.tsx | 6 +- .../components/LaunchActionsForm/index.tsx | 19 +++- .../components/LaunchActionsForm/styles.ts | 8 +- .../LaunchPad/TokenHolderDetail/styles.ts | 2 +- .../components/LaunchPad/TokenTx/index.tsx | 4 +- .../components/LaunchPad/TokenTx/styles.ts | 2 +- .../src/components/NameCard/nameCard.tsx | 62 +++++------ apps/mobile/src/components/NameCard/styles.ts | 22 ++-- .../mobile/src/components/NamesList/index.tsx | 20 ++-- .../mobile/src/components/NamesList/styles.ts | 4 +- apps/mobile/src/components/Navbar/index.tsx | 14 +-- apps/mobile/src/components/QR/ScanCode.tsx | 4 +- .../src/components/Starknet/CustomProfile.tsx | 47 ++++---- apps/mobile/src/components/Starknet/styles.ts | 9 +- .../src/components/search/TokenCard/index.tsx | 76 +++++++------ .../search/TokenLaunchCard/index.tsx | 55 +++++---- apps/mobile/src/context/TokenCreateModal.tsx | 17 ++- .../src/hooks/account/useInternalAccount.ts | 2 +- .../hooks/api/indexer/useMyTokensCreated.ts | 2 +- .../mobile/src/hooks/api/indexer/useTokens.ts | 2 +- .../src/hooks/launchpad/useAddLiquidity.ts | 16 +-- .../src/hooks/launchpad/useCreateToken.ts | 28 ++--- .../src/hooks/launchpad/useLaunchToken.ts | 8 +- .../mobile/src/hooks/modals/useTransaction.ts | 16 +-- .../src/hooks/nameservice/useNamesList.ts | 28 ++--- .../src/hooks/nameservice/useNameservice.ts | 48 ++++---- apps/mobile/src/hooks/unruggable/useDeploy.ts | 2 +- apps/mobile/src/hooks/useCombinedTokens.ts | 6 +- apps/mobile/src/modules/Auth/index.tsx | 9 +- .../src/modules/Cashu/HistoryTxCashu.tsx | 8 +- apps/mobile/src/modules/Cashu/SendEcash.tsx | 18 +-- apps/mobile/src/modules/Cashu/index.tsx | 16 ++- apps/mobile/src/modules/Cashu/styles.ts | 4 +- .../CashuWallet/components/History/index.tsx | 6 +- .../CashuWallet/components/Receive/styles.ts | 2 +- .../CashuWallet/components/Send/index.tsx | 14 ++- .../CashuWallet/components/Send/styles.ts | 4 +- .../CashuWallet/components/Settings/styles.ts | 2 +- .../LaunchTokenPump/FormLaunchToken.tsx | 2 +- .../FormLaunchTokenUnruggable.tsx | 2 +- .../src/modules/Lightning/LNWalletInfo.tsx | 5 +- apps/mobile/src/modules/Lightning/index.tsx | 4 +- apps/mobile/src/modules/Lightning/styles.ts | 2 +- apps/mobile/src/modules/Oauth/twitter.tsx | 18 +-- .../src/modules/Onboard/wallet/index.tsx | 6 +- apps/mobile/src/modules/PostCard/index.tsx | 2 +- apps/mobile/src/modules/Studio/index.tsx | 3 +- .../src/modules/TipModal/lightning/index.tsx | 28 +++-- .../src/modules/TipModal/starknet/form.tsx | 29 +++-- .../TokenCreatedModal/FormInstantiateKey.tsx | 20 ++-- .../src/modules/TransactionModal/index.tsx | 2 +- .../src/modules/TransactionModal/styles.ts | 2 +- .../src/modules/VideoPostCard/index.tsx | 2 +- .../src/modules/WalletModal/walletUtil.ts | 4 +- apps/mobile/src/modules/nameservice/form.tsx | 93 ++++++++-------- apps/mobile/src/modules/nameservice/index.tsx | 67 +++++------ apps/mobile/src/modules/nameservice/styles.ts | 30 ++--- apps/mobile/src/screens/Feed/index.tsx | 52 ++++----- apps/mobile/src/screens/Games/index.tsx | 28 ++--- .../mobile/src/screens/LaunchDetail/index.tsx | 43 ++++---- .../screens/Launchpad/LaunchpadComponent.tsx | 104 ++++++++---------- apps/mobile/src/screens/Launchpad/styles.ts | 4 +- .../Nameservice/LaunchpadComponent.tsx | 104 ++++++++---------- apps/mobile/src/screens/Nameservice/index.tsx | 2 +- apps/mobile/src/screens/Nameservice/styles.ts | 4 +- .../mobile/src/screens/Tips/TipsComponent.tsx | 70 ++++++------ apps/mobile/src/screens/TokenDetail/index.tsx | 45 ++++---- apps/mobile/src/screens/Whatever/index.tsx | 61 +++++----- apps/mobile/src/store/launchpad.ts | 12 +- apps/mobile/src/types/keys.ts | 4 +- apps/mobile/src/types/tab.ts | 16 +-- apps/mobile/src/utils/format.ts | 6 +- apps/pwa/package.json | 4 +- apps/pwa/src/theme/index.ts | 6 +- apps/pwa/src/types/index.ts | 2 +- onchain/cairo/launchpad/docs/launchpad.md | 2 +- .../launchpad/src/tests/liquidity_tests.cairo | 6 +- .../src/context/NostrContext.tsx | 1 + 109 files changed, 952 insertions(+), 997 deletions(-) diff --git a/.github/workflows/config/typos.toml b/.github/workflows/config/typos.toml index 61824aae..9859761e 100644 --- a/.github/workflows/config/typos.toml +++ b/.github/workflows/config/typos.toml @@ -1,5 +1,6 @@ [default.extend-words] ba = "ba" +frst = "frst" [files] extend-exclude = ["/**/patches/**", "/**/assets/**", "/**/src/config/**", "**/*.config.ts"] \ No newline at end of file diff --git a/.github/workflows/data-backend.yml b/.github/workflows/data-backend.yml index 403e4c34..f3157bfb 100644 --- a/.github/workflows/data-backend.yml +++ b/.github/workflows/data-backend.yml @@ -53,7 +53,7 @@ jobs: fi - name: Prettier Format Check - run: pnpm prettier:check + run: pnpm format:check - name: TypeScript Check run: pnpm ts:check diff --git a/.github/workflows/pwa.yml b/.github/workflows/pwa.yml index e1db6b42..fd0d94ae 100644 --- a/.github/workflows/pwa.yml +++ b/.github/workflows/pwa.yml @@ -53,7 +53,7 @@ jobs: fi - name: Prettier Format Check - run: pnpm prettier:check + run: pnpm format:check - name: Lint run: pnpm lint diff --git a/apps/data-backend/package.json b/apps/data-backend/package.json index d11bb3d3..90444e8e 100644 --- a/apps/data-backend/package.json +++ b/apps/data-backend/package.json @@ -16,8 +16,8 @@ "prisma:generate": "npx prisma generate", "prisma:push": "npx prisma db push", "prisma:setup": "npx prisma generate && npx prisma db pull", - "prettier": "prettier --write \"src/**/*.{ts,tsx}\"", - "prettier:check": "prettier --check \"src/**/*.{ts,tsx}\"", + "format": "prettier --write \"src/**/*.{ts,tsx}\"", + "format:check": "prettier --check \"src/**/*.{ts,tsx}\"", "ts:check": "tsc --noEmit" }, "keywords": [], diff --git a/apps/data-backend/src/index.ts b/apps/data-backend/src/index.ts index b9c489f5..740c9e09 100644 --- a/apps/data-backend/src/index.ts +++ b/apps/data-backend/src/index.ts @@ -14,7 +14,7 @@ import prismaPlugin from "./plugins/prisma"; import twitterPlugin from "./plugins/twitter-oauth"; import { launchBot } from "./services/telegram-app"; import declareRoutes from "./router"; -import fastifySession from '@fastify/session'; +import fastifySession from "@fastify/session"; import fastifyOauth2 from "@fastify/oauth2"; // Type declarations @@ -53,7 +53,7 @@ async function buildServer() { await fastify.register(authPlugin); // await fastify.register(twitterPlugin); await fastify.register(fastifyOauth2, { - name: 'twitterOAuth', + name: "twitterOAuth", credentials: { client: { id: process.env.TWITTER_API_KEY!, @@ -61,15 +61,15 @@ async function buildServer() { }, // auth: fastifyOauth2.TWITTER_CONFIGURATION, auth: { - authorizeHost: 'https://api.twitter.com', - authorizePath: '/oauth/authorize', - tokenHost: 'https://api.twitter.com', - tokenPath: '/oauth/access_token', - } + authorizeHost: "https://api.twitter.com", + authorizePath: "/oauth/authorize", + tokenHost: "https://api.twitter.com", + tokenPath: "/oauth/access_token", + }, }, - startRedirectPath: '/auth/login', + startRedirectPath: "/auth/login", callbackUri: process.env.TWITTER_CALLBACK_URL!, - }) + }); //Middleware to verify JWT const JWT_SECRET = config.jwt.secret; @@ -84,7 +84,7 @@ async function buildServer() { }); fastify.register(fastifySession, { - secret: JWT_SECRET ?? 'your-secret-key', + secret: JWT_SECRET ?? "your-secret-key", cookie: { secure: process.env.NODE_ENV == "production" ? true : false }, // Set to true in production }); @@ -92,7 +92,7 @@ async function buildServer() { // Auth // await fastify.register(authRoutes); // Indexer - await declareRoutes(fastify) + await declareRoutes(fastify); // Initialize WebSocket handlers fastify.ready((err) => { diff --git a/apps/data-backend/src/plugins/twitter-oauth.ts b/apps/data-backend/src/plugins/twitter-oauth.ts index 51a9db22..dd65b52a 100644 --- a/apps/data-backend/src/plugins/twitter-oauth.ts +++ b/apps/data-backend/src/plugins/twitter-oauth.ts @@ -1,50 +1,49 @@ -import fp from 'fastify-plugin'; -import fastifyOauth2 from '@fastify/oauth2'; +import fp from "fastify-plugin"; +import fastifyOauth2 from "@fastify/oauth2"; export default fp(async (fastify, opts) => { - // fastify.decorate("oauth2Twitter", - // { - // name: 'twitterOAuth', - // credentials: { - // client: { - // id: process.env.TWITTER_API_KEY!, - // secret: process.env.TWITTER_API_SECRET_KEY!, - // }, - // // auth: fastifyOauth2.TWITTER_CONFIGURATION, - // auth:{ - // authorizeHost: 'https://api.twitter.com', - // authorizePath: '/oauth/authorize', - // tokenHost: 'https://api.twitter.com', - // tokenPath: '/oauth/access_token', - // } - // }, - // startRedirectPath: '/auth/login', - // // callbackUri: process.env.TWITTER_CALLBACK_URL!, - // } - // ) - // fastify.register(fastifyOauth2, { - // name: 'twitterOAuth', - // credentials: { - // client: { - // id: process.env.TWITTER_API_KEY!, - // secret: process.env.TWITTER_API_SECRET_KEY!, - // }, - // // auth: fastifyOauth2.TWITTER_CONFIGURATION, - // auth:{ - // authorizeHost: 'https://api.twitter.com', - // authorizePath: '/oauth/authorize', - // tokenHost: 'https://api.twitter.com', - // tokenPath: '/oauth/access_token', - // } - // }, - // startRedirectPath: '/auth/login', - // // callbackUri: process.env.TWITTER_CALLBACK_URL!, - // }); + // fastify.decorate("oauth2Twitter", + // { + // name: 'twitterOAuth', + // credentials: { + // client: { + // id: process.env.TWITTER_API_KEY!, + // secret: process.env.TWITTER_API_SECRET_KEY!, + // }, + // // auth: fastifyOauth2.TWITTER_CONFIGURATION, + // auth:{ + // authorizeHost: 'https://api.twitter.com', + // authorizePath: '/oauth/authorize', + // tokenHost: 'https://api.twitter.com', + // tokenPath: '/oauth/access_token', + // } + // }, + // startRedirectPath: '/auth/login', + // // callbackUri: process.env.TWITTER_CALLBACK_URL!, + // } + // ) + // fastify.register(fastifyOauth2, { + // name: 'twitterOAuth', + // credentials: { + // client: { + // id: process.env.TWITTER_API_KEY!, + // secret: process.env.TWITTER_API_SECRET_KEY!, + // }, + // // auth: fastifyOauth2.TWITTER_CONFIGURATION, + // auth:{ + // authorizeHost: 'https://api.twitter.com', + // authorizePath: '/oauth/authorize', + // tokenHost: 'https://api.twitter.com', + // tokenPath: '/oauth/access_token', + // } + // }, + // startRedirectPath: '/auth/login', + // // callbackUri: process.env.TWITTER_CALLBACK_URL!, + // }); }); - declare module "fastify" { - interface FastifyInstance { - twitterOAuth: any; - } + interface FastifyInstance { + twitterOAuth: any; + } } diff --git a/apps/data-backend/src/routes/indexer/all-transactions.ts b/apps/data-backend/src/routes/indexer/all-transactions.ts index 92fc844b..3dc8f86f 100644 --- a/apps/data-backend/src/routes/indexer/all-transactions.ts +++ b/apps/data-backend/src/routes/indexer/all-transactions.ts @@ -1,7 +1,5 @@ import type { FastifyInstance, RouteOptions } from "fastify"; -import prisma from "indexer-prisma" -// import {prisma} from "indexer-prisma" - +import prisma from "indexer-prisma"; import { HTTPStatus } from "../../utils/http"; import { isValidStarknetAddress } from "../../utils/starknet"; @@ -42,7 +40,7 @@ async function allTransactionsRoute( transaction_type: true, created_at: true, quote_amount: true, - time_stamp:true, + time_stamp: true, }, }); diff --git a/apps/data-backend/src/routes/indexer/buy-coin.ts b/apps/data-backend/src/routes/indexer/buy-coin.ts index a7cafa88..721ffdc3 100644 --- a/apps/data-backend/src/routes/indexer/buy-coin.ts +++ b/apps/data-backend/src/routes/indexer/buy-coin.ts @@ -1,7 +1,5 @@ import type { FastifyInstance, RouteOptions } from "fastify"; -import prisma from "indexer-prisma" -// import {prisma} from "indexer-prisma" - +import prisma from "indexer-prisma"; import { HTTPStatus } from "../../utils/http"; async function buyCoinRoute(fastify: FastifyInstance, options: RouteOptions) { diff --git a/apps/data-backend/src/routes/indexer/deploy-launch.ts b/apps/data-backend/src/routes/indexer/deploy-launch.ts index c04668b3..d603c765 100644 --- a/apps/data-backend/src/routes/indexer/deploy-launch.ts +++ b/apps/data-backend/src/routes/indexer/deploy-launch.ts @@ -1,15 +1,14 @@ import type { FastifyInstance, RouteOptions } from "fastify"; -import prisma from "indexer-prisma" -// import {prisma} from "indexer-prisma" +import prisma from "indexer-prisma"; import { HTTPStatus } from "../../utils/http"; import { isValidStarknetAddress } from "../../utils/starknet"; interface DeployLaunchParams { launch: string; - owner_address?:string + owner_address?: string; } interface DeployLaunchByUserParams { - owner_address:string + owner_address: string; } async function deployLaunchRoute( fastify: FastifyInstance, @@ -122,9 +121,8 @@ async function deployLaunchRoute( } }); - // @TODO fix - + // fastify.get<{ // Params: DeployLaunchByUserParams; // }>("/deploy-launch/from/:user/", async (request, reply) => { diff --git a/apps/data-backend/src/routes/indexer/deploy-token.ts b/apps/data-backend/src/routes/indexer/deploy-token.ts index 236a5f74..718fedb0 100644 --- a/apps/data-backend/src/routes/indexer/deploy-token.ts +++ b/apps/data-backend/src/routes/indexer/deploy-token.ts @@ -1,7 +1,5 @@ import type { FastifyInstance, RouteOptions } from "fastify"; -import prisma from "indexer-prisma" -// import {prisma} from "indexer-prisma" - +import prisma from "indexer-prisma"; import { HTTPStatus } from "../../utils/http"; import { isValidStarknetAddress } from "../../utils/starknet"; @@ -90,7 +88,7 @@ async function deployTokenRoute( } const deploys = await prisma.token_deploy.findMany({ - where: { owner_address:owner_address }, + where: { owner_address: owner_address }, select: { memecoin_address: true, owner_address: true, @@ -112,7 +110,6 @@ async function deployTokenRoute( .send({ message: "Internal server error." }); } }); - } export default deployTokenRoute; diff --git a/apps/data-backend/src/routes/indexer/graph.ts b/apps/data-backend/src/routes/indexer/graph.ts index 476e33b0..fe99ae4c 100644 --- a/apps/data-backend/src/routes/indexer/graph.ts +++ b/apps/data-backend/src/routes/indexer/graph.ts @@ -1,6 +1,5 @@ import type { FastifyInstance, RouteOptions } from "fastify"; -import prisma from "indexer-prisma" -// import {prisma} from "indexer-prisma" +import prisma from "indexer-prisma"; import { HTTPStatus } from "../../utils/http"; import { isValidStarknetAddress } from "../../utils/starknet"; diff --git a/apps/data-backend/src/routes/indexer/holdings.ts b/apps/data-backend/src/routes/indexer/holdings.ts index c4e132cf..49559351 100644 --- a/apps/data-backend/src/routes/indexer/holdings.ts +++ b/apps/data-backend/src/routes/indexer/holdings.ts @@ -1,7 +1,5 @@ import type { FastifyInstance, RouteOptions } from "fastify"; -import prisma from "indexer-prisma" -// import {prisma} from "indexer-prisma" - +import prisma from "indexer-prisma"; import { HTTPStatus } from "../../utils/http"; import { isValidStarknetAddress } from "../../utils/starknet"; @@ -23,7 +21,6 @@ async function holdingsRoute(fastify: FastifyInstance, options: RouteOptions) { } try { - const distributions = await prisma.token_transactions.groupBy({ by: ["owner_address", "transaction_type"], // by: ["owner_address", "transaction_type"], // TODO add by tx type and sum sell and buy diff --git a/apps/data-backend/src/routes/indexer/index.ts b/apps/data-backend/src/routes/indexer/index.ts index 8f50ecd5..7f922fc2 100644 --- a/apps/data-backend/src/routes/indexer/index.ts +++ b/apps/data-backend/src/routes/indexer/index.ts @@ -1,8 +1,7 @@ import allTransactionsRoute from "./all-transactions"; import buyCoinRoute from "./buy-coin"; - -export const indexerRoutes = { - buyCoinRoute, - allTransactionsRoute -} \ No newline at end of file +export const indexerRoutes = { + buyCoinRoute, + allTransactionsRoute, +}; diff --git a/apps/data-backend/src/routes/indexer/nameservice/nameservice.ts b/apps/data-backend/src/routes/indexer/nameservice/nameservice.ts index 636e24f5..28a69db3 100644 --- a/apps/data-backend/src/routes/indexer/nameservice/nameservice.ts +++ b/apps/data-backend/src/routes/indexer/nameservice/nameservice.ts @@ -1,14 +1,17 @@ import type { FastifyInstance, RouteOptions } from "fastify"; -import prisma from "indexer-prisma" +import prisma from "indexer-prisma"; import { HTTPStatus } from "../../../utils/http"; import { isValidStarknetAddress } from "../../../utils/starknet"; interface NameserviceParams { username?: string; - owner_address?:string + owner_address?: string; } -async function nameserviceRoutes(fastify: FastifyInstance, options: RouteOptions) { +async function nameserviceRoutes( + fastify: FastifyInstance, + options: RouteOptions +) { fastify.get<{ Params: NameserviceParams; }>("/username-claimed", async (request, reply) => { diff --git a/apps/data-backend/src/routes/indexer/token_stats.ts b/apps/data-backend/src/routes/indexer/token_stats.ts index dff97084..d5147f21 100644 --- a/apps/data-backend/src/routes/indexer/token_stats.ts +++ b/apps/data-backend/src/routes/indexer/token_stats.ts @@ -1,7 +1,5 @@ import type { FastifyInstance, RouteOptions } from "fastify"; -import prisma from "indexer-prisma" -// import {prisma} from "indexer-prisma" - +import prisma from "indexer-prisma"; import { HTTPStatus } from "../../utils/http"; import { isValidStarknetAddress } from "../../utils/starknet"; diff --git a/apps/data-backend/src/routes/indexer/transactions.ts b/apps/data-backend/src/routes/indexer/transactions.ts index fcbe77db..d690991e 100644 --- a/apps/data-backend/src/routes/indexer/transactions.ts +++ b/apps/data-backend/src/routes/indexer/transactions.ts @@ -1,7 +1,5 @@ import type { FastifyInstance, RouteOptions } from "fastify"; -import prisma from "indexer-prisma" -// import {prisma} from "indexer-prisma" - +import prisma from "indexer-prisma"; import { HTTPStatus } from "../../utils/http"; import { isValidStarknetAddress } from "../../utils/starknet"; @@ -37,8 +35,8 @@ async function transactionsRoute( amount: true, quote_amount: true, price: true, - time_stamp:true, - liquidity_raised:true + time_stamp: true, + liquidity_raised: true, }, }); diff --git a/apps/data-backend/src/routes/indexer/unruggable/index.ts b/apps/data-backend/src/routes/indexer/unruggable/index.ts index f622962c..dff39496 100644 --- a/apps/data-backend/src/routes/indexer/unruggable/index.ts +++ b/apps/data-backend/src/routes/indexer/unruggable/index.ts @@ -1,5 +1,5 @@ import type { FastifyInstance, RouteOptions } from "fastify"; -import prisma from "indexer-prisma" +import prisma from "indexer-prisma"; import { HTTPStatus } from "../../../utils/http"; import { isValidStarknetAddress } from "../../../utils/starknet"; @@ -8,16 +8,12 @@ interface DeployLaunchParams { } // Routes for Unrug data of dashboard -async function unrugRoutes( - fastify: FastifyInstance, - options: RouteOptions -) { +async function unrugRoutes(fastify: FastifyInstance, options: RouteOptions) { fastify.get("/unrug/create-token", async (request, reply) => { try { const launches = await prisma.unrugmeme_deploy.findMany({ select: { memecoin_address: true, - }, }); @@ -84,7 +80,6 @@ async function unrugRoutes( }, select: { memecoin_address: true, - }, }); @@ -141,4 +136,4 @@ async function unrugRoutes( }); } -export default unrugRoutes; \ No newline at end of file +export default unrugRoutes; diff --git a/apps/data-backend/src/routes/otp/getOtp.ts b/apps/data-backend/src/routes/otp/getOtp.ts index 8a019cb1..39534b82 100644 --- a/apps/data-backend/src/routes/otp/getOtp.ts +++ b/apps/data-backend/src/routes/otp/getOtp.ts @@ -7,7 +7,10 @@ interface GetOtpRequestBody { nickname: string; } -async function getOtp(fastify: FastifyInstance, twilio_verification: VerificationListInstance) { +async function getOtp( + fastify: FastifyInstance, + twilio_verification: VerificationListInstance +) { fastify.post<{ Body: GetOtpRequestBody }>( "/get_otp", @@ -18,10 +21,10 @@ async function getOtp(fastify: FastifyInstance, twilio_verification: Verificatio required: ["phone_number", "nickname"], properties: { phone_number: { type: "string", pattern: "^\\+[1-9]\\d{1,14}$" }, - nickname: { type: "string", pattern: "^[A-Za-z]{1,20}$" } - } - } - } + nickname: { type: "string", pattern: "^[A-Za-z]{1,20}$" }, + }, + }, + }, }, async (request, reply) => { @@ -33,9 +36,9 @@ async function getOtp(fastify: FastifyInstance, twilio_verification: Verificatio const record_by_phone_number = await prisma.registration.findFirst({ where: { - phone_number: phone_number + phone_number: phone_number, }, - orderBy: { created_at: "desc" } + orderBy: { created_at: "desc" }, }); if (!record_by_phone_number) { @@ -43,14 +46,14 @@ async function getOtp(fastify: FastifyInstance, twilio_verification: Verificatio await prisma.registration.create({ data: { phone_number: phone_number, - nickname - } + nickname, + }, }); } catch (error: any) { fastify.log.error(error); if (error.code === "23505") { return reply.code(409).send({ - message: "A user with the given phone number already exists." + message: "A user with the given phone number already exists.", }); } return reply.code(500).send({ message: "Internal server error" }); @@ -59,12 +62,12 @@ async function getOtp(fastify: FastifyInstance, twilio_verification: Verificatio const send_msg_res = await twilio_verification.create({ to: phone_number, - channel: "sms" + channel: "sms", }); if (send_msg_res.status != "pending") { fastify.log.error("Error sending message to phone number"); return reply.code(500).send({ - message: "We are facing some issues. Please try again later" + message: "We are facing some issues. Please try again later", }); } diff --git a/apps/data-backend/src/routes/otp/verifyOtp.ts b/apps/data-backend/src/routes/otp/verifyOtp.ts index 7ca48006..be701cf2 100644 --- a/apps/data-backend/src/routes/otp/verifyOtp.ts +++ b/apps/data-backend/src/routes/otp/verifyOtp.ts @@ -1,7 +1,11 @@ import type { FastifyInstance } from "fastify"; import { type Account, addAddressPadding, uint256 } from "starknet"; import { VerificationCheckListInstance } from "twilio/lib/rest/verify/v2/service/verificationCheck"; -import { Entrypoint, SN_CHAIN_ID, VAULT_FACTORY_ADDRESSES } from "../../constants/contracts"; +import { + Entrypoint, + SN_CHAIN_ID, + VAULT_FACTORY_ADDRESSES, +} from "../../constants/contracts"; import { hashPhoneNumber } from "../../utils/format"; import { computeAddress } from "../../utils/address"; import { PrismaClient } from "@prisma/client"; @@ -27,20 +31,26 @@ async function verifyOtp( schema: { body: { type: "object", - required: ["phone_number", "public_key_x", "public_key_y", "sent_otp"], + required: [ + "phone_number", + "public_key_x", + "public_key_y", + "sent_otp", + ], properties: { phone_number: { type: "string", pattern: "^\\+[1-9]\\d{1,14}$" }, sent_otp: { type: "string", pattern: "^[0-9]{6}$" }, public_key_x: { type: "string", pattern: "^0x[0-9a-fA-F]+$" }, - public_key_y: { type: "string", pattern: "^0x[0-9a-fA-F]+$" } - } - } - } + public_key_y: { type: "string", pattern: "^0x[0-9a-fA-F]+$" }, + }, + }, + }, }, async (request, reply) => { try { - const { phone_number, sent_otp, public_key_x, public_key_y } = request.body; + const { phone_number, sent_otp, public_key_x, public_key_y } = + request.body; const prisma = new PrismaClient(); @@ -48,7 +58,7 @@ async function verifyOtp( const response = await twilio_verification .create({ to: phone_number, - code: sent_otp + code: sent_otp, }) .catch((error) => { fastify.log.error(error); @@ -58,21 +68,21 @@ async function verifyOtp( // The status of the verification. Can be: `pending`, `approved`, `canceled`, `max_attempts_reached`, `deleted`, `failed` or `expired`. if (response.status != "approved") { return reply.code(400).send({ - message: `Otp is ${response.status}.` + message: `Otp is ${response.status}.`, }); } // check if user is already registered const user = await prisma.registration.findFirst({ where: { - phone_number: phone_number - } + phone_number: phone_number, + }, }); // user is already registered if (user?.is_confirmed) { return reply.code(200).send({ - contract_address: user.contract_address + contract_address: user.contract_address, }); } @@ -82,9 +92,9 @@ async function verifyOtp( calldata: [ hashPhoneNumber(phone_number), uint256.bnToUint256(public_key_x), - uint256.bnToUint256(public_key_y) + uint256.bnToUint256(public_key_y), ], - entrypoint: Entrypoint.DEPLOY_ACCOUNT + entrypoint: Entrypoint.DEPLOY_ACCOUNT, }); const contractAddress = addAddressPadding(computeAddress(phone_number)); @@ -100,19 +110,20 @@ async function verifyOtp( if (!transaction_hash) { return reply.code(500).send({ - message: "Error in deploying smart contract. Please try again later" + message: + "Error in deploying smart contract. Please try again later", }); } // update the user record as confirmed and add the account address const userUpdated = await prisma.registration.update({ where: { - id: user?.id + id: user?.id, }, data: { is_confirmed: true, - contract_address: contractAddress - } + contract_address: contractAddress, + }, }); // await fastify.db // .update(registration) @@ -123,7 +134,7 @@ async function verifyOtp( // .where(eq(registration.phone_number, phone_number)) return reply.code(200).send({ - contract_address: contractAddress + contract_address: contractAddress, }); } catch (error) { console.log(error); diff --git a/apps/data-backend/src/routes/stripe/createPaymentIntent.ts b/apps/data-backend/src/routes/stripe/createPaymentIntent.ts index 6337375f..4a409eaa 100644 --- a/apps/data-backend/src/routes/stripe/createPaymentIntent.ts +++ b/apps/data-backend/src/routes/stripe/createPaymentIntent.ts @@ -19,10 +19,10 @@ async function createPaymentIntent(fastify: FastifyInstance) { required: ["currency", "amount"], properties: { currency: { type: "string", pattern: "^\\+[1-9]\\d{1,14}$" }, - amount: { type: "number" } - } - } - } + amount: { type: "number" }, + }, + }, + }, }, async (request, reply) => { @@ -32,11 +32,11 @@ async function createPaymentIntent(fastify: FastifyInstance) { const paymentIntent = await stripe.paymentIntents.create({ amount: 1000, // Example amount in smallest currency unit (cents) currency: currency, - payment_method_types: ["card"] + payment_method_types: ["card"], }); reply.send({ - clientSecret: paymentIntent.client_secret + clientSecret: paymentIntent.client_secret, }); return reply.code(200).send({ ok: true }); diff --git a/apps/data-backend/src/routes/stripe/paymentSheet.ts b/apps/data-backend/src/routes/stripe/paymentSheet.ts index 57aa475c..530371b7 100644 --- a/apps/data-backend/src/routes/stripe/paymentSheet.ts +++ b/apps/data-backend/src/routes/stripe/paymentSheet.ts @@ -19,10 +19,10 @@ async function paymentSheet(fastify: FastifyInstance) { required: ["currency", "amount"], properties: { currency: { type: "string", pattern: "^\\+[1-9]\\d{1,14}$" }, - amount: { type: "number" } - } - } - } + amount: { type: "number" }, + }, + }, + }, }, async (request, reply) => { @@ -41,7 +41,7 @@ async function paymentSheet(fastify: FastifyInstance) { const paymentIntent = await stripe.paymentIntents.create({ amount: 1000, // Example amount in smallest currency unit (cents) currency: currency, - payment_method_types: ["card"] + payment_method_types: ["card"], }); // reply.send({ @@ -51,7 +51,7 @@ async function paymentSheet(fastify: FastifyInstance) { return reply.code(200).send({ paymentIntent: paymentIntent.client_secret, ephemeralKey: ephemeralKey.secret, - customer: customer.id + customer: customer.id, }); // return reply.code(200).send({ ok: true }); diff --git a/apps/data-backend/src/services/auth/signature.service.ts b/apps/data-backend/src/services/auth/signature.service.ts index 0295f0c5..686a3fdd 100644 --- a/apps/data-backend/src/services/auth/signature.service.ts +++ b/apps/data-backend/src/services/auth/signature.service.ts @@ -36,9 +36,6 @@ export class SignatureService { s: BigInt(signature.s), } as WeierstrassSignatureType; - - - // Using dummy private key since we only need it for interface compatibility // This won't affect verification as we're only using public methods const dummyPrivateKey = "0x1"; diff --git a/apps/data-backend/src/services/telegram-app.ts b/apps/data-backend/src/services/telegram-app.ts index c927c75b..f6552c0e 100644 --- a/apps/data-backend/src/services/telegram-app.ts +++ b/apps/data-backend/src/services/telegram-app.ts @@ -4,8 +4,8 @@ const TELEGRAM_API_URL = `https://api.telegram.org/bot${process.env.TELEGRAM_BOT const WEB_APP_URL = process.env.TELEGRAM_WEB_APP ?? "https://lfg.afk-community.xyz"; // Replace with your web app's URL - -const MOBILE_APP_URL = process.env.TELEGRAM_MOBILE_APP ?? "https:/afk-community.xyz" +const MOBILE_APP_URL = + process.env.TELEGRAM_MOBILE_APP ?? "https:/afk-community.xyz"; // 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"; @@ -78,24 +78,24 @@ function listenToCommands(bot) { [ { text: "Start AFK", - web_app: { url: MOBILE_APP_URL ?? process.env.TELEGRAM_MOBILE_APP }, + web_app: { + url: MOBILE_APP_URL ?? process.env.TELEGRAM_MOBILE_APP, + }, }, ], ], }, }); } catch (error) { - console.log("Error", error) - + console.log("Error", error); } - }); // 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) { } + } catch (e) {} } /** @@ -157,7 +157,7 @@ function listenToMiniAppData(bot) { } }); } catch (e) { - console.log("Error listenMiniAppData", e) + console.log("Error listenMiniAppData", e); } } @@ -194,7 +194,7 @@ function listenToQueries(bot) { // Using context shortcut await ctx.answerInlineQuery(result); }); - } catch (e) { } + } catch (e) {} } /** * Listens to process stop events and performs a graceful bot stop @@ -207,7 +207,7 @@ function enableGracefulStop(bot) { // Enable graceful stop process.once("SIGINT", () => bot.stop("SIGINT")); process.once("SIGTERM", () => bot.stop("SIGTERM")); - } catch (e) { } + } catch (e) {} } /** diff --git a/apps/data-backend/src/services/twitter-client.ts b/apps/data-backend/src/services/twitter-client.ts index 182b59b2..d50afd6a 100644 --- a/apps/data-backend/src/services/twitter-client.ts +++ b/apps/data-backend/src/services/twitter-client.ts @@ -1,5 +1,5 @@ -import { TwitterApi } from 'twitter-api-v2'; -import axios from 'axios'; +import { TwitterApi } from "twitter-api-v2"; +import axios from "axios"; export const getTwitterClient = (accessToken: string, accessSecret: string) => { return new TwitterApi({ @@ -10,22 +10,22 @@ export const getTwitterClient = (accessToken: string, accessSecret: string) => { }); }; - - export const getRequestToken = async () => { const response = await axios.post( - 'https://api.twitter.com/oauth/request_token', + "https://api.twitter.com/oauth/request_token", null, { headers: { - Authorization: `OAuth oauth_consumer_key="${process.env.TWITTER_API_KEY!}", oauth_signature="${process.env.TWITTER_API_SECRET_KEY!}&"`, + Authorization: `OAuth oauth_consumer_key="${process.env + .TWITTER_API_KEY!}", oauth_signature="${process.env + .TWITTER_API_SECRET_KEY!}&"`, }, } ); const params = new URLSearchParams(response.data); return { - oauthToken: params.get('oauth_token'), - oauthTokenSecret: params.get('oauth_token_secret'), + oauthToken: params.get("oauth_token"), + oauthTokenSecret: params.get("oauth_token_secret"), }; }; diff --git a/apps/indexer/src/name-claimed.ts b/apps/indexer/src/name-claimed.ts index 3df9da0b..bf9276fa 100644 --- a/apps/indexer/src/name-claimed.ts +++ b/apps/indexer/src/name-claimed.ts @@ -1,5 +1,5 @@ -import { Block, DECIMALS, hash, uint256, Pool, formatUnits } from "./deps.ts"; -import { STARTING_BLOCK, NAMESERVICE_ADDRESS } from "./constants.ts"; +import {Block, DECIMALS, formatUnits, hash, Pool, uint256} from "./deps.ts"; +import {NAMESERVICE_ADDRESS, STARTING_BLOCK} from "./constants.ts"; const ConnectionString = Deno.env.get("POSTGRES_CONNECTION_STRING")!; const pool = new Pool(ConnectionString, 1, true); @@ -80,7 +80,7 @@ export default function DecodeUsernameClaimed({ header, events }: Block) { // memecoin_address: token_address, // caller: caller, // }); - const amount_paid_formated = formatUnits(paid_amount, DECIMALS).toString(); + const amount_paid_formatted = formatUnits(paid_amount, DECIMALS).toString(); return { network: "starknet-sepolia", @@ -92,7 +92,7 @@ export default function DecodeUsernameClaimed({ header, events }: Block) { name: username, username: username, expiry: expiry, - paid:amount_paid_formated, + paid:amount_paid_formatted, quote_token:quote_token, created_at: new Date().toISOString(), }; diff --git a/apps/indexer/src/nameservice.ts b/apps/indexer/src/nameservice.ts index 3df9da0b..bf9276fa 100644 --- a/apps/indexer/src/nameservice.ts +++ b/apps/indexer/src/nameservice.ts @@ -1,5 +1,5 @@ -import { Block, DECIMALS, hash, uint256, Pool, formatUnits } from "./deps.ts"; -import { STARTING_BLOCK, NAMESERVICE_ADDRESS } from "./constants.ts"; +import {Block, DECIMALS, formatUnits, hash, Pool, uint256} from "./deps.ts"; +import {NAMESERVICE_ADDRESS, STARTING_BLOCK} from "./constants.ts"; const ConnectionString = Deno.env.get("POSTGRES_CONNECTION_STRING")!; const pool = new Pool(ConnectionString, 1, true); @@ -80,7 +80,7 @@ export default function DecodeUsernameClaimed({ header, events }: Block) { // memecoin_address: token_address, // caller: caller, // }); - const amount_paid_formated = formatUnits(paid_amount, DECIMALS).toString(); + const amount_paid_formatted = formatUnits(paid_amount, DECIMALS).toString(); return { network: "starknet-sepolia", @@ -92,7 +92,7 @@ export default function DecodeUsernameClaimed({ header, events }: Block) { name: username, username: username, expiry: expiry, - paid:amount_paid_formated, + paid:amount_paid_formatted, quote_token:quote_token, created_at: new Date().toISOString(), }; diff --git a/apps/indexer/src/nameservice/claimed.ts b/apps/indexer/src/nameservice/claimed.ts index ef808ad9..36465442 100644 --- a/apps/indexer/src/nameservice/claimed.ts +++ b/apps/indexer/src/nameservice/claimed.ts @@ -1,5 +1,5 @@ -import { Block, DECIMALS, hash, uint256, Pool, formatUnits } from "../deps.ts"; -import { STARTING_BLOCK, NAMESERVICE_ADDRESS } from "../constants.ts"; +import {Block, DECIMALS, formatUnits, hash, Pool, uint256} from "../deps.ts"; +import {NAMESERVICE_ADDRESS, STARTING_BLOCK} from "../constants.ts"; const ConnectionString = Deno.env.get("POSTGRES_CONNECTION_STRING")!; const pool = new Pool(ConnectionString, 1, true); @@ -80,7 +80,7 @@ export default function DecodeUsernameClaimed({ header, events }: Block) { // memecoin_address: token_address, // caller: caller, // }); - const amount_paid_formated = formatUnits(paid_amount, DECIMALS).toString(); + const amount_paid_formatted = formatUnits(paid_amount, DECIMALS).toString(); return { network: "starknet-sepolia", @@ -92,7 +92,7 @@ export default function DecodeUsernameClaimed({ header, events }: Block) { name: username, username: username, expiry: expiry, - paid:amount_paid_formated, + paid:amount_paid_formatted, quote_token:quote_token, created_at: new Date().toISOString(), }; diff --git a/apps/indexer/src/nameservice/renew.ts b/apps/indexer/src/nameservice/renew.ts index b12a0292..56af036c 100644 --- a/apps/indexer/src/nameservice/renew.ts +++ b/apps/indexer/src/nameservice/renew.ts @@ -1,13 +1,5 @@ -import { NAMESERVICE_ADDRESS, STARTING_BLOCK } from "../constants.js"; -import { - Block, - DECIMALS, - formatUnits, - hash, - uint256, - shortString, - Pool, -} from "../deps.js"; +import {NAMESERVICE_ADDRESS, STARTING_BLOCK} from "../constants.js"; +import {Block, DECIMALS, formatUnits, hash, Pool, uint256,} from "../deps.js"; const ConnectionString = Deno.env.get("POSTGRES_CONNECTION_STRING")!; const pool = new Pool(ConnectionString, 1, true); @@ -88,7 +80,7 @@ export default function DecodeUsernameClaimed({ header, events }: Block) { // memecoin_address: token_address, // caller: caller, // }); - const amount_paid_formated = formatUnits(paid_amount, DECIMALS).toString(); + const amount_paid_formatted = formatUnits(paid_amount, DECIMALS).toString(); return { network: "starknet-sepolia", @@ -100,7 +92,7 @@ export default function DecodeUsernameClaimed({ header, events }: Block) { name: username, username: username, expiry: expiry, - paid:amount_paid_formated, + paid:amount_paid_formatted, created_at: new Date().toISOString(), }; }); diff --git a/apps/mobile/src/components/AddLiquidityForm/index.tsx b/apps/mobile/src/components/AddLiquidityForm/index.tsx index 6a19d39d..7d5f8a1c 100644 --- a/apps/mobile/src/components/AddLiquidityForm/index.tsx +++ b/apps/mobile/src/components/AddLiquidityForm/index.tsx @@ -7,8 +7,8 @@ import {useToast, useWalletModal} from '../../hooks/modals'; import {AddLiquidityValidationSchema} from './validation'; import stylesheet from './styles'; -import { useState } from 'react'; -import { useAddLiquidity } from '../../hooks/launchpad/useAddLiquidity'; +import {useState} from 'react'; +import {useAddLiquidity} from '../../hooks/launchpad/useAddLiquidity'; type FormValues = { amount: string; @@ -47,7 +47,7 @@ export const AddLiquidityForm: React.FC<{ liquidityType: 'EKUBO_NFT', unlockTime: '', teamVestingPeriod: '0', - teamVestingCliff: '0' + teamVestingCliff: '0', }; const onSubmit = async (values: FormValues) => { @@ -70,23 +70,18 @@ export const AddLiquidityForm: React.FC<{ tokenAddress, values.amount, values.startingPrice!, - values.liquidityLockTime! + values.liquidityLockTime!, ); break; case 'EKUBO': - await addLiquidityEkubo( - account.account, - tokenAddress, - values.amount, - values.ekuboPrice! - ); + await addLiquidityEkubo(account.account, tokenAddress, values.amount, values.ekuboPrice!); break; case 'JEDISWAP': await addLiquidityJediswap( account.account, tokenAddress, values.amount, - values.minLiquidity! + values.minLiquidity!, ); break; } @@ -97,14 +92,19 @@ export const AddLiquidityForm: React.FC<{ showToast({ type: 'error', title: 'Failed to add liquidity', - }); } finally { setIsLoading(false); } }; - const renderDexFields = (values: FormValues, handleChange: any, handleBlur: any, errors: any, touched: any) => { + const renderDexFields = ( + values: FormValues, + handleChange: any, + handleBlur: any, + errors: any, + touched: any, + ) => { switch (values.dexType) { case 'UNRUGGABLE': return ( @@ -248,7 +248,7 @@ export const AddLiquidityForm: React.FC<{ }; return ( - ( @@ -290,21 +289,16 @@ export const AddLiquidityForm: React.FC<{ value={values.amount} keyboardType="decimal-pad" /> - {touched.amount && errors.amount && ( - {errors.amount} - )} + {touched.amount && errors.amount && {errors.amount}} {renderDexFields(values, handleChange, handleBlur, errors, touched)} - )} ); -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/components/AddLiquidityForm/styles.ts b/apps/mobile/src/components/AddLiquidityForm/styles.ts index 461016e0..9a1107df 100644 --- a/apps/mobile/src/components/AddLiquidityForm/styles.ts +++ b/apps/mobile/src/components/AddLiquidityForm/styles.ts @@ -55,5 +55,5 @@ export default ThemedStyleSheet((theme) => ({ justifyContent: 'center', alignItems: 'center', backgroundColor: theme.colors.overlay, - } -})); \ No newline at end of file + }, +})); diff --git a/apps/mobile/src/components/AddLiquidityForm/validation.ts b/apps/mobile/src/components/AddLiquidityForm/validation.ts index f56e365b..c7fbaea6 100644 --- a/apps/mobile/src/components/AddLiquidityForm/validation.ts +++ b/apps/mobile/src/components/AddLiquidityForm/validation.ts @@ -15,14 +15,13 @@ export type ValidationErrors = { export const validateAddLiquidity = (values: any): ValidationErrors => { const errors: ValidationErrors = {}; - if (!values.amount) { errors.amount = 'Amount is required'; } else if (!/^\d*\.?\d*$/.test(values.amount)) { errors.amount = 'Must be a valid number'; } - // DEX type validation + // DEX type validation if (!values.dexType) { errors.dexType = 'DEX type is required'; } else if (!['UNRUGGABLE', 'EKUBO', 'JEDISWAP'].includes(values.dexType)) { @@ -34,7 +33,7 @@ export const validateAddLiquidity = (values: any): ValidationErrors => { if (!values.startingPrice) { errors.startingPrice = 'Starting price is required'; } - + if (!values.teamAllocation) { errors.teamAllocation = 'Team allocation is required'; } else { @@ -54,7 +53,5 @@ export const validateAddLiquidity = (values: any): ValidationErrors => { } } - - return errors; -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/components/Filter/index.tsx b/apps/mobile/src/components/Filter/index.tsx index bc1b3fef..5358da37 100644 --- a/apps/mobile/src/components/Filter/index.tsx +++ b/apps/mobile/src/components/Filter/index.tsx @@ -29,9 +29,9 @@ const NDK_KIND_OPTIONS = [ {label: 'Group Chat', value: NDKKind.GroupChat}, {label: 'Channel Message', value: NDKKind.ChannelMessage}, {label: 'Metadata', value: NDKKind.Metadata}, - {label: 'Stream', value:30311 }, - {label: 'Video', value:NDKKind.HorizontalVideo }, - {label: 'Video shorts', value:NDKKind.VerticalVideo }, + {label: 'Stream', value: 30311}, + {label: 'Video', value: NDKKind.HorizontalVideo}, + {label: 'Video shorts', value: NDKKind.VerticalVideo}, ]; // const SORT_OPTIONS = [ diff --git a/apps/mobile/src/components/LaunchActionsForm/index.tsx b/apps/mobile/src/components/LaunchActionsForm/index.tsx index b32ee95f..b02fc18f 100644 --- a/apps/mobile/src/components/LaunchActionsForm/index.tsx +++ b/apps/mobile/src/components/LaunchActionsForm/index.tsx @@ -77,13 +77,21 @@ export const LaunchActionsForm: React.FC = ({ @@ -106,7 +114,7 @@ export const LaunchActionsForm: React.FC = ({ ) : ( - )} diff --git a/apps/mobile/src/components/LaunchActionsForm/styles.ts b/apps/mobile/src/components/LaunchActionsForm/styles.ts index 82ca8f23..14d43d26 100644 --- a/apps/mobile/src/components/LaunchActionsForm/styles.ts +++ b/apps/mobile/src/components/LaunchActionsForm/styles.ts @@ -34,16 +34,16 @@ export default ThemedStyleSheet((theme) => ({ borderRadius: 8, }, buttonSell: { - backgroundColor:theme.colors.red + backgroundColor: theme.colors.red, }, buttonBuy: { - backgroundColor:theme.colors.green + backgroundColor: theme.colors.green, }, activeToggle: { // backgroundColor: theme.colors.primary, borderColor: theme.colors.blue, - color:theme.colors.badge, - border:theme.colors.badgeBorder + color: theme.colors.badge, + border: theme.colors.badgeBorder, }, inputContainer: { gap: Spacing.xsmall, diff --git a/apps/mobile/src/components/LaunchPad/TokenHolderDetail/styles.ts b/apps/mobile/src/components/LaunchPad/TokenHolderDetail/styles.ts index cd9f3682..4cf115f8 100644 --- a/apps/mobile/src/components/LaunchPad/TokenHolderDetail/styles.ts +++ b/apps/mobile/src/components/LaunchPad/TokenHolderDetail/styles.ts @@ -41,5 +41,5 @@ export default ThemedStyleSheet((theme) => ({ emptyText: { color: theme.colors.textSecondary, textAlign: 'center', - } + }, })); diff --git a/apps/mobile/src/components/LaunchPad/TokenTx/index.tsx b/apps/mobile/src/components/LaunchPad/TokenTx/index.tsx index e3fb5977..d05290ca 100644 --- a/apps/mobile/src/components/LaunchPad/TokenTx/index.tsx +++ b/apps/mobile/src/components/LaunchPad/TokenTx/index.tsx @@ -18,7 +18,7 @@ export const TokenTx: React.FC = ({tx, loading}) => { return ; } - console.log("tx", tx) + console.log('tx', tx); return ( = ({tx, loading}) => { Liquidity raised at this moment {item?.liquidity_raised} - - )} diff --git a/apps/mobile/src/components/LaunchPad/TokenTx/styles.ts b/apps/mobile/src/components/LaunchPad/TokenTx/styles.ts index 25177750..9409d5f6 100644 --- a/apps/mobile/src/components/LaunchPad/TokenTx/styles.ts +++ b/apps/mobile/src/components/LaunchPad/TokenTx/styles.ts @@ -57,5 +57,5 @@ export default ThemedStyleSheet((theme) => ({ emptyText: { color: theme.colors.textSecondary, textAlign: 'center', - } + }, })); diff --git a/apps/mobile/src/components/NameCard/nameCard.tsx b/apps/mobile/src/components/NameCard/nameCard.tsx index 81ed74c0..b2dc987c 100644 --- a/apps/mobile/src/components/NameCard/nameCard.tsx +++ b/apps/mobile/src/components/NameCard/nameCard.tsx @@ -1,37 +1,35 @@ -import { useStyles } from "../../hooks"; -import { View, Text } from "react-native"; -import stylesheet from "./styles"; +import {useStyles} from '../../hooks'; +import {View, Text} from 'react-native'; +import stylesheet from './styles'; interface NameCardProps { - name: string; - owner: string; - expiryTime: Date; - } - - export const NameCard: React.FC = ({ name, owner, expiryTime }) => { - const styles = useStyles(stylesheet); - - return ( - - - {name} - - - - Owner: - - {owner.slice(0, 6)}...{owner.slice(-4)} - - - - - Expires: - - {new Date(expiryTime).toLocaleDateString()} - - + name: string; + owner: string; + expiryTime: Date; +} + +export const NameCard: React.FC = ({name, owner, expiryTime}) => { + const styles = useStyles(stylesheet); + + return ( + + + {name} + + + + Owner: + + {owner.slice(0, 6)}...{owner.slice(-4)} + + + + + Expires: + {new Date(expiryTime).toLocaleDateString()} - ); - }; \ No newline at end of file + + ); +}; diff --git a/apps/mobile/src/components/NameCard/styles.ts b/apps/mobile/src/components/NameCard/styles.ts index d583d3d6..f0d33a46 100644 --- a/apps/mobile/src/components/NameCard/styles.ts +++ b/apps/mobile/src/components/NameCard/styles.ts @@ -1,4 +1,4 @@ -import { ThemedStyleSheet, Spacing } from '../../styles'; +import {ThemedStyleSheet, Spacing} from '../../styles'; export default ThemedStyleSheet((theme) => ({ card: { @@ -9,12 +9,12 @@ export default ThemedStyleSheet((theme) => ({ borderWidth: 1, borderColor: `${theme.colors.primary}20`, shadowColor: theme.colors.primary, - shadowOffset: { width: 0, height: 8 }, + shadowOffset: {width: 0, height: 8}, shadowOpacity: 0.15, shadowRadius: 24, elevation: 8, }, - + innerContainer: { backgroundColor: `${theme.colors.background}80`, borderRadius: 16, @@ -22,7 +22,7 @@ export default ThemedStyleSheet((theme) => ({ borderWidth: 1, borderColor: `${theme.colors.primary}10`, }, - + nameText: { fontSize: 28, fontWeight: '700', @@ -30,30 +30,30 @@ export default ThemedStyleSheet((theme) => ({ marginBottom: Spacing.medium, letterSpacing: 0.5, }, - + detailsContainer: { marginTop: Spacing.medium, gap: Spacing.small, }, - + ownerContainer: { flexDirection: 'row', alignItems: 'center', gap: Spacing.small, }, - + label: { fontSize: 14, color: theme.colors.white, fontWeight: '600', }, - + value: { fontSize: 14, color: theme.colors.white, opacity: 0.8, }, - + expiryContainer: { marginTop: Spacing.medium, backgroundColor: `${theme.colors.primary}10`, @@ -64,5 +64,5 @@ export default ThemedStyleSheet((theme) => ({ flexDirection: 'row', alignItems: 'center', gap: Spacing.small, - } -})); \ No newline at end of file + }, +})); diff --git a/apps/mobile/src/components/NamesList/index.tsx b/apps/mobile/src/components/NamesList/index.tsx index ddb7bf97..eec45984 100644 --- a/apps/mobile/src/components/NamesList/index.tsx +++ b/apps/mobile/src/components/NamesList/index.tsx @@ -1,6 +1,6 @@ -import { View, FlatList, ActivityIndicator } from 'react-native'; -import { NameCard } from '../NameCard/nameCard'; -import { useStyles } from '../../hooks'; +import {View, FlatList, ActivityIndicator} from 'react-native'; +import {NameCard} from '../NameCard/nameCard'; +import {useStyles} from '../../hooks'; import stylesheet from './styles'; interface Name { @@ -14,7 +14,7 @@ interface NamesListProps { isLoading?: boolean; } -export const NamesList: React.FC = ({ names, isLoading }) => { +export const NamesList: React.FC = ({names, isLoading}) => { const styles = useStyles(stylesheet); if (isLoading) { @@ -29,16 +29,12 @@ export const NamesList: React.FC = ({ names, isLoading }) => { ( - + renderItem={({item}) => ( + )} - keyExtractor={item => item.name} + keyExtractor={(item) => item.name} contentContainerStyle={styles.list} /> ); -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/components/NamesList/styles.ts b/apps/mobile/src/components/NamesList/styles.ts index 26ba29dc..b178decb 100644 --- a/apps/mobile/src/components/NamesList/styles.ts +++ b/apps/mobile/src/components/NamesList/styles.ts @@ -1,4 +1,4 @@ -import { ThemedStyleSheet, Spacing } from '../../styles'; +import {ThemedStyleSheet, Spacing} from '../../styles'; export default ThemedStyleSheet((theme) => ({ container: { @@ -26,4 +26,4 @@ export default ThemedStyleSheet((theme) => ({ textAlign: 'center', marginTop: Spacing.medium, }, -})); \ No newline at end of file +})); diff --git a/apps/mobile/src/components/Navbar/index.tsx b/apps/mobile/src/components/Navbar/index.tsx index f11c3e6c..ef3e569e 100644 --- a/apps/mobile/src/components/Navbar/index.tsx +++ b/apps/mobile/src/components/Navbar/index.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; -import { Image, Text, TouchableOpacity, View } from 'react-native'; +import {Image, Text, TouchableOpacity, View} from 'react-native'; -import { useStyles, useWindowDimensions } from '../../hooks'; -import { Icon } from '../Icon'; +import {useStyles, useWindowDimensions} from '../../hooks'; +import {Icon} from '../Icon'; import stylesheet from './styles'; import CustomProfileMenu from '../Starknet/CustomProfile'; interface CustomHeaderInterface { @@ -10,7 +10,7 @@ interface CustomHeaderInterface { navigation?: any; showLogo?: boolean; } -export const Navbar = ({ title, navigation, showLogo }: CustomHeaderInterface) => { +export const Navbar = ({title, navigation, showLogo}: CustomHeaderInterface) => { const styles = useStyles(stylesheet); const dimensions = useWindowDimensions(); const isDesktop = React.useMemo(() => { @@ -22,10 +22,10 @@ export const Navbar = ({ title, navigation, showLogo }: CustomHeaderInterface) = {showLogo && ( - {title} diff --git a/apps/mobile/src/components/QR/ScanCode.tsx b/apps/mobile/src/components/QR/ScanCode.tsx index 38bb42f4..9cc5ea5f 100644 --- a/apps/mobile/src/components/QR/ScanCode.tsx +++ b/apps/mobile/src/components/QR/ScanCode.tsx @@ -384,8 +384,8 @@ export const ScanQRCode: React.FC = ({onClose, onSuccess}) {isProcessing ? 'Processing...' : scannedData?.toLowerCase().startsWith('lnbc') - ? 'Pay' - : 'Receive'} + ? 'Pay' + : 'Receive'} diff --git a/apps/mobile/src/components/Starknet/CustomProfile.tsx b/apps/mobile/src/components/Starknet/CustomProfile.tsx index ba747f30..6475441c 100644 --- a/apps/mobile/src/components/Starknet/CustomProfile.tsx +++ b/apps/mobile/src/components/Starknet/CustomProfile.tsx @@ -1,14 +1,14 @@ // CustomProfileMenu.tsx -import React, { useState } from 'react'; -import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; -import stylesheet from "./styles" -import { useStyles } from '../../hooks'; -import { useAccount } from '@starknet-react/core'; -import { useNavigation } from '@react-navigation/native'; -import { MainStackNavigationProps } from '../../types'; -import { useWalletModal } from '../../hooks/modals'; +import React, {useState} from 'react'; +import {View, Text, StyleSheet, TouchableOpacity} from 'react-native'; +import stylesheet from './styles'; +import {useStyles} from '../../hooks'; +import {useAccount} from '@starknet-react/core'; +import {useNavigation} from '@react-navigation/native'; +import {MainStackNavigationProps} from '../../types'; +import {useWalletModal} from '../../hooks/modals'; const CustomProfileMenu = () => { - const account = useAccount() + const account = useAccount(); const walletModal = useWalletModal(); @@ -26,42 +26,33 @@ const CustomProfileMenu = () => { } }; - const navigation = useNavigation() - const styles = useStyles(stylesheet) + const navigation = useNavigation(); + const styles = useStyles(stylesheet); return ( Profile - {account?.address && + {account?.address && ( Connected - } - {!account?.address && + + )} + {!account?.address && ( onConnect()}> Help - } - + )} {isOpen && ( - - - - navigation.push("Settings") - }> - + navigation.push('Settings')}> Account Settings - - navigation.push("Settings") - - - }> + navigation.push('Settings')}> Log Out {/* alert('Help')}> @@ -73,4 +64,4 @@ const CustomProfileMenu = () => { ); }; -export default CustomProfileMenu; \ No newline at end of file +export default CustomProfileMenu; diff --git a/apps/mobile/src/components/Starknet/styles.ts b/apps/mobile/src/components/Starknet/styles.ts index a108a8ff..2e116d33 100644 --- a/apps/mobile/src/components/Starknet/styles.ts +++ b/apps/mobile/src/components/Starknet/styles.ts @@ -1,5 +1,4 @@ -import { Spacing, ThemedStyleSheet, Typography } from "../../styles"; - +import {Spacing, ThemedStyleSheet, Typography} from '../../styles'; export default ThemedStyleSheet((theme) => ({ // container: { @@ -17,7 +16,7 @@ export default ThemedStyleSheet((theme) => ({ }, profileButton: { // backgroundColor: '#6200ea', - backgroundColor:theme.colors.background, + backgroundColor: theme.colors.background, paddingVertical: 10, paddingHorizontal: 20, borderRadius: 5, @@ -34,7 +33,7 @@ export default ThemedStyleSheet((theme) => ({ backgroundColor: '#fff', borderRadius: 5, shadowColor: '#000', - shadowOffset: { width: 0, height: 2 }, + shadowOffset: {width: 0, height: 2}, shadowOpacity: 0.3, shadowRadius: 5, elevation: 5, @@ -45,7 +44,7 @@ export default ThemedStyleSheet((theme) => ({ borderBottomColor: '#ddd', fontSize: 16, }, - + content: { flex: 1, borderRadius: 999, diff --git a/apps/mobile/src/components/search/TokenCard/index.tsx b/apps/mobile/src/components/search/TokenCard/index.tsx index 1e0f5487..0393e4d9 100644 --- a/apps/mobile/src/components/search/TokenCard/index.tsx +++ b/apps/mobile/src/components/search/TokenCard/index.tsx @@ -1,22 +1,22 @@ -import { NDKEvent, NDKUserProfile } from '@nostr-dev-kit/ndk'; -import { useNavigation } from '@react-navigation/native'; -import { useAccount } from '@starknet-react/core'; -import { useProfile } from 'afk_nostr_sdk'; +import {NDKEvent, NDKUserProfile} from '@nostr-dev-kit/ndk'; +import {useNavigation} from '@react-navigation/native'; +import {useAccount} from '@starknet-react/core'; +import {useProfile} from 'afk_nostr_sdk'; import * as Clipboard from 'expo-clipboard'; -import { ImageSourcePropType, TouchableOpacity, View } from 'react-native'; +import {ImageSourcePropType, TouchableOpacity, View} from 'react-native'; -import { CopyIconStack } from '../../../assets/icons'; -import { useStyles, useTheme } from '../../../hooks'; -import { useToast } from '../../../hooks/modals'; -import { MainStackNavigationProps } from '../../../types'; -import { TokenDeployInterface, TokenLaunchInterface } from '../../../types/keys'; -import { feltToAddress } from '../../../utils/format'; -import { Button } from '../..'; -import { Text } from '../../Text'; +import {CopyIconStack} from '../../../assets/icons'; +import {useStyles, useTheme} from '../../../hooks'; +import {useToast} from '../../../hooks/modals'; +import {MainStackNavigationProps} from '../../../types'; +import {TokenDeployInterface, TokenLaunchInterface} from '../../../types/keys'; +import {feltToAddress} from '../../../utils/format'; +import {Button} from '../..'; +import {Text} from '../../Text'; import stylesheet from './styles'; -import { useLaunchToken } from '../../../hooks/launchpad/useLaunchToken'; -import { AddLiquidityForm } from '../../AddLiquidityForm'; -import { useModal } from '../../../hooks/modals/useModal'; +import {useLaunchToken} from '../../../hooks/launchpad/useLaunchToken'; +import {AddLiquidityForm} from '../../AddLiquidityForm'; +import {useModal} from '../../../hooks/modals/useModal'; export type LaunchCoinProps = { imageProps?: ImageSourcePropType; @@ -27,7 +27,7 @@ export type LaunchCoinProps = { dataMeged?: LaunchCoinProps; launch?: TokenLaunchInterface; isViewDetailDisabled?: boolean; - isTokenOnly?: boolean + isTokenOnly?: boolean; }; enum AmountType { @@ -43,22 +43,22 @@ export const TokenCard: React.FC = ({ profileProps, event, isViewDetailDisabled, - isTokenOnly + isTokenOnly, }) => { - const { data: profile } = useProfile({ publicKey: event?.pubkey }); + const {data: profile} = useProfile({publicKey: event?.pubkey}); const {account} = useAccount(); - const { showToast } = useToast(); - const { theme } = useTheme(); + const {showToast} = useToast(); + const {theme} = useTheme(); const styles = useStyles(stylesheet); const navigation = useNavigation(); - const { handleLaunchCoin } = useLaunchToken() - const { show: showModal } = useModal(); + const {handleLaunchCoin} = useLaunchToken(); + const {show: showModal} = useModal(); const handleCopy = async () => { if (!token?.memecoin_address) return; await Clipboard.setStringAsync(token?.memecoin_address); - showToast({ type: 'info', title: 'Copied to clipboard' }); + showToast({type: 'info', title: 'Copied to clipboard'}); }; return ( @@ -67,7 +67,7 @@ export const TokenCard: React.FC = ({ {token?.name || 'Unnamed Token'} {token?.symbol || 'Unnamed Token'} - + {token?.memecoin_address ? feltToAddress(BigInt(token.memecoin_address)) : ''} @@ -93,10 +93,14 @@ export const TokenCard: React.FC = ({ {account && account?.address == token?.owner && ( - - + + )} @@ -116,16 +120,16 @@ export const TokenCard: React.FC = ({ View token page - - - )} ); diff --git a/apps/mobile/src/components/search/TokenLaunchCard/index.tsx b/apps/mobile/src/components/search/TokenLaunchCard/index.tsx index 3add37b0..782d174e 100644 --- a/apps/mobile/src/components/search/TokenLaunchCard/index.tsx +++ b/apps/mobile/src/components/search/TokenLaunchCard/index.tsx @@ -1,18 +1,18 @@ -import { NDKEvent, NDKUserProfile } from '@nostr-dev-kit/ndk'; -import { useNavigation } from '@react-navigation/native'; -import { useAccount } from '@starknet-react/core'; -import { useProfile } from 'afk_nostr_sdk'; +import {NDKEvent, NDKUserProfile} from '@nostr-dev-kit/ndk'; +import {useNavigation} from '@react-navigation/native'; +import {useAccount} from '@starknet-react/core'; +import {useProfile} from 'afk_nostr_sdk'; import * as Clipboard from 'expo-clipboard'; -import { ImageSourcePropType, TouchableOpacity, View } from 'react-native'; +import {ImageSourcePropType, TouchableOpacity, View} from 'react-native'; -import { CopyIconStack } from '../../../assets/icons'; -import { useStyles, useTheme } from '../../../hooks'; -import { useToast } from '../../../hooks/modals'; -import { MainStackNavigationProps } from '../../../types'; -import { TokenDeployInterface, TokenLaunchInterface } from '../../../types/keys'; -import { feltToAddress } from '../../../utils/format'; -import { Button } from '../..'; -import { Text } from '../../Text'; +import {CopyIconStack} from '../../../assets/icons'; +import {useStyles, useTheme} from '../../../hooks'; +import {useToast} from '../../../hooks/modals'; +import {MainStackNavigationProps} from '../../../types'; +import {TokenDeployInterface, TokenLaunchInterface} from '../../../types/keys'; +import {feltToAddress} from '../../../utils/format'; +import {Button} from '../..'; +import {Text} from '../../Text'; import stylesheet from './styles'; export type LaunchCoinProps = { @@ -21,10 +21,10 @@ export type LaunchCoinProps = { event?: NDKEvent; profileProps?: NDKUserProfile; token?: TokenDeployInterface; - dataMeged?:LaunchCoinProps; + dataMeged?: LaunchCoinProps; launch?: TokenLaunchInterface; isViewDetailDisabled?: boolean; - isTokenOnly?: boolean + isTokenOnly?: boolean; }; enum AmountType { @@ -40,19 +40,19 @@ export const TokenLaunchCard: React.FC = ({ profileProps, event, isViewDetailDisabled, - isTokenOnly + isTokenOnly, }) => { - const { data: profile } = useProfile({ publicKey: event?.pubkey }); + const {data: profile} = useProfile({publicKey: event?.pubkey}); const account = useAccount(); - const { showToast } = useToast(); - const { theme } = useTheme(); + const {showToast} = useToast(); + const {theme} = useTheme(); const styles = useStyles(stylesheet); const navigation = useNavigation(); const handleCopy = async () => { if (!token?.memecoin_address) return; await Clipboard.setStringAsync(token?.memecoin_address); - showToast({ type: 'info', title: 'Copied to clipboard' }); + showToast({type: 'info', title: 'Copied to clipboard'}); }; return ( @@ -60,7 +60,7 @@ export const TokenLaunchCard: React.FC = ({ {token?.name || 'Unnamed Token'} - + {token?.memecoin_address ? feltToAddress(BigInt(token.memecoin_address)) : ''} @@ -68,7 +68,7 @@ export const TokenLaunchCard: React.FC = ({ - ${Number(token?.price || 0).toFixed(4)} + ${Number(token?.price || 0).toFixed(4)} @@ -97,7 +97,7 @@ export const TokenLaunchCard: React.FC = ({ {!isViewDetailDisabled && ( <> - {!isTokenOnly && + {!isTokenOnly && ( - - } - {isTokenOnly && + )} + {isTokenOnly && ( - - } + )} - )} ); diff --git a/apps/mobile/src/context/TokenCreateModal.tsx b/apps/mobile/src/context/TokenCreateModal.tsx index cd9ea46a..46380f93 100644 --- a/apps/mobile/src/context/TokenCreateModal.tsx +++ b/apps/mobile/src/context/TokenCreateModal.tsx @@ -5,7 +5,7 @@ import {Modalize} from 'react-native-modalize'; import {KeyModalAction} from '../modules/KeyModal'; import {TipSuccessModal, TipSuccessModalProps} from '../modules/TipSuccessModal'; import {TokenCreateModal} from '../modules/TokenCreatedModal'; -import { useAccount } from '@starknet-react/core'; +import {useAccount} from '@starknet-react/core'; export type TokenCreateModal = Modalize; @@ -20,7 +20,7 @@ export type TokenCreatedContextType = { export const TokenModalContext = createContext(null); export const TokenCreateModalProvider: React.FC = ({children}) => { - const account = useAccount() + const account = useAccount(); const tokenModalRef = useRef(null); const [event, setEvent] = useState(); @@ -28,17 +28,14 @@ export const TokenCreateModalProvider: React.FC = ({chi const [action, setAction] = useState(); const [successModal, setSuccessModal] = useState(null); - useEffect(() => { - - if(account?.address && !starknetAddress) { - setStarknetAddress(account?.address) + if (account?.address && !starknetAddress) { + setStarknetAddress(account?.address); } - if(!account?.address) { - setStarknetAddress(undefined) + if (!account?.address) { + setStarknetAddress(undefined); } - - },[account]) + }, [account]); const show = useCallback( (event?: NDKEvent, starknetAddress?: string, action?: KeyModalAction) => { setEvent(event); diff --git a/apps/mobile/src/hooks/account/useInternalAccount.ts b/apps/mobile/src/hooks/account/useInternalAccount.ts index 936ed9b8..9fefd26b 100644 --- a/apps/mobile/src/hooks/account/useInternalAccount.ts +++ b/apps/mobile/src/hooks/account/useInternalAccount.ts @@ -48,7 +48,7 @@ export const useInternalAccount = () => { // } else { // const { secretKey, mnemonic, publicKey, strkPrivateKey } = result // console.log("result", result) - // showToast({ title: "Authentication succed.", type: "success" }) + // showToast({ title: "Authentication succeed.", type: "success" }) // setIsConnected(true) // } diff --git a/apps/mobile/src/hooks/api/indexer/useMyTokensCreated.ts b/apps/mobile/src/hooks/api/indexer/useMyTokensCreated.ts index a66fc559..3b604162 100644 --- a/apps/mobile/src/hooks/api/indexer/useMyTokensCreated.ts +++ b/apps/mobile/src/hooks/api/indexer/useMyTokensCreated.ts @@ -15,4 +15,4 @@ export const useMyTokensCreated = (launch?: string) => { return res.data; }, }); -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/hooks/api/indexer/useTokens.ts b/apps/mobile/src/hooks/api/indexer/useTokens.ts index ed63ccb0..7fb63afe 100644 --- a/apps/mobile/src/hooks/api/indexer/useTokens.ts +++ b/apps/mobile/src/hooks/api/indexer/useTokens.ts @@ -6,7 +6,7 @@ export const useTokens = (launch?: string) => { return useQuery({ queryKey: launch ? ['launch', launch] : ['deploy_token'], queryFn: async () => { - const endpoint = "deploy"; + const endpoint = 'deploy'; const res = await ApiIndexerInstance.get(endpoint); if (res.status !== 200) { diff --git a/apps/mobile/src/hooks/launchpad/useAddLiquidity.ts b/apps/mobile/src/hooks/launchpad/useAddLiquidity.ts index 1a5b512c..955417e3 100644 --- a/apps/mobile/src/hooks/launchpad/useAddLiquidity.ts +++ b/apps/mobile/src/hooks/launchpad/useAddLiquidity.ts @@ -7,7 +7,7 @@ export const useAddLiquidity = () => { coinAddress: string, amount: string, startingPrice: string, - lockTime: string + lockTime: string, ) => { try { const deployCall = { @@ -17,7 +17,7 @@ export const useAddLiquidity = () => { coin_address: coinAddress, amount, starting_price: startingPrice, - lock_time: lockTime + lock_time: lockTime, }), }; @@ -33,7 +33,7 @@ export const useAddLiquidity = () => { account: AccountInterface, coinAddress: string, amount: string, - price: string + price: string, ) => { try { const deployCall = { @@ -42,7 +42,7 @@ export const useAddLiquidity = () => { calldata: CallData.compile({ token_address: coinAddress, amount, - price + price, }), }; @@ -58,7 +58,7 @@ export const useAddLiquidity = () => { account: AccountInterface, coinAddress: string, amount: string, - minLiquidity: string + minLiquidity: string, ) => { try { const deployCall = { @@ -67,7 +67,7 @@ export const useAddLiquidity = () => { calldata: CallData.compile({ token: coinAddress, amount, - min_liquidity: minLiquidity + min_liquidity: minLiquidity, }), }; @@ -82,6 +82,6 @@ export const useAddLiquidity = () => { return { addLiquidityUnrug, addLiquidityEkubo, - addLiquidityJediswap + addLiquidityJediswap, }; -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/hooks/launchpad/useCreateToken.ts b/apps/mobile/src/hooks/launchpad/useCreateToken.ts index 832be9b1..2285364e 100644 --- a/apps/mobile/src/hooks/launchpad/useCreateToken.ts +++ b/apps/mobile/src/hooks/launchpad/useCreateToken.ts @@ -1,8 +1,8 @@ -import { LAUNCHPAD_ADDRESS } from 'common'; -import { AccountInterface, cairo, CallData, constants } from 'starknet'; +import {LAUNCHPAD_ADDRESS} from 'common'; +import {AccountInterface, cairo, CallData, constants} from 'starknet'; // import { LAUNCHPAD_ADDRESS, UNRUGGABLE_FACTORY_ADDRESS } from "../../constants/contracts"; -import { formatFloatToUint256 } from '../../utils/format'; +import {formatFloatToUint256} from '../../utils/format'; export type DeployTokenFormValues = { recipient?: string; @@ -10,13 +10,12 @@ export type DeployTokenFormValues = { symbol: string | undefined; initialSupply: number | undefined; contract_address_salt: string | undefined; - is_unruggable?: boolean + is_unruggable?: boolean; }; export const useCreateToken = () => { const deployToken = async (account: AccountInterface, data: DeployTokenFormValues) => { try { - // const CONTRACT_ADDRESS_SALT_DEFAULT = // data?.contract_address_salt ?? // (await account?.getChainId()) == constants.StarknetChainId.SN_MAIN @@ -38,7 +37,7 @@ export const useCreateToken = () => { initialSupply: initial_supply, // initialSupply: cairo.uint256(data?.initialSupply ?? 100_000_000), contract_address_salt: new Date().getTime(), - is_unruggable: cairo.felt( String(data?.is_unruggable)) + is_unruggable: cairo.felt(String(data?.is_unruggable)), // contract_address_salt:CONTRACT_ADDRESS_SALT_DEFAULT + Math.random() + Math.random() / 1000 // contract_address_salt:cairo.felt(Math.random()) }), @@ -51,12 +50,9 @@ export const useCreateToken = () => { console.log('tx hash', tx.transaction_hash); const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); return wait_tx; - - } catch (error) { - console.log("Error deploy token", error) + console.log('Error deploy token', error); } - }; const deployTokenAndLaunch = async (account: AccountInterface, data: DeployTokenFormValues) => { @@ -79,8 +75,7 @@ export const useCreateToken = () => { initialSupply: initial_supply, contract_address_salt: new Date().getTime(), // is_unruggable: data?.is_unruggable - is_unruggable: cairo.felt( String(data?.is_unruggable)) - + is_unruggable: cairo.felt(String(data?.is_unruggable)), }), }; @@ -89,10 +84,8 @@ export const useCreateToken = () => { const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); return wait_tx; } catch (error) { - console.log("Error deploy token and launch", error) - + console.log('Error deploy token and launch', error); } - }; const launchToken = async (account: AccountInterface, coin_address: string) => { @@ -104,15 +97,14 @@ export const useCreateToken = () => { 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; } catch (error) { - console.log("Error launch token",error) + console.log('Error launch token', error); } - }; return { diff --git a/apps/mobile/src/hooks/launchpad/useLaunchToken.ts b/apps/mobile/src/hooks/launchpad/useLaunchToken.ts index 54ea03d3..c54f2521 100644 --- a/apps/mobile/src/hooks/launchpad/useLaunchToken.ts +++ b/apps/mobile/src/hooks/launchpad/useLaunchToken.ts @@ -16,11 +16,9 @@ export const useLaunchToken = () => { contractAddress?: string, ) => { try { + if (!account) return; - - if(!account) return; - - if(!coin_address) { + if (!coin_address) { return; } const addressContract = @@ -34,7 +32,7 @@ export const useLaunchToken = () => { contractAddress: addressContract, entrypoint: 'launch_token', calldata: CallData.compile({ - coin_address: coin_address + coin_address: coin_address, // ekubo_pool:CairoOptionVariant.None }), }; diff --git a/apps/mobile/src/hooks/modals/useTransaction.ts b/apps/mobile/src/hooks/modals/useTransaction.ts index 29c5a9e7..61c01b3e 100644 --- a/apps/mobile/src/hooks/modals/useTransaction.ts +++ b/apps/mobile/src/hooks/modals/useTransaction.ts @@ -8,7 +8,7 @@ import {useTransactionModal} from './useTransactionModal'; interface UseTransactionInterface { callsProps?: Call[]; } -export const useTransaction = ({callsProps=[]}: UseTransactionInterface) => { +export const useTransaction = ({callsProps = []}: UseTransactionInterface) => { const {show: showTransactionModal, hide: hideTransactionModal, shown} = useTransactionModal(); // const {writeAsync} = useContractWrite({}); @@ -60,10 +60,10 @@ export const useTransaction = ({callsProps=[]}: UseTransactionInterface) => { // const {transaction_hash} = await writeAsync(args) const transaction_hash = await sendTransactionTx(); - setTxHash(transaction_hash) + setTxHash(transaction_hash); return { - isOk:true, - transaction_hash + isOk: true, + transaction_hash, }; // return new Promise((resolve) => { // showTransactionModal(transaction_hash, resolve); @@ -71,8 +71,8 @@ export const useTransaction = ({callsProps=[]}: UseTransactionInterface) => { } catch (error) { hideTransactionModal(); return { - transaction_hash:undefined, - isOk:false + transaction_hash: undefined, + isOk: false, }; } }; @@ -80,6 +80,6 @@ export const useTransaction = ({callsProps=[]}: UseTransactionInterface) => { return { sendTransaction, txUrl, - txHash + txHash, }; -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/hooks/nameservice/useNamesList.ts b/apps/mobile/src/hooks/nameservice/useNamesList.ts index 721e43d7..4ed459f7 100644 --- a/apps/mobile/src/hooks/nameservice/useNamesList.ts +++ b/apps/mobile/src/hooks/nameservice/useNamesList.ts @@ -1,8 +1,8 @@ -import { useQuery } from '@tanstack/react-query'; -import { useAccount } from '@starknet-react/core'; -import { decodeUsername, formatExpiry } from '../../utils/format'; -import { ApiIndexerInstance } from '../../services/api'; -import { NAMESERVICE_ENDPOINTS } from './useNameservice'; +import {useQuery} from '@tanstack/react-query'; +import {useAccount} from '@starknet-react/core'; +import {decodeUsername, formatExpiry} from '../../utils/format'; +import {ApiIndexerInstance} from '../../services/api'; +import {NAMESERVICE_ENDPOINTS} from './useNameservice'; interface RawName { owner_address: string; @@ -21,27 +21,27 @@ interface FormattedName { } export const useNamesList = () => { - const { account } = useAccount(); + const {account} = useAccount(); const fetchNames = async () => { console.log('Fetching names from endpoint:', NAMESERVICE_ENDPOINTS.claimed); const response = await ApiIndexerInstance.get(NAMESERVICE_ENDPOINTS.claimed); - + console.log('Names API Response:', { status: response.status, dataLength: response.data?.data?.length, - rawData: response.data + rawData: response.data, }); - + if (!response.data?.data || !Array.isArray(response.data.data)) { throw new Error('Invalid data format received'); } - const formattedNames = (response.data.data as RawName[]).map(name => ({ + const formattedNames = (response.data.data as RawName[]).map((name) => ({ name: decodeUsername(name.username), owner: name.owner_address, expiryTime: formatExpiry(name.expiry), - paid: name.paid + paid: name.paid, })); console.log('Formatted names:', formattedNames); @@ -50,12 +50,12 @@ export const useNamesList = () => { const query = useQuery({ queryKey: ['names', account?.address], - queryFn: fetchNames + queryFn: fetchNames, }); return { names: query.data ?? [], isLoading: query.isLoading, - fetchNames: query.refetch + fetchNames: query.refetch, }; -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/hooks/nameservice/useNameservice.ts b/apps/mobile/src/hooks/nameservice/useNameservice.ts index fa360a41..07e0192b 100644 --- a/apps/mobile/src/hooks/nameservice/useNameservice.ts +++ b/apps/mobile/src/hooks/nameservice/useNameservice.ts @@ -1,11 +1,11 @@ -import { useAccount, useNetwork, useProvider } from '@starknet-react/core'; -import { KEYS_ADDRESS, NAMESERVICE_ADDRESS, TOKENS_ADDRESS } from 'common'; -import { AccountInterface, cairo, CallData, constants, RpcProvider, uint256 } from 'starknet'; -import { TokenQuoteBuyKeys } from '../../types/keys'; -import { feltToAddress, formatFloatToUint256 } from '../../utils/format'; -import { prepareAndConnectContract } from '../keys/useDataKeys'; -import { useQuery } from '@tanstack/react-query'; -import { ApiIndexerInstance } from '../../services/api'; +import {useAccount, useNetwork, useProvider} from '@starknet-react/core'; +import {KEYS_ADDRESS, NAMESERVICE_ADDRESS, TOKENS_ADDRESS} from 'common'; +import {AccountInterface, cairo, CallData, constants, RpcProvider, uint256} from 'starknet'; +import {TokenQuoteBuyKeys} from '../../types/keys'; +import {feltToAddress, formatFloatToUint256} from '../../utils/format'; +import {prepareAndConnectContract} from '../keys/useDataKeys'; +import {useQuery} from '@tanstack/react-query'; +import {ApiIndexerInstance} from '../../services/api'; export const NAMESERVICE_ENDPOINTS = { claimed: '/username-claimed', @@ -28,7 +28,7 @@ export const useNameservice = () => { const chain = useNetwork(); const rpcProvider = useProvider(); 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 handleBuyUsername = async ( account: AccountInterface, @@ -37,12 +37,16 @@ export const useNameservice = () => { ) => { if (!account) return; - const addressContract = contractAddress ?? NAMESERVICE_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; + const addressContract = + contractAddress ?? NAMESERVICE_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; console.log('addressContract', addressContract); console.log('read asset'); const nameservice = await prepareAndConnectContract(provider, addressContract); - let quote_address:string = TOKENS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA].STRK ?? TOKENS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA].ETH ?? ""; + let quote_address: string = + TOKENS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA].STRK ?? + TOKENS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA].ETH ?? + ''; console.log('read nameservice asset'); try { @@ -82,7 +86,7 @@ export const useNameservice = () => { contractAddress: addressContract, entrypoint: 'claim_username', calldata: CallData.compile({ - username: username + username: username, }), }; @@ -91,7 +95,7 @@ export const useNameservice = () => { const tx = await account?.execute([approveCall, claimedUsername], undefined, {}); console.log('tx hash', tx.transaction_hash); const wait_tx = await account?.waitForTransaction(tx?.transaction_hash); - return wait_tx + return wait_tx; }; return { @@ -101,13 +105,13 @@ export const useNameservice = () => { // New indexer hooks export const useNameserviceData = () => { - const provider = new RpcProvider({ nodeUrl: process.env.EXPO_PUBLIC_PROVIDER_URL }); - + const provider = new RpcProvider({nodeUrl: process.env.EXPO_PUBLIC_PROVIDER_URL}); + const query = useQuery({ queryKey: ['nameservice_data'], queryFn: async () => { const response = await ApiIndexerInstance.get(NAMESERVICE_ENDPOINTS.claimed); - + if (response.status !== 200) { throw new Error('Failed to fetch nameservice data'); } @@ -121,8 +125,10 @@ export const useNameserviceData = () => { const addressContract = NAMESERVICE_ADDRESS[constants.StarknetChainId.SN_SEPOLIA]; const nameservice = await prepareAndConnectContract(provider, addressContract); - let quote_address = TOKENS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA].STRK ?? - TOKENS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA].ETH ?? ""; + let quote_address = + TOKENS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA].STRK ?? + TOKENS_ADDRESS[constants.StarknetChainId.SN_SEPOLIA].ETH ?? + ''; try { quote_address = await nameservice.get_token_quote(); @@ -156,7 +162,7 @@ export const useNameserviceData = () => { contractAddress: addressContract, entrypoint: 'claim_username', calldata: CallData.compile({ - username: username + username: username, }), }; @@ -174,7 +180,7 @@ export const useNameserviceByUsername = (username: string) => { queryKey: ['nameservice_data', username], queryFn: async () => { const response = await ApiIndexerInstance.get(NAMESERVICE_ENDPOINTS.byUsername(username)); - + if (response.status !== 200) { throw new Error('Failed to fetch nameservice data'); } @@ -185,4 +191,4 @@ export const useNameserviceByUsername = (username: string) => { }); return query; -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/hooks/unruggable/useDeploy.ts b/apps/mobile/src/hooks/unruggable/useDeploy.ts index 3d5aef11..39ad89e9 100644 --- a/apps/mobile/src/hooks/unruggable/useDeploy.ts +++ b/apps/mobile/src/hooks/unruggable/useDeploy.ts @@ -6,7 +6,7 @@ export type DeployTokenFormValues = { symbol: string | undefined; initialSupply: number | undefined; contract_address_salt: string | undefined; - is_unruggable?:boolean + is_unruggable?: boolean; }; export const useDeployTokenUnruggable = () => { diff --git a/apps/mobile/src/hooks/useCombinedTokens.ts b/apps/mobile/src/hooks/useCombinedTokens.ts index 1af90f9b..d82288b3 100644 --- a/apps/mobile/src/hooks/useCombinedTokens.ts +++ b/apps/mobile/src/hooks/useCombinedTokens.ts @@ -19,7 +19,7 @@ export const useCombinedTokenData = (token?: string, launch?: string) => { } = useGetTokenLaunch(launch); const [tokens, setTokens] = useState([]); - const [launchs, setLaunchs] = useState([]); + const [launches, setLaunches] = useState([]); const combinedData = useMemo(() => { return [ @@ -37,12 +37,12 @@ export const useCombinedTokenData = (token?: string, launch?: string) => { useEffect(() => { setTokens(combinedData); - setLaunchs(launchDataCombined) + setLaunches(launchDataCombined); }, [combinedData]); return { tokens, - launchs:launchDataCombined, + launches: launchDataCombined, isLoading: isLoadingDeploy || isLoadingLaunch, isError: isErrorDeploy || isErrorLaunch, isFetching: launchIsFetching || tokenIsFetching, diff --git a/apps/mobile/src/modules/Auth/index.tsx b/apps/mobile/src/modules/Auth/index.tsx index 7b76fd04..6a98b5f1 100644 --- a/apps/mobile/src/modules/Auth/index.tsx +++ b/apps/mobile/src/modules/Auth/index.tsx @@ -23,10 +23,11 @@ export const Auth: React.FC = ({title, children}) => { - + {/* */} diff --git a/apps/mobile/src/modules/Cashu/HistoryTxCashu.tsx b/apps/mobile/src/modules/Cashu/HistoryTxCashu.tsx index 03f2e3da..c45b59be 100644 --- a/apps/mobile/src/modules/Cashu/HistoryTxCashu.tsx +++ b/apps/mobile/src/modules/Cashu/HistoryTxCashu.tsx @@ -66,7 +66,7 @@ export const HistoryTxCashu = () => { (i) => i?.state === MintQuoteState?.ISSUED || i?.state === MintQuoteState.PAID, ); const invoicesSorted = invoicesPaid - .map((invoice) => ({...invoice, direction: 'in'} as ICashuInvoice)) + .map((invoice) => ({...invoice, direction: 'in'}) as ICashuInvoice) .reverse(); setTxInvoices([...invoicesSorted]); } @@ -76,7 +76,7 @@ export const HistoryTxCashu = () => { if (proofsLocal) { const proofsSpent: ProofInvoice[] = JSON.parse(proofsLocal); const proofsSpentSorted = proofsSpent - .map((proof) => ({...proof, direction: 'out'} as ProofInvoice)) + .map((proof) => ({...proof, direction: 'out'}) as ProofInvoice) .reverse(); console.log('proofsSpentSorted', proofsSpentSorted); setTxInvoices((invoices) => [...invoices, ...proofsSpentSorted]); @@ -283,8 +283,8 @@ export const HistoryTxCashu = () => { item.direction === 'out' ? styles.dirOutText : item.direction === 'in' - ? styles.dirInText - : null, + ? styles.dirInText + : null, ]} > {item?.direction} diff --git a/apps/mobile/src/modules/Cashu/SendEcash.tsx b/apps/mobile/src/modules/Cashu/SendEcash.tsx index e9636fb0..ba59b00b 100644 --- a/apps/mobile/src/modules/Cashu/SendEcash.tsx +++ b/apps/mobile/src/modules/Cashu/SendEcash.tsx @@ -335,14 +335,16 @@ export const SendEcash: React.FC = ({onClose}) => { ]} onValueChange={setSelectedCurrency} > - {mintUnitsMap.get(selectedMint.url)?.map((unitInfo) => ( - - ))} + {mintUnitsMap + .get(selectedMint.url) + ?.map((unitInfo) => ( + + ))} Amount ; } return ( - + Wallet Details diff --git a/apps/mobile/src/modules/Cashu/styles.ts b/apps/mobile/src/modules/Cashu/styles.ts index 03ebd02f..1cdff189 100644 --- a/apps/mobile/src/modules/Cashu/styles.ts +++ b/apps/mobile/src/modules/Cashu/styles.ts @@ -296,7 +296,7 @@ export default ThemedStyleSheet((theme) => ({ marginBottom: Spacing.small, }, pasteButton: { - backgroundColor: 'transparant', + backgroundColor: 'transparent', borderRadius: 30, alignItems: 'center', borderWidth: 1, @@ -361,7 +361,7 @@ export default ThemedStyleSheet((theme) => ({ }, //Wallet Info - walletcontainer: { + walletContainer: { backgroundColor: theme.colors.surface, borderRadius: 10, padding: Spacing.medium, diff --git a/apps/mobile/src/modules/CashuWallet/components/History/index.tsx b/apps/mobile/src/modules/CashuWallet/components/History/index.tsx index 7b0a7db2..039367c6 100644 --- a/apps/mobile/src/modules/CashuWallet/components/History/index.tsx +++ b/apps/mobile/src/modules/CashuWallet/components/History/index.tsx @@ -32,7 +32,7 @@ export const History = () => { (i) => i?.state === MintQuoteState?.ISSUED || i?.state === MintQuoteState.PAID, ); const invoicesSorted = invoicesPaid - .map((invoice) => ({...invoice} as ICashuInvoice)) + .map((invoice) => ({...invoice}) as ICashuInvoice) .reverse(); setTxInvoices([...invoicesSorted]); } @@ -86,8 +86,8 @@ export const History = () => { item.direction === 'out' ? styles.dirOutText : item.direction === 'in' - ? styles.dirInText - : null, + ? styles.dirInText + : null, ]} > {item?.direction} diff --git a/apps/mobile/src/modules/CashuWallet/components/Receive/styles.ts b/apps/mobile/src/modules/CashuWallet/components/Receive/styles.ts index 43668158..100bea9c 100644 --- a/apps/mobile/src/modules/CashuWallet/components/Receive/styles.ts +++ b/apps/mobile/src/modules/CashuWallet/components/Receive/styles.ts @@ -88,7 +88,7 @@ export default ThemedStyleSheet((theme) => ({ fontWeight: 'bold', }, pasteButton: { - backgroundColor: 'transparant', + backgroundColor: 'transparent', borderRadius: 30, alignItems: 'center', borderWidth: 1, diff --git a/apps/mobile/src/modules/CashuWallet/components/Send/index.tsx b/apps/mobile/src/modules/CashuWallet/components/Send/index.tsx index ea16973b..1e841e1c 100644 --- a/apps/mobile/src/modules/CashuWallet/components/Send/index.tsx +++ b/apps/mobile/src/modules/CashuWallet/components/Send/index.tsx @@ -6,8 +6,16 @@ import {MintData} from 'afk_nostr_sdk/src/hooks/cashu/useCashu'; import * as Clipboard from 'expo-clipboard'; import {randomUUID} from 'expo-crypto'; import React, {useEffect, useState} from 'react'; -import {Modal, Platform, SafeAreaView, Share, TouchableOpacity, View} from 'react-native'; -import {Text, TextInput} from 'react-native'; +import { + Modal, + Platform, + SafeAreaView, + Share, + Text, + TextInput, + TouchableOpacity, + View, +} from 'react-native'; import {CloseIcon, CopyIconStack, ScanQrIcon, ShareIcon} from '../../../../assets/icons'; import {Button, GenerateQRCode, Input, ScanQRCode} from '../../../../components'; @@ -426,7 +434,7 @@ export const Send: React.FC = ({onClose}) => { Gift this ecash? - + diff --git a/apps/mobile/src/modules/Lightning/styles.ts b/apps/mobile/src/modules/Lightning/styles.ts index a2abbac1..928dd7d7 100644 --- a/apps/mobile/src/modules/Lightning/styles.ts +++ b/apps/mobile/src/modules/Lightning/styles.ts @@ -111,7 +111,7 @@ export default ThemedStyleSheet((theme) => ({ }, //Wallet Info - walletcontainer: { + walletContainer: { backgroundColor: theme.colors.surface, borderRadius: 10, padding: Spacing.medium, diff --git a/apps/mobile/src/modules/Oauth/twitter.tsx b/apps/mobile/src/modules/Oauth/twitter.tsx index 27391f94..66834324 100644 --- a/apps/mobile/src/modules/Oauth/twitter.tsx +++ b/apps/mobile/src/modules/Oauth/twitter.tsx @@ -1,17 +1,17 @@ -import React, { useState } from 'react'; -import { View, Button, Text, StyleSheet } from 'react-native'; +import React, {useState} from 'react'; +import {View, Button, Text, StyleSheet} from 'react-native'; import axios from 'axios'; const API_URL = process.env.EXPO_PUBLIC_INDEXER_BACKEND_URL ?? 'http://localhost:3000'; // Replace with your Fastify backend URL -const TwitterOauth = ({ navigation }: any) => { +const TwitterOauth = ({navigation}: any) => { const [isAuthenticated, setIsAuthenticated] = useState(false); const [screenName, setScreenName] = useState(null); const initiateOAuth = async () => { try { - const { data } = await axios.get(`${API_URL}/auth/login`); - navigation.navigate('OAuthWebView', { authUrl: data.url }); + const {data} = await axios.get(`${API_URL}/auth/login`); + navigation.navigate('OAuthWebView', {authUrl: data.url}); } catch (error) { console.error('Failed to start OAuth:', error); } @@ -19,7 +19,7 @@ const TwitterOauth = ({ navigation }: any) => { const postTweet = async () => { try { - const { data } = await axios.post(`${API_URL}/tweet`, { + const {data} = await axios.post(`${API_URL}/tweet`, { tweetContent: 'Hello from React Native!', }); alert('Tweet posted successfully: ' + data.tweet.text); @@ -45,9 +45,9 @@ const TwitterOauth = ({ navigation }: any) => { }; const styles = StyleSheet.create({ - container: { flex: 1, justifyContent: 'center', alignItems: 'center' }, - title: { fontSize: 20, marginBottom: 20 }, - welcome: { marginBottom: 20, fontSize: 16 }, + container: {flex: 1, justifyContent: 'center', alignItems: 'center'}, + title: {fontSize: 20, marginBottom: 20}, + welcome: {marginBottom: 20, fontSize: 16}, }); export default TwitterOauth; diff --git a/apps/mobile/src/modules/Onboard/wallet/index.tsx b/apps/mobile/src/modules/Onboard/wallet/index.tsx index a9f158e2..66869465 100644 --- a/apps/mobile/src/modules/Onboard/wallet/index.tsx +++ b/apps/mobile/src/modules/Onboard/wallet/index.tsx @@ -1,11 +1,11 @@ import {useAuth} from 'afk_nostr_sdk'; -import {FC, useState} from 'react'; -import React from 'react'; +import React, {FC, useState} from 'react'; import {ScrollView, Text, View} from 'react-native'; import {Button} from '../../../components'; import {useToast} from '../../../hooks/modals'; import {WalletManager} from '../../../utils/storage/wallet-manager'; + export const WalletOnboarding: FC = () => { const [email, setEmail] = useState(''); const [otp, setOtp] = useState(''); @@ -63,7 +63,7 @@ export const WalletOnboarding: FC = () => { } else { const {secretKey, mnemonic, publicKey, strkPrivateKey} = result; console.log('result', result); - showToast({title: 'Authentication succed.', type: 'success'}); + showToast({title: 'Authentication succeed.', type: 'success'}); setIsConnected(true); } diff --git a/apps/mobile/src/modules/PostCard/index.tsx b/apps/mobile/src/modules/PostCard/index.tsx index fdab8cdb..86eaba89 100644 --- a/apps/mobile/src/modules/PostCard/index.tsx +++ b/apps/mobile/src/modules/PostCard/index.tsx @@ -20,7 +20,7 @@ export const PostCard: React.FC = ({event, isRepostProps, isBookm let repostedEvent = undefined; const [isRepost, setIsRepost] = useState( - isRepostProps ?? event?.kind == NDKKind.Repost ? true : false, + (isRepostProps ?? event?.kind == NDKKind.Repost) ? true : false, ); if (event?.kind == NDKKind.Repost) { diff --git a/apps/mobile/src/modules/Studio/index.tsx b/apps/mobile/src/modules/Studio/index.tsx index 4fd6f5f5..37ac83c2 100644 --- a/apps/mobile/src/modules/Studio/index.tsx +++ b/apps/mobile/src/modules/Studio/index.tsx @@ -157,9 +157,8 @@ export const RenderEventCard = ({ }); const handleJoinEvent = async () => { - await handleCheckNostrAndSendConnectDialog(); - + if (!pubKey) { toast.showToast({title: 'Must be signed in', type: 'error'}); return; diff --git a/apps/mobile/src/modules/TipModal/lightning/index.tsx b/apps/mobile/src/modules/TipModal/lightning/index.tsx index 0e272d37..257b6f1a 100644 --- a/apps/mobile/src/modules/TipModal/lightning/index.tsx +++ b/apps/mobile/src/modules/TipModal/lightning/index.tsx @@ -72,20 +72,18 @@ export const TipModalStarknet = forwardRef( DEFAULT_TIMELOCK, // timelock ]); - const {transaction_hash} = await sendTransaction( - [ - { - contractAddress: TOKENS[token][CHAIN_ID].address, - entrypoint: Entrypoint.APPROVE, - calldata: approveCallData, - }, - { - contractAddress: ESCROW_ADDRESSES[CHAIN_ID], - entrypoint: Entrypoint.DEPOSIT, - calldata: depositCallData, - }, - ], - ); + const {transaction_hash} = await sendTransaction([ + { + contractAddress: TOKENS[token][CHAIN_ID].address, + entrypoint: Entrypoint.APPROVE, + calldata: approveCallData, + }, + { + contractAddress: ESCROW_ADDRESSES[CHAIN_ID], + entrypoint: Entrypoint.DEPOSIT, + calldata: depositCallData, + }, + ]); if (transaction_hash) { hideTipModal(); @@ -103,7 +101,7 @@ export const TipModalStarknet = forwardRef( } else { let description = 'Please Try Again Later.'; // if (transaction_hash?.isRejected()) { - // description = receipt.transaction_failure_reason.error_message; + // description = receipt.transaction_failure_reason.error_message; // } showDialog({ diff --git a/apps/mobile/src/modules/TipModal/starknet/form.tsx b/apps/mobile/src/modules/TipModal/starknet/form.tsx index 2ebcd1e4..cd2c337c 100644 --- a/apps/mobile/src/modules/TipModal/starknet/form.tsx +++ b/apps/mobile/src/modules/TipModal/starknet/form.tsx @@ -78,21 +78,20 @@ export const FormTipStarknet: React.FC = ({ DEFAULT_TIMELOCK, // timelock ]); const receipt = await sendTransaction([ - { - contractAddress: TOKENS[token][CHAIN_ID].address, - entrypoint: Entrypoint.APPROVE, - calldata: approveCallData, - }, - { - contractAddress: ESCROW_ADDRESSES[CHAIN_ID], - entrypoint: Entrypoint.DEPOSIT, - calldata: depositCallData, - }, - ], - ); + { + contractAddress: TOKENS[token][CHAIN_ID].address, + entrypoint: Entrypoint.APPROVE, + calldata: approveCallData, + }, + { + contractAddress: ESCROW_ADDRESSES[CHAIN_ID], + entrypoint: Entrypoint.DEPOSIT, + calldata: depositCallData, + }, + ]); // TODO add receipt - if (receipt?.transaction_hash) { + if (receipt?.transaction_hash) { hideTipModal(); hideTransactionModal(); showSuccess({ @@ -108,7 +107,7 @@ export const FormTipStarknet: React.FC = ({ } else { let description = 'Please Try Again Later.'; // if (receipt?.isRejected()) { - // description = receipt.transaction_failure_reason.error_message; + // description = receipt.transaction_failure_reason.error_message; // } showDialog({ @@ -132,8 +131,6 @@ export const FormTipStarknet: React.FC = ({ // }, // ], // }); - - }; return ( diff --git a/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx b/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx index 2acb13e5..456a70d6 100644 --- a/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx +++ b/apps/mobile/src/modules/TokenCreatedModal/FormInstantiateKey.tsx @@ -96,16 +96,14 @@ export const FormInstantiateKey = ({ }; if (!account || !account?.account) return; - const receipt = await sendTransaction( - [ - call, - // { - // contractAddress: ESCROW_ADDRESSES[CHAIN_ID], - // entrypoint: Entrypoint.DEPOSIT, - // calldata: depositCallData, - // }, - ], - ); + const receipt = await sendTransaction([ + call, + // { + // contractAddress: ESCROW_ADDRESSES[CHAIN_ID], + // entrypoint: Entrypoint.DEPOSIT, + // calldata: depositCallData, + // }, + ]); // const tx = await account?.account?.execute([call], undefined, {}); // console.log('tx hash', tx?.transaction_hash); // if (tx?.transaction_hash) { @@ -133,7 +131,7 @@ export const FormInstantiateKey = ({ } else { let description = 'Please Try Again Later.'; // if (receipt?.isRejected()) { - // description = receipt.transaction_failure_reason.error_message; + // description = receipt.transaction_failure_reason.error_message; // } showDialog({ diff --git a/apps/mobile/src/modules/TransactionModal/index.tsx b/apps/mobile/src/modules/TransactionModal/index.tsx index dfb5f87f..99cda4ae 100644 --- a/apps/mobile/src/modules/TransactionModal/index.tsx +++ b/apps/mobile/src/modules/TransactionModal/index.tsx @@ -91,4 +91,4 @@ export const TransactionModal: React.FC = ({ ); -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/modules/TransactionModal/styles.ts b/apps/mobile/src/modules/TransactionModal/styles.ts index c901e20c..026c0338 100644 --- a/apps/mobile/src/modules/TransactionModal/styles.ts +++ b/apps/mobile/src/modules/TransactionModal/styles.ts @@ -17,4 +17,4 @@ export default StyleSheet.create({ indicator: { paddingVertical: 20, }, -}); \ No newline at end of file +}); diff --git a/apps/mobile/src/modules/VideoPostCard/index.tsx b/apps/mobile/src/modules/VideoPostCard/index.tsx index b503bfde..832166dc 100644 --- a/apps/mobile/src/modules/VideoPostCard/index.tsx +++ b/apps/mobile/src/modules/VideoPostCard/index.tsx @@ -20,7 +20,7 @@ export const VideoPostCard: React.FC = ({event, isRepostProps, is let repostedEvent = undefined; const [isRepost, setIsRepost] = useState( - isRepostProps ?? event?.kind == NDKKind.Repost ? true : false, + (isRepostProps ?? event?.kind == NDKKind.Repost) ? true : false, ); if (event?.kind == NDKKind.Repost) { diff --git a/apps/mobile/src/modules/WalletModal/walletUtil.ts b/apps/mobile/src/modules/WalletModal/walletUtil.ts index 59d3780f..53285c9a 100644 --- a/apps/mobile/src/modules/WalletModal/walletUtil.ts +++ b/apps/mobile/src/modules/WalletModal/walletUtil.ts @@ -79,8 +79,8 @@ export function injectedWithFallback() { return !window.ethereum ? 'Install MetaMask' : window.ethereum?.isMetaMask - ? 'MetaMask' - : 'Browser Wallet'; + ? 'MetaMask' + : 'Browser Wallet'; }, }; }); diff --git a/apps/mobile/src/modules/nameservice/form.tsx b/apps/mobile/src/modules/nameservice/form.tsx index d454ec92..50cb44f6 100644 --- a/apps/mobile/src/modules/nameservice/form.tsx +++ b/apps/mobile/src/modules/nameservice/form.tsx @@ -1,38 +1,45 @@ -import { useNavigation } from '@react-navigation/native'; -import { useState } from 'react'; -import { KeyboardAvoidingView, ScrollView, Text, View, ActivityIndicator, Linking } from 'react-native'; -import { SafeAreaView } from 'react-native-safe-area-context'; +import {useNavigation} from '@react-navigation/native'; +import {useState} from 'react'; +import { + KeyboardAvoidingView, + ScrollView, + Text, + View, + ActivityIndicator, + Linking, +} from 'react-native'; +import {SafeAreaView} from 'react-native-safe-area-context'; -import { Button, SquareInput, TextButton } from '../../components'; -import { Swap } from '../../components/Swap'; +import {Button, SquareInput, TextButton} from '../../components'; +import {Swap} from '../../components/Swap'; import TabSelector from '../../components/TabSelector'; -import { TOKENSMINT } from '../../constants/tokens'; -import { useStyles } from '../../hooks'; -import { WalletOnboarding } from '../Onboard/wallet'; -import { MainStackNavigationProps } from '../../types'; -import { SelectedTab, TABS_NAMESERVICE, TABS_ONBOARDING_WALLET } from '../../types/tab'; -import { CashuWalletView } from '../CashuWallet'; -import { LightningNetworkWalletView } from '../Lightning'; +import {TOKENSMINT} from '../../constants/tokens'; +import {useStyles} from '../../hooks'; +import {WalletOnboarding} from '../Onboard/wallet'; +import {MainStackNavigationProps} from '../../types'; +import {SelectedTab, TABS_NAMESERVICE, TABS_ONBOARDING_WALLET} from '../../types/tab'; +import {CashuWalletView} from '../CashuWallet'; +import {LightningNetworkWalletView} from '../Lightning'; import stylesheet from './styles'; -import { useNameserviceData } from '../../hooks/nameservice/useNameservice'; -import { useToast, useWalletModal, useTransaction } from '../../hooks/modals'; -import { useAccount } from '@starknet-react/core'; +import {useNameserviceData} from '../../hooks/nameservice/useNameservice'; +import {useToast, useWalletModal, useTransaction} from '../../hooks/modals'; +import {useAccount} from '@starknet-react/core'; export const FormComponent: React.FC = () => { const styles = useStyles(stylesheet); - const { account } = useAccount(); - const { prepareBuyUsername } = useNameserviceData(); + const {account} = useAccount(); + const {prepareBuyUsername} = useNameserviceData(); const [username, setUsername] = useState(); const walletModal = useWalletModal(); - const { showToast } = useToast(); - const { sendTransaction } = useTransaction({ callsProps: [] }); + const {showToast} = useToast(); + const {sendTransaction} = useTransaction({callsProps: []}); const [isLoading, setIsLoading] = useState(false); const [isVerifying, setIsVerifying] = useState(false); const [isVerified, setIsVerified] = useState(false); const handleVerify = async () => { if (!username) { - showToast({ title: "Please enter a name", type: "info" }); + showToast({title: 'Please enter a name', type: 'info'}); return; } setIsVerifying(true); @@ -41,11 +48,11 @@ export const FormComponent: React.FC = () => { // TODO: Add actual verification against the contract if (username.length > 0) { setIsVerified(true); - showToast({ title: "Name is available!", type: "success" }); + showToast({title: 'Name is available!', type: 'success'}); } } catch (error) { console.error('Verification error:', error); - showToast({ title: "Name verification failed", type: "error" }); + showToast({title: 'Name verification failed', type: 'error'}); } finally { setIsVerifying(false); } @@ -61,17 +68,17 @@ export const FormComponent: React.FC = () => { const handleBuy = async () => { if (!isVerified) { - showToast({ title: "Please verify name first", type: "info" }); + showToast({title: 'Please verify name first', type: 'info'}); return; } - + if (isLoading) return; - + if (!username) { - showToast({ title: "Please enter a name", type: "info" }); + showToast({title: 'Please enter a name', type: 'info'}); return; } - + setIsLoading(true); try { const isConnected = await onConnect(); @@ -82,20 +89,20 @@ export const FormComponent: React.FC = () => { const calls = await prepareBuyUsername(account, username); const success = await sendTransaction(calls); - + if (success) { - showToast({ - title: "Transaction submitted!", - type: "success" + showToast({ + title: 'Transaction submitted!', + type: 'success', }); } else { throw new Error('Transaction failed'); } } catch (error) { console.error('Buy error:', error); - showToast({ - title: "Failed to purchase name", - type: "error" + showToast({ + title: 'Failed to purchase name', + type: 'error', }); } finally { setIsLoading(false); @@ -105,7 +112,7 @@ export const FormComponent: React.FC = () => { return ( Buy Nameservice - + Need funds? Get test tokens from Starknet Sepolia faucet @@ -125,22 +132,14 @@ export const FormComponent: React.FC = () => { - - ); -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/modules/nameservice/index.tsx b/apps/mobile/src/modules/nameservice/index.tsx index b41ae9ba..d24bd1a3 100644 --- a/apps/mobile/src/modules/nameservice/index.tsx +++ b/apps/mobile/src/modules/nameservice/index.tsx @@ -1,25 +1,24 @@ -import { useNavigation } from '@react-navigation/native'; -import { useState } from 'react'; -import { KeyboardAvoidingView, ScrollView, Text, View, ActivityIndicator } from 'react-native'; -import { SafeAreaView } from 'react-native-safe-area-context'; +import {useNavigation} from '@react-navigation/native'; +import {useState} from 'react'; +import {KeyboardAvoidingView, ScrollView, Text, View, ActivityIndicator} from 'react-native'; +import {SafeAreaView} from 'react-native-safe-area-context'; -import { TextButton } from '../../components'; -import { Swap } from '../../components/Swap'; +import {TextButton} from '../../components'; +import {Swap} from '../../components/Swap'; import TabSelector from '../../components/TabSelector'; -import { TOKENSMINT } from '../../constants/tokens'; -import { useStyles } from '../../hooks'; -import { WalletOnboarding } from '../../modules/Onboard/wallet'; -import { MainStackNavigationProps } from '../../types'; -import { SelectedTab, TABS_NAMESERVICE, TABS_ONBOARDING_WALLET } from '../../types/tab'; -import { CashuWalletView } from '../CashuWallet'; -import { LightningNetworkWalletView } from '../Lightning'; +import {TOKENSMINT} from '../../constants/tokens'; +import {useStyles} from '../../hooks'; +import {WalletOnboarding} from '../../modules/Onboard/wallet'; +import {MainStackNavigationProps} from '../../types'; +import {SelectedTab, TABS_NAMESERVICE, TABS_ONBOARDING_WALLET} from '../../types/tab'; +import {CashuWalletView} from '../CashuWallet'; +import {LightningNetworkWalletView} from '../Lightning'; import stylesheet from './styles'; -import { FormComponent } from './form'; -import { NameCard } from '../../components/NameCard/nameCard'; -import { useAccount } from '@starknet-react/core'; -import { useNamesList } from '../../hooks/nameservice/useNamesList'; -import { NamesList } from '../../components/NamesList'; - +import {FormComponent} from './form'; +import {NameCard} from '../../components/NameCard/nameCard'; +import {useAccount} from '@starknet-react/core'; +import {useNamesList} from '../../hooks/nameservice/useNamesList'; +import {NamesList} from '../../components/NamesList'; export const NameserviceComponent: React.FC = () => { const styles = useStyles(stylesheet); @@ -35,19 +34,19 @@ export const NameserviceComponent: React.FC = () => { // } }; - const { account } = useAccount(); - + const {account} = useAccount(); + const renderContent = () => { - const { names, isLoading } = useNamesList(); - + const {names, isLoading} = useNamesList(); + console.log('NameserviceComponent state:', { selectedTab, isLoading, namesCount: names.length, - names + names, }); - switch(selectedTab) { + switch (selectedTab) { case SelectedTab.DYNAMIC_GENERAL: return ( @@ -64,21 +63,18 @@ export const NameserviceComponent: React.FC = () => { ) : names.length === 0 ? ( No names found ) : ( - + )} ); case SelectedTab.DYNAMIC_OWNED: - const ownedNames = names.filter(name => - name.owner.toLowerCase() === account?.address?.toLowerCase() + const ownedNames = names.filter( + (name) => name.owner.toLowerCase() === account?.address?.toLowerCase(), ); console.log('Rendering Your Names tab:', { accountAddress: account?.address, ownedNamesCount: ownedNames.length, - ownedNames + ownedNames, }); return ( @@ -88,10 +84,7 @@ export const NameserviceComponent: React.FC = () => { ) : names.length === 0 ? ( No names found ) : ( - + )} ); @@ -117,4 +110,4 @@ export const NameserviceComponent: React.FC = () => { ); -}; \ No newline at end of file +}; diff --git a/apps/mobile/src/modules/nameservice/styles.ts b/apps/mobile/src/modules/nameservice/styles.ts index 508187ca..f1391f38 100644 --- a/apps/mobile/src/modules/nameservice/styles.ts +++ b/apps/mobile/src/modules/nameservice/styles.ts @@ -8,19 +8,19 @@ export default ThemedStyleSheet((theme) => ({ backgroundColor: theme.colors.background, padding: Spacing.large, }, - + content: { flex: 1, backgroundColor: theme.colors.background, padding: Spacing.medium, }, - + text: { color: theme.colors.text, fontSize: 16, marginBottom: Spacing.medium, }, - + title: { color: theme.colors.primary, fontSize: 28, @@ -28,7 +28,7 @@ export default ThemedStyleSheet((theme) => ({ marginBottom: Spacing.large, textAlign: 'center', }, - + faucetContainer: { backgroundColor: theme.colors.surface, padding: Spacing.medium, @@ -37,27 +37,27 @@ export default ThemedStyleSheet((theme) => ({ borderWidth: 1, borderColor: theme.colors.surface, }, - + faucetText: { color: theme.colors.white, textAlign: 'center', fontSize: 14, }, - + inputContainer: { marginBottom: Spacing.large, backgroundColor: theme.colors.surface, borderRadius: 20, padding: Spacing.large, shadowColor: theme.colors.shadow, - shadowOffset: { width: 0, height: 4 }, + shadowOffset: {width: 0, height: 4}, shadowOpacity: 0.15, shadowRadius: 12, elevation: 5, borderWidth: 1, borderColor: theme.colors.divider, }, - + input: { backgroundColor: theme.colors.background, borderRadius: 12, @@ -67,38 +67,38 @@ export default ThemedStyleSheet((theme) => ({ borderWidth: 1, borderColor: theme.colors.divider, }, - + buttonContainer: { gap: Spacing.medium, }, - + button: { borderRadius: 16, padding: Spacing.medium, backgroundColor: theme.colors.primary, shadowColor: theme.colors.shadow, - shadowOffset: { width: 0, height: 2 }, + shadowOffset: {width: 0, height: 2}, shadowOpacity: 0.1, shadowRadius: 4, elevation: 3, }, - + buttonInactive: { backgroundColor: theme.colors.surface, opacity: 0.7, }, - + buttonText: { color: theme.colors.white, fontSize: 16, fontWeight: '600', textAlign: 'center', }, - + sectionTitle: { fontSize: 18, fontWeight: 'bold', marginTop: 20, marginBottom: 10, }, -})); \ No newline at end of file +})); diff --git a/apps/mobile/src/screens/Feed/index.tsx b/apps/mobile/src/screens/Feed/index.tsx index ff0815aa..6bbefdda 100644 --- a/apps/mobile/src/screens/Feed/index.tsx +++ b/apps/mobile/src/screens/Feed/index.tsx @@ -1,25 +1,25 @@ -import { NDKKind } from '@nostr-dev-kit/ndk'; -import { useAllProfiles, useSearch } from 'afk_nostr_sdk'; -import { useAuth, useContacts } from 'afk_nostr_sdk'; -import { useCallback, useEffect, useState } from 'react'; -import { ActivityIndicator, FlatList, Image, Pressable, RefreshControl, View } from 'react-native'; +import {NDKKind} from '@nostr-dev-kit/ndk'; +import {useAllProfiles, useSearch} from 'afk_nostr_sdk'; +import {useAuth, useContacts} from 'afk_nostr_sdk'; +import {useCallback, useEffect, useState} from 'react'; +import {ActivityIndicator, FlatList, Image, Pressable, RefreshControl, View} from 'react-native'; -import { AddPostIcon } from '../../assets/icons'; -import { BubbleUser } from '../../components/BubbleUser'; +import {AddPostIcon} from '../../assets/icons'; +import {BubbleUser} from '../../components/BubbleUser'; import SearchComponent from '../../components/search'; -import { useStyles, useTheme } from '../../hooks'; -import { ChannelComponent } from '../../modules/ChannelCard'; -import { PostCard } from '../../modules/PostCard'; -import { VideoPostCard } from '../../modules/VideoPostCard'; -import { FeedScreenProps } from '../../types'; +import {useStyles, useTheme} from '../../hooks'; +import {ChannelComponent} from '../../modules/ChannelCard'; +import {PostCard} from '../../modules/PostCard'; +import {VideoPostCard} from '../../modules/VideoPostCard'; +import {FeedScreenProps} from '../../types'; import stylesheet from './styles'; -import { RenderEventCard } from '../../modules/Studio'; +import {RenderEventCard} from '../../modules/Studio'; -export const Feed: React.FC = ({ navigation }) => { - const { theme } = useTheme(); - const { publicKey } = useAuth(); +export const Feed: React.FC = ({navigation}) => { + const {theme} = useTheme(); + const {publicKey} = useAuth(); const styles = useStyles(stylesheet); - const profiles = useAllProfiles({ limit: 10 }); + const profiles = useAllProfiles({limit: 10}); const [activeSortBy, setSortBy] = useState(); const [search, setSearch] = useState(undefined); const [feedData, setFeedData] = useState(null); @@ -31,10 +31,10 @@ export const Feed: React.FC = ({ navigation }) => { NDKKind.Metadata, NDKKind.VerticalVideo, NDKKind.HorizontalVideo, - 30311 as NDKKind + 30311 as NDKKind, ]); - const contacts = useContacts({ authors: [publicKey] }); + const contacts = useContacts({authors: [publicKey]}); const notes = useSearch({ // search: search, kinds, @@ -84,11 +84,11 @@ export const Feed: React.FC = ({ navigation }) => { }, [activeSortBy]); const handleNavigate = (id: string) => { - navigation.navigate('WatchStream', { streamId: id }); + navigation.navigate('WatchStream', {streamId: id}); }; const handleNavigateToStreamView = (id: string) => { - navigation.navigate('ViewStreamGuest', { streamId: id }); + navigation.navigate('ViewStreamGuest', {streamId: id}); }; return ( @@ -106,7 +106,7 @@ export const Feed: React.FC = ({ navigation }) => { setKinds={setKinds} setSortBy={setSortBy} sortBy={activeSortBy} - // contactList={contacts?.data?.map((item) => item)} + // contactList={contacts?.data?.map((item) => item)} /> {notes?.isLoading && } @@ -128,14 +128,14 @@ export const Feed: React.FC = ({ navigation }) => { /> } ItemSeparatorComponent={() => } - renderItem={({ item }) => } + renderItem={({item}) => } /> } contentContainerStyle={styles.flatListContent} data={feedData} keyExtractor={(item) => item?.id} - renderItem={({ item }) => { + renderItem={({item}) => { if (item.kind === NDKKind.ChannelCreation || item.kind === NDKKind.ChannelMetadata) { return ; } else if (item.kind === NDKKind.ChannelMessage) { @@ -144,7 +144,7 @@ export const Feed: React.FC = ({ navigation }) => { return ; } else if (item.kind === NDKKind.Text) { return ; - } + } // else if (item.kind === 30311) { // return handleNavigateToStreamView(item?.identifier)} @@ -164,7 +164,7 @@ export const Feed: React.FC = ({ navigation }) => { navigation.navigate('MainStack', { screen: 'CreateForm' })} + onPress={() => navigation.navigate('MainStack', {screen: 'CreateForm'})} > diff --git a/apps/mobile/src/screens/Games/index.tsx b/apps/mobile/src/screens/Games/index.tsx index 330ed8ed..d47288d1 100644 --- a/apps/mobile/src/screens/Games/index.tsx +++ b/apps/mobile/src/screens/Games/index.tsx @@ -1,20 +1,20 @@ -import { useState } from 'react'; -import { KeyboardAvoidingView, ScrollView, Text, View } from 'react-native'; -import { SafeAreaView } from 'react-native-safe-area-context'; +import {useState} from 'react'; +import {KeyboardAvoidingView, ScrollView, Text, View} from 'react-native'; +import {SafeAreaView} from 'react-native-safe-area-context'; -import { TextButton } from '../../components'; +import {TextButton} from '../../components'; import TabSelector from '../../components/TabSelector'; -import { useStyles, useTheme } from '../../hooks'; -import { PixelPeace } from '../../modules/PixelPeace'; -import { GameSreenProps } from '../../types'; -import { SelectedTab, TABS_MENU } from '../../types/tab'; -import { AllKeysComponent } from '../KeysMarketplace/AllKeysComponent'; -import { LaunchpadComponent } from '../Launchpad/LaunchpadComponent'; -import { SlinksMap } from '../Slink/SlinksMap'; +import {useStyles, useTheme} from '../../hooks'; +import {PixelPeace} from '../../modules/PixelPeace'; +import {GameSreenProps} from '../../types'; +import {SelectedTab, TABS_MENU} from '../../types/tab'; +import {AllKeysComponent} from '../KeysMarketplace/AllKeysComponent'; +import {LaunchpadComponent} from '../Launchpad/LaunchpadComponent'; +import {SlinksMap} from '../Slink/SlinksMap'; import stylesheet from './styles'; -import { NameserviceComponent } from '../../modules/nameservice'; +import {NameserviceComponent} from '../../modules/nameservice'; -export const Games: React.FC = ({ navigation }) => { +export const Games: React.FC = ({navigation}) => { const theme = useTheme(); const styles = useStyles(stylesheet); const [selectedTab, setSelectedTab] = useState( @@ -62,7 +62,7 @@ export const Games: React.FC = ({ navigation }) => { {selectedTab == SelectedTab.NAMESERVICE && ( - + )} diff --git a/apps/mobile/src/screens/LaunchDetail/index.tsx b/apps/mobile/src/screens/LaunchDetail/index.tsx index c43d590f..1112521a 100644 --- a/apps/mobile/src/screens/LaunchDetail/index.tsx +++ b/apps/mobile/src/screens/LaunchDetail/index.tsx @@ -30,11 +30,11 @@ import { } from '../../types/keys'; import {SelectedTab, TABS_LAUNCH} from '../../types/tab'; import stylesheet from './styles'; -import { TokenHolderDetail } from '../../components/LaunchPad/TokenHolderDetail'; -import { TokenTx } from '../../components/LaunchPad/TokenTx'; +import {TokenHolderDetail} from '../../components/LaunchPad/TokenHolderDetail'; +import {TokenTx} from '../../components/LaunchPad/TokenTx'; // import { TokenStats } from '../../components/LaunchPad/TokenStats'; -import { UserShare } from '../../components/LaunchPad/UserShare'; -import { useGetToken } from '../../hooks/api/indexer/useToken'; +import {UserShare} from '../../components/LaunchPad/UserShare'; +import {useGetToken} from '../../hooks/api/indexer/useToken'; interface LaunchDetailStyles { holdersTotal: ViewStyle; @@ -101,15 +101,14 @@ export const LaunchDetail: React.FC = ({navigation, rou const {showToast} = useToast(); const walletModal = useWalletModal(); - const [amount, setAmount] = useState("0"); + const [amount, setAmount] = useState('0'); - const handleSetAmount = (_amount?:string) => { - let nb_amount= Number(_amount) - if(_amount && isNaN(Number(_amount)) ) { - setAmount(nb_amount?.toFixed(2).toString()) + const handleSetAmount = (_amount?: string) => { + let nb_amount = Number(_amount); + if (_amount && isNaN(Number(_amount))) { + setAmount(nb_amount?.toFixed(2).toString()); } - - } + }; const handleTabSelected = (tab: string | SelectedTab, screen?: string) => { setSelectedTab(tab as any); @@ -119,7 +118,7 @@ export const LaunchDetail: React.FC = ({navigation, rou }; useEffect(() => { - console.log("launchData",launchData) + console.log('launchData', launchData); if (launchData && launchData.data) { setTokens(launchData?.data); setToken(launchData?.data); @@ -196,8 +195,8 @@ export const LaunchDetail: React.FC = ({navigation, rou console.log('token', token); - if (!token?.memecoin_address) { - return showToast({title:"Token can't be find", type:"info"}) + if (!token?.memecoin_address) { + return showToast({title: "Token can't be find", type: 'info'}); } // if (!token?.token_quote) return; // handleBuyKeys(account?.account, token?.owner, token?.token_quote, Number(amount),) @@ -275,7 +274,7 @@ export const LaunchDetail: React.FC = ({navigation, rou isDisabledForm /> )} - + {selectedTab == SelectedTab.LAUNCH_HOLDERS && ( <> @@ -295,7 +294,9 @@ export const LaunchDetail: React.FC = ({navigation, rou )} */} - {selectedTab == SelectedTab.USER_SHARE && launch?.memecoin_address && account?.address ? ( + {selectedTab == SelectedTab.USER_SHARE && + launch?.memecoin_address && + account?.address ? ( = ({navigation, rou /> ) : ( !account?.address && - selectedTab == SelectedTab.USER_SHARE && + selectedTab == SelectedTab.USER_SHARE && launch?.memecoin_address && ( Please connect @@ -362,7 +363,7 @@ export const LaunchDetail: React.FC = ({navigation, rou isDisabledForm /> )} - + {selectedTab == SelectedTab.LAUNCH_HOLDERS && ( <> @@ -382,7 +383,9 @@ export const LaunchDetail: React.FC = ({navigation, rou )} */} - {selectedTab == SelectedTab.USER_SHARE && launch?.memecoin_address && account?.address ? ( + {selectedTab == SelectedTab.USER_SHARE && + launch?.memecoin_address && + account?.address ? ( = ({navigation, rou /> ) : ( !account?.address && - selectedTab == SelectedTab.USER_SHARE && + selectedTab == SelectedTab.USER_SHARE && launch?.memecoin_address && ( Please connect diff --git a/apps/mobile/src/screens/Launchpad/LaunchpadComponent.tsx b/apps/mobile/src/screens/Launchpad/LaunchpadComponent.tsx index 5ccecfaa..696b022f 100644 --- a/apps/mobile/src/screens/Launchpad/LaunchpadComponent.tsx +++ b/apps/mobile/src/screens/Launchpad/LaunchpadComponent.tsx @@ -1,21 +1,20 @@ -import { useAccount } from '@starknet-react/core'; -import { useAuth } from 'afk_nostr_sdk'; -import { useEffect, useState } from 'react'; -import { ActivityIndicator, FlatList, RefreshControl, Text, View } from 'react-native'; +import {useAccount} from '@starknet-react/core'; +import {useAuth} from 'afk_nostr_sdk'; +import {useEffect, useState} from 'react'; +import {ActivityIndicator, FlatList, RefreshControl, Text, View} from 'react-native'; -import { Button } from '../../components'; +import {Button} from '../../components'; import Loading from '../../components/Loading'; -import { TokenLaunchCard } from '../../components/search/TokenLaunchCard'; -import { TokenCard } from '../../components/search/TokenCard'; -import { useStyles, useTheme, useWindowDimensions } from '../../hooks'; -import { useTokenCreatedModal } from '../../hooks/modals/useTokenCreateModal'; -import { useCombinedTokenData } from '../../hooks/useCombinedTokens'; -import { FormLaunchToken } from '../../modules/LaunchTokenPump/FormLaunchToken'; -import { useLaunchpadStore } from '../../store/launchpad'; +import {TokenCard} from '../../components/search/TokenCard'; +import {TokenLaunchCard} from '../../components/search/TokenLaunchCard'; +import {useStyles, useTheme, useWindowDimensions} from '../../hooks'; +import {useMyTokensCreated} from '../../hooks/api/indexer/useMyTokensCreated'; +import {useTokens} from '../../hooks/api/indexer/useTokens'; +import {useTokenCreatedModal} from '../../hooks/modals/useTokenCreateModal'; +import {useCombinedTokenData} from '../../hooks/useCombinedTokens'; +import {FormLaunchToken} from '../../modules/LaunchTokenPump/FormLaunchToken'; +import {useLaunchpadStore} from '../../store/launchpad'; import stylesheet from './styles'; -import { useGetToken } from '../../hooks/api/indexer/useToken'; -import { useMyTokensCreated } from '../../hooks/api/indexer/useMyTokensCreated'; -import { useTokens } from '../../hooks/api/indexer/useTokens'; interface AllKeysComponentInterface { isButtonInstantiateEnable?: boolean; @@ -23,26 +22,30 @@ interface AllKeysComponentInterface { export const LaunchpadComponent: React.FC = ({ isButtonInstantiateEnable, }) => { - const { theme } = useTheme(); + const {theme} = useTheme(); const styles = useStyles(stylesheet); const account = useAccount(); - const { tokens:launchsData, isLoading, isFetching } = useCombinedTokenData(); - const { data:tokens, isLoading:isLoadingTokens, isFetching:isFetchingTokens } = useTokens(); - console.log("tokens data",tokens) - const { data:myTokens, isLoading:isLoadingMyTokens, isFetching:isFetchingMyTokens } = useMyTokensCreated(); - const { show: showModal } = useTokenCreatedModal(); + const {tokens: launchesData, isLoading, isFetching} = useCombinedTokenData(); + const {data: tokens, isLoading: isLoadingTokens, isFetching: isFetchingTokens} = useTokens(); + console.log('tokens data', tokens); + const { + data: myTokens, + isLoading: isLoadingMyTokens, + isFetching: isFetchingMyTokens, + } = useMyTokensCreated(); + const {show: showModal} = useTokenCreatedModal(); const [menuOpen, setMenuOpen] = useState(false); - const { publicKey } = useAuth(); - const { width } = useWindowDimensions(); + const {publicKey} = useAuth(); + const {width} = useWindowDimensions(); const isDesktop = width >= 1024 ? true : false; - const { tokens: tokensStore, setTokens, setLaunchs, launchs } = useLaunchpadStore(); + const {tokens: tokensStore, setTokens, setLaunches, launches} = useLaunchpadStore(); - const [tokenOrLaunch, setTokenOrLauch] = useState<'TOKEN' | 'LAUNCH' | 'MY_DASHBOARD'>('LAUNCH') + const [tokenOrLaunch, setTokenOrLaunch] = useState<'TOKEN' | 'LAUNCH' | 'MY_DASHBOARD'>('LAUNCH'); useEffect(() => { if (tokens?.length != tokensStore?.length) { setTokens(tokens); - setLaunchs(tokens); + setLaunches(tokens); } console.log('tokens', tokens); @@ -63,55 +66,49 @@ export const LaunchpadComponent: React.FC = ({ )} {menuOpen && } - - {isLoading ? ( ) : ( <> - - {tokenOrLaunch == "LAUNCH" && - + {tokenOrLaunch == 'LAUNCH' && ( } keyExtractor={(item, i) => i.toString()} key={`flatlist-${isDesktop ? 3 : 1}`} numColumns={isDesktop ? 3 : 1} - renderItem={({ item, index }) => { + renderItem={({item, index}) => { return ; }} refreshControl={} /> - } - - {tokenOrLaunch == "TOKEN" && + )} + {tokenOrLaunch == 'TOKEN' && ( = ({ keyExtractor={(item, i) => i.toString()} key={`flatlist-${isDesktop ? 3 : 1}`} numColumns={isDesktop ? 3 : 1} - renderItem={({ item, index }) => { + renderItem={({item, index}) => { return ; }} refreshControl={} /> - } - - {tokenOrLaunch == "MY_DASHBOARD" && + )} + {tokenOrLaunch == 'MY_DASHBOARD' && ( <> - My tokens deployed + My tokens deployed = ({ keyExtractor={(item, i) => i.toString()} key={`flatlist-${isDesktop ? 3 : 1}`} numColumns={isDesktop ? 3 : 1} - renderItem={({ item, index }) => { + renderItem={({item, index}) => { return ; }} refreshControl={} /> - - } + )} - - - )} ); diff --git a/apps/mobile/src/screens/Launchpad/styles.ts b/apps/mobile/src/screens/Launchpad/styles.ts index d1d0295c..01299065 100644 --- a/apps/mobile/src/screens/Launchpad/styles.ts +++ b/apps/mobile/src/screens/Launchpad/styles.ts @@ -19,8 +19,8 @@ export default ThemedStyleSheet((theme) => ({ }, activeToggle: { backgroundColor: theme.colors.primary, - color:theme.colors.badge, - border:theme.colors.badgeBorder + color: theme.colors.badge, + border: theme.colors.badgeBorder, }, toggleButton: { flex: 1, diff --git a/apps/mobile/src/screens/Nameservice/LaunchpadComponent.tsx b/apps/mobile/src/screens/Nameservice/LaunchpadComponent.tsx index 5ccecfaa..696b022f 100644 --- a/apps/mobile/src/screens/Nameservice/LaunchpadComponent.tsx +++ b/apps/mobile/src/screens/Nameservice/LaunchpadComponent.tsx @@ -1,21 +1,20 @@ -import { useAccount } from '@starknet-react/core'; -import { useAuth } from 'afk_nostr_sdk'; -import { useEffect, useState } from 'react'; -import { ActivityIndicator, FlatList, RefreshControl, Text, View } from 'react-native'; +import {useAccount} from '@starknet-react/core'; +import {useAuth} from 'afk_nostr_sdk'; +import {useEffect, useState} from 'react'; +import {ActivityIndicator, FlatList, RefreshControl, Text, View} from 'react-native'; -import { Button } from '../../components'; +import {Button} from '../../components'; import Loading from '../../components/Loading'; -import { TokenLaunchCard } from '../../components/search/TokenLaunchCard'; -import { TokenCard } from '../../components/search/TokenCard'; -import { useStyles, useTheme, useWindowDimensions } from '../../hooks'; -import { useTokenCreatedModal } from '../../hooks/modals/useTokenCreateModal'; -import { useCombinedTokenData } from '../../hooks/useCombinedTokens'; -import { FormLaunchToken } from '../../modules/LaunchTokenPump/FormLaunchToken'; -import { useLaunchpadStore } from '../../store/launchpad'; +import {TokenCard} from '../../components/search/TokenCard'; +import {TokenLaunchCard} from '../../components/search/TokenLaunchCard'; +import {useStyles, useTheme, useWindowDimensions} from '../../hooks'; +import {useMyTokensCreated} from '../../hooks/api/indexer/useMyTokensCreated'; +import {useTokens} from '../../hooks/api/indexer/useTokens'; +import {useTokenCreatedModal} from '../../hooks/modals/useTokenCreateModal'; +import {useCombinedTokenData} from '../../hooks/useCombinedTokens'; +import {FormLaunchToken} from '../../modules/LaunchTokenPump/FormLaunchToken'; +import {useLaunchpadStore} from '../../store/launchpad'; import stylesheet from './styles'; -import { useGetToken } from '../../hooks/api/indexer/useToken'; -import { useMyTokensCreated } from '../../hooks/api/indexer/useMyTokensCreated'; -import { useTokens } from '../../hooks/api/indexer/useTokens'; interface AllKeysComponentInterface { isButtonInstantiateEnable?: boolean; @@ -23,26 +22,30 @@ interface AllKeysComponentInterface { export const LaunchpadComponent: React.FC = ({ isButtonInstantiateEnable, }) => { - const { theme } = useTheme(); + const {theme} = useTheme(); const styles = useStyles(stylesheet); const account = useAccount(); - const { tokens:launchsData, isLoading, isFetching } = useCombinedTokenData(); - const { data:tokens, isLoading:isLoadingTokens, isFetching:isFetchingTokens } = useTokens(); - console.log("tokens data",tokens) - const { data:myTokens, isLoading:isLoadingMyTokens, isFetching:isFetchingMyTokens } = useMyTokensCreated(); - const { show: showModal } = useTokenCreatedModal(); + const {tokens: launchesData, isLoading, isFetching} = useCombinedTokenData(); + const {data: tokens, isLoading: isLoadingTokens, isFetching: isFetchingTokens} = useTokens(); + console.log('tokens data', tokens); + const { + data: myTokens, + isLoading: isLoadingMyTokens, + isFetching: isFetchingMyTokens, + } = useMyTokensCreated(); + const {show: showModal} = useTokenCreatedModal(); const [menuOpen, setMenuOpen] = useState(false); - const { publicKey } = useAuth(); - const { width } = useWindowDimensions(); + const {publicKey} = useAuth(); + const {width} = useWindowDimensions(); const isDesktop = width >= 1024 ? true : false; - const { tokens: tokensStore, setTokens, setLaunchs, launchs } = useLaunchpadStore(); + const {tokens: tokensStore, setTokens, setLaunches, launches} = useLaunchpadStore(); - const [tokenOrLaunch, setTokenOrLauch] = useState<'TOKEN' | 'LAUNCH' | 'MY_DASHBOARD'>('LAUNCH') + const [tokenOrLaunch, setTokenOrLaunch] = useState<'TOKEN' | 'LAUNCH' | 'MY_DASHBOARD'>('LAUNCH'); useEffect(() => { if (tokens?.length != tokensStore?.length) { setTokens(tokens); - setLaunchs(tokens); + setLaunches(tokens); } console.log('tokens', tokens); @@ -63,55 +66,49 @@ export const LaunchpadComponent: React.FC = ({ )} {menuOpen && } - - {isLoading ? ( ) : ( <> - - {tokenOrLaunch == "LAUNCH" && - + {tokenOrLaunch == 'LAUNCH' && ( } keyExtractor={(item, i) => i.toString()} key={`flatlist-${isDesktop ? 3 : 1}`} numColumns={isDesktop ? 3 : 1} - renderItem={({ item, index }) => { + renderItem={({item, index}) => { return ; }} refreshControl={} /> - } - - {tokenOrLaunch == "TOKEN" && + )} + {tokenOrLaunch == 'TOKEN' && ( = ({ keyExtractor={(item, i) => i.toString()} key={`flatlist-${isDesktop ? 3 : 1}`} numColumns={isDesktop ? 3 : 1} - renderItem={({ item, index }) => { + renderItem={({item, index}) => { return ; }} refreshControl={} /> - } - - {tokenOrLaunch == "MY_DASHBOARD" && + )} + {tokenOrLaunch == 'MY_DASHBOARD' && ( <> - My tokens deployed + My tokens deployed = ({ keyExtractor={(item, i) => i.toString()} key={`flatlist-${isDesktop ? 3 : 1}`} numColumns={isDesktop ? 3 : 1} - renderItem={({ item, index }) => { + renderItem={({item, index}) => { return ; }} refreshControl={} /> - - } + )} - - - )} ); diff --git a/apps/mobile/src/screens/Nameservice/index.tsx b/apps/mobile/src/screens/Nameservice/index.tsx index baabd979..8f3ce169 100644 --- a/apps/mobile/src/screens/Nameservice/index.tsx +++ b/apps/mobile/src/screens/Nameservice/index.tsx @@ -10,7 +10,7 @@ import {LaunchpadScreenProps, MainStackNavigationProps, NameserviceScreenProps} import {SelectedTab} from '../../types/tab'; import {LaunchpadComponent} from './LaunchpadComponent'; import stylesheet from './styles'; -import { NameserviceComponent } from '../../modules/nameservice'; +import {NameserviceComponent} from '../../modules/nameservice'; export const NameserviceScreen: React.FC = () => { const {theme} = useTheme(); diff --git a/apps/mobile/src/screens/Nameservice/styles.ts b/apps/mobile/src/screens/Nameservice/styles.ts index d1d0295c..01299065 100644 --- a/apps/mobile/src/screens/Nameservice/styles.ts +++ b/apps/mobile/src/screens/Nameservice/styles.ts @@ -19,8 +19,8 @@ export default ThemedStyleSheet((theme) => ({ }, activeToggle: { backgroundColor: theme.colors.primary, - color:theme.colors.badge, - border:theme.colors.badgeBorder + color: theme.colors.badge, + border: theme.colors.badgeBorder, }, toggleButton: { flex: 1, diff --git a/apps/mobile/src/screens/Tips/TipsComponent.tsx b/apps/mobile/src/screens/Tips/TipsComponent.tsx index 9809729e..097d9b26 100644 --- a/apps/mobile/src/screens/Tips/TipsComponent.tsx +++ b/apps/mobile/src/screens/Tips/TipsComponent.tsx @@ -1,43 +1,43 @@ -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 {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'; - -import { Button, Divider, Text } from '../../components'; -import { ESCROW_ADDRESSES } from '../../constants/contracts'; -import { CHAIN_ID } from '../../constants/env'; -import { Entrypoint } from '../../constants/misc'; -import { ETH, STRK } from '../../constants/tokens'; -import { useStyles, useTheme, useTips, useWaitConnection } from '../../hooks'; -import { useClaim, useEstimateClaim } from '../../hooks/api'; -import { useToast, useTransaction, useTransactionModal, useWalletModal } from '../../hooks/modals'; -import { MainStackNavigationProps } from '../../types'; -import { decimalsScale } from '../../utils/helpers'; +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'; + +import {Button, Divider, Text} from '../../components'; +import {ESCROW_ADDRESSES} from '../../constants/contracts'; +import {CHAIN_ID} from '../../constants/env'; +import {Entrypoint} from '../../constants/misc'; +import {ETH, STRK} from '../../constants/tokens'; +import {useStyles, useTheme, useTips, useWaitConnection} from '../../hooks'; +import {useClaim, useEstimateClaim} from '../../hooks/api'; +import {useToast, useTransaction, useTransactionModal, useWalletModal} from '../../hooks/modals'; +import {MainStackNavigationProps} from '../../types'; +import {decimalsScale} from '../../utils/helpers'; import stylesheet from './styles'; export const TipsComponent: React.FC = () => { - const { theme } = useTheme(); + const {theme} = useTheme(); const styles = useStyles(stylesheet); const [loading, setLoading] = useState(false); const tips = useTips(); - const { ndk } = useNostrContext(); + const {ndk} = useNostrContext(); - const { provider } = useProvider(); + const {provider} = useProvider(); const account = useAccount(); - const { sendTransaction } = useTransaction({}); + const {sendTransaction} = useTransaction({}); const claim = useClaim(); const estimateClaim = useEstimateClaim(); const walletModal = useWalletModal(); const waitConnection = useWaitConnection(); - const { show: showTransactionModal } = useTransactionModal(); - const { showToast } = useToast(); + const {show: showTransactionModal} = useTransactionModal(); + const {showToast} = useToast(); const navigation = useNavigation(); const onClaimPress = async (depositId: number) => { @@ -90,7 +90,7 @@ export const TipsComponent: React.FC = () => { entrypoint: Entrypoint.BALANCE_OF, calldata: [connectedAccount.address], }); - const balance = uint256.uint256ToBN({ low: balanceLow, high: balanceHigh }); + const balance = uint256.uint256ToBN({low: balanceLow, high: balanceHigh}); if (balance < gasFee) { // Send the claim through backend @@ -101,14 +101,14 @@ export const TipsComponent: React.FC = () => { showTransactionModal(txHash, async (receipt) => { if (receipt.isSuccess()) { tips.refetch(); - showToast({ type: 'success', title: 'Tip claimed successfully' }); + showToast({type: 'success', title: 'Tip claimed successfully'}); } else { let description = 'Please Try Again Later.'; if (receipt.isRejected()) { description = receipt.transaction_failure_reason.error_message; } - showToast({ type: 'error', title: `Failed to claim the tip. ${description}` }); + showToast({type: 'error', title: `Failed to claim the tip. ${description}`}); } setLoading(false); @@ -150,24 +150,24 @@ export const TipsComponent: React.FC = () => { // ], // }); - const receipt = await sendTransaction( - [{ + const receipt = await sendTransaction([ + { contractAddress: ESCROW_ADDRESSES[CHAIN_ID], entrypoint: Entrypoint.CLAIM, calldata: claimCalldata, - }] - ); + }, + ]); if (receipt?.transaction_hash) { tips.refetch(); - showToast({ type: 'success', title: 'Tip claimed successfully' }); + showToast({type: 'success', title: 'Tip claimed successfully'}); } else { let description = 'Please Try Again Later.'; // if (receipt) { // description = receipt.transaction_failure_reason.error_message; // } - showToast({ type: 'error', title: `Failed to claim the tip. ${description}` }); + showToast({type: 'error', title: `Failed to claim the tip. ${description}`}); } setLoading(false); @@ -187,7 +187,7 @@ export const TipsComponent: React.FC = () => { data={tips.data ?? []} ItemSeparatorComponent={() => } keyExtractor={(item) => item.event.transaction_hash} - renderItem={({ item }) => { + renderItem={({item}) => { const amount = new Fraction(item.amount, decimalsScale(item.token.decimals)).toFixed(6); return ( diff --git a/apps/mobile/src/screens/TokenDetail/index.tsx b/apps/mobile/src/screens/TokenDetail/index.tsx index ebc23e55..4b324a1f 100644 --- a/apps/mobile/src/screens/TokenDetail/index.tsx +++ b/apps/mobile/src/screens/TokenDetail/index.tsx @@ -30,11 +30,11 @@ import { } from '../../types/keys'; import {SelectedTab, TABS_LAUNCH} from '../../types/tab'; import stylesheet from './styles'; -import { TokenHolderDetail } from '../../components/LaunchPad/TokenHolderDetail'; -import { TokenTx } from '../../components/LaunchPad/TokenTx'; -import { TokenStats } from '../../components/LaunchPad/TokenStats'; -import { UserShare } from '../../components/LaunchPad/UserShare'; -import { useGetToken } from '../../hooks/api/indexer/useToken'; +import {TokenHolderDetail} from '../../components/LaunchPad/TokenHolderDetail'; +import {TokenTx} from '../../components/LaunchPad/TokenTx'; +import {TokenStats} from '../../components/LaunchPad/TokenStats'; +import {UserShare} from '../../components/LaunchPad/UserShare'; +import {useGetToken} from '../../hooks/api/indexer/useToken'; interface LaunchDetailStyles { holdersTotal: ViewStyle; @@ -99,15 +99,14 @@ export const TokenDetail: React.FC = ({navigation, rout const {showToast} = useToast(); const walletModal = useWalletModal(); - const [amount, setAmount] = useState("0"); + const [amount, setAmount] = useState('0'); - const handleSetAmount = (_amount?:string) => { - let nb_amount= Number(_amount) - if(_amount && isNaN(Number(_amount)) ) { - setAmount(nb_amount?.toFixed(2).toString()) + const handleSetAmount = (_amount?: string) => { + let nb_amount = Number(_amount); + if (_amount && isNaN(Number(_amount))) { + setAmount(nb_amount?.toFixed(2).toString()); } - - } + }; const handleTabSelected = (tab: string | SelectedTab, screen?: string) => { setSelectedTab(tab as any); @@ -117,7 +116,7 @@ export const TokenDetail: React.FC = ({navigation, rout }; useEffect(() => { - console.log("launchData",launchData) + console.log('launchData', launchData); if (launchData && launchData.data) { setTokens(launchData?.data); setToken(launchData?.data); @@ -194,8 +193,8 @@ export const TokenDetail: React.FC = ({navigation, rout console.log('token', token); - if (!token?.memecoin_address) { - return showToast({title:"Token can't be find", type:"info"}) + if (!token?.memecoin_address) { + return showToast({title: "Token can't be find", type: 'info'}); } // if (!token?.token_quote) return; // handleBuyKeys(account?.account, token?.owner, token?.token_quote, Number(amount),) @@ -273,7 +272,7 @@ export const TokenDetail: React.FC = ({navigation, rout isDisabledForm /> )} - + {selectedTab == SelectedTab.LAUNCH_HOLDERS && ( <> @@ -293,7 +292,9 @@ export const TokenDetail: React.FC = ({navigation, rout )} - {selectedTab == SelectedTab.USER_SHARE && launch?.memecoin_address && account?.address ? ( + {selectedTab == SelectedTab.USER_SHARE && + launch?.memecoin_address && + account?.address ? ( = ({navigation, rout /> ) : ( !account?.address && - selectedTab == SelectedTab.USER_SHARE && + selectedTab == SelectedTab.USER_SHARE && launch?.memecoin_address && ( Please connect @@ -360,7 +361,7 @@ export const TokenDetail: React.FC = ({navigation, rout isDisabledForm /> )} - + {selectedTab == SelectedTab.LAUNCH_HOLDERS && ( <> @@ -380,7 +381,9 @@ export const TokenDetail: React.FC = ({navigation, rout )} - {selectedTab == SelectedTab.USER_SHARE && launch?.memecoin_address && account?.address ? ( + {selectedTab == SelectedTab.USER_SHARE && + launch?.memecoin_address && + account?.address ? ( = ({navigation, rout /> ) : ( !account?.address && - selectedTab == SelectedTab.USER_SHARE && + selectedTab == SelectedTab.USER_SHARE && launch?.memecoin_address && ( Please connect diff --git a/apps/mobile/src/screens/Whatever/index.tsx b/apps/mobile/src/screens/Whatever/index.tsx index 3bec1ffb..0c1a4ba5 100644 --- a/apps/mobile/src/screens/Whatever/index.tsx +++ b/apps/mobile/src/screens/Whatever/index.tsx @@ -1,22 +1,22 @@ -import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; -import { useNavigation } from '@react-navigation/native'; -import { useAccount, useProvider } from '@starknet-react/core'; -import { useNostrContext } from 'afk_nostr_sdk'; -import { useState } from 'react'; -import { View } from 'react-native'; -import { byteArray, cairo, CallData, getChecksumAddress, uint256 } from 'starknet'; +import {NDKEvent, NDKKind} from '@nostr-dev-kit/ndk'; +import {useNavigation} from '@react-navigation/native'; +import {useAccount, useProvider} from '@starknet-react/core'; +import {useNostrContext} from 'afk_nostr_sdk'; +import {useState} from 'react'; +import {View} from 'react-native'; +import {byteArray, cairo, CallData, getChecksumAddress, uint256} from 'starknet'; import TabSelector from '../../components/TabSelector'; -import { ESCROW_ADDRESSES } from '../../constants/contracts'; -import { CHAIN_ID } from '../../constants/env'; -import { Entrypoint } from '../../constants/misc'; -import { ETH, STRK } from '../../constants/tokens'; -import { useStyles, useTheme, useTips, useWaitConnection } from '../../hooks'; -import { useClaim, useEstimateClaim } from '../../hooks/api'; -import { useToast, useTransaction, useTransactionModal, useWalletModal } from '../../hooks/modals'; -import { ChannelComponent } from '../../modules/ChannelCard'; -import { MainStackNavigationProps } from '../../types'; -import { TipsComponent } from '../Tips/TipsComponent'; +import {ESCROW_ADDRESSES} from '../../constants/contracts'; +import {CHAIN_ID} from '../../constants/env'; +import {Entrypoint} from '../../constants/misc'; +import {ETH, STRK} from '../../constants/tokens'; +import {useStyles, useTheme, useTips, useWaitConnection} from '../../hooks'; +import {useClaim, useEstimateClaim} from '../../hooks/api'; +import {useToast, useTransaction, useTransactionModal, useWalletModal} from '../../hooks/modals'; +import {ChannelComponent} from '../../modules/ChannelCard'; +import {MainStackNavigationProps} from '../../types'; +import {TipsComponent} from '../Tips/TipsComponent'; import stylesheet from './styles'; enum SelectedTab { @@ -25,23 +25,23 @@ enum SelectedTab { CHANNELS, } export const Whatever: React.FC = () => { - const { theme } = useTheme(); + const {theme} = useTheme(); const styles = useStyles(stylesheet); const [loading, setLoading] = useState(false); const tips = useTips(); - const { ndk } = useNostrContext(); + const {ndk} = useNostrContext(); - const { provider } = useProvider(); + const {provider} = useProvider(); const account = useAccount(); - const { sendTransaction } = useTransaction({}); + const {sendTransaction} = useTransaction({}); const claim = useClaim(); const estimateClaim = useEstimateClaim(); const walletModal = useWalletModal(); const waitConnection = useWaitConnection(); - const { show: showTransactionModal } = useTransactionModal(); - const { showToast } = useToast(); + const {show: showTransactionModal} = useTransactionModal(); + const {showToast} = useToast(); const navigation = useNavigation(); const onClaimPress = async (depositId: number) => { @@ -93,7 +93,7 @@ export const Whatever: React.FC = () => { entrypoint: Entrypoint.BALANCE_OF, calldata: [connectedAccount.address], }); - const balance = uint256.uint256ToBN({ low: balanceLow, high: balanceHigh }); + const balance = uint256.uint256ToBN({low: balanceLow, high: balanceHigh}); if (balance < gasFee) { // Send the claim through backend @@ -104,14 +104,14 @@ export const Whatever: React.FC = () => { showTransactionModal(txHash, async (receipt) => { if (receipt.isSuccess()) { tips.refetch(); - showToast({ type: 'success', title: 'Tip claimed successfully' }); + showToast({type: 'success', title: 'Tip claimed successfully'}); } else { let description = 'Please Try Again Later.'; if (receipt.isRejected()) { description = receipt.transaction_failure_reason.error_message; } - showToast({ type: 'error', title: `Failed to claim the tip. ${description}` }); + showToast({type: 'error', title: `Failed to claim the tip. ${description}`}); } setLoading(false); @@ -149,23 +149,22 @@ export const Whatever: React.FC = () => { entrypoint: Entrypoint.CLAIM, calldata: claimCalldata, }, - ], - ); + ]); if (receipt?.transaction_hash) { tips.refetch(); - showToast({ type: 'success', title: 'Tip claimed successfully' }); + showToast({type: 'success', title: 'Tip claimed successfully'}); } else { let description = 'Please Try Again Later.'; - showToast({ type: 'error', title: `Failed to claim the tip. ${description}` }); + showToast({type: 'error', title: `Failed to claim the tip. ${description}`}); } setLoading(false); } }; - const TABS: { screen?: string; title: string; tab: SelectedTab }[] = [ + const TABS: {screen?: string; title: string; tab: SelectedTab}[] = [ { title: 'Tips', screen: 'Tips', diff --git a/apps/mobile/src/store/launchpad.ts b/apps/mobile/src/store/launchpad.ts index 62ffc0be..75093b8c 100644 --- a/apps/mobile/src/store/launchpad.ts +++ b/apps/mobile/src/store/launchpad.ts @@ -1,21 +1,21 @@ import {createStore} from 'zustand'; import {UserShareProps} from '../components/LaunchPad/UserShare'; -import {LaunchDataMerged, TokenDeployInterface, TokenLaunchInterface} from '../types/keys'; +import {LaunchDataMerged, TokenDeployInterface} from '../types/keys'; import createBoundedUseStore from './createBoundedUseStore'; type State = { userShare?: UserShareProps; userShares?: UserShareProps[]; tokens?: TokenDeployInterface[]; - launchs?: LaunchDataMerged[]; + launches?: LaunchDataMerged[]; }; type Action = { setUserShares: (userShares: UserShareProps[]) => void; setUserShare: (userShares: UserShareProps) => void; setTokens: (tokens: TokenDeployInterface[]) => void; - setLaunchs: (launchs: LaunchDataMerged[]) => void; + setLaunches: (launches: LaunchDataMerged[]) => void; }; export const launchpadStore = createStore((set, get) => ({ @@ -24,7 +24,7 @@ export const launchpadStore = createStore((set, get) => ({ userShare: undefined as unknown as UserShareProps, userShares: undefined as unknown as UserShareProps[], tokens: undefined as unknown as TokenDeployInterface[], - launchs: undefined as unknown as LaunchDataMerged[], + launches: undefined as unknown as LaunchDataMerged[], setUserShare: (userShare) => { set({userShare}); @@ -35,8 +35,8 @@ export const launchpadStore = createStore((set, get) => ({ setTokens: (tokens) => { set({tokens}); }, - setLaunchs: (launchs) => { - set({launchs}); + setLaunches: (launches) => { + set({launches}); }, })); diff --git a/apps/mobile/src/types/keys.ts b/apps/mobile/src/types/keys.ts index d967e7eb..f43b6cf5 100644 --- a/apps/mobile/src/types/keys.ts +++ b/apps/mobile/src/types/keys.ts @@ -40,7 +40,7 @@ export interface UserShareInterface { export interface TokenDeployInterface { memecoin_address: string; - symbol?:string; + symbol?: string; price: Uint256; name: string; network: string; @@ -82,7 +82,7 @@ export interface TokenTxInterface { memecoin_address: string; owner_address: string; amount: number; - quote_amount?:number; + quote_amount?: number; price: number; coin_received: boolean; liquidity_raised: boolean; diff --git a/apps/mobile/src/types/tab.ts b/apps/mobile/src/types/tab.ts index 12049147..501be148 100644 --- a/apps/mobile/src/types/tab.ts +++ b/apps/mobile/src/types/tab.ts @@ -46,13 +46,13 @@ export enum SelectedTab { AFK_ID, NAMESERVICE, CONTACTS = 'contacts', - HOLDERS = "HOLDERS", - TX = "TX", - SHARES = "SHARES", - STATS = "STATS", - GRAPH = "GRAPH", - DYNAMIC_OWNED = "DYNAMIC_OWNED", - DYNAMIC_ALL = "DYNAMIC_ALL", + HOLDERS = 'HOLDERS', + TX = 'TX', + SHARES = 'SHARES', + STATS = 'STATS', + GRAPH = 'GRAPH', + DYNAMIC_OWNED = 'DYNAMIC_OWNED', + DYNAMIC_ALL = 'DYNAMIC_ALL', } export const TABS_TIP_LIST: {screen?: string; title: string; tab: SelectedTab}[] = [ @@ -396,4 +396,4 @@ export const TABS_NAMESERVICE: {screen?: string; title: string; tab: SelectedTab screen: 'Owned', tab: SelectedTab.DYNAMIC_OWNED, }, -]; \ No newline at end of file +]; diff --git a/apps/mobile/src/utils/format.ts b/apps/mobile/src/utils/format.ts index 95bb199e..be8646b8 100644 --- a/apps/mobile/src/utils/format.ts +++ b/apps/mobile/src/utils/format.ts @@ -20,9 +20,9 @@ export const formatFloatToUint256 = (total_amount_float: number, decimals = 18) export const decodeUsername = (hexUsername: string): string => { try { - return shortString.decodeShortString(hexUsername.replace(/0x0+/, "0x")); + return shortString.decodeShortString(hexUsername.replace(/0x0+/, '0x')); } catch (error) { - console.error("Error decoding username:", error); + console.error('Error decoding username:', error); return hexUsername; } }; @@ -30,4 +30,4 @@ export const decodeUsername = (hexUsername: string): string => { export const formatExpiry = (hexExpiry: string): Date => { const timestamp = parseInt(hexExpiry, 16); return new Date(timestamp * 1000); -}; \ No newline at end of file +}; diff --git a/apps/pwa/package.json b/apps/pwa/package.json index 601206f9..4c427031 100644 --- a/apps/pwa/package.json +++ b/apps/pwa/package.json @@ -10,8 +10,8 @@ "build:nostr_sdk": "cd ../.. && pnpm run build:nostr_sdk", "lint": "next lint", "lint:fix": "next lint --fix", - "prettier": "prettier --write \"src/**/*.{ts,tsx}\"", - "prettier:check": "prettier --check \"src/**/*.{ts,tsx}\"", + "format": "prettier --write \"src/**/*.{ts,tsx}\"", + "format:check": "prettier --check \"src/**/*.{ts,tsx}\"", "ts:check": "tsc --noEmit" }, "dependencies": { diff --git a/apps/pwa/src/theme/index.ts b/apps/pwa/src/theme/index.ts index 4c81afdf..d21891a9 100644 --- a/apps/pwa/src/theme/index.ts +++ b/apps/pwa/src/theme/index.ts @@ -60,7 +60,7 @@ const colors = { body: { body: { // bg: mode("#153e75","#153e75") - fontFamilly: 'monospace', + fontFamily: 'monospace', bg: '#153e75', // useColorMode("#153e75", "#153e75") }, @@ -134,7 +134,7 @@ const theme = extendTheme({ // borderRadius: "base", // <-- border radius is same for all variants and sizes }, fontFamily: 'monospace', - // fontFamilly:"PressStart2P", + // fontFamily:"PressStart2P", // // The default size and variant values defaultProps: { @@ -172,7 +172,7 @@ const theme = extendTheme({ // color: 'white', // }, // }, - // fontFamilly: "monospace", + // fontFamily: "monospace", }, }, }); diff --git a/apps/pwa/src/types/index.ts b/apps/pwa/src/types/index.ts index a78e6a79..988a5061 100644 --- a/apps/pwa/src/types/index.ts +++ b/apps/pwa/src/types/index.ts @@ -1,4 +1,4 @@ -export type ChainString = 'KAKAROT' | 'STARKNET' | 'SEPOLIA' | "STARKNET_SEPOLIA"; +export type ChainString = 'KAKAROT' | 'STARKNET' | 'SEPOLIA' | 'STARKNET_SEPOLIA'; export type Token = 'ETH' | 'STRK' | 'USDC'; export enum GiftType { 'INTERNAL', diff --git a/onchain/cairo/launchpad/docs/launchpad.md b/onchain/cairo/launchpad/docs/launchpad.md index 1692e756..247569fb 100644 --- a/onchain/cairo/launchpad/docs/launchpad.md +++ b/onchain/cairo/launchpad/docs/launchpad.md @@ -6,7 +6,7 @@ launch a bonding curve fair launch, or add liquidity safely and unruggable for y ## What you can do: -- Create token with supply choosen etc +- Create token with supply chosen etc - Launch token bonding curve: in hard test - Add liquidity after bonding curve a. Ekubo (done) diff --git a/onchain/cairo/launchpad/src/tests/liquidity_tests.cairo b/onchain/cairo/launchpad/src/tests/liquidity_tests.cairo index 1f5d16b8..1e34463d 100644 --- a/onchain/cairo/launchpad/src/tests/liquidity_tests.cairo +++ b/onchain/cairo/launchpad/src/tests/liquidity_tests.cairo @@ -432,7 +432,7 @@ mod liquidity_tests { contract_address_salt: SALT() + 1, is_launch_bonding_now: false ); - println!("token_address unrug lp withouth launch curve: {:?}", token_address.clone()); + println!("token_address unrug lp without launch curve: {:?}", token_address.clone()); // start_cheat_caller_address(token_address, launchpad.contract_address); @@ -604,14 +604,14 @@ mod liquidity_tests { bound: 88719042 }; start_cheat_caller_address(launchpad.contract_address, OWNER()); - println!("buy liquidity threshold unrug withouth threshold"); + println!("buy liquidity threshold unrug without threshold"); run_buy_by_amount( launchpad, quote_token, memecoin, THRESHOLD_LIQUIDITY, token_address, OWNER(), ); let balance_quote_launch = quote_token.balance_of(launchpad.contract_address); // println!("balance_quote_launch {:?}", balance_quote_launch); - println!("add liquidity unrug lp withtout threshold"); + println!("add liquidity unrug lp without threshold"); let (id, position) = launchpad .add_liquidity_unrug_lp( token_address, diff --git a/packages/afk_nostr_sdk/src/context/NostrContext.tsx b/packages/afk_nostr_sdk/src/context/NostrContext.tsx index d632bab4..9d03e667 100644 --- a/packages/afk_nostr_sdk/src/context/NostrContext.tsx +++ b/packages/afk_nostr_sdk/src/context/NostrContext.tsx @@ -50,6 +50,7 @@ export const NostrProvider: React.FC = ({children}) => ? nip07Signer : undefined, }); + console.log('test'); newNdk.connect().then(() => { setNdk(newNdk);