Skip to content

Commit 8a6e0e6

Browse files
authored
[xc-admin-frontend] Some cleanup (#606)
* Some cleanup * Fix * Fix
1 parent b2cae74 commit 8a6e0e6

File tree

2 files changed

+5
-40
lines changed

2 files changed

+5
-40
lines changed

governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
getMultisigCluster,
1212
isRemoteCluster,
1313
mapKey,
14-
OPS_KEY,
1514
proposeInstructions,
1615
WORMHOLE_ADDRESS,
1716
} from 'xc_admin_common'
@@ -414,29 +413,6 @@ const General = () => {
414413
}
415414
}
416415

417-
const AddressChangesRow = ({ changes }: { changes: any }) => {
418-
const key = 'address'
419-
return (
420-
<>
421-
{changes.prev !== changes.new && (
422-
<tr key={key}>
423-
<td className="base16 py-4 pl-6 pr-2 lg:pl-6">
424-
{key
425-
.split('_')
426-
.map((word) => capitalizeFirstLetter(word))
427-
.join(' ')}
428-
</td>
429-
<td className="base16 py-4 pl-1 pr-2 lg:pl-6">
430-
<s>{changes.prev}</s>
431-
<br />
432-
{changes.new}
433-
</td>
434-
</tr>
435-
)}
436-
</>
437-
)
438-
}
439-
440416
const MetadataChangesRows = ({ changes }: { changes: any }) => {
441417
const addNewPriceFeed =
442418
changes.prev === undefined && changes.new !== undefined
@@ -571,20 +547,14 @@ const General = () => {
571547
}
572548

573549
const NewPriceFeedsRows = ({ priceFeedData }: { priceFeedData: any }) => {
574-
const key =
575-
priceFeedData.metadata.asset_type +
576-
'.' +
577-
priceFeedData.metadata.base +
578-
'/' +
579-
priceFeedData.metadata.quote_currency
580550
return (
581551
<>
582552
<MetadataChangesRows
583-
key={key + 'metadata'}
553+
key={priceFeedData.key + 'metadata'}
584554
changes={{ new: priceFeedData.metadata }}
585555
/>
586556
<PriceAccountsChangesRows
587-
key={key + 'priceAccounts'}
557+
key={priceFeedData.key + 'priceAccounts'}
588558
changes={{ new: priceFeedData.priceAccounts }}
589559
/>
590560
</>
@@ -621,12 +591,7 @@ const General = () => {
621591
<NewPriceFeedsRows key={key} priceFeedData={newChanges} />
622592
) : (
623593
diff.map((k) =>
624-
k === 'address' ? (
625-
<AddressChangesRow
626-
key={k}
627-
changes={{ prev: prev[k], new: newChanges[k] }}
628-
/>
629-
) : k === 'metadata' ? (
594+
k === 'metadata' ? (
630595
<MetadataChangesRows
631596
key={k}
632597
changes={{ prev: prev[k], new: newChanges[k] }}

governance/xc_admin/packages/xc_admin_frontend/hooks/usePyth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ const usePyth = (): PythHookData => {
114114
case AccountType.Product:
115115
const parsed = parseProductData(allPythAccounts[i].account.data)
116116

117-
if (parsed.priceAccountKey?.toBase58() == ONES) {
117+
if (!parsed.priceAccountKey) {
118118
productRawConfigs[allPythAccounts[i].pubkey.toBase58()] = {
119119
priceAccounts: [],
120120
metadata: parsed.product,
121121
address: allPythAccounts[i].pubkey,
122122
}
123123
} else {
124124
let priceAccountKey: string | undefined =
125-
parsed.priceAccountKey?.toBase58()
125+
parsed.priceAccountKey.toBase58()
126126
let priceAccounts = []
127127
while (priceAccountKey) {
128128
const toAdd: PriceRawConfig = priceRawConfigs[priceAccountKey]

0 commit comments

Comments
 (0)