diff --git a/apps/staking/public/publisher-icons/blocksize.png b/apps/staking/public/publisher-icons/blocksize.png new file mode 100644 index 0000000000..f93928d89e Binary files /dev/null and b/apps/staking/public/publisher-icons/blocksize.png differ diff --git a/apps/staking/src/api.ts b/apps/staking/src/api.ts index 8772f0e4f8..9759488b20 100644 --- a/apps/staking/src/api.ts +++ b/apps/staking/src/api.ts @@ -12,6 +12,8 @@ import { import { PublicKey } from "@solana/web3.js"; import { z } from "zod"; +import { KNOWN_PUBLISHERS } from "./known-publishers"; + const publishersRankingSchema = z .object({ publisher: z.string(), @@ -47,7 +49,12 @@ type Data = { m: bigint; z: bigint; integrityStakingPublishers: { - name: string | undefined; + identity: + | { + name: string; + icon: string; + } + | undefined; publicKey: PublicKey; stakeAccount: PublicKey | undefined; selfStake: bigint; @@ -263,7 +270,9 @@ const loadPublisherData = async ( return { apyHistory, - name: undefined, // TODO + identity: ( + KNOWN_PUBLISHERS as Record + )[publisher.pubkey.toBase58()], numFeeds: numberOfSymbols ?? 0, poolCapacity: getPublisherCap(publisherCaps, publisher.pubkey), poolUtilization: publisher.totalDelegation, diff --git a/apps/staking/src/components/CopyButton/index.tsx b/apps/staking/src/components/CopyButton/index.tsx index 7c27e02e70..5a7e5c4531 100644 --- a/apps/staking/src/components/CopyButton/index.tsx +++ b/apps/staking/src/components/CopyButton/index.tsx @@ -52,7 +52,7 @@ export const CopyButton = ({ onPress={copy} isDisabled={isCopied} className={clsx( - "group -mx-2 -mt-0.5 rounded-md px-2 py-0.5 align-middle transition hover:bg-white/10 focus:outline-none focus-visible:ring-1 focus-visible:ring-pythpurple-400", + "group mx-[-0.25em] -mt-0.5 inline-block rounded-md px-[0.25em] py-0.5 transition hover:bg-white/10 focus:outline-none focus-visible:ring-1 focus-visible:ring-pythpurple-400", className, )} {...(isCopied && { "data-is-copied": true })} @@ -60,13 +60,13 @@ export const CopyButton = ({ > {(...args) => ( <> - + {typeof children === "function" ? children(...args) : children} - + -
Copy code to clipboaord
+
Copy to clipboard
diff --git a/apps/staking/src/components/Header/current-stake-account.tsx b/apps/staking/src/components/Header/current-stake-account.tsx index a003ad0e71..1356124318 100644 --- a/apps/staking/src/components/Header/current-stake-account.tsx +++ b/apps/staking/src/components/Header/current-stake-account.tsx @@ -28,7 +28,7 @@ export const CurrentStakeAccount = ({
Stake account:
{api.account} diff --git a/apps/staking/src/components/OracleIntegrityStaking/index.tsx b/apps/staking/src/components/OracleIntegrityStaking/index.tsx index 66d8e82ac7..a4b8e68dbf 100644 --- a/apps/staking/src/components/OracleIntegrityStaking/index.tsx +++ b/apps/staking/src/components/OracleIntegrityStaking/index.tsx @@ -10,6 +10,7 @@ import { import { calculateApy } from "@pythnetwork/staking-sdk"; import { PublicKey } from "@solana/web3.js"; import clsx from "clsx"; +import Image from "next/image"; import { useMemo, useCallback, @@ -190,13 +191,13 @@ const SelfStaking = ({

Self Staking

- {self} - +
@@ -353,10 +354,12 @@ const ReassignStakeAccount = ({ closeDisabled={closeDisabled} description={ <> - + Designate a different stake account as the self-staking account for - {self} + + {self} + } {...props} @@ -613,8 +616,8 @@ const PublisherList = ({ .filter( (publisher) => filter.contains(publisher.publicKey.toBase58(), search) || - (publisher.name !== undefined && - filter.contains(publisher.name, search)), + (publisher.identity !== undefined && + filter.contains(publisher.identity.name, search)), ) .sort((a, b) => { if (yoursFirst) { @@ -1027,8 +1030,8 @@ const compareName = ( ) => (reverse ? -1 : 1) * collator.compare( - a.name ?? a.publicKey.toBase58(), - b.name ?? b.publicKey.toBase58(), + a.identity?.name ?? a.publicKey.toBase58(), + b.identity?.name ?? b.publicKey.toBase58(), ); const compareApy = ( @@ -1166,7 +1169,12 @@ type PublisherProps = { totalStaked: bigint; isSelf?: boolean | undefined; publisher: { - name: string | undefined; + identity: + | { + name: string; + icon: string; + } + | undefined; publicKey: PublicKey; stakeAccount: PublicKey | undefined; selfStake: bigint; @@ -1247,6 +1255,7 @@ const Publisher = ({ publisher.poolCapacity, publisher.poolUtilization, publisher.poolUtilizationDelta, + publisher.delegationFee, yieldRate, ], ); @@ -1255,13 +1264,14 @@ const Publisher = ({
{!isSelf && (
- {publisher} - + - {publisher} - + {publisher.selfStake + publisher.selfStakeDelta} @@ -1526,12 +1537,12 @@ const YourPositionsTable = ({ className="w-28" actionDescription={ <> - + Cancel tokens that are in warmup for staking to - + {publisher} - + } actionName="Cancel" @@ -1563,12 +1574,10 @@ const YourPositionsTable = ({ className="md:w-28" actionDescription={ <> - - Unstake tokens from - - + Unstake tokens from + {publisher} - + } actionName="Unstake" @@ -1615,8 +1624,10 @@ const StakeToPublisherButton = ({ size="small" actionDescription={ <> - Stake to - {publisher} + Stake to + + {publisher} + } actionName="Stake" @@ -1690,6 +1701,7 @@ const NewApy = ({ publisher.selfStakeDelta, publisher.poolUtilization, publisher.poolUtilizationDelta, + publisher.delegationFee, children, ], ); @@ -1697,34 +1709,58 @@ const NewApy = ({ return
{apy}%
; }; -type PublisherNameProps = { +type PublisherIdentityProps = PublisherKeyProps & { + withNameClassName?: string | undefined; +}; + +const PublisherIdentity = ({ + className, + withNameClassName, + ...props +}: PublisherIdentityProps) => + props.children.identity ? ( + + + {`${props.children.identity.name} + {props.children.identity.name} + + + + ) : ( + + ); + +type PublisherKeyProps = { className?: string | undefined; children: PublisherProps["publisher"]; fullClassName?: string; truncatedClassName?: string; }; -const PublisherName = ({ +const PublisherKey = ({ children, fullClassName, truncatedClassName, className, -}: PublisherNameProps) => - children.name ? ( - {children.name} - ) : ( - - {fullClassName && ( - {children.publicKey.toBase58()} - )} - - {children.publicKey} - - - ); +}: PublisherKeyProps) => ( + + {fullClassName && ( + {children.publicKey.toBase58()} + )} + + {children.publicKey} + + +); const useTransferActionForPublisher = ( action: ((publisher: PublicKey, amount: bigint) => Promise) | undefined, diff --git a/apps/staking/src/components/Tooltip/index.tsx b/apps/staking/src/components/Tooltip/index.tsx index fd095e9896..c28836452f 100644 --- a/apps/staking/src/components/Tooltip/index.tsx +++ b/apps/staking/src/components/Tooltip/index.tsx @@ -9,14 +9,19 @@ type Props = Omit, "children"> & { export const Tooltip = ({ children, className, offset, ...props }: Props) => ( - + diff --git a/apps/staking/src/known-publishers.ts b/apps/staking/src/known-publishers.ts new file mode 100644 index 0000000000..2aa096d8da --- /dev/null +++ b/apps/staking/src/known-publishers.ts @@ -0,0 +1,6 @@ +export const KNOWN_PUBLISHERS = { + CfVkYofcLC1iVBcYFzgdYPeiX25SVRmWvBQVHorP1A3y: { + name: "BLOCKSIZE", + icon: "/publisher-icons/blocksize.png", + }, +};