diff --git a/package.json b/package.json
index 99c07ec..e9fc0c0 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,8 @@
"react-dom": "18.2.0",
"react-hot-toast": "^2.4.1",
"react-lottie": "^1.2.3",
- "styled-components": "^5.3.6"
+ "styled-components": "^5.3.6",
+ "viem": "^2.21.48"
},
"devDependencies": {
"@types/node": "18.11.9",
@@ -43,6 +44,6 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unused-imports": "^2.0.0",
"prettier": "^2.7.1",
- "typescript": "4.8.4"
+ "typescript": "^5.6.3"
}
}
diff --git a/src/components/views/home/VerificationDashboard.tsx b/src/components/views/home/VerificationDashboard.tsx
index 1622767..558b2df 100644
--- a/src/components/views/home/VerificationDashboard.tsx
+++ b/src/components/views/home/VerificationDashboard.tsx
@@ -19,10 +19,9 @@ import { Flex, FlexCenter } from '../../styled-components/flex';
import DatePicker from '../../DatePicker';
import CheckBox from '../../CheckBox';
import { useVouchesCount } from '../../../hooks/useVouchesCount';
-import { GIVETH_VERIFIERS_ORG_ID } from '../../../lib/constants';
+import { GIVETH_SOURCE, GIVETH_VERIFIERS_ORG_ID } from '../../../lib/constants';
import Spinner from '../../Spinner';
import VerificationChart from './charts/VerificationChart';
-import VerificationCommentsPieChart from './charts/VerificationCommentsPieChart';
import VerificationAttestorsPieChart from './charts/VerificationAttestorsPieChart';
const VerificationDashboard = () => {
@@ -34,6 +33,7 @@ const VerificationDashboard = () => {
fromDate,
toDate,
GIVETH_VERIFIERS_ORG_ID,
+ GIVETH_SOURCE,
);
return (
@@ -115,7 +115,7 @@ const VerificationDashboard = () => {
)}
-
+ {/*
{loading ? (
@@ -125,7 +125,7 @@ const VerificationDashboard = () => {
/>
)}
-
+ */}
();
const [loading, setLoading] = useState(true);
+
useEffect(() => {
!loading && setLoading(true);
+
const variables = {
fromDate: formatDateToISO(fromDate),
toDate: formatDateToISO(toDate),
organisationId: organizationId,
source,
};
+
deVouchGQLRequest(FETCH_USER_VOUCHES_COUNT_TO_SOURCE_BY_DATE, variables)
- .then((res: IAttestorVouchesCountToSourceRes) => {
- setAttestorsVouchesCountInfo(
- res.data.getOrganisationUserVouchCountBySource,
- );
+ .then(async (res: IAttestorVouchesCountToSourceRes) => {
+ const vouchData =
+ res.data.getOrganisationUserVouchCountBySource;
+
+ if (vouchData?.vouchCountByUser) {
+ // Resolve ENS names using viem's getEnsName
+ const resolvedVouches = await Promise.all(
+ vouchData.vouchCountByUser.map(async vouch => {
+ try {
+ const ensName = await getEnsName(client, {
+ address: vouch.attestorId as `0x${string}`,
+ });
+ return {
+ ...vouch,
+ attestorId: ensName || vouch.attestorId, // Use ENS name if available
+ };
+ } catch {
+ return vouch; // Fallback to original address if ENS lookup fails
+ }
+ }),
+ );
+
+ setAttestorsVouchesCountInfo({
+ ...vouchData,
+ vouchCountByUser: resolvedVouches,
+ });
+ }
})
.catch(showToastError)
.finally(() => setLoading(false));
diff --git a/src/hooks/useVouchesCount.ts b/src/hooks/useVouchesCount.ts
index 4d75040..179b6a5 100644
--- a/src/hooks/useVouchesCount.ts
+++ b/src/hooks/useVouchesCount.ts
@@ -8,6 +8,7 @@ export const useVouchesCount = (
fromDate: Date,
toDate: Date,
organizationId: string,
+ source: string,
) => {
const [vouchCountInfo, setVouchCountInfo] = useState();
const [loading, setLoading] = useState(true);
@@ -17,6 +18,7 @@ export const useVouchesCount = (
fromDate: formatDateToISO(fromDate),
toDate: formatDateToISO(toDate),
organisationId: organizationId,
+ source,
};
deVouchGQLRequest(FETCH_VOUCHES_COUNT_BY_DATE, variables)
.then((res: IFetchVouchesCountRes) => {
@@ -24,7 +26,7 @@ export const useVouchesCount = (
})
.catch(showToastError)
.finally(() => setLoading(false));
- }, [fromDate, organizationId, toDate]);
+ }, [fromDate, organizationId, source, toDate]);
return { vouchCountInfo, loading };
};
diff --git a/yarn.lock b/yarn.lock
index 98a0846..b5aaa9e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,6 +2,11 @@
# yarn lockfile v1
+"@adraffy/ens-normalize@^1.10.1":
+ version "1.11.0"
+ resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz#42cc67c5baa407ac25059fcd7d405cc5ecdb0c33"
+ integrity sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==
+
"@babel/code-frame@7.12.11":
version "7.12.11"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"
@@ -453,6 +458,18 @@
resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.0.1.tgz#469dde61519f6a310874af93ee5969f1d5ff6d03"
integrity sha512-t/0G33t/6VGWZUGCOT7rG42qqvf/x+MrFp1CU+8CN6PrjSSL57R5bqkXfubV9t4eCEnUxVP+5Hn3MoEXEebtEw==
+"@noble/curves@1.6.0", "@noble/curves@^1.4.0", "@noble/curves@^1.6.0", "@noble/curves@~1.6.0":
+ version "1.6.0"
+ resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.6.0.tgz#be5296ebcd5a1730fccea4786d420f87abfeb40b"
+ integrity sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==
+ dependencies:
+ "@noble/hashes" "1.5.0"
+
+"@noble/hashes@1.5.0", "@noble/hashes@^1.4.0", "@noble/hashes@^1.5.0", "@noble/hashes@~1.5.0":
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.5.0.tgz#abadc5ca20332db2b1b2aa3e496e9af1213570b0"
+ integrity sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==
+
"@nodelib/fs.scandir@2.1.5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
@@ -496,6 +513,28 @@
resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.2.0.tgz#8be36a1f66f3265389e90b5f9c9962146758f728"
integrity sha512-sXo/qW2/pAcmT43VoRKOJbDOfV3cYpq3szSVfIThQXNt+E4DfKj361vaAt3c88U5tPUxzEswam7GW48PJqtKAg==
+"@scure/base@~1.1.7", "@scure/base@~1.1.8":
+ version "1.1.9"
+ resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1"
+ integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==
+
+"@scure/bip32@1.5.0", "@scure/bip32@^1.5.0":
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.5.0.tgz#dd4a2e1b8a9da60e012e776d954c4186db6328e6"
+ integrity sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==
+ dependencies:
+ "@noble/curves" "~1.6.0"
+ "@noble/hashes" "~1.5.0"
+ "@scure/base" "~1.1.7"
+
+"@scure/bip39@1.4.0", "@scure/bip39@^1.4.0":
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.4.0.tgz#664d4f851564e2e1d4bffa0339f9546ea55960a6"
+ integrity sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==
+ dependencies:
+ "@noble/hashes" "~1.5.0"
+ "@scure/base" "~1.1.8"
+
"@swc/helpers@0.4.11":
version "0.4.11"
resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.4.11.tgz#db23a376761b3d31c26502122f349a21b592c8de"
@@ -666,6 +705,11 @@
"@typescript-eslint/types" "5.42.0"
eslint-visitor-keys "^3.3.0"
+abitype@1.0.6, abitype@^1.0.6:
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.6.tgz#76410903e1d88e34f1362746e2d407513c38565b"
+ integrity sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A==
+
acorn-jsx@^5.3.2:
version "5.3.2"
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"
@@ -1706,6 +1750,11 @@ etag@1.8.1:
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==
+eventemitter3@5.0.1:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4"
+ integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==
+
events@3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400"
@@ -2318,6 +2367,11 @@ isexe@^2.0.0:
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==
+isows@1.0.6:
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.6.tgz#0da29d706fa51551c663c627ace42769850f86e7"
+ integrity sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw==
+
jest-worker@27.0.0-next.5:
version "27.0.0-next.5"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.0.0-next.5.tgz#5985ee29b12a4e191f4aae4bb73b97971d86ec28"
@@ -2761,6 +2815,19 @@ os-browserify@0.3.0:
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27"
integrity sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==
+ox@0.1.2:
+ version "0.1.2"
+ resolved "https://registry.yarnpkg.com/ox/-/ox-0.1.2.tgz#0f791be2ccabeaf4928e6d423498fe1c8094e560"
+ integrity sha512-ak/8K0Rtphg9vnRJlbOdaX9R7cmxD2MiSthjWGaQdMk3D7hrAlDoM+6Lxn7hN52Za3vrXfZ7enfke/5WjolDww==
+ dependencies:
+ "@adraffy/ens-normalize" "^1.10.1"
+ "@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"
+
p-limit@3.1.0, p-limit@^3.0.2:
version "3.1.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b"
@@ -3589,10 +3656,10 @@ type-fest@^0.7.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.7.1.tgz#8dda65feaf03ed78f0a3f9678f1869147f7c5c48"
integrity sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==
-typescript@4.8.4:
- version "4.8.4"
- resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6"
- integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==
+typescript@^5.6.3:
+ version "5.6.3"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b"
+ integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==
unbox-primitive@^1.0.2:
version "1.0.2"
@@ -3656,6 +3723,21 @@ util@^0.12.0:
is-typed-array "^1.1.3"
which-typed-array "^1.1.2"
+viem@^2.21.48:
+ version "2.21.48"
+ resolved "https://registry.yarnpkg.com/viem/-/viem-2.21.48.tgz#f8f1d0bf5381282e22e6a1f8b72ebd6e64426480"
+ integrity sha512-/hBHyG1gdIIuiQv0z9YmzXl5eWJa0UCZGwkeuQzH2Bmg6FIEwZeEcxgiytXZydip+p2wMBFa1jdr7o5O1+mrIg==
+ dependencies:
+ "@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"
+ ox "0.1.2"
+ webauthn-p256 "0.0.10"
+ ws "8.18.0"
+
vm-browserify@1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
@@ -3676,6 +3758,14 @@ watchpack@2.3.0:
glob-to-regexp "^0.4.1"
graceful-fs "^4.1.2"
+webauthn-p256@0.0.10:
+ version "0.0.10"
+ resolved "https://registry.yarnpkg.com/webauthn-p256/-/webauthn-p256-0.0.10.tgz#877e75abe8348d3e14485932968edf3325fd2fdd"
+ integrity sha512-EeYD+gmIT80YkSIDb2iWq0lq2zbHo1CxHlQTeJ+KkCILWpVy3zASH3ByD4bopzfk0uCwXxLqKGLqp2W4O28VFA==
+ dependencies:
+ "@noble/curves" "^1.4.0"
+ "@noble/hashes" "^1.4.0"
+
webidl-conversions@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
@@ -3730,6 +3820,11 @@ wrappy@1:
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
+ws@8.18.0:
+ version "8.18.0"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc"
+ integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==
+
xtend@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"