@@ -10,6 +10,7 @@ import {
10
10
import { calculateApy } from "@pythnetwork/staking-sdk" ;
11
11
import { PublicKey } from "@solana/web3.js" ;
12
12
import clsx from "clsx" ;
13
+ import Image from "next/image" ;
13
14
import {
14
15
useMemo ,
15
16
useCallback ,
@@ -190,13 +191,13 @@ const SelfStaking = ({
190
191
< div className = "sticky left-0 mb-4 flex flex-row items-start justify-between px-4 sm:px-10 sm:pb-4 sm:pt-6 lg:items-center" >
191
192
< div >
192
193
< h3 className = "text-2xl font-light" > Self Staking</ h3 >
193
- < PublisherName
194
+ < PublisherIdentity
194
195
truncatedClassName = "2xl:hidden"
195
196
fullClassName = "hidden 2xl:inline"
196
197
className = "opacity-60"
197
198
>
198
199
{ self }
199
- </ PublisherName >
200
+ </ PublisherIdentity >
200
201
</ div >
201
202
< div className = "flex flex-row items-center gap-4" >
202
203
< MenuTrigger >
@@ -353,10 +354,12 @@ const ReassignStakeAccount = ({
353
354
closeDisabled = { closeDisabled }
354
355
description = {
355
356
< >
356
- < span className = "mr-3 align-middle " >
357
+ < span className = "mr-[0.5em] " >
357
358
Designate a different stake account as the self-staking account for
358
359
</ span >
359
- < PublisherName className = "font-semibold" > { self } </ PublisherName >
360
+ < PublisherIdentity className = "font-semibold" >
361
+ { self }
362
+ </ PublisherIdentity >
360
363
</ >
361
364
}
362
365
{ ...props }
@@ -613,8 +616,8 @@ const PublisherList = ({
613
616
. filter (
614
617
( publisher ) =>
615
618
filter . contains ( publisher . publicKey . toBase58 ( ) , search ) ||
616
- ( publisher . name !== undefined &&
617
- filter . contains ( publisher . name , search ) ) ,
619
+ ( publisher . identity !== undefined &&
620
+ filter . contains ( publisher . identity . name , search ) ) ,
618
621
)
619
622
. sort ( ( a , b ) => {
620
623
if ( yoursFirst ) {
@@ -1027,8 +1030,8 @@ const compareName = (
1027
1030
) =>
1028
1031
( reverse ? - 1 : 1 ) *
1029
1032
collator . compare (
1030
- a . name ?? a . publicKey . toBase58 ( ) ,
1031
- b . name ?? b . publicKey . toBase58 ( ) ,
1033
+ a . identity ?. name ?? a . publicKey . toBase58 ( ) ,
1034
+ b . identity ?. name ?? b . publicKey . toBase58 ( ) ,
1032
1035
) ;
1033
1036
1034
1037
const compareApy = (
@@ -1166,7 +1169,12 @@ type PublisherProps = {
1166
1169
totalStaked : bigint ;
1167
1170
isSelf ?: boolean | undefined ;
1168
1171
publisher : {
1169
- name : string | undefined ;
1172
+ identity :
1173
+ | {
1174
+ name : string ;
1175
+ icon : string ;
1176
+ }
1177
+ | undefined ;
1170
1178
publicKey : PublicKey ;
1171
1179
stakeAccount : PublicKey | undefined ;
1172
1180
selfStake : bigint ;
@@ -1247,6 +1255,7 @@ const Publisher = ({
1247
1255
publisher . poolCapacity ,
1248
1256
publisher . poolUtilization ,
1249
1257
publisher . poolUtilizationDelta ,
1258
+ publisher . delegationFee ,
1250
1259
yieldRate ,
1251
1260
] ,
1252
1261
) ;
@@ -1255,13 +1264,14 @@ const Publisher = ({
1255
1264
< div className = "border-t border-neutral-600/50 p-4 sm:px-10 md:pt-8" >
1256
1265
{ ! isSelf && (
1257
1266
< div className = "flex flex-row items-center justify-between" >
1258
- < PublisherName
1267
+ < PublisherIdentity
1259
1268
className = "font-semibold"
1260
1269
truncatedClassName = "md:hidden"
1261
1270
fullClassName = "hidden md:inline"
1271
+ withNameClassName = "flex flex-col items-start"
1262
1272
>
1263
1273
{ publisher }
1264
- </ PublisherName >
1274
+ </ PublisherIdentity >
1265
1275
< StakeToPublisherButton
1266
1276
api = { api }
1267
1277
currentEpoch = { currentEpoch }
@@ -1356,12 +1366,13 @@ const Publisher = ({
1356
1366
{ ! isSelf && (
1357
1367
< >
1358
1368
< PublisherTableCell className = "truncate py-4 pl-4 font-medium sm:pl-10" >
1359
- < PublisherName
1369
+ < PublisherIdentity
1360
1370
truncatedClassName = "3xl:hidden"
1361
1371
fullClassName = "hidden 3xl:inline"
1372
+ withNameClassName = "flex flex-col items-start"
1362
1373
>
1363
1374
{ publisher }
1364
- </ PublisherName >
1375
+ </ PublisherIdentity >
1365
1376
</ PublisherTableCell >
1366
1377
< PublisherTableCell className = "text-center" >
1367
1378
< Tokens > { publisher . selfStake + publisher . selfStakeDelta } </ Tokens >
@@ -1526,12 +1537,12 @@ const YourPositionsTable = ({
1526
1537
className = "w-28"
1527
1538
actionDescription = {
1528
1539
< >
1529
- < span className = "mr-3 align-middle " >
1540
+ < span className = "mr-[0.5em] " >
1530
1541
Cancel tokens that are in warmup for staking to
1531
1542
</ span >
1532
- < PublisherName className = "font-semibold" >
1543
+ < PublisherIdentity className = "font-semibold" >
1533
1544
{ publisher }
1534
- </ PublisherName >
1545
+ </ PublisherIdentity >
1535
1546
</ >
1536
1547
}
1537
1548
actionName = "Cancel"
@@ -1563,12 +1574,10 @@ const YourPositionsTable = ({
1563
1574
className = "md:w-28"
1564
1575
actionDescription = {
1565
1576
< >
1566
- < span className = "mr-3 align-middle" >
1567
- Unstake tokens from
1568
- </ span >
1569
- < PublisherName className = "font-semibold" >
1577
+ < span className = "mr-[0.5em]" > Unstake tokens from</ span >
1578
+ < PublisherIdentity className = "font-semibold" >
1570
1579
{ publisher }
1571
- </ PublisherName >
1580
+ </ PublisherIdentity >
1572
1581
</ >
1573
1582
}
1574
1583
actionName = "Unstake"
@@ -1615,8 +1624,10 @@ const StakeToPublisherButton = ({
1615
1624
size = "small"
1616
1625
actionDescription = {
1617
1626
< >
1618
- < span className = "mr-3 align-middle" > Stake to</ span >
1619
- < PublisherName className = "font-semibold" > { publisher } </ PublisherName >
1627
+ < span className = "mr-[0.5em]" > Stake to</ span >
1628
+ < PublisherIdentity className = "font-semibold" >
1629
+ { publisher }
1630
+ </ PublisherIdentity >
1620
1631
</ >
1621
1632
}
1622
1633
actionName = "Stake"
@@ -1690,41 +1701,66 @@ const NewApy = ({
1690
1701
publisher . selfStakeDelta ,
1691
1702
publisher . poolUtilization ,
1692
1703
publisher . poolUtilizationDelta ,
1704
+ publisher . delegationFee ,
1693
1705
children ,
1694
1706
] ,
1695
1707
) ;
1696
1708
1697
1709
return < div { ...props } > { apy } %</ div > ;
1698
1710
} ;
1699
1711
1700
- type PublisherNameProps = {
1712
+ type PublisherIdentityProps = PublisherKeyProps & {
1713
+ withNameClassName ?: string | undefined ;
1714
+ } ;
1715
+
1716
+ const PublisherIdentity = ( {
1717
+ className,
1718
+ withNameClassName,
1719
+ ...props
1720
+ } : PublisherIdentityProps ) =>
1721
+ props . children . identity ? (
1722
+ < span className = { clsx ( className , withNameClassName ) } >
1723
+ < span >
1724
+ < Image
1725
+ alt = { `${ props . children . identity . name } icon` }
1726
+ src = { props . children . identity . icon }
1727
+ className = "mr-2 inline-block size-[20px] align-sub"
1728
+ width = { 20 }
1729
+ height = { 20 }
1730
+ />
1731
+ < span className = "mr-[0.5em]" > { props . children . identity . name } </ span >
1732
+ </ span >
1733
+ < PublisherKey className = "text-sm opacity-50" { ...props } />
1734
+ </ span >
1735
+ ) : (
1736
+ < PublisherKey className = { className } { ...props } />
1737
+ ) ;
1738
+
1739
+ type PublisherKeyProps = {
1701
1740
className ?: string | undefined ;
1702
1741
children : PublisherProps [ "publisher" ] ;
1703
1742
fullClassName ?: string ;
1704
1743
truncatedClassName ?: string ;
1705
1744
} ;
1706
1745
1707
- const PublisherName = ( {
1746
+ const PublisherKey = ( {
1708
1747
children,
1709
1748
fullClassName,
1710
1749
truncatedClassName,
1711
1750
className,
1712
- } : PublisherNameProps ) =>
1713
- children . name ? (
1714
- < span className = { className } > { children . name } </ span >
1715
- ) : (
1716
- < CopyButton
1717
- text = { children . publicKey . toBase58 ( ) }
1718
- { ...( className && { className } ) }
1719
- >
1720
- { fullClassName && (
1721
- < code className = { fullClassName } > { children . publicKey . toBase58 ( ) } </ code >
1722
- ) }
1723
- < TruncatedKey className = { truncatedClassName } >
1724
- { children . publicKey }
1725
- </ TruncatedKey >
1726
- </ CopyButton >
1727
- ) ;
1751
+ } : PublisherKeyProps ) => (
1752
+ < CopyButton
1753
+ text = { children . publicKey . toBase58 ( ) }
1754
+ { ...( className && { className } ) }
1755
+ >
1756
+ { fullClassName && (
1757
+ < code className = { fullClassName } > { children . publicKey . toBase58 ( ) } </ code >
1758
+ ) }
1759
+ < TruncatedKey className = { truncatedClassName } >
1760
+ { children . publicKey }
1761
+ </ TruncatedKey >
1762
+ </ CopyButton >
1763
+ ) ;
1728
1764
1729
1765
const useTransferActionForPublisher = (
1730
1766
action : ( ( publisher : PublicKey , amount : bigint ) => Promise < void > ) | undefined ,
0 commit comments