From dacd6f67214969bed882db207d3c2b574873418d Mon Sep 17 00:00:00 2001 From: Singupalli Kartik Date: Sat, 30 Nov 2024 15:03:08 +0530 Subject: [PATCH 01/13] added contract to soon and fixed added create campaign --- ...8X24qwGvG2kpTcogg3Wpvu31FrErpLU8vw6oT.json | 1 + anchor/Anchor.toml | 2 +- anchor/programs/dashh/src/lib.rs | 2 +- anchor/src/dashh-exports.ts | 4 +- anchor/target/idl/dashh.json | 6 +- anchor/target/types/dashh.ts | 6 +- package-lock.json | 75 +++- package.json | 26 +- src/app/account/[address]/page.tsx | 5 + src/app/account/page.tsx | 5 + src/app/api/donate/[id]/route.ts | 65 +-- src/app/api/generate/campaigns/route.ts | 1 - src/app/api/generate/route.ts | 1 - src/app/api/posts/route.ts | 6 +- src/app/api/reclaim/[id]/route.ts | 4 +- src/app/api/redirect/route.ts | 1 - src/app/blinkcard/Preblink.tsx | 62 +++ src/app/blinkcard/SolanaBlinksCard.tsx | 2 +- src/app/clusters/page.tsx | 5 + src/app/connectPhantomWallet/connectbtn.tsx | 3 +- src/app/creatordashboard/creatorpage.tsx | 118 ++--- src/app/creatordashboard/page.tsx | 20 +- src/app/creatorlogin/page.tsx | 90 ++++ src/app/dashboard/creatorpage.tsx | 20 +- src/app/dashboard/page.tsx | 85 +++- src/app/dashh/page.tsx | 5 + src/app/form/page.tsx | 402 ++++++++++-------- src/app/layout.tsx | 17 +- src/app/not-found.tsx | 11 + src/app/page.tsx | 4 +- src/app/react-query-provider.tsx | 15 + src/app/verifyClaim/[uid]/page.tsx | 74 ++-- src/app/verifyClaim/text.cpp | 1 + .../account/account-data-access.tsx | 177 ++++++++ .../account/account-detail-feature.tsx | 48 +++ .../account/account-list-feature.tsx | 22 + src/components/account/account-ui.tsx | 352 +++++++++++++++ .../cluster/cluster-data-access.tsx | 117 +++++ src/components/cluster/cluster-feature.tsx | 22 + src/components/cluster/cluster-ui.tsx | 176 ++++++++ .../dashboard/dashboard-feature.tsx | 31 ++ src/components/dashh/dashh-data-access.tsx | 154 +++++++ src/components/dashh/dashh-feature.tsx | 37 ++ src/components/dashh/dashh-ui.tsx | 122 ++++++ src/components/header.tsx | 26 +- src/components/hero-section.tsx | 2 - src/components/hero2.tsx | 2 +- src/components/solana/solana-provider.tsx | 6 +- src/components/ui/dialog.tsx | 2 +- src/components/ui/ui-layout.tsx | 160 +++++++ src/lib/dbconnect.ts | 4 +- 51 files changed, 2127 insertions(+), 477 deletions(-) create mode 100644 anchor/ALH8UD28X24qwGvG2kpTcogg3Wpvu31FrErpLU8vw6oT.json create mode 100644 src/app/account/[address]/page.tsx create mode 100644 src/app/account/page.tsx create mode 100644 src/app/blinkcard/Preblink.tsx create mode 100644 src/app/clusters/page.tsx create mode 100644 src/app/creatorlogin/page.tsx create mode 100644 src/app/dashh/page.tsx create mode 100644 src/app/not-found.tsx create mode 100644 src/app/react-query-provider.tsx create mode 100644 src/app/verifyClaim/text.cpp create mode 100644 src/components/account/account-data-access.tsx create mode 100644 src/components/account/account-detail-feature.tsx create mode 100644 src/components/account/account-list-feature.tsx create mode 100644 src/components/account/account-ui.tsx create mode 100644 src/components/cluster/cluster-data-access.tsx create mode 100644 src/components/cluster/cluster-feature.tsx create mode 100644 src/components/cluster/cluster-ui.tsx create mode 100644 src/components/dashboard/dashboard-feature.tsx create mode 100644 src/components/dashh/dashh-data-access.tsx create mode 100644 src/components/dashh/dashh-feature.tsx create mode 100644 src/components/dashh/dashh-ui.tsx create mode 100644 src/components/ui/ui-layout.tsx diff --git a/anchor/ALH8UD28X24qwGvG2kpTcogg3Wpvu31FrErpLU8vw6oT.json b/anchor/ALH8UD28X24qwGvG2kpTcogg3Wpvu31FrErpLU8vw6oT.json new file mode 100644 index 0000000..18aa8eb --- /dev/null +++ b/anchor/ALH8UD28X24qwGvG2kpTcogg3Wpvu31FrErpLU8vw6oT.json @@ -0,0 +1 @@ +[243,231,65,226,67,82,76,126,131,209,171,118,251,45,166,75,89,26,209,221,68,133,192,49,85,66,226,71,214,84,240,132,138,169,116,95,29,213,89,189,108,93,248,33,83,144,30,173,112,101,127,190,107,208,101,29,157,39,62,26,145,127,81,154] \ No newline at end of file diff --git a/anchor/Anchor.toml b/anchor/Anchor.toml index ed21f8e..1477b2c 100644 --- a/anchor/Anchor.toml +++ b/anchor/Anchor.toml @@ -6,7 +6,7 @@ resolution = true skip-lint = false [programs.localnet] -dashh = "2cdoyYdYcU25bCXoLViEoKkSN3g18nHztXrf98AfsQUi" +dashh = "5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP" [registry] url = "https://api.apr.dev" diff --git a/anchor/programs/dashh/src/lib.rs b/anchor/programs/dashh/src/lib.rs index f50c783..6cf6a48 100644 --- a/anchor/programs/dashh/src/lib.rs +++ b/anchor/programs/dashh/src/lib.rs @@ -2,7 +2,7 @@ use anchor_lang::prelude::*; -declare_id!("2cdoyYdYcU25bCXoLViEoKkSN3g18nHztXrf98AfsQUi"); +declare_id!("5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP"); // creater caimpaign // user participate in campaign // user can claim reward diff --git a/anchor/src/dashh-exports.ts b/anchor/src/dashh-exports.ts index fb1a4e3..15c917f 100644 --- a/anchor/src/dashh-exports.ts +++ b/anchor/src/dashh-exports.ts @@ -16,12 +16,12 @@ export function getDashhProgram(provider: AnchorProvider) { } // This is a helper function to get the program ID for the Dashh program depending on the cluster. -export function getDashhProgramId(cluster: Cluster) { +export function getDashhProgramId(cluster: Cluster = 'devnet') { switch (cluster) { case 'devnet': case 'testnet': // This is the program ID for the Dashh program on devnet and testnet. - return new PublicKey('2cdoyYdYcU25bCXoLViEoKkSN3g18nHztXrf98AfsQUi') + return new PublicKey('5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP') case 'mainnet-beta': default: return DASHH_PROGRAM_ID diff --git a/anchor/target/idl/dashh.json b/anchor/target/idl/dashh.json index 6f2eb68..0eb73be 100644 --- a/anchor/target/idl/dashh.json +++ b/anchor/target/idl/dashh.json @@ -1,5 +1,5 @@ { - "address": "2cdoyYdYcU25bCXoLViEoKkSN3g18nHztXrf98AfsQUi", + "address": "5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP", "metadata": { "name": "dashh", "version": "0.1.0", @@ -239,6 +239,10 @@ { "name": "reward", "type": "u64" + }, + { + "name": "owner", + "type": "pubkey" } ] } diff --git a/anchor/target/types/dashh.ts b/anchor/target/types/dashh.ts index 072440d..d6bd508 100644 --- a/anchor/target/types/dashh.ts +++ b/anchor/target/types/dashh.ts @@ -5,7 +5,7 @@ * IDL can be found at `target/idl/dashh.json`. */ export type Dashh = { - "address": "2cdoyYdYcU25bCXoLViEoKkSN3g18nHztXrf98AfsQUi", + "address": "5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP", "metadata": { "name": "dashh", "version": "0.1.0", @@ -245,6 +245,10 @@ export type Dashh = { { "name": "reward", "type": "u64" + }, + { + "name": "owner", + "type": "pubkey" } ] } diff --git a/package-lock.json b/package-lock.json index 3c96704..58ba108 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,12 +30,13 @@ "@solana/wallet-adapter-react-ui": "^0.9.35", "@solana/web3.js": "^1.95.3", "@tabler/icons-react": "^3.22.0", - "@tanstack/react-query": "^5.51.11", - "@tanstack/react-query-next-experimental": "^5.51.11", + "@tanstack/react-query": "^5.61.5", + "@tanstack/react-query-next-experimental": "^5.61.5", "@types/react-router-dom": "^5.3.3", "anchor-bankrun": "^0.5.0", "arweave": "^1.15.5", "axios": "^1.7.7", + "bn.js": "^5.2.1", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "cors": "^2.8.5", @@ -57,9 +58,11 @@ "styled-components": "^6.1.13", "tailwind-merge": "^2.5.3", "tailwindcss-animate": "^1.0.7", - "three": "^0.170.0" + "three": "^0.170.0", + "uuid": "^11.0.3" }, "devDependencies": { + "@types/bn.js": "^5.1.6", "@types/cors": "^2.8.17", "@types/node": "^20", "@types/react": "^18", @@ -5868,9 +5871,9 @@ } }, "node_modules/@tanstack/query-core": { - "version": "5.61.4", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.61.4.tgz", - "integrity": "sha512-rsnemyhPvEG4ViZe0R2UQDM8NgQS/BNC5/Gf9RTs0TKN5thUhPUwnL2anWG4jxAGKFyDfvG7PXbx6MRq3hxi1w==", + "version": "5.61.5", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.61.5.tgz", + "integrity": "sha512-iG5vqurEOEbv+paP6kW3zPENa99kSIrd1THISJMaTwVlJ+N5yjVDNOUwp9McK2DWqWCXM3v13ubBbAyhxT78UQ==", "license": "MIT", "funding": { "type": "github", @@ -5878,12 +5881,12 @@ } }, "node_modules/@tanstack/react-query": { - "version": "5.61.4", - "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.61.4.tgz", - "integrity": "sha512-Nh5+0V4fRVShSeDHFTVvzJrvwTdafIvqxyZUrad71kJWL7J+J5Wrd/xcHTWfSL1mR/9eoufd2roXOpL3F16ECA==", + "version": "5.61.5", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.61.5.tgz", + "integrity": "sha512-rjy8aqPgBBEz/rjJnpnuhi8TVkVTorMUsJlM3lMvrRb5wK6yzfk34Er0fnJ7w/4qyF01SnXsLB/QsTBsLF5PaQ==", "license": "MIT", "dependencies": { - "@tanstack/query-core": "5.61.4" + "@tanstack/query-core": "5.61.5" }, "funding": { "type": "github", @@ -5894,16 +5897,16 @@ } }, "node_modules/@tanstack/react-query-next-experimental": { - "version": "5.61.4", - "resolved": "https://registry.npmjs.org/@tanstack/react-query-next-experimental/-/react-query-next-experimental-5.61.4.tgz", - "integrity": "sha512-H5jUqQtW5IaPlMMAgbRr8rQLjvYfY/5hdpMis19clLNBSCDysqSxFgqZMWFb3g9U1FCrmIr+GYDBTc0zow9lLg==", + "version": "5.61.5", + "resolved": "https://registry.npmjs.org/@tanstack/react-query-next-experimental/-/react-query-next-experimental-5.61.5.tgz", + "integrity": "sha512-gV/B41wjPXVOZcN7fjFza+Jx/QjZvVcbQRo/GGwMwAwgtRmpjEZxdvPch9hzYQu+aBSzlL7zflyA3SeVyVd8LQ==", "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" }, "peerDependencies": { - "@tanstack/react-query": "^5.61.4", + "@tanstack/react-query": "^5.61.5", "next": "^13 || ^14 || ^15", "react": "^18 || ^19" } @@ -5959,6 +5962,16 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/bn.js": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.6.tgz", + "integrity": "sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/connect": { "version": "3.4.38", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", @@ -7389,7 +7402,8 @@ "node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", + "license": "MIT" }, "node_modules/borsh": { "version": "0.7.0", @@ -11072,6 +11086,15 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, + "node_modules/jayson/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/jayson/node_modules/ws": { "version": "7.5.10", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", @@ -14832,6 +14855,15 @@ "@types/node": "*" } }, + "node_modules/rpc-websockets/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", @@ -16654,11 +16686,16 @@ } }, "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.3.tgz", + "integrity": "sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", "bin": { - "uuid": "dist/bin/uuid" + "uuid": "dist/esm/bin/uuid" } }, "node_modules/vary": { diff --git a/package.json b/package.json index 405d8a4..f5a432d 100644 --- a/package.json +++ b/package.json @@ -14,18 +14,6 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - - "@solana/wallet-adapter-base": "^0.9.23", - "@solana/wallet-adapter-react": "^0.15.35", - "@solana/wallet-adapter-react-ui": "^0.9.35", - - "@tanstack/react-query": "^5.51.11", - "@tanstack/react-query-next-experimental": "^5.51.11", - "anchor-bankrun": "^0.5.0", - "daisyui": "^4.12.10", - "jotai": "^2.9.1", - - "react-hot-toast": "^2.4.1", "@emotion/react": "^11.13.5", "@emotion/styled": "^11.13.5", "@fortawesome/fontawesome-free": "^6.6.0", @@ -42,15 +30,24 @@ "@reclaimprotocol/js-sdk": "^2.0.0", "@solana/actions": "^1.6.5", "@solana/spl-token": "^0.4.8", + "@solana/wallet-adapter-base": "^0.9.23", + "@solana/wallet-adapter-react": "^0.15.35", + "@solana/wallet-adapter-react-ui": "^0.9.35", "@solana/web3.js": "^1.95.3", "@tabler/icons-react": "^3.22.0", + "@tanstack/react-query": "^5.61.5", + "@tanstack/react-query-next-experimental": "^5.61.5", "@types/react-router-dom": "^5.3.3", + "anchor-bankrun": "^0.5.0", "arweave": "^1.15.5", "axios": "^1.7.7", + "bn.js": "^5.2.1", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "cors": "^2.8.5", + "daisyui": "^4.12.10", "framer-motion": "^11.11.11", + "jotai": "^2.9.1", "lucide-react": "^0.447.0", "mongoose": "^8.7.0", "morgan": "^1.10.0", @@ -58,6 +55,7 @@ "react": "^18", "react-datepicker": "^7.5.0", "react-dom": "^18", + "react-hot-toast": "^2.4.1", "react-qr-code": "^2.0.15", "react-router-dom": "^6.27.0", "react-syntax-highlighter": "^15.6.1", @@ -65,9 +63,11 @@ "styled-components": "^6.1.13", "tailwind-merge": "^2.5.3", "tailwindcss-animate": "^1.0.7", - "three": "^0.170.0" + "three": "^0.170.0", + "uuid": "^11.0.3" }, "devDependencies": { + "@types/bn.js": "^5.1.6", "@types/cors": "^2.8.17", "@types/node": "^20", "@types/react": "^18", diff --git a/src/app/account/[address]/page.tsx b/src/app/account/[address]/page.tsx new file mode 100644 index 0000000..5bb6688 --- /dev/null +++ b/src/app/account/[address]/page.tsx @@ -0,0 +1,5 @@ +import AccountDetailFeature from '@/components/account/account-detail-feature' + +export default function Page() { + return +} diff --git a/src/app/account/page.tsx b/src/app/account/page.tsx new file mode 100644 index 0000000..1b0e276 --- /dev/null +++ b/src/app/account/page.tsx @@ -0,0 +1,5 @@ +import AccountListFeature from '@/components/account/account-list-feature' + +export default function Page() { + return +} diff --git a/src/app/api/donate/[id]/route.ts b/src/app/api/donate/[id]/route.ts index 3590b73..7eb6e75 100644 --- a/src/app/api/donate/[id]/route.ts +++ b/src/app/api/donate/[id]/route.ts @@ -1,58 +1,33 @@ -import connectDB from "@/lib/dbconnect"; +import {useDashhProgramAccount} from "@/components/dashh/dashh-data-access"; import Creator from "@/lib/models/creater"; import User from "@/lib/models/user"; + import { ActionGetResponse, ActionPostRequest, ActionPostResponse, ACTIONS_CORS_HEADERS } from "@solana/actions"; import { clusterApiUrl, Connection, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; -import mongoose from "mongoose"; + export async function GET(request:Request ,params:{params:{id:string} }){ const url = new URL(request.url); - // console.log("url: ",); - // const { searchParams } = new URL(request.url); - // console.log("searchParams: " +searchParams); - // const id = searchParams.get('id')||""; - // console.log("id" +id); - const id = await params.params.id; - -console.log("id", id); - let creator; - if (!mongoose.Types.ObjectId.isValid(id as string)) { - creator = { - icons: "https://cdn.vectorstock.com/i/500p/04/45/solana-logo-coin-icon-isolated-vector-43670445.jpg", - title: "Donate to Solana", - description: "Donate to the Solana Foundation to support the Solana ecosystem.", - label: "Donate", - }; - } - else{ - - - try{ - await connectDB(); - creator = await Creator.findOne({ _id: id }); -console.log(creator); -if (!creator) { - creator = { - icons: "https://cdn.vectorstock.com/i/500p/04/45/solana-logo-coin-icon-isolated-vector-43670445.jpg", - title: "Donate to Solana", - description: "Donate to the Solana Foundation to support the Solana ecosystem.", - label: "Donate", - }; -} + console.log(id); + const { accountQuery } = useDashhProgramAccount({ + account:new PublicKey(id as string), + }); + console.log("account query ",accountQuery); + +const creator = { + icons: accountQuery.data?.image , + title : accountQuery.data?.title, + description : accountQuery.data?.description, + label : accountQuery.data?.lable, +}; - // console.log(creator); - + - } - catch(e){ - return Response.json({error:e},{status:400,headers:ACTIONS_CORS_HEADERS}); - } -} const payload:ActionGetResponse = { - icon: creator.icons, - title: creator.title, - description:creator.description , - label:creator.label, + icon: creator.icons? creator.icons : "https://cdn.vectorstock.com/i/500p/04/45/solana-logo-coin-icon-isolated-vector-43670445.jpg", + title: creator.title ? creator.title : "Donate to Solana", + description:creator.description ? creator.description : "Donate to the Solana Foundation to support the Solana ecosystem.", + label:creator.label ? creator.label : "Donate", links: { actions :[ diff --git a/src/app/api/generate/campaigns/route.ts b/src/app/api/generate/campaigns/route.ts index ee46252..8526418 100644 --- a/src/app/api/generate/campaigns/route.ts +++ b/src/app/api/generate/campaigns/route.ts @@ -9,7 +9,6 @@ export async function GET(request: Request) { export const OPTIONS = async () => Response.json(null, { headers }); export async function POST(request:Request){ const body:ActionPostRequest=await request.json(); - console.log(body.account); const payload:ActionPostResponse={ type:"external-link", diff --git a/src/app/api/generate/route.ts b/src/app/api/generate/route.ts index 09d887b..48d1e25 100644 --- a/src/app/api/generate/route.ts +++ b/src/app/api/generate/route.ts @@ -94,7 +94,6 @@ export async function POST(request: Request) { const body: ActionPostRequest = await request.json(); const url = new URL(request.url); const amount = Number(url.searchParams.get("amount")); - console.log(amount); let sender; // let camurl; let payload: ActionPostResponse; diff --git a/src/app/api/posts/route.ts b/src/app/api/posts/route.ts index 17a74ee..eb7052f 100644 --- a/src/app/api/posts/route.ts +++ b/src/app/api/posts/route.ts @@ -43,7 +43,7 @@ await connectDB(); }); await newPost.save(); - console.log(newPost); + return Response.json({ message: 'Post created successfully', data: newPost }); } catch (error) { return Response.json({ message: 'Internal Server Error', error }); @@ -55,11 +55,11 @@ export const PUT = async(req: Request, res:Response)=> { await runMiddleware(req, res, cors); try { const data = await req.json(); - console.log(data); + const { id, igProfile, views } = data; const updatedPost = await User.findByIdAndUpdate(id, { igProfile, views }, { new: true }); - console.log(updatedPost); + return Response.json({ message: 'Post updated successfully', data: updatedPost }); } catch (error) { return Response.json({ message: 'Internal Server Error', error }); } diff --git a/src/app/api/reclaim/[id]/route.ts b/src/app/api/reclaim/[id]/route.ts index 4ef0e43..0d6f50d 100644 --- a/src/app/api/reclaim/[id]/route.ts +++ b/src/app/api/reclaim/[id]/route.ts @@ -9,11 +9,11 @@ export async function GET(request: Request) { export const OPTIONS = async () => Response.json(null, { headers }); export async function POST(request:Request,params:{params:{id:string}}){ const body:ActionPostRequest=await request.json(); - console.log(body.account); + const payload:ActionPostResponse={ type:"external-link", - externalLink:`https://reclaim-verify-xmm5.vercel.app/?id=${params.params.id}&wallet=${body.account}`, + externalLink:`https://blinks.knowflow.study/verifyClaim/?id=${params.params.id}&wallet=${body.account}`, message:"Redirected to reaclaim verify", } return Response.json(payload,{ diff --git a/src/app/api/redirect/route.ts b/src/app/api/redirect/route.ts index 5f89906..e1a97ef 100644 --- a/src/app/api/redirect/route.ts +++ b/src/app/api/redirect/route.ts @@ -1,6 +1,5 @@ export async function POST() { - console.log('yaha aya'); return Response.redirect("https://blinks.knowflow.study/form"); } \ No newline at end of file diff --git a/src/app/blinkcard/Preblink.tsx b/src/app/blinkcard/Preblink.tsx new file mode 100644 index 0000000..2613056 --- /dev/null +++ b/src/app/blinkcard/Preblink.tsx @@ -0,0 +1,62 @@ +import { Card } from '@/components/ui/card' +import React from 'react' +import { SolanaBlinksCard } from './SolanaBlinksCard' +import { useDashhProgramAccount } from '@/components/dashh/dashh-data-access'; +import { PublicKey } from '@solana/web3.js'; +import { ICreator } from '@/lib/interface/creater'; +import BN from 'bn.js'; +const Preblink = ({ account }: { account: PublicKey }) => { + const { accountQuery } = useDashhProgramAccount({ + account, + }); + + const title = accountQuery.data?.title; + const icon= accountQuery.data?.image; + const message = accountQuery.data?.description; + const lable = accountQuery.data?.lable; + const endtime = accountQuery.data?.endtime; + const reward = accountQuery.data?.reward; + const owner =account.toBase58(); +const id = accountQuery.data?.id; + + // const title = accountQuery.data?.title; + + // const isFormValid = message.trim() !== ""; + + // const handleSubmit = () => { + // if (publicKey && isFormValid && title) { + // updateEntry.mutateAsync({ title, message, owner: publicKey }); + // } + // }; + + // if (!publicKey) { + // return

Connect your wallet

; + // } const idAsNumber = new BN(id).toNumber(); + const idAsNumber = new BN(id || 0).toNumber(); + const rewardAsNumber = new BN(reward || 0).toNumber(); + const endAsNumber = new BN(endtime || 0).toNumber(); + + const cat: ICreator = { + id: idAsNumber.toString(), // Ensure id is a string if that's the type in ICreator + title: title ? title : "", + icons: message ? message : "", + description: icon ? icon : "", + label: lable ? lable : "", + end: new Date(endAsNumber), // Ensure endtime is a Date object + amount: rewardAsNumber, + solAdd: owner ? owner : "", + users: [], + _id: idAsNumber.toString(), // Ensure _id is a string if that's the type in ICreator + }; + + + return ( +<> + + + + + ) +} + +export default Preblink \ No newline at end of file diff --git a/src/app/blinkcard/SolanaBlinksCard.tsx b/src/app/blinkcard/SolanaBlinksCard.tsx index cbe0547..08cdc2e 100644 --- a/src/app/blinkcard/SolanaBlinksCard.tsx +++ b/src/app/blinkcard/SolanaBlinksCard.tsx @@ -63,7 +63,7 @@ export function SolanaBlinksCard({ content, id }: { content: ICreator; id: strin
BLINK NOW diff --git a/src/app/clusters/page.tsx b/src/app/clusters/page.tsx new file mode 100644 index 0000000..d83613f --- /dev/null +++ b/src/app/clusters/page.tsx @@ -0,0 +1,5 @@ + + +export default function Page() { + return <> +} diff --git a/src/app/connectPhantomWallet/connectbtn.tsx b/src/app/connectPhantomWallet/connectbtn.tsx index 752dcaa..2e99a98 100644 --- a/src/app/connectPhantomWallet/connectbtn.tsx +++ b/src/app/connectPhantomWallet/connectbtn.tsx @@ -10,7 +10,6 @@ interface ConnectPhantomWalletProps { } export default function ConnectPhantomWallet({ - walletAddress, setWalletAddress, }: ConnectPhantomWalletProps) { const [isClient, setIsClient] = useState(false); @@ -24,7 +23,7 @@ export default function ConnectPhantomWallet({ setIsConnected(true); } }, []); - console.log(walletAddress); + // Check if Phantom Wallet is installed const isPhantomInstalled = () => { diff --git a/src/app/creatordashboard/creatorpage.tsx b/src/app/creatordashboard/creatorpage.tsx index cd90834..d4853eb 100644 --- a/src/app/creatordashboard/creatorpage.tsx +++ b/src/app/creatordashboard/creatorpage.tsx @@ -1,67 +1,56 @@ "use client"; - -import React, { useState, useEffect } from "react"; - -import { Card } from "@/components/ui/card"; - -// import { Badge } from "@/components/ui/badge"; -// import { Zap } from "lucide-react"; -import { SolanaBlinksCard } from "../blinkcard/SolanaBlinksCard"; -// import connectDB from "@/lib/dbconnect"; -// import { ICreator } from "@/lib/interface/creater"; -// import Creator from "@/lib/models/creater"; +import React, { useState } from "react"; import Link from "next/link"; -import { ICreator } from "@/lib/interface/creater"; import CustomToggle from "@/components/custom-toggle"; +import { useDashhProgram } from "@/components/dashh/dashh-data-access"; +import Preblink from "../blinkcard/Preblink"; +import { useAnchorProvider } from "@/components/solana/solana-provider"; +import { BN } from "@coral-xyz/anchor"; -const Creatorpage = ({ creator }: { creator: ICreator[] }) => { - const [walletAddress, setWalletAddress] = useState(""); +const Creatorpage = () => { + const provider = useAnchorProvider() + const { accounts, getProgramAccount } = useDashhProgram(); const [selectedOption, setSelectedOption] = useState("Live"); - - const handleToggle = (selected: string) => { - setSelectedOption(selected); - }; - const isPhantomInstalled = () => { + if (getProgramAccount.isLoading) { + return ; + } + if(! provider.wallet.publicKey){ return ( - typeof window !== "undefined" && - window.solana && - (window.solana.isPhantom || window.solana.isMobile) +
+ + Please connect your wallet to view the events. + +
); - }; - async function getSolanaAddress() { - if (isPhantomInstalled()) { - try { - const { solana }: any = window; - // Request connection to Phantom - const response = await solana.connect(); - console.log("Connected to wallet:", response.publicKey.toString()); - setWalletAddress(response.publicKey.toString()); - } catch (error) { - console.error("Error connecting to Phantom wallet:", error); - } - } } - useEffect(() => { - const searchParams = new URLSearchParams(window.location.search); - - const id = searchParams.get("id"); - if (!id) { - getSolanaAddress(); - } else { - setWalletAddress(id); - } - // getSolanaAddress(); - }, []); - - creator = creator.filter((creator) => creator.solAdd == walletAddress); - + if (!getProgramAccount.data?.value) { + return ( +
+ + Program account not found. Make sure you have deployed the program and + are on the correct cluster. + +
+ ); + } + let creator = accounts.data?.filter((account) => account.account.owner.toString == provider.wallet.publicKey.toString); const yesterday = new Date(); yesterday.setDate(yesterday.getDate() - 1); if (selectedOption === "Closed") { - creator = creator.filter((creator) => new Date(creator.end) < yesterday); + creator = creator?.filter((creato) => new Date(new BN(creato.account.endtime).toNumber()) < yesterday); } else { - creator = creator.filter((creator) => new Date(creator.end) > yesterday); + creator = creator?.filter((creato) => new Date(new BN(creato.account.endtime).toNumber()) > yesterday); + } + if(accounts.data){ + creator = creator?.sort((a, b) => { + const aDaysLeft = (new Date(new BN(a.account.endtime).toNumber()).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24); + const bDaysLeft = (new Date(new BN(b.account.endtime).toNumber()).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24); + return bDaysLeft-aDaysLeft; + }); } + const handleToggle = (option:any) => { + setSelectedOption(option); + }; return (
@@ -70,7 +59,7 @@ const Creatorpage = ({ creator }: { creator: ICreator[] }) => {
- + @@ -80,31 +69,10 @@ const Creatorpage = ({ creator }: { creator: ICreator[] }) => { Creater's Event
- {creator.map((cat) => { + {creator?.map((cat) => { return ( <> - - {/* - - - {creator.title} - - - -
-

Total Prize

-

{creator.amount}

-
- -
-

Network Status

- - Active - -
-
*/} - -
+ ); })} diff --git a/src/app/creatordashboard/page.tsx b/src/app/creatordashboard/page.tsx index 2677612..aeb2f56 100644 --- a/src/app/creatordashboard/page.tsx +++ b/src/app/creatordashboard/page.tsx @@ -1,28 +1,10 @@ - - -import connectDB from "@/lib/dbconnect"; -import { ICreator } from "@/lib/interface/creater"; -import Creator from "@/lib/models/creater"; - import Creatorpage from "./creatorpage"; export const dynamic = 'force-dynamic' export default async function Component() { - - - let creators: ICreator[] = []; - try { - await connectDB(); - creators = await Creator.find().sort({ _id: -1 }); - - console.log(creators); - } catch (error) { - console.error(error); - } - return (
- +
); diff --git a/src/app/creatorlogin/page.tsx b/src/app/creatorlogin/page.tsx new file mode 100644 index 0000000..bbc5dca --- /dev/null +++ b/src/app/creatorlogin/page.tsx @@ -0,0 +1,90 @@ +import React from 'react' + +const Page = () => { + return ( +
Page
+ ) +} + +export default Page +// "use client" + +// import { useState } from 'react' +// import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" +// import { Input } from "@/components/ui/input" +// import { Label } from "@/components/ui/label" +// import { Button } from "@/components/ui/button" +// import { Wallet, Lock } from "lucide-react" +// import { useRouter } from 'next/navigation' + + +// export default page +// export default function CreatorLogin() { +// const [solAddress, setSolAddress] = useState('') +// const [password, setPassword] = useState('') +// const router = useRouter(); +// if (!window) { +// return { +// notFound: true, +// } +// } +// const handleSubmit = (e: React.FormEvent) => { +// e.preventDefault() +// // Here you would typically handle the login logic +// // console.log('Login attempted with:', { solAddress, password }); +// router.push('/dashboard'); + +// } + +// return ( +//
+// +// +// Creator Login +// +// Enter your SOL address and password to access your creator dashboard +// +// +//
+// +//
+// +//
+// +// setSolAddress(e.target.value)} +// className="pl-10 bg-gray-800 border-gray-700 text-white placeholder-gray-500" +// /> +//
+//
+//
+// +//
+// +// setPassword(e.target.value)} +// className="pl-10 bg-gray-800 border-gray-700 text-white placeholder-gray-500" +// /> +//
+//
+//
+// +// +// +//
+// +//
+//
+// ) +// } \ No newline at end of file diff --git a/src/app/dashboard/creatorpage.tsx b/src/app/dashboard/creatorpage.tsx index 11c96f3..4f82471 100644 --- a/src/app/dashboard/creatorpage.tsx +++ b/src/app/dashboard/creatorpage.tsx @@ -27,33 +27,15 @@ const Creatorpage = ({ creator }: { creator: ICreator[] }) => { const isPhantomInstalled = () => { return typeof window !== 'undefined' && window.solana && (window.solana.isPhantom || window.solana.isMobile); }; - // const [creators, setCreators] = useState([]); - const [walletAddress, setWalletAddress] = useState(""); - - // async function fetchData() { - // await connectDB(); - - // const participated: IUser[] = await User.find({ - // "solAdd": walletAddress - // }); - // const creatorIds = participated.map((user) => { - // const url = new URL(user.post); - // return url.pathname.split("/")[3]; - // }); - - // setCreators( - // await Creator.find({ _id: { $in: creatorIds } }).sort({ _id: -1 }) - // ); + const [walletAddress, setWalletAddress] = useState(""); - // // } async function getSolanaAddress() { if (isPhantomInstalled()) { try { const { solana }: any = window; // Request connection to Phantom const response = await solana.connect(); - console.log('Connected to wallet:', response.publicKey.toString()); setWalletAddress(response.publicKey.toString()); } catch (error) { console.error('Error connecting to Phantom wallet:', error); diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index c1c70f9..59eb10c 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -1,30 +1,77 @@ +'use client' +// import connectDB from "@/lib/dbconnect"; +// import { ICreator } from "@/lib/interface/creater"; +// import Creator from "@/lib/models/creater"; +import BN from 'bn.js'; +import { useDashhProgram } from "@/components/dashh/dashh-data-access"; -import connectDB from "@/lib/dbconnect"; -import { ICreator } from "@/lib/interface/creater"; -import Creator from "@/lib/models/creater"; - -import Creatorpage from "./creatorpage"; +import Preblink from "../blinkcard/Preblink"; export const dynamic = 'force-dynamic' -export default async function Component() { +export default function Component() { + + const { accounts, getProgramAccount } = useDashhProgram(); +console.log("accounts",accounts); +console.log("object",getProgramAccount); + if (getProgramAccount.isLoading) { + return ; + } + if (!getProgramAccount.data?.value) { + return ( +
+ + Program account not found. Make sure you have deployed the program and + are on the correct cluster. + +
+ ); + } + accounts.data?.sort((a, b) => { + const aDaysLeft = (new Date(new BN(a.account.endtime).toNumber()).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24); + const bDaysLeft = (new Date(new BN(b.account.endtime).toNumber()).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24); + return bDaysLeft-aDaysLeft; + }); - let creators: ICreator[] = []; + return ( + <> + {accounts.isLoading ? ( + + ) : accounts.data?.length ? ( +
+
+
+ {/* */} +
+
+
+ {/*

Explore Events

*/} + Explore Events +
+
- try { - await connectDB(); - creators = await Creator.find().sort({ _id: -1 }); + { + accounts.data?.map((account) => { +console.log(account.publicKey); + return ( + <> - console.log(creators); - } catch (error) { - console.error(error); - } + + + + ) + }) + } - return ( -
-
- -
+
):( +
+

No accounts

+ No accounts found. Create one above to get started. +
+ ) + } + ); } \ No newline at end of file diff --git a/src/app/dashh/page.tsx b/src/app/dashh/page.tsx new file mode 100644 index 0000000..e694ef4 --- /dev/null +++ b/src/app/dashh/page.tsx @@ -0,0 +1,5 @@ +import DashhFeature from '@/components/dashh/dashh-feature' + +export default function Page() { + return +} diff --git a/src/app/form/page.tsx b/src/app/form/page.tsx index 951a412..e4e2517 100644 --- a/src/app/form/page.tsx +++ b/src/app/form/page.tsx @@ -4,15 +4,15 @@ import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { CardHeader, CardTitle, CardContent } from "@/components/ui/card"; -import axios from "axios"; - -import { Connection, PublicKey, Transaction, SystemProgram, clusterApiUrl, LAMPORTS_PER_SOL } from '@solana/web3.js'; +import { + PublicKey, +} from "@solana/web3.js"; import Image from "next/image"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faShieldHalved } from "@fortawesome/free-solid-svg-icons"; -import { useState } from "react"; +import { useState } from "react"; import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import { @@ -24,10 +24,9 @@ import { } from "@/components/ui/dialog"; import { toast } from "react-toastify"; import Link from "next/link"; +import { useDashhProgram } from "@/components/dashh/dashh-data-access"; - - -export const dynamic = 'force-dynamic' +export const dynamic = "force-dynamic"; export default function CreatorForm() { const [url_data, seturl_data] = useState(""); @@ -41,105 +40,125 @@ export default function CreatorForm() { icons: "", end: "", }); -const [formamount , setFormAmount] = useState(0); -const [walletAddress, setWalletAddress] = useState(null); - async function sendTransaction() { - // if (!walletAddress) { - // console.log('Wallet not connected'); - // return; - // } + const { createCampaign } = useDashhProgram(); - const connection = new Connection(clusterApiUrl('devnet'), 'confirmed'); - const recipientAddress = new PublicKey("8vbaCLhg1SZmiGNZfFzV2DEJHenFtdgg7G2JtY5v74i1"); // Public address of the recipient - const senderPublicKey = new PublicKey(walletAddress?walletAddress:"" ); // Sender's public key (your wallet) + // const [walletAddress, setWalletAddress] = useState(null); + // async function sendTransaction() { + // if (!walletAddress) { + // console.log('Wallet not connected'); + // return; + // } - const transaction = new Transaction().add( - SystemProgram.transfer({ - fromPubkey: senderPublicKey, - toPubkey: recipientAddress, - lamports: formamount * LAMPORTS_PER_SOL // Amount to send (in lamports, 1 SOL = 1e9 lamports) - }) - ); + // const connection = new Connection(clusterApiUrl('devnet'), 'confirmed'); + // const recipientAddress = new PublicKey("8vbaCLhg1SZmiGNZfFzV2DEJHenFtdgg7G2JtY5v74i1"); // Public address of the recipient + // const senderPublicKey = new PublicKey(walletAddress?walletAddress:"" ); // Sender's public key (your wallet) - try { - const { blockhash } = await connection.getLatestBlockhash(); // Fetch recent blockhash - transaction.recentBlockhash = blockhash; - transaction.feePayer = senderPublicKey; // Set fee payer to sender's public key + // const transaction = new Transaction().add( + // SystemProgram.transfer({ + // fromPubkey: senderPublicKey, + // toPubkey: recipientAddress, + // lamports: formamount * LAMPORTS_PER_SOL // Amount to send (in lamports, 1 SOL = 1e9 lamports) + // }) + // ); - const { solana }: any = window; - const signedTransaction = await solana.signTransaction(transaction); // Sign transaction with Phantom - const signature = await connection.sendRawTransaction(signedTransaction.serialize()); // Send signed transaction - await connection.confirmTransaction(signature); // Confirm the transaction + // try { + // const { blockhash } = await connection.getLatestBlockhash(); // Fetch recent blockhash + // transaction.recentBlockhash = blockhash; + // transaction.feePayer = senderPublicKey; // Set fee payer to sender's public key + + // const { solana }: any = window; + // const signedTransaction = await solana.signTransaction(transaction); // Sign transaction with Phantom + // const signature = await connection.sendRawTransaction(signedTransaction.serialize()); // Send signed transaction + // await connection.confirmTransaction(signature); // Confirm the transaction + + // // console.log('Transaction successful, signature:', signature); + // } catch (error) { + // console.error('Error sending transaction:', error); + // } + // } - // console.log('Transaction successful, signature:', signature); - } catch (error) { - console.error('Error sending transaction:', error); - } - } const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (typeof window !== "undefined") { // Client-side-only code - - const { solana }: any = window; - // Request connection to Phantom - const response = await solana.connect(); - console.log("wallet:", response.publicKey.toString()); - setWalletAddress(response.publicKey.toString()); - const formData = new FormData(e.target as HTMLFormElement); - console.log(endDate?.toISOString()); - const data = { - solAdd: response.publicKey.toString(), - title: formData.get("title"), - description: formData.get("description"), - label: formData.get("label"), - amount: formData.get("amount"), - icons: formData.get("icons"), - end: endDate ? endDate.toISOString() : new Date().toISOString(), - }; - - try { - const response = await axios.post("/api/posts", data, { - headers: { - "Content-Type": "application/json", - }, - }); - console.log("Data successfully sent to the server:", response.data); + const { solana }: any = window; + // Request connection to Phantom + const response = await solana.connect(); + - if (response.data.data._id != undefined) { - setFormAmount(Number(formData.get("amount"))); - - sendTransaction(); - seturl_data(response.data.data._id); - setOpen(true); + const formData = new FormData(e.target as HTMLFormElement); + // console.log(endDate?.getTime()); + // const data = { + // solAdd: response.publicKey.toString(), + // title: formData.get("title"), + // description: formData.get("description"), + // label: formData.get("label"), + // amount: formData.get("amount"), + // icons: formData.get("icons"), + // end: endDate ? endDate.toISOString() : new Date().toISOString(), + // }; + try { + if (response.publicKey) { + const res = await createCampaign.mutateAsync({ + id: 0, + title: formData.get("title") as string, + description: formData.get("description") as string, + image: formData.get("icons") as string, + lable: formData.get("label") as string, + endtime: endDate + ? (endDate.getTime() as number) + : (new Date().getTime() as number), + reward: Number(formData.get("amount")) as number, + owner: response.publicKey as PublicKey, + }); + if(res){ + seturl_data(res); + } + else { + return
Error Loading
+ } + } else { +
+

Wallet not connected

+
; + } + } catch (error) { + console.log(error); } - } catch (error) { - console.error("There was an error sending the data:", error); + + + setOpen(true); + // if (response.data.data._id != undefined) { + // // setFormAmount(Number(formData.get("amount"))); + + // // sendTransaction(); + // seturl_data(response.data.data._id); + // setOpen(true); + // } } }; - } function isValidURL(url: string): boolean { try { new URL(url); return true; } catch (e) { - console.log(e); +console.log(e); return false; } } const [open, setOpen] = useState(false); return ( - <> + <> {open ? ( - + Share Your Blink
- - - - - - - -
-
- {" "} - - - - - - - - - -
+ +
+ + + + + + + + + +
+
+ {" "} + + + + + + + + + +
) : ( -
-
-
-
- {" "} - Your Blinks Will Look like this -
- -
-
-
- Solana Blinks -
-
-
-

- blinks.knowflow.study -

- -
-
-
-

- {content.title ? content.title : "Title"} -

-
- -

- {content.description ? content.description : "Description"}{" "} -

- - -
-
-
-
- {/*

Welcome to Boastit

*/} -
+
+
Create New Campaign @@ -397,8 +354,79 @@ const [walletAddress, setWalletAddress] = useState(null);
+ + + {/* card */} +
+
+
+ {" "} + Your Blinks Will Look like this +
+ +
+
+
+ Solana Blinks +
+
+
+

+ blinks.knowflow.study +

+ +
+
+
+

+ {content.title ? content.title : "Title"} +

+
+ +

+ {content.description ? content.description : "Description"}{" "} +

+ +
+ + +
+ + +
+
+
+
+
)} ); + } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index e87b5c4..5283ebe 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,6 +4,8 @@ import connectDB from "@/lib/dbconnect"; import Header from "@/components/header"; import { ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; +import {SolanaProvider} from '@/components/solana/solana-provider' +import {ReactQueryProvider} from './react-query-provider' export const metadata: Metadata = { @@ -20,6 +22,11 @@ export default function RootLayout({ return ( + + {/* */} + + + {/* the div below is the grid background and can be used in any other projetc too */} {/*
@@ -38,18 +45,22 @@ export default function RootLayout({ -
+
{/* Grid Pattern Background */}
{children} -
+
+ + {/* */} + ); diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx new file mode 100644 index 0000000..c363236 --- /dev/null +++ b/src/app/not-found.tsx @@ -0,0 +1,11 @@ +import Link from 'next/link' + +export default function NotFound() { + return ( +
+

Not Found

+

Could not find requested resource

+ Return Home +
+ ) +} \ No newline at end of file diff --git a/src/app/page.tsx b/src/app/page.tsx index fbeddd8..cbe4fab 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -6,11 +6,11 @@ import Demo from "@/components/demo2"; import APISection from "@/components/APISection2"; import { cn } from "@/lib/utils"; import { - IconAdjustmentsBolt, + IconCloud, IconCurrencyDollar, IconEaseInOut, - IconHeart, + IconHelp, IconRouteAltLeft, IconTerminal2, diff --git a/src/app/react-query-provider.tsx b/src/app/react-query-provider.tsx new file mode 100644 index 0000000..e12cf8d --- /dev/null +++ b/src/app/react-query-provider.tsx @@ -0,0 +1,15 @@ +'use client' + +import React, { ReactNode, useState } from 'react' +import { ReactQueryStreamedHydration } from '@tanstack/react-query-next-experimental' +import { QueryClientProvider, QueryClient } from '@tanstack/react-query' + +export function ReactQueryProvider({ children }: { children: ReactNode }) { + const [client] = useState(new QueryClient()) + + return ( + + {children} + + ) +} diff --git a/src/app/verifyClaim/[uid]/page.tsx b/src/app/verifyClaim/[uid]/page.tsx index 9e92421..82ff8eb 100644 --- a/src/app/verifyClaim/[uid]/page.tsx +++ b/src/app/verifyClaim/[uid]/page.tsx @@ -1,13 +1,10 @@ "use client"; import { useSearchParams } from "next/navigation"; -import { title } from "process"; + import React, { useState } from "react"; import QRCode from "react-qr-code"; import { ReclaimProofRequest } from "@reclaimprotocol/js-sdk"; -import CircularProgress, { - circularProgressClasses, - CircularProgressProps, -} from "@mui/material/CircularProgress"; +import CircularProgress from "@mui/material/CircularProgress"; import Link from "next/link"; import { Button } from "@/components/ui/button"; import { Instagram, Twitter } from "lucide-react"; @@ -17,36 +14,35 @@ const APP_SECRET = "0xa24f2911de618188e78d5981f62a3bba7497bc87b1e1789bac933ec614ca11a8"; const PROVIDER_ID = "d18dcace-d59b-4432-b77e-655b7248334d"; -const sampledata = { - identifier: - "0x293dab3d4be5211106b52f40ecdc16653bd921a4a4ff5cd0896bc53bbee87086", - claimData: { - provider: "http", - parameters: - '{"additionalClientOptions":{},"body":"","geoLocation":"","headers":{"user-agent":"Mozilla/5.0 (Linux; Android 12; 2201117PI Build/SP1A.210812.016) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/131.0.6778.39 Mobile Safari/537.36"},"method":"GET","paramValues":{"URL_PARAMS_1":"Tg82Ez_kxVaJf7OPbUdbCg","URL_PARAMS_2":"%7B%22userId%22%3A%221543126510642536448%22%2C%22count%22%3A20%2C%22includePromotedContent%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D","URL_PARAMS_3":"%7B%22rweb_tipjar_consumption_enabled%22%3Atrue%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22communities_web_enable_tweet_community_results_fetch%22%3Atrue%2C%22c9s_tweet_anatomy_moderator_badge_enabled%22%3Atrue%2C%22articles_preview_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Atrue%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22creator_subscriptions_quote_tweet_preview_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22rweb_video_timestamps_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D","favorite_count":"17","full_text":"Won the Reclaim Protocol track at Radar hackathon! ❤️\\\\nKudos to my team @SKartik_SK @praneshz_ @tusharpatidar23 @TheAshutoshM.\\\\n\\\\nCouldn\'t be more grateful to @solana @SuperteamIN @colosseum and @reclaimprotocol for such an opportunity \\\\uD83D\\\\uDE80✨","hashtags":"[]","user_mentions":"[{\\"id_str\\":\\"1586361012315250688\\",\\"name\\":\\"Singupalli Kartik\\",\\"screen_name\\":\\"SKartik_SK\\",\\"indices\\":[71,82]},{\\"id_str\\":\\"1396787419081592835\\",\\"name\\":\\"Pranesh Joshi\\",\\"screen_name\\":\\"praneshz_\\",\\"indices\\":[83,93]},{\\"id_str\\":\\"1444314554553364485\\",\\"name\\":\\"Tushar Patidar\\",\\"screen_name\\":\\"tusharpatidar23\\",\\"indices\\":[94,110]},{\\"id_str\\":\\"1618846191734910978\\",\\"name\\":\\"Ashutosh Mishra\\",\\"screen_name\\":\\"TheAshutoshM\\",\\"indices\\":[111,124]},{\\"id_str\\":\\"951329744804392960\\",\\"name\\":\\"Solana\\",\\"screen_name\\":\\"solana\\",\\"indices\\":[156,163]},{\\"id_str\\":\\"1508022250649550864\\",\\"name\\":\\"Superteam India\\",\\"screen_name\\":\\"SuperteamIN\\",\\"indices\\":[164,176]},{\\"id_str\\":\\"1626610682773794816\\",\\"name\\":\\"Colosseum\\",\\"screen_name\\":\\"colosseum\\",\\"indices\\":[177,187]},{\\"id_str\\":\\"1643929314768093185\\",\\"name\\":\\"Reclaim Protocol | Devcon \\\\uD83C\\\\uDDF9\\\\uD83C\\\\uDDED\\",\\"screen_name\\":\\"reclaimprotocol\\",\\"indices\\":[192,208]}]"},"responseMatches":[{"type":"contains","value":"\\"full_text\\":\\"{{full_text}}\\""},{"type":"contains","value":"\\"favorite_count\\":{{favorite_count}}"},{"type":"contains","value":"\\"user_mentions\\":{{user_mentions}}"},{"type":"contains","value":"\\"hashtags\\":{{hashtags}}"}],"responseRedactions":[{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.full_text","regex":"\\"full_text\\":\\"(.*)\\"","xPath":""},{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.favorite_count","regex":"\\"favorite_count\\":(.*)","xPath":""},{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.entities.user_mentions","regex":"\\"user_mentions\\":(.*)","xPath":""},{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.entities.hashtags","regex":"\\"hashtags\\":(.*)","xPath":""}],"url":"https://x.com/i/api/graphql/{{URL_PARAMS_1}}/UserTweets?variables={{URL_PARAMS_2}}&features={{URL_PARAMS_3}}&fieldToggles=%7B%22withArticlePlainText%22%3Afalse%7D"}', - owner: "0xbcaa9b981ddb0bc631878e448ceb64e7f2d531d0", - timestampS: 1732116708, - context: - '{"contextAddress":"0x0","contextMessage":"","extractedParameters":{"URL_PARAMS_1":"Tg82Ez_kxVaJf7OPbUdbCg","URL_PARAMS_2":"%7B%22userId%22%3A%221543126510642536448%22%2C%22count%22%3A20%2C%22includePromotedContent%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D","URL_PARAMS_3":"%7B%22rweb_tipjar_consumption_enabled%22%3Atrue%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22communities_web_enable_tweet_community_results_fetch%22%3Atrue%2C%22c9s_tweet_anatomy_moderator_badge_enabled%22%3Atrue%2C%22articles_preview_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Atrue%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22creator_subscriptions_quote_tweet_preview_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22rweb_video_timestamps_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D","favorite_count":"17","full_text":"Won the Reclaim Protocol track at Radar hackathon! ❤️\\\\nKudos to my team @SKartik_SK @praneshz_ @tusharpatidar23 @TheAshutoshM.\\\\n\\\\nCouldn\'t be more grateful to @solana @SuperteamIN @colosseum and @reclaimprotocol for such an opportunity \\\\uD83D\\\\uDE80✨","hashtags":"[]","user_mentions":"[{\\"id_str\\":\\"1586361012315250688\\",\\"name\\":\\"Singupalli Kartik\\",\\"screen_name\\":\\"SKartik_SK\\",\\"indices\\":[71,82]},{\\"id_str\\":\\"1396787419081592835\\",\\"name\\":\\"Pranesh Joshi\\",\\"screen_name\\":\\"praneshz_\\",\\"indices\\":[83,93]},{\\"id_str\\":\\"1444314554553364485\\",\\"name\\":\\"Tushar Patidar\\",\\"screen_name\\":\\"tusharpatidar23\\",\\"indices\\":[94,110]},{\\"id_str\\":\\"1618846191734910978\\",\\"name\\":\\"Ashutosh Mishra\\",\\"screen_name\\":\\"TheAshutoshM\\",\\"indices\\":[111,124]},{\\"id_str\\":\\"951329744804392960\\",\\"name\\":\\"Solana\\",\\"screen_name\\":\\"solana\\",\\"indices\\":[156,163]},{\\"id_str\\":\\"1508022250649550864\\",\\"name\\":\\"Superteam India\\",\\"screen_name\\":\\"SuperteamIN\\",\\"indices\\":[164,176]},{\\"id_str\\":\\"1626610682773794816\\",\\"name\\":\\"Colosseum\\",\\"screen_name\\":\\"colosseum\\",\\"indices\\":[177,187]},{\\"id_str\\":\\"1643929314768093185\\",\\"name\\":\\"Reclaim Protocol | Devcon \\\\uD83C\\\\uDDF9\\\\uD83C\\\\uDDED\\",\\"screen_name\\":\\"reclaimprotocol\\",\\"indices\\":[192,208]}]"},"providerHash":"0x33ddc18c613908cfcf63a898dc24b302c80111ca80fb28572c6f090f0391067f"}', - identifier: - "0x293dab3d4be5211106b52f40ecdc16653bd921a4a4ff5cd0896bc53bbee87086", - epoch: 1, - }, - signatures: [ - "0xdc93b5e915fcc848f855c30bb23146707f124b9bf44a24b5407cb2044cfff97e5ae745968577ff9da7357ecf058ef1f72f430ee1f98cd96fee6179b7baac33821b", - ], - witnesses: [ - { - id: "0x244897572368eadf65bfbc5aec98d8e5443a9072", - url: "wss://witness.reclaimprotocol.org/ws", - }, - ], - publicData: {}, -}; +// const sampledata = { +// identifier: +// "0x293dab3d4be5211106b52f40ecdc16653bd921a4a4ff5cd0896bc53bbee87086", +// claimData: { +// provider: "http", +// parameters: +// '{"additionalClientOptions":{},"body":"","geoLocation":"","headers":{"user-agent":"Mozilla/5.0 (Linux; Android 12; 2201117PI Build/SP1A.210812.016) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/131.0.6778.39 Mobile Safari/537.36"},"method":"GET","paramValues":{"URL_PARAMS_1":"Tg82Ez_kxVaJf7OPbUdbCg","URL_PARAMS_2":"%7B%22userId%22%3A%221543126510642536448%22%2C%22count%22%3A20%2C%22includePromotedContent%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D","URL_PARAMS_3":"%7B%22rweb_tipjar_consumption_enabled%22%3Atrue%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22communities_web_enable_tweet_community_results_fetch%22%3Atrue%2C%22c9s_tweet_anatomy_moderator_badge_enabled%22%3Atrue%2C%22articles_preview_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Atrue%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22creator_subscriptions_quote_tweet_preview_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22rweb_video_timestamps_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D","favorite_count":"17","full_text":"Won the Reclaim Protocol track at Radar hackathon! ❤️\\\\nKudos to my team @SKartik_SK @praneshz_ @tusharpatidar23 @TheAshutoshM.\\\\n\\\\nCouldn\'t be more grateful to @solana @SuperteamIN @colosseum and @reclaimprotocol for such an opportunity \\\\uD83D\\\\uDE80✨","hashtags":"[]","user_mentions":"[{\\"id_str\\":\\"1586361012315250688\\",\\"name\\":\\"Singupalli Kartik\\",\\"screen_name\\":\\"SKartik_SK\\",\\"indices\\":[71,82]},{\\"id_str\\":\\"1396787419081592835\\",\\"name\\":\\"Pranesh Joshi\\",\\"screen_name\\":\\"praneshz_\\",\\"indices\\":[83,93]},{\\"id_str\\":\\"1444314554553364485\\",\\"name\\":\\"Tushar Patidar\\",\\"screen_name\\":\\"tusharpatidar23\\",\\"indices\\":[94,110]},{\\"id_str\\":\\"1618846191734910978\\",\\"name\\":\\"Ashutosh Mishra\\",\\"screen_name\\":\\"TheAshutoshM\\",\\"indices\\":[111,124]},{\\"id_str\\":\\"951329744804392960\\",\\"name\\":\\"Solana\\",\\"screen_name\\":\\"solana\\",\\"indices\\":[156,163]},{\\"id_str\\":\\"1508022250649550864\\",\\"name\\":\\"Superteam India\\",\\"screen_name\\":\\"SuperteamIN\\",\\"indices\\":[164,176]},{\\"id_str\\":\\"1626610682773794816\\",\\"name\\":\\"Colosseum\\",\\"screen_name\\":\\"colosseum\\",\\"indices\\":[177,187]},{\\"id_str\\":\\"1643929314768093185\\",\\"name\\":\\"Reclaim Protocol | Devcon \\\\uD83C\\\\uDDF9\\\\uD83C\\\\uDDED\\",\\"screen_name\\":\\"reclaimprotocol\\",\\"indices\\":[192,208]}]"},"responseMatches":[{"type":"contains","value":"\\"full_text\\":\\"{{full_text}}\\""},{"type":"contains","value":"\\"favorite_count\\":{{favorite_count}}"},{"type":"contains","value":"\\"user_mentions\\":{{user_mentions}}"},{"type":"contains","value":"\\"hashtags\\":{{hashtags}}"}],"responseRedactions":[{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.full_text","regex":"\\"full_text\\":\\"(.*)\\"","xPath":""},{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.favorite_count","regex":"\\"favorite_count\\":(.*)","xPath":""},{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.entities.user_mentions","regex":"\\"user_mentions\\":(.*)","xPath":""},{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.entities.hashtags","regex":"\\"hashtags\\":(.*)","xPath":""}],"url":"https://x.com/i/api/graphql/{{URL_PARAMS_1}}/UserTweets?variables={{URL_PARAMS_2}}&features={{URL_PARAMS_3}}&fieldToggles=%7B%22withArticlePlainText%22%3Afalse%7D"}', +// owner: "0xbcaa9b981ddb0bc631878e448ceb64e7f2d531d0", +// timestampS: 1732116708, +// context: +// '{"contextAddress":"0x0","contextMessage":"","extractedParameters":{"URL_PARAMS_1":"Tg82Ez_kxVaJf7OPbUdbCg","URL_PARAMS_2":"%7B%22userId%22%3A%221543126510642536448%22%2C%22count%22%3A20%2C%22includePromotedContent%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D","URL_PARAMS_3":"%7B%22rweb_tipjar_consumption_enabled%22%3Atrue%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22communities_web_enable_tweet_community_results_fetch%22%3Atrue%2C%22c9s_tweet_anatomy_moderator_badge_enabled%22%3Atrue%2C%22articles_preview_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Atrue%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22creator_subscriptions_quote_tweet_preview_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22rweb_video_timestamps_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D","favorite_count":"17","full_text":"Won the Reclaim Protocol track at Radar hackathon! ❤️\\\\nKudos to my team @SKartik_SK @praneshz_ @tusharpatidar23 @TheAshutoshM.\\\\n\\\\nCouldn\'t be more grateful to @solana @SuperteamIN @colosseum and @reclaimprotocol for such an opportunity \\\\uD83D\\\\uDE80✨","hashtags":"[]","user_mentions":"[{\\"id_str\\":\\"1586361012315250688\\",\\"name\\":\\"Singupalli Kartik\\",\\"screen_name\\":\\"SKartik_SK\\",\\"indices\\":[71,82]},{\\"id_str\\":\\"1396787419081592835\\",\\"name\\":\\"Pranesh Joshi\\",\\"screen_name\\":\\"praneshz_\\",\\"indices\\":[83,93]},{\\"id_str\\":\\"1444314554553364485\\",\\"name\\":\\"Tushar Patidar\\",\\"screen_name\\":\\"tusharpatidar23\\",\\"indices\\":[94,110]},{\\"id_str\\":\\"1618846191734910978\\",\\"name\\":\\"Ashutosh Mishra\\",\\"screen_name\\":\\"TheAshutoshM\\",\\"indices\\":[111,124]},{\\"id_str\\":\\"951329744804392960\\",\\"name\\":\\"Solana\\",\\"screen_name\\":\\"solana\\",\\"indices\\":[156,163]},{\\"id_str\\":\\"1508022250649550864\\",\\"name\\":\\"Superteam India\\",\\"screen_name\\":\\"SuperteamIN\\",\\"indices\\":[164,176]},{\\"id_str\\":\\"1626610682773794816\\",\\"name\\":\\"Colosseum\\",\\"screen_name\\":\\"colosseum\\",\\"indices\\":[177,187]},{\\"id_str\\":\\"1643929314768093185\\",\\"name\\":\\"Reclaim Protocol | Devcon \\\\uD83C\\\\uDDF9\\\\uD83C\\\\uDDED\\",\\"screen_name\\":\\"reclaimprotocol\\",\\"indices\\":[192,208]}]"},"providerHash":"0x33ddc18c613908cfcf63a898dc24b302c80111ca80fb28572c6f090f0391067f"}', +// identifier: +// "0x293dab3d4be5211106b52f40ecdc16653bd921a4a4ff5cd0896bc53bbee87086", +// epoch: 1, +// }, +// signatures: [ +// "0xdc93b5e915fcc848f855c30bb23146707f124b9bf44a24b5407cb2044cfff97e5ae745968577ff9da7357ecf058ef1f72f430ee1f98cd96fee6179b7baac33821b", +// ], +// witnesses: [ +// { +// id: "0x244897572368eadf65bfbc5aec98d8e5443a9072", +// url: "wss://witness.reclaimprotocol.org/ws", +// }, +// ], +// publicData: {}, +// }; const Page = () => { const searchParams = useSearchParams(); - const uid = searchParams?.get("uid"); const title = searchParams?.get("title"); // const uid = "aa"; @@ -82,13 +78,13 @@ const Page = () => { }); }; - const handleGenerateQr = () => { - setQrState("loading"); - setTimeout(() => { - setQrUrl("https://example.com/qr-code"); // Replace with dynamic QR URL - setQrState("success"); - }, 2000); // Simulate loading time - }; + // const handleGenerateQr = () => { + // setQrState("loading"); + // setTimeout(() => { + // setQrUrl("https://example.com/qr-code"); // Replace with dynamic QR URL + // setQrState("success"); + // }, 2000); // Simulate loading time + // }; return (
\ No newline at end of file diff --git a/src/components/account/account-data-access.tsx b/src/components/account/account-data-access.tsx new file mode 100644 index 0000000..b2a0baf --- /dev/null +++ b/src/components/account/account-data-access.tsx @@ -0,0 +1,177 @@ +'use client' + +import {TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID} from '@solana/spl-token' +import {useConnection, useWallet} from '@solana/wallet-adapter-react' +import { + Connection, + LAMPORTS_PER_SOL, + PublicKey, + SystemProgram, + TransactionMessage, + TransactionSignature, + VersionedTransaction, +} from '@solana/web3.js' +import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query' +import toast from 'react-hot-toast' +import { useTransactionToast } from '../ui/ui-layout' + + +export function useGetBalance({ address }: { address: PublicKey }) { + const { connection } = useConnection() + + return useQuery({ + queryKey: ['get-balance', { endpoint: connection.rpcEndpoint, address }], + queryFn: () => connection.getBalance(address), + }) +} + +export function useGetSignatures({ address }: { address: PublicKey }) { + const { connection } = useConnection() + + return useQuery({ + queryKey: ['get-signatures', { endpoint: connection.rpcEndpoint, address }], + queryFn: () => connection.getSignaturesForAddress(address), + }) +} + +export function useGetTokenAccounts({ address }: { address: PublicKey }) { + const { connection } = useConnection() + + return useQuery({ + queryKey: ['get-token-accounts', { endpoint: connection.rpcEndpoint, address }], + queryFn: async () => { + const [tokenAccounts, token2022Accounts] = await Promise.all([ + connection.getParsedTokenAccountsByOwner(address, { + programId: TOKEN_PROGRAM_ID, + }), + connection.getParsedTokenAccountsByOwner(address, { + programId: TOKEN_2022_PROGRAM_ID, + }), + ]) + return [...tokenAccounts.value, ...token2022Accounts.value] + }, + }) +} + +export function useTransferSol({ address }: { address: PublicKey }) { + const { connection } = useConnection() + const transactionToast = useTransactionToast() + const wallet = useWallet() + const client = useQueryClient() + + return useMutation({ + mutationKey: ['transfer-sol', { endpoint: connection.rpcEndpoint, address }], + mutationFn: async (input: { destination: PublicKey; amount: number }) => { + let signature: TransactionSignature = '' + try { + const { transaction, latestBlockhash } = await createTransaction({ + publicKey: address, + destination: input.destination, + amount: input.amount, + connection, + }) + + // Send transaction and await for signature + signature = await wallet.sendTransaction(transaction, connection) + + // Send transaction and await for signature + await connection.confirmTransaction({ signature, ...latestBlockhash }, 'confirmed') + + console.log(signature) + return signature + } catch (error: unknown) { + console.log('error', `Transaction failed! ${error}`, signature) + + return + } + }, + onSuccess: (signature) => { + if (signature) { + transactionToast(signature) + } + return Promise.all([ + client.invalidateQueries({ + queryKey: ['get-balance', { endpoint: connection.rpcEndpoint, address }], + }), + client.invalidateQueries({ + queryKey: ['get-signatures', { endpoint: connection.rpcEndpoint, address }], + }), + ]) + }, + onError: (error: unknown) => { + toast.error(`Transaction failed! ${error}`) + }, + }) +} + +export function useRequestAirdrop({ address }: { address: PublicKey }) { + const { connection } = useConnection() + const transactionToast = useTransactionToast() + const client = useQueryClient() + + return useMutation({ + mutationKey: ['airdrop', { endpoint: connection.rpcEndpoint, address }], + mutationFn: async (amount: number = 1) => { + const [latestBlockhash, signature] = await Promise.all([ + connection.getLatestBlockhash(), + connection.requestAirdrop(address, amount * LAMPORTS_PER_SOL), + ]) + + await connection.confirmTransaction({ signature, ...latestBlockhash }, 'confirmed') + return signature + }, + onSuccess: (signature) => { + transactionToast(signature) + return Promise.all([ + client.invalidateQueries({ + queryKey: ['get-balance', { endpoint: connection.rpcEndpoint, address }], + }), + client.invalidateQueries({ + queryKey: ['get-signatures', { endpoint: connection.rpcEndpoint, address }], + }), + ]) + }, + }) +} + +async function createTransaction({ + publicKey, + destination, + amount, + connection, +}: { + publicKey: PublicKey + destination: PublicKey + amount: number + connection: Connection +}): Promise<{ + transaction: VersionedTransaction + latestBlockhash: { blockhash: string; lastValidBlockHeight: number } +}> { + // Get the latest blockhash to use in our transaction + const latestBlockhash = await connection.getLatestBlockhash() + + // Create instructions to send, in this case a simple transfer + const instructions = [ + SystemProgram.transfer({ + fromPubkey: publicKey, + toPubkey: destination, + lamports: amount * LAMPORTS_PER_SOL, + }), + ] + + // Create a new TransactionMessage with version and compile it to legacy + const messageLegacy = new TransactionMessage({ + payerKey: publicKey, + recentBlockhash: latestBlockhash.blockhash, + instructions, + }).compileToLegacyMessage() + + // Create a new VersionedTransaction which supports legacy and v0 + const transaction = new VersionedTransaction(messageLegacy) + + return { + transaction, + latestBlockhash, + } +} diff --git a/src/components/account/account-detail-feature.tsx b/src/components/account/account-detail-feature.tsx new file mode 100644 index 0000000..113af33 --- /dev/null +++ b/src/components/account/account-detail-feature.tsx @@ -0,0 +1,48 @@ +'use client' + +import { PublicKey } from '@solana/web3.js' +import { useMemo } from 'react' + +import { useParams } from 'next/navigation' + +import { ExplorerLink } from '../cluster/cluster-ui' +import { AppHero, ellipsify } from '../ui/ui-layout' +import { AccountBalance, AccountButtons, AccountTokens, AccountTransactions } from './account-ui' + +export default function AccountDetailFeature() { + const params = useParams() + const address = useMemo(() => { + if (!params.address) { + return + } + try { + return new PublicKey(params.address) + } catch (e) { + console.log(`Invalid public key`, e) + } + }, [params]) + if (!address) { + return
Error loading account
+ } + + return ( +
+ } + subtitle={ +
+ +
+ } + > +
+ +
+
+
+ + +
+
+ ) +} diff --git a/src/components/account/account-list-feature.tsx b/src/components/account/account-list-feature.tsx new file mode 100644 index 0000000..3443c76 --- /dev/null +++ b/src/components/account/account-list-feature.tsx @@ -0,0 +1,22 @@ +'use client' + +import { useWallet } from '@solana/wallet-adapter-react' + +import { redirect } from 'next/navigation' +import { WalletButton } from '../solana/solana-provider' + +export default function AccountListFeature() { + const { publicKey } = useWallet() + + if (publicKey) { + return redirect(`/account/${publicKey.toString()}`) + } + + return ( +
+
+ +
+
+ ) +} diff --git a/src/components/account/account-ui.tsx b/src/components/account/account-ui.tsx new file mode 100644 index 0000000..70d7d93 --- /dev/null +++ b/src/components/account/account-ui.tsx @@ -0,0 +1,352 @@ +'use client' + +import { useWallet } from '@solana/wallet-adapter-react' +import { LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js' +import { IconRefresh } from '@tabler/icons-react' +import { useQueryClient } from '@tanstack/react-query' +import { useMemo, useState } from 'react' +import { AppModal, ellipsify } from '../ui/ui-layout' +import { useCluster } from '../cluster/cluster-data-access' +import { ExplorerLink } from '../cluster/cluster-ui' +import { + useGetBalance, + useGetSignatures, + useGetTokenAccounts, + useRequestAirdrop, + useTransferSol, +} from './account-data-access' + +export function AccountBalance({ address }: { address: PublicKey }) { + const query = useGetBalance({ address }) + + return ( +
+

query.refetch()}> + {query.data ? : '...'} SOL +

+
+ ) +} +export function AccountChecker() { + const { publicKey } = useWallet() + if (!publicKey) { + return null + } + return +} +export function AccountBalanceCheck({ address }: { address: PublicKey }) { + const { cluster } = useCluster() + const mutation = useRequestAirdrop({ address }) + const query = useGetBalance({ address }) + + if (query.isLoading) { + return null + } + if (query.isError || !query.data) { + return ( +
+ + You are connected to {cluster.name} but your account is not found on this cluster. + + +
+ ) + } + return null +} + +export function AccountButtons({ address }: { address: PublicKey }) { + const wallet = useWallet() + const { cluster } = useCluster() + const [showAirdropModal, setShowAirdropModal] = useState(false) + const [showReceiveModal, setShowReceiveModal] = useState(false) + const [showSendModal, setShowSendModal] = useState(false) + + return ( +
+ setShowAirdropModal(false)} address={address} show={showAirdropModal} /> + setShowReceiveModal(false)} /> + setShowSendModal(false)} /> +
+ + + +
+
+ ) +} + +export function AccountTokens({ address }: { address: PublicKey }) { + const [showAll, setShowAll] = useState(false) + const query = useGetTokenAccounts({ address }) + const client = useQueryClient() + const items = useMemo(() => { + if (showAll) return query.data + return query.data?.slice(0, 5) + }, [query.data, showAll]) + + return ( +
+
+
+

Token Accounts

+
+ {query.isLoading ? ( + + ) : ( + + )} +
+
+
+ {query.isError &&
Error: {query.error?.message.toString()}
} + {query.isSuccess && ( +
+ {query.data.length === 0 ? ( +
No token accounts found.
+ ) : ( + + + + + + + + + + {items?.map(({ account, pubkey }) => ( + + + + + + ))} + + {(query.data?.length ?? 0) > 5 && ( + + + + )} + +
Public KeyMintBalance
+
+ + + +
+
+
+ + + +
+
+ {account.data.parsed.info.tokenAmount.uiAmount} +
+ +
+ )} +
+ )} +
+ ) +} + +export function AccountTransactions({ address }: { address: PublicKey }) { + const query = useGetSignatures({ address }) + const [showAll, setShowAll] = useState(false) + + const items = useMemo(() => { + if (showAll) return query.data + return query.data?.slice(0, 5) + }, [query.data, showAll]) + + return ( +
+
+

Transaction History

+
+ {query.isLoading ? ( + + ) : ( + + )} +
+
+ {query.isError &&
Error: {query.error?.message.toString()}
} + {query.isSuccess && ( +
+ {query.data.length === 0 ? ( +
No transactions found.
+ ) : ( + + + + + + + + + + + {items?.map((item) => ( + + + + + + + ))} + {(query.data?.length ?? 0) > 5 && ( + + + + )} + +
SignatureSlotBlock TimeStatus
+ + + + {new Date((item.blockTime ?? 0) * 1000).toISOString()} + {item.err ? ( +
+ Failed +
+ ) : ( +
Success
+ )} +
+ +
+ )} +
+ )} +
+ ) +} + +function BalanceSol({ balance }: { balance: number }) { + return {Math.round((balance / LAMPORTS_PER_SOL) * 100000) / 100000} +} + +function ModalReceive({ hide, show, address }: { hide: () => void; show: boolean; address: PublicKey }) { + return ( + +

Receive assets by sending them to your public key:

+ {address.toString()} +
+ ) +} + +function ModalAirdrop({ hide, show, address }: { hide: () => void; show: boolean; address: PublicKey }) { + const mutation = useRequestAirdrop({ address }) + const [amount, setAmount] = useState('2') + + return ( + mutation.mutateAsync(parseFloat(amount)).then(() => hide())} + > + setAmount(e.target.value)} + /> + + ) +} + +function ModalSend({ hide, show, address }: { hide: () => void; show: boolean; address: PublicKey }) { + const wallet = useWallet() + const mutation = useTransferSol({ address }) + const [destination, setDestination] = useState('') + const [amount, setAmount] = useState('1') + + if (!address || !wallet.sendTransaction) { + return
Wallet not connected
+ } + + return ( + { + mutation + .mutateAsync({ + destination: new PublicKey(destination), + amount: parseFloat(amount), + }) + .then(() => hide()) + }} + > + setDestination(e.target.value)} + /> + setAmount(e.target.value)} + /> + + ) +} diff --git a/src/components/cluster/cluster-data-access.tsx b/src/components/cluster/cluster-data-access.tsx new file mode 100644 index 0000000..6d9aa87 --- /dev/null +++ b/src/components/cluster/cluster-data-access.tsx @@ -0,0 +1,117 @@ +'use client' + +import { clusterApiUrl, Connection } from '@solana/web3.js' +import { atom, useAtomValue, useSetAtom } from 'jotai' +import { atomWithStorage } from 'jotai/utils' +import { createContext, ReactNode, useContext } from 'react' +import toast from 'react-hot-toast' + +export interface Cluster { + name: string + endpoint: string + network?: ClusterNetwork + active?: boolean +} + +export enum ClusterNetwork { + Mainnet = 'mainnet-beta', + Testnet = 'testnet', + Devnet = 'devnet', + Custom = 'custom', +} + +// By default, we don't configure the mainnet-beta cluster +// The endpoint provided by clusterApiUrl('mainnet-beta') does not allow access from the browser due to CORS restrictions +// To use the mainnet-beta cluster, provide a custom endpoint +export const defaultClusters: Cluster[] = [ + { + name: 'devnet', + endpoint: clusterApiUrl('devnet'), + network: ClusterNetwork.Devnet, + }, + { name: 'local', endpoint: 'http://localhost:8899' }, + { + name: 'testnet', + endpoint: clusterApiUrl('testnet'), + network: ClusterNetwork.Testnet, + }, +] + +const clusterAtom = atomWithStorage('solana-cluster', defaultClusters[0]) +const clustersAtom = atomWithStorage('solana-clusters', defaultClusters) + +const activeClustersAtom = atom((get) => { + const clusters = get(clustersAtom) + const cluster = get(clusterAtom) + return clusters.map((item) => ({ + ...item, + active: item.name === cluster.name, + })) +}) + +const activeClusterAtom = atom((get) => { + const clusters = get(activeClustersAtom) + + return clusters.find((item) => item.active) || clusters[0] +}) + +export interface ClusterProviderContext { + cluster: Cluster + clusters: Cluster[] + addCluster: (cluster: Cluster) => void + deleteCluster: (cluster: Cluster) => void + setCluster: (cluster: Cluster) => void + getExplorerUrl(path: string): string +} + +const Context = createContext({} as ClusterProviderContext) + +export function ClusterProvider({ children }: { children: ReactNode }) { + const cluster = useAtomValue(activeClusterAtom) + const clusters = useAtomValue(activeClustersAtom) + const setCluster = useSetAtom(clusterAtom) + const setClusters = useSetAtom(clustersAtom) + + const value: ClusterProviderContext = { + cluster, + clusters: clusters.sort((a, b) => (a.name > b.name ? 1 : -1)), + addCluster: (cluster: Cluster) => { + try { + new Connection(cluster.endpoint) + setClusters([...clusters, cluster]) + } catch (err) { + toast.error(`${err}`) + } + }, + deleteCluster: (cluster: Cluster) => { + setClusters(clusters.filter((item) => item.name !== cluster.name)) + }, + setCluster: (cluster: Cluster) => setCluster(cluster), + getExplorerUrl: (path: string) => `https://explorer.solana.com/${path}${getClusterUrlParam(cluster)}`, + } + return {children} +} + +export function useCluster() { + return useContext(Context) +} + +function getClusterUrlParam(cluster: Cluster): string { + let suffix = '' + switch (cluster.network) { + case ClusterNetwork.Devnet: + suffix = 'devnet' + break + case ClusterNetwork.Mainnet: + suffix = '' + break + case ClusterNetwork.Testnet: + suffix = 'testnet' + break + default: + suffix = `custom&customUrl=${encodeURIComponent(cluster.endpoint)}` + break + } + + return suffix.length ? `?cluster=${suffix}` : '' +} diff --git a/src/components/cluster/cluster-feature.tsx b/src/components/cluster/cluster-feature.tsx new file mode 100644 index 0000000..3ccf3b8 --- /dev/null +++ b/src/components/cluster/cluster-feature.tsx @@ -0,0 +1,22 @@ +'use client' + +import { useState } from 'react' +import { AppHero } from '../ui/ui-layout' +import { ClusterUiModal } from './cluster-ui' +import { ClusterUiTable } from './cluster-ui' + +export default function ClusterFeature() { + const [showModal, setShowModal] = useState(false) + + return ( +
+ + setShowModal(false)} /> + + + +
+ ) +} diff --git a/src/components/cluster/cluster-ui.tsx b/src/components/cluster/cluster-ui.tsx new file mode 100644 index 0000000..c1f4812 --- /dev/null +++ b/src/components/cluster/cluster-ui.tsx @@ -0,0 +1,176 @@ +'use client' + +import { useConnection } from '@solana/wallet-adapter-react' +import { IconTrash } from '@tabler/icons-react' +import { useQuery } from '@tanstack/react-query' +import { ReactNode, useState } from 'react' +import { AppModal } from '../ui/ui-layout' +import { ClusterNetwork, useCluster } from './cluster-data-access' +import { Connection } from '@solana/web3.js' + +export function ExplorerLink({ path, label, className }: { path: string; label: string; className?: string }) { + const { getExplorerUrl } = useCluster() + return ( + + {label} + + ) +} + +export function ClusterChecker({ children }: { children: ReactNode }) { + const { cluster } = useCluster() + const { connection } = useConnection() + + const query = useQuery({ + queryKey: ['version', { cluster, endpoint: connection.rpcEndpoint }], + queryFn: () => connection.getVersion(), + retry: 1, + }) + if (query.isLoading) { + return null + } + if (query.isError || !query.data) { + return ( +
+ + Error connecting to cluster {cluster.name} + + +
+ ) + } + return children +} + +export function ClusterUiSelect() { + const { clusters, setCluster, cluster } = useCluster() + return ( +
+ +
    + {clusters.map((item) => ( +
  • + +
  • + ))} +
+
+ ) +} + +export function ClusterUiModal({ hideModal, show }: { hideModal: () => void; show: boolean }) { + const { addCluster } = useCluster() + const [name, setName] = useState('') + const [network, setNetwork] = useState() + const [endpoint, setEndpoint] = useState('') + + return ( + { + try { + new Connection(endpoint) + if (name) { + addCluster({ name, network, endpoint }) + hideModal() + } else { + console.log('Invalid cluster name') + } + } catch { + console.log('Invalid cluster endpoint') + } + }} + submitLabel="Save" + > + setName(e.target.value)} + /> + setEndpoint(e.target.value)} + /> + + + ) +} + +export function ClusterUiTable() { + const { clusters, setCluster, deleteCluster } = useCluster() + return ( +
+ + + + + + + + + {clusters.map((item) => ( + + + + + ))} + +
Name/ Network / EndpointActions
+
+ + {item?.active ? ( + item.name + ) : ( + + )} + +
+ Network: {item.network ?? 'custom'} +
{item.endpoint}
+
+ +
+
+ ) +} diff --git a/src/components/dashboard/dashboard-feature.tsx b/src/components/dashboard/dashboard-feature.tsx new file mode 100644 index 0000000..df8e7bc --- /dev/null +++ b/src/components/dashboard/dashboard-feature.tsx @@ -0,0 +1,31 @@ +'use client' + +import { AppHero } from '../ui/ui-layout' + +const links: { label: string; href: string }[] = [ + { label: 'Solana Docs', href: 'https://docs.solana.com/' }, + { label: 'Solana Faucet', href: 'https://faucet.solana.com/' }, + { label: 'Solana Cookbook', href: 'https://solanacookbook.com/' }, + { label: 'Solana Stack Overflow', href: 'https://solana.stackexchange.com/' }, + { label: 'Solana Developers GitHub', href: 'https://github.com/solana-developers/' }, +] + +export default function DashboardFeature() { + return ( +
+ +
+
+

Here are some helpful links to get you started.

+ {links.map((link, index) => ( + + ))} +
+
+
+ ) +} diff --git a/src/components/dashh/dashh-data-access.tsx b/src/components/dashh/dashh-data-access.tsx new file mode 100644 index 0000000..cc1fbcb --- /dev/null +++ b/src/components/dashh/dashh-data-access.tsx @@ -0,0 +1,154 @@ +'use client' +import * as anchor from '@coral-xyz/anchor' + +import { clusterApiUrl, Connection, PublicKey} from '@solana/web3.js' +import {useMutation, useQuery} from '@tanstack/react-query' + +import toast from 'react-hot-toast' + +import {useAnchorProvider} from '../solana/solana-provider' +import { useTransactionToast } from '../ui/ui-layout' +import { getDashhProgram } from '../../../anchor/src' +import Error from 'next/error' +import { v4 as uuidv4 } from 'uuid'; + +interface CampaignArgs{ + id: number, + title: string, + image: string, + description: string, + lable: string, + endtime: number, + reward: number, + owner: PublicKey, +} + +interface participantargs{ + id: number, + user: PublicKey, + points: number, +} + +export function useDashhProgram() { + + const connection = new Connection(clusterApiUrl("devnet"), "confirmed"); + const transactionToast = useTransactionToast() + const provider = useAnchorProvider() + const programId = "5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP" + const program = getDashhProgram(provider) + + const accounts = useQuery({ + queryKey: ['dashh', 'all', 'devnet'], + queryFn: () => program.account.campaign.all(), + }) + + const getProgramAccount = useQuery({ + queryKey: ['get-program-account', 'devnet'], + queryFn: () => connection.getParsedAccountInfo(new PublicKey(programId)), + }) + + const createCampaign = useMutation({ + mutationKey: ['create-campaign', 'create', 'devnet'], + mutationFn: async ({ title, description, image, lable, endtime, reward }) => { + const id = new anchor.BN(uuidv4().split('-').join('').slice(0, 8), 16); + const endtimeAsU64 = new anchor.BN(endtime); + const rewardAsU64 = new anchor.BN(reward); + + try { + // Connect to Phantom wallet + // const { solana }: any = window; + // if (!solana || !solana.isPhantom) { + // console.log("Phantom wallet not found"); + + // } + + // const response = await solana.connect(); + // const signer = new PublicKey(response.publicKey.toString()); + + return program.methods + .createCampaign(id, title, description, image, lable, endtimeAsU64, rewardAsU64) + + .rpc(); + } catch (error) { + console.error('Error creating campaign:', error); + throw error; + } + }, + onSuccess: (signature) => { + transactionToast(signature); + toast.success('Campaign created successfully'); + accounts.refetch(); + }, + onError: (error) => { + toast.error('Failed to create campaign'); + console.error('Error:', error); + }, + }); + + const createParticipant = useMutation({ + mutationKey:['create-Participant',`create`,'devnet'], + mutationFn: async ({id,user}) => { + return program.methods.createParticipent( + new anchor.BN( id), + user + ).rpc(); + }, + onSuccess: (signature) => { + transactionToast(signature); + toast.success('participated created successfully') + accounts.refetch() + }, + onError: (error) => { + toast.error(`Error creating campaign: ${error}`) + } + }) + + + return { + program, + programId, + accounts, + getProgramAccount, + createCampaign, + createParticipant, + + } +} + +export function useDashhProgramAccount({ account }: { account: PublicKey }) { + // const { cluster } = useCluster() + const transactionToast = useTransactionToast() + const { program, accounts } = useDashhProgram() + + const accountQuery = useQuery({ + queryKey: ['dashh', 'fetch', { cluster:'devnet', account: account.toBase58() }], + queryFn: () => program.account.campaign.fetch(account), + }) + + + const updateParticipant = useMutation({ + mutationKey:['update-Participant',`update`,'devnet'], + mutationFn: async ({id,user,points}) => { + return program.methods.updatedParticipent( + new anchor.BN( id), + user, +new anchor.BN (points) + ).rpc(); + }, + onSuccess: (Signature) => { + transactionToast(Signature); + toast.success('points update successfully') + accounts.refetch() + }, + onError: (error) => { + toast.error(`Error creating campaign: ${error}`) + } + + }) + + return { + accountQuery, + updateParticipant + + } +} diff --git a/src/components/dashh/dashh-feature.tsx b/src/components/dashh/dashh-feature.tsx new file mode 100644 index 0000000..5dad64c --- /dev/null +++ b/src/components/dashh/dashh-feature.tsx @@ -0,0 +1,37 @@ +'use client' + +import { useWallet } from '@solana/wallet-adapter-react' +import { WalletButton } from '../solana/solana-provider' +import { AppHero, ellipsify } from '../ui/ui-layout' +import { ExplorerLink } from '../cluster/cluster-ui' +import { useDashhProgram } from './dashh-data-access' + + +export default function DashhFeature() { + const { publicKey } = useWallet() + const { programId } = useDashhProgram() + + return publicKey ? ( +
+ +

+ +

+
+ +
+ ) : ( +
+
+
+ +
+
+
+ ) +} diff --git a/src/components/dashh/dashh-ui.tsx b/src/components/dashh/dashh-ui.tsx new file mode 100644 index 0000000..8a293cd --- /dev/null +++ b/src/components/dashh/dashh-ui.tsx @@ -0,0 +1,122 @@ +// 'use client' + +// import { Keypair, PublicKey } from '@solana/web3.js' +// import { useMemo } from 'react' +// import { ellipsify } from '../ui/ui-layout' +// import { ExplorerLink } from '../cluster/cluster-ui' +// import { useDashhProgram, useDashhProgramAccount } from './dashh-data-access' + +// export function DashhCreate() { +// const { initialize } = useDashhProgram() + +// return ( +// +// ) +// } + +// export function DashhList() { +// const { accounts, getProgramAccount } = useDashhProgram() + +// if (getProgramAccount.isLoading) { +// return +// } +// if (!getProgramAccount.data?.value) { +// return ( +//
+// Program account not found. Make sure you have deployed the program and are on the correct cluster. +//
+// ) +// } +// return ( +//
+// {accounts.isLoading ? ( +// +// ) : accounts.data?.length ? ( +//
+// {accounts.data?.map((account) => ( +// +// ))} +//
+// ) : ( +//
+//

No accounts

+// No accounts found. Create one above to get started. +//
+// )} +//
+// ) +// } + +// function DashhCard({ account }: { account: PublicKey }) { +// const { accountQuery, incrementMutation, setMutation, decrementMutation, closeMutation } = useDashhProgramAccount({ +// account, +// }) + +// const count = useMemo(() => accountQuery.data?.count ?? 0, [accountQuery.data?.count]) + +// return accountQuery.isLoading ? ( +// +// ) : ( +//
+//
+//
+//

accountQuery.refetch()}> +// {count} +//

+//
+// +// +// +//
+//
+//

+// +//

+// +//
+//
+//
+//
+// ) +// } diff --git a/src/components/header.tsx b/src/components/header.tsx index d3768ad..1096d54 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -1,27 +1,31 @@ 'use client' -import { useState } from "react" -import ConnectPhantomWallet from "@/app/connectPhantomWallet/connectbtn" +import { useEffect, useState } from "react" + import CustomToggle from "./custom-toggle" import Link from "next/link" import Image from "next/image" import logo from "../images/whiteDASHH.png" import { useRouter } from "next/navigation" +import { useAnchorProvider, WalletButton } from "./solana/solana-provider" const Header = () => { const [selectedOption, setSelectedOption] = useState(''); const router = useRouter() + const provider = useAnchorProvider() + useEffect(() => { + if (!provider.wallet.publicKey) { + router.push('/') + } + },[]) const handleToggle = (selected: string) => { setSelectedOption(selected); }; - if(selectedOption === 'User'){ - router.push('/dashboard') - } - else if(selectedOption === 'Creator'){ - router.push('/creatordashboard') - } - const [walletAddress, setWalletAddress] = useState(null); + console.log(selectedOption); + + + return (
{/* Toggle thingg */}
-
+
- +
{/*
+ +
+ ) +} + +export function AppModal({ + children, + title, + hide, + show, + submit, + submitDisabled, + submitLabel, +}: { + children: ReactNode + title: string + hide: () => void + show: boolean + submit?: () => void + submitDisabled?: boolean + submitLabel?: string +}) { + const dialogRef = useRef(null) + + useEffect(() => { + if (!dialogRef.current) return + if (show) { + dialogRef.current.showModal() + } else { + dialogRef.current.close() + } + }, [show, dialogRef]) + + return ( + +
+

{title}

+ {children} +
+
+ {submit ? ( + + ) : null} + +
+
+
+
+ ) +} + +export function AppHero({ + children, + title, + subtitle, +}: { + children?: ReactNode + title: ReactNode + subtitle: ReactNode +}) { + return ( +
+
+
+ {typeof title === 'string' ?

{title}

: title} + {typeof subtitle === 'string' ?

{subtitle}

: subtitle} + {children} +
+
+
+ ) +} + +export function ellipsify(str = '', len = 4) { + if (str.length > 30) { + return str.substring(0, len) + '..' + str.substring(str.length - len, str.length) + } + return str +} + +export function useTransactionToast() { + return (signature: string) => { + toast.success( +
+
Transaction sent
+ +
, + ) + } +} diff --git a/src/lib/dbconnect.ts b/src/lib/dbconnect.ts index 6f1f122..0adfce9 100644 --- a/src/lib/dbconnect.ts +++ b/src/lib/dbconnect.ts @@ -5,7 +5,9 @@ const connectDB = async () => { const conn = await mongoose.connect(process.env.MONGO_URI||"",{ dbName: process.env.MONGO_DB_NAME, }); - console.log(`MongoDB Connected: ${conn.connection.host}`); +if(conn){ + console.log(`MongoDB Connected: ${conn.connection.host}`); +} } catch (error) { if (error instanceof Error) { console.error(`Error: ${error.message}`); From 3b84b3d57e9dafdc4b0b0bc29bc48a3c66cc8e89 Mon Sep 17 00:00:00 2001 From: Singupalli Kartik Date: Sat, 30 Nov 2024 17:03:19 +0530 Subject: [PATCH 02/13] integrate Anchor program for fetching campaign account data --- src/app/api/donate/[id]/route.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/app/api/donate/[id]/route.ts b/src/app/api/donate/[id]/route.ts index 7eb6e75..12555f8 100644 --- a/src/app/api/donate/[id]/route.ts +++ b/src/app/api/donate/[id]/route.ts @@ -4,14 +4,30 @@ import User from "@/lib/models/user"; import { ActionGetResponse, ActionPostRequest, ActionPostResponse, ACTIONS_CORS_HEADERS } from "@solana/actions"; import { clusterApiUrl, Connection, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; +import IDL from "../../../../../anchor/target/idl/dashh.json"; +import { Program } from "@coral-xyz/anchor"; +import { Dashh, getDashhProgram } from "../../../../../anchor/src"; +import { useAnchorProvider } from "@/components/solana/solana-provider"; +import { useQuery } from "@tanstack/react-query"; export async function GET(request:Request ,params:{params:{id:string} }){ const url = new URL(request.url); const id = await params.params.id; console.log(id); - const { accountQuery } = useDashhProgramAccount({ - account:new PublicKey(id as string), - }); + const provider = useAnchorProvider() + const programId = "5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP" + const program = getDashhProgram(provider) + + const accountQuery = useQuery({ + queryKey: ['dashh', 'fetch', { cluster:'devnet', account: programId }], + queryFn: () => program.account.campaign.fetch(id), + }) + +// const getProgramAccount = useQuery({ +// queryKey: ['get-program-account', 'devnet'], +// queryFn: () => connection.getParsedAccountInfo(new PublicKey(programId)), +// }) + console.log("account query ",accountQuery); const creator = { From c6f3c078f7e5e936841bbaa76b7d8e06a535e0d6 Mon Sep 17 00:00:00 2001 From: Singupalli Kartik Date: Mon, 2 Dec 2024 06:48:35 +0530 Subject: [PATCH 03/13] converted the whole program into onchain --- ...8X24qwGvG2kpTcogg3Wpvu31FrErpLU8vw6oT.json | 1 - anchor/Anchor.toml | 9 +- anchor/programs/dashh/src/lib.rs | 10 +- anchor/src/dashh-exports.ts | 4 +- anchor/target/idl/dashh.json | 8 +- anchor/target/types/dashh.ts | 6 +- anchor/tests/dashh.spec.ts | 2 +- package-lock.json | 1742 +++++++++++++++-- package.json | 1 + src/app/api/donate/[id]/route.ts | 23 +- src/app/blinkcard/Preblink.tsx | 6 +- src/app/blinkcard/SolanaBlinksCard.tsx | 38 +- src/app/dashboard/[id]/page.tsx | 108 +- src/app/dashboard/page.tsx | 12 +- src/app/verifyClaim/page.tsx | 257 +++ src/components/dashh/dashh-data-access.tsx | 64 +- src/components/header.tsx | 10 +- 17 files changed, 1989 insertions(+), 312 deletions(-) delete mode 100644 anchor/ALH8UD28X24qwGvG2kpTcogg3Wpvu31FrErpLU8vw6oT.json create mode 100644 src/app/verifyClaim/page.tsx diff --git a/anchor/ALH8UD28X24qwGvG2kpTcogg3Wpvu31FrErpLU8vw6oT.json b/anchor/ALH8UD28X24qwGvG2kpTcogg3Wpvu31FrErpLU8vw6oT.json deleted file mode 100644 index 18aa8eb..0000000 --- a/anchor/ALH8UD28X24qwGvG2kpTcogg3Wpvu31FrErpLU8vw6oT.json +++ /dev/null @@ -1 +0,0 @@ -[243,231,65,226,67,82,76,126,131,209,171,118,251,45,166,75,89,26,209,221,68,133,192,49,85,66,226,71,214,84,240,132,138,169,116,95,29,213,89,189,108,93,248,33,83,144,30,173,112,101,127,190,107,208,101,29,157,39,62,26,145,127,81,154] \ No newline at end of file diff --git a/anchor/Anchor.toml b/anchor/Anchor.toml index 1477b2c..b506698 100644 --- a/anchor/Anchor.toml +++ b/anchor/Anchor.toml @@ -5,14 +5,17 @@ anchor_version = "0.30.1" resolution = true skip-lint = false +[programs.devnet] +dashh = "Gdh4Jq1DY5t47vVVVGeK2Zx3EyeDm9L923bRfSWQ2aDJ" + [programs.localnet] -dashh = "5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP" +dashh = "7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr" [registry] url = "https://api.apr.dev" [provider] -cluster = "Localnet" +cluster = "Devnet" wallet = "~/.config/solana/id.json" [scripts] @@ -26,4 +29,4 @@ upgradeable = false [test.validator] bind_address = "127.0.0.1" ledger = ".anchor/test-ledger" -rpc_port = 8898 +rpc_port = 8899 diff --git a/anchor/programs/dashh/src/lib.rs b/anchor/programs/dashh/src/lib.rs index 6cf6a48..e95f61c 100644 --- a/anchor/programs/dashh/src/lib.rs +++ b/anchor/programs/dashh/src/lib.rs @@ -2,7 +2,7 @@ use anchor_lang::prelude::*; -declare_id!("5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP"); +declare_id!("Gdh4Jq1DY5t47vVVVGeK2Zx3EyeDm9L923bRfSWQ2aDJ"); // creater caimpaign // user participate in campaign // user can claim reward @@ -14,6 +14,7 @@ pub mod dashh { pub fn create_campaign(ctx: Context,campaignid:u64, title: String,image:String, description: String, lable:String,endtime:u64, reward: u64) -> Result<()> { let campaign = &mut ctx.accounts.campaign; + campaign.owner = ctx.accounts.signer.key(); campaign.id = campaignid; campaign.title = title; campaign.image = image; @@ -23,9 +24,10 @@ pub mod dashh { campaign.reward = reward; Ok(()) } - pub fn create_participent(ctx: Context,_campaignid:u64,_useraccount:Pubkey ) -> Result<()> { + pub fn create_participent(ctx: Context,campaignid:u64,_useraccount:Pubkey ) -> Result<()> { let participent = &mut ctx.accounts.participent; - participent.user = *ctx.accounts.signer.key; + participent.id= campaignid; + participent.user = ctx.accounts.signer.key(); participent.points = 0; Ok(()) } @@ -51,6 +53,7 @@ pub struct Campaign { pub lable: String, pub endtime: u64, pub reward: u64, + pub owner: Pubkey, } @@ -74,6 +77,7 @@ pub struct CreateCampaign<'info> { #[account] #[derive(InitSpace)] pub struct Participent{ + pub id: u64, pub user: Pubkey, pub points: u64, } diff --git a/anchor/src/dashh-exports.ts b/anchor/src/dashh-exports.ts index 15c917f..267d2df 100644 --- a/anchor/src/dashh-exports.ts +++ b/anchor/src/dashh-exports.ts @@ -16,12 +16,12 @@ export function getDashhProgram(provider: AnchorProvider) { } // This is a helper function to get the program ID for the Dashh program depending on the cluster. -export function getDashhProgramId(cluster: Cluster = 'devnet') { +export function getDashhProgramId(cluster: Cluster) { switch (cluster) { case 'devnet': case 'testnet': // This is the program ID for the Dashh program on devnet and testnet. - return new PublicKey('5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP') + return new PublicKey('7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr') case 'mainnet-beta': default: return DASHH_PROGRAM_ID diff --git a/anchor/target/idl/dashh.json b/anchor/target/idl/dashh.json index 0eb73be..6724de6 100644 --- a/anchor/target/idl/dashh.json +++ b/anchor/target/idl/dashh.json @@ -1,5 +1,5 @@ { - "address": "5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP", + "address": "7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr", "metadata": { "name": "dashh", "version": "0.1.0", @@ -114,7 +114,7 @@ ], "args": [ { - "name": "_campaignid", + "name": "campaignid", "type": "u64" }, { @@ -252,6 +252,10 @@ "type": { "kind": "struct", "fields": [ + { + "name": "id", + "type": "u64" + }, { "name": "user", "type": "pubkey" diff --git a/anchor/target/types/dashh.ts b/anchor/target/types/dashh.ts index d6bd508..d1d922a 100644 --- a/anchor/target/types/dashh.ts +++ b/anchor/target/types/dashh.ts @@ -5,7 +5,7 @@ * IDL can be found at `target/idl/dashh.json`. */ export type Dashh = { - "address": "5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP", + "address": "7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr", "metadata": { "name": "dashh", "version": "0.1.0", @@ -258,6 +258,10 @@ export type Dashh = { "type": { "kind": "struct", "fields": [ + { + "name": "id", + "type": "u64" + }, { "name": "user", "type": "pubkey" diff --git a/anchor/tests/dashh.spec.ts b/anchor/tests/dashh.spec.ts index 49e7f91..42029a6 100644 --- a/anchor/tests/dashh.spec.ts +++ b/anchor/tests/dashh.spec.ts @@ -5,7 +5,7 @@ import {Dashh} from '../target/types/dashh' import { BankrunProvider, startAnchor } from 'anchor-bankrun' import { randomUUID } from 'crypto' const IDL = require('../target/idl/dashh.json') -const campaign_address = new PublicKey("AsjZ3kWAUSQRNt2pZVeJkywhZ6gpLpHZmJjduPmKZDZZ") +const campaign_address = new PublicKey("7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr") describe('dashh', () => { // Configure the client to use the local cluster. diff --git a/package-lock.json b/package-lock.json index 58ba108..37adee8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -71,6 +71,7 @@ "@types/three": "^0.170.0", "eslint": "^8", "eslint-config-next": "14.2.14", + "jest": "^29.7.0", "postcss": "^8", "tailwindcss": "^3.4.1", "typescript": "^5" @@ -98,7 +99,6 @@ "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "license": "Apache-2.0", - "peer": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" @@ -125,7 +125,6 @@ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.2.tgz", "integrity": "sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg==", "license": "MIT", - "peer": true, "engines": { "node": ">=6.9.0" } @@ -135,7 +134,6 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", "license": "MIT", - "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.26.0", @@ -165,15 +163,13 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@babel/core/node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "license": "MIT", - "peer": true, "bin": { "json5": "lib/cli.js" }, @@ -186,7 +182,6 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "license": "ISC", - "peer": true, "bin": { "semver": "bin/semver.js" } @@ -238,7 +233,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", "license": "MIT", - "peer": true, "dependencies": { "@babel/compat-data": "^7.25.9", "@babel/helper-validator-option": "^7.25.9", @@ -255,7 +249,6 @@ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "license": "ISC", - "peer": true, "dependencies": { "yallist": "^3.0.2" } @@ -265,7 +258,6 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "license": "ISC", - "peer": true, "bin": { "semver": "bin/semver.js" } @@ -378,7 +370,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9", @@ -409,7 +400,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", "license": "MIT", - "peer": true, "engines": { "node": ">=6.9.0" } @@ -499,7 +489,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "license": "MIT", - "peer": true, "engines": { "node": ">=6.9.0" } @@ -524,7 +513,6 @@ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/template": "^7.25.9", "@babel/types": "^7.26.0" @@ -720,7 +708,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -733,7 +720,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -746,7 +732,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.12.13" }, @@ -759,7 +744,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" }, @@ -836,7 +820,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" }, @@ -852,7 +835,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, @@ -865,7 +847,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -878,7 +859,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz", "integrity": "sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" }, @@ -894,7 +874,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, @@ -907,7 +886,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -920,7 +898,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, @@ -933,7 +910,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -946,7 +922,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -959,7 +934,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -972,7 +946,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" }, @@ -988,7 +961,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" }, @@ -1004,7 +976,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz", "integrity": "sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" }, @@ -2275,6 +2246,13 @@ "node": ">=6.9.0" } }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true, + "license": "MIT" + }, "node_modules/@coral-xyz/anchor": { "version": "0.30.1", "resolved": "https://registry.npmjs.org/@coral-xyz/anchor/-/anchor-0.30.1.tgz", @@ -3464,7 +3442,6 @@ "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", "license": "ISC", - "peer": true, "dependencies": { "camelcase": "^5.3.1", "find-up": "^4.1.0", @@ -3481,7 +3458,6 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "license": "MIT", - "peer": true, "dependencies": { "sprintf-js": "~1.0.2" } @@ -3491,7 +3467,6 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "license": "MIT", - "peer": true, "engines": { "node": ">=6" } @@ -3501,7 +3476,6 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "license": "MIT", - "peer": true, "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -3515,7 +3489,6 @@ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "license": "MIT", - "peer": true, "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -3529,7 +3502,6 @@ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "license": "MIT", - "peer": true, "dependencies": { "p-locate": "^4.1.0" }, @@ -3542,7 +3514,6 @@ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "license": "MIT", - "peer": true, "dependencies": { "p-try": "^2.0.0" }, @@ -3558,7 +3529,6 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "license": "MIT", - "peer": true, "dependencies": { "p-limit": "^2.2.0" }, @@ -3571,7 +3541,6 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "license": "MIT", - "peer": true, "engines": { "node": ">=8" } @@ -3581,11 +3550,110 @@ "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", "license": "MIT", - "peer": true, "engines": { "node": ">=8" } }, + "node_modules/@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/console/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/core/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/@jest/create-cache-key-function": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz", @@ -3604,7 +3672,6 @@ "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", "license": "MIT", - "peer": true, "dependencies": { "@jest/fake-timers": "^29.7.0", "@jest/types": "^29.6.3", @@ -3615,12 +3682,38 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/@jest/fake-timers": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", "license": "MIT", - "peer": true, "dependencies": { "@jest/types": "^29.6.3", "@sinonjs/fake-timers": "^10.0.2", @@ -3633,12 +3726,105 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/reporters/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@jest/reporters/node_modules/istanbul-lib-instrument": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@jest/schemas": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", "license": "MIT", - "peer": true, "dependencies": { "@sinclair/typebox": "^0.27.8" }, @@ -3646,12 +3832,58 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/@jest/transform": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/core": "^7.11.6", "@jest/types": "^29.6.3", @@ -3678,7 +3910,6 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "license": "MIT", - "peer": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -3694,15 +3925,13 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@jest/types": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", "license": "MIT", - "peer": true, "dependencies": { "@jest/schemas": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", @@ -3720,7 +3949,6 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "license": "MIT", - "peer": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -5150,15 +5378,13 @@ "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@sinonjs/commons": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "license": "BSD-3-Clause", - "peer": true, "dependencies": { "type-detect": "4.0.8" } @@ -5168,7 +5394,6 @@ "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", "license": "BSD-3-Clause", - "peer": true, "dependencies": { "@sinonjs/commons": "^3.0.0" } @@ -5922,7 +6147,6 @@ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", "license": "MIT", - "peer": true, "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", @@ -5936,7 +6160,6 @@ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/types": "^7.0.0" } @@ -5946,7 +6169,6 @@ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", "license": "MIT", - "peer": true, "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" @@ -5957,7 +6179,6 @@ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz", "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==", "license": "MIT", - "peer": true, "dependencies": { "@babel/types": "^7.20.7" } @@ -5994,7 +6215,6 @@ "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", "license": "MIT", - "peer": true, "dependencies": { "@types/node": "*" } @@ -6025,15 +6245,13 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/istanbul-lib-report": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", "license": "MIT", - "peer": true, "dependencies": { "@types/istanbul-lib-coverage": "*" } @@ -6043,7 +6261,6 @@ "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", "license": "MIT", - "peer": true, "dependencies": { "@types/istanbul-lib-report": "*" } @@ -6140,8 +6357,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/stats.js": { "version": "0.17.3", @@ -6212,7 +6428,6 @@ "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==", "license": "MIT", - "peer": true, "dependencies": { "@types/yargs-parser": "*" } @@ -6221,8 +6436,7 @@ "version": "21.0.3", "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "8.8.0", @@ -7057,7 +7271,6 @@ "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", "license": "MIT", - "peer": true, "dependencies": { "@jest/transform": "^29.7.0", "@types/babel__core": "^7.1.14", @@ -7079,7 +7292,6 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "license": "MIT", - "peer": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -7096,7 +7308,6 @@ "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", "license": "BSD-3-Clause", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", "@istanbuljs/load-nyc-config": "^1.0.0", @@ -7113,7 +7324,6 @@ "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", "license": "MIT", - "peer": true, "dependencies": { "@babel/template": "^7.3.3", "@babel/types": "^7.3.3", @@ -7215,7 +7425,6 @@ "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz", "integrity": "sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/plugin-syntax-async-generators": "^7.8.4", "@babel/plugin-syntax-bigint": "^7.8.3", @@ -7242,7 +7451,6 @@ "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", "license": "MIT", - "peer": true, "dependencies": { "babel-plugin-jest-hoist": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0" @@ -7475,7 +7683,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001669", "electron-to-chromium": "^1.5.41", @@ -7502,7 +7709,6 @@ "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", "license": "Apache-2.0", - "peer": true, "dependencies": { "node-int64": "^0.4.0" } @@ -7543,8 +7749,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/buffer-layout": { "version": "1.2.2", @@ -7706,6 +7911,16 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/character-entities": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz", @@ -7834,11 +8049,17 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=8" } }, + "node_modules/cjs-module-lexer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz", + "integrity": "sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==", + "dev": true, + "license": "MIT" + }, "node_modules/class-variance-authority": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.0.tgz", @@ -7969,6 +8190,24 @@ "node": ">=6" } }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true, + "license": "MIT" + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -8121,6 +8360,45 @@ "node": ">= 6" } }, + "node_modules/create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/create-jest/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/cross-fetch": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", @@ -8328,6 +8606,21 @@ "node": ">=0.10.0" } }, + "node_modules/dedent": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", + "integrity": "sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, "node_modules/deep-equal": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.3.tgz", @@ -8366,6 +8659,16 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/defaults": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", @@ -8457,6 +8760,16 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/detect-node-es": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", @@ -8468,6 +8781,16 @@ "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/dijkstrajs": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", @@ -8526,8 +8849,7 @@ "version": "1.5.65", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.65.tgz", "integrity": "sha512-PWVzBjghx7/wop6n22vS2MLU8tKGd4Q91aCEGhG/TYmW6PP5OcSXcdnxTe1NNt0T66N8D6jxh4kC8UsdzOGaIw==", - "license": "ISC", - "peer": true + "license": "ISC" }, "node_modules/elliptic": { "version": "6.5.4", @@ -8548,6 +8870,19 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==" }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", @@ -8788,7 +9123,6 @@ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "license": "MIT", - "peer": true, "engines": { "node": ">=6" } @@ -9216,7 +9550,6 @@ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "license": "BSD-2-Clause", - "peer": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -9356,7 +9689,6 @@ "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", "license": "MIT", - "peer": true, "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -9379,8 +9711,33 @@ "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "license": "ISC", - "peer": true + "license": "ISC" + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } }, "node_modules/exponential-backoff": { "version": "3.1.1", @@ -9503,7 +9860,6 @@ "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", "license": "Apache-2.0", - "peer": true, "dependencies": { "bser": "2.1.1" } @@ -9834,7 +10190,6 @@ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "license": "MIT", - "peer": true, "engines": { "node": ">=6.9.0" } @@ -9880,7 +10235,6 @@ "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", "license": "MIT", - "peer": true, "engines": { "node": ">=8.0.0" } @@ -9890,7 +10244,6 @@ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "license": "MIT", - "peer": true, "engines": { "node": ">=10" }, @@ -10190,6 +10543,13 @@ "react-is": "^16.7.0" } }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -10222,7 +10582,6 @@ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "license": "Apache-2.0", - "peer": true, "engines": { "node": ">=10.17.0" } @@ -10306,6 +10665,95 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-local/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-local/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local/node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -10665,6 +11113,16 @@ "node": ">=8" } }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/is-generator-function": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", @@ -10837,7 +11295,6 @@ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "license": "MIT", - "peer": true, "engines": { "node": ">=8" }, @@ -10988,7 +11445,6 @@ "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", "license": "BSD-3-Clause", - "peer": true, "engines": { "node": ">=8" } @@ -10998,7 +11454,6 @@ "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", "license": "BSD-3-Clause", - "peer": true, "dependencies": { "@babel/core": "^7.12.3", "@babel/parser": "^7.14.7", @@ -11015,26 +11470,95 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "license": "ISC", - "peer": true, "bin": { "semver": "bin/semver.js" } }, - "node_modules/iterator.prototype": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.2.tgz", - "integrity": "sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==", + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "define-properties": "^1.2.1", - "get-intrinsic": "^1.2.1", - "has-symbols": "^1.0.3", - "reflect.getprototypeof": "^1.0.4", - "set-function-name": "^2.0.1" + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" } }, - "node_modules/jackspeak": { - "version": "2.3.6", + "node_modules/istanbul-lib-report/node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/iterator.prototype": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.2.tgz", + "integrity": "sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "reflect.getprototypeof": "^1.0.4", + "set-function-name": "^2.0.1" + } + }, + "node_modules/jackspeak": { + "version": "2.3.6", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", "dev": true, @@ -11115,87 +11639,782 @@ } } }, - "node_modules/jest-environment-node": { + "node_modules/jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-cli/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-cli/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-cli/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-cli/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-cli/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/jest-cli/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-cli/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-cli/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-config/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-diff/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-runner/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jest-runner/node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/jest-runtime": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", - "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@jest/environment": "^29.7.0", "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", "@jest/types": "^29.6.3", "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", "jest-mock": "^29.7.0", - "jest-util": "^29.7.0" + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-get-type": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", - "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "node_modules/jest-runtime/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "license": "MIT", - "peer": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-haste-map": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", - "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "node_modules/jest-runtime/node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, "license": "MIT", - "peer": true, - "dependencies": { - "@jest/types": "^29.6.3", - "@types/graceful-fs": "^4.1.3", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.6.3", - "jest-util": "^29.7.0", - "jest-worker": "^29.7.0", - "micromatch": "^4.0.4", - "walker": "^1.0.8" - }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "optionalDependencies": { - "fsevents": "^2.3.2" + "node": ">=8" } }, - "node_modules/jest-message-util": { + "node_modules/jest-snapshot": { "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", - "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, "license": "MIT", - "peer": true, "dependencies": { - "@babel/code-frame": "^7.12.13", + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", "@jest/types": "^29.6.3", - "@types/stack-utils": "^2.0.0", + "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", + "expect": "^29.7.0", "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", "pretty-format": "^29.7.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" + "semver": "^7.5.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-message-util/node_modules/chalk": { + "node_modules/jest-snapshot/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "license": "MIT", - "peer": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -11207,37 +12426,11 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/jest-mock": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", - "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", - "license": "MIT", - "peer": true, - "dependencies": { - "@jest/types": "^29.6.3", - "@types/node": "*", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-regex-util": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", - "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", - "license": "MIT", - "peer": true, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, "node_modules/jest-util": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "license": "MIT", - "peer": true, "dependencies": { "@jest/types": "^29.6.3", "@types/node": "*", @@ -11255,7 +12448,6 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "license": "MIT", - "peer": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -11272,7 +12464,6 @@ "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", "license": "MIT", - "peer": true, "dependencies": { "@jest/types": "^29.6.3", "camelcase": "^6.2.0", @@ -11290,7 +12481,43 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "license": "MIT", - "peer": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-watcher/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -11307,7 +12534,6 @@ "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", "license": "MIT", - "peer": true, "dependencies": { "@types/node": "*", "jest-util": "^29.7.0", @@ -11323,7 +12549,6 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "license": "MIT", - "peer": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -11646,6 +12871,16 @@ "node": ">=0.10.0" } }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/language-subtag-registry": { "version": "0.3.23", "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.23.tgz", @@ -11669,7 +12904,6 @@ "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", "license": "MIT", - "peer": true, "engines": { "node": ">=6" } @@ -11883,7 +13117,6 @@ "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", "license": "BSD-3-Clause", - "peer": true, "dependencies": { "tmpl": "1.0.5" } @@ -11925,8 +13158,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/merge2": { "version": "1.4.1", @@ -13052,15 +14284,13 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/node-releases": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/normalize-path": { "version": "3.0.0", @@ -13075,7 +14305,6 @@ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", "license": "MIT", - "peer": true, "dependencies": { "path-key": "^3.0.0" }, @@ -13849,7 +15078,6 @@ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", "license": "MIT", - "peer": true, "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", @@ -13864,7 +15092,6 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "license": "MIT", - "peer": true, "engines": { "node": ">=10" }, @@ -13876,8 +15103,7 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/prismjs": { "version": "1.29.0", @@ -13917,6 +15143,20 @@ "asap": "~2.0.6" } }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", @@ -13953,6 +15193,23 @@ "node": ">=6" } }, + "node_modules/pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, "node_modules/qr.js": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/qr.js/-/qr.js-0.0.0.tgz", @@ -14749,6 +16006,29 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-cwd/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -14767,6 +16047,16 @@ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", @@ -15272,12 +16562,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true, + "license": "MIT" + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "license": "MIT", - "peer": true, "engines": { "node": ">=8" } @@ -15490,15 +16786,13 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "license": "BSD-3-Clause", - "peer": true + "license": "BSD-3-Clause" }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", "license": "MIT", - "peer": true, "dependencies": { "escape-string-regexp": "^2.0.0" }, @@ -15511,7 +16805,6 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "license": "MIT", - "peer": true, "engines": { "node": ">=8" } @@ -15584,6 +16877,20 @@ "safe-buffer": "~5.2.0" } }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -15782,7 +17089,6 @@ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "license": "MIT", - "peer": true, "engines": { "node": ">=6" } @@ -16149,7 +17455,6 @@ "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", "license": "ISC", - "peer": true, "dependencies": { "@istanbuljs/schema": "^0.1.2", "glob": "^7.1.4", @@ -16298,8 +17603,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", - "license": "BSD-3-Clause", - "peer": true + "license": "BSD-3-Clause" }, "node_modules/to-regex-range": { "version": "5.0.1", @@ -16389,7 +17693,6 @@ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "license": "MIT", - "peer": true, "engines": { "node": ">=4" } @@ -16584,7 +17887,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.0" @@ -16698,6 +18000,28 @@ "uuid": "dist/esm/bin/uuid" } }, + "node_modules/v8-to-istanbul": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/v8-to-istanbul/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -16717,7 +18041,6 @@ "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", "license": "Apache-2.0", - "peer": true, "dependencies": { "makeerror": "1.0.12" } @@ -16963,7 +18286,6 @@ "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "license": "ISC", - "peer": true, "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^3.0.7" @@ -16976,8 +18298,7 @@ "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "license": "ISC", - "peer": true + "license": "ISC" }, "node_modules/ws": { "version": "8.17.1", @@ -17017,8 +18338,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "license": "ISC", - "peer": true + "license": "ISC" }, "node_modules/yaml": { "version": "2.5.1", diff --git a/package.json b/package.json index f5a432d..d83d1a4 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "@types/three": "^0.170.0", "eslint": "^8", "eslint-config-next": "14.2.14", + "jest": "^29.7.0", "postcss": "^8", "tailwindcss": "^3.4.1", "typescript": "^5" diff --git a/src/app/api/donate/[id]/route.ts b/src/app/api/donate/[id]/route.ts index 12555f8..167b75e 100644 --- a/src/app/api/donate/[id]/route.ts +++ b/src/app/api/donate/[id]/route.ts @@ -4,30 +4,15 @@ import User from "@/lib/models/user"; import { ActionGetResponse, ActionPostRequest, ActionPostResponse, ACTIONS_CORS_HEADERS } from "@solana/actions"; import { clusterApiUrl, Connection, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; -import IDL from "../../../../../anchor/target/idl/dashh.json"; -import { Program } from "@coral-xyz/anchor"; -import { Dashh, getDashhProgram } from "../../../../../anchor/src"; -import { useAnchorProvider } from "@/components/solana/solana-provider"; -import { useQuery } from "@tanstack/react-query"; export async function GET(request:Request ,params:{params:{id:string} }){ const url = new URL(request.url); const id = await params.params.id; console.log(id); - const provider = useAnchorProvider() - const programId = "5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP" - const program = getDashhProgram(provider) - - const accountQuery = useQuery({ - queryKey: ['dashh', 'fetch', { cluster:'devnet', account: programId }], - queryFn: () => program.account.campaign.fetch(id), - }) - -// const getProgramAccount = useQuery({ -// queryKey: ['get-program-account', 'devnet'], -// queryFn: () => connection.getParsedAccountInfo(new PublicKey(programId)), -// }) - + + const { accountQuery } = useDashhProgramAccount({ + account:new PublicKey(id as string), + }); console.log("account query ",accountQuery); const creator = { diff --git a/src/app/blinkcard/Preblink.tsx b/src/app/blinkcard/Preblink.tsx index 2613056..659e1fb 100644 --- a/src/app/blinkcard/Preblink.tsx +++ b/src/app/blinkcard/Preblink.tsx @@ -5,7 +5,7 @@ import { useDashhProgramAccount } from '@/components/dashh/dashh-data-access'; import { PublicKey } from '@solana/web3.js'; import { ICreator } from '@/lib/interface/creater'; import BN from 'bn.js'; -const Preblink = ({ account }: { account: PublicKey }) => { +const Preblink = ({ account,size }: { account: PublicKey,size:number }) => { const { accountQuery } = useDashhProgramAccount({ account, }); @@ -49,11 +49,11 @@ const id = accountQuery.data?.id; _id: idAsNumber.toString(), // Ensure _id is a string if that's the type in ICreator }; - + console.log("id",accountQuery); return ( <> - + ) diff --git a/src/app/blinkcard/SolanaBlinksCard.tsx b/src/app/blinkcard/SolanaBlinksCard.tsx index 08cdc2e..0e304b7 100644 --- a/src/app/blinkcard/SolanaBlinksCard.tsx +++ b/src/app/blinkcard/SolanaBlinksCard.tsx @@ -4,13 +4,34 @@ import Link from 'next/link' import Image from 'next/image' import { ICreator } from '@/lib/interface/creater' import { Clock, Trophy } from 'lucide-react' +import { Button } from '@/components/ui/button' +import { useDashhProgram } from '@/components/dashh/dashh-data-access' +// import { BN } from 'bn.js' +import { useAnchorProvider } from '@/components/solana/solana-provider' +// import { PublicKey } from '@solana/web3.js' -export function SolanaBlinksCard({ content, id }: { content: ICreator; id: string }) { +export function SolanaBlinksCard({ content, id,size }: { content: ICreator; id: string,size:number }) { + const provider = useAnchorProvider(); const daysLeft = content.end ? Math.max(0, Math.floor((new Date(content.end).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24))) : 'N/A' + const { createParticipant } = useDashhProgram(); +const handleparticipate =async (e:any) => { + e.preventDefault(); + await createParticipant.mutateAsync({ + id: Number(id), + user: provider.wallet.publicKey, + points: 0, + }).then + (function(){ + console.log("done"); + }) + .catch(function(){ + console.log("error"); + }); +} const getDashboardLink = () => { if (typeof window !== 'undefined') { const hostname = window.location.hostname; @@ -57,17 +78,18 @@ export function SolanaBlinksCard({ content, id }: { content: ICreator; id: strin
- Current participants: {content.users.length?content.users.length: 0 } users + Current participants: {size} users
- - BLINK NOW - + + (null); + + +const data = paccounts.data?.filter((account) => new BN(account.account.id|| 0).toNumber() === Number(params.id)); +const leaderboard = data?.sort((a:any, b:any) => b.account.points - a.account.points); +const myData = data?.find((account) => new BN(account.account.id|| 0).toNumber() == Number(params.id)); +const myRank = (leaderboard?.findIndex((account) => new BN(account.account.id|| 0).toNumber() == Number(params.id)) ?? -1) + 1; +const provider = useAnchorProvider(); + +const myv = accounts.data?.find((account) => account.account.id.toNumber() === Number(params.id)); + +useEffect(() => { + if (myv?.account.endtime) { + console.log(new BN(myv?.account.endtime).toNumber()); + console.log(Math.floor(Date.now())); + const endTime = new BN(myv?.account.endtime).toNumber(); + const updateTimer = () => { + const now = Math.floor(Date.now() ); + + const timeRemaining = endTime - now; + setTimeLeft(timeRemaining > 0 ? timeRemaining : 0); + }; + + updateTimer(); + const intervalId = setInterval(updateTimer, 1000); + + return () => clearInterval(intervalId); } +}, [myData]); + +const formatTime = (milliseconds: number) => { + const totalSeconds = Math.floor(milliseconds / 1000); + const days = Math.floor(totalSeconds / 86400); + const hours = Math.floor((totalSeconds % 86400) / 3600); + const minutes = Math.floor((totalSeconds % 3600) / 60); + const seconds = totalSeconds % 60; + return `${days}d ${hours}h ${minutes}m ${seconds}s`; +}; +const creator = accounts.data?.find((account) => account.account.owner.toString() == provider.wallet.publicKey.toString()); return ( -
-
- +
+
+
+ {myData? + + + + : + <>} + + {creator? + <> + + :<>} + +
{/* Header */}
@@ -37,13 +85,13 @@ export default async function Page({ params }: { params: { id: string } }) { {/* Podium */}
- {leaderboard.slice(0, 3).map((player, index) => ( -
+ {leaderboard?.slice(0, 3).map((player, index) => ( +
{player.solAdd}

- {player.views} SOL + {player.account.points.toNumber()} SOL

@@ -71,12 +119,14 @@ export default async function Page({ params }: { params: { id: string } }) { Ends in
-
00d 00h 43m 51s
+
{ + myv?.account.endtime ? formatTime(timeLeft || 0) : "Challenge Ended 🎉" + }
{/* Status Bar */}
- You earned 50 today and are ranked - out of 13868 users + You earned {myData?.account.points.toNumber()} today and are ranked {myRank} out of {leaderboard?.length} users
{/* Leaderboard Table */} @@ -90,17 +140,17 @@ export default async function Page({ params }: { params: { id: string } }) { - {leaderboard.slice(3).map((player, index) => ( - + {leaderboard?.slice(3).map((player, index) => ( + {index + 4} - {player.solAdd} + {player.account.user.toString()} - {player.views} + {player.account.points.toNumber()} diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index 59eb10c..96a69f5 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -10,10 +10,8 @@ import Preblink from "../blinkcard/Preblink"; export const dynamic = 'force-dynamic' export default function Component() { - const { accounts, getProgramAccount } = useDashhProgram(); -console.log("accounts",accounts); -console.log("object",getProgramAccount); - if (getProgramAccount.isLoading) { + const { accounts, getProgramAccount,paccounts } = useDashhProgram(); + if (getProgramAccount.isLoading) { return ; } if (!getProgramAccount.data?.value) { @@ -52,12 +50,14 @@ console.log("object",getProgramAccount); { accounts.data?.map((account) => { -console.log(account.publicKey); + const val = paccounts.data?.filter((paccount) =>{ + return new BN(paccount.account.id || 0).toNumber() ==new BN(account.account.id|| 0).toNumber()}); return ( <> + account={account.publicKey} + size = {val?.length?val?.length:0 }/> ) diff --git a/src/app/verifyClaim/page.tsx b/src/app/verifyClaim/page.tsx new file mode 100644 index 0000000..1af168a --- /dev/null +++ b/src/app/verifyClaim/page.tsx @@ -0,0 +1,257 @@ + +"use client"; +import { useSearchParams } from "next/navigation"; + +import React, { useEffect, useState } from "react"; +import QRCode from "react-qr-code"; +import { ReclaimProofRequest } from "@reclaimprotocol/js-sdk"; + +import Link from "next/link"; + +import { Instagram, Twitter } from "lucide-react"; + +import { useDashhProgram } from "@/components/dashh/dashh-data-access"; +import { useAnchorProvider } from "@/components/solana/solana-provider"; + +const APP_ID = "0x896b97E0915ae00C61D8bb88b9f6A76d273cfE76"; +const APP_SECRET = + "0xa24f2911de618188e78d5981f62a3bba7497bc87b1e1789bac933ec614ca11a8"; +const PROVIDER_ID = "d18dcace-d59b-4432-b77e-655b7248334d"; + +interface irysdata { + uid: string | null; + likes: number; + keyword: boolean; +} +export async function sendtoIrys(dataToSend: irysdata) { + try { + const response = await fetch("/api/upload-to-arweave", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(dataToSend), + }); + + if (!response.ok) { + throw new Error("Network response was not ok"); + } + + const data = await response.json(); + console.log(data); + } catch (error) { + console.log({ error }); + } +} + +function extractAfterFavoriteCount(input: string): string | null { + try { + // Attempt to parse the input as JSON + const parsed = JSON.parse(input); + // If favorite_count exists in the parsed object, return its value + return parsed?.extractedParameters?.favorite_count || null; + } catch { + // Fallback to regex if JSON parsing fails + const match = input.match(/"favorite_count":"(.*?)"/); + return match ? match[1] : null; + } +} +function containsKeyword(input: string, ...keywords: string[]): boolean { + // If no keywords are provided, return true + if (keywords.length === 0) { + return true; + } + + // Check if all keywords are present in the input string + return keywords.every((keyword) => { + const regex = new RegExp(keyword, "i"); + return regex.test(input); + }); +} + +export default function Page () { + + + // const { uid } = router; + // const uid = "AAAA"; + // console.log(uid); + const searchParams = useSearchParams(); + const uid = searchParams?.get("id"); + const title = searchParams?.get("title"); + console.log(uid); +const { accounts } = useDashhProgram(); +const myv = accounts.data?.find((account) => account.account.id.toNumber() === Number(uid)); + // const uid = "aa"; + // const title = "hello"; + const [res, setRes] = useState(""); + const [deploying, setDeploying] = useState(false); + const [qrState, setQrState] = useState< + "none" | "loading" | "failed" | "waiting" | "success" + >("none"); + + const [qrUrl, setQrUrl] = useState(""); + const {updateParticipant} = useDashhProgram(); + const provider = useAnchorProvider(); + + const verifyOnReclaim = async () => { + setQrState("loading"); + const reclaimProofRequest = await ReclaimProofRequest.init( + APP_ID, + APP_SECRET, + PROVIDER_ID + ); + const requestUrl = await reclaimProofRequest.getRequestUrl(); + if (requestUrl) { + setQrUrl(requestUrl); + setQrState("waiting"); + } + await reclaimProofRequest.startSession({ + onSuccess: (proofs) => { + console.log("Verification success", proofs); + const likes = extractAfterFavoriteCount(proofs.claimData.context); + const isKeyword = containsKeyword( + proofs.claimData.context, + "won", + "@superteamin" + ); + + console.log(likes); + if (likes && isKeyword) { + const points = Number(likes) * 10; + updateParticipant.mutateAsync({ + id: Number(uid), + user:provider.wallet.publicKey, + points: points, + }).then((result) => { + // Your logic here + setDeploying(true); + console.log("done", result); + }) + .catch((error) => { + console.error(error); + }); + // const dataToSend = { + // uid: uid, + // likes: Number(likes), + // keyword: isKeyword, + // }; + // sendtoIrys(dataToSend); + // setQrState("success"); + } else { + setQrState("success"); + } + + setQrState("success"); + setRes(proofs.claimData.context); + }, + // Called if there's an error during verification + onError: (error) => { + console.error("Verification failed", error); + }, + }); + }; + + return ( +
+ {/* Header */} +
+

+ {title || "Verification Page"} +

+

+ Secure your identity with futuristic verification. +

+
+ + {/* Buttons */} +
+ + + +
+ + {/* QR Code Section */} +
+ {qrState === "none" && ( +

+ No QR code to display yet. +

+ )} + {qrState === "loading" && ( +
+
+

Loading QR code...

+
+ )} + {qrState === "failed" && ( +
+

+ Verification failed. Ensure your tweet includes the required + keywords. +

+ +
+ )} + {qrState === "success" && !deploying && ( +
+

+ Success! You’ve successfully participated. +

+
+ Success Animation +
+
+ )} + {qrState === "waiting" && ( +
+
+ +
+
+
+

Waiting for Proofs...

+
+

+ Scan the QR code or click{" "} + + here + {" "} + to verify. +

+
+ )} +
+
+ ); +}; diff --git a/src/components/dashh/dashh-data-access.tsx b/src/components/dashh/dashh-data-access.tsx index cc1fbcb..1794f60 100644 --- a/src/components/dashh/dashh-data-access.tsx +++ b/src/components/dashh/dashh-data-access.tsx @@ -34,13 +34,17 @@ export function useDashhProgram() { const connection = new Connection(clusterApiUrl("devnet"), "confirmed"); const transactionToast = useTransactionToast() const provider = useAnchorProvider() - const programId = "5PrtiiJ1m6NmepQ7XD2ZmPKSw8o8RGVnFUuMUXLPcjfP" + const programId = "Gdh4Jq1DY5t47vVVVGeK2Zx3EyeDm9L923bRfSWQ2aDJ" const program = getDashhProgram(provider) - - const accounts = useQuery({ + + const accounts = useQuery({ queryKey: ['dashh', 'all', 'devnet'], queryFn: () => program.account.campaign.all(), }) + const paccounts = useQuery({ + queryKey: ['dashh-p', 'all', 'devnet'], + queryFn: () => program.account.participent.all(), + }) const getProgramAccount = useQuery({ queryKey: ['get-program-account', 'devnet'], @@ -55,16 +59,7 @@ export function useDashhProgram() { const rewardAsU64 = new anchor.BN(reward); try { - // Connect to Phantom wallet - // const { solana }: any = window; - // if (!solana || !solana.isPhantom) { - // console.log("Phantom wallet not found"); - - // } - - // const response = await solana.connect(); - // const signer = new PublicKey(response.publicKey.toString()); - + return program.methods .createCampaign(id, title, description, image, lable, endtimeAsU64, rewardAsU64) @@ -89,7 +84,7 @@ export function useDashhProgram() { mutationKey:['create-Participant',`create`,'devnet'], mutationFn: async ({id,user}) => { return program.methods.createParticipent( - new anchor.BN( id), + new anchor.BN( id,16), user ).rpc(); }, @@ -102,7 +97,25 @@ export function useDashhProgram() { toast.error(`Error creating campaign: ${error}`) } }) - + const updateParticipant = useMutation({ + mutationKey:['update-Participant',`update`,'devnet'], + mutationFn: async ({id,user,points}) => { + return program.methods.updatedParticipent( + new anchor.BN( id), + user, +new anchor.BN (points) + ).rpc(); + }, + onSuccess: (Signature) => { + transactionToast(Signature); + toast.success('points update successfully') + accounts.refetch() + }, + onError: (error) => { + toast.error(`Error creating campaign: ${error}`) + } + + }) return { program, @@ -111,10 +124,24 @@ export function useDashhProgram() { getProgramAccount, createCampaign, createParticipant, - + updateParticipant, + paccounts } } +// export function getParicipatedData({id}:{id:number}){ +// const { program } = useDashhProgram() +// const connection = new Connection(clusterApiUrl("devnet"), "confirmed"); +// const provider = useAnchorProvider() +// const account = useQuery({ +// queryKey: ['dashh', 'fetch', { cluster:'devnet', account: id }], +// queryFn: () => program.account.participent.all(), +// }) +// return { +// account +// } +// } + export function useDashhProgramAccount({ account }: { account: PublicKey }) { // const { cluster } = useCluster() const transactionToast = useTransactionToast() @@ -124,6 +151,7 @@ export function useDashhProgramAccount({ account }: { account: PublicKey }) { queryKey: ['dashh', 'fetch', { cluster:'devnet', account: account.toBase58() }], queryFn: () => program.account.campaign.fetch(account), }) + const updateParticipant = useMutation({ @@ -148,7 +176,7 @@ new anchor.BN (points) return { accountQuery, - updateParticipant - + updateParticipant, + } } diff --git a/src/components/header.tsx b/src/components/header.tsx index 1096d54..0be9de4 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -14,11 +14,11 @@ const Header = () => { const [selectedOption, setSelectedOption] = useState(''); const router = useRouter() const provider = useAnchorProvider() - useEffect(() => { - if (!provider.wallet.publicKey) { - router.push('/') - } - },[]) + // useEffect(() => { + // if (!provider.wallet.publicKey) { + // router.push('/') + // } + // },[]) const handleToggle = (selected: string) => { setSelectedOption(selected); }; From 9dfd7fff555e9fedb62f2491df6a7e7b963862f6 Mon Sep 17 00:00:00 2001 From: Singupalli Kartik Date: Mon, 2 Dec 2024 07:31:04 +0530 Subject: [PATCH 04/13] refactor: clean up code formatting and remove unused files --- .eslintrc.json | 2 +- README.md | 14 +- anchor/migrations/deploy.ts | 5 +- anchor/src/dashh-exports.ts | 24 +- anchor/src/index.ts | 2 +- anchor/target/idl/dashh.json | 57 +-- anchor/target/types/dashh.ts | 345 ++++++++---------- anchor/tests/dashh.spec.ts | 147 ++++---- components.json | 2 +- global.d.ts | 4 +- next.config.mjs | 56 +-- src/app/account/[address]/page.tsx | 4 +- src/app/account/page.tsx | 4 +- src/app/actions.json/route.ts | 13 +- src/app/api/donate/[id]/route.ts | 260 ++++++------- src/app/api/donate/route.ts | 9 +- src/app/api/generate/campaigns/route.ts | 69 ++-- src/app/api/generate/route.ts | 4 +- src/app/api/posts/route.ts | 90 ++--- src/app/api/reclaim/[id]/route.ts | 73 ++-- src/app/api/redirect/[id]/route.ts | 71 ++-- src/app/api/redirect/route.ts | 6 +- src/app/api/upload-to-arweave/route.ts | 23 +- src/app/blinkcard/Preblink.tsx | 96 ++--- src/app/blinkcard/SolanaBlinksCard.tsx | 177 ++++----- src/app/clusters/page.tsx | 4 +- src/app/connectPhantomWallet/connectbtn.tsx | 1 - src/app/creatordashboard/creatorpage.tsx | 55 ++- src/app/creatordashboard/loading.tsx | 12 +- src/app/creatordashboard/page.tsx | 16 +- src/app/creatorlogin/page.tsx | 13 +- src/app/dashboard/[id]/getsoladd.tsx | 68 ++-- src/app/dashboard/[id]/page.tsx | 208 +++++++---- src/app/dashboard/creatorpage.tsx | 106 ------ src/app/dashboard/loading.tsx | 12 +- src/app/dashboard/page.tsx | 105 +++--- src/app/dashh/page.tsx | 4 +- src/app/form/loading.tsx | 12 +- src/app/form/page.tsx | 43 +-- src/app/layout.tsx | 52 ++- src/app/middleware.ts | 2 +- src/app/not-found.tsx | 8 +- src/app/page.tsx | 28 +- src/app/react-query-provider.tsx | 12 +- src/app/trial/key.json | 13 +- src/app/verifyClaim/[uid]/page.tsx | 191 ---------- src/app/verifyClaim/[uid]/samplepage.tsx | 79 ---- src/app/verifyClaim/page.tsx | 133 ++++--- src/app/verifyClaim/text.cpp | 1 - src/components/APISection2.tsx | 43 ++- src/components/Globe.tsx | 26 +- .../account/account-data-access.tsx | 145 ++++---- .../account/account-detail-feature.tsx | 38 +- .../account/account-list-feature.tsx | 14 +- src/components/account/account-ui.tsx | 240 ++++++++---- .../cluster/cluster-data-access.tsx | 125 ++++--- src/components/cluster/cluster-feature.tsx | 29 +- src/components/cluster/cluster-ui.tsx | 114 +++--- src/components/creator-login.tsx | 66 ++-- src/components/custom-toggle.tsx | 48 +-- .../dashboard/dashboard-feature.tsx | 28 +- src/components/dashh/dashh-data-access.tsx | 213 +++++------ src/components/dashh/dashh-feature.tsx | 25 +- src/components/demo2.tsx | 5 +- .../dynamic-full-screen-leaderboard.tsx | 91 +++-- src/components/footer.tsx | 82 ++++- .../fully-black-theme-dashboard.tsx | 2 +- src/components/header.tsx | 114 +++--- src/components/hero2.tsx | 43 ++- src/components/loading.tsx | 7 +- src/components/magicui/ShiningText.tsx | 2 +- src/components/product-form.tsx | 118 +++--- src/components/solana/solana-provider.tsx | 43 ++- src/components/tilt-card2.tsx | 77 ++-- src/components/ui/badge.tsx | 19 +- src/components/ui/button.tsx | 32 +- src/components/ui/card.tsx | 41 ++- src/components/ui/dialog.tsx | 54 +-- src/components/ui/input.tsx | 16 +- src/components/ui/label.tsx | 20 +- src/components/ui/table.tsx | 49 +-- src/components/ui/textarea.tsx | 16 +- src/components/ui/ui-layout.tsx | 115 +++--- src/lib/dbconnect.ts | 31 +- src/lib/interface/creater.ts | 46 ++- src/lib/interface/user.ts | 19 +- src/lib/models/creater.ts | 11 +- src/lib/models/user.ts | 14 +- src/lib/utils.ts | 6 +- tailwind.config.ts | 55 +-- 90 files changed, 2544 insertions(+), 2473 deletions(-) delete mode 100644 src/app/dashboard/creatorpage.tsx delete mode 100644 src/app/verifyClaim/[uid]/page.tsx delete mode 100644 src/app/verifyClaim/[uid]/samplepage.tsx delete mode 100644 src/app/verifyClaim/text.cpp diff --git a/.eslintrc.json b/.eslintrc.json index 3ad3ce4..30fcc75 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,7 +3,7 @@ "rules": { "no-console": "warn", "no-unused-vars": "warn", - "react-hooks/rules-of-hooks":"off", + "react-hooks/rules-of-hooks": "off", "@next/next/no-assign-module-variable": "off", // Disable the specific warning "react/no-unescaped-entities": "off", "@next/next/no-page-custom-font": "off", diff --git a/README.md b/README.md index e1d3bfb..ff51ea1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ - # DASHH - Decentralized Engagement Platform -DASHH is the new ad platform focused on helping brands reach the masses through micro-influencers. +DASHH is the new ad platform focused on helping brands reach the masses through micro-influencers. Check out here: https://blinks.knowflow.study/ @@ -28,7 +27,6 @@ Check out here: https://blinks.knowflow.study/ ➤ Targeting **micro-influencers** to amplify brand reach directly. ➤ Scalable, trust-based platform—**no middlemen, just results**. - --- ## 🚀 Getting Started @@ -52,20 +50,23 @@ bun dev ## 📈 How DASHH Works ### 1. **Campaign Creation** + Brands set up campaigns, allocate a budget, and share them through Solana Actions using Reclaim Protocol for Instagram verification and zkTLS proof to ensure privacy and security. ### 2. **User Participation** + Influencers connect their wallets, verify their Instagram account via Reclaim, and participate by posting stories that will generate real engagement. ### 3. **Engagement Proof** + Reclaim Protocol collects engagement data (e.g., Instagram views) and generates zkTLS proofs, ensuring that the engagement is real and verified. ### 4. **Payment Distribution** + Once engagement is verified, payments are processed through a secure escrow programs on Solana, ensuring influencers are rewarded fairly and without delay. --- - ## 📊 Execution Flow 1. **Campaign Setup** → **Reclaim Verification** → **Solana Action (Blink URL)** @@ -86,22 +87,27 @@ Once engagement is verified, payments are processed through a secure escrow prog ## What we are doing: Decentralized Marketing with DASHH ### 1. **No Middlemen, Direct Payments** + - Brands bid on Instagram engagement through Solana Blinks. - Payments are made directly to influencers via smart contracts, eliminating intermediary fees. ### 2. **Real-Time Transparency** + - Track every view, like, and interaction on-chain. - Solana's high throughput ensures real-time campaign performance updates without bottlenecks. ### 3. **Program Automation** + - Automatic payments based on pre-defined metrics (e.g., 10,000 views). - Solana’s fast block finality ensures instant payouts upon reaching campaign goals. ### 4. **Fraud Reduction with Verified Engagement** + - Authentic engagement guaranteed using Reclaim Protocol's zkTLS proofs. - Protects against bot-driven ad fraud, ensuring real interactions. ## 🔗 Powered by Solana + - **Low Fees**: Microtransactions with minimal cost. - **High Speed**: Real-time updates and payments without delays. - **Scalable**: Supports large-scale campaigns effortlessly. diff --git a/anchor/migrations/deploy.ts b/anchor/migrations/deploy.ts index e914965..41e4f39 100644 --- a/anchor/migrations/deploy.ts +++ b/anchor/migrations/deploy.ts @@ -1,9 +1,8 @@ // Migrations are an early feature. Currently, they're nothing more than this // single deploy script that's invoked from the CLI, injecting a provider // configured from the workspace's Anchor.toml. - -const anchor = require("@coral-xyz/anchor"); -import { AnchorProvider } from '@coral-xyz/anchor' +import anchor from '@coral-xyz/anchor'; +import { AnchorProvider } from "@coral-xyz/anchor"; module.exports = async function (provider: AnchorProvider) { // Configure client to use the provider. diff --git a/anchor/src/dashh-exports.ts b/anchor/src/dashh-exports.ts index 267d2df..b9b787c 100644 --- a/anchor/src/dashh-exports.ts +++ b/anchor/src/dashh-exports.ts @@ -1,29 +1,29 @@ // Here we export some useful types and functions for interacting with the Anchor program. -import { AnchorProvider, Program } from '@coral-xyz/anchor' -import { Cluster, PublicKey } from '@solana/web3.js' -import DashhIDL from '../target/idl/dashh.json' -import type { Dashh } from '../target/types/dashh' +import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { Cluster, PublicKey } from "@solana/web3.js"; +import DashhIDL from "../target/idl/dashh.json"; +import type { Dashh } from "../target/types/dashh"; // Re-export the generated IDL and type -export { Dashh, DashhIDL } +export { Dashh, DashhIDL }; // The programId is imported from the program IDL. -export const DASHH_PROGRAM_ID = new PublicKey(DashhIDL.address) +export const DASHH_PROGRAM_ID = new PublicKey(DashhIDL.address); // This is a helper function to get the Dashh Anchor program. export function getDashhProgram(provider: AnchorProvider) { - return new Program(DashhIDL as Dashh, provider) + return new Program(DashhIDL as Dashh, provider); } // This is a helper function to get the program ID for the Dashh program depending on the cluster. export function getDashhProgramId(cluster: Cluster) { switch (cluster) { - case 'devnet': - case 'testnet': + case "devnet": + case "testnet": // This is the program ID for the Dashh program on devnet and testnet. - return new PublicKey('7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr') - case 'mainnet-beta': + return new PublicKey("7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr"); + case "mainnet-beta": default: - return DASHH_PROGRAM_ID + return DASHH_PROGRAM_ID; } } diff --git a/anchor/src/index.ts b/anchor/src/index.ts index 449a000..cb4dd3b 100644 --- a/anchor/src/index.ts +++ b/anchor/src/index.ts @@ -1,3 +1,3 @@ // This file was generated by preset-anchor. Programs are exported from this file. -export * from './dashh-exports' +export * from "./dashh-exports"; diff --git a/anchor/target/idl/dashh.json b/anchor/target/idl/dashh.json index 6724de6..a934994 100644 --- a/anchor/target/idl/dashh.json +++ b/anchor/target/idl/dashh.json @@ -9,16 +9,7 @@ "instructions": [ { "name": "create_campaign", - "discriminator": [ - 111, - 131, - 187, - 98, - 160, - 193, - 114, - 244 - ], + "discriminator": [111, 131, 187, 98, 160, 193, 114, 244], "accounts": [ { "name": "signer", @@ -75,16 +66,7 @@ }, { "name": "create_participent", - "discriminator": [ - 71, - 8, - 24, - 190, - 154, - 238, - 185, - 114 - ], + "discriminator": [71, 8, 24, 190, 154, 238, 185, 114], "accounts": [ { "name": "signer", @@ -125,16 +107,7 @@ }, { "name": "updated_participent", - "discriminator": [ - 53, - 236, - 20, - 147, - 92, - 1, - 150, - 117 - ], + "discriminator": [53, 236, 20, 147, 92, 1, 150, 117], "accounts": [ { "name": "signer", @@ -181,29 +154,11 @@ "accounts": [ { "name": "Campaign", - "discriminator": [ - 50, - 40, - 49, - 11, - 157, - 220, - 229, - 192 - ] + "discriminator": [50, 40, 49, 11, 157, 220, 229, 192] }, { "name": "Participent", - "discriminator": [ - 44, - 209, - 38, - 30, - 148, - 88, - 55, - 251 - ] + "discriminator": [44, 209, 38, 30, 148, 88, 55, 251] } ], "types": [ @@ -268,4 +223,4 @@ } } ] -} \ No newline at end of file +} diff --git a/anchor/target/types/dashh.ts b/anchor/target/types/dashh.ts index d1d922a..4827eab 100644 --- a/anchor/target/types/dashh.ts +++ b/anchor/target/types/dashh.ts @@ -5,273 +5,228 @@ * IDL can be found at `target/idl/dashh.json`. */ export type Dashh = { - "address": "7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr", - "metadata": { - "name": "dashh", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ + address: "7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr"; + metadata: { + name: "dashh"; + version: "0.1.0"; + spec: "0.1.0"; + description: "Created with Anchor"; + }; + instructions: [ { - "name": "createCampaign", - "discriminator": [ - 111, - 131, - 187, - 98, - 160, - 193, - 114, - 244 - ], - "accounts": [ + name: "createCampaign"; + discriminator: [111, 131, 187, 98, 160, 193, 114, 244]; + accounts: [ { - "name": "signer", - "writable": true, - "signer": true + name: "signer"; + writable: true; + signer: true; }, { - "name": "campaign", - "writable": true, - "pda": { - "seeds": [ + name: "campaign"; + writable: true; + pda: { + seeds: [ { - "kind": "arg", - "path": "campaignid" - } - ] - } + kind: "arg"; + path: "campaignid"; + }, + ]; + }; }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + ]; + args: [ { - "name": "campaignid", - "type": "u64" + name: "campaignid"; + type: "u64"; }, { - "name": "title", - "type": "string" + name: "title"; + type: "string"; }, { - "name": "image", - "type": "string" + name: "image"; + type: "string"; }, { - "name": "description", - "type": "string" + name: "description"; + type: "string"; }, { - "name": "lable", - "type": "string" + name: "lable"; + type: "string"; }, { - "name": "endtime", - "type": "u64" + name: "endtime"; + type: "u64"; }, { - "name": "reward", - "type": "u64" - } - ] + name: "reward"; + type: "u64"; + }, + ]; }, { - "name": "createParticipent", - "discriminator": [ - 71, - 8, - 24, - 190, - 154, - 238, - 185, - 114 - ], - "accounts": [ + name: "createParticipent"; + discriminator: [71, 8, 24, 190, 154, 238, 185, 114]; + accounts: [ { - "name": "signer", - "writable": true, - "signer": true + name: "signer"; + writable: true; + signer: true; }, { - "name": "participent", - "writable": true, - "pda": { - "seeds": [ + name: "participent"; + writable: true; + pda: { + seeds: [ { - "kind": "arg", - "path": "campaignid" + kind: "arg"; + path: "campaignid"; }, { - "kind": "arg", - "path": "useraccount" - } - ] - } + kind: "arg"; + path: "useraccount"; + }, + ]; + }; }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + ]; + args: [ { - "name": "campaignid", - "type": "u64" + name: "campaignid"; + type: "u64"; }, { - "name": "useraccount", - "type": "pubkey" - } - ] + name: "useraccount"; + type: "pubkey"; + }, + ]; }, { - "name": "updatedParticipent", - "discriminator": [ - 53, - 236, - 20, - 147, - 92, - 1, - 150, - 117 - ], - "accounts": [ + name: "updatedParticipent"; + discriminator: [53, 236, 20, 147, 92, 1, 150, 117]; + accounts: [ { - "name": "signer", - "writable": true, - "signer": true + name: "signer"; + writable: true; + signer: true; }, { - "name": "participent", - "writable": true, - "pda": { - "seeds": [ + name: "participent"; + writable: true; + pda: { + seeds: [ { - "kind": "arg", - "path": "campaignid" + kind: "arg"; + path: "campaignid"; }, { - "kind": "arg", - "path": "useraccount" - } - ] - } + kind: "arg"; + path: "useraccount"; + }, + ]; + }; }, { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [ + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + ]; + args: [ { - "name": "campaignid", - "type": "u64" + name: "campaignid"; + type: "u64"; }, { - "name": "useraccount", - "type": "pubkey" + name: "useraccount"; + type: "pubkey"; }, { - "name": "points", - "type": "u64" - } - ] - } - ], - "accounts": [ + name: "points"; + type: "u64"; + }, + ]; + }, + ]; + accounts: [ { - "name": "campaign", - "discriminator": [ - 50, - 40, - 49, - 11, - 157, - 220, - 229, - 192 - ] + name: "campaign"; + discriminator: [50, 40, 49, 11, 157, 220, 229, 192]; }, { - "name": "participent", - "discriminator": [ - 44, - 209, - 38, - 30, - 148, - 88, - 55, - 251 - ] - } - ], - "types": [ + name: "participent"; + discriminator: [44, 209, 38, 30, 148, 88, 55, 251]; + }, + ]; + types: [ { - "name": "campaign", - "type": { - "kind": "struct", - "fields": [ + name: "campaign"; + type: { + kind: "struct"; + fields: [ { - "name": "id", - "type": "u64" + name: "id"; + type: "u64"; }, { - "name": "title", - "type": "string" + name: "title"; + type: "string"; }, { - "name": "image", - "type": "string" + name: "image"; + type: "string"; }, { - "name": "description", - "type": "string" + name: "description"; + type: "string"; }, { - "name": "lable", - "type": "string" + name: "lable"; + type: "string"; }, { - "name": "endtime", - "type": "u64" + name: "endtime"; + type: "u64"; }, { - "name": "reward", - "type": "u64" + name: "reward"; + type: "u64"; }, { - "name": "owner", - "type": "pubkey" - } - ] - } + name: "owner"; + type: "pubkey"; + }, + ]; + }; }, { - "name": "participent", - "type": { - "kind": "struct", - "fields": [ + name: "participent"; + type: { + kind: "struct"; + fields: [ { - "name": "id", - "type": "u64" + name: "id"; + type: "u64"; }, { - "name": "user", - "type": "pubkey" + name: "user"; + type: "pubkey"; }, { - "name": "points", - "type": "u64" - } - ] - } - } - ] + name: "points"; + type: "u64"; + }, + ]; + }; + }, + ]; }; diff --git a/anchor/tests/dashh.spec.ts b/anchor/tests/dashh.spec.ts index 42029a6..589ab88 100644 --- a/anchor/tests/dashh.spec.ts +++ b/anchor/tests/dashh.spec.ts @@ -1,13 +1,16 @@ -import * as anchor from '@coral-xyz/anchor' -import {Program} from '@coral-xyz/anchor' -import {Keypair, PublicKey} from '@solana/web3.js' -import {Dashh} from '../target/types/dashh' -import { BankrunProvider, startAnchor } from 'anchor-bankrun' -import { randomUUID } from 'crypto' -const IDL = require('../target/idl/dashh.json') -const campaign_address = new PublicKey("7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr") +import * as anchor from "@coral-xyz/anchor"; +import { Program } from "@coral-xyz/anchor"; +import { Keypair, PublicKey } from "@solana/web3.js"; +import { Dashh } from "../target/types/dashh"; +import { BankrunProvider, startAnchor } from "anchor-bankrun"; +import { randomUUID } from "crypto"; +import IDL from '../target/idl/dashh.json'; -describe('dashh', () => { +const campaign_address = new PublicKey( + "7qpRXNFY5PJQfwptK4BosJ5jCnVeEYRWATFu8BBDTVcr", +); + +describe("dashh", () => { // Configure the client to use the local cluster. // const provider = anchor.AnchorProvider.env() // anchor.setProvider(provider) @@ -15,82 +18,88 @@ describe('dashh', () => { // const program = anchor.workspace.Dashh as Program - const dashhKeypair = Keypair.generate() + const dashhKeypair = Keypair.generate(); let context; -let provider; -let dashhProgram: Program; + let provider; + let dashhProgram: Program; beforeAll(async () => { - context = await startAnchor("", [{ - name: "dashh", - programId: campaign_address, - }], []); - provider = new BankrunProvider(context); - dashhProgram = new Program(IDL, provider); + context = await startAnchor( + "", + [ + { + name: "dashh", + programId: campaign_address, + }, + ], + [], + ); + provider = new BankrunProvider(context); + dashhProgram = new Program(IDL, provider); + }); -}); + const id = new anchor.BN(randomUUID().split("-").join("").slice(0, 8), 16); + it("Initialize campaign", async () => { + await dashhProgram.methods + .createCampaign( + id, + "Test knowflow", + "https://images.unsplash.com/photo-1719937206667-ac87c15ad3e9?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + "this is only for testing in and out", + "0x0", + new anchor.BN(1832639258), + new anchor.BN(1000), + ) + .rpc(); + const [campaignAddress] = PublicKey.findProgramAddressSync( + [id.toArrayLike(Buffer, "le", 8)], + campaign_address, + ); -const id = new anchor.BN(randomUUID().split("-").join("").slice(0, 8), 16); -it('Initialize campaign', async () => { -await dashhProgram.methods.createCampaign( - id, - "Test knowflow", - "https://images.unsplash.com/photo-1719937206667-ac87c15ad3e9?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", - "this is only for testing in and out", -"0x0", -new anchor.BN(1832639258), -new anchor.BN(1000), -).rpc(); + const campaign = await dashhProgram.account.campaign.fetch(campaignAddress); + console.log("campaign", campaign); -const [campaignAddress]=PublicKey.findProgramAddressSync([id.toArrayLike(Buffer, 'le', 8)],campaign_address); + // expect(campaign.campaignId.toNumber()).toEqual(1); + // expect(campaign.description).toEqual("What is your favorite color?"); + // expect(campaign.campaignSatrt.toNumber()).toBeLessThan(campaign.campaignEnd.toNumber()) + }); -const campaign = await dashhProgram.account.campaign.fetch(campaignAddress); -console.log("campaign", campaign); + it("participate in campaign", async () => { + await dashhProgram.methods + .createParticipent(id, dashhKeypair.publicKey) + .rpc(); -// expect(campaign.campaignId.toNumber()).toEqual(1); -// expect(campaign.description).toEqual("What is your favorite color?"); -// expect(campaign.campaignSatrt.toNumber()).toBeLessThan(campaign.campaignEnd.toNumber()) + const [participantAddress] = PublicKey.findProgramAddressSync( + [id.toArrayLike(Buffer, "le", 8), dashhKeypair.publicKey.toBuffer()], + campaign_address, + ); -}) + const participant = + await dashhProgram.account.participent.fetch(participantAddress); + console.log("participant", participant); + // expect(campaign.campaignId.toNumber()).toEqual(1); + // expect(campaign.description).toEqual("What is your favorite color?"); + // expect(campaign.campaignSatrt.toNumber()).toBeLessThan(campaign.campaignEnd.toNumber()) + }); + it("updates in participant", async () => { + await dashhProgram.methods + .updatedParticipent(id, dashhKeypair.publicKey, new anchor.BN(100)) + .rpc(); -it('participate in campaign', async () => { - - await dashhProgram.methods.createParticipent( - id, - dashhKeypair.publicKey, - ).rpc(); - - const [participantAddress]=PublicKey.findProgramAddressSync([id.toArrayLike(Buffer, 'le', 8),dashhKeypair.publicKey.toBuffer()],campaign_address); - - const participant = await dashhProgram.account.participent.fetch(participantAddress); - console.log("participant", participant); - - // expect(campaign.campaignId.toNumber()).toEqual(1); - // expect(campaign.description).toEqual("What is your favorite color?"); - // expect(campaign.campaignSatrt.toNumber()).toBeLessThan(campaign.campaignEnd.toNumber()) - - }) + const [participantAddress] = PublicKey.findProgramAddressSync( + [id.toArrayLike(Buffer, "le", 8), dashhKeypair.publicKey.toBuffer()], + campaign_address, + ); - it('updates in participant', async () => { - await dashhProgram.methods.updatedParticipent( - id, - dashhKeypair.publicKey, - new anchor.BN(100), - ).rpc(); - - const [participantAddress]=PublicKey.findProgramAddressSync([id.toArrayLike(Buffer, 'le', 8),dashhKeypair.publicKey.toBuffer()],campaign_address); - - const participant = await dashhProgram.account.participent.fetch(participantAddress); + const participant = + await dashhProgram.account.participent.fetch(participantAddress); console.log("participant", participant); console.log("points", participant.points.toNumber()); expect(participant.points.toNumber()).toEqual(100); // expect(campaign.campaignId.toNumber()).toEqual(1); // expect(campaign.description).toEqual("What is your favorite color?"); // expect(campaign.campaignSatrt.toNumber()).toBeLessThan(campaign.campaignEnd.toNumber()) - - }) - - -}) + }); +}); diff --git a/components.json b/components.json index 17dc8d7..c4cf640 100644 --- a/components.json +++ b/components.json @@ -17,4 +17,4 @@ "lib": "@/lib", "hooks": "@/hooks" } -} \ No newline at end of file +} diff --git a/global.d.ts b/global.d.ts index 8e044c7..044166f 100644 --- a/global.d.ts +++ b/global.d.ts @@ -1,11 +1,11 @@ // global.d.ts interface Solana { isPhantom: boolean; - isMobile?: boolean; + isMobile?: boolean; isConnected?: boolean; // Add this line } interface Window { solana?: Solana; isConnected?: boolean; -} \ No newline at end of file +} diff --git a/next.config.mjs b/next.config.mjs index 2ea3464..6a44fc4 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,29 +1,33 @@ /** @type {import('next').NextConfig} */ -const nextConfig = -{ - async headers() { - return [ - { - source: '/api/:path*', - headers: [ - { key: "Access-Control-Allow-Credentials", value: "true" }, - { key: "Access-Control-Allow-Origin", value: "*" }, // replace this with your actual origin - { key: "Access-Control-Allow-Methods", value: "GET, DELETE, PATCH, POST, PUT" }, - { key: "Access-Control-Allow-Headers", value: "X-CSRF-Token, X-Requested-With, Content-Length, Content-MD5, X-Api-Version" } - ] - } - ] - }, - images: { - remotePatterns: [ - { - protocol: "https", - hostname: "**", - }, - - ], - }, - -} +const nextConfig = { + async headers() { + return [ + { + source: "/api/:path*", + headers: [ + { key: "Access-Control-Allow-Credentials", value: "true" }, + { key: "Access-Control-Allow-Origin", value: "*" }, // replace this with your actual origin + { + key: "Access-Control-Allow-Methods", + value: "GET, DELETE, PATCH, POST, PUT", + }, + { + key: "Access-Control-Allow-Headers", + value: + "X-CSRF-Token, X-Requested-With, Content-Length, Content-MD5, X-Api-Version", + }, + ], + }, + ]; + }, + images: { + remotePatterns: [ + { + protocol: "https", + hostname: "**", + }, + ], + }, +}; export default nextConfig; diff --git a/src/app/account/[address]/page.tsx b/src/app/account/[address]/page.tsx index 5bb6688..0f46f88 100644 --- a/src/app/account/[address]/page.tsx +++ b/src/app/account/[address]/page.tsx @@ -1,5 +1,5 @@ -import AccountDetailFeature from '@/components/account/account-detail-feature' +import AccountDetailFeature from "@/components/account/account-detail-feature"; export default function Page() { - return + return ; } diff --git a/src/app/account/page.tsx b/src/app/account/page.tsx index 1b0e276..cf7d07d 100644 --- a/src/app/account/page.tsx +++ b/src/app/account/page.tsx @@ -1,5 +1,5 @@ -import AccountListFeature from '@/components/account/account-list-feature' +import AccountListFeature from "@/components/account/account-list-feature"; export default function Page() { - return + return ; } diff --git a/src/app/actions.json/route.ts b/src/app/actions.json/route.ts index 0fa6faf..f217e30 100644 --- a/src/app/actions.json/route.ts +++ b/src/app/actions.json/route.ts @@ -1,17 +1,14 @@ import { ACTIONS_CORS_HEADERS, ActionsJson } from "@solana/actions"; - export const GET = async () => { - const payload: ActionsJson = { rules: [ - // map all root level routes to an action { pathPattern: "/", apiPath: "/api/donate/", }, - { + { pathPattern: "/", apiPath: `/api/redirect/`, }, @@ -27,26 +24,22 @@ export const GET = async () => { // THIS WILL ENSURE CORS WORKS FOR BLINKS export const OPTIONS = GET; - export const POST = async () => { - const payload: ActionsJson = { - rules: [ // map all root level routes to an action { pathPattern: "/", apiPath: "/api/donate", }, - { + { pathPattern: "/", apiPath: `/api/redirect`, }, - ], }; return Response.json(payload, { headers: ACTIONS_CORS_HEADERS, }); -}; \ No newline at end of file +}; diff --git a/src/app/api/donate/[id]/route.ts b/src/app/api/donate/[id]/route.ts index 167b75e..c20f05e 100644 --- a/src/app/api/donate/[id]/route.ts +++ b/src/app/api/donate/[id]/route.ts @@ -1,37 +1,53 @@ -import {useDashhProgramAccount} from "@/components/dashh/dashh-data-access"; +import { useDashhProgramAccount } from "@/components/dashh/dashh-data-access"; import Creator from "@/lib/models/creater"; import User from "@/lib/models/user"; -import { ActionGetResponse, ActionPostRequest, ActionPostResponse, ACTIONS_CORS_HEADERS } from "@solana/actions"; -import { clusterApiUrl, Connection, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; - -export async function GET(request:Request ,params:{params:{id:string} }){ - const url = new URL(request.url); - const id = await params.params.id; - console.log(id); - - const { accountQuery } = useDashhProgramAccount({ - account:new PublicKey(id as string), - }); - console.log("account query ",accountQuery); - -const creator = { - icons: accountQuery.data?.image , - title : accountQuery.data?.title, - description : accountQuery.data?.description, - label : accountQuery.data?.lable, -}; - - - - const payload:ActionGetResponse = { - icon: creator.icons? creator.icons : "https://cdn.vectorstock.com/i/500p/04/45/solana-logo-coin-icon-isolated-vector-43670445.jpg", +import { + ActionGetResponse, + ActionPostRequest, + ActionPostResponse, + ACTIONS_CORS_HEADERS, +} from "@solana/actions"; +import { + clusterApiUrl, + Connection, + LAMPORTS_PER_SOL, + PublicKey, + SystemProgram, + Transaction, +} from "@solana/web3.js"; + +export async function GET( + request: Request, + params: { params: { id: string } }, +) { + const url = new URL(request.url); + const id = await params.params.id; + console.log(id); + + const { accountQuery } = useDashhProgramAccount({ + account: new PublicKey(id as string), + }); + console.log("account query ", accountQuery); + + const creator = { + icons: accountQuery.data?.image, + title: accountQuery.data?.title, + description: accountQuery.data?.description, + label: accountQuery.data?.lable, + }; + + const payload: ActionGetResponse = { + icon: creator.icons + ? creator.icons + : "https://cdn.vectorstock.com/i/500p/04/45/solana-logo-coin-icon-isolated-vector-43670445.jpg", title: creator.title ? creator.title : "Donate to Solana", - description:creator.description ? creator.description : "Donate to the Solana Foundation to support the Solana ecosystem.", - label:creator.label ? creator.label : "Donate", + description: creator.description + ? creator.description + : "Donate to the Solana Foundation to support the Solana ecosystem.", + label: creator.label ? creator.label : "Donate", links: { - actions :[ - + actions: [ //{ // type:"transaction", // label:"Participate", @@ -44,24 +60,23 @@ const creator = { // } // ], // }, - { type:'external-link', - label:'See Leaderboard', - href:`${url.origin}/api/redirect/${id}`, - },{ - type:"external-link", - label:"Verify With Reclaim", - href:`${url.origin}/api/reclaim/${id}`, - - }, { - type:"transaction", - label:"Participate", - href:`${url.href}?amount=0`, - }, - - ] - } - - + { + type: "external-link", + label: "See Leaderboard", + href: `${url.origin}/api/redirect/${id}`, + }, + { + type: "external-link", + label: "Verify With Reclaim", + href: `${url.origin}/api/reclaim/${id}`, + }, + { + type: "transaction", + label: "Participate", + href: `${url.href}?amount=0`, + }, + ], + }, }; return Response.json(payload, { @@ -70,87 +85,88 @@ const creator = { } export const OPTIONS = GET; +export async function POST(request: Request) { + const body: ActionPostRequest = await request.json(); + const url = new URL(request.url); + const amount = Number(url.searchParams.get("amount")) || 0; -export async function POST(request:Request){ - const body: ActionPostRequest = await request.json(); - const url = new URL(request.url); -const amount = Number(url.searchParams.get("amount")) || 0; - - let sender ; + let sender; - try{ - sender = new PublicKey(body.account); + try { + sender = new PublicKey(body.account); -// const Post = await Creator.findById(url.pathname.split("/")[3]) -// imgurl=Post?.icons - - }catch(e){ - return Response.json({error:e},{status:400,headers:ACTIONS_CORS_HEADERS}); - } - - const connection = new Connection(clusterApiUrl("devnet"), "confirmed"); - // const payer = Keypair.generate(); // Replace with your payer Keypair - - const transaction = new Transaction().add( - SystemProgram.transfer({ - fromPubkey: sender, - toPubkey: new PublicKey("8vbaCLhg1SZmiGNZfFzV2DEJHenFtdgg7G2JtY5v74i1"), - lamports: amount * LAMPORTS_PER_SOL, - }) + // const Post = await Creator.findById(url.pathname.split("/")[3]) + // imgurl=Post?.icons + } catch (e) { + return Response.json( + { error: e }, + { status: 400, headers: ACTIONS_CORS_HEADERS }, ); + } + + const connection = new Connection(clusterApiUrl("devnet"), "confirmed"); + // const payer = Keypair.generate(); // Replace with your payer Keypair + + const transaction = new Transaction().add( + SystemProgram.transfer({ + fromPubkey: sender, + toPubkey: new PublicKey("8vbaCLhg1SZmiGNZfFzV2DEJHenFtdgg7G2JtY5v74i1"), + lamports: amount * LAMPORTS_PER_SOL, + }), + ); + + const blockheight = await connection.getLatestBlockhash(); + transaction.recentBlockhash = blockheight.blockhash; + transaction.lastValidBlockHeight = blockheight.lastValidBlockHeight; + transaction.feePayer = sender; + // transaction.sign(payer); + + const payload: ActionPostResponse = { + type: "transaction", + transaction: transaction + .serialize({ verifySignatures: false }) + .toString("base64"), + message: `Participation done successfully`, + + // links: { + // next: { + // type:"post", + // href: `${url.origin}/api/redirect/${url.pathname.split("/")[3]}`, + // }, + // } + }; + try { + const creater = await Creator.findById(url.pathname.split("/")[3]); + if (creater) { + creater.users.push(sender.toString()); + await creater.save(); + } + const newUser = new User({ + solAdd: sender.toString(), + post: url.href.toString(), + isAwarded: false, + }); - const blockheight = await connection.getLatestBlockhash(); - transaction.recentBlockhash = blockheight.blockhash; - transaction.lastValidBlockHeight = blockheight.lastValidBlockHeight; - transaction.feePayer = sender; - // transaction.sign(payer); - - const payload: ActionPostResponse = { - type: "transaction", - transaction: transaction.serialize({ verifySignatures: false }).toString("base64"), - message: `Participation done successfully`, - - // links: { - // next: { - // type:"post", - // href: `${url.origin}/api/redirect/${url.pathname.split("/")[3]}`, - // }, - // } - }; - try { - const creater = await Creator.findById(url.pathname.split("/")[3]); - if (creater) { - creater.users.push(sender.toString()); - await creater.save(); - } - const newUser = new User({ - solAdd: sender.toString(), - post: url.href.toString(), - isAwarded: false, - }); - - await newUser.save(); + await newUser.save(); // redirect("https://blinks.knowflow.study"); - return Response.json(payload,{ - headers : ACTIONS_CORS_HEADERS, - }); - - - } catch (error) { - return Response.json({error:error},{status:400,headers:ACTIONS_CORS_HEADERS}); - - } - + return Response.json(payload, { + headers: ACTIONS_CORS_HEADERS, + }); + } catch (error) { + return Response.json( + { error: error }, + { status: 400, headers: ACTIONS_CORS_HEADERS }, + ); + } - // // Redirect to a specific page after transaction creation - // const redirectUrl = new URL('/some-page', url.origin); - // redirectUrl.searchParams.set('transaction', payload.transaction); - // redirectUrl.searchParams.set('message', payload.message); + // // Redirect to a specific page after transaction creation + // const redirectUrl = new URL('/some-page', url.origin); + // redirectUrl.searchParams.set('transaction', payload.transaction); + // redirectUrl.searchParams.set('message', payload.message); - // return Response.redirect(redirectUrl.toString(), 302); - // return Response.json(payload, { - // headers: ACTIONS_CORS_HEADERS, - // }); - -} \ No newline at end of file + // return Response.redirect(redirectUrl.toString(), 302); + // return Response.json(payload, { + // headers: ACTIONS_CORS_HEADERS, + // }); +} diff --git a/src/app/api/donate/route.ts b/src/app/api/donate/route.ts index fe9431d..ce68efa 100644 --- a/src/app/api/donate/route.ts +++ b/src/app/api/donate/route.ts @@ -1,8 +1,7 @@ - -import { v4 as uuidv4 } from 'uuid'; // For generating random IDs +import { v4 as uuidv4 } from "uuid"; // For generating random IDs export async function GET(request: Request) { - const url = new URL(request.url); // Replace with your fixed ID + const url = new URL(request.url); // Replace with your fixed ID const redirectUrl = `${url.href}/${23}`; return Response.redirect(redirectUrl, 302); } @@ -10,10 +9,10 @@ export async function GET(request: Request) { export async function POST(request: Request) { const randomId = uuidv4(); // Generate a random ID const url = new URL(request.url); - const amount = url.searchParams.get('amount') || '0.2'; + const amount = url.searchParams.get("amount") || "0.2"; const redirectUrl = `/api/donate/${randomId}?amount=${amount}`; return Response.redirect(redirectUrl, 302); } -export const OPTIONS = GET; \ No newline at end of file +export const OPTIONS = GET; diff --git a/src/app/api/generate/campaigns/route.ts b/src/app/api/generate/campaigns/route.ts index 8526418..f1ce20f 100644 --- a/src/app/api/generate/campaigns/route.ts +++ b/src/app/api/generate/campaigns/route.ts @@ -1,45 +1,48 @@ -import { ActionPostRequest, ActionPostResponse, ACTIONS_CORS_HEADERS, createActionHeaders } from "@solana/actions"; +import { + ActionPostRequest, + ActionPostResponse, + ACTIONS_CORS_HEADERS, + createActionHeaders, +} from "@solana/actions"; const headers = createActionHeaders(); export async function GET(request: Request) { - const url = new URL(request.url); // Replace with your fixed ID + const url = new URL(request.url); // Replace with your fixed ID const redirectUrl = `${url.href}`; return Response.redirect(redirectUrl, 302); } export const OPTIONS = async () => Response.json(null, { headers }); -export async function POST(request:Request){ - const body:ActionPostRequest=await request.json(); +export async function POST(request: Request) { + const body: ActionPostRequest = await request.json(); - const payload:ActionPostResponse={ - type:"external-link", - externalLink:`https://blinks.knowflow.study/creatordashboard?id=${body.account}`, - message:"Redirected Creator Dashboard", - } - return Response.json(payload,{ - headers : ACTIONS_CORS_HEADERS, - }); + const payload: ActionPostResponse = { + type: "external-link", + externalLink: `https://blinks.knowflow.study/creatordashboard?id=${body.account}`, + message: "Redirected Creator Dashboard", + }; + return Response.json(payload, { + headers: ACTIONS_CORS_HEADERS, + }); + // const payloads: ActionPostResponse = { + // type: "external-link", + // externalLink: "https://www.google.com", + // message: "Transaction completed", + // links: { + // next: { + // type:"post", + // href: "https://blinks.knowflow.study/api/donate", + // }, + // } + // }; -// const payloads: ActionPostResponse = { -// type: "external-link", -// externalLink: "https://www.google.com", -// message: "Transaction completed", -// links: { -// next: { -// type:"post", -// href: "https://blinks.knowflow.study/api/donate", -// }, -// } -// }; + // // Redirect to a specific page after transaction creation + // const redirectUrl = new URL('/some-page', url.origin); + // redirectUrl.searchParams.set('transaction', payload.transaction); + // redirectUrl.searchParams.set('message', payload.message); - // // Redirect to a specific page after transaction creation - // const redirectUrl = new URL('/some-page', url.origin); - // redirectUrl.searchParams.set('transaction', payload.transaction); - // redirectUrl.searchParams.set('message', payload.message); - - // return Response.redirect(redirectUrl.toString(), 302); - return Response.json(payload, { - headers: ACTIONS_CORS_HEADERS, - }); - + // return Response.redirect(redirectUrl.toString(), 302); + return Response.json(payload, { + headers: ACTIONS_CORS_HEADERS, + }); } diff --git a/src/app/api/generate/route.ts b/src/app/api/generate/route.ts index 48d1e25..89bcd85 100644 --- a/src/app/api/generate/route.ts +++ b/src/app/api/generate/route.ts @@ -107,7 +107,7 @@ export async function POST(request: Request) { fromPubkey: sender, toPubkey: new PublicKey("8vbaCLhg1SZmiGNZfFzV2DEJHenFtdgg7G2JtY5v74i1"), lamports: amount * LAMPORTS_PER_SOL, - }) + }), ); const blockheight = await connection.getLatestBlockhash(); @@ -157,7 +157,7 @@ export async function POST(request: Request) { } catch (e) { return Response.json( { error: e }, - { status: 400, headers: ACTIONS_CORS_HEADERS } + { status: 400, headers: ACTIONS_CORS_HEADERS }, ); } diff --git a/src/app/api/posts/route.ts b/src/app/api/posts/route.ts index eb7052f..1821620 100644 --- a/src/app/api/posts/route.ts +++ b/src/app/api/posts/route.ts @@ -1,19 +1,18 @@ - // import { NextApiRequest, NextApiResponse } from 'next'; -import connectDB from '@/lib/dbconnect'; -import Creator from '@/lib/models/creater'; -import User from '@/lib/models/user'; +import connectDB from "@/lib/dbconnect"; +import Creator from "@/lib/models/creater"; +import User from "@/lib/models/user"; // import { ICreator } from '@/lib/interface/creater'; -import Cors from 'cors'; +import Cors from "cors"; // Initializing the cors middleware const cors = Cors({ - methods: ['GET', 'HEAD', 'PUT', 'POST', 'DELETE'], - origin: '*', // Replace '' with your frontend domain in production + methods: ["GET", "HEAD", "PUT", "POST", "DELETE"], + origin: "*", // Replace '' with your frontend domain in production }); // Helper method to wait for middleware to execute before continuing -function runMiddleware(req:Request, res:Response, fn: any) { +function runMiddleware(req: Request, res: Response, fn: any) { return new Promise((resolve, reject) => { fn(req, res, (result: any) => { if (result instanceof Error) { @@ -24,43 +23,52 @@ function runMiddleware(req:Request, res:Response, fn: any) { }); } +export const POST = async (req: Request) => { + await connectDB(); + try { + const data = await req.json(); - export const POST = async(req: Request)=> { -await connectDB(); - try { - const data = await req.json(); - - - const newPost = new Creator({ - solAdd: data.solAdd, - title: data.title, - description: data.description, - label: data.label, - amount: data.amount, - icons: data.icons, - end: data.end, - users: [], - }); + const newPost = new Creator({ + solAdd: data.solAdd, + title: data.title, + description: data.description, + label: data.label, + amount: data.amount, + icons: data.icons, + end: data.end, + users: [], + }); - await newPost.save(); + await newPost.save(); - return Response.json({ message: 'Post created successfully', data: newPost }); - } catch (error) { - return Response.json({ message: 'Internal Server Error', error }); - } -} + return Response.json({ + message: "Post created successfully", + data: newPost, + }); + } catch (error) { + return Response.json({ message: "Internal Server Error", error }); + } +}; -export const PUT = async(req: Request, res:Response)=> { - await connectDB(); - await runMiddleware(req, res, cors); - try { - const data = await req.json(); +export const PUT = async (req: Request, res: Response) => { + await connectDB(); + await runMiddleware(req, res, cors); + try { + const data = await req.json(); - const { id, igProfile, views } = data; + const { id, igProfile, views } = data; - const updatedPost = await User.findByIdAndUpdate(id, { igProfile, views }, { new: true }); + const updatedPost = await User.findByIdAndUpdate( + id, + { igProfile, views }, + { new: true }, + ); - return Response.json({ message: 'Post updated successfully', data: updatedPost }); } catch (error) { - return Response.json({ message: 'Internal Server Error', error }); - } -} \ No newline at end of file + return Response.json({ + message: "Post updated successfully", + data: updatedPost, + }); + } catch (error) { + return Response.json({ message: "Internal Server Error", error }); + } +}; diff --git a/src/app/api/reclaim/[id]/route.ts b/src/app/api/reclaim/[id]/route.ts index 0d6f50d..f1ec75b 100644 --- a/src/app/api/reclaim/[id]/route.ts +++ b/src/app/api/reclaim/[id]/route.ts @@ -1,46 +1,51 @@ -import { ActionPostRequest, ActionPostResponse, ACTIONS_CORS_HEADERS, createActionHeaders } from "@solana/actions"; +import { + ActionPostRequest, + ActionPostResponse, + ACTIONS_CORS_HEADERS, + createActionHeaders, +} from "@solana/actions"; const headers = createActionHeaders(); export async function GET(request: Request) { - const url = new URL(request.url); // Replace with your fixed ID + const url = new URL(request.url); // Replace with your fixed ID const redirectUrl = `${url.href}`; return Response.redirect(redirectUrl, 302); } export const OPTIONS = async () => Response.json(null, { headers }); -export async function POST(request:Request,params:{params:{id:string}}){ - const body:ActionPostRequest=await request.json(); +export async function POST( + request: Request, + params: { params: { id: string } }, +) { + const body: ActionPostRequest = await request.json(); + const payload: ActionPostResponse = { + type: "external-link", + externalLink: `https://blinks.knowflow.study/verifyClaim/?id=${params.params.id}&wallet=${body.account}`, + message: "Redirected to reaclaim verify", + }; + return Response.json(payload, { + headers: ACTIONS_CORS_HEADERS, + }); - const payload:ActionPostResponse={ - type:"external-link", - externalLink:`https://blinks.knowflow.study/verifyClaim/?id=${params.params.id}&wallet=${body.account}`, - message:"Redirected to reaclaim verify", - } - return Response.json(payload,{ - headers : ACTIONS_CORS_HEADERS, - }); + // const payloads: ActionPostResponse = { + // type: "external-link", + // externalLink: "https://www.google.com", + // message: "Transaction completed", + // links: { + // next: { + // type:"post", + // href: "https://blinks.knowflow.study/api/donate", + // }, + // } + // }; + // // Redirect to a specific page after transaction creation + // const redirectUrl = new URL('/some-page', url.origin); + // redirectUrl.searchParams.set('transaction', payload.transaction); + // redirectUrl.searchParams.set('message', payload.message); -// const payloads: ActionPostResponse = { -// type: "external-link", -// externalLink: "https://www.google.com", -// message: "Transaction completed", -// links: { -// next: { -// type:"post", -// href: "https://blinks.knowflow.study/api/donate", -// }, -// } -// }; - - // // Redirect to a specific page after transaction creation - // const redirectUrl = new URL('/some-page', url.origin); - // redirectUrl.searchParams.set('transaction', payload.transaction); - // redirectUrl.searchParams.set('message', payload.message); - - // return Response.redirect(redirectUrl.toString(), 302); - return Response.json(payload, { - headers: ACTIONS_CORS_HEADERS, - }); - + // return Response.redirect(redirectUrl.toString(), 302); + return Response.json(payload, { + headers: ACTIONS_CORS_HEADERS, + }); } diff --git a/src/app/api/redirect/[id]/route.ts b/src/app/api/redirect/[id]/route.ts index e03b1a4..6305b59 100644 --- a/src/app/api/redirect/[id]/route.ts +++ b/src/app/api/redirect/[id]/route.ts @@ -1,44 +1,49 @@ -import { ActionPostResponse, ACTIONS_CORS_HEADERS, createActionHeaders } from "@solana/actions"; +import { + ActionPostResponse, + ACTIONS_CORS_HEADERS, + createActionHeaders, +} from "@solana/actions"; const headers = createActionHeaders(); export async function GET(request: Request) { - const url = new URL(request.url); // Replace with your fixed ID + const url = new URL(request.url); // Replace with your fixed ID const redirectUrl = `${url.href}`; return Response.redirect(redirectUrl, 302); } export const OPTIONS = async () => Response.json(null, { headers }); -export async function POST(request:Request,params:{params:{id:string}}){ - const url = new URL(request.url); - const payload:ActionPostResponse={ - type:"external-link", - externalLink:`${url.origin}/dashboard/${params.params.id}`, - message:"Redirected to Leaderboard", - } - return Response.json(payload,{ - headers : ACTIONS_CORS_HEADERS, - }); +export async function POST( + request: Request, + params: { params: { id: string } }, +) { + const url = new URL(request.url); + const payload: ActionPostResponse = { + type: "external-link", + externalLink: `${url.origin}/dashboard/${params.params.id}`, + message: "Redirected to Leaderboard", + }; + return Response.json(payload, { + headers: ACTIONS_CORS_HEADERS, + }); + // const payloads: ActionPostResponse = { + // type: "external-link", + // externalLink: "https://www.google.com", + // message: "Transaction completed", + // links: { + // next: { + // type:"post", + // href: "https://blinks.knowflow.study/api/donate", + // }, + // } + // }; -// const payloads: ActionPostResponse = { -// type: "external-link", -// externalLink: "https://www.google.com", -// message: "Transaction completed", -// links: { -// next: { -// type:"post", -// href: "https://blinks.knowflow.study/api/donate", -// }, -// } -// }; + // // Redirect to a specific page after transaction creation + // const redirectUrl = new URL('/some-page', url.origin); + // redirectUrl.searchParams.set('transaction', payload.transaction); + // redirectUrl.searchParams.set('message', payload.message); - // // Redirect to a specific page after transaction creation - // const redirectUrl = new URL('/some-page', url.origin); - // redirectUrl.searchParams.set('transaction', payload.transaction); - // redirectUrl.searchParams.set('message', payload.message); - - // return Response.redirect(redirectUrl.toString(), 302); - return Response.json(payload, { - headers: ACTIONS_CORS_HEADERS, - }); - + // return Response.redirect(redirectUrl.toString(), 302); + return Response.json(payload, { + headers: ACTIONS_CORS_HEADERS, + }); } diff --git a/src/app/api/redirect/route.ts b/src/app/api/redirect/route.ts index e1a97ef..80070c7 100644 --- a/src/app/api/redirect/route.ts +++ b/src/app/api/redirect/route.ts @@ -1,5 +1,3 @@ - - export async function POST() { -return Response.redirect("https://blinks.knowflow.study/form"); -} \ No newline at end of file + return Response.redirect("https://blinks.knowflow.study/form"); +} diff --git a/src/app/api/upload-to-arweave/route.ts b/src/app/api/upload-to-arweave/route.ts index 889ef63..4085d79 100644 --- a/src/app/api/upload-to-arweave/route.ts +++ b/src/app/api/upload-to-arweave/route.ts @@ -4,29 +4,30 @@ import { Solana } from "@irys/upload-solana"; const getIrysUploader = async () => { const irysUploader = await Uploader(Solana).withWallet( - process.env.PRIVATE_KEY + process.env.PRIVATE_KEY, ); return irysUploader; }; export async function POST(req: NextRequest) { const irysUploader = await getIrysUploader(); - + try { - const { data } = await req.json(); + const { data } = await req.json(); + + const bufferData = Buffer.from(data, "utf-8"); - const bufferData = Buffer.from(data, 'utf-8'); + const receipt = await irysUploader.upload(bufferData); - const receipt = await irysUploader.upload(bufferData); - console.log(`Data uploaded ==> https://gateway.irys.xyz/${receipt.id}`); - - - return NextResponse.json({ txid: `https://gateway.irys.xyz/${receipt.id}`, - receipt:receipt }); + + return NextResponse.json({ + txid: `https://gateway.irys.xyz/${receipt.id}`, + receipt: receipt, + }); } catch (e) { console.error("Error when uploading ", e); return NextResponse.json({ error: "Upload failed" }, { status: 500 }); } -} \ No newline at end of file +} diff --git a/src/app/blinkcard/Preblink.tsx b/src/app/blinkcard/Preblink.tsx index 659e1fb..3caf136 100644 --- a/src/app/blinkcard/Preblink.tsx +++ b/src/app/blinkcard/Preblink.tsx @@ -1,41 +1,41 @@ -import { Card } from '@/components/ui/card' -import React from 'react' -import { SolanaBlinksCard } from './SolanaBlinksCard' -import { useDashhProgramAccount } from '@/components/dashh/dashh-data-access'; -import { PublicKey } from '@solana/web3.js'; -import { ICreator } from '@/lib/interface/creater'; -import BN from 'bn.js'; -const Preblink = ({ account,size }: { account: PublicKey,size:number }) => { - const { accountQuery } = useDashhProgramAccount({ - account, - }); - - const title = accountQuery.data?.title; - const icon= accountQuery.data?.image; - const message = accountQuery.data?.description; - const lable = accountQuery.data?.lable; - const endtime = accountQuery.data?.endtime; - const reward = accountQuery.data?.reward; - const owner =account.toBase58(); -const id = accountQuery.data?.id; - - // const title = accountQuery.data?.title; - - // const isFormValid = message.trim() !== ""; - - // const handleSubmit = () => { - // if (publicKey && isFormValid && title) { - // updateEntry.mutateAsync({ title, message, owner: publicKey }); - // } - // }; - - // if (!publicKey) { - // return

Connect your wallet

; - // } const idAsNumber = new BN(id).toNumber(); - const idAsNumber = new BN(id || 0).toNumber(); - const rewardAsNumber = new BN(reward || 0).toNumber(); - const endAsNumber = new BN(endtime || 0).toNumber(); - +import { Card } from "@/components/ui/card"; +import React from "react"; +import { SolanaBlinksCard } from "./SolanaBlinksCard"; +import { useDashhProgramAccount } from "@/components/dashh/dashh-data-access"; +import { PublicKey } from "@solana/web3.js"; +import { ICreator } from "@/lib/interface/creater"; +import BN from "bn.js"; +const Preblink = ({ account, size }: { account: PublicKey; size: number }) => { + const { accountQuery } = useDashhProgramAccount({ + account, + }); + + const title = accountQuery.data?.title; + const icon = accountQuery.data?.image; + const message = accountQuery.data?.description; + const lable = accountQuery.data?.lable; + const endtime = accountQuery.data?.endtime; + const reward = accountQuery.data?.reward; + const owner = account.toBase58(); + const id = accountQuery.data?.id; + + // const title = accountQuery.data?.title; + + // const isFormValid = message.trim() !== ""; + + // const handleSubmit = () => { + // if (publicKey && isFormValid && title) { + // updateEntry.mutateAsync({ title, message, owner: publicKey }); + // } + // }; + + // if (!publicKey) { + // return

Connect your wallet

; + // } const idAsNumber = new BN(id).toNumber(); + const idAsNumber = new BN(id || 0).toNumber(); + const rewardAsNumber = new BN(reward || 0).toNumber(); + const endAsNumber = new BN(endtime || 0).toNumber(); + const cat: ICreator = { id: idAsNumber.toString(), // Ensure id is a string if that's the type in ICreator title: title ? title : "", @@ -49,14 +49,14 @@ const id = accountQuery.data?.id; _id: idAsNumber.toString(), // Ensure _id is a string if that's the type in ICreator }; - console.log("id",accountQuery); + console.log("id", accountQuery); return ( -<> - - - - - ) -} - -export default Preblink \ No newline at end of file + <> + + + + + ); +}; + +export default Preblink; diff --git a/src/app/blinkcard/SolanaBlinksCard.tsx b/src/app/blinkcard/SolanaBlinksCard.tsx index 0e304b7..b7e81f9 100644 --- a/src/app/blinkcard/SolanaBlinksCard.tsx +++ b/src/app/blinkcard/SolanaBlinksCard.tsx @@ -1,48 +1,62 @@ -'use client' +"use client"; -import Link from 'next/link' -import Image from 'next/image' -import { ICreator } from '@/lib/interface/creater' -import { Clock, Trophy } from 'lucide-react' -import { Button } from '@/components/ui/button' -import { useDashhProgram } from '@/components/dashh/dashh-data-access' +import Link from "next/link"; +import Image from "next/image"; +import { ICreator } from "@/lib/interface/creater"; +import { Clock, Trophy } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { useDashhProgram } from "@/components/dashh/dashh-data-access"; // import { BN } from 'bn.js' -import { useAnchorProvider } from '@/components/solana/solana-provider' +import { useAnchorProvider } from "@/components/solana/solana-provider"; // import { PublicKey } from '@solana/web3.js' -export function SolanaBlinksCard({ content, id,size }: { content: ICreator; id: string,size:number }) { +export function SolanaBlinksCard({ + content, + id, + size, +}: { + content: ICreator; + id: string; + size: number; +}) { const provider = useAnchorProvider(); const daysLeft = content.end - ? Math.max(0, Math.floor((new Date(content.end).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24))) - : 'N/A' + ? Math.max( + 0, + Math.floor( + (new Date(content.end).getTime() - new Date().getTime()) / + (1000 * 60 * 60 * 24), + ), + ) + : "N/A"; - const { createParticipant } = useDashhProgram(); -const handleparticipate =async (e:any) => { - e.preventDefault(); - await createParticipant.mutateAsync({ - id: Number(id), - user: provider.wallet.publicKey, - points: 0, - }).then - (function(){ - console.log("done"); - }) - .catch(function(){ - console.log("error"); - }); - -} - const getDashboardLink = () => { - if (typeof window !== 'undefined') { - const hostname = window.location.hostname; - if (hostname === 'localhost') { - return `/dashboard/${id}`; - } else { - return `https://blinks.knowflow.study/dashboard/${id}`; - } + const { createParticipant } = useDashhProgram(); + const handleparticipate = async (e: any) => { + e.preventDefault(); + await createParticipant + .mutateAsync({ + id: Number(id), + user: provider.wallet.publicKey, + points: 0, + }) + .then(function () { + console.log("done"); + }) + .catch(function () { + console.log("error"); + }); + }; + const getDashboardLink = () => { + if (typeof window !== "undefined") { + const hostname = window.location.hostname; + if (hostname === "localhost") { + return `/dashboard/${id}`; + } else { + return `https://blinks.knowflow.study/dashboard/${id}`; } - return `https://blinks.knowflow.study/dashboard/${id}`; - }; + } + return `https://blinks.knowflow.study/dashboard/${id}`; + }; return (
@@ -58,9 +72,7 @@ const handleparticipate =async (e:any) => { #blinks
-

- {content.title} -

+

{content.title}

@@ -78,15 +90,16 @@ const handleparticipate =async (e:any) => {
- Current participants: {size} users + Current participants:{" "} + {size} users
- @@ -99,42 +112,42 @@ const handleparticipate =async (e:any) => {
- ) + ); } - //
- //
- //
- - //
- //
- //

{content.title}

- //

Total Prize - {content.amount} SOL

- //
- //
- //
- //

{content.description}

- // - // - // - //
- //
- //
\ No newline at end of file +//
+//
+//
+ +//
+//
+//

{content.title}

+//

Total Prize - {content.amount} SOL

+//
+//
+//
+//

{content.description}

+// +// +// +//
+//
+//
diff --git a/src/app/clusters/page.tsx b/src/app/clusters/page.tsx index d83613f..7d1e0b7 100644 --- a/src/app/clusters/page.tsx +++ b/src/app/clusters/page.tsx @@ -1,5 +1,3 @@ - - export default function Page() { - return <> + return <>; } diff --git a/src/app/connectPhantomWallet/connectbtn.tsx b/src/app/connectPhantomWallet/connectbtn.tsx index 2e99a98..d586da7 100644 --- a/src/app/connectPhantomWallet/connectbtn.tsx +++ b/src/app/connectPhantomWallet/connectbtn.tsx @@ -24,7 +24,6 @@ export default function ConnectPhantomWallet({ } }, []); - // Check if Phantom Wallet is installed const isPhantomInstalled = () => { return ( diff --git a/src/app/creatordashboard/creatorpage.tsx b/src/app/creatordashboard/creatorpage.tsx index d4853eb..a3d3cb8 100644 --- a/src/app/creatordashboard/creatorpage.tsx +++ b/src/app/creatordashboard/creatorpage.tsx @@ -8,18 +8,16 @@ import { useAnchorProvider } from "@/components/solana/solana-provider"; import { BN } from "@coral-xyz/anchor"; const Creatorpage = () => { - const provider = useAnchorProvider() - const { accounts, getProgramAccount } = useDashhProgram(); + const provider = useAnchorProvider(); + const { accounts, getProgramAccount, paccounts } = useDashhProgram(); const [selectedOption, setSelectedOption] = useState("Live"); if (getProgramAccount.isLoading) { return ; } - if(! provider.wallet.publicKey){ + if (!provider.wallet.publicKey) { return (
- - Please connect your wallet to view the events. - + Please connect your wallet to view the events.
); } @@ -33,22 +31,38 @@ const Creatorpage = () => {
); } - let creator = accounts.data?.filter((account) => account.account.owner.toString == provider.wallet.publicKey.toString); + + let creator = accounts.data?.filter( + (account) => + account.account.owner.toString == provider.wallet.publicKey.toString, + ); const yesterday = new Date(); yesterday.setDate(yesterday.getDate() - 1); if (selectedOption === "Closed") { - creator = creator?.filter((creato) => new Date(new BN(creato.account.endtime).toNumber()) < yesterday); + creator = creator?.filter( + (creato) => + new Date(new BN(creato.account.endtime).toNumber()) < yesterday, + ); } else { - creator = creator?.filter((creato) => new Date(new BN(creato.account.endtime).toNumber()) > yesterday); + creator = creator?.filter( + (creato) => + new Date(new BN(creato.account.endtime).toNumber()) > yesterday, + ); } - if(accounts.data){ + if (accounts.data) { creator = creator?.sort((a, b) => { - const aDaysLeft = (new Date(new BN(a.account.endtime).toNumber()).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24); - const bDaysLeft = (new Date(new BN(b.account.endtime).toNumber()).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24); - return bDaysLeft-aDaysLeft; + const aDaysLeft = + (new Date(new BN(a.account.endtime).toNumber()).getTime() - + new Date().getTime()) / + (1000 * 60 * 60 * 24); + const bDaysLeft = + (new Date(new BN(b.account.endtime).toNumber()).getTime() - + new Date().getTime()) / + (1000 * 60 * 60 * 24); + return bDaysLeft - aDaysLeft; }); } - const handleToggle = (option:any) => { + const handleToggle = (option: any) => { setSelectedOption(option); }; @@ -70,9 +84,20 @@ const Creatorpage = () => {
{creator?.map((cat) => { + const val = paccounts.data?.filter((paccount) => { + return ( + new BN(paccount.account.id || 0).toNumber() == + new BN(cat.account.id || 0).toNumber() + ); + }); + return ( <> - + ); })} diff --git a/src/app/creatordashboard/loading.tsx b/src/app/creatordashboard/loading.tsx index e87c058..4e7c7b3 100644 --- a/src/app/creatordashboard/loading.tsx +++ b/src/app/creatordashboard/loading.tsx @@ -1,10 +1,8 @@ -import SolanaLoadingComponent from '@/components/loading' -import React from 'react' +import SolanaLoadingComponent from "@/components/loading"; +import React from "react"; const Loading = () => { - return ( - - ) -} + return ; +}; -export default Loading \ No newline at end of file +export default Loading; diff --git a/src/app/creatordashboard/page.tsx b/src/app/creatordashboard/page.tsx index aeb2f56..3a67f42 100644 --- a/src/app/creatordashboard/page.tsx +++ b/src/app/creatordashboard/page.tsx @@ -1,11 +1,11 @@ import Creatorpage from "./creatorpage"; -export const dynamic = 'force-dynamic' +export const dynamic = "force-dynamic"; export default async function Component() { - return ( -
-
- -
+ return ( +
+
+
- ); -} \ No newline at end of file +
+ ); +} diff --git a/src/app/creatorlogin/page.tsx b/src/app/creatorlogin/page.tsx index bbc5dca..5c65781 100644 --- a/src/app/creatorlogin/page.tsx +++ b/src/app/creatorlogin/page.tsx @@ -1,12 +1,10 @@ -import React from 'react' +import React from "react"; const Page = () => { - return ( -
Page
- ) -} + return
Page
; +}; -export default Page +export default Page; // "use client" // import { useState } from 'react' @@ -17,7 +15,6 @@ export default Page // import { Wallet, Lock } from "lucide-react" // import { useRouter } from 'next/navigation' - // export default page // export default function CreatorLogin() { // const [solAddress, setSolAddress] = useState('') @@ -87,4 +84,4 @@ export default Page // //
// ) -// } \ No newline at end of file +// } diff --git a/src/app/dashboard/[id]/getsoladd.tsx b/src/app/dashboard/[id]/getsoladd.tsx index 9d7bd70..6fbf78c 100644 --- a/src/app/dashboard/[id]/getsoladd.tsx +++ b/src/app/dashboard/[id]/getsoladd.tsx @@ -1,18 +1,37 @@ -'use client'; +"use client"; -import { ICreator } from '@/lib/interface/creater'; -import { IUser } from '@/lib/interface/user'; -import Link from 'next/link'; -import React, { useEffect, useState } from 'react'; -import { Connection, PublicKey, Transaction, SystemProgram, clusterApiUrl, LAMPORTS_PER_SOL } from '@solana/web3.js'; +import { ICreator } from "@/lib/interface/creater"; +import { IUser } from "@/lib/interface/user"; +import Link from "next/link"; +import React, { useEffect, useState } from "react"; +import { + Connection, + PublicKey, + Transaction, + SystemProgram, + clusterApiUrl, + LAMPORTS_PER_SOL, +} from "@solana/web3.js"; -export const dynamic = 'force-dynamic'; +export const dynamic = "force-dynamic"; -const Getsoladd = ({ leaderboard, id, creator }: { leaderboard: IUser[], id: string, creator: ICreator }) => { +const Getsoladd = ({ + leaderboard, + id, + creator, +}: { + leaderboard: IUser[]; + id: string; + creator: ICreator; +}) => { const [walletAddress, setWalletAddress] = useState(null); const isPhantomInstalled = () => { - return typeof window !== 'undefined' && window.solana && (window.solana.isPhantom || window.solana.isMobile); + return ( + typeof window !== "undefined" && + window.solana && + (window.solana.isPhantom || window.solana.isMobile) + ); }; useEffect(() => { @@ -25,21 +44,21 @@ const Getsoladd = ({ leaderboard, id, creator }: { leaderboard: IUser[], id: str const { solana }: any = window; // Request connection to Phantom const response = await solana.connect(); - console.log('Connected to wallet:', response.publicKey.toString()); + console.log("Connected to wallet:", response.publicKey.toString()); setWalletAddress(response.publicKey.toString()); } catch (error) { - console.error('Error connecting to Phantom wallet:', error); + console.error("Error connecting to Phantom wallet:", error); } } } async function sendTransaction() { if (!walletAddress) { - console.log('Wallet not connected'); + console.log("Wallet not connected"); return; } - const connection = new Connection(clusterApiUrl('devnet'), 'confirmed'); + const connection = new Connection(clusterApiUrl("devnet"), "confirmed"); const recipientAddress = new PublicKey(leaderboard[0].solAdd); // Public address of the recipient const senderPublicKey = new PublicKey(walletAddress); // Sender's public key (your wallet) @@ -47,8 +66,8 @@ const Getsoladd = ({ leaderboard, id, creator }: { leaderboard: IUser[], id: str SystemProgram.transfer({ fromPubkey: senderPublicKey, toPubkey: recipientAddress, - lamports: creator.amount * LAMPORTS_PER_SOL // Amount to send (in lamports, 1 SOL = 1e9 lamports) - }) + lamports: creator.amount * LAMPORTS_PER_SOL, // Amount to send (in lamports, 1 SOL = 1e9 lamports) + }), ); try { @@ -58,18 +77,20 @@ const Getsoladd = ({ leaderboard, id, creator }: { leaderboard: IUser[], id: str const { solana }: any = window; const signedTransaction = await solana.signTransaction(transaction); // Sign transaction with Phantom - const signature = await connection.sendRawTransaction(signedTransaction.serialize()); // Send signed transaction + const signature = await connection.sendRawTransaction( + signedTransaction.serialize(), + ); // Send signed transaction await connection.confirmTransaction(signature); // Confirm the transaction - console.log('Transaction successful, signature:', signature); + console.log("Transaction successful, signature:", signature); } catch (error) { - console.error('Error sending transaction:', error); + console.error("Error sending transaction:", error); } } return ( -
- {leaderboard.some(item => item.solAdd == walletAddress) && ( +
+ {leaderboard.some((item) => item.solAdd == walletAddress) && ( @@ -88,4 +112,4 @@ const Getsoladd = ({ leaderboard, id, creator }: { leaderboard: IUser[], id: str ); }; -export default Getsoladd; \ No newline at end of file +export default Getsoladd; diff --git a/src/app/dashboard/[id]/page.tsx b/src/app/dashboard/[id]/page.tsx index b62d9ee..49c61e2 100644 --- a/src/app/dashboard/[id]/page.tsx +++ b/src/app/dashboard/[id]/page.tsx @@ -1,78 +1,97 @@ -'use client'; -import React from 'react' -import Image from 'next/image' -import { Clock, Trophy } from 'lucide-react' -import { BN } from 'bn.js' -import { useDashhProgram } from '@/components/dashh/dashh-data-access' -import { useAnchorProvider } from '@/components/solana/solana-provider'; -import Link from 'next/link'; -import { useEffect, useState } from 'react'; - -export default function Page({ params }: { params: { id: string } }) { - const {accounts, paccounts } = useDashhProgram(); +"use client"; +import React from "react"; +import Image from "next/image"; +import { Clock, Trophy } from "lucide-react"; +import { BN } from "bn.js"; +import { useDashhProgram } from "@/components/dashh/dashh-data-access"; +import { useAnchorProvider } from "@/components/solana/solana-provider"; +import Link from "next/link"; +import { useEffect, useState } from "react"; + +export default function Page({ params }: { params: { id: string } }) { + const { accounts, paccounts } = useDashhProgram(); const [timeLeft, setTimeLeft] = useState(null); - -const data = paccounts.data?.filter((account) => new BN(account.account.id|| 0).toNumber() === Number(params.id)); -const leaderboard = data?.sort((a:any, b:any) => b.account.points - a.account.points); -const myData = data?.find((account) => new BN(account.account.id|| 0).toNumber() == Number(params.id)); -const myRank = (leaderboard?.findIndex((account) => new BN(account.account.id|| 0).toNumber() == Number(params.id)) ?? -1) + 1; -const provider = useAnchorProvider(); - -const myv = accounts.data?.find((account) => account.account.id.toNumber() === Number(params.id)); - -useEffect(() => { - if (myv?.account.endtime) { - console.log(new BN(myv?.account.endtime).toNumber()); - console.log(Math.floor(Date.now())); - const endTime = new BN(myv?.account.endtime).toNumber(); - const updateTimer = () => { - const now = Math.floor(Date.now() ); - - const timeRemaining = endTime - now; - setTimeLeft(timeRemaining > 0 ? timeRemaining : 0); - }; - - updateTimer(); - const intervalId = setInterval(updateTimer, 1000); - - return () => clearInterval(intervalId); - } -}, [myData]); - -const formatTime = (milliseconds: number) => { - const totalSeconds = Math.floor(milliseconds / 1000); - const days = Math.floor(totalSeconds / 86400); - const hours = Math.floor((totalSeconds % 86400) / 3600); - const minutes = Math.floor((totalSeconds % 3600) / 60); - const seconds = totalSeconds % 60; - - return `${days}d ${hours}h ${minutes}m ${seconds}s`; -}; -const creator = accounts.data?.find((account) => account.account.owner.toString() == provider.wallet.publicKey.toString()); + const data = paccounts.data?.filter( + (account) => + new BN(account.account.id || 0).toNumber() === Number(params.id), + ); + const leaderboard = data?.sort( + (a: any, b: any) => b.account.points - a.account.points, + ); + const myData = data?.find( + (account) => + new BN(account.account.id || 0).toNumber() == Number(params.id), + ); + const myRank = + (leaderboard?.findIndex( + (account) => + new BN(account.account.id || 0).toNumber() == Number(params.id), + ) ?? -1) + 1; + const provider = useAnchorProvider(); + + const myv = accounts.data?.find( + (account) => account.account.id.toNumber() === Number(params.id), + ); + + useEffect(() => { + if (myv?.account.endtime) { + console.log(new BN(myv?.account.endtime).toNumber()); + console.log(Math.floor(Date.now())); + const endTime = new BN(myv?.account.endtime).toNumber(); + const updateTimer = () => { + const now = Math.floor(Date.now()); + + const timeRemaining = endTime - now; + setTimeLeft(timeRemaining > 0 ? timeRemaining : 0); + }; + + updateTimer(); + const intervalId = setInterval(updateTimer, 1000); + + return () => clearInterval(intervalId); + } + }, [myData]); + + const formatTime = (milliseconds: number) => { + const totalSeconds = Math.floor(milliseconds / 1000); + const days = Math.floor(totalSeconds / 86400); + const hours = Math.floor((totalSeconds % 86400) / 3600); + const minutes = Math.floor((totalSeconds % 3600) / 60); + const seconds = totalSeconds % 60; + + return `${days}d ${hours}h ${minutes}m ${seconds}s`; + }; + const creator = accounts.data?.find( + (account) => + account.account.owner.toString() == provider.wallet.publicKey.toString(), + ); return (
-
- {myData? - - - - : - <>} - - {creator? - <> - - :<>} - -
- +
+ {myData ? ( + + + + ) : ( + <> + )} + + {creator ? ( + <> + + + ) : ( + <> + )} +
+ {/* Header */}

@@ -86,11 +105,22 @@ const creator = accounts.data?.find((account) => account.account.owner.toString( {/* Podium */}
{leaderboard?.slice(0, 3).map((player, index) => ( -
+
-
+
{player.publicKey.toString()} account.account.owner.toString( {player.account.points.toNumber()} SOL

-
+
))}
@@ -119,14 +151,23 @@ const creator = accounts.data?.find((account) => account.account.owner.toString( Ends in
-
{ - myv?.account.endtime ? formatTime(timeLeft || 0) : "Challenge Ended 🎉" - }
+
+ {myv?.account.endtime + ? formatTime(timeLeft || 0) + : "Challenge Ended 🎉"} +
{/* Status Bar */}
- You earned {myData?.account.points.toNumber()} today and are ranked {myRank} out of {leaderboard?.length} users + + You earned{" "} + + {myData?.account.points.toNumber()} + {" "} + today and are ranked {myRank} out of{" "} + {leaderboard?.length} users +
{/* Leaderboard Table */} @@ -141,14 +182,19 @@ const creator = accounts.data?.find((account) => account.account.owner.toString( {leaderboard?.slice(3).map((player, index) => ( - + {index + 4} - {player.account.user.toString()} + + {player.account.user.toString()} + {player.account.points.toNumber()} @@ -160,5 +206,5 @@ const creator = accounts.data?.find((account) => account.account.owner.toString(
- ) -}; \ No newline at end of file + ); +} diff --git a/src/app/dashboard/creatorpage.tsx b/src/app/dashboard/creatorpage.tsx deleted file mode 100644 index 4f82471..0000000 --- a/src/app/dashboard/creatorpage.tsx +++ /dev/null @@ -1,106 +0,0 @@ -'use client'; - -import React, { useState, useEffect } from 'react' - - -import { Card } from "@/components/ui/card"; - -// import { Badge } from "@/components/ui/badge"; -// import { Zap } from "lucide-react"; -import { SolanaBlinksCard } from '../blinkcard/SolanaBlinksCard'; -// import connectDB from "@/lib/dbconnect"; -// import { ICreator } from "@/lib/interface/creater"; -// import Creator from "@/lib/models/creater"; - -import { ICreator } from '@/lib/interface/creater'; -import CustomToggle from '@/components/custom-toggle'; -// import { IUser } from '@/lib/interface/user'; -// import User from '@/lib/models/user'; -// import connectDB from '@/lib/dbconnect'; -// import Creator from '@/lib/models/creater'; - -const Creatorpage = ({ creator }: { creator: ICreator[] }) => { - const [selectedOption, setSelectedOption] = useState('All'); - const handleToggle = (selected: string) => { - setSelectedOption(selected); - }; - const isPhantomInstalled = () => { - return typeof window !== 'undefined' && window.solana && (window.solana.isPhantom || window.solana.isMobile); - }; - - const [walletAddress, setWalletAddress] = useState(""); - - async function getSolanaAddress() { - if (isPhantomInstalled()) { - try { - const { solana }: any = window; - // Request connection to Phantom - const response = await solana.connect(); - setWalletAddress(response.publicKey.toString()); - } catch (error) { - console.error('Error connecting to Phantom wallet:', error); - } - } - } - useEffect(() => { - // const searchParams = new URLSearchParams(window.location.search); - - - - getSolanaAddress(); - - - // getSolanaAddress(); - } - , []) - - - creator = creator.sort((a, b) => { - const aDaysLeft = (new Date(a.end).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24); - const bDaysLeft = (new Date(b.end).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24); - return aDaysLeft - bDaysLeft; - }); - - const yesterday = new Date(); - yesterday.setDate(yesterday.getDate() - 1); - if (selectedOption === 'Participated') { - - creator = creator.filter((creator) => creator.users.includes(walletAddress)); - } - - - - return ( -
-
-
- -
-
-
- {/*

Explore Events

*/} - Explore Events -
-
- - { - creator.map((cat) => { - - return ( - <> - - - - - - - ) - }) - } - -
-
- ) -} - -export default Creatorpage; \ No newline at end of file diff --git a/src/app/dashboard/loading.tsx b/src/app/dashboard/loading.tsx index e87c058..4e7c7b3 100644 --- a/src/app/dashboard/loading.tsx +++ b/src/app/dashboard/loading.tsx @@ -1,10 +1,8 @@ -import SolanaLoadingComponent from '@/components/loading' -import React from 'react' +import SolanaLoadingComponent from "@/components/loading"; +import React from "react"; const Loading = () => { - return ( - - ) -} + return ; +}; -export default Loading \ No newline at end of file +export default Loading; diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index 96a69f5..a652ef1 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -1,17 +1,15 @@ - -'use client' +"use client"; // import connectDB from "@/lib/dbconnect"; // import { ICreator } from "@/lib/interface/creater"; // import Creator from "@/lib/models/creater"; -import BN from 'bn.js'; +import BN from "bn.js"; import { useDashhProgram } from "@/components/dashh/dashh-data-access"; import Preblink from "../blinkcard/Preblink"; -export const dynamic = 'force-dynamic' -export default function Component() { - - const { accounts, getProgramAccount,paccounts } = useDashhProgram(); - if (getProgramAccount.isLoading) { +export const dynamic = "force-dynamic"; +export default function Component() { + const { accounts, getProgramAccount, paccounts } = useDashhProgram(); + if (getProgramAccount.isLoading) { return ; } if (!getProgramAccount.data?.value) { @@ -24,54 +22,59 @@ export default function Component() {

); } - accounts.data?.sort((a, b) => { - const aDaysLeft = (new Date(new BN(a.account.endtime).toNumber()).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24); - const bDaysLeft = (new Date(new BN(b.account.endtime).toNumber()).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24); - return bDaysLeft-aDaysLeft; - }); - - - return ( - <> + accounts.data?.sort((a, b) => { + const aDaysLeft = + (new Date(new BN(a.account.endtime).toNumber()).getTime() - + new Date().getTime()) / + (1000 * 60 * 60 * 24); + const bDaysLeft = + (new Date(new BN(b.account.endtime).toNumber()).getTime() - + new Date().getTime()) / + (1000 * 60 * 60 * 24); + return bDaysLeft - aDaysLeft; + }); + + return ( + <> {accounts.isLoading ? ( ) : accounts.data?.length ? ( -
-
-
- {/* */} +
+
+
+ {/* */} +
+
+
+ {/*

Explore Events

*/} + Explore Events +
+
+ {accounts.data?.map((account) => { + const val = paccounts.data?.filter((paccount) => { + return ( + new BN(paccount.account.id || 0).toNumber() == + new BN(account.account.id || 0).toNumber() + ); + }); + return ( + <> + + + ); + })} +
-
-
- {/*

Explore Events

*/} - Explore Events -
-
- - { - accounts.data?.map((account) => { - const val = paccounts.data?.filter((paccount) =>{ - return new BN(paccount.account.id || 0).toNumber() ==new BN(account.account.id|| 0).toNumber()}); - return ( - <> - - - - - ) - }) - } - -
-
):( + ) : (

No accounts

No accounts found. Create one above to get started.
- ) - } - - ); -} \ No newline at end of file + )} + + ); +} diff --git a/src/app/dashh/page.tsx b/src/app/dashh/page.tsx index e694ef4..c5f6049 100644 --- a/src/app/dashh/page.tsx +++ b/src/app/dashh/page.tsx @@ -1,5 +1,5 @@ -import DashhFeature from '@/components/dashh/dashh-feature' +import DashhFeature from "@/components/dashh/dashh-feature"; export default function Page() { - return + return ; } diff --git a/src/app/form/loading.tsx b/src/app/form/loading.tsx index e87c058..4e7c7b3 100644 --- a/src/app/form/loading.tsx +++ b/src/app/form/loading.tsx @@ -1,10 +1,8 @@ -import SolanaLoadingComponent from '@/components/loading' -import React from 'react' +import SolanaLoadingComponent from "@/components/loading"; +import React from "react"; const Loading = () => { - return ( - - ) -} + return ; +}; -export default Loading \ No newline at end of file +export default Loading; diff --git a/src/app/form/page.tsx b/src/app/form/page.tsx index e4e2517..5837bf4 100644 --- a/src/app/form/page.tsx +++ b/src/app/form/page.tsx @@ -5,9 +5,7 @@ import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { CardHeader, CardTitle, CardContent } from "@/components/ui/card"; -import { - PublicKey, -} from "@solana/web3.js"; +import { PublicKey } from "@solana/web3.js"; import Image from "next/image"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -85,7 +83,6 @@ export default function CreatorForm() { // Request connection to Phantom const response = await solana.connect(); - const formData = new FormData(e.target as HTMLFormElement); // console.log(endDate?.getTime()); // const data = { @@ -99,7 +96,7 @@ export default function CreatorForm() { // }; try { if (response.publicKey) { - const res = await createCampaign.mutateAsync({ + const res = await createCampaign.mutateAsync({ id: 0, title: formData.get("title") as string, description: formData.get("description") as string, @@ -111,11 +108,10 @@ export default function CreatorForm() { reward: Number(formData.get("amount")) as number, owner: response.publicKey as PublicKey, }); - if(res){ + if (res) { seturl_data(res); - } - else { - return
Error Loading
+ } else { + return
Error Loading
; } } else {
@@ -126,8 +122,7 @@ export default function CreatorForm() { console.log(error); } - - setOpen(true); + setOpen(true); // if (response.data.data._id != undefined) { // // setFormAmount(Number(formData.get("amount"))); @@ -142,7 +137,7 @@ export default function CreatorForm() { new URL(url); return true; } catch (e) { -console.log(e); + console.log(e); return false; } } @@ -151,17 +146,17 @@ console.log(e); return ( <> {open ? ( - - + + - Share Your Blink + Share Your Blink
- -
-
+
{" "} +
@@ -355,7 +349,6 @@ console.log(e);
- {/* card */}
@@ -398,8 +391,12 @@ console.log(e);

- - + +
-
)} ); - } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 5283ebe..01675f9 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -2,11 +2,10 @@ import type { Metadata } from "next"; import "./globals.css"; import connectDB from "@/lib/dbconnect"; import Header from "@/components/header"; -import { ToastContainer } from 'react-toastify'; -import 'react-toastify/dist/ReactToastify.css'; -import {SolanaProvider} from '@/components/solana/solana-provider' -import {ReactQueryProvider} from './react-query-provider' - +import { ToastContainer } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; +import { SolanaProvider } from "@/components/solana/solana-provider"; +import { ReactQueryProvider } from "./react-query-provider"; export const metadata: Metadata = { title: "Dashh", @@ -22,14 +21,12 @@ export default function RootLayout({ return ( - + {/* */} - - - - {/* the div below is the grid background and can be used in any other projetc too */} + + {/* the div below is the grid background and can be used in any other projetc too */} - {/*
+ {/*
@@ -40,25 +37,20 @@ export default function RootLayout({
*/} - - - - - -
- {/* Grid Pattern Background */} -
-
- {children} -
- +
+ {/* Grid Pattern Background */} +
+
+ + {children} +
+ {/* */} diff --git a/src/app/middleware.ts b/src/app/middleware.ts index bbd0a42..71c09fc 100644 --- a/src/app/middleware.ts +++ b/src/app/middleware.ts @@ -22,4 +22,4 @@ // console.log("helo"); // // Other API logic // res.json({ foo: "bar" }); -// } \ No newline at end of file +// } diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx index c363236..23b0429 100644 --- a/src/app/not-found.tsx +++ b/src/app/not-found.tsx @@ -1,5 +1,5 @@ -import Link from 'next/link' - +import Link from "next/link"; + export default function NotFound() { return (
@@ -7,5 +7,5 @@ export default function NotFound() {

Could not find requested resource

Return Home
- ) -} \ No newline at end of file + ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx index cbe4fab..2819d0d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,43 +1,45 @@ -'use client'; -import React from 'react'; +"use client"; +import React from "react"; import Footer from "@/components/footer"; import Hero from "@/components/hero2"; import Demo from "@/components/demo2"; import APISection from "@/components/APISection2"; import { cn } from "@/lib/utils"; import { - IconCloud, IconCurrencyDollar, IconEaseInOut, - IconHelp, IconRouteAltLeft, IconTerminal2, } from "@tabler/icons-react"; -export const dynamic = 'force-dynamic'; +export const dynamic = "force-dynamic"; export default function FrontPage() { const features = [ { title: "Transaction Tracking", - description: "Keep track of your transactions and ensure you meet the required amount to participate.", + description: + "Keep track of your transactions and ensure you meet the required amount to participate.", icon: , }, { title: "Reclaim Protocol Signup", - description: "Sign up for the Reclaim Protocol to start getting views on your Instagram stories.", + description: + "Sign up for the Reclaim Protocol to start getting views on your Instagram stories.", icon: , }, { title: "Engagement Tracking", - description: "Track the engagement on your Instagram stories and see how you rank.", + description: + "Track the engagement on your Instagram stories and see how you rank.", icon: , }, { title: "Find Top Stories", - description: "Discover the top-performing Instagram stories and learn from the best.", + description: + "Discover the top-performing Instagram stories and learn from the best.", icon: , }, { @@ -47,7 +49,8 @@ export default function FrontPage() { }, { title: "Collaborative Engagement", - description: "Collaborate with others to boost your story views and engagement.", + description: + "Collaborate with others to boost your story views and engagement.", icon: , }, ]; @@ -104,7 +107,7 @@ const Feature = ({ className={cn( "flex flex-col lg:border-r py-10 relative group/feature dark:border-neutral-800", (index === 0 || index === 3) && "lg:border-l dark:border-neutral-800", - index < 3 && "lg:border-b dark:border-neutral-800" + index < 3 && "lg:border-b dark:border-neutral-800", )} > {index < 3 && ( @@ -112,7 +115,6 @@ const Feature = ({ )} {index >= 3 && (
- )}
{icon} @@ -128,4 +130,4 @@ const Feature = ({

); -}; \ No newline at end of file +}; diff --git a/src/app/react-query-provider.tsx b/src/app/react-query-provider.tsx index e12cf8d..6d09646 100644 --- a/src/app/react-query-provider.tsx +++ b/src/app/react-query-provider.tsx @@ -1,15 +1,15 @@ -'use client' +"use client"; -import React, { ReactNode, useState } from 'react' -import { ReactQueryStreamedHydration } from '@tanstack/react-query-next-experimental' -import { QueryClientProvider, QueryClient } from '@tanstack/react-query' +import React, { ReactNode, useState } from "react"; +import { ReactQueryStreamedHydration } from "@tanstack/react-query-next-experimental"; +import { QueryClientProvider, QueryClient } from "@tanstack/react-query"; export function ReactQueryProvider({ children }: { children: ReactNode }) { - const [client] = useState(new QueryClient()) + const [client] = useState(new QueryClient()); return ( {children} - ) + ); } diff --git a/src/app/trial/key.json b/src/app/trial/key.json index b3a97f0..2082a5b 100644 --- a/src/app/trial/key.json +++ b/src/app/trial/key.json @@ -1 +1,12 @@ -{"d":"jrZM5bV5srvmQJdQY7l_j7OFSvSEwd-ZyvosHwAta4FB1RBdHfC9ZD29KewrA-YYBlEtwhUehJRhDoKTfZqBZ8bJArm-Bop8eHciWJTvReJLsuNlpiBKaDLXyWDHLYKAvDmExEqlxSIAhQNU20FR7ljShr7ppKmZkDPHMdvuc9Wcb4TIYbXAZPzVWfyk_py06jX2dmC_WmfOymnjnuoCpbnv5ypnEC21Axj7YNineE0UP-ByeK_YIIfXmOuRNHEw4iBA-NvcKMZ5IIG7W5GPv8gs6hMn89r792WeYiHFFGGHHoJSjVl8gAD6SZ3eLBkObjAwqsGPiDHFFSNgKj-Lb2UdB_Sq5Lfq5b8SsSe8h16Ho27up9pi9E0QKrzhJZtZtLJE7uUenQhnxJXDTc4sukCAVLVQ9aa9XIcUQttO_hLz976NbECLkn7t-ceIasaZor161Zy2S2c_1E3c6ltrd4IlLgj0Fsq6Yk3sm-UvFAmsiX4xL0yURp9rS7i-tM_lBOGRaCJL6NE6s0ZyGRRe8l1gkaPgg42AoxW0Mg2pL-_8KED1L_Sqp6cfRsRHs4_6B3Y3BJC7NpHsYk2nzzQ84bJuxQluSspb52rlKjB97SVxcXXQywH3p9q-ihO_wmYF_t4rsoK7UK60L6V3LDXcE7odJu9Oo2XhBeJpAWTcXbE","dp":"vwwnu8Bk6AfX4w5677aQeqKNYWIRDlOXX3WW2f1Bfvs-jgCg0zSW1XEJsSYXR_i-DmI1lyupXu986p2H8vg7Fbvo9Pti5atQNTZAtpSUb4UC8euX3Qag28i-bk9C2p4qrJ0NGSSJ7LW5aCKOn3CyaG3sGhkFBJhzobd06JTHR7CziHG5AiWmRwRwZpzqGOOgKs8S64XgGvPqUOqvRKsparAFGaiImkOv6Ep0Nvph9zpsOOJuuP6yrkciUDYWXqP0IBRl_LkJyLgq2xR5XcwJfo92Ss7ZaygqKhEM0-T0wBAXaVBG4G5krOfiVO7VDAHHfkQGdoy3ty3ZT5fNI7vIwQ","dq":"W7k8dvMWCepIZKm-AlTHE15UXMgx7qn4WOE4JY4Qs8QVpYRK9w1vbVVVGssLlCn0GVdnoJfBuMsHJ98Ue_b98TrBbmfWqhrKVtR4XE5mz9Zcqe9Lw-Ql91L6L813uaMulymAOGo1kNb6O5RbCgBQW1uer4Wg-4RbeVILEUR7WZYwroAoEwQ3XFtFCGXOVDELSZy-AdqzUvl0-fvFpHcSgjm180E6NE3py45OqBKAReWShmfMb6nEqqEhbMp7f6rSfnM5C_hdaF6B8r1bziUOdiPQLCoOJMxsnyxoqMRIw28yV7vX3IOYuWOB9qyGxin3xIr3n2nXopeJRCt0zbtOuw","e":"AQAB","ext":true,"kty":"RSA","n":"mSfoGvkjqrT3aq-RLMu2ul_mxjUnak_U-87MYCq12Yc5bIy6UjBObc-uEbZ5tC3LKkcUp8LVB74GJjaSdEMivIrYDDgCSBr50y1NfBCZky5WT5P7Rxry31_UhWBnFWuG7aX1fnJM9w_E3wh5zFiojW86Ii364kiZTWhYj0fRyS9fC_6OuXtfVrJbNspA8KoLVKy3F-QwVtJ6uAzv0nKZsjb9Xzx5tuCMQKZVhoO7dKRQVyWwHv9Q3-OHNIO0z7wCsmKCZOXP9jfpwtd0NYLbKnk4XglMTtKkK6vH5IA0z-LfHiNz0QhO2aySMivMMcxdVB7IFyZCAchrNhRPzn_DkbJS318v6cRSLB-UOnPJoliBM7mE2qvaSd60C3d1Lg7xETSuw7DuOOdLT31y8uXbyZBylK2lOXWMgb4WvoafTH4-bn_0GzHB7o3kt8F3kDHcwELqqXdYHF67R4ck7Lc2fwwmAkv4HhBnkCJ9cL3-1JZhMydFvPj3rrgBsJDZMS6BtjDKPrpsoddza6S0Dq8IFIG3NFBtUjuS5PO60AU5TBuTizB-fDtsOPdZBjwgg5GmIOx6R60YtjRETlb_FEb072_1rfb8sXQVBvYt-5N3u2rtPz9q6TfO_Y2EfOGMiOTKN4w067YR7pXp_ilU_sMNfVaoQ5ABb-MdXmjMMGq-KtE","p":"7LQlhExao8JcgpYPKyN3VUVEAcdAgVbBNwqjnjgyKN6w5_2_q4tueIbjNGwj18-1smlUrotitBRElC8D85x8lUBDwomj24T7-dYi6GhvhrSDSStBjTvspyawgigxwtTRIGe7gAIHNR5iVQEKE4KkSKK2ecCnZyGRtFKAE97HnDmWp7_kEJCIz7uBhlYwRSNuffunFBklLDwdctw51z4EIeJ_CkmS_DAPFJIGgu-MtQaFb7tt735uLOHhcuBwOeTVbiddx3e-9o_4CjfaJTHnRahKJ6vtE60XyIiNHEW7ugWwXWx8wEvpNhxClCODdagg1SgiWti7aVam7_nxuvigbw","q":"paQr0kITWXDqwLDEIehSgXPVVKHBXaDVVfcTpq6-6SSrid8sdRKQDMmREXlaqSAluGXBSgOkYqZSLCHOQw1v-Jy7gYPXaQ1_YxvO_mA5xlHmynAhNHXt5T5Rxsn0jUzB1bCxjQV3fyPDxq6_kDr9JAoH_kfw8MeYbfhJGo4zYeoiW7kjf1XfQkqvNQgRZTb4BsWqwzhK-5GIWDWqNbcC2hmUUa45pImZCOVbsuSRrxMKvkPk_j62k6egcdo0yzsJbRqG4fPVmJKEBOBk-5yDbRfsMSPxWP3JuRXfoUjJsEY-OUCXaVlZSmMTwoGCW38tftSnXje8FhZque_TJPUIvw","qi":"kHVnmSkmZNv4uZXjCSrfCyUdygBrA0iKk1k1M6P3iqvE-BOcRBhr9y1KADcVa_7qbRifW4A32K_FThgPuxnJ-irpjCWT9gbwzeHr-nu3Phugc3umQ1cDOLJ7GYtAaVHVTe4qp-j9npNlr_E_SW0EU6cq2iisBdRtoyznGt4OnRjsCnps5nHfhfaoBJ1P02JH1LJIrZGQq6go4xdITU8grBjPqSIOdEyZhdWQsmtlIqLMUgCNnGjKXbxL5DppPq3_kLgdhzIQN56Eu9mMRaH3f5iS2K6Zw3emOOIy6w2uh6ESXqf7rYpeEtE2pCNcqsFwQNPizYbxBGXxDn3WOZrrpg"} \ No newline at end of file +{ + "d": "jrZM5bV5srvmQJdQY7l_j7OFSvSEwd-ZyvosHwAta4FB1RBdHfC9ZD29KewrA-YYBlEtwhUehJRhDoKTfZqBZ8bJArm-Bop8eHciWJTvReJLsuNlpiBKaDLXyWDHLYKAvDmExEqlxSIAhQNU20FR7ljShr7ppKmZkDPHMdvuc9Wcb4TIYbXAZPzVWfyk_py06jX2dmC_WmfOymnjnuoCpbnv5ypnEC21Axj7YNineE0UP-ByeK_YIIfXmOuRNHEw4iBA-NvcKMZ5IIG7W5GPv8gs6hMn89r792WeYiHFFGGHHoJSjVl8gAD6SZ3eLBkObjAwqsGPiDHFFSNgKj-Lb2UdB_Sq5Lfq5b8SsSe8h16Ho27up9pi9E0QKrzhJZtZtLJE7uUenQhnxJXDTc4sukCAVLVQ9aa9XIcUQttO_hLz976NbECLkn7t-ceIasaZor161Zy2S2c_1E3c6ltrd4IlLgj0Fsq6Yk3sm-UvFAmsiX4xL0yURp9rS7i-tM_lBOGRaCJL6NE6s0ZyGRRe8l1gkaPgg42AoxW0Mg2pL-_8KED1L_Sqp6cfRsRHs4_6B3Y3BJC7NpHsYk2nzzQ84bJuxQluSspb52rlKjB97SVxcXXQywH3p9q-ihO_wmYF_t4rsoK7UK60L6V3LDXcE7odJu9Oo2XhBeJpAWTcXbE", + "dp": "vwwnu8Bk6AfX4w5677aQeqKNYWIRDlOXX3WW2f1Bfvs-jgCg0zSW1XEJsSYXR_i-DmI1lyupXu986p2H8vg7Fbvo9Pti5atQNTZAtpSUb4UC8euX3Qag28i-bk9C2p4qrJ0NGSSJ7LW5aCKOn3CyaG3sGhkFBJhzobd06JTHR7CziHG5AiWmRwRwZpzqGOOgKs8S64XgGvPqUOqvRKsparAFGaiImkOv6Ep0Nvph9zpsOOJuuP6yrkciUDYWXqP0IBRl_LkJyLgq2xR5XcwJfo92Ss7ZaygqKhEM0-T0wBAXaVBG4G5krOfiVO7VDAHHfkQGdoy3ty3ZT5fNI7vIwQ", + "dq": "W7k8dvMWCepIZKm-AlTHE15UXMgx7qn4WOE4JY4Qs8QVpYRK9w1vbVVVGssLlCn0GVdnoJfBuMsHJ98Ue_b98TrBbmfWqhrKVtR4XE5mz9Zcqe9Lw-Ql91L6L813uaMulymAOGo1kNb6O5RbCgBQW1uer4Wg-4RbeVILEUR7WZYwroAoEwQ3XFtFCGXOVDELSZy-AdqzUvl0-fvFpHcSgjm180E6NE3py45OqBKAReWShmfMb6nEqqEhbMp7f6rSfnM5C_hdaF6B8r1bziUOdiPQLCoOJMxsnyxoqMRIw28yV7vX3IOYuWOB9qyGxin3xIr3n2nXopeJRCt0zbtOuw", + "e": "AQAB", + "ext": true, + "kty": "RSA", + "n": "mSfoGvkjqrT3aq-RLMu2ul_mxjUnak_U-87MYCq12Yc5bIy6UjBObc-uEbZ5tC3LKkcUp8LVB74GJjaSdEMivIrYDDgCSBr50y1NfBCZky5WT5P7Rxry31_UhWBnFWuG7aX1fnJM9w_E3wh5zFiojW86Ii364kiZTWhYj0fRyS9fC_6OuXtfVrJbNspA8KoLVKy3F-QwVtJ6uAzv0nKZsjb9Xzx5tuCMQKZVhoO7dKRQVyWwHv9Q3-OHNIO0z7wCsmKCZOXP9jfpwtd0NYLbKnk4XglMTtKkK6vH5IA0z-LfHiNz0QhO2aySMivMMcxdVB7IFyZCAchrNhRPzn_DkbJS318v6cRSLB-UOnPJoliBM7mE2qvaSd60C3d1Lg7xETSuw7DuOOdLT31y8uXbyZBylK2lOXWMgb4WvoafTH4-bn_0GzHB7o3kt8F3kDHcwELqqXdYHF67R4ck7Lc2fwwmAkv4HhBnkCJ9cL3-1JZhMydFvPj3rrgBsJDZMS6BtjDKPrpsoddza6S0Dq8IFIG3NFBtUjuS5PO60AU5TBuTizB-fDtsOPdZBjwgg5GmIOx6R60YtjRETlb_FEb072_1rfb8sXQVBvYt-5N3u2rtPz9q6TfO_Y2EfOGMiOTKN4w067YR7pXp_ilU_sMNfVaoQ5ABb-MdXmjMMGq-KtE", + "p": "7LQlhExao8JcgpYPKyN3VUVEAcdAgVbBNwqjnjgyKN6w5_2_q4tueIbjNGwj18-1smlUrotitBRElC8D85x8lUBDwomj24T7-dYi6GhvhrSDSStBjTvspyawgigxwtTRIGe7gAIHNR5iVQEKE4KkSKK2ecCnZyGRtFKAE97HnDmWp7_kEJCIz7uBhlYwRSNuffunFBklLDwdctw51z4EIeJ_CkmS_DAPFJIGgu-MtQaFb7tt735uLOHhcuBwOeTVbiddx3e-9o_4CjfaJTHnRahKJ6vtE60XyIiNHEW7ugWwXWx8wEvpNhxClCODdagg1SgiWti7aVam7_nxuvigbw", + "q": "paQr0kITWXDqwLDEIehSgXPVVKHBXaDVVfcTpq6-6SSrid8sdRKQDMmREXlaqSAluGXBSgOkYqZSLCHOQw1v-Jy7gYPXaQ1_YxvO_mA5xlHmynAhNHXt5T5Rxsn0jUzB1bCxjQV3fyPDxq6_kDr9JAoH_kfw8MeYbfhJGo4zYeoiW7kjf1XfQkqvNQgRZTb4BsWqwzhK-5GIWDWqNbcC2hmUUa45pImZCOVbsuSRrxMKvkPk_j62k6egcdo0yzsJbRqG4fPVmJKEBOBk-5yDbRfsMSPxWP3JuRXfoUjJsEY-OUCXaVlZSmMTwoGCW38tftSnXje8FhZque_TJPUIvw", + "qi": "kHVnmSkmZNv4uZXjCSrfCyUdygBrA0iKk1k1M6P3iqvE-BOcRBhr9y1KADcVa_7qbRifW4A32K_FThgPuxnJ-irpjCWT9gbwzeHr-nu3Phugc3umQ1cDOLJ7GYtAaVHVTe4qp-j9npNlr_E_SW0EU6cq2iisBdRtoyznGt4OnRjsCnps5nHfhfaoBJ1P02JH1LJIrZGQq6go4xdITU8grBjPqSIOdEyZhdWQsmtlIqLMUgCNnGjKXbxL5DppPq3_kLgdhzIQN56Eu9mMRaH3f5iS2K6Zw3emOOIy6w2uh6ESXqf7rYpeEtE2pCNcqsFwQNPizYbxBGXxDn3WOZrrpg" +} diff --git a/src/app/verifyClaim/[uid]/page.tsx b/src/app/verifyClaim/[uid]/page.tsx deleted file mode 100644 index 82ff8eb..0000000 --- a/src/app/verifyClaim/[uid]/page.tsx +++ /dev/null @@ -1,191 +0,0 @@ -"use client"; -import { useSearchParams } from "next/navigation"; - -import React, { useState } from "react"; -import QRCode from "react-qr-code"; -import { ReclaimProofRequest } from "@reclaimprotocol/js-sdk"; -import CircularProgress from "@mui/material/CircularProgress"; -import Link from "next/link"; -import { Button } from "@/components/ui/button"; -import { Instagram, Twitter } from "lucide-react"; - -const APP_ID = "0x896b97E0915ae00C61D8bb88b9f6A76d273cfE76"; -const APP_SECRET = - "0xa24f2911de618188e78d5981f62a3bba7497bc87b1e1789bac933ec614ca11a8"; -const PROVIDER_ID = "d18dcace-d59b-4432-b77e-655b7248334d"; - -// const sampledata = { -// identifier: -// "0x293dab3d4be5211106b52f40ecdc16653bd921a4a4ff5cd0896bc53bbee87086", -// claimData: { -// provider: "http", -// parameters: -// '{"additionalClientOptions":{},"body":"","geoLocation":"","headers":{"user-agent":"Mozilla/5.0 (Linux; Android 12; 2201117PI Build/SP1A.210812.016) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/131.0.6778.39 Mobile Safari/537.36"},"method":"GET","paramValues":{"URL_PARAMS_1":"Tg82Ez_kxVaJf7OPbUdbCg","URL_PARAMS_2":"%7B%22userId%22%3A%221543126510642536448%22%2C%22count%22%3A20%2C%22includePromotedContent%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D","URL_PARAMS_3":"%7B%22rweb_tipjar_consumption_enabled%22%3Atrue%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22communities_web_enable_tweet_community_results_fetch%22%3Atrue%2C%22c9s_tweet_anatomy_moderator_badge_enabled%22%3Atrue%2C%22articles_preview_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Atrue%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22creator_subscriptions_quote_tweet_preview_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22rweb_video_timestamps_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D","favorite_count":"17","full_text":"Won the Reclaim Protocol track at Radar hackathon! ❤️\\\\nKudos to my team @SKartik_SK @praneshz_ @tusharpatidar23 @TheAshutoshM.\\\\n\\\\nCouldn\'t be more grateful to @solana @SuperteamIN @colosseum and @reclaimprotocol for such an opportunity \\\\uD83D\\\\uDE80✨","hashtags":"[]","user_mentions":"[{\\"id_str\\":\\"1586361012315250688\\",\\"name\\":\\"Singupalli Kartik\\",\\"screen_name\\":\\"SKartik_SK\\",\\"indices\\":[71,82]},{\\"id_str\\":\\"1396787419081592835\\",\\"name\\":\\"Pranesh Joshi\\",\\"screen_name\\":\\"praneshz_\\",\\"indices\\":[83,93]},{\\"id_str\\":\\"1444314554553364485\\",\\"name\\":\\"Tushar Patidar\\",\\"screen_name\\":\\"tusharpatidar23\\",\\"indices\\":[94,110]},{\\"id_str\\":\\"1618846191734910978\\",\\"name\\":\\"Ashutosh Mishra\\",\\"screen_name\\":\\"TheAshutoshM\\",\\"indices\\":[111,124]},{\\"id_str\\":\\"951329744804392960\\",\\"name\\":\\"Solana\\",\\"screen_name\\":\\"solana\\",\\"indices\\":[156,163]},{\\"id_str\\":\\"1508022250649550864\\",\\"name\\":\\"Superteam India\\",\\"screen_name\\":\\"SuperteamIN\\",\\"indices\\":[164,176]},{\\"id_str\\":\\"1626610682773794816\\",\\"name\\":\\"Colosseum\\",\\"screen_name\\":\\"colosseum\\",\\"indices\\":[177,187]},{\\"id_str\\":\\"1643929314768093185\\",\\"name\\":\\"Reclaim Protocol | Devcon \\\\uD83C\\\\uDDF9\\\\uD83C\\\\uDDED\\",\\"screen_name\\":\\"reclaimprotocol\\",\\"indices\\":[192,208]}]"},"responseMatches":[{"type":"contains","value":"\\"full_text\\":\\"{{full_text}}\\""},{"type":"contains","value":"\\"favorite_count\\":{{favorite_count}}"},{"type":"contains","value":"\\"user_mentions\\":{{user_mentions}}"},{"type":"contains","value":"\\"hashtags\\":{{hashtags}}"}],"responseRedactions":[{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.full_text","regex":"\\"full_text\\":\\"(.*)\\"","xPath":""},{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.favorite_count","regex":"\\"favorite_count\\":(.*)","xPath":""},{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.entities.user_mentions","regex":"\\"user_mentions\\":(.*)","xPath":""},{"jsonPath":"$.data.user.result.timeline_v2.timeline.instructions[1].entry.content.itemContent.tweet_results.result.legacy.entities.hashtags","regex":"\\"hashtags\\":(.*)","xPath":""}],"url":"https://x.com/i/api/graphql/{{URL_PARAMS_1}}/UserTweets?variables={{URL_PARAMS_2}}&features={{URL_PARAMS_3}}&fieldToggles=%7B%22withArticlePlainText%22%3Afalse%7D"}', -// owner: "0xbcaa9b981ddb0bc631878e448ceb64e7f2d531d0", -// timestampS: 1732116708, -// context: -// '{"contextAddress":"0x0","contextMessage":"","extractedParameters":{"URL_PARAMS_1":"Tg82Ez_kxVaJf7OPbUdbCg","URL_PARAMS_2":"%7B%22userId%22%3A%221543126510642536448%22%2C%22count%22%3A20%2C%22includePromotedContent%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D","URL_PARAMS_3":"%7B%22rweb_tipjar_consumption_enabled%22%3Atrue%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22communities_web_enable_tweet_community_results_fetch%22%3Atrue%2C%22c9s_tweet_anatomy_moderator_badge_enabled%22%3Atrue%2C%22articles_preview_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Atrue%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22creator_subscriptions_quote_tweet_preview_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22rweb_video_timestamps_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D","favorite_count":"17","full_text":"Won the Reclaim Protocol track at Radar hackathon! ❤️\\\\nKudos to my team @SKartik_SK @praneshz_ @tusharpatidar23 @TheAshutoshM.\\\\n\\\\nCouldn\'t be more grateful to @solana @SuperteamIN @colosseum and @reclaimprotocol for such an opportunity \\\\uD83D\\\\uDE80✨","hashtags":"[]","user_mentions":"[{\\"id_str\\":\\"1586361012315250688\\",\\"name\\":\\"Singupalli Kartik\\",\\"screen_name\\":\\"SKartik_SK\\",\\"indices\\":[71,82]},{\\"id_str\\":\\"1396787419081592835\\",\\"name\\":\\"Pranesh Joshi\\",\\"screen_name\\":\\"praneshz_\\",\\"indices\\":[83,93]},{\\"id_str\\":\\"1444314554553364485\\",\\"name\\":\\"Tushar Patidar\\",\\"screen_name\\":\\"tusharpatidar23\\",\\"indices\\":[94,110]},{\\"id_str\\":\\"1618846191734910978\\",\\"name\\":\\"Ashutosh Mishra\\",\\"screen_name\\":\\"TheAshutoshM\\",\\"indices\\":[111,124]},{\\"id_str\\":\\"951329744804392960\\",\\"name\\":\\"Solana\\",\\"screen_name\\":\\"solana\\",\\"indices\\":[156,163]},{\\"id_str\\":\\"1508022250649550864\\",\\"name\\":\\"Superteam India\\",\\"screen_name\\":\\"SuperteamIN\\",\\"indices\\":[164,176]},{\\"id_str\\":\\"1626610682773794816\\",\\"name\\":\\"Colosseum\\",\\"screen_name\\":\\"colosseum\\",\\"indices\\":[177,187]},{\\"id_str\\":\\"1643929314768093185\\",\\"name\\":\\"Reclaim Protocol | Devcon \\\\uD83C\\\\uDDF9\\\\uD83C\\\\uDDED\\",\\"screen_name\\":\\"reclaimprotocol\\",\\"indices\\":[192,208]}]"},"providerHash":"0x33ddc18c613908cfcf63a898dc24b302c80111ca80fb28572c6f090f0391067f"}', -// identifier: -// "0x293dab3d4be5211106b52f40ecdc16653bd921a4a4ff5cd0896bc53bbee87086", -// epoch: 1, -// }, -// signatures: [ -// "0xdc93b5e915fcc848f855c30bb23146707f124b9bf44a24b5407cb2044cfff97e5ae745968577ff9da7357ecf058ef1f72f430ee1f98cd96fee6179b7baac33821b", -// ], -// witnesses: [ -// { -// id: "0x244897572368eadf65bfbc5aec98d8e5443a9072", -// url: "wss://witness.reclaimprotocol.org/ws", -// }, -// ], -// publicData: {}, -// }; - -const Page = () => { - const searchParams = useSearchParams(); - const title = searchParams?.get("title"); - - // const uid = "aa"; - // const title = "hello"; - const [res, setRes] = useState(""); - const [qrState, setQrState] = useState< - "none" | "loading" | "waiting" | "success" - >("none"); - const [qrUrl, setQrUrl] = useState(""); - - const verifyOnReclaim = async () => { - setQrState("loading"); - const reclaimProofRequest = await ReclaimProofRequest.init( - APP_ID, - APP_SECRET, - PROVIDER_ID - ); - const requestUrl = await reclaimProofRequest.getRequestUrl(); - if (requestUrl) { - setQrUrl(requestUrl); - setQrState("waiting"); - } - await reclaimProofRequest.startSession({ - onSuccess: (proofs) => { - console.log("Verification success", proofs); - setQrState("success"); - setRes(proofs.claimData.context); - }, - // Called if there's an error during verification - onError: (error) => { - console.error("Verification failed", error); - }, - }); - }; - - // const handleGenerateQr = () => { - // setQrState("loading"); - // setTimeout(() => { - // setQrUrl("https://example.com/qr-code"); // Replace with dynamic QR URL - // setQrState("success"); - // }, 2000); // Simulate loading time - // }; - - return ( -
-

- {title || "Verification Page"} -

- -
- - - -
- -
- {qrState === "none" &&

No QR code to display yet.

} - {qrState === "loading" &&

Loading QR code...

} - {qrState === "success" &&

Sucess! {res}

} - {qrState === "waiting" && ( -
-
- -
-
- - - - - - - - - - - - <> -

Waiting for Proofs!

- -
-

- Scan this QR or click - - {" "} - here - {" "} - to verify -

-
- )} -
-
- ); -}; - -export default Page; diff --git a/src/app/verifyClaim/[uid]/samplepage.tsx b/src/app/verifyClaim/[uid]/samplepage.tsx deleted file mode 100644 index c6612fc..0000000 --- a/src/app/verifyClaim/[uid]/samplepage.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import { useState } from 'react'; -import QRCode from 'react-qr-code'; -import { ReclaimProofRequest } from '@reclaimprotocol/js-sdk'; - -function ReclaimDemo() { - - // State to store the verification request URL - const [requestUrl, setRequestUrl] = useState(''); - const [proofs, setProofs] = useState({}) - - const getVerificationReq = async () => { - - // Your credentials from the Reclaim Developer Portal - // Replace these with your actual credentials - - const APP_ID = '0xF31aa56D97CeC403f1da64d37c5cA315a3Fa0b05'; - const APP_SECRET = 'YOUR_APPLICATION_SECRET'; - const PROVIDER_ID = 'c8a77c4a-7ff2-4ef2-a7a3-c0ad9cf92aec'; - - // Initialize the Reclaim SDK with your credentials - const reclaimProofRequest = await ReclaimProofRequest.init(APP_ID, APP_SECRET, PROVIDER_ID); - - // Generate the verification request URL - const requestUrl = await reclaimProofRequest.getRequestUrl(); - - console.log('Request URL:', requestUrl); - - setRequestUrl(requestUrl); - - // Start listening for proof submissions - await reclaimProofRequest.startSession({ - - // Called when the user successfully completes the verification - onSuccess: (proofs) => { - - console.log('Verification success', proofs); - setProofs(proofs); - - // Add your success logic here, such as: - // - Updating UI to show verification success - // - Storing verification status - // - Redirecting to another page - }, - // Called if there's an error during verification - onError: (error) => { - - console.error('Verification failed', error); - - // Add your error handling logic here, such as: - // - Showing error message to user - // - Resetting verification state - // - Offering retry options - }, - }); - }; - - return ( - <> - - - {/* Display QR code when URL is available */} - - {requestUrl && ( -
- -
- )} - - {proofs && ( -
-

Verification Successful!

-
{JSON.stringify(proofs, null, 2)}
-
- )} - - ); -} - -export default ReclaimDemo; \ No newline at end of file diff --git a/src/app/verifyClaim/page.tsx b/src/app/verifyClaim/page.tsx index 1af168a..799d6b6 100644 --- a/src/app/verifyClaim/page.tsx +++ b/src/app/verifyClaim/page.tsx @@ -1,8 +1,6 @@ - "use client"; import { useSearchParams } from "next/navigation"; - -import React, { useEffect, useState } from "react"; +import React, { useState } from "react"; import QRCode from "react-qr-code"; import { ReclaimProofRequest } from "@reclaimprotocol/js-sdk"; @@ -13,36 +11,32 @@ import { Instagram, Twitter } from "lucide-react"; import { useDashhProgram } from "@/components/dashh/dashh-data-access"; import { useAnchorProvider } from "@/components/solana/solana-provider"; -const APP_ID = "0x896b97E0915ae00C61D8bb88b9f6A76d273cfE76"; -const APP_SECRET = - "0xa24f2911de618188e78d5981f62a3bba7497bc87b1e1789bac933ec614ca11a8"; -const PROVIDER_ID = "d18dcace-d59b-4432-b77e-655b7248334d"; - -interface irysdata { - uid: string | null; - likes: number; - keyword: boolean; -} -export async function sendtoIrys(dataToSend: irysdata) { - try { - const response = await fetch("/api/upload-to-arweave", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(dataToSend), - }); - - if (!response.ok) { - throw new Error("Network response was not ok"); - } - const data = await response.json(); - console.log(data); - } catch (error) { - console.log({ error }); - } -} +// interface irysdata { +// uid: string | null; +// likes: number; +// keyword: boolean; +// } +// async function sendtoIrys(dataToSend: irysdata) { +// try { +// const response = await fetch("/api/upload-to-arweave", { +// method: "POST", +// headers: { +// "Content-Type": "application/json", +// }, +// body: JSON.stringify(dataToSend), +// }); + +// if (!response.ok) { +// throw new Error("Network response was not ok"); +// } + +// const data = await response.json(); +// console.log(data); +// } catch (error) { +// console.log({ error }); +// } +// } function extractAfterFavoriteCount(input: string): string | null { try { @@ -69,18 +63,14 @@ function containsKeyword(input: string, ...keywords: string[]): boolean { }); } -export default function Page () { - - +export default function Page() { // const { uid } = router; // const uid = "AAAA"; // console.log(uid); const searchParams = useSearchParams(); - const uid = searchParams?.get("id"); - const title = searchParams?.get("title"); + const uid = searchParams?.get("id") || ""; + const title = searchParams?.get("title") || ""; console.log(uid); -const { accounts } = useDashhProgram(); -const myv = accounts.data?.find((account) => account.account.id.toNumber() === Number(uid)); // const uid = "aa"; // const title = "hello"; const [res, setRes] = useState(""); @@ -88,17 +78,22 @@ const myv = accounts.data?.find((account) => account.account.id.toNumber() === N const [qrState, setQrState] = useState< "none" | "loading" | "failed" | "waiting" | "success" >("none"); + console.log(res); const [qrUrl, setQrUrl] = useState(""); - const {updateParticipant} = useDashhProgram(); + const { accounts, updateParticipant } = useDashhProgram(); const provider = useAnchorProvider(); - + + const myd = accounts.data?.find( + (account) => account.account.id.toNumber() === Number(uid), + ); + const verifyOnReclaim = async () => { setQrState("loading"); const reclaimProofRequest = await ReclaimProofRequest.init( - APP_ID, - APP_SECRET, - PROVIDER_ID + process.env.APP_ID || "", + process.env.APP_SECRET || "", + process.env.PROVIDER_ID || "", ); const requestUrl = await reclaimProofRequest.getRequestUrl(); if (requestUrl) { @@ -111,32 +106,34 @@ const myv = accounts.data?.find((account) => account.account.id.toNumber() === N const likes = extractAfterFavoriteCount(proofs.claimData.context); const isKeyword = containsKeyword( proofs.claimData.context, - "won", - "@superteamin" + myd?.account.lable || "won", + "@superteamin", ); - + console.log(likes); if (likes && isKeyword) { - const points = Number(likes) * 10; - updateParticipant.mutateAsync({ - id: Number(uid), - user:provider.wallet.publicKey, - points: points, - }).then((result) => { - // Your logic here - setDeploying(true); - console.log("done", result); - }) - .catch((error) => { - console.error(error); - }); - // const dataToSend = { - // uid: uid, - // likes: Number(likes), - // keyword: isKeyword, - // }; - // sendtoIrys(dataToSend); - // setQrState("success"); + const points = Number(likes) * 10; + updateParticipant + .mutateAsync({ + id: Number(uid), + user: provider.wallet.publicKey, + points: points, + }) + .then((result) => { + // Your logic here + setDeploying(true); + console.log("done", result); + }) + .catch((error) => { + console.error(error); + }); + // const dataToSend = { + // uid: uid, + // likes: Number(likes), + // keyword: isKeyword, + // }; + // sendtoIrys(dataToSend); + // setQrState("success"); } else { setQrState("success"); } @@ -254,4 +251,4 @@ const myv = accounts.data?.find((account) => account.account.id.toNumber() === N
); -}; +} diff --git a/src/app/verifyClaim/text.cpp b/src/app/verifyClaim/text.cpp deleted file mode 100644 index 6989ae5..0000000 --- a/src/app/verifyClaim/text.cpp +++ /dev/null @@ -1 +0,0 @@ -#include \ No newline at end of file diff --git a/src/components/APISection2.tsx b/src/components/APISection2.tsx index 4cc46ee..bf56f22 100644 --- a/src/components/APISection2.tsx +++ b/src/components/APISection2.tsx @@ -1,11 +1,17 @@ -'use client'; -import React from 'react'; -import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; -import { solarizedlight } from 'react-syntax-highlighter/dist/esm/styles/prism'; -import { useRef } from 'react'; +"use client"; +import React from "react"; +import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; +import { solarizedlight } from "react-syntax-highlighter/dist/esm/styles/prism"; +import { useRef } from "react"; import { Button } from "@/components/ui/button"; -import { ArrowRight } from 'lucide-react'; -import { motion, useAnimationFrame, useMotionTemplate, useMotionValue, useTransform } from 'framer-motion'; +import { ArrowRight } from "lucide-react"; +import { + motion, + useAnimationFrame, + useMotionTemplate, + useMotionValue, + useTransform, +} from "framer-motion"; const codeString = ` import { Integration } from "@botpress/sdk"; @@ -36,7 +42,11 @@ export default function APISection() { {/* Left content */}

- An API for everything + An{" "} + + API + {" "} + for everything

Extend your agents' functionality with our easy-to-use API and SDK. @@ -70,7 +80,7 @@ export default function APISection() { {codeString} @@ -110,11 +120,11 @@ const MovingBorder = ({ const x = useTransform( progress, - (val) => pathRef.current?.getPointAtLength(val).x + (val) => pathRef.current?.getPointAtLength(val).x, ); const y = useTransform( progress, - (val) => pathRef.current?.getPointAtLength(val).y + (val) => pathRef.current?.getPointAtLength(val).y, ); const transform = useMotionTemplate`translateX(${x}px) translateY(${y}px) translateX(-50%) translateY(-50%)`; @@ -145,14 +155,15 @@ const MovingBorder = ({ left: 0, display: "inline-block", transform, - background: 'linear-gradient(90deg, rgba(255,154,158,0) 0%, rgba(255,154,158,1) 50%, rgba(255,154,158,0) 100%)', - width: '150px', // Increase the width for a smoother effect - height: '150px', // Increase the height for a smoother effect - borderRadius: '50%', + background: + "linear-gradient(90deg, rgba(255,154,158,0) 0%, rgba(255,154,158,1) 50%, rgba(255,154,158,0) 100%)", + width: "150px", // Increase the width for a smoother effect + height: "150px", // Increase the height for a smoother effect + borderRadius: "50%", }} > {children} ); -}; \ No newline at end of file +}; diff --git a/src/components/Globe.tsx b/src/components/Globe.tsx index 8210d29..3c03705 100644 --- a/src/components/Globe.tsx +++ b/src/components/Globe.tsx @@ -1,5 +1,5 @@ -import React, { useEffect, useRef } from 'react'; -import * as THREE from 'three'; +import React, { useEffect, useRef } from "react"; +import * as THREE from "three"; const Globe = () => { const mountRef = useRef(null); @@ -8,20 +8,32 @@ const Globe = () => { if (!mountRef.current) return; const scene = new THREE.Scene(); - const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); + const camera = new THREE.PerspectiveCamera( + 75, + window.innerWidth / window.innerHeight, + 0.1, + 1000, + ); const renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setSize(window.innerWidth, window.innerHeight); mountRef.current.appendChild(renderer.domElement); // Create the interior sphere const interiorGeometry = new THREE.SphereGeometry(5, 32, 32); - const interiorMaterial = new THREE.MeshStandardMaterial({ color: 0x0077ff, transparent: true, opacity: 0.6 }); + const interiorMaterial = new THREE.MeshStandardMaterial({ + color: 0x0077ff, + transparent: true, + opacity: 0.6, + }); const interiorSphere = new THREE.Mesh(interiorGeometry, interiorMaterial); scene.add(interiorSphere); // Create the outline sphere const outlineGeometry = new THREE.SphereGeometry(5.1, 32, 32); // Slightly larger for the outline - const outlineMaterial = new THREE.MeshBasicMaterial({ color: 0xc0c0c0, wireframe: true }); + const outlineMaterial = new THREE.MeshBasicMaterial({ + color: 0xc0c0c0, + wireframe: true, + }); const outlineSphere = new THREE.Mesh(outlineGeometry, outlineMaterial); scene.add(outlineSphere); @@ -48,7 +60,7 @@ const Globe = () => { }; }, []); - return

; + return
; }; -export default Globe; \ No newline at end of file +export default Globe; diff --git a/src/components/account/account-data-access.tsx b/src/components/account/account-data-access.tsx index b2a0baf..3f2299a 100644 --- a/src/components/account/account-data-access.tsx +++ b/src/components/account/account-data-access.tsx @@ -1,7 +1,7 @@ -'use client' +"use client"; -import {TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID} from '@solana/spl-token' -import {useConnection, useWallet} from '@solana/wallet-adapter-react' +import { TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID } from "@solana/spl-token"; +import { useConnection, useWallet } from "@solana/wallet-adapter-react"; import { Connection, LAMPORTS_PER_SOL, @@ -10,35 +10,37 @@ import { TransactionMessage, TransactionSignature, VersionedTransaction, -} from '@solana/web3.js' -import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query' -import toast from 'react-hot-toast' -import { useTransactionToast } from '../ui/ui-layout' - +} from "@solana/web3.js"; +import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; +import toast from "react-hot-toast"; +import { useTransactionToast } from "../ui/ui-layout"; export function useGetBalance({ address }: { address: PublicKey }) { - const { connection } = useConnection() + const { connection } = useConnection(); return useQuery({ - queryKey: ['get-balance', { endpoint: connection.rpcEndpoint, address }], + queryKey: ["get-balance", { endpoint: connection.rpcEndpoint, address }], queryFn: () => connection.getBalance(address), - }) + }); } export function useGetSignatures({ address }: { address: PublicKey }) { - const { connection } = useConnection() + const { connection } = useConnection(); return useQuery({ - queryKey: ['get-signatures', { endpoint: connection.rpcEndpoint, address }], + queryKey: ["get-signatures", { endpoint: connection.rpcEndpoint, address }], queryFn: () => connection.getSignaturesForAddress(address), - }) + }); } export function useGetTokenAccounts({ address }: { address: PublicKey }) { - const { connection } = useConnection() + const { connection } = useConnection(); return useQuery({ - queryKey: ['get-token-accounts', { endpoint: connection.rpcEndpoint, address }], + queryKey: [ + "get-token-accounts", + { endpoint: connection.rpcEndpoint, address }, + ], queryFn: async () => { const [tokenAccounts, token2022Accounts] = await Promise.all([ connection.getParsedTokenAccountsByOwner(address, { @@ -47,91 +49,112 @@ export function useGetTokenAccounts({ address }: { address: PublicKey }) { connection.getParsedTokenAccountsByOwner(address, { programId: TOKEN_2022_PROGRAM_ID, }), - ]) - return [...tokenAccounts.value, ...token2022Accounts.value] + ]); + return [...tokenAccounts.value, ...token2022Accounts.value]; }, - }) + }); } export function useTransferSol({ address }: { address: PublicKey }) { - const { connection } = useConnection() - const transactionToast = useTransactionToast() - const wallet = useWallet() - const client = useQueryClient() + const { connection } = useConnection(); + const transactionToast = useTransactionToast(); + const wallet = useWallet(); + const client = useQueryClient(); return useMutation({ - mutationKey: ['transfer-sol', { endpoint: connection.rpcEndpoint, address }], + mutationKey: [ + "transfer-sol", + { endpoint: connection.rpcEndpoint, address }, + ], mutationFn: async (input: { destination: PublicKey; amount: number }) => { - let signature: TransactionSignature = '' + let signature: TransactionSignature = ""; try { const { transaction, latestBlockhash } = await createTransaction({ publicKey: address, destination: input.destination, amount: input.amount, connection, - }) + }); // Send transaction and await for signature - signature = await wallet.sendTransaction(transaction, connection) + signature = await wallet.sendTransaction(transaction, connection); // Send transaction and await for signature - await connection.confirmTransaction({ signature, ...latestBlockhash }, 'confirmed') + await connection.confirmTransaction( + { signature, ...latestBlockhash }, + "confirmed", + ); - console.log(signature) - return signature + console.log(signature); + return signature; } catch (error: unknown) { - console.log('error', `Transaction failed! ${error}`, signature) + console.log("error", `Transaction failed! ${error}`, signature); - return + return; } }, onSuccess: (signature) => { if (signature) { - transactionToast(signature) + transactionToast(signature); } return Promise.all([ client.invalidateQueries({ - queryKey: ['get-balance', { endpoint: connection.rpcEndpoint, address }], + queryKey: [ + "get-balance", + { endpoint: connection.rpcEndpoint, address }, + ], }), client.invalidateQueries({ - queryKey: ['get-signatures', { endpoint: connection.rpcEndpoint, address }], + queryKey: [ + "get-signatures", + { endpoint: connection.rpcEndpoint, address }, + ], }), - ]) + ]); }, onError: (error: unknown) => { - toast.error(`Transaction failed! ${error}`) + toast.error(`Transaction failed! ${error}`); }, - }) + }); } export function useRequestAirdrop({ address }: { address: PublicKey }) { - const { connection } = useConnection() - const transactionToast = useTransactionToast() - const client = useQueryClient() + const { connection } = useConnection(); + const transactionToast = useTransactionToast(); + const client = useQueryClient(); return useMutation({ - mutationKey: ['airdrop', { endpoint: connection.rpcEndpoint, address }], + mutationKey: ["airdrop", { endpoint: connection.rpcEndpoint, address }], mutationFn: async (amount: number = 1) => { const [latestBlockhash, signature] = await Promise.all([ connection.getLatestBlockhash(), connection.requestAirdrop(address, amount * LAMPORTS_PER_SOL), - ]) + ]); - await connection.confirmTransaction({ signature, ...latestBlockhash }, 'confirmed') - return signature + await connection.confirmTransaction( + { signature, ...latestBlockhash }, + "confirmed", + ); + return signature; }, onSuccess: (signature) => { - transactionToast(signature) + transactionToast(signature); return Promise.all([ client.invalidateQueries({ - queryKey: ['get-balance', { endpoint: connection.rpcEndpoint, address }], + queryKey: [ + "get-balance", + { endpoint: connection.rpcEndpoint, address }, + ], }), client.invalidateQueries({ - queryKey: ['get-signatures', { endpoint: connection.rpcEndpoint, address }], + queryKey: [ + "get-signatures", + { endpoint: connection.rpcEndpoint, address }, + ], }), - ]) + ]); }, - }) + }); } async function createTransaction({ @@ -140,16 +163,16 @@ async function createTransaction({ amount, connection, }: { - publicKey: PublicKey - destination: PublicKey - amount: number - connection: Connection + publicKey: PublicKey; + destination: PublicKey; + amount: number; + connection: Connection; }): Promise<{ - transaction: VersionedTransaction - latestBlockhash: { blockhash: string; lastValidBlockHeight: number } + transaction: VersionedTransaction; + latestBlockhash: { blockhash: string; lastValidBlockHeight: number }; }> { // Get the latest blockhash to use in our transaction - const latestBlockhash = await connection.getLatestBlockhash() + const latestBlockhash = await connection.getLatestBlockhash(); // Create instructions to send, in this case a simple transfer const instructions = [ @@ -158,20 +181,20 @@ async function createTransaction({ toPubkey: destination, lamports: amount * LAMPORTS_PER_SOL, }), - ] + ]; // Create a new TransactionMessage with version and compile it to legacy const messageLegacy = new TransactionMessage({ payerKey: publicKey, recentBlockhash: latestBlockhash.blockhash, instructions, - }).compileToLegacyMessage() + }).compileToLegacyMessage(); // Create a new VersionedTransaction which supports legacy and v0 - const transaction = new VersionedTransaction(messageLegacy) + const transaction = new VersionedTransaction(messageLegacy); return { transaction, latestBlockhash, - } + }; } diff --git a/src/components/account/account-detail-feature.tsx b/src/components/account/account-detail-feature.tsx index 113af33..4534c25 100644 --- a/src/components/account/account-detail-feature.tsx +++ b/src/components/account/account-detail-feature.tsx @@ -1,28 +1,33 @@ -'use client' +"use client"; -import { PublicKey } from '@solana/web3.js' -import { useMemo } from 'react' +import { PublicKey } from "@solana/web3.js"; +import { useMemo } from "react"; -import { useParams } from 'next/navigation' +import { useParams } from "next/navigation"; -import { ExplorerLink } from '../cluster/cluster-ui' -import { AppHero, ellipsify } from '../ui/ui-layout' -import { AccountBalance, AccountButtons, AccountTokens, AccountTransactions } from './account-ui' +import { ExplorerLink } from "../cluster/cluster-ui"; +import { AppHero, ellipsify } from "../ui/ui-layout"; +import { + AccountBalance, + AccountButtons, + AccountTokens, + AccountTransactions, +} from "./account-ui"; export default function AccountDetailFeature() { - const params = useParams() + const params = useParams(); const address = useMemo(() => { if (!params.address) { - return + return; } try { - return new PublicKey(params.address) + return new PublicKey(params.address); } catch (e) { - console.log(`Invalid public key`, e) + console.log(`Invalid public key`, e); } - }, [params]) + }, [params]); if (!address) { - return
Error loading account
+ return
Error loading account
; } return ( @@ -31,7 +36,10 @@ export default function AccountDetailFeature() { title={} subtitle={
- +
} > @@ -44,5 +52,5 @@ export default function AccountDetailFeature() {
- ) + ); } diff --git a/src/components/account/account-list-feature.tsx b/src/components/account/account-list-feature.tsx index 3443c76..0b915a4 100644 --- a/src/components/account/account-list-feature.tsx +++ b/src/components/account/account-list-feature.tsx @@ -1,15 +1,15 @@ -'use client' +"use client"; -import { useWallet } from '@solana/wallet-adapter-react' +import { useWallet } from "@solana/wallet-adapter-react"; -import { redirect } from 'next/navigation' -import { WalletButton } from '../solana/solana-provider' +import { redirect } from "next/navigation"; +import { WalletButton } from "../solana/solana-provider"; export default function AccountListFeature() { - const { publicKey } = useWallet() + const { publicKey } = useWallet(); if (publicKey) { - return redirect(`/account/${publicKey.toString()}`) + return redirect(`/account/${publicKey.toString()}`); } return ( @@ -18,5 +18,5 @@ export default function AccountListFeature() {
- ) + ); } diff --git a/src/components/account/account-ui.tsx b/src/components/account/account-ui.tsx index 70d7d93..b0bcaca 100644 --- a/src/components/account/account-ui.tsx +++ b/src/components/account/account-ui.tsx @@ -1,80 +1,98 @@ -'use client' +"use client"; -import { useWallet } from '@solana/wallet-adapter-react' -import { LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js' -import { IconRefresh } from '@tabler/icons-react' -import { useQueryClient } from '@tanstack/react-query' -import { useMemo, useState } from 'react' -import { AppModal, ellipsify } from '../ui/ui-layout' -import { useCluster } from '../cluster/cluster-data-access' -import { ExplorerLink } from '../cluster/cluster-ui' +import { useWallet } from "@solana/wallet-adapter-react"; +import { LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js"; +import { IconRefresh } from "@tabler/icons-react"; +import { useQueryClient } from "@tanstack/react-query"; +import { useMemo, useState } from "react"; +import { AppModal, ellipsify } from "../ui/ui-layout"; +import { useCluster } from "../cluster/cluster-data-access"; +import { ExplorerLink } from "../cluster/cluster-ui"; import { useGetBalance, useGetSignatures, useGetTokenAccounts, useRequestAirdrop, useTransferSol, -} from './account-data-access' +} from "./account-data-access"; export function AccountBalance({ address }: { address: PublicKey }) { - const query = useGetBalance({ address }) + const query = useGetBalance({ address }); return (
-

query.refetch()}> - {query.data ? : '...'} SOL +

query.refetch()} + > + {query.data ? : "..."} SOL

- ) + ); } export function AccountChecker() { - const { publicKey } = useWallet() + const { publicKey } = useWallet(); if (!publicKey) { - return null + return null; } - return + return ; } export function AccountBalanceCheck({ address }: { address: PublicKey }) { - const { cluster } = useCluster() - const mutation = useRequestAirdrop({ address }) - const query = useGetBalance({ address }) + const { cluster } = useCluster(); + const mutation = useRequestAirdrop({ address }); + const query = useGetBalance({ address }); if (query.isLoading) { - return null + return null; } if (query.isError || !query.data) { return (
- You are connected to {cluster.name} but your account is not found on this cluster. + You are connected to {cluster.name} but your account + is not found on this cluster.
- ) + ); } - return null + return null; } export function AccountButtons({ address }: { address: PublicKey }) { - const wallet = useWallet() - const { cluster } = useCluster() - const [showAirdropModal, setShowAirdropModal] = useState(false) - const [showReceiveModal, setShowReceiveModal] = useState(false) - const [showSendModal, setShowSendModal] = useState(false) + const wallet = useWallet(); + const { cluster } = useCluster(); + const [showAirdropModal, setShowAirdropModal] = useState(false); + const [showReceiveModal, setShowReceiveModal] = useState(false); + const [showSendModal, setShowSendModal] = useState(false); return (
- setShowAirdropModal(false)} address={address} show={showAirdropModal} /> - setShowReceiveModal(false)} /> - setShowSendModal(false)} /> + setShowAirdropModal(false)} + address={address} + show={showAirdropModal} + /> + setShowReceiveModal(false)} + /> + setShowSendModal(false)} + />
-
- ) + ); } export function AccountTokens({ address }: { address: PublicKey }) { - const [showAll, setShowAll] = useState(false) - const query = useGetTokenAccounts({ address }) - const client = useQueryClient() + const [showAll, setShowAll] = useState(false); + const query = useGetTokenAccounts({ address }); + const client = useQueryClient(); const items = useMemo(() => { - if (showAll) return query.data - return query.data?.slice(0, 5) - }, [query.data, showAll]) + if (showAll) return query.data; + return query.data?.slice(0, 5); + }, [query.data, showAll]); return (
@@ -116,10 +137,10 @@ export function AccountTokens({ address }: { address: PublicKey }) {
- {query.isError &&
Error: {query.error?.message.toString()}
} + {query.isError && ( +
+          Error: {query.error?.message.toString()}
+        
+ )} {query.isSuccess && (
{query.data.length === 0 ? ( @@ -148,7 +173,10 @@ export function AccountTokens({ address }: { address: PublicKey }) {
- +
@@ -163,7 +191,9 @@ export function AccountTokens({ address }: { address: PublicKey }) {
- {account.data.parsed.info.tokenAmount.uiAmount} + + {account.data.parsed.info.tokenAmount.uiAmount} + ))} @@ -171,8 +201,11 @@ export function AccountTokens({ address }: { address: PublicKey }) { {(query.data?.length ?? 0) > 5 && ( - @@ -183,17 +216,17 @@ export function AccountTokens({ address }: { address: PublicKey }) {
)}
- ) + ); } export function AccountTransactions({ address }: { address: PublicKey }) { - const query = useGetSignatures({ address }) - const [showAll, setShowAll] = useState(false) + const query = useGetSignatures({ address }); + const [showAll, setShowAll] = useState(false); const items = useMemo(() => { - if (showAll) return query.data - return query.data?.slice(0, 5) - }, [query.data, showAll]) + if (showAll) return query.data; + return query.data?.slice(0, 5); + }, [query.data, showAll]); return (
@@ -203,13 +236,20 @@ export function AccountTransactions({ address }: { address: PublicKey }) { {query.isLoading ? ( ) : ( - )}
- {query.isError &&
Error: {query.error?.message.toString()}
} + {query.isError && ( +
+          Error: {query.error?.message.toString()}
+        
+ )} {query.isSuccess && (
{query.data.length === 0 ? ( @@ -228,15 +268,26 @@ export function AccountTransactions({ address }: { address: PublicKey }) { {items?.map((item) => ( - + - + + + + {new Date((item.blockTime ?? 0) * 1000).toISOString()} - {new Date((item.blockTime ?? 0) * 1000).toISOString()} {item.err ? ( -
+
Failed
) : ( @@ -248,8 +299,11 @@ export function AccountTransactions({ address }: { address: PublicKey }) { {(query.data?.length ?? 0) > 5 && ( - @@ -260,25 +314,43 @@ export function AccountTransactions({ address }: { address: PublicKey }) {
)}
- ) + ); } function BalanceSol({ balance }: { balance: number }) { - return {Math.round((balance / LAMPORTS_PER_SOL) * 100000) / 100000} + return ( + {Math.round((balance / LAMPORTS_PER_SOL) * 100000) / 100000} + ); } -function ModalReceive({ hide, show, address }: { hide: () => void; show: boolean; address: PublicKey }) { +function ModalReceive({ + hide, + show, + address, +}: { + hide: () => void; + show: boolean; + address: PublicKey; +}) { return (

Receive assets by sending them to your public key:

{address.toString()}
- ) + ); } -function ModalAirdrop({ hide, show, address }: { hide: () => void; show: boolean; address: PublicKey }) { - const mutation = useRequestAirdrop({ address }) - const [amount, setAmount] = useState('2') +function ModalAirdrop({ + hide, + show, + address, +}: { + hide: () => void; + show: boolean; + address: PublicKey; +}) { + const mutation = useRequestAirdrop({ address }); + const [amount, setAmount] = useState("2"); return ( void; show: boolean onChange={(e) => setAmount(e.target.value)} /> - ) + ); } -function ModalSend({ hide, show, address }: { hide: () => void; show: boolean; address: PublicKey }) { - const wallet = useWallet() - const mutation = useTransferSol({ address }) - const [destination, setDestination] = useState('') - const [amount, setAmount] = useState('1') +function ModalSend({ + hide, + show, + address, +}: { + hide: () => void; + show: boolean; + address: PublicKey; +}) { + const wallet = useWallet(); + const mutation = useTransferSol({ address }); + const [destination, setDestination] = useState(""); + const [amount, setAmount] = useState("1"); if (!address || !wallet.sendTransaction) { - return
Wallet not connected
+ return
Wallet not connected
; } return ( @@ -326,7 +406,7 @@ function ModalSend({ hide, show, address }: { hide: () => void; show: boolean; a destination: new PublicKey(destination), amount: parseFloat(amount), }) - .then(() => hide()) + .then(() => hide()); }} > void; show: boolean; a onChange={(e) => setAmount(e.target.value)} /> - ) + ); } diff --git a/src/components/cluster/cluster-data-access.tsx b/src/components/cluster/cluster-data-access.tsx index 6d9aa87..41ac31f 100644 --- a/src/components/cluster/cluster-data-access.tsx +++ b/src/components/cluster/cluster-data-access.tsx @@ -1,23 +1,23 @@ -'use client' +"use client"; -import { clusterApiUrl, Connection } from '@solana/web3.js' -import { atom, useAtomValue, useSetAtom } from 'jotai' -import { atomWithStorage } from 'jotai/utils' -import { createContext, ReactNode, useContext } from 'react' -import toast from 'react-hot-toast' +import { clusterApiUrl, Connection } from "@solana/web3.js"; +import { atom, useAtomValue, useSetAtom } from "jotai"; +import { atomWithStorage } from "jotai/utils"; +import { createContext, ReactNode, useContext } from "react"; +import toast from "react-hot-toast"; export interface Cluster { - name: string - endpoint: string - network?: ClusterNetwork - active?: boolean + name: string; + endpoint: string; + network?: ClusterNetwork; + active?: boolean; } export enum ClusterNetwork { - Mainnet = 'mainnet-beta', - Testnet = 'testnet', - Devnet = 'devnet', - Custom = 'custom', + Mainnet = "mainnet-beta", + Testnet = "testnet", + Devnet = "devnet", + Custom = "custom", } // By default, we don't configure the mainnet-beta cluster @@ -25,93 +25,102 @@ export enum ClusterNetwork { // To use the mainnet-beta cluster, provide a custom endpoint export const defaultClusters: Cluster[] = [ { - name: 'devnet', - endpoint: clusterApiUrl('devnet'), + name: "devnet", + endpoint: clusterApiUrl("devnet"), network: ClusterNetwork.Devnet, }, - { name: 'local', endpoint: 'http://localhost:8899' }, + { name: "local", endpoint: "http://localhost:8899" }, { - name: 'testnet', - endpoint: clusterApiUrl('testnet'), + name: "testnet", + endpoint: clusterApiUrl("testnet"), network: ClusterNetwork.Testnet, }, -] +]; -const clusterAtom = atomWithStorage('solana-cluster', defaultClusters[0]) -const clustersAtom = atomWithStorage('solana-clusters', defaultClusters) +const clusterAtom = atomWithStorage( + "solana-cluster", + defaultClusters[0], +); +const clustersAtom = atomWithStorage( + "solana-clusters", + defaultClusters, +); const activeClustersAtom = atom((get) => { - const clusters = get(clustersAtom) - const cluster = get(clusterAtom) + const clusters = get(clustersAtom); + const cluster = get(clusterAtom); return clusters.map((item) => ({ ...item, active: item.name === cluster.name, - })) -}) + })); +}); const activeClusterAtom = atom((get) => { - const clusters = get(activeClustersAtom) + const clusters = get(activeClustersAtom); - return clusters.find((item) => item.active) || clusters[0] -}) + return clusters.find((item) => item.active) || clusters[0]; +}); export interface ClusterProviderContext { - cluster: Cluster - clusters: Cluster[] - addCluster: (cluster: Cluster) => void - deleteCluster: (cluster: Cluster) => void - setCluster: (cluster: Cluster) => void - getExplorerUrl(path: string): string + cluster: Cluster; + clusters: Cluster[]; + addCluster: (cluster: Cluster) => void; + deleteCluster: (cluster: Cluster) => void; + setCluster: (cluster: Cluster) => void; + getExplorerUrl(path: string): string; } -const Context = createContext({} as ClusterProviderContext) +const Context = createContext( + {} as ClusterProviderContext, +); export function ClusterProvider({ children }: { children: ReactNode }) { - const cluster = useAtomValue(activeClusterAtom) - const clusters = useAtomValue(activeClustersAtom) - const setCluster = useSetAtom(clusterAtom) - const setClusters = useSetAtom(clustersAtom) + const cluster = useAtomValue(activeClusterAtom); + const clusters = useAtomValue(activeClustersAtom); + const setCluster = useSetAtom(clusterAtom); + const setClusters = useSetAtom(clustersAtom); const value: ClusterProviderContext = { cluster, clusters: clusters.sort((a, b) => (a.name > b.name ? 1 : -1)), addCluster: (cluster: Cluster) => { try { - new Connection(cluster.endpoint) - setClusters([...clusters, cluster]) + new Connection(cluster.endpoint); + setClusters([...clusters, cluster]); } catch (err) { - toast.error(`${err}`) + toast.error(`${err}`); } }, deleteCluster: (cluster: Cluster) => { - setClusters(clusters.filter((item) => item.name !== cluster.name)) + setClusters(clusters.filter((item) => item.name !== cluster.name)); }, setCluster: (cluster: Cluster) => setCluster(cluster), - getExplorerUrl: (path: string) => `https://explorer.solana.com/${path}${getClusterUrlParam(cluster)}`, - } - return {children} + getExplorerUrl: (path: string) => + `https://explorer.solana.com/${path}${getClusterUrlParam(cluster)}`, + }; + return {children}; } export function useCluster() { - return useContext(Context) + return useContext(Context); } function getClusterUrlParam(cluster: Cluster): string { - let suffix = '' + let suffix = ""; switch (cluster.network) { case ClusterNetwork.Devnet: - suffix = 'devnet' - break + suffix = "devnet"; + break; case ClusterNetwork.Mainnet: - suffix = '' - break + suffix = ""; + break; case ClusterNetwork.Testnet: - suffix = 'testnet' - break + suffix = "testnet"; + break; default: - suffix = `custom&customUrl=${encodeURIComponent(cluster.endpoint)}` - break + suffix = `custom&customUrl=${encodeURIComponent(cluster.endpoint)}`; + break; } - return suffix.length ? `?cluster=${suffix}` : '' + return suffix.length ? `?cluster=${suffix}` : ""; } diff --git a/src/components/cluster/cluster-feature.tsx b/src/components/cluster/cluster-feature.tsx index 3ccf3b8..7ec2574 100644 --- a/src/components/cluster/cluster-feature.tsx +++ b/src/components/cluster/cluster-feature.tsx @@ -1,22 +1,31 @@ -'use client' +"use client"; -import { useState } from 'react' -import { AppHero } from '../ui/ui-layout' -import { ClusterUiModal } from './cluster-ui' -import { ClusterUiTable } from './cluster-ui' +import { useState } from "react"; +import { AppHero } from "../ui/ui-layout"; +import { ClusterUiModal } from "./cluster-ui"; +import { ClusterUiTable } from "./cluster-ui"; export default function ClusterFeature() { - const [showModal, setShowModal] = useState(false) + const [showModal, setShowModal] = useState(false); return (
- - setShowModal(false)} /> -
- ) + ); } diff --git a/src/components/cluster/cluster-ui.tsx b/src/components/cluster/cluster-ui.tsx index c1f4812..5943a52 100644 --- a/src/components/cluster/cluster-ui.tsx +++ b/src/components/cluster/cluster-ui.tsx @@ -1,15 +1,23 @@ -'use client' +"use client"; -import { useConnection } from '@solana/wallet-adapter-react' -import { IconTrash } from '@tabler/icons-react' -import { useQuery } from '@tanstack/react-query' -import { ReactNode, useState } from 'react' -import { AppModal } from '../ui/ui-layout' -import { ClusterNetwork, useCluster } from './cluster-data-access' -import { Connection } from '@solana/web3.js' +import { useConnection } from "@solana/wallet-adapter-react"; +import { IconTrash } from "@tabler/icons-react"; +import { useQuery } from "@tanstack/react-query"; +import { ReactNode, useState } from "react"; +import { AppModal } from "../ui/ui-layout"; +import { ClusterNetwork, useCluster } from "./cluster-data-access"; +import { Connection } from "@solana/web3.js"; -export function ExplorerLink({ path, label, className }: { path: string; label: string; className?: string }) { - const { getExplorerUrl } = useCluster() +export function ExplorerLink({ + path, + label, + className, +}: { + path: string; + label: string; + className?: string; +}) { + const { getExplorerUrl } = useCluster(); return ( {label} - ) + ); } export function ClusterChecker({ children }: { children: ReactNode }) { - const { cluster } = useCluster() - const { connection } = useConnection() + const { cluster } = useCluster(); + const { connection } = useConnection(); const query = useQuery({ - queryKey: ['version', { cluster, endpoint: connection.rpcEndpoint }], + queryKey: ["version", { cluster, endpoint: connection.rpcEndpoint }], queryFn: () => connection.getVersion(), retry: 1, - }) + }); if (query.isLoading) { - return null + return null; } if (query.isError || !query.data) { return ( @@ -40,27 +48,33 @@ export function ClusterChecker({ children }: { children: ReactNode }) { Error connecting to cluster {cluster.name} -
- ) + ); } - return children + return children; } export function ClusterUiSelect() { - const { clusters, setCluster, cluster } = useCluster() + const { clusters, setCluster, cluster } = useCluster(); return (
-
    +
      {clusters.map((item) => (
- ) + ); } -export function ClusterUiModal({ hideModal, show }: { hideModal: () => void; show: boolean }) { - const { addCluster } = useCluster() - const [name, setName] = useState('') - const [network, setNetwork] = useState() - const [endpoint, setEndpoint] = useState('') +export function ClusterUiModal({ + hideModal, + show, +}: { + hideModal: () => void; + show: boolean; +}) { + const { addCluster } = useCluster(); + const [name, setName] = useState(""); + const [network, setNetwork] = useState(); + const [endpoint, setEndpoint] = useState(""); return ( { try { - new Connection(endpoint) + new Connection(endpoint); if (name) { - addCluster({ name, network, endpoint }) - hideModal() + addCluster({ name, network, endpoint }); + hideModal(); } else { - console.log('Invalid cluster name') + console.log("Invalid cluster name"); } } catch { - console.log('Invalid cluster endpoint') + console.log("Invalid cluster endpoint"); } }} submitLabel="Save" @@ -123,11 +143,11 @@ export function ClusterUiModal({ hideModal, show }: { hideModal: () => void; sho - ) + ); } export function ClusterUiTable() { - const { clusters, setCluster, deleteCluster } = useCluster() + const { clusters, setCluster, deleteCluster } = useCluster(); return (
@@ -139,29 +159,37 @@ export function ClusterUiTable() { {clusters.map((item) => ( - +
{item?.active ? ( item.name ) : ( - )}
- Network: {item.network ?? 'custom'} -
{item.endpoint}
+ + Network: {item.network ?? "custom"} + +
+ {item.endpoint} +
- ) + ); } diff --git a/src/components/creator-login.tsx b/src/components/creator-login.tsx index 433d6f9..63cf065 100644 --- a/src/components/creator-login.tsx +++ b/src/components/creator-login.tsx @@ -1,27 +1,36 @@ -"use client" +"use client"; -import { useState } from "react" -import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" -import { Input } from "@/components/ui/input" -import { Label } from "@/components/ui/label" -import { Button } from "@/components/ui/button" -import { Wallet, Lock } from "lucide-react" +import { useState } from "react"; +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Button } from "@/components/ui/button"; +import { Wallet, Lock } from "lucide-react"; export function CreatorLoginComponent() { - const [solAddress, setSolAddress] = useState("''") - const [password, setPassword] = useState("''") + const [solAddress, setSolAddress] = useState("''"); + const [password, setPassword] = useState("''"); const handleSubmit = (e: React.FormEvent) => { - e.preventDefault() + e.preventDefault(); // Here you would typically handle the login logic - console.log("'Login attempted with:'", { solAddress, password }) - } + console.log("'Login attempted with:'", { solAddress, password }); + }; return (
- Creator Login + + Creator Login + Enter your SOL address and password to access your creator dashboard @@ -29,9 +38,14 @@ export function CreatorLoginComponent() {
- +
- +
- + - ) -} \ No newline at end of file + ); +} diff --git a/src/components/custom-toggle.tsx b/src/components/custom-toggle.tsx index b712651..b4d7581 100644 --- a/src/components/custom-toggle.tsx +++ b/src/components/custom-toggle.tsx @@ -1,36 +1,38 @@ -'use client' +"use client"; // import { ArrowRightIcon } from "lucide-react" -import React, { useState } from "react" -import { useRouter } from 'next/navigation'; +import React, { useState } from "react"; +import { useRouter } from "next/navigation"; interface ToggleProps { - options?: [string, string] - onChange?: (selectedOption: string) => void + options?: [string, string]; + onChange?: (selectedOption: string) => void; } -export default function CustomToggle({ options = ["User", "Creator"], onChange }: ToggleProps) { +export default function CustomToggle({ + options = ["User", "Creator"], + onChange, +}: ToggleProps) { const [activeOption, setActiveOption] = useState(options[0]); const router = useRouter(); const handleToggle = (option: string) => { - setActiveOption(option) - console.log(option) - console.log(activeOption) + setActiveOption(option); + console.log(option); + console.log(activeOption); if (onChange) { - onChange(option) + onChange(option); } - + console.log(activeOption); // Navigate to the dashboard if (option === "User") { - router.push('/dashboard'); - } else if(option === "Creator") { - router.push('/creatordashboard'); + router.push("/dashboard"); + } else if (option === "Creator") { + router.push("/creatordashboard"); } - } - + }; return ( // Here is the custom toggle component @@ -46,12 +48,12 @@ export default function CustomToggle({ options = ["User", "Creator"], onChange } @@ -62,5 +64,5 @@ export default function CustomToggle({ options = ["User", "Creator"], onChange }
- ) -} \ No newline at end of file + ); +} diff --git a/src/components/dashboard/dashboard-feature.tsx b/src/components/dashboard/dashboard-feature.tsx index df8e7bc..9001fd7 100644 --- a/src/components/dashboard/dashboard-feature.tsx +++ b/src/components/dashboard/dashboard-feature.tsx @@ -1,14 +1,17 @@ -'use client' +"use client"; -import { AppHero } from '../ui/ui-layout' +import { AppHero } from "../ui/ui-layout"; const links: { label: string; href: string }[] = [ - { label: 'Solana Docs', href: 'https://docs.solana.com/' }, - { label: 'Solana Faucet', href: 'https://faucet.solana.com/' }, - { label: 'Solana Cookbook', href: 'https://solanacookbook.com/' }, - { label: 'Solana Stack Overflow', href: 'https://solana.stackexchange.com/' }, - { label: 'Solana Developers GitHub', href: 'https://github.com/solana-developers/' }, -] + { label: "Solana Docs", href: "https://docs.solana.com/" }, + { label: "Solana Faucet", href: "https://faucet.solana.com/" }, + { label: "Solana Cookbook", href: "https://solanacookbook.com/" }, + { label: "Solana Stack Overflow", href: "https://solana.stackexchange.com/" }, + { + label: "Solana Developers GitHub", + href: "https://github.com/solana-developers/", + }, +]; export default function DashboardFeature() { return ( @@ -19,7 +22,12 @@ export default function DashboardFeature() {

Here are some helpful links to get you started.

{links.map((link, index) => ( @@ -27,5 +35,5 @@ export default function DashboardFeature() {
- ) + ); } diff --git a/src/components/dashh/dashh-data-access.tsx b/src/components/dashh/dashh-data-access.tsx index 1794f60..cd15164 100644 --- a/src/components/dashh/dashh-data-access.tsx +++ b/src/components/dashh/dashh-data-access.tsx @@ -1,121 +1,130 @@ -'use client' -import * as anchor from '@coral-xyz/anchor' - -import { clusterApiUrl, Connection, PublicKey} from '@solana/web3.js' -import {useMutation, useQuery} from '@tanstack/react-query' - -import toast from 'react-hot-toast' - -import {useAnchorProvider} from '../solana/solana-provider' -import { useTransactionToast } from '../ui/ui-layout' -import { getDashhProgram } from '../../../anchor/src' -import Error from 'next/error' -import { v4 as uuidv4 } from 'uuid'; - -interface CampaignArgs{ - id: number, - title: string, - image: string, - description: string, - lable: string, - endtime: number, - reward: number, - owner: PublicKey, +"use client"; +import * as anchor from "@coral-xyz/anchor"; + +import { clusterApiUrl, Connection, PublicKey } from "@solana/web3.js"; +import { useMutation, useQuery } from "@tanstack/react-query"; + +import toast from "react-hot-toast"; + +import { useAnchorProvider } from "../solana/solana-provider"; +import { useTransactionToast } from "../ui/ui-layout"; +import { getDashhProgram } from "../../../anchor/src"; +import Error from "next/error"; +import { v4 as uuidv4 } from "uuid"; + +interface CampaignArgs { + id: number; + title: string; + image: string; + description: string; + lable: string; + endtime: number; + reward: number; + owner: PublicKey; } -interface participantargs{ - id: number, - user: PublicKey, - points: number, +interface participantargs { + id: number; + user: PublicKey; + points: number; } export function useDashhProgram() { - const connection = new Connection(clusterApiUrl("devnet"), "confirmed"); - const transactionToast = useTransactionToast() - const provider = useAnchorProvider() - const programId = "Gdh4Jq1DY5t47vVVVGeK2Zx3EyeDm9L923bRfSWQ2aDJ" - const program = getDashhProgram(provider) - - const accounts = useQuery({ - queryKey: ['dashh', 'all', 'devnet'], + const transactionToast = useTransactionToast(); + const provider = useAnchorProvider(); + const programId = "Gdh4Jq1DY5t47vVVVGeK2Zx3EyeDm9L923bRfSWQ2aDJ"; + const program = getDashhProgram(provider); + + const accounts = useQuery({ + queryKey: ["dashh", "all", "devnet"], queryFn: () => program.account.campaign.all(), - }) + }); const paccounts = useQuery({ - queryKey: ['dashh-p', 'all', 'devnet'], + queryKey: ["dashh-p", "all", "devnet"], queryFn: () => program.account.participent.all(), - }) + }); const getProgramAccount = useQuery({ - queryKey: ['get-program-account', 'devnet'], + queryKey: ["get-program-account", "devnet"], queryFn: () => connection.getParsedAccountInfo(new PublicKey(programId)), - }) + }); const createCampaign = useMutation({ - mutationKey: ['create-campaign', 'create', 'devnet'], - mutationFn: async ({ title, description, image, lable, endtime, reward }) => { - const id = new anchor.BN(uuidv4().split('-').join('').slice(0, 8), 16); + mutationKey: ["create-campaign", "create", "devnet"], + mutationFn: async ({ + title, + description, + image, + lable, + endtime, + reward, + }) => { + const id = new anchor.BN(uuidv4().split("-").join("").slice(0, 8), 16); const endtimeAsU64 = new anchor.BN(endtime); const rewardAsU64 = new anchor.BN(reward); - + try { - return program.methods - .createCampaign(id, title, description, image, lable, endtimeAsU64, rewardAsU64) - + .createCampaign( + id, + title, + description, + image, + lable, + endtimeAsU64, + rewardAsU64, + ) + .rpc(); } catch (error) { - console.error('Error creating campaign:', error); + console.error("Error creating campaign:", error); throw error; } }, onSuccess: (signature) => { transactionToast(signature); - toast.success('Campaign created successfully'); + toast.success("Campaign created successfully"); accounts.refetch(); }, onError: (error) => { - toast.error('Failed to create campaign'); - console.error('Error:', error); + toast.error("Failed to create campaign"); + console.error("Error:", error); }, }); - const createParticipant = useMutation({ - mutationKey:['create-Participant',`create`,'devnet'], - mutationFn: async ({id,user}) => { - return program.methods.createParticipent( - new anchor.BN( id,16), - user - ).rpc(); + const createParticipant = useMutation({ + mutationKey: ["create-Participant", `create`, "devnet"], + mutationFn: async ({ id, user }) => { + return program.methods + .createParticipent(new anchor.BN(id, 16), user) + .rpc(); }, onSuccess: (signature) => { transactionToast(signature); - toast.success('participated created successfully') - accounts.refetch() + toast.success("participated created successfully"); + accounts.refetch(); }, onError: (error) => { - toast.error(`Error creating campaign: ${error}`) - } - }) - const updateParticipant = useMutation({ - mutationKey:['update-Participant',`update`,'devnet'], - mutationFn: async ({id,user,points}) => { - return program.methods.updatedParticipent( - new anchor.BN( id), - user, -new anchor.BN (points) - ).rpc(); + toast.error(`Error creating campaign: ${error}`); + }, + }); + const updateParticipant = useMutation({ + mutationKey: ["update-Participant", `update`, "devnet"], + mutationFn: async ({ id, user, points }) => { + return program.methods + .updatedParticipent(new anchor.BN(id), user, new anchor.BN(points)) + .rpc(); }, onSuccess: (Signature) => { transactionToast(Signature); - toast.success('points update successfully') - accounts.refetch() + toast.success("points update successfully"); + accounts.refetch(); }, onError: (error) => { - toast.error(`Error creating campaign: ${error}`) - } - - }) + toast.error(`Error creating campaign: ${error}`); + }, + }); return { program, @@ -125,8 +134,8 @@ new anchor.BN (points) createCampaign, createParticipant, updateParticipant, - paccounts - } + paccounts, + }; } // export function getParicipatedData({id}:{id:number}){ @@ -142,41 +151,39 @@ new anchor.BN (points) // } // } -export function useDashhProgramAccount({ account }: { account: PublicKey }) { +export function useDashhProgramAccount({ account }: { account: PublicKey }) { // const { cluster } = useCluster() - const transactionToast = useTransactionToast() - const { program, accounts } = useDashhProgram() + const transactionToast = useTransactionToast(); + const { program, accounts } = useDashhProgram(); const accountQuery = useQuery({ - queryKey: ['dashh', 'fetch', { cluster:'devnet', account: account.toBase58() }], + queryKey: [ + "dashh", + "fetch", + { cluster: "devnet", account: account.toBase58() }, + ], queryFn: () => program.account.campaign.fetch(account), - }) - - - - const updateParticipant = useMutation({ - mutationKey:['update-Participant',`update`,'devnet'], - mutationFn: async ({id,user,points}) => { - return program.methods.updatedParticipent( - new anchor.BN( id), - user, -new anchor.BN (points) - ).rpc(); + }); + + const updateParticipant = useMutation({ + mutationKey: ["update-Participant", `update`, "devnet"], + mutationFn: async ({ id, user, points }) => { + return program.methods + .updatedParticipent(new anchor.BN(id), user, new anchor.BN(points)) + .rpc(); }, onSuccess: (Signature) => { transactionToast(Signature); - toast.success('points update successfully') - accounts.refetch() + toast.success("points update successfully"); + accounts.refetch(); }, onError: (error) => { - toast.error(`Error creating campaign: ${error}`) - } - - }) + toast.error(`Error creating campaign: ${error}`); + }, + }); return { accountQuery, updateParticipant, - - } + }; } diff --git a/src/components/dashh/dashh-feature.tsx b/src/components/dashh/dashh-feature.tsx index 5dad64c..69682bd 100644 --- a/src/components/dashh/dashh-feature.tsx +++ b/src/components/dashh/dashh-feature.tsx @@ -1,15 +1,14 @@ -'use client' - -import { useWallet } from '@solana/wallet-adapter-react' -import { WalletButton } from '../solana/solana-provider' -import { AppHero, ellipsify } from '../ui/ui-layout' -import { ExplorerLink } from '../cluster/cluster-ui' -import { useDashhProgram } from './dashh-data-access' +"use client"; +import { useWallet } from "@solana/wallet-adapter-react"; +import { WalletButton } from "../solana/solana-provider"; +import { AppHero, ellipsify } from "../ui/ui-layout"; +import { ExplorerLink } from "../cluster/cluster-ui"; +import { useDashhProgram } from "./dashh-data-access"; export default function DashhFeature() { - const { publicKey } = useWallet() - const { programId } = useDashhProgram() + const { publicKey } = useWallet(); + const { programId } = useDashhProgram(); return publicKey ? (
@@ -20,10 +19,12 @@ export default function DashhFeature() { } >

- +

-
) : (
@@ -33,5 +34,5 @@ export default function DashhFeature() {
- ) + ); } diff --git a/src/components/demo2.tsx b/src/components/demo2.tsx index 301b127..9385040 100644 --- a/src/components/demo2.tsx +++ b/src/components/demo2.tsx @@ -1,4 +1,4 @@ -import TiltCard from './tilt-card2' +import TiltCard from "./tilt-card2"; export default function Demo() { return ( @@ -16,6 +16,5 @@ export default function Demo() { /> */} - ) + ); } - diff --git a/src/components/dynamic-full-screen-leaderboard.tsx b/src/components/dynamic-full-screen-leaderboard.tsx index f73960d..bf85660 100644 --- a/src/components/dynamic-full-screen-leaderboard.tsx +++ b/src/components/dynamic-full-screen-leaderboard.tsx @@ -1,21 +1,39 @@ -'use client' +"use client"; -import Image from "next/image" -import { Clock, Trophy } from "lucide-react" +import Image from "next/image"; +import { Clock, Trophy } from "lucide-react"; interface Player { - id: number - name: string - avatar: string - pointsToEarn: number - prize: number + id: number; + name: string; + avatar: string; + pointsToEarn: number; + prize: number; } const topPlayers: Player[] = [ - { id: 2, name: "Skulldugger", avatar: "/placeholder.svg?height=64&width=64", pointsToEarn: 500, prize: 5000 }, - { id: 1, name: "Klaxxon", avatar: "/placeholder.svg?height=80&width=80", pointsToEarn: 1500, prize: 10000 }, - { id: 3, name: "Ultralex", avatar: "/placeholder.svg?height=64&width=64", pointsToEarn: 250, prize: 2500 }, -] + { + id: 2, + name: "Skulldugger", + avatar: "/placeholder.svg?height=64&width=64", + pointsToEarn: 500, + prize: 5000, + }, + { + id: 1, + name: "Klaxxon", + avatar: "/placeholder.svg?height=80&width=80", + pointsToEarn: 1500, + prize: 10000, + }, + { + id: 3, + name: "Ultralex", + avatar: "/placeholder.svg?height=64&width=64", + pointsToEarn: 250, + prize: 2500, + }, +]; // worked on the leader board functionality export function DynamicFullScreenLeaderboard() { return ( @@ -23,23 +41,31 @@ export function DynamicFullScreenLeaderboard() {
{/* Top 3 Players */} - {topPlayers.sort((a, b) => b.prize - a.prize).map((player, index) => ( -
-
- {player.name} + {topPlayers + .sort((a, b) => b.prize - a.prize) + .map((player, index) => ( +
+
+ {player.name} +
+

{player.name}

+
+ Earn {player.pointsToEarn} points +
+
+ {player.prize.toLocaleString()} +
+
Prize
-

{player.name}

-
Earn {player.pointsToEarn} points
-
{player.prize.toLocaleString()}
-
Prize
-
- ))} + ))}
{/* Countdown Timer */} @@ -55,7 +81,10 @@ export function DynamicFullScreenLeaderboard() {
You earned 50 - today and are ranked - out of 13868 users + + {" "} + today and are ranked - out of 13868 users +
{/* Leaderboard Table */} @@ -86,5 +115,5 @@ export function DynamicFullScreenLeaderboard() {
- ) -} \ No newline at end of file + ); +} diff --git a/src/components/footer.tsx b/src/components/footer.tsx index 2a1d646..8357f5e 100644 --- a/src/components/footer.tsx +++ b/src/components/footer.tsx @@ -6,29 +6,95 @@ export default function Footer() { return (
- DASHH + DASHH
); -} \ No newline at end of file +} diff --git a/src/components/fully-black-theme-dashboard.tsx b/src/components/fully-black-theme-dashboard.tsx index c93e9de..2183bd6 100644 --- a/src/components/fully-black-theme-dashboard.tsx +++ b/src/components/fully-black-theme-dashboard.tsx @@ -87,4 +87,4 @@ // // // ) -// } \ No newline at end of file +// } diff --git a/src/components/header.tsx b/src/components/header.tsx index 0be9de4..411da5d 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -1,54 +1,65 @@ -'use client' +"use client"; -import { useEffect, useState } from "react" - -import CustomToggle from "./custom-toggle" -import Link from "next/link" -import Image from "next/image" -import logo from "../images/whiteDASHH.png" -import { useRouter } from "next/navigation" -import { useAnchorProvider, WalletButton } from "./solana/solana-provider" +import { useState } from "react"; +import CustomToggle from "./custom-toggle"; +import Link from "next/link"; +import Image from "next/image"; +import logo from "../images/whiteDASHH.png"; +import { useAnchorProvider, WalletButton } from "./solana/solana-provider"; const Header = () => { - const [selectedOption, setSelectedOption] = useState(''); - const router = useRouter() - const provider = useAnchorProvider() - // useEffect(() => { - // if (!provider.wallet.publicKey) { - // router.push('/') - // } - // },[]) - const handleToggle = (selected: string) => { - setSelectedOption(selected); - }; - console.log(selectedOption); - - + const [selectedOption, setSelectedOption] = useState(""); + const provider = useAnchorProvider(); + // useEffect(() => { + // if (!provider.wallet.publicKey) { + // router.push('/') + // } + // },[]) + const handleToggle = (selected: string) => { + setSelectedOption(selected); + }; + console.log(selectedOption); - return ( - - + ); +}; -export default Header \ No newline at end of file +export default Header; diff --git a/src/components/hero2.tsx b/src/components/hero2.tsx index 37e773a..e498c13 100644 --- a/src/components/hero2.tsx +++ b/src/components/hero2.tsx @@ -1,5 +1,5 @@ -import Link from "next/link" -import { ArrowRight } from 'lucide-react' +import Link from "next/link"; +import { ArrowRight } from "lucide-react"; export default function Hero() { return ( @@ -7,14 +7,16 @@ export default function Hero() {
{/* Grid Pattern Background */} {/* shifted to layout of main page */} - - + {/* Content Container */}
{/* Top Banner */}
-

Community support, daily live office hours, and thousands of builders - all on Discord.

+

+ Community support, daily live office hours, and thousands of + builders - all on Discord. +

@@ -22,34 +24,35 @@ export default function Hero() { {/* Main Content */}

- The Complete
+ The Complete +
guide to Engage & Earn

- +

- The all-in-one web-3 platform for delivering AI agents powered by the latest LLMs. + The all-in-one web-3 platform for delivering AI agents powered by + the latest LLMs.

{/* CTA Buttons */}
- - Get started for free - - - + Get started for free + + + + > Contact Sales - +
- ) + ); } - diff --git a/src/components/loading.tsx b/src/components/loading.tsx index 201d56c..42062fc 100644 --- a/src/components/loading.tsx +++ b/src/components/loading.tsx @@ -77,7 +77,12 @@ const StyledWrapper = styled.div` height: 1em; background-color: currentColor; border-radius: 50%; - box-shadow: 0 0 2em, 0 0 4em, 0 0 6em, 0 0 8em, 0 0 10em, + box-shadow: + 0 0 2em, + 0 0 4em, + 0 0 6em, + 0 0 8em, + 0 0 10em, 0 0 0 0.5em rgba(255, 255, 0, 0.1); } diff --git a/src/components/magicui/ShiningText.tsx b/src/components/magicui/ShiningText.tsx index ff9f978..3ac0295 100644 --- a/src/components/magicui/ShiningText.tsx +++ b/src/components/magicui/ShiningText.tsx @@ -29,7 +29,7 @@ const AnimatedShinyText: FC = ({ // Shine gradient "bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80", - className + className, )} > {children} diff --git a/src/components/product-form.tsx b/src/components/product-form.tsx index 93ac4a7..16bcf16 100644 --- a/src/components/product-form.tsx +++ b/src/components/product-form.tsx @@ -1,11 +1,17 @@ -"'use client'" +"'use client'"; -import { useState } from "react" -import { Button } from "@/components/ui/button" -import { Input } from "@/components/ui/input" -import { Label } from "@/components/ui/label" -import { Textarea } from "@/components/ui/textarea" -import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/components/ui/card" +import { useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Textarea } from "@/components/ui/textarea"; +import { + Card, + CardHeader, + CardTitle, + CardDescription, + CardContent, +} from "@/components/ui/card"; export function ProductFormComponent() { const [formData, setFormData] = useState({ @@ -14,85 +20,91 @@ export function ProductFormComponent() { description: "''", label: "''", amount: "''", - }) + }); - const handleChange = (e: React.ChangeEvent) => { - const { name, value } = e.target - setFormData(prevData => ({ + const handleChange = ( + e: React.ChangeEvent, + ) => { + const { name, value } = e.target; + setFormData((prevData) => ({ ...prevData, - [name]: value - })) - } + [name]: value, + })); + }; const handleSubmit = (e: React.FormEvent) => { - e.preventDefault() - console.log("'Form submitted:'", formData) + e.preventDefault(); + console.log("'Form submitted:'", formData); // Here you would typically send the data to an API or perform some action - } + }; return ( Product Information - Enter the details for your new product + + Enter the details for your new product +
-
-
-