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

* Some cleanup

* Fix

* Fix
This commit is contained in:
guibescos 2023-02-17 12:14:36 +00:00 committed by GitHub
parent b2cae745c8
commit 8a6e0e6e4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 40 deletions

View File

@ -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] }}

View File

@ -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]