diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-11-01 10:20:37 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-11-01 10:21:06 +0800 |
commit | 6091ee732d208eaf9889087b8308dfd0427b9be5 (patch) | |
tree | c13189159cc172c9f82340a8d3a2bd69eed47f6e /packages/instant/src/redux/reducer.ts | |
parent | 8c336925601127c759ad4cfbca119368a2edfd56 (diff) | |
download | dexon-sol-tools-6091ee732d208eaf9889087b8308dfd0427b9be5.tar dexon-sol-tools-6091ee732d208eaf9889087b8308dfd0427b9be5.tar.gz dexon-sol-tools-6091ee732d208eaf9889087b8308dfd0427b9be5.tar.bz2 dexon-sol-tools-6091ee732d208eaf9889087b8308dfd0427b9be5.tar.lz dexon-sol-tools-6091ee732d208eaf9889087b8308dfd0427b9be5.tar.xz dexon-sol-tools-6091ee732d208eaf9889087b8308dfd0427b9be5.tar.zst dexon-sol-tools-6091ee732d208eaf9889087b8308dfd0427b9be5.zip |
feat: modify public API to allow for passing in available assets, or fetch assets from SRA
Diffstat (limited to 'packages/instant/src/redux/reducer.ts')
-rw-r--r-- | packages/instant/src/redux/reducer.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts index dd9403052..c0a8c1771 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?: BigNumberInput; buyOrderState: OrderState; ethUsdPrice?: BigNumber; @@ -36,6 +37,7 @@ export interface State { export const INITIAL_STATE: State = { network: Network.Mainnet, selectedAssetAmount: undefined, + availableAssets: [], assetMetaDataMap, buyOrderState: { processState: OrderProcessState.NONE }, ethUsdPrice: undefined, @@ -109,7 +111,7 @@ export const reducer = (state: State = INITIAL_STATE, action: Action): State => const newSelectedAssetData = action.data; let newSelectedAsset: Asset | undefined; if (!_.isUndefined(newSelectedAssetData)) { - newSelectedAsset = assetUtils.createAssetFromAssetData( + newSelectedAsset = assetUtils.createAssetFromAssetDataOrThrow( newSelectedAssetData, state.assetMetaDataMap, state.network, @@ -127,6 +129,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; } |