Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
10 changes: 5 additions & 5 deletions apps/staking/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ type Data = {
z: bigint;
integrityStakingPublishers: {
identity:
| {
name: string;
icon: string;
}
| (typeof KNOWN_PUBLISHERS)[keyof typeof KNOWN_PUBLISHERS]
| undefined;
publicKey: PublicKey;
stakeAccount: PublicKey | undefined;
Expand Down Expand Up @@ -271,7 +268,10 @@ const loadPublisherData = async (
return {
apyHistory,
identity: (
KNOWN_PUBLISHERS as Record<string, { name: string; icon: string }>
KNOWN_PUBLISHERS as Record<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we move the type to KNOWN_PUBLISHERS? Or maybe even have the type separately.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're too fast for me!

I' changed this to typeof KNOWN_PUBLISHERS[keyof typeof KNOWN_PUBLISHERS] so the type is entirely driven by the shape :)

string,
(typeof KNOWN_PUBLISHERS)[keyof typeof KNOWN_PUBLISHERS]
>
)[publisher.pubkey.toBase58()],
numFeeds: numberOfSymbols ?? 0,
poolCapacity: getPublisherCap(publisherCaps, publisher.pubkey),
Expand Down
16 changes: 7 additions & 9 deletions apps/staking/src/components/OracleIntegrityStaking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ 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,
useState,
useRef,
createElement,
type ComponentProps,
type Dispatch,
type SetStateAction,
type HTMLAttributes,
type FormEvent,
type ComponentType,
type SVGProps,
} from "react";
import { useFilter, useCollator } from "react-aria";
import {
Expand Down Expand Up @@ -1172,7 +1174,7 @@ type PublisherProps = {
identity:
| {
name: string;
icon: string;
icon: ComponentType<SVGProps<SVGSVGElement>>;
}
| undefined;
publicKey: PublicKey;
Expand Down Expand Up @@ -1721,13 +1723,9 @@ const PublisherIdentity = ({
props.children.identity ? (
<span className={clsx(className, withNameClassName)}>
<span>
<Image
alt={`${props.children.identity.name} icon`}
src={props.children.identity.icon}
className="mr-2 inline-block size-[20px] align-sub"
width={20}
height={20}
/>
{createElement(props.children.identity.icon, {
className: "mr-2 inline-block size-[20px] align-sub",
})}
<span className="mr-[0.5em]">{props.children.identity.name}</span>
</span>
<PublisherKey className="text-sm opacity-50" {...props} />
Expand Down
9 changes: 8 additions & 1 deletion apps/staking/src/known-publishers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import blocksize from "./publisher-icons/blocksize.svg";
import sentio from "./publisher-icons/sentio.svg";

export const KNOWN_PUBLISHERS = {
CfVkYofcLC1iVBcYFzgdYPeiX25SVRmWvBQVHorP1A3y: {
name: "BLOCKSIZE",
icon: "/publisher-icons/blocksize.png",
icon: blocksize,
},
"89ijemG1TUL2kdV2RtCrhXzY5QhyKHsWqCmP5iobvLUF": {
name: "Sentio",
icon: sentio,
},
};
6 changes: 6 additions & 0 deletions apps/staking/src/publisher-icons/blocksize.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions apps/staking/src/publisher-icons/sentio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading