Fix/format price in order confirmation dialog (#102)
This commit is contained in:
parent
ecbcdf57e3
commit
9ced1ce0fd
@ -4,7 +4,11 @@ import {
|
||||
TransactionState,
|
||||
VegaTxStatus,
|
||||
} from '../../hooks/use-vega-transaction';
|
||||
import { OrderEvent_busEvents_event_Order } from '@vegaprotocol/graphql';
|
||||
import {
|
||||
OrderEvent_busEvents_event_Order,
|
||||
OrderStatus,
|
||||
} from '@vegaprotocol/graphql';
|
||||
import { formatNumber } from '@vegaprotocol/react-helpers';
|
||||
|
||||
interface OrderDialogProps {
|
||||
transaction: TransactionState;
|
||||
@ -66,8 +70,17 @@ export const OrderDialog = ({
|
||||
>
|
||||
<p>Status: {finalizedOrder.status}</p>
|
||||
<p>Market: {finalizedOrder.market.name}</p>
|
||||
<p>Type: {finalizedOrder.type}</p>
|
||||
<p>Amount: {finalizedOrder.size}</p>
|
||||
{finalizedOrder.type === 'Limit' && <p>Price: {finalizedOrder.price}</p>}
|
||||
{finalizedOrder.type === 'Limit' && (
|
||||
<p>
|
||||
Price:{' '}
|
||||
{formatNumber(
|
||||
finalizedOrder.price,
|
||||
finalizedOrder.market.decimalPlaces
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</OrderDialogWrapper>
|
||||
);
|
||||
};
|
||||
|
@ -29,6 +29,7 @@ const ORDER_EVENT_SUB = gql`
|
||||
price
|
||||
market {
|
||||
name
|
||||
decimalPlaces
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
libs/graphql/src/__generated__/OrderEvent.ts
generated
17
libs/graphql/src/__generated__/OrderEvent.ts
generated
@ -19,6 +19,23 @@ export interface OrderEvent_busEvents_event_Order_market {
|
||||
* Market full name
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||
* number denominated in the currency of the Market. (uint64)
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
* GBX (pence) 1 4 GBP 0.000001 ( 0.0001p)
|
||||
*/
|
||||
decimalPlaces: number;
|
||||
}
|
||||
|
||||
export interface OrderEvent_busEvents_event_Order {
|
||||
|
Loading…
Reference in New Issue
Block a user