aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/redux
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-01-25 23:42:58 +0800
committerFabio Berger <me@fabioberger.com>2018-01-25 23:42:58 +0800
commit71d68f975cd7bc089f0cbef4e5888a73eab4ee42 (patch)
tree9482602fc23d2baec3fff1fb97750ad45adc6eca /packages/website/ts/redux
parentec3d8a034fe763d8255935985b1fb97aff6c177b (diff)
parentf58f0ddb67555c3f0c7252ea3e003824984c48ad (diff)
downloaddexon-0x-contracts-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.tar.gz
dexon-0x-contracts-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.tar.zst
dexon-0x-contracts-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.zip
Merge branch 'development' into feature/portal-ledger-support
* development: (437 commits) Publish Update yarn.lock Update the CHANGELOG Fix the bug making it impossible to specify the custom ZRX address Fix fill/cancel order by looking for NoError instead of empty blockchainErr given the BlockchainErrs type refactor Add a comment about a yarn bug Add our mainnet and kovan nodes as backups for Portal requests Fix bug hiding the user info from topBar Add dev-utils package to top level README Prettier newline Prettier Allow Token symbols to be alphanumeric Update CHANGELOG, rebase on development Should not -> cannot Reject negative amounts in isValidBaseUnitAmount Re-add changelog for 0x.js Fix prettier Update yarn.lock Move tests to a separate folder Change file layout ... # Conflicts: # packages/website/README.md
Diffstat (limited to 'packages/website/ts/redux')
-rw-r--r--packages/website/ts/redux/dispatcher.ts194
-rw-r--r--packages/website/ts/redux/reducer.ts302
2 files changed, 257 insertions, 239 deletions
diff --git a/packages/website/ts/redux/dispatcher.ts b/packages/website/ts/redux/dispatcher.ts
index a0a1da21b..42989e5e1 100644
--- a/packages/website/ts/redux/dispatcher.ts
+++ b/packages/website/ts/redux/dispatcher.ts
@@ -1,12 +1,10 @@
-import BigNumber from 'bignumber.js';
-import {Dispatch} from 'redux';
-import {State} from 'ts/redux/reducer';
+import { BigNumber } from '@0xproject/utils';
+import { Dispatch } from 'redux';
+import { State } from 'ts/redux/reducer';
import {
ActionTypes,
AssetToken,
BlockchainErrs,
- Direction,
- Fill,
Order,
ProviderType,
ScreenWidths,
@@ -17,227 +15,221 @@ import {
} from 'ts/types';
export class Dispatcher {
- private dispatch: Dispatch<State>;
+ private _dispatch: Dispatch<State>;
constructor(dispatch: Dispatch<State>) {
- this.dispatch = dispatch;
+ this._dispatch = dispatch;
}
// Portal
public resetState() {
- this.dispatch({
- type: ActionTypes.RESET_STATE,
+ this._dispatch({
+ type: ActionTypes.ResetState,
});
}
public updateNodeVersion(nodeVersion: string) {
- this.dispatch({
+ this._dispatch({
data: nodeVersion,
- type: ActionTypes.UPDATE_NODE_VERSION,
+ type: ActionTypes.UpdateNodeVersion,
});
}
public updateScreenWidth(screenWidth: ScreenWidths) {
- this.dispatch({
+ this._dispatch({
data: screenWidth,
- type: ActionTypes.UPDATE_SCREEN_WIDTH,
+ type: ActionTypes.UpdateScreenWidth,
});
}
public swapAssetTokenSymbols() {
- this.dispatch({
- type: ActionTypes.SWAP_ASSET_TOKENS,
- });
- }
- public updateGenerateOrderStep(direction: Direction) {
- this.dispatch({
- data: direction,
- type: ActionTypes.UPDATE_GENERATE_ORDER_STEP,
+ this._dispatch({
+ type: ActionTypes.SwapAssetTokens,
});
}
public updateOrderSalt(salt: BigNumber) {
- this.dispatch({
+ this._dispatch({
data: salt,
- type: ActionTypes.UPDATE_ORDER_SALT,
+ type: ActionTypes.UpdateOrderSalt,
});
}
public updateUserSuppliedOrderCache(order: Order) {
- this.dispatch({
+ this._dispatch({
data: order,
- type: ActionTypes.UPDATE_USER_SUPPLIED_ORDER_CACHE,
+ type: ActionTypes.UpdateUserSuppliedOrderCache,
});
}
public updateShouldBlockchainErrDialogBeOpen(shouldBeOpen: boolean) {
- this.dispatch({
+ this._dispatch({
data: shouldBeOpen,
- type: ActionTypes.UPDATE_SHOULD_BLOCKCHAIN_ERR_DIALOG_BE_OPEN,
+ type: ActionTypes.UpdateShouldBlockchainErrDialogBeOpen,
});
}
public updateChosenAssetToken(side: Side, token: AssetToken) {
- this.dispatch({
+ this._dispatch({
data: {
side,
token,
},
- type: ActionTypes.UPDATE_CHOSEN_ASSET_TOKEN,
+ type: ActionTypes.UpdateChosenAssetToken,
});
}
public updateChosenAssetTokenAddress(side: Side, address: string) {
- this.dispatch({
+ this._dispatch({
data: {
address,
side,
},
- type: ActionTypes.UPDATE_CHOSEN_ASSET_TOKEN_ADDRESS,
+ type: ActionTypes.UpdateChosenAssetTokenAddress,
});
}
public updateOrderTakerAddress(address: string) {
- this.dispatch({
+ this._dispatch({
data: address,
- type: ActionTypes.UPDATE_ORDER_TAKER_ADDRESS,
+ type: ActionTypes.UpdateOrderTakerAddress,
});
}
public updateUserAddress(address: string) {
- this.dispatch({
+ this._dispatch({
data: address,
- type: ActionTypes.UPDATE_USER_ADDRESS,
+ type: ActionTypes.UpdateUserAddress,
});
}
public updateOrderExpiry(unixTimestampSec: BigNumber) {
- this.dispatch({
+ this._dispatch({
data: unixTimestampSec,
- type: ActionTypes.UPDATE_ORDER_EXPIRY,
+ type: ActionTypes.UpdateOrderExpiry,
});
}
public encounteredBlockchainError(err: BlockchainErrs) {
- this.dispatch({
- data: err,
- type: ActionTypes.BLOCKCHAIN_ERR_ENCOUNTERED,
- });
+ this._dispatch({
+ data: err,
+ type: ActionTypes.BlockchainErrEncountered,
+ });
}
public updateBlockchainIsLoaded(isLoaded: boolean) {
- this.dispatch({
- data: isLoaded,
- type: ActionTypes.UPDATE_BLOCKCHAIN_IS_LOADED,
- });
+ this._dispatch({
+ data: isLoaded,
+ type: ActionTypes.UpdateBlockchainIsLoaded,
+ });
}
public addTokenToTokenByAddress(token: Token) {
- this.dispatch({
- data: token,
- type: ActionTypes.ADD_TOKEN_TO_TOKEN_BY_ADDRESS,
- });
+ this._dispatch({
+ data: token,
+ type: ActionTypes.AddTokenToTokenByAddress,
+ });
}
public removeTokenToTokenByAddress(token: Token) {
- this.dispatch({
- data: token,
- type: ActionTypes.REMOVE_TOKEN_TO_TOKEN_BY_ADDRESS,
- });
+ this._dispatch({
+ data: token,
+ type: ActionTypes.RemoveTokenFromTokenByAddress,
+ });
}
public clearTokenByAddress() {
- this.dispatch({
- type: ActionTypes.CLEAR_TOKEN_BY_ADDRESS,
- });
+ this._dispatch({
+ type: ActionTypes.ClearTokenByAddress,
+ });
}
public updateTokenByAddress(tokens: Token[]) {
- this.dispatch({
- data: tokens,
- type: ActionTypes.UPDATE_TOKEN_BY_ADDRESS,
- });
+ this._dispatch({
+ data: tokens,
+ type: ActionTypes.UpdateTokenByAddress,
+ });
}
public updateTokenStateByAddress(tokenStateByAddress: TokenStateByAddress) {
- this.dispatch({
- data: tokenStateByAddress,
- type: ActionTypes.UPDATE_TOKEN_STATE_BY_ADDRESS,
- });
+ this._dispatch({
+ data: tokenStateByAddress,
+ type: ActionTypes.UpdateTokenStateByAddress,
+ });
}
public removeFromTokenStateByAddress(tokenAddress: string) {
- this.dispatch({
+ this._dispatch({
data: tokenAddress,
- type: ActionTypes.REMOVE_FROM_TOKEN_STATE_BY_ADDRESS,
+ type: ActionTypes.RemoveFromTokenStateByAddress,
});
}
public replaceTokenAllowanceByAddress(address: string, allowance: BigNumber) {
- this.dispatch({
+ this._dispatch({
data: {
- address,
- allowance,
+ address,
+ allowance,
},
- type: ActionTypes.REPLACE_TOKEN_ALLOWANCE_BY_ADDRESS,
+ type: ActionTypes.ReplaceTokenAllowanceByAddress,
});
}
public replaceTokenBalanceByAddress(address: string, balance: BigNumber) {
- this.dispatch({
+ this._dispatch({
data: {
address,
balance,
},
- type: ActionTypes.REPLACE_TOKEN_BALANCE_BY_ADDRESS,
+ type: ActionTypes.ReplaceTokenBalanceByAddress,
});
}
public updateTokenBalanceByAddress(address: string, balanceDelta: BigNumber) {
- this.dispatch({
+ this._dispatch({
data: {
address,
balanceDelta,
},
- type: ActionTypes.UPDATE_TOKEN_BALANCE_BY_ADDRESS,
+ type: ActionTypes.UpdateTokenBalanceByAddress,
});
}
public updateSignatureData(signatureData: SignatureData) {
- this.dispatch({
- data: signatureData,
- type: ActionTypes.UPDATE_ORDER_SIGNATURE_DATA,
- });
+ this._dispatch({
+ data: signatureData,
+ type: ActionTypes.UpdateOrderSignatureData,
+ });
}
public updateUserEtherBalance(balance: BigNumber) {
- this.dispatch({
- data: balance,
- type: ActionTypes.UPDATE_USER_ETHER_BALANCE,
- });
+ this._dispatch({
+ data: balance,
+ type: ActionTypes.UpdateUserEtherBalance,
+ });
}
public updateNetworkId(networkId: number) {
- this.dispatch({
- data: networkId,
- type: ActionTypes.UPDATE_NETWORK_ID,
- });
+ this._dispatch({
+ data: networkId,
+ type: ActionTypes.UpdateNetworkId,
+ });
}
public updateOrderFillAmount(amount: BigNumber) {
- this.dispatch({
+ this._dispatch({
data: amount,
- type: ActionTypes.UPDATE_ORDER_FILL_AMOUNT,
+ type: ActionTypes.UpdateOrderFillAmount,
});
}
// Docs
public updateCurrentDocsVersion(version: string) {
- this.dispatch({
+ this._dispatch({
data: version,
- type: ActionTypes.UPDATE_LIBRARY_VERSION,
+ type: ActionTypes.UpdateLibraryVersion,
});
}
public updateAvailableDocVersions(versions: string[]) {
- this.dispatch({
+ this._dispatch({
data: versions,
- type: ActionTypes.UPDATE_AVAILABLE_LIBRARY_VERSIONS,
+ type: ActionTypes.UpdateAvailableLibraryVersions,
});
}
// Shared
- public showFlashMessage(msg: string|React.ReactNode) {
- this.dispatch({
+ public showFlashMessage(msg: string | React.ReactNode) {
+ this._dispatch({
data: msg,
- type: ActionTypes.SHOW_FLASH_MESSAGE,
+ type: ActionTypes.ShowFlashMessage,
});
}
public hideFlashMessage() {
- this.dispatch({
- type: ActionTypes.HIDE_FLASH_MESSAGE,
+ this._dispatch({
+ type: ActionTypes.HideFlashMessage,
});
}
public updateProviderType(providerType: ProviderType) {
- this.dispatch({
- type: ActionTypes.UPDATE_PROVIDER_TYPE,
+ this._dispatch({
+ type: ActionTypes.UpdateProviderType,
data: providerType,
});
}
public updateInjectedProviderName(injectedProviderName: string) {
- this.dispatch({
- type: ActionTypes.UPDATE_INJECTED_PROVIDER_NAME,
+ this._dispatch({
+ type: ActionTypes.UpdateInjectedProviderName,
data: injectedProviderName,
});
}
diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts
index da69a9d00..06ac8b670 100644
--- a/packages/website/ts/redux/reducer.ts
+++ b/packages/website/ts/redux/reducer.ts
@@ -1,12 +1,10 @@
-import {ZeroEx} from '0x.js';
-import BigNumber from 'bignumber.js';
+import { ZeroEx } from '0x.js';
+import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import {
Action,
ActionTypes,
BlockchainErrs,
- Direction,
- GenerateOrderSteps,
Order,
ProviderType,
ScreenWidths,
@@ -17,7 +15,7 @@ import {
TokenState,
TokenStateByAddress,
} from 'ts/types';
-import {utils} from 'ts/utils/utils';
+import { utils } from 'ts/utils/utils';
// Instead of defaulting the docs version to an empty string, we pre-populate it with
// a valid version value. This does not need to be updated however, since onLoad, it
@@ -28,7 +26,6 @@ export interface State {
// Portal
blockchainErr: BlockchainErrs;
blockchainIsLoaded: boolean;
- generateOrderStep: GenerateOrderSteps;
networkId: number;
orderExpiryTimestamp: BigNumber;
orderFillAmount: BigNumber;
@@ -51,16 +48,15 @@ export interface State {
availableDocVersions: string[];
// Shared
- flashMessage: string|React.ReactNode;
+ flashMessage: string | React.ReactNode;
providerType: ProviderType;
injectedProviderName: string;
}
const INITIAL_STATE: State = {
// Portal
- blockchainErr: '',
+ blockchainErr: BlockchainErrs.NoError,
blockchainIsLoaded: false,
- generateOrderStep: GenerateOrderSteps.ChooseAssets,
networkId: undefined,
orderExpiryTimestamp: utils.initialOrderExpiryUnixTimestampSec(),
orderFillAmount: undefined,
@@ -76,8 +72,8 @@ const INITIAL_STATE: State = {
screenWidth: utils.getScreenWidth(),
shouldBlockchainErrDialogBeOpen: false,
sideToAssetToken: {
- [Side.deposit]: {},
- [Side.receive]: {},
+ [Side.Deposit]: {},
+ [Side.Receive]: {},
},
tokenByAddress: {},
tokenStateByAddress: {},
@@ -91,270 +87,300 @@ const INITIAL_STATE: State = {
// Shared
flashMessage: undefined,
- providerType: ProviderType.INJECTED,
+ providerType: ProviderType.Injected,
injectedProviderName: '',
};
export function reducer(state: State = INITIAL_STATE, action: Action) {
switch (action.type) {
// Portal
- case ActionTypes.RESET_STATE:
+ case ActionTypes.ResetState:
return INITIAL_STATE;
- case ActionTypes.UPDATE_ORDER_SALT: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateOrderSalt: {
+ return {
+ ...state,
orderSalt: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_NODE_VERSION: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateNodeVersion: {
+ return {
+ ...state,
nodeVersion: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_ORDER_FILL_AMOUNT: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateOrderFillAmount: {
+ return {
+ ...state,
orderFillAmount: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_SHOULD_BLOCKCHAIN_ERR_DIALOG_BE_OPEN: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateShouldBlockchainErrDialogBeOpen: {
+ return {
+ ...state,
shouldBlockchainErrDialogBeOpen: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_USER_ETHER_BALANCE: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateUserEtherBalance: {
+ return {
+ ...state,
userEtherBalance: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_USER_SUPPLIED_ORDER_CACHE: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateUserSuppliedOrderCache: {
+ return {
+ ...state,
userSuppliedOrderCache: action.data,
- });
+ };
}
- case ActionTypes.CLEAR_TOKEN_BY_ADDRESS: {
- return _.assign({}, state, {
+ case ActionTypes.ClearTokenByAddress: {
+ return {
+ ...state,
tokenByAddress: {},
- });
+ };
}
- case ActionTypes.ADD_TOKEN_TO_TOKEN_BY_ADDRESS: {
+ case ActionTypes.AddTokenToTokenByAddress: {
const newTokenByAddress = state.tokenByAddress;
newTokenByAddress[action.data.address] = action.data;
- return _.assign({}, state, {
+ return {
+ ...state,
tokenByAddress: newTokenByAddress,
- });
+ };
}
- case ActionTypes.REMOVE_TOKEN_TO_TOKEN_BY_ADDRESS: {
+ case ActionTypes.RemoveTokenFromTokenByAddress: {
const newTokenByAddress = state.tokenByAddress;
delete newTokenByAddress[action.data.address];
- return _.assign({}, state, {
+ return {
+ ...state,
tokenByAddress: newTokenByAddress,
- });
+ };
}
- case ActionTypes.UPDATE_TOKEN_BY_ADDRESS: {
+ case ActionTypes.UpdateTokenByAddress: {
const tokenByAddress = state.tokenByAddress;
const tokens = action.data;
_.each(tokens, token => {
- const updatedToken = _.assign({}, tokenByAddress[token.address], token);
+ const updatedToken = {
+ ...tokenByAddress[token.address],
+ ...token,
+ };
tokenByAddress[token.address] = updatedToken;
});
- return _.assign({}, state, {
+ return {
+ ...state,
tokenByAddress,
- });
+ };
}
- case ActionTypes.UPDATE_TOKEN_STATE_BY_ADDRESS: {
+ case ActionTypes.UpdateTokenStateByAddress: {
const tokenStateByAddress = state.tokenStateByAddress;
const updatedTokenStateByAddress = action.data;
_.each(updatedTokenStateByAddress, (tokenState: TokenState, address: string) => {
- const updatedTokenState = _.assign({}, tokenStateByAddress[address], tokenState);
+ const updatedTokenState = {
+ ...tokenStateByAddress[address],
+ ...tokenState,
+ };
tokenStateByAddress[address] = updatedTokenState;
});
- return _.assign({}, state, {
+ return {
+ ...state,
tokenStateByAddress,
- });
+ };
}
- case ActionTypes.REMOVE_FROM_TOKEN_STATE_BY_ADDRESS: {
+ case ActionTypes.RemoveFromTokenStateByAddress: {
const tokenStateByAddress = state.tokenStateByAddress;
const tokenAddress = action.data;
delete tokenStateByAddress[tokenAddress];
- return _.assign({}, state, {
+ return {
+ ...state,
tokenStateByAddress,
- });
+ };
}
- case ActionTypes.REPLACE_TOKEN_ALLOWANCE_BY_ADDRESS: {
+ case ActionTypes.ReplaceTokenAllowanceByAddress: {
const tokenStateByAddress = state.tokenStateByAddress;
const allowance = action.data.allowance;
const tokenAddress = action.data.address;
- tokenStateByAddress[tokenAddress] = _.assign({}, tokenStateByAddress[tokenAddress], {
+ tokenStateByAddress[tokenAddress] = {
+ ...tokenStateByAddress[tokenAddress],
allowance,
- });
- return _.assign({}, state, {
+ };
+ return {
+ ...state,
tokenStateByAddress,
- });
+ };
}
- case ActionTypes.REPLACE_TOKEN_BALANCE_BY_ADDRESS: {
+ case ActionTypes.ReplaceTokenBalanceByAddress: {
const tokenStateByAddress = state.tokenStateByAddress;
const balance = action.data.balance;
const tokenAddress = action.data.address;
- tokenStateByAddress[tokenAddress] = _.assign({}, tokenStateByAddress[tokenAddress], {
+ tokenStateByAddress[tokenAddress] = {
+ ...tokenStateByAddress[tokenAddress],
balance,
- });
- return _.assign({}, state, {
+ };
+ return {
+ ...state,
tokenStateByAddress,
- });
+ };
}
- case ActionTypes.UPDATE_TOKEN_BALANCE_BY_ADDRESS: {
+ case ActionTypes.UpdateTokenBalanceByAddress: {
const tokenStateByAddress = state.tokenStateByAddress;
const balanceDelta = action.data.balanceDelta;
const tokenAddress = action.data.address;
const currBalance = tokenStateByAddress[tokenAddress].balance;
- tokenStateByAddress[tokenAddress] = _.assign({}, tokenStateByAddress[tokenAddress], {
+ tokenStateByAddress[tokenAddress] = {
+ ...tokenStateByAddress[tokenAddress],
balance: currBalance.plus(balanceDelta),
- });
- return _.assign({}, state, {
+ };
+ return {
+ ...state,
tokenStateByAddress,
- });
+ };
}
- case ActionTypes.UPDATE_ORDER_SIGNATURE_DATA: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateOrderSignatureData: {
+ return {
+ ...state,
orderSignatureData: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_SCREEN_WIDTH: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateScreenWidth: {
+ return {
+ ...state,
screenWidth: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_BLOCKCHAIN_IS_LOADED: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateBlockchainIsLoaded: {
+ return {
+ ...state,
blockchainIsLoaded: action.data,
- });
+ };
}
- case ActionTypes.BLOCKCHAIN_ERR_ENCOUNTERED: {
- return _.assign({}, state, {
+ case ActionTypes.BlockchainErrEncountered: {
+ return {
+ ...state,
blockchainErr: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_NETWORK_ID: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateNetworkId: {
+ return {
+ ...state,
networkId: action.data,
- });
- }
-
- case ActionTypes.UPDATE_GENERATE_ORDER_STEP: {
- const direction = action.data;
- let nextGenerateOrderStep = state.generateOrderStep;
- if (direction === Direction.forward) {
- nextGenerateOrderStep += 1;
- } else if (state.generateOrderStep !== 0) {
- nextGenerateOrderStep -= 1;
- }
- return _.assign({}, state, {
- generateOrderStep: nextGenerateOrderStep,
- });
+ };
}
- case ActionTypes.UPDATE_CHOSEN_ASSET_TOKEN: {
- const newSideToAssetToken = _.assign({}, state.sideToAssetToken, {
+ case ActionTypes.UpdateChosenAssetToken: {
+ const newSideToAssetToken = {
+ ...state.sideToAssetToken,
[action.data.side]: action.data.token,
- });
- return _.assign({}, state, {
+ };
+ return {
+ ...state,
sideToAssetToken: newSideToAssetToken,
- });
+ };
}
- case ActionTypes.UPDATE_CHOSEN_ASSET_TOKEN_ADDRESS: {
+ case ActionTypes.UpdateChosenAssetTokenAddress: {
const newAssetToken = state.sideToAssetToken[action.data.side];
newAssetToken.address = action.data.address;
- const newSideToAssetToken = _.assign({}, state.sideToAssetToken, {
+ const newSideToAssetToken = {
+ ...state.sideToAssetToken,
[action.data.side]: newAssetToken,
- });
- return _.assign({}, state, {
+ };
+ return {
+ ...state,
sideToAssetToken: newSideToAssetToken,
- });
+ };
}
- case ActionTypes.SWAP_ASSET_TOKENS: {
- const newSideToAssetToken = _.assign({}, state.sideToAssetToken, {
- [Side.deposit]: state.sideToAssetToken[Side.receive],
- [Side.receive]: state.sideToAssetToken[Side.deposit],
- });
- return _.assign({}, state, {
+ case ActionTypes.SwapAssetTokens: {
+ const newSideToAssetToken = {
+ [Side.Deposit]: state.sideToAssetToken[Side.Receive],
+ [Side.Receive]: state.sideToAssetToken[Side.Deposit],
+ };
+ return {
+ ...state,
sideToAssetToken: newSideToAssetToken,
- });
+ };
}
- case ActionTypes.UPDATE_ORDER_EXPIRY: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateOrderExpiry: {
+ return {
+ ...state,
orderExpiryTimestamp: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_ORDER_TAKER_ADDRESS: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateOrderTakerAddress: {
+ return {
+ ...state,
orderTakerAddress: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_USER_ADDRESS: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateUserAddress: {
+ return {
+ ...state,
userAddress: action.data,
- });
+ };
}
// Docs
- case ActionTypes.UPDATE_LIBRARY_VERSION: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateLibraryVersion: {
+ return {
+ ...state,
docsVersion: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_AVAILABLE_LIBRARY_VERSIONS: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateAvailableLibraryVersions: {
+ return {
+ ...state,
availableDocVersions: action.data,
- });
+ };
}
// Shared
- case ActionTypes.SHOW_FLASH_MESSAGE: {
- return _.assign({}, state, {
+ case ActionTypes.ShowFlashMessage: {
+ return {
+ ...state,
flashMessage: action.data,
- });
+ };
}
- case ActionTypes.HIDE_FLASH_MESSAGE: {
- return _.assign({}, state, {
+ case ActionTypes.HideFlashMessage: {
+ return {
+ ...state,
flashMessage: undefined,
- });
+ };
}
- case ActionTypes.UPDATE_PROVIDER_TYPE: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateProviderType: {
+ return {
+ ...state,
providerType: action.data,
- });
+ };
}
- case ActionTypes.UPDATE_INJECTED_PROVIDER_NAME: {
- return _.assign({}, state, {
+ case ActionTypes.UpdateInjectedProviderName: {
+ return {
+ ...state,
injectedProviderName: action.data,
- });
+ };
}
default: