fix: show decimals based on tick size in open orders table
This commit is contained in:
parent
5f869716ce
commit
b880220103
|
@ -9,7 +9,7 @@ import { notify } from '../utils/notifications'
|
||||||
import SideBadge from './SideBadge'
|
import SideBadge from './SideBadge'
|
||||||
import { Order, Market } from '@project-serum/serum/lib/market'
|
import { Order, Market } from '@project-serum/serum/lib/market'
|
||||||
import { PerpOrder, PerpMarket } from '@blockworks-foundation/mango-client'
|
import { PerpOrder, PerpMarket } from '@blockworks-foundation/mango-client'
|
||||||
import { formatUsdValue } from '../utils'
|
import { formatUsdValue, getDecimalCount, usdFormatter } from '../utils'
|
||||||
import { Table, Td, Th, TrBody, TrHead } from './TableElements'
|
import { Table, Td, Th, TrBody, TrHead } from './TableElements'
|
||||||
import { useViewport } from '../hooks/useViewport'
|
import { useViewport } from '../hooks/useViewport'
|
||||||
import { breakpoints } from './TradePageGrid'
|
import { breakpoints } from './TradePageGrid'
|
||||||
|
@ -36,6 +36,7 @@ const DesktopTable = ({ openOrders, cancelledOrderId, handleCancelOrder }) => {
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{openOrders.map(({ order, market }, index) => {
|
{openOrders.map(({ order, market }, index) => {
|
||||||
|
const decimals = getDecimalCount(market.account.tickSize)
|
||||||
return (
|
return (
|
||||||
<TrBody index={index} key={`${order.orderId}${order.side}`}>
|
<TrBody index={index} key={`${order.orderId}${order.side}`}>
|
||||||
<Td>
|
<Td>
|
||||||
|
@ -54,7 +55,7 @@ const DesktopTable = ({ openOrders, cancelledOrderId, handleCancelOrder }) => {
|
||||||
<SideBadge side={order.side} />
|
<SideBadge side={order.side} />
|
||||||
</Td>
|
</Td>
|
||||||
<Td>{order.size}</Td>
|
<Td>{order.size}</Td>
|
||||||
<Td>{formatUsdValue(order.price)}</Td>
|
<Td>{usdFormatter(order.price, decimals)}</Td>
|
||||||
<Td>{formatUsdValue(order.price * order.size)}</Td>
|
<Td>{formatUsdValue(order.price * order.size)}</Td>
|
||||||
<Td>
|
<Td>
|
||||||
{order.perpTrigger &&
|
{order.perpTrigger &&
|
||||||
|
|
Loading…
Reference in New Issue