Remove 0x.js as a dependency from website

This commit is contained in:
Leonid Logvinov
2018-05-22 16:18:52 -07:00
parent f3fe9661f6
commit 5913d654bd
24 changed files with 137 additions and 122 deletions

View File

@@ -1,6 +1,6 @@
import { ZeroEx } from '0x.js';
import { colors, EtherscanLinkSuffixes } from '@0xproject/react-shared';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import Paper from 'material-ui/Paper';
import * as moment from 'moment';
@@ -90,10 +90,16 @@ export class TradeHistoryItem extends React.Component<TradeHistoryItemProps, Tra
}
private _renderAmounts(makerToken: Token, takerToken: Token): React.ReactNode {
const fill = this.props.fill;
const filledTakerTokenAmountInUnits = ZeroEx.toUnitAmount(fill.filledTakerTokenAmount, takerToken.decimals);
const filledMakerTokenAmountInUnits = ZeroEx.toUnitAmount(fill.filledMakerTokenAmount, takerToken.decimals);
const filledTakerTokenAmountInUnits = Web3Wrapper.toUnitAmount(
fill.filledTakerTokenAmount,
takerToken.decimals,
);
const filledMakerTokenAmountInUnits = Web3Wrapper.toUnitAmount(
fill.filledMakerTokenAmount,
takerToken.decimals,
);
let exchangeRate = filledTakerTokenAmountInUnits.div(filledMakerTokenAmountInUnits);
const fillMakerTokenAmount = ZeroEx.toBaseUnitAmount(filledMakerTokenAmountInUnits, makerToken.decimals);
const fillMakerTokenAmount = Web3Wrapper.toBaseUnitAmount(filledMakerTokenAmountInUnits, makerToken.decimals);
let receiveAmount;
let receiveToken;
@@ -160,7 +166,7 @@ export class TradeHistoryItem extends React.Component<TradeHistoryItemProps, Tra
);
}
private _renderAmount(amount: BigNumber, symbol: string, decimals: number): React.ReactNode {
const unitAmount = ZeroEx.toUnitAmount(amount, decimals);
const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals);
return (
<span>
{unitAmount.toFixed(configs.AMOUNT_DISPLAY_PRECSION)} {symbol}