import { Web3Wrapper } from '@0x/web3-wrapper'; import * as _ from 'lodash'; import * as React from 'react'; import { Party } from 'ts/components/ui/party'; import { AssetToken, Token, TokenByAddress } from 'ts/types'; import { configs } from 'ts/utils/configs'; import { utils } from 'ts/utils/utils'; interface VisualOrderProps { makerAssetToken: AssetToken; takerAssetToken: AssetToken; makerToken: Token; takerToken: Token; networkId: number; tokenByAddress: TokenByAddress; isMakerTokenAddressInRegistry: boolean; isTakerTokenAddressInRegistry: boolean; } interface VisualOrderState {} export class VisualOrder extends React.Component { public render(): React.ReactNode { const allTokens = _.values(this.props.tokenByAddress); const makerImage = this.props.makerToken.iconUrl; const takerImage = this.props.takerToken.iconUrl; return (
{this._renderAmount(this.props.takerAssetToken, this.props.takerToken)}
{this._renderAmount(this.props.makerAssetToken, this.props.makerToken)}
); } private _renderAmount(assetToken: AssetToken, token: Token): React.ReactNode { const unitAmount = Web3Wrapper.toUnitAmount(assetToken.amount, token.decimals); return (
{unitAmount.toNumber().toFixed(configs.AMOUNT_DISPLAY_PRECSION)} {token.symbol}
); } }