Procházet zdrojové kódy

fix: minor fixes (#2166)

* use getSignaturesForAddress

* handle promise error
guibescos před 11 měsíci
rodič
revize
f3ec2b5dd1

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

@@ -508,22 +508,6 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
             )
           }
 
-          // check if minPub has changed
-          if (
-            prev.priceAccounts[0].minPub !== newChanges.priceAccounts[0].minPub
-          ) {
-            // create update product account instruction
-            instructions.push(
-              await pythProgramClient.methods
-                .setMinPub(newChanges.priceAccounts[0].minPub, [0, 0, 0])
-                .accounts({
-                  priceAccount: new PublicKey(prev.priceAccounts[0].address),
-                  fundingAccount,
-                })
-                .instruction()
-            )
-          }
-
           // check if maxLatency has changed
           if (
             prev.priceAccounts[0].maxLatency !==
@@ -584,6 +568,22 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
             )
             await initPublisherInPriceStore(publisherPubKey)
           }
+
+          // check if minPub has changed
+          if (
+            prev.priceAccounts[0].minPub !== newChanges.priceAccounts[0].minPub
+          ) {
+            // create update product account instruction
+            instructions.push(
+              await pythProgramClient.methods
+                .setMinPub(newChanges.priceAccounts[0].minPub, [0, 0, 0])
+                .accounts({
+                  priceAccount: new PublicKey(prev.priceAccounts[0].address),
+                  fundingAccount,
+                })
+                .instruction()
+            )
+          }
         }
       }
 

+ 6 - 1
governance/xc_admin/packages/xc_admin_frontend/components/tabs/Proposals/ProposalRow.tsx

@@ -56,7 +56,7 @@ export const ProposalRow = ({
         // set proposal time
         if (!time) {
           connection
-            .getConfirmedSignaturesForAddress2(proposal.publicKey)
+            .getSignaturesForAddress(proposal.publicKey)
             .then((txs) => {
               if (isCancelled) return
               const firstBlockTime = txs?.[txs.length - 1]?.blockTime
@@ -64,6 +64,11 @@ export const ProposalRow = ({
                 setTime(new Date(firstBlockTime * 1000))
               }
             })
+            .catch((err) => {
+              console.error(
+                `Error fetching proposal time for ${proposal.publicKey.toBase58()}: ${err}`
+              )
+            })
         }
 
         // calculate instructions summary