diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-23 07:18:52 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-24 00:41:35 +0800 |
commit | 5913d654bdf77d25b95570b1e656f63cc89ff97a (patch) | |
tree | 8cf3fd324cb7cd13e58f67eb3c0491bf5fa6ef18 /packages/website/ts/components/inputs | |
parent | f3fe9661f65f5ac58d45e965b7be02e9738df1c4 (diff) | |
download | dexon-0x-contracts-5913d654bdf77d25b95570b1e656f63cc89ff97a.tar.gz dexon-0x-contracts-5913d654bdf77d25b95570b1e656f63cc89ff97a.tar.zst dexon-0x-contracts-5913d654bdf77d25b95570b1e656f63cc89ff97a.zip |
Remove 0x.js as a dependency from website
Diffstat (limited to 'packages/website/ts/components/inputs')
3 files changed, 10 insertions, 9 deletions
diff --git a/packages/website/ts/components/inputs/eth_amount_input.tsx b/packages/website/ts/components/inputs/eth_amount_input.tsx index fa684d85c..1f0f27410 100644 --- a/packages/website/ts/components/inputs/eth_amount_input.tsx +++ b/packages/website/ts/components/inputs/eth_amount_input.tsx @@ -1,5 +1,5 @@ -import { ZeroEx } from '0x.js'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import * as React from 'react'; import { BalanceBoundedInput } from 'ts/components/inputs/balance_bounded_input'; @@ -34,7 +34,7 @@ export class EthAmountInput extends React.Component<EthAmountInputProps, EthAmou }; public render(): React.ReactNode { const amount = this.props.amount - ? ZeroEx.toUnitAmount(this.props.amount, constants.DECIMAL_PLACES_ETH) + ? Web3Wrapper.toUnitAmount(this.props.amount, constants.DECIMAL_PLACES_ETH) : undefined; return ( <div className="flex overflow-hidden" style={this.props.style}> @@ -61,7 +61,7 @@ export class EthAmountInput extends React.Component<EthAmountInputProps, EthAmou private _onChange(isValid: boolean, amount?: BigNumber): void { const baseUnitAmountIfExists = _.isUndefined(amount) ? undefined - : ZeroEx.toBaseUnitAmount(amount, constants.DECIMAL_PLACES_ETH); + : Web3Wrapper.toBaseUnitAmount(amount, constants.DECIMAL_PLACES_ETH); this.props.onChange(isValid, baseUnitAmountIfExists); } private _getLabelStyle(): React.CSSProperties { diff --git a/packages/website/ts/components/inputs/hash_input.tsx b/packages/website/ts/components/inputs/hash_input.tsx index 37d4af138..8d9cdfc0b 100644 --- a/packages/website/ts/components/inputs/hash_input.tsx +++ b/packages/website/ts/components/inputs/hash_input.tsx @@ -1,5 +1,6 @@ -import { Order, ZeroEx } from '0x.js'; +import { getOrderHashHex } from '@0xproject/order-utils'; import { Styles } from '@0xproject/react-shared'; +import { Order } from '@0xproject/types'; import * as _ from 'lodash'; import * as React from 'react'; import ReactTooltip = require('react-tooltip'); @@ -57,7 +58,7 @@ export class HashInput extends React.Component<HashInputProps, HashInputState> { takerTokenAddress: hashData.receiveTokenContractAddr, takerTokenAmount: hashData.receiveAmount, }; - const orderHash = ZeroEx.getOrderHashHex(order); + const orderHash = getOrderHashHex(order); return orderHash; } } diff --git a/packages/website/ts/components/inputs/token_amount_input.tsx b/packages/website/ts/components/inputs/token_amount_input.tsx index f040928f1..a67120320 100644 --- a/packages/website/ts/components/inputs/token_amount_input.tsx +++ b/packages/website/ts/components/inputs/token_amount_input.tsx @@ -1,6 +1,6 @@ -import { ZeroEx } from '0x.js'; import { colors } from '@0xproject/react-shared'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import * as React from 'react'; import { Link } from 'react-router-dom'; @@ -75,14 +75,14 @@ export class TokenAmountInput extends React.Component<TokenAmountInputProps, Tok } public render(): React.ReactNode { const amount = this.props.amount - ? ZeroEx.toUnitAmount(this.props.amount, this.props.token.decimals) + ? Web3Wrapper.toUnitAmount(this.props.amount, this.props.token.decimals) : undefined; return ( <div className="flex overflow-hidden" style={this._getStyle()}> <BalanceBoundedInput label={this.props.label} amount={amount} - balance={ZeroEx.toUnitAmount(this.state.balance, this.props.token.decimals)} + balance={Web3Wrapper.toUnitAmount(this.state.balance, this.props.token.decimals)} onChange={this._onChange.bind(this)} onErrorMsgChange={this.props.onErrorMsgChange} validate={this._validate.bind(this)} @@ -103,7 +103,7 @@ export class TokenAmountInput extends React.Component<TokenAmountInputProps, Tok private _onChange(isValid: boolean, amount?: BigNumber): void { let baseUnitAmount; if (!_.isUndefined(amount)) { - baseUnitAmount = ZeroEx.toBaseUnitAmount(amount, this.props.token.decimals); + baseUnitAmount = Web3Wrapper.toBaseUnitAmount(amount, this.props.token.decimals); } this.props.onChange(isValid, baseUnitAmount); } |