aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/redux
diff options
context:
space:
mode:
Diffstat (limited to 'packages/instant/src/redux')
-rw-r--r--packages/instant/src/redux/reducer.ts13
-rw-r--r--packages/instant/src/redux/store.ts10
2 files changed, 13 insertions, 10 deletions
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts
index 83422be45..e9e0a85e0 100644
--- a/packages/instant/src/redux/reducer.ts
+++ b/packages/instant/src/redux/reducer.ts
@@ -3,7 +3,8 @@ import { ObjectMap } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
-import { Asset, AssetMetaData, AsyncProcessState } from '../types';
+import { assetMetaDataMap } from '../data/asset_meta_data_map';
+import { Asset, AssetMetaData, AsyncProcessState, Network } from '../types';
import { assetUtils } from '../util/asset';
import { Action, ActionTypes } from './actions';
@@ -13,6 +14,7 @@ export enum LatestErrorDisplay {
Hidden,
}
export interface State {
+ network: Network;
assetBuyer?: AssetBuyer;
assetMetaDataMap: ObjectMap<AssetMetaData>;
selectedAsset?: Asset;
@@ -26,8 +28,9 @@ export interface State {
}
export const INITIAL_STATE: State = {
+ network: Network.Mainnet,
selectedAssetAmount: undefined,
- assetMetaDataMap: {},
+ assetMetaDataMap,
buyOrderState: AsyncProcessState.NONE,
ethUsdPrice: undefined,
latestBuyQuote: undefined,
@@ -92,7 +95,11 @@ export const reducer = (state: State = INITIAL_STATE, action: Action): State =>
const newSelectedAssetData = action.data;
let newSelectedAsset: Asset | undefined;
if (!_.isUndefined(newSelectedAssetData)) {
- newSelectedAsset = assetUtils.createAssetFromAssetData(newSelectedAssetData, state.assetMetaDataMap);
+ newSelectedAsset = assetUtils.createAssetFromAssetData(
+ newSelectedAssetData,
+ state.assetMetaDataMap,
+ state.network,
+ );
}
return {
...state,
diff --git a/packages/instant/src/redux/store.ts b/packages/instant/src/redux/store.ts
index 88d964bbc..01deb8690 100644
--- a/packages/instant/src/redux/store.ts
+++ b/packages/instant/src/redux/store.ts
@@ -2,16 +2,12 @@ import * as _ from 'lodash';
import { createStore, Store as ReduxStore } from 'redux';
import { devToolsEnhancer } from 'redux-devtools-extension/developmentOnly';
-import { INITIAL_STATE, reducer, State } from './reducer';
+import { reducer, State } from './reducer';
export type Store = ReduxStore<State>;
export const store = {
- create: (withState: Partial<State>): Store => {
- const allInitialState = {
- ...INITIAL_STATE,
- ...withState,
- };
- return createStore(reducer, allInitialState, devToolsEnhancer({}));
+ create: (state: State): Store => {
+ return createStore(reducer, state, devToolsEnhancer({}));
},
};