Explorar el Código

Merge pull request #2028 from cprussin/add-sentio

feat(staking): add Sentio to known publishers
Connor Prussin hace 1 año
padre
commit
7e273d0ef6

BIN
apps/staking/public/publisher-icons/blocksize.png


+ 5 - 5
apps/staking/src/api.ts

@@ -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;
@@ -271,7 +268,10 @@ const loadPublisherData = async (
     return {
       apyHistory,
       identity: (
-        KNOWN_PUBLISHERS as Record<string, { name: string; icon: string }>
+        KNOWN_PUBLISHERS as Record<
+          string,
+          (typeof KNOWN_PUBLISHERS)[keyof typeof KNOWN_PUBLISHERS]
+        >
       )[publisher.pubkey.toBase58()],
       numFeeds: numberOfSymbols ?? 0,
       poolCapacity: getPublisherCap(publisherCaps, publisher.pubkey),

+ 7 - 9
apps/staking/src/components/OracleIntegrityStaking/index.tsx

@@ -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 {
@@ -1172,7 +1174,7 @@ type PublisherProps = {
     identity:
       | {
           name: string;
-          icon: string;
+          icon: ComponentType<SVGProps<SVGSVGElement>>;
         }
       | undefined;
     publicKey: PublicKey;
@@ -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} />

+ 8 - 1
apps/staking/src/known-publishers.ts

@@ -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 - 0
apps/staking/src/publisher-icons/blocksize.svg

@@ -0,0 +1,6 @@
+<svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 277.6 277.6">
+  <path d="M0 .01h277.6v22.72H0zm0 254.86h277.6v22.73H0z"/>
+  <path d="M0 0h22.72v277.6H0zm254.88 0h22.72v277.6h-22.72z"/>
+  <path d="M131.87 127.44h138.8v22.72h-138.8z"/>
+  <path d="M127.61 0h22.72v277.6h-22.72z"/>
+</svg>

+ 4 - 0
apps/staking/src/publisher-icons/sentio.svg

@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 98 100">
+  <path fill-rule="evenodd" d="M95.345 52.856c-.865-.605-1.816-1.21-2.767-1.816-1.557-.951-3.114-1.989-4.757-2.94a177.536 177.536 0 0 0-11.416-6.227l-3.2-1.557h-.087c-3.027-1.47-6.14-2.768-9.34-4.065-18.508-7.524-37.19-11.503-54.054-12.108 5.275-9.254 12.28-17.99 17.73-20.324 12.021-5.017 42.724 1.124 48.691 9.427 1.557 2.162 4.152 6.486 7.006 11.675l1.47 2.681.519.952.26.519.086.086c.605 1.211 1.21 2.335 1.816 3.546 3.373 6.919 6.573 14.27 8.13 19.979z"/>
+  <path fill-rule="evenodd" d="M96.296 58.823c0 .173 0 .346-.086.519-1.47 12.194-26.206 33.297-33.816 37.189-7.006 3.546-28.8.26-41.6-4.238h-.087c12.8-7.092 25.6-16.778 37.449-28.713 5.621-5.622 10.638-11.503 15.221-17.47l1.298-1.212a160.458 160.458 0 0 1 20.41 12.022c.173.087.26.173.433.346.519.346.778.865.778 1.557zm-58.032 17.73C31.69 81.569 25.03 85.98 18.372 89.526c-.087.086-.087.086-.173.086-.26.173-.606.173-.952.173-.605 0-1.124-.26-1.556-.605-.174-.173-.346-.433-.52-.606C6.35 78.63 1.68 50.002 1.68 45.159c0-1.989.605-4.67 1.643-7.61.951-2.682 2.249-5.622 3.805-8.65.087-.086.087-.172.173-.259.346-.605.952-.951 1.644-1.037h.432c5.19.172 10.551.691 16.087 1.556z"/>
+</svg>