aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-27 06:20:04 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-27 06:20:04 +0800
commite1ae551560ad12501256fd5702dcd929baa84100 (patch)
treed02f498fe7a14222b18cef3476cb7aa8a54cbc5e /packages/instant/src/containers
parent476cbbb6cb32db5ca72cc9d200b3ead152ae0e33 (diff)
downloaddexon-sol-tools-e1ae551560ad12501256fd5702dcd929baa84100.tar
dexon-sol-tools-e1ae551560ad12501256fd5702dcd929baa84100.tar.gz
dexon-sol-tools-e1ae551560ad12501256fd5702dcd929baa84100.tar.bz2
dexon-sol-tools-e1ae551560ad12501256fd5702dcd929baa84100.tar.lz
dexon-sol-tools-e1ae551560ad12501256fd5702dcd929baa84100.tar.xz
dexon-sol-tools-e1ae551560ad12501256fd5702dcd929baa84100.tar.zst
dexon-sol-tools-e1ae551560ad12501256fd5702dcd929baa84100.zip
move funct into util
Diffstat (limited to 'packages/instant/src/containers')
-rw-r--r--packages/instant/src/containers/selected_erc20_asset_amount_input.ts7
1 files changed, 2 insertions, 5 deletions
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 });