Skip to content

Commit

Permalink
Merge pull request #1226 from MyCryptoHQ/develop
Browse files Browse the repository at this point in the history
Tag Beta Release 0.4.0
  • Loading branch information
dternyak authored Mar 2, 2018
2 parents c5e5320 + 7c451ff commit b445a43
Show file tree
Hide file tree
Showing 208 changed files with 2,555 additions and 1,958 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ webpack_config/server.csr

v8-compile-cache-0/
package-lock.json

yarn.lock
35 changes: 30 additions & 5 deletions common/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { Provider, connect } from 'react-redux';
import { withRouter, Switch, Redirect, HashRouter, Route, BrowserRouter } from 'react-router-dom';
// Components
import Contracts from 'containers/Tabs/Contracts';
Expand All @@ -15,27 +15,41 @@ import PageNotFound from 'components/PageNotFound';
import LogOutPrompt from 'components/LogOutPrompt';
import { TitleBar } from 'components/ui';
import { Store } from 'redux';
import { pollOfflineStatus } from 'actions/config';
import { pollOfflineStatus, TPollOfflineStatus } from 'actions/config';
import { AppState } from 'reducers';
import { RouteNotFound } from 'components/RouteNotFound';
import { RedirectWithQuery } from 'components/RedirectWithQuery';
import 'what-input';
import { setUnitMeta, TSetUnitMeta } from 'actions/transaction';
import { getNetworkUnit } from 'selectors/config';

interface Props {
interface OwnProps {
store: Store<AppState>;
}

interface StateProps {
networkUnit: string;
}

interface DispatchProps {
pollOfflineStatus: TPollOfflineStatus;
setUnitMeta: TSetUnitMeta;
}

type Props = OwnProps & StateProps & DispatchProps;

interface State {
error: Error | null;
}

export default class Root extends Component<Props, State> {
class RootClass extends Component<Props, State> {
public state = {
error: null
};

public componentDidMount() {
this.props.store.dispatch(pollOfflineStatus());
this.props.pollOfflineStatus();
this.props.setUnitMeta(this.props.networkUnit);
}

public componentDidCatch(error: Error) {
Expand Down Expand Up @@ -134,3 +148,14 @@ const LegacyRoutes = withRouter(props => {
</Switch>
);
});

const mapStateToProps = (state: AppState) => {
return {
networkUnit: getNetworkUnit(state)
};
};

export default connect(mapStateToProps, {
pollOfflineStatus,
setUnitMeta
})(RootClass);
8 changes: 8 additions & 0 deletions common/actions/config/actionCreators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ export function changeNodeIntent(payload: string): interfaces.ChangeNodeIntentAc
};
}

export type TChangeNodeForce = typeof changeNodeForce;
export function changeNodeForce(payload: string): interfaces.ChangeNodeForceAction {
return {
type: TypeKeys.CONFIG_NODE_CHANGE_FORCE,
payload
};
}

export type TAddCustomNode = typeof addCustomNode;
export function addCustomNode(
payload: interfaces.AddCustomNodeAction['payload']
Expand Down
5 changes: 5 additions & 0 deletions common/actions/config/actionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export interface ChangeNodeIntentAction {
type: TypeKeys.CONFIG_NODE_CHANGE_INTENT;
payload: string;
}
/*** Force Change Node ***/
export interface ChangeNodeForceAction {
type: TypeKeys.CONFIG_NODE_CHANGE_FORCE;
payload: string;
}

/*** Add Custom Node ***/
export interface AddCustomNodeAction {
Expand Down
1 change: 1 addition & 0 deletions common/actions/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum TypeKeys {
CONFIG_NODE_WEB3_UNSET = 'CONFIG_NODE_WEB3_UNSET',
CONFIG_NODE_CHANGE = 'CONFIG_NODE_CHANGE',
CONFIG_NODE_CHANGE_INTENT = 'CONFIG_NODE_CHANGE_INTENT',
CONFIG_NODE_CHANGE_FORCE = 'CONFIG_NODE_CHANGE_FORCE',

CONFIG_ADD_CUSTOM_NODE = 'CONFIG_ADD_CUSTOM_NODE',
CONFIG_REMOVE_CUSTOM_NODE = 'CONFIG_REMOVE_CUSTOM_NODE',
Expand Down
22 changes: 18 additions & 4 deletions common/actions/swap/actionCreators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export function loadBityRatesSucceededSwap(
};
}

export type TLoadShapeshiftSucceededSwap = typeof loadShapeshiftRatesSucceededSwap;
export type TLoadShapeshiftRatesSucceededSwap = typeof loadShapeshiftRatesSucceededSwap;
export function loadShapeshiftRatesSucceededSwap(
payload
): interfaces.LoadShapshiftRatesSucceededSwapAction {
): interfaces.LoadShapeshiftRatesSucceededSwapAction {
return {
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_SUCCEEDED,
payload
Expand Down Expand Up @@ -59,13 +59,27 @@ export function loadBityRatesRequestedSwap(): interfaces.LoadBityRatesRequestedS
};
}

export type TLoadShapeshiftRequestedSwap = typeof loadShapeshiftRatesRequestedSwap;
export function loadShapeshiftRatesRequestedSwap(): interfaces.LoadShapeshiftRequestedSwapAction {
export type TLoadShapeshiftRatesRequestedSwap = typeof loadShapeshiftRatesRequestedSwap;
export function loadShapeshiftRatesRequestedSwap(): interfaces.LoadShapeshiftRatesRequestedSwapAction {
return {
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED
};
}

export type TLoadBityRatesFailedSwap = typeof loadBityRatesFailedSwap;
export function loadBityRatesFailedSwap(): interfaces.LoadBityRatesFailedSwapAction {
return {
type: TypeKeys.SWAP_LOAD_BITY_RATES_FAILED
};
}

export type TLoadShapeshiftFailedSwap = typeof loadShapeshiftRatesFailedSwap;
export function loadShapeshiftRatesFailedSwap(): interfaces.LoadShapeshiftRatesFailedSwapAction {
return {
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_FAILED
};
}

export type TStopLoadBityRatesSwap = typeof stopLoadBityRatesSwap;
export function stopLoadBityRatesSwap(): interfaces.StopLoadBityRatesSwapAction {
return {
Expand Down
24 changes: 16 additions & 8 deletions common/actions/swap/actionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface Pairs {
}

export interface SwapInput {
id: string;
label: string;
amount: number | string;
}

Expand Down Expand Up @@ -43,7 +43,7 @@ export interface LoadBityRatesSucceededSwapAction {
payload: ApiResponse;
}

export interface LoadShapshiftRatesSucceededSwapAction {
export interface LoadShapeshiftRatesSucceededSwapAction {
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_SUCCEEDED;
payload: ApiResponse;
}
Expand All @@ -59,12 +59,18 @@ export interface RestartSwapAction {

export interface LoadBityRatesRequestedSwapAction {
type: TypeKeys.SWAP_LOAD_BITY_RATES_REQUESTED;
payload?: null;
}

export interface LoadShapeshiftRequestedSwapAction {
export interface LoadShapeshiftRatesRequestedSwapAction {
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED;
payload?: null;
}

export interface LoadBityRatesFailedSwapAction {
type: TypeKeys.SWAP_LOAD_BITY_RATES_FAILED;
}

export interface LoadShapeshiftRatesFailedSwapAction {
type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_FAILED;
}

export interface ChangeStepSwapAction {
Expand Down Expand Up @@ -240,12 +246,14 @@ export interface ShowLiteSendAction {
export type SwapAction =
| ChangeStepSwapAction
| InitSwap
| LoadBityRatesSucceededSwapAction
| LoadShapshiftRatesSucceededSwapAction
| DestinationAddressSwapAction
| RestartSwapAction
| LoadBityRatesRequestedSwapAction
| LoadShapeshiftRequestedSwapAction
| LoadBityRatesSucceededSwapAction
| LoadBityRatesFailedSwapAction
| LoadShapeshiftRatesRequestedSwapAction
| LoadShapeshiftRatesSucceededSwapAction
| LoadShapeshiftRatesFailedSwapAction
| StopLoadBityRatesSwapAction
| StopLoadShapeshiftRatesSwapAction
| BityOrderCreateRequestedSwapAction
Expand Down
2 changes: 2 additions & 0 deletions common/actions/swap/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export enum TypeKeys {
SWAP_RESTART = 'SWAP_RESTART',
SWAP_LOAD_BITY_RATES_REQUESTED = 'SWAP_LOAD_BITY_RATES_REQUESTED',
SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED = 'SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED',
SWAP_LOAD_BITY_RATES_FAILED = 'SWAP_LOAD_BITY_RATES_FAILED',
SWAP_LOAD_SHAPESHIFT_RATES_FAILED = 'SWAP_LOAD_SHAPESHIFT_RATES_FAILED',
SWAP_STOP_LOAD_BITY_RATES = 'SWAP_STOP_LOAD_BITY_RATES',
SWAP_STOP_LOAD_SHAPESHIFT_RATES = 'SWAP_STOP_LOAD_SHAPESHIFT_RATES',
SWAP_ORDER_TIME = 'SWAP_ORDER_TIME',
Expand Down
5 changes: 4 additions & 1 deletion common/actions/transaction/actionCreators/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ const setGasPriceField = (payload: SetGasPriceFieldAction['payload']): SetGasPri
});

type TReset = typeof reset;
const reset = (): ResetAction => ({ type: TypeKeys.RESET });
const reset = (payload: ResetAction['payload'] = { include: {}, exclude: {} }): ResetAction => ({
type: TypeKeys.RESET,
payload
});

export {
TInputGasLimit,
Expand Down
17 changes: 8 additions & 9 deletions common/actions/transaction/actionCreators/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,22 @@ import {
SetTokenToMetaAction
} from 'actions/transaction';

type TSetTokenBalance = typeof setTokenValue;
type TSetUnitMeta = typeof setUnitMeta;
type TSetTokenTo = typeof setTokenTo;

const setTokenTo = (payload: SetTokenToMetaAction['payload']): SetTokenToMetaAction => ({
export type TSetTokenTo = typeof setTokenTo;
export const setTokenTo = (payload: SetTokenToMetaAction['payload']): SetTokenToMetaAction => ({
type: TypeKeys.TOKEN_TO_META_SET,
payload
});

const setTokenValue = (payload: SetTokenValueMetaAction['payload']): SetTokenValueMetaAction => ({
export type TSetTokenValue = typeof setTokenValue;
export const setTokenValue = (
payload: SetTokenValueMetaAction['payload']
): SetTokenValueMetaAction => ({
type: TypeKeys.TOKEN_VALUE_META_SET,
payload
});

const setUnitMeta = (payload: SetUnitMetaAction['payload']): SetUnitMetaAction => ({
export type TSetUnitMeta = typeof setUnitMeta;
export const setUnitMeta = (payload: SetUnitMetaAction['payload']): SetUnitMetaAction => ({
type: TypeKeys.UNIT_META_SET,
payload
});

export { TSetUnitMeta, TSetTokenBalance, TSetTokenTo, setUnitMeta, setTokenValue, setTokenTo };
15 changes: 15 additions & 0 deletions common/actions/transaction/actionTypes/actionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { SignAction } from './sign';
import { SwapAction } from './swap';
import { CurrentAction } from './current';
import { SendEverythingAction } from './sendEverything';
import { State as FieldState } from 'reducers/transaction/fields';
import { State as MetaState } from 'reducers/transaction/meta';
import { State as SignState } from 'reducers/transaction/sign';

export * from './broadcast';
export * from './fields';
Expand All @@ -19,6 +22,18 @@ export * from './sendEverything';

export interface ResetAction {
type: TypeKeys.RESET;
payload: {
include: {
fields?: (keyof FieldState)[];
meta?: (keyof MetaState)[];
sign?: (keyof SignState)[];
};
exclude: {
fields?: (keyof FieldState)[];
meta?: (keyof MetaState)[];
sign?: (keyof SignState)[];
};
};
}

export type TransactionAction =
Expand Down
2 changes: 2 additions & 0 deletions common/api/gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface GasEstimates {
fast: number;
fastest: number;
time: number;
chainId: number;
isDefault: boolean;
}

Expand Down Expand Up @@ -66,6 +67,7 @@ export function fetchGasEstimates(): Promise<GasEstimates> {
.then((res: RawGasEstimates) => ({
...res,
time: Date.now(),
chainId: 1,
isDefault: false
}));
}
Binary file modified common/assets/fonts/social-media.woff
Binary file not shown.
Binary file modified common/assets/fonts/social-media.woff2
Binary file not shown.
Binary file modified common/assets/images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions common/assets/images/icon-check.svg

This file was deleted.

3 changes: 0 additions & 3 deletions common/assets/images/icon-edit.svg

This file was deleted.

1 change: 0 additions & 1 deletion common/assets/images/icon-help-2.svg

This file was deleted.

2 changes: 1 addition & 1 deletion common/assets/images/icon-help-3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion common/assets/images/icon-help.svg

This file was deleted.

3 changes: 0 additions & 3 deletions common/assets/images/icon-view.svg

This file was deleted.

8 changes: 0 additions & 8 deletions common/assets/images/icon-x.svg

This file was deleted.

Binary file removed common/assets/images/logo-ethereum-2.png
Binary file not shown.
2 changes: 1 addition & 1 deletion common/assets/images/logo-mycrypto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b445a43

Please sign in to comment.