From 664156ca7e275cb6d3187e486a188467ce703539 Mon Sep 17 00:00:00 2001 From: Snehagupta1907 Date: Sat, 2 Nov 2024 00:32:36 +0530 Subject: [PATCH 1/8] Fix: Address issue #891->cleanup of apidelay,and Refactor addr assignment for better readability --- app/leaderboard/page.tsx | 69 ++++++++++++++-------------------------- package-lock.json | 34 ++++++++++++++++---- package.json | 2 +- 3 files changed, 52 insertions(+), 53 deletions(-) diff --git a/app/leaderboard/page.tsx b/app/leaderboard/page.tsx index d0d946da..4e2d6679 100644 --- a/app/leaderboard/page.tsx +++ b/app/leaderboard/page.tsx @@ -71,6 +71,12 @@ export default function Page() { }); const [inititalFetchTop50, setInititalFetchTop50] = useState(false); + const [leaderboardToppers, setLeaderboardToppers] = + useState({ + best_users: [], + total_users: 0, + }); + const isTop50RankedView = useMemo( () => !currentSearchedAddress && @@ -87,18 +93,21 @@ export default function Page() { // set user address on wallet connect and disconnect useEffect(() => { - setTimeout(() => { - setApiCallDelay(true); - }, 1000); - if (address === "") return; + const timeoutId = setTimeout(() => setApiCallDelay(true), 1000); if (address) setUserAddress(address); if (status === "disconnected") setUserAddress(""); + return () => clearTimeout(timeoutId); // Cleanup }, [address, status]); useEffect(() => { if (!apiCallDelay) return; - fetchPageData(); - }, [apiCallDelay]); + const fetchTimeout = setTimeout(() => { + fetchPageData(); + }, 500); + + return () => clearTimeout(fetchTimeout); +}, [apiCallDelay]); + const fetchRankingResults = useCallback( async (requestBody: LeaderboardRankingParams) => { @@ -113,10 +122,9 @@ export default function Page() { const addRankingResults = useCallback( async (requestBody: LeaderboardRankingParams) => { const response = await fetchLeaderboardRankings(requestBody); - if (response) - setRanking((prev) => { - return { ...prev, ranking: [...prev.ranking, ...response.ranking] }; - }); + if (response) { + setRanking((prev) => ({ ...prev, ranking: [...prev.ranking, ...response.ranking] })); + } }, [] ); @@ -131,10 +139,7 @@ export default function Page() { const fetchPageData = useCallback(async () => { const requestBody = { - addr: - status === "connected" - ? hexToDecimal(address && address?.length > 0 ? address : userAddress) - : "", + addr: status === "connected" ? hexToDecimal(address || userAddress) : "", page_size: 10, shift: 0, duration: timeFrameMap(duration), @@ -154,11 +159,7 @@ export default function Page() { status, ]); - const [leaderboardToppers, setLeaderboardToppers] = - useState({ - best_users: [], - total_users: 0, - }); + const contract = useMemo(() => { return new Contract( @@ -206,10 +207,7 @@ export default function Page() { useEffect(() => { const checkIfValidAddress = async (address: string) => { try { - let domain = address; - if (isStarkDomain(address)) { - domain = getDomainWithoutStark(address); - } + const domain = isStarkDomain(address) ? getDomainWithoutStark(address) : address; const res: { message: boolean } = await verifyDomain(domain); if (res.message) { setSearchResults([domain.concat(".stark")]); @@ -260,12 +258,7 @@ export default function Page() { } if (!checkIfLastPage && viewMore) { const requestBody = { - addr: - currentSearchedAddress.length > 0 - ? currentSearchedAddress - : userAddress - ? hexToDecimal(userAddress) - : "", + addr: currentSearchedAddress || (userAddress ? hexToDecimal(userAddress) : ""), page_size: rowsPerPage, shift: currentPage, duration: timeFrameMap(duration), @@ -294,14 +287,7 @@ export default function Page() { */ useEffect(() => { const requestBody = { - addr: - currentSearchedAddress.length > 0 - ? currentSearchedAddress - : userAddress - ? hexToDecimal(userAddress) - : address - ? address - : "", + addr: currentSearchedAddress || (userAddress ? hexToDecimal(userAddress) : address || ""), page_size: rowsPerPage, shift: 0, duration: timeFrameMap(duration), @@ -326,14 +312,7 @@ export default function Page() { useEffect(() => { if (inititalFetchTop50 && address && duration !== TOP_50_TAB_STRING) { const requestBody = { - addr: - currentSearchedAddress.length > 0 - ? currentSearchedAddress - : userAddress - ? hexToDecimal(userAddress) - : address - ? address - : "", + addr: currentSearchedAddress || (userAddress ? hexToDecimal(userAddress) : address || ""), page_size: rowsPerPage, shift: 0, duration: timeFrameMap(duration), diff --git a/package-lock.json b/package-lock.json index 4a0f4d81..8ff88f63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "recharts": "^2.12.2", "starknet": "^6.11.0", "starknetid.js": "^4.0.1", - "starknetkit": "^1.1.3", + "starknetkit": "^2.3.3", "three": "^0.155.0", "twitter-api-sdk": "^1.2.1" }, @@ -5370,6 +5370,24 @@ "@stablelib/wipe": "^1.0.1" } }, + "node_modules/@starknet-io/get-starknet": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@starknet-io/get-starknet/-/get-starknet-4.0.3.tgz", + "integrity": "sha512-lZqlYYe1HnaX/j3mpm/DdC0Vi6g0dUKVLiHX7/Rc7Bf5CG7G5bAQHWDzHvACw+7pOAZT3/DlvfsZet9cBmX10Q==", + "dependencies": { + "@starknet-io/get-starknet-core": "4.0.3", + "bowser": "^2.11.0" + } + }, + "node_modules/@starknet-io/get-starknet-core": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@starknet-io/get-starknet-core/-/get-starknet-core-4.0.3.tgz", + "integrity": "sha512-yE9P3i1+QE1R0KwC1frruh28iLfDfTzRei46EP2Hzqg4m08suV/tFrcfj7iKsymmvbE7R2eGIXy4wV5roSwb4g==", + "dependencies": { + "@module-federation/runtime": "^0.1.2", + "@starknet-io/types-js": "^0.7.7" + } + }, "node_modules/@starknet-io/types-js": { "version": "0.7.7", "resolved": "https://registry.npmjs.org/@starknet-io/types-js/-/types-js-0.7.7.tgz", @@ -15289,24 +15307,26 @@ } }, "node_modules/starknetkit": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/starknetkit/-/starknetkit-1.1.9.tgz", - "integrity": "sha512-KarnNS9sJoImTdpTKizyNzDlQSAOutbzuZ6CzHQpJHWzaf8ION9aIf+d87sY7hSlbmD7cqGRUG28Hpke24arCg==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/starknetkit/-/starknetkit-2.3.3.tgz", + "integrity": "sha512-RBr+tVT0KphghG3OO7mnAureOryqzNAxGvt2juYvAEUxRSbvCUlprxDUk7/wYt9dfSLGD4mLKFq0P36/8MVB9w==", "dependencies": { + "@starknet-io/get-starknet": "^4.0.2", + "@starknet-io/get-starknet-core": "^4.0.2", + "@starknet-io/types-js": "^0.7.7", "@trpc/client": "^10.38.1", "@trpc/server": "^10.38.1", - "@walletconnect/sign-client": "^2.10.1", + "@walletconnect/sign-client": "^2.11.0", "bowser": "^2.11.0", "detect-browser": "^5.3.0", "eventemitter3": "^5.0.1", "events": "^3.3.0", - "get-starknet-core": "^3.1.0", "lodash-es": "^4.17.21", "svelte-forms": "^2.3.1", "trpc-browser": "^1.3.2" }, "peerDependencies": { - "starknet": "^6.7.0" + "starknet": "^6.9.0" } }, "node_modules/stats-gl": { diff --git a/package.json b/package.json index cf6fe206..2f0afb06 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "recharts": "^2.12.2", "starknet": "^6.11.0", "starknetid.js": "^4.0.1", - "starknetkit": "^1.1.3", + "starknetkit": "^2.3.3", "three": "^0.155.0", "twitter-api-sdk": "^1.2.1" }, From 7fb8d3762561a7088dc0d3c92b5193ff4da6ab7c Mon Sep 17 00:00:00 2001 From: Snehagupta1907 Date: Sat, 2 Nov 2024 02:52:12 +0530 Subject: [PATCH 2/8] revert back to 1.1.3 version of starknetkit --- app/leaderboard/page.tsx | 2 +- package-lock.json | 40 ++++++++++------------------------------ package.json | 4 ++-- 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/app/leaderboard/page.tsx b/app/leaderboard/page.tsx index 4e2d6679..1bffd2da 100644 --- a/app/leaderboard/page.tsx +++ b/app/leaderboard/page.tsx @@ -312,7 +312,7 @@ export default function Page() { useEffect(() => { if (inititalFetchTop50 && address && duration !== TOP_50_TAB_STRING) { const requestBody = { - addr: currentSearchedAddress || (userAddress ? hexToDecimal(userAddress) : address || ""), + addr: currentSearchedAddress || (userAddress ? hexToDecimal(userAddress) : address || ""), page_size: rowsPerPage, shift: 0, duration: timeFrameMap(duration), diff --git a/package-lock.json b/package-lock.json index 8ff88f63..a9e7aa63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "recharts": "^2.12.2", "starknet": "^6.11.0", "starknetid.js": "^4.0.1", - "starknetkit": "^2.3.3", + "starknetkit": "^1.1.3", "three": "^0.155.0", "twitter-api-sdk": "^1.2.1" }, @@ -4630,9 +4630,9 @@ "integrity": "sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA==" }, "node_modules/@scure/base": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", - "integrity": "sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", "funding": { "url": "https://paulmillr.com/funding/" } @@ -5370,24 +5370,6 @@ "@stablelib/wipe": "^1.0.1" } }, - "node_modules/@starknet-io/get-starknet": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@starknet-io/get-starknet/-/get-starknet-4.0.3.tgz", - "integrity": "sha512-lZqlYYe1HnaX/j3mpm/DdC0Vi6g0dUKVLiHX7/Rc7Bf5CG7G5bAQHWDzHvACw+7pOAZT3/DlvfsZet9cBmX10Q==", - "dependencies": { - "@starknet-io/get-starknet-core": "4.0.3", - "bowser": "^2.11.0" - } - }, - "node_modules/@starknet-io/get-starknet-core": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@starknet-io/get-starknet-core/-/get-starknet-core-4.0.3.tgz", - "integrity": "sha512-yE9P3i1+QE1R0KwC1frruh28iLfDfTzRei46EP2Hzqg4m08suV/tFrcfj7iKsymmvbE7R2eGIXy4wV5roSwb4g==", - "dependencies": { - "@module-federation/runtime": "^0.1.2", - "@starknet-io/types-js": "^0.7.7" - } - }, "node_modules/@starknet-io/types-js": { "version": "0.7.7", "resolved": "https://registry.npmjs.org/@starknet-io/types-js/-/types-js-0.7.7.tgz", @@ -15307,26 +15289,24 @@ } }, "node_modules/starknetkit": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/starknetkit/-/starknetkit-2.3.3.tgz", - "integrity": "sha512-RBr+tVT0KphghG3OO7mnAureOryqzNAxGvt2juYvAEUxRSbvCUlprxDUk7/wYt9dfSLGD4mLKFq0P36/8MVB9w==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/starknetkit/-/starknetkit-1.1.9.tgz", + "integrity": "sha512-KarnNS9sJoImTdpTKizyNzDlQSAOutbzuZ6CzHQpJHWzaf8ION9aIf+d87sY7hSlbmD7cqGRUG28Hpke24arCg==", "dependencies": { - "@starknet-io/get-starknet": "^4.0.2", - "@starknet-io/get-starknet-core": "^4.0.2", - "@starknet-io/types-js": "^0.7.7", "@trpc/client": "^10.38.1", "@trpc/server": "^10.38.1", - "@walletconnect/sign-client": "^2.11.0", + "@walletconnect/sign-client": "^2.10.1", "bowser": "^2.11.0", "detect-browser": "^5.3.0", "eventemitter3": "^5.0.1", "events": "^3.3.0", + "get-starknet-core": "^3.1.0", "lodash-es": "^4.17.21", "svelte-forms": "^2.3.1", "trpc-browser": "^1.3.2" }, "peerDependencies": { - "starknet": "^6.9.0" + "starknet": "^6.7.0" } }, "node_modules/stats-gl": { diff --git a/package.json b/package.json index 2f0afb06..5582890a 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "recharts": "^2.12.2", "starknet": "^6.11.0", "starknetid.js": "^4.0.1", - "starknetkit": "^2.3.3", + "starknetkit": "^1.1.3", "three": "^0.155.0", "twitter-api-sdk": "^1.2.1" }, @@ -77,4 +77,4 @@ "ts-jest": "^29.0.3", "typescript": "^5.3.2" } -} +} \ No newline at end of file From 50aeb0dc115dfd13a14805064ee84ce3aff06e3a Mon Sep 17 00:00:00 2001 From: Snehagupta1907 Date: Sat, 2 Nov 2024 11:36:29 +0530 Subject: [PATCH 3/8] deleted the pakage.lock and then installed the packages again --- package-lock.json | 342 ---------------------------------------------- 1 file changed, 342 deletions(-) diff --git a/package-lock.json b/package-lock.json index a9e7aa63..1bce6187 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3960,126 +3960,6 @@ "glob": "10.3.10" } }, - "node_modules/@next/swc-darwin-arm64": { - "version": "14.2.5", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.5.tgz", - "integrity": "sha512-/9zVxJ+K9lrzSGli1///ujyRfon/ZneeZ+v4ptpiPoOU+GKZnm8Wj8ELWU1Pm7GHltYRBklmXMTUqM/DqQ99FQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-darwin-x64": { - "version": "14.2.5", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.5.tgz", - "integrity": "sha512-vXHOPCwfDe9qLDuq7U1OYM2wUY+KQ4Ex6ozwsKxp26BlJ6XXbHleOUldenM67JRyBfVjv371oneEvYd3H2gNSA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.2.5", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.5.tgz", - "integrity": "sha512-vlhB8wI+lj8q1ExFW8lbWutA4M2ZazQNvMWuEDqZcuJJc78iUnLdPPunBPX8rC4IgT6lIx/adB+Cwrl99MzNaA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.2.5", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.5.tgz", - "integrity": "sha512-NpDB9NUR2t0hXzJJwQSGu1IAOYybsfeB+LxpGsXrRIb7QOrYmidJz3shzY8cM6+rO4Aojuef0N/PEaX18pi9OA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.2.5", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.5.tgz", - "integrity": "sha512-8XFikMSxWleYNryWIjiCX+gU201YS+erTUidKdyOVYi5qUQo/gRxv/3N1oZFCgqpesN6FPeqGM72Zve+nReVXQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-musl": { - "version": "14.2.5", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.5.tgz", - "integrity": "sha512-6QLwi7RaYiQDcRDSU/os40r5o06b5ue7Jsk5JgdRBGGp8l37RZEh9JsLSM8QF0YDsgcosSeHjglgqi25+m04IQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.2.5", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.5.tgz", - "integrity": "sha512-1GpG2VhbspO+aYoMOQPQiqc/tG3LzmsdBH0LhnDS3JrtDx2QmzXe0B6mSZZiN3Bq7IOMXxv1nlsjzoS1+9mzZw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.2.5", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.5.tgz", - "integrity": "sha512-Igh9ZlxwvCDsu6438FXlQTHlRno4gFpJzqPjSIBZooD22tKeI4fE/YMRoHVJHmrQ2P5YL1DoZ0qaOKkbeFWeMg==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@next/swc-win32-x64-msvc": { "version": "14.2.5", "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.5.tgz", @@ -4186,177 +4066,6 @@ "@parcel/watcher-win32-x64": "2.4.1" } }, - "node_modules/@parcel/watcher-android-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.4.1.tgz", - "integrity": "sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.4.1.tgz", - "integrity": "sha512-ln41eihm5YXIY043vBrrHfn94SIBlqOWmoROhsMVTSXGh0QahKGy77tfEywQ7v3NywyxBBkGIfrWRHm0hsKtzA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.4.1.tgz", - "integrity": "sha512-yrw81BRLjjtHyDu7J61oPuSoeYWR3lDElcPGJyOvIXmor6DEo7/G2u1o7I38cwlcoBHQFULqF6nesIX3tsEXMg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-freebsd-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.4.1.tgz", - "integrity": "sha512-TJa3Pex/gX3CWIx/Co8k+ykNdDCLx+TuZj3f3h7eOjgpdKM+Mnix37RYsYU4LHhiYJz3DK5nFCCra81p6g050w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.4.1.tgz", - "integrity": "sha512-4rVYDlsMEYfa537BRXxJ5UF4ddNwnr2/1O4MHM5PjI9cvV2qymvhwZSFgXqbS8YoTk5i/JR0L0JDs69BUn45YA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.4.1.tgz", - "integrity": "sha512-BJ7mH985OADVLpbrzCLgrJ3TOpiZggE9FMblfO65PlOCdG++xJpKUJ0Aol74ZUIYfb8WsRlUdgrZxKkz3zXWYA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-musl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.4.1.tgz", - "integrity": "sha512-p4Xb7JGq3MLgAfYhslU2SjoV9G0kI0Xry0kuxeG/41UfpjHGOhv7UoUDAz/jb1u2elbhazy4rRBL8PegPJFBhA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.4.1.tgz", - "integrity": "sha512-s9O3fByZ/2pyYDPoLM6zt92yu6P4E39a03zvO0qCHOTjxmt3GHRMLuRZEWhWLASTMSrrnVNWdVI/+pUElJBBBg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-musl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.4.1.tgz", - "integrity": "sha512-L2nZTYR1myLNST0O632g0Dx9LyMNHrn6TOt76sYxWLdff3cB22/GZX2UPtJnaqQPdCRoszoY5rcOj4oMTtp5fQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, "node_modules/@parcel/watcher-wasm": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@parcel/watcher-wasm/-/watcher-wasm-2.4.1.tgz", @@ -4382,44 +4091,6 @@ "inBundle": true, "license": "MIT" }, - "node_modules/@parcel/watcher-win32-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.4.1.tgz", - "integrity": "sha512-Uq2BPp5GWhrq/lcuItCHoqxjULU1QYEcyjSO5jqqOK8RNFDBQnenMMx4gAl3v8GiWa59E9+uDM7yZ6LxwUIfRg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-ia32": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.4.1.tgz", - "integrity": "sha512-maNRit5QQV2kgHFSYwftmPBxiuK5u4DXjbXx7q6eKjq5dsLXZ4FJiVvlcw35QXzk0KrUecJmuVFbj4uV9oYrcw==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, "node_modules/@parcel/watcher-win32-x64": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.4.1.tgz", @@ -9659,19 +9330,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", From 3ad36d899d706847e4c8e64d5366a3199fac4a78 Mon Sep 17 00:00:00 2001 From: Snehagupta1907 Date: Sat, 2 Nov 2024 12:23:19 +0530 Subject: [PATCH 4/8] revert to previous testnet branch's lock file --- package-lock.json | 350 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 346 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1bce6187..aa2d9726 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3960,6 +3960,126 @@ "glob": "10.3.10" } }, + "node_modules/@next/swc-darwin-arm64": { + "version": "14.2.5", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.5.tgz", + "integrity": "sha512-/9zVxJ+K9lrzSGli1///ujyRfon/ZneeZ+v4ptpiPoOU+GKZnm8Wj8ELWU1Pm7GHltYRBklmXMTUqM/DqQ99FQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "14.2.5", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.5.tgz", + "integrity": "sha512-vXHOPCwfDe9qLDuq7U1OYM2wUY+KQ4Ex6ozwsKxp26BlJ6XXbHleOUldenM67JRyBfVjv371oneEvYd3H2gNSA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "14.2.5", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.5.tgz", + "integrity": "sha512-vlhB8wI+lj8q1ExFW8lbWutA4M2ZazQNvMWuEDqZcuJJc78iUnLdPPunBPX8rC4IgT6lIx/adB+Cwrl99MzNaA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "14.2.5", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.5.tgz", + "integrity": "sha512-NpDB9NUR2t0hXzJJwQSGu1IAOYybsfeB+LxpGsXrRIb7QOrYmidJz3shzY8cM6+rO4Aojuef0N/PEaX18pi9OA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "14.2.5", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.5.tgz", + "integrity": "sha512-8XFikMSxWleYNryWIjiCX+gU201YS+erTUidKdyOVYi5qUQo/gRxv/3N1oZFCgqpesN6FPeqGM72Zve+nReVXQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "14.2.5", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.5.tgz", + "integrity": "sha512-6QLwi7RaYiQDcRDSU/os40r5o06b5ue7Jsk5JgdRBGGp8l37RZEh9JsLSM8QF0YDsgcosSeHjglgqi25+m04IQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "14.2.5", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.5.tgz", + "integrity": "sha512-1GpG2VhbspO+aYoMOQPQiqc/tG3LzmsdBH0LhnDS3JrtDx2QmzXe0B6mSZZiN3Bq7IOMXxv1nlsjzoS1+9mzZw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "14.2.5", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.5.tgz", + "integrity": "sha512-Igh9ZlxwvCDsu6438FXlQTHlRno4gFpJzqPjSIBZooD22tKeI4fE/YMRoHVJHmrQ2P5YL1DoZ0qaOKkbeFWeMg==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@next/swc-win32-x64-msvc": { "version": "14.2.5", "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.5.tgz", @@ -4066,6 +4186,177 @@ "@parcel/watcher-win32-x64": "2.4.1" } }, + "node_modules/@parcel/watcher-android-arm64": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.4.1.tgz", + "integrity": "sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-arm64": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.4.1.tgz", + "integrity": "sha512-ln41eihm5YXIY043vBrrHfn94SIBlqOWmoROhsMVTSXGh0QahKGy77tfEywQ7v3NywyxBBkGIfrWRHm0hsKtzA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-x64": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.4.1.tgz", + "integrity": "sha512-yrw81BRLjjtHyDu7J61oPuSoeYWR3lDElcPGJyOvIXmor6DEo7/G2u1o7I38cwlcoBHQFULqF6nesIX3tsEXMg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-freebsd-x64": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.4.1.tgz", + "integrity": "sha512-TJa3Pex/gX3CWIx/Co8k+ykNdDCLx+TuZj3f3h7eOjgpdKM+Mnix37RYsYU4LHhiYJz3DK5nFCCra81p6g050w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-glibc": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.4.1.tgz", + "integrity": "sha512-4rVYDlsMEYfa537BRXxJ5UF4ddNwnr2/1O4MHM5PjI9cvV2qymvhwZSFgXqbS8YoTk5i/JR0L0JDs69BUn45YA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-glibc": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.4.1.tgz", + "integrity": "sha512-BJ7mH985OADVLpbrzCLgrJ3TOpiZggE9FMblfO65PlOCdG++xJpKUJ0Aol74ZUIYfb8WsRlUdgrZxKkz3zXWYA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-musl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.4.1.tgz", + "integrity": "sha512-p4Xb7JGq3MLgAfYhslU2SjoV9G0kI0Xry0kuxeG/41UfpjHGOhv7UoUDAz/jb1u2elbhazy4rRBL8PegPJFBhA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-glibc": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.4.1.tgz", + "integrity": "sha512-s9O3fByZ/2pyYDPoLM6zt92yu6P4E39a03zvO0qCHOTjxmt3GHRMLuRZEWhWLASTMSrrnVNWdVI/+pUElJBBBg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-musl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.4.1.tgz", + "integrity": "sha512-L2nZTYR1myLNST0O632g0Dx9LyMNHrn6TOt76sYxWLdff3cB22/GZX2UPtJnaqQPdCRoszoY5rcOj4oMTtp5fQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, "node_modules/@parcel/watcher-wasm": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@parcel/watcher-wasm/-/watcher-wasm-2.4.1.tgz", @@ -4091,6 +4382,44 @@ "inBundle": true, "license": "MIT" }, + "node_modules/@parcel/watcher-win32-arm64": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.4.1.tgz", + "integrity": "sha512-Uq2BPp5GWhrq/lcuItCHoqxjULU1QYEcyjSO5jqqOK8RNFDBQnenMMx4gAl3v8GiWa59E9+uDM7yZ6LxwUIfRg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-ia32": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.4.1.tgz", + "integrity": "sha512-maNRit5QQV2kgHFSYwftmPBxiuK5u4DXjbXx7q6eKjq5dsLXZ4FJiVvlcw35QXzk0KrUecJmuVFbj4uV9oYrcw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, "node_modules/@parcel/watcher-win32-x64": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.4.1.tgz", @@ -4301,9 +4630,9 @@ "integrity": "sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA==" }, "node_modules/@scure/base": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", - "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", + "integrity": "sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==", "funding": { "url": "https://paulmillr.com/funding/" } @@ -9330,6 +9659,19 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -16748,4 +17090,4 @@ } } } -} +} \ No newline at end of file From 5515573aa7e389fd98c045c11c88907c1cd94002 Mon Sep 17 00:00:00 2001 From: Snehagupta1907 Date: Sun, 3 Nov 2024 00:11:33 +0530 Subject: [PATCH 5/8] updated the starknet core-react package and made the required changes for migrating to new version --- app/leaderboard/page.tsx | 3 +- app/not-connected/page.tsx | 8 +- app/provider.tsx | 6 +- components/UI/avatar.tsx | 9 +- components/UI/navbar.tsx | 8 +- .../UI/notifications/notificationDetail.tsx | 4 +- components/UI/profileCard/profileCard.tsx | 5 +- components/discover/claimModal.tsx | 4 +- components/navbar/walletButton.tsx | 4 +- components/quests/reward.tsx | 4 +- hooks/contracts.ts | 12 +- package-lock.json | 272 ++++++++++++++++-- package.json | 8 +- 13 files changed, 283 insertions(+), 64 deletions(-) diff --git a/app/leaderboard/page.tsx b/app/leaderboard/page.tsx index 1bffd2da..41fc2ca2 100644 --- a/app/leaderboard/page.tsx +++ b/app/leaderboard/page.tsx @@ -14,7 +14,7 @@ import { } from "@services/apiService"; import { calculatePercentile } from "@utils/numberService"; import styles from "@styles/leaderboard.module.css"; -import { useAccount } from "@starknet-react/core"; +import { useAccount,type Address } from "@starknet-react/core"; import LeaderboardSkeleton from "@components/skeletons/leaderboardSkeleton"; import FeaturedQuest from "@components/UI/featured_banner/featuredQuest"; import { QuestsContext } from "@context/QuestsProvider"; @@ -44,6 +44,7 @@ import { LeaderboardTopperParams, } from "../../types/backTypes"; + export default function Page() { const router = useRouter(); const { status, address, isConnecting } = useAccount(); diff --git a/app/not-connected/page.tsx b/app/not-connected/page.tsx index 952eea78..7886c4ce 100644 --- a/app/not-connected/page.tsx +++ b/app/not-connected/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { useAccount, useConnect } from "@starknet-react/core"; +import { useAccount, useConnect, Connector } from "@starknet-react/core"; import React, { useEffect } from "react"; import { useRouter } from "next/navigation"; import ErrorScreen from "@components/UI/screens/errorScreen"; @@ -12,7 +12,7 @@ export default function Page() { const { connectAsync } = useConnect(); const { push } = useRouter(); const { starknetkitConnectModal } = useStarknetkitConnectModal({ - connectors: availableConnectors, + connectors: availableConnectors as any, modalTheme: "dark", }); @@ -25,14 +25,14 @@ export default function Page() { if (!connector) { return; } - await connectAsync({ connector }); + await connectAsync({ connector: connector as Connector }); // Type casted localStorage.setItem("SQ-connectedWallet", connector.id); }; return ( <> diff --git a/app/provider.tsx b/app/provider.tsx index 6cdd3b42..7b4ef3e6 100644 --- a/app/provider.tsx +++ b/app/provider.tsx @@ -44,11 +44,11 @@ export const availableConnectors = [ ? "https://web.hydrogen.argent47.net" : "https://web.argent.xyz/", }), - new ArgentMobileConnector({ - dappName: "Starknet Quest", + ArgentMobileConnector.init({ + options: {dappName: "Starknet Quest", url: process.env.NEXT_PUBLIC_APP_LINK as string, chainId: constants.NetworkName.SN_MAIN, - icons: ["https://starknet.quest/visuals/starknetquestLogo.svg"], + icons: ["https://starknet.quest/visuals/starknetquestLogo.svg"],} }), new InjectedConnector({ options: { id: "keplr", name: "Keplr" } }) diff --git a/components/UI/avatar.tsx b/components/UI/avatar.tsx index 61ae9b90..a01be748 100644 --- a/components/UI/avatar.tsx +++ b/components/UI/avatar.tsx @@ -1,7 +1,7 @@ import React, { FunctionComponent } from "react"; import ProfilIcon from "@components/UI/iconsComponents/icons/profilIcon"; import theme from "@styles/theme"; -import { useStarkProfile } from "@starknet-react/core"; +import { useStarkProfile, type Address } from "@starknet-react/core"; type AvatarProps = { address: string; @@ -9,14 +9,15 @@ type AvatarProps = { }; const Avatar: FunctionComponent = ({ address, width = "32" }) => { - const { data: profileData } = useStarkProfile({ address }); - + const { data: profileData } = useStarkProfile({ + address: (address.startsWith("0x") ? address : `0x${address}`) as Address, + }); return ( <> {profileData?.profilePicture ? ( { }, ]); const { starknetkitConnectModal } = useStarknetkitConnectModal({ - connectors: availableConnectors, + connectors: availableConnectors as any, }); const fetchAndUpdateNotifications = async () => { @@ -94,7 +94,7 @@ const Navbar: FunctionComponent = () => { const connector = availableConnectors.find( (item) => item.id === connectordId ); - await connectAsync({ connector }); + await connectAsync({ connector: connector as Connector }); } }; connectToStarknet(); @@ -121,7 +121,7 @@ const Navbar: FunctionComponent = () => { if (!connector) { return; } - await connectAsync({ connector }); + await connectAsync({ connector: connector as Connector }); localStorage.setItem("SQ-connectedWallet", connector.id); }; diff --git a/components/UI/notifications/notificationDetail.tsx b/components/UI/notifications/notificationDetail.tsx index a864c274..aee594b4 100644 --- a/components/UI/notifications/notificationDetail.tsx +++ b/components/UI/notifications/notificationDetail.tsx @@ -13,7 +13,7 @@ import { } from "@constants/notifications"; import { CircularProgress } from "@mui/material"; import { getCurrentNetwork } from "@utils/network"; -import { useWaitForTransaction } from "@starknet-react/core"; +import { useTransactionReceipt } from "@starknet-react/core"; import { useNotificationManager } from "@hooks/useNotificationManager"; type NotificationDetailProps = { @@ -27,7 +27,7 @@ const NotificationDetail: FunctionComponent = ({ }) => { const currentNetwork = getCurrentNetwork(); const { updateNotificationStatus } = useNotificationManager(); - const { data, error, isLoading, isError } = useWaitForTransaction({ + const { data, error, isLoading, isError } = useTransactionReceipt({ hash: notification.type === NotificationType.TRANSACTION ? notification.data.hash diff --git a/components/UI/profileCard/profileCard.tsx b/components/UI/profileCard/profileCard.tsx index 02fefeb6..e75d64cb 100644 --- a/components/UI/profileCard/profileCard.tsx +++ b/components/UI/profileCard/profileCard.tsx @@ -8,7 +8,7 @@ import React, { import styles from "@styles/dashboard.module.css"; import CopyIcon from "@components/UI/iconsComponents/icons/copyIcon"; import { CDNImage } from "@components/cdn/image"; -import { useStarkProfile } from "@starknet-react/core"; +import { useStarkProfile,type Address } from "@starknet-react/core"; import { minifyAddress } from "@utils/stringService"; import trophyIcon from "public/icons/trophy.svg"; import xpIcon from "public/icons/xpBadge.svg"; @@ -35,7 +35,8 @@ const ProfileCard: FunctionComponent = ({ }) => { const [copied, setCopied] = useState(false); const sinceDate = useCreationDate(identity); - const { data: profileData } = useStarkProfile({ address: identity.owner }); + const formattedAddress = (identity.owner.startsWith("0x") ? identity.owner : `0x${identity.owner}`) as Address; + const { data: profileData } = useStarkProfile({ address: formattedAddress }); const [userXp, setUserXp] = useState(); diff --git a/components/discover/claimModal.tsx b/components/discover/claimModal.tsx index e8989d5a..167ef51d 100644 --- a/components/discover/claimModal.tsx +++ b/components/discover/claimModal.tsx @@ -10,7 +10,7 @@ import AppIcon from "./appIcon"; import TokenIcon from "./tokenIcon"; import { useNotification } from "@context/NotificationProvider"; import Loading from "@app/loading"; -import { useAccount, useContractWrite } from "@starknet-react/core"; +import { useAccount, useSendTransaction } from "@starknet-react/core"; import { RewardsPerProtocol } from "../../types/backTypes"; import { getRewards } from "@services/apiService"; import { gweiToEth } from "@utils/feltService"; @@ -86,7 +86,7 @@ const ClaimModal: FunctionComponent = ({ const { address } = useAccount(); const [rewards, setRewards] = useState(null); const [calls, setCalls] = useState([]); - const { writeAsync: execute } = useContractWrite({ + const { sendAsync: execute } = useSendTransaction({ calls: calls, }); diff --git a/components/navbar/walletButton.tsx b/components/navbar/walletButton.tsx index 6bd10d98..a754eb95 100644 --- a/components/navbar/walletButton.tsx +++ b/components/navbar/walletButton.tsx @@ -44,7 +44,9 @@ const WalletButton: FunctionComponent = ({ const [unfocus, setUnfocus] = useState(false); const network = currentNetwork === "TESTNET" ? "testnet" : "mainnet"; const isWebWallet = - (connector as Connector)?.wallet?.id === "argentWebWallet"; + (connector as Connector)?.id === "argentWebWallet"; + + // console.log(connector?.id,"wallet") const buttonName = useMemo( () => diff --git a/components/quests/reward.tsx b/components/quests/reward.tsx index 8a0f198c..cb89c33a 100644 --- a/components/quests/reward.tsx +++ b/components/quests/reward.tsx @@ -2,7 +2,7 @@ import React, { FunctionComponent, useCallback, useState } from "react"; import styles from "../../styles/quests.module.css"; import Button from "../UI/button"; import ModalMessage from "../UI/modalMessage"; -import { useAccount, useContractWrite } from "@starknet-react/core"; +import { useAccount, useSendTransaction } from "@starknet-react/core"; import { useRouter } from "next/navigation"; import Lottie from "lottie-react"; import verifiedLottie from "@public/visuals/verifiedLottie.json"; @@ -49,7 +49,7 @@ const Reward: FunctionComponent = ({ const [modalTxOpen, setModalTxOpen] = useState(false); const { address } = useAccount(); const { addTransaction } = useNotificationManager(); - const { writeAsync: executeMint } = useContractWrite({ + const { sendAsync: executeMint } = useSendTransaction({ calls: mintCalldata, }); const [showSuccessModal, setShowSuccessModal] = useState(false); diff --git a/hooks/contracts.ts b/hooks/contracts.ts index b063143a..27f480f0 100644 --- a/hooks/contracts.ts +++ b/hooks/contracts.ts @@ -2,14 +2,18 @@ import { Abi } from "starknet"; import quests_nft_abi from "@abi/quests_nft_abi.json"; import { useContract } from "@starknet-react/core"; import { getCurrentNetwork } from "@utils/network"; +import { type Address } from "@starknet-react/core"; export function useQuestsNFTContract() { const network = getCurrentNetwork(); + + const address = + network === "TESTNET" + ? process.env.NEXT_PUBLIC_QUESTS_CONTRACT_TESTNET as Address + : process.env.NEXT_PUBLIC_QUESTS_CONTRACT_MAINNET as Address; + return useContract({ abi: quests_nft_abi as Abi, - address: - network === "TESTNET" - ? process.env.NEXT_PUBLIC_QUESTS_CONTRACT_TESTNET - : process.env.NEXT_PUBLIC_QUESTS_CONTRACT_MAINNET, + address, }); } diff --git a/package-lock.json b/package-lock.json index aa2d9726..c3fce457 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,8 +17,8 @@ "@nimiq/style": "^0.8.5", "@react-three/drei": "^9.80.3", "@react-three/fiber": "^8.13.6", - "@starknet-react/chains": "^0.1.6", - "@starknet-react/core": "^2.8.0", + "@starknet-react/chains": "^3.1.0", + "@starknet-react/core": "^3.5.0", "@tanstack/react-table": "^8.17.3", "@use-gesture/react": "^10.2.27", "@vercel/analytics": "^0.1.5", @@ -47,7 +47,7 @@ "recharts": "^2.12.2", "starknet": "^6.11.0", "starknetid.js": "^4.0.1", - "starknetkit": "^1.1.3", + "starknetkit": "^2.3.3", "three": "^0.155.0", "twitter-api-sdk": "^1.2.1" }, @@ -75,6 +75,11 @@ "typescript": "^5.3.2" } }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz", + "integrity": "sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==" + }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -4630,9 +4635,70 @@ "integrity": "sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA==" }, "node_modules/@scure/base": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", - "integrity": "sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.5.0.tgz", + "integrity": "sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==", + "dependencies": { + "@noble/curves": "~1.6.0", + "@noble/hashes": "~1.5.0", + "@scure/base": "~1.1.7" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/curves": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", + "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "dependencies": { + "@noble/hashes": "1.5.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.4.0.tgz", + "integrity": "sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==", + "dependencies": { + "@noble/hashes": "~1.5.0", + "@scure/base": "~1.1.8" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39/node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "engines": { + "node": "^14.21.3 || >=16" + }, "funding": { "url": "https://paulmillr.com/funding/" } @@ -5370,31 +5436,50 @@ "@stablelib/wipe": "^1.0.1" } }, + "node_modules/@starknet-io/get-starknet": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@starknet-io/get-starknet/-/get-starknet-4.0.3.tgz", + "integrity": "sha512-lZqlYYe1HnaX/j3mpm/DdC0Vi6g0dUKVLiHX7/Rc7Bf5CG7G5bAQHWDzHvACw+7pOAZT3/DlvfsZet9cBmX10Q==", + "dependencies": { + "@starknet-io/get-starknet-core": "4.0.3", + "bowser": "^2.11.0" + } + }, + "node_modules/@starknet-io/get-starknet-core": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@starknet-io/get-starknet-core/-/get-starknet-core-4.0.3.tgz", + "integrity": "sha512-yE9P3i1+QE1R0KwC1frruh28iLfDfTzRei46EP2Hzqg4m08suV/tFrcfj7iKsymmvbE7R2eGIXy4wV5roSwb4g==", + "dependencies": { + "@module-federation/runtime": "^0.1.2", + "@starknet-io/types-js": "^0.7.7" + } + }, "node_modules/@starknet-io/types-js": { "version": "0.7.7", "resolved": "https://registry.npmjs.org/@starknet-io/types-js/-/types-js-0.7.7.tgz", "integrity": "sha512-WLrpK7LIaIb8Ymxu6KF/6JkGW1sso988DweWu7p5QY/3y7waBIiPvzh27D9bX5KIJNRDyOoOVoHVEKYUYWZ/RQ==" }, "node_modules/@starknet-react/chains": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/@starknet-react/chains/-/chains-0.1.7.tgz", - "integrity": "sha512-UNh97I1SvuJKaAhKOmpEk8JcWuZWMlPG/ba2HcvFYL9x/47BKndJ+Da9V+iJFtkHUjreVnajT1snsaz1XMG+UQ==" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@starknet-react/chains/-/chains-3.1.0.tgz", + "integrity": "sha512-h+fxh+Bs8h0ZSEX651vG3mn1NtMKzFDSHqrX7Q8YRRIeTKolPCx4vmoi5Gg19SXr/9iIVSwgx6qe4rVZTNfhcQ==" }, "node_modules/@starknet-react/core": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/@starknet-react/core/-/core-2.9.0.tgz", - "integrity": "sha512-UdRo454/g2lb0YsNAUJohJ2w21LlahcEXQlkWrddoKFubRY6Q0b39hec0eZOCqfU0Z1Sh7kF1XYvI5t9xL4yTQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@starknet-react/core/-/core-3.5.0.tgz", + "integrity": "sha512-qeE6+kcumRZszx2iA1FKu2ZFLPrxF3rYOv9Tu1cJriQtCymKblolGyaE2/nBz5ysIhZB80JtHksC9l6dpgRmuw==", "dependencies": { - "@starknet-react/chains": "^0.1.7", - "@tanstack/react-query": "^5.0.1", + "@starknet-io/types-js": "^0.7.7", + "@starknet-react/chains": "^3.1.0", + "@tanstack/react-query": "^5.25.0", "eventemitter3": "^5.0.1", - "immutable": "^4.3.4", - "zod": "^3.22.2" + "viem": "^2.21.1", + "zod": "^3.22.4" }, "peerDependencies": { - "get-starknet-core": "^3.2.0", + "get-starknet-core": "^4.0.0", "react": "^18.0", - "starknet": "^5.25.0" + "starknet": "^6.11.0" } }, "node_modules/@swc/counter": { @@ -6364,6 +6449,26 @@ "generate": "dist/generate.js" } }, + "node_modules/abitype": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.6.tgz", + "integrity": "sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A==", + "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/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -10178,11 +10283,6 @@ "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" }, - "node_modules/immutable": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.7.tgz", - "integrity": "sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==" - }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -10777,6 +10877,20 @@ "whatwg-fetch": "^3.4.1" } }, + "node_modules/isows": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.6.tgz", + "integrity": "sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "peerDependencies": { + "ws": "*" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -15289,24 +15403,26 @@ } }, "node_modules/starknetkit": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/starknetkit/-/starknetkit-1.1.9.tgz", - "integrity": "sha512-KarnNS9sJoImTdpTKizyNzDlQSAOutbzuZ6CzHQpJHWzaf8ION9aIf+d87sY7hSlbmD7cqGRUG28Hpke24arCg==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/starknetkit/-/starknetkit-2.3.3.tgz", + "integrity": "sha512-RBr+tVT0KphghG3OO7mnAureOryqzNAxGvt2juYvAEUxRSbvCUlprxDUk7/wYt9dfSLGD4mLKFq0P36/8MVB9w==", "dependencies": { + "@starknet-io/get-starknet": "^4.0.2", + "@starknet-io/get-starknet-core": "^4.0.2", + "@starknet-io/types-js": "^0.7.7", "@trpc/client": "^10.38.1", "@trpc/server": "^10.38.1", - "@walletconnect/sign-client": "^2.10.1", + "@walletconnect/sign-client": "^2.11.0", "bowser": "^2.11.0", "detect-browser": "^5.3.0", "eventemitter3": "^5.0.1", "events": "^3.3.0", - "get-starknet-core": "^3.1.0", "lodash-es": "^4.17.21", "svelte-forms": "^2.3.1", "trpc-browser": "^1.3.2" }, "peerDependencies": { - "starknet": "^6.7.0" + "starknet": "^6.9.0" } }, "node_modules/stats-gl": { @@ -16631,6 +16747,61 @@ "d3-timer": "^3.0.1" } }, + "node_modules/viem": { + "version": "2.21.39", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.21.39.tgz", + "integrity": "sha512-8zPdwVE66BBqnu7JgYWFLzt1mrHS48+GHug2sGqDtdALZ7/LDht/WuUodVT5xOouyLsxsOKJBnqgErtUVes6ZA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.11.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", + "isows": "1.0.6", + "webauthn-p256": "0.0.10", + "ws": "8.18.0" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/viem/node_modules/@noble/curves": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", + "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "dependencies": { + "@noble/hashes": "1.5.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", @@ -16657,6 +16828,46 @@ "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-4.2.3.tgz", "integrity": "sha512-/CFAm1mNxSmOj6i0Co+iGFJ58OS4NRGVP+AWS/l509uIK5a1bSoIVaHz/ZumpHTfHSZBpgrJ+wjfpAOrTHok5Q==" }, + "node_modules/webauthn-p256": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/webauthn-p256/-/webauthn-p256-0.0.10.tgz", + "integrity": "sha512-EeYD+gmIT80YkSIDb2iWq0lq2zbHo1CxHlQTeJ+KkCILWpVy3zASH3ByD4bopzfk0uCwXxLqKGLqp2W4O28VFA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "dependencies": { + "@noble/curves": "^1.4.0", + "@noble/hashes": "^1.4.0" + } + }, + "node_modules/webauthn-p256/node_modules/@noble/curves": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", + "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "dependencies": { + "@noble/hashes": "1.5.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/webauthn-p256/node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/webgl-constants": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/webgl-constants/-/webgl-constants-1.1.1.tgz", @@ -16956,7 +17167,6 @@ "version": "8.18.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", - "dev": true, "engines": { "node": ">=10.0.0" }, @@ -17090,4 +17300,4 @@ } } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 5582890a..c9c4d50d 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "@nimiq/style": "^0.8.5", "@react-three/drei": "^9.80.3", "@react-three/fiber": "^8.13.6", - "@starknet-react/chains": "^0.1.6", - "@starknet-react/core": "^2.8.0", + "@starknet-react/chains": "^3.1.0", + "@starknet-react/core": "^3.5.0", "@tanstack/react-table": "^8.17.3", "@use-gesture/react": "^10.2.27", "@vercel/analytics": "^0.1.5", @@ -50,7 +50,7 @@ "recharts": "^2.12.2", "starknet": "^6.11.0", "starknetid.js": "^4.0.1", - "starknetkit": "^1.1.3", + "starknetkit": "^2.3.3", "three": "^0.155.0", "twitter-api-sdk": "^1.2.1" }, @@ -77,4 +77,4 @@ "ts-jest": "^29.0.3", "typescript": "^5.3.2" } -} \ No newline at end of file +} From ce1ec05eaf6464f7dfe75506313a9d949cef9c3c Mon Sep 17 00:00:00 2001 From: Snehagupta1907 Date: Sun, 3 Nov 2024 01:59:15 +0530 Subject: [PATCH 6/8] remove hextTodecimal from leaderboard page --- app/leaderboard/page.tsx | 15 ++++++++------- components/UI/avatar.tsx | 5 ++++- components/leaderboard/RankCard.tsx | 3 ++- components/leaderboard/RankingsTable.tsx | 3 ++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/leaderboard/page.tsx b/app/leaderboard/page.tsx index 41fc2ca2..087f8c9d 100644 --- a/app/leaderboard/page.tsx +++ b/app/leaderboard/page.tsx @@ -31,7 +31,7 @@ import Divider from "@mui/material/Divider"; import Blur from "@components/shapes/blur"; import RankingsTable from "@components/leaderboard/RankingsTable"; import { TOP_50_TAB_STRING } from "@constants/common"; -import { hexToDecimal } from "@utils/feltService"; +// import { } from "@utils/feltService"; import Avatar from "@components/UI/avatar"; import RankingSkeleton from "@components/skeletons/rankingSkeleton"; import { Button } from "@mui/material"; @@ -43,6 +43,7 @@ import { LeaderboardRankingParams, LeaderboardTopperParams, } from "../../types/backTypes"; +import { decimalToHex } from "@utils/feltService"; export default function Page() { @@ -140,7 +141,7 @@ export default function Page() { const fetchPageData = useCallback(async () => { const requestBody = { - addr: status === "connected" ? hexToDecimal(address || userAddress) : "", + addr: status === "connected" ? (address || userAddress) : "", page_size: 10, shift: 0, duration: timeFrameMap(duration), @@ -259,7 +260,7 @@ export default function Page() { } if (!checkIfLastPage && viewMore) { const requestBody = { - addr: currentSearchedAddress || (userAddress ? hexToDecimal(userAddress) : ""), + addr: currentSearchedAddress || (userAddress ? (userAddress) : ""), page_size: rowsPerPage, shift: currentPage, duration: timeFrameMap(duration), @@ -288,7 +289,7 @@ export default function Page() { */ useEffect(() => { const requestBody = { - addr: currentSearchedAddress || (userAddress ? hexToDecimal(userAddress) : address || ""), + addr: currentSearchedAddress || (userAddress ? (userAddress) : address || ""), page_size: rowsPerPage, shift: 0, duration: timeFrameMap(duration), @@ -313,7 +314,7 @@ export default function Page() { useEffect(() => { if (inititalFetchTop50 && address && duration !== TOP_50_TAB_STRING) { const requestBody = { - addr: currentSearchedAddress || (userAddress ? hexToDecimal(userAddress) : address || ""), + addr: currentSearchedAddress || (userAddress ? (userAddress) : address || ""), page_size: rowsPerPage, shift: 0, duration: timeFrameMap(duration), @@ -433,7 +434,7 @@ export default function Page() { 0 - ? currentSearchedAddress + ? decimalToHex(currentSearchedAddress) : userAddress } /> @@ -524,7 +525,7 @@ export default function Page() { selectedAddress={ currentSearchedAddress.length > 0 ? currentSearchedAddress - : hexToDecimal(userAddress) + : (userAddress) } searchedAddress={currentSearchedAddress} leaderboardToppers={leaderboardToppers} diff --git a/components/UI/avatar.tsx b/components/UI/avatar.tsx index a01be748..812c090a 100644 --- a/components/UI/avatar.tsx +++ b/components/UI/avatar.tsx @@ -2,6 +2,7 @@ import React, { FunctionComponent } from "react"; import ProfilIcon from "@components/UI/iconsComponents/icons/profilIcon"; import theme from "@styles/theme"; import { useStarkProfile, type Address } from "@starknet-react/core"; +import { decimalToHex } from "@utils/feltService"; type AvatarProps = { address: string; @@ -10,9 +11,11 @@ type AvatarProps = { const Avatar: FunctionComponent = ({ address, width = "32" }) => { const { data: profileData } = useStarkProfile({ - address: (address.startsWith("0x") ? address : `0x${address}`) as Address, + address: (address.startsWith("0x") ? address : decimalToHex(address)) as Address, }); + // console.log(profileData,error) + return ( <> {profileData?.profilePicture ? ( diff --git a/components/leaderboard/RankCard.tsx b/components/leaderboard/RankCard.tsx index 71e45951..a21994b9 100644 --- a/components/leaderboard/RankCard.tsx +++ b/components/leaderboard/RankCard.tsx @@ -54,7 +54,8 @@ const RankCard: FunctionComponent = ({
- + +
{displayName}
diff --git a/components/leaderboard/RankingsTable.tsx b/components/leaderboard/RankingsTable.tsx index 19a22106..9e8fa577 100644 --- a/components/leaderboard/RankingsTable.tsx +++ b/components/leaderboard/RankingsTable.tsx @@ -146,7 +146,8 @@ const RankingsTable: FunctionComponent = ({
- + + Date: Sat, 2 Nov 2024 21:47:25 +0100 Subject: [PATCH 7/8] fix: avatar --- components/UI/avatar.tsx | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/components/UI/avatar.tsx b/components/UI/avatar.tsx index 812c090a..e47f8b77 100644 --- a/components/UI/avatar.tsx +++ b/components/UI/avatar.tsx @@ -1,8 +1,13 @@ -import React, { FunctionComponent } from "react"; +import React, { + FunctionComponent, + useContext, + useEffect, + useState, +} from "react"; import ProfilIcon from "@components/UI/iconsComponents/icons/profilIcon"; import theme from "@styles/theme"; -import { useStarkProfile, type Address } from "@starknet-react/core"; -import { decimalToHex } from "@utils/feltService"; +import { StarknetIdJsContext } from "@context/StarknetIdJsProvider"; +import { StarkProfile } from "starknetid.js"; type AvatarProps = { address: string; @@ -10,17 +15,20 @@ type AvatarProps = { }; const Avatar: FunctionComponent = ({ address, width = "32" }) => { - const { data: profileData } = useStarkProfile({ - address: (address.startsWith("0x") ? address : decimalToHex(address)) as Address, - }); - - // console.log(profileData,error) + const { starknetIdNavigator } = useContext(StarknetIdJsContext); + const [profile, setProfile] = useState(null); + useEffect(() => { + if (!starknetIdNavigator) return; + starknetIdNavigator.getProfileData(address).then((profile) => { + setProfile(profile); + }); + }, [starknetIdNavigator, address]); return ( <> - {profileData?.profilePicture ? ( + {profile?.profilePicture ? ( Date: Sun, 3 Nov 2024 02:32:08 +0530 Subject: [PATCH 8/8] removed the unecessary console logs --- app/leaderboard/page.tsx | 1 - components/navbar/walletButton.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/app/leaderboard/page.tsx b/app/leaderboard/page.tsx index 087f8c9d..59e75654 100644 --- a/app/leaderboard/page.tsx +++ b/app/leaderboard/page.tsx @@ -31,7 +31,6 @@ import Divider from "@mui/material/Divider"; import Blur from "@components/shapes/blur"; import RankingsTable from "@components/leaderboard/RankingsTable"; import { TOP_50_TAB_STRING } from "@constants/common"; -// import { } from "@utils/feltService"; import Avatar from "@components/UI/avatar"; import RankingSkeleton from "@components/skeletons/rankingSkeleton"; import { Button } from "@mui/material"; diff --git a/components/navbar/walletButton.tsx b/components/navbar/walletButton.tsx index a754eb95..ba31bff7 100644 --- a/components/navbar/walletButton.tsx +++ b/components/navbar/walletButton.tsx @@ -46,7 +46,6 @@ const WalletButton: FunctionComponent = ({ const isWebWallet = (connector as Connector)?.id === "argentWebWallet"; - // console.log(connector?.id,"wallet") const buttonName = useMemo( () =>