From 2df70ff0b258b0d8382fd89219f4711484e885dc Mon Sep 17 00:00:00 2001 From: Spencer Schoeneman <78219375+Spencer-Sch@users.noreply.github.com> Date: Sat, 2 Dec 2023 06:51:02 -0600 Subject: [PATCH 01/10] add light/dark theme change (#6) --- packages/nextjs/tailwind.config.js | 98 +----------------------------- 1 file changed, 2 insertions(+), 96 deletions(-) diff --git a/packages/nextjs/tailwind.config.js b/packages/nextjs/tailwind.config.js index 33cf01a..b346baf 100644 --- a/packages/nextjs/tailwind.config.js +++ b/packages/nextjs/tailwind.config.js @@ -7,104 +7,10 @@ module.exports = { "./node_modules/react-tailwindcss-datepicker/dist/index.esm.js", ], plugins: [require("daisyui")], - darkTheme: "scaffoldEthDark", + darkMode: ["class", '[data-theme="dark"]'], // DaisyUI theme colors daisyui: { - themes: [ - { - myTheme: { - primary: "#4b6bfb", - secondary: "#7b92b2", - accent: "#67cba0", - neutral: "#181a2a", - "neutral-content": "#edf2f7", - "base-100": "#ffffff", - "base-content": "#181a2a", - "--rounded-box": "0.25rem", - "--rounded-btn": ".125rem", - "--rounded-badge": ".125rem", - "--animation-btn": "0", - "--animation-input": "0", - "--btn-focus-scale": "1", - - // "--rounded-btn": "9999rem", - // ".tooltip": { - // "--tooltip-tail": "6px", - // }, - // ".link": { - // textUnderlineOffset: "2px", - // }, - // ".link:hover": { - // opacity: "80%", - // }, - }, - }, - // { - // scaffoldEth: { - // primary: "#93BBFB", - // "primary-content": "#212638", - // secondary: "#DAE8FF", - // "secondary-content": "#212638", - // accent: "#93BBFB", - // "accent-content": "#212638", - // neutral: "#212638", - // "neutral-content": "#ffffff", - // "base-100": "#ffffff", - // "base-200": "#f4f8ff", - // "base-300": "#DAE8FF", - // "base-content": "#212638", - // info: "#93BBFB", - // success: "#34EEB6", - // warning: "#FFCF72", - // error: "#FF8863", - - // "--rounded-btn": "9999rem", - - // ".tooltip": { - // "--tooltip-tail": "6px", - // }, - // ".link": { - // textUnderlineOffset: "2px", - // }, - // ".link:hover": { - // opacity: "80%", - // }, - // }, - // }, - // { - // scaffoldEthDark: { - // primary: "#212638", - // "primary-content": "#F9FBFF", - // secondary: "#323f61", - // "secondary-content": "#F9FBFF", - // accent: "#4969A6", - // "accent-content": "#F9FBFF", - // neutral: "#F9FBFF", - // "neutral-content": "#385183", - // "base-100": "#385183", - // "base-200": "#2A3655", - // "base-300": "#212638", - // "base-content": "#F9FBFF", - // info: "#385183", - // success: "#34EEB6", - // warning: "#FFCF72", - // error: "#FF8863", - - // "--rounded-btn": "9999rem", - - // ".tooltip": { - // "--tooltip-tail": "6px", - // "--tooltip-color": "hsl(var(--p))", - // }, - // ".link": { - // textUnderlineOffset: "2px", - // }, - // ".link:hover": { - // opacity: "80%", - // }, - // }, - // }, - ], + themes: ["light", "dark"], }, theme: { extend: { From de8a996fe75a4928fc02b60aa9478d1a48fbb89f Mon Sep 17 00:00:00 2001 From: Spencer Schoeneman <78219375+Spencer-Sch@users.noreply.github.com> Date: Sat, 2 Dec 2023 09:07:11 -0600 Subject: [PATCH 02/10] add wallet address display to header (#7) --- .../dash-wind/containers/Header.tsx | 38 +++++- .../nextjs/components/web-3-crew/Address.tsx | 129 ++++++++++++++++++ 2 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 packages/nextjs/components/web-3-crew/Address.tsx diff --git a/packages/nextjs/components/dash-wind/containers/Header.tsx b/packages/nextjs/components/dash-wind/containers/Header.tsx index 221d2f3..dab87d5 100644 --- a/packages/nextjs/components/dash-wind/containers/Header.tsx +++ b/packages/nextjs/components/dash-wind/containers/Header.tsx @@ -9,8 +9,9 @@ import Bars3Icon from "@heroicons/react/24/outline/Bars3Icon"; import BellIcon from "@heroicons/react/24/outline/BellIcon"; import MoonIcon from "@heroicons/react/24/outline/MoonIcon"; import SunIcon from "@heroicons/react/24/outline/SunIcon"; -import UserIcon from "@heroicons/react/24/outline/UserIcon"; +// import UserIcon from "@heroicons/react/24/outline/UserIcon"; import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; +import { Address } from "~~/components/web-3-crew/Address"; function Header() { const dispatch = useMyDispatch(); @@ -94,6 +95,39 @@ function Header() { {/* Profile icon, opening menu on click */}
+ + +
+ + {/* Profile icon, opening menu on click */} + {/*
*/} diff --git a/packages/nextjs/components/web-3-crew/Address.tsx b/packages/nextjs/components/web-3-crew/Address.tsx new file mode 100644 index 0000000..833afd6 --- /dev/null +++ b/packages/nextjs/components/web-3-crew/Address.tsx @@ -0,0 +1,129 @@ +import { useEffect, useState } from "react"; +import Link from "next/link"; +// import { CopyToClipboard } from "react-copy-to-clipboard"; +import { isAddress } from "viem"; +import { hardhat } from "viem/chains"; +import { useEnsAvatar, useEnsName } from "wagmi"; +// import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline"; +import { BlockieAvatar } from "~~/components/scaffold-eth"; +import { getBlockExplorerAddressLink, getTargetNetwork } from "~~/utils/scaffold-eth"; + +type TAddressProps = { + address?: string; + disableAddressLink?: boolean; + format?: "short" | "long"; + size?: "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl"; +}; + +const blockieSizeMap = { + xs: 6, + sm: 7, + base: 8, + lg: 9, + xl: 10, + "2xl": 12, + "3xl": 15, +}; + +/** + * Edit of Scaffold-Eth-2 `Address` components + */ +/** + * Displays an address (or ENS) with a Blockie image and option to copy address. + */ +export const Address = ({ address, disableAddressLink, format, size = "base" }: TAddressProps) => { + const [ens, setEns] = useState(); + const [ensAvatar, setEnsAvatar] = useState(); + // const [addressCopied, setAddressCopied] = useState(false); + + const { data: fetchedEns } = useEnsName({ address, enabled: isAddress(address ?? ""), chainId: 1 }); + const { data: fetchedEnsAvatar } = useEnsAvatar({ + name: fetchedEns, + enabled: Boolean(fetchedEns), + chainId: 1, + cacheTime: 30_000, + }); + + // We need to apply this pattern to avoid Hydration errors. + useEffect(() => { + setEns(fetchedEns); + }, [fetchedEns]); + + useEffect(() => { + setEnsAvatar(fetchedEnsAvatar); + }, [fetchedEnsAvatar]); + + // Skeleton UI + if (!address) { + return ( +
+
+
+
+
+
+ ); + } + + if (!isAddress(address)) { + return Wrong address; + } + + const blockExplorerAddressLink = getBlockExplorerAddressLink(getTargetNetwork(), address); + let displayAddress = address?.slice(0, 5) + "..." + address?.slice(-4); + + if (ens) { + displayAddress = ens; + } else if (format === "long") { + displayAddress = address; + } + + return ( +
+
+ +
+ {disableAddressLink ? ( + {displayAddress} + ) : getTargetNetwork().id === hardhat.id ? ( + + {displayAddress} + + ) : ( + + {displayAddress} + + )} + {/* {addressCopied ? ( +
+ ); +}; From 641159ba9400ba3bc05010993e7e6b1ccc02342b Mon Sep 17 00:00:00 2001 From: Spencer Schoeneman <78219375+Spencer-Sch@users.noreply.github.com> Date: Tue, 5 Dec 2023 05:29:42 -0600 Subject: [PATCH 03/10] Web3auth (#8) * add web3auth and basic route auth guard * add authSlice - set auth vars on login/logout --- packages/nextjs/auth/authSlice.ts | 37 + .../nextjs/auth/checkUserAuthentication.ts | 23 + packages/nextjs/auth/web3auth.ts | 23 + .../nextjs/components/dash-wind/app/store.ts | 6 + .../dash-wind/containers/Header.tsx | 10 +- .../dash-wind/features/user/Login.tsx | 29 +- .../components/web-3-crew/watchPathname.tsx | 23 + packages/nextjs/package.json | 2 + packages/nextjs/pages/_app.tsx | 17 +- packages/nextjs/pages/index.tsx | 35 +- yarn.lock | 2016 ++++++++++++++++- 11 files changed, 2176 insertions(+), 45 deletions(-) create mode 100644 packages/nextjs/auth/authSlice.ts create mode 100644 packages/nextjs/auth/checkUserAuthentication.ts create mode 100644 packages/nextjs/auth/web3auth.ts create mode 100644 packages/nextjs/components/web-3-crew/watchPathname.tsx diff --git a/packages/nextjs/auth/authSlice.ts b/packages/nextjs/auth/authSlice.ts new file mode 100644 index 0000000..b9f85db --- /dev/null +++ b/packages/nextjs/auth/authSlice.ts @@ -0,0 +1,37 @@ +import { PayloadAction, createSlice } from "@reduxjs/toolkit"; +import { IProvider } from "@web3auth/base"; + +export type AuthProvider = IProvider | null; + +export interface AuthRootState { + auth: { + isConnected: boolean; + provider: AuthProvider; + }; +} + +interface AuthState { + isConnected: boolean; + provider: AuthProvider; +} + +export const authSlice = createSlice({ + name: "auth", + initialState: { + isConnected: false, + provider: null as AuthProvider, + }, + reducers: { + setAuthProvider: (state: AuthState, action: PayloadAction<{ provider: AuthProvider }>) => { + state.provider = action.payload.provider; + }, + + setIsConnected: (state: AuthState, action: PayloadAction<{ isConnected: boolean }>) => { + state.isConnected = action.payload.isConnected; + }, + }, +}); + +export const { setAuthProvider, setIsConnected } = authSlice.actions; + +export default authSlice.reducer; diff --git a/packages/nextjs/auth/checkUserAuthentication.ts b/packages/nextjs/auth/checkUserAuthentication.ts new file mode 100644 index 0000000..2a5e6ad --- /dev/null +++ b/packages/nextjs/auth/checkUserAuthentication.ts @@ -0,0 +1,23 @@ +import { web3auth } from "~~/auth/web3auth"; + +export default function checkUserAuthentication(path: string) { + console.log("from checkUserAuthentication - Path = ", path); + + const protectedRoutes = [ + "/dapp/dashboard", + "/dapp/welcome", + "/dapp/leads", + "/dapp/settings-team", + "/dapp/calendar", + "/dapp/transactions", + "/dapp/settings-profile", + "/dapp/settings-billing", + "/dapp/charts", + "/dapp/integration", + ]; + + if (!web3auth.connected && protectedRoutes.includes(path)) { + return false; + } + return true; +} diff --git a/packages/nextjs/auth/web3auth.ts b/packages/nextjs/auth/web3auth.ts new file mode 100644 index 0000000..858de5a --- /dev/null +++ b/packages/nextjs/auth/web3auth.ts @@ -0,0 +1,23 @@ +import { Web3Auth } from "@web3auth/modal"; + +export const web3auth = new Web3Auth({ + clientId: "BM0SLNkhMCfIygw0Xi79dG6qbWGMN0o0mEeDjRT0dxlP3BEok9pnu5aqxCNfj2TZ9XT7sQaXm0ltuWbCQ1tsRNI", // Get your Client ID from the Web3Auth Dashboard + web3AuthNetwork: "sapphire_devnet", // Web3Auth Network + chainConfig: { + chainNamespace: "eip155", + chainId: "0x13881", // Mumbai + rpcTarget: "https://rpc.ankr.com/polygon_mumbai", + displayName: "Mumbai Testnet", + blockExplorer: "https://mumbai.polygonscan.com/", + ticker: "MATIC", + tickerName: "Polygon", + }, +}); + +export async function web3AuthInit() { + try { + await web3auth.initModal(); + } catch (error) { + console.error(error); + } +} diff --git a/packages/nextjs/components/dash-wind/app/store.ts b/packages/nextjs/components/dash-wind/app/store.ts index c5b1657..f4a9a68 100644 --- a/packages/nextjs/components/dash-wind/app/store.ts +++ b/packages/nextjs/components/dash-wind/app/store.ts @@ -6,6 +6,7 @@ import { Reducer, ThunkAction, configureStore } from "@reduxjs/toolkit"; import { createWrapper } from "next-redux-wrapper"; import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux"; import { Action } from "redux"; +import authSlice, { AuthProvider } from "~~/auth/authSlice"; interface CombinedReducer { header: Reducer<{ @@ -31,6 +32,10 @@ interface CombinedReducer { isLoading: boolean; leads: never[]; }>; + auth: Reducer<{ + isConnected: boolean; + provider: AuthProvider; + }>; } const combinedReducer: CombinedReducer = { @@ -38,6 +43,7 @@ const combinedReducer: CombinedReducer = { rightDrawer: rightDrawerSlice, modal: modalSlice, lead: leadsSlice, + auth: authSlice, }; // export default configureStore({ diff --git a/packages/nextjs/components/dash-wind/containers/Header.tsx b/packages/nextjs/components/dash-wind/containers/Header.tsx index dab87d5..c6825dc 100644 --- a/packages/nextjs/components/dash-wind/containers/Header.tsx +++ b/packages/nextjs/components/dash-wind/containers/Header.tsx @@ -9,6 +9,8 @@ import Bars3Icon from "@heroicons/react/24/outline/Bars3Icon"; import BellIcon from "@heroicons/react/24/outline/BellIcon"; import MoonIcon from "@heroicons/react/24/outline/MoonIcon"; import SunIcon from "@heroicons/react/24/outline/SunIcon"; +import { setAuthProvider, setIsConnected } from "~~/auth/authSlice"; +import { web3auth } from "~~/auth/web3auth"; // import UserIcon from "@heroicons/react/24/outline/UserIcon"; import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; import { Address } from "~~/components/web-3-crew/Address"; @@ -38,10 +40,10 @@ function Header() { dispatch(openRightDrawer({ header: "Notifications", bodyType: RIGHT_DRAWER_TYPES.NOTIFICATION })); }; - function logoutUser() { - if (typeof window !== "undefined") { - localStorage.clear(); - } + async function logoutUser() { + await web3auth.logout(); + dispatch(setAuthProvider({ provider: null })); + dispatch(setIsConnected({ isConnected: false })); router.push("/"); } diff --git a/packages/nextjs/components/dash-wind/features/user/Login.tsx b/packages/nextjs/components/dash-wind/features/user/Login.tsx index 9ce5ef6..422073c 100644 --- a/packages/nextjs/components/dash-wind/features/user/Login.tsx +++ b/packages/nextjs/components/dash-wind/features/user/Login.tsx @@ -1,9 +1,13 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import Link from "next/link"; +import { useRouter } from "next/router"; import InputText from "../../components/Input/InputText"; import ErrorText from "../../components/Typography/ErrorText"; import { UpdateFormValues } from "../../types/FormTypes"; import LandingIntro from "./LandingIntro"; +import { setAuthProvider, setIsConnected } from "~~/auth/authSlice"; +import { web3auth } from "~~/auth/web3auth"; +import { useMyDispatch } from "~~/components/dash-wind/app/store"; function Login() { const INITIAL_LOGIN_OBJ = { @@ -15,6 +19,26 @@ function Login() { const [errorMessage, setErrorMessage] = useState(""); const [loginObj, setLoginObj] = useState(INITIAL_LOGIN_OBJ); + const router = useRouter(); + const dispatch = useMyDispatch(); + + // Web3Auth + useEffect(() => { + const init = async () => { + try { + const web3authProvider = await web3auth.connect(); + dispatch(setAuthProvider({ provider: web3authProvider })); + if (web3auth.connected) { + dispatch(setIsConnected({ isConnected: true })); + } + router.push("/dapp/dashboard"); + } catch (error) { + console.error(error); + } + }; + init(); + }); + const submitForm = (e: React.FormEvent) => { e.preventDefault(); setErrorMessage(""); @@ -26,7 +50,8 @@ function Login() { // Call API to check user credentials and save token in localstorage localStorage.setItem("token", "DumyTokenHere"); setLoading(false); - window.location.href = "/dapp/welcome"; + router.push("/dapp/welcome"); + // window.location.href = "/dapp/welcome"; } }; diff --git a/packages/nextjs/components/web-3-crew/watchPathname.tsx b/packages/nextjs/components/web-3-crew/watchPathname.tsx new file mode 100644 index 0000000..6b03fb7 --- /dev/null +++ b/packages/nextjs/components/web-3-crew/watchPathname.tsx @@ -0,0 +1,23 @@ +"use client"; + +import React, { useEffect } from "react"; +import { usePathname } from "next/navigation"; +import { useRouter } from "next/router"; +import checkUserAuthentication from "~~/auth/checkUserAuthentication"; + +export default function WatchPathname() { + const pathname = usePathname(); + const router = useRouter(); + + useEffect(() => { + console.log(`Route changed to: ${pathname}`); + if (pathname !== null) { + const userIsAuthenticated = checkUserAuthentication(pathname); + if (!userIsAuthenticated) { + router.replace("/login"); + } + } + }, [pathname, router]); + + return <>; +} diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 181d699..e64c44b 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -20,6 +20,8 @@ "@reduxjs/toolkit": "^1.9.7", "@uniswap/sdk-core": "^4.0.1", "@uniswap/v2-sdk": "^3.0.1", + "@web3auth/base": "^7.2.0", + "@web3auth/modal": "^7.2.0", "axios": "^1.6.2", "blo": "^1.0.1", "chart.js": "^4.4.0", diff --git a/packages/nextjs/pages/_app.tsx b/packages/nextjs/pages/_app.tsx index 4c1a210..59df41e 100644 --- a/packages/nextjs/pages/_app.tsx +++ b/packages/nextjs/pages/_app.tsx @@ -5,13 +5,13 @@ import "@rainbow-me/rainbowkit/styles.css"; import type { NextPage } from "next"; import NextNProgress from "nextjs-progressbar"; import { Toaster } from "react-hot-toast"; -// NEW import { Provider } from "react-redux"; import { useDarkMode } from "usehooks-ts"; import { WagmiConfig } from "wagmi"; -// NEW +import { web3AuthInit } from "~~/auth/web3auth"; import { wrapper } from "~~/components/dash-wind/app/store"; import { BlockieAvatar } from "~~/components/scaffold-eth"; +import WatchPathname from "~~/components/web-3-crew/watchPathname"; import { useNativeCurrencyPrice } from "~~/hooks/scaffold-eth"; import { useGlobalState } from "~~/services/store/store"; import { wagmiConfig } from "~~/services/web3/wagmiConfig"; @@ -43,12 +43,25 @@ const ScaffoldEthApp = ({ Component, pageProps }: AppPropsWithLayout) => { setIsDarkTheme(isDarkMode); }, [isDarkMode]); + // Web3Auth + useEffect(() => { + const init = async () => { + try { + await web3AuthInit(); + } catch (error) { + console.error(error); + } + }; + init(); + }, []); + const getLayout = Component.getLayout || (page => page); const { store, props } = wrapper.useWrappedStore(pageProps); return ( + { + const router = useRouter(); + const dispatch = useMyDispatch(); + + useEffect(() => { + dispatch(setAuthProvider({ provider: web3auth.provider })); + + if (web3auth.connected) { + dispatch(setIsConnected({ isConnected: true })); + } + }, [dispatch]); + + function launchDapp() { + if (web3auth.connected) { + // redirect to dashboard if logged in + router.push("/dapp/dashboard"); + return; + } + // redirect to login if not connected + router.push("/login"); + } return ( <> {/* Look into MetaHeader - should it be moved to _app.tsx ??? */} @@ -20,9 +44,12 @@ const LandingPage: NextPageWithLayout = () => { Web3Crew Constellation Project - + + {/* Launch Dapp - + */} ); diff --git a/yarn.lock b/yarn.lock index d619705..4d825c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -171,6 +171,15 @@ __metadata: languageName: node linkType: hard +"@babel/runtime@npm:^7.22.10, @babel/runtime@npm:^7.22.5, @babel/runtime@npm:^7.23.2": + version: 7.23.5 + resolution: "@babel/runtime@npm:7.23.5" + dependencies: + regenerator-runtime: ^0.14.0 + checksum: 164d9802424f06908e62d29b8fd3a87db55accf82f46f964ac481dcead11ff7df8391e3696e5fa91a8ca10ea8845bf650acd730fa88cf13f8026cd8d5eec6936 + languageName: node + linkType: hard + "@babel/template@npm:^7.20.7": version: 7.20.7 resolution: "@babel/template@npm:7.20.7" @@ -383,6 +392,99 @@ __metadata: languageName: node linkType: hard +"@ethereumjs/common@npm:^3.2.0": + version: 3.2.0 + resolution: "@ethereumjs/common@npm:3.2.0" + dependencies: + "@ethereumjs/util": ^8.1.0 + crc-32: ^1.2.0 + checksum: cb9cc11f5c868cb577ba611cebf55046e509218bbb89b47ccce010776dafe8256d70f8f43fab238aec74cf71f62601cd5842bc03a83261200802de365732a14b + languageName: node + linkType: hard + +"@ethereumjs/common@npm:^4.1.0": + version: 4.1.0 + resolution: "@ethereumjs/common@npm:4.1.0" + dependencies: + "@ethereumjs/util": ^9.0.1 + crc: ^4.3.2 + checksum: 8494e6d179fe3949d8d8285badfb7be9ade71864e477da5dbf432ecc8046a58a0db73e99b5543c807fdc1b3f5959ed9c85ba99536b2f4753e08eaeb096af4beb + languageName: node + linkType: hard + +"@ethereumjs/rlp@npm:^4.0.1": + version: 4.0.1 + resolution: "@ethereumjs/rlp@npm:4.0.1" + bin: + rlp: bin/rlp + checksum: 30db19c78faa2b6ff27275ab767646929207bb207f903f09eb3e4c273ce2738b45f3c82169ddacd67468b4f063d8d96035f2bf36f02b6b7e4d928eefe2e3ecbc + languageName: node + linkType: hard + +"@ethereumjs/rlp@npm:^5.0.1": + version: 5.0.1 + resolution: "@ethereumjs/rlp@npm:5.0.1" + bin: + rlp: bin/rlp.cjs + checksum: eddff08718c3b8312007ef51a951dff6b2c1152f9f9ea6fb9eec65d50caf3fa53f5894d79d6d450eef70a5ef3b0688be044912096aa8d263345a0d9debb4d477 + languageName: node + linkType: hard + +"@ethereumjs/tx@npm:^4.2.0": + version: 4.2.0 + resolution: "@ethereumjs/tx@npm:4.2.0" + dependencies: + "@ethereumjs/common": ^3.2.0 + "@ethereumjs/rlp": ^4.0.1 + "@ethereumjs/util": ^8.1.0 + ethereum-cryptography: ^2.0.0 + checksum: 87a3f5f2452cfbf6712f8847525a80c213210ed453c211c793c5df801fe35ecef28bae17fadd222fcbdd94277478a47e52d2b916a90a6b30cda21f1e0cdaee42 + languageName: node + linkType: hard + +"@ethereumjs/tx@npm:^5.1.0": + version: 5.1.0 + resolution: "@ethereumjs/tx@npm:5.1.0" + dependencies: + "@ethereumjs/common": ^4.1.0 + "@ethereumjs/rlp": ^5.0.1 + "@ethereumjs/util": ^9.0.1 + ethereum-cryptography: ^2.1.2 + peerDependencies: + c-kzg: ^2.1.2 + peerDependenciesMeta: + c-kzg: + optional: true + checksum: fd17b337f7a64a6a29b1d279c52ac5bfb9655cda06858b198b85a306cc978d25b871acc4ec57e0c29bab50a7c9600d934837fb62052cbde7dc88223be7ebc740 + languageName: node + linkType: hard + +"@ethereumjs/util@npm:^8.1.0": + version: 8.1.0 + resolution: "@ethereumjs/util@npm:8.1.0" + dependencies: + "@ethereumjs/rlp": ^4.0.1 + ethereum-cryptography: ^2.0.0 + micro-ftch: ^0.3.1 + checksum: 9ae5dee8f12b0faf81cd83f06a41560e79b0ba96a48262771d897a510ecae605eb6d84f687da001ab8ccffd50f612ae50f988ef76e6312c752897f462f3ac08d + languageName: node + linkType: hard + +"@ethereumjs/util@npm:^9.0.1": + version: 9.0.1 + resolution: "@ethereumjs/util@npm:9.0.1" + dependencies: + "@ethereumjs/rlp": ^5.0.1 + ethereum-cryptography: ^2.1.2 + peerDependencies: + c-kzg: ^2.1.2 + peerDependenciesMeta: + c-kzg: + optional: true + checksum: 3569dcc0106f5e962e62811be66b5f49529c9d1a29671908568528b2b45d6cae03cb497fc755a1ae4144170f749133308494be42255ac98b61c930d143ed26f4 + languageName: node + linkType: hard + "@ethersproject/abi@npm:5.7.0, @ethersproject/abi@npm:^5.0.0-beta.146, @ethersproject/abi@npm:^5.0.9, @ethersproject/abi@npm:^5.1.2, @ethersproject/abi@npm:^5.7.0": version: 5.7.0 resolution: "@ethersproject/abi@npm:5.7.0" @@ -872,6 +974,13 @@ __metadata: languageName: node linkType: hard +"@ioredis/commands@npm:^1.1.1": + version: 1.2.0 + resolution: "@ioredis/commands@npm:1.2.0" + checksum: 9b20225ba36ef3e5caf69b3c0720597c3016cc9b1e157f519ea388f621dd9037177f84cfe7e25c4c32dad7dd90c70ff9123cd411f747e053cf292193c9c461e2 + languageName: node + linkType: hard + "@jridgewell/gen-mapping@npm:^0.3.2": version: 0.3.2 resolution: "@jridgewell/gen-mapping@npm:0.3.2" @@ -1007,6 +1116,23 @@ __metadata: languageName: node linkType: hard +"@metamask/abi-utils@npm:^2.0.2": + version: 2.0.2 + resolution: "@metamask/abi-utils@npm:2.0.2" + dependencies: + "@metamask/utils": ^8.0.0 + superstruct: ^1.0.3 + checksum: 5ec153e7691a4e1dc8738a0ba1a99a354ddb13851fa88a40a19f002f6308310e71c2cee28c3a25d9f7f67e839c7dffe4760e93e308dd17fa725b08d0dc73a3d4 + languageName: node + linkType: hard + +"@metamask/detect-provider@npm:^2.0.0": + version: 2.0.0 + resolution: "@metamask/detect-provider@npm:2.0.0" + checksum: 45d3128069310e6cdb9a572b31da88b3fddb0aa78f94deba71657efd7e40d0680912a4ee0291a7a0e9ab66681aba271e74de87c5464d979f115726c740db641b + languageName: node + linkType: hard + "@metamask/eth-sig-util@npm:^4.0.0": version: 4.0.1 resolution: "@metamask/eth-sig-util@npm:4.0.1" @@ -1020,6 +1146,30 @@ __metadata: languageName: node linkType: hard +"@metamask/eth-sig-util@npm:^7.0.1": + version: 7.0.1 + resolution: "@metamask/eth-sig-util@npm:7.0.1" + dependencies: + "@ethereumjs/util": ^8.1.0 + "@metamask/abi-utils": ^2.0.2 + "@metamask/utils": ^8.1.0 + ethereum-cryptography: ^2.1.2 + tweetnacl: ^1.0.3 + tweetnacl-util: ^0.15.1 + checksum: 98d056bd83aeb2d29ec3de09cd18e67d97ea295a59d405a9ce3fe274badd2d4f18da1fe530a266b4c777650855ed75ecd3577decd607a561e938dd7a808c5839 + languageName: node + linkType: hard + +"@metamask/rpc-errors@npm:^6.0.0, @metamask/rpc-errors@npm:^6.1.0": + version: 6.1.0 + resolution: "@metamask/rpc-errors@npm:6.1.0" + dependencies: + "@metamask/utils": ^8.1.0 + fast-safe-stringify: ^2.0.6 + checksum: 9f4821d804e2fcaa8987b0958d02c6d829b7c7db49740c811cb593f381d0c4b00dabb7f1802907f1b2f6126f7c0d83ec34219183d29650f5d24df014ac72906a + languageName: node + linkType: hard + "@metamask/safe-event-emitter@npm:2.0.0, @metamask/safe-event-emitter@npm:^2.0.0": version: 2.0.0 resolution: "@metamask/safe-event-emitter@npm:2.0.0" @@ -1039,6 +1189,22 @@ __metadata: languageName: node linkType: hard +"@metamask/utils@npm:^8.0.0, @metamask/utils@npm:^8.1.0": + version: 8.2.1 + resolution: "@metamask/utils@npm:8.2.1" + dependencies: + "@ethereumjs/tx": ^4.2.0 + "@noble/hashes": ^1.3.1 + "@scure/base": ^1.1.3 + "@types/debug": ^4.1.7 + debug: ^4.3.4 + pony-cause: ^2.1.10 + semver: ^7.5.4 + superstruct: ^1.0.3 + checksum: 36a714a17e4949d2040bedb28d4373a22e7e86bb797aa2d59223f9799fd76e662443bcede113719c4e200f5e9d90a9d62feafad5028fff8b9a7a85fface097ca + languageName: node + linkType: hard + "@motionone/animation@npm:^10.15.1": version: 10.15.1 resolution: "@motionone/animation@npm:10.15.1" @@ -1240,7 +1406,16 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:1.2.0, @noble/curves@npm:~1.2.0": +"@noble/curves@npm:1.1.0, @noble/curves@npm:~1.1.0": + version: 1.1.0 + resolution: "@noble/curves@npm:1.1.0" + dependencies: + "@noble/hashes": 1.3.1 + checksum: 2658cdd3f84f71079b4e3516c47559d22cf4b55c23ac8ee9d2b1f8e5b72916d9689e59820e0f9d9cb4a46a8423af5b56dc6bb7782405c88be06a015180508db5 + languageName: node + linkType: hard + +"@noble/curves@npm:1.2.0, @noble/curves@npm:^1.2.0, @noble/curves@npm:~1.2.0": version: 1.2.0 resolution: "@noble/curves@npm:1.2.0" dependencies: @@ -1270,7 +1445,14 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.3.2, @noble/hashes@npm:~1.3.2": +"@noble/hashes@npm:1.3.1": + version: 1.3.1 + resolution: "@noble/hashes@npm:1.3.1" + checksum: 7fdefc0f7a0c1ec27acc6ff88841793e3f93ec4ce6b8a6a12bfc0dd70ae6b7c4c82fe305fdfeda1735d5ad4a9eebe761e6693b3d355689c559e91242f4bc95b1 + languageName: node + linkType: hard + +"@noble/hashes@npm:1.3.2, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:~1.3.1, @noble/hashes@npm:~1.3.2": version: 1.3.2 resolution: "@noble/hashes@npm:1.3.2" checksum: fe23536b436539d13f90e4b9be843cc63b1b17666a07634a2b1259dded6f490be3d050249e6af98076ea8f2ea0d56f578773c2197f2aa0eeaa5fba5bc18ba474 @@ -1717,6 +1899,151 @@ __metadata: languageName: node linkType: hard +"@parcel/watcher-android-arm64@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-android-arm64@npm:2.3.0" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@parcel/watcher-darwin-arm64@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-darwin-arm64@npm:2.3.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@parcel/watcher-darwin-x64@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-darwin-x64@npm:2.3.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@parcel/watcher-freebsd-x64@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-freebsd-x64@npm:2.3.0" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@parcel/watcher-linux-arm-glibc@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-linux-arm-glibc@npm:2.3.0" + conditions: os=linux & cpu=arm & libc=glibc + languageName: node + linkType: hard + +"@parcel/watcher-linux-arm64-glibc@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-linux-arm64-glibc@npm:2.3.0" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@parcel/watcher-linux-arm64-musl@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-linux-arm64-musl@npm:2.3.0" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@parcel/watcher-linux-x64-glibc@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-linux-x64-glibc@npm:2.3.0" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@parcel/watcher-linux-x64-musl@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-linux-x64-musl@npm:2.3.0" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@parcel/watcher-wasm@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-wasm@npm:2.3.0" + dependencies: + is-glob: ^4.0.3 + micromatch: ^4.0.5 + napi-wasm: ^1.1.0 + checksum: 61e3209e5253fc4eda2ddf903877475836cc3c65dca8b19c538de4b1fb598c17ca2797ab52cb45f61c01be963aed44059f2f9e536eb68539e31f27f1fcfb09ba + languageName: node + linkType: hard + +"@parcel/watcher-win32-arm64@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-win32-arm64@npm:2.3.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@parcel/watcher-win32-ia32@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-win32-ia32@npm:2.3.0" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@parcel/watcher-win32-x64@npm:2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher-win32-x64@npm:2.3.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@parcel/watcher@npm:^2.3.0": + version: 2.3.0 + resolution: "@parcel/watcher@npm:2.3.0" + dependencies: + "@parcel/watcher-android-arm64": 2.3.0 + "@parcel/watcher-darwin-arm64": 2.3.0 + "@parcel/watcher-darwin-x64": 2.3.0 + "@parcel/watcher-freebsd-x64": 2.3.0 + "@parcel/watcher-linux-arm-glibc": 2.3.0 + "@parcel/watcher-linux-arm64-glibc": 2.3.0 + "@parcel/watcher-linux-arm64-musl": 2.3.0 + "@parcel/watcher-linux-x64-glibc": 2.3.0 + "@parcel/watcher-linux-x64-musl": 2.3.0 + "@parcel/watcher-win32-arm64": 2.3.0 + "@parcel/watcher-win32-ia32": 2.3.0 + "@parcel/watcher-win32-x64": 2.3.0 + detect-libc: ^1.0.3 + is-glob: ^4.0.3 + micromatch: ^4.0.5 + node-addon-api: ^7.0.0 + node-gyp: latest + dependenciesMeta: + "@parcel/watcher-android-arm64": + optional: true + "@parcel/watcher-darwin-arm64": + optional: true + "@parcel/watcher-darwin-x64": + optional: true + "@parcel/watcher-freebsd-x64": + optional: true + "@parcel/watcher-linux-arm-glibc": + optional: true + "@parcel/watcher-linux-arm64-glibc": + optional: true + "@parcel/watcher-linux-arm64-musl": + optional: true + "@parcel/watcher-linux-x64-glibc": + optional: true + "@parcel/watcher-linux-x64-musl": + optional: true + "@parcel/watcher-win32-arm64": + optional: true + "@parcel/watcher-win32-ia32": + optional: true + "@parcel/watcher-win32-x64": + optional: true + checksum: 12f494998dbae363cc9c48b49f7e09589c179e84133e3b6cd0c087573a7dc70b3adec458f95b39e3b8e4d9c93cff770ce15b1d2452d6741a5047f1ca90485ded + languageName: node + linkType: hard + "@pkgr/utils@npm:^2.3.1": version: 2.3.1 resolution: "@pkgr/utils@npm:2.3.1" @@ -1817,6 +2144,13 @@ __metadata: languageName: node linkType: hard +"@scure/base@npm:^1.1.3, @scure/base@npm:~1.1.2": + version: 1.1.3 + resolution: "@scure/base@npm:1.1.3" + checksum: 1606ab8a4db898cb3a1ada16c15437c3bce4e25854fadc8eb03ae93cbbbac1ed90655af4b0be3da37e12056fef11c0374499f69b9e658c9e5b7b3e06353c630c + languageName: node + linkType: hard + "@scure/base@npm:~1.1.0": version: 1.1.1 resolution: "@scure/base@npm:1.1.1" @@ -1824,13 +2158,6 @@ __metadata: languageName: node linkType: hard -"@scure/base@npm:~1.1.2": - version: 1.1.3 - resolution: "@scure/base@npm:1.1.3" - checksum: 1606ab8a4db898cb3a1ada16c15437c3bce4e25854fadc8eb03ae93cbbbac1ed90655af4b0be3da37e12056fef11c0374499f69b9e658c9e5b7b3e06353c630c - languageName: node - linkType: hard - "@scure/bip32@npm:1.1.0": version: 1.1.0 resolution: "@scure/bip32@npm:1.1.0" @@ -1853,6 +2180,17 @@ __metadata: languageName: node linkType: hard +"@scure/bip32@npm:1.3.1": + version: 1.3.1 + resolution: "@scure/bip32@npm:1.3.1" + dependencies: + "@noble/curves": ~1.1.0 + "@noble/hashes": ~1.3.1 + "@scure/base": ~1.1.0 + checksum: 394d65f77a40651eba21a5096da0f4233c3b50d422864751d373fcf142eeedb94a1149f9ab1dbb078086dab2d0bc27e2b1afec8321bf22d4403c7df2fea5bfe2 + languageName: node + linkType: hard + "@scure/bip32@npm:1.3.2": version: 1.3.2 resolution: "@scure/bip32@npm:1.3.2" @@ -1950,6 +2288,8 @@ __metadata: "@typescript-eslint/eslint-plugin": ^5.39.0 "@uniswap/sdk-core": ^4.0.1 "@uniswap/v2-sdk": ^3.0.1 + "@web3auth/base": ^7.2.0 + "@web3auth/modal": ^7.2.0 autoprefixer: ^10.4.12 axios: ^1.6.2 blo: ^1.0.1 @@ -2070,6 +2410,13 @@ __metadata: languageName: node linkType: hard +"@socket.io/component-emitter@npm:~3.1.0": + version: 3.1.0 + resolution: "@socket.io/component-emitter@npm:3.1.0" + checksum: db069d95425b419de1514dffe945cc439795f6a8ef5b9465715acf5b8b50798e2c91b8719cbf5434b3fe7de179d6cdcd503c277b7871cb3dd03febb69bdd50fa + languageName: node + linkType: hard + "@solana/buffer-layout@npm:^4.0.0": version: 4.0.0 resolution: "@solana/buffer-layout@npm:4.0.0" @@ -2103,6 +2450,29 @@ __metadata: languageName: node linkType: hard +"@solana/web3.js@npm:^1.78.4": + version: 1.87.6 + resolution: "@solana/web3.js@npm:1.87.6" + dependencies: + "@babel/runtime": ^7.23.2 + "@noble/curves": ^1.2.0 + "@noble/hashes": ^1.3.1 + "@solana/buffer-layout": ^4.0.0 + agentkeepalive: ^4.3.0 + bigint-buffer: ^1.1.5 + bn.js: ^5.2.1 + borsh: ^0.7.0 + bs58: ^4.0.1 + buffer: 6.0.3 + fast-stable-stringify: ^1.0.0 + jayson: ^4.1.0 + node-fetch: ^2.6.12 + rpc-websockets: ^7.5.1 + superstruct: ^0.14.2 + checksum: 182eb2a953f6ebebdfbc7dfda031d1985fb1591a2aa38b388d5dfb9fd3df0fb53a3962373384dbd91df343e148ec3d42a579324effab9ca86f0560c4f6f08481 + languageName: node + linkType: hard + "@solidity-parser/parser@npm:^0.14.0, @solidity-parser/parser@npm:^0.14.1": version: 0.14.3 resolution: "@solidity-parser/parser@npm:0.14.3" @@ -2353,6 +2723,264 @@ __metadata: languageName: node linkType: hard +"@toruslabs/base-controllers@npm:^4.0.1, @toruslabs/base-controllers@npm:^4.9.1": + version: 4.10.0 + resolution: "@toruslabs/base-controllers@npm:4.10.0" + dependencies: + "@ethereumjs/util": ^9.0.1 + "@metamask/rpc-errors": ^6.1.0 + "@toruslabs/broadcast-channel": ^9.0.1 + "@toruslabs/http-helpers": ^5.0.0 + "@toruslabs/openlogin-jrpc": ^6.1.0 + async-mutex: ^0.4.0 + bignumber.js: ^9.1.2 + bowser: ^2.11.0 + lodash: ^4.17.21 + loglevel: ^1.8.1 + peerDependencies: + "@babel/runtime": 7.x + checksum: 1ab980d0cef8f792a83a5749c062a68da6748943c2254351d422e500191b6c2087672c6e7b944d80a71249fbebbc3f9af8a6e0fce69582b515af269541fc35af + languageName: node + linkType: hard + +"@toruslabs/base-session-manager@npm:^3.0.0": + version: 3.0.0 + resolution: "@toruslabs/base-session-manager@npm:3.0.0" + dependencies: + "@toruslabs/http-helpers": ^5.0.0 + peerDependencies: + "@babel/runtime": 7.x + checksum: 6c6ab75978ad521a558e6f3aaca58d6371adb5938da05c49b8380e7b6a710ec138561eb44150f7034b479400329377de887032247442be68b300acdd4ffddcd9 + languageName: node + linkType: hard + +"@toruslabs/broadcast-channel@npm:^9.0.1": + version: 9.0.1 + resolution: "@toruslabs/broadcast-channel@npm:9.0.1" + dependencies: + "@babel/runtime": ^7.22.10 + "@toruslabs/eccrypto": ^4.0.0 + "@toruslabs/metadata-helpers": ^5.0.0 + bowser: ^2.11.0 + loglevel: ^1.8.1 + oblivious-set: 1.1.1 + socket.io-client: ^4.7.2 + unload: ^2.4.1 + checksum: 252bba8259785beca1ec59c23f0531e89f3dcc521a121a1182b5e8e4d8dc118bb7731be6a9938ac7f193f94482df52a6413ac6c62e2314c1eb768e4339006749 + languageName: node + linkType: hard + +"@toruslabs/constants@npm:^13.0.1, @toruslabs/constants@npm:^13.0.4": + version: 13.1.0 + resolution: "@toruslabs/constants@npm:13.1.0" + peerDependencies: + "@babel/runtime": 7.x + checksum: aa5e502d34e3d9180630d50a823276c2aad3f7724f91f9e2bc101d0bf7f59ac4bda8be690b09eebd7310f38b937845730529da6204076d6692f63a0850ca3950 + languageName: node + linkType: hard + +"@toruslabs/eccrypto@npm:^4.0.0": + version: 4.0.0 + resolution: "@toruslabs/eccrypto@npm:4.0.0" + dependencies: + elliptic: ^6.5.4 + checksum: 760e498ad08c6b06e9d9da4d528d8ac877562378e908d9ea120814a9bbb1151c63269d54c191718c06a4d607a57f7643cb40e8f1bb4b8c0438cafab23a4ad531 + languageName: node + linkType: hard + +"@toruslabs/http-helpers@npm:^5.0.0": + version: 5.0.0 + resolution: "@toruslabs/http-helpers@npm:5.0.0" + dependencies: + lodash.merge: ^4.6.2 + loglevel: ^1.8.1 + peerDependencies: + "@babel/runtime": ^7.x + "@sentry/types": ^7.x + peerDependenciesMeta: + "@sentry/types": + optional: true + checksum: 2402fb85e380f8dd1502f7a32639894e3a0ce440e9b4417d45c47986bc44d873b9ff341132e8a8dc6de014a2d793fee3fb6969c24d9ce097d43605e376a8c298 + languageName: node + linkType: hard + +"@toruslabs/metadata-helpers@npm:5.0.0, @toruslabs/metadata-helpers@npm:^5.0.0": + version: 5.0.0 + resolution: "@toruslabs/metadata-helpers@npm:5.0.0" + dependencies: + "@toruslabs/eccrypto": ^4.0.0 + "@toruslabs/http-helpers": ^5.0.0 + elliptic: ^6.5.4 + ethereum-cryptography: ^2.1.2 + json-stable-stringify: ^1.0.2 + peerDependencies: + "@babel/runtime": 7.x + checksum: c0f07d0cc8c926f089a2bacdbc99daf94cffeaad0906d4112fd7e5063cfec671a917591f96ada1dacfe4fa9e05b44f457a587df33c063fd25f714c3f5c62dcfc + languageName: node + linkType: hard + +"@toruslabs/openlogin-ed25519@npm:^6.0.0": + version: 6.0.0 + resolution: "@toruslabs/openlogin-ed25519@npm:6.0.0" + dependencies: + "@toruslabs/tweetnacl-js": ^1.0.4 + peerDependencies: + "@babel/runtime": 7.x + checksum: d220d07b82d5b5fdd2a93804edc276e33e7ef8003c133038914e45427ce6982fa800033a8fcd3994b72fe9fcc35edd64765a5dfe0b15f890eb881c831c49a58a + languageName: node + linkType: hard + +"@toruslabs/openlogin-jrpc@npm:^5.0.2": + version: 5.3.0 + resolution: "@toruslabs/openlogin-jrpc@npm:5.3.0" + dependencies: + "@metamask/rpc-errors": ^6.0.0 + "@toruslabs/openlogin-utils": ^5.3.0 + end-of-stream: ^1.4.4 + events: ^3.3.0 + fast-safe-stringify: ^2.1.1 + once: ^1.4.0 + pump: ^3.0.0 + readable-stream: ^4.4.2 + peerDependencies: + "@babel/runtime": 7.x + checksum: 130e5b27ca7e63754978fd35d9889a4611dd7df249b55b6af50fac35455a7acb602e4f3771f4cb0ed37b3bdd3a03100f12ef2139cb7d8d4dbbaf8231f96565c8 + languageName: node + linkType: hard + +"@toruslabs/openlogin-jrpc@npm:^6.1.0": + version: 6.1.0 + resolution: "@toruslabs/openlogin-jrpc@npm:6.1.0" + dependencies: + "@metamask/rpc-errors": ^6.1.0 + "@toruslabs/openlogin-utils": ^6.1.0 + end-of-stream: ^1.4.4 + events: ^3.3.0 + fast-safe-stringify: ^2.1.1 + once: ^1.4.0 + pump: ^3.0.0 + readable-stream: ^4.4.2 + peerDependencies: + "@babel/runtime": 7.x + checksum: b096d505ebbc506a374f46a84d18da2aefe690285f2e99c1e92a7db45923667821f7dd0057943c9a02a54f68c1ae8dbf3f285c44fe6bf11f2d992b6b3e23134b + languageName: node + linkType: hard + +"@toruslabs/openlogin-session-manager@npm:^3.0.0": + version: 3.0.0 + resolution: "@toruslabs/openlogin-session-manager@npm:3.0.0" + dependencies: + "@toruslabs/base-session-manager": ^3.0.0 + "@toruslabs/eccrypto": ^4.0.0 + "@toruslabs/metadata-helpers": 5.0.0 + peerDependencies: + "@babel/runtime": 7.x + checksum: 55a6cc166f5e0cbe138590a2a7ef3c5d6abb61ed6dd28d2272a5a1fe01c25d137f08c5390b5539f199c46d246fc36904e231d77bc3bcf39dd9c22e003bf82ea3 + languageName: node + linkType: hard + +"@toruslabs/openlogin-utils@npm:^5.3.0": + version: 5.3.0 + resolution: "@toruslabs/openlogin-utils@npm:5.3.0" + dependencies: + "@toruslabs/constants": ^13.0.1 + base64url: ^3.0.1 + peerDependencies: + "@babel/runtime": 7.x + checksum: 706d84f83bd85846e81e68a6b12b70bea2b4073365063e5e7b69e73ea9fa5ac9e1e5e3670008a68564889759ccd86883923e9cac31a9ca3400c71aea001bdee4 + languageName: node + linkType: hard + +"@toruslabs/openlogin-utils@npm:^6.1.0": + version: 6.1.0 + resolution: "@toruslabs/openlogin-utils@npm:6.1.0" + dependencies: + "@toruslabs/constants": ^13.0.4 + base64url: ^3.0.1 + peerDependencies: + "@babel/runtime": 7.x + checksum: 410c8795903198d8b0c16f3cd85f51076c1874b26af072bb6462a0062d99d87140358add0acf95ac490e3129f6c2718706f57b83278682ed9dc07bfbf39f4d4a + languageName: node + linkType: hard + +"@toruslabs/openlogin@npm:^6.1.0": + version: 6.1.0 + resolution: "@toruslabs/openlogin@npm:6.1.0" + dependencies: + "@toruslabs/eccrypto": ^4.0.0 + "@toruslabs/metadata-helpers": ^5.0.0 + "@toruslabs/openlogin-session-manager": ^3.0.0 + "@toruslabs/openlogin-utils": ^6.1.0 + "@toruslabs/secure-pub-sub": ^0.0.1 + bowser: ^2.11.0 + events: ^3.3.0 + loglevel: ^1.8.1 + ts-custom-error: ^3.3.1 + peerDependencies: + "@babel/runtime": 7.x + checksum: 56c2290eb4fd3e1cbb248115306cbc743b34fd6de948850bf216c02ca6f0425da787c8f513faeac617106d6e0013a12806bd1e0d37e756d0797caddbda54d9e7 + languageName: node + linkType: hard + +"@toruslabs/secure-pub-sub@npm:^0.0.1": + version: 0.0.1 + resolution: "@toruslabs/secure-pub-sub@npm:0.0.1" + dependencies: + "@toruslabs/eccrypto": ^4.0.0 + "@toruslabs/http-helpers": ^5.0.0 + "@toruslabs/metadata-helpers": ^5.0.0 + loglevel: ^1.8.1 + socket.io-client: ^4.7.2 + peerDependencies: + "@babel/runtime": 7.x + checksum: 726cf979a377b8e45cd36ca22ea46a6125c90a2703a6fae6c3458c79f7a1ebda7a5870a233d755522ca096423b1af41528bf36a6ebbc40bece84e319fca5e7ab + languageName: node + linkType: hard + +"@toruslabs/solana-embed@npm:^2.0.0": + version: 2.0.0 + resolution: "@toruslabs/solana-embed@npm:2.0.0" + dependencies: + "@solana/web3.js": ^1.78.4 + "@toruslabs/base-controllers": ^4.0.1 + "@toruslabs/http-helpers": ^5.0.0 + "@toruslabs/openlogin-jrpc": ^5.0.2 + eth-rpc-errors: ^4.0.3 + fast-deep-equal: ^3.1.3 + lodash-es: ^4.17.21 + loglevel: ^1.8.1 + pump: ^3.0.0 + peerDependencies: + "@babel/runtime": 7.x + checksum: d3acda17e691cf45413759936412ff0280a6b8222ef4f1a1f1eef49ec32c2a751a7ee45851efec0a0add7a5ec4185bf814c8951e866d1c4b081becabbdd68e57 + languageName: node + linkType: hard + +"@toruslabs/torus-embed@npm:^4.0.7": + version: 4.0.8 + resolution: "@toruslabs/torus-embed@npm:4.0.8" + dependencies: + "@metamask/rpc-errors": ^6.0.0 + "@toruslabs/http-helpers": ^5.0.0 + "@toruslabs/openlogin-jrpc": ^5.0.2 + fast-deep-equal: ^3.1.3 + lodash.merge: ^4.6.2 + loglevel: ^1.8.1 + pump: ^3.0.0 + readable-stream: ^4.4.2 + peerDependencies: + "@babel/runtime": 7.x + checksum: 25b38ee19e4eb77e2eeb3ca419eb13ab81982958211caf676e8e3e02c16edd00ed928a16a82aca24b0b8421b2eed71a334ee769ab20435a23835ed8c30ecccdd + languageName: node + linkType: hard + +"@toruslabs/tweetnacl-js@npm:^1.0.4": + version: 1.0.4 + resolution: "@toruslabs/tweetnacl-js@npm:1.0.4" + checksum: 9094f55bfab6e4798bc59be20d31d4c1009f8aeb2432fc491e8dab7d6891b87cdffe5edf37c011fafb87c95bb464327b7f5a4e155b44a58d81659d0bcd804ff7 + languageName: node + linkType: hard + "@trivago/prettier-plugin-sort-imports@npm:^4.1.1": version: 4.1.1 resolution: "@trivago/prettier-plugin-sort-imports@npm:4.1.1" @@ -3575,6 +4203,22 @@ __metadata: languageName: node linkType: hard +"@walletconnect/keyvaluestorage@npm:^1.1.1": + version: 1.1.1 + resolution: "@walletconnect/keyvaluestorage@npm:1.1.1" + dependencies: + "@walletconnect/safe-json": ^1.0.1 + idb-keyval: ^6.2.1 + unstorage: ^1.9.0 + peerDependencies: + "@react-native-async-storage/async-storage": 1.x + peerDependenciesMeta: + "@react-native-async-storage/async-storage": + optional: true + checksum: 7f85cb83963153417745367742070ccb78e03bd62adb549de57a7d5fae7bcfbd9a8f42b2f445ca76a3817ffacacc69d85bbf67757c3616ee7b3525f2f8a0faea + languageName: node + linkType: hard + "@walletconnect/legacy-client@npm:^2.0.0": version: 2.0.0 resolution: "@walletconnect/legacy-client@npm:2.0.0" @@ -3780,6 +4424,20 @@ __metadata: languageName: node linkType: hard +"@walletconnect/types@npm:2.10.6": + version: 2.10.6 + resolution: "@walletconnect/types@npm:2.10.6" + dependencies: + "@walletconnect/events": ^1.0.1 + "@walletconnect/heartbeat": 1.2.1 + "@walletconnect/jsonrpc-types": 1.0.3 + "@walletconnect/keyvaluestorage": ^1.1.1 + "@walletconnect/logger": ^2.0.1 + events: ^3.3.0 + checksum: 84f411fd41debc310b4aae4969e5a78074f1f8cc937c4f1a6f92fa80775dd88bb400b365533396fc9325109a3c5dc4c4951615f2e265b5f82e9f454b17b96d5e + languageName: node + linkType: hard + "@walletconnect/universal-provider@npm:2.10.1": version: 2.10.1 resolution: "@walletconnect/universal-provider@npm:2.10.1" @@ -3819,6 +4477,28 @@ __metadata: languageName: node linkType: hard +"@walletconnect/utils@npm:^2.10.5": + version: 2.10.6 + resolution: "@walletconnect/utils@npm:2.10.6" + dependencies: + "@stablelib/chacha20poly1305": 1.0.1 + "@stablelib/hkdf": 1.0.1 + "@stablelib/random": ^1.0.2 + "@stablelib/sha256": 1.0.1 + "@stablelib/x25519": ^1.0.3 + "@walletconnect/relay-api": ^1.0.9 + "@walletconnect/safe-json": ^1.0.2 + "@walletconnect/time": ^1.0.2 + "@walletconnect/types": 2.10.6 + "@walletconnect/window-getters": ^1.0.1 + "@walletconnect/window-metadata": ^1.0.1 + detect-browser: 5.3.0 + query-string: 7.1.3 + uint8arrays: ^3.1.0 + checksum: f6543601897aaa00f7aa0178df1cb88cca8f06f65846d3f4be85c458e79d04c462ad45e1f38d3fc993fcfa4f77871c92308e81620d6256da8138ae10e4b7546c + languageName: node + linkType: hard + "@walletconnect/window-getters@npm:^1.0.1": version: 1.0.1 resolution: "@walletconnect/window-getters@npm:1.0.1" @@ -3838,6 +4518,271 @@ __metadata: languageName: node linkType: hard +"@web3auth/base-evm-adapter@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/base-evm-adapter@npm:7.2.0" + dependencies: + "@web3auth/base": ^7.2.0 + peerDependencies: + "@babel/runtime": ^7.x + checksum: 3363ef176072cfe9c45e08ab6f4b77c1b425a66b5cabd5543953a5207692e542891967b604e8f3d1eafed831302b728ade2ebb95d4b4a8e0acd61e2e7a659b5f + languageName: node + linkType: hard + +"@web3auth/base-plugin@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/base-plugin@npm:7.2.0" + dependencies: + "@web3auth/base": ^7.2.0 + checksum: 563983327706f2e05092e4fb50ae7daa517ef6016ac89956bd6ba5da91888953aa81108c1a43dde55d9e7f7ff8825ea5bd2786c97ef6074a60dcddcf594f96b2 + languageName: node + linkType: hard + +"@web3auth/base-provider@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/base-provider@npm:7.2.0" + dependencies: + "@metamask/rpc-errors": ^6.1.0 + "@toruslabs/base-controllers": ^4.9.1 + "@toruslabs/openlogin-jrpc": ^6.1.0 + "@web3auth/base": ^7.2.0 + json-rpc-random-id: ^1.0.1 + peerDependencies: + "@babel/runtime": 7.x + checksum: 244a9fd842fc45cc49ed2b60d37e43077d4588cd7aa8b53804c38ee2acd19f368b5db96b7806928014bad49df5dca4d20938bcdfa22edf42239756106b2064c0 + languageName: node + linkType: hard + +"@web3auth/base-solana-adapter@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/base-solana-adapter@npm:7.2.0" + dependencies: + "@web3auth/base": ^7.2.0 + bs58: ^5.0.0 + peerDependencies: + "@babel/runtime": ^7.x + checksum: f92415ec985a1f16b6f7d69e00f6e48d2d6cbb1e82c579cf0df9e354894163c98eaad24941da5b34a4316b584872792d5ebf640af8cbcdb4fcbf0eb102caf3a2 + languageName: node + linkType: hard + +"@web3auth/base@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/base@npm:7.2.0" + dependencies: + "@toruslabs/http-helpers": ^5.0.0 + "@toruslabs/openlogin": ^6.1.0 + "@toruslabs/openlogin-jrpc": ^6.1.0 + "@toruslabs/openlogin-utils": ^6.1.0 + jwt-decode: ^4.0.0 + loglevel: ^1.8.1 + ts-custom-error: ^3.3.1 + peerDependencies: + "@babel/runtime": ^7.x + checksum: cf9e91834e01cae1a3e057636f907b013e57ce5f9e8e5a0278592e0ad14cf1f2dea7da2b277463d957c65af5633d469563bea590dd9d463f16b23fc76dc98ed1 + languageName: node + linkType: hard + +"@web3auth/ethereum-provider@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/ethereum-provider@npm:7.2.0" + dependencies: + "@ethereumjs/common": ^4.1.0 + "@ethereumjs/tx": ^5.1.0 + "@ethereumjs/util": ^9.0.1 + "@metamask/eth-sig-util": ^7.0.1 + "@metamask/rpc-errors": ^6.1.0 + "@toruslabs/base-controllers": ^4.9.1 + "@toruslabs/http-helpers": ^5.0.0 + "@toruslabs/openlogin-jrpc": ^6.1.0 + "@walletconnect/utils": ^2.10.5 + "@web3auth/base": ^7.2.0 + "@web3auth/base-provider": ^7.2.0 + assert: ^2.1.0 + bignumber.js: ^9.1.2 + bn.js: ^5.2.1 + jsonschema: ^1.4.1 + peerDependencies: + "@babel/runtime": 7.x + checksum: 022012afcb675c51de3c724ef4ece4e54182b053716a48fc6553c043cbf24c418316b935a55caf3a51d30f7fcafb55c57d8a73fd3da03f9c9679a51159c9e623 + languageName: node + linkType: hard + +"@web3auth/metamask-adapter@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/metamask-adapter@npm:7.2.0" + dependencies: + "@metamask/detect-provider": ^2.0.0 + "@web3auth/base": ^7.2.0 + "@web3auth/base-evm-adapter": ^7.2.0 + peerDependencies: + "@babel/runtime": ^7.x + checksum: 393c65baf0ecf84754a46c1ae062fb66852785ab27e315e8bfe46708a8b85ddbfcfb14a491b4320bdeee9270d35f90974d411f3915b41b0d51f94c56e8937def + languageName: node + linkType: hard + +"@web3auth/modal@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/modal@npm:7.2.0" + dependencies: + "@web3auth/base": ^7.2.0 + "@web3auth/base-provider": ^7.2.0 + "@web3auth/ethereum-provider": ^7.2.0 + "@web3auth/metamask-adapter": ^7.2.0 + "@web3auth/no-modal": ^7.2.0 + "@web3auth/openlogin-adapter": ^7.2.0 + "@web3auth/phantom-adapter": ^7.2.0 + "@web3auth/solana-provider": ^7.2.0 + "@web3auth/torus-evm-adapter": ^7.2.0 + "@web3auth/torus-solana-adapter": ^7.2.0 + "@web3auth/ui": ^7.2.0 + "@web3auth/wallet-connect-v2-adapter": ^7.2.0 + peerDependencies: + "@babel/runtime": 7.x + "@solana/web3.js": ^1.x + checksum: a16a7bae8e2d49afd2eac462f4fa75280f613cc20bf4505ebde2dd794175654476f4332e85108b4d6f246d9759422a737866483b945a761ef47d3fbdc8a46a68 + languageName: node + linkType: hard + +"@web3auth/no-modal@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/no-modal@npm:7.2.0" + dependencies: + "@toruslabs/openlogin": ^6.1.0 + "@toruslabs/openlogin-jrpc": ^6.1.0 + "@toruslabs/openlogin-utils": ^6.1.0 + "@web3auth/base": ^7.2.0 + "@web3auth/base-plugin": ^7.2.0 + "@web3auth/base-provider": ^7.2.0 + peerDependencies: + "@babel/runtime": ^7.x + checksum: 08bef72169bf37a1e43c11d8be2066bccb2c30473b964a56c87ac9f8b0fa25b8137c86bb96be7fbd22661657fe96d0552f5e87c9a0d9ccf0402692b977761dc5 + languageName: node + linkType: hard + +"@web3auth/openlogin-adapter@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/openlogin-adapter@npm:7.2.0" + dependencies: + "@toruslabs/openlogin": ^6.1.0 + "@toruslabs/openlogin-utils": ^6.1.0 + "@web3auth/base": ^7.2.0 + "@web3auth/base-provider": ^7.2.0 + lodash.merge: ^4.6.2 + peerDependencies: + "@babel/runtime": ^7.x + "@solana/web3.js": ^1.x + checksum: 9f5c8a6416048f43edcbfc35bff861b1fe3d89b0d88cb01cc66922d7c1fbe498b629661fc4ca61423f8ae0fc8cb3a73eeb5c52ee36ac8286f02f33feed86baaa + languageName: node + linkType: hard + +"@web3auth/phantom-adapter@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/phantom-adapter@npm:7.2.0" + dependencies: + "@web3auth/base": ^7.2.0 + "@web3auth/base-provider": ^7.2.0 + "@web3auth/base-solana-adapter": ^7.2.0 + "@web3auth/solana-provider": ^7.2.0 + bn.js: ^5.2.1 + peerDependencies: + "@babel/runtime": ^7.x + "@solana/web3.js": ^1.x + checksum: 1828c1004404534afee7bac8227514842bc0016da9802ebd65398fc3b69ef82b7fc51f8fb5fc9c0b6fcde24723b79b12aadeb827395ee6170dd0b0e64a459af2 + languageName: node + linkType: hard + +"@web3auth/solana-provider@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/solana-provider@npm:7.2.0" + dependencies: + "@metamask/rpc-errors": ^6.1.0 + "@toruslabs/base-controllers": ^4.9.1 + "@toruslabs/openlogin-ed25519": ^6.0.0 + "@toruslabs/openlogin-jrpc": ^6.1.0 + "@toruslabs/tweetnacl-js": ^1.0.4 + "@web3auth/base": ^7.2.0 + "@web3auth/base-provider": ^7.2.0 + bn.js: ^5.2.1 + bs58: ^5.0.0 + json-rpc-random-id: ^1.0.1 + peerDependencies: + "@babel/runtime": ^7.x + "@solana/web3.js": ^1.x + checksum: 7ab0ba2f9c958b58948e0cb8ac6895630a3a29d835a1182b447ecd6607e67238b9221fabf20c2287a79569a0fe5a2854927fefd94ab3c9d3749d95bc93e9d6d6 + languageName: node + linkType: hard + +"@web3auth/torus-evm-adapter@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/torus-evm-adapter@npm:7.2.0" + dependencies: + "@toruslabs/torus-embed": ^4.0.7 + "@web3auth/base": ^7.2.0 + "@web3auth/base-evm-adapter": ^7.2.0 + peerDependencies: + "@babel/runtime": ^7.x + checksum: 70a8fad64d09141acae09a7d200537ce52bb40170a3a3e954074ea45acc29e9a9d180bf89c82ad3ccfc710ed212fbef588e754c4aa4c1d13e0b2bfdd68150c5e + languageName: node + linkType: hard + +"@web3auth/torus-solana-adapter@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/torus-solana-adapter@npm:7.2.0" + dependencies: + "@toruslabs/solana-embed": ^2.0.0 + "@web3auth/base": ^7.2.0 + "@web3auth/base-provider": ^7.2.0 + "@web3auth/base-solana-adapter": ^7.2.0 + "@web3auth/solana-provider": ^7.2.0 + peerDependencies: + "@babel/runtime": ^7.x + "@solana/web3.js": ^1.x + checksum: b9e6f7bd648f59c4d7bacff1855e36e9429d7554c8fd7b29e8e20188922694f268df2b8f3f8fdcc4df535eb03845636fea1643baef752eb6a9813b031e4a2086 + languageName: node + linkType: hard + +"@web3auth/ui@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/ui@npm:7.2.0" + dependencies: + "@toruslabs/http-helpers": ^5.0.0 + "@toruslabs/openlogin": ^6.1.0 + "@toruslabs/openlogin-jrpc": ^6.1.0 + "@toruslabs/openlogin-utils": ^6.1.0 + "@web3auth/base": ^7.2.0 + bowser: ^2.11.0 + classnames: ^2.3.2 + copy-to-clipboard: ^3.3.3 + i18next: ^23.7.6 + lodash.clonedeep: ^4.5.0 + lodash.merge: ^4.6.2 + react-i18next: ^13.5.0 + react-qrcode-logo: ^2.9.0 + peerDependencies: + "@babel/runtime": ^7.x + react: ^18.x + react-dom: ^18.x + checksum: 288a8cbb42c5dc9387d41f2cf53f95bcdaee7a2ac9860a5bdff61c2faf545ed47ac72617c64d3e48fa1d03a89f53e91fdbb13de4a7b3dbd4cba43c4bbbc54f71 + languageName: node + linkType: hard + +"@web3auth/wallet-connect-v2-adapter@npm:^7.2.0": + version: 7.2.0 + resolution: "@web3auth/wallet-connect-v2-adapter@npm:7.2.0" + dependencies: + "@web3auth/base": ^7.2.0 + "@web3auth/base-evm-adapter": ^7.2.0 + "@web3auth/ethereum-provider": ^7.2.0 + lodash.merge: ^4.6.2 + peerDependencies: + "@babel/runtime": ^7.x + "@walletconnect/sign-client": ^2.x + "@walletconnect/types": ^2.x + "@walletconnect/utils": ^2.x + checksum: 10d3b5b4ed8651275be9b880d1d38e61726dcb287e2baca19dfcaae7144cd53f8dc46aea802be022c46c9ed7fd15ae5daa4e39c1a3457e4ffc1f368d52340a90 + languageName: node + linkType: hard + "JSONStream@npm:1.3.2": version: 1.3.2 resolution: "JSONStream@npm:1.3.2" @@ -3904,6 +4849,15 @@ __metadata: languageName: node linkType: hard +"abort-controller@npm:^3.0.0": + version: 3.0.0 + resolution: "abort-controller@npm:3.0.0" + dependencies: + event-target-shim: ^5.0.0 + checksum: 170bdba9b47b7e65906a28c8ce4f38a7a369d78e2271706f020849c1bfe0ee2067d4261df8bbb66eb84f79208fd5b710df759d64191db58cfba7ce8ef9c54b75 + languageName: node + linkType: hard + "abstract-level@npm:^1.0.0, abstract-level@npm:^1.0.2, abstract-level@npm:^1.0.3": version: 1.0.3 resolution: "abstract-level@npm:1.0.3" @@ -3971,6 +4925,15 @@ __metadata: languageName: node linkType: hard +"acorn@npm:^8.10.0": + version: 8.11.2 + resolution: "acorn@npm:8.11.2" + bin: + acorn: bin/acorn + checksum: 818450408684da89423e3daae24e4dc9b68692db8ab49ea4569c7c5abb7a3f23669438bf129cc81dfdada95e1c9b944ee1bfca2c57a05a4dc73834a612fbf6a7 + languageName: node + linkType: hard + "acorn@npm:^8.4.1, acorn@npm:^8.8.0": version: 8.8.0 resolution: "acorn@npm:8.8.0" @@ -4037,6 +5000,15 @@ __metadata: languageName: node linkType: hard +"agentkeepalive@npm:^4.3.0": + version: 4.5.0 + resolution: "agentkeepalive@npm:4.5.0" + dependencies: + humanize-ms: ^1.2.1 + checksum: 13278cd5b125e51eddd5079f04d6fe0914ac1b8b91c1f3db2c1822f99ac1a7457869068997784342fe455d59daaff22e14fb7b8c3da4e741896e7e31faf92481 + languageName: node + linkType: hard + "aggregate-error@npm:^3.0.0": version: 3.1.0 resolution: "aggregate-error@npm:3.1.0" @@ -4208,6 +5180,16 @@ __metadata: languageName: node linkType: hard +"anymatch@npm:^3.1.3": + version: 3.1.3 + resolution: "anymatch@npm:3.1.3" + dependencies: + normalize-path: ^3.0.0 + picomatch: ^2.0.4 + checksum: 3e044fd6d1d26545f235a9fe4d7a534e2029d8e59fa7fd9f2a6eb21230f6b5380ea1eaf55136e60cbf8e613544b3b766e7a6fa2102e2a3a117505466e3025dc2 + languageName: node + linkType: hard + "anymatch@npm:~3.1.1, anymatch@npm:~3.1.2": version: 3.1.2 resolution: "anymatch@npm:3.1.2" @@ -4225,6 +5207,13 @@ __metadata: languageName: node linkType: hard +"arch@npm:^2.2.0": + version: 2.2.0 + resolution: "arch@npm:2.2.0" + checksum: e21b7635029fe8e9cdd5a026f9a6c659103e63fff423834323cdf836a1bb240a72d0c39ca8c470f84643385cf581bd8eda2cad8bf493e27e54bd9783abe9101f + languageName: node + linkType: hard + "are-we-there-yet@npm:^2.0.0": version: 2.0.0 resolution: "are-we-there-yet@npm:2.0.0" @@ -4386,6 +5375,19 @@ __metadata: languageName: node linkType: hard +"assert@npm:^2.1.0": + version: 2.1.0 + resolution: "assert@npm:2.1.0" + dependencies: + call-bind: ^1.0.2 + is-nan: ^1.3.2 + object-is: ^1.1.5 + object.assign: ^4.1.4 + util: ^0.12.5 + checksum: 1ed1cabba9abe55f4109b3f7292b4e4f3cf2953aad8dc148c0b3c3bd676675c31b1abb32ef563b7d5a19d1715bf90d1e5f09fad2a4ee655199468902da80f7c2 + languageName: node + linkType: hard + "assertion-error@npm:^1.1.0": version: 1.1.0 resolution: "assertion-error@npm:1.1.0" @@ -4416,6 +5418,15 @@ __metadata: languageName: node linkType: hard +"async-mutex@npm:^0.4.0": + version: 0.4.0 + resolution: "async-mutex@npm:0.4.0" + dependencies: + tslib: ^2.4.0 + checksum: 813a71728b35a4fbfd64dba719f04726d9133c67b577fcd951b7028c4a675a13ee34e69beb82d621f87bf81f5d4f135c4c44be0448550c7db728547244ef71fc + languageName: node + linkType: hard + "async-sema@npm:^3.1.1": version: 3.1.1 resolution: "async-sema@npm:3.1.1" @@ -4551,6 +5562,13 @@ __metadata: languageName: node linkType: hard +"base-x@npm:^4.0.0": + version: 4.0.0 + resolution: "base-x@npm:4.0.0" + checksum: b25db9e07eb1998472a20557c7f00c797dc0595f79df95155ab74274e7fa98b9f2659b3ee547ac8773666b7f69540656793aeb97ad2b1ceccdb6fa5faaf69ac0 + languageName: node + linkType: hard + "base64-js@npm:^1.3.1": version: 1.5.1 resolution: "base64-js@npm:1.5.1" @@ -4558,6 +5576,13 @@ __metadata: languageName: node linkType: hard +"base64url@npm:^3.0.1": + version: 3.0.1 + resolution: "base64url@npm:3.0.1" + checksum: a77b2a3a526b3343e25be424de3ae0aa937d78f6af7c813ef9020ef98001c0f4e2323afcd7d8b2d2978996bf8c42445c3e9f60c218c622593e5fdfd54a3d6e18 + languageName: node + linkType: hard + "bcrypt-pbkdf@npm:^1.0.0, bcrypt-pbkdf@npm:^1.0.2": version: 1.0.2 resolution: "bcrypt-pbkdf@npm:1.0.2" @@ -4607,7 +5632,7 @@ __metadata: languageName: node linkType: hard -"bignumber.js@npm:*": +"bignumber.js@npm:*, bignumber.js@npm:^9.1.2": version: 9.1.2 resolution: "bignumber.js@npm:9.1.2" checksum: 582c03af77ec9cb0ebd682a373ee6c66475db94a4325f92299621d544aa4bd45cb45fd60001610e94aef8ae98a0905fa538241d9638d4422d57abbeeac6fadaf @@ -4711,6 +5736,13 @@ __metadata: languageName: node linkType: hard +"bowser@npm:^2.11.0": + version: 2.11.0 + resolution: "bowser@npm:2.11.0" + checksum: 29c3f01f22e703fa6644fc3b684307442df4240b6e10f6cfe1b61c6ca5721073189ca97cdeedb376081148c8518e33b1d818a57f781d70b0b70e1f31fb48814f + languageName: node + linkType: hard + "brace-expansion@npm:^1.1.7": version: 1.1.11 resolution: "brace-expansion@npm:1.1.11" @@ -4802,6 +5834,15 @@ __metadata: languageName: node linkType: hard +"bs58@npm:^5.0.0": + version: 5.0.0 + resolution: "bs58@npm:5.0.0" + dependencies: + base-x: ^4.0.0 + checksum: 2475cb0684e07077521aac718e604a13e0f891d58cff923d437a2f7e9e28703ab39fce9f84c7c703ab369815a675f11e3bd394d38643bfe8969fbe42e6833d45 + languageName: node + linkType: hard + "bs58check@npm:^2.1.2": version: 2.1.2 resolution: "bs58check@npm:2.1.2" @@ -4861,23 +5902,23 @@ __metadata: languageName: node linkType: hard -"buffer@npm:^5.5.0": - version: 5.7.1 - resolution: "buffer@npm:5.7.1" +"buffer@npm:6.0.3, buffer@npm:^6.0.3, buffer@npm:~6.0.3": + version: 6.0.3 + resolution: "buffer@npm:6.0.3" dependencies: base64-js: ^1.3.1 - ieee754: ^1.1.13 - checksum: e2cf8429e1c4c7b8cbd30834ac09bd61da46ce35f5c22a78e6c2f04497d6d25541b16881e30a019c6fd3154150650ccee27a308eff3e26229d788bbdeb08ab84 + ieee754: ^1.2.1 + checksum: 5ad23293d9a731e4318e420025800b42bf0d264004c0286c8cc010af7a270c7a0f6522e84f54b9ad65cbd6db20b8badbfd8d2ebf4f80fa03dab093b89e68c3f9 languageName: node linkType: hard -"buffer@npm:^6.0.3, buffer@npm:~6.0.3": - version: 6.0.3 - resolution: "buffer@npm:6.0.3" +"buffer@npm:^5.5.0": + version: 5.7.1 + resolution: "buffer@npm:5.7.1" dependencies: base64-js: ^1.3.1 - ieee754: ^1.2.1 - checksum: 5ad23293d9a731e4318e420025800b42bf0d264004c0286c8cc010af7a270c7a0f6522e84f54b9ad65cbd6db20b8badbfd8d2ebf4f80fa03dab093b89e68c3f9 + ieee754: ^1.1.13 + checksum: e2cf8429e1c4c7b8cbd30834ac09bd61da46ce35f5c22a78e6c2f04497d6d25541b16881e30a019c6fd3154150650ccee27a308eff3e26229d788bbdeb08ab84 languageName: node linkType: hard @@ -4950,6 +5991,17 @@ __metadata: languageName: node linkType: hard +"call-bind@npm:^1.0.5": + version: 1.0.5 + resolution: "call-bind@npm:1.0.5" + dependencies: + function-bind: ^1.1.2 + get-intrinsic: ^1.2.1 + set-function-length: ^1.1.1 + checksum: 449e83ecbd4ba48e7eaac5af26fea3b50f8f6072202c2dd7c5a6e7a6308f2421abe5e13a3bbd55221087f76320c5e09f25a8fdad1bab2b77c68ae74d92234ea5 + languageName: node + linkType: hard + "callsites@npm:^3.0.0": version: 3.1.0 resolution: "callsites@npm:3.1.0" @@ -5155,6 +6207,15 @@ __metadata: languageName: node linkType: hard +"citty@npm:^0.1.3, citty@npm:^0.1.4": + version: 0.1.5 + resolution: "citty@npm:0.1.5" + dependencies: + consola: ^3.2.3 + checksum: 9a2379fd01345500f1eb2bcc33f5e60be8379551091b43a3ba4e3a39c63a92e41453dea542ab9f2528fe9e19177ff1453c01a845a74529292af34fdafd23a5f6 + languageName: node + linkType: hard + "classic-level@npm:^1.2.0": version: 1.2.0 resolution: "classic-level@npm:1.2.0" @@ -5169,7 +6230,7 @@ __metadata: languageName: node linkType: hard -"classnames@npm:^2.1.1": +"classnames@npm:^2.1.1, classnames@npm:^2.3.2": version: 2.3.2 resolution: "classnames@npm:2.3.2" checksum: 2c62199789618d95545c872787137262e741f9db13328e216b093eea91c85ef2bfb152c1f9e63027204e2559a006a92eb74147d46c800a9f96297ae1d9f96f4e @@ -5233,6 +6294,17 @@ __metadata: languageName: node linkType: hard +"clipboardy@npm:^3.0.0": + version: 3.0.0 + resolution: "clipboardy@npm:3.0.0" + dependencies: + arch: ^2.2.0 + execa: ^5.1.1 + is-wsl: ^2.2.0 + checksum: 2c292acb59705494cbe07d7df7c8becff4f01651514d32ebd80f4aec2d20946d8f3824aac67ecdf2d09ef21fdf0eb24b6a7f033c137ccdceedc4661c54455c94 + languageName: node + linkType: hard + "cliui@npm:^5.0.0": version: 5.0.0 resolution: "cliui@npm:5.0.0" @@ -5280,6 +6352,13 @@ __metadata: languageName: node linkType: hard +"cluster-key-slot@npm:^1.1.0": + version: 1.1.2 + resolution: "cluster-key-slot@npm:1.1.2" + checksum: be0ad2d262502adc998597e83f9ded1b80f827f0452127c5a37b22dfca36bab8edf393f7b25bb626006fb9fb2436106939ede6d2d6ecf4229b96a47f27edd681 + languageName: node + linkType: hard + "code-block-writer@npm:^10.1.1": version: 10.1.1 resolution: "code-block-writer@npm:10.1.1" @@ -5436,6 +6515,13 @@ __metadata: languageName: node linkType: hard +"consola@npm:^3.2.3": + version: 3.2.3 + resolution: "consola@npm:3.2.3" + checksum: 32ec70e177dd2385c42e38078958cc7397be91db21af90c6f9faa0b16168b49b1c61d689338604bbb2d64370b9347a35f42a9197663a913d3a405bb0ce728499 + languageName: node + linkType: hard + "console-control-strings@npm:^1.0.0, console-control-strings@npm:^1.1.0": version: 1.1.0 resolution: "console-control-strings@npm:1.1.0" @@ -5450,6 +6536,13 @@ __metadata: languageName: node linkType: hard +"cookie-es@npm:^1.0.0": + version: 1.0.0 + resolution: "cookie-es@npm:1.0.0" + checksum: e8721cf4d38f3e44049c9118874b323f4f674b1c5cef84a2b888f5bf86ad720ad17b51b43150cad7535a375c24e2921da603801ad28aa6125c3d36c031b41468 + languageName: node + linkType: hard + "cookie@npm:^0.4.1": version: 0.4.2 resolution: "cookie@npm:0.4.2" @@ -5516,6 +6609,18 @@ __metadata: languageName: node linkType: hard +"crc@npm:^4.3.2": + version: 4.3.2 + resolution: "crc@npm:4.3.2" + peerDependencies: + buffer: ">=6.0.3" + peerDependenciesMeta: + buffer: + optional: true + checksum: 8231cc25331727083ffd22da3575110fc49b4dc8725de973bd43261d4426aba134ed3a75cc247f7c5e97a6e171f87dffc3325b82890e86d032de2e6bcef09c32 + languageName: node + linkType: hard + "create-hash@npm:^1.1.0, create-hash@npm:^1.1.2, create-hash@npm:^1.2.0": version: 1.2.0 resolution: "create-hash@npm:1.2.0" @@ -5662,7 +6767,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": +"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:~4.3.1, debug@npm:~4.3.2": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -5773,6 +6878,17 @@ __metadata: languageName: node linkType: hard +"define-data-property@npm:^1.1.1": + version: 1.1.1 + resolution: "define-data-property@npm:1.1.1" + dependencies: + get-intrinsic: ^1.2.1 + gopd: ^1.0.1 + has-property-descriptors: ^1.0.0 + checksum: a29855ad3f0630ea82e3c5012c812efa6ca3078d5c2aa8df06b5f597c1cde6f7254692df41945851d903e05a1668607b6d34e778f402b9ff9ffb38111f1a3f0d + languageName: node + linkType: hard + "define-lazy-prop@npm:^2.0.0": version: 2.0.0 resolution: "define-lazy-prop@npm:2.0.0" @@ -5797,6 +6913,13 @@ __metadata: languageName: node linkType: hard +"defu@npm:^6.1.2, defu@npm:^6.1.3": + version: 6.1.3 + resolution: "defu@npm:6.1.3" + checksum: c857a0cf854632e8528dad36454fd1c812bff8f5f091d5a6892e75d7f6b76d8319afbbfb8c504daab84ac86e40037ff37c544d50f89ed5b5419ba1989a226777 + languageName: node + linkType: hard + "delay@npm:^5.0.0": version: 5.0.0 resolution: "delay@npm:5.0.0" @@ -5818,6 +6941,13 @@ __metadata: languageName: node linkType: hard +"denque@npm:^2.1.0": + version: 2.1.0 + resolution: "denque@npm:2.1.0" + checksum: 1d4ae1d05e59ac3a3481e7b478293f4b4c813819342273f3d5b826c7ffa9753c520919ba264f377e09108d24ec6cf0ec0ac729a5686cbb8f32d797126c5dae74 + languageName: node + linkType: hard + "depd@npm:2.0.0": version: 2.0.0 resolution: "depd@npm:2.0.0" @@ -5832,6 +6962,13 @@ __metadata: languageName: node linkType: hard +"destr@npm:^2.0.1, destr@npm:^2.0.2": + version: 2.0.2 + resolution: "destr@npm:2.0.2" + checksum: cb63dd477d1c323f95650ce7784f1497466d68150ac0fddd6c99652be45c9dcb997d53fd5eb6c6fda6c0b2a5e5b4fc7fa3c3e18dace3d810ba4cf45d8b55bdd6 + languageName: node + linkType: hard + "detect-browser@npm:5.3.0, detect-browser@npm:^5.3.0": version: 5.3.0 resolution: "detect-browser@npm:5.3.0" @@ -5839,6 +6976,15 @@ __metadata: languageName: node linkType: hard +"detect-libc@npm:^1.0.3": + version: 1.0.3 + resolution: "detect-libc@npm:1.0.3" + bin: + detect-libc: ./bin/detect-libc.js + checksum: daaaed925ffa7889bd91d56e9624e6c8033911bb60f3a50a74a87500680652969dbaab9526d1e200a4c94acf80fc862a22131841145a0a8482d60a99c24f4a3e + languageName: node + linkType: hard + "detect-libc@npm:^2.0.0": version: 2.0.1 resolution: "detect-libc@npm:2.0.1" @@ -6127,7 +7273,7 @@ __metadata: languageName: node linkType: hard -"end-of-stream@npm:^1.0.0, end-of-stream@npm:^1.1.0, end-of-stream@npm:^1.4.1": +"end-of-stream@npm:^1.0.0, end-of-stream@npm:^1.1.0, end-of-stream@npm:^1.4.1, end-of-stream@npm:^1.4.4": version: 1.4.4 resolution: "end-of-stream@npm:1.4.4" dependencies: @@ -6136,6 +7282,26 @@ __metadata: languageName: node linkType: hard +"engine.io-client@npm:~6.5.2": + version: 6.5.3 + resolution: "engine.io-client@npm:6.5.3" + dependencies: + "@socket.io/component-emitter": ~3.1.0 + debug: ~4.3.1 + engine.io-parser: ~5.2.1 + ws: ~8.11.0 + xmlhttprequest-ssl: ~2.0.0 + checksum: a72596fae99afbdb899926fccdb843f8fa790c69085b881dde121285a6935da2c2c665ebe88e0e6aa4285637782df84ac882084ff4892ad2430b059fc0045db0 + languageName: node + linkType: hard + +"engine.io-parser@npm:~5.2.1": + version: 5.2.1 + resolution: "engine.io-parser@npm:5.2.1" + checksum: 55b0e8e18500f50c1573675c53597c5552554ead08d3f30ff19fde6409e48f882a8e01f84e9772cd155c18a1d653d06f6bf57b4e1f8b834c63c9eaf3b657b88e + languageName: node + linkType: hard + "enhanced-resolve@npm:^5.10.0": version: 5.12.0 resolution: "enhanced-resolve@npm:5.12.0" @@ -6978,7 +8144,7 @@ __metadata: languageName: node linkType: hard -"eth-rpc-errors@npm:^4.0.2": +"eth-rpc-errors@npm:^4.0.2, eth-rpc-errors@npm:^4.0.3": version: 4.0.3 resolution: "eth-rpc-errors@npm:4.0.3" dependencies: @@ -7031,6 +8197,18 @@ __metadata: languageName: node linkType: hard +"ethereum-cryptography@npm:^2.0.0, ethereum-cryptography@npm:^2.1.2": + version: 2.1.2 + resolution: "ethereum-cryptography@npm:2.1.2" + dependencies: + "@noble/curves": 1.1.0 + "@noble/hashes": 1.3.1 + "@scure/bip32": 1.3.1 + "@scure/bip39": 1.2.1 + checksum: 2e8f7b8cc90232ae838ab6a8167708e8362621404d26e79b5d9e762c7b53d699f7520aff358d9254de658fcd54d2d0af168ff909943259ed27dc4cef2736410c + languageName: node + linkType: hard + "ethereumjs-abi@npm:^0.6.8": version: 0.6.8 resolution: "ethereumjs-abi@npm:0.6.8" @@ -7144,6 +8322,13 @@ __metadata: languageName: node linkType: hard +"event-target-shim@npm:^5.0.0": + version: 5.0.1 + resolution: "event-target-shim@npm:5.0.1" + checksum: 1ffe3bb22a6d51bdeb6bf6f7cf97d2ff4a74b017ad12284cc9e6a279e727dc30a5de6bb613e5596ff4dc3e517841339ad09a7eec44266eccb1aa201a30448166 + languageName: node + linkType: hard + "eventemitter3@npm:^4.0.7": version: 4.0.7 resolution: "eventemitter3@npm:4.0.7" @@ -7169,6 +8354,23 @@ __metadata: languageName: node linkType: hard +"execa@npm:^5.1.1": + version: 5.1.1 + resolution: "execa@npm:5.1.1" + dependencies: + cross-spawn: ^7.0.3 + get-stream: ^6.0.0 + human-signals: ^2.1.0 + is-stream: ^2.0.0 + merge-stream: ^2.0.0 + npm-run-path: ^4.0.1 + onetime: ^5.1.2 + signal-exit: ^3.0.3 + strip-final-newline: ^2.0.0 + checksum: fba9022c8c8c15ed862847e94c252b3d946036d7547af310e344a527e59021fd8b6bb0723883ea87044dc4f0201f949046993124a42ccb0855cae5bf8c786343 + languageName: node + linkType: hard + "execa@npm:^6.1.0": version: 6.1.0 resolution: "execa@npm:6.1.0" @@ -7282,7 +8484,7 @@ __metadata: languageName: node linkType: hard -"fast-safe-stringify@npm:^2.0.6": +"fast-safe-stringify@npm:^2.0.6, fast-safe-stringify@npm:^2.1.1": version: 2.1.1 resolution: "fast-safe-stringify@npm:2.1.1" checksum: a851cbddc451745662f8f00ddb622d6766f9bd97642dabfd9a405fb0d646d69fc0b9a1243cbf67f5f18a39f40f6fa821737651ff1bceeba06c9992ca2dc5bd3d @@ -7661,6 +8863,13 @@ __metadata: languageName: node linkType: hard +"function-bind@npm:^1.1.2": + version: 1.1.2 + resolution: "function-bind@npm:1.1.2" + checksum: 2b0ff4ce708d99715ad14a6d1f894e2a83242e4a52ccfcefaee5e40050562e5f6dafc1adbb4ce2d4ab47279a45dc736ab91ea5042d843c3c092820dfe032efb1 + languageName: node + linkType: hard + "function.prototype.name@npm:^1.1.5": version: 1.1.5 resolution: "function.prototype.name@npm:1.1.5" @@ -7745,6 +8954,18 @@ __metadata: languageName: node linkType: hard +"get-intrinsic@npm:^1.2.1": + version: 1.2.2 + resolution: "get-intrinsic@npm:1.2.2" + dependencies: + function-bind: ^1.1.2 + has-proto: ^1.0.1 + has-symbols: ^1.0.3 + hasown: ^2.0.0 + checksum: 447ff0724df26829908dc033b62732359596fcf66027bc131ab37984afb33842d9cd458fd6cecadfe7eac22fd8a54b349799ed334cf2726025c921c7250e7417 + languageName: node + linkType: hard + "get-nonce@npm:^1.0.0": version: 1.0.1 resolution: "get-nonce@npm:1.0.1" @@ -7752,6 +8973,13 @@ __metadata: languageName: node linkType: hard +"get-port-please@npm:^3.1.1": + version: 3.1.1 + resolution: "get-port-please@npm:3.1.1" + checksum: e2b0b3822e5a5a37994a0bd1c708eb220ca47fd4b29adbc6ba076fb378d4706c07eba4d382a8283f6534e870f9081a58f923a9f873f7d1f298f5fae386470211 + languageName: node + linkType: hard + "get-port@npm:^3.1.0": version: 3.2.0 resolution: "get-port@npm:3.2.0" @@ -7759,7 +8987,7 @@ __metadata: languageName: node linkType: hard -"get-stream@npm:^6.0.1": +"get-stream@npm:^6.0.0, get-stream@npm:^6.0.1": version: 6.0.1 resolution: "get-stream@npm:6.0.1" checksum: e04ecece32c92eebf5b8c940f51468cd53554dcbb0ea725b2748be583c9523d00128137966afce410b9b051eb2ef16d657cd2b120ca8edafcf5a65e81af63cad @@ -8020,6 +9248,15 @@ __metadata: languageName: node linkType: hard +"gopd@npm:^1.0.1": + version: 1.0.1 + resolution: "gopd@npm:1.0.1" + dependencies: + get-intrinsic: ^1.1.3 + checksum: a5ccfb8806e0917a94e0b3de2af2ea4979c1da920bc381667c260e00e7cafdbe844e2cb9c5bcfef4e5412e8bf73bab837285bc35c7ba73aaaf0134d4583393a6 + languageName: node + linkType: hard + "graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": version: 4.2.10 resolution: "graceful-fs@npm:4.2.10" @@ -8041,6 +9278,22 @@ __metadata: languageName: node linkType: hard +"h3@npm:^1.8.1, h3@npm:^1.8.2": + version: 1.9.0 + resolution: "h3@npm:1.9.0" + dependencies: + cookie-es: ^1.0.0 + defu: ^6.1.3 + destr: ^2.0.2 + iron-webcrypto: ^1.0.0 + radix3: ^1.1.0 + ufo: ^1.3.2 + uncrypto: ^0.1.3 + unenv: ^1.7.4 + checksum: 7305163b6fa4ecd7d14fce85e6372fae3580728957c8c021fa6b18176ce5e0cbfcc07c523bafcf7b34e895d2dab3ba731a11af43282faee4f2c8a331ec144f51 + languageName: node + linkType: hard + "handlebars@npm:^4.0.1": version: 4.7.7 resolution: "handlebars@npm:4.7.7" @@ -8224,6 +9477,13 @@ __metadata: languageName: node linkType: hard +"has-proto@npm:^1.0.1": + version: 1.0.1 + resolution: "has-proto@npm:1.0.1" + checksum: febc5b5b531de8022806ad7407935e2135f1cc9e64636c3916c6842bd7995994ca3b29871ecd7954bd35f9e2986c17b3b227880484d22259e2f8e6ce63fd383e + languageName: node + linkType: hard + "has-symbols@npm:^1.0.0, has-symbols@npm:^1.0.2, has-symbols@npm:^1.0.3": version: 1.0.3 resolution: "has-symbols@npm:1.0.3" @@ -8287,6 +9547,15 @@ __metadata: languageName: node linkType: hard +"hasown@npm:^2.0.0": + version: 2.0.0 + resolution: "hasown@npm:2.0.0" + dependencies: + function-bind: ^1.1.2 + checksum: 6151c75ca12554565098641c98a40f4cc86b85b0fd5b6fe92360967e4605a4f9610f7757260b4e8098dd1c2ce7f4b095f2006fe72a570e3b6d2d28de0298c176 + languageName: node + linkType: hard + "he@npm:1.2.0": version: 1.2.0 resolution: "he@npm:1.2.0" @@ -8330,6 +9599,15 @@ __metadata: languageName: node linkType: hard +"html-parse-stringify@npm:^3.0.1": + version: 3.0.1 + resolution: "html-parse-stringify@npm:3.0.1" + dependencies: + void-elements: 3.1.0 + checksum: 334fdebd4b5c355dba8e95284cead6f62bf865a2359da2759b039db58c805646350016d2017875718bc3c4b9bf81a0d11be5ee0cf4774a3a5a7b97cde21cfd67 + languageName: node + linkType: hard + "http-basic@npm:^8.1.1": version: 8.1.3 resolution: "http-basic@npm:8.1.3" @@ -8382,6 +9660,13 @@ __metadata: languageName: node linkType: hard +"http-shutdown@npm:^1.2.2": + version: 1.2.2 + resolution: "http-shutdown@npm:1.2.2" + checksum: 5dccd94f4fe4f51f9cbd7ec4586121160cd6470728e581662ea8032724440d891c4c92b8210b871ac468adadb3c99c40098ad0f752a781a550abae49dfa26206 + languageName: node + linkType: hard + "http-signature@npm:~1.2.0": version: 1.2.0 resolution: "http-signature@npm:1.2.0" @@ -8410,6 +9695,13 @@ __metadata: languageName: node linkType: hard +"human-signals@npm:^2.1.0": + version: 2.1.0 + resolution: "human-signals@npm:2.1.0" + checksum: b87fd89fce72391625271454e70f67fe405277415b48bcc0117ca73d31fa23a4241787afdc8d67f5a116cf37258c052f59ea82daffa72364d61351423848e3b8 + languageName: node + linkType: hard + "human-signals@npm:^3.0.1": version: 3.0.1 resolution: "human-signals@npm:3.0.1" @@ -8446,6 +9738,15 @@ __metadata: languageName: node linkType: hard +"i18next@npm:^23.7.6": + version: 23.7.7 + resolution: "i18next@npm:23.7.7" + dependencies: + "@babel/runtime": ^7.23.2 + checksum: f063140c8b38fd51b673200693ddc5f697ba9c4a87c5c7ca4b9233dd2cf8ada53e76e14af9659db5b3a5b0f4c3acb517ebaf28863116068e7d6bdacfaf7f0b09 + languageName: node + linkType: hard + "iconv-lite@npm:0.4.24": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" @@ -8464,6 +9765,13 @@ __metadata: languageName: node linkType: hard +"idb-keyval@npm:^6.2.1": + version: 6.2.1 + resolution: "idb-keyval@npm:6.2.1" + checksum: 7c0836f832096086e99258167740181132a71dd2694c8b8454a4f5ec69114ba6d70983115153306f0b6de1c8d3bad04f67eed3dff8f50c96815b9985d6d78470 + languageName: node + linkType: hard + "ieee754@npm:^1.1.13, ieee754@npm:^1.2.1": version: 1.2.1 resolution: "ieee754@npm:1.2.1" @@ -8590,6 +9898,23 @@ __metadata: languageName: node linkType: hard +"ioredis@npm:^5.3.2": + version: 5.3.2 + resolution: "ioredis@npm:5.3.2" + dependencies: + "@ioredis/commands": ^1.1.1 + cluster-key-slot: ^1.1.0 + debug: ^4.3.4 + denque: ^2.1.0 + lodash.defaults: ^4.2.0 + lodash.isarguments: ^3.1.0 + redis-errors: ^1.2.0 + redis-parser: ^3.0.0 + standard-as-callback: ^2.1.0 + checksum: 9a23559133e862a768778301efb68ae8c2af3c33562174b54a4c2d6574b976e85c75a4c34857991af733e35c48faf4c356e7daa8fb0a3543d85ff1768c8754bc + languageName: node + linkType: hard + "ip@npm:^2.0.0": version: 2.0.0 resolution: "ip@npm:2.0.0" @@ -8597,6 +9922,13 @@ __metadata: languageName: node linkType: hard +"iron-webcrypto@npm:^1.0.0": + version: 1.0.0 + resolution: "iron-webcrypto@npm:1.0.0" + checksum: bbd96cbbfec7d072296bc7464763b96555bdadb12aca50f1f1c7e4fcdc6acb102bc3488333e924f94404dd50eda24f84b67ad28323b9138ec7255a023e8dc19e + languageName: node + linkType: hard + "is-arguments@npm:^1.0.4": version: 1.1.1 resolution: "is-arguments@npm:1.1.1" @@ -8754,6 +10086,16 @@ __metadata: languageName: node linkType: hard +"is-nan@npm:^1.3.2": + version: 1.3.2 + resolution: "is-nan@npm:1.3.2" + dependencies: + call-bind: ^1.0.0 + define-properties: ^1.1.3 + checksum: 5dfadcef6ad12d3029d43643d9800adbba21cf3ce2ec849f734b0e14ee8da4070d82b15fdb35138716d02587c6578225b9a22779cab34888a139cc43e4e3610a + languageName: node + linkType: hard + "is-negative-zero@npm:^2.0.2": version: 2.0.2 resolution: "is-negative-zero@npm:2.0.2" @@ -8810,6 +10152,13 @@ __metadata: languageName: node linkType: hard +"is-stream@npm:^2.0.0": + version: 2.0.1 + resolution: "is-stream@npm:2.0.1" + checksum: b8e05ccdf96ac330ea83c12450304d4a591f9958c11fd17bed240af8d5ffe08aedafa4c0f4cfccd4d28dc9d4d129daca1023633d5c11601a6cbc77521f6fae66 + languageName: node + linkType: hard + "is-stream@npm:^3.0.0": version: 3.0.0 resolution: "is-stream@npm:3.0.0" @@ -8887,6 +10236,13 @@ __metadata: languageName: node linkType: hard +"isarray@npm:^2.0.5": + version: 2.0.5 + resolution: "isarray@npm:2.0.5" + checksum: bd5bbe4104438c4196ba58a54650116007fa0262eccef13a4c55b2e09a5b36b59f1e75b9fcc49883dd9d4953892e6fc007eef9e9155648ceea036e184b0f930a + languageName: node + linkType: hard + "isarray@npm:~1.0.0": version: 1.0.0 resolution: "isarray@npm:1.0.0" @@ -8965,6 +10321,28 @@ __metadata: languageName: node linkType: hard +"jayson@npm:^4.1.0": + version: 4.1.0 + resolution: "jayson@npm:4.1.0" + dependencies: + "@types/connect": ^3.4.33 + "@types/node": ^12.12.54 + "@types/ws": ^7.4.4 + JSONStream: ^1.3.5 + commander: ^2.20.3 + delay: ^5.0.0 + es6-promisify: ^5.0.0 + eyes: ^0.1.8 + isomorphic-ws: ^4.0.1 + json-stringify-safe: ^5.0.1 + uuid: ^8.3.2 + ws: ^7.4.5 + bin: + jayson: bin/jayson.js + checksum: 86464322fbdc6db65d2bb4fc278cb6c86fad5c2a506065490d39459f09ba0d30f2b4fb740b33828a1424791419b6c8bd295dc54d361a4ad959bf70cc62b1ca7e + languageName: node + linkType: hard + "jiti@npm:^1.18.2": version: 1.19.1 resolution: "jiti@npm:1.19.1" @@ -8974,6 +10352,15 @@ __metadata: languageName: node linkType: hard +"jiti@npm:^1.20.0": + version: 1.21.0 + resolution: "jiti@npm:1.21.0" + bin: + jiti: bin/jiti.js + checksum: a7bd5d63921c170eaec91eecd686388181c7828e1fa0657ab374b9372bfc1f383cf4b039e6b272383d5cb25607509880af814a39abdff967322459cca41f2961 + languageName: node + linkType: hard + "js-sdsl@npm:^4.1.4": version: 4.1.4 resolution: "js-sdsl@npm:4.1.4" @@ -9115,6 +10502,18 @@ __metadata: languageName: node linkType: hard +"json-stable-stringify@npm:^1.0.2": + version: 1.1.0 + resolution: "json-stable-stringify@npm:1.1.0" + dependencies: + call-bind: ^1.0.5 + isarray: ^2.0.5 + jsonify: ^0.0.1 + object-keys: ^1.1.1 + checksum: 98e74dd45d3e93aa7cb5351b9f55475e15a8a7b57f401897373a1a1bbe41a6757f8b8d24f2bff0594893eccde616efe71bbaea2c1fdc1f67e8c39bcb9ee993e2 + languageName: node + linkType: hard + "json-stringify-safe@npm:^5.0.1, json-stringify-safe@npm:~5.0.1": version: 5.0.1 resolution: "json-stringify-safe@npm:5.0.1" @@ -9133,6 +10532,13 @@ __metadata: languageName: node linkType: hard +"jsonc-parser@npm:^3.2.0": + version: 3.2.0 + resolution: "jsonc-parser@npm:3.2.0" + checksum: 946dd9a5f326b745aa326d48a7257e3f4a4b62c5e98ec8e49fa2bdd8d96cef7e6febf1399f5c7016114fd1f68a1c62c6138826d5d90bc650448e3cf0951c53c7 + languageName: node + linkType: hard + "jsonfile@npm:^2.1.0": version: 2.4.0 resolution: "jsonfile@npm:2.4.0" @@ -9170,6 +10576,13 @@ __metadata: languageName: node linkType: hard +"jsonify@npm:^0.0.1": + version: 0.0.1 + resolution: "jsonify@npm:0.0.1" + checksum: 027287e1c0294fce15f18c0ff990cfc2318e7f01fb76515f784d5cd0784abfec6fc5c2355c3a2f2cb0ad7f4aa2f5b74ebbfe4e80476c35b2d13cabdb572e1134 + languageName: node + linkType: hard + "jsonparse@npm:^1.2.0": version: 1.3.1 resolution: "jsonparse@npm:1.3.1" @@ -9177,7 +10590,7 @@ __metadata: languageName: node linkType: hard -"jsonschema@npm:^1.2.4": +"jsonschema@npm:^1.2.4, jsonschema@npm:^1.4.1": version: 1.4.1 resolution: "jsonschema@npm:1.4.1" checksum: 1ef02a6cd9bc32241ec86bbf1300bdbc3b5f2d8df6eb795517cf7d1cd9909e7beba1e54fdf73990fd66be98a182bda9add9607296b0cb00b1348212988e424b2 @@ -9206,6 +10619,13 @@ __metadata: languageName: node linkType: hard +"jwt-decode@npm:^4.0.0": + version: 4.0.0 + resolution: "jwt-decode@npm:4.0.0" + checksum: 390e2edcb31a92e86c8cbdd1edeea4c0d62acd371f8a8f0a8878e499390c0ecf4c658b365c4e941e4ef37d0170e4ca650aaa49f99a45c0b9695a235b210154b0 + languageName: node + linkType: hard + "keccak@npm:^3.0.0, keccak@npm:^3.0.1, keccak@npm:^3.0.2": version: 3.0.2 resolution: "keccak@npm:3.0.2" @@ -9358,6 +10778,34 @@ __metadata: languageName: node linkType: hard +"listhen@npm:^1.5.5": + version: 1.5.5 + resolution: "listhen@npm:1.5.5" + dependencies: + "@parcel/watcher": ^2.3.0 + "@parcel/watcher-wasm": 2.3.0 + citty: ^0.1.4 + clipboardy: ^3.0.0 + consola: ^3.2.3 + defu: ^6.1.2 + get-port-please: ^3.1.1 + h3: ^1.8.1 + http-shutdown: ^1.2.2 + jiti: ^1.20.0 + mlly: ^1.4.2 + node-forge: ^1.3.1 + pathe: ^1.1.1 + std-env: ^3.4.3 + ufo: ^1.3.0 + untun: ^0.1.2 + uqr: ^0.1.2 + bin: + listen: bin/listhen.mjs + listhen: bin/listhen.mjs + checksum: 2d4a9d9d25b41e1569b50f0c7c72004dacb35ced91b0de943734f4e2f828fdeea890d9f5ab48c37133b06ee1f188ee1d335ae6dbb5dee6a86c21740aa309f485 + languageName: node + linkType: hard + "listr2@npm:^4.0.5": version: 4.0.5 resolution: "listr2@npm:4.0.5" @@ -9457,6 +10905,13 @@ __metadata: languageName: node linkType: hard +"lodash-es@npm:^4.17.21": + version: 4.17.21 + resolution: "lodash-es@npm:4.17.21" + checksum: 05cbffad6e2adbb331a4e16fbd826e7faee403a1a04873b82b42c0f22090f280839f85b95393f487c1303c8a3d2a010048bf06151a6cbe03eee4d388fb0a12d2 + languageName: node + linkType: hard + "lodash.camelcase@npm:^4.3.0": version: 4.3.0 resolution: "lodash.camelcase@npm:4.3.0" @@ -9464,7 +10919,28 @@ __metadata: languageName: node linkType: hard -"lodash.isequal@npm:4.5.0": +"lodash.clonedeep@npm:^4.5.0": + version: 4.5.0 + resolution: "lodash.clonedeep@npm:4.5.0" + checksum: 92c46f094b064e876a23c97f57f81fbffd5d760bf2d8a1c61d85db6d1e488c66b0384c943abee4f6af7debf5ad4e4282e74ff83177c9e63d8ff081a4837c3489 + languageName: node + linkType: hard + +"lodash.defaults@npm:^4.2.0": + version: 4.2.0 + resolution: "lodash.defaults@npm:4.2.0" + checksum: 84923258235592c8886e29de5491946ff8c2ae5c82a7ac5cddd2e3cb697e6fbdfbbb6efcca015795c86eec2bb953a5a2ee4016e3735a3f02720428a40efbb8f1 + languageName: node + linkType: hard + +"lodash.isarguments@npm:^3.1.0": + version: 3.1.0 + resolution: "lodash.isarguments@npm:3.1.0" + checksum: ae1526f3eb5c61c77944b101b1f655f846ecbedcb9e6b073526eba6890dc0f13f09f72e11ffbf6540b602caee319af9ac363d6cdd6be41f4ee453436f04f13b5 + languageName: node + linkType: hard + +"lodash.isequal@npm:4.5.0, lodash.isequal@npm:^4.5.0": version: 4.5.0 resolution: "lodash.isequal@npm:4.5.0" checksum: da27515dc5230eb1140ba65ff8de3613649620e8656b19a6270afe4866b7bd461d9ba2ac8a48dcc57f7adac4ee80e1de9f965d89d4d81a0ad52bb3eec2609644 @@ -9523,6 +10999,13 @@ __metadata: languageName: node linkType: hard +"loglevel@npm:^1.8.1": + version: 1.8.1 + resolution: "loglevel@npm:1.8.1" + checksum: a1a62db40291aaeaef2f612334c49e531bff71cc1d01a2acab689ab80d59e092f852ab164a5aedc1a752fdc46b7b162cb097d8a9eb2cf0b299511106c29af61d + languageName: node + linkType: hard + "loose-envify@npm:^1.0.0, loose-envify@npm:^1.1.0, loose-envify@npm:^1.4.0": version: 1.4.0 resolution: "loose-envify@npm:1.4.0" @@ -9543,6 +11026,13 @@ __metadata: languageName: node linkType: hard +"lru-cache@npm:^10.0.2": + version: 10.1.0 + resolution: "lru-cache@npm:10.1.0" + checksum: 58056d33e2500fbedce92f8c542e7c11b50d7d086578f14b7074d8c241422004af0718e08a6eaae8705cee09c77e39a61c1c79e9370ba689b7010c152e6a76ab + languageName: node + linkType: hard + "lru-cache@npm:^5.1.1": version: 5.1.1 resolution: "lru-cache@npm:5.1.1" @@ -9695,6 +11185,13 @@ __metadata: languageName: node linkType: hard +"micro-ftch@npm:^0.3.1": + version: 0.3.1 + resolution: "micro-ftch@npm:0.3.1" + checksum: 0e496547253a36e98a83fb00c628c53c3fb540fa5aaeaf718438873785afd193244988c09d219bb1802984ff227d04938d9571ef90fe82b48bd282262586aaff + languageName: node + linkType: hard + "micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5": version: 4.0.5 resolution: "micromatch@npm:4.0.5" @@ -9721,6 +11218,15 @@ __metadata: languageName: node linkType: hard +"mime@npm:^3.0.0": + version: 3.0.0 + resolution: "mime@npm:3.0.0" + bin: + mime: cli.js + checksum: f43f9b7bfa64534e6b05bd6062961681aeb406a5b53673b53b683f27fcc4e739989941836a355eef831f4478923651ecc739f4a5f6e20a76487b432bfd4db928 + languageName: node + linkType: hard + "mimic-fn@npm:^2.1.0": version: 2.1.0 resolution: "mimic-fn@npm:2.1.0" @@ -9900,6 +11406,18 @@ __metadata: languageName: node linkType: hard +"mlly@npm:^1.2.0, mlly@npm:^1.4.2": + version: 1.4.2 + resolution: "mlly@npm:1.4.2" + dependencies: + acorn: ^8.10.0 + pathe: ^1.1.1 + pkg-types: ^1.0.3 + ufo: ^1.3.0 + checksum: ad0813eca133e59ac03b356b87deea57da96083dce7dda58a8eeb2dce92b7cc2315bedd9268f3ff8e98effe1867ddb1307486d4c5cd8be162daa8e0fa0a98ed4 + languageName: node + linkType: hard + "mnemonist@npm:^0.38.0": version: 0.38.5 resolution: "mnemonist@npm:0.38.5" @@ -10040,7 +11558,7 @@ __metadata: languageName: node linkType: hard -"mri@npm:1.2.0": +"mri@npm:1.2.0, mri@npm:^1.2.0": version: 1.2.0 resolution: "mri@npm:1.2.0" checksum: 83f515abbcff60150873e424894a2f65d68037e5a7fcde8a9e2b285ee9c13ac581b63cfc1e6826c4732de3aeb84902f7c1e16b7aff46cd3f897a0f757a894e85 @@ -10147,6 +11665,13 @@ __metadata: languageName: node linkType: hard +"napi-wasm@npm:^1.1.0": + version: 1.1.0 + resolution: "napi-wasm@npm:1.1.0" + checksum: 649a5d03477b89ee75cd8d7be5404daa5c889915640fd4ab042f2d38d265e961f86933e83982388d72c8b0a3952f36f099b96598ea88210205519ec2adc41d8d + languageName: node + linkType: hard + "natural-compare@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare@npm:1.4.0" @@ -10270,6 +11795,15 @@ __metadata: languageName: node linkType: hard +"node-addon-api@npm:^7.0.0": + version: 7.0.0 + resolution: "node-addon-api@npm:7.0.0" + dependencies: + node-gyp: latest + checksum: 4349465d737e284b280fc0e5fd2384f9379bca6b7f2a5a1460bea676ba5b90bf563e7d02a9254c35b9ed808641c81d9b4ca9e1da17d2849cd07727660b00b332 + languageName: node + linkType: hard + "node-emoji@npm:^1.10.0": version: 1.11.0 resolution: "node-emoji@npm:1.11.0" @@ -10289,6 +11823,13 @@ __metadata: languageName: node linkType: hard +"node-fetch-native@npm:^1.4.0, node-fetch-native@npm:^1.4.1": + version: 1.4.1 + resolution: "node-fetch-native@npm:1.4.1" + checksum: 339001ad3235a09b195198df8be71b591eec4064a2fcfb7f54b9f0716f6ccb3bda5828e1746f809a6d2edb062a0330e5798f408396c33b3b88339c73d6e9575d + languageName: node + linkType: hard + "node-fetch@npm:2, node-fetch@npm:2.6.7": version: 2.6.7 resolution: "node-fetch@npm:2.6.7" @@ -10317,6 +11858,20 @@ __metadata: languageName: node linkType: hard +"node-fetch@npm:^2.6.12": + version: 2.7.0 + resolution: "node-fetch@npm:2.7.0" + dependencies: + whatwg-url: ^5.0.0 + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + checksum: d76d2f5edb451a3f05b15115ec89fc6be39de37c6089f1b6368df03b91e1633fd379a7e01b7ab05089a25034b2023d959b47e59759cb38d88341b2459e89d6e5 + languageName: node + linkType: hard + "node-fetch@npm:^2.6.7": version: 2.6.9 resolution: "node-fetch@npm:2.6.9" @@ -10331,6 +11886,13 @@ __metadata: languageName: node linkType: hard +"node-forge@npm:^1.3.1": + version: 1.3.1 + resolution: "node-forge@npm:1.3.1" + checksum: 08fb072d3d670599c89a1704b3e9c649ff1b998256737f0e06fbd1a5bf41cae4457ccaee32d95052d80bbafd9ffe01284e078c8071f0267dc9744e51c5ed42a9 + languageName: node + linkType: hard + "node-gyp-build@npm:^4.2.0, node-gyp-build@npm:^4.3.0": version: 4.5.0 resolution: "node-gyp-build@npm:4.5.0" @@ -10423,6 +11985,15 @@ __metadata: languageName: node linkType: hard +"npm-run-path@npm:^4.0.1": + version: 4.0.1 + resolution: "npm-run-path@npm:4.0.1" + dependencies: + path-key: ^3.0.0 + checksum: 5374c0cea4b0bbfdfae62da7bbdf1e1558d338335f4cacf2515c282ff358ff27b2ecb91ffa5330a8b14390ac66a1e146e10700440c1ab868208430f56b5f4d23 + languageName: node + linkType: hard + "npm-run-path@npm:^5.1.0": version: 5.1.0 resolution: "npm-run-path@npm:5.1.0" @@ -10501,6 +12072,16 @@ __metadata: languageName: node linkType: hard +"object-is@npm:^1.1.5": + version: 1.1.5 + resolution: "object-is@npm:1.1.5" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.3 + checksum: 989b18c4cba258a6b74dc1d74a41805c1a1425bce29f6cabb50dcb1a6a651ea9104a1b07046739a49a5bb1bc49727bcb00efd5c55f932f6ea04ec8927a7901fe + languageName: node + linkType: hard + "object-keys@npm:^1.0.11, object-keys@npm:^1.1.1": version: 1.1.1 resolution: "object-keys@npm:1.1.1" @@ -10594,6 +12175,24 @@ __metadata: languageName: node linkType: hard +"oblivious-set@npm:1.1.1": + version: 1.1.1 + resolution: "oblivious-set@npm:1.1.1" + checksum: ea1830c38ad5b8b71e6573d0dda3ecaf01e7e0c25c5d612d6f2915e8568c2148a5e0aab31a7d4155db96e6623a123cce57d9b4929947d2ab4c040505947674c6 + languageName: node + linkType: hard + +"ofetch@npm:^1.3.3": + version: 1.3.3 + resolution: "ofetch@npm:1.3.3" + dependencies: + destr: ^2.0.1 + node-fetch-native: ^1.4.0 + ufo: ^1.3.0 + checksum: 945d757b25ba144f9f45d9de3382de743f0950e68e76726a4c0d2ef01456fa6700a6b102cc343a4e06f71d5ac59a8affdd9a673751c448f4265996f7f22ffa3d + languageName: node + linkType: hard + "on-exit-leak-free@npm:^0.2.0": version: 0.2.0 resolution: "on-exit-leak-free@npm:0.2.0" @@ -10610,7 +12209,7 @@ __metadata: languageName: node linkType: hard -"onetime@npm:^5.1.0": +"onetime@npm:^5.1.0, onetime@npm:^5.1.2": version: 5.1.2 resolution: "onetime@npm:5.1.2" dependencies: @@ -10825,7 +12424,7 @@ __metadata: languageName: node linkType: hard -"path-key@npm:^3.1.0": +"path-key@npm:^3.0.0, path-key@npm:^3.1.0": version: 3.1.1 resolution: "path-key@npm:3.1.1" checksum: 55cd7a9dd4b343412a8386a743f9c746ef196e57c823d90ca3ab917f90ab9f13dd0ded27252ba49dbdfcab2b091d998bc446f6220cd3cea65db407502a740020 @@ -10860,6 +12459,13 @@ __metadata: languageName: node linkType: hard +"pathe@npm:^1.1.0, pathe@npm:^1.1.1": + version: 1.1.1 + resolution: "pathe@npm:1.1.1" + checksum: 34ab3da2e5aa832ebc6a330ffe3f73d7ba8aec6e899b53b8ec4f4018de08e40742802deb12cf5add9c73b7bf719b62c0778246bd376ca62b0fb23e0dde44b759 + languageName: node + linkType: hard + "pathval@npm:^1.1.1": version: 1.1.1 resolution: "pathval@npm:1.1.1" @@ -10983,6 +12589,17 @@ __metadata: languageName: node linkType: hard +"pkg-types@npm:^1.0.3": + version: 1.0.3 + resolution: "pkg-types@npm:1.0.3" + dependencies: + jsonc-parser: ^3.2.0 + mlly: ^1.2.0 + pathe: ^1.1.0 + checksum: 4b305c834b912ddcc8a0fe77530c0b0321fe340396f84cbb87aecdbc126606f47f2178f23b8639e71a4870f9631c7217aef52ffed0ae17ea2dbbe7e43d116a6e + languageName: node + linkType: hard + "pngjs@npm:^5.0.0": version: 5.0.0 resolution: "pngjs@npm:5.0.0" @@ -10990,6 +12607,13 @@ __metadata: languageName: node linkType: hard +"pony-cause@npm:^2.1.10": + version: 2.1.10 + resolution: "pony-cause@npm:2.1.10" + checksum: 8b61378f213e61056312dc274a1c79980154e9d864f6ad86e0c8b91a50d3ce900d430995ee24147c9f3caa440dfe7d51c274b488d7f033b65b206522536d7217 + languageName: node + linkType: hard + "postcss-import@npm:^14.1.0": version: 14.1.0 resolution: "postcss-import@npm:14.1.0" @@ -11241,6 +12865,13 @@ __metadata: languageName: node linkType: hard +"process@npm:^0.11.10": + version: 0.11.10 + resolution: "process@npm:0.11.10" + checksum: bfcce49814f7d172a6e6a14d5fa3ac92cc3d0c3b9feb1279774708a719e19acd673995226351a082a9ae99978254e320ccda4240ddc474ba31a76c79491ca7c3 + languageName: node + linkType: hard + "promise-inflight@npm:^1.0.1": version: 1.0.1 resolution: "promise-inflight@npm:1.0.1" @@ -11326,6 +12957,13 @@ __metadata: languageName: node linkType: hard +"qrcode-generator@npm:^1.4.1": + version: 1.4.4 + resolution: "qrcode-generator@npm:1.4.4" + checksum: 860cfdd2a7a608d34e92cab99774cc08182e1911432f30ed36d16f8a5cdabd7fdf40239caed91fa2691cfe66c8d95c1340a2fc9cc439eed07a9f2eb328c6f527 + languageName: node + linkType: hard + "qrcode.react@npm:^3.1.0": version: 3.1.0 resolution: "qrcode.react@npm:3.1.0" @@ -11438,6 +13076,13 @@ __metadata: languageName: node linkType: hard +"radix3@npm:^1.1.0": + version: 1.1.0 + resolution: "radix3@npm:1.1.0" + checksum: e5e6ed8fcf68be4d124bca4f7da7ba0fc7c5b6f9e98bc3f4424459c45d50f1f92506c5f7f8421b5cfee5823c524a4a2cef416053e88845813ce9fc9c7086729a + languageName: node + linkType: hard + "randombytes@npm:^2.1.0": version: 2.1.0 resolution: "randombytes@npm:2.1.0" @@ -11505,6 +13150,24 @@ __metadata: languageName: node linkType: hard +"react-i18next@npm:^13.5.0": + version: 13.5.0 + resolution: "react-i18next@npm:13.5.0" + dependencies: + "@babel/runtime": ^7.22.5 + html-parse-stringify: ^3.0.1 + peerDependencies: + i18next: ">= 23.2.3" + react: ">= 16.8.0" + peerDependenciesMeta: + react-dom: + optional: true + react-native: + optional: true + checksum: 2f68ccd24daf72ddd2d11a526fb3c2b66c11ea4fcd2e24ac7aed42bf57ec7bffa7455ad1dc93679968ff629e9b1896465cdf6d1a61c29b92138ef88098e8dcba + languageName: node + linkType: hard + "react-is@npm:^16.13.1, react-is@npm:^16.7.0": version: 16.13.1 resolution: "react-is@npm:16.13.1" @@ -11531,6 +13194,19 @@ __metadata: languageName: node linkType: hard +"react-qrcode-logo@npm:^2.9.0": + version: 2.9.0 + resolution: "react-qrcode-logo@npm:2.9.0" + dependencies: + lodash.isequal: ^4.5.0 + qrcode-generator: ^1.4.1 + peerDependencies: + react: ">=16.4.1" + react-dom: ">=16.4.1" + checksum: 24dbabb24091c13062981da8336e92f1ed2bf576b1eee1fcc8945dc6e4bde94fdec887da8380cbe49fe10bfdeb06eda393f135a15a4ecf13c45472bdfd2510a5 + languageName: node + linkType: hard + "react-redux@npm:^8.1.3": version: 8.1.3 resolution: "react-redux@npm:8.1.3" @@ -11710,6 +13386,19 @@ __metadata: languageName: node linkType: hard +"readable-stream@npm:^4.4.2": + version: 4.4.2 + resolution: "readable-stream@npm:4.4.2" + dependencies: + abort-controller: ^3.0.0 + buffer: ^6.0.3 + events: ^3.3.0 + process: ^0.11.10 + string_decoder: ^1.3.0 + checksum: 6f4063763dbdb52658d22d3f49ca976420e1fbe16bbd241f744383715845350b196a2f08b8d6330f8e219153dff34b140aeefd6296da828e1041a7eab1f20d5e + languageName: node + linkType: hard + "readable-stream@npm:~1.0.26-4": version: 1.0.34 resolution: "readable-stream@npm:1.0.34" @@ -11765,6 +13454,22 @@ __metadata: languageName: node linkType: hard +"redis-errors@npm:^1.0.0, redis-errors@npm:^1.2.0": + version: 1.2.0 + resolution: "redis-errors@npm:1.2.0" + checksum: f28ac2692113f6f9c222670735aa58aeae413464fd58ccf3fce3f700cae7262606300840c802c64f2b53f19f65993da24dc918afc277e9e33ac1ff09edb394f4 + languageName: node + linkType: hard + +"redis-parser@npm:^3.0.0": + version: 3.0.0 + resolution: "redis-parser@npm:3.0.0" + dependencies: + redis-errors: ^1.0.0 + checksum: 89290ae530332f2ae37577647fa18208d10308a1a6ba750b9d9a093e7398f5e5253f19855b64c98757f7129cccce958e4af2573fdc33bad41405f87f1943459a + languageName: node + linkType: hard + "reduce-flatten@npm:^2.0.0": version: 2.0.0 resolution: "reduce-flatten@npm:2.0.0" @@ -12144,6 +13849,25 @@ __metadata: languageName: node linkType: hard +"rpc-websockets@npm:^7.5.1": + version: 7.8.0 + resolution: "rpc-websockets@npm:7.8.0" + dependencies: + "@babel/runtime": ^7.17.2 + bufferutil: ^4.0.1 + eventemitter3: ^4.0.7 + utf-8-validate: ^5.0.2 + uuid: ^8.3.2 + ws: ^8.5.0 + dependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 8f608efe4797a317d5fb76081d4d359a0189d9e1bb5540211f6241620e42ea845c84b882fe49e6ffc0aed676b4d8a425c91bbd0609952b2bc674efaac21db099 + languageName: node + linkType: hard + "run-parallel-limit@npm:^1.1.0": version: 1.1.0 resolution: "run-parallel-limit@npm:1.1.0" @@ -12350,6 +14074,17 @@ __metadata: languageName: node linkType: hard +"semver@npm:^7.5.4": + version: 7.5.4 + resolution: "semver@npm:7.5.4" + dependencies: + lru-cache: ^6.0.0 + bin: + semver: bin/semver.js + checksum: 12d8ad952fa353b0995bf180cdac205a4068b759a140e5d3c608317098b3575ac2f1e09182206bf2eb26120e1c0ed8fb92c48c592f6099680de56bb071423ca3 + languageName: node + linkType: hard + "serialize-javascript@npm:6.0.0": version: 6.0.0 resolution: "serialize-javascript@npm:6.0.0" @@ -12366,6 +14101,18 @@ __metadata: languageName: node linkType: hard +"set-function-length@npm:^1.1.1": + version: 1.1.1 + resolution: "set-function-length@npm:1.1.1" + dependencies: + define-data-property: ^1.1.1 + get-intrinsic: ^1.2.1 + gopd: ^1.0.1 + has-property-descriptors: ^1.0.0 + checksum: c131d7569cd7e110cafdfbfbb0557249b538477624dfac4fc18c376d879672fa52563b74029ca01f8f4583a8acb35bb1e873d573a24edb80d978a7ee607c6e06 + languageName: node + linkType: hard + "setimmediate@npm:1.0.4": version: 1.0.4 resolution: "setimmediate@npm:1.0.4" @@ -12449,7 +14196,7 @@ __metadata: languageName: node linkType: hard -"signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.7": +"signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3, signal-exit@npm:^3.0.7": version: 3.0.7 resolution: "signal-exit@npm:3.0.7" checksum: a2f098f247adc367dffc27845853e9959b9e88b01cb301658cfe4194352d8d2bb32e18467c786a7fe15f1d44b233ea35633d076d5e737870b7139949d1ab6318 @@ -12509,6 +14256,28 @@ __metadata: languageName: node linkType: hard +"socket.io-client@npm:^4.7.2": + version: 4.7.2 + resolution: "socket.io-client@npm:4.7.2" + dependencies: + "@socket.io/component-emitter": ~3.1.0 + debug: ~4.3.2 + engine.io-client: ~6.5.2 + socket.io-parser: ~4.2.4 + checksum: 8f0ab6b623e014d889bae0cd847ef7826658e8f131bd9367ee5ae4404bb52a6d7b1755b8fbe8e68799b60e92149370a732b381f913b155e40094facb135cd088 + languageName: node + linkType: hard + +"socket.io-parser@npm:~4.2.4": + version: 4.2.4 + resolution: "socket.io-parser@npm:4.2.4" + dependencies: + "@socket.io/component-emitter": ~3.1.0 + debug: ~4.3.1 + checksum: 61540ef99af33e6a562b9effe0fad769bcb7ec6a301aba5a64b3a8bccb611a0abdbe25f469933ab80072582006a78ca136bf0ad8adff9c77c9953581285e2263 + languageName: node + linkType: hard + "socks-proxy-agent@npm:^7.0.0": version: 7.0.0 resolution: "socks-proxy-agent@npm:7.0.0" @@ -12714,6 +14483,13 @@ __metadata: languageName: node linkType: hard +"standard-as-callback@npm:^2.1.0": + version: 2.1.0 + resolution: "standard-as-callback@npm:2.1.0" + checksum: 88bec83ee220687c72d94fd86a98d5272c91d37ec64b66d830dbc0d79b62bfa6e47f53b71646011835fc9ce7fae62739545d13124262b53be4fbb3e2ebad551c + languageName: node + linkType: hard + "statuses@npm:2.0.1": version: 2.0.1 resolution: "statuses@npm:2.0.1" @@ -12721,6 +14497,13 @@ __metadata: languageName: node linkType: hard +"std-env@npm:^3.4.3": + version: 3.6.0 + resolution: "std-env@npm:3.6.0" + checksum: ec344e93af17fd1b71eb28aeb4712f72790b9f2363981fc91ad1a91c9c7967c1ab89271819242d1b3bdbd57f10ac8ef0559d561ccf081a5377f9b3cd8c9b2259 + languageName: node + linkType: hard + "stealthy-require@npm:^1.1.1": version: 1.1.1 resolution: "stealthy-require@npm:1.1.1" @@ -12854,7 +14637,7 @@ __metadata: languageName: node linkType: hard -"string_decoder@npm:^1.1.1": +"string_decoder@npm:^1.1.1, string_decoder@npm:^1.3.0": version: 1.3.0 resolution: "string_decoder@npm:1.3.0" dependencies: @@ -12922,6 +14705,13 @@ __metadata: languageName: node linkType: hard +"strip-final-newline@npm:^2.0.0": + version: 2.0.0 + resolution: "strip-final-newline@npm:2.0.0" + checksum: 69412b5e25731e1938184b5d489c32e340605bb611d6140344abc3421b7f3c6f9984b21dff296dfcf056681b82caa3bb4cc996a965ce37bcfad663e92eae9c64 + languageName: node + linkType: hard + "strip-final-newline@npm:^3.0.0": version: 3.0.0 resolution: "strip-final-newline@npm:3.0.0" @@ -13439,6 +15229,13 @@ __metadata: languageName: node linkType: hard +"ts-custom-error@npm:^3.3.1": + version: 3.3.1 + resolution: "ts-custom-error@npm:3.3.1" + checksum: 50a1e825fced68d70049bd8d282379a635e43aa023a370fa8e736b12a6edba7f18a2d731fa194ac35303a8b625be56e121bdb31d8a0318250d1a8b277059fce3 + languageName: node + linkType: hard + "ts-essentials@npm:^7.0.1": version: 7.0.3 resolution: "ts-essentials@npm:7.0.3" @@ -13743,6 +15540,13 @@ __metadata: languageName: node linkType: hard +"ufo@npm:^1.3.0, ufo@npm:^1.3.1, ufo@npm:^1.3.2": + version: 1.3.2 + resolution: "ufo@npm:1.3.2" + checksum: f1180bb715ff4dd46152fd4dec41c731e84d7b9eaf1432548a0210b2f7e0cd29de125ac88e582c6a079d8ae5bc9ab04ef2bdbafe125086480b10c1006b81bfce + languageName: node + linkType: hard + "uglify-js@npm:^3.1.4": version: 3.17.2 resolution: "uglify-js@npm:3.17.2" @@ -13773,6 +15577,13 @@ __metadata: languageName: node linkType: hard +"uncrypto@npm:^0.1.3": + version: 0.1.3 + resolution: "uncrypto@npm:0.1.3" + checksum: 07160e08806dd6cea16bb96c3fd54cd70fc801e02fc3c6f86980144d15c9ebbd1c55587f7280a207b3af6cd34901c0d0b77ada5a02c2f7081a033a05acf409e2 + languageName: node + linkType: hard + "undici@npm:^5.14.0": version: 5.25.2 resolution: "undici@npm:5.25.2" @@ -13789,6 +15600,19 @@ __metadata: languageName: node linkType: hard +"unenv@npm:^1.7.4": + version: 1.8.0 + resolution: "unenv@npm:1.8.0" + dependencies: + consola: ^3.2.3 + defu: ^6.1.3 + mime: ^3.0.0 + node-fetch-native: ^1.4.1 + pathe: ^1.1.1 + checksum: 8118260ac7be8d13f99ebb5ca6a40203cf64cc592142753c1a1f75d40b07398c3208430d9a0299573cef3e4f2eba3bf6735901ff4217583df8344b2491314fb0 + languageName: node + linkType: hard + "unique-filename@npm:^2.0.0": version: 2.0.1 resolution: "unique-filename@npm:2.0.1" @@ -13821,6 +15645,13 @@ __metadata: languageName: node linkType: hard +"unload@npm:^2.4.1": + version: 2.4.1 + resolution: "unload@npm:2.4.1" + checksum: a6f92d176e2718af3cb4bf087a338f21f2ded32e81c052d97d020c5b402e4a2925784efd8808827c149d35fddf49dad0a01035ecc6a69941f2c8eae90d33dc12 + languageName: node + linkType: hard + "unpipe@npm:1.0.0": version: 1.0.0 resolution: "unpipe@npm:1.0.0" @@ -13828,6 +15659,76 @@ __metadata: languageName: node linkType: hard +"unstorage@npm:^1.9.0": + version: 1.10.1 + resolution: "unstorage@npm:1.10.1" + dependencies: + anymatch: ^3.1.3 + chokidar: ^3.5.3 + destr: ^2.0.2 + h3: ^1.8.2 + ioredis: ^5.3.2 + listhen: ^1.5.5 + lru-cache: ^10.0.2 + mri: ^1.2.0 + node-fetch-native: ^1.4.1 + ofetch: ^1.3.3 + ufo: ^1.3.1 + peerDependencies: + "@azure/app-configuration": ^1.4.1 + "@azure/cosmos": ^4.0.0 + "@azure/data-tables": ^13.2.2 + "@azure/identity": ^3.3.2 + "@azure/keyvault-secrets": ^4.7.0 + "@azure/storage-blob": ^12.16.0 + "@capacitor/preferences": ^5.0.6 + "@netlify/blobs": ^6.2.0 + "@planetscale/database": ^1.11.0 + "@upstash/redis": ^1.23.4 + "@vercel/kv": ^0.2.3 + idb-keyval: ^6.2.1 + peerDependenciesMeta: + "@azure/app-configuration": + optional: true + "@azure/cosmos": + optional: true + "@azure/data-tables": + optional: true + "@azure/identity": + optional: true + "@azure/keyvault-secrets": + optional: true + "@azure/storage-blob": + optional: true + "@capacitor/preferences": + optional: true + "@netlify/blobs": + optional: true + "@planetscale/database": + optional: true + "@upstash/redis": + optional: true + "@vercel/kv": + optional: true + idb-keyval: + optional: true + checksum: 59dc9f21d25df2bc8d14e3965235cbb85e3e2e8cb332da70ca471ba4519269a06936eba4012916251f3b88e23176df44b64abb826202a3a3c9d0a185bfe5e500 + languageName: node + linkType: hard + +"untun@npm:^0.1.2": + version: 0.1.2 + resolution: "untun@npm:0.1.2" + dependencies: + citty: ^0.1.3 + consola: ^3.2.3 + pathe: ^1.1.1 + bin: + untun: bin/untun.mjs + checksum: 4ba32a6273138712ce8db3df027262902ec2a2c106d44ab94202a73b652e76b984e5661e3a7897dce048a740890f23165fb810a2ab1a69df2d6f729dad8078e2 + languageName: node + linkType: hard + "update-browserslist-db@npm:^1.0.9": version: 1.0.9 resolution: "update-browserslist-db@npm:1.0.9" @@ -13842,6 +15743,13 @@ __metadata: languageName: node linkType: hard +"uqr@npm:^0.1.2": + version: 0.1.2 + resolution: "uqr@npm:0.1.2" + checksum: 717766f03814172f5a9934dae2c4c48f6de065a4fd7da82aa513bd8300b621c1e606efdd174478cab79093e5ba244a99f0c0b1b0b9c0175656ab5e637a006d92 + languageName: node + linkType: hard + "uri-js@npm:^4.2.2": version: 4.4.1 resolution: "uri-js@npm:4.4.1" @@ -13958,6 +15866,19 @@ __metadata: languageName: node linkType: hard +"util@npm:^0.12.5": + version: 0.12.5 + resolution: "util@npm:0.12.5" + dependencies: + inherits: ^2.0.3 + is-arguments: ^1.0.4 + is-generator-function: ^1.0.7 + is-typed-array: ^1.1.3 + which-typed-array: ^1.1.2 + checksum: 705e51f0de5b446f4edec10739752ac25856541e0254ea1e7e45e5b9f9b0cb105bc4bd415736a6210edc68245a7f903bf085ffb08dd7deb8a0e847f60538a38a + languageName: node + linkType: hard + "uuid@npm:2.0.1": version: 2.0.1 resolution: "uuid@npm:2.0.1" @@ -14080,6 +16001,13 @@ __metadata: languageName: node linkType: hard +"void-elements@npm:3.1.0": + version: 3.1.0 + resolution: "void-elements@npm:3.1.0" + checksum: 0390f818107fa8fce55bb0a5c3f661056001c1d5a2a48c28d582d4d847347c2ab5b7f8272314cac58acf62345126b6b09bea623a185935f6b1c3bbce0dfd7f7f + languageName: node + linkType: hard + "wagmi@npm:1.4.4": version: 1.4.4 resolution: "wagmi@npm:1.4.4" @@ -14360,6 +16288,28 @@ __metadata: languageName: node linkType: hard +"ws@npm:~8.11.0": + version: 8.11.0 + resolution: "ws@npm:8.11.0" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 316b33aba32f317cd217df66dbfc5b281a2f09ff36815de222bc859e3424d83766d9eb2bd4d667de658b6ab7be151f258318fb1da812416b30be13103e5b5c67 + languageName: node + linkType: hard + +"xmlhttprequest-ssl@npm:~2.0.0": + version: 2.0.0 + resolution: "xmlhttprequest-ssl@npm:2.0.0" + checksum: 1e98df67f004fec15754392a131343ea92e6ab5ac4d77e842378c5c4e4fd5b6a9134b169d96842cc19422d77b1606b8df84a5685562b3b698cb68441636f827e + languageName: node + linkType: hard + "xmlhttprequest@npm:1.8.0": version: 1.8.0 resolution: "xmlhttprequest@npm:1.8.0" From 8d936fc4ac47462cd3f06cd574e42f4cceecb48b Mon Sep 17 00:00:00 2001 From: Spencer Schoeneman <78219375+Spencer-Sch@users.noreply.github.com> Date: Tue, 5 Dec 2023 14:42:02 -0600 Subject: [PATCH 04/10] Register & Login (#9) * comment out console.logs * comment out failed attempt at making a custom hook * remove dispatch to set provider in auth slice - edit router.push * edit to use isConnected prop * edit to use isConnected from redux state and pass to checkUserAuth * add use of isConnected from redux state, clean up code * move WatchPathname inside of store provider * integrate web3auth, edit inputs, integrate redux state * edit register page/form, integrate web3auth, edit inputs --- .../nextjs/auth/checkUserAuthentication.ts | 10 +- packages/nextjs/auth/web3auth.ts | 79 ++++++++++ .../dash-wind/containers/Header.tsx | 5 +- .../dash-wind/features/charts/index.tsx | 2 +- .../dashboard/components/DashboardTopBar.tsx | 2 +- .../dash-wind/features/user/Login.tsx | 73 ++++----- .../dash-wind/features/user/Register.tsx | 146 +++++++++++------- .../web-3-crew/register-page/DeployForm.tsx | 72 +++++++++ .../register-page/EmployeeRegistered.tsx | 50 ++++++ .../web-3-crew/register-page/RegisterForm.tsx | 63 ++++++++ .../components/web-3-crew/watchPathname.tsx | 8 +- packages/nextjs/pages/_app.tsx | 3 +- packages/nextjs/pages/index.tsx | 14 +- 13 files changed, 400 insertions(+), 127 deletions(-) create mode 100644 packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx create mode 100644 packages/nextjs/components/web-3-crew/register-page/EmployeeRegistered.tsx create mode 100644 packages/nextjs/components/web-3-crew/register-page/RegisterForm.tsx diff --git a/packages/nextjs/auth/checkUserAuthentication.ts b/packages/nextjs/auth/checkUserAuthentication.ts index 2a5e6ad..7c5cd79 100644 --- a/packages/nextjs/auth/checkUserAuthentication.ts +++ b/packages/nextjs/auth/checkUserAuthentication.ts @@ -1,7 +1,8 @@ -import { web3auth } from "~~/auth/web3auth"; +// import { web3auth } from "~~/auth/web3auth"; -export default function checkUserAuthentication(path: string) { - console.log("from checkUserAuthentication - Path = ", path); +export default function checkUserAuthentication(path: string, isConnected: boolean) { + // export default function checkUserAuthentication(path: string) { + // console.log("from checkUserAuthentication - Path = ", path); const protectedRoutes = [ "/dapp/dashboard", @@ -16,7 +17,8 @@ export default function checkUserAuthentication(path: string) { "/dapp/integration", ]; - if (!web3auth.connected && protectedRoutes.includes(path)) { + // if (!web3auth.connected && protectedRoutes.includes(path)) { + if (!isConnected && protectedRoutes.includes(path)) { return false; } return true; diff --git a/packages/nextjs/auth/web3auth.ts b/packages/nextjs/auth/web3auth.ts index 858de5a..f6da7db 100644 --- a/packages/nextjs/auth/web3auth.ts +++ b/packages/nextjs/auth/web3auth.ts @@ -1,5 +1,11 @@ +// import { useEffect, useState } from "react"; import { Web3Auth } from "@web3auth/modal"; +// import { createWalletClient, custom } from "viem"; +// import { polygonMumbai } from "viem/chains"; +// import { AuthProvider, setAuthProvider, setIsConnected } from "~~/auth/authSlice"; +// import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; + export const web3auth = new Web3Auth({ clientId: "BM0SLNkhMCfIygw0Xi79dG6qbWGMN0o0mEeDjRT0dxlP3BEok9pnu5aqxCNfj2TZ9XT7sQaXm0ltuWbCQ1tsRNI", // Get your Client ID from the Web3Auth Dashboard web3AuthNetwork: "sapphire_devnet", // Web3Auth Network @@ -21,3 +27,76 @@ export async function web3AuthInit() { console.error(error); } } + +// Failed attempt at making a custom hook +// Saving for future reference / another try +// export function useWeb3auth() { +// const [provider, setProvider] = useState(null); +// const [loggedIn, setLoggedIn] = useState(false); + +// // useEffect(() => { +// // console.log(`web3auth useEffect - provider: ${!!provider} | loggedIn: ${isConnected}`); +// // }, [provider, isConnected]); +// // useEffect(() => { +// // console.log(`web3auth useEffect - provider: ${!!provider} | loggedIn: ${loggedIn}`); +// // }, [provider, loggedIn]); + +// // async function web3AuthInit() { +// // console.log("web3Auth Init..."); +// // try { +// // await web3auth.initModal(); +// // console.log("web3AuthProvider - from init: ", web3auth.provider); +// // setProvider(web3auth.provider); + +// // if (web3auth.connected) { +// // console.log("web3Auth Init connected?: ", web3auth.connected); +// // dispatch(setIsConnected({ isConnected: true })); +// // // setLoggedIn(true); +// // } +// // } catch (error) { +// // console.error(error); +// // } +// // } + +// async function loginW3A() { +// try { +// const web3authProvider = await web3auth.connect(); +// // dispatch(setAuthProvider({ provider: web3authProvider })); +// console.log("web3AuthProvider - from loginW3A: ", web3authProvider); +// setProvider(web3authProvider); +// if (web3auth.connected) { +// dispatch(setIsConnected({ isConnected: true })); +// console.log("web3Auth - loggedIn: ", loggedIn); +// setLoggedIn(true); +// } +// } catch (error) { +// console.error(error); +// } +// } + +// async function logoutW3A() { +// await web3auth.logout(); +// setProvider(null); +// setLoggedIn(false); +// console.log("logged out"); +// } + +// async function getAccountsW3A() { +// if (!provider) { +// // uiConsole("provider not initialized yet"); +// console.log("from getAccountsW3A: provider not defined"); +// return; +// } +// const client = createWalletClient({ +// chain: polygonMumbai, +// transport: custom(provider), +// }); + +// // Get user's Ethereum public address +// const [address] = await client.getAddresses(); +// // toast message? +// return address; +// } + +// return { provider, loggedIn, web3AuthInit, loginW3A, logoutW3A, getAccountsW3A }; +// } diff --git a/packages/nextjs/components/dash-wind/containers/Header.tsx b/packages/nextjs/components/dash-wind/containers/Header.tsx index c6825dc..d80d64f 100644 --- a/packages/nextjs/components/dash-wind/containers/Header.tsx +++ b/packages/nextjs/components/dash-wind/containers/Header.tsx @@ -9,7 +9,7 @@ import Bars3Icon from "@heroicons/react/24/outline/Bars3Icon"; import BellIcon from "@heroicons/react/24/outline/BellIcon"; import MoonIcon from "@heroicons/react/24/outline/MoonIcon"; import SunIcon from "@heroicons/react/24/outline/SunIcon"; -import { setAuthProvider, setIsConnected } from "~~/auth/authSlice"; +import { setIsConnected } from "~~/auth/authSlice"; import { web3auth } from "~~/auth/web3auth"; // import UserIcon from "@heroicons/react/24/outline/UserIcon"; import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; @@ -42,9 +42,8 @@ function Header() { async function logoutUser() { await web3auth.logout(); - dispatch(setAuthProvider({ provider: null })); dispatch(setIsConnected({ isConnected: false })); - router.push("/"); + router.push("/login"); } return ( diff --git a/packages/nextjs/components/dash-wind/features/charts/index.tsx b/packages/nextjs/components/dash-wind/features/charts/index.tsx index 2a1ce5b..3a1db6d 100644 --- a/packages/nextjs/components/dash-wind/features/charts/index.tsx +++ b/packages/nextjs/components/dash-wind/features/charts/index.tsx @@ -17,7 +17,7 @@ function Charts() { // eslint-disable-next-line @typescript-eslint/no-unused-vars const handleDatePickerValueChange = (newValue: DateValueType, e?: HTMLInputElement | null | undefined) => { if (newValue !== null) { - console.log("newValue:", newValue); + // console.log("newValue:", newValue); setDateValue(newValue); } }; diff --git a/packages/nextjs/components/dash-wind/features/dashboard/components/DashboardTopBar.tsx b/packages/nextjs/components/dash-wind/features/dashboard/components/DashboardTopBar.tsx index 62e86de..b1ae716 100644 --- a/packages/nextjs/components/dash-wind/features/dashboard/components/DashboardTopBar.tsx +++ b/packages/nextjs/components/dash-wind/features/dashboard/components/DashboardTopBar.tsx @@ -30,7 +30,7 @@ function DashboardTopBar({ updateDashboardPeriod }: props) { // eslint-disable-next-line @typescript-eslint/no-unused-vars const handleDatePickerValueChange = (newValue: DateValueType, e?: HTMLInputElement | null | undefined) => { if (newValue !== null) { - console.log("newValue:", newValue); + // console.log("newValue:", newValue); setDateValue(newValue); updateDashboardPeriod(newValue); } diff --git a/packages/nextjs/components/dash-wind/features/user/Login.tsx b/packages/nextjs/components/dash-wind/features/user/Login.tsx index 422073c..74f3d13 100644 --- a/packages/nextjs/components/dash-wind/features/user/Login.tsx +++ b/packages/nextjs/components/dash-wind/features/user/Login.tsx @@ -1,58 +1,50 @@ -import { useEffect, useState } from "react"; +import { useState } from "react"; import Link from "next/link"; import { useRouter } from "next/router"; import InputText from "../../components/Input/InputText"; import ErrorText from "../../components/Typography/ErrorText"; import { UpdateFormValues } from "../../types/FormTypes"; import LandingIntro from "./LandingIntro"; -import { setAuthProvider, setIsConnected } from "~~/auth/authSlice"; +import { setIsConnected } from "~~/auth/authSlice"; import { web3auth } from "~~/auth/web3auth"; -import { useMyDispatch } from "~~/components/dash-wind/app/store"; +import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; function Login() { const INITIAL_LOGIN_OBJ = { - password: "", + contractAddress: "", emailId: "", }; - const [loading, setLoading] = useState(false); + // const [loading, setLoading] = useState(false); const [errorMessage, setErrorMessage] = useState(""); const [loginObj, setLoginObj] = useState(INITIAL_LOGIN_OBJ); + const { isConnected } = useMySelector((state: MyState) => state.auth); const router = useRouter(); const dispatch = useMyDispatch(); // Web3Auth - useEffect(() => { - const init = async () => { - try { - const web3authProvider = await web3auth.connect(); - dispatch(setAuthProvider({ provider: web3authProvider })); - if (web3auth.connected) { - dispatch(setIsConnected({ isConnected: true })); - } + async function login() { + if (isConnected) { + router.push("/dapp/dashboard"); + } + try { + await web3auth.connect(); + if (web3auth.connected) { + dispatch(setIsConnected({ isConnected: true })); router.push("/dapp/dashboard"); - } catch (error) { - console.error(error); } - }; - init(); - }); + } catch (error) { + console.error(error); + } + } const submitForm = (e: React.FormEvent) => { e.preventDefault(); setErrorMessage(""); - if (loginObj.emailId.trim() === "") return setErrorMessage("Email Id is required! (use any value)"); - if (loginObj.password.trim() === "") return setErrorMessage("Password is required! (use any value)"); - else { - setLoading(true); - // Call API to check user credentials and save token in localstorage - localStorage.setItem("token", "DumyTokenHere"); - setLoading(false); - router.push("/dapp/welcome"); - // window.location.href = "/dapp/welcome"; - } + if (loginObj.emailId.trim() === "") return setErrorMessage("Email is required!"); + if (loginObj.contractAddress.trim() === "") return setErrorMessage("Contract Address is required!"); }; const updateFormValue = ({ updateType, value }: UpdateFormValues) => { @@ -72,34 +64,25 @@ function Login() {
submitForm(e)}>
-
- - - Forgot Password? - - -
- {errorMessage} - diff --git a/packages/nextjs/components/dash-wind/features/user/Register.tsx b/packages/nextjs/components/dash-wind/features/user/Register.tsx index 7496f5b..cc297b2 100644 --- a/packages/nextjs/components/dash-wind/features/user/Register.tsx +++ b/packages/nextjs/components/dash-wind/features/user/Register.tsx @@ -1,34 +1,92 @@ import { useState } from "react"; -import Link from "next/link"; -import InputText from "../../components/Input/InputText"; -import ErrorText from "../../components/Typography/ErrorText"; import { UpdateFormValues } from "../../types/FormTypes"; import LandingIntro from "./LandingIntro"; +import { Address, createWalletClient, custom } from "viem"; +import { polygonMumbai } from "viem/chains"; +import { setIsConnected } from "~~/auth/authSlice"; +import { web3auth } from "~~/auth/web3auth"; +import { useMyDispatch } from "~~/components/dash-wind/app/store"; +import DeployForm from "~~/components/web-3-crew/register-page/DeployForm"; +import EmployeeRegistered from "~~/components/web-3-crew/register-page/EmployeeRegistered"; +import RegisterForm from "~~/components/web-3-crew/register-page/RegisterForm"; + +type RegisterState = "init" | "company-deploy" | "employee-complete" | "loading"; function Register() { const INITIAL_REGISTER_OBJ = { - name: "", - password: "", emailId: "", }; - const [loading, setLoading] = useState(false); + // const [loading, setLoading] = useState(false); const [errorMessage, setErrorMessage] = useState(""); + const [registerState, setRegisterState] = useState("init"); const [registerObj, setRegisterObj] = useState(INITIAL_REGISTER_OBJ); + const [walletAddress, setWalletAddress] = useState
(null); + + const dispatch = useMyDispatch(); + + async function login() { + try { + await web3auth.connect(); + if (web3auth.connected) { + dispatch(setIsConnected({ isConnected: true })); + } + } catch (error) { + console.error(error); + } + } + + async function getAccounts() { + if (!web3auth.provider) { + console.log("from Register - getAccounts: provider not defined"); + return; + } + const client = createWalletClient({ + chain: polygonMumbai, + transport: custom(web3auth.provider), + }); + + // Get user's public address + const [address] = await client.getAddresses(); + return address; + } - const submitForm = (e: React.FormEvent) => { + const registerCompany = async (e: React.MouseEvent) => { e.preventDefault(); setErrorMessage(""); - if (registerObj.name.trim() === "") return setErrorMessage("Name is required! (use any value)"); - if (registerObj.emailId.trim() === "") return setErrorMessage("Email Id is required! (use any value)"); - if (registerObj.password.trim() === "") return setErrorMessage("Password is required! (use any value)"); + if (registerObj.emailId.trim() === "") return setErrorMessage("Email is required!"); else { - setLoading(true); - // Call API to check user credentials and save token in localstorage - localStorage.setItem("token", "DumyTokenHere"); - setLoading(false); - window.location.href = "/dapp/welcome"; + setRegisterState("loading"); + console.log("logging in company..."); + await login(); + // Account Abstraction goes here...? + console.log("getting account address..."); + const address = await getAccounts(); + if (address) { + // Prompt user to fund wallet? + setWalletAddress(address); + // Prompt use to deploy contract using wallet address + setRegisterState("company-deploy"); + } + } + }; + + const registerEmployee = async (e: React.MouseEvent) => { + e.preventDefault(); + setErrorMessage(""); + + if (registerObj.emailId.trim() === "") return setErrorMessage("Email is required!"); + else { + setRegisterState("loading"); + console.log("logging in employee..."); + await login(); + // Account Abstraction goes here...? + const address = await getAccounts(); + if (address) { + setWalletAddress(address); + setRegisterState("employee-complete"); + } } }; @@ -44,51 +102,19 @@ function Register() {
-
-

Register

- submitForm(e)}> -
- - - - - -
- - {errorMessage} - - -
- Already have an account?{" "} - - - Login - - -
- -
+ {registerState === "loading" &&
Loading...
} + {registerState === "init" && ( + + )} + {registerState === "company-deploy" && } + {registerState === "employee-complete" && } diff --git a/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx b/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx new file mode 100644 index 0000000..677742e --- /dev/null +++ b/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx @@ -0,0 +1,72 @@ +import React from "react"; +import Link from "next/link"; +import { Abi, Address, parseEther } from "viem"; +import { useContractWrite, usePrepareContractWrite } from "wagmi"; +import ErrorText from "~~/components/dash-wind/components/Typography/ErrorText"; +import { Address as AddressDisplay } from "~~/components/scaffold-eth/Address"; + +interface props { + ownerAddress: Address | null; +} + +const payrollFactoryAddress = ""; +const payrollFactoryABI: Abi = []; + +export default function DeployForm({ ownerAddress }: props) { + const { config } = usePrepareContractWrite({ + address: payrollFactoryAddress, + abi: payrollFactoryABI, + functionName: "deployPayrollAndTokenTransferor", + value: parseEther("1", "wei"), + onSuccess(data) { + console.log("contract deployed! Data: ", data); + }, + onError(error) { + console.error("contract deploy error!", error); + }, + }); + + const { data, isLoading, isSuccess, write } = useContractWrite(config); + + return ( +
+

Deploy Payroll Contract

+
+ {ownerAddress ? ( + <> +
+

Account Owner Address:

+ +
+ {/* + + ) : ( + Error: Owner Address Not Found + )} + + {data && ( +
+

Payroll Contract Address:

+ {/*

{data}

*/} + {/* */} +
+ )} + +
+ + + Go Home + + +
+
+
+ ); +} diff --git a/packages/nextjs/components/web-3-crew/register-page/EmployeeRegistered.tsx b/packages/nextjs/components/web-3-crew/register-page/EmployeeRegistered.tsx new file mode 100644 index 0000000..8e3e618 --- /dev/null +++ b/packages/nextjs/components/web-3-crew/register-page/EmployeeRegistered.tsx @@ -0,0 +1,50 @@ +import React from "react"; +import Link from "next/link"; +import { Address } from "viem"; +import ErrorText from "~~/components/dash-wind/components/Typography/ErrorText"; +import { Address as AddressDisplay } from "~~/components/scaffold-eth/Address"; + +interface props { + employeeAddress: Address | null; +} + +export default function EmployeeRegistered({ employeeAddress }: props) { + return ( +
+ {employeeAddress ? ( + <> +

Registration Complete!

+
+
+

Your New Address:

+ +
+

+ Give this address to your company administrator +

+ +
+ + + Go Home + + +
+
+ + ) : ( + <> +

Registration Error!

+ Error: Employee Address Not Found +
+ + + Go Home + + +
+ + )} +
+ ); +} diff --git a/packages/nextjs/components/web-3-crew/register-page/RegisterForm.tsx b/packages/nextjs/components/web-3-crew/register-page/RegisterForm.tsx new file mode 100644 index 0000000..c305a18 --- /dev/null +++ b/packages/nextjs/components/web-3-crew/register-page/RegisterForm.tsx @@ -0,0 +1,63 @@ +import React from "react"; +import Link from "next/link"; +import InputText from "~~/components/dash-wind/components/Input/InputText"; +import ErrorText from "~~/components/dash-wind/components/Typography/ErrorText"; +import { UpdateFormValues } from "~~/components/dash-wind/types/FormTypes"; + +interface props { + updateFormValue: ({ updateType, value }: UpdateFormValues) => void; + registerObj: { emailId: string }; + loading?: boolean; + errorMessage: string; + registerCompany: (e: React.MouseEvent) => void; + registerEmployee: (e: React.MouseEvent) => void; +} + +export default function registerForm({ + updateFormValue, + registerObj, + loading, + errorMessage, + registerCompany, + registerEmployee, +}: props) { + return ( +
+

Register

+
+
+ +
+ + {errorMessage} + + + +
+ Already have an account?{" "} + + + Login + + +
+
+
+ ); +} diff --git a/packages/nextjs/components/web-3-crew/watchPathname.tsx b/packages/nextjs/components/web-3-crew/watchPathname.tsx index 6b03fb7..c60263f 100644 --- a/packages/nextjs/components/web-3-crew/watchPathname.tsx +++ b/packages/nextjs/components/web-3-crew/watchPathname.tsx @@ -4,20 +4,22 @@ import React, { useEffect } from "react"; import { usePathname } from "next/navigation"; import { useRouter } from "next/router"; import checkUserAuthentication from "~~/auth/checkUserAuthentication"; +import { MyState, useMySelector } from "~~/components/dash-wind/app/store"; export default function WatchPathname() { const pathname = usePathname(); const router = useRouter(); + const { isConnected } = useMySelector((state: MyState) => state.auth); useEffect(() => { - console.log(`Route changed to: ${pathname}`); + // console.log(`Route changed to: ${pathname}`); if (pathname !== null) { - const userIsAuthenticated = checkUserAuthentication(pathname); + const userIsAuthenticated = checkUserAuthentication(pathname, isConnected); if (!userIsAuthenticated) { router.replace("/login"); } } - }, [pathname, router]); + }, [pathname, router, isConnected]); return <>; } diff --git a/packages/nextjs/pages/_app.tsx b/packages/nextjs/pages/_app.tsx index 59df41e..2218962 100644 --- a/packages/nextjs/pages/_app.tsx +++ b/packages/nextjs/pages/_app.tsx @@ -61,7 +61,7 @@ const ScaffoldEthApp = ({ Component, pageProps }: AppPropsWithLayout) => { return ( - + {/* */} { theme={isDarkTheme ? darkTheme() : lightTheme()} > +
{getLayout()}
{/*
{getLayout()}
*/}
diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 8a51d66..a91e4ec 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -2,31 +2,30 @@ import { ReactElement, useEffect } from "react"; // import Link from "next/link"; import { useRouter } from "next/router"; import type { NextPageWithLayout } from "./_app"; -import { setAuthProvider, setIsConnected } from "~~/auth/authSlice"; +import { setIsConnected } from "~~/auth/authSlice"; import { web3auth } from "~~/auth/web3auth"; import { MetaHeader } from "~~/components/MetaHeader"; -import { useMyDispatch } from "~~/components/dash-wind/app/store"; +import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; import CleanLayout from "~~/components/layouts/CleanLayout"; const LandingPage: NextPageWithLayout = () => { const router = useRouter(); const dispatch = useMyDispatch(); + const { isConnected } = useMySelector((state: MyState) => state.auth); useEffect(() => { - dispatch(setAuthProvider({ provider: web3auth.provider })); - if (web3auth.connected) { dispatch(setIsConnected({ isConnected: true })); } }, [dispatch]); function launchDapp() { - if (web3auth.connected) { + if (isConnected) { // redirect to dashboard if logged in router.push("/dapp/dashboard"); return; } - // redirect to login if not connected + // redirect to login if not logged in router.push("/login"); } return ( @@ -47,9 +46,6 @@ const LandingPage: NextPageWithLayout = () => { - {/* - Launch Dapp - */} ); From 206eed0c13ebcf6ecf37df6c6591bbc0f765dc9e Mon Sep 17 00:00:00 2001 From: Spencer Schoeneman <78219375+Spencer-Sch@users.noreply.github.com> Date: Wed, 6 Dec 2023 15:55:08 -0600 Subject: [PATCH 05/10] Admin Dash - Employees Page (#11) * make styleClass prop optional * add employees dummy data * swap out leadsSlice for employeesSlice and all references * edit component to allow for left/right controle of topSideButtons * edit sidebar/routes, add sidebar routes for admin vs employee, add employees page, add employee profile page/view/edit * remove provider from authSlice, add isAdmin to authSlice * add commented code for future reference --- packages/nextjs/auth/authSlice.ts | 19 +- .../nextjs/components/dash-wind/app/store.ts | 16 +- .../dash-wind/components/Cards/TitleCard.tsx | 9 +- .../components/Typography/Subtitle.tsx | 2 +- .../dash-wind/containers/LeftSidebar.tsx | 22 +- .../dash-wind/containers/ModalLayout.tsx | 6 +- .../components/AddEmployeeModalBody.tsx | 102 +++++++++ .../features/employees/employeesSlice.ts | 78 +++++++ .../dash-wind/features/employees/index.tsx | 127 +++++++++++ .../dash-wind/features/leads/index.tsx | 215 +++++++++--------- .../dash-wind/features/user/Register.tsx | 1 + .../protected/{Leads.tsx => Employees.tsx} | 6 +- .../protected/employee/EmployeeProfile.tsx | 16 ++ .../components/dash-wind/routes/index.ts | 10 +- .../components/dash-wind/routes/sidebar.ts | 175 +++++++------- .../components/dash-wind/utils/dummyData.ts | 74 ++++++ .../dash-wind/utils/globalConstantUtil.ts | 1 + .../employeeProfile/EmployeeProfile.tsx | 68 ++++++ .../components/EditProfile.tsx | 71 ++++++ .../components/ProfileAttribute.tsx | 16 ++ .../components/ViewProfile.tsx | 45 ++++ .../components/web-3-crew/types/Employee.ts | 13 ++ packages/nextjs/pages/dapp/employee/[id].tsx | 23 ++ .../pages/dapp/{leads.tsx => employees.tsx} | 4 +- 24 files changed, 889 insertions(+), 230 deletions(-) create mode 100644 packages/nextjs/components/dash-wind/features/employees/components/AddEmployeeModalBody.tsx create mode 100644 packages/nextjs/components/dash-wind/features/employees/employeesSlice.ts create mode 100644 packages/nextjs/components/dash-wind/features/employees/index.tsx rename packages/nextjs/components/dash-wind/pages/protected/{Leads.tsx => Employees.tsx} (70%) create mode 100644 packages/nextjs/components/dash-wind/pages/protected/employee/EmployeeProfile.tsx create mode 100644 packages/nextjs/components/web-3-crew/employeeProfile/EmployeeProfile.tsx create mode 100644 packages/nextjs/components/web-3-crew/employeeProfile/components/EditProfile.tsx create mode 100644 packages/nextjs/components/web-3-crew/employeeProfile/components/ProfileAttribute.tsx create mode 100644 packages/nextjs/components/web-3-crew/employeeProfile/components/ViewProfile.tsx create mode 100644 packages/nextjs/components/web-3-crew/types/Employee.ts create mode 100644 packages/nextjs/pages/dapp/employee/[id].tsx rename packages/nextjs/pages/dapp/{leads.tsx => employees.tsx} (83%) diff --git a/packages/nextjs/auth/authSlice.ts b/packages/nextjs/auth/authSlice.ts index b9f85db..bc8e11d 100644 --- a/packages/nextjs/auth/authSlice.ts +++ b/packages/nextjs/auth/authSlice.ts @@ -1,37 +1,34 @@ import { PayloadAction, createSlice } from "@reduxjs/toolkit"; -import { IProvider } from "@web3auth/base"; - -export type AuthProvider = IProvider | null; export interface AuthRootState { auth: { isConnected: boolean; - provider: AuthProvider; + isAdmin: boolean; }; } interface AuthState { isConnected: boolean; - provider: AuthProvider; + isAdmin: boolean; } export const authSlice = createSlice({ name: "auth", initialState: { isConnected: false, - provider: null as AuthProvider, + isAdmin: false, }, reducers: { - setAuthProvider: (state: AuthState, action: PayloadAction<{ provider: AuthProvider }>) => { - state.provider = action.payload.provider; - }, - setIsConnected: (state: AuthState, action: PayloadAction<{ isConnected: boolean }>) => { state.isConnected = action.payload.isConnected; }, + + setIsAdmin: (state: AuthState, action: PayloadAction<{ isAdmin: boolean }>) => { + state.isAdmin = action.payload.isAdmin; + }, }, }); -export const { setAuthProvider, setIsConnected } = authSlice.actions; +export const { setIsConnected, setIsAdmin } = authSlice.actions; export default authSlice.reducer; diff --git a/packages/nextjs/components/dash-wind/app/store.ts b/packages/nextjs/components/dash-wind/app/store.ts index f4a9a68..b6ea562 100644 --- a/packages/nextjs/components/dash-wind/app/store.ts +++ b/packages/nextjs/components/dash-wind/app/store.ts @@ -1,12 +1,15 @@ import headerSlice from "../features/common/headerSlice"; import modalSlice from "../features/common/modalSlice"; import rightDrawerSlice from "../features/common/rightDrawerSlice"; -import leadsSlice from "../features/leads/leadSlice"; +// import leadsSlice from "../features/leads/leadSlice"; +import employeesSlice, { Employee } from "../features/employees/employeesSlice"; import { Reducer, ThunkAction, configureStore } from "@reduxjs/toolkit"; import { createWrapper } from "next-redux-wrapper"; import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux"; import { Action } from "redux"; -import authSlice, { AuthProvider } from "~~/auth/authSlice"; +import authSlice from "~~/auth/authSlice"; + +// import authSlice, { AuthProvider } from "~~/auth/authSlice"; interface CombinedReducer { header: Reducer<{ @@ -28,13 +31,14 @@ interface CombinedReducer { size: string; extraObject: Record; }>; - lead: Reducer<{ + employees: Reducer<{ isLoading: boolean; - leads: never[]; + employees: Employee[]; }>; auth: Reducer<{ isConnected: boolean; - provider: AuthProvider; + isAdmin: boolean; + // provider: AuthProvider; }>; } @@ -42,7 +46,7 @@ const combinedReducer: CombinedReducer = { header: headerSlice, rightDrawer: rightDrawerSlice, modal: modalSlice, - lead: leadsSlice, + employees: employeesSlice, auth: authSlice, }; diff --git a/packages/nextjs/components/dash-wind/components/Cards/TitleCard.tsx b/packages/nextjs/components/dash-wind/components/Cards/TitleCard.tsx index 58f0e38..8209aad 100644 --- a/packages/nextjs/components/dash-wind/components/Cards/TitleCard.tsx +++ b/packages/nextjs/components/dash-wind/components/Cards/TitleCard.tsx @@ -6,9 +6,10 @@ interface props { children: ReactNode; topMargin?: string; TopSideButtons?: JSX.Element; + topSideButtonsLeft?: boolean; } -function TitleCard({ title, children, topMargin, TopSideButtons }: props) { +function TitleCard({ title, children, topMargin, TopSideButtons, topSideButtonsLeft }: props) { return (
{/* Title for Card */} @@ -16,7 +17,11 @@ function TitleCard({ title, children, topMargin, TopSideButtons }: props) { {title} {/* Top side button, show only if present */} - {TopSideButtons &&
{TopSideButtons}
} + {TopSideButtons && ( +
+ {TopSideButtons} +
+ )}
diff --git a/packages/nextjs/components/dash-wind/components/Typography/Subtitle.tsx b/packages/nextjs/components/dash-wind/components/Typography/Subtitle.tsx index 251beec..a60ceac 100644 --- a/packages/nextjs/components/dash-wind/components/Typography/Subtitle.tsx +++ b/packages/nextjs/components/dash-wind/components/Typography/Subtitle.tsx @@ -1,7 +1,7 @@ import { ReactNode } from "react"; interface props { - styleClass: string; + styleClass?: string; children: ReactNode; } function Subtitle({ styleClass, children }: props) { diff --git a/packages/nextjs/components/dash-wind/containers/LeftSidebar.tsx b/packages/nextjs/components/dash-wind/containers/LeftSidebar.tsx index 3cd8106..14212be 100644 --- a/packages/nextjs/components/dash-wind/containers/LeftSidebar.tsx +++ b/packages/nextjs/components/dash-wind/containers/LeftSidebar.tsx @@ -1,14 +1,22 @@ /* eslint-disable @next/next/no-img-element */ // import Image from "next/image"; +// import { useEffect } from "react"; import Link from "next/link"; import { useRouter } from "next/router"; -import routes from "../routes/sidebar"; +import { adminRoutes, userRoutes } from "../routes/sidebar"; import SidebarSubmenu from "./SidebarSubmenu"; +import { MyState, useMySelector } from "~~/components/dash-wind/app/store"; // import XMarkIcon from "@heroicons/react/24/outline/XMarkIcon"; function LeftSidebar() { const router = useRouter(); + const { isAdmin } = useMySelector((state: MyState) => state.auth); + + const routes = isAdmin ? adminRoutes : userRoutes; + // useEffect(() => { + + // }, [isAdmin]) // const close = () => { // document.getElementById("left-sidebar-drawer")?.click(); @@ -39,9 +47,17 @@ function LeftSidebar() { ) : ( - + {} {route.name} - {router.pathname === route.path ? ( + {router.pathname === route.path || + (route.path === "/dapp/employees" && /\/employee\/./i.test(router.pathname)) ? (
From 1b275fcfb6e487fc54f700c8ce78b7f66eb6e5f9 Mon Sep 17 00:00:00 2001 From: Spencer Schoeneman <78219375+Spencer-Sch@users.noreply.github.com> Date: Fri, 8 Dec 2023 10:19:08 -0600 Subject: [PATCH 08/10] Payments Page - Admin Dash (#17) * comment out incomplete isAdmin code * add temp 'toggle isAdmin' button to header * rename 'Transactions' to 'Payments' * update payment data sctructure and display * changed z-index on filter dropdown - updated filter options - NOTE: filter/search not fully functional * remove 'billing' from admin sidebar --- .../dash-wind/containers/Header.tsx | 10 +- .../{transactions => payments}/index.tsx | 58 +++-- .../dash-wind/features/user/Login.tsx | 63 ++--- .../{Transactions.tsx => Payments.tsx} | 6 +- .../components/dash-wind/routes/index.ts | 101 ++++---- .../components/dash-wind/routes/sidebar.ts | 47 ++-- .../components/dash-wind/utils/dummyData.ts | 245 +++++++++++++----- .../dapp/{transactions.tsx => payments.tsx} | 4 +- 8 files changed, 351 insertions(+), 183 deletions(-) rename packages/nextjs/components/dash-wind/features/{transactions => payments}/index.tsx (70%) rename packages/nextjs/components/dash-wind/pages/protected/{Transactions.tsx => Payments.tsx} (68%) rename packages/nextjs/pages/dapp/{transactions.tsx => payments.tsx} (81%) diff --git a/packages/nextjs/components/dash-wind/containers/Header.tsx b/packages/nextjs/components/dash-wind/containers/Header.tsx index d80d64f..20d32ac 100644 --- a/packages/nextjs/components/dash-wind/containers/Header.tsx +++ b/packages/nextjs/components/dash-wind/containers/Header.tsx @@ -9,7 +9,7 @@ import Bars3Icon from "@heroicons/react/24/outline/Bars3Icon"; import BellIcon from "@heroicons/react/24/outline/BellIcon"; import MoonIcon from "@heroicons/react/24/outline/MoonIcon"; import SunIcon from "@heroicons/react/24/outline/SunIcon"; -import { setIsConnected } from "~~/auth/authSlice"; +import { setIsAdmin, setIsConnected } from "~~/auth/authSlice"; import { web3auth } from "~~/auth/web3auth"; // import UserIcon from "@heroicons/react/24/outline/UserIcon"; import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; @@ -18,6 +18,7 @@ import { Address } from "~~/components/web-3-crew/Address"; function Header() { const dispatch = useMyDispatch(); const { noOfNotifications, pageTitle } = useMySelector((state: MyState) => state.header); + const { isAdmin } = useMySelector((state: MyState) => state.auth); const [currentTheme, setCurrentTheme] = useState( typeof window !== "undefined" ? localStorage.getItem("theme") : null, ); @@ -46,6 +47,10 @@ function Header() { router.push("/login"); } + function toggleIsAdmin() { + dispatch(setIsAdmin({ isAdmin: !isAdmin })); + } + return ( <>
@@ -58,6 +63,9 @@ function Header() {
+ {/* Multiple theme selection, uncomment this if you want to enable multiple themes selection, also includes corporate and retro themes in tailwind.config file */} diff --git a/packages/nextjs/components/dash-wind/features/transactions/index.tsx b/packages/nextjs/components/dash-wind/features/payments/index.tsx similarity index 70% rename from packages/nextjs/components/dash-wind/features/transactions/index.tsx rename to packages/nextjs/components/dash-wind/features/payments/index.tsx index 955e780..9a60353 100644 --- a/packages/nextjs/components/dash-wind/features/transactions/index.tsx +++ b/packages/nextjs/components/dash-wind/features/payments/index.tsx @@ -3,9 +3,9 @@ import { useCallback, useEffect, useState } from "react"; // import Image from "next/image"; import TitleCard from "../../components/Cards/TitleCard"; import SearchBar from "../../components/Input/SearchBar"; -import { RECENT_TRANSACTIONS } from "../../utils/dummyData"; +import { RECENT_PAYMENTS } from "../../utils/dummyData"; // import { showNotification } from "../common/headerSlice"; -import moment from "moment"; +// import moment from "moment"; // import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; import FunnelIcon from "@heroicons/react/24/outline/FunnelIcon"; import XMarkIcon from "@heroicons/react/24/outline/XMarkIcon"; @@ -19,7 +19,7 @@ interface TopSideButtonsProps { const TopSideButtons = ({ removeFilter, applyFilter, applySearch }: TopSideButtonsProps) => { const [filterParam, setFilterParam] = useState(""); const [searchText, setSearchText] = useState(""); - const locationFilters = ["Paris", "London", "Canada", "Peru", "Tokyo"]; + const statusFilters = ["paid", "pending"]; const showFiltersAndApply = (params: string) => { applyFilter(params); @@ -54,11 +54,11 @@ const TopSideButtons = ({ removeFilter, applyFilter, applySearch }: TopSideButto Filter -
    - {locationFilters.map((l, k) => { +
      + {statusFilters.map((s, k) => { return (
    • - showFiltersAndApply(l)}>{l} + showFiltersAndApply(s)}>{s}
    • ); })} @@ -72,32 +72,38 @@ const TopSideButtons = ({ removeFilter, applyFilter, applySearch }: TopSideButto ); }; -function Transactions() { - const [trans, setTrans] = useState(RECENT_TRANSACTIONS); +function Payments() { + const [payments, setPayments] = useState(RECENT_PAYMENTS); + + const getPaymentStatus = (status: string) => { + if (status === "Paid") return
      {status}
      ; + if (status === "Pending") return
      {status}
      ; + else return
      {status}
      ; + }; const removeFilter = () => { - setTrans(RECENT_TRANSACTIONS); + setPayments(RECENT_PAYMENTS); }; const applyFilter = (params: string) => { - const filteredTransactions = RECENT_TRANSACTIONS.filter(t => { - return t.location == params; + const filteredPayments = RECENT_PAYMENTS.filter(p => { + return p.status.toLowerCase() == params.toLowerCase(); }); - setTrans(filteredTransactions); + setPayments(filteredPayments); }; // Search according to name const applySearch = (value: string) => { - const filteredTransactions = RECENT_TRANSACTIONS.filter(t => { - return t.email.toLowerCase().includes(value.toLowerCase()) || t.email.toLowerCase().includes(value.toLowerCase()); + const filteredPayments = RECENT_PAYMENTS.filter(p => { + return p.name.toLowerCase().includes(value.toLowerCase()) || p.name.toLowerCase().includes(value.toLowerCase()); }); - setTrans(filteredTransactions); + setPayments(filteredPayments); }; return ( <> @@ -109,14 +115,16 @@ function Transactions() { Name - Email Id - Location + To Wallet + Invoice No + Invoice Generated On Amount - Transaction Date + Status + Invoice Paid On - {trans.map((l, k) => { + {payments.map((l, k) => { return ( @@ -131,10 +139,12 @@ function Transactions() {
- {l.email} - {l.location} + {l.wallet} + {l.invoiceNo} + {l.generatedOn} ${l.amount} - {moment(l.date).format("D MMM")} + {getPaymentStatus(l.status)} + {l.paidOn} ); })} @@ -146,4 +156,4 @@ function Transactions() { ); } -export default Transactions; +export default Payments; diff --git a/packages/nextjs/components/dash-wind/features/user/Login.tsx b/packages/nextjs/components/dash-wind/features/user/Login.tsx index e4aa292..6ba37e7 100644 --- a/packages/nextjs/components/dash-wind/features/user/Login.tsx +++ b/packages/nextjs/components/dash-wind/features/user/Login.tsx @@ -5,10 +5,13 @@ import InputText from "../../components/Input/InputText"; import ErrorText from "../../components/Typography/ErrorText"; import { UpdateFormValues } from "../../types/FormTypes"; import LandingIntro from "./LandingIntro"; -import { Address, createWalletClient, custom } from "viem"; -import { polygonMumbai } from "viem/chains"; +// import { Address, createWalletClient, custom } from "viem"; +// import { polygonMumbai } from "viem/chains"; import { useContractRead } from "wagmi"; -import { setIsAdmin, setIsConnected } from "~~/auth/authSlice"; +import { + /*setIsAdmin,*/ + setIsConnected, +} from "~~/auth/authSlice"; import { web3auth } from "~~/auth/web3auth"; import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; @@ -80,11 +83,11 @@ function Login() { await web3auth.connect(); if (web3auth.connected) { dispatch(setIsConnected({ isConnected: true })); - await determineIfAccountIsAdmin(); - if (!isEmployee) { - // until the hook is working, this is going to prevent us from being directed to the dashboard - return; - } + // await determineIfAccountIsAdmin(); + // if (!isEmployee) { + // // until the hook is working, this is going to prevent us from being directed to the dashboard + // return; + // } router.push("/dapp/dashboard"); } } catch (error) { @@ -94,11 +97,11 @@ function Login() { async function determineIfAccountIsAdmin() { // set loading === true ??? - const address = await getAccounts(); - if (!address) { - console.error("from determineIfAccountIsAdmin - address is undefined"); - return; - } + // const address = await getAccounts(); + // if (!address) { + // console.error("from determineIfAccountIsAdmin - address is undefined"); + // return; + // } if (!owner) { console.error("From determineIfAccountIsAdmin: ownerData from Payroll Contract is undefined"); @@ -108,27 +111,27 @@ function Login() { /*-------------------------------------*/ // Kaz & Trevor // need to see what shape `owner` will be on return - const isAdmin = address === owner ? true : false; - dispatch(setIsAdmin({ isAdmin: isAdmin })); + // const isAdmin = address === owner ? true : false; + // dispatch(setIsAdmin({ isAdmin: isAdmin })); /*-------------------------------------*/ // set loading === false ??? } - async function getAccounts() { - if (!web3auth.provider) { - console.log("from login - getAccounts: provider not defined"); - return; - } - const client = createWalletClient({ - // account: privateKeyToAccount('0x...'); // from viem - chain: polygonMumbai, - transport: custom(web3auth.provider), - }); - - // Get user's public address - const [address] = await client.getAddresses(); - return address as Address; - } + // async function getAccounts() { + // if (!web3auth.provider) { + // console.log("from login - getAccounts: provider not defined"); + // return; + // } + // const client = createWalletClient({ + // // account: privateKeyToAccount('0x...'); // from viem + // chain: polygonMumbai, + // transport: custom(web3auth.provider), + // }); + + // // Get user's public address + // const [address] = await client.getAddresses(); + // return address as Address; + // } const submitForm = (e: React.FormEvent) => { e.preventDefault(); diff --git a/packages/nextjs/components/dash-wind/pages/protected/Transactions.tsx b/packages/nextjs/components/dash-wind/pages/protected/Payments.tsx similarity index 68% rename from packages/nextjs/components/dash-wind/pages/protected/Transactions.tsx rename to packages/nextjs/components/dash-wind/pages/protected/Payments.tsx index 1fcdb58..0d82980 100644 --- a/packages/nextjs/components/dash-wind/pages/protected/Transactions.tsx +++ b/packages/nextjs/components/dash-wind/pages/protected/Payments.tsx @@ -1,16 +1,16 @@ import { useEffect } from "react"; import { setPageTitle } from "../../features/common/headerSlice"; -import Transactions from "../../features/transactions"; +import Payments from "../../features/payments"; import { useMyDispatch } from "~~/components/dash-wind/app/store"; function InternalPage() { const dispatch = useMyDispatch(); useEffect(() => { - dispatch(setPageTitle({ title: "Transactions" })); + dispatch(setPageTitle({ title: "Payments" })); }, [dispatch]); - return ; + return ; } export default InternalPage; diff --git a/packages/nextjs/components/dash-wind/routes/index.ts b/packages/nextjs/components/dash-wind/routes/index.ts index 2cd295f..fa97cb9 100644 --- a/packages/nextjs/components/dash-wind/routes/index.ts +++ b/packages/nextjs/components/dash-wind/routes/index.ts @@ -2,82 +2,87 @@ import { lazy } from "react"; const Dashboard = lazy(() => import("../pages/protected/Dashboard")); -const Welcome = lazy(() => import("../pages/protected/Welcome")); +// const Welcome = lazy(() => import("../pages/protected/Welcome")); const Page404 = lazy(() => import("../pages/protected/_404")); -const Blank = lazy(() => import("../pages/protected/Blank")); -const Charts = lazy(() => import("../pages/protected/Charts")); +// const Blank = lazy(() => import("../pages/protected/Blank")); +// const Charts = lazy(() => import("../pages/protected/Charts")); // const Leads = lazy(() => import("../pages/protected/Leads")); -const Integration = lazy(() => import("../pages/protected/Integration")); -const Calendar = lazy(() => import("../pages/protected/Calendar")); -const Team = lazy(() => import("../pages/protected/Team")); -const Transactions = lazy(() => import("../pages/protected/Transactions")); +// const Integration = lazy(() => import("../pages/protected/Integration")); +// const Calendar = lazy(() => import("../pages/protected/Calendar")); +// const Team = lazy(() => import("../pages/protected/Team")); +// const Transactions = lazy(() => import("../pages/protected/Transactions")); +const Payments = lazy(() => import("../pages/protected/Payments")); const Bills = lazy(() => import("../pages/protected/Bills")); -const ProfileSettings = lazy(() => import("../pages/protected/ProfileSettings")); -const GettingStarted = lazy(() => import("../pages/GettingStarted")); +// const ProfileSettings = lazy(() => import("../pages/protected/ProfileSettings")); +// const GettingStarted = lazy(() => import("../pages/GettingStarted")); // const DocFeatures = lazy(() => import("../pages/DocFeatures")); -const DocComponents = lazy(() => import("../pages/DocComponents")); +// const DocComponents = lazy(() => import("../pages/DocComponents")); const routes = [ { path: "/dashboard", // the url component: Dashboard, // view rendered }, - { - path: "/welcome", // the url - component: Welcome, // view rendered - }, + // { + // path: "/welcome", // the url + // component: Welcome, // view rendered + // }, // { // path: "/leads", // component: Leads, // }, + // { + // path: "/settings-team", + // component: Team, + // }, + // { + // path: "/calendar", + // component: Calendar, + // }, { - path: "/settings-team", - component: Team, - }, - { - path: "/calendar", - component: Calendar, - }, - { - path: "/transactions", - component: Transactions, - }, - { - path: "/settings-profile", - component: ProfileSettings, + path: "/payments", + component: Payments, }, + // { + // path: "/transactions", + // component: Transactions, + // }, + // { + // path: "/settings-profile", + // component: ProfileSettings, + // }, { path: "/settings-billing", component: Bills, }, - { - path: "/getting-started", - component: GettingStarted, - }, + // { + // path: "/getting-started", + // component: GettingStarted, + // }, // { // path: "/features", // component: DocFeatures, // }, - { - path: "/components", - component: DocComponents, - }, - { - path: "/integration", - component: Integration, - }, - { - path: "/charts", - component: Charts, - }, + // { + // path: "/components", + // component: DocComponents, + // }, + // { + // path: "/integration", + // component: Integration, + // }, + // { + // path: "/charts", + // component: Charts, + // }, { path: "/404", component: Page404, }, - { - path: "/blank", - component: Blank, - }, + // { + // path: "/blank", + // component: Blank, + // }, ]; export default routes; diff --git a/packages/nextjs/components/dash-wind/routes/sidebar.ts b/packages/nextjs/components/dash-wind/routes/sidebar.ts index 82d638e..efd9537 100644 --- a/packages/nextjs/components/dash-wind/routes/sidebar.ts +++ b/packages/nextjs/components/dash-wind/routes/sidebar.ts @@ -17,7 +17,8 @@ import Squares2X2Icon from "@heroicons/react/24/outline/Squares2X2Icon"; // import TableCellsIcon from "@heroicons/react/24/outline/TableCellsIcon"; import UserIcon from "@heroicons/react/24/outline/UserIcon"; import UsersIcon from "@heroicons/react/24/outline/UsersIcon"; -import WalletIcon from "@heroicons/react/24/outline/WalletIcon"; + +// import WalletIcon from "@heroicons/react/24/outline/WalletIcon"; const iconClasses = `h-6 w-6`; const submenuIconClasses = `h-5 w-5`; @@ -36,12 +37,18 @@ export const adminRoutes = [ name: "Employees", // name that appear in Sidebar }, { - path: "/dapp/transactions", // url + path: "/dapp/payments", // url icon: CurrencyDollarIcon, // icon component className: iconClasses, - name: "Transactions", // name that appear in Sidebar + name: "Payments", // name that appear in Sidebar }, // { + // path: "/dapp/transactions", // url + // icon: CurrencyDollarIcon, // icon component + // className: iconClasses, + // name: "Transactions", // name that appear in Sidebar + // }, + // { // path: "/dapp/charts", // url // icon: ChartBarIcon, // icon component // className: iconClasses, @@ -71,12 +78,12 @@ export const adminRoutes = [ // className: submenuIconClasses, // name: "Profile", // name that appear in Sidebar // }, - { - path: "/dapp/settings-billing", - icon: WalletIcon, - className: submenuIconClasses, - name: "Billing", - }, + // { + // path: "/dapp/settings-billing", + // icon: WalletIcon, + // className: submenuIconClasses, + // name: "Billing", + // }, // { // path: "/dapp/settings-team", // url // icon: UsersIcon, // icon component @@ -100,12 +107,18 @@ export const userRoutes = [ // name: "Leads", // name that appear in Sidebar // }, { - path: "/dapp/transactions", // url + path: "/dapp/payments", // url icon: CurrencyDollarIcon, // icon component className: iconClasses, - name: "Transactions", // name that appear in Sidebar + name: "Payments", // name that appear in Sidebar }, // { + // path: "/dapp/transactions", // url + // icon: CurrencyDollarIcon, // icon component + // className: iconClasses, + // name: "Transactions", // name that appear in Sidebar + // }, + // { // path: "/dapp/charts", // url // icon: ChartBarIcon, // icon component // className: iconClasses, @@ -135,12 +148,12 @@ export const userRoutes = [ className: submenuIconClasses, name: "Profile", // name that appear in Sidebar }, - { - path: "/dapp/settings-billing", - icon: WalletIcon, - className: submenuIconClasses, - name: "Billing", - }, + // { + // path: "/dapp/settings-billing", + // icon: WalletIcon, + // className: submenuIconClasses, + // name: "Billing", + // }, // { // path: "/dapp/settings-team", // url // icon: UsersIcon, // icon component diff --git a/packages/nextjs/components/dash-wind/utils/dummyData.ts b/packages/nextjs/components/dash-wind/utils/dummyData.ts index 98a6559..e4d7b9b 100644 --- a/packages/nextjs/components/dash-wind/utils/dummyData.ts +++ b/packages/nextjs/components/dash-wind/utils/dummyData.ts @@ -71,158 +71,287 @@ export const CALENDAR_INITIAL_EVENTS = [ endTime: moment().add(16, "d").endOf("day"), }, ]; -export const RECENT_TRANSACTIONS = [ +export const RECENT_PAYMENTS = [ { + invoiceNo: "#4567", name: "Alex", avatar: "https://reqres.in/img/faces/1-image.jpg", - email: "alex@dashwind.com", + wallet: "0x...", + status: "Pending", location: "Paris", - amount: 100, - date: moment().endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 2, "days") + .format("DD MMM YYYY"), + paidOn: "-", }, { + invoiceNo: "#4523", name: "Ereena", avatar: "https://reqres.in/img/faces/2-image.jpg", - email: "ereena@dashwind.com", + wallet: "0x...", + status: "Pending", location: "London", - amount: 190, - date: moment().add(-1, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 2, "days") + .format("DD MMM YYYY"), + paidOn: "-", }, { + invoiceNo: "#4453", name: "John", avatar: "https://reqres.in/img/faces/3-image.jpg", - email: "jhon@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Canada", - amount: 112, - date: moment().add(-1, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#4359", name: "Matrix", avatar: "https://reqres.in/img/faces/4-image.jpg", - email: "matrix@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Peru", - amount: 111, - date: moment().add(-1, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#3359", name: "Virat", avatar: "https://reqres.in/img/faces/5-image.jpg", - email: "virat@dashwind.com", + wallet: "0x...", + status: "Paid", location: "London", - amount: 190, - date: moment().add(-2, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#3367", name: "Miya", avatar: "https://reqres.in/img/faces/6-image.jpg", - email: "miya@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Paris", - amount: 230, - date: moment().add(-2, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#3359", name: "Virat", avatar: "https://reqres.in/img/faces/3-image.jpg", - email: "virat@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Canada", - amount: 331, - date: moment().add(-2, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#2359", name: "Matrix", avatar: "https://reqres.in/img/faces/1-image.jpg", - email: "matrix@dashwind.com", + wallet: "0x...", + status: "Paid", location: "London", - amount: 581, - date: moment().add(-2, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#4567", name: "Ereena", avatar: "https://reqres.in/img/faces/3-image.jpg", - email: "ereena@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Tokyo", - amount: 151, - date: moment().add(-2, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#4523", name: "John", avatar: "https://reqres.in/img/faces/2-image.jpg", - email: "jhon@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Paris", - amount: 91, - date: moment().add(-2, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#4453", name: "Virat", avatar: "https://reqres.in/img/faces/3-image.jpg", - email: "virat@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Canada", - amount: 161, - date: moment().add(-3, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#4359", name: "Matrix", avatar: "https://reqres.in/img/faces/4-image.jpg", - email: "matrix@dashwind.com", + wallet: "0x...", + status: "Paid", location: "US", - amount: 121, - date: moment().add(-3, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#3359", name: "Ereena", avatar: "https://reqres.in/img/faces/6-image.jpg", - email: "jhon@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Tokyo", - amount: 713, - date: moment().add(-3, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#3367", name: "John", avatar: "https://reqres.in/img/faces/2-image.jpg", - email: "ereena@dashwind.com", + wallet: "0x...", + status: "Paid", location: "London", - amount: 217, - date: moment().add(-3, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#3359", name: "Virat", avatar: "https://reqres.in/img/faces/3-image.jpg", - email: "virat@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Paris", - amount: 117, - date: moment().add(-3, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#2359", name: "Miya", avatar: "https://reqres.in/img/faces/7-image.jpg", - email: "jhon@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Canada", - amount: 612, - date: moment().add(-3, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#4567", name: "Matrix", avatar: "https://reqres.in/img/faces/3-image.jpg", - email: "matrix@dashwind.com", + wallet: "0x...", + status: "Paid", location: "London", - amount: 631, - date: moment().add(-3, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#4523", name: "Virat", avatar: "https://reqres.in/img/faces/2-image.jpg", - email: "ereena@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Tokyo", - amount: 151, - date: moment().add(-3, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, { + invoiceNo: "#4453", name: "Ereena", avatar: "https://reqres.in/img/faces/3-image.jpg", - email: "virat@dashwind.com", + wallet: "0x...", + status: "Paid", location: "Paris", - amount: 617, - date: moment().add(-3, "d").endOf("day"), + amount: "34,989", + generatedOn: moment(new Date()) + .add(-30 * 3, "days") + .format("DD MMM YYYY"), + paidOn: moment(new Date()) + .add(-24 * 2, "days") + .format("DD MMM YYYY"), }, ]; export const EMPLOYEES = [ diff --git a/packages/nextjs/pages/dapp/transactions.tsx b/packages/nextjs/pages/dapp/payments.tsx similarity index 81% rename from packages/nextjs/pages/dapp/transactions.tsx rename to packages/nextjs/pages/dapp/payments.tsx index 8e93acf..ecd3598 100644 --- a/packages/nextjs/pages/dapp/transactions.tsx +++ b/packages/nextjs/pages/dapp/payments.tsx @@ -1,6 +1,6 @@ import { ReactElement } from "react"; import type { NextPageWithLayout } from "../_app"; -import Transactions from "~~/components/dash-wind/pages/protected/Transactions"; +import Payments from "~~/components/dash-wind/pages/protected/Payments"; // import { MetaHeader } from "~~/components/MetaHeader"; import DashLayout from "~~/components/layouts/DashLayout"; @@ -9,7 +9,7 @@ import DashLayout from "~~/components/layouts/DashLayout"; } const DappDashboard: NextPageWithLayout = () => { - return ; + return ; }; DappDashboard.getLayout = function getLayout(page: ReactElement) { From 02094caea63997ea164a3d99dc0619b78b203e87 Mon Sep 17 00:00:00 2001 From: Spencer Schoeneman <78219375+Spencer-Sch@users.noreply.github.com> Date: Fri, 8 Dec 2023 11:58:47 -0600 Subject: [PATCH 09/10] Contracts - mesh Spencer and Trevor changes (#22) * get wallet address and display in Header * isOwner - login flow - wagmiConnect attempt * add web3auth-wagmi-connector * ignore .env * remove .env * add missing imports * fix package issue * add another package * add 'contracts' to IERC20 import path - also format... * fix issue with ccip package --------- Co-authored-by: funkornaut001 --- NOTES.md | 33 + package.json | 3 + packages/hardhat/contracts/Payroll.sol | 4 +- packages/hardhat/contracts/PayrollFactory.sol | 207 +++--- .../hardhat/contracts/TokenTransferor.sol | 644 +++++++++--------- packages/hardhat/deploy/03_deploy_payroll.ts | 2 +- packages/hardhat/package.json | 2 + packages/nextjs/.env.example | 5 +- packages/nextjs/.gitignore | 1 + packages/nextjs/auth/web3auth.ts | 17 + .../dash-wind/containers/Header.tsx | 39 +- .../dash-wind/features/employees/index.tsx | 3 +- .../dash-wind/features/user/Login.tsx | 211 ++++-- .../dash-wind/features/user/Register.tsx | 11 +- .../web-3-crew/register-page/DeployForm.tsx | 71 +- .../web-3-crew/register-page/form.tsx | 73 ++ packages/nextjs/package.json | 1 + packages/nextjs/scaffold.config.ts | 2 +- packages/nextjs/services/web3/wagmiConfig.tsx | 12 +- yarn.lock | 163 ++++- 20 files changed, 988 insertions(+), 516 deletions(-) create mode 100644 NOTES.md create mode 100644 packages/nextjs/components/web-3-crew/register-page/form.tsx diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 0000000..3ad5d59 --- /dev/null +++ b/NOTES.md @@ -0,0 +1,33 @@ +PayrollFactory deployed to: 0xfe44aB0B966E57F126130BE6401546c7351484ad --mumbai +TokenTransferor deployed to: 0x21d762ab159676d3bd05e12A95699C1d0b043A48 --mumbai +Payroll deployed to: 0xDBAbe75848c608bDA3382f0D68219542032B3fEa --mumbai +All deployed from 0x9768818565ED5968fAACC6F66ca02CBf2785dB84 + +https://api-testnet.polygonscan.com/IEWN9BX92EIKVXR22UKQQ9A4UWEF5J9IRG + +There is no log out / wallet modal on Register Deploy +Need a rundown of how to log in with wallet and connect to mumbai chain without AA + +I shouldnt need to change the web3auth client id correct? + +deploy contract in register flow is stuck at getting account address... + +## 12/7 +Funkornaut@gmail -- 0xBB65877a1207572321dE0ad64A2e196545904a09 +trevfost503@gmail -- 0xfd330177602f092b72a3b65893602067Ab69cE2c +sign in with funkornaut through gmail -- 0x1aD394b0c57dbC57f16A5A54b4ccee436b678287 + +deployed new payroll 0xAB34603b0A8c54f9F9Fe9207b98da8ac354dB68e +- added function isOwner returns bool, owner() func on ownable works but since we then needed to look for bool on front end thought that would simplify from end logic / routing +- think that the LogIn flow is a little better + +Login.tsx +Web3 modal pops up when you hit login button - should only pop up if there is a contract address in the form + +Now logOut if funky +Cant log in with Metamask + +DeployForm +- just using useContractWrite was able to click button and make action got this error in browser console + next-dev.js:20 ConnectorNotFoundError: Connector not found at writeContract (chunk-TSH6VVF4.js:2348:1) + diff --git a/package.json b/package.json index c4d4ea4..7b46570 100644 --- a/package.json +++ b/package.json @@ -36,5 +36,8 @@ }, "resolutions": { "usehooks-ts@^2.7.2": "patch:usehooks-ts@npm:^2.7.2#./.yarn/patches/usehooks-ts-npm-2.7.2-fceffe0e43.patch" + }, + "dependencies": { + "@web3auth/web3auth-wagmi-connector": "^5.0.1" } } diff --git a/packages/hardhat/contracts/Payroll.sol b/packages/hardhat/contracts/Payroll.sol index a09a1f8..b4df6d1 100644 --- a/packages/hardhat/contracts/Payroll.sol +++ b/packages/hardhat/contracts/Payroll.sol @@ -527,8 +527,8 @@ ITokenTransferor public ccip; } } - function getOwner() public view returns (address){ - return owner(); + function isOwner(address _address) public view returns (bool){ + return _address == owner(); } function getEmployeePaymentSplits(address _employeeAddress) public view returns (PaymentSplit memory){ diff --git a/packages/hardhat/contracts/PayrollFactory.sol b/packages/hardhat/contracts/PayrollFactory.sol index 991e528..a738a9b 100644 --- a/packages/hardhat/contracts/PayrollFactory.sol +++ b/packages/hardhat/contracts/PayrollFactory.sol @@ -1,98 +1,121 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {TokenTransferor} from "./TokenTransferor.sol"; -import {Payroll} from "./Payroll.sol"; -import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; -import {IRouterClient} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol"; -import {OwnerIsCreator} from "@chainlink/contracts-ccip/src/v0.8/shared/access/OwnerIsCreator.sol"; -import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; -import {IERC20} from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/token/ERC20/IERC20.sol"; +import { TokenTransferor } from "./TokenTransferor.sol"; +import { Payroll } from "./Payroll.sol"; +import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { IRouterClient } from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol"; +import { OwnerIsCreator } from "@chainlink/contracts-ccip/src/v0.8/shared/access/OwnerIsCreator.sol"; +import { Client } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; +import { IERC20 } from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol"; contract PayrollFactory is Ownable { - // Set the deployment fee - uint256 public deployment_fee = 1 wei; // Example fee - - IRouterClient public router; - IERC20 public linkToken; - IERC20 public paymentToken; - - error InvalidAddress(); - error InsufficientFunds(uint256 amount); - - event TokenTransferorDeployed(address indexed deployer, address contractAddress); - event PayrollDeployed(address indexed deployer, address contractAddress, address tokenTransferorAddress); - - ///@param _router The address of the Chainlink Router for local chain - ///@param _linkToken The address of the LINK token for local chain - ///@param _paymentToken The address of the payment token for Payroll Contract on native chain - constructor(address _router, address _linkToken, address _paymentToken) { - router = IRouterClient(_router); - linkToken = IERC20(_linkToken); - paymentToken = IERC20(_paymentToken); - } - - ///@dev Deploys TokenTransferor and Payroll contracts - function deployPayrollAndTokenTransferor() external payable returns (address payrollAddress, address tokenTransferorAddress) { - if(msg.value < deployment_fee){ - revert InsufficientFunds(msg.value); - } - - tokenTransferorAddress = deployTokenTransferor(); - payrollAddress = deployPayroll(tokenTransferorAddress); - return (payrollAddress, tokenTransferorAddress); - } - - // Function to deploy TokenTransferor - ///@dev transfers ownership of TokenTransferor to caller of deployPayrollAndTokenTransferor - function deployTokenTransferor() internal returns (address) { - //require(msg.value >= deployment_fee, "Insufficient funds sent for deployment"); - - TokenTransferor newTokenTransferor = new TokenTransferor(address(router), address(linkToken)); - newTokenTransferor.transferOwnership(msg.sender); - emit TokenTransferorDeployed(msg.sender, address(newTokenTransferor)); - return address(newTokenTransferor); - } - - /// Function to deploy Payroll - ///@dev transfers ownership of Payroll to caller of deployPayrollAndTokenTransferor - ///@param tokenTransferorAddress The address of the newly deployed TokenTransferor contract - function deployPayroll(address tokenTransferorAddress) internal returns (address) { - //require(msg.value >= deployment_fee, "Insufficient funds sent for deployment"); - - Payroll newPayroll = new Payroll(tokenTransferorAddress, address(paymentToken)); - newPayroll.transferOwnership(msg.sender); // Transfer ownership - emit PayrollDeployed(msg.sender, address(newPayroll), tokenTransferorAddress); - return address(newPayroll); - } - - /// Functions to update deployment params so that they can be changed in the future or for deployment on other chains - function updateDeploymentFee(uint256 newFee) external onlyOwner { - deployment_fee = newFee; - } - - function changeRouter(address newRouter) external onlyOwner { - router = IRouterClient(newRouter); - } - - function changeLinkToken(address newLinkToken) external onlyOwner { - linkToken = IERC20(newLinkToken); - } - - function changePaymentToken(address newPaymentToken) external onlyOwner { - paymentToken = IERC20(newPaymentToken); - } - - // Fallback function to receive ETH - receive() external payable {} - - // Function to withdraw collected fees - function withdrawFees(address payable _beneficiary) public onlyOwner { - // Only contract owner should be able to withdraw fees - // Implement ownership and access control - if (_beneficiary == address(0)) { - revert InvalidAddress(); - } - _beneficiary.transfer(address(this).balance); - } + // Set the deployment fee + uint256 public deployment_fee = 1 wei; // Example fee + + IRouterClient public router; + IERC20 public linkToken; + IERC20 public paymentToken; + + error InvalidAddress(); + error InsufficientFunds(uint256 amount); + + event TokenTransferorDeployed( + address indexed deployer, + address contractAddress + ); + event PayrollDeployed( + address indexed deployer, + address contractAddress, + address tokenTransferorAddress + ); + + ///@param _router The address of the Chainlink Router for local chain + ///@param _linkToken The address of the LINK token for local chain + ///@param _paymentToken The address of the payment token for Payroll Contract on native chain + constructor(address _router, address _linkToken, address _paymentToken) { + router = IRouterClient(_router); + linkToken = IERC20(_linkToken); + paymentToken = IERC20(_paymentToken); + } + + ///@dev Deploys TokenTransferor and Payroll contracts + function deployPayrollAndTokenTransferor() + external + payable + returns (address payrollAddress, address tokenTransferorAddress) + { + if (msg.value < deployment_fee) { + revert InsufficientFunds(msg.value); + } + + tokenTransferorAddress = deployTokenTransferor(); + payrollAddress = deployPayroll(tokenTransferorAddress); + return (payrollAddress, tokenTransferorAddress); + } + + // Function to deploy TokenTransferor + ///@dev transfers ownership of TokenTransferor to caller of deployPayrollAndTokenTransferor + function deployTokenTransferor() internal returns (address) { + //require(msg.value >= deployment_fee, "Insufficient funds sent for deployment"); + + TokenTransferor newTokenTransferor = new TokenTransferor( + address(router), + address(linkToken) + ); + newTokenTransferor.transferOwnership(msg.sender); + emit TokenTransferorDeployed(msg.sender, address(newTokenTransferor)); + return address(newTokenTransferor); + } + + /// Function to deploy Payroll + ///@dev transfers ownership of Payroll to caller of deployPayrollAndTokenTransferor + ///@param tokenTransferorAddress The address of the newly deployed TokenTransferor contract + function deployPayroll( + address tokenTransferorAddress + ) internal returns (address) { + //require(msg.value >= deployment_fee, "Insufficient funds sent for deployment"); + + Payroll newPayroll = new Payroll( + tokenTransferorAddress, + address(paymentToken) + ); + newPayroll.transferOwnership(msg.sender); // Transfer ownership + emit PayrollDeployed( + msg.sender, + address(newPayroll), + tokenTransferorAddress + ); + return address(newPayroll); + } + + /// Functions to update deployment params so that they can be changed in the future or for deployment on other chains + function updateDeploymentFee(uint256 newFee) external onlyOwner { + deployment_fee = newFee; + } + + function changeRouter(address newRouter) external onlyOwner { + router = IRouterClient(newRouter); + } + + function changeLinkToken(address newLinkToken) external onlyOwner { + linkToken = IERC20(newLinkToken); + } + + function changePaymentToken(address newPaymentToken) external onlyOwner { + paymentToken = IERC20(newPaymentToken); + } + + // Fallback function to receive ETH + receive() external payable {} + + // Function to withdraw collected fees + function withdrawFees(address payable _beneficiary) public onlyOwner { + // Only contract owner should be able to withdraw fees + // Implement ownership and access control + if (_beneficiary == address(0)) { + revert InvalidAddress(); + } + _beneficiary.transfer(address(this).balance); + } } diff --git a/packages/hardhat/contracts/TokenTransferor.sol b/packages/hardhat/contracts/TokenTransferor.sol index 8b4c70b..5a2738d 100644 --- a/packages/hardhat/contracts/TokenTransferor.sol +++ b/packages/hardhat/contracts/TokenTransferor.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; -import {IRouterClient} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol"; -import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; -import {IERC20} from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/token/ERC20/IERC20.sol"; +import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; +import { IRouterClient } from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol"; +import { Client } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; +import { IERC20 } from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol"; /** * THIS IS AN EXAMPLE CONTRACT THAT USES HARDCODED VALUES FOR CLARITY. @@ -14,236 +14,234 @@ import {IERC20} from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-sol /// @title - A simple contract for transferring tokens across chains. contract TokenTransferor is Ownable { - // Custom errors to provide more descriptive revert messages. - error NotEnoughBalance(uint256 currentBalance, uint256 calculatedFees); // Used to make sure contract has enough balance to cover the fees. - error NothingToWithdraw(); // Used when trying to withdraw Ether but there's nothing to withdraw. - error FailedToWithdrawEth(address owner, address target, uint256 value); // Used when the withdrawal of Ether fails. - error DestinationChainNotAllowlisted(uint64 destinationChainSelector); // Used when the destination chain has not been allowlisted by the contract owner. - error CallerNotWhiteListed(address caller); // Used when the caller is not whitelisted by the contract owner. - - // Event emitted when the tokens are transferred to an account on another chain. - event TokensTransferred( - bytes32 indexed messageId, // The unique ID of the message. - uint64 indexed destinationChainSelector, // The chain selector of the destination chain. - address receiver, // The address of the receiver on the destination chain. - address token, // The token address that was transferred. - uint256 tokenAmount, // The token amount that was transferred. - address feeToken, // the token address used to pay CCIP fees. - uint256 fees // The fees paid for sending the message. - ); - - // Mapping to keep track of allowlisted destination chains. - mapping(uint64 => bool) public allowlistedChains; - - // Mapping to keep track of whitelisted addressed that can call functions on this contract - mapping(address => bool) public whitelistedAddresses; - - // Mutable extra args - struct ExtraArgs { - uint256 gasLimit; - bool strict; - } - - ExtraArgs public currentExtraArgs; - - IRouterClient private s_router; - - IERC20 private s_linkToken; - - // @notice Constructor initializes the contract with the router address. - // @param _router The address of the router contract. - // @param _link The address of the link contract. - // mumbai router 0x70499c328e1e2a3c41108bd3730f6670a44595d1 - // mumbai LINK 0x326C977E6efc84E512bB9C30f76E30c160eD06FB - constructor(address _router, address _link) { - s_router = IRouterClient(_router); - s_linkToken = IERC20(_link); - - // Initialixe default values for ExtraArgs - currentExtraArgs = ExtraArgs ({ - gasLimit: 0, - strict: false - }); - } - - /// @dev Modifier that checks if the chain with the given destinationChainSelector is allowlisted. - /// @param _destinationChainSelector The selector of the destination chain. - modifier onlyAllowlistedChain(uint64 _destinationChainSelector) { - if (!allowlistedChains[_destinationChainSelector]) - revert DestinationChainNotAllowlisted(_destinationChainSelector); - _; - } - - /// @dev Modifier that checks if the caller is allowlisted. - modifier onlyAllowlistedAddress() { - if (!whitelistedAddresses[msg.sender]) revert CallerNotWhiteListed(msg.sender); - _; - } - - /// @dev Updates the allowlist status of a destination chain for transactions. - /// @notice This function can only be called by the owner. - /// @param _destinationChainSelector The selector of the destination chain to be updated. - /// @param allowed The allowlist status to be set for the destination chain. - function allowlistDestinationChain( - uint64 _destinationChainSelector, - bool allowed - ) external onlyOwner { - allowlistedChains[_destinationChainSelector] = allowed; - } - - /// @notice Transfer tokens to receiver on the destination chain. - /// @notice pay in LINK. - /// @notice the token must be in the list of supported tokens. - /// @notice This function can only be called by allowlisted addresses. - /// @dev Assumes your contract has sufficient LINK tokens to pay for the fees. - /// @param _destinationChainSelector The identifier (aka selector) for the destination blockchain. - /// @param _receiver The address of the recipient on the destination blockchain. - /// @param _token token address. - /// @param _amount token amount. - /// @return messageId The ID of the message that was sent. - function transferTokensPayLINK( - uint64 _destinationChainSelector, - address _receiver, - address _token, - uint256 _amount - ) - external - onlyAllowlistedAddress - onlyAllowlistedChain(_destinationChainSelector) - returns (bytes32 messageId) - { - // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message - // address(linkToken) means fees are paid in LINK - Client.EVM2AnyMessage memory evm2AnyMessage = _buildCCIPMessage( - _receiver, - _token, - _amount, - address(s_linkToken) - ); - - // Get the fee required to send the message - uint256 fees = s_router.getFee( - _destinationChainSelector, - evm2AnyMessage - ); - - if (fees > s_linkToken.balanceOf(address(this))) - revert NotEnoughBalance(s_linkToken.balanceOf(address(this)), fees); - - // approve the Router to transfer LINK tokens on contract's behalf. It will spend the fees in LINK - s_linkToken.approve(address(s_router), fees); - - // approve the Router to spend tokens on contract's behalf. It will spend the amount of the given token - IERC20(_token).approve(address(s_router), _amount); - - // Send the message through the router and store the returned message ID - messageId = s_router.ccipSend( - _destinationChainSelector, - evm2AnyMessage - ); - - // Emit an event with message details - emit TokensTransferred( - messageId, - _destinationChainSelector, - _receiver, - _token, - _amount, - address(s_linkToken), - fees - ); - - // Return the message ID - return messageId; - } - - /// @notice Transfer tokens to receiver on the destination chain. - /// @notice Pay in native gas such as ETH on Ethereum or MATIC on Polgon. - /// @notice the token must be in the list of supported tokens. - /// @notice This function can only be called by allowlisted addresses. - /// @dev Assumes your contract has sufficient native gas like ETH on Ethereum or MATIC on Polygon. - /// @param _destinationChainSelector The identifier (aka selector) for the destination blockchain. - /// @param _receiver The address of the recipient on the destination blockchain. - /// @param _token token address. - /// @param _amount token amount. - /// @return messageId The ID of the message that was sent. - function transferTokensPayNative( - uint64 _destinationChainSelector, - address _receiver, - address _token, - uint256 _amount - ) - external - onlyAllowlistedAddress - onlyAllowlistedChain(_destinationChainSelector) - returns (bytes32 messageId) - { - // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message - // address(0) means fees are paid in native gas - Client.EVM2AnyMessage memory evm2AnyMessage = _buildCCIPMessage( - _receiver, - _token, - _amount, - address(0) - ); - - // Get the fee required to send the message - uint256 fees = s_router.getFee( - _destinationChainSelector, - evm2AnyMessage - ); - - if (fees > address(this).balance) - revert NotEnoughBalance(address(this).balance, fees); - - // approve the Router to spend tokens on contract's behalf. It will spend the amount of the given token - IERC20(_token).approve(address(s_router), _amount); - - // Send the message through the router and store the returned message ID - messageId = s_router.ccipSend{value: fees}( - _destinationChainSelector, - evm2AnyMessage - ); - - // Emit an event with message details - emit TokensTransferred( - messageId, - _destinationChainSelector, - _receiver, - _token, - _amount, - address(0), - fees - ); - - // Return the message ID - return messageId; - } - - /// @notice Construct a CCIP message. - /// @dev This function will create an EVM2AnyMessage struct with all the necessary information for tokens transfer. - /// @param _receiver The address of the receiver. - /// @param _token The token to be transferred. - /// @param _amount The amount of the token to be transferred. - /// @param _feeTokenAddress The address of the token used for fees. Set address(0) for native gas. - /// @return Client.EVM2AnyMessage Returns an EVM2AnyMessage struct which contains information for sending a CCIP message. - function _buildCCIPMessage( - address _receiver, - address _token, - uint256 _amount, - address _feeTokenAddress - ) internal view returns (Client.EVM2AnyMessage memory) { - // Set the token amounts - Client.EVMTokenAmount[] - memory tokenAmounts = new Client.EVMTokenAmount[](1); - tokenAmounts[0] = Client.EVMTokenAmount({ - token: _token, - amount: _amount - }); - - // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message - - /** + // Custom errors to provide more descriptive revert messages. + error NotEnoughBalance(uint256 currentBalance, uint256 calculatedFees); // Used to make sure contract has enough balance to cover the fees. + error NothingToWithdraw(); // Used when trying to withdraw Ether but there's nothing to withdraw. + error FailedToWithdrawEth(address owner, address target, uint256 value); // Used when the withdrawal of Ether fails. + error DestinationChainNotAllowlisted(uint64 destinationChainSelector); // Used when the destination chain has not been allowlisted by the contract owner. + error CallerNotWhiteListed(address caller); // Used when the caller is not whitelisted by the contract owner. + + // Event emitted when the tokens are transferred to an account on another chain. + event TokensTransferred( + bytes32 indexed messageId, // The unique ID of the message. + uint64 indexed destinationChainSelector, // The chain selector of the destination chain. + address receiver, // The address of the receiver on the destination chain. + address token, // The token address that was transferred. + uint256 tokenAmount, // The token amount that was transferred. + address feeToken, // the token address used to pay CCIP fees. + uint256 fees // The fees paid for sending the message. + ); + + // Mapping to keep track of allowlisted destination chains. + mapping(uint64 => bool) public allowlistedChains; + + // Mapping to keep track of whitelisted addressed that can call functions on this contract + mapping(address => bool) public whitelistedAddresses; + + // Mutable extra args + struct ExtraArgs { + uint256 gasLimit; + bool strict; + } + + ExtraArgs public currentExtraArgs; + + IRouterClient private s_router; + + IERC20 private s_linkToken; + + // @notice Constructor initializes the contract with the router address. + // @param _router The address of the router contract. + // @param _link The address of the link contract. + // mumbai router 0x70499c328e1e2a3c41108bd3730f6670a44595d1 + // mumbai LINK 0x326C977E6efc84E512bB9C30f76E30c160eD06FB + constructor(address _router, address _link) { + s_router = IRouterClient(_router); + s_linkToken = IERC20(_link); + + // Initialixe default values for ExtraArgs + currentExtraArgs = ExtraArgs({ gasLimit: 0, strict: false }); + } + + /// @dev Modifier that checks if the chain with the given destinationChainSelector is allowlisted. + /// @param _destinationChainSelector The selector of the destination chain. + modifier onlyAllowlistedChain(uint64 _destinationChainSelector) { + if (!allowlistedChains[_destinationChainSelector]) + revert DestinationChainNotAllowlisted(_destinationChainSelector); + _; + } + + /// @dev Modifier that checks if the caller is allowlisted. + modifier onlyAllowlistedAddress() { + if (!whitelistedAddresses[msg.sender]) + revert CallerNotWhiteListed(msg.sender); + _; + } + + /// @dev Updates the allowlist status of a destination chain for transactions. + /// @notice This function can only be called by the owner. + /// @param _destinationChainSelector The selector of the destination chain to be updated. + /// @param allowed The allowlist status to be set for the destination chain. + function allowlistDestinationChain( + uint64 _destinationChainSelector, + bool allowed + ) external onlyOwner { + allowlistedChains[_destinationChainSelector] = allowed; + } + + /// @notice Transfer tokens to receiver on the destination chain. + /// @notice pay in LINK. + /// @notice the token must be in the list of supported tokens. + /// @notice This function can only be called by allowlisted addresses. + /// @dev Assumes your contract has sufficient LINK tokens to pay for the fees. + /// @param _destinationChainSelector The identifier (aka selector) for the destination blockchain. + /// @param _receiver The address of the recipient on the destination blockchain. + /// @param _token token address. + /// @param _amount token amount. + /// @return messageId The ID of the message that was sent. + function transferTokensPayLINK( + uint64 _destinationChainSelector, + address _receiver, + address _token, + uint256 _amount + ) + external + onlyAllowlistedAddress + onlyAllowlistedChain(_destinationChainSelector) + returns (bytes32 messageId) + { + // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message + // address(linkToken) means fees are paid in LINK + Client.EVM2AnyMessage memory evm2AnyMessage = _buildCCIPMessage( + _receiver, + _token, + _amount, + address(s_linkToken) + ); + + // Get the fee required to send the message + uint256 fees = s_router.getFee( + _destinationChainSelector, + evm2AnyMessage + ); + + if (fees > s_linkToken.balanceOf(address(this))) + revert NotEnoughBalance(s_linkToken.balanceOf(address(this)), fees); + + // approve the Router to transfer LINK tokens on contract's behalf. It will spend the fees in LINK + s_linkToken.approve(address(s_router), fees); + + // approve the Router to spend tokens on contract's behalf. It will spend the amount of the given token + IERC20(_token).approve(address(s_router), _amount); + + // Send the message through the router and store the returned message ID + messageId = s_router.ccipSend( + _destinationChainSelector, + evm2AnyMessage + ); + + // Emit an event with message details + emit TokensTransferred( + messageId, + _destinationChainSelector, + _receiver, + _token, + _amount, + address(s_linkToken), + fees + ); + + // Return the message ID + return messageId; + } + + /// @notice Transfer tokens to receiver on the destination chain. + /// @notice Pay in native gas such as ETH on Ethereum or MATIC on Polgon. + /// @notice the token must be in the list of supported tokens. + /// @notice This function can only be called by allowlisted addresses. + /// @dev Assumes your contract has sufficient native gas like ETH on Ethereum or MATIC on Polygon. + /// @param _destinationChainSelector The identifier (aka selector) for the destination blockchain. + /// @param _receiver The address of the recipient on the destination blockchain. + /// @param _token token address. + /// @param _amount token amount. + /// @return messageId The ID of the message that was sent. + function transferTokensPayNative( + uint64 _destinationChainSelector, + address _receiver, + address _token, + uint256 _amount + ) + external + onlyAllowlistedAddress + onlyAllowlistedChain(_destinationChainSelector) + returns (bytes32 messageId) + { + // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message + // address(0) means fees are paid in native gas + Client.EVM2AnyMessage memory evm2AnyMessage = _buildCCIPMessage( + _receiver, + _token, + _amount, + address(0) + ); + + // Get the fee required to send the message + uint256 fees = s_router.getFee( + _destinationChainSelector, + evm2AnyMessage + ); + + if (fees > address(this).balance) + revert NotEnoughBalance(address(this).balance, fees); + + // approve the Router to spend tokens on contract's behalf. It will spend the amount of the given token + IERC20(_token).approve(address(s_router), _amount); + + // Send the message through the router and store the returned message ID + messageId = s_router.ccipSend{ value: fees }( + _destinationChainSelector, + evm2AnyMessage + ); + + // Emit an event with message details + emit TokensTransferred( + messageId, + _destinationChainSelector, + _receiver, + _token, + _amount, + address(0), + fees + ); + + // Return the message ID + return messageId; + } + + /// @notice Construct a CCIP message. + /// @dev This function will create an EVM2AnyMessage struct with all the necessary information for tokens transfer. + /// @param _receiver The address of the receiver. + /// @param _token The token to be transferred. + /// @param _amount The amount of the token to be transferred. + /// @param _feeTokenAddress The address of the token used for fees. Set address(0) for native gas. + /// @return Client.EVM2AnyMessage Returns an EVM2AnyMessage struct which contains information for sending a CCIP message. + function _buildCCIPMessage( + address _receiver, + address _token, + uint256 _amount, + address _feeTokenAddress + ) internal view returns (Client.EVM2AnyMessage memory) { + // Set the token amounts + Client.EVMTokenAmount[] + memory tokenAmounts = new Client.EVMTokenAmount[](1); + tokenAmounts[0] = Client.EVMTokenAmount({ + token: _token, + amount: _amount + }); + + // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message + + /** * @todo * DO NOT HARDCODE EXTRAARGS @@ -251,90 +249,96 @@ contract TokenTransferor is Ownable { This allows you to build it off-chain and pass it in a call to a function or store it in a variable that you can update on-demand. This makes extraArgs compatible with future CCIP upgrades. */ - return - Client.EVM2AnyMessage({ - receiver: abi.encode(_receiver), // ABI-encoded receiver address - data: "", // No data - tokenAmounts: tokenAmounts, // The amount and type of token being transferred - extraArgs: Client._argsToBytes( - // Additional arguments, setting gas limit to 0 as we are not sending any data and non-strict sequencing mode - Client.EVMExtraArgsV1({ - gasLimit: currentExtraArgs.gasLimit, - strict: currentExtraArgs.strict - }) - ), - // Set the feeToken to a feeTokenAddress, indicating specific asset will be used for fees - feeToken: _feeTokenAddress - }); - } - - /// @notice Fallback function to allow the contract to receive Ether. - /// @dev This function has no function body, making it a default function for receiving Ether. - /// It is automatically called when Ether is transferred to the contract without any data. - receive() external payable {} - - /// @notice Allows the contract owner to withdraw the entire balance of Ether from the contract. - /// @dev This function reverts if there are no funds to withdraw or if the transfer fails. - /// It should only be callable by the owner of the contract. - /// @param _beneficiary The address to which the Ether should be transferred. - function withdraw(address _beneficiary) public onlyOwner { - // Retrieve the balance of this contract - uint256 amount = address(this).balance; - - // Revert if there is nothing to withdraw - if (amount == 0) revert NothingToWithdraw(); - - // Attempt to send the funds, capturing the success status and discarding any return data - (bool sent, ) = _beneficiary.call{value: amount}(""); - - // Revert if the send failed, with information about the attempted transfer - if (!sent) revert FailedToWithdrawEth(msg.sender, _beneficiary, amount); - } - - /// @notice Allows the owner of the contract to withdraw all tokens of a specific ERC20 token. - /// @dev This function reverts with a 'NothingToWithdraw' error if there are no tokens to withdraw. - /// @param _beneficiary The address to which the tokens will be sent. - /// @param _token The contract address of the ERC20 token to be withdrawn. - function withdrawToken( - address _beneficiary, - address _token - ) public onlyOwner { - // Retrieve the balance of this contract - uint256 amount = IERC20(_token).balanceOf(address(this)); - - // Revert if there is nothing to withdraw - if (amount == 0) revert NothingToWithdraw(); - - IERC20(_token).transfer(_beneficiary, amount); - } - - function updateExtraArgs(uint256 _gasLimit, bool _strict) public onlyOwner { - currentExtraArgs.gasLimit = _gasLimit; - currentExtraArgs.strict = _strict; - } - - function getExtraArgs() public view returns (uint256, bool) { - return (currentExtraArgs.gasLimit, currentExtraArgs.strict); - } - - function addToWhitelist(address _address) public onlyOwner { - whitelistedAddresses[_address] = true; - } - - function removeFromWhitelist(address _address) public onlyOwner { - whitelistedAddresses[_address] = false; - } - - function isWhitelisted(address _address) public view returns (bool) { - return whitelistedAddresses[_address]; - } - - function isChainIdAllowed(uint64 _chainId) public view returns (bool) { - return allowlistedChains[_chainId]; - } - - function transferOwnership(address newOwner) public override onlyOwner { - require(newOwner != address(0), "Ownable: new owner is the zero address"); - _transferOwnership(newOwner); - } + return + Client.EVM2AnyMessage({ + receiver: abi.encode(_receiver), // ABI-encoded receiver address + data: "", // No data + tokenAmounts: tokenAmounts, // The amount and type of token being transferred + extraArgs: Client._argsToBytes( + // Additional arguments, setting gas limit to 0 as we are not sending any data and non-strict sequencing mode + Client.EVMExtraArgsV1({ + gasLimit: currentExtraArgs.gasLimit + }) + // Client.EVMExtraArgsV1({ + // gasLimit: currentExtraArgs.gasLimit, + // strict: currentExtraArgs.strict + // }) + ), + // Set the feeToken to a feeTokenAddress, indicating specific asset will be used for fees + feeToken: _feeTokenAddress + }); + } + + /// @notice Fallback function to allow the contract to receive Ether. + /// @dev This function has no function body, making it a default function for receiving Ether. + /// It is automatically called when Ether is transferred to the contract without any data. + receive() external payable {} + + /// @notice Allows the contract owner to withdraw the entire balance of Ether from the contract. + /// @dev This function reverts if there are no funds to withdraw or if the transfer fails. + /// It should only be callable by the owner of the contract. + /// @param _beneficiary The address to which the Ether should be transferred. + function withdraw(address _beneficiary) public onlyOwner { + // Retrieve the balance of this contract + uint256 amount = address(this).balance; + + // Revert if there is nothing to withdraw + if (amount == 0) revert NothingToWithdraw(); + + // Attempt to send the funds, capturing the success status and discarding any return data + (bool sent, ) = _beneficiary.call{ value: amount }(""); + + // Revert if the send failed, with information about the attempted transfer + if (!sent) revert FailedToWithdrawEth(msg.sender, _beneficiary, amount); + } + + /// @notice Allows the owner of the contract to withdraw all tokens of a specific ERC20 token. + /// @dev This function reverts with a 'NothingToWithdraw' error if there are no tokens to withdraw. + /// @param _beneficiary The address to which the tokens will be sent. + /// @param _token The contract address of the ERC20 token to be withdrawn. + function withdrawToken( + address _beneficiary, + address _token + ) public onlyOwner { + // Retrieve the balance of this contract + uint256 amount = IERC20(_token).balanceOf(address(this)); + + // Revert if there is nothing to withdraw + if (amount == 0) revert NothingToWithdraw(); + + IERC20(_token).transfer(_beneficiary, amount); + } + + function updateExtraArgs(uint256 _gasLimit, bool _strict) public onlyOwner { + currentExtraArgs.gasLimit = _gasLimit; + currentExtraArgs.strict = _strict; + } + + function getExtraArgs() public view returns (uint256, bool) { + return (currentExtraArgs.gasLimit, currentExtraArgs.strict); + } + + function addToWhitelist(address _address) public onlyOwner { + whitelistedAddresses[_address] = true; + } + + function removeFromWhitelist(address _address) public onlyOwner { + whitelistedAddresses[_address] = false; + } + + function isWhitelisted(address _address) public view returns (bool) { + return whitelistedAddresses[_address]; + } + + function isChainIdAllowed(uint64 _chainId) public view returns (bool) { + return allowlistedChains[_chainId]; + } + + function transferOwnership(address newOwner) public override onlyOwner { + require( + newOwner != address(0), + "Ownable: new owner is the zero address" + ); + _transferOwnership(newOwner); + } } diff --git a/packages/hardhat/deploy/03_deploy_payroll.ts b/packages/hardhat/deploy/03_deploy_payroll.ts index a0980ad..ca1c6a2 100644 --- a/packages/hardhat/deploy/03_deploy_payroll.ts +++ b/packages/hardhat/deploy/03_deploy_payroll.ts @@ -6,7 +6,7 @@ async function main() { console.log("Deploying contracts with the account:", deployer.address); // Add the addresses of the dependencies of your Payroll contract - const ccipTokenTransferorAddress = "0xFFc15127eB60C4Ab1a2e5e0319615ca0982952f2"; // deployed via script + const ccipTokenTransferorAddress = "0x21d762ab159676d3bd05e12A95699C1d0b043A48"; // deployed via script const bnmTokenAddress = "0xf1E3A5842EeEF51F2967b3F05D45DD4f4205FF40"; //BnM Mumbai // Deploy the Payroll contract diff --git a/packages/hardhat/package.json b/packages/hardhat/package.json index d630720..3b72ce7 100644 --- a/packages/hardhat/package.json +++ b/packages/hardhat/package.json @@ -46,6 +46,8 @@ "typescript": "^5.1.6" }, "dependencies": { + "@chainlink/contracts": "^0.8.0", + "@chainlink/contracts-ccip": "^1.2.1", "@openzeppelin/contracts": "^4.8.1", "dotenv": "^16.0.3", "envfile": "^6.18.0", diff --git a/packages/nextjs/.env.example b/packages/nextjs/.env.example index 6769588..47c95bd 100644 --- a/packages/nextjs/.env.example +++ b/packages/nextjs/.env.example @@ -12,7 +12,8 @@ NEXT_PUBLIC_ALCHEMY_API_KEY= NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID= -NEXT_PUBLIC_FACTORY_CONTRACT_ADDRESS="" # Polygon Mumbai -NEXT_PUBLIC_PAYROLL_CONTRACT_ADDRESS="" # Polygon Mumbai +NEXT_PUBLIC_FACTORY_CONTRACT_ADDRESS= # Polygon Mumbai +NEXT_PUBLIC_PAYROLL_CONTRACT_ADDRESS= # Polygon Mumbai +NEXT_PUBLIC_TOKEN_TRANSFEROR_CONTRACT_ADDRESS= # Polygon Mumbai NEXT_PUBLIC_LOCAL_CHAIN_ID=0 # REPLACE WITH LOCAL DEV CHAIN NEXT_PUBLIC_TESTNET_CHAIN_ID=80001 # Polygon Mumbai diff --git a/packages/nextjs/.gitignore b/packages/nextjs/.gitignore index 6985d55..16dad0e 100644 --- a/packages/nextjs/.gitignore +++ b/packages/nextjs/.gitignore @@ -26,6 +26,7 @@ yarn-error.log* .pnpm-debug.log* # local env files +.env .env.local .env.development.local .env.test.local diff --git a/packages/nextjs/auth/web3auth.ts b/packages/nextjs/auth/web3auth.ts index f6da7db..b6713f3 100644 --- a/packages/nextjs/auth/web3auth.ts +++ b/packages/nextjs/auth/web3auth.ts @@ -1,11 +1,28 @@ // import { useEffect, useState } from "react"; import { Web3Auth } from "@web3auth/modal"; +//import { Web3AuthConnector } from "@web3auth/web3auth-wagmi-connector"; + // import { createWalletClient, custom } from "viem"; // import { polygonMumbai } from "viem/chains"; // import { AuthProvider, setAuthProvider, setIsConnected } from "~~/auth/authSlice"; // import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; +// set up your web3auth instance with all the features you want +// const web3AuthInstance = new Web3Auth({ +// clientId: "BM0SLNkhMCfIygw0Xi79dG6qbWGMN0o0mEeDjRT0dxlP3BEok9pnu5aqxCNfj2TZ9XT7sQaXm0ltuWbCQ1tsRNI", +// chainConfig: { +// chainNamespace: "eip155", +// chainId: "0x13881", // Mumbai +// rpcTarget: "https://rpc.ankr.com/polygon_mumbai", +// displayName: "Mumbai Testnet", +// blockExplorer: "https://mumbai.polygonscan.com/", +// ticker: "MATIC", +// tickerName: "Polygon", +// }, +// web3AuthNetwork: "sapphire_mainnet", +// }); + export const web3auth = new Web3Auth({ clientId: "BM0SLNkhMCfIygw0Xi79dG6qbWGMN0o0mEeDjRT0dxlP3BEok9pnu5aqxCNfj2TZ9XT7sQaXm0ltuWbCQ1tsRNI", // Get your Client ID from the Web3Auth Dashboard web3AuthNetwork: "sapphire_devnet", // Web3Auth Network diff --git a/packages/nextjs/components/dash-wind/containers/Header.tsx b/packages/nextjs/components/dash-wind/containers/Header.tsx index 20d32ac..8ea2c1d 100644 --- a/packages/nextjs/components/dash-wind/containers/Header.tsx +++ b/packages/nextjs/components/dash-wind/containers/Header.tsx @@ -5,6 +5,8 @@ import { useRouter } from "next/router"; import { openRightDrawer } from "../features/common/rightDrawerSlice"; import { RIGHT_DRAWER_TYPES } from "../utils/globalConstantUtil"; import { themeChange } from "theme-change"; +import { Address, createWalletClient, custom } from "viem"; +import { polygonMumbai } from "viem/chains"; import Bars3Icon from "@heroicons/react/24/outline/Bars3Icon"; import BellIcon from "@heroicons/react/24/outline/BellIcon"; import MoonIcon from "@heroicons/react/24/outline/MoonIcon"; @@ -13,7 +15,7 @@ import { setIsAdmin, setIsConnected } from "~~/auth/authSlice"; import { web3auth } from "~~/auth/web3auth"; // import UserIcon from "@heroicons/react/24/outline/UserIcon"; import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; -import { Address } from "~~/components/web-3-crew/Address"; +import { Address as AddressDisplay } from "~~/components/web-3-crew/Address"; function Header() { const dispatch = useMyDispatch(); @@ -22,8 +24,19 @@ function Header() { const [currentTheme, setCurrentTheme] = useState( typeof window !== "undefined" ? localStorage.getItem("theme") : null, ); + const [address, setAddress] = useState
(null); const router = useRouter(); + useEffect(() => { + async function getAddress() { + const address = await getAccounts(); + if (address) { + setAddress(address); + } + } + getAddress(); + }, []); + useEffect(() => { themeChange(false); if (currentTheme === null) { @@ -36,6 +49,23 @@ function Header() { // 👆 false parameter is required for react project }, [currentTheme]); + async function getAccounts() { + if (!web3auth.provider) { + console.log("from login - getAccounts: provider not defined"); + return; + } + const client = createWalletClient({ + // account: privateKeyToAccount('0x...'); // from viem + chain: polygonMumbai, + transport: custom(web3auth.provider), + }); + + // Get user's public address + const [address] = await client.getAddresses(); + //console.log("user address: ", address); + return address as Address; + } + // Opening right sidebar for notification const openNotification = () => { dispatch(openRightDrawer({ header: "Notifications", bodyType: RIGHT_DRAWER_TYPES.NOTIFICATION })); @@ -107,12 +137,7 @@ function Header() {
    state.auth); - const router = useRouter(); const dispatch = useMyDispatch(); + //const userAddress = getAccounts(); + // state to store user address once it is fetched + const [userAddress, setUserAddress] = useState(null); + + useEffect(() => { + async function fetchAddress() { + const address = await getAccounts(); + if (address) { + // not sure what this issue is with this + setUserAddress(address); + } + } + fetchAddress(); + }, []); + + const payrollABI = Payroll.abi; /*-------------------------------------*/ // Kaz & Trevor // getOwner address to test against user's address // need to see what shape `owner` will be on return + // contract interaction calls isOwner() const { - data: owner, + data: isOwner, // isError, // isLoading, } = useContractRead({ address: process.env.NEXT_PUBLIC_PAYROLL_CONTRACT_ADDRESS, - // abi: payrollContractAbi, - functionName: "getOwner", + abi: payrollABI, + functionName: "isOwner", + args: userAddress ? [userAddress] : [], chainId: Number(chainId), - }); + }) as { data: boolean | undefined }; + + console.log("is owner: ", isOwner); + console.log("user address contract read: ", [getAccounts()]); + + useEffect(() => { + if (typeof isOwner !== "undefined") { + // Ensure the value is not undefined + if (isOwner) { + // Redirect to owner's dashboard + router.push("/dapp/dashboard"); + } else { + // Redirect to employee or general user dashboard + router.push("/dapp/dashboard"); + } + } + }, [isOwner, router]); + /*-------------------------------------*/ /*-------------------------------------*/ // Kaz & Trevor // - const { - data: isEmployee, - // isError, - // isLoading, - } = useContractRead({ - address: process.env.NEXT_PUBLIC_PAYROLL_CONTRACT_ADDRESS, - // abi: payrollContractAbi, - functionName: "doesEmployeeExist", - args: [ - /* problem: figure out how to getAccount() address here */ - ], - chainId: Number(chainId), - }); + // const { + // data: isEmployee, + // // isError, + // // isLoading, + // } = useContractRead({ + // address: process.env.NEXT_PUBLIC_PAYROLL_CONTRACT_ADDRESS, + // abi: payrollABI, + // functionName: "doesEmployeeExist", + // args: [ + // /* problem: figure out how to getAccount() address here */ + // userAddress + // ], + // chainId: Number(chainId), + // }); /*-------------------------------------*/ + // // Web3Auth + // async function login() { + // if (isConnected) { + // // await determineIfAccountIsAdmin(); + // // if (!isEmployee) { + // // //until the hook is working, this is going to prevent us from being directed to the dashboard + // // return; + // // } + // router.push("/dapp/dashboard"); + // return; + // } + + // try { + // await web3auth.connect(); + // if (web3auth.connected) { + // dispatch(setIsConnected({ isConnected: true })); + // //const userAddress = await getAccounts(); // Retrieve user's address + + // await determineIfAccountIsAdmin(); + // if (!isEmployee) { + // // until the hook is working, this is going to prevent us from being directed to the dashboard + // return; + // } + // router.push("/dapp/dashboard"); + // } + // } catch (error) { + // console.error(error); + // } + // } + // Web3Auth async function login() { if (isConnected) { - await determineIfAccountIsAdmin(); - if (!isEmployee) { - // until the hook is working, this is going to prevent us from being directed to the dashboard + // await determineIfAccountIsAdmin(); + if (!isOwner) { + //until the hook is working, this is going to prevent us from being directed to the dashboard + router.push("/dapp/dashboard"); + return; } - router.push("/dapp/dashboard"); return; } @@ -83,61 +155,68 @@ function Login() { await web3auth.connect(); if (web3auth.connected) { dispatch(setIsConnected({ isConnected: true })); + + //const userAddress = await getAccounts(); // Retrieve user's address + // await determineIfAccountIsAdmin(); - // if (!isEmployee) { - // // until the hook is working, this is going to prevent us from being directed to the dashboard - // return; - // } - router.push("/dapp/dashboard"); + if (!isOwner) { + // until the hook is working, this is going to prevent us from being directed to the dashboard + router.push("/dapp/dashboard"); + + return; + } } } catch (error) { console.error(error); } } - async function determineIfAccountIsAdmin() { - // set loading === true ??? - // const address = await getAccounts(); - // if (!address) { - // console.error("from determineIfAccountIsAdmin - address is undefined"); - // return; - // } + // async function determineIfAccountIsAdmin() { + // // set loading === true ??? + // const userAddress = getAccounts(); + // if (!userAddress) { + // console.error("from determineIfAccountIsAdmin - address is undefined"); + // return; + // } + + // if (!owner) { + // console.error("From determineIfAccountIsAdmin: ownerData from Payroll Contract is undefined"); + // return; + // } + + // /*-------------------------------------*/ + // // Kaz & Trevor + // // need to see what shape `owner` will be on return + // const isAdmin = userAddress === owner ? true : false; + // dispatch(setIsAdmin({ isAdmin: isAdmin })); + // /*-------------------------------------*/ + // // set loading === false ??? + // } - if (!owner) { - console.error("From determineIfAccountIsAdmin: ownerData from Payroll Contract is undefined"); + // func to grab the connected wallet address + async function getAccounts() { + if (!web3auth.provider) { + console.log("from login - getAccounts: provider not defined"); return; } + const client = createWalletClient({ + // account: privateKeyToAccount('0x...'); // from viem + chain: polygonMumbai, + transport: custom(web3auth.provider), + }); - /*-------------------------------------*/ - // Kaz & Trevor - // need to see what shape `owner` will be on return - // const isAdmin = address === owner ? true : false; - // dispatch(setIsAdmin({ isAdmin: isAdmin })); - /*-------------------------------------*/ - // set loading === false ??? + //console.log("web3auth provider: ", web3auth.provider); + // Get user's public address + const [userAddress] = await client.getAddresses(); + console.log("user address: ", userAddress); + return userAddress as Address; } - // async function getAccounts() { - // if (!web3auth.provider) { - // console.log("from login - getAccounts: provider not defined"); - // return; - // } - // const client = createWalletClient({ - // // account: privateKeyToAccount('0x...'); // from viem - // chain: polygonMumbai, - // transport: custom(web3auth.provider), - // }); - - // // Get user's public address - // const [address] = await client.getAddresses(); - // return address as Address; - // } - const submitForm = (e: React.FormEvent) => { e.preventDefault(); setErrorMessage(""); - if (loginObj.emailId.trim() === "") return setErrorMessage("Email is required!"); + // if (loginObj.emailId.trim() === "") return setErrorMessage("Email is required!"); if (loginObj.contractAddress.trim() === "") return setErrorMessage("Contract Address is required!"); }; @@ -165,14 +244,14 @@ function Login() { updateFormValue={updateFormValue} /> - + /> */}
{errorMessage} diff --git a/packages/nextjs/components/dash-wind/features/user/Register.tsx b/packages/nextjs/components/dash-wind/features/user/Register.tsx index 035ba0d..9629106 100644 --- a/packages/nextjs/components/dash-wind/features/user/Register.tsx +++ b/packages/nextjs/components/dash-wind/features/user/Register.tsx @@ -24,7 +24,7 @@ function Register() { const [walletAddress, setWalletAddress] = useState
(null); const dispatch = useMyDispatch(); - + //@note is this working? working for register page? async function login() { try { await web3auth.connect(); @@ -49,6 +49,8 @@ function Register() { // Get user's public address const [address] = await client.getAddresses(); + console.log("user address: ", address); + return address; } @@ -61,9 +63,12 @@ function Register() { setRegisterState("loading"); console.log("logging in company..."); await login(); - // Account Abstraction goes here...? - console.log("getting account address..."); + // Account Abstraction goes here...? -- kinda is with login + // grab account address const address = await getAccounts(); + console.log("connected address: ", address); + + console.log("getting account address..."); if (address) { // Prompt user to fund wallet? setWalletAddress(address); diff --git a/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx b/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx index acbef6f..84d8ad7 100644 --- a/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx +++ b/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx @@ -1,36 +1,66 @@ import React from "react"; import Link from "next/link"; -import { Abi, Address, parseEther } from "viem"; -import { useContractWrite, usePrepareContractWrite } from "wagmi"; +import PayrollFactory from "../../../../hardhat/artifacts/contracts/PayrollFactory.sol/PayrollFactory.json"; +import { Address, parseEther } from "viem"; +import { useContractWrite } from "wagmi"; +import { web3auth } from "~~/auth/web3auth"; import ErrorText from "~~/components/dash-wind/components/Typography/ErrorText"; import { Address as AddressDisplay } from "~~/components/scaffold-eth/Address"; +//import { useDeployedContractInfo } from "~~/hooks/scaffold-eth"; + interface props { ownerAddress: Address | null; } - -const payrollFactoryAddress = ""; -const payrollFactoryABI: Abi = []; +// Check if the user is connected +const isConnected = web3auth.connected; +const payrollFactoryAddress = "0xfe44aB0B966E57F126130BE6401546c7351484ad"; +const payrollFactoryABI = PayrollFactory.abi; export default function DeployForm({ ownerAddress }: props) { + //const { data: contractData } = useDeployedContractInfo("PayrollFactory"); + /*-------------------------------------*/ - // Kaz & Trevor + // Kaz & Trevor -- think this is the right way to do it + // but running in browser it seems to always be looking for the connected address + // see no action in the terminal when the button is clicked // deploy company contract after registration of account - const { config } = usePrepareContractWrite({ + // const { config } = usePrepareContractWrite({ + // address: payrollFactoryAddress, + // // abi: contractData?.abi, + // abi: payrollFactoryABI, + // functionName: "deployPayrollAndTokenTransferor", + // value: parseEther("1", "wei"), + // onSuccess(data) { + // console.log("contract deployed! Data: ", data); //will data be the contract addresses? + // }, + // onError(error) { + // console.error("contract deploy error!", error); //error message + // }, + // }); + + //console.log("config: ", config); + + const { data, isLoading, isSuccess, write } = useContractWrite({ address: payrollFactoryAddress, abi: payrollFactoryABI, functionName: "deployPayrollAndTokenTransferor", - value: parseEther("1", "wei"), - onSuccess(data) { - console.log("contract deployed! Data: ", data); - }, - onError(error) { - console.error("contract deploy error!", error); - }, }); + console.log("write: ", write); + console.log("data: ", data); - const { data, isLoading, isSuccess, write } = useContractWrite(config); - /*-------------------------------------*/ + // Function to handle button click + const handleDeployClick = () => { + if (isConnected) { + write({ + args: [], + //from: ownerAddress, + value: parseEther("1", "wei"), + }); + } else { + console.log("Wallet not connected"); + } + }; return (
@@ -44,7 +74,14 @@ export default function DeployForm({ ownerAddress }: props) {
{/* + + ) : ( + Error: Owner Address Not Found + )} + + {data && ( +
+

Payroll Contract Address:

+ {/*

{data}

*/} + {/* */} +
+ )} + +
+ + + Go Home + + +
+ + + ); +} diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index e64c44b..6ffb456 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -22,6 +22,7 @@ "@uniswap/v2-sdk": "^3.0.1", "@web3auth/base": "^7.2.0", "@web3auth/modal": "^7.2.0", + "@web3auth/web3auth-wagmi-connector": "^5.0.1", "axios": "^1.6.2", "blo": "^1.0.1", "chart.js": "^4.4.0", diff --git a/packages/nextjs/scaffold.config.ts b/packages/nextjs/scaffold.config.ts index 0af072c..628208e 100644 --- a/packages/nextjs/scaffold.config.ts +++ b/packages/nextjs/scaffold.config.ts @@ -11,7 +11,7 @@ export type ScaffoldConfig = { const scaffoldConfig = { // The network where your DApp lives in - targetNetwork: chains.hardhat, + targetNetwork: chains.polygonMumbai, // The interval at which your front-end polls the RPC servers for new data // it has no effect on the local network diff --git a/packages/nextjs/services/web3/wagmiConfig.tsx b/packages/nextjs/services/web3/wagmiConfig.tsx index 240aea0..00c2a1e 100644 --- a/packages/nextjs/services/web3/wagmiConfig.tsx +++ b/packages/nextjs/services/web3/wagmiConfig.tsx @@ -1,8 +1,18 @@ +import { Web3AuthConnector } from "@web3auth/web3auth-wagmi-connector"; import { createConfig } from "wagmi"; +import { web3auth as web3AuthInstance } from "~~/auth/web3auth"; import { appChains, wagmiConnectors } from "~~/services/web3/wagmiConnectors"; export const wagmiConfig = createConfig({ autoConnect: false, - connectors: wagmiConnectors, + connectors: [ + ...wagmiConnectors(), + new Web3AuthConnector({ + chains: appChains.chains, + options: { + web3AuthInstance, + }, + }), + ], publicClient: appChains.publicClient, }); diff --git a/yarn.lock b/yarn.lock index 4d825c3..3e062d1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -248,6 +248,30 @@ __metadata: languageName: node linkType: hard +"@chainlink/contracts-ccip@npm:^1.2.1": + version: 1.2.1 + resolution: "@chainlink/contracts-ccip@npm:1.2.1" + dependencies: + "@eth-optimism/contracts": ^0.5.21 + "@openzeppelin/contracts": ~4.3.3 + "@openzeppelin/contracts-upgradeable-4.7.3": "npm:@openzeppelin/contracts-upgradeable@v4.7.3" + "@openzeppelin/contracts-v0.7": "npm:@openzeppelin/contracts@v3.4.2" + checksum: b789c01eeaf0b28c712f9fbc9e42dc60e412f02274074a637fda4919cbf54eacc117036880a4b7a4921835d1a53bbe0b2dd9d9253d98fba167a212faba6899f1 + languageName: node + linkType: hard + +"@chainlink/contracts@npm:^0.8.0": + version: 0.8.0 + resolution: "@chainlink/contracts@npm:0.8.0" + dependencies: + "@eth-optimism/contracts": ^0.5.21 + "@openzeppelin/contracts": ~4.3.3 + "@openzeppelin/contracts-upgradeable-4.7.3": "npm:@openzeppelin/contracts-upgradeable@v4.7.3" + "@openzeppelin/contracts-v0.7": "npm:@openzeppelin/contracts@v3.4.2" + checksum: 4165aa7fa5d28c2ebef4da72e117f78889da292cff03d736d5738e2a3842d5fd162718106c2c04e9acb41298813edc99a27c456217a00bfdd4b0dfb758802cd0 + languageName: node + linkType: hard + "@chainsafe/as-sha256@npm:^0.3.1": version: 0.3.1 resolution: "@chainsafe/as-sha256@npm:0.3.1" @@ -392,6 +416,43 @@ __metadata: languageName: node linkType: hard +"@eth-optimism/contracts@npm:^0.5.21": + version: 0.5.40 + resolution: "@eth-optimism/contracts@npm:0.5.40" + dependencies: + "@eth-optimism/core-utils": 0.12.0 + "@ethersproject/abstract-provider": ^5.7.0 + "@ethersproject/abstract-signer": ^5.7.0 + peerDependencies: + ethers: ^5 + checksum: 11dde466c90b886efe8b5fd123fa5893187a4ff84839213d417f90ae4e45bf00b2f62d56e4ebe23ba5dd7ec33beed22c4c41e206add35fce0db073fe2dbae6ba + languageName: node + linkType: hard + +"@eth-optimism/core-utils@npm:0.12.0": + version: 0.12.0 + resolution: "@eth-optimism/core-utils@npm:0.12.0" + dependencies: + "@ethersproject/abi": ^5.7.0 + "@ethersproject/abstract-provider": ^5.7.0 + "@ethersproject/address": ^5.7.0 + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/constants": ^5.7.0 + "@ethersproject/contracts": ^5.7.0 + "@ethersproject/hash": ^5.7.0 + "@ethersproject/keccak256": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/providers": ^5.7.0 + "@ethersproject/rlp": ^5.7.0 + "@ethersproject/transactions": ^5.7.0 + "@ethersproject/web": ^5.7.0 + bufio: ^1.0.7 + chai: ^4.3.4 + checksum: 1c820107c44bdbb46becb1b00fd0dabb44f3ac8f54e6da7872a5a134411fad26f53b193225da55e79d6a8d7f0d01cc16a123db5d41ebaf02ca78360249a4b52a + languageName: node + linkType: hard + "@ethereumjs/common@npm:^3.2.0": version: 3.2.0 resolution: "@ethereumjs/common@npm:3.2.0" @@ -740,7 +801,7 @@ __metadata: languageName: node linkType: hard -"@ethersproject/providers@npm:^5.7.2": +"@ethersproject/providers@npm:^5.7.0, @ethersproject/providers@npm:^5.7.2": version: 5.7.2 resolution: "@ethersproject/providers@npm:5.7.2" dependencies: @@ -1892,6 +1953,20 @@ __metadata: languageName: node linkType: hard +"@openzeppelin/contracts-upgradeable-4.7.3@npm:@openzeppelin/contracts-upgradeable@v4.7.3": + version: 4.7.3 + resolution: "@openzeppelin/contracts-upgradeable@npm:4.7.3" + checksum: c9ffb40cb847a975d440204fc6a811f43af960050242f707332b984d29bd16dc242ffa0935de61867aeb9e0357fadedb16b09b276deda5e9775582face831021 + languageName: node + linkType: hard + +"@openzeppelin/contracts-v0.7@npm:@openzeppelin/contracts@v3.4.2": + version: 3.4.2 + resolution: "@openzeppelin/contracts@npm:3.4.2" + checksum: 0c90f029fe50a49643588e4c8670dae3bbf31795133a6ddce9bdcbc258486332700bb732287baabf7bf807f39182fe8ea2ffa19aa5caf359b1b9c0f083280748 + languageName: node + linkType: hard + "@openzeppelin/contracts@npm:^4.8.1": version: 4.8.1 resolution: "@openzeppelin/contracts@npm:4.8.1" @@ -1899,6 +1974,13 @@ __metadata: languageName: node linkType: hard +"@openzeppelin/contracts@npm:~4.3.3": + version: 4.3.3 + resolution: "@openzeppelin/contracts@npm:4.3.3" + checksum: 73eb23e7acc8531931076d11251629bdc8579c99ef921a3facbd8abf7b860bc214c97a4bd56cd67db7c9d1db837765132640f24987aac8097a13960bb41ca6d1 + languageName: node + linkType: hard + "@parcel/watcher-android-arm64@npm:2.3.0": version: 2.3.0 resolution: "@parcel/watcher-android-arm64@npm:2.3.0" @@ -2236,6 +2318,8 @@ __metadata: version: 0.0.0-use.local resolution: "@se-2/hardhat@workspace:packages/hardhat" dependencies: + "@chainlink/contracts": ^0.8.0 + "@chainlink/contracts-ccip": ^1.2.1 "@ethersproject/abi": ^5.7.0 "@ethersproject/providers": ^5.7.1 "@matterlabs/hardhat-zksync-solc": ^0.3.17 @@ -2290,6 +2374,7 @@ __metadata: "@uniswap/v2-sdk": ^3.0.1 "@web3auth/base": ^7.2.0 "@web3auth/modal": ^7.2.0 + "@web3auth/web3auth-wagmi-connector": ^5.0.1 autoprefixer: ^10.4.12 axios: ^1.6.2 blo: ^1.0.1 @@ -4783,6 +4868,23 @@ __metadata: languageName: node linkType: hard +"@web3auth/web3auth-wagmi-connector@npm:^5.0.1": + version: 5.0.1 + resolution: "@web3auth/web3auth-wagmi-connector@npm:5.0.1" + peerDependencies: + "@wagmi/core": ^1.x + "@web3auth/base": ^7.x + "@web3auth/modal": ^7.x + "@web3auth/no-modal": ^7.x + "@web3auth/openlogin-adapter": ^7.x + viem: ^1.x + peerDependenciesMeta: + "@web3auth/modal": + optional: true + checksum: 1c3d39cab0ff298ec10fe1061465f66a794a36b4d62261b5abf63879fef555005b7e44b6c5e7253b2e9d57b777671bef60f6564f9b2cb2399f92ef3bf9519372 + languageName: node + linkType: hard + "JSONStream@npm:1.3.2": version: 1.3.2 resolution: "JSONStream@npm:1.3.2" @@ -5932,6 +6034,13 @@ __metadata: languageName: node linkType: hard +"bufio@npm:^1.0.7": + version: 1.2.1 + resolution: "bufio@npm:1.2.1" + checksum: b6e1216f4a5877617a3580b83807d8b96c794c015bc2d5eb9e70e152dc79fe923517472bd96df3d5b8feb59a0e25e2aa3cd8a70b8f90905b92d86f2e5719ed68 + languageName: node + linkType: hard + "buildcheck@npm:~0.0.6": version: 0.0.6 resolution: "buildcheck@npm:0.0.6" @@ -6079,6 +6188,21 @@ __metadata: languageName: node linkType: hard +"chai@npm:^4.3.4": + version: 4.3.10 + resolution: "chai@npm:4.3.10" + dependencies: + assertion-error: ^1.1.0 + check-error: ^1.0.3 + deep-eql: ^4.1.3 + get-func-name: ^2.0.2 + loupe: ^2.3.6 + pathval: ^1.1.1 + type-detect: ^4.0.8 + checksum: 536668c60a0d985a0fbd94418028e388d243a925d7c5e858c7443e334753511614a3b6a124bac9ca077dfc4c37acc367d62f8c294960f440749536dc181dfc6d + languageName: node + linkType: hard + "chai@npm:^4.3.6": version: 4.3.6 resolution: "chai@npm:4.3.6" @@ -6138,6 +6262,15 @@ __metadata: languageName: node linkType: hard +"check-error@npm:^1.0.3": + version: 1.0.3 + resolution: "check-error@npm:1.0.3" + dependencies: + get-func-name: ^2.0.2 + checksum: e2131025cf059b21080f4813e55b3c480419256914601750b0fee3bd9b2b8315b531e551ef12560419b8b6d92a3636511322752b1ce905703239e7cc451b6399 + languageName: node + linkType: hard + "chokidar@npm:3.3.0": version: 3.3.0 resolution: "chokidar@npm:3.3.0" @@ -6850,6 +6983,15 @@ __metadata: languageName: node linkType: hard +"deep-eql@npm:^4.1.3": + version: 4.1.3 + resolution: "deep-eql@npm:4.1.3" + dependencies: + type-detect: ^4.0.0 + checksum: 7f6d30cb41c713973dc07eaadded848b2ab0b835e518a88b91bea72f34e08c4c71d167a722a6f302d3a6108f05afd8e6d7650689a84d5d29ec7fe6220420397f + languageName: node + linkType: hard + "deep-extend@npm:~0.6.0": version: 0.6.0 resolution: "deep-extend@npm:0.6.0" @@ -8943,6 +9085,13 @@ __metadata: languageName: node linkType: hard +"get-func-name@npm:^2.0.1, get-func-name@npm:^2.0.2": + version: 2.0.2 + resolution: "get-func-name@npm:2.0.2" + checksum: 3f62f4c23647de9d46e6f76d2b3eafe58933a9b3830c60669e4180d6c601ce1b4aa310ba8366143f55e52b139f992087a9f0647274e8745621fa2af7e0acf13b + languageName: node + linkType: hard + "get-intrinsic@npm:^1.0.2, get-intrinsic@npm:^1.1.0, get-intrinsic@npm:^1.1.1, get-intrinsic@npm:^1.1.3": version: 1.1.3 resolution: "get-intrinsic@npm:1.1.3" @@ -11026,6 +11175,15 @@ __metadata: languageName: node linkType: hard +"loupe@npm:^2.3.6": + version: 2.3.7 + resolution: "loupe@npm:2.3.7" + dependencies: + get-func-name: ^2.0.1 + checksum: 96c058ec7167598e238bb7fb9def2f9339215e97d6685d9c1e3e4bdb33d14600e11fe7a812cf0c003dfb73ca2df374f146280b2287cae9e8d989e9d7a69a203b + languageName: node + linkType: hard + "lru-cache@npm:^10.0.2": version: 10.1.0 resolution: "lru-cache@npm:10.1.0" @@ -14008,6 +14166,7 @@ __metadata: version: 0.0.0-use.local resolution: "se-2@workspace:." dependencies: + "@web3auth/web3auth-wagmi-connector": ^5.0.1 husky: ^8.0.1 lint-staged: ^13.0.3 languageName: unknown @@ -15413,7 +15572,7 @@ __metadata: languageName: node linkType: hard -"type-detect@npm:^4.0.0, type-detect@npm:^4.0.5": +"type-detect@npm:^4.0.0, type-detect@npm:^4.0.5, type-detect@npm:^4.0.8": version: 4.0.8 resolution: "type-detect@npm:4.0.8" checksum: 62b5628bff67c0eb0b66afa371bd73e230399a8d2ad30d852716efcc4656a7516904570cd8631a49a3ce57c10225adf5d0cbdcb47f6b0255fe6557c453925a15 From 8e275bb5711d8fac9d262b387870d34ec408b00e Mon Sep 17 00:00:00 2001 From: Spencer Schoeneman Date: Fri, 8 Dec 2023 15:58:07 -0600 Subject: [PATCH 10/10] EPIC SUCCESS: web3auth connected to wagmi - login/register working - deploy contracts working - recieve address back --- .../dash-wind/features/user/Login.tsx | 124 ++++-------------- .../dash-wind/features/user/Register.tsx | 8 +- .../web-3-crew/register-page/DeployForm.tsx | 85 ++++++++---- 3 files changed, 92 insertions(+), 125 deletions(-) diff --git a/packages/nextjs/components/dash-wind/features/user/Login.tsx b/packages/nextjs/components/dash-wind/features/user/Login.tsx index 650d4f9..156908f 100644 --- a/packages/nextjs/components/dash-wind/features/user/Login.tsx +++ b/packages/nextjs/components/dash-wind/features/user/Login.tsx @@ -10,13 +10,14 @@ import { Address, createWalletClient, custom } from "viem"; import { polygonMumbai } from "viem/chains"; // import { Address, createWalletClient, custom } from "viem"; // import { polygonMumbai } from "viem/chains"; -import { useContractRead } from "wagmi"; +import { useAccount, useConnect, useContractRead } from "wagmi"; import { + setIsAdmin, /*setIsAdmin,*/ setIsConnected, } from "~~/auth/authSlice"; import { web3auth } from "~~/auth/web3auth"; -import { MyState, useMyDispatch, useMySelector } from "~~/components/dash-wind/app/store"; +import { useMyDispatch } from "~~/components/dash-wind/app/store"; //import { get } from "http"; @@ -34,12 +35,14 @@ function Login() { // const [loading, setLoading] = useState(false); const [errorMessage, setErrorMessage] = useState(""); const [loginObj, setLoginObj] = useState(INITIAL_LOGIN_OBJ); - const { isConnected } = useMySelector((state: MyState) => state.auth); + // const { isConnected } = useMySelector((state: MyState) => state.auth); const router = useRouter(); const dispatch = useMyDispatch(); //const userAddress = getAccounts(); // state to store user address once it is fetched const [userAddress, setUserAddress] = useState(null); + const { address: wagmiAddress, isConnected: wagmiIsConnected } = useAccount(); + const { connect, connectors, error } = useConnect(); useEffect(() => { async function fetchAddress() { @@ -72,127 +75,50 @@ function Login() { }) as { data: boolean | undefined }; console.log("is owner: ", isOwner); - console.log("user address contract read: ", [getAccounts()]); + console.log("wagmi account address: ", wagmiAddress); + console.log("wagmi account isConnected: ", wagmiIsConnected); - useEffect(() => { - if (typeof isOwner !== "undefined") { - // Ensure the value is not undefined - if (isOwner) { - // Redirect to owner's dashboard - router.push("/dapp/dashboard"); - } else { - // Redirect to employee or general user dashboard - router.push("/dapp/dashboard"); - } - } - }, [isOwner, router]); - - /*-------------------------------------*/ - - /*-------------------------------------*/ - // Kaz & Trevor - // - // const { - // data: isEmployee, - // // isError, - // // isLoading, - // } = useContractRead({ - // address: process.env.NEXT_PUBLIC_PAYROLL_CONTRACT_ADDRESS, - // abi: payrollABI, - // functionName: "doesEmployeeExist", - // args: [ - // /* problem: figure out how to getAccount() address here */ - // userAddress - // ], - // chainId: Number(chainId), - // }); - /*-------------------------------------*/ - - // // Web3Auth - // async function login() { - // if (isConnected) { - // // await determineIfAccountIsAdmin(); - // // if (!isEmployee) { - // // //until the hook is working, this is going to prevent us from being directed to the dashboard - // // return; - // // } - // router.push("/dapp/dashboard"); - // return; - // } - - // try { - // await web3auth.connect(); - // if (web3auth.connected) { - // dispatch(setIsConnected({ isConnected: true })); - // //const userAddress = await getAccounts(); // Retrieve user's address - - // await determineIfAccountIsAdmin(); - // if (!isEmployee) { - // // until the hook is working, this is going to prevent us from being directed to the dashboard - // return; - // } - // router.push("/dapp/dashboard"); - // } - // } catch (error) { - // console.error(error); - // } - // } - - // Web3Auth + // Wagmi Connect async function login() { - if (isConnected) { - // await determineIfAccountIsAdmin(); + if (web3auth.connected) { + dispatch(setIsConnected({ isConnected: true })); if (!isOwner) { //until the hook is working, this is going to prevent us from being directed to the dashboard + dispatch(setIsAdmin({ isAdmin: false })); router.push("/dapp/dashboard"); - return; } + dispatch(setIsAdmin({ isAdmin: true })); + router.push("/dapp/dashboard"); return; } try { await web3auth.connect(); + connect({ connector: connectors[6] }); + if (error) { + console.error("wagmi connect error: from Login - login(): ", error); + } if (web3auth.connected) { dispatch(setIsConnected({ isConnected: true })); - - //const userAddress = await getAccounts(); // Retrieve user's address - - // await determineIfAccountIsAdmin(); + const address = await getAccounts(); // Retrieve user's address + if (address) { + setUserAddress(address); + } if (!isOwner) { // until the hook is working, this is going to prevent us from being directed to the dashboard + dispatch(setIsAdmin({ isAdmin: false })); router.push("/dapp/dashboard"); - return; } + dispatch(setIsAdmin({ isAdmin: true })); + router.push("/dapp/dashboard"); } } catch (error) { console.error(error); } } - // async function determineIfAccountIsAdmin() { - // // set loading === true ??? - // const userAddress = getAccounts(); - // if (!userAddress) { - // console.error("from determineIfAccountIsAdmin - address is undefined"); - // return; - // } - - // if (!owner) { - // console.error("From determineIfAccountIsAdmin: ownerData from Payroll Contract is undefined"); - // return; - // } - - // /*-------------------------------------*/ - // // Kaz & Trevor - // // need to see what shape `owner` will be on return - // const isAdmin = userAddress === owner ? true : false; - // dispatch(setIsAdmin({ isAdmin: isAdmin })); - // /*-------------------------------------*/ - // // set loading === false ??? - // } - // func to grab the connected wallet address async function getAccounts() { if (!web3auth.provider) { diff --git a/packages/nextjs/components/dash-wind/features/user/Register.tsx b/packages/nextjs/components/dash-wind/features/user/Register.tsx index 9629106..3457e6a 100644 --- a/packages/nextjs/components/dash-wind/features/user/Register.tsx +++ b/packages/nextjs/components/dash-wind/features/user/Register.tsx @@ -3,6 +3,7 @@ import { UpdateFormValues } from "../../types/FormTypes"; import LandingIntro from "./LandingIntro"; import { Address, createWalletClient, custom } from "viem"; import { polygonMumbai } from "viem/chains"; +import { useConnect } from "wagmi"; import { setIsConnected } from "~~/auth/authSlice"; import { web3auth } from "~~/auth/web3auth"; import { useMyDispatch } from "~~/components/dash-wind/app/store"; @@ -22,12 +23,17 @@ function Register() { const [registerState, setRegisterState] = useState("init"); const [registerObj, setRegisterObj] = useState(INITIAL_REGISTER_OBJ); const [walletAddress, setWalletAddress] = useState
(null); + const { connect, connectors, error } = useConnect(); const dispatch = useMyDispatch(); - //@note is this working? working for register page? + async function login() { try { await web3auth.connect(); + connect({ connector: connectors[6] }); + if (error) { + console.error("wagmi connect error: from Register - login(): ", error); + } if (web3auth.connected) { dispatch(setIsConnected({ isConnected: true })); } diff --git a/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx b/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx index 84d8ad7..c56f37c 100644 --- a/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx +++ b/packages/nextjs/components/web-3-crew/register-page/DeployForm.tsx @@ -1,9 +1,15 @@ -import React from "react"; +import React, { useState } from "react"; import Link from "next/link"; import PayrollFactory from "../../../../hardhat/artifacts/contracts/PayrollFactory.sol/PayrollFactory.json"; -import { Address, parseEther } from "viem"; -import { useContractWrite } from "wagmi"; -import { web3auth } from "~~/auth/web3auth"; +import { + Address, + parseEther, + trim, + /*parseEther*/ +} from "viem"; +import { useContractEvent, useContractWrite } from "wagmi"; +// import { web3auth } from "~~/auth/web3auth"; +import { MyState, useMySelector } from "~~/components/dash-wind/app/store"; import ErrorText from "~~/components/dash-wind/components/Typography/ErrorText"; import { Address as AddressDisplay } from "~~/components/scaffold-eth/Address"; @@ -13,12 +19,15 @@ interface props { ownerAddress: Address | null; } // Check if the user is connected -const isConnected = web3auth.connected; -const payrollFactoryAddress = "0xfe44aB0B966E57F126130BE6401546c7351484ad"; +// const isConnected = web3auth.connected; +const payrollFactoryAddress = process.env.NEXT_PUBLIC_FACTORY_CONTRACT_ADDRESS; const payrollFactoryABI = PayrollFactory.abi; export default function DeployForm({ ownerAddress }: props) { //const { data: contractData } = useDeployedContractInfo("PayrollFactory"); + const { isConnected } = useMySelector((state: MyState) => state.auth); + const [newPayrollContractAddress, setNewPayrollContractAddress] = useState(""); + const [newTokenTransferorContractAddress, setNewTokenTransferorContractAddress] = useState(""); /*-------------------------------------*/ // Kaz & Trevor -- think this is the right way to do it @@ -26,42 +35,73 @@ export default function DeployForm({ ownerAddress }: props) { // see no action in the terminal when the button is clicked // deploy company contract after registration of account // const { config } = usePrepareContractWrite({ + // usePrepareContractWrite({ // address: payrollFactoryAddress, // // abi: contractData?.abi, // abi: payrollFactoryABI, // functionName: "deployPayrollAndTokenTransferor", - // value: parseEther("1", "wei"), - // onSuccess(data) { + // args: [], + // value: 1_000_000n, + // gas: 1_000_000n, + // onSuccess(data: any) { // console.log("contract deployed! Data: ", data); //will data be the contract addresses? // }, - // onError(error) { + // onError(error: any) { // console.error("contract deploy error!", error); //error message // }, // }); + // const { data, write, isLoading, isSuccess } = useContractWrite(config); + //console.log("config: ", config); const { data, isLoading, isSuccess, write } = useContractWrite({ address: payrollFactoryAddress, abi: payrollFactoryABI, functionName: "deployPayrollAndTokenTransferor", + args: [], + value: parseEther("0.000000000000000001"), + // value: 100_000_000_000_000_000n, + onSuccess(data: any) { + console.log("contract deployed! Data: ", data); //will data be the contract addresses? + }, + onError(error: any) { + console.error("contract deploy error!", error); //error message + }, }); - console.log("write: ", write); - console.log("data: ", data); + // console.log("write: ", write); + // console.log("data: ", data); // Function to handle button click const handleDeployClick = () => { if (isConnected) { - write({ - args: [], - //from: ownerAddress, - value: parseEther("1", "wei"), - }); + console.log("writing..."); + write(); } else { console.log("Wallet not connected"); } }; + useContractEvent({ + address: payrollFactoryAddress, + abi: payrollFactoryABI, + eventName: "TokenTransferorDeployed", + listener(log) { + console.log("TokenTransferorDeployed: ", trim(log[0].data)); + setNewTokenTransferorContractAddress(trim(log[0].data).toString()); + }, + }); + useContractEvent({ + address: payrollFactoryAddress, + abi: payrollFactoryABI, + eventName: "PayrollDeployed", + listener(log) { + console.log("PayrollDeployed: ", trim(log[0].data).toString().slice(0, 42)); + setNewPayrollContractAddress(trim(log[0].data).toString().slice(0, 42)); + }, + }); + // 0x5898400727c49fc2453993e017f01f44077e508b; // 42 + // 0xde9e1226a501921472da36c57b9acbe75891bf1 return (

Deploy Payroll Contract

@@ -74,14 +114,7 @@ export default function DeployForm({ ownerAddress }: props) {
{/*