aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-25 07:04:09 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-25 07:04:09 +0800
commit73f5ea2906502e89fa9bca275e229a1485d2f974 (patch)
tree94100c43f7ace72723235daaffc7f7281f30738e /packages/instant/src/containers
parentdb3ad83ebca88e0faf2529ec468044e6ce4d5746 (diff)
downloaddexon-0x-contracts-73f5ea2906502e89fa9bca275e229a1485d2f974.tar.gz
dexon-0x-contracts-73f5ea2906502e89fa9bca275e229a1485d2f974.tar.zst
dexon-0x-contracts-73f5ea2906502e89fa9bca275e229a1485d2f974.zip
Associate txnhash with processing state
Diffstat (limited to 'packages/instant/src/containers')
-rw-r--r--packages/instant/src/containers/selected_asset_buy_button.ts14
1 files changed, 11 insertions, 3 deletions
diff --git a/packages/instant/src/containers/selected_asset_buy_button.ts b/packages/instant/src/containers/selected_asset_buy_button.ts
index 1d8b3b4bd..f55254daf 100644
--- a/packages/instant/src/containers/selected_asset_buy_button.ts
+++ b/packages/instant/src/containers/selected_asset_buy_button.ts
@@ -6,7 +6,7 @@ import { Dispatch } from 'redux';
import { Action, actions } from '../redux/actions';
import { State } from '../redux/reducer';
-import { AsyncProcessState, OrderProcessState } from '../types';
+import { OrderProcessState, OrderState } from '../types';
import { BuyButton } from '../components/buy_button';
@@ -18,7 +18,8 @@ interface ConnectedState {
}
interface ConnectedDispatch {
- onClick: (buyQuote: BuyQuote) => void;
+ onAwaitingSignature: (buyQuote: BuyQuote) => void;
+ onProcessingTransaction: (buyQuote: BuyQuote, txnHash: string) => void;
onBuySuccess: (buyQuote: BuyQuote, txnHash: string) => void;
onBuyFailure: (buyQuote: BuyQuote) => void;
onBuyPrevented: (buyQuote: BuyQuote, error: Error) => void;
@@ -30,7 +31,14 @@ const mapStateToProps = (state: State, _ownProps: SelectedAssetBuyButtonProps):
});
const mapDispatchToProps = (dispatch: Dispatch<Action>, ownProps: SelectedAssetBuyButtonProps): ConnectedDispatch => ({
- onClick: buyQuote => dispatch(actions.updateBuyOrderState({ processState: OrderProcessState.AWAITING_SIGNATURE })),
+ onAwaitingSignature: (buyQuote: BuyQuote) => {
+ const newOrderState: OrderState = { processState: OrderProcessState.AWAITING_SIGNATURE };
+ dispatch(actions.updateBuyOrderState(newOrderState));
+ },
+ onProcessingTransaction: (buyQuote: BuyQuote, txnHash: string) => {
+ const newOrderState: OrderState = { processState: OrderProcessState.PROCESSING, txnHash };
+ dispatch(actions.updateBuyOrderState(newOrderState));
+ },
onBuySuccess: (buyQuote: BuyQuote, txnHash: string) =>
dispatch(actions.updateBuyOrderState({ processState: OrderProcessState.SUCCESS, txnHash })),
onBuyFailure: buyQuote => dispatch(actions.updateBuyOrderState({ processState: OrderProcessState.FAILURE })),