@@ -21,12 +21,14 @@ import {useOperatorRuntime} from "@/hooks/useOperatorRuntime";
21
21
import { accruingStateAtom } from "@/hooks/useAccruingInfo" ;
22
22
import { ethers } from "ethers" ;
23
23
import { BiLoaderAlt } from "react-icons/bi" ;
24
+ import { EarnedEsxaiBalance , useGetWalletBalance } from "@/hooks/useGetWalletBalance" ;
24
25
25
26
interface HasKeysProps {
26
27
combinedOwners : string [ ] ,
27
28
combinedLicensesMap : LicenseMap ,
28
29
statusMap : StatusMap ,
29
30
isWalletAssignedMap : WalletAssignedMap ,
31
+ earnedEsxaiBalance : EarnedEsxaiBalance ,
30
32
}
31
33
32
34
export function HasKeys ( { combinedOwners, combinedLicensesMap, statusMap, isWalletAssignedMap} : HasKeysProps ) {
@@ -41,6 +43,7 @@ export function HasKeys({combinedOwners, combinedLicensesMap, statusMap, isWalle
41
43
const [ isRemoveWalletOpen , setIsRemoveWalletOpen ] = useState < boolean > ( false ) ;
42
44
const { isLoading : isOperatorLoading , publicKey : operatorAddress } = useOperator ( ) ;
43
45
const { startRuntime, sentryRunning} = useOperatorRuntime ( ) ;
46
+ const { data : earnedEsxaiBalance } = useGetWalletBalance ( combinedOwners ) ;
44
47
45
48
function startAssignment ( ) {
46
49
if ( ! isOperatorLoading ) {
@@ -291,39 +294,74 @@ export function HasKeys({combinedOwners, combinedLicensesMap, statusMap, isWalle
291
294
</ div >
292
295
</ div >
293
296
294
- < div className = "flex flex-col pl-10" >
295
- < div className = "flex items-center gap-1 text-[15px] text-[#525252]" >
296
- < p > Accrued network esXAI</ p >
297
- < Tooltip
298
- header = { "Each key will accrue esXAI" }
299
- body = { "This value is the sum of all esXAI accrued for the selected wallet. If esXAI has already been claimed, it will not be reflected in this value." }
300
- >
301
- < AiOutlineInfoCircle size = { 16 } color = { "#A3A3A3" } />
302
- </ Tooltip >
303
- </ div >
304
- < div className = "flex items-center gap-2 font-semibold" >
305
- < XaiLogo />
306
- < div >
307
- { balances
308
- ?
309
- < div className = { `flex gap-1 items-end` } >
310
- < p className = "text-3xl" >
311
- { ethers . formatEther ( Object . values ( balances ) . reduce ( ( acc , value ) => acc + value . totalAccruedEsXai , BigInt ( 0 ) ) ) }
312
- </ p >
297
+ < div >
298
+ < div className = "flex" >
313
299
314
- < p className = "flex items-center text-[#A3A3A3] text-[12px] ml-1 mb-1" >
315
- Last
316
- updated: { ! isBalancesLoading && balancesFetchedLast ? balancesFetchedLast . toLocaleString ( ) :
317
- < BiLoaderAlt className = "animate-spin w-[18px]" color = { "#A3A3A3" } /> }
318
- </ p >
300
+ < div className = "flex flex-col px-10" >
301
+ < div className = "flex items-center gap-1 text-[15px] text-[#525252]" >
302
+ < p > esXAI balance</ p >
303
+ < Tooltip
304
+ header = { "Claimed esXAI will appear in your wallet balance.\n" }
305
+ body = { "Once you pass KYC for a wallet, any accrued esXAI for that wallet will be claimed and reflected in your esXAI balance." }
306
+ >
307
+ < AiOutlineInfoCircle size = { 16 } color = { "#A3A3A3" } />
308
+ </ Tooltip >
309
+ </ div >
310
+ < div className = "flex items-center gap-2 font-semibold" >
311
+ < XaiLogo />
312
+ < div >
313
+ { earnedEsxaiBalance ? (
314
+ < div className = { `flex gap-1 items-end` } >
315
+ < p className = "text-3xl" >
316
+ { ethers . formatEther (
317
+ earnedEsxaiBalance . reduce ( ( acc , item ) => acc + item . esXaiBalance , BigInt ( 0 ) )
318
+ ) }
319
+ </ p >
320
+ </ div >
321
+ ) : (
322
+ < p className = "text-3xl" >
323
+ Loading...
324
+ </ p >
325
+ ) }
319
326
</ div >
320
- : "Loading..."
321
- }
327
+
328
+ </ div >
329
+ </ div >
330
+
331
+ < div className = "flex flex-col pl-10" >
332
+ < div className = "flex items-center gap-1 text-[15px] text-[#525252]" >
333
+ < p > Accrued esXAI (unclaimed)</ p >
334
+ < Tooltip
335
+ header = { "Each key will accrue esXAI. Pass KYC to claim." }
336
+ body = { "This value is the sum of all esXAI accrued for the selected wallet. If esXAI has already been claimed, it will appear in esXAI balance." }
337
+ >
338
+ < AiOutlineInfoCircle size = { 16 } color = { "#A3A3A3" } />
339
+ </ Tooltip >
340
+ </ div >
341
+ < div className = "flex items-center gap-2 font-semibold" >
342
+ < XaiLogo />
343
+ < div >
344
+ { balances
345
+ ?
346
+ < div className = { `flex gap-1 items-end` } >
347
+ < p className = "text-3xl" >
348
+ { ethers . formatEther ( Object . values ( balances ) . reduce ( ( acc , value ) => acc + value . totalAccruedEsXai , BigInt ( 0 ) ) ) }
349
+ </ p >
350
+ </ div >
351
+ : "Loading..."
352
+ }
353
+ </ div >
354
+ </ div >
355
+
356
+ < p className = "flex items-center text-[#A3A3A3] text-[12px]" >
357
+ Last
358
+ updated: { ! isBalancesLoading && balancesFetchedLast ? balancesFetchedLast . toLocaleString ( ) :
359
+ < BiLoaderAlt className = "animate-spin w-[18px]" color = { "#A3A3A3" } /> }
360
+ </ p >
322
361
</ div >
323
362
</ div >
324
363
</ div >
325
364
326
-
327
365
< div className = "flex flex-col max-h-[70vh]" >
328
366
< div className = "w-full overflow-y-auto" >
329
367
< table className = "w-full bg-white" >
0 commit comments