@@ -8,7 +8,8 @@ import ClientWrapper from '@/components/shared/ClientWrapper';
88import { CopyableAddress } from '@/components/shared/CopyableValue' ;
99import config from '@/config' ;
1010import { getPublicProfiles } from '@/lib/api/backend' ;
11- import { fetchCSPDetails , fetchErc20Balance , getLicenses } from '@/lib/api/blockchain' ;
11+ import { fetchCSPDetails , fetchErc20Balance } from '@/lib/api/blockchain' ;
12+ import { cachedGetLicenses } from '@/lib/api/cache' ;
1213import { cachedGetENSName , fBI , getShortAddress , isZeroAddress } from '@/lib/utils' ;
1314import * as types from '@/typedefs/blockchain' ;
1415import type { PublicProfileInfo } from '@/typedefs/general' ;
@@ -30,48 +31,48 @@ const getCachedNodeOperatorProfile = unstable_cache(
3031 { revalidate : 60 } ,
3132) ;
3233
33- export async function generateMetadata ( { params } ) {
34- const { ownerEthAddr } = await params ;
35- const errorMetadata = {
36- title : 'Error' ,
37- openGraph : {
38- title : 'Error' ,
39- } ,
40- } ;
41-
42- if ( ! ownerEthAddr || ! isAddress ( ownerEthAddr ) || isZeroAddress ( ownerEthAddr ) ) {
43- return errorMetadata ;
44- }
45-
46- const canonical = `/account/${ encodeURIComponent ( ownerEthAddr ) } ` ;
47- const errorMetadataWithCanonical = {
48- ...errorMetadata ,
49- alternates : {
50- canonical,
51- } ,
52- } ;
53-
54- try {
55- const [ ensName , publicProfile ] = await Promise . all ( [
56- cachedGetENSName ( ownerEthAddr ) ,
57- getCachedNodeOperatorProfile ( ownerEthAddr as types . EthAddress ) ,
34+ export async function generateMetadata ( { params } ) {
35+ const { ownerEthAddr } = await params ;
36+ const errorMetadata = {
37+ title : 'Error' ,
38+ openGraph : {
39+ title : 'Error' ,
40+ } ,
41+ } ;
42+
43+ if ( ! ownerEthAddr || ! isAddress ( ownerEthAddr ) || isZeroAddress ( ownerEthAddr ) ) {
44+ return errorMetadata ;
45+ }
46+
47+ const canonical = `/account/${ encodeURIComponent ( ownerEthAddr ) } ` ;
48+ const errorMetadataWithCanonical = {
49+ ...errorMetadata ,
50+ alternates : {
51+ canonical,
52+ } ,
53+ } ;
54+
55+ try {
56+ const [ ensName , publicProfile ] = await Promise . all ( [
57+ cachedGetENSName ( ownerEthAddr ) ,
58+ getCachedNodeOperatorProfile ( ownerEthAddr as types . EthAddress ) ,
5859 ] ) ;
5960
6061 const primaryName = publicProfile ?. name || ensName || getShortAddress ( ownerEthAddr , 4 , true ) ;
6162
62- return {
63- title : `Node Operator • ${ primaryName } ` ,
64- openGraph : {
65- title : `Node Operator • ${ primaryName } ` ,
66- } ,
67- alternates : {
68- canonical,
69- } ,
70- } ;
71- } catch ( error ) {
72- return errorMetadataWithCanonical ;
73- }
74- }
63+ return {
64+ title : `Node Operator • ${ primaryName } ` ,
65+ openGraph : {
66+ title : `Node Operator • ${ primaryName } ` ,
67+ } ,
68+ alternates : {
69+ canonical,
70+ } ,
71+ } ;
72+ } catch ( error ) {
73+ return errorMetadataWithCanonical ;
74+ }
75+ }
7576
7677export default async function NodeOperatorPage ( { params } ) {
7778 const { ownerEthAddr } = await params ;
@@ -81,15 +82,15 @@ export default async function NodeOperatorPage({ params }) {
8182 return < NotFound /> ;
8283 }
8384
84- let licenses : types . LicenseInfo [ ] ,
85+ let licenses : types . CachedLicense [ ] ,
8586 ensName : string | undefined ,
8687 r1Balance : bigint ,
8788 publicProfileInfo : PublicProfileInfo | undefined ,
8889 cspDetails : types . CSP | undefined ;
8990
9091 try {
9192 [ licenses , ensName , r1Balance , publicProfileInfo , cspDetails ] = await Promise . all ( [
92- getLicenses ( ownerEthAddr ) ,
93+ cachedGetLicenses ( ownerEthAddr ) ,
9394 cachedGetENSName ( ownerEthAddr ) ,
9495 fetchErc20Balance ( ownerEthAddr , config . r1ContractAddress ) ,
9596 getCachedNodeOperatorProfile ( ownerEthAddr as types . EthAddress ) ,
@@ -133,7 +134,7 @@ export default async function NodeOperatorPage({ params }) {
133134 value = {
134135 < div className = "text-primary" >
135136 { fBI (
136- licenses . reduce ( ( acc , license ) => acc + license . totalClaimedAmount , 0n ) ,
137+ licenses . reduce ( ( acc , license ) => acc + BigInt ( license . totalClaimedAmount ) , 0n ) ,
137138 18 ,
138139 ) }
139140 </ div >
@@ -148,9 +149,12 @@ export default async function NodeOperatorPage({ params }) {
148149 value = {
149150 < div className = "w-full min-w-52 xs:min-w-56 md:min-w-60" >
150151 < UsageStats
151- totalClaimedAmount = { licenses . reduce ( ( acc , license ) => acc + license . totalClaimedAmount , 0n ) }
152+ totalClaimedAmount = { licenses . reduce (
153+ ( acc , license ) => acc + BigInt ( license . totalClaimedAmount ) ,
154+ 0n ,
155+ ) }
152156 totalAssignedAmount = { licenses . reduce (
153- ( acc , license ) => acc + license . totalAssignedAmount ,
157+ ( acc , license ) => acc + BigInt ( license . totalAssignedAmount ) ,
154158 0n ,
155159 ) }
156160 />
0 commit comments