aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-11-14 09:31:54 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-11-14 09:31:54 +0800
commit84215f75e046597eb34f9d5409bd45410a0819e6 (patch)
treee6c57cdd7bc5064bdd6752d99c35779f3c1200c7 /packages/instant/src/util
parent35bfd493e87b5d6c76f5bb2176b0992891a4a555 (diff)
parent4fc457b78b30e761164eac26fe5f1ebcddd11f7d (diff)
downloaddexon-sol-tools-84215f75e046597eb34f9d5409bd45410a0819e6.tar
dexon-sol-tools-84215f75e046597eb34f9d5409bd45410a0819e6.tar.gz
dexon-sol-tools-84215f75e046597eb34f9d5409bd45410a0819e6.tar.bz2
dexon-sol-tools-84215f75e046597eb34f9d5409bd45410a0819e6.tar.lz
dexon-sol-tools-84215f75e046597eb34f9d5409bd45410a0819e6.tar.xz
dexon-sol-tools-84215f75e046597eb34f9d5409bd45410a0819e6.tar.zst
dexon-sol-tools-84215f75e046597eb34f9d5409bd45410a0819e6.zip
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/different-install-wallet-copy-for-mobile
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: (