diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-24 01:19:10 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-24 01:19:10 +0800 |
commit | 0a725415a48ebc2f23578baa410f56f88bc77cee (patch) | |
tree | c4a618bb0700560d23b7839b60ba2203e46433f9 /packages/website/ts/components/wallet | |
parent | 48e66954470ffb1b547e377d3edbed5d2cf7fc6b (diff) | |
parent | af0d9439d4f4e05fce8018665e375cf2db07184c (diff) | |
download | dexon-sol-tools-0a725415a48ebc2f23578baa410f56f88bc77cee.tar dexon-sol-tools-0a725415a48ebc2f23578baa410f56f88bc77cee.tar.gz dexon-sol-tools-0a725415a48ebc2f23578baa410f56f88bc77cee.tar.bz2 dexon-sol-tools-0a725415a48ebc2f23578baa410f56f88bc77cee.tar.lz dexon-sol-tools-0a725415a48ebc2f23578baa410f56f88bc77cee.tar.xz dexon-sol-tools-0a725415a48ebc2f23578baa410f56f88bc77cee.tar.zst dexon-sol-tools-0a725415a48ebc2f23578baa410f56f88bc77cee.zip |
Merge branch 'v2-prototype' into feature/truffle-sol-cov
Diffstat (limited to 'packages/website/ts/components/wallet')
-rw-r--r-- | packages/website/ts/components/wallet/wallet.tsx | 6 | ||||
-rw-r--r-- | packages/website/ts/components/wallet/wrap_ether_item.tsx | 11 |
2 files changed, 10 insertions, 7 deletions
diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index dab8b7d2f..afcf3862f 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -1,4 +1,3 @@ -import { ZeroEx } from '0x.js'; import { constants as sharedConstants, EtherscanLinkSuffixes, @@ -6,6 +5,7 @@ import { utils as sharedUtils, } from '@0xproject/react-shared'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import FlatButton from 'material-ui/FlatButton'; import FloatingActionButton from 'material-ui/FloatingActionButton'; @@ -473,7 +473,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> { ); } private _renderAmount(amount: BigNumber, decimals: number, symbol: string): React.ReactNode { - const unitAmount = ZeroEx.toUnitAmount(amount, decimals); + const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals); const formattedAmount = unitAmount.toPrecision(TOKEN_AMOUNT_DISPLAY_PRECISION); const result = `${formattedAmount} ${symbol}`; return <div style={styles.amountLabel}>{result}</div>; @@ -482,7 +482,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> { if (_.isUndefined(price)) { return null; } - const unitAmount = ZeroEx.toUnitAmount(amount, decimals); + const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals); const value = unitAmount.mul(price); const formattedAmount = value.toFixed(USD_DECIMAL_PLACES); const result = `$${formattedAmount}`; diff --git a/packages/website/ts/components/wallet/wrap_ether_item.tsx b/packages/website/ts/components/wallet/wrap_ether_item.tsx index 98b28b3ad..0a0a8a1fe 100644 --- a/packages/website/ts/components/wallet/wrap_ether_item.tsx +++ b/packages/website/ts/components/wallet/wrap_ether_item.tsx @@ -1,6 +1,6 @@ -import { ZeroEx } from '0x.js'; import { Styles } from '@0xproject/react-shared'; import { BigNumber, logUtils } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import FlatButton from 'material-ui/FlatButton'; import { ListItem } from 'material-ui/List'; @@ -82,7 +82,10 @@ export class WrapEtherItem extends React.Component<WrapEtherItemProps, WrapEther }; } public render(): React.ReactNode { - const etherBalanceInEth = ZeroEx.toUnitAmount(this.props.userEtherBalanceInWei, constants.DECIMAL_PLACES_ETH); + const etherBalanceInEth = Web3Wrapper.toUnitAmount( + this.props.userEtherBalanceInWei, + constants.DECIMAL_PLACES_ETH, + ); const isWrappingEth = this.props.direction === Side.Deposit; const topLabelText = isWrappingEth ? 'Convert ETH into WETH 1:1' : 'Convert WETH into ETH 1:1'; return ( @@ -184,11 +187,11 @@ export class WrapEtherItem extends React.Component<WrapEtherItemProps, WrapEther const amountToConvert = this.state.currentInputAmount; if (this.props.direction === Side.Deposit) { await this.props.blockchain.convertEthToWrappedEthTokensAsync(etherToken.address, amountToConvert); - const ethAmount = ZeroEx.toUnitAmount(amountToConvert, constants.DECIMAL_PLACES_ETH); + const ethAmount = Web3Wrapper.toUnitAmount(amountToConvert, constants.DECIMAL_PLACES_ETH); this.props.dispatcher.showFlashMessage(`Successfully wrapped ${ethAmount.toString()} ETH to WETH`); } else { await this.props.blockchain.convertWrappedEthTokensToEthAsync(etherToken.address, amountToConvert); - const tokenAmount = ZeroEx.toUnitAmount(amountToConvert, etherToken.decimals); + const tokenAmount = Web3Wrapper.toUnitAmount(amountToConvert, etherToken.decimals); this.props.dispatcher.showFlashMessage(`Successfully unwrapped ${tokenAmount.toString()} WETH to ETH`); } await this.props.refetchEthTokenStateAsync(); |