aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/redux/reducer.ts
diff options
context:
space:
mode:
authorFrancesco Agosti <francesco.agosti93@gmail.com>2018-10-17 09:18:41 +0800
committerGitHub <noreply@github.com>2018-10-17 09:18:41 +0800
commit336e456984e24807e3d0d5017de4ea8d1e9beb19 (patch)
treeb81fcdfb7f1026b3007a9c5a81f39974d74ae483 /packages/instant/src/redux/reducer.ts
parent35b001b0818eda5a55e0c5f9fad9ec7122c28745 (diff)
parent32beeae2f0fa4538f12036aca8dd8d30b1de8bc9 (diff)
downloaddexon-sol-tools-336e456984e24807e3d0d5017de4ea8d1e9beb19.tar.gz
dexon-sol-tools-336e456984e24807e3d0d5017de4ea8d1e9beb19.tar.zst
dexon-sol-tools-336e456984e24807e3d0d5017de4ea8d1e9beb19.zip
Merge pull request #1131 from 0xProject/feature/instant/move-features-over-from-zrx-buyer
[instant][types][order-utils][asset-buyer] Move over and clean up features from zrx-buyer
Diffstat (limited to 'packages/instant/src/redux/reducer.ts')
-rw-r--r--packages/instant/src/redux/reducer.ts27
1 files changed, 24 insertions, 3 deletions
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts
index 5026895ae..adecf2ab7 100644
--- a/packages/instant/src/redux/reducer.ts
+++ b/packages/instant/src/redux/reducer.ts
@@ -1,16 +1,27 @@
+import { BuyQuote } from '@0xproject/asset-buyer';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
-import { Action, ActionTypes } from '../types';
+import { zrxAssetData } from '../constants';
+import { AsyncProcessState } from '../types';
+
+import { Action, ActionTypes } from './actions';
export interface State {
- ethUsdPrice?: string;
+ selectedAssetData?: string;
selectedAssetAmount?: BigNumber;
+ selectedAssetBuyState: AsyncProcessState;
+ ethUsdPrice?: BigNumber;
+ latestBuyQuote?: BuyQuote;
}
export const INITIAL_STATE: State = {
- ethUsdPrice: undefined,
+ // TODO: Remove hardcoded zrxAssetData
+ selectedAssetData: zrxAssetData,
selectedAssetAmount: undefined,
+ selectedAssetBuyState: AsyncProcessState.NONE,
+ ethUsdPrice: undefined,
+ latestBuyQuote: undefined,
};
export const reducer = (state: State = INITIAL_STATE, action: Action): State => {
@@ -25,6 +36,16 @@ export const reducer = (state: State = INITIAL_STATE, action: Action): State =>
...state,
selectedAssetAmount: action.data,
};
+ case ActionTypes.UPDATE_LATEST_BUY_QUOTE:
+ return {
+ ...state,
+ latestBuyQuote: action.data,
+ };
+ case ActionTypes.UPDATE_SELECTED_ASSET_BUY_STATE:
+ return {
+ ...state,
+ selectedAssetBuyState: action.data,
+ };
default:
return state;
}