diff --git a/packages/dapp/src/abi/IERC20Abi.ts b/packages/constants/abi/IERC20Abi.ts similarity index 100% rename from packages/dapp/src/abi/IERC20Abi.ts rename to packages/constants/abi/IERC20Abi.ts diff --git a/packages/dapp/src/abi/ISmartInvoiceEscrowAbi.ts b/packages/constants/abi/ISmartInvoiceEscrowAbi.ts similarity index 100% rename from packages/dapp/src/abi/ISmartInvoiceEscrowAbi.ts rename to packages/constants/abi/ISmartInvoiceEscrowAbi.ts diff --git a/packages/dapp/src/abi/ISmartInvoiceFactoryAbi.ts b/packages/constants/abi/ISmartInvoiceFactoryAbi.ts similarity index 100% rename from packages/dapp/src/abi/ISmartInvoiceFactoryAbi.ts rename to packages/constants/abi/ISmartInvoiceFactoryAbi.ts diff --git a/packages/dapp/src/abi/ISmartInvoiceInstantAbi.ts b/packages/constants/abi/ISmartInvoiceInstantAbi.ts similarity index 100% rename from packages/dapp/src/abi/ISmartInvoiceInstantAbi.ts rename to packages/constants/abi/ISmartInvoiceInstantAbi.ts diff --git a/packages/dapp/src/abi/ISmartInvoiceSplitEscrowAbi.ts b/packages/constants/abi/ISmartInvoiceSplitEscrowAbi.ts similarity index 100% rename from packages/dapp/src/abi/ISmartInvoiceSplitEscrowAbi.ts rename to packages/constants/abi/ISmartInvoiceSplitEscrowAbi.ts diff --git a/packages/dapp/src/abi/index.ts b/packages/constants/abi/index.ts similarity index 100% rename from packages/dapp/src/abi/index.ts rename to packages/constants/abi/index.ts diff --git a/packages/dapp/src/constants/config.ts b/packages/constants/config.ts similarity index 100% rename from packages/dapp/src/constants/config.ts rename to packages/constants/config.ts diff --git a/packages/constants/index.ts b/packages/constants/index.ts new file mode 100644 index 00000000..10058e97 --- /dev/null +++ b/packages/constants/index.ts @@ -0,0 +1,3 @@ +export * from './abi'; +export * from './config'; +export * from './misc'; diff --git a/packages/dapp/src/constants/index.ts b/packages/constants/misc.ts similarity index 96% rename from packages/dapp/src/constants/index.ts rename to packages/constants/misc.ts index 2604318d..d9ab8426 100644 --- a/packages/dapp/src/constants/index.ts +++ b/packages/constants/misc.ts @@ -1,6 +1,6 @@ import { Address } from 'viem'; -import { getKeys } from '../utils/getKeys'; +// import { getKeys } from '../utils/getKeys'; import { CONFIG } from './config'; export { CONFIG }; @@ -154,7 +154,9 @@ export const invoiceFactory = { 80001: NETWORK_CONFIG[80001].INVOICE_FACTORY, }; -export const SUPPORTED_NETWORKS = getKeys(NETWORK_CONFIG).map(k => Number(k)); +// TODO fix +// export const SUPPORTED_NETWORKS = getKeys(NETWORK_CONFIG).map(k => Number(k)); +export const SUPPORTED_NETWORKS = [1, 4, 5, 42, 100, 137, 31337, 80001]; export const INVOICE_VERSION = 'smart-invoice-v0'; diff --git a/packages/constants/package.json b/packages/constants/package.json new file mode 100644 index 00000000..520dda5a --- /dev/null +++ b/packages/constants/package.json @@ -0,0 +1,18 @@ +{ + "name": "@smart-invoice/constants", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "viem": "^1.21.4" + }, + "devDependencies": { + "@types/node": "^20.11.5" + } +} diff --git a/packages/constants/tsconfig.json b/packages/constants/tsconfig.json new file mode 100644 index 00000000..0a56d933 --- /dev/null +++ b/packages/constants/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "target": "ES2020", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "ESNext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../../jest.config.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/dapp/package.json b/packages/dapp/package.json index c1f36a17..b8d2e51e 100644 --- a/packages/dapp/package.json +++ b/packages/dapp/package.json @@ -13,13 +13,16 @@ "@graphql-typed-document-node/core": "^3.2.0", "@rainbow-me/rainbowkit": "^1.3.3", "@react-pdf/renderer": "^3.1.14", + "@smart-invoice/constants": "*", + "@smart-invoice/hooks": "*", + "@smart-invoice/ui": "*", + "@smart-invoice/utils": "*", "@tanstack/react-query": "^5.17.9", "@tanstack/react-table": "^8.11.3", "@vercel/analytics": "^1.1.1", "@wagmi/core": "^1.4.13", "abitype": "^0.10.3", "base-58": "^0.0.1", - "bignumber.js": "^9.1.2", "dotenv": "^16.0.1", "firebase": "^10.7.0", "focus-visible": "^5.2.0", diff --git a/packages/dapp/src/pages/_app.tsx b/packages/dapp/pages/_app.tsx similarity index 84% rename from packages/dapp/src/pages/_app.tsx rename to packages/dapp/pages/_app.tsx index d2fbc1e7..3e54227e 100644 --- a/packages/dapp/src/pages/_app.tsx +++ b/packages/dapp/pages/_app.tsx @@ -8,10 +8,8 @@ import { CSSReset, ChakraProvider, ColorModeScript } from '@chakra-ui/react'; import { Global } from '@emotion/react'; import { RainbowKitProvider } from '@rainbow-me/rainbowkit'; -import { ErrorBoundary } from '../components/ErrorBoundary'; -import { Layout } from '../shared/Layout'; -import { globalStyles, theme } from '../theme'; -import { chains, wagmiConfig } from '../utils/web3'; +import { ErrorBoundary, Layout, globalStyles, theme } from '@smart-invoice/ui'; +import { chains, wagmiConfig } from '@smart-invoice/utils'; import { AppProps } from 'next/app'; const App = ({ Component, pageProps }: AppProps) => { diff --git a/packages/dapp/src/pages/contracts.tsx b/packages/dapp/pages/contracts.tsx similarity index 100% rename from packages/dapp/src/pages/contracts.tsx rename to packages/dapp/pages/contracts.tsx diff --git a/packages/dapp/src/pages/create/escrow.tsx b/packages/dapp/pages/create/escrow.tsx similarity index 100% rename from packages/dapp/src/pages/create/escrow.tsx rename to packages/dapp/pages/create/escrow.tsx diff --git a/packages/dapp/src/pages/create/index.tsx b/packages/dapp/pages/create/index.tsx similarity index 100% rename from packages/dapp/src/pages/create/index.tsx rename to packages/dapp/pages/create/index.tsx diff --git a/packages/dapp/src/pages/create/instant.tsx b/packages/dapp/pages/create/instant.tsx similarity index 100% rename from packages/dapp/src/pages/create/instant.tsx rename to packages/dapp/pages/create/instant.tsx diff --git a/packages/dapp/src/pages/index.tsx b/packages/dapp/pages/index.tsx similarity index 100% rename from packages/dapp/src/pages/index.tsx rename to packages/dapp/pages/index.tsx diff --git a/packages/dapp/src/pages/invoice/[chainId]/[invoiceId]/index.tsx b/packages/dapp/pages/invoice/[chainId]/[invoiceId]/index.tsx similarity index 100% rename from packages/dapp/src/pages/invoice/[chainId]/[invoiceId]/index.tsx rename to packages/dapp/pages/invoice/[chainId]/[invoiceId]/index.tsx diff --git a/packages/dapp/src/pages/invoice/[chainId]/[invoiceId]/instant.tsx b/packages/dapp/pages/invoice/[chainId]/[invoiceId]/instant.tsx similarity index 100% rename from packages/dapp/src/pages/invoice/[chainId]/[invoiceId]/instant.tsx rename to packages/dapp/pages/invoice/[chainId]/[invoiceId]/instant.tsx diff --git a/packages/dapp/src/pages/invoice/[chainId]/[invoiceId]/locked.tsx b/packages/dapp/pages/invoice/[chainId]/[invoiceId]/locked.tsx similarity index 100% rename from packages/dapp/src/pages/invoice/[chainId]/[invoiceId]/locked.tsx rename to packages/dapp/pages/invoice/[chainId]/[invoiceId]/locked.tsx diff --git a/packages/dapp/src/pages/invoices.tsx b/packages/dapp/pages/invoices.tsx similarity index 96% rename from packages/dapp/src/pages/invoices.tsx rename to packages/dapp/pages/invoices.tsx index b3754bbc..2707f5f9 100644 --- a/packages/dapp/src/pages/invoices.tsx +++ b/packages/dapp/pages/invoices.tsx @@ -13,7 +13,7 @@ import { useBreakpointValue, } from '@chakra-ui/react'; -import { InvoiceDashboardTable } from '../components/InvoiceDashboardTable'; +import { InvoiceDashboardTable } from '@smart-invoice/ui'; const Invoices = () => { const { data: walletClient } = useWalletClient(); diff --git a/packages/dapp/src/context/CreateContext.tsx b/packages/dapp/src/context/CreateContext.tsx deleted file mode 100644 index 8017b30f..00000000 --- a/packages/dapp/src/context/CreateContext.tsx +++ /dev/null @@ -1,581 +0,0 @@ -/* eslint-disable no-unused-vars */ -import React, { - createContext, - useCallback, - useEffect, - useMemo, - useState, -} from 'react'; -import { - Address, - Hash, - encodeAbiParameters, - parseAbiParameters, - stringToHex, -} from 'viem'; -import { useWalletClient } from 'wagmi'; - -import { track } from '@vercel/analytics'; - -import { ESCROW_STEPS, INSTANT_STEPS, INVOICE_TYPES } from '../constants'; -import { - getInvoiceFactoryAddress, - getResolvers, - getWrappedNativeToken, - isValidLink, - logError, - sum, -} from '../utils/helpers'; -import { register } from '../utils/invoice'; -import { uploadMetadata } from '../utils/ipfs'; -import { useCreateEscrow } from './create-hooks/useCreateEscrow'; -import { useCreateInstant } from './create-hooks/useCreateInstant'; - -export type CreateContextType = { - projectName?: string; - projectDescription?: string; - projectAgreement?: any; - projectAgreementSource?: string; - projectAgreementLinkType?: string; - startDate?: number; - endDate?: number; - safetyValveDate?: number; - clientAddress?: Address; - paymentAddress?: Address; - paymentDue?: bigint; - paymentToken?: Address; - milestones?: number; - termsAccepted?: boolean; - arbitrationProvider?: Address; - payments?: bigint[]; - txHash?: Hash; - invoiceType?: string; - deadline?: number; - lateFee?: bigint; - lateFeeInterval?: number; - // setters - setProjectName: (v: string) => void; - setProjectDescription: (v: string) => void; - setProjectAgreement: (v: any) => void; - setProjectAgreementSource: (v: string) => void; - setProjectAgreementLinkType: (v: string) => void; - setStartDate: (v: any) => void; - setEndDate: (v: any) => void; - setSafetyValveDate: (v: number) => void; - setClientAddress: (v: Address) => void; - setPaymentAddress: (v: Address) => void; - setPaymentDue: (v: bigint) => void; - setPaymentToken: (v: Address) => void; - setMilestones: (v: number) => void; - setTermsAccepted: (v: boolean) => void; - setArbitrationProvider: (v: Address) => void; - setPayments: (v: bigint[]) => void; - setInvoiceType: (v: string) => void; - setDeadline: (v: number) => void; - setLateFee: (v: bigint) => void; - setLateFeeInterval: (v: number) => void; - // creating invoice - loading: boolean; - createInvoice: () => void; - // stepHandling - currentStep: number; - nextStepEnabled: boolean; - goBackHandler: () => void; - nextStepHandler: () => void; -}; - -export const CreateContext = createContext({ - // setters - setProjectName: () => {}, - setProjectDescription: () => {}, - setProjectAgreement: () => {}, - setProjectAgreementSource: () => {}, - setProjectAgreementLinkType: () => {}, - setStartDate: () => {}, - setEndDate: () => {}, - setSafetyValveDate: () => {}, - setClientAddress: () => {}, - setPaymentAddress: () => {}, - setPaymentDue: () => {}, - setPaymentToken: () => {}, - setMilestones: () => {}, - setTermsAccepted: () => {}, - setArbitrationProvider: () => {}, - setPayments: () => {}, - setInvoiceType: () => {}, - setDeadline: () => {}, - setLateFee: () => {}, - setLateFeeInterval: () => {}, - // creating invoice - loading: true, - createInvoice: () => {}, - // stepHandling - currentStep: 0, - nextStepEnabled: false, - goBackHandler: () => {}, - nextStepHandler: () => {}, -}); - -export const CreateContextProvider: React.FC = ({ - children, -}) => { - const { data: walletClient } = useWalletClient(); - const chainId = walletClient?.chain?.id; - const RESOLVERS = getResolvers(chainId); - const WRAPPED_NATIVE_TOKEN = getWrappedNativeToken(chainId); - - // project details - const [invoiceType, setInvoiceType] = useState(''); - const [projectName, setProjectName] = useState(''); - const [projectDescription, setProjectDescription] = useState(''); - const [projectAgreementLinkType, setProjectAgreementLinkType] = - useState('https'); - const [projectAgreementSource, setProjectAgreementSource] = useState(''); - const [projectAgreement, setProjectAgreement] = useState([ - { - type: projectAgreementLinkType, - src: projectAgreementSource, - createdAt: Date.now().toString(), - }, - ]); - const [startDate, setStartDate] = useState(); - const [endDate, setEndDate] = useState(); - const [detailsHash, setDetailsHash] = useState(); // ipfsHash for projectDetails - - // payment details - const [clientAddress, setClientAddress] = useState
(); - const [paymentAddress, setPaymentAddress] = useState
(); - const [paymentDue, setPaymentDue] = useState(BigInt(0)); - const [paymentToken, setPaymentToken] = - useState
(WRAPPED_NATIVE_TOKEN); - const [milestones, setMilestones] = useState(1); - - // escrow details - const [safetyValveDate, setSafetyValveDate] = useState(0); - const [termsAccepted, setTermsAccepted] = useState(false); - const [arbitrationProvider, setArbitrationProvider] = useState(RESOLVERS[0]); - // eslint-disable-next-line no-unused-vars - const [requireVerification, setRequireVerification] = useState(true); - - // instant payment details - const [deadline, setDeadline] = useState(0); - const [lateFee, setLateFee] = useState(BigInt(0)); - const [lateFeeInterval, setLateFeeInterval] = useState(0); - - // payments chunks - const [payments, setPayments] = useState([BigInt(0)]); - const [txHash, setTxHash] = useState(); - const [loading, setLoading] = useState(false); - - // step handling - const [currentStep, setStep] = useState(1); - const [nextStepEnabled, setNextStepEnabled] = useState(false); - const [allValid, setAllValid] = useState(false); - - useEffect(() => { - track('CreateInvoice', { invoiceType, currentStep }); - }, [invoiceType, currentStep]); - - const { Escrow, Instant } = INVOICE_TYPES; - - // common for all invoice types - const step1Valid = useMemo(() => { - if (invoiceType === Escrow) { - return ( - projectName && - isValidLink(projectAgreementSource) && - safetyValveDate && - safetyValveDate > new Date().getTime() - ); - } - if (invoiceType === Instant) { - return projectName && isValidLink(projectAgreementSource); - } - return false; - }, [ - projectName, - projectAgreementSource, - safetyValveDate, - Escrow, - Instant, - invoiceType, - ]); - - // handle invoice type - const { escrowStep2Valid, escrowStep3Valid } = useCreateEscrow({ - step1Valid, - allValid, - clientAddress, - paymentAddress, - payments, - paymentToken, - paymentDue, - milestones, - termsAccepted, - arbitrationProvider, - setAllValid, - }); - - const { instantStep2Valid } = useCreateInstant({ - step1Valid, - allValid, - clientAddress, - paymentAddress, - paymentToken, - paymentDue, - milestones, - setAllValid, - }); - - useEffect(() => { - setProjectAgreement([ - { - type: projectAgreementLinkType, - src: projectAgreementSource, - createdAt: Date.now().toString(), - }, - ]); - }, [projectAgreementSource, projectAgreementLinkType]); - - useEffect(() => { - if (step1Valid && currentStep === 2 && startDate && endDate) { - uploadMetadata({ - projectName, - projectDescription, - projectAgreement, - startDate: Math.floor(startDate / 1000), - endDate: Math.floor(endDate / 1000), - }) - .then(hash => setDetailsHash(hash)) - .catch(ipfsError => { - logError({ ipfsError }); - }); - } - }, [ - step1Valid, - currentStep, - projectName, - projectDescription, - projectAgreement, - projectAgreementLinkType, - projectAgreementSource, - startDate, - endDate, - ]); - - const encodeEscrowData = useCallback( - (factoryAddress: Address) => { - if (!clientAddress) throw new Error('Invalid client address'); - if (!detailsHash) throw new Error('Invalid details hash'); - - const resolverType = 0; // 0 for individual, 1 for erc-792 arbitrator - const type = stringToHex(Escrow, { size: 32 }); - const data = encodeAbiParameters( - parseAbiParameters( - 'address, uint8, address, address, uint256, bytes32, address, bool, address', - ), - [ - clientAddress, - resolverType, - arbitrationProvider, - paymentToken, - BigInt(Math.floor(safetyValveDate / 1000)), - detailsHash, - WRAPPED_NATIVE_TOKEN, - requireVerification, - factoryAddress, - ], - ); - - return { type, data }; - }, - [ - clientAddress, - arbitrationProvider, - paymentToken, - safetyValveDate, - detailsHash, - WRAPPED_NATIVE_TOKEN, - requireVerification, - Escrow, - ], - ); - - const encodeInstantData = useCallback(() => { - if (!clientAddress) throw new Error('Invalid client address'); - if (!detailsHash) throw new Error('Invalid details hash'); - const type = stringToHex(Instant, { size: 32 }); - const data = encodeAbiParameters( - parseAbiParameters( - 'address, address, uint256, bytes32, address, uint256, uint256', - ), - [ - clientAddress, - paymentToken, - BigInt(Math.floor(deadline / 1000)), - detailsHash, - WRAPPED_NATIVE_TOKEN, - lateFee, - BigInt(lateFeeInterval), - ], - ); - - return { type, data }; - }, [ - clientAddress, - paymentToken, - deadline, - detailsHash, - WRAPPED_NATIVE_TOKEN, - lateFee, - lateFeeInterval, - Instant, - ]); - - const createInvoice = useCallback(async () => { - let type; - let data; - - if (chainId && allValid && paymentAddress && data && detailsHash && type) { - setLoading(true); - setTxHash(undefined); - - const factoryAddress = getInvoiceFactoryAddress(chainId); - - let paymentAmounts = [BigInt(0)]; - if (invoiceType === Escrow) { - const escrowInfo = encodeEscrowData(factoryAddress); - type = escrowInfo.type; - data = escrowInfo.data; - paymentAmounts = payments; - } else if (invoiceType === Instant) { - const instantInfo = encodeInstantData(); - type = instantInfo.type; - data = instantInfo.data; - paymentAmounts = [paymentDue]; - } - - const hash = await register( - factoryAddress, - walletClient, - paymentAddress, - paymentAmounts, - data, - type, - ).catch(registerError => { - logError({ registerError }); - setLoading(false); - throw registerError; - }); - - setTxHash(hash); - setLoading(false); - - const paymentTotal = sum(paymentAmounts); - - track('InvoiceCreated', { - chain: chainId ?? -1, - invoiceType, - paymentToken, - paymentTotal, - }); - } else { - logError( - `unable to create invoice: allValid: ${allValid}, detailsHash: ${detailsHash}`, - ); - } - }, [ - allValid, - detailsHash, - chainId, - invoiceType, - Escrow, - Instant, - walletClient, - paymentAddress, - paymentToken, - encodeEscrowData, - payments, - encodeInstantData, - paymentDue, - ]); - - useEffect(() => { - if (invoiceType === Escrow) { - if (currentStep === 1) { - setNextStepEnabled(step1Valid); - } else if (currentStep === 2) { - setNextStepEnabled(escrowStep2Valid); - } else if (currentStep === 3) { - setNextStepEnabled(escrowStep3Valid); - } else if (currentStep === 4) { - setNextStepEnabled(true); - } else { - setNextStepEnabled(false); - } - } - - if (invoiceType === Instant) { - if (currentStep === 1) { - setNextStepEnabled(step1Valid); - } else if (currentStep === 2) { - setNextStepEnabled(instantStep2Valid); - } else if (currentStep === 3) { - setNextStepEnabled(true); - } - } - }, [ - step1Valid, - escrowStep2Valid, - escrowStep3Valid, - instantStep2Valid, - currentStep, - invoiceType, - Escrow, - Instant, - ]); - - const goBackHandler = useCallback( - () => setStep((prevState: any) => prevState - 1), - [setStep], - ); - - const nextStepHandler = useCallback(() => { - let maxStep; - switch (invoiceType) { - case Escrow: - maxStep = Object.keys(ESCROW_STEPS).length; - break; - case Instant: - maxStep = Object.keys(INSTANT_STEPS).length; - break; - default: - maxStep = 0; - } - if (nextStepEnabled) { - if (currentStep === maxStep) return createInvoice(); - setStep((prevState: any) => prevState + 1); - } - return () => undefined; - }, [ - nextStepEnabled, - currentStep, - invoiceType, - createInvoice, - Escrow, - Instant, - ]); - - const returnValue = useMemo( - () => ({ - projectName, - projectDescription, - projectAgreement, - projectAgreementSource, - projectAgreementLinkType, - startDate, - endDate, - safetyValveDate, - clientAddress, - paymentAddress, - paymentDue, - paymentToken, - milestones, - termsAccepted, - arbitrationProvider, - payments, - txHash, - invoiceType, - deadline, - lateFee, - lateFeeInterval, - // setters - setProjectName, - setProjectDescription, - setProjectAgreement, - setProjectAgreementSource, - setProjectAgreementLinkType, - setStartDate, - setEndDate, - setSafetyValveDate, - setClientAddress, - setPaymentAddress, - setPaymentDue, - setPaymentToken, - setMilestones, - setTermsAccepted, - setArbitrationProvider, - setPayments, - setInvoiceType, - setDeadline, - setLateFee, - setLateFeeInterval, - // creating invoice - loading, - createInvoice, - // stepHandling - currentStep, - nextStepEnabled, - goBackHandler, - nextStepHandler, - }), - [ - projectName, - projectDescription, - projectAgreement, - projectAgreementSource, - projectAgreementLinkType, - startDate, - endDate, - safetyValveDate, - clientAddress, - paymentAddress, - paymentDue, - paymentToken, - milestones, - termsAccepted, - arbitrationProvider, - payments, - txHash, - invoiceType, - deadline, - lateFee, - lateFeeInterval, - // setters - setProjectName, - setProjectDescription, - setProjectAgreement, - setProjectAgreementSource, - setProjectAgreementLinkType, - setStartDate, - setEndDate, - setSafetyValveDate, - setClientAddress, - setPaymentAddress, - setPaymentDue, - setPaymentToken, - setMilestones, - setTermsAccepted, - setArbitrationProvider, - setPayments, - setInvoiceType, - setDeadline, - setLateFee, - setLateFeeInterval, - // creating invoice - loading, - createInvoice, - // stepHandling - currentStep, - nextStepEnabled, - goBackHandler, - nextStepHandler, - ], - ); - - return ( - - {children} - - ); -}; diff --git a/packages/dapp/src/context/create-hooks/useCreateEscrow.tsx b/packages/dapp/src/context/create-hooks/useCreateEscrow.tsx deleted file mode 100644 index 8bdad9b5..00000000 --- a/packages/dapp/src/context/create-hooks/useCreateEscrow.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { useEffect, useMemo } from 'react'; -import { isAddress } from '../../utils/helpers'; -import { Address } from 'viem'; - -export function useCreateEscrow({ - step1Valid, - allValid, - clientAddress, - paymentAddress, - payments, - paymentToken, - paymentDue, - milestones, - termsAccepted, - arbitrationProvider, - setAllValid, -}: { - step1Valid: boolean; - allValid: boolean; - clientAddress?: Address; - paymentAddress?: Address; - paymentToken?: Address; - payments: bigint[]; - paymentDue: bigint; - milestones: number; - termsAccepted: boolean; - arbitrationProvider?: Address; - // eslint-disable-next-line no-unused-vars - setAllValid: (valid: boolean) => void; -}) { - const escrowStep2Valid = useMemo( - () => - isAddress(clientAddress) && - isAddress(paymentAddress) && - isAddress(paymentToken) && - isAddress(arbitrationProvider) && - paymentDue > 0 && - milestones > 0 && - termsAccepted && - Array.from( - new Set([ - clientAddress?.toLowerCase(), - paymentAddress?.toLowerCase(), - paymentToken?.toLowerCase(), - arbitrationProvider?.toLowerCase(), - ]), - ).length === 4, - [ - clientAddress, - paymentAddress, - paymentToken, - arbitrationProvider, - paymentDue, - milestones, - termsAccepted, - ], - ); - - const escrowStep3Valid = useMemo( - () => payments.reduce((t, a) => t + a, BigInt(0)) === paymentDue, - [payments, paymentDue], - ); - - useEffect(() => { - if (step1Valid && escrowStep2Valid && escrowStep3Valid) { - setAllValid(true); - } - }, [step1Valid, escrowStep2Valid, escrowStep3Valid, allValid, setAllValid]); - - return { escrowStep2Valid, escrowStep3Valid }; -} diff --git a/packages/dapp/src/context/create-hooks/useCreateInstant.tsx b/packages/dapp/src/context/create-hooks/useCreateInstant.tsx deleted file mode 100644 index b177ec2f..00000000 --- a/packages/dapp/src/context/create-hooks/useCreateInstant.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { useEffect, useMemo } from 'react'; -import { isAddress } from '../../utils'; -import { Address } from 'viem'; - -export function useCreateInstant({ - step1Valid, - allValid, - clientAddress, - paymentAddress, - paymentToken, - paymentDue, - milestones, - setAllValid, -}: { - step1Valid: boolean; - allValid: boolean; - clientAddress?: Address; - paymentAddress?: Address; - paymentToken?: Address; - paymentDue: bigint; - milestones: number; - // eslint-disable-next-line no-unused-vars - setAllValid: (valid: boolean) => void; -}) { - const instantStep2Valid = useMemo( - () => - isAddress(clientAddress) && - isAddress(paymentAddress) && - isAddress(paymentToken) && - paymentDue > 0 && - milestones > 0 && - Array.from( - new Set([ - clientAddress?.toLowerCase(), - paymentAddress?.toLowerCase(), - paymentToken?.toLowerCase(), - ]), - ).length === 3, - [clientAddress, paymentAddress, paymentToken, paymentDue, milestones], - ); - - useEffect(() => { - if (step1Valid && instantStep2Valid) { - setAllValid(true); - } - }, [step1Valid, instantStep2Valid, allValid, setAllValid]); - - return { instantStep2Valid }; -} diff --git a/packages/dapp/src/types/index.ts b/packages/dapp/src/types/index.ts deleted file mode 100644 index 8feafddb..00000000 --- a/packages/dapp/src/types/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './network'; -export * from './tokendata'; diff --git a/packages/dapp/src/utils/contracts.ts b/packages/dapp/src/utils/contracts.ts deleted file mode 100644 index 6d7ba91a..00000000 --- a/packages/dapp/src/utils/contracts.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { - AbiEvent, - AbiFunction, - AbiParametersToPrimitiveTypes, - ExtractAbiEvent, - ExtractAbiEventNames, - ExtractAbiFunction, - ExtractAbiFunctionNames, -} from 'abitype'; -import { - Abi, - Address, - Chain, - Hash, - WalletClient, - createPublicClient, - decodeEventLog, - http, - isAddress, -} from 'viem'; - -import { waitForTransaction } from '@wagmi/core'; - -export const readContract = async < - TAbi extends Abi, - TFunctionName extends ExtractAbiFunctionNames, - TAbiFunction extends AbiFunction = ExtractAbiFunction, ->(config: { - abi: TAbi; - address: Address; - chain: Chain; - functionName: TFunctionName | ExtractAbiFunctionNames; - args: AbiParametersToPrimitiveTypes; -}): Promise< - AbiParametersToPrimitiveTypes -> => { - const { abi, address, chain, functionName, args } = config; - const publicClient = createPublicClient({ - chain, - transport: http(), - }); - - return publicClient.readContract({ - abi: abi as Abi, - address: address as Address, - functionName: functionName as ExtractAbiFunctionNames, - args: args as any, - }) as AbiParametersToPrimitiveTypes; -}; - -export const readEvent = async < - TAbi extends Abi, - TEventName extends `0x${string}` | ExtractAbiEventNames, - TAbiEvent extends AbiEvent = ExtractAbiEvent, ->(config: { - abi: TAbi; - chainId: number; - hash: Hash; - name: TEventName; - // ... -}): Promise> => { - const { abi, chainId, hash, name } = config; - const receipt = await waitForTransaction({ chainId, hash }); - const eventLog = receipt.logs.find(log => log.topics[0] === name); - if (!eventLog) - throw new Error(`Event ${name} not found in transaction ${hash}`); - const { data, topics } = eventLog; - return decodeEventLog({ - abi, - data, - topics, - }) as AbiParametersToPrimitiveTypes; -}; - -export const writeContract = async < - TAbi extends Abi, - TFunctionName extends ExtractAbiFunctionNames, - TAbiFunction extends AbiFunction = ExtractAbiFunction, ->(config: { - abi: TAbi; - address: Address; - walletClient: WalletClient; - functionName: - | TFunctionName - | ExtractAbiFunctionNames; - args: AbiParametersToPrimitiveTypes; -}): Promise => { - const { abi, address, walletClient, functionName, args } = config; - if (!walletClient.account?.address) throw new Error('Invalid account'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - if (!isAddress(walletClient.account.address)) - throw new Error('Invalid wallet client'); - - const publicClient = createPublicClient({ - chain: walletClient.chain, - transport: http(), - }); - - const { request } = await publicClient.simulateContract({ - account: walletClient.account.address, - address, - abi, - functionName, - args, - } as any); - - return walletClient.writeContract(request); -}; diff --git a/packages/dapp/src/utils/erc20.ts b/packages/dapp/src/utils/erc20.ts deleted file mode 100644 index be888e23..00000000 --- a/packages/dapp/src/utils/erc20.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Address, Chain, WalletClient } from 'viem'; - -import { IERC20Abi } from '../abi'; -import { readContract, writeContract } from './contracts'; - -export const approve = async ( - walletClient: WalletClient, - token: Address, - spender: Address, - amount: bigint, -) => - writeContract({ - abi: IERC20Abi, - address: token, - walletClient, - functionName: 'approve', - args: [spender, amount], - }); - -export const transfer = async ( - walletClient: WalletClient, - token: Address, - recipient: Address, - amount: bigint, -) => - writeContract({ - abi: IERC20Abi, - address: token, - walletClient, - functionName: 'transfer', - args: [recipient, amount], - }); - -export const balanceOf = async ( - chain: Chain, - token: Address, - address: Address, -) => { - const [balance] = await readContract({ - abi: IERC20Abi, - address: token, - chain, - functionName: 'balanceOf', - args: [address], - }); - return balance; -}; - -export const getAllowance = async ( - chain: Chain, - token: Address, - owner: Address, - spender: Address, -) => { - const [allowance] = await readContract({ - abi: IERC20Abi, - address: token, - chain, - functionName: 'allowance', - args: [owner, spender], - }); - return allowance; -}; diff --git a/packages/dapp/src/utils/invoice.ts b/packages/dapp/src/utils/invoice.ts deleted file mode 100644 index 0cda00c4..00000000 --- a/packages/dapp/src/utils/invoice.ts +++ /dev/null @@ -1,331 +0,0 @@ -import { - Address, - Chain, - Hash, - Hex, - WalletClient, - isAddress, - isHex, -} from 'viem'; - -import { - ISmartInvoiceEscrowAbi, - ISmartInvoiceFactoryAbi, - ISmartInvoiceInstantAbi, -} from '../abi'; -import { readContract, readEvent, writeContract } from './contracts'; -import { getInvoiceFactoryAddress, logError } from './helpers'; - -export const register = async ( - address: Address, - walletClient: WalletClient, - recipient: Address, - amounts: bigint[], - data: Hex, - type: Hex, -) => { - if (!walletClient) throw new Error('Invalid wallet client'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - if (!isAddress(recipient)) throw new Error('Invalid recipient'); - if (!Array.isArray(amounts)) throw new Error('Invalid amounts'); - if (!isHex(data)) throw new Error('Invalid data'); - if (!isHex(type)) throw new Error('Invalid type'); - - return writeContract({ - abi: ISmartInvoiceFactoryAbi, - address, - walletClient, - functionName: 'create', - args: [recipient, amounts, data, type], - }); -}; - -export const awaitInvoiceAddress = async (chainId: number, hash: Hash) => { - // const receipt = await waitForTransaction({ chainId: chain.id, hash }); - const abi = ISmartInvoiceFactoryAbi; - const [, address, , ,] = await readEvent({ - abi, - chainId, - hash, - name: 'LogNewInvoice', - }); - // const eventFragment = abi.events[Object.keys(abi.events)[0]]; - // const eventTopic = abi.getEventTopic(eventFragment); - // const event = receipt.logs.find((e) => e.topics[0] === eventTopic); - // if (event) { - // const decodedLog = abi.decodeEventLog( - // eventFragment, - // event.data, - // event.topics, - // ); - // return decodedLog.invoice; - // } - return address; -}; - -export const getResolutionRateFromFactory = async ( - chain: Chain, - resolver: Address, - defaultValue: number = 20, -) => { - if (!isAddress(resolver)) return defaultValue; - try { - const address = getInvoiceFactoryAddress(chain.id); - const [resolutionRate] = await readContract({ - abi: ISmartInvoiceFactoryAbi, - address, - chain, - functionName: 'resolutionRateOf', - args: [resolver], - }); - return resolutionRate > 0 ? Number(resolutionRate) : defaultValue; - } catch (resolutionRateError) { - logError({ resolutionRateError }); - return defaultValue; - } -}; - -export const release = async (walletClient: WalletClient, address: Address) => { - if (!walletClient) throw new Error('Invalid wallet client'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - - return writeContract({ - abi: ISmartInvoiceEscrowAbi, - address, - walletClient, - functionName: 'release', - args: [], - }); -}; - -export const withdraw = async ( - walletClient: WalletClient, - address: Address, -) => { - if (!walletClient) throw new Error('Invalid wallet client'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - - return writeContract({ - abi: ISmartInvoiceEscrowAbi, - address, - walletClient, - functionName: 'withdraw', - args: [], - }); -}; - -export const lock = async ( - walletClient: WalletClient, - address: Address, - detailsHash: Hash, // 32 bits hex -) => { - if (!walletClient) throw new Error('Invalid wallet client'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - if (!isHex(detailsHash)) throw new Error('Invalid details hash'); - - return writeContract({ - abi: ISmartInvoiceEscrowAbi, - address, - walletClient, - functionName: 'lock', - args: [detailsHash], - }); -}; - -export const resolve = async ( - walletClient: WalletClient, - address: Address, - clientAward: any, - providerAward: any, - detailsHash: Hash, // 32 bits hex -) => { - if (!walletClient) throw new Error('Invalid wallet client'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - if (!isHex(detailsHash)) throw new Error('Invalid details hash'); - - return writeContract({ - abi: ISmartInvoiceEscrowAbi, - address, - walletClient, - functionName: 'resolve', - args: [clientAward, providerAward, detailsHash], - }); -}; - -export const addMilestones = async ( - walletClient: WalletClient, - address: Address, - amounts: bigint[], -) => { - if (!walletClient) throw new Error('Invalid wallet client'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - if (!Array.isArray(amounts)) throw new Error('Invalid amounts'); - - return writeContract({ - abi: ISmartInvoiceEscrowAbi, - address, - walletClient, - functionName: 'addMilestones', - args: [amounts], - }); -}; - -export const addMilestonesWithDetails = async ( - walletClient: WalletClient, - address: Address, - amounts: bigint[], - details: Hex, -) => { - if (!walletClient) throw new Error('Invalid wallet client'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - if (!Array.isArray(amounts)) throw new Error('Invalid amounts'); - if (!isHex(details)) throw new Error('Invalid details'); - - return writeContract({ - abi: ISmartInvoiceEscrowAbi, - address, - walletClient, - functionName: 'addMilestones', - args: [amounts, details], - }); -}; - -export const verify = async (walletClient: WalletClient, address: Address) => { - if (!walletClient) throw new Error('Invalid wallet client'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - - return writeContract({ - abi: ISmartInvoiceEscrowAbi, - address, - walletClient, - functionName: 'verify', - args: [], - }); -}; - -// Functions for Instant type -export const getTotalDue = async (chain: Chain, address: Address) => { - if (!chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - - const [totalDue] = await readContract({ - abi: ISmartInvoiceInstantAbi, - address, - chain, - functionName: 'getTotalDue', - args: [], - }); - - return totalDue; -}; - -export const getTotalFulfilled = async (chain: Chain, address: Address) => { - if (!chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - - const [amount] = await readContract({ - abi: ISmartInvoiceInstantAbi, - address, - chain, - functionName: 'totalFulfilled', - args: [], - }); - - const [isFulfilled] = await readContract({ - abi: ISmartInvoiceInstantAbi, - address, - chain, - functionName: 'fulfilled', - args: [], - }); - - return { amount, isFulfilled }; -}; - -export const getDeadline = async (chain: Chain, address: Address) => { - if (!chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - - const [deadline] = await readContract({ - abi: ISmartInvoiceInstantAbi, - address, - chain, - functionName: 'deadline', - args: [], - }); - - return deadline; -}; - -export const getLateFee = async (chain: Chain, address: Address) => { - if (!chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - - const [amount] = await readContract({ - abi: ISmartInvoiceInstantAbi, - address, - chain, - functionName: 'lateFee', - args: [], - }); - - const [timeInterval] = await readContract({ - abi: ISmartInvoiceInstantAbi, - address, - chain, - functionName: 'lateFeeTimeInterval', - args: [], - }); - - return { amount, timeInterval }; -}; - -export const depositTokens = async ( - walletClient: WalletClient, - address: Address, - tokenAddress: Address, - amount: bigint, -) => { - if (!walletClient) throw new Error('Invalid wallet client'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - if (!isAddress(tokenAddress)) throw new Error('Invalid token address'); - if (amount <= 0) throw new Error('Invalid amount'); - - return writeContract({ - abi: ISmartInvoiceInstantAbi, - address, - walletClient, - functionName: 'depositTokens', - args: [tokenAddress, amount], - }); -}; - -export const tipTokens = async ( - walletClient: WalletClient, - address: Address, - tokenAddress: Address, - amount: bigint, -) => { - if (!walletClient) throw new Error('Invalid wallet client'); - if (!walletClient.chain) throw new Error('Invalid chain'); - if (!isAddress(address)) throw new Error('Invalid address'); - if (!isAddress(tokenAddress)) throw new Error('Invalid token address'); - if (amount <= 0) throw new Error('Invalid amount'); - - return writeContract({ - abi: ISmartInvoiceInstantAbi, - address, - walletClient, - functionName: 'tip', - args: [tokenAddress, amount], - }); -}; diff --git a/packages/forms/package.json b/packages/forms/package.json new file mode 100644 index 00000000..8fcf5015 --- /dev/null +++ b/packages/forms/package.json @@ -0,0 +1,29 @@ +{ + "name": "@smart-invoice/forms", + "version": "1.0.0", + "description": "", + "main": "src/index.ts", + "scripts": { + "build": "tsc", + "publish": "npm publish --access public", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "@smart-invoice/constants": "*", + "@smart-invoice/graphql": "*", + "@smart-invoice/types": "*", + "@smart-invoice/ui": "*", + "@smart-invoice/utils": "*", + "@chakra-ui/icon": "^3.2.0", + "@chakra-ui/react": "^2.8.2", + "react": "^18.2.0", + "viem": "^2.3.1", + "wagmi": "^1.4.13" + }, + "devDependencies": { + "@types/react": "^18.2.47" + } +} diff --git a/packages/dapp/src/components/AddMilestones.tsx b/packages/forms/src/AddMilestones.tsx similarity index 88% rename from packages/dapp/src/components/AddMilestones.tsx rename to packages/forms/src/AddMilestones.tsx index 04adf040..109c7b3c 100644 --- a/packages/dapp/src/components/AddMilestones.tsx +++ b/packages/forms/src/AddMilestones.tsx @@ -24,9 +24,9 @@ import { useBreakpointValue, } from '@chakra-ui/react'; -import { ChainId } from '../constants/config'; -import { OrderedInput, OrderedLinkInput } from '../shared/OrderedInput'; -import { TokenData } from '../types'; +import { ChainId } from '@smart-invoice/constants'; +import { OrderedInput } from '@smart-invoice/ui'; +import { TokenData } from '@smart-invoice/types'; import { calculateResolutionFeePercentage, getTokenInfo, @@ -34,11 +34,12 @@ import { isAddress, logDebug, logError, -} from '../utils/helpers'; -import { addMilestones, addMilestonesWithDetails } from '../utils/invoice'; -import { uploadMetadata } from '../utils/ipfs'; -import { waitForTransaction } from '../utils/transactions'; -import { Invoice } from '../graphql/fetchInvoice'; + // addMilestones, + // addMilestonesWithDetails, + uploadMetadata, + // waitForTransaction, +} from '@smart-invoice/utils'; +import { Invoice } from '@smart-invoice/graphql'; export type AddMilestonesProps = { invoice: Invoice; @@ -97,7 +98,7 @@ export function AddMilestones({ invoice, due, tokenData }: AddMilestonesProps) { if (!amounts) return; const totalAmounts = formatUnits( - amounts.reduce((a, b) => a + BigInt(b), BigInt(0)), + amounts.reduce((a: any, b: any) => a + BigInt(b), BigInt(0)), decimals, ); @@ -159,23 +160,23 @@ export function AddMilestones({ invoice, due, tokenData }: AddMilestonesProps) { const validAddress = isAddress(address); if (!validAddress) return; if (detailsHash) { - hash = await addMilestonesWithDetails( - walletClient, - validAddress, - milestoneAmounts, - detailsHash, - ); + hash = '0x'; // await addMilestonesWithDetails( + // walletClient, + // validAddress, + // milestoneAmounts, + // detailsHash, + // ); } else { - hash = await addMilestones( - walletClient, - validAddress, - milestoneAmounts, - ); + hash = '0x'; // await addMilestones( + // walletClient, + // validAddress, + // milestoneAmounts, + // ); } setTxHash(hash); const { chain } = walletClient; - await waitForTransaction(chain, hash); + // await waitForTransaction(chain, hash); window.location.href = `/invoice/${chain.id.toString(16)}/${address}`; } } catch (addMilestonesError) { @@ -198,14 +199,15 @@ export function AddMilestones({ invoice, due, tokenData }: AddMilestonesProps) { {revisedProjectAgreementType === 'ipfs' ? ( - +
+ // ) : ( '' )} diff --git a/packages/dapp/src/components/DepositFunds.tsx b/packages/forms/src/DepositFunds.tsx similarity index 95% rename from packages/dapp/src/components/DepositFunds.tsx rename to packages/forms/src/DepositFunds.tsx index 036ee49c..30b8e1fe 100644 --- a/packages/dapp/src/components/DepositFunds.tsx +++ b/packages/forms/src/DepositFunds.tsx @@ -22,10 +22,10 @@ import { useBreakpointValue, } from '@chakra-ui/react'; -import { ChainId } from '../constants/config'; -import { QuestionIcon } from '../icons/QuestionIcon'; -import { TokenData } from '../types'; -import { balanceOf, transfer } from '../utils/erc20'; +import { ChainId } from '@smart-invoice/constants'; +import { QuestionIcon } from '@smart-invoice/ui'; +import { TokenData } from '@smart-invoice/types'; +import { balanceOf, transfer } from '@smart-invoice/utils'; import { calculateResolutionFeePercentage, getNativeTokenSymbol, @@ -34,9 +34,9 @@ import { getWrappedNativeToken, isAddress, logError, -} from '../utils/helpers'; -import { waitForTransaction } from '../utils/transactions'; -import { Invoice } from '../graphql/fetchInvoice'; + // waitForTransaction +} from '@smart-invoice/utils'; +import { Invoice } from '@smart-invoice/graphql'; const getCheckedStatus = (deposited: bigint, validAmounts: bigint[]) => { let sum = BigInt(0); @@ -108,7 +108,7 @@ export const DepositFunds: React.FC = ({ } setTxHash(hash); const { chain } = walletClient; - await waitForTransaction(chain, hash); + // await waitForTransaction(chain, hash); window.location.href = `/invoice/${chain.id.toString(16)}/${address}`; } catch (e) { setLoading(false); @@ -175,7 +175,7 @@ export const DepositFunds: React.FC = ({ - {validAmounts.map((a, i) => ( + {validAmounts.map((a: any, i: any) => ( = ({ ? checkedAtIndex(i, checked) : checkedAtIndex(i - 1, checked); const totAmount = validAmounts.reduce( - (tot, cur, ind) => (newChecked[ind] ? tot + cur : tot), + (tot: any, cur: any, ind: any) => (newChecked[ind] ? tot + cur : tot), BigInt(0), ); const newAmount = diff --git a/packages/dapp/src/components/LockFunds.tsx b/packages/forms/src/LockFunds.tsx similarity index 100% rename from packages/dapp/src/components/LockFunds.tsx rename to packages/forms/src/LockFunds.tsx diff --git a/packages/dapp/src/components/PaymentChunksForm.tsx b/packages/forms/src/PaymentChunksForm.tsx similarity index 100% rename from packages/dapp/src/components/PaymentChunksForm.tsx rename to packages/forms/src/PaymentChunksForm.tsx diff --git a/packages/dapp/src/components/PaymentDetailsForm.tsx b/packages/forms/src/PaymentDetailsForm.tsx similarity index 100% rename from packages/dapp/src/components/PaymentDetailsForm.tsx rename to packages/forms/src/PaymentDetailsForm.tsx diff --git a/packages/dapp/src/components/ProjectDetailsForm.tsx b/packages/forms/src/ProjectDetailsForm.tsx similarity index 100% rename from packages/dapp/src/components/ProjectDetailsForm.tsx rename to packages/forms/src/ProjectDetailsForm.tsx diff --git a/packages/dapp/src/components/ReleaseFunds.tsx b/packages/forms/src/ReleaseFunds.tsx similarity index 90% rename from packages/dapp/src/components/ReleaseFunds.tsx rename to packages/forms/src/ReleaseFunds.tsx index 6292b7a2..7d846704 100644 --- a/packages/dapp/src/components/ReleaseFunds.tsx +++ b/packages/forms/src/ReleaseFunds.tsx @@ -13,14 +13,13 @@ import { useBreakpointValue, useToast, } from '@chakra-ui/react'; -import { waitForTransaction } from '@wagmi/core'; +import { waitForTransaction } from 'wagmi/actions'; -import { ChainId } from '../constants/config'; -import { QuestionIcon } from '../icons/QuestionIcon'; -import { TokenData } from '../types'; -import { getTokenInfo, getTxLink, isAddress, logError } from '../utils/helpers'; -import { release } from '../utils/invoice'; -import { Invoice } from '../graphql/fetchInvoice'; +import { ChainId } from '@smart-invoice/constants'; +import { Invoice } from '@smart-invoice/graphql'; +import { TokenData } from '@smart-invoice/types'; +import { QuestionIcon } from '@smart-invoice/ui'; +import { getTokenInfo, getTxLink, isAddress, logError } from '@smart-invoice/utils'; const getReleaseAmount = ( currentMilestone: number, @@ -62,7 +61,7 @@ export function ReleaseFunds({ token, provider: recipient, } = invoice ?? {}; - const validAmounts = amounts?.map(a => BigInt(a)); + const validAmounts = amounts?.map((a: any) => BigInt(a)); const validAddress = isAddress(address); const amount = validAmounts @@ -78,7 +77,7 @@ export function ReleaseFunds({ if (loading || !walletClient || !chainId || !validAddress) return; try { setLoading(true); - const hash = await release(walletClient, validAddress); + const hash = '0x'; // await release(walletClient, validAddress); // TODO fix setTxHash(hash); const txReceipt = await waitForTransaction({ chainId, hash }); setLoading(false); diff --git a/packages/dapp/src/components/ResolveFunds.tsx b/packages/forms/src/ResolveFunds.tsx similarity index 100% rename from packages/dapp/src/components/ResolveFunds.tsx rename to packages/forms/src/ResolveFunds.tsx diff --git a/packages/dapp/src/components/WithdrawFunds.tsx b/packages/forms/src/WithdrawFunds.tsx similarity index 100% rename from packages/dapp/src/components/WithdrawFunds.tsx rename to packages/forms/src/WithdrawFunds.tsx diff --git a/packages/forms/src/index.ts b/packages/forms/src/index.ts new file mode 100644 index 00000000..c11ca50e --- /dev/null +++ b/packages/forms/src/index.ts @@ -0,0 +1,9 @@ +export * from './AddMilestones'; +export * from './DepositFunds'; +export * from './LockFunds'; +export * from './PaymentChunksForm'; +export * from './PaymentDetailsForm'; +export * from './ProjectDetailsForm'; +export * from './ReleaseFunds'; +export * from './ResolveFunds'; +export * from './WithdrawFunds'; \ No newline at end of file diff --git a/packages/forms/tsconfig.json b/packages/forms/tsconfig.json new file mode 100644 index 00000000..0a56d933 --- /dev/null +++ b/packages/forms/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "target": "ES2020", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "ESNext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../../jest.config.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/graphql/package.json b/packages/graphql/package.json new file mode 100644 index 00000000..99031527 --- /dev/null +++ b/packages/graphql/package.json @@ -0,0 +1,19 @@ +{ + "name": "@smart-invoice/graphql", + "version": "1.0.0", + "description": "", + "main": "src/index.ts", + "scripts": { + "build": "tsc", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "dependencies": { + "@smart-invoice/constants": "*", + "@smart-invoice/utils": "*", + "@apollo/client": "^3.8.10", + "graphql-request": "^6.1.0", + "graphql-tag": "^2.12.6", + "graphql-zeus": "^5.3.3", + "viem": "^2.3.1" + } +} diff --git a/packages/dapp/src/graphql/client.ts b/packages/graphql/src/client.ts similarity index 76% rename from packages/dapp/src/graphql/client.ts rename to packages/graphql/src/client.ts index cdf6b7ee..fb4267e3 100644 --- a/packages/dapp/src/graphql/client.ts +++ b/packages/graphql/src/client.ts @@ -4,8 +4,8 @@ import { NormalizedCacheObject, } from '@apollo/client'; -import { SUPPORTED_NETWORKS } from '../constants'; -import { getGraphUrl } from '../utils/helpers'; +import { SUPPORTED_NETWORKS } from '@smart-invoice/constants'; +import { getGraphUrl } from '@smart-invoice/utils'; const cache = new InMemoryCache(); diff --git a/packages/dapp/src/graphql/fragments.ts b/packages/graphql/src/fragments.ts similarity index 100% rename from packages/dapp/src/graphql/fragments.ts rename to packages/graphql/src/fragments.ts diff --git a/packages/graphql/src/index.ts b/packages/graphql/src/index.ts new file mode 100644 index 00000000..37a5eecc --- /dev/null +++ b/packages/graphql/src/index.ts @@ -0,0 +1,5 @@ +export * from './client'; +// export * from './fragments'; +export * from './invoice'; +export * from './invoices'; +export * from './scalars'; diff --git a/packages/dapp/src/graphql/fetchInvoice.ts b/packages/graphql/src/invoice.ts similarity index 98% rename from packages/dapp/src/graphql/fetchInvoice.ts rename to packages/graphql/src/invoice.ts index 898bf969..f0e337fb 100644 --- a/packages/dapp/src/graphql/fetchInvoice.ts +++ b/packages/graphql/src/invoice.ts @@ -1,7 +1,7 @@ /* eslint-disable camelcase */ import { Address } from 'viem'; -import { isAddress, logDebug } from '../utils/helpers'; +import { isAddress, logDebug } from '../../utils/helpers'; import { clients } from './client'; import { typedGql } from './zeus/typedDocumentNode'; import { diff --git a/packages/dapp/src/graphql/fetchInvoices.ts b/packages/graphql/src/invoices.ts similarity index 90% rename from packages/dapp/src/graphql/fetchInvoices.ts rename to packages/graphql/src/invoices.ts index 45c76d15..98e6e21e 100644 --- a/packages/dapp/src/graphql/fetchInvoices.ts +++ b/packages/graphql/src/invoices.ts @@ -6,7 +6,7 @@ import { Address, isAddress } from 'viem'; import { typedGql } from './zeus/typedDocumentNode'; import { Invoice_orderBy, OrderDirection, _SubgraphErrorPolicy_ } from './zeus'; import { clients } from './client'; -import { logDebug } from '../utils'; +import { logDebug } from '../../utils'; import { scalars } from './scalars'; export type SearchInputType = string | Address | undefined; @@ -105,8 +105,8 @@ export const fetchInvoices = async ( return data.invoices; }; -type GetElementType = T extends (infer U)[] - ? U - : never; -type Invoices = Awaited>; -export type Invoice = GetElementType; +// type GetElementType = T extends (infer U)[] +// ? U +// : never; +// type Invoices = Awaited>; +// export type Invoice = GetElementType; diff --git a/packages/dapp/src/graphql/scalars.ts b/packages/graphql/src/scalars.ts similarity index 68% rename from packages/dapp/src/graphql/scalars.ts rename to packages/graphql/src/scalars.ts index adc2f4a9..1f907893 100644 --- a/packages/dapp/src/graphql/scalars.ts +++ b/packages/graphql/src/scalars.ts @@ -1,10 +1,9 @@ -import BigNumber from 'bignumber.js'; import { ZeusScalars } from './zeus'; export const scalars = ZeusScalars({ BigDecimal: { - encode: (e: unknown) => (e as BigNumber).toString(), - decode: (e: unknown) => BigNumber(e as string), + encode: (e: unknown) => (e as bigint).toString(), + decode: (e: unknown) => BigInt(e as string), }, BigInt: { encode: (e: unknown) => (e as bigint).toString(16), diff --git a/packages/dapp/src/graphql/schema.graphql b/packages/graphql/src/schema.graphql similarity index 100% rename from packages/dapp/src/graphql/schema.graphql rename to packages/graphql/src/schema.graphql diff --git a/packages/dapp/src/graphql/zeus/const.ts b/packages/graphql/src/zeus/const.ts similarity index 100% rename from packages/dapp/src/graphql/zeus/const.ts rename to packages/graphql/src/zeus/const.ts diff --git a/packages/dapp/src/graphql/zeus/index.ts b/packages/graphql/src/zeus/index.ts similarity index 100% rename from packages/dapp/src/graphql/zeus/index.ts rename to packages/graphql/src/zeus/index.ts diff --git a/packages/dapp/src/graphql/zeus/typedDocumentNode.ts b/packages/graphql/src/zeus/typedDocumentNode.ts similarity index 100% rename from packages/dapp/src/graphql/zeus/typedDocumentNode.ts rename to packages/graphql/src/zeus/typedDocumentNode.ts diff --git a/packages/hooks/package.json b/packages/hooks/package.json new file mode 100644 index 00000000..f3f7d43b --- /dev/null +++ b/packages/hooks/package.json @@ -0,0 +1,19 @@ +{ + "name": "@smart-invoice/hooks", + "version": "1.0.0", + "description": "", + "main": "src/index.ts", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "dependencies": { + "@smart-invoice/constants": "*", + "@smart-invoice/types": "*", + "@smart-invoice/utils": "*", + "react": "^18.2.0", + "viem": "^1.21.4" + }, + "devDependencies": { + "@types/react": "^18.2.47" + } +} diff --git a/packages/hooks/src/index.ts b/packages/hooks/src/index.ts new file mode 100644 index 00000000..813722f6 --- /dev/null +++ b/packages/hooks/src/index.ts @@ -0,0 +1,2 @@ +export { useFetchTokensViaIPFS } from './useFetchTokensViaIPFS'; +export { useInvoiceStatus } from './useInvoiceStatus'; diff --git a/packages/dapp/src/hooks/useFetchTokensViaIPFS.ts b/packages/hooks/src/useFetchTokensViaIPFS.ts similarity index 81% rename from packages/dapp/src/hooks/useFetchTokensViaIPFS.ts rename to packages/hooks/src/useFetchTokensViaIPFS.ts index 71c7162f..57b67644 100644 --- a/packages/dapp/src/hooks/useFetchTokensViaIPFS.ts +++ b/packages/hooks/src/useFetchTokensViaIPFS.ts @@ -1,11 +1,10 @@ import { useEffect, useState } from 'react'; import { Address } from 'viem'; -import { IPFS_ENDPOINT } from '../constants'; -import { ChainId } from '../constants/config'; -import { TokenData } from '../types'; -import { getCID } from '../utils/firebase'; -import { formatTokenData, formatTokens } from '../utils/helpers'; +import { IPFS_ENDPOINT, ChainId } from '@smart-invoice/constants'; +import { TokenData } from '@smart-invoice/types'; +import { getCID } from '@smart-invoice/utils/firebase'; +import { formatTokenData, formatTokens } from '@smart-invoice/utils/helpers'; export const useFetchTokensViaIPFS = () => { const [tokenData, setTokenData] = useState( diff --git a/packages/dapp/src/hooks/useInvoiceStatus.tsx b/packages/hooks/src/useInvoiceStatus.tsx similarity index 93% rename from packages/dapp/src/hooks/useInvoiceStatus.tsx rename to packages/hooks/src/useInvoiceStatus.tsx index 9709ec79..212e7e56 100644 --- a/packages/dapp/src/hooks/useInvoiceStatus.tsx +++ b/packages/hooks/src/useInvoiceStatus.tsx @@ -1,14 +1,14 @@ import { useEffect, useState } from 'react'; -import { balanceOf } from '../utils/erc20'; -import { isAddress, logError } from '../utils/helpers'; -import { getDeadline, getTotalFulfilled } from '../utils/invoice'; +import { balanceOf } from '../dapp/src/utils/erc20'; +import { isAddress, logError } from '../dapp/src/utils/helpers'; +import { getDeadline, getTotalFulfilled } from '../dapp/src/utils/invoice'; import { Address, Chain, useWalletClient } from 'wagmi'; import { Invoice } from '../graphql/fetchInvoice'; export const useInvoiceStatus = (invoice: Invoice) => { const { data: walletClient } = useWalletClient(); - const {chain} = walletClient ?? {}; + const { chain } = walletClient ?? {}; const [loading, setLoading] = useState(true); const [funded, setFunded] = useState(false); diff --git a/packages/hooks/tsconfig.json b/packages/hooks/tsconfig.json new file mode 100644 index 00000000..0a56d933 --- /dev/null +++ b/packages/hooks/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "target": "ES2020", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "ESNext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../../jest.config.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/types/package.json b/packages/types/package.json new file mode 100644 index 00000000..cf745780 --- /dev/null +++ b/packages/types/package.json @@ -0,0 +1,13 @@ +{ + "name": "@smart-invoice/types", + "version": "1.0.0", + "description": "", + "main": "src/index.ts", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "devDependencies": { + "@types/node": "^14.14.31", + "typescript": "^4.2.3" + } +} diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts new file mode 100644 index 00000000..4a906330 --- /dev/null +++ b/packages/types/src/index.ts @@ -0,0 +1,2 @@ +export * from './network'; +export * from './token'; diff --git a/packages/dapp/src/types/network.ts b/packages/types/src/network.ts similarity index 100% rename from packages/dapp/src/types/network.ts rename to packages/types/src/network.ts diff --git a/packages/dapp/src/types/tokendata.ts b/packages/types/src/token.ts similarity index 100% rename from packages/dapp/src/types/tokendata.ts rename to packages/types/src/token.ts diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json new file mode 100644 index 00000000..0a56d933 --- /dev/null +++ b/packages/types/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "target": "ES2020", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "ESNext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../../jest.config.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/ui/package.json b/packages/ui/package.json new file mode 100644 index 00000000..23101ff6 --- /dev/null +++ b/packages/ui/package.json @@ -0,0 +1,25 @@ +{ + "name": "@smart-invoice/ui", + "version": "1.0.0", + "main": "src/index.ts", + "scripts": { + "build": "tsc", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "dependencies": { + "@chakra-ui/icon": "^3.2.0", + "@chakra-ui/react": "^2.8.2", + "@smart-invoice/constants": "*", + "@wagmi/core": "2.2.1", + "abitype": "^0.1.0", + "base-58": "^0.0.1", + "firebase": "^10.7.0", + "ipfs-http-client": "^50.1.2", + "react": "^18.2.0", + "viem": "2.3.1" + }, + "devDependencies": { + "@types/node": "20.11.5", + "@types/react": "^18.2.47" + } +} diff --git a/packages/dapp/src/components/ErrorBoundary.tsx b/packages/ui/src/components/ErrorBoundary.tsx similarity index 100% rename from packages/dapp/src/components/ErrorBoundary.tsx rename to packages/ui/src/components/ErrorBoundary.tsx diff --git a/packages/dapp/src/components/FormConfirmation.tsx b/packages/ui/src/components/FormConfirmation.tsx similarity index 100% rename from packages/dapp/src/components/FormConfirmation.tsx rename to packages/ui/src/components/FormConfirmation.tsx diff --git a/packages/dapp/src/components/GenerateInvoicePDF.tsx b/packages/ui/src/components/GenerateInvoicePDF.tsx similarity index 100% rename from packages/dapp/src/components/GenerateInvoicePDF.tsx rename to packages/ui/src/components/GenerateInvoicePDF.tsx diff --git a/packages/dapp/src/components/InvoiceBadge.tsx b/packages/ui/src/components/InvoiceBadge.tsx similarity index 100% rename from packages/dapp/src/components/InvoiceBadge.tsx rename to packages/ui/src/components/InvoiceBadge.tsx diff --git a/packages/dapp/src/components/InvoiceDashboardTable.tsx b/packages/ui/src/components/InvoiceDashboardTable.tsx similarity index 100% rename from packages/dapp/src/components/InvoiceDashboardTable.tsx rename to packages/ui/src/components/InvoiceDashboardTable.tsx diff --git a/packages/dapp/src/components/InvoicePDF.tsx b/packages/ui/src/components/InvoicePDF.tsx similarity index 100% rename from packages/dapp/src/components/InvoicePDF.tsx rename to packages/ui/src/components/InvoicePDF.tsx diff --git a/packages/dapp/src/components/InvoiceStatusLabel.tsx b/packages/ui/src/components/InvoiceStatusLabel.tsx similarity index 100% rename from packages/dapp/src/components/InvoiceStatusLabel.tsx rename to packages/ui/src/components/InvoiceStatusLabel.tsx diff --git a/packages/dapp/src/components/InvoicesStyles.tsx b/packages/ui/src/components/InvoicesStyles.tsx similarity index 100% rename from packages/dapp/src/components/InvoicesStyles.tsx rename to packages/ui/src/components/InvoicesStyles.tsx diff --git a/packages/dapp/src/components/Loader.tsx b/packages/ui/src/components/Loader.tsx similarity index 100% rename from packages/dapp/src/components/Loader.tsx rename to packages/ui/src/components/Loader.tsx diff --git a/packages/dapp/src/components/NetworkChangeAlertModal.tsx b/packages/ui/src/components/NetworkChangeAlertModal.tsx similarity index 100% rename from packages/dapp/src/components/NetworkChangeAlertModal.tsx rename to packages/ui/src/components/NetworkChangeAlertModal.tsx diff --git a/packages/dapp/src/components/RegisterSuccess.tsx b/packages/ui/src/components/RegisterSuccess.tsx similarity index 100% rename from packages/dapp/src/components/RegisterSuccess.tsx rename to packages/ui/src/components/RegisterSuccess.tsx diff --git a/packages/dapp/src/components/VerifyInvoice.tsx b/packages/ui/src/components/VerifyInvoice.tsx similarity index 100% rename from packages/dapp/src/components/VerifyInvoice.tsx rename to packages/ui/src/components/VerifyInvoice.tsx diff --git a/packages/dapp/src/components/WhatIsThisModal.tsx b/packages/ui/src/components/WhatIsThisModal.tsx similarity index 100% rename from packages/dapp/src/components/WhatIsThisModal.tsx rename to packages/ui/src/components/WhatIsThisModal.tsx diff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.ts new file mode 100644 index 00000000..98e157bc --- /dev/null +++ b/packages/ui/src/components/index.ts @@ -0,0 +1,13 @@ +export * from './ErrorBoundary'; +export * from './FormConfirmation'; +export * from './GenerateInvoicePDF'; +export * from './InvoiceBadge'; +export * from './InvoiceDashboardTable'; +export * from './InvoicePDF'; +export * from './InvoicesStyles'; +export * from './InvoiceStatusLabel'; +export * from './Loader'; +export * from './NetworkChangeAlertModal'; +export * from './RegisterSuccess'; +export * from './VerifyInvoice'; +export * from './WhatIsThisModal'; diff --git a/packages/dapp/src/components/instant/DepositFunds.tsx b/packages/ui/src/components/instant/DepositFunds.tsx similarity index 100% rename from packages/dapp/src/components/instant/DepositFunds.tsx rename to packages/ui/src/components/instant/DepositFunds.tsx diff --git a/packages/dapp/src/components/instant/FormConfirmation.tsx b/packages/ui/src/components/instant/FormConfirmation.tsx similarity index 100% rename from packages/dapp/src/components/instant/FormConfirmation.tsx rename to packages/ui/src/components/instant/FormConfirmation.tsx diff --git a/packages/dapp/src/components/instant/PaymentDetailsForm.tsx b/packages/ui/src/components/instant/PaymentDetailsForm.tsx similarity index 100% rename from packages/dapp/src/components/instant/PaymentDetailsForm.tsx rename to packages/ui/src/components/instant/PaymentDetailsForm.tsx diff --git a/packages/dapp/src/components/instant/ProjectDetailsForm.tsx b/packages/ui/src/components/instant/ProjectDetailsForm.tsx similarity index 100% rename from packages/dapp/src/components/instant/ProjectDetailsForm.tsx rename to packages/ui/src/components/instant/ProjectDetailsForm.tsx diff --git a/packages/dapp/src/components/instant/WithdrawFunds.tsx b/packages/ui/src/components/instant/WithdrawFunds.tsx similarity index 100% rename from packages/dapp/src/components/instant/WithdrawFunds.tsx rename to packages/ui/src/components/instant/WithdrawFunds.tsx diff --git a/packages/dapp/src/icons/ArrowIcons.tsx b/packages/ui/src/icons/ArrowIcons.tsx similarity index 100% rename from packages/dapp/src/icons/ArrowIcons.tsx rename to packages/ui/src/icons/ArrowIcons.tsx diff --git a/packages/dapp/src/icons/CopyIcon.tsx b/packages/ui/src/icons/CopyIcon.tsx similarity index 100% rename from packages/dapp/src/icons/CopyIcon.tsx rename to packages/ui/src/icons/CopyIcon.tsx diff --git a/packages/dapp/src/icons/FilterIcon.tsx b/packages/ui/src/icons/FilterIcon.tsx similarity index 100% rename from packages/dapp/src/icons/FilterIcon.tsx rename to packages/ui/src/icons/FilterIcon.tsx diff --git a/packages/dapp/src/icons/HamburgerIcon.tsx b/packages/ui/src/icons/HamburgerIcon.tsx similarity index 100% rename from packages/dapp/src/icons/HamburgerIcon.tsx rename to packages/ui/src/icons/HamburgerIcon.tsx diff --git a/packages/dapp/src/icons/QuestionIcon.tsx b/packages/ui/src/icons/QuestionIcon.tsx similarity index 100% rename from packages/dapp/src/icons/QuestionIcon.tsx rename to packages/ui/src/icons/QuestionIcon.tsx diff --git a/packages/dapp/src/icons/SearchIcon.tsx b/packages/ui/src/icons/SearchIcon.tsx similarity index 100% rename from packages/dapp/src/icons/SearchIcon.tsx rename to packages/ui/src/icons/SearchIcon.tsx diff --git a/packages/dapp/src/icons/VerticalDots.tsx b/packages/ui/src/icons/VerticalDots.tsx similarity index 100% rename from packages/dapp/src/icons/VerticalDots.tsx rename to packages/ui/src/icons/VerticalDots.tsx diff --git a/packages/dapp/src/icons/WalletFilledIcon.tsx b/packages/ui/src/icons/WalletFilledIcon.tsx similarity index 100% rename from packages/dapp/src/icons/WalletFilledIcon.tsx rename to packages/ui/src/icons/WalletFilledIcon.tsx diff --git a/packages/ui/src/icons/index.ts b/packages/ui/src/icons/index.ts new file mode 100644 index 00000000..9ee2a204 --- /dev/null +++ b/packages/ui/src/icons/index.ts @@ -0,0 +1,8 @@ +export * from './ArrowIcons'; +export * from './CopyIcon'; +export * from './FilterIcon'; +export * from './HamburgerIcon'; +export * from './QuestionIcon'; +export * from './SearchIcon'; +export * from './VerticalDots'; +export * from './WalletFilledIcon' \ No newline at end of file diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts new file mode 100644 index 00000000..627bb2e2 --- /dev/null +++ b/packages/ui/src/index.ts @@ -0,0 +1,4 @@ +export * from './components'; +export * from './icons'; +export * from './shared'; +export * from './theme'; \ No newline at end of file diff --git a/packages/dapp/src/shared/AccountLink.tsx b/packages/ui/src/shared/AccountLink.tsx similarity index 100% rename from packages/dapp/src/shared/AccountLink.tsx rename to packages/ui/src/shared/AccountLink.tsx diff --git a/packages/dapp/src/shared/ConnectWeb3.tsx b/packages/ui/src/shared/ConnectWeb3.tsx similarity index 100% rename from packages/dapp/src/shared/ConnectWeb3.tsx rename to packages/ui/src/shared/ConnectWeb3.tsx diff --git a/packages/dapp/src/shared/Container.tsx b/packages/ui/src/shared/Container.tsx similarity index 100% rename from packages/dapp/src/shared/Container.tsx rename to packages/ui/src/shared/Container.tsx diff --git a/packages/dapp/src/shared/Footer.tsx b/packages/ui/src/shared/Footer.tsx similarity index 100% rename from packages/dapp/src/shared/Footer.tsx rename to packages/ui/src/shared/Footer.tsx diff --git a/packages/dapp/src/shared/Header.tsx b/packages/ui/src/shared/Header.tsx similarity index 100% rename from packages/dapp/src/shared/Header.tsx rename to packages/ui/src/shared/Header.tsx diff --git a/packages/dapp/src/shared/InvoiceNotFound.tsx b/packages/ui/src/shared/InvoiceNotFound.tsx similarity index 100% rename from packages/dapp/src/shared/InvoiceNotFound.tsx rename to packages/ui/src/shared/InvoiceNotFound.tsx diff --git a/packages/dapp/src/shared/Layout.tsx b/packages/ui/src/shared/Layout.tsx similarity index 100% rename from packages/dapp/src/shared/Layout.tsx rename to packages/ui/src/shared/Layout.tsx diff --git a/packages/dapp/src/shared/OrderedInput.tsx b/packages/ui/src/shared/OrderedInput.tsx similarity index 100% rename from packages/dapp/src/shared/OrderedInput.tsx rename to packages/ui/src/shared/OrderedInput.tsx diff --git a/packages/dapp/src/shared/StepInfo.tsx b/packages/ui/src/shared/StepInfo.tsx similarity index 100% rename from packages/dapp/src/shared/StepInfo.tsx rename to packages/ui/src/shared/StepInfo.tsx diff --git a/packages/ui/src/shared/index.ts b/packages/ui/src/shared/index.ts new file mode 100644 index 00000000..a29cbc54 --- /dev/null +++ b/packages/ui/src/shared/index.ts @@ -0,0 +1,9 @@ +export { AccountLink } from './AccountLink'; +export { ConnectWeb3 } from './ConnectWeb3'; +export { Container } from './Container'; +export { Footer } from './Footer'; +export { Header } from './Header'; +export { InvoiceNotFound } from './InvoiceNotFound'; +export { Layout } from './Layout'; +export { OrderedInput } from './OrderedInput'; +export { StepInfo } from './StepInfo'; diff --git a/packages/dapp/src/theme/index.ts b/packages/ui/src/theme/index.ts similarity index 100% rename from packages/dapp/src/theme/index.ts rename to packages/ui/src/theme/index.ts diff --git a/packages/ui/tsconfig.json b/packages/ui/tsconfig.json new file mode 100644 index 00000000..0a56d933 --- /dev/null +++ b/packages/ui/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "target": "ES2020", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "ESNext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../../jest.config.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/utils/package.json b/packages/utils/package.json new file mode 100644 index 00000000..376b694c --- /dev/null +++ b/packages/utils/package.json @@ -0,0 +1,28 @@ +{ + "name": "@smart-invoice/utils", + "version": "1.0.0", + "description": "", + "main": "src/index.ts", + "scripts": { + "build": "tsc", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "dependencies": { + "@rainbow-me/rainbowkit": "^1.3.3", + "@smart-invoice/constants": "*", + "@smart-invoice/types": "*", + "@wagmi/core": "2.2.1", + "abitype": "^0.1.0", + "base-58": "^0.0.1", + "firebase": "^10.7.0", + "ipfs-http-client": "^50.1.2", + "viem": "2.3.1", + "wagmi": "^1.4.13" + }, + "devDependencies": { + "@types/node": "20.11.5" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/packages/dapp/src/utils/3box.ts b/packages/utils/src/3box.ts similarity index 100% rename from packages/dapp/src/utils/3box.ts rename to packages/utils/src/3box.ts diff --git a/packages/dapp/src/utils/compatibilityHelpers.ts b/packages/utils/src/compatibilityHelpers.ts similarity index 100% rename from packages/dapp/src/utils/compatibilityHelpers.ts rename to packages/utils/src/compatibilityHelpers.ts diff --git a/packages/utils/src/contracts.ts b/packages/utils/src/contracts.ts new file mode 100644 index 00000000..176e439a --- /dev/null +++ b/packages/utils/src/contracts.ts @@ -0,0 +1,114 @@ +import { + AbiEvent, + AbiFunction, + AbiParametersToPrimitiveTypes, + ExtractAbiEvent, + ExtractAbiEventNames, + ExtractAbiFunction, + ExtractAbiFunctionNames, +} from 'abitype'; +import { + Abi, + Address, + Chain, + Hash, + WalletClient, + createPublicClient, + decodeEventLog, + http, + isAddress, +} from 'viem'; + +import { waitForTransaction } from 'wagmi/actions'; + +export const testContracts = () => undefined; + +export const readContract = () => undefined; +export const readEvent = () => undefined; +export const writeContract = () => undefined; +// export const readContract = async < +// TAbi extends Abi, +// TFunctionName extends ExtractAbiFunctionNames, +// TAbiFunction extends AbiFunction = ExtractAbiFunction, +// >(config: { +// abi: TAbi; +// address: Address; +// chain: Chain; +// functionName: TFunctionName | ExtractAbiFunctionNames; +// args: AbiParametersToPrimitiveTypes; +// }): Promise< +// AbiParametersToPrimitiveTypes +// > => { +// const { abi, address, chain, functionName, args } = config; +// const publicClient = createPublicClient({ +// chain, +// transport: http(), +// }); + +// return publicClient.readContract({ +// abi: abi as Abi, +// address: address as Address, +// functionName: functionName as ExtractAbiFunctionNames, +// args: args as any, +// }) as AbiParametersToPrimitiveTypes; +// }; + +// export const readEvent = async < +// TAbi extends Abi, +// TEventName extends `0x${string}` | ExtractAbiEventNames, +// TAbiEvent extends AbiEvent = ExtractAbiEvent, +// >(config: { +// abi: TAbi; +// chainId: number; +// hash: Hash; +// name: TEventName; +// // ... +// }): Promise> => { +// const { abi, chainId, hash, name } = config; +// const receipt = await waitForTransaction({ chainId, hash }); +// const eventLog = receipt.logs.find(log => log.topics[0] === name); +// if (!eventLog) +// throw new Error(`Event ${name} not found in transaction ${hash}`); +// const { data, topics } = eventLog; +// return decodeEventLog({ +// abi, +// data, +// topics, +// }) as AbiParametersToPrimitiveTypes; +// }; + +// export const writeContract = async < +// TAbi extends Abi, +// TFunctionName extends ExtractAbiFunctionNames, +// TAbiFunction extends AbiFunction = ExtractAbiFunction, +// >(config: { +// abi: TAbi; +// address: Address; +// walletClient: WalletClient; +// functionName: +// | TFunctionName +// | ExtractAbiFunctionNames; +// args: AbiParametersToPrimitiveTypes; +// }): Promise => { +// const { abi, address, walletClient, functionName, args } = config; +// if (!walletClient.account?.address) throw new Error('Invalid account'); +// if (!walletClient.chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); +// if (!isAddress(walletClient.account.address)) +// throw new Error('Invalid wallet client'); + +// const publicClient = createPublicClient({ +// chain: walletClient.chain, +// transport: http(), +// }); + +// const { request } = await publicClient.simulateContract({ +// account: walletClient.account.address, +// address, +// abi, +// functionName, +// args, +// } as any); + +// return walletClient.writeContract(request); +// }; diff --git a/packages/utils/src/erc20.ts b/packages/utils/src/erc20.ts new file mode 100644 index 00000000..cdf90092 --- /dev/null +++ b/packages/utils/src/erc20.ts @@ -0,0 +1,63 @@ +import { Address, Chain, WalletClient } from 'viem'; + +import { IERC20Abi } from '@smart-invoice/constants'; +// import { readContract, writeContract } from './contracts'; + +export const approve = async ( + walletClient: WalletClient, + token: Address, + spender: Address, + amount: bigint, +) => undefined; + // writeContract({ + // abi: IERC20Abi, + // address: token, + // walletClient, + // functionName: 'approve', + // args: [spender, amount], + // }); + +export const transfer = async ( + walletClient: WalletClient, + token: Address, + recipient: Address, + amount: bigint, +) => undefined; + // writeContract({ + // abi: IERC20Abi, + // address: token, + // walletClient, + // functionName: 'transfer', + // args: [recipient, amount], + // }); + +export const balanceOf = async ( + chain: Chain, + token: Address, + address: Address, +) => { + // const [balance] = await readContract({ + // abi: IERC20Abi, + // address: token, + // chain, + // functionName: 'balanceOf', + // args: [address], + // }); + return undefined; // balance; +}; + +export const getAllowance = async ( + chain: Chain, + token: Address, + owner: Address, + spender: Address, +) => { + // const [allowance] = await readContract({ + // abi: IERC20Abi, + // address: token, + // chain, + // functionName: 'allowance', + // args: [owner, spender], + // }); + return undefined; // allowance; +}; diff --git a/packages/dapp/src/utils/firebase.ts b/packages/utils/src/firebase.ts similarity index 100% rename from packages/dapp/src/utils/firebase.ts rename to packages/utils/src/firebase.ts diff --git a/packages/dapp/src/utils/getKeys.ts b/packages/utils/src/getKeys.ts similarity index 100% rename from packages/dapp/src/utils/getKeys.ts rename to packages/utils/src/getKeys.ts diff --git a/packages/dapp/src/utils/hashCode.ts b/packages/utils/src/hashCode.ts similarity index 100% rename from packages/dapp/src/utils/hashCode.ts rename to packages/utils/src/hashCode.ts diff --git a/packages/dapp/src/utils/helpers.ts b/packages/utils/src/helpers.ts similarity index 98% rename from packages/dapp/src/utils/helpers.ts rename to packages/utils/src/helpers.ts index f680acde..5d6318a0 100644 --- a/packages/dapp/src/utils/helpers.ts +++ b/packages/utils/src/helpers.ts @@ -19,9 +19,9 @@ import { resolvers, rpcUrls, wrappedNativeToken, -} from '../constants'; -import { ChainId, isOfTypeChainId } from '../constants/config'; -import { Network, TokenData } from '../types'; + ChainId, isOfTypeChainId +} from '@smart-invoice/constants'; +import { Network, TokenData } from '@smart-invoice/types'; export const getDateString = (timeInSec: any) => { if (parseInt(timeInSec) !== 0) { diff --git a/packages/dapp/src/utils/index.ts b/packages/utils/src/index.ts similarity index 100% rename from packages/dapp/src/utils/index.ts rename to packages/utils/src/index.ts diff --git a/packages/utils/src/invoice.ts b/packages/utils/src/invoice.ts new file mode 100644 index 00000000..29848a9f --- /dev/null +++ b/packages/utils/src/invoice.ts @@ -0,0 +1,333 @@ +import { + Address, + Chain, + Hash, + Hex, + WalletClient, + isAddress, + isHex, +} from 'viem'; + +import { + ISmartInvoiceEscrowAbi, + ISmartInvoiceFactoryAbi, + ISmartInvoiceInstantAbi, +} from '@smart-invoice/constants'; +import { readContract, readEvent, writeContract } from './contracts'; +import { getInvoiceFactoryAddress, logError } from './helpers'; + +export const register = async ( + address: Address, + walletClient: WalletClient, + recipient: Address, + amounts: bigint[], + data: Hex, + type: Hex, +) => { + if (!walletClient) throw new Error('Invalid wallet client'); + if (!walletClient.chain) throw new Error('Invalid chain'); + if (!isAddress(address)) throw new Error('Invalid address'); + if (!isAddress(recipient)) throw new Error('Invalid recipient'); + if (!Array.isArray(amounts)) throw new Error('Invalid amounts'); + if (!isHex(data)) throw new Error('Invalid data'); + if (!isHex(type)) throw new Error('Invalid type'); + + return undefined; + // return writeContract({ + // abi: ISmartInvoiceFactoryAbi, + // address, + // walletClient, + // functionName: 'create', + // args: [recipient, amounts, data, type], + // }); +}; + +export const awaitInvoiceAddress = async (chainId: number, hash: Hash) => { + // const receipt = await waitForTransaction({ chainId: chain.id, hash }); + const abi = ISmartInvoiceFactoryAbi; + + // const [, address, , ,] = await readEvent({ + // abi, + // chainId, + // hash, + // name: 'LogNewInvoice', + // }); + // const eventFragment = abi.events[Object.keys(abi.events)[0]]; + // const eventTopic = abi.getEventTopic(eventFragment); + // const event = receipt.logs.find((e) => e.topics[0] === eventTopic); + // if (event) { + // const decodedLog = abi.decodeEventLog( + // eventFragment, + // event.data, + // event.topics, + // ); + // return decodedLog.invoice; + // } + return undefined; // address; +}; + +export const getResolutionRateFromFactory = async ( + chain: Chain, + resolver: Address, + defaultValue: number = 20, +) => { + if (!isAddress(resolver)) return defaultValue; + try { + // const address = getInvoiceFactoryAddress(chain.id); + // const [resolutionRate] = await readContract({ + // abi: ISmartInvoiceFactoryAbi, + // address, + // chain, + // functionName: 'resolutionRateOf', + // args: [resolver], + // }); + // return resolutionRate > 0 ? Number(resolutionRate) : defaultValue; + } catch (resolutionRateError) { + logError({ resolutionRateError }); + return defaultValue; + } +}; + +// export const release = async (walletClient: WalletClient, address: Address) => { +// if (!walletClient) throw new Error('Invalid wallet client'); +// if (!walletClient.chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); + +// return writeContract({ +// abi: ISmartInvoiceEscrowAbi, +// address, +// walletClient, +// functionName: 'release', +// args: [], +// }); +// }; + +// export const withdraw = async ( +// walletClient: WalletClient, +// address: Address, +// ) => { +// if (!walletClient) throw new Error('Invalid wallet client'); +// if (!walletClient.chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); + +// return writeContract({ +// abi: ISmartInvoiceEscrowAbi, +// address, +// walletClient, +// functionName: 'withdraw', +// args: [], +// }); +// }; + +// export const lock = async ( +// walletClient: WalletClient, +// address: Address, +// detailsHash: Hash, // 32 bits hex +// ) => { +// if (!walletClient) throw new Error('Invalid wallet client'); +// if (!walletClient.chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); +// if (!isHex(detailsHash)) throw new Error('Invalid details hash'); + +// return writeContract({ +// abi: ISmartInvoiceEscrowAbi, +// address, +// walletClient, +// functionName: 'lock', +// args: [detailsHash], +// }); +// }; + +// export const resolve = async ( +// walletClient: WalletClient, +// address: Address, +// clientAward: any, +// providerAward: any, +// detailsHash: Hash, // 32 bits hex +// ) => { +// if (!walletClient) throw new Error('Invalid wallet client'); +// if (!walletClient.chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); +// if (!isHex(detailsHash)) throw new Error('Invalid details hash'); + +// return writeContract({ +// abi: ISmartInvoiceEscrowAbi, +// address, +// walletClient, +// functionName: 'resolve', +// args: [clientAward, providerAward, detailsHash], +// }); +// }; + +// export const addMilestones = async ( +// walletClient: WalletClient, +// address: Address, +// amounts: bigint[], +// ) => { +// if (!walletClient) throw new Error('Invalid wallet client'); +// if (!walletClient.chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); +// if (!Array.isArray(amounts)) throw new Error('Invalid amounts'); + +// return writeContract({ +// abi: ISmartInvoiceEscrowAbi, +// address, +// walletClient, +// functionName: 'addMilestones', +// args: [amounts], +// }); +// }; + +// export const addMilestonesWithDetails = async ( +// walletClient: WalletClient, +// address: Address, +// amounts: bigint[], +// details: Hex, +// ) => { +// if (!walletClient) throw new Error('Invalid wallet client'); +// if (!walletClient.chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); +// if (!Array.isArray(amounts)) throw new Error('Invalid amounts'); +// if (!isHex(details)) throw new Error('Invalid details'); + +// return writeContract({ +// abi: ISmartInvoiceEscrowAbi, +// address, +// walletClient, +// functionName: 'addMilestones', +// args: [amounts, details], +// }); +// }; + +// export const verify = async (walletClient: WalletClient, address: Address) => { +// if (!walletClient) throw new Error('Invalid wallet client'); +// if (!walletClient.chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); + +// return writeContract({ +// abi: ISmartInvoiceEscrowAbi, +// address, +// walletClient, +// functionName: 'verify', +// args: [], +// }); +// }; + +// // Functions for Instant type +// export const getTotalDue = async (chain: Chain, address: Address) => { +// if (!chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); + +// const [totalDue] = await readContract({ +// abi: ISmartInvoiceInstantAbi, +// address, +// chain, +// functionName: 'getTotalDue', +// args: [], +// }); + +// return totalDue; +// }; + +// export const getTotalFulfilled = async (chain: Chain, address: Address) => { +// if (!chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); + +// const [amount] = await readContract({ +// abi: ISmartInvoiceInstantAbi, +// address, +// chain, +// functionName: 'totalFulfilled', +// args: [], +// }); + +// const [isFulfilled] = await readContract({ +// abi: ISmartInvoiceInstantAbi, +// address, +// chain, +// functionName: 'fulfilled', +// args: [], +// }); + +// return { amount, isFulfilled }; +// }; + +// export const getDeadline = async (chain: Chain, address: Address) => { +// if (!chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); + +// const [deadline] = await readContract({ +// abi: ISmartInvoiceInstantAbi, +// address, +// chain, +// functionName: 'deadline', +// args: [], +// }); + +// return deadline; +// }; + +// export const getLateFee = async (chain: Chain, address: Address) => { +// if (!chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); + +// const [amount] = await readContract({ +// abi: ISmartInvoiceInstantAbi, +// address, +// chain, +// functionName: 'lateFee', +// args: [], +// }); + +// const [timeInterval] = await readContract({ +// abi: ISmartInvoiceInstantAbi, +// address, +// chain, +// functionName: 'lateFeeTimeInterval', +// args: [], +// }); + +// return { amount, timeInterval }; +// }; + +// export const depositTokens = async ( +// walletClient: WalletClient, +// address: Address, +// tokenAddress: Address, +// amount: bigint, +// ) => { +// if (!walletClient) throw new Error('Invalid wallet client'); +// if (!walletClient.chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); +// if (!isAddress(tokenAddress)) throw new Error('Invalid token address'); +// if (amount <= 0) throw new Error('Invalid amount'); + +// return writeContract({ +// abi: ISmartInvoiceInstantAbi, +// address, +// walletClient, +// functionName: 'depositTokens', +// args: [tokenAddress, amount], +// }); +// }; + +// export const tipTokens = async ( +// walletClient: WalletClient, +// address: Address, +// tokenAddress: Address, +// amount: bigint, +// ) => { +// if (!walletClient) throw new Error('Invalid wallet client'); +// if (!walletClient.chain) throw new Error('Invalid chain'); +// if (!isAddress(address)) throw new Error('Invalid address'); +// if (!isAddress(tokenAddress)) throw new Error('Invalid token address'); +// if (amount <= 0) throw new Error('Invalid amount'); + +// return writeContract({ +// abi: ISmartInvoiceInstantAbi, +// address, +// walletClient, +// functionName: 'tip', +// args: [tokenAddress, amount], +// }); +// }; diff --git a/packages/dapp/src/utils/ipfs.ts b/packages/utils/src/ipfs.ts similarity index 96% rename from packages/dapp/src/utils/ipfs.ts rename to packages/utils/src/ipfs.ts index bd4192b5..1d000737 100644 --- a/packages/dapp/src/utils/ipfs.ts +++ b/packages/utils/src/ipfs.ts @@ -3,7 +3,7 @@ import Base58 from 'base-58'; import { create } from 'ipfs-http-client'; import { Hash } from 'viem'; -import { INFURA_AUTH, INVOICE_VERSION } from '../constants'; +import { INFURA_AUTH, INVOICE_VERSION } from '@smart-invoice/constants'; import { logDebug } from './helpers'; // const ipfsTheGraph = create({ diff --git a/packages/dapp/src/utils/metadataSchema.ts b/packages/utils/src/metadataSchema.ts similarity index 100% rename from packages/dapp/src/utils/metadataSchema.ts rename to packages/utils/src/metadataSchema.ts diff --git a/packages/dapp/src/tokenSupport/README.md b/packages/utils/src/tokenSupport/README.md similarity index 100% rename from packages/dapp/src/tokenSupport/README.md rename to packages/utils/src/tokenSupport/README.md diff --git a/packages/dapp/src/tokenSupport/firebase-CID-template.tson b/packages/utils/src/tokenSupport/firebase-CID-template.tson similarity index 100% rename from packages/dapp/src/tokenSupport/firebase-CID-template.tson rename to packages/utils/src/tokenSupport/firebase-CID-template.tson diff --git a/packages/dapp/src/tokenSupport/tokenSchema.json b/packages/utils/src/tokenSupport/tokenSchema.json similarity index 100% rename from packages/dapp/src/tokenSupport/tokenSchema.json rename to packages/utils/src/tokenSupport/tokenSchema.json diff --git a/packages/dapp/src/tokenSupport/uploadTokenInfo.ts b/packages/utils/src/tokenSupport/uploadTokenInfo.ts similarity index 100% rename from packages/dapp/src/tokenSupport/uploadTokenInfo.ts rename to packages/utils/src/tokenSupport/uploadTokenInfo.ts diff --git a/packages/dapp/src/utils/transactions.ts b/packages/utils/src/transactions.ts similarity index 100% rename from packages/dapp/src/utils/transactions.ts rename to packages/utils/src/transactions.ts diff --git a/packages/dapp/src/utils/unixToDateTime.ts b/packages/utils/src/unixToDateTime.ts similarity index 100% rename from packages/dapp/src/utils/unixToDateTime.ts rename to packages/utils/src/unixToDateTime.ts diff --git a/packages/dapp/src/utils/web3.ts b/packages/utils/src/web3.ts similarity index 100% rename from packages/dapp/src/utils/web3.ts rename to packages/utils/src/web3.ts diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json new file mode 100644 index 00000000..0a56d933 --- /dev/null +++ b/packages/utils/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "target": "ES2020", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "ESNext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../../jest.config.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c11197fa..078ba654 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,6 +69,16 @@ importers: specifier: ^5.3.2 version: 5.3.3 + packages/constants: + dependencies: + viem: + specifier: ^1.21.4 + version: 1.21.4(typescript@5.3.3) + devDependencies: + '@types/node': + specifier: ^20.11.5 + version: 20.11.5 + packages/contracts: dependencies: '@nomiclabs/hardhat-ethers': @@ -182,6 +192,18 @@ importers: '@react-pdf/renderer': specifier: ^3.1.14 version: 3.2.1(react@18.2.0) + '@smart-invoice/constants': + specifier: '*' + version: link:../constants + '@smart-invoice/hooks': + specifier: '*' + version: link:../hooks + '@smart-invoice/ui': + specifier: '*' + version: link:../ui + '@smart-invoice/utils': + specifier: '*' + version: link:../utils '@tanstack/react-query': specifier: ^5.17.9 version: 5.17.15(react@18.2.0) @@ -200,9 +222,6 @@ importers: base-58: specifier: ^0.0.1 version: 0.0.1 - bignumber.js: - specifier: ^9.1.2 - version: 9.1.2 dotenv: specifier: ^16.0.1 version: 16.3.1 @@ -232,7 +251,7 @@ importers: version: 50.1.2(node-fetch@3.3.2) next: specifier: ^14.0.4 - version: 14.0.4(@babel/core@7.23.7)(react-dom@18.2.0)(react@18.2.0) + version: 14.1.0(@babel/core@7.23.7)(react-dom@18.2.0)(react@18.2.0) react: specifier: ^18.2.0 version: 18.2.0 @@ -251,7 +270,7 @@ importers: devDependencies: '@next/eslint-plugin-next': specifier: ^14.0.4 - version: 14.0.4 + version: 14.1.0 '@testing-library/jest-dom': specifier: ^6.2.0 version: 6.2.0(@types/jest@29.5.11)(jest@29.7.0) @@ -275,7 +294,7 @@ importers: version: 6.19.0(eslint@8.56.0)(typescript@5.3.3) eslint-config-next: specifier: ^14.0.4 - version: 14.0.4(eslint@8.56.0)(typescript@5.3.3) + version: 14.1.0(eslint@8.56.0)(typescript@5.3.3) jest: specifier: ^29.7.0 version: 29.7.0(@types/node@20.11.5)(ts-node@10.9.2) @@ -314,6 +333,89 @@ importers: specifier: 2.29.1 version: 2.29.1(@typescript-eslint/parser@6.19.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0) + packages/forms: + dependencies: + '@chakra-ui/icon': + specifier: ^3.2.0 + version: 3.2.0(@chakra-ui/system@2.6.2)(react@18.2.0) + '@chakra-ui/react': + specifier: ^2.8.2 + version: 2.8.2(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@types/react@18.2.48)(framer-motion@10.18.0)(react-dom@18.2.0)(react@18.2.0) + '@smart-invoice/constants': + specifier: '*' + version: link:../constants + '@smart-invoice/graphql': + specifier: '*' + version: link:../graphql + '@smart-invoice/types': + specifier: '*' + version: link:../types + '@smart-invoice/ui': + specifier: '*' + version: link:../ui + '@smart-invoice/utils': + specifier: '*' + version: link:../utils + react: + specifier: ^18.2.0 + version: 18.2.0 + viem: + specifier: ^2.3.1 + version: 2.3.1(typescript@5.3.3) + wagmi: + specifier: ^1.4.13 + version: 1.4.13(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1) + devDependencies: + '@types/react': + specifier: ^18.2.47 + version: 18.2.48 + + packages/graphql: + dependencies: + '@apollo/client': + specifier: ^3.8.10 + version: 3.8.10(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) + '@smart-invoice/constants': + specifier: '*' + version: link:../constants + '@smart-invoice/utils': + specifier: '*' + version: link:../utils + graphql-request: + specifier: ^6.1.0 + version: 6.1.0(graphql@16.8.1) + graphql-tag: + specifier: ^2.12.6 + version: 2.12.6(graphql@16.8.1) + graphql-zeus: + specifier: ^5.3.3 + version: 5.3.3 + viem: + specifier: ^2.3.1 + version: 2.3.1(typescript@5.3.3) + + packages/hooks: + dependencies: + '@smart-invoice/constants': + specifier: '*' + version: link:../constants + '@smart-invoice/types': + specifier: '*' + version: link:../types + '@smart-invoice/utils': + specifier: '*' + version: link:../utils + react: + specifier: ^18.2.0 + version: 18.2.0 + viem: + specifier: ^1.21.4 + version: 1.21.4(typescript@5.3.3) + devDependencies: + '@types/react': + specifier: ^18.2.47 + version: 18.2.48 + packages/subgraph: dependencies: '@graphprotocol/graph-cli': @@ -326,6 +428,92 @@ importers: specifier: ^4.2.0 version: 4.2.0 + packages/types: + devDependencies: + '@types/node': + specifier: ^14.14.31 + version: 14.18.63 + typescript: + specifier: ^4.2.3 + version: 4.9.5 + + packages/ui: + dependencies: + '@chakra-ui/icon': + specifier: ^3.2.0 + version: 3.2.0(@chakra-ui/system@2.6.2)(react@18.2.0) + '@chakra-ui/react': + specifier: ^2.8.2 + version: 2.8.2(@emotion/react@11.11.3)(@emotion/styled@11.11.0)(@types/react@18.2.48)(framer-motion@10.18.0)(react-dom@18.2.0)(react@18.2.0) + '@smart-invoice/constants': + specifier: '*' + version: link:../constants + '@wagmi/core': + specifier: 2.2.1 + version: 2.2.1(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1) + abitype: + specifier: ^0.1.0 + version: 0.1.8(typescript@5.3.3) + base-58: + specifier: ^0.0.1 + version: 0.0.1 + firebase: + specifier: ^10.7.0 + version: 10.7.2 + ipfs-http-client: + specifier: ^50.1.2 + version: 50.1.2(node-fetch@3.3.2) + react: + specifier: ^18.2.0 + version: 18.2.0 + viem: + specifier: 2.3.1 + version: 2.3.1(typescript@5.3.3) + devDependencies: + '@types/node': + specifier: 20.11.5 + version: 20.11.5 + '@types/react': + specifier: ^18.2.47 + version: 18.2.48 + + packages/utils: + dependencies: + '@rainbow-me/rainbowkit': + specifier: ^1.3.3 + version: 1.3.3(react-dom@18.2.0)(react@18.2.0)(viem@2.3.1)(wagmi@1.4.13) + '@smart-invoice/constants': + specifier: '*' + version: link:../constants + '@smart-invoice/types': + specifier: '*' + version: link:../types + '@wagmi/core': + specifier: 2.2.1 + version: 2.2.1(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1) + abitype: + specifier: ^0.1.0 + version: 0.1.8(typescript@5.3.3) + base-58: + specifier: ^0.0.1 + version: 0.0.1 + firebase: + specifier: ^10.7.0 + version: 10.7.2 + ipfs-http-client: + specifier: ^50.1.2 + version: 50.1.2(node-fetch@3.3.2) + viem: + specifier: 2.3.1 + version: 2.3.1(typescript@5.3.3) + wagmi: + specifier: ^1.4.13 + version: 1.4.13(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1) + devDependencies: + '@types/node': + specifier: 20.11.5 + version: 20.11.5 + packages: /@aashutoshrathi/word-wrap@1.2.6: @@ -5125,6 +5313,18 @@ packages: multiformats: 9.9.0 dev: false + /@isaacs/cliui@8.0.2: + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + dependencies: + string-width: 5.1.2 + string-width-cjs: /string-width@4.2.3 + strip-ansi: 7.1.0 + strip-ansi-cjs: /strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: /wrap-ansi@7.0.0 + dev: true + /@istanbuljs/load-nyc-config@1.1.0: resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} engines: {node: '>=8'} @@ -5549,18 +5749,18 @@ packages: resolution: {integrity: sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw==} dev: false - /@next/env@14.0.4: - resolution: {integrity: sha512-irQnbMLbUNQpP1wcE5NstJtbuA/69kRfzBrpAD7Gsn8zm/CY6YQYc3HQBz8QPxwISG26tIm5afvvVbu508oBeQ==} + /@next/env@14.1.0: + resolution: {integrity: sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==} dev: false - /@next/eslint-plugin-next@14.0.4: - resolution: {integrity: sha512-U3qMNHmEZoVmHA0j/57nRfi3AscXNvkOnxDmle/69Jz/G0o/gWjXTDdlgILZdrxQ0Lw/jv2mPW8PGy0EGIHXhQ==} + /@next/eslint-plugin-next@14.1.0: + resolution: {integrity: sha512-x4FavbNEeXx/baD/zC/SdrvkjSby8nBn8KcCREqk6UuwvwoAPZmaV8TFCAuo/cpovBRTIY67mHhe86MQQm/68Q==} dependencies: - glob: 7.1.7 + glob: 10.3.10 dev: true - /@next/swc-darwin-arm64@14.0.4: - resolution: {integrity: sha512-mF05E/5uPthWzyYDyptcwHptucf/jj09i2SXBPwNzbgBNc+XnwzrL0U6BmPjQeOL+FiB+iG1gwBeq7mlDjSRPg==} + /@next/swc-darwin-arm64@14.1.0: + resolution: {integrity: sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -5568,8 +5768,8 @@ packages: dev: false optional: true - /@next/swc-darwin-x64@14.0.4: - resolution: {integrity: sha512-IZQ3C7Bx0k2rYtrZZxKKiusMTM9WWcK5ajyhOZkYYTCc8xytmwSzR1skU7qLgVT/EY9xtXDG0WhY6fyujnI3rw==} + /@next/swc-darwin-x64@14.1.0: + resolution: {integrity: sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -5577,8 +5777,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-gnu@14.0.4: - resolution: {integrity: sha512-VwwZKrBQo/MGb1VOrxJ6LrKvbpo7UbROuyMRvQKTFKhNaXjUmKTu7wxVkIuCARAfiI8JpaWAnKR+D6tzpCcM4w==} + /@next/swc-linux-arm64-gnu@14.1.0: + resolution: {integrity: sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -5586,8 +5786,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-musl@14.0.4: - resolution: {integrity: sha512-8QftwPEW37XxXoAwsn+nXlodKWHfpMaSvt81W43Wh8dv0gkheD+30ezWMcFGHLI71KiWmHK5PSQbTQGUiidvLQ==} + /@next/swc-linux-arm64-musl@14.1.0: + resolution: {integrity: sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -5595,8 +5795,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-gnu@14.0.4: - resolution: {integrity: sha512-/s/Pme3VKfZAfISlYVq2hzFS8AcAIOTnoKupc/j4WlvF6GQ0VouS2Q2KEgPuO1eMBwakWPB1aYFIA4VNVh667A==} + /@next/swc-linux-x64-gnu@14.1.0: + resolution: {integrity: sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -5604,8 +5804,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-musl@14.0.4: - resolution: {integrity: sha512-m8z/6Fyal4L9Bnlxde5g2Mfa1Z7dasMQyhEhskDATpqr+Y0mjOBZcXQ7G5U+vgL22cI4T7MfvgtrM2jdopqWaw==} + /@next/swc-linux-x64-musl@14.1.0: + resolution: {integrity: sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -5613,8 +5813,8 @@ packages: dev: false optional: true - /@next/swc-win32-arm64-msvc@14.0.4: - resolution: {integrity: sha512-7Wv4PRiWIAWbm5XrGz3D8HUkCVDMMz9igffZG4NB1p4u1KoItwx9qjATHz88kwCEal/HXmbShucaslXCQXUM5w==} + /@next/swc-win32-arm64-msvc@14.1.0: + resolution: {integrity: sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -5622,8 +5822,8 @@ packages: dev: false optional: true - /@next/swc-win32-ia32-msvc@14.0.4: - resolution: {integrity: sha512-zLeNEAPULsl0phfGb4kdzF/cAVIfaC7hY+kt0/d+y9mzcZHsMS3hAS829WbJ31DkSlVKQeHEjZHIdhN+Pg7Gyg==} + /@next/swc-win32-ia32-msvc@14.1.0: + resolution: {integrity: sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -5631,8 +5831,8 @@ packages: dev: false optional: true - /@next/swc-win32-x64-msvc@14.0.4: - resolution: {integrity: sha512-yEh2+R8qDlDCjxVpzOTEpBLQTEFAcP2A8fUFLaWNap9GitYKkKv1//y2S6XY6zsR4rCOPRpU7plYDR+az2n30A==} + /@next/swc-win32-x64-msvc@14.1.0: + resolution: {integrity: sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -6350,6 +6550,13 @@ packages: webcrypto-core: 1.7.7 dev: false + /@pkgjs/parseargs@0.11.0: + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + requiresBuild: true + dev: true + optional: true + /@polka/url@1.0.0-next.24: resolution: {integrity: sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ==} dev: false @@ -6426,6 +6633,31 @@ packages: - '@types/react' dev: false + /@rainbow-me/rainbowkit@1.3.3(react-dom@18.2.0)(react@18.2.0)(viem@2.3.1)(wagmi@1.4.13): + resolution: {integrity: sha512-IsUlBCy4SZfo6zFEZgPvGr1MLe/rK4sZzoBtYHRPjRqDHTXrYqDsp3ThTIZWh2HSIq0jU5gMA/94mFnT5kwMLA==} + engines: {node: '>=12.4'} + peerDependencies: + react: '>=17' + react-dom: '>=17' + viem: ~0.3.19 || ^1.0.0 + wagmi: ~1.0.1 || ~1.1.0 || ~1.2.0 || ~1.3.0 || ~1.4.0 + dependencies: + '@vanilla-extract/css': 1.14.0 + '@vanilla-extract/dynamic': 2.1.0 + '@vanilla-extract/sprinkles': 1.6.1(@vanilla-extract/css@1.14.0) + clsx: 2.1.0 + i18n-js: 4.3.2 + qrcode: 1.5.3 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + react-remove-scroll: 2.5.7(@types/react@18.2.48)(react@18.2.0) + ua-parser-js: 1.0.37 + viem: 2.3.1(typescript@5.3.3) + wagmi: 1.4.13(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1) + transitivePeerDependencies: + - '@types/react' + dev: false + /@rari-capital/solmate@6.4.0: resolution: {integrity: sha512-BXWIHHbG5Zbgrxi0qVYe0Zs+bfx+XgOciVUACjuIApV0KzC0kY8XdO1higusIei/ZKCC+GUKdcdQZflxYPUTKQ==} deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. @@ -6675,7 +6907,7 @@ packages: resolution: {integrity: sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==} dependencies: '@noble/curves': 1.1.0 - '@noble/hashes': 1.3.1 + '@noble/hashes': 1.3.3 '@scure/base': 1.1.5 dev: false @@ -6683,7 +6915,7 @@ packages: resolution: {integrity: sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==} dependencies: '@noble/curves': 1.2.0 - '@noble/hashes': 1.3.2 + '@noble/hashes': 1.3.3 '@scure/base': 1.1.5 dev: false @@ -6697,7 +6929,7 @@ packages: /@scure/bip39@1.2.1: resolution: {integrity: sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==} dependencies: - '@noble/hashes': 1.3.2 + '@noble/hashes': 1.3.3 '@scure/base': 1.1.5 dev: false @@ -7544,7 +7776,7 @@ packages: dependencies: '@types/http-cache-semantics': 4.0.4 '@types/keyv': 3.1.4 - '@types/node': 12.20.55 + '@types/node': 20.11.5 '@types/responselike': 1.0.3 dev: false @@ -7561,7 +7793,7 @@ packages: /@types/concat-stream@1.6.1: resolution: {integrity: sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA==} dependencies: - '@types/node': 8.10.66 + '@types/node': 20.11.5 dev: false /@types/connect-history-api-fallback@1.5.4: @@ -7574,7 +7806,7 @@ packages: /@types/connect@3.4.38: resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} dependencies: - '@types/node': 12.20.55 + '@types/node': 20.11.5 dev: false /@types/debug@4.1.12: @@ -7622,7 +7854,7 @@ packages: /@types/form-data@0.0.33: resolution: {integrity: sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw==} dependencies: - '@types/node': 8.10.66 + '@types/node': 20.11.5 dev: false /@types/glob@7.2.0: @@ -7705,7 +7937,7 @@ packages: /@types/keyv@3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: - '@types/node': 12.20.55 + '@types/node': 20.11.5 dev: false /@types/lodash.mergewith@4.6.7: @@ -7779,6 +8011,10 @@ packages: resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} dev: false + /@types/node@14.18.63: + resolution: {integrity: sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==} + dev: true + /@types/node@17.0.45: resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} dev: false @@ -7879,7 +8115,7 @@ packages: /@types/responselike@1.0.3: resolution: {integrity: sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw==} dependencies: - '@types/node': 12.20.55 + '@types/node': 20.11.5 dev: false /@types/retry@0.12.0: @@ -7889,7 +8125,7 @@ packages: /@types/sax@1.2.7: resolution: {integrity: sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==} dependencies: - '@types/node': 17.0.45 + '@types/node': 20.11.5 dev: false /@types/scheduler@0.16.8: @@ -7968,7 +8204,7 @@ packages: /@types/ws@7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 12.20.55 + '@types/node': 20.11.5 dev: false /@types/ws@8.5.10: @@ -8091,8 +8327,172 @@ packages: server-only: 0.0.1 dev: false - /@wagmi/connectors@3.1.11(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@1.21.4): - resolution: {integrity: sha512-wzxp9f9PtSUFjDUP/QDjc1t7HON4D8wrVKsw35ejdO8hToDpx1gU9lwH/47Zo/1zExGezQc392sjoHSszYd7OA==} + /@wagmi/connectors@3.1.11(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@1.21.4): + resolution: {integrity: sha512-wzxp9f9PtSUFjDUP/QDjc1t7HON4D8wrVKsw35ejdO8hToDpx1gU9lwH/47Zo/1zExGezQc392sjoHSszYd7OA==} + peerDependencies: + typescript: '>=5.0.4' + viem: '>=0.3.35' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@coinbase/wallet-sdk': 3.7.2 + '@safe-global/safe-apps-provider': 0.18.2(typescript@5.3.3) + '@safe-global/safe-apps-sdk': 8.1.0(typescript@5.3.3) + '@walletconnect/ethereum-provider': 2.11.0(@types/react@18.2.48)(react@18.2.0) + '@walletconnect/legacy-provider': 2.0.0 + '@walletconnect/modal': 2.6.2(@types/react@18.2.48)(react@18.2.0) + '@walletconnect/utils': 2.11.0 + abitype: 0.8.7(typescript@5.3.3) + eventemitter3: 4.0.7 + typescript: 5.3.3 + viem: 1.21.4(typescript@5.3.3) + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - react + - supports-color + - utf-8-validate + - zod + dev: false + + /@wagmi/connectors@3.1.11(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1): + resolution: {integrity: sha512-wzxp9f9PtSUFjDUP/QDjc1t7HON4D8wrVKsw35ejdO8hToDpx1gU9lwH/47Zo/1zExGezQc392sjoHSszYd7OA==} + peerDependencies: + typescript: '>=5.0.4' + viem: '>=0.3.35' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@coinbase/wallet-sdk': 3.7.2 + '@safe-global/safe-apps-provider': 0.18.2(typescript@5.3.3) + '@safe-global/safe-apps-sdk': 8.1.0(typescript@5.3.3) + '@walletconnect/ethereum-provider': 2.11.0(@types/react@18.2.48)(react@18.2.0) + '@walletconnect/legacy-provider': 2.0.0 + '@walletconnect/modal': 2.6.2(@types/react@18.2.48)(react@18.2.0) + '@walletconnect/utils': 2.11.0 + abitype: 0.8.7(typescript@5.3.3) + eventemitter3: 4.0.7 + typescript: 5.3.3 + viem: 2.3.1(typescript@5.3.3) + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - react + - supports-color + - utf-8-validate + - zod + dev: false + + /@wagmi/connectors@3.1.11(react@18.2.0)(typescript@5.3.3)(viem@2.3.1): + resolution: {integrity: sha512-wzxp9f9PtSUFjDUP/QDjc1t7HON4D8wrVKsw35ejdO8hToDpx1gU9lwH/47Zo/1zExGezQc392sjoHSszYd7OA==} + peerDependencies: + typescript: '>=5.0.4' + viem: '>=0.3.35' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@coinbase/wallet-sdk': 3.7.2 + '@safe-global/safe-apps-provider': 0.18.2(typescript@5.3.3) + '@safe-global/safe-apps-sdk': 8.1.0(typescript@5.3.3) + '@walletconnect/ethereum-provider': 2.11.0(@types/react@18.2.48)(react@18.2.0) + '@walletconnect/legacy-provider': 2.0.0 + '@walletconnect/modal': 2.6.2(@types/react@18.2.48)(react@18.2.0) + '@walletconnect/utils': 2.11.0 + abitype: 0.8.7(typescript@5.3.3) + eventemitter3: 4.0.7 + typescript: 5.3.3 + viem: 2.3.1(typescript@5.3.3) + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - react + - supports-color + - utf-8-validate + - zod + dev: false + + /@wagmi/core@1.4.13(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@1.21.4): + resolution: {integrity: sha512-ytMCvXbBOgfDu9Qw67279wq/jNEe7EZLjLyekX7ROnvHRADqFr3lwZI6ih41UmtRZAmXAx8Ghyuqy154EjB5mQ==} + peerDependencies: + typescript: '>=5.0.4' + viem: '>=0.3.35' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@wagmi/connectors': 3.1.11(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@1.21.4) + abitype: 0.8.7(typescript@5.3.3) + eventemitter3: 4.0.7 + typescript: 5.3.3 + viem: 1.21.4(typescript@5.3.3) + zustand: 4.4.7(@types/react@18.2.48)(react@18.2.0) + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - immer + - react + - supports-color + - utf-8-validate + - zod + dev: false + + /@wagmi/core@1.4.13(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1): + resolution: {integrity: sha512-ytMCvXbBOgfDu9Qw67279wq/jNEe7EZLjLyekX7ROnvHRADqFr3lwZI6ih41UmtRZAmXAx8Ghyuqy154EjB5mQ==} peerDependencies: typescript: '>=5.0.4' viem: '>=0.3.35' @@ -8100,17 +8500,12 @@ packages: typescript: optional: true dependencies: - '@coinbase/wallet-sdk': 3.7.2 - '@safe-global/safe-apps-provider': 0.18.2(typescript@5.3.3) - '@safe-global/safe-apps-sdk': 8.1.0(typescript@5.3.3) - '@walletconnect/ethereum-provider': 2.11.0(@types/react@18.2.48)(react@18.2.0) - '@walletconnect/legacy-provider': 2.0.0 - '@walletconnect/modal': 2.6.2(@types/react@18.2.48)(react@18.2.0) - '@walletconnect/utils': 2.11.0 + '@wagmi/connectors': 3.1.11(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1) abitype: 0.8.7(typescript@5.3.3) eventemitter3: 4.0.7 typescript: 5.3.3 - viem: 1.21.4(typescript@5.3.3) + viem: 2.3.1(typescript@5.3.3) + zustand: 4.4.7(@types/react@18.2.48)(react@18.2.0) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -8127,13 +8522,14 @@ packages: - '@vercel/kv' - bufferutil - encoding + - immer - react - supports-color - utf-8-validate - zod dev: false - /@wagmi/core@1.4.13(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@1.21.4): + /@wagmi/core@1.4.13(react@18.2.0)(typescript@5.3.3)(viem@2.3.1): resolution: {integrity: sha512-ytMCvXbBOgfDu9Qw67279wq/jNEe7EZLjLyekX7ROnvHRADqFr3lwZI6ih41UmtRZAmXAx8Ghyuqy154EjB5mQ==} peerDependencies: typescript: '>=5.0.4' @@ -8142,11 +8538,11 @@ packages: typescript: optional: true dependencies: - '@wagmi/connectors': 3.1.11(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@1.21.4) + '@wagmi/connectors': 3.1.11(react@18.2.0)(typescript@5.3.3)(viem@2.3.1) abitype: 0.8.7(typescript@5.3.3) eventemitter3: 4.0.7 typescript: 5.3.3 - viem: 1.21.4(typescript@5.3.3) + viem: 2.3.1(typescript@5.3.3) zustand: 4.4.7(@types/react@18.2.48)(react@18.2.0) transitivePeerDependencies: - '@azure/app-configuration' @@ -8171,6 +8567,32 @@ packages: - zod dev: false + /@wagmi/core@2.2.1(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1): + resolution: {integrity: sha512-eoTHG600lFpQyeofuo1nlAuTlI7rjduJK/yU4F8sLwjucROSE5RmD2OpQOkeEC3JGoXjrYxVPbY77PUD6ajzqw==} + peerDependencies: + '@tanstack/query-core': '>=5.0.0' + typescript: '>=5.0.4' + viem: 2.x + peerDependenciesMeta: + '@tanstack/query-core': + optional: true + typescript: + optional: true + dependencies: + eventemitter3: 5.0.1 + mipd: 0.0.5(typescript@5.3.3) + typescript: 5.3.3 + viem: 2.3.1(typescript@5.3.3) + zustand: 4.4.1(@types/react@18.2.48)(react@18.2.0) + transitivePeerDependencies: + - '@types/react' + - bufferutil + - immer + - react + - utf-8-validate + - zod + dev: false + /@walletconnect/core@2.11.0: resolution: {integrity: sha512-2Tjp5BCevI7dbmqo/OrCjX4tqgMqwJNQLlQAlphqPfvwlF9+tIu6pGcVbSN3U9zyXzWIZCeleqEaWUeSeET4Ew==} dependencies: @@ -8847,6 +9269,15 @@ packages: commander: 2.20.3 dev: false + /abitype@0.1.8(typescript@5.3.3): + resolution: {integrity: sha512-2pde0KepTzdfu19ZrzYTYVIWo69+6UbBCY4B1RDiwWgo2XZtFSJhF6C+XThuRXbbZ823J0Rw1Y5cP0NXYVcCdQ==} + engines: {pnpm: '>=7'} + peerDependencies: + typescript: '>=4.7.4' + dependencies: + typescript: 5.3.3 + dev: false + /abitype@0.10.3(typescript@5.3.3): resolution: {integrity: sha512-tRN+7XIa7J9xugdbRzFv/95ka5ivR/sRe01eiWvM0HWWjHuigSZEACgKa0sj4wGuekTDtghCx+5Izk/cOi78pQ==} peerDependencies: @@ -8887,6 +9318,20 @@ packages: typescript: 5.3.3 dev: false + /abitype@1.0.0(typescript@5.3.3): + resolution: {integrity: sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==} + peerDependencies: + typescript: '>=5.0.4' + zod: ^3 >=3.22.0 + peerDependenciesMeta: + typescript: + optional: true + zod: + optional: true + dependencies: + typescript: 5.3.3 + dev: false + /abort-controller@3.0.0: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} engines: {node: '>=6.5'} @@ -9646,7 +10091,7 @@ packages: convert-source-map: 1.9.0 debug: 2.6.9 json5: 0.5.1 - lodash: 4.17.20 + lodash: 4.17.21 minimatch: 3.1.2 path-is-absolute: 1.0.1 private: 0.1.8 @@ -9664,7 +10109,7 @@ packages: babel-types: 6.26.0 detect-indent: 4.0.0 jsesc: 1.3.0 - lodash: 4.17.20 + lodash: 4.17.21 source-map: 0.5.7 trim-right: 1.0.1 dev: false @@ -9696,7 +10141,7 @@ packages: babel-helper-function-name: 6.24.1 babel-runtime: 6.26.0 babel-types: 6.26.0 - lodash: 4.17.20 + lodash: 4.17.21 transitivePeerDependencies: - supports-color dev: false @@ -9749,7 +10194,7 @@ packages: dependencies: babel-runtime: 6.26.0 babel-types: 6.26.0 - lodash: 4.17.20 + lodash: 4.17.21 dev: false /babel-helper-remap-async-to-generator@6.24.1: @@ -9962,7 +10407,7 @@ packages: babel-template: 6.26.0 babel-traverse: 6.26.0 babel-types: 6.26.0 - lodash: 4.17.20 + lodash: 4.17.21 transitivePeerDependencies: - supports-color dev: false @@ -10229,7 +10674,7 @@ packages: babel-runtime: 6.26.0 core-js: 2.6.12 home-or-tmp: 2.0.0 - lodash: 4.17.20 + lodash: 4.17.21 mkdirp: 0.5.6 source-map-support: 0.4.18 transitivePeerDependencies: @@ -10250,7 +10695,7 @@ packages: babel-traverse: 6.26.0 babel-types: 6.26.0 babylon: 6.18.0 - lodash: 4.17.20 + lodash: 4.17.21 transitivePeerDependencies: - supports-color dev: false @@ -10266,7 +10711,7 @@ packages: debug: 2.6.9 globals: 9.18.0 invariant: 2.2.4 - lodash: 4.17.20 + lodash: 4.17.21 transitivePeerDependencies: - supports-color dev: false @@ -10276,7 +10721,7 @@ packages: dependencies: babel-runtime: 6.26.0 esutils: 2.0.3 - lodash: 4.17.20 + lodash: 4.17.21 to-fast-properties: 1.0.3 dev: false @@ -13250,8 +13695,8 @@ packages: object.entries: 1.1.7 dev: true - /eslint-config-next@14.0.4(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-9/xbOHEQOmQtqvQ1UsTQZpnA7SlDMBtuKJ//S4JnoyK3oGLhILKXdBgu/UO7lQo/2xOykQULS1qQ6p2+EpHgAQ==} + /eslint-config-next@14.1.0(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-SBX2ed7DoRFXC6CQSLc/SbLY9Ut6HxNB2wPTcoIWjUMd7aF7O/SIE7111L8FdZ9TXsNV4pulUDnfthpyPtbFUg==} peerDependencies: eslint: ^7.23.0 || ^8.0.0 typescript: '>=3.3.1' @@ -13259,7 +13704,7 @@ packages: typescript: optional: true dependencies: - '@next/eslint-plugin-next': 14.0.4 + '@next/eslint-plugin-next': 14.1.0 '@rushstack/eslint-patch': 1.7.0 '@typescript-eslint/parser': 6.19.0(eslint@8.56.0)(typescript@5.3.3) eslint: 8.56.0 @@ -14190,6 +14635,7 @@ packages: is-hex-prefixed: 1.0.0 strip-hex-prefix: 1.0.0 dev: false + bundledDependencies: false /eval@0.1.8: resolution: {integrity: sha512-EzV94NYKoO09GLXGjXj9JIlXijVck4ONSr5wiCWDvhsvj5jxSrzTmRU/9C1DyB6uToszLs8aifA6NQ7lEQdvFw==} @@ -14214,7 +14660,6 @@ packages: /eventemitter3@5.0.1: resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} - dev: true /events@3.3.0: resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} @@ -14826,6 +15271,14 @@ packages: engines: {node: '>=0.10.0'} dev: false + /foreground-child@3.1.1: + resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} + engines: {node: '>=14'} + dependencies: + cross-spawn: 7.0.3 + signal-exit: 4.1.0 + dev: true + /forever-agent@0.6.1: resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} dev: false @@ -15237,6 +15690,18 @@ packages: resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} dev: false + /glob@10.3.10: + resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==} + engines: {node: '>=16 || 14 >=14.17'} + hasBin: true + dependencies: + foreground-child: 3.1.1 + jackspeak: 2.3.6 + minimatch: 9.0.3 + minipass: 7.0.4 + path-scurry: 1.10.1 + dev: true + /glob@5.0.15: resolution: {integrity: sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==} dependencies: @@ -15258,17 +15723,6 @@ packages: path-is-absolute: 1.0.1 dev: false - /glob@7.1.7: - resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - dev: true - /glob@7.2.0: resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} dependencies: @@ -17480,6 +17934,15 @@ packages: set-function-name: 2.0.1 dev: true + /jackspeak@2.3.6: + resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} + engines: {node: '>=14'} + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + dev: true + /jake@10.8.7: resolution: {integrity: sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==} engines: {node: '>=10'} @@ -18872,7 +19335,6 @@ packages: /lru-cache@10.1.0: resolution: {integrity: sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==} engines: {node: 14 || >=16.14} - dev: false /lru-cache@3.2.0: resolution: {integrity: sha512-91gyOKTc2k66UG6kHiH4h3S2eltcPwE1STVfMYC/NG+nZwf8IIuiamfmpGZjpbbxzSyEJaLC0tNSmhjlQUTJow==} @@ -19304,7 +19766,6 @@ packages: /minipass@7.0.4: resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} engines: {node: '>=16 || 14 >=14.17'} - dev: false /minizlib@1.3.3: resolution: {integrity: sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==} @@ -19320,6 +19781,22 @@ packages: yallist: 4.0.0 dev: false + /mipd@0.0.5(typescript@5.3.3): + resolution: {integrity: sha512-gbKA784D2WKb5H/GtqEv+Ofd1S9Zj+Z/PGDIl1u1QAbswkxD28BQ5bSXQxkeBzPBABg1iDSbiwGG1XqlOxRspA==} + peerDependencies: + typescript: '>=5.0.4' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + typescript: 5.3.3 + viem: 1.21.4(typescript@5.3.3) + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + dev: false + /mixin-deep@1.3.2: resolution: {integrity: sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==} engines: {node: '>=0.10.0'} @@ -19740,8 +20217,8 @@ packages: resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} dev: false - /next@14.0.4(@babel/core@7.23.7)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-qbwypnM7327SadwFtxXnQdGiKpkuhaRLE2uq62/nRul9cj9KhQ5LhHmlziTNqUidZotw/Q1I9OjirBROdUJNgA==} + /next@14.1.0(@babel/core@7.23.7)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==} engines: {node: '>=18.17.0'} hasBin: true peerDependencies: @@ -19755,7 +20232,7 @@ packages: sass: optional: true dependencies: - '@next/env': 14.0.4 + '@next/env': 14.1.0 '@swc/helpers': 0.5.2 busboy: 1.6.0 caniuse-lite: 1.0.30001579 @@ -19764,17 +20241,16 @@ packages: react: 18.2.0 react-dom: 18.2.0(react@18.2.0) styled-jsx: 5.1.1(@babel/core@7.23.7)(react@18.2.0) - watchpack: 2.4.0 optionalDependencies: - '@next/swc-darwin-arm64': 14.0.4 - '@next/swc-darwin-x64': 14.0.4 - '@next/swc-linux-arm64-gnu': 14.0.4 - '@next/swc-linux-arm64-musl': 14.0.4 - '@next/swc-linux-x64-gnu': 14.0.4 - '@next/swc-linux-x64-musl': 14.0.4 - '@next/swc-win32-arm64-msvc': 14.0.4 - '@next/swc-win32-ia32-msvc': 14.0.4 - '@next/swc-win32-x64-msvc': 14.0.4 + '@next/swc-darwin-arm64': 14.1.0 + '@next/swc-darwin-x64': 14.1.0 + '@next/swc-linux-arm64-gnu': 14.1.0 + '@next/swc-linux-arm64-musl': 14.1.0 + '@next/swc-linux-x64-gnu': 14.1.0 + '@next/swc-linux-x64-musl': 14.1.0 + '@next/swc-win32-arm64-msvc': 14.1.0 + '@next/swc-win32-ia32-msvc': 14.1.0 + '@next/swc-win32-x64-msvc': 14.1.0 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros @@ -20577,7 +21053,6 @@ packages: dependencies: lru-cache: 10.1.0 minipass: 7.0.4 - dev: false /path-to-regexp@0.1.7: resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} @@ -23072,7 +23547,6 @@ packages: /signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - dev: false /simple-concat@1.0.1: resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} @@ -24648,6 +25122,12 @@ packages: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} dev: false + /typescript@4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: true + /typescript@5.3.3: resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} engines: {node: '>=14.17'} @@ -25354,6 +25834,29 @@ packages: - zod dev: false + /viem@2.3.1(typescript@5.3.3): + resolution: {integrity: sha512-bZ2KvbnoQ+A60bePGH6PTpO9xdWEvvCAlSjNt+cvmw0eHMjj5aqfhBN9a82oTonJGJsufvt1hwKUlEvVfSsM3g==} + peerDependencies: + typescript: '>=5.0.4' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@adraffy/ens-normalize': 1.10.0 + '@noble/curves': 1.2.0 + '@noble/hashes': 1.3.2 + '@scure/bip32': 1.3.2 + '@scure/bip39': 1.2.1 + abitype: 1.0.0(typescript@5.3.3) + isows: 1.0.3(ws@8.13.0) + typescript: 5.3.3 + ws: 8.13.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + dev: false + /vite-compatible-readable-stream@3.6.1: resolution: {integrity: sha512-t20zYkrSf868+j/p31cRIGN28Phrjm3nRSLR2fyc2tiWi4cZGVdv68yNlwnIINTkMTmPoMiSlc0OadaO7DXZaQ==} engines: {node: '>= 6'} @@ -25413,6 +25916,92 @@ packages: - zod dev: false + /wagmi@1.4.13(@types/react@18.2.48)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1): + resolution: {integrity: sha512-AScVYFjqNt1wMgL99Bob7MLdhoTZ3XKiOZL5HVBdy4W1sh7QodA3gQ8IsmTuUrQ7oQaTxjiXEhwg7sWNrPBvJA==} + peerDependencies: + react: '>=17.0.0' + typescript: '>=5.0.4' + viem: '>=0.3.35' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@tanstack/query-sync-storage-persister': 4.36.1 + '@tanstack/react-query': 4.36.1(react-dom@18.2.0)(react@18.2.0) + '@tanstack/react-query-persist-client': 4.36.1(@tanstack/react-query@4.36.1) + '@wagmi/core': 1.4.13(@types/react@18.2.48)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1) + abitype: 0.8.7(typescript@5.3.3) + react: 18.2.0 + typescript: 5.3.3 + use-sync-external-store: 1.2.0(react@18.2.0) + viem: 2.3.1(typescript@5.3.3) + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - immer + - react-dom + - react-native + - supports-color + - utf-8-validate + - zod + dev: false + + /wagmi@1.4.13(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)(viem@2.3.1): + resolution: {integrity: sha512-AScVYFjqNt1wMgL99Bob7MLdhoTZ3XKiOZL5HVBdy4W1sh7QodA3gQ8IsmTuUrQ7oQaTxjiXEhwg7sWNrPBvJA==} + peerDependencies: + react: '>=17.0.0' + typescript: '>=5.0.4' + viem: '>=0.3.35' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@tanstack/query-sync-storage-persister': 4.36.1 + '@tanstack/react-query': 4.36.1(react-dom@18.2.0)(react@18.2.0) + '@tanstack/react-query-persist-client': 4.36.1(@tanstack/react-query@4.36.1) + '@wagmi/core': 1.4.13(react@18.2.0)(typescript@5.3.3)(viem@2.3.1) + abitype: 0.8.7(typescript@5.3.3) + react: 18.2.0 + typescript: 5.3.3 + use-sync-external-store: 1.2.0(react@18.2.0) + viem: 2.3.1(typescript@5.3.3) + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - immer + - react-dom + - react-native + - supports-color + - utf-8-validate + - zod + dev: false + /wait-on@6.0.1: resolution: {integrity: sha512-zht+KASY3usTY5u2LgaNqn/Cd8MukxLGjdcZxT2ns5QzDmTFc4XoWBgC+C/na+sMRZTuVygQoMYwdcVjHnYIVw==} engines: {node: '>=10.0.0'} @@ -27352,6 +27941,26 @@ packages: resolution: {integrity: sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==} dev: false + /zustand@4.4.1(@types/react@18.2.48)(react@18.2.0): + resolution: {integrity: sha512-QCPfstAS4EBiTQzlaGP1gmorkh/UL1Leaj2tdj+zZCZ/9bm0WS7sI2wnfD5lpOszFqWJ1DcPnGoY8RDL61uokw==} + engines: {node: '>=12.7.0'} + peerDependencies: + '@types/react': '>=16.8' + immer: '>=9.0' + react: '>=16.8' + peerDependenciesMeta: + '@types/react': + optional: true + immer: + optional: true + react: + optional: true + dependencies: + '@types/react': 18.2.48 + react: 18.2.0 + use-sync-external-store: 1.2.0(react@18.2.0) + dev: false + /zustand@4.4.7(@types/react@18.2.48)(react@18.2.0): resolution: {integrity: sha512-QFJWJMdlETcI69paJwhSMJz7PPWjVP8Sjhclxmxmxv/RYI7ZOvR5BHX+ktH0we9gTWQMxcne8q1OY8xxz604gw==} engines: {node: '>=12.7.0'}