aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/redux/reducer.ts
diff options
context:
space:
mode:
authorFrancesco Agosti <francesco.agosti93@gmail.com>2018-11-03 07:26:16 +0800
committerGitHub <noreply@github.com>2018-11-03 07:26:16 +0800
commit66261102de57e3bc86714577c021aa5c7e17c150 (patch)
tree2a146790ba3d0a632a23c7335a3dcbd9d5a8c881 /packages/instant/src/redux/reducer.ts
parentd0f20a4fd5d1ab563d4b1c941b55018da129334e (diff)
parent6748c36b033798de4eb56e5d4e49d1c4b4e7be1e (diff)
downloaddexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar
dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar.gz
dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar.bz2
dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar.lz
dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar.xz
dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar.zst
dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.zip
Merge pull request #1204 from 0xProject/feature/instant/maker-asset-datas-interface
[instant] Add `availableAssetDatas` to render method, fetch from asset-buyer if not specified, implement basic token selection
Diffstat (limited to 'packages/instant/src/redux/reducer.ts')
-rw-r--r--packages/instant/src/redux/reducer.ts18
1 files changed, 8 insertions, 10 deletions
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts
index 1b4fdabbc..8c1902bb8 100644
--- a/packages/instant/src/redux/reducer.ts
+++ b/packages/instant/src/redux/reducer.ts
@@ -24,6 +24,7 @@ export interface State {
assetBuyer?: AssetBuyer;
assetMetaDataMap: ObjectMap<AssetMetaData>;
selectedAsset?: Asset;
+ availableAssets?: Asset[];
selectedAssetAmount?: BigNumber;
buyOrderState: OrderState;
ethUsdPrice?: BigNumber;
@@ -37,6 +38,7 @@ export interface State {
export const INITIAL_STATE: State = {
network: Network.Mainnet,
selectedAssetAmount: undefined,
+ availableAssets: undefined,
assetMetaDataMap,
buyOrderState: { processState: OrderProcessState.NONE },
ethUsdPrice: undefined,
@@ -159,18 +161,9 @@ export const reducer = (state: State = INITIAL_STATE, action: Action): State =>
latestErrorDisplayStatus: DisplayStatus.Hidden,
};
case ActionTypes.UPDATE_SELECTED_ASSET:
- const newSelectedAssetData = action.data;
- let newSelectedAsset: Asset | undefined;
- if (!_.isUndefined(newSelectedAssetData)) {
- newSelectedAsset = assetUtils.createAssetFromAssetData(
- newSelectedAssetData,
- state.assetMetaDataMap,
- state.network,
- );
- }
return {
...state,
- selectedAsset: newSelectedAsset,
+ selectedAsset: action.data,
};
case ActionTypes.RESET_AMOUNT:
return {
@@ -180,6 +173,11 @@ export const reducer = (state: State = INITIAL_STATE, action: Action): State =>
buyOrderState: { processState: OrderProcessState.NONE },
selectedAssetAmount: undefined,
};
+ case ActionTypes.SET_AVAILABLE_ASSETS:
+ return {
+ ...state,
+ availableAssets: action.data,
+ };
default:
return state;
}