From 476cbbb6cb32db5ca72cc9d200b3ead152ae0e33 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Fri, 26 Oct 2018 15:03:56 -0700 Subject: move imports --- .../instant/src/containers/selected_erc20_asset_amount_input.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'packages/instant/src/containers/selected_erc20_asset_amount_input.ts') diff --git a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts index 67c3ce6a5..3d0895aac 100644 --- a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts +++ b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts @@ -7,18 +7,16 @@ import * as React from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; +import { ERC20AssetAmountInput } from '../components/erc20_asset_amount_input'; import { Action, actions } from '../redux/actions'; import { State } from '../redux/reducer'; import { ColorOption } from '../style/theme'; +import { ERC20Asset, OrderProcessState, ZeroExInstantError } from '../types'; import { getBestAddress } from '../util/address'; import { BigNumberInput } from '../util/big_number_input'; import { errorUtil } from '../util/error'; import { web3Wrapper } from '../util/web3_wrapper'; -import { ERC20AssetAmountInput } from '../components/erc20_asset_amount_input'; - -import { ERC20Asset, OrderProcessState, ZeroExInstantError } from '../types'; - export interface SelectedERC20AssetAmountInputProps { fontColor?: ColorOption; startingFontSizePx: number; -- cgit v1.2.3 From e1ae551560ad12501256fd5702dcd929baa84100 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Fri, 26 Oct 2018 15:20:04 -0700 Subject: move funct into util --- .../instant/src/containers/selected_erc20_asset_amount_input.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'packages/instant/src/containers/selected_erc20_asset_amount_input.ts') diff --git a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts index 3d0895aac..1fc5b6d8c 100644 --- a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts +++ b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts @@ -13,6 +13,7 @@ import { State } from '../redux/reducer'; import { ColorOption } from '../style/theme'; import { ERC20Asset, OrderProcessState, ZeroExInstantError } from '../types'; import { getBestAddress } from '../util/address'; +import { balanceUtil } from '../util/balance'; import { BigNumberInput } from '../util/big_number_input'; import { errorUtil } from '../util/error'; import { web3Wrapper } from '../util/web3_wrapper'; @@ -81,11 +82,7 @@ const updateBuyQuoteAsync = async ( // set error if user doesn't have appropriate balance const takerAddress = await getBestAddress(); - const balanceWei = await web3Wrapper.getBalanceInWeiAsync(takerAddress); - if (balanceWei < newBuyQuote.worstCaseQuoteInfo.totalEthAmount) { - const balanceError = new Error(ZeroExInstantError.InsufficientBalance); - errorUtil.errorFlasher.flashNewError(dispatch, balanceError); - } + await balanceUtil.checkSufficientBalanceAndFlashError(takerAddress, newBuyQuote, web3Wrapper, dispatch); }; const debouncedUpdateBuyQuoteAsync = _.debounce(updateBuyQuoteAsync, 200, { trailing: true }); -- cgit v1.2.3 From 86febc3cce1135d2345f0048c205c3c524a66733 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Fri, 26 Oct 2018 15:34:35 -0700 Subject: acccount for no address --- packages/instant/src/containers/selected_erc20_asset_amount_input.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/instant/src/containers/selected_erc20_asset_amount_input.ts') diff --git a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts index 1fc5b6d8c..325dc0ef2 100644 --- a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts +++ b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts @@ -82,7 +82,7 @@ const updateBuyQuoteAsync = async ( // set error if user doesn't have appropriate balance const takerAddress = await getBestAddress(); - await balanceUtil.checkSufficientBalanceAndFlashError(takerAddress, newBuyQuote, web3Wrapper, dispatch); + await balanceUtil.checkInsufficientEthBalanceAndFlashError(takerAddress, newBuyQuote, web3Wrapper, dispatch); }; const debouncedUpdateBuyQuoteAsync = _.debounce(updateBuyQuoteAsync, 200, { trailing: true }); -- cgit v1.2.3 From ff295daa5c56b5c056a5faa5ca8875c317524070 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Fri, 26 Oct 2018 19:53:15 -0700 Subject: Simpler way of validaitng has enough eth --- packages/instant/src/containers/selected_erc20_asset_amount_input.ts | 4 ---- 1 file changed, 4 deletions(-) (limited to 'packages/instant/src/containers/selected_erc20_asset_amount_input.ts') diff --git a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts index 325dc0ef2..a090ad8fb 100644 --- a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts +++ b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts @@ -79,10 +79,6 @@ const updateBuyQuoteAsync = async ( errorUtil.errorFlasher.clearError(dispatch); // invalidate the last buy quote. dispatch(actions.updateLatestBuyQuote(newBuyQuote)); - - // set error if user doesn't have appropriate balance - const takerAddress = await getBestAddress(); - await balanceUtil.checkInsufficientEthBalanceAndFlashError(takerAddress, newBuyQuote, web3Wrapper, dispatch); }; const debouncedUpdateBuyQuoteAsync = _.debounce(updateBuyQuoteAsync, 200, { trailing: true }); -- cgit v1.2.3 From 3052c8d303bdbaf57e762345d5ee8428d2194d0a Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Fri, 26 Oct 2018 19:55:42 -0700 Subject: linting --- packages/instant/src/containers/selected_erc20_asset_amount_input.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'packages/instant/src/containers/selected_erc20_asset_amount_input.ts') diff --git a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts index a090ad8fb..6536e2787 100644 --- a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts +++ b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts @@ -11,12 +11,9 @@ import { ERC20AssetAmountInput } from '../components/erc20_asset_amount_input'; import { Action, actions } from '../redux/actions'; import { State } from '../redux/reducer'; import { ColorOption } from '../style/theme'; -import { ERC20Asset, OrderProcessState, ZeroExInstantError } from '../types'; -import { getBestAddress } from '../util/address'; -import { balanceUtil } from '../util/balance'; +import { ERC20Asset, OrderProcessState } from '../types'; import { BigNumberInput } from '../util/big_number_input'; import { errorUtil } from '../util/error'; -import { web3Wrapper } from '../util/web3_wrapper'; export interface SelectedERC20AssetAmountInputProps { fontColor?: ColorOption; -- cgit v1.2.3