diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-05-24 05:16:32 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-05-24 05:16:32 +0800 |
commit | 3fe94891d3569a4615f4aa32d47f0065b5957fe9 (patch) | |
tree | 83d4e4ccf7748d2100aa935c457de0a893eaec9c /packages/website/ts/components/wallet | |
parent | d0abc60176dba3116cb3986d298ab5164c1fe49c (diff) | |
parent | f6b81f588d98e09e7a5806902d94e2892d029481 (diff) | |
download | dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.gz dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.bz2 dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.lz dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.xz dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.tar.zst dexon-sol-tools-3fe94891d3569a4615f4aa32d47f0065b5957fe9.zip |
Merge branch 'v2-prototype' into feature/website/wallet-flex-box
* v2-prototype: (95 commits)
Add missing dep to website
Upgrade solidity parser
Fix trace test
Fix linter issues
Move contract utils
Fix prettier
Fix NameResolver
Fix prettier
Remove 0x.js as a dependency from website
Enable 0x.js tests
Fix small bug in order-utils
Address feedback
Fix Tslint error caused by "PromiseLike" value
Fix Tslint error caused by "PromiseLike" value
Update dogfood url
fix contract-wrappers version
Parse compiler.json in SolCompilerArtifactsAdapter
Fix TokenTransferProxy artifact name since it's now suffixed with _v1
Update yarn.lock
Fix signature verification test
...
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 113f3c864..d0354580d 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'; @@ -450,7 +450,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>; @@ -459,7 +459,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 aab1d4439..34b5b8824 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'; @@ -90,7 +90,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'; @@ -192,11 +195,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(); |