diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-11-14 02:14:20 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-11-14 02:29:21 +0800 |
commit | 5527de62ffda68c00ae5fb68781c2e081fcc372e (patch) | |
tree | 61d3fb172de49a194bb5e5f4fe78365696818692 /packages/instant/src/util | |
parent | e8afc66a5afd65ee1ae640b43dee927ee57dceea (diff) | |
download | dexon-sol-tools-5527de62ffda68c00ae5fb68781c2e081fcc372e.tar dexon-sol-tools-5527de62ffda68c00ae5fb68781c2e081fcc372e.tar.gz dexon-sol-tools-5527de62ffda68c00ae5fb68781c2e081fcc372e.tar.bz2 dexon-sol-tools-5527de62ffda68c00ae5fb68781c2e081fcc372e.tar.lz dexon-sol-tools-5527de62ffda68c00ae5fb68781c2e081fcc372e.tar.xz dexon-sol-tools-5527de62ffda68c00ae5fb68781c2e081fcc372e.tar.zst dexon-sol-tools-5527de62ffda68c00ae5fb68781c2e081fcc372e.zip |
chore(instant): update selectedAssetAmount in the redux state to be named selectedAssetUnitAmount
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r-- | packages/instant/src/util/buy_quote_updater.ts | 4 | ||||
-rw-r--r-- | packages/instant/src/util/format.ts | 16 |
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: ( |