feat(explorer): labvel fix and insurance pool details

This commit is contained in:
Edd
2023-08-09 13:17:03 +01:00
parent 2355099bce
commit 9ba55d95d8
2 changed files with 23 additions and 1 deletions
@@ -10,6 +10,8 @@ import Hash from '../../links/hash';
import { t } from '@vegaprotocol/i18n';
import { ProposalSignatureBundleNewAsset } from './proposal/signature-bundle-new';
import { ProposalSignatureBundleUpdateAsset } from './proposal/signature-bundle-update';
import { MarketLink } from '../../links';
import { formatNumber } from '@vegaprotocol/utils';
export type Proposal = components['schemas']['v1ProposalSubmission'];
export type ProposalTerms = components['schemas']['vegaProposalTerms'];
@@ -89,6 +91,9 @@ export const TxProposal = ({ txData, pubKey, blockData }: TxProposalProps) => {
}
const tx = proposal.terms?.newAsset || proposal.terms?.updateAsset;
const isSuccessorMarketProposal = proposal?.terms?.newMarket?.changes?.successor;
const parentMarketId = isSuccessorMarketProposal && proposal?.terms.newMarket?.changes?.successor?.parentMarketId;
const insurancePoolFraction = proposal?.terms?.newMarket?.changes?.successor?.insurancePoolFraction;
// This component is not rendered if no bundle is required
const SignatureBundleComponent = proposal.terms?.newAsset
@@ -115,6 +120,23 @@ export const TxProposal = ({ txData, pubKey, blockData }: TxProposalProps) => {
<Hash text={deterministicId} />
</TableCell>
</TableRow>
{isSuccessorMarketProposal ? <>
{parentMarketId ?
<TableRow modifier='bordered'>
<TableCell>{t('Previous market')}</TableCell>
<TableCell>
<MarketLink id={proposal.terms?.newMarket.changes.successor.parentMarketId} />
</TableCell>
</TableRow> : null}
{insurancePoolFraction ?
<TableRow modifier='bordered'>
<TableCell>{t('Insurance pool fraction')}</TableCell>
<TableCell>
{formatNumber(Number(insurancePoolFraction) * 100, 0)}%
</TableCell>
</TableRow> : null}
</> : null}
</TableWithTbody>
<ProposalSummary
id={deterministicId}
@@ -78,7 +78,7 @@ export function getLabelForProposal(
} else if (proposal.terms?.updateAsset) {
return t('Proposal: Update asset');
} else if (proposal.terms?.newMarket) {
if (proposal.terms?.newMarket) {
if (proposal.terms?.newMarket.changes?.successor) {
return t('Proposal: Successor market');
} else {
return t('Proposal: New market');