From 0385a267f57a7e8a37073c1f5b6ae8048ce68b42 Mon Sep 17 00:00:00 2001 From: Danish Arora Date: Tue, 23 Sep 2025 16:06:34 +0530 Subject: [PATCH] chore: time range for sds store query to 1 month --- app/src/App.tsx | 2 + app/src/components/Header.tsx | 8 +- app/src/pages/ProfilePage.tsx | 3 +- package-lock.json | 113 ++++++++++-------- packages/core/package.json | 2 +- packages/core/src/lib/waku/constants.ts | 11 -- .../src/lib/waku/core/ReliableMessaging.ts | 16 +-- 7 files changed, 85 insertions(+), 70 deletions(-) diff --git a/app/src/App.tsx b/app/src/App.tsx index 322c93f..0367830 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -23,6 +23,7 @@ import Dashboard from './pages/Dashboard'; import Index from './pages/Index'; import ProfilePage from './pages/ProfilePage'; import BookmarksPage from './pages/BookmarksPage'; +import DebugPage from './pages/DebugPage'; // Create a client const queryClient = new QueryClient(); @@ -40,6 +41,7 @@ const App = () => ( } /> } /> } /> + } /> } /> diff --git a/app/src/components/Header.tsx b/app/src/components/Header.tsx index 53aafb7..6b28bf6 100644 --- a/app/src/components/Header.tsx +++ b/app/src/components/Header.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { useAuth, useForumContext, useNetworkStatus } from '@opchan/react'; import { EVerificationStatus } from '@opchan/core'; @@ -57,7 +57,7 @@ const Header = () => { const wakuHealth = { statusMessage: network.getStatusMessage(), }; - const location = useLocation(); + const location = useLocation() const { toast } = useToast(); const forumContext = useForumContext(); @@ -67,6 +67,10 @@ const Header = () => { const isConnected = bitcoinAccount.isConnected || ethereumAccount.isConnected; + useEffect(()=> { + console.log('currentUser', currentUser); + }, []) + // Use currentUser address (which has ENS details) instead of raw AppKit address diff --git a/app/src/pages/ProfilePage.tsx b/app/src/pages/ProfilePage.tsx index 03e4889..7d42917 100644 --- a/app/src/pages/ProfilePage.tsx +++ b/app/src/pages/ProfilePage.tsx @@ -29,7 +29,8 @@ import { Globe, Edit3, Save, - X, + X, + } from 'lucide-react'; import { EDisplayPreference, EVerificationStatus } from '@opchan/core'; import { useToast } from '@/hooks/use-toast'; diff --git a/package-lock.json b/package-lock.json index c03dddf..eea6048 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5014,6 +5014,15 @@ "integrity": "sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA==", "license": "MIT" }, + "node_modules/@types/lodash.debounce": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/lodash.debounce/-/lodash.debounce-4.0.9.tgz", + "integrity": "sha512-Ma5JcgTREwpLRwMM+XwBR7DaWe96nC38uCBDFKZWbNKD+osjVzdpnUSwBcqCptrp16sSOLBAUb50Car5I0TCsQ==", + "license": "MIT", + "dependencies": { + "@types/lodash": "*" + } + }, "node_modules/@types/mdast": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", @@ -5638,17 +5647,17 @@ } }, "node_modules/@waku/core": { - "version": "0.0.39-eb93360.0", - "resolved": "https://registry.npmjs.org/@waku/core/-/core-0.0.39-eb93360.0.tgz", - "integrity": "sha512-0BLrm9SEJVjtRDRjkc3lAY9PessVNd8mIfqqqSaDu3rjP3PGjpWaFRi9KK1s1FFQbiG2kXHwBs2Q3zxYWTvYag==", + "version": "0.0.40-79dfb35.0", + "resolved": "https://registry.npmjs.org/@waku/core/-/core-0.0.40-79dfb35.0.tgz", + "integrity": "sha512-+94ez/4zZDQffAK/ERzXOkqCOlMh28/EEtTmqdaahSLrpc3EgqdIsDC8uUPddkOSDoaJ2Y657gm4WZ4PjyRmOQ==", "license": "MIT OR Apache-2.0", "dependencies": { "@libp2p/ping": "2.0.35", "@noble/hashes": "^1.3.2", - "@waku/enr": "0.0.33-eb93360.0", - "@waku/interfaces": "0.0.34-eb93360.0", - "@waku/proto": "0.0.14-eb93360.0", - "@waku/utils": "0.0.27-eb93360.0", + "@waku/enr": "0.0.34-79dfb35.0", + "@waku/interfaces": "0.0.35-79dfb35.0", + "@waku/proto": "0.0.15-79dfb35.0", + "@waku/utils": "0.0.28-79dfb35.0", "debug": "^4.3.4", "it-all": "^3.0.4", "it-length-prefixed": "^9.0.4", @@ -5703,16 +5712,16 @@ } }, "node_modules/@waku/discovery": { - "version": "0.0.12-eb93360.0", - "resolved": "https://registry.npmjs.org/@waku/discovery/-/discovery-0.0.12-eb93360.0.tgz", - "integrity": "sha512-lFq72Pw6hUZfFdy2ioeEO6dZgJ6U8afDg5EHsnEZUC72vsJMiWmzm5XO5a84Tqt10E079mxKBGA3+cC+Djzz7Q==", + "version": "0.0.13-79dfb35.0", + "resolved": "https://registry.npmjs.org/@waku/discovery/-/discovery-0.0.13-79dfb35.0.tgz", + "integrity": "sha512-YNR7ThBjerUqqK0dOPAartpx5OeQN3r3xmuabUm8SCnKKXFLbB7WFBtSwu3X0O4GoalhtC9fAJhkia91A6CZEQ==", "license": "MIT OR Apache-2.0", "dependencies": { - "@waku/core": "0.0.39-eb93360.0", - "@waku/enr": "0.0.33-eb93360.0", - "@waku/interfaces": "0.0.34-eb93360.0", - "@waku/proto": "0.0.14-eb93360.0", - "@waku/utils": "0.0.27-eb93360.0", + "@waku/core": "0.0.40-79dfb35.0", + "@waku/enr": "0.0.34-79dfb35.0", + "@waku/interfaces": "0.0.35-79dfb35.0", + "@waku/proto": "0.0.15-79dfb35.0", + "@waku/utils": "0.0.28-79dfb35.0", "debug": "^4.3.4", "dns-over-http-resolver": "^3.0.8", "hi-base32": "^0.5.1", @@ -5723,9 +5732,9 @@ } }, "node_modules/@waku/enr": { - "version": "0.0.33-eb93360.0", - "resolved": "https://registry.npmjs.org/@waku/enr/-/enr-0.0.33-eb93360.0.tgz", - "integrity": "sha512-Rejx1qoiO8s5nxxp9AE2PKnatStL8TpgJEL3TwmbhBONW9U4JvP3YvqRMFqhLEV+mbrt9zTon19rfqCOzd+kVg==", + "version": "0.0.34-79dfb35.0", + "resolved": "https://registry.npmjs.org/@waku/enr/-/enr-0.0.34-79dfb35.0.tgz", + "integrity": "sha512-suGFUu94gizghRQ+gNjTqR4zXMDK91FBlIn0EeALwVIboHX1MUExMjd58qgQ8biWdcJpnB/NiyiobK+5X46U7Q==", "license": "MIT OR Apache-2.0", "dependencies": { "@ethersproject/rlp": "^5.7.0", @@ -5733,7 +5742,7 @@ "@libp2p/peer-id": "5.1.7", "@multiformats/multiaddr": "^12.0.0", "@noble/secp256k1": "^1.7.1", - "@waku/utils": "0.0.27-eb93360.0", + "@waku/utils": "0.0.28-79dfb35.0", "debug": "^4.3.4", "js-sha3": "^0.9.2" }, @@ -5777,18 +5786,18 @@ } }, "node_modules/@waku/interfaces": { - "version": "0.0.34-eb93360.0", - "resolved": "https://registry.npmjs.org/@waku/interfaces/-/interfaces-0.0.34-eb93360.0.tgz", - "integrity": "sha512-nMiUgcM86SLLNWxjdHmsQ4m0ONnnF9j0mfnTbj156UZ8QcP3X38BcOjKSXw0y6b+Iv97cqXjNqzJXOwX2BqoPA==", + "version": "0.0.35-79dfb35.0", + "resolved": "https://registry.npmjs.org/@waku/interfaces/-/interfaces-0.0.35-79dfb35.0.tgz", + "integrity": "sha512-3zBBpblsSrLHUAOjkQ+js0G5/TeNS4PERgR587caxn75xNn7Fd8WvgAM1xhMbtQU08twDZFGXKaJu3m9zCOOmA==", "license": "MIT OR Apache-2.0", "engines": { "node": ">=22" } }, "node_modules/@waku/proto": { - "version": "0.0.14-eb93360.0", - "resolved": "https://registry.npmjs.org/@waku/proto/-/proto-0.0.14-eb93360.0.tgz", - "integrity": "sha512-KvPyFVxKRUseOwk2l92BUbc7IqlwPGpe8HMWNoKV3ud7lisJbFz6PnYgDIGVNoVHk0pz75RtyxvgbMTBf5UsYQ==", + "version": "0.0.15-79dfb35.0", + "resolved": "https://registry.npmjs.org/@waku/proto/-/proto-0.0.15-79dfb35.0.tgz", + "integrity": "sha512-lH2a74lNzXKNpALDWIMLFfNMmfJtd+lAFgLhMEu3lHBVCgu1SVXy54fBk3X08A/cfOZSzuW0kStlND6GsYQOyA==", "license": "MIT OR Apache-2.0", "dependencies": { "protons-runtime": "^5.4.0" @@ -5798,9 +5807,9 @@ } }, "node_modules/@waku/sdk": { - "version": "0.0.35-eb93360.0", - "resolved": "https://registry.npmjs.org/@waku/sdk/-/sdk-0.0.35-eb93360.0.tgz", - "integrity": "sha512-9ZmhcG1q54YaLTWnTiTKImFBjLnS1zMM8fMBiBmY1097Jb71u1v8OBYdhsFE00uhOkpt4qMZc2RNrzMZhf+H8g==", + "version": "0.0.36-79dfb35.0", + "resolved": "https://registry.npmjs.org/@waku/sdk/-/sdk-0.0.36-79dfb35.0.tgz", + "integrity": "sha512-mbr8dzHLq5T4K4ShfJwOlPeAY2v9ABvZ5mUbViFsKgfwO14vQV4X80P/lgyiFYwQg8r6ZL7Mc9UkRz/FArgSDg==", "license": "MIT OR Apache-2.0", "dependencies": { "@chainsafe/libp2p-noise": "16.1.3", @@ -5810,28 +5819,30 @@ "@libp2p/ping": "2.0.35", "@libp2p/websockets": "9.2.16", "@noble/hashes": "^1.3.3", - "@waku/core": "0.0.39-eb93360.0", - "@waku/discovery": "0.0.12-eb93360.0", - "@waku/interfaces": "0.0.34-eb93360.0", - "@waku/proto": "0.0.14-eb93360.0", - "@waku/sds": "0.0.7-eb93360.0", - "@waku/utils": "0.0.27-eb93360.0", - "libp2p": "2.8.11" + "@types/lodash.debounce": "^4.0.9", + "@waku/core": "0.0.40-79dfb35.0", + "@waku/discovery": "0.0.13-79dfb35.0", + "@waku/interfaces": "0.0.35-79dfb35.0", + "@waku/proto": "0.0.15-79dfb35.0", + "@waku/sds": "0.0.8-79dfb35.0", + "@waku/utils": "0.0.28-79dfb35.0", + "libp2p": "2.8.11", + "lodash.debounce": "^4.0.8" }, "engines": { "node": ">=22" } }, "node_modules/@waku/sds": { - "version": "0.0.7-eb93360.0", - "resolved": "https://registry.npmjs.org/@waku/sds/-/sds-0.0.7-eb93360.0.tgz", - "integrity": "sha512-vHlEAVbhAh662sCJ88hMgJMdP+KfuNwh4xBAcTzhuyhMFur4aw79Ci0OhAlziDPDyPA9ziCEnnpm2BX4319O2g==", + "version": "0.0.8-79dfb35.0", + "resolved": "https://registry.npmjs.org/@waku/sds/-/sds-0.0.8-79dfb35.0.tgz", + "integrity": "sha512-hhzlLwgSsDYYmIBBZprJWkCUkI6oJfrgUgMAyrC04JIQbzvuOF0sRHHUY4C6VQKmxUJFU0Lj+RRPj1pR6ezk9w==", "license": "MIT OR Apache-2.0", "dependencies": { "@libp2p/interface": "2.10.4", "@noble/hashes": "^1.7.1", - "@waku/proto": "0.0.14-eb93360.0", - "@waku/utils": "0.0.27-eb93360.0", + "@waku/proto": "0.0.15-79dfb35.0", + "@waku/utils": "0.0.28-79dfb35.0", "chai": "^5.1.2", "lodash": "^4.17.21" }, @@ -5855,13 +5866,13 @@ } }, "node_modules/@waku/utils": { - "version": "0.0.27-eb93360.0", - "resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.27-eb93360.0.tgz", - "integrity": "sha512-31vyI/42ZXTHA3PqmIMFFyO2xykDDWTe6SdFALBN66mtMfHKxHY1u2sQ9UzIHK0qVGCAWcEPyAusRXr4FjbTgg==", + "version": "0.0.28-79dfb35.0", + "resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.28-79dfb35.0.tgz", + "integrity": "sha512-wwNg+qGI5MmoT+DD+1+AUM6SMJvOgqcXawVVlXc83UMgWgU44YshBdfrhsxv/CPUfIN2l6i39uU6zhDN5INT4A==", "license": "MIT OR Apache-2.0", "dependencies": { "@noble/hashes": "^1.3.2", - "@waku/interfaces": "0.0.34-eb93360.0", + "@waku/interfaces": "0.0.35-79dfb35.0", "chai": "^4.3.10", "debug": "^4.3.4", "uint8arrays": "^5.0.1" @@ -11585,9 +11596,9 @@ "license": "MIT" }, "node_modules/is-network-error": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.2.0.tgz", - "integrity": "sha512-32jdpRpJo8SeL7zOuBJbMLz/VTw9mDpTvcKzzR8DkXWsJbbE60gdiX8YOd0UAV6b8Skt+CMytzfgVVIRFidn0Q==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.3.0.tgz", + "integrity": "sha512-6oIwpsgRfnDiyEDLMay/GqCl3HoAtH5+RUKW29gYkL0QA+ipzpDLA16yQs7/RHCSu+BwgbJaOUqa4A99qNVQVw==", "license": "MIT", "engines": { "node": ">=16" @@ -12243,6 +12254,12 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "license": "MIT" + }, "node_modules/lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", @@ -17963,7 +17980,7 @@ "@reown/appkit-adapter-wagmi": "^1.7.17", "@reown/appkit-common": "^1.7.17", "@reown/appkit-controllers": "^1.7.17", - "@waku/sdk": "^0.0.35-67a7287.0", + "@waku/sdk": "^0.0.36-79dfb35.0", "clsx": "^2.1.1", "ordiscan": "^1.3.0", "tailwind-merge": "^2.5.2", diff --git a/packages/core/package.json b/packages/core/package.json index bd67754..64e0b57 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -41,7 +41,7 @@ "@reown/appkit-adapter-wagmi": "^1.7.17", "@reown/appkit-common": "^1.7.17", "@reown/appkit-controllers": "^1.7.17", - "@waku/sdk": "^0.0.35-67a7287.0", + "@waku/sdk": "^0.0.36-79dfb35.0", "clsx": "^2.1.1", "ordiscan": "^1.3.0", "tailwind-merge": "^2.5.2", diff --git a/packages/core/src/lib/waku/constants.ts b/packages/core/src/lib/waku/constants.ts index f6441bb..d6a7160 100644 --- a/packages/core/src/lib/waku/constants.ts +++ b/packages/core/src/lib/waku/constants.ts @@ -4,14 +4,3 @@ */ export const CONTENT_TOPIC = '/opchan-demo/1/messages/proto'; -/** - * Bootstrap nodes for the Waku network - * These are public Waku nodes that our node will connect to on startup - */ -export const BOOTSTRAP_NODES = { - '42': [ - '/dns4/waku-test.bloxy.one/tcp/8095/wss/p2p/16Uiu2HAmSZbDB7CusdRhgkD81VssRjQV5ZH13FbzCGcdnbbh6VwZ', - '/dns4/node-01.do-ams3.waku.sandbox.status.im/tcp/30303/p2p/16Uiu2HAmNaeL4p3WEYzC9mgXBmBWSgWjPHRvatZTXnp8Jgv3iKsb', - '/dns4/vps-aaa00d52.vps.ovh.ca/tcp/8000/wss/p2p/16Uiu2HAm9PftGgHZwWE3wzdMde4m3kT2eYJFXLZfGoSED3gysofk', - ], -}; diff --git a/packages/core/src/lib/waku/core/ReliableMessaging.ts b/packages/core/src/lib/waku/core/ReliableMessaging.ts index a48dea3..6679380 100644 --- a/packages/core/src/lib/waku/core/ReliableMessaging.ts +++ b/packages/core/src/lib/waku/core/ReliableMessaging.ts @@ -2,7 +2,7 @@ import { IDecodedMessage, LightNode, ReliableChannel, - ReliableChannelEvent, + ReliableChannelEvents, } from '@waku/sdk'; import { CodecManager } from '../CodecManager'; import { generateStringId } from '../../utils'; @@ -39,7 +39,8 @@ export class ReliableMessaging { channelId, senderId, encoder, - decoder + decoder, + { initialQueryLookbackMs: 30 * 24 * 60 * 60 * 1000 } ); this.setupChannelListeners(this.channel); } catch (error) { @@ -50,8 +51,9 @@ export class ReliableMessaging { private setupChannelListeners( channel: ReliableChannel ): void { - channel.addEventListener(ReliableChannelEvent.InMessageReceived, event => { + channel.addEventListener("message-received", event => { try { + console.log("received a message, processing...", event.detail); const wakuMessage = event.detail; if (wakuMessage.payload) { const opchanMessage = this.codecManager.decodeMessage( @@ -66,13 +68,13 @@ export class ReliableMessaging { } }); - channel.addEventListener(ReliableChannelEvent.OutMessageSent, event => { + channel.addEventListener("message-sent", event => { const messageId = event.detail; this.messageCallbacks.get(messageId)?.onSent?.(messageId); }); channel.addEventListener( - ReliableChannelEvent.OutMessageAcknowledged, + "message-acknowledged", event => { const messageId = event.detail; this.messageCallbacks.get(messageId)?.onAcknowledged?.(messageId); @@ -80,7 +82,7 @@ export class ReliableMessaging { ); channel.addEventListener( - ReliableChannelEvent.OutMessageIrrecoverableError, + "sending-message-irrecoverable-error", event => { const messageId = event.detail.messageId; const error = event.detail.error; @@ -98,7 +100,7 @@ export class ReliableMessaging { public async sendMessage( message: OpchanMessage, statusCallback?: MessageStatusCallback - ): Promise { + ) { if (!this.channel) { throw new Error('Reliable channel not initialized'); }