From 6c4cfdf7475a75bc3c22e30f4d9737c8a46e044a Mon Sep 17 00:00:00 2001 From: Crisgarner <@crisgarner> Date: Mon, 25 Nov 2024 20:14:06 -0600 Subject: [PATCH] feat(devcon-poap): added poap --- .gitignore | 3 + packages/interface/package.json | 2 + packages/interface/src/components/Header.tsx | 3 +- .../interface/src/components/JoinButton.tsx | 481 +++++++++--------- packages/interface/src/config.ts | 7 +- packages/interface/src/contexts/Maci.tsx | 2 + packages/interface/src/contexts/types.ts | 1 + .../src/features/home/components/FaqList.tsx | 12 +- packages/interface/src/pages/api/poap.ts | 90 ++++ packages/interface/src/pages/index.tsx | 81 ++- packages/interface/src/utils/db.ts | 33 ++ pnpm-lock.yaml | 399 ++++++++++++++- 12 files changed, 802 insertions(+), 312 deletions(-) create mode 100644 packages/interface/src/pages/api/poap.ts create mode 100644 packages/interface/src/utils/db.ts diff --git a/.gitignore b/.gitignore index e00a5b52..831ae450 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ packages/interface/metamask/ # typescript *.tsbuildinfo zkeys + +db.db +proofs diff --git a/packages/interface/package.json b/packages/interface/package.json index 16318239..afb61e87 100644 --- a/packages/interface/package.json +++ b/packages/interface/package.json @@ -66,6 +66,8 @@ "react-number-format": "^5.4.2", "react-use": "^17.5.0", "sonner": "^1.4.0", + "sqlite": "^5.1.1", + "sqlite3": "^5.1.7", "superjson": "^2.2.1", "tailwind-merge": "^2.2.1", "tailwind-variants": "^0.1.20", diff --git a/packages/interface/src/components/Header.tsx b/packages/interface/src/components/Header.tsx index 0a75ac80..eb0b0798 100644 --- a/packages/interface/src/components/Header.tsx +++ b/packages/interface/src/components/Header.tsx @@ -10,7 +10,6 @@ import { useBallot } from "~/contexts/Ballot"; import { useRoundState } from "~/utils/state"; import { ERoundState } from "~/utils/types"; -import { ConnectButton } from "./ConnectButton"; import { IconButton } from "./ui/Button"; import { Logo } from "./ui/Logo"; @@ -122,7 +121,7 @@ const Header = ({ navLinks, pollId = "" }: IHeaderProps) => { onClick={handleChangeTheme} /> - + RESULTS diff --git a/packages/interface/src/components/JoinButton.tsx b/packages/interface/src/components/JoinButton.tsx index 976607dd..bdf2294a 100644 --- a/packages/interface/src/components/JoinButton.tsx +++ b/packages/interface/src/components/JoinButton.tsx @@ -1,247 +1,254 @@ /* eslint-disable no-console */ -import { decStringToBigIntToUuid } from "@pcd/util"; import { ZKEdDSAEventTicketPCDPackage } from "@pcd/zk-eddsa-event-ticket-pcd"; import { zuAuthPopup } from "@pcd/zuauth"; -import { GatekeeperTrait, getZupassGatekeeperData } from "maci-cli/sdk"; -import { useCallback } from "react"; +import { useCallback, useState } from "react"; import { toast } from "sonner"; -import { zupass, config } from "~/config"; +import { zupass } from "~/config"; import { useMaci } from "~/contexts/Maci"; -import { useEthersSigner } from "~/hooks/useEthersSigner"; -import { useSmartAccount } from "~/utils/accountAbstraction"; import { jsonPCD } from "~/utils/types"; import type { EdDSAPublicKey } from "@pcd/eddsa-pcd"; import { Button } from "./ui/Button"; -import { Spinner } from "./ui/Spinner"; export const JoinButton = (): JSX.Element => { - const { isLoading, isRegistered, isEligibleToVote, onSignup, gatekeeperTrait, storeZupassProof } = useMaci(); - const { smartAccountClient } = useSmartAccount(); + const { isLoading, isRegistered } = useMaci(); + const [poapLink, setPoapLink] = useState(""); - const signer = useEthersSigner({ client: smartAccountClient }); - - const onError = useCallback(() => toast.error("Signup error"), []); - const handleSignup = useCallback(() => onSignup(onError), [onSignup, onError]); + const onOpenPoap = () => { + window.open(poapLink, "_blank"); + }; const handleZupassVerify = useCallback(async () => { - if (signer && smartAccountClient?.account?.address) { - const zupassGatekeeperData = await getZupassGatekeeperData({ maciAddress: config.maciAddress!, signer }); - const eventId = decStringToBigIntToUuid(zupassGatekeeperData.eventId); - const result = await zuAuthPopup({ - fieldsToReveal: { - revealTicketId: true, - revealEventId: true, - revealProductId: true, + const { eventId } = zupass; + const result = await zuAuthPopup({ + fieldsToReveal: { + revealTicketId: true, + revealEventId: true, + revealProductId: true, + }, + config: [ + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "220f81f4-ca7b-4e47-bfb7-14bf1aa94a89", + eventName: zupass.eventName, }, - watermark: smartAccountClient.account.address, - config: [ - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "220f81f4-ca7b-4e47-bfb7-14bf1aa94a89", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "45b07aad-b4cf-4f0e-861b-683ba3de49bd", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "e6df2335-00d5-4ee1-916c-977d326a9049", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "2ab74a56-4182-4798-a485-6380f87d6299", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "9fb49dd1-edea-4c57-9ff2-6e6c9c3b4a0a", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "1ad9e110-8745-4eed-8ca5-ee5b8cd69c0f", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "6b0f70f1-c757-40a1-b6ab-a9ddab221615", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "08482abb-8767-47aa-be47-2691032403b6", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "2a86d360-4ca2-43b5-aeb5-9a070da9a992", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "c900d46a-99fd-4f7a-8d6b-10d041b2601b", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "3de2fcc5-3822-460c-8175-2eef211d2f1d", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "c97cb25e-302b-4696-ac24-2a7a8255572e", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "695cedfe-a973-4371-acc4-907bde4251c5", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "41a055e0-db9c-41ff-8e9c-5834c9d64c6d", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "b50febf2-a258-4ee6-b3e4-2b2c2e57a74e", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "f15237ec-abd9-40ae-8e61-9cf8a7a60c3f", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "a4c658af-0b37-41ac-aa0a-850b6b7741be", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "c64cac28-5719-4260-bd9a-ea0c0cb04d54", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "bc67b24b-52e1-418e-832a-568d1ae5a58c", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "b44cac2f-92b5-405e-9aa1-7127661790e2", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "81620f49-d7fc-4ccb-a7bb-0ad81d97191a", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "1bbc0ec1-5be9-43ff-acd3-d4ca794f814f", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "1bbc0ec1-5be9-43ff-acd3-d4ca794f814f", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "3c30c8e0-4f96-4b46-b2c9-72954e31ab51", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "f4f14100-f816-4e2e-a770-78dacaee4e2f", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "5dcea12b-5862-404f-8943-2fbb35322e4e", - eventName: zupass.eventName, - }, - { - pcdType: zupass.pcdType, - publicKey: zupass.publicKey as EdDSAPublicKey, - eventId, - productId: "c751e137-bb3c-44f3-94c2-f81f0bc00276", - eventName: zupass.eventName, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "45b07aad-b4cf-4f0e-861b-683ba3de49bd", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "e6df2335-00d5-4ee1-916c-977d326a9049", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "2ab74a56-4182-4798-a485-6380f87d6299", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "9fb49dd1-edea-4c57-9ff2-6e6c9c3b4a0a", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "1ad9e110-8745-4eed-8ca5-ee5b8cd69c0f", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "6b0f70f1-c757-40a1-b6ab-a9ddab221615", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "08482abb-8767-47aa-be47-2691032403b6", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "2a86d360-4ca2-43b5-aeb5-9a070da9a992", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "c900d46a-99fd-4f7a-8d6b-10d041b2601b", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "3de2fcc5-3822-460c-8175-2eef211d2f1d", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "c97cb25e-302b-4696-ac24-2a7a8255572e", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "695cedfe-a973-4371-acc4-907bde4251c5", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "41a055e0-db9c-41ff-8e9c-5834c9d64c6d", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "b50febf2-a258-4ee6-b3e4-2b2c2e57a74e", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "f15237ec-abd9-40ae-8e61-9cf8a7a60c3f", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "a4c658af-0b37-41ac-aa0a-850b6b7741be", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "c64cac28-5719-4260-bd9a-ea0c0cb04d54", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "bc67b24b-52e1-418e-832a-568d1ae5a58c", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "b44cac2f-92b5-405e-9aa1-7127661790e2", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "81620f49-d7fc-4ccb-a7bb-0ad81d97191a", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "1bbc0ec1-5be9-43ff-acd3-d4ca794f814f", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "1bbc0ec1-5be9-43ff-acd3-d4ca794f814f", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "3c30c8e0-4f96-4b46-b2c9-72954e31ab51", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "f4f14100-f816-4e2e-a770-78dacaee4e2f", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "5dcea12b-5862-404f-8943-2fbb35322e4e", + eventName: zupass.eventName, + }, + { + pcdType: zupass.pcdType, + publicKey: zupass.publicKey as EdDSAPublicKey, + eventId, + productId: "c751e137-bb3c-44f3-94c2-f81f0bc00276", + eventName: zupass.eventName, + }, + ], + watermark: "", + }); + if (result.type === "pcd") { + try { + const parsedPCD = (JSON.parse(result.pcdStr) as jsonPCD).pcd; + const pcd = await ZKEdDSAEventTicketPCDPackage.deserialize(parsedPCD); + + const response = await fetch("/api/poap", { + method: "POST", + body: JSON.stringify({ pcd }), + headers: { + "Content-Type": "application/json", }, - ], - }); - if (result.type === "pcd") { - try { - const parsedPCD = (JSON.parse(result.pcdStr) as jsonPCD).pcd; - const pcd = await ZKEdDSAEventTicketPCDPackage.deserialize(parsedPCD); - await storeZupassProof(pcd); - } catch (e) { - console.error("zupass error:", e); + }); + + console.log("response", response); + + if (!response.ok) { + toast.error("Could not verify your Zupass ticket, please try again"); + return; } + const { poap } = (await response.json()) as { poap: string }; + setPoapLink(poap); + } catch (e) { + console.error("zupass error:", e); } } - }, [signer, smartAccountClient, storeZupassProof]); + }, []); - if (!isEligibleToVote && gatekeeperTrait === GatekeeperTrait.Zupass) { + if (poapLink === "") { return (
); } - if (isEligibleToVote && !isRegistered) { - return ( -
- {isLoading ? ( - - ) : ( - - )} -
- ); - } - - if (!isEligibleToVote) { + if (poapLink !== "") { return (
-
); diff --git a/packages/interface/src/config.ts b/packages/interface/src/config.ts index bae67e64..d44c4be9 100644 --- a/packages/interface/src/config.ts +++ b/packages/interface/src/config.ts @@ -93,8 +93,8 @@ export const config = { // TODO: temp solution until we come up with solid one // https://github.com/privacy-scaling-explorations/maci-platform/issues/31 tokenName: process.env.NEXT_PUBLIC_TOKEN_NAME!, - eventName: process.env.NEXT_PUBLIC_EVENT_NAME ?? "Add your event name", - eventDescription: process.env.NEXT_PUBLIC_EVENT_DESCRIPTION ?? "Add your event description", + eventName: "Thanks for your support!", + eventDescription: "Claim your voter POAP.", admin: (process.env.NEXT_PUBLIC_ADMIN_ADDRESS ?? "") as `0x${string}`, network: wagmiChains[process.env.NEXT_PUBLIC_CHAIN_NAME as keyof typeof wagmiChains], maciAddress: process.env.NEXT_PUBLIC_MACI_ADDRESS, @@ -134,6 +134,7 @@ export const zupass = { "2b259329f0adf98c9b6cf2a11db7225fdcaa4f8796c61864e86154477da10663", ], eventName: process.env.NEXT_PUBLIC_ZUPASS_EVENT_NAME!, + eventId: "5074edf5-f079-4099-b036-22223c0c6995", } as const; export const impactCategories = { @@ -145,3 +146,5 @@ export const impactCategories = { DEVELOPER_ECOSYSTEM: { label: "Developer Ecosystem" }, END_USER_EXPERIENCE_AND_ADOPTION: { label: "End user UX" }, } as const; + +export const gatekeeperAddress = "0x6520BB469D42C0A56Dc114EE364440388d74A629"; diff --git a/packages/interface/src/contexts/Maci.tsx b/packages/interface/src/contexts/Maci.tsx index 04e78285..99de3587 100644 --- a/packages/interface/src/contexts/Maci.tsx +++ b/packages/interface/src/contexts/Maci.tsx @@ -423,6 +423,7 @@ export const MaciProvider: React.FC = ({ children }: MaciProv gatekeeperTrait, storeZupassProof, treeData, + zupassProof, }), [ isLoading, @@ -437,6 +438,7 @@ export const MaciProvider: React.FC = ({ children }: MaciProv gatekeeperTrait, storeZupassProof, treeData, + zupassProof, ], ); diff --git a/packages/interface/src/contexts/types.ts b/packages/interface/src/contexts/types.ts index 98f7b86f..b63ef79a 100644 --- a/packages/interface/src/contexts/types.ts +++ b/packages/interface/src/contexts/types.ts @@ -29,6 +29,7 @@ export interface MaciContextType { onError: () => void | Promise, onSuccess: () => void | Promise, ) => Promise; + zupassProof?: PCD; } export interface MaciProviderProps { diff --git a/packages/interface/src/features/home/components/FaqList.tsx b/packages/interface/src/features/home/components/FaqList.tsx index 52e66d32..0e743a00 100644 --- a/packages/interface/src/features/home/components/FaqList.tsx +++ b/packages/interface/src/features/home/components/FaqList.tsx @@ -1,5 +1,3 @@ -import Link from "next/link"; - import { Heading } from "~/components/ui/Heading"; import { FAQItem } from "./FaqItem"; @@ -59,13 +57,11 @@ export const FAQList = (): JSX.Element => ( description={

- Join our - - + Join our + Discord channel - - - to learn more, or come over to PSE booth in the Impact Space! + + to learn more, or come over to PSE's booth in the Impact Space!

} diff --git a/packages/interface/src/pages/api/poap.ts b/packages/interface/src/pages/api/poap.ts new file mode 100644 index 00000000..df945fad --- /dev/null +++ b/packages/interface/src/pages/api/poap.ts @@ -0,0 +1,90 @@ +/* eslint-disable no-console */ +import { uuidToBigInt } from "@pcd/util"; +import { ZKEdDSAEventTicketPCDClaim, ZKEdDSAEventTicketPCDPackage } from "@pcd/zk-eddsa-event-ticket-pcd"; +import { ZupassGatekeeper__factory as ZupassGatekeeper } from "maci-platform-contracts/typechain-types"; +import { NextApiRequest, NextApiResponse } from "next"; +import { createPublicClient, http } from "viem"; +import { optimism } from "viem/chains"; + +import { gatekeeperAddress } from "~/config"; +import { getDb } from "~/utils/db"; + +import type { PCD } from "@pcd/pcd-types"; +import type { Groth16Proof } from "snarkjs"; + +/** + * Handler for the faucet API endpoint. + * @param req - The request object. + * @param res - The response object. + * @returns - The response object. + */ +export default async function handler(req: NextApiRequest, res: NextApiResponse): Promise { + const db = await getDb(); + + const publicClient = createPublicClient({ + chain: optimism, + transport: http(), + }); + + try { + // we expect a JSON body with a pcd and an address + const { pcd } = req.body as { + pcd: PCD; + }; + + const isValid = await ZKEdDSAEventTicketPCDPackage.verify(pcd); + + if (!isValid) { + console.error(`[ERROR] ZK ticket PCD is not valid`); + res.status(400).json("Not valid PCD"); + return; + } + + const signedUp = await publicClient.readContract({ + address: gatekeeperAddress, + abi: ZupassGatekeeper.abi, + functionName: "registeredTickets", + args: [uuidToBigInt(pcd.claim.partialTicket.ticketId!)], + }); + + if (!signedUp) { + console.error(`[ERROR] Didn't vote in the round`); + res.status(401).json("Didn't vote in the round"); + return; + } + + const alreadyRegistered: { id: number; pcd: string } | undefined = await db.get( + "SELECT id, pcd FROM users WHERE pcd = ?", + pcd.claim.partialTicket.ticketId, + ); + + // if not in db, we save it so they can retrieve the poap with the same link + if (!alreadyRegistered) { + await db.run("INSERT INTO users (id, pcd) VALUES (null, ?)", pcd.claim.partialTicket.ticketId); + } + + const result: { id: number } | undefined = await db.get( + "SELECT id FROM users WHERE pcd = ?", + pcd.claim.partialTicket.ticketId, + ); + + if (!process.env.POAPS_LINKS) { + throw new Error("POAPS_LINKS environment variable is not defined"); + } + const response = await fetch(process.env.POAPS_LINKS); + const poapLinks = (await response.json()) as { links: string[] }; + const poapLink = result ? poapLinks.links[result.id - 1] : undefined; + + if (!poapLink) { + res.status(500).json("No POAP link found"); + return; + } + res.status(200).json({ poap: poapLink }); + } catch (err) { + console.error(err); + res.status(500).json("Internal server error"); + return; + } finally { + await db.close(); + } +} diff --git a/packages/interface/src/pages/index.tsx b/packages/interface/src/pages/index.tsx index d56251ad..a0cc677c 100644 --- a/packages/interface/src/pages/index.tsx +++ b/packages/interface/src/pages/index.tsx @@ -1,4 +1,3 @@ -import { usePrivy } from "@privy-io/react-auth"; import clsx from "clsx"; import Image from "next/image"; @@ -6,55 +5,41 @@ import { JoinButton } from "~/components/JoinButton"; import { Button } from "~/components/ui/Button"; import { Heading } from "~/components/ui/Heading"; import { config } from "~/config"; -import { useMaci } from "~/contexts/Maci"; -import { useRound } from "~/contexts/Round"; import { FAQList } from "~/features/home/components/FaqList"; -import { useIsAdmin } from "~/hooks/useIsAdmin"; import { Layout } from "~/layouts/DefaultLayout"; -const HomePage = (): JSX.Element => { - const { authenticated } = usePrivy(); - const { isRegistered } = useMaci(); - const isAdmin = useIsAdmin(); - const { rounds } = useRound(); - - return ( - -
- - {config.eventName} - - - - {config.eventDescription} - - - {!authenticated &&

Login to get started.

} - - {authenticated && !isRegistered && } - - {authenticated && !isAdmin && rounds && rounds.length === 0 && ( -

There are no rounds deployed.

- )} - - {authenticated && isRegistered && ( - - )} - - -
- - -
- ); -}; +const HomePage = (): JSX.Element => ( + +
+ + {config.eventName} + + + + {config.eventDescription} + + + + + + View the round Results + + + + + +
+ + +
+); export default HomePage; diff --git a/packages/interface/src/utils/db.ts b/packages/interface/src/utils/db.ts new file mode 100644 index 00000000..d1689e90 --- /dev/null +++ b/packages/interface/src/utils/db.ts @@ -0,0 +1,33 @@ +/* eslint-disable @typescript-eslint/no-shadow */ +import { Database, open } from "sqlite"; +import sqlite3 from "sqlite3"; + +/** + * Initialize the database + * @returns the database + */ +export const initDb = async (): Promise => { + const db = await open({ + filename: "./db.db", + driver: sqlite3.Database, + }); + + await db.exec(` + CREATE TABLE IF NOT EXISTS users ( + id integer primary key, + pcd TEXT UNIQUE + ) + `); +}; + +/** + * Get the database + * @returns the database + */ +export const getDb = async (): Promise => { + await initDb(); + return open({ + filename: "./db.db", + driver: sqlite3.Database, + }); +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 44b4c357..a52b8d8b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -503,6 +503,12 @@ importers: sonner: specifier: ^1.4.0 version: 1.5.0(react-dom@18.3.1(react@18.2.0))(react@18.2.0) + sqlite: + specifier: ^5.1.1 + version: 5.1.1 + sqlite3: + specifier: ^5.1.7 + version: 5.1.7 superjson: specifier: ^2.2.1 version: 2.2.1 @@ -2167,6 +2173,9 @@ packages: '@floating-ui/utils@0.2.8': resolution: {integrity: sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==} + '@gar/promisify@1.1.3': + resolution: {integrity: sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==} + '@graphprotocol/graph-cli@0.79.2': resolution: {integrity: sha512-/zKbObhwBf2b+P3mlL83SN9NIQ+LevIm8VkkWu9t7jQ7fFMHja2UUn+iqH8bVaJCsa3U8iaa1KfLu3ipk4dauQ==} engines: {node: '>=18'} @@ -3007,6 +3016,9 @@ packages: engines: {node: ^16.14.0 || >=18.0.0} hasBin: true + '@npmcli/fs@1.1.1': + resolution: {integrity: sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==} + '@npmcli/fs@3.1.1': resolution: {integrity: sha512-q9CRWjpHCMIh5sVyefoD1cA7PkvILqCZsnSOEUUivORLjxCO/Irmue2DprETiNgEqktDBZaM1Bi+jrarx1XdCg==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -3028,6 +3040,11 @@ packages: resolution: {integrity: sha512-Nkxf96V0lAx3HCpVda7Vw4P23RILgdi/5K1fmj2tZkWIYLpXAN8k2UVVOsW16TsS5F8Ws2I7Cm+PU1/rsVF47g==} engines: {node: ^16.14.0 || >=18.0.0} + '@npmcli/move-file@1.1.2': + resolution: {integrity: sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==} + engines: {node: '>=10'} + deprecated: This functionality has been moved to @npmcli/fs + '@npmcli/name-from-folder@2.0.0': resolution: {integrity: sha512-pwK+BfEBZJbKdNYpHHRTNBwBoqrN/iIMO0AiGvYsp3Hoaq0WbgGSWQR6SCldZovoDpY3yje5lkFUe6gsDgJ2vg==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -4433,6 +4450,10 @@ packages: '@types/react-dom': optional: true + '@tootallnate/once@1.1.2': + resolution: {integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==} + engines: {node: '>= 6'} + '@trpc/client@11.0.0-rc.608': resolution: {integrity: sha512-ZvhYhewiXXo3Kfy7JazVShsJUJTyqgkEV1rjhioJ6r3aIGw0ZS6zyyjcq1w99DTIzRP//FgB239NG5c66Ki9sw==} peerDependencies: @@ -5485,6 +5506,11 @@ packages: aproba@2.0.0: resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} + are-we-there-yet@3.0.1: + resolution: {integrity: sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + deprecated: This package is no longer supported. + arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} @@ -5966,6 +5992,10 @@ packages: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} + cacache@15.3.0: + resolution: {integrity: sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==} + engines: {node: '>= 10'} + cacache@18.0.4: resolution: {integrity: sha512-B+L5iIa9mgcjLbliir2th36yEwPftrzteHYujzsx3dFP/31GCHcIeS8f5MGd80odLOjaOvSpU3EEAmRQptkxLQ==} engines: {node: ^16.14.0 || >=18.0.0} @@ -6951,6 +6981,9 @@ packages: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} + delegates@1.0.0: + resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} + denodeify@1.2.1: resolution: {integrity: sha512-KNTihKNmQENUZeKu5fzfpzRqR5S2VMp4gl9RFHiWzj9DfvYQPMJ6XHKNaQxaGCXwPk6y9yme3aUoaiAe+KX+vg==} @@ -6992,6 +7025,10 @@ packages: engines: {node: '>=0.10'} hasBin: true + detect-libc@2.0.3: + resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==} + engines: {node: '>=8'} + detect-newline@3.1.0: resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} engines: {node: '>=8'} @@ -7690,6 +7727,10 @@ packages: resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} engines: {node: '>= 0.8.0'} + expand-template@2.0.3: + resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==} + engines: {node: '>=6'} + expand-tilde@2.0.2: resolution: {integrity: sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==} engines: {node: '>=0.10.0'} @@ -8077,6 +8118,11 @@ packages: resolution: {integrity: sha512-SewY5KdMpaoCeh7jachEWFsh1nNlaDjNHZXWqL5IGwtpEYHTgkr2+AMCgNwKWkcc0wpSYrZfR7he4WdmHFtDxQ==} engines: {node: '>=8'} + gauge@4.0.4: + resolution: {integrity: sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + deprecated: This package is no longer supported. + gensync@1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} @@ -8190,6 +8236,9 @@ packages: gitconfiglocal@1.0.0: resolution: {integrity: sha512-spLUXeTAVHxDtKsJc8FkFVgFtMdEN9qPGpL23VfSHx4fP4+Ds097IXLvymbnDH8FnmxX5Nr9bPw3A+AQ6mWEaQ==} + github-from-package@0.0.0: + resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} + glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -8522,6 +8571,10 @@ packages: http-https@1.0.0: resolution: {integrity: sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg==} + http-proxy-agent@4.0.1: + resolution: {integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==} + engines: {node: '>= 6'} + http-proxy-agent@7.0.2: resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} engines: {node: '>= 14'} @@ -8647,6 +8700,9 @@ packages: resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} engines: {node: '>=8'} + infer-owner@1.0.4: + resolution: {integrity: sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==} + inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. @@ -9866,6 +9922,10 @@ packages: resolution: {integrity: sha512-cKTUFc/rbKUd/9meOvgrpJ2WrNzymt6jfRDdwg5UCnVzv9dTpEj9JS5m3wtziXVCjluIXyL8pcaukYqezIzZQA==} engines: {node: ^16.14.0 || >=18.0.0} + make-fetch-happen@9.1.0: + resolution: {integrity: sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==} + engines: {node: '>= 10'} + makeerror@1.0.12: resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} @@ -10191,10 +10251,18 @@ packages: minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + minipass-collect@1.0.2: + resolution: {integrity: sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==} + engines: {node: '>= 8'} + minipass-collect@2.0.1: resolution: {integrity: sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw==} engines: {node: '>=16 || 14 >=14.17'} + minipass-fetch@1.4.1: + resolution: {integrity: sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==} + engines: {node: '>=8'} + minipass-fetch@3.0.5: resolution: {integrity: sha512-2N8elDQAtSnFV0Dk7gt15KHsS0Fyz6CbYZ360h0WTYV1Ty46li3rAXVOQj1THMNLdmrD9Vt5pBPtWtVkpwGBqg==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -10344,6 +10412,9 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + napi-build-utils@1.0.2: + resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==} + native-abort-controller@1.0.4: resolution: {integrity: sha512-zp8yev7nxczDJMoP6pDxyD20IU0T22eX8VwN2ztDccKvSZhRaV33yP1BGwKSZfXuqWUzsXopVFjBdau9OOAwMQ==} peerDependencies: @@ -10420,6 +10491,10 @@ packages: resolution: {integrity: sha512-WDD0bdg9mbq6F4mRxEYcPWwfA1vxd0mrvKOyxI7Xj/atfRHVeutzuWByG//jfm4uPzp0y4Kj051EORCBSQMycw==} engines: {node: '>=12.0.0'} + node-abi@3.71.0: + resolution: {integrity: sha512-SZ40vRiy/+wRTf21hxkkEjPJZpARzUMVcJoQse2EF8qkUWbbO2z7vd5oA/H6bVH6SZQ5STGcu0KRDS7biNRfxw==} + engines: {node: '>=10'} + node-abort-controller@3.1.1: resolution: {integrity: sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==} @@ -10488,6 +10563,11 @@ packages: engines: {node: ^16.14.0 || >=18.0.0} hasBin: true + node-gyp@8.4.1: + resolution: {integrity: sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==} + engines: {node: '>= 10.12.0'} + hasBin: true + node-int64@0.4.0: resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} @@ -10509,6 +10589,11 @@ packages: resolution: {integrity: sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==} hasBin: true + nopt@5.0.0: + resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} + engines: {node: '>=6'} + hasBin: true + nopt@7.2.1: resolution: {integrity: sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -10573,6 +10658,11 @@ packages: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + npmlog@6.0.2: + resolution: {integrity: sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + deprecated: This package is no longer supported. + nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} @@ -11151,6 +11241,11 @@ packages: preact@10.23.1: resolution: {integrity: sha512-O5UdRsNh4vdZaTieWe3XOgSpdMAmkIYBCT3VhQDlKrzyCm8lUYsk0fmVEvoQQifoOjFRTaHZO69ylrzTW2BH+A==} + prebuild-install@7.1.2: + resolution: {integrity: sha512-UnNke3IQb6sgarcZIDU3gbMeTp/9SSU1DAIkil7PrqG1vZlBtY5msYccSKSHDqa3hNg436IXK+SNImReuA1wEQ==} + engines: {node: '>=10'} + hasBin: true + prelude-ls@1.1.2: resolution: {integrity: sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==} engines: {node: '>= 0.8.0'} @@ -12059,6 +12154,12 @@ packages: resolution: {integrity: sha512-8G+/XDU8wNsJOQS5ysDVO0Etg9/2uA5gR9l4ZwijjlwxBcrU6RPfwi2+jJmbP+Ap1Hlp/nVAaEO4Fj22/SL2gQ==} engines: {node: ^16.14.0 || >=18.0.0} + simple-concat@1.0.1: + resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} + + simple-get@4.0.1: + resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==} + sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} @@ -12113,6 +12214,10 @@ packages: resolution: {integrity: sha512-DmeAkF6cwM9jSfmp6Dr/5/mfMwb5Z5qRrSXLpo3Fq5SqyU8CMF15jIN4ZhfSwu35ksM1qmHZDQ/DK5XTccSTvA==} engines: {node: '>=10.2.0'} + socks-proxy-agent@6.2.1: + resolution: {integrity: sha512-a6KW9G+6B3nWZ1yB8G7pJwL3ggLy1uTzKAgCb7ttblwqdz9fMGJUuTy3uFzEP48FAs9FLILlmzDlE2JJhVQaXQ==} + engines: {node: '>= 10'} + socks-proxy-agent@8.0.4: resolution: {integrity: sha512-GNAq/eg8Udq2x0eNiFkr9gRg5bA7PXEWagQdeRX4cPSG+X/8V38v637gim9bjFptMk1QWsCTr0ttrJEiXbNnRw==} engines: {node: '>= 14'} @@ -12241,10 +12346,20 @@ packages: sprintf-js@1.1.3: resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} + sqlite3@5.1.7: + resolution: {integrity: sha512-GGIyOiFaG+TUra3JIfkI/zGP8yZYLPQ0pl1bH+ODjiX57sPhrLU5sQJn1y9bDKZUFYkX1crlrPfSYt0BKKdkog==} + + sqlite@5.1.1: + resolution: {integrity: sha512-oBkezXa2hnkfuJwUo44Hl9hS3er+YFtueifoajrgidvqsJRQFpc5fKoAkAor1O5ZnLoa28GBScfHXs8j0K358Q==} + ssri@10.0.6: resolution: {integrity: sha512-MGrFH9Z4NP9Iyhqn16sDtBpRRNJ0Y2hNa6D65h736fVSaPCHr4DM4sWUNvVaSuC+0OBGhwsrydQwmgfg5LncqQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + ssri@8.0.1: + resolution: {integrity: sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==} + engines: {node: '>= 8'} + stack-generator@2.0.10: resolution: {integrity: sha512-mwnua/hkqM6pF4k8SnmZ2zfETsRUpWXREfA/goT8SLCV4iOFa4bzOX2nDipWAZFPTjLvQB82f5yaodMVhK0yJQ==} @@ -12868,6 +12983,9 @@ packages: resolution: {integrity: sha512-GwIJau9XaA8nLVbUXsN3IlFi7WmQ48gBUrl3FTkkL/XLu/POhBzfmX9hd33FNMX1qAsfl6ozO1iMmW9NC8YniA==} engines: {node: ^16.14.0 || >=18.0.0} + tunnel-agent@0.6.0: + resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} + tweetnacl-util@0.15.1: resolution: {integrity: sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==} @@ -13055,10 +13173,16 @@ packages: unified@11.0.5: resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} + unique-filename@1.1.1: + resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==} + unique-filename@3.0.0: resolution: {integrity: sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + unique-slug@2.0.2: + resolution: {integrity: sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==} + unique-slug@4.0.0: resolution: {integrity: sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -15610,6 +15734,9 @@ snapshots: '@floating-ui/utils@0.2.8': {} + '@gar/promisify@1.1.3': + optional: true + '@graphprotocol/graph-cli@0.79.2(@types/node@20.14.14)(bufferutil@4.0.8)(encoding@0.1.13)(node-fetch@2.7.0(encoding@0.1.13))(typescript@5.5.4)(utf-8-validate@5.0.10)': dependencies: '@float-capital/float-subgraph-uncrashable': 0.0.0-internal-testing.5 @@ -17080,6 +17207,12 @@ snapshots: - bluebird - supports-color + '@npmcli/fs@1.1.1': + dependencies: + '@gar/promisify': 1.1.3 + semver: 7.6.3 + optional: true + '@npmcli/fs@3.1.1': dependencies: semver: 7.6.3 @@ -17121,6 +17254,12 @@ snapshots: - bluebird - supports-color + '@npmcli/move-file@1.1.2': + dependencies: + mkdirp: 1.0.4 + rimraf: 3.0.2 + optional: true + '@npmcli/name-from-folder@2.0.0': {} '@npmcli/node-gyp@3.0.0': {} @@ -19321,6 +19460,9 @@ snapshots: '@types/react': 18.3.3 '@types/react-dom': 18.3.1 + '@tootallnate/once@1.1.2': + optional: true + '@trpc/client@11.0.0-rc.608(@trpc/server@11.0.0-rc.608)': dependencies: '@trpc/server': 11.0.0-rc.608 @@ -20971,6 +21113,12 @@ snapshots: aproba@2.0.0: {} + are-we-there-yet@3.0.1: + dependencies: + delegates: 1.0.0 + readable-stream: 3.6.2 + optional: true + arg@4.1.3: {} arg@5.0.2: {} @@ -21541,6 +21689,30 @@ snapshots: cac@6.7.14: {} + cacache@15.3.0: + dependencies: + '@npmcli/fs': 1.1.1 + '@npmcli/move-file': 1.1.2 + chownr: 2.0.0 + fs-minipass: 2.1.0 + glob: 7.2.3 + infer-owner: 1.0.4 + lru-cache: 6.0.0 + minipass: 3.3.6 + minipass-collect: 1.0.2 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + mkdirp: 1.0.4 + p-map: 4.0.0 + promise-inflight: 1.0.1 + rimraf: 3.0.2 + ssri: 8.0.1 + tar: 6.2.1 + unique-filename: 1.1.1 + transitivePeerDependencies: + - bluebird + optional: true + cacache@18.0.4: dependencies: '@npmcli/fs': 3.1.1 @@ -22653,6 +22825,9 @@ snapshots: delayed-stream@1.0.0: {} + delegates@1.0.0: + optional: true + denodeify@1.2.1: {} depd@2.0.0: {} @@ -22675,6 +22850,8 @@ snapshots: detect-libc@1.0.3: {} + detect-libc@2.0.3: {} + detect-newline@3.1.0: {} detect-node-es@1.1.0: {} @@ -23248,8 +23425,8 @@ snapshots: '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.5.4) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0))(eslint@8.57.0) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0) eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.0) eslint-plugin-react: 7.37.1(eslint@8.57.0) eslint-plugin-react-hooks: 5.0.0(eslint@8.57.0) @@ -23288,13 +23465,13 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0): + eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0))(eslint@8.57.0): dependencies: debug: 4.3.6(supports-color@8.1.1) enhanced-resolve: 5.17.1 eslint: 8.57.0 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) fast-glob: 3.3.2 get-tsconfig: 4.7.6 is-core-module: 2.15.0 @@ -23333,6 +23510,17 @@ snapshots: transitivePeerDependencies: - supports-color + eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0): + dependencies: + debug: 3.2.7 + optionalDependencies: + '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.5.4) + eslint: 8.57.0 + eslint-import-resolver-node: 0.3.9 + eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.31.0)(eslint@8.57.0) + transitivePeerDependencies: + - supports-color + eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0): dependencies: debug: 3.2.7 @@ -23354,14 +23542,14 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.8.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0): + eslint-module-utils@2.8.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.5.4) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.31.0)(eslint@8.57.0) transitivePeerDependencies: - supports-color @@ -23404,6 +23592,35 @@ snapshots: - eslint-import-resolver-webpack - supports-color + eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0): + dependencies: + '@rtsao/scc': 1.1.0 + array-includes: 3.1.8 + array.prototype.findlastindex: 1.2.5 + array.prototype.flat: 1.3.2 + array.prototype.flatmap: 1.3.2 + debug: 3.2.7 + doctrine: 2.1.0 + eslint: 8.57.0 + eslint-import-resolver-node: 0.3.9 + eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.31.0)(eslint@8.57.0))(eslint@8.57.0) + hasown: 2.0.2 + is-core-module: 2.15.1 + is-glob: 4.0.3 + minimatch: 3.1.2 + object.fromentries: 2.0.8 + object.groupby: 1.0.3 + object.values: 1.2.0 + semver: 6.3.1 + string.prototype.trimend: 1.0.8 + tsconfig-paths: 3.15.0 + optionalDependencies: + '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.5.4) + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0): dependencies: '@rtsao/scc': 1.1.0 @@ -23895,6 +24112,8 @@ snapshots: exit@0.1.2: {} + expand-template@2.0.3: {} + expand-tilde@2.0.2: dependencies: homedir-polyfill: 1.0.3 @@ -23953,7 +24172,7 @@ snapshots: extension-port-stream@3.0.0: dependencies: - readable-stream: 3.6.2 + readable-stream: 4.5.2 webextension-polyfill: 0.10.0 external-editor@3.1.0: @@ -24365,6 +24584,18 @@ snapshots: futoin-hkdf@1.5.3: {} + gauge@4.0.4: + dependencies: + aproba: 2.0.0 + color-support: 1.1.3 + console-control-strings: 1.1.0 + has-unicode: 2.0.1 + signal-exit: 3.0.7 + string-width: 4.2.3 + strip-ansi: 6.0.1 + wide-align: 1.1.5 + optional: true + gensync@1.0.0-beta.2: {} get-caller-file@2.0.5: {} @@ -24469,6 +24700,8 @@ snapshots: dependencies: ini: 1.3.8 + github-from-package@0.0.0: {} + glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -25077,6 +25310,15 @@ snapshots: http-https@1.0.0: {} + http-proxy-agent@4.0.1: + dependencies: + '@tootallnate/once': 1.1.2 + agent-base: 6.0.2 + debug: 4.3.6(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + optional: true + http-proxy-agent@7.0.2: dependencies: agent-base: 7.1.1 @@ -25195,6 +25437,9 @@ snapshots: indent-string@4.0.0: {} + infer-owner@1.0.4: + optional: true + inflight@1.0.6: dependencies: once: 1.4.0 @@ -27154,6 +27399,29 @@ snapshots: transitivePeerDependencies: - supports-color + make-fetch-happen@9.1.0: + dependencies: + agentkeepalive: 4.5.0 + cacache: 15.3.0 + http-cache-semantics: 4.1.1 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.1 + is-lambda: 1.0.1 + lru-cache: 6.0.0 + minipass: 3.3.6 + minipass-collect: 1.0.2 + minipass-fetch: 1.4.1 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + negotiator: 0.6.3 + promise-retry: 2.0.1 + socks-proxy-agent: 6.2.1 + ssri: 8.0.1 + transitivePeerDependencies: + - bluebird + - supports-color + optional: true + makeerror@1.0.12: dependencies: tmpl: 1.0.5 @@ -27707,10 +27975,24 @@ snapshots: minimist@1.2.8: {} + minipass-collect@1.0.2: + dependencies: + minipass: 3.3.6 + optional: true + minipass-collect@2.0.1: dependencies: minipass: 7.1.2 + minipass-fetch@1.4.1: + dependencies: + minipass: 3.3.6 + minipass-sized: 1.0.3 + minizlib: 2.1.2 + optionalDependencies: + encoding: 0.1.13 + optional: true + minipass-fetch@3.0.5: dependencies: minipass: 7.1.2 @@ -27909,6 +28191,8 @@ snapshots: nanoid@3.3.7: {} + napi-build-utils@1.0.2: {} + native-abort-controller@1.0.4(abort-controller@3.0.0): dependencies: abort-controller: 3.0.0 @@ -27993,6 +28277,10 @@ snapshots: nocache@3.0.4: {} + node-abi@3.71.0: + dependencies: + semver: 7.6.3 + node-abort-controller@3.1.1: {} node-addon-api@2.0.2: {} @@ -28059,6 +28347,23 @@ snapshots: transitivePeerDependencies: - supports-color + node-gyp@8.4.1: + dependencies: + env-paths: 2.2.1 + glob: 7.2.3 + graceful-fs: 4.2.11 + make-fetch-happen: 9.1.0 + nopt: 5.0.0 + npmlog: 6.0.2 + rimraf: 3.0.2 + semver: 7.6.3 + tar: 6.2.1 + which: 2.0.2 + transitivePeerDependencies: + - bluebird + - supports-color + optional: true + node-int64@0.4.0: {} node-machine-id@1.1.12: {} @@ -28073,6 +28378,11 @@ snapshots: dependencies: abbrev: 1.0.9 + nopt@5.0.0: + dependencies: + abbrev: 1.0.9 + optional: true + nopt@7.2.1: dependencies: abbrev: 2.0.0 @@ -28152,6 +28462,14 @@ snapshots: dependencies: path-key: 4.0.0 + npmlog@6.0.2: + dependencies: + are-we-there-yet: 3.0.1 + console-control-strings: 1.1.0 + gauge: 4.0.4 + set-blocking: 2.0.0 + optional: true + nth-check@2.1.1: dependencies: boolbase: 1.0.0 @@ -28808,6 +29126,21 @@ snapshots: preact@10.23.1: {} + prebuild-install@7.1.2: + dependencies: + detect-libc: 2.0.3 + expand-template: 2.0.3 + github-from-package: 0.0.0 + minimist: 1.2.8 + mkdirp-classic: 0.5.3 + napi-build-utils: 1.0.2 + node-abi: 3.71.0 + pump: 3.0.0 + rc: 1.2.8 + simple-get: 4.0.1 + tar-fs: 2.1.1 + tunnel-agent: 0.6.0 + prelude-ls@1.1.2: {} prelude-ls@1.2.1: {} @@ -29819,6 +30152,14 @@ snapshots: transitivePeerDependencies: - supports-color + simple-concat@1.0.1: {} + + simple-get@4.0.1: + dependencies: + decompress-response: 6.0.0 + once: 1.4.0 + simple-concat: 1.0.1 + sisteransi@1.0.5: {} slash@3.0.0: {} @@ -29927,6 +30268,15 @@ snapshots: - supports-color - utf-8-validate + socks-proxy-agent@6.2.1: + dependencies: + agent-base: 6.0.2 + debug: 4.3.6(supports-color@8.1.1) + socks: 2.8.3 + transitivePeerDependencies: + - supports-color + optional: true + socks-proxy-agent@8.0.4: dependencies: agent-base: 7.1.1 @@ -30153,10 +30503,29 @@ snapshots: sprintf-js@1.1.3: {} + sqlite3@5.1.7: + dependencies: + bindings: 1.5.0 + node-addon-api: 7.1.1 + prebuild-install: 7.1.2 + tar: 6.2.1 + optionalDependencies: + node-gyp: 8.4.1 + transitivePeerDependencies: + - bluebird + - supports-color + + sqlite@5.1.1: {} + ssri@10.0.6: dependencies: minipass: 7.1.2 + ssri@8.0.1: + dependencies: + minipass: 3.3.6 + optional: true + stack-generator@2.0.10: dependencies: stackframe: 1.3.4 @@ -30909,6 +31278,10 @@ snapshots: transitivePeerDependencies: - supports-color + tunnel-agent@0.6.0: + dependencies: + safe-buffer: 5.2.1 + tweetnacl-util@0.15.1: {} tweetnacl@1.0.3: {} @@ -31090,10 +31463,20 @@ snapshots: trough: 2.2.0 vfile: 6.0.2 + unique-filename@1.1.1: + dependencies: + unique-slug: 2.0.2 + optional: true + unique-filename@3.0.0: dependencies: unique-slug: 4.0.0 + unique-slug@2.0.2: + dependencies: + imurmurhash: 0.1.4 + optional: true + unique-slug@4.0.0: dependencies: imurmurhash: 0.1.4