Преглед на файлове

[xc-admin-frontend] Some cleanup (#606)

* Some cleanup

* Fix

* Fix
guibescos преди 2 години
родител
ревизия
8a6e0e6e4b

+ 3 - 38
governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx

@@ -11,7 +11,6 @@ import {
   getMultisigCluster,
   isRemoteCluster,
   mapKey,
-  OPS_KEY,
   proposeInstructions,
   WORMHOLE_ADDRESS,
 } from 'xc_admin_common'
@@ -414,29 +413,6 @@ const General = () => {
     }
   }
 
-  const AddressChangesRow = ({ changes }: { changes: any }) => {
-    const key = 'address'
-    return (
-      <>
-        {changes.prev !== changes.new && (
-          <tr key={key}>
-            <td className="base16 py-4 pl-6 pr-2 lg:pl-6">
-              {key
-                .split('_')
-                .map((word) => capitalizeFirstLetter(word))
-                .join(' ')}
-            </td>
-            <td className="base16 py-4 pl-1 pr-2 lg:pl-6">
-              <s>{changes.prev}</s>
-              <br />
-              {changes.new}
-            </td>
-          </tr>
-        )}
-      </>
-    )
-  }
-
   const MetadataChangesRows = ({ changes }: { changes: any }) => {
     const addNewPriceFeed =
       changes.prev === undefined && changes.new !== undefined
@@ -571,20 +547,14 @@ const General = () => {
   }
 
   const NewPriceFeedsRows = ({ priceFeedData }: { priceFeedData: any }) => {
-    const key =
-      priceFeedData.metadata.asset_type +
-      '.' +
-      priceFeedData.metadata.base +
-      '/' +
-      priceFeedData.metadata.quote_currency
     return (
       <>
         <MetadataChangesRows
-          key={key + 'metadata'}
+          key={priceFeedData.key + 'metadata'}
           changes={{ new: priceFeedData.metadata }}
         />
         <PriceAccountsChangesRows
-          key={key + 'priceAccounts'}
+          key={priceFeedData.key + 'priceAccounts'}
           changes={{ new: priceFeedData.priceAccounts }}
         />
       </>
@@ -621,12 +591,7 @@ const General = () => {
                     <NewPriceFeedsRows key={key} priceFeedData={newChanges} />
                   ) : (
                     diff.map((k) =>
-                      k === 'address' ? (
-                        <AddressChangesRow
-                          key={k}
-                          changes={{ prev: prev[k], new: newChanges[k] }}
-                        />
-                      ) : k === 'metadata' ? (
+                      k === 'metadata' ? (
                         <MetadataChangesRows
                           key={k}
                           changes={{ prev: prev[k], new: newChanges[k] }}

+ 2 - 2
governance/xc_admin/packages/xc_admin_frontend/hooks/usePyth.ts

@@ -114,7 +114,7 @@ const usePyth = (): PythHookData => {
             case AccountType.Product:
               const parsed = parseProductData(allPythAccounts[i].account.data)
 
-              if (parsed.priceAccountKey?.toBase58() == ONES) {
+              if (!parsed.priceAccountKey) {
                 productRawConfigs[allPythAccounts[i].pubkey.toBase58()] = {
                   priceAccounts: [],
                   metadata: parsed.product,
@@ -122,7 +122,7 @@ const usePyth = (): PythHookData => {
                 }
               } else {
                 let priceAccountKey: string | undefined =
-                  parsed.priceAccountKey?.toBase58()
+                  parsed.priceAccountKey.toBase58()
                 let priceAccounts = []
                 while (priceAccountKey) {
                   const toAdd: PriceRawConfig = priceRawConfigs[priceAccountKey]