From e067b0fad9a51cc78e72c3b12685e918c41b24f8 Mon Sep 17 00:00:00 2001 From: Danish Arora Date: Wed, 10 Sep 2025 14:56:51 +0530 Subject: [PATCH] wip --- app/package-lock.json | 852 +++++++++++++++++- app/package.json | 1 + app/src/App.tsx | 5 +- app/src/components/CellList.tsx | 4 +- app/src/components/CommentCard.tsx | 2 +- app/src/components/CreateCellDialog.tsx | 2 +- app/src/components/FeedSidebar.tsx | 2 +- app/src/components/Header.tsx | 6 +- app/src/components/PostCard.tsx | 2 +- app/src/components/PostList.tsx | 2 +- app/src/components/ui/bookmark-card.tsx | 2 +- .../components/ui/call-sign-setup-dialog.tsx | 2 +- app/src/components/ui/delegation-step.tsx | 2 +- app/src/components/ui/relevance-indicator.tsx | 2 +- app/src/components/ui/verification-step.tsx | 4 +- app/src/components/ui/wallet-wizard.tsx | 2 +- app/src/contexts/AuthContext.tsx | 10 +- app/src/contexts/ForumContext.tsx | 24 +- app/src/contexts/ModerationContext.tsx | 2 +- app/src/hooks/actions/useAuthActions.ts | 4 +- app/src/hooks/actions/useForumActions.ts | 2 +- app/src/hooks/actions/useUserActions.ts | 2 +- app/src/hooks/core/useAuth.ts | 2 +- app/src/hooks/core/useBookmarks.ts | 4 +- app/src/hooks/core/useEnhancedUserDisplay.ts | 2 +- app/src/hooks/core/useForumData.ts | 4 +- app/src/hooks/core/usePermissions.ts | 2 +- app/src/hooks/derived/useCell.ts | 2 +- app/src/hooks/useDelegation.ts | 2 +- app/src/hooks/useMessageSigning.ts | 2 +- app/src/hooks/usePending.ts | 2 +- app/src/hooks/useWakuHealth.ts | 2 +- app/src/hooks/utilities/selectors.ts | 4 +- app/src/hooks/utilities/useNetworkStatus.ts | 2 +- app/src/lib/utils.ts | 6 + app/src/pages/BookmarksPage.tsx | 2 +- app/src/pages/FeedPage.tsx | 4 +- app/src/pages/ProfilePage.tsx | 4 +- 38 files changed, 885 insertions(+), 97 deletions(-) create mode 100644 app/src/lib/utils.ts diff --git a/app/package-lock.json b/app/package-lock.json index dea645d..77b2303 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -52,6 +52,7 @@ "input-otp": "^1.2.4", "lucide-react": "^0.462.0", "next-themes": "^0.3.0", + "opchan-core": "file:../packages/core", "react": "^18.3.1", "react-day-picker": "^8.10.1", "react-dom": "^18.3.1", @@ -65,7 +66,7 @@ "uuid": "^11.1.0", "vaul": "^0.9.3", "viem": "^2.37.1", - "wagmi": "^2.16.1", + "wagmi": "^2.16.9", "zod": "^3.23.8" }, "devDependencies": { @@ -95,6 +96,31 @@ "vitest": "^3.2.4" } }, + "../packages/core": { + "name": "opchan-core", + "version": "1.0.2", + "license": "MIT", + "dependencies": { + "@reown/appkit": "^1.7.17", + "@reown/appkit-adapter-bitcoin": "^1.7.17", + "@reown/appkit-adapter-wagmi": "^1.7.17", + "wagmi": "^2.16.9" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", + "eslint": "^8.0.0", + "prettier": "^3.0.0" + }, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "@waku/sdk": "^0.0.35-67a7287.0", + "typescript": ">=5.0.4" + } + }, "node_modules/@adobe/css-tools": { "version": "4.4.3", "dev": true, @@ -583,6 +609,73 @@ "version": "0.2.8", "license": "MIT" }, + "node_modules/@gemini-wallet/core": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@gemini-wallet/core/-/core-0.2.0.tgz", + "integrity": "sha512-vv9aozWnKrrPWQ3vIFcWk7yta4hQW1Ie0fsNNPeXnjAxkbXr2hqMagEptLuMxpEP2W3mnRu05VDNKzcvAuuZDw==", + "license": "MIT", + "dependencies": { + "@metamask/rpc-errors": "7.0.2", + "eventemitter3": "5.0.1" + }, + "peerDependencies": { + "viem": ">=2.0.0" + } + }, + "node_modules/@gemini-wallet/core/node_modules/@metamask/rpc-errors": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@metamask/rpc-errors/-/rpc-errors-7.0.2.tgz", + "integrity": "sha512-YYYHsVYd46XwY2QZzpGeU4PSdRhHdxnzkB8piWGvJW2xbikZ3R+epAYEL4q/K8bh9JPTucsUdwRFnACor1aOYw==", + "license": "MIT", + "dependencies": { + "@metamask/utils": "^11.0.1", + "fast-safe-stringify": "^2.0.6" + }, + "engines": { + "node": "^18.20 || ^20.17 || >=22" + } + }, + "node_modules/@gemini-wallet/core/node_modules/@metamask/utils": { + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/@metamask/utils/-/utils-11.7.0.tgz", + "integrity": "sha512-IamqpZF8Lr4WeXJ84fD+Sy+v1Zo05SYuMPHHBrZWpzVbnHAmXQpL4ckn9s5dfA+zylp3WGypaBPb6SBZdOhuNQ==", + "license": "ISC", + "dependencies": { + "@ethereumjs/tx": "^4.2.0", + "@metamask/superstruct": "^3.1.0", + "@noble/hashes": "^1.3.1", + "@scure/base": "^1.1.3", + "@types/debug": "^4.1.7", + "@types/lodash": "^4.17.20", + "debug": "^4.3.4", + "lodash": "^4.17.21", + "pony-cause": "^2.1.10", + "semver": "^7.5.4", + "uuid": "^9.0.1" + }, + "engines": { + "node": "^18.18 || ^20.14 || >=22" + } + }, + "node_modules/@gemini-wallet/core/node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" + }, + "node_modules/@gemini-wallet/core/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@hookform/resolvers": { "version": "3.9.0", "license": "MIT", @@ -1087,6 +1180,15 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/@phosphor-icons/webcomponents": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@phosphor-icons/webcomponents/-/webcomponents-2.1.5.tgz", + "integrity": "sha512-JcvQkZxvcX2jK+QCclm8+e8HXqtdFW9xV4/kk2aL9Y3dJA2oQVt+pzbv1orkumz3rfx4K9mn9fDoMr1He1yr7Q==", + "license": "MIT", + "dependencies": { + "lit": "^3" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "license": "MIT", @@ -2407,22 +2509,593 @@ } }, "node_modules/@reown/appkit-adapter-bitcoin": { - "version": "1.7.17", - "license": "Apache-2.0", + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@reown/appkit-adapter-bitcoin/-/appkit-adapter-bitcoin-1.8.3.tgz", + "integrity": "sha512-1ffJjUyaPikFa4d/Ery5tfoEOeJYgD5qP4h9cStVXRVoLps91RkWtG6SfjWudLDIMHd7rbwGo0domX4RzDvgZw==", + "license": "SEE LICENSE IN LICENSE.md", "dependencies": { "@exodus/bitcoin-wallet-standard": "0.0.0", - "@reown/appkit": "1.7.17", - "@reown/appkit-common": "1.7.17", - "@reown/appkit-controllers": "1.7.17", - "@reown/appkit-polyfills": "1.7.17", - "@reown/appkit-utils": "1.7.17", + "@reown/appkit": "1.8.3", + "@reown/appkit-common": "1.8.3", + "@reown/appkit-controllers": "1.8.3", + "@reown/appkit-polyfills": "1.8.3", + "@reown/appkit-utils": "1.8.3", "@wallet-standard/app": "1.1.0", "@wallet-standard/base": "1.1.0", - "@walletconnect/universal-provider": "2.21.5", + "@walletconnect/universal-provider": "2.21.7", "bitcoinjs-lib": "6.1.7", "sats-connect": "3.5.0" } }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@reown/appkit": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@reown/appkit/-/appkit-1.8.3.tgz", + "integrity": "sha512-v+PPFmkLj3iYW6nAJb7RU1kQrv/rwOoTlQpX1MmP0YftB5gqnQ8VLMyoDJAacWfKD8LCHTIxqnD1GN4auU8O/A==", + "hasInstallScript": true, + "license": "SEE LICENSE IN LICENSE.md", + "dependencies": { + "@reown/appkit-common": "1.8.3", + "@reown/appkit-controllers": "1.8.3", + "@reown/appkit-pay": "1.8.3", + "@reown/appkit-polyfills": "1.8.3", + "@reown/appkit-scaffold-ui": "1.8.3", + "@reown/appkit-ui": "1.8.3", + "@reown/appkit-utils": "1.8.3", + "@reown/appkit-wallet": "1.8.3", + "@walletconnect/universal-provider": "2.21.7", + "bs58": "6.0.0", + "semver": "7.7.2", + "valtio": "2.1.7", + "viem": ">=2.37.2" + }, + "optionalDependencies": { + "@lit/react": "1.0.8" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@reown/appkit-common": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@reown/appkit-common/-/appkit-common-1.8.3.tgz", + "integrity": "sha512-4tFCQT+NsDGV7cLd94st00lwWPxdxI2ExORhK3znblEPsm9Mr7MF/pp79NgqZzGlFLbEnmAPHZH+gw7sF7WdJA==", + "license": "SEE LICENSE IN LICENSE.md", + "dependencies": { + "big.js": "6.2.2", + "dayjs": "1.11.13", + "viem": ">=2.37.2" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@reown/appkit-controllers": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@reown/appkit-controllers/-/appkit-controllers-1.8.3.tgz", + "integrity": "sha512-CvXV36hqcaP+LkZz97DHRPf1BXAEjA8TBgXLRTFVgWRNx9nYQsqmlJX0KeSBJeFeFcx81+mnRRaHZX2b2KeJJw==", + "license": "SEE LICENSE IN LICENSE.md", + "dependencies": { + "@reown/appkit-common": "1.8.3", + "@reown/appkit-wallet": "1.8.3", + "@walletconnect/universal-provider": "2.21.7", + "valtio": "2.1.7", + "viem": ">=2.37.2" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@reown/appkit-pay": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@reown/appkit-pay/-/appkit-pay-1.8.3.tgz", + "integrity": "sha512-bLWehofB/nQ+lvF1P4VdW9DHv67VYRTxhnMcpLW14F1Px1rXEaLtLd4WM5ehB9xP46VUM3rS01/EaiOPv/48Nw==", + "license": "SEE LICENSE IN LICENSE.md", + "dependencies": { + "@reown/appkit-common": "1.8.3", + "@reown/appkit-controllers": "1.8.3", + "@reown/appkit-ui": "1.8.3", + "@reown/appkit-utils": "1.8.3", + "lit": "3.3.0", + "valtio": "2.1.7" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@reown/appkit-polyfills": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@reown/appkit-polyfills/-/appkit-polyfills-1.8.3.tgz", + "integrity": "sha512-7T+c2TaOem2E3dnbS1Gd+GYgRKtTOh1OcGp6M/i42L48c7Ij8WIrAQTdDsTh1wb0kY6mD0/6q9mGFr9/X3gI5w==", + "license": "SEE LICENSE IN LICENSE.md", + "dependencies": { + "buffer": "6.0.3" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@reown/appkit-scaffold-ui": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@reown/appkit-scaffold-ui/-/appkit-scaffold-ui-1.8.3.tgz", + "integrity": "sha512-Qq2fXJuuv4rf8qDVgZOmYWvCQmmskf9uo02K0y/hVErLqlgaXxb+BQi8Me7KMygyJozZAk3ktzDu/iPXdani/w==", + "license": "SEE LICENSE IN LICENSE.md", + "dependencies": { + "@reown/appkit-common": "1.8.3", + "@reown/appkit-controllers": "1.8.3", + "@reown/appkit-ui": "1.8.3", + "@reown/appkit-utils": "1.8.3", + "@reown/appkit-wallet": "1.8.3", + "lit": "3.3.0" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@reown/appkit-ui": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@reown/appkit-ui/-/appkit-ui-1.8.3.tgz", + "integrity": "sha512-qPalf7v68JvqDFICgaXa6Nu+3uE9owHXJzHJ/vv4znQboN1ARLrICyUxefat/stfjcwabQeUYn7ldGmDmK8pgw==", + "license": "SEE LICENSE IN LICENSE.md", + "dependencies": { + "@phosphor-icons/webcomponents": "2.1.5", + "@reown/appkit-common": "1.8.3", + "@reown/appkit-controllers": "1.8.3", + "@reown/appkit-wallet": "1.8.3", + "lit": "3.3.0", + "qrcode": "1.5.3" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@reown/appkit-utils": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@reown/appkit-utils/-/appkit-utils-1.8.3.tgz", + "integrity": "sha512-WCd30aSD6e65fhplMhF7G2dnSjBwzkFK5BJwovUOFsejkluTIYkjeTctTpTvB07t+zdgzTfVDLkOooj3tpdQaA==", + "license": "SEE LICENSE IN LICENSE.md", + "dependencies": { + "@reown/appkit-common": "1.8.3", + "@reown/appkit-controllers": "1.8.3", + "@reown/appkit-polyfills": "1.8.3", + "@reown/appkit-wallet": "1.8.3", + "@wallet-standard/wallet": "1.1.0", + "@walletconnect/logger": "2.1.2", + "@walletconnect/universal-provider": "2.21.7", + "valtio": "2.1.7", + "viem": ">=2.37.2" + }, + "peerDependencies": { + "valtio": "2.1.7" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@reown/appkit-wallet": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@reown/appkit-wallet/-/appkit-wallet-1.8.3.tgz", + "integrity": "sha512-A0LXTwBWE+dBjv0Qm91ifOnnldZDYnV5SqxoAKTrAWKD0MmI2ISrhnFXBMlD1fFjOeKfJ0/+a4Ktu85+PuU3GA==", + "license": "SEE LICENSE IN LICENSE.md", + "dependencies": { + "@reown/appkit-common": "1.8.3", + "@reown/appkit-polyfills": "1.8.3", + "@walletconnect/logger": "2.1.2", + "zod": "3.22.4" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@scure/bip32": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz", + "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==", + "license": "MIT", + "dependencies": { + "@noble/curves": "~1.9.0", + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@scure/bip39": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz", + "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@walletconnect/core": { + "version": "2.21.7", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.21.7.tgz", + "integrity": "sha512-q/Au5Ne3g4R+q4GvHR5cvRd3+ha00QZCZiCs058lmy+eDbiZd0YsautvTPJ5a2guD6UaS1k/w5e1JHgixdcgLA==", + "license": "Apache-2.0", + "dependencies": { + "@walletconnect/heartbeat": "1.2.2", + "@walletconnect/jsonrpc-provider": "1.0.14", + "@walletconnect/jsonrpc-types": "1.0.4", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/jsonrpc-ws-connection": "1.0.16", + "@walletconnect/keyvaluestorage": "1.1.1", + "@walletconnect/logger": "2.1.2", + "@walletconnect/relay-api": "1.0.11", + "@walletconnect/relay-auth": "1.1.0", + "@walletconnect/safe-json": "1.0.2", + "@walletconnect/time": "1.0.2", + "@walletconnect/types": "2.21.7", + "@walletconnect/utils": "2.21.7", + "@walletconnect/window-getters": "1.0.1", + "es-toolkit": "1.39.3", + "events": "3.3.0", + "uint8arrays": "3.1.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@walletconnect/keyvaluestorage": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@walletconnect/keyvaluestorage/-/keyvaluestorage-1.1.1.tgz", + "integrity": "sha512-V7ZQq2+mSxAq7MrRqDxanTzu2RcElfK1PfNYiaVnJgJ7Q7G7hTVwF8voIBx92qsRyGHZihrwNPHuZd1aKkd0rA==", + "license": "MIT", + "dependencies": { + "@walletconnect/safe-json": "^1.0.1", + "idb-keyval": "^6.2.1", + "unstorage": "^1.9.0" + }, + "peerDependencies": { + "@react-native-async-storage/async-storage": "1.x" + }, + "peerDependenciesMeta": { + "@react-native-async-storage/async-storage": { + "optional": true + } + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@walletconnect/sign-client": { + "version": "2.21.7", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.21.7.tgz", + "integrity": "sha512-9k/JEl9copR6nXRhqnmzWz2Zk1hiWysH+o6bp6Cqo8TgDUrZoMLBZMZ6qbo+2HLI54V02kKf0Vg8M81nNFOpjQ==", + "license": "Apache-2.0", + "dependencies": { + "@walletconnect/core": "2.21.7", + "@walletconnect/events": "1.0.1", + "@walletconnect/heartbeat": "1.2.2", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/logger": "2.1.2", + "@walletconnect/time": "1.0.2", + "@walletconnect/types": "2.21.7", + "@walletconnect/utils": "2.21.7", + "events": "3.3.0" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@walletconnect/types": { + "version": "2.21.7", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.21.7.tgz", + "integrity": "sha512-kyGnFje4Iq+XGkZZcSoAIrJWBE4BeghVW4O7n9e1MhUyeOOtO55M/kcqceNGYrvwjHvdN+Kf+aoLnKC0zKlpbQ==", + "license": "Apache-2.0", + "dependencies": { + "@walletconnect/events": "1.0.1", + "@walletconnect/heartbeat": "1.2.2", + "@walletconnect/jsonrpc-types": "1.0.4", + "@walletconnect/keyvaluestorage": "1.1.1", + "@walletconnect/logger": "2.1.2", + "events": "3.3.0" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@walletconnect/universal-provider": { + "version": "2.21.7", + "resolved": "https://registry.npmjs.org/@walletconnect/universal-provider/-/universal-provider-2.21.7.tgz", + "integrity": "sha512-8PB+vA5VuR9PBqt5Y0xj4JC2doYNPlXLGQt3wJORVF9QC227Mm/8R1CAKpmneeLrUH02LkSRwx+wnN/pPnDiQA==", + "license": "Apache-2.0", + "dependencies": { + "@walletconnect/events": "1.0.1", + "@walletconnect/jsonrpc-http-connection": "1.0.8", + "@walletconnect/jsonrpc-provider": "1.0.14", + "@walletconnect/jsonrpc-types": "1.0.4", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/keyvaluestorage": "1.1.1", + "@walletconnect/logger": "2.1.2", + "@walletconnect/sign-client": "2.21.7", + "@walletconnect/types": "2.21.7", + "@walletconnect/utils": "2.21.7", + "es-toolkit": "1.39.3", + "events": "3.3.0" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@walletconnect/utils": { + "version": "2.21.7", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.21.7.tgz", + "integrity": "sha512-qyaclTgcFf9AwVuoV8CLLg8wfH3nX7yZdpylNkDqCpS7wawQL9zmFFTaGgma8sQrCsd3Sd9jUIymcpRvCJnSTw==", + "license": "Apache-2.0", + "dependencies": { + "@msgpack/msgpack": "3.1.2", + "@noble/ciphers": "1.3.0", + "@noble/curves": "1.9.2", + "@noble/hashes": "1.8.0", + "@scure/base": "1.2.6", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/keyvaluestorage": "1.1.1", + "@walletconnect/relay-api": "1.0.11", + "@walletconnect/relay-auth": "1.1.0", + "@walletconnect/safe-json": "1.0.2", + "@walletconnect/time": "1.0.2", + "@walletconnect/types": "2.21.7", + "@walletconnect/window-getters": "1.0.1", + "@walletconnect/window-metadata": "1.0.1", + "blakejs": "1.2.1", + "bs58": "6.0.0", + "detect-browser": "5.3.0", + "query-string": "7.1.3", + "uint8arrays": "3.1.1", + "viem": "2.31.0" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@walletconnect/utils/node_modules/viem": { + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.31.0.tgz", + "integrity": "sha512-U7OMQ6yqK+bRbEIarf2vqxL7unSEQvNxvML/1zG7suAmKuJmipqdVTVJGKBCJiYsm/EremyO2FS4dHIPpGv+eA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@noble/curves": "1.9.1", + "@noble/hashes": "1.8.0", + "@scure/bip32": "1.7.0", + "@scure/bip39": "1.6.0", + "abitype": "1.0.8", + "isows": "1.0.7", + "ox": "0.7.1", + "ws": "8.18.2" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/@walletconnect/utils/node_modules/viem/node_modules/@noble/curves": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.1.tgz", + "integrity": "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/es-toolkit": { + "version": "1.39.3", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.39.3.tgz", + "integrity": "sha512-Qb/TCFCldgOy8lZ5uC7nLGdqJwSabkQiYQShmw4jyiPk1pZzaYWTwaYKYP7EgLccWYgZocMrtItrwh683voaww==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks" + ] + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/multiformats": { + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz", + "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==", + "license": "(Apache-2.0 AND MIT)" + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/ox": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ox/-/ox-0.7.1.tgz", + "integrity": "sha512-+k9fY9PRNuAMHRFIUbiK9Nt5seYHHzSQs9Bj+iMETcGtlpS7SmBzcGSVUQO3+nqGLEiNK4598pHNFlVRaZbRsg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@adraffy/ens-normalize": "^1.10.1", + "@noble/ciphers": "^1.3.0", + "@noble/curves": "^1.6.0", + "@noble/hashes": "^1.5.0", + "@scure/bip32": "^1.5.0", + "@scure/bip39": "^1.4.0", + "abitype": "^1.0.6", + "eventemitter3": "5.0.1" + }, + "peerDependencies": { + "typescript": ">=5.4.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/uint8arrays": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", + "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", + "license": "MIT", + "dependencies": { + "multiformats": "^9.4.2" + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/unstorage": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.1.tgz", + "integrity": "sha512-KKGwRTT0iVBCErKemkJCLs7JdxNVfqTPc/85ae1XES0+bsHbc/sFBfVi5kJp156cc51BHinIH2l3k0EZ24vOBQ==", + "license": "MIT", + "dependencies": { + "anymatch": "^3.1.3", + "chokidar": "^4.0.3", + "destr": "^2.0.5", + "h3": "^1.15.4", + "lru-cache": "^10.4.3", + "node-fetch-native": "^1.6.7", + "ofetch": "^1.4.1", + "ufo": "^1.6.1" + }, + "peerDependencies": { + "@azure/app-configuration": "^1.8.0", + "@azure/cosmos": "^4.2.0", + "@azure/data-tables": "^13.3.0", + "@azure/identity": "^4.6.0", + "@azure/keyvault-secrets": "^4.9.0", + "@azure/storage-blob": "^12.26.0", + "@capacitor/preferences": "^6.0.3 || ^7.0.0", + "@deno/kv": ">=0.9.0", + "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0", + "@planetscale/database": "^1.19.0", + "@upstash/redis": "^1.34.3", + "@vercel/blob": ">=0.27.1", + "@vercel/functions": "^2.2.12 || ^3.0.0", + "@vercel/kv": "^1.0.1", + "aws4fetch": "^1.0.20", + "db0": ">=0.2.1", + "idb-keyval": "^6.2.1", + "ioredis": "^5.4.2", + "uploadthing": "^7.4.4" + }, + "peerDependenciesMeta": { + "@azure/app-configuration": { + "optional": true + }, + "@azure/cosmos": { + "optional": true + }, + "@azure/data-tables": { + "optional": true + }, + "@azure/identity": { + "optional": true + }, + "@azure/keyvault-secrets": { + "optional": true + }, + "@azure/storage-blob": { + "optional": true + }, + "@capacitor/preferences": { + "optional": true + }, + "@deno/kv": { + "optional": true + }, + "@netlify/blobs": { + "optional": true + }, + "@planetscale/database": { + "optional": true + }, + "@upstash/redis": { + "optional": true + }, + "@vercel/blob": { + "optional": true + }, + "@vercel/functions": { + "optional": true + }, + "@vercel/kv": { + "optional": true + }, + "aws4fetch": { + "optional": true + }, + "db0": { + "optional": true + }, + "idb-keyval": { + "optional": true + }, + "ioredis": { + "optional": true + }, + "uploadthing": { + "optional": true + } + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/valtio": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/valtio/-/valtio-2.1.7.tgz", + "integrity": "sha512-DwJhCDpujuQuKdJ2H84VbTjEJJteaSmqsuUltsfbfdbotVfNeTE4K/qc/Wi57I9x8/2ed4JNdjEna7O6PfavRg==", + "license": "MIT", + "dependencies": { + "proxy-compare": "^3.0.1" + }, + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "@types/react": ">=18.0.0", + "react": ">=18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react": { + "optional": true + } + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/ws": { + "version": "8.18.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz", + "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@reown/appkit-adapter-bitcoin/node_modules/zod": { + "version": "3.22.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, "node_modules/@reown/appkit-adapter-wagmi": { "version": "1.7.17", "license": "Apache-2.0", @@ -3113,6 +3786,12 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA==", + "license": "MIT" + }, "node_modules/@types/ms": { "version": "2.1.0", "license": "MIT" @@ -3498,6 +4177,7 @@ "node_modules/@wagmi/connectors": { "version": "5.9.1", "license": "MIT", + "optional": true, "dependencies": { "@base-org/account": "1.1.1", "@coinbase/wallet-sdk": "4.3.6", @@ -3524,6 +4204,7 @@ "node_modules/@wagmi/core": { "version": "2.18.1", "license": "MIT", + "peer": true, "dependencies": { "eventemitter3": "5.0.1", "mipd": "0.0.7", @@ -3548,11 +4229,13 @@ }, "node_modules/@wagmi/core/node_modules/eventemitter3": { "version": "5.0.1", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@wagmi/core/node_modules/zustand": { "version": "5.0.0", "license": "MIT", + "peer": true, "engines": { "node": ">=12.20.0" }, @@ -9141,6 +9824,10 @@ "wrappy": "1" } }, + "node_modules/opchan-core": { + "resolved": "../packages/core", + "link": true + }, "node_modules/optionator": { "version": "0.9.4", "dev": true, @@ -11063,7 +11750,9 @@ } }, "node_modules/viem": { - "version": "2.37.1", + "version": "2.37.5", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.37.5.tgz", + "integrity": "sha512-bLKvKgLcge6KWBMLk8iP9weu5tHNr0hkxPNwQd+YQrHEgek7ogTBBeE10T0V6blwBMYmeZFZHLnMhDmPjp63/A==", "funding": [ { "type": "github", @@ -11076,7 +11765,7 @@ "@noble/hashes": "1.8.0", "@scure/bip32": "1.7.0", "@scure/bip39": "1.6.0", - "abitype": "1.0.8", + "abitype": "1.1.0", "isows": "1.0.7", "ox": "0.9.3", "ws": "8.18.3" @@ -11126,6 +11815,27 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/viem/node_modules/abitype": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.1.0.tgz", + "integrity": "sha512-6Vh4HcRxNMLA0puzPjM5GBgT4aAcFGKZzSgAXvuZ27shJP6NEpielTuqbBmZILR5/xd0PizkBGy5hReKz9jl5A==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "typescript": ">=5.0.4", + "zod": "^3.22.0 || ^4.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, "node_modules/viem/node_modules/eventemitter3": { "version": "5.0.1", "license": "MIT" @@ -11158,25 +11868,6 @@ } } }, - "node_modules/viem/node_modules/ox/node_modules/abitype": { - "version": "1.0.9", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/wevm" - }, - "peerDependencies": { - "typescript": ">=5.0.4", - "zod": "^3 >=3.22.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - }, - "zod": { - "optional": true - } - } - }, "node_modules/vite": { "version": "5.4.10", "dev": true, @@ -11350,11 +12041,13 @@ } }, "node_modules/wagmi": { - "version": "2.16.1", + "version": "2.16.9", + "resolved": "https://registry.npmjs.org/wagmi/-/wagmi-2.16.9.tgz", + "integrity": "sha512-5NbjvuNNhT0t0lQsDD5otQqZ5RZBM1UhInHoBq/Lpnr6xLLa8AWxYqHg5oZtGCdiUNltys11iBOS6z4mLepIqw==", "license": "MIT", "dependencies": { - "@wagmi/connectors": "5.9.1", - "@wagmi/core": "2.18.1", + "@wagmi/connectors": "5.9.9", + "@wagmi/core": "2.20.3", "use-sync-external-store": "1.4.0" }, "funding": { @@ -11372,6 +12065,97 @@ } } }, + "node_modules/wagmi/node_modules/@wagmi/connectors": { + "version": "5.9.9", + "resolved": "https://registry.npmjs.org/@wagmi/connectors/-/connectors-5.9.9.tgz", + "integrity": "sha512-6+eqU7P2OtxU2PkIw6kHojfYYUJykYG2K5rSkzVh29RDCAjhJqGEZW5f1b8kV5rUBORip1NpST8QTBNi96JHGQ==", + "license": "MIT", + "dependencies": { + "@base-org/account": "1.1.1", + "@coinbase/wallet-sdk": "4.3.6", + "@gemini-wallet/core": "0.2.0", + "@metamask/sdk": "0.32.0", + "@safe-global/safe-apps-provider": "0.18.6", + "@safe-global/safe-apps-sdk": "9.1.0", + "@walletconnect/ethereum-provider": "2.21.1", + "cbw-sdk": "npm:@coinbase/wallet-sdk@3.9.3" + }, + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "@wagmi/core": "2.20.3", + "typescript": ">=5.0.4", + "viem": "2.x" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/wagmi/node_modules/@wagmi/core": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/@wagmi/core/-/core-2.20.3.tgz", + "integrity": "sha512-gsbuHnWxf0AYZISvR8LvF/vUCIq6/ZwT5f5/FKd6wLA7Wq05NihCvmQpIgrcVbpSJPL67wb6S8fXm3eJGJA1vQ==", + "license": "MIT", + "dependencies": { + "eventemitter3": "5.0.1", + "mipd": "0.0.7", + "zustand": "5.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "@tanstack/query-core": ">=5.0.0", + "typescript": ">=5.0.4", + "viem": "2.x" + }, + "peerDependenciesMeta": { + "@tanstack/query-core": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/wagmi/node_modules/@wagmi/core/node_modules/zustand": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.0.tgz", + "integrity": "sha512-LE+VcmbartOPM+auOjCCLQOsQ05zUTp8RkgwRzefUk+2jISdMMFnxvyTjA4YNWr5ZGXYbVsEMZosttuxUBkojQ==", + "license": "MIT", + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "@types/react": ">=18.0.0", + "immer": ">=9.0.6", + "react": ">=18.0.0", + "use-sync-external-store": ">=1.2.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + }, + "use-sync-external-store": { + "optional": true + } + } + }, + "node_modules/wagmi/node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" + }, "node_modules/webextension-polyfill": { "version": "0.10.0", "license": "MPL-2.0" diff --git a/app/package.json b/app/package.json index 5a2aa02..0a672d0 100644 --- a/app/package.json +++ b/app/package.json @@ -59,6 +59,7 @@ "input-otp": "^1.2.4", "lucide-react": "^0.462.0", "next-themes": "^0.3.0", + "opchan-core": "^1.0.0", "react": "^18.3.1", "react-day-picker": "^8.10.1", "react-dom": "^18.3.1", diff --git a/app/src/App.tsx b/app/src/App.tsx index a51f247..bad0053 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -1,5 +1,3 @@ -//TODO: research into having signatures somehow? -//TODO research: **each message sent should not be able to be spoofed** /** * Reference: * https://www.notion.so/Logos-Forum-PoC-Waku-Powered-Opchan-1968f96fb65c8078b343c43429d66d0a#1968f96fb65c8025a929c2c9255a57c4 @@ -26,9 +24,8 @@ import Dashboard from './pages/Dashboard'; import Index from './pages/Index'; import ProfilePage from './pages/ProfilePage'; import BookmarksPage from './pages/BookmarksPage'; -import { appkitConfig } from './lib/wallet/config'; +import { appkitConfig, config } from 'opchan-core/wallet/config'; import { WagmiProvider } from 'wagmi'; -import { config } from './lib/wallet/config'; import { AppKitProvider } from '@reown/appkit/react'; // Create a client diff --git a/app/src/components/CellList.tsx b/app/src/components/CellList.tsx index d9a3d70..0a660e8 100644 --- a/app/src/components/CellList.tsx +++ b/app/src/components/CellList.tsx @@ -24,8 +24,8 @@ import { import { CypherImage } from './ui/CypherImage'; import { RelevanceIndicator } from './ui/relevance-indicator'; import { ModerationToggle } from './ui/moderation-toggle'; -import { sortCells, SortOption } from '@/lib/utils/sorting'; -import { Cell } from '@/types/forum'; +import { sortCells, SortOption } from 'opchan-core/utils/sorting'; +import { Cell } from 'opchan-core/types/forum'; import { usePending } from '@/hooks/usePending'; import { ShareButton } from './ui/ShareButton'; diff --git a/app/src/components/CommentCard.tsx b/app/src/components/CommentCard.tsx index 020c054..097121a 100644 --- a/app/src/components/CommentCard.tsx +++ b/app/src/components/CommentCard.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { ArrowUp, ArrowDown, Clock, Shield, UserX } from 'lucide-react'; import { formatDistanceToNow } from 'date-fns'; -import { Comment } from '@/types/forum'; +import { Comment } from 'opchan-core/types/forum'; import { useForumActions, usePermissions, diff --git a/app/src/components/CreateCellDialog.tsx b/app/src/components/CreateCellDialog.tsx index bf3aae3..4c9d751 100644 --- a/app/src/components/CreateCellDialog.tsx +++ b/app/src/components/CreateCellDialog.tsx @@ -23,7 +23,7 @@ import { DialogTrigger, } from '@/components/ui/dialog'; import { useToast } from '@/hooks/use-toast'; -import { urlLoads } from '@/lib/utils/urlLoads'; +import { urlLoads } from 'opchan-core/utils/urlLoads'; const formSchema = z.object({ title: z diff --git a/app/src/components/FeedSidebar.tsx b/app/src/components/FeedSidebar.tsx index 114195a..c6fcbaa 100644 --- a/app/src/components/FeedSidebar.tsx +++ b/app/src/components/FeedSidebar.tsx @@ -5,7 +5,7 @@ import { TrendingUp, Users, Eye } from 'lucide-react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { useForumData, useAuth } from '@/hooks'; -import { EVerificationStatus } from '@/types/identity'; +import { EVerificationStatus } from 'opchan-core/types/identity'; import { CypherImage } from '@/components/ui/CypherImage'; import { useUserDisplay } from '@/hooks'; diff --git a/app/src/components/Header.tsx b/app/src/components/Header.tsx index d019d1c..6346023 100644 --- a/app/src/components/Header.tsx +++ b/app/src/components/Header.tsx @@ -2,10 +2,10 @@ import React, { useState } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { useAuth, useWakuHealthStatus } from '@/hooks'; import { useAuth as useAuthContext } from '@/contexts/useAuth'; -import { EVerificationStatus } from '@/types/identity'; +import { EVerificationStatus } from 'opchan-core/types/identity'; import { useForum } from '@/contexts/useForum'; -import { localDatabase } from '@/lib/database/LocalDatabase'; -import { DelegationFullStatus } from '@/lib/delegation'; +import { localDatabase } from 'opchan-core/database/LocalDatabase'; +import { DelegationFullStatus } from 'opchan-core/delegation'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; diff --git a/app/src/components/PostCard.tsx b/app/src/components/PostCard.tsx index bc33a7d..45bb050 100644 --- a/app/src/components/PostCard.tsx +++ b/app/src/components/PostCard.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Link } from 'react-router-dom'; import { ArrowUp, ArrowDown, MessageSquare, Clipboard } from 'lucide-react'; import { formatDistanceToNow } from 'date-fns'; -import { Post } from '@/types/forum'; +import { Post } from 'opchan-core/types/forum'; import { useForumActions, usePermissions, diff --git a/app/src/components/PostList.tsx b/app/src/components/PostList.tsx index c8fb2f0..27061ef 100644 --- a/app/src/components/PostList.tsx +++ b/app/src/components/PostList.tsx @@ -9,7 +9,7 @@ import { useAuth, usePostComments, } from '@/hooks'; -import { EVerificationStatus } from '@/types/identity'; +import { EVerificationStatus } from 'opchan-core/types/identity'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Textarea } from '@/components/ui/textarea'; diff --git a/app/src/components/ui/bookmark-card.tsx b/app/src/components/ui/bookmark-card.tsx index 13594f0..0c64639 100644 --- a/app/src/components/ui/bookmark-card.tsx +++ b/app/src/components/ui/bookmark-card.tsx @@ -8,7 +8,7 @@ import { Trash2, ExternalLink, } from 'lucide-react'; -import { Bookmark, BookmarkType } from '@/types/forum'; +import { Bookmark, BookmarkType } from 'opchan-core/types/forum'; import { useUserDisplay } from '@/hooks'; import { cn } from '@/lib/utils'; import { formatDistanceToNow } from 'date-fns'; diff --git a/app/src/components/ui/call-sign-setup-dialog.tsx b/app/src/components/ui/call-sign-setup-dialog.tsx index b68887c..2b2839a 100644 --- a/app/src/components/ui/call-sign-setup-dialog.tsx +++ b/app/src/components/ui/call-sign-setup-dialog.tsx @@ -30,7 +30,7 @@ import { SelectValue, } from '@/components/ui/select'; import { useToast } from '@/hooks/use-toast'; -import { EDisplayPreference } from '@/types/identity'; +import { EDisplayPreference } from 'opchan-core/types/identity'; const formSchema = z.object({ callSign: z diff --git a/app/src/components/ui/delegation-step.tsx b/app/src/components/ui/delegation-step.tsx index 0c97535..062211a 100644 --- a/app/src/components/ui/delegation-step.tsx +++ b/app/src/components/ui/delegation-step.tsx @@ -3,7 +3,7 @@ import { Button } from './button'; import { useAuth, useAuthActions } from '@/hooks'; import { useAuth as useAuthContext } from '@/contexts/useAuth'; import { CheckCircle, AlertCircle, Trash2 } from 'lucide-react'; -import { DelegationDuration, DelegationFullStatus } from '@/lib/delegation'; +import { DelegationDuration, DelegationFullStatus } from 'opchan-core/delegation'; interface DelegationStepProps { onComplete: () => void; diff --git a/app/src/components/ui/relevance-indicator.tsx b/app/src/components/ui/relevance-indicator.tsx index 4858c66..b6183a3 100644 --- a/app/src/components/ui/relevance-indicator.tsx +++ b/app/src/components/ui/relevance-indicator.tsx @@ -23,7 +23,7 @@ import { MessageSquare, ThumbsUp, } from 'lucide-react'; -import { RelevanceScoreDetails } from '@/types/forum'; +import { RelevanceScoreDetails } from 'opchan-core/types/forum'; interface RelevanceIndicatorProps { score: number; diff --git a/app/src/components/ui/verification-step.tsx b/app/src/components/ui/verification-step.tsx index 578f62e..b005184 100644 --- a/app/src/components/ui/verification-step.tsx +++ b/app/src/components/ui/verification-step.tsx @@ -9,9 +9,9 @@ import { AlertCircle, } from 'lucide-react'; import { useAuth, useAuthActions } from '@/hooks'; -import { EVerificationStatus } from '@/types/identity'; +import { EVerificationStatus } from 'opchan-core/types/identity'; import { useAppKitAccount } from '@reown/appkit/react'; -import { OrdinalDetails, EnsDetails } from '@/types/identity'; +import { OrdinalDetails, EnsDetails } from 'opchan-core/types/identity'; interface VerificationStepProps { onComplete: () => void; diff --git a/app/src/components/ui/wallet-wizard.tsx b/app/src/components/ui/wallet-wizard.tsx index f1b29a7..a831d15 100644 --- a/app/src/components/ui/wallet-wizard.tsx +++ b/app/src/components/ui/wallet-wizard.tsx @@ -10,7 +10,7 @@ import { Button } from '@/components/ui/button'; import { CheckCircle, Circle, Loader2 } from 'lucide-react'; import { useAuth } from '@/hooks'; import { useDelegation } from '@/hooks/useDelegation'; -import { EVerificationStatus } from '@/types/identity'; +import { EVerificationStatus } from 'opchan-core/types/identity'; import { WalletConnectionStep } from './wallet-connection-step'; import { VerificationStep } from './verification-step'; import { DelegationStep } from './delegation-step'; diff --git a/app/src/contexts/AuthContext.tsx b/app/src/contexts/AuthContext.tsx index 870cc44..0b17b86 100644 --- a/app/src/contexts/AuthContext.tsx +++ b/app/src/contexts/AuthContext.tsx @@ -1,18 +1,18 @@ import React, { createContext, useState, useEffect, useMemo } from 'react'; import { useToast } from '@/components/ui/use-toast'; -import { OpchanMessage } from '@/types/forum'; +import { OpchanMessage } from 'opchan-core/types/forum'; import { User, EVerificationStatus, EDisplayPreference, -} from '@/types/identity'; -import { WalletManager } from '@/lib/wallet'; +} from 'opchan-core/types/identity'; +import { WalletManager } from 'opchan-core/wallet'; import { DelegationManager, DelegationDuration, DelegationFullStatus, -} from '@/lib/delegation'; -import { localDatabase } from '@/lib/database/LocalDatabase'; +} from 'opchan-core/delegation'; +import { localDatabase } from 'opchan-core/database/LocalDatabase'; import { useAppKitAccount, useDisconnect, modal } from '@reown/appkit/react'; interface AuthContextType { diff --git a/app/src/contexts/ForumContext.tsx b/app/src/contexts/ForumContext.tsx index e63e743..2026570 100644 --- a/app/src/contexts/ForumContext.tsx +++ b/app/src/contexts/ForumContext.tsx @@ -6,25 +6,25 @@ import React, { useMemo, useRef, } from 'react'; -import { Cell, Post, Comment } from '@/types/forum'; +import { Cell, Post, Comment } from 'opchan-core/types/forum'; import { User, EVerificationStatus, EDisplayPreference, -} from '@/types/identity'; +} from 'opchan-core/types/identity'; import { useToast } from '@/components/ui/use-toast'; -import { ForumActions } from '@/lib/forum/ForumActions'; -import { monitorNetworkHealth, initializeNetwork } from '@/lib/waku/network'; -import messageManager from '@/lib/waku'; -import { getDataFromCache } from '@/lib/forum/transformers'; -import { RelevanceCalculator } from '@/lib/forum/RelevanceCalculator'; -import { UserVerificationStatus } from '@/types/forum'; -import { DelegationManager } from '@/lib/delegation'; -import { UserIdentityService } from '@/lib/services/UserIdentityService'; -import { MessageService } from '@/lib/services/MessageService'; +import { ForumActions } from 'opchan-core/forum/ForumActions'; +import { monitorNetworkHealth, initializeNetwork } from 'opchan-core/waku/network'; +import messageManager from 'opchan-core/waku'; +import { getDataFromCache } from 'opchan-core/forum/transformers'; +import { RelevanceCalculator } from 'opchan-core/forum/RelevanceCalculator'; +import { UserVerificationStatus } from 'opchan-core/types/forum'; +import { DelegationManager } from 'opchan-core/delegation'; +import { UserIdentityService } from 'opchan-core/services/UserIdentityService'; +import { MessageService } from 'opchan-core/services/MessageService'; import { useAuth } from '@/contexts/useAuth'; -import { localDatabase } from '@/lib/database/LocalDatabase'; +import { localDatabase } from 'opchan-core/database/LocalDatabase'; interface ForumContextType { cells: Cell[]; diff --git a/app/src/contexts/ModerationContext.tsx b/app/src/contexts/ModerationContext.tsx index 09f7132..90d1209 100644 --- a/app/src/contexts/ModerationContext.tsx +++ b/app/src/contexts/ModerationContext.tsx @@ -1,5 +1,5 @@ import React, { createContext, useContext, useState, useEffect } from 'react'; -import { localDatabase } from '@/lib/database/LocalDatabase'; +import { localDatabase } from 'opchan-core/database/LocalDatabase'; interface ModerationContextType { showModerated: boolean; diff --git a/app/src/hooks/actions/useAuthActions.ts b/app/src/hooks/actions/useAuthActions.ts index c00eded..483d97e 100644 --- a/app/src/hooks/actions/useAuthActions.ts +++ b/app/src/hooks/actions/useAuthActions.ts @@ -1,9 +1,9 @@ import { useCallback, useState } from 'react'; import { useAuth } from '@/hooks/core/useAuth'; -import { DelegationDuration } from '@/lib/delegation'; +import { DelegationDuration } from 'opchan-core/delegation'; import { useToast } from '@/components/ui/use-toast'; import { useAuth as useAuthContext } from '@/contexts/useAuth'; -import { EVerificationStatus } from '@/types/identity'; +import { EVerificationStatus } from 'opchan-core/types/identity'; export interface AuthActionStates { isConnecting: boolean; diff --git a/app/src/hooks/actions/useForumActions.ts b/app/src/hooks/actions/useForumActions.ts index 96402a0..ac86b55 100644 --- a/app/src/hooks/actions/useForumActions.ts +++ b/app/src/hooks/actions/useForumActions.ts @@ -2,7 +2,7 @@ import { useCallback } from 'react'; import { useForum } from '@/contexts/useForum'; import { useAuth } from '@/hooks/core/useAuth'; import { usePermissions } from '@/hooks/core/usePermissions'; -import { Cell, Post, Comment } from '@/types/forum'; +import { Cell, Post, Comment } from 'opchan-core/types/forum'; import { useToast } from '@/components/ui/use-toast'; export interface ForumActionStates { diff --git a/app/src/hooks/actions/useUserActions.ts b/app/src/hooks/actions/useUserActions.ts index c7261fd..cf5a0a3 100644 --- a/app/src/hooks/actions/useUserActions.ts +++ b/app/src/hooks/actions/useUserActions.ts @@ -2,7 +2,7 @@ import { useCallback, useState } from 'react'; import { useForum } from '@/contexts/useForum'; import { useAuth } from '@/hooks/core/useAuth'; import { usePermissions } from '@/hooks/core/usePermissions'; -import { EDisplayPreference } from '@/types/identity'; +import { EDisplayPreference } from 'opchan-core/types/identity'; import { useToast } from '@/components/ui/use-toast'; export interface UserActionStates { diff --git a/app/src/hooks/core/useAuth.ts b/app/src/hooks/core/useAuth.ts index 4ba7a1c..583e704 100644 --- a/app/src/hooks/core/useAuth.ts +++ b/app/src/hooks/core/useAuth.ts @@ -1,6 +1,6 @@ import { useAuth as useBaseAuth } from '@/contexts/useAuth'; import { useForum } from '@/contexts/useForum'; -import { User, EVerificationStatus } from '@/types/identity'; +import { User, EVerificationStatus } from 'opchan-core/types/identity'; export interface AuthState { currentUser: User | null; diff --git a/app/src/hooks/core/useBookmarks.ts b/app/src/hooks/core/useBookmarks.ts index 1fcfd2d..1c24da3 100644 --- a/app/src/hooks/core/useBookmarks.ts +++ b/app/src/hooks/core/useBookmarks.ts @@ -1,6 +1,6 @@ import { useState, useEffect, useCallback } from 'react'; -import { Bookmark, BookmarkType, Post, Comment } from '@/types/forum'; -import { BookmarkService } from '@/lib/services/BookmarkService'; +import { Bookmark, BookmarkType, Post, Comment } from 'opchan-core/types/forum'; +import { BookmarkService } from 'opchan-core/services/BookmarkService'; import { useAuth } from '@/contexts/useAuth'; /** diff --git a/app/src/hooks/core/useEnhancedUserDisplay.ts b/app/src/hooks/core/useEnhancedUserDisplay.ts index bdad558..11c0285 100644 --- a/app/src/hooks/core/useEnhancedUserDisplay.ts +++ b/app/src/hooks/core/useEnhancedUserDisplay.ts @@ -1,6 +1,6 @@ import { useState, useEffect, useMemo } from 'react'; import { useForum } from '@/contexts/useForum'; -import { EDisplayPreference, EVerificationStatus } from '@/types/identity'; +import { EDisplayPreference, EVerificationStatus } from 'opchan-core/types/identity'; export interface UserDisplayInfo { displayName: string; diff --git a/app/src/hooks/core/useForumData.ts b/app/src/hooks/core/useForumData.ts index 8da6ff0..a188f86 100644 --- a/app/src/hooks/core/useForumData.ts +++ b/app/src/hooks/core/useForumData.ts @@ -2,8 +2,8 @@ import { useMemo } from 'react'; import { useForum } from '@/contexts/useForum'; import { useAuth } from '@/contexts/useAuth'; import { useModeration } from '@/contexts/ModerationContext'; -import { Cell, Post, Comment, UserVerificationStatus } from '@/types/forum'; -import { EVerificationStatus } from '@/types/identity'; +import { Cell, Post, Comment, UserVerificationStatus } from 'opchan-core/types/forum'; +import { EVerificationStatus } from 'opchan-core/types/identity'; export interface CellWithStats extends Cell { postCount: number; diff --git a/app/src/hooks/core/usePermissions.ts b/app/src/hooks/core/usePermissions.ts index 0d64c6c..a878968 100644 --- a/app/src/hooks/core/usePermissions.ts +++ b/app/src/hooks/core/usePermissions.ts @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { useAuth } from './useAuth'; import { useForumData } from './useForumData'; -import { EVerificationStatus } from '@/types/identity'; +import { EVerificationStatus } from 'opchan-core/types/identity'; export interface Permission { canPost: boolean; diff --git a/app/src/hooks/derived/useCell.ts b/app/src/hooks/derived/useCell.ts index 07f7b13..9c99855 100644 --- a/app/src/hooks/derived/useCell.ts +++ b/app/src/hooks/derived/useCell.ts @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { useForumData, CellWithStats } from '@/hooks/core/useForumData'; import { useAuth } from '@/hooks/core/useAuth'; -import { EVerificationStatus } from '@/types/identity'; +import { EVerificationStatus } from 'opchan-core/types/identity'; export interface CellData extends CellWithStats { posts: Array<{ diff --git a/app/src/hooks/useDelegation.ts b/app/src/hooks/useDelegation.ts index b49de24..2610b69 100644 --- a/app/src/hooks/useDelegation.ts +++ b/app/src/hooks/useDelegation.ts @@ -1,6 +1,6 @@ import { useCallback, useContext, useState, useEffect } from 'react'; import { AuthContext } from '@/contexts/AuthContext'; -import { DelegationDuration } from '@/lib/delegation'; +import { DelegationDuration } from 'opchan-core/delegation'; export const useDelegation = () => { const context = useContext(AuthContext); diff --git a/app/src/hooks/useMessageSigning.ts b/app/src/hooks/useMessageSigning.ts index eb233e3..8ee329b 100644 --- a/app/src/hooks/useMessageSigning.ts +++ b/app/src/hooks/useMessageSigning.ts @@ -1,6 +1,6 @@ import { useCallback, useContext } from 'react'; import { AuthContext } from '@/contexts/AuthContext'; -import { OpchanMessage } from '@/types/forum'; +import { OpchanMessage } from 'opchan-core/types/forum'; export const useMessageSigning = () => { const context = useContext(AuthContext); diff --git a/app/src/hooks/usePending.ts b/app/src/hooks/usePending.ts index 8c47dfe..8896907 100644 --- a/app/src/hooks/usePending.ts +++ b/app/src/hooks/usePending.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import { localDatabase } from '@/lib/database/LocalDatabase'; +import { localDatabase } from 'opchan-core/database/LocalDatabase'; import { useAuth } from '@/contexts/useAuth'; export function usePending(id: string | undefined) { diff --git a/app/src/hooks/useWakuHealth.ts b/app/src/hooks/useWakuHealth.ts index e763c99..23a2797 100644 --- a/app/src/hooks/useWakuHealth.ts +++ b/app/src/hooks/useWakuHealth.ts @@ -1,6 +1,6 @@ import { useState, useEffect, useCallback } from 'react'; import { HealthStatus } from '@waku/sdk'; -import messageManager from '@/lib/waku'; +import messageManager from 'opchan-core/waku'; export interface WakuHealthState { isReady: boolean; diff --git a/app/src/hooks/utilities/selectors.ts b/app/src/hooks/utilities/selectors.ts index 9926553..4533f83 100644 --- a/app/src/hooks/utilities/selectors.ts +++ b/app/src/hooks/utilities/selectors.ts @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { ForumData } from '@/hooks/core/useForumData'; -import { Cell, Post, Comment } from '@/types/forum'; -import { EVerificationStatus } from '@/types/identity'; +import { Cell, Post, Comment } from 'opchan-core/types/forum'; +import { EVerificationStatus } from 'opchan-core/types/identity'; // Selector types for different data slices export type CellSelector = (cells: Cell[]) => T; diff --git a/app/src/hooks/utilities/useNetworkStatus.ts b/app/src/hooks/utilities/useNetworkStatus.ts index 59c4176..2026582 100644 --- a/app/src/hooks/utilities/useNetworkStatus.ts +++ b/app/src/hooks/utilities/useNetworkStatus.ts @@ -2,7 +2,7 @@ import { useMemo, useState, useEffect } from 'react'; import { useForum } from '@/contexts/useForum'; import { useAuth } from '@/hooks/core/useAuth'; import { useAuth as useAuthContext } from '@/contexts/useAuth'; -import { DelegationFullStatus } from '@/lib/delegation'; +import { DelegationFullStatus } from 'opchan-core/delegation'; export interface NetworkHealth { isConnected: boolean; diff --git a/app/src/lib/utils.ts b/app/src/lib/utils.ts new file mode 100644 index 0000000..9ad0df4 --- /dev/null +++ b/app/src/lib/utils.ts @@ -0,0 +1,6 @@ +import { type ClassValue, clsx } from 'clsx'; +import { twMerge } from 'tailwind-merge'; + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)); +} diff --git a/app/src/pages/BookmarksPage.tsx b/app/src/pages/BookmarksPage.tsx index e86da8d..7026af6 100644 --- a/app/src/pages/BookmarksPage.tsx +++ b/app/src/pages/BookmarksPage.tsx @@ -17,7 +17,7 @@ import { AlertDialogTrigger, } from '@/components/ui/alert-dialog'; import { useBookmarks } from '@/hooks'; -import { Bookmark, BookmarkType } from '@/types/forum'; +import { Bookmark, BookmarkType } from 'opchan-core/types/forum'; import { Trash2, Bookmark as BookmarkIcon, diff --git a/app/src/pages/FeedPage.tsx b/app/src/pages/FeedPage.tsx index 14a3094..ffe9e6d 100644 --- a/app/src/pages/FeedPage.tsx +++ b/app/src/pages/FeedPage.tsx @@ -13,8 +13,8 @@ import PostCard from '@/components/PostCard'; import FeedSidebar from '@/components/FeedSidebar'; import { ModerationToggle } from '@/components/ui/moderation-toggle'; import { useForumData, useAuth, useForumActions } from '@/hooks'; -import { EVerificationStatus } from '@/types/identity'; -import { sortPosts, SortOption } from '@/lib/utils/sorting'; +import { EVerificationStatus } from 'opchan-core/types/identity'; +import { sortPosts, SortOption } from 'opchan-core/utils/sorting'; const FeedPage: React.FC = () => { const forumData = useForumData(); diff --git a/app/src/pages/ProfilePage.tsx b/app/src/pages/ProfilePage.tsx index 8fcfba0..920e940 100644 --- a/app/src/pages/ProfilePage.tsx +++ b/app/src/pages/ProfilePage.tsx @@ -3,7 +3,7 @@ import { useAuth, useUserActions, useForumActions } from '@/hooks'; import { useAuth as useAuthContext } from '@/contexts/useAuth'; import { useUserDisplay } from '@/hooks'; import { useDelegation } from '@/hooks/useDelegation'; -import { DelegationFullStatus } from '@/lib/delegation'; +import { DelegationFullStatus } from 'opchan-core/delegation'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; @@ -32,7 +32,7 @@ import { Save, X, } from 'lucide-react'; -import { EDisplayPreference, EVerificationStatus } from '@/types/identity'; +import { EDisplayPreference, EVerificationStatus } from 'opchan-core/types/identity'; import { useToast } from '@/hooks/use-toast'; export default function ProfilePage() {