fix(explorer): fix various small lp tx view bugs (#2738)
This commit is contained in:
parent
ed1363b035
commit
dad953b45b
@ -2,16 +2,5 @@ query ExplorerSettlementAssetForMarket($id: ID!) {
|
|||||||
market(id: $id) {
|
market(id: $id) {
|
||||||
id
|
id
|
||||||
decimalPlaces
|
decimalPlaces
|
||||||
tradableInstrument {
|
|
||||||
instrument {
|
|
||||||
product {
|
|
||||||
... on Future {
|
|
||||||
settlementAsset {
|
|
||||||
decimals
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ export type ExplorerSettlementAssetForMarketQueryVariables = Types.Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type ExplorerSettlementAssetForMarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', decimals: number } } } } } | null };
|
export type ExplorerSettlementAssetForMarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number } | null };
|
||||||
|
|
||||||
|
|
||||||
export const ExplorerSettlementAssetForMarketDocument = gql`
|
export const ExplorerSettlementAssetForMarketDocument = gql`
|
||||||
@ -16,17 +16,6 @@ export const ExplorerSettlementAssetForMarketDocument = gql`
|
|||||||
market(id: $id) {
|
market(id: $id) {
|
||||||
id
|
id
|
||||||
decimalPlaces
|
decimalPlaces
|
||||||
tradableInstrument {
|
|
||||||
instrument {
|
|
||||||
product {
|
|
||||||
... on Future {
|
|
||||||
settlementAsset {
|
|
||||||
decimals
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -91,7 +91,7 @@ describe('LiquidityProvisionDetails component', () => {
|
|||||||
expect(res.getByTestId('SIDE_SELL-40-1')).toBeInTheDocument();
|
expect(res.getByTestId('SIDE_SELL-40-1')).toBeInTheDocument();
|
||||||
expect(res.getByText('-1')).toBeInTheDocument();
|
expect(res.getByText('-1')).toBeInTheDocument();
|
||||||
expect(res.getByText('Best Bid')).toBeInTheDocument();
|
expect(res.getByText('Best Bid')).toBeInTheDocument();
|
||||||
expect(res.getByText('40% (normalised from: 20%)')).toBeInTheDocument();
|
expect(res.getByText('40%')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles a missing offset gracefully (should not happen)', () => {
|
it('handles a missing offset gracefully (should not happen)', () => {
|
||||||
@ -125,7 +125,7 @@ describe('LiquidityProvisionDetails component', () => {
|
|||||||
);
|
);
|
||||||
// Row test ids and keys are based on the side, reference and proportion - and that proportion is scaled
|
// Row test ids and keys are based on the side, reference and proportion - and that proportion is scaled
|
||||||
expect(res.getByTestId('SIDE_SELL-40-1')).toBeInTheDocument();
|
expect(res.getByTestId('SIDE_SELL-40-1')).toBeInTheDocument();
|
||||||
expect(res.getByText('40% (normalised from: 20%)')).toBeInTheDocument();
|
expect(res.getByText('40%')).toBeInTheDocument();
|
||||||
expect(res.getByText('-')).toBeInTheDocument();
|
expect(res.getByText('-')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -67,11 +67,7 @@ export function LiquidityProvisionDetailsRow({
|
|||||||
<td className="text-center">
|
<td className="text-center">
|
||||||
{order.reference ? LiquidityReferenceLabel[order.reference] : '-'}
|
{order.reference ? LiquidityReferenceLabel[order.reference] : '-'}
|
||||||
</td>
|
</td>
|
||||||
<td className="text-center">
|
<td className="text-center">{proportion}%</td>
|
||||||
{proportion === order.proportion
|
|
||||||
? `${proportion}%`
|
|
||||||
: `${proportion}% (normalised from: ${order.proportion}%)`}{' '}
|
|
||||||
</td>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -13,15 +13,6 @@ const decimalsMock: ExplorerSettlementAssetForMarketQuery = {
|
|||||||
id: '123',
|
id: '123',
|
||||||
__typename: 'Market',
|
__typename: 'Market',
|
||||||
decimalPlaces: 5,
|
decimalPlaces: 5,
|
||||||
tradableInstrument: {
|
|
||||||
instrument: {
|
|
||||||
product: {
|
|
||||||
settlementAsset: {
|
|
||||||
decimals: 5,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ export function LiquidityProvisionOffset({
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the work of formatting the number now we have the settlement decimal places.
|
* Does the work of formatting the number now we have the market decimal places.
|
||||||
* If no market data is assigned (i.e. during loading, or if the market doesn't exist)
|
* If no market data is assigned (i.e. during loading, or if the market doesn't exist)
|
||||||
* this function will return the unformatted number
|
* this function will return the unformatted number
|
||||||
*
|
*
|
||||||
@ -49,9 +49,7 @@ export function getFormattedOffset(
|
|||||||
offset: string,
|
offset: string,
|
||||||
data?: ExplorerSettlementAssetForMarketQuery
|
data?: ExplorerSettlementAssetForMarketQuery
|
||||||
) {
|
) {
|
||||||
const decimals =
|
const decimals = data?.market?.decimalPlaces;
|
||||||
data?.market?.tradableInstrument.instrument.product.settlementAsset
|
|
||||||
.decimals;
|
|
||||||
|
|
||||||
if (!decimals) {
|
if (!decimals) {
|
||||||
return offset;
|
return offset;
|
||||||
|
@ -203,7 +203,7 @@ describe('LiquidityProvisionDetails component', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const res = renderComponent(mock);
|
const res = renderComponent(mock);
|
||||||
expect(res.getByText('45% (normalised from: 25%)')).toBeInTheDocument();
|
expect(res.getByText('45%')).toBeInTheDocument();
|
||||||
expect(res.getByText('55% (normalised from: 30%)')).toBeInTheDocument();
|
expect(res.getByText('55%')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -27,7 +27,7 @@ export const TxDetailsLiquidityCancellation = ({
|
|||||||
pubKey,
|
pubKey,
|
||||||
blockData,
|
blockData,
|
||||||
}: TxDetailsLiquidityCancellationProps) => {
|
}: TxDetailsLiquidityCancellationProps) => {
|
||||||
if (!txData || !txData.command.liquidityProvisionAmendment) {
|
if (!txData || !txData.command.liquidityProvisionCancellation) {
|
||||||
return <>{t('Awaiting Block Explorer transaction details')}</>;
|
return <>{t('Awaiting Block Explorer transaction details')}</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user