aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers
diff options
context:
space:
mode:
authorSteve Klebanoff <steve@0xproject.com>2018-10-30 01:12:44 +0800
committerGitHub <noreply@github.com>2018-10-30 01:12:44 +0800
commit4e4291eccdd6c837bbec70603aa6eb64d3aa8d85 (patch)
treeedf8006576143d5cd1c32b052164ac898c57c8b2 /packages/instant/src/containers
parentae6202ed3d777605a3fd02cd29141a3ba40f4b34 (diff)
parent7ed44f7b2f0224b4169f0a8f34bae09e8c6b986f (diff)
downloaddexon-sol-tools-4e4291eccdd6c837bbec70603aa6eb64d3aa8d85.tar
dexon-sol-tools-4e4291eccdd6c837bbec70603aa6eb64d3aa8d85.tar.gz
dexon-sol-tools-4e4291eccdd6c837bbec70603aa6eb64d3aa8d85.tar.bz2
dexon-sol-tools-4e4291eccdd6c837bbec70603aa6eb64d3aa8d85.tar.lz
dexon-sol-tools-4e4291eccdd6c837bbec70603aa6eb64d3aa8d85.tar.xz
dexon-sol-tools-4e4291eccdd6c837bbec70603aa6eb64d3aa8d85.tar.zst
dexon-sol-tools-4e4291eccdd6c837bbec70603aa6eb64d3aa8d85.zip
Merge pull request #1193 from 0xProject/feature/not-enough-eth
[instant] Not enough ETH error message
Diffstat (limited to 'packages/instant/src/containers')
-rw-r--r--packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts18
-rw-r--r--packages/instant/src/containers/selected_erc20_asset_amount_input.ts3
2 files changed, 13 insertions, 8 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..241c0192c 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
@@ -1,4 +1,4 @@
-import { AssetBuyer, BuyQuote } from '@0x/asset-buyer';
+import { AssetBuyer, AssetBuyerError, BuyQuote } from '@0x/asset-buyer';
import * as _ from 'lodash';
import * as React from 'react';
import { connect } from 'react-redux';
@@ -6,10 +6,11 @@ import { Dispatch } from 'redux';
import { Action, actions } from '../redux/actions';
import { State } from '../redux/reducer';
-import { OrderProcessState, OrderState } from '../types';
+import { OrderProcessState, OrderState, ZeroExInstantError } from '../types';
import { etherscanUtil } from '../util/etherscan';
import { BuyOrderStateButtons } from '../components/buy_order_state_buttons';
+import { errorUtil } from '../util/error';
interface ConnectedState {
buyQuote?: BuyQuote;
@@ -19,12 +20,13 @@ interface ConnectedState {
}
interface ConnectedDispatch {
- onAwaitingSignature: (buyQuote: BuyQuote) => void;
+ onValidationPending: (buyQuote: BuyQuote) => void;
onSignatureDenied: (buyQuote: BuyQuote, error: Error) => void;
onBuyProcessing: (buyQuote: BuyQuote, txHash: string) => void;
onBuySuccess: (buyQuote: BuyQuote, txHash: string) => void;
onBuyFailure: (buyQuote: BuyQuote, txHash: string) => void;
onRetry: () => void;
+ onValidationFail: (buyQuote: BuyQuote, errorMessage: AssetBuyerError | ZeroExInstantError) => void;
}
export interface SelectedAssetBuyOrderStateButtons {}
const mapStateToProps = (state: State, _ownProps: SelectedAssetBuyOrderStateButtons): ConnectedState => ({
@@ -54,8 +56,8 @@ const mapDispatchToProps = (
dispatch: Dispatch<Action>,
ownProps: SelectedAssetBuyOrderStateButtons,
): ConnectedDispatch => ({
- onAwaitingSignature: (buyQuote: BuyQuote) => {
- const newOrderState: OrderState = { processState: OrderProcessState.AWAITING_SIGNATURE };
+ onValidationPending: (buyQuote: BuyQuote) => {
+ const newOrderState: OrderState = { processState: OrderProcessState.VALIDATING };
dispatch(actions.updateBuyOrderState(newOrderState));
},
onBuyProcessing: (buyQuote: BuyQuote, txHash: string) => {
@@ -68,7 +70,11 @@ const mapDispatchToProps = (
dispatch(actions.updateBuyOrderState({ processState: OrderProcessState.FAILURE, txHash })),
onSignatureDenied: (buyQuote, error) => {
dispatch(actions.resetAmount());
- dispatch(actions.setError(error));
+ errorUtil.errorFlasher.flashNewError(dispatch, error);
+ },
+ onValidationFail: (buyQuote, error) => {
+ dispatch(actions.updateBuyOrderState({ processState: OrderProcessState.NONE }));
+ errorUtil.errorFlasher.flashNewError(dispatch, new Error(error));
},
onRetry: () => {
dispatch(actions.resetAmount());
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 3d741ae97..41ed974a2 100644
--- a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
+++ b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
@@ -7,6 +7,7 @@ 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';
@@ -14,8 +15,6 @@ import { ERC20Asset, OrderProcessState } from '../types';
import { BigNumberInput } from '../util/big_number_input';
import { errorUtil } from '../util/error';
-import { ERC20AssetAmountInput } from '../components/erc20_asset_amount_input';
-
export interface SelectedERC20AssetAmountInputProps {
fontColor?: ColorOption;
startingFontSizePx: number;