diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-19 08:42:32 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-19 08:42:32 +0800 |
commit | 7bc2df56023641c27de62bc7e9a8953767cbc076 (patch) | |
tree | a1d2fad7ebe06d126474d25cf21647849456b42f /packages/instant/src/redux/reducer.ts | |
parent | 7a8adf9db5a83c3f44d6fe9e84e00ff1ec1e88e0 (diff) | |
download | dexon-sol-tools-7bc2df56023641c27de62bc7e9a8953767cbc076.tar dexon-sol-tools-7bc2df56023641c27de62bc7e9a8953767cbc076.tar.gz dexon-sol-tools-7bc2df56023641c27de62bc7e9a8953767cbc076.tar.bz2 dexon-sol-tools-7bc2df56023641c27de62bc7e9a8953767cbc076.tar.lz dexon-sol-tools-7bc2df56023641c27de62bc7e9a8953767cbc076.tar.xz dexon-sol-tools-7bc2df56023641c27de62bc7e9a8953767cbc076.tar.zst dexon-sol-tools-7bc2df56023641c27de62bc7e9a8953767cbc076.zip |
feat: add network to state and use it where relevant
Diffstat (limited to 'packages/instant/src/redux/reducer.ts')
-rw-r--r-- | packages/instant/src/redux/reducer.ts | 13 |
1 files changed, 10 insertions, 3 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, |