aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-11-14 09:09:58 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-11-14 09:09:58 +0800
commitda9de70bbcecc16fa3a7f6991623f5027628f2b3 (patch)
tree5ec1cdef371604aa360eeae4ae7cde3190a8783d /packages/instant/src/util
parentf03afe6f1b6a6bfa339507ee47b42c62550444a0 (diff)
parente02dc13805349a770506350c69e9061f596b48b2 (diff)
downloaddexon-sol-tools-da9de70bbcecc16fa3a7f6991623f5027628f2b3.tar
dexon-sol-tools-da9de70bbcecc16fa3a7f6991623f5027628f2b3.tar.gz
dexon-sol-tools-da9de70bbcecc16fa3a7f6991623f5027628f2b3.tar.bz2
dexon-sol-tools-da9de70bbcecc16fa3a7f6991623f5027628f2b3.tar.lz
dexon-sol-tools-da9de70bbcecc16fa3a7f6991623f5027628f2b3.tar.xz
dexon-sol-tools-da9de70bbcecc16fa3a7f6991623f5027628f2b3.tar.zst
dexon-sol-tools-da9de70bbcecc16fa3a7f6991623f5027628f2b3.zip
Merge https://github.com/0xProject/0x-monorepo into feature/instant/metamask-connect-flow
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r--packages/instant/src/util/buy_quote_updater.ts4
-rw-r--r--packages/instant/src/util/format.ts16
2 files changed, 10 insertions, 10 deletions
diff --git a/packages/instant/src/util/buy_quote_updater.ts b/packages/instant/src/util/buy_quote_updater.ts
index c33e28f1c..fcdded0a9 100644
--- a/packages/instant/src/util/buy_quote_updater.ts
+++ b/packages/instant/src/util/buy_quote_updater.ts
@@ -15,12 +15,12 @@ export const buyQuoteUpdater = {
assetBuyer: AssetBuyer,
dispatch: Dispatch<Action>,
asset: ERC20Asset,
- assetAmount: BigNumber,
+ assetUnitAmount: BigNumber,
setPending = true,
affiliateInfo?: AffiliateInfo,
): Promise<void> => {
// get a new buy quote.
- const baseUnitValue = Web3Wrapper.toBaseUnitAmount(assetAmount, asset.metaData.decimals);
+ const baseUnitValue = Web3Wrapper.toBaseUnitAmount(assetUnitAmount, asset.metaData.decimals);
if (setPending) {
// mark quote as pending
dispatch(actions.setQuoteRequestStatePending());
diff --git a/packages/instant/src/util/format.ts b/packages/instant/src/util/format.ts
index 44661d697..e9c432b2f 100644
--- a/packages/instant/src/util/format.ts
+++ b/packages/instant/src/util/format.ts
@@ -5,15 +5,15 @@ import * as _ from 'lodash';
import { ETH_DECIMALS } from '../constants';
export const format = {
- ethBaseAmount: (
- ethBaseAmount?: BigNumber,
+ ethBaseUnitAmount: (
+ ethBaseUnitAmount?: BigNumber,
decimalPlaces: number = 4,
defaultText: React.ReactNode = '0 ETH',
): React.ReactNode => {
- if (_.isUndefined(ethBaseAmount)) {
+ if (_.isUndefined(ethBaseUnitAmount)) {
return defaultText;
}
- const ethUnitAmount = Web3Wrapper.toUnitAmount(ethBaseAmount, ETH_DECIMALS);
+ const ethUnitAmount = Web3Wrapper.toUnitAmount(ethBaseUnitAmount, ETH_DECIMALS);
return format.ethUnitAmount(ethUnitAmount, decimalPlaces);
},
ethUnitAmount: (
@@ -27,16 +27,16 @@ export const format = {
const roundedAmount = ethUnitAmount.round(decimalPlaces).toDigits(decimalPlaces);
return `${roundedAmount} ETH`;
},
- ethBaseAmountInUsd: (
- ethBaseAmount?: BigNumber,
+ ethBaseUnitAmountInUsd: (
+ ethBaseUnitAmount?: BigNumber,
ethUsdPrice?: BigNumber,
decimalPlaces: number = 2,
defaultText: React.ReactNode = '$0.00',
): React.ReactNode => {
- if (_.isUndefined(ethBaseAmount) || _.isUndefined(ethUsdPrice)) {
+ if (_.isUndefined(ethBaseUnitAmount) || _.isUndefined(ethUsdPrice)) {
return defaultText;
}
- const ethUnitAmount = Web3Wrapper.toUnitAmount(ethBaseAmount, ETH_DECIMALS);
+ const ethUnitAmount = Web3Wrapper.toUnitAmount(ethBaseUnitAmount, ETH_DECIMALS);
return format.ethUnitAmountInUsd(ethUnitAmount, ethUsdPrice, decimalPlaces);
},
ethUnitAmountInUsd: (