aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-27 06:51:23 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-27 06:51:23 +0800
commit667b1e03ddba1a2fac16488239f6bc977fa4cb6d (patch)
treec26e672ea99e3b19ec53a2465abc5e7059730e70 /packages/instant/src/containers
parent6ad8ac6a4836bf926666f2d05e91d2d4b31c6b19 (diff)
downloaddexon-sol-tools-667b1e03ddba1a2fac16488239f6bc977fa4cb6d.tar
dexon-sol-tools-667b1e03ddba1a2fac16488239f6bc977fa4cb6d.tar.gz
dexon-sol-tools-667b1e03ddba1a2fac16488239f6bc977fa4cb6d.tar.bz2
dexon-sol-tools-667b1e03ddba1a2fac16488239f6bc977fa4cb6d.tar.lz
dexon-sol-tools-667b1e03ddba1a2fac16488239f6bc977fa4cb6d.tar.xz
dexon-sol-tools-667b1e03ddba1a2fac16488239f6bc977fa4cb6d.tar.zst
dexon-sol-tools-667b1e03ddba1a2fac16488239f6bc977fa4cb6d.zip
Validate enough ETH when user clicks buy
Diffstat (limited to 'packages/instant/src/containers')
-rw-r--r--packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts b/packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts
index 8927b8954..49b9cf209 100644
--- a/packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts
+++ b/packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts
@@ -7,7 +7,9 @@ import { Dispatch } from 'redux';
import { Action, actions } from '../redux/actions';
import { State } from '../redux/reducer';
import { OrderProcessState, OrderState } from '../types';
+import { balanceUtil } from '../util/balance';
import { etherscanUtil } from '../util/etherscan';
+import { web3Wrapper } from '../util/web3_wrapper';
import { BuyOrderStateButtons } from '../components/buy_order_state_buttons';
@@ -25,6 +27,7 @@ interface ConnectedDispatch {
onBuySuccess: (buyQuote: BuyQuote, txHash: string) => void;
onBuyFailure: (buyQuote: BuyQuote, txHash: string) => void;
onRetry: () => void;
+ validateWalletBeforeBuy: (buyQuote: BuyQuote, takerAddress: string | undefined) => Promise<boolean>;
}
export interface SelectedAssetBuyOrderStateButtons {}
const mapStateToProps = (state: State, _ownProps: SelectedAssetBuyOrderStateButtons): ConnectedState => ({
@@ -73,6 +76,9 @@ const mapDispatchToProps = (
onRetry: () => {
dispatch(actions.resetAmount());
},
+ validateWalletBeforeBuy: async (buyQuote: BuyQuote, takerAddress: string | undefined) => {
+ return balanceUtil.checkInsufficientEthBalanceAndFlashError(takerAddress, buyQuote, web3Wrapper, dispatch);
+ },
});
export const SelectedAssetBuyOrderStateButtons: React.ComponentClass<SelectedAssetBuyOrderStateButtons> = connect(