Prettier Reformat (#619)

* Add repo wide prettier command to prepush

* Make config file explict, remove formatAll to prepush
This commit is contained in:
HenryNguyen5 2017-12-18 18:29:26 -05:00 committed by Daniel Ternyak
parent 882d7ca164
commit da93fb1684
61 changed files with 158 additions and 480 deletions

View File

@ -3,9 +3,7 @@ import * as interfaces from './actionTypes';
import { TypeKeys } from './constants'; import { TypeKeys } from './constants';
export type TAddCustomToken = typeof addCustomToken; export type TAddCustomToken = typeof addCustomToken;
export function addCustomToken( export function addCustomToken(payload: Token): interfaces.AddCustomTokenAction {
payload: Token
): interfaces.AddCustomTokenAction {
return { return {
type: TypeKeys.CUSTOM_TOKEN_ADD, type: TypeKeys.CUSTOM_TOKEN_ADD,
payload payload
@ -14,9 +12,7 @@ export function addCustomToken(
export type TRemoveCustomToken = typeof removeCustomToken; export type TRemoveCustomToken = typeof removeCustomToken;
export function removeCustomToken( export function removeCustomToken(payload: string): interfaces.RemoveCustomTokenAction {
payload: string
): interfaces.RemoveCustomTokenAction {
return { return {
type: TypeKeys.CUSTOM_TOKEN_REMOVE, type: TypeKeys.CUSTOM_TOKEN_REMOVE,
payload payload

View File

@ -26,9 +26,7 @@ export function setDeterministicWallets(
}; };
} }
export function setDesiredToken( export function setDesiredToken(token: string | undefined): interfaces.SetDesiredTokenAction {
token: string | undefined
): interfaces.SetDesiredTokenAction {
return { return {
type: TypeKeys.DW_SET_DESIRED_TOKEN, type: TypeKeys.DW_SET_DESIRED_TOKEN,
payload: token payload: token

View File

@ -3,9 +3,7 @@ import * as interfaces from './actionTypes';
import { TypeKeys } from './constants'; import { TypeKeys } from './constants';
export type TGenerateNewWallet = typeof generateNewWallet; export type TGenerateNewWallet = typeof generateNewWallet;
export function generateNewWallet( export function generateNewWallet(password: string): interfaces.GenerateNewWalletAction {
password: string
): interfaces.GenerateNewWalletAction {
return { return {
type: TypeKeys.GENERATE_WALLET_GENERATE_WALLET, type: TypeKeys.GENERATE_WALLET_GENERATE_WALLET,
wallet: generate(), wallet: generate(),

View File

@ -20,9 +20,7 @@ export function showNotification(
} }
export type TCloseNotification = typeof closeNotification; export type TCloseNotification = typeof closeNotification;
export function closeNotification( export function closeNotification(notification: types.Notification): types.CloseNotificationAction {
notification: types.Notification
): types.CloseNotificationAction {
return { return {
type: TypeKeys.CLOSE_NOTIFICATION, type: TypeKeys.CLOSE_NOTIFICATION,
payload: notification payload: notification

View File

@ -23,6 +23,4 @@ export interface ShowNotificationAction {
} }
/*** Union Type ***/ /*** Union Type ***/
export type NotificationsAction = export type NotificationsAction = ShowNotificationAction | CloseNotificationAction;
| ShowNotificationAction
| CloseNotificationAction;

View File

@ -11,9 +11,7 @@ export function fetchCCRates(symbols: string[] = []): interfaces.FetchCCRates {
} }
export type TFetchCCRatesSucceeded = typeof fetchCCRatesSucceeded; export type TFetchCCRatesSucceeded = typeof fetchCCRatesSucceeded;
export function fetchCCRatesSucceeded( export function fetchCCRatesSucceeded(payload: CCResponse): interfaces.FetchCCRatesSucceeded {
payload: CCResponse
): interfaces.FetchCCRatesSucceeded {
return { return {
type: TypeKeys.RATES_FETCH_CC_SUCCEEDED, type: TypeKeys.RATES_FETCH_CC_SUCCEEDED,
payload payload

View File

@ -17,7 +17,4 @@ export interface FetchCCRatesFailed {
} }
/*** Union Type ***/ /*** Union Type ***/
export type RatesAction = export type RatesAction = FetchCCRates | FetchCCRatesSucceeded | FetchCCRatesFailed;
| FetchCCRates
| FetchCCRatesSucceeded
| FetchCCRatesFailed;

View File

@ -25,23 +25,19 @@ export default class AlphaAgreement extends React.Component<{}, State> {
<div className="AlphaAgreement-content"> <div className="AlphaAgreement-content">
<h2>This is an Unstable Version of MEW</h2> <h2>This is an Unstable Version of MEW</h2>
<p> <p>
You are about to access an alpha version of MyEtherWallet that is You are about to access an alpha version of MyEtherWallet that is currently in
currently in development. In its current state, it should only be development. In its current state, it should only be used for testing, not for important
used for testing, not for important transactions. transactions.
</p> </p>
<p> <p>
Any wallets you generate should not hold a significant value, and Any wallets you generate should not hold a significant value, and any transactions you
any transactions you make should be for small amounts. MEW does not make should be for small amounts. MEW does not claim responsibility for any issues that
claim responsibility for any issues that happen while using the happen while using the alpha version.
alpha version.
</p> </p>
<p>Are you sure you would like to continue?</p> <p>Are you sure you would like to continue?</p>
<div className="AlphaAgreement-content-buttons"> <div className="AlphaAgreement-content-buttons">
<button <button className="AlphaAgreement-content-buttons-btn is-reject" onClick={this.reject}>
className="AlphaAgreement-content-buttons-btn is-reject"
onClick={this.reject}
>
No, Take Me to v3 No, Take Me to v3
</button> </button>
<button <button

View File

@ -1,30 +1,20 @@
import { BlockExplorerConfig } from 'config/data'; import { BlockExplorerConfig } from 'config/data';
import React from 'react'; import React from 'react';
import {translateRaw} from 'translations'; import { translateRaw } from 'translations';
export interface TransactionSucceededProps { export interface TransactionSucceededProps {
txHash: string; txHash: string;
blockExplorer: BlockExplorerConfig; blockExplorer: BlockExplorerConfig;
} }
const TransactionSucceeded = ({ const TransactionSucceeded = ({ txHash, blockExplorer }: TransactionSucceededProps) => {
txHash,
blockExplorer
}: TransactionSucceededProps) => {
// const checkTxLink = `https://www.myetherwallet.com?txHash=${txHash}/#check-tx-status`; // const checkTxLink = `https://www.myetherwallet.com?txHash=${txHash}/#check-tx-status`;
const txHashLink = blockExplorer.tx(txHash); const txHashLink = blockExplorer.tx(txHash);
return ( return (
<div> <div>
<p> <p>{translateRaw('SUCCESS_3') + txHash}</p>
{translateRaw('SUCCESS_3') + txHash} <a className="btn btn-xs btn-info string" href={txHashLink} target="_blank" rel="noopener">
</p>
<a
className="btn btn-xs btn-info string"
href={txHashLink}
target="_blank"
rel="noopener"
>
Verify Transaction Verify Transaction
</a> </a>
</div> </div>

View File

@ -6,9 +6,9 @@ const PreFooter = () => {
<section className="pre-footer"> <section className="pre-footer">
<div className="container"> <div className="container">
<p> <p>
MyEtherWallet.com does not hold your keys for you. We cannot access MyEtherWallet.com does not hold your keys for you. We cannot access accounts, recover
accounts, recover keys, reset passwords, nor reverse transactions. keys, reset passwords, nor reverse transactions. Protect your keys &amp; always check that
Protect your keys &amp; always check that you are on correct URL. you are on correct URL.
<a href="#"> You are responsible for your security.</a> <a href="#"> You are responsible for your security.</a>
</p> </p>
</div> </div>

View File

@ -139,9 +139,7 @@ export default class PaperWallet extends React.Component<Props, {}> {
<div style={{ float: 'left' }}> <div style={{ float: 'left' }}>
<Identicon address={address} size={'42px'} /> <Identicon address={address} size={'42px'} />
</div> </div>
<p style={styles.identiconText}> <p style={styles.identiconText}>Always look for this icon when sending to this wallet</p>
Always look for this icon when sending to this wallet
</p>
</div> </div>
</div> </div>
); );

View File

@ -42,21 +42,14 @@ export default class KeystoreDecrypt extends Component {
onChange={this.handleFileSelection} onChange={this.handleFileSelection}
/> />
<label htmlFor="fselector" style={{ width: '100%' }}> <label htmlFor="fselector" style={{ width: '100%' }}>
<a <a className="btn btn-default btn-block" id="aria1" tabIndex={0} role="button">
className="btn btn-default btn-block"
id="aria1"
tabIndex={0}
role="button"
>
{translate('ADD_Radio_2_short')} {translate('ADD_Radio_2_short')}
</a> </a>
</label> </label>
<div className={file.length && passReq ? '' : 'hidden'}> <div className={file.length && passReq ? '' : 'hidden'}>
<p>{translate('ADD_Label_3')}</p> <p>{translate('ADD_Label_3')}</p>
<input <input
className={`form-control ${ className={`form-control ${password.length > 0 ? 'is-valid' : 'is-invalid'}`}
password.length > 0 ? 'is-valid' : 'is-invalid'
}`}
value={password} value={password}
onChange={this.onPasswordChange} onChange={this.onPasswordChange}
onKeyDown={this.onKeyDown} onKeyDown={this.onKeyDown}

View File

@ -84,18 +84,14 @@ export class WalletDecrypt extends Component<Props, State> {
password: '' password: ''
}, },
unlock: this.props.unlockKeystore, unlock: this.props.unlockKeystore,
helpLink: `${ helpLink: `${knowledgeBaseURL}/private-keys-passwords/difference-beween-private-key-and-keystore-file.html`
knowledgeBaseURL
}/private-keys-passwords/difference-beween-private-key-and-keystore-file.html`
}, },
'mnemonic-phrase': { 'mnemonic-phrase': {
lid: 'x_Mnemonic', lid: 'x_Mnemonic',
component: MnemonicDecrypt, component: MnemonicDecrypt,
initialParams: {}, initialParams: {},
unlock: this.props.unlockMnemonic, unlock: this.props.unlockMnemonic,
helpLink: `${ helpLink: `${knowledgeBaseURL}/private-keys-passwords/difference-beween-private-key-and-keystore-file.html`
knowledgeBaseURL
}/private-keys-passwords/difference-beween-private-key-and-keystore-file.html`
}, },
'private-key': { 'private-key': {
lid: 'x_PrivKey2', lid: 'x_PrivKey2',
@ -105,9 +101,7 @@ export class WalletDecrypt extends Component<Props, State> {
password: '' password: ''
}, },
unlock: this.props.unlockPrivateKey, unlock: this.props.unlockPrivateKey,
helpLink: `${ helpLink: `${knowledgeBaseURL}/private-keys-passwords/difference-beween-private-key-and-keystore-file.html`
knowledgeBaseURL
}/private-keys-passwords/difference-beween-private-key-and-keystore-file.html`
}, },
'view-only': { 'view-only': {
lid: 'View with Address Only', lid: 'View with Address Only',

View File

@ -17,9 +17,7 @@ export const withConditional = <WrappedComponentProps extends {}>(
public render() { public render() {
const { condition, conditionalProps, ...passedProps } = this.props as any; const { condition, conditionalProps, ...passedProps } = this.props as any;
return condition ? ( return condition ? (
<PassedComponent <PassedComponent {...{ ...passedProps, ...(conditionalProps as object) }} />
{...{ ...passedProps, ...(conditionalProps as object) }}
/>
) : ( ) : (
<PassedComponent {...passedProps} /> <PassedComponent {...passedProps} />
); );

View File

@ -8,8 +8,6 @@ interface Props {
export const GasQuery: React.SFC<Props> = ({ withQuery }) => ( export const GasQuery: React.SFC<Props> = ({ withQuery }) => (
<Query <Query
params={['limit', 'gaslimit']} params={['limit', 'gaslimit']}
withQuery={({ limit, gaslimit }) => withQuery={({ limit, gaslimit }) => withQuery({ gasLimit: limit || gaslimit })}
withQuery({ gasLimit: limit || gaslimit })
}
/> />
); );

View File

@ -14,16 +14,12 @@ class TokenQueryClass extends Component<Props, {}> {
return ( return (
<Query <Query
params={['tokenSymbol']} params={['tokenSymbol']}
withQuery={({ tokenSymbol }) => withQuery={({ tokenSymbol }) => this.props.withQuery(this.paramGetter(tokenSymbol))}
this.props.withQuery(this.paramGetter(tokenSymbol))
}
/> />
); );
} }
private paramGetter = (unit: string | null) => private paramGetter = (unit: string | null) =>
unit unit ? { token: this.props.tokens.find(t => t.symbol === unit) } : { token: null };
? { token: this.props.tokens.find(t => t.symbol === unit) }
: { token: null };
} }
export const TokenQuery = connect((state: AppState) => ({ export const TokenQuery = connect((state: AppState) => ({

View File

@ -5,21 +5,11 @@ interface Props {
whenQueryExists: React.ReactElement<any> | null; whenQueryExists: React.ReactElement<any> | null;
} }
const params: Param[] = [ const params: Param[] = ['to', 'data', 'tokenSymbol', 'value', 'gaslimit', 'limit', 'readOnly'];
'to',
'data',
'tokenSymbol',
'value',
'gaslimit',
'limit',
'readOnly'
];
export const WhenQueryExists: React.SFC<Props> = ({ whenQueryExists }) => ( export const WhenQueryExists: React.SFC<Props> = ({ whenQueryExists }) => (
<Query <Query
params={params} params={params}
withQuery={queries => withQuery={queries => (Object.values(queries).some(v => !!v) ? whenQueryExists : null)}
Object.values(queries).some(v => !!v) ? whenQueryExists : null
}
/> />
); );

View File

@ -58,16 +58,14 @@ export default class ColorDropdown<T> extends Component<Props<T>, {}> {
private renderOptions = () => { private renderOptions = () => {
const { options, value, menuAlign, extra } = this.props; const { options, value, menuAlign, extra } = this.props;
const listItems = options const listItems = options.filter(opt => !opt.hidden).reduce((prev: any[], opt) => {
.filter(opt => !opt.hidden) const prevOpt = prev.length ? prev[prev.length - 1] : null;
.reduce((prev: any[], opt) => { if (prevOpt && !prevOpt.divider && prevOpt.color !== opt.color) {
const prevOpt = prev.length ? prev[prev.length - 1] : null; prev.push({ divider: true });
if (prevOpt && !prevOpt.divider && prevOpt.color !== opt.color) { }
prev.push({ divider: true }); prev.push(opt);
} return prev;
prev.push(opt); }, []);
return prev;
}, []);
const menuClass = classnames({ const menuClass = classnames({
ColorDropdown: true, ColorDropdown: true,
@ -82,11 +80,7 @@ export default class ColorDropdown<T> extends Component<Props<T>, {}> {
return <li key={i} role="separator" className="divider" />; return <li key={i} role="separator" className="divider" />;
} else { } else {
return ( return (
<li <li key={i} className="ColorDropdown-item" style={{ borderColor: option.color }}>
key={i}
className="ColorDropdown-item"
style={{ borderColor: option.color }}
>
<a <a
className={option.value === value ? 'active' : ''} className={option.value === value ? 'active' : ''}
onClick={this.onChange.bind(null, option.value)} onClick={this.onChange.bind(null, option.value)}
@ -118,10 +112,7 @@ export default class ColorDropdown<T> extends Component<Props<T>, {}> {
} }
}; };
private onRemove( private onRemove(onRemove: () => void, ev?: React.SyntheticEvent<HTMLButtonElement>) {
onRemove: () => void,
ev?: React.SyntheticEvent<HTMLButtonElement>
) {
if (ev) { if (ev) {
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); ev.stopPropagation();

View File

@ -1,7 +1,5 @@
import React from 'react'; import React from 'react';
import { withConditional } from 'components/hocs'; import { withConditional } from 'components/hocs';
const Input: React.SFC<React.InputHTMLAttributes<any>> = props => ( const Input: React.SFC<React.InputHTMLAttributes<any>> = props => <input {...props} />;
<input {...props} />
);
export const ConditionalInput = withConditional(Input); export const ConditionalInput = withConditional(Input);

View File

@ -35,21 +35,9 @@ export default class DropdownComponent extends Component<Props, State> {
} }
public render() { public render() {
const { const { ariaLabel, color, disabled, size, renderOptions, renderLabel } = this.props;
ariaLabel,
color,
disabled,
size,
renderOptions,
renderLabel
} = this.props;
const { expanded } = this.state; const { expanded } = this.state;
const toggleClasses = classnames([ const toggleClasses = classnames(['dropdown-toggle', 'btn', `btn-${color}`, `btn-${size}`]);
'dropdown-toggle',
'btn',
`btn-${color}`,
`btn-${size}`
]);
return ( return (
<span <span

View File

@ -12,14 +12,7 @@ const Spinner = ({ size = 'x1', light = false }: SpinnerProps) => {
const color = light ? 'Spinner-light' : 'Spinner-dark'; const color = light ? 'Spinner-light' : 'Spinner-dark';
return ( return (
<svg className={`Spinner Spinner-${size} ${color}`} viewBox="0 0 50 50"> <svg className={`Spinner Spinner-${size} ${color}`} viewBox="0 0 50 50">
<circle <circle className="path" cx="25" cy="25" r="20" fill="none" strokeWidth="5" />
className="path"
cx="25"
cy="25"
r="20"
fill="none"
strokeWidth="5"
/>
</svg> </svg>
); );
}; };

View File

@ -35,14 +35,7 @@ const EXPANSE = {
const TREZOR = [ETH_TREZOR, ETC_TREZOR, TESTNET]; const TREZOR = [ETH_TREZOR, ETC_TREZOR, TESTNET];
const MNEMONIC = [ const MNEMONIC = [ETH_DEFAULT, ETH_LEDGER, ETC_LEDGER, ETC_TREZOR, TESTNET, EXPANSE];
ETH_DEFAULT,
ETH_LEDGER,
ETC_LEDGER,
ETC_TREZOR,
TESTNET,
EXPANSE
];
const LEDGER = [ETH_LEDGER, ETC_LEDGER, TESTNET]; const LEDGER = [ETH_LEDGER, ETC_LEDGER, TESTNET];

View File

@ -21,11 +21,7 @@ export default class NotificationRow extends Component<Props, {}> {
<div className={notifClass} role="alert" aria-live="assertive"> <div className={notifClass} role="alert" aria-live="assertive">
<span className="sr-only">{level}</span> <span className="sr-only">{level}</span>
<div className="Notification-message">{msg}</div> <div className="Notification-message">{msg}</div>
<button <button className="Notification-close" aria-label="dismiss" onClick={this.onClose} />
className="Notification-close"
aria-label="dismiss"
onClick={this.onClose}
/>
</div> </div>
); );
} }

View File

@ -1,8 +1,4 @@
import { import { closeNotification, Notification, TCloseNotification } from 'actions/notifications';
closeNotification,
Notification,
TCloseNotification
} from 'actions/notifications';
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { TransitionGroup, CSSTransition } from 'react-transition-group'; import { TransitionGroup, CSSTransition } from 'react-transition-group';
@ -29,10 +25,7 @@ export class Notifications extends React.Component<Props, {}> {
{this.props.notifications.map(n => { {this.props.notifications.map(n => {
return ( return (
<Transition key={n.id}> <Transition key={n.id}>
<NotificationRow <NotificationRow notification={n} onClose={this.props.closeNotification} />
notification={n}
onClose={this.props.closeNotification}
/>
</Transition> </Transition>
); );
})} })}

View File

@ -1,44 +1,28 @@
import React from 'react'; import React from 'react';
import { HeaderProps, ListProps, NodeProps, NodeState } from './types'; import { HeaderProps, ListProps, NodeProps, NodeState } from './types';
const InfoHeader = ({ children, onClickHandler }: HeaderProps) => const InfoHeader = ({ children, onClickHandler }: HeaderProps) => (
<h6 onClick={onClickHandler}> <h6 onClick={onClickHandler}>
<span>+</span> {children} <span>+</span> {children}
</h6>; </h6>
);
const InfoList = ({ children, isOpen }: ListProps) => const InfoList = ({ children, isOpen }: ListProps) => (isOpen ? <ul>{children}</ul> : null);
isOpen
? <ul>
{children}
</ul>
: null;
export default class GeneralInfoNode extends React.Component< export default class GeneralInfoNode extends React.Component<NodeProps, NodeState> {
NodeProps,
NodeState
> {
public state = { public state = {
isOpen: false isOpen: false
}; };
public toggleVisibility = () => public toggleVisibility = () => this.setState(prevState => ({ isOpen: !prevState.isOpen }));
this.setState(prevState => ({ isOpen: !prevState.isOpen }));
public render() { public render() {
const { const { toggleVisibility, props: { innerList, headerContent }, state: { isOpen } } = this;
toggleVisibility,
props: { innerList, headerContent },
state: { isOpen }
} = this;
return ( return (
<section> <section>
<InfoHeader onClickHandler={toggleVisibility}> <InfoHeader onClickHandler={toggleVisibility}>{headerContent}</InfoHeader>
{headerContent} <InfoList isOpen={isOpen}>{innerList}</InfoList>
</InfoHeader>
<InfoList isOpen={isOpen}>
{innerList}
</InfoList>
</section> </section>
); );
} }

View File

@ -2,23 +2,23 @@ import { NewTabLink } from 'components/ui';
import React from 'react'; import React from 'react';
import translate from 'translations'; import translate from 'translations';
const ENSDocsLink = () => const ENSDocsLink = () => (
<NewTabLink <NewTabLink
href="http://ens.readthedocs.io/en/latest/introduction.html" href="http://ens.readthedocs.io/en/latest/introduction.html"
content="Ethereum Name Service" content="Ethereum Name Service"
/>; />
);
const ENSTitle = () => const ENSTitle = () => (
<article className="cont-md"> <article className="cont-md">
<h1 className="text-center"> <h1 className="text-center">{translate('NAV_ENS')}</h1>
{translate('NAV_ENS')}
</h1>
<p> <p>
The <ENSDocsLink /> is a distributed, open, and extensible naming system The <ENSDocsLink /> is a distributed, open, and extensible naming system based on the Ethereum
based on the Ethereum blockchain. Once you have a name, you can tell your blockchain. Once you have a name, you can tell your friends to send ETH to{' '}
friends to send ETH to <code>mewtopia.eth</code> instead of <code>mewtopia.eth</code> instead of
<code>0x7cB57B5A97eAbe942.....</code>. <code>0x7cB57B5A97eAbe942.....</code>.
</p> </p>
</article>; </article>
);
export default ENSTitle; export default ENSTitle;

View File

@ -28,9 +28,7 @@ const BROWSERS = [
const CryptoWarning: React.SFC<{}> = () => ( const CryptoWarning: React.SFC<{}> = () => (
<div className="Tab-content-pane"> <div className="Tab-content-pane">
<div className="CryptoWarning"> <div className="CryptoWarning">
<h2 className="CryptoWarning-title"> <h2 className="CryptoWarning-title">Your Browser Cannot Generate a Wallet</h2>
Your Browser Cannot Generate a Wallet
</h2>
<p className="CryptoWarning-text"> <p className="CryptoWarning-text">
{isMobile {isMobile
? ` ? `
@ -55,13 +53,8 @@ const CryptoWarning: React.SFC<{}> = () => (
className="CryptoWarning-browsers-browser" className="CryptoWarning-browsers-browser"
> >
<div> <div>
<img <img className="CryptoWarning-browsers-browser-icon" src={browser.icon} />
className="CryptoWarning-browsers-browser-icon" <div className="CryptoWarning-browsers-browser-name">{browser.name}</div>
src={browser.icon}
/>
<div className="CryptoWarning-browsers-browser-name">
{browser.name}
</div>
</div> </div>
</NewTabLink> </NewTabLink>
))} ))}

View File

@ -104,9 +104,7 @@ export default class DownloadWallet extends Component<Props, State> {
</li> </li>
<li> <li>
<NewTabLink <NewTabLink
href={`${ href={`${knowledgeBaseURL}/private-keys-passwords/difference-beween-private-key-and-keystore-file`}
knowledgeBaseURL
}/private-keys-passwords/difference-beween-private-key-and-keystore-file`}
> >
<strong>{translate('GEN_Help_14')}</strong> <strong>{translate('GEN_Help_14')}</strong>
</NewTabLink> </NewTabLink>

View File

@ -66,9 +66,7 @@ const help = (
</li> </li>
<li> <li>
<NewTabLink <NewTabLink
href={`${ href={`${knowledgeBaseURL}/private-keys-passwords/difference-beween-private-key-and-keystore-file`}
knowledgeBaseURL
}/private-keys-passwords/difference-beween-private-key-and-keystore-file`}
> >
<strong>{translate('GEN_Help_16')}</strong> <strong>{translate('GEN_Help_16')}</strong>
</NewTabLink> </NewTabLink>

View File

@ -12,15 +12,11 @@ export default class GenerateWalletTemplate extends React.Component<Props, {}> {
return ( return (
<div className="GenerateWallet row"> <div className="GenerateWallet row">
<div className="GenerateWallet-column col-md-9"> <div className="GenerateWallet-column col-md-9">
<main className="GenerateWallet-column-content Tab-content-pane"> <main className="GenerateWallet-column-content Tab-content-pane">{content}</main>
{content}
</main>
</div> </div>
<div className="GenerateWallet-column col-md-3"> <div className="GenerateWallet-column col-md-3">
<aside className="GenerateWallet-column-help Tab-content-pane"> <aside className="GenerateWallet-column-help Tab-content-pane">{help}</aside>
{help}
</aside>
</div> </div>
</div> </div>
); );

View File

@ -15,16 +15,13 @@ export default class Donate extends React.Component<Props, State> {
public render() { public render() {
return ( return (
<div className="well"> <div className="well">
<p> <p>{translate('sidebar_donation')}</p>
{translate('sidebar_donation')}
</p>
<a className="btn btn-primary btn-block" onClick={this.onClick}> <a className="btn btn-primary btn-block" onClick={this.onClick}>
{translate('sidebar_donate')} {translate('sidebar_donate')}
</a> </a>
{this.state.clicked && {this.state.clicked && (
<div className="text-success text-center marg-v-sm"> <div className="text-success text-center marg-v-sm">{translate('sidebar_thanks')}</div>
{translate('sidebar_thanks')} )}
</div>}
</div> </div>
); );
} }

View File

@ -14,10 +14,7 @@ interface Props {
export default class SignMessageButton extends React.Component<Props, {}> { export default class SignMessageButton extends React.Component<Props, {}> {
public render() { public render() {
return ( return (
<button <button className="SignMessage-sign btn btn-primary btn-lg" onClick={this.handleSignMessage}>
className="SignMessage-sign btn btn-primary btn-lg"
onClick={this.handleSignMessage}
>
{translate('NAV_SignMsg')} {translate('NAV_SignMsg')}
</button> </button>
); );

View File

@ -9,34 +9,21 @@ export interface SwapInfoHeaderTitleProps {
restartSwap(): RestartSwapAction; restartSwap(): RestartSwapAction;
} }
export default class SwapInfoHeaderTitle extends Component< export default class SwapInfoHeaderTitle extends Component<SwapInfoHeaderTitleProps, {}> {
SwapInfoHeaderTitleProps,
{}
> {
public render() { public render() {
return ( return (
<section className="SwapInfo-top row text-center"> <section className="SwapInfo-top row text-center">
<div className="col-xs-3 text-left"> <div className="col-xs-3 text-left">
<button <button className="SwapInfo-top-back" onClick={this.props.restartSwap}>
className="SwapInfo-top-back"
onClick={this.props.restartSwap}
>
<i className="fa fa-arrow-left" /> <i className="fa fa-arrow-left" />
Start New Swap Start New Swap
</button> </button>
</div> </div>
<div className="col-xs-6"> <div className="col-xs-6">
<h3 className="SwapInfo-top-title"> <h3 className="SwapInfo-top-title">{translate('SWAP_information')}</h3>
{translate('SWAP_information')}
</h3>
</div> </div>
<div className="col-xs-3"> <div className="col-xs-3">
<a <a className="SwapInfo-top-logo" href={bityReferralURL} target="_blank" rel="noopener">
className="SwapInfo-top-logo"
href={bityReferralURL}
target="_blank"
rel="noopener"
>
<img className="SwapInfo-top-logo-img" src={bityLogo} /> <img className="SwapInfo-top-logo-img" src={bityLogo} />
</a> </a>
</div> </div>

View File

@ -17,11 +17,7 @@ const start = async () => {
const { frozen } = JSON.parse(packageStr); const { frozen } = JSON.parse(packageStr);
if (frozen === undefined) { if (frozen === undefined) {
console.log( console.log(`Freezer: No config found in package.json on branch ${ORACLE_BRANCH}. Exiting.`);
`Freezer: No config found in package.json on branch ${
ORACLE_BRANCH
}. Exiting.`
);
return; return;
} }
@ -119,11 +115,7 @@ const validateConfig = () => {
const { frozen } = JSON.parse(fs.readFileSync(packagePath, 'utf8')); const { frozen } = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
if (frozen === undefined) { if (frozen === undefined) {
console.log( console.log(`Freezer: No config found in package.json on branch ${ORACLE_BRANCH}. Exiting.`);
`Freezer: No config found in package.json on branch ${
ORACLE_BRANCH
}. Exiting.`
);
return; return;
} }

View File

@ -20,10 +20,10 @@ export interface Input {
export type Output = Input; export type Output = Input;
/** /**
* *
* @export * @export
* @interface ABIFunction * @interface ABIFunction
* @template T * @template T
*/ */
export interface ContractOutputMappings { export interface ContractOutputMappings {
[key: string]: string[]; [key: string]: string[];

View File

@ -13,10 +13,7 @@ export function decryptPrivKey(encprivkey: string, password: string): Buffer {
ivsize: 16 ivsize: 16
}); });
const decipher = createDecipheriv('aes-256-cbc', evp.key, evp.iv); const decipher = createDecipheriv('aes-256-cbc', evp.key, evp.iv);
const privKey = decipherBuffer( const privKey = decipherBuffer(decipher, new Buffer(decryptedCipher.ciphertext));
decipher,
new Buffer(decryptedCipher.ciphertext)
);
return new Buffer(privKey.toString(), 'hex'); return new Buffer(privKey.toString(), 'hex');
} }

View File

@ -14,10 +14,7 @@ export interface INode {
ping(): Promise<boolean>; ping(): Promise<boolean>;
getBalance(address: string): Promise<Wei>; getBalance(address: string): Promise<Wei>;
getTokenBalance(address: string, token: Token): Promise<TokenBalanceResult>; getTokenBalance(address: string, token: Token): Promise<TokenBalanceResult>;
getTokenBalances( getTokenBalances(address: string, tokens: Token[]): Promise<TokenBalanceResult[]>;
address: string,
tokens: Token[]
): Promise<TokenBalanceResult[]>;
estimateGas(tx: Partial<IHexStrTransaction>): Promise<Wei>; estimateGas(tx: Partial<IHexStrTransaction>): Promise<Wei>;
getTransactionCount(address: string): Promise<string>; getTransactionCount(address: string): Promise<string>;
sendRawTx(tx: string): Promise<string>; sendRawTx(tx: string): Promise<string>;

View File

@ -58,10 +58,7 @@ export default class EtherscanRequests extends RPCRequests {
}; };
} }
public getTokenBalance( public getTokenBalance(address: string, token: Token): GetTokenBalanceRequest {
address: string,
token: Token
): GetTokenBalanceRequest {
return this.ethCall({ return this.ethCall({
to: token.address, to: token.address,
data: ERC20.balanceOf.encodeInput({ _owner: address }) data: ERC20.balanceOf.encodeInput({ _owner: address })

View File

@ -44,19 +44,14 @@ export default class RPCRequests {
}; };
} }
public getTransactionCount( public getTransactionCount(address: string): GetTransactionCountRequest | any {
address: string
): GetTransactionCountRequest | any {
return { return {
method: 'eth_getTransactionCount', method: 'eth_getTransactionCount',
params: [address, 'pending'] params: [address, 'pending']
}; };
} }
public getTokenBalance( public getTokenBalance(address: string, token: Token): GetTokenBalanceRequest | any {
address: string,
token: Token
): GetTokenBalanceRequest | any {
return { return {
method: 'eth_call', method: 'eth_call',
params: [ params: [

View File

@ -39,23 +39,15 @@ export interface ISignedMessage {
// adapted from: // adapted from:
// https://github.com/kvhnuke/etherwallet/blob/2a5bc0db1c65906b14d8c33ce9101788c70d3774/app/scripts/controllers/signMsgCtrl.js#L118 // https://github.com/kvhnuke/etherwallet/blob/2a5bc0db1c65906b14d8c33ce9101788c70d3774/app/scripts/controllers/signMsgCtrl.js#L118
export function verifySignedMessage({ export function verifySignedMessage({ address, message, signature, version }: ISignedMessage) {
address,
message,
signature,
version
}: ISignedMessage) {
const sig = new Buffer(stripHexPrefixAndLower(signature), 'hex'); const sig = new Buffer(stripHexPrefixAndLower(signature), 'hex');
if (sig.length !== 65) { if (sig.length !== 65) {
return false; return false;
} }
//TODO: explain what's going on here //TODO: explain what's going on here
sig[64] = sig[64] === 0 || sig[64] === 1 ? sig[64] + 27 : sig[64]; sig[64] = sig[64] === 0 || sig[64] === 1 ? sig[64] + 27 : sig[64];
const hash = const hash = version === '2' ? hashPersonalMessage(toBuffer(message)) : sha3(message);
version === '2' ? hashPersonalMessage(toBuffer(message)) : sha3(message);
const pubKey = ecrecover(hash, sig[64], sig.slice(0, 32), sig.slice(32, 64)); const pubKey = ecrecover(hash, sig[64], sig.slice(0, 32), sig.slice(32, 64));
return ( return stripHexPrefixAndLower(address) === pubToAddress(pubKey).toString('hex');
stripHexPrefixAndLower(address) === pubToAddress(pubKey).toString('hex')
);
} }

View File

@ -54,22 +54,18 @@ export class LedgerWallet extends DeterministicWallet implements IFullWallet {
const msgHex = Buffer.from(msg).toString('hex'); const msgHex = Buffer.from(msg).toString('hex');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.ethApp.signPersonalMessage_async( this.ethApp.signPersonalMessage_async(this.getPath(), msgHex, async (signed, error) => {
this.getPath(), if (error) {
msgHex, return reject(this.ethApp.getError(error));
async (signed, error) => {
if (error) {
return reject(this.ethApp.getError(error));
}
try {
const combined = signed.r + signed.s + signed.v;
resolve(bufferToHex(combined));
} catch (err) {
reject(err);
}
} }
);
try {
const combined = signed.r + signed.s + signed.v;
resolve(bufferToHex(combined));
} catch (err) {
reject(err);
}
});
}); });
} }
} }

View File

@ -2,12 +2,5 @@ import { decryptMnemonicToPrivKey } from 'libs/decrypt';
import { fromPrivateKey } from 'ethereumjs-wallet'; import { fromPrivateKey } from 'ethereumjs-wallet';
import { signWrapper } from 'libs/wallet'; import { signWrapper } from 'libs/wallet';
export const MnemonicWallet = ( export const MnemonicWallet = (phrase: string, pass: string, path: string, address: string) =>
phrase: string, signWrapper(fromPrivateKey(decryptMnemonicToPrivKey(phrase, pass, path, address)));
pass: string,
path: string,
address: string
) =>
signWrapper(
fromPrivateKey(decryptMnemonicToPrivKey(phrase, pass, path, address))
);

View File

@ -15,10 +15,7 @@ export class TrezorWallet extends DeterministicWallet implements IFullWallet {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const { chainId, ...strTx } = getTransactionFields(tx); const { chainId, ...strTx } = getTransactionFields(tx);
// stripHexPrefixAndLower identical to ethFuncs.getNakedAddress // stripHexPrefixAndLower identical to ethFuncs.getNakedAddress
const cleanedTx = mapValues( const cleanedTx = mapValues(mapValues(strTx, stripHexPrefixAndLower), padLeftEven);
mapValues(strTx, stripHexPrefixAndLower),
padLeftEven
);
(TrezorConnect as any).ethereumSignTx( (TrezorConnect as any).ethereumSignTx(
// Args // Args
@ -52,8 +49,7 @@ export class TrezorWallet extends DeterministicWallet implements IFullWallet {
}); });
} }
public signMessage = () => public signMessage = () => Promise.reject(new Error('Signing via Trezor not yet supported.'));
Promise.reject(new Error('Signing via Trezor not yet supported.'));
// works, but returns a signature that can only be verified with a Trezor device // works, but returns a signature that can only be verified with a Trezor device
/* /*

View File

@ -27,10 +27,8 @@ export type WrappedWallet = IFullWallet & ISignWrapper;
export const signWrapper = (walletToWrap: IFullWallet): WrappedWallet => export const signWrapper = (walletToWrap: IFullWallet): WrappedWallet =>
Object.assign(walletToWrap, { Object.assign(walletToWrap, {
signRawTransaction: (t: Tx) => signRawTransaction: (t: Tx) => signRawTxWithPrivKey(walletToWrap.getPrivateKey(), t),
signRawTxWithPrivKey(walletToWrap.getPrivateKey(), t), signMessage: (msg: string) => signMessageWithPrivKeyV2(walletToWrap.getPrivateKey(), msg),
signMessage: (msg: string) =>
signMessageWithPrivKeyV2(walletToWrap.getPrivateKey(), msg),
unlock: () => Promise.resolve() unlock: () => Promise.resolve()
}); });

View File

@ -5,10 +5,8 @@ import { decryptPrivKey } from 'libs/decrypt';
import Web3Wallet from './web3'; import Web3Wallet from './web3';
import AddressOnlyWallet from './address'; import AddressOnlyWallet from './address';
const EncryptedPrivateKeyWallet = ( const EncryptedPrivateKeyWallet = (encryptedPrivateKey: string, password: string) =>
encryptedPrivateKey: string, signWrapper(fromPrivateKey(decryptPrivKey(encryptedPrivateKey, password)));
password: string
) => signWrapper(fromPrivateKey(decryptPrivKey(encryptedPrivateKey, password)));
const PresaleWallet = (keystore: string, password: string) => const PresaleWallet = (keystore: string, password: string) =>
signWrapper(fromEthSale(keystore, password)); signWrapper(fromEthSale(keystore, password));

View File

@ -70,9 +70,9 @@ export default class Web3Wallet implements IFullWallet {
const netName = networkIdToName(netId); const netName = networkIdToName(netId);
if (this.network !== netName) { if (this.network !== netName) {
throw new Error( throw new Error(
`Expected MetaMask / Mist network to be ${this.network}, but got ${ `Expected MetaMask / Mist network to be ${
netName this.network
}. Please change the network or restart MyEtherWallet.` }, but got ${netName}. Please change the network or restart MyEtherWallet.`
); );
} }
} }

View File

@ -17,17 +17,11 @@ function addCustomToken(state: State, action: AddCustomTokenAction): State {
return [...state, action.payload]; return [...state, action.payload];
} }
function removeCustomToken( function removeCustomToken(state: State, action: RemoveCustomTokenAction): State {
state: State,
action: RemoveCustomTokenAction
): State {
return state.filter(token => token.symbol !== action.payload); return state.filter(token => token.symbol !== action.payload);
} }
export function customTokens( export function customTokens(state: State = INITIAL_STATE, action: CustomTokenAction): State {
state: State = INITIAL_STATE,
action: CustomTokenAction
): State {
switch (action.type) { switch (action.type) {
case TypeKeys.CUSTOM_TOKEN_ADD: case TypeKeys.CUSTOM_TOKEN_ADD:
return addCustomToken(state, action); return addCustomToken(state, action);

View File

@ -1,7 +1,4 @@
import { import { DeterministicWalletAction, DeterministicWalletData } from 'actions/deterministicWallets';
DeterministicWalletAction,
DeterministicWalletData
} from 'actions/deterministicWallets';
import { TypeKeys } from 'actions/deterministicWallets/constants'; import { TypeKeys } from 'actions/deterministicWallets/constants';
export interface State { export interface State {

View File

@ -14,10 +14,7 @@ export const INITIAL_STATE: State = {
password: null password: null
}; };
export function generateWallet( export function generateWallet(state: State = INITIAL_STATE, action: GenerateWalletAction): State {
state: State = INITIAL_STATE,
action: GenerateWalletAction
): State {
switch (action.type) { switch (action.type) {
case TypeKeys.GENERATE_WALLET_GENERATE_WALLET: { case TypeKeys.GENERATE_WALLET_GENERATE_WALLET: {
return { return {

View File

@ -2,10 +2,7 @@ import { routerReducer } from 'react-router-redux';
import { combineReducers } from 'redux'; import { combineReducers } from 'redux';
import { config, State as ConfigState } from './config'; import { config, State as ConfigState } from './config';
import { customTokens, State as CustomTokensState } from './customTokens'; import { customTokens, State as CustomTokensState } from './customTokens';
import { import { deterministicWallets, State as DeterministicWalletsState } from './deterministicWallets';
deterministicWallets,
State as DeterministicWalletsState
} from './deterministicWallets';
import { ens, State as EnsState } from './ens'; import { ens, State as EnsState } from './ens';
import { generateWallet, State as GenerateWalletState } from './generateWallet'; import { generateWallet, State as GenerateWalletState } from './generateWallet';
import { notifications, State as NotificationsState } from './notifications'; import { notifications, State as NotificationsState } from './notifications';

View File

@ -19,10 +19,7 @@ function closeNotification(state, action: CloseNotificationAction): State {
return state; return state;
} }
export function notifications( export function notifications(state: State = INITIAL_STATE, action: NotificationsAction): State {
state: State = INITIAL_STATE,
action: NotificationsAction
): State {
switch (action.type) { switch (action.type) {
case TypeKeys.SHOW_NOTIFICATION: case TypeKeys.SHOW_NOTIFICATION:
return showNotification(state, action); return showNotification(state, action);

View File

@ -12,10 +12,7 @@ export const INITIAL_STATE: State = {
ratesError: null ratesError: null
}; };
function fetchCCRatesSucceeded( function fetchCCRatesSucceeded(state: State, action: FetchCCRatesSucceeded): State {
state: State,
action: FetchCCRatesSucceeded
): State {
return { return {
...state, ...state,
rates: { rates: {
@ -33,10 +30,7 @@ function fetchCCRatesFailed(state: State): State {
}; };
} }
export function rates( export function rates(state: State = INITIAL_STATE, action: RatesAction): State {
state: State = INITIAL_STATE,
action: RatesAction
): State {
switch (action.type) { switch (action.type) {
case TypeKeys.RATES_FETCH_CC_SUCCEEDED: case TypeKeys.RATES_FETCH_CC_SUCCEEDED:
return fetchCCRatesSucceeded(state, action); return fetchCCRatesSucceeded(state, action);

View File

@ -10,24 +10,14 @@ import { publicToAddress, toChecksumAddress } from 'ethereumjs-util';
import HDKey from 'hdkey'; import HDKey from 'hdkey';
import { INode } from 'libs/nodes/INode'; import { INode } from 'libs/nodes/INode';
import { SagaIterator } from 'redux-saga'; import { SagaIterator } from 'redux-saga';
import { import { all, apply, fork, put, select, takeEvery, takeLatest } from 'redux-saga/effects';
all,
apply,
fork,
put,
select,
takeEvery,
takeLatest
} from 'redux-saga/effects';
import { getNodeLib } from 'selectors/config'; import { getNodeLib } from 'selectors/config';
import { getDesiredToken, getWallets } from 'selectors/deterministicWallets'; import { getDesiredToken, getWallets } from 'selectors/deterministicWallets';
import { getTokens } from 'selectors/wallet'; import { getTokens } from 'selectors/wallet';
import translate from 'translations'; import translate from 'translations';
import { TokenValue } from 'libs/units'; import { TokenValue } from 'libs/units';
export function* getDeterministicWallets( export function* getDeterministicWallets(action: GetDeterministicWalletsAction): SagaIterator {
action: GetDeterministicWalletsAction
): SagaIterator {
const { seed, dPath, publicKey, chainCode, limit, offset } = action.payload; const { seed, dPath, publicKey, chainCode, limit, offset } = action.payload;
let pathBase; let pathBase;
let hdk; let hdk;

View File

@ -1,13 +1,8 @@
import { import { closeNotification, ShowNotificationAction } from 'actions/notifications';
closeNotification,
ShowNotificationAction
} from 'actions/notifications';
import { delay, SagaIterator } from 'redux-saga'; import { delay, SagaIterator } from 'redux-saga';
import { call, put, takeEvery } from 'redux-saga/effects'; import { call, put, takeEvery } from 'redux-saga/effects';
export function* handleNotification( export function* handleNotification(action: ShowNotificationAction): SagaIterator {
action: ShowNotificationAction
): SagaIterator {
const { duration } = action.payload; const { duration } = action.payload;
// show forever // show forever
if (duration === 0 || duration === Infinity) { if (duration === 0 || duration === Infinity) {

View File

@ -17,16 +17,7 @@ import moment from 'moment';
import { AppState } from 'reducers'; import { AppState } from 'reducers';
import { State as SwapState } from 'reducers/swap'; import { State as SwapState } from 'reducers/swap';
import { delay, SagaIterator } from 'redux-saga'; import { delay, SagaIterator } from 'redux-saga';
import { import { call, cancel, cancelled, fork, put, select, take, takeEvery } from 'redux-saga/effects';
call,
cancel,
cancelled,
fork,
put,
select,
take,
takeEvery
} from 'redux-saga/effects';
export const getSwap = (state: AppState): SwapState => state.swap; export const getSwap = (state: AppState): SwapState => state.swap;
const ONE_SECOND = 1000; const ONE_SECOND = 1000;
@ -45,13 +36,7 @@ export function* pollBityOrderStatus(): SagaIterator {
yield put(orderStatusRequestedSwap()); yield put(orderStatusRequestedSwap());
const orderStatus = yield call(getOrderStatus, swap.orderId); const orderStatus = yield call(getOrderStatus, swap.orderId);
if (orderStatus.error) { if (orderStatus.error) {
yield put( yield put(showNotification('danger', `Bity Error: ${orderStatus.msg}`, TEN_SECONDS));
showNotification(
'danger',
`Bity Error: ${orderStatus.msg}`,
TEN_SECONDS
)
);
} else { } else {
yield put(orderStatusSucceededSwap(orderStatus.data)); yield put(orderStatusSucceededSwap(orderStatus.data));
yield call(delay, ONE_SECOND * 5); yield call(delay, ONE_SECOND * 5);
@ -81,9 +66,7 @@ export function* pollBityOrderStatusSaga(): SagaIterator {
} }
} }
export function* postBityOrderCreate( export function* postBityOrderCreate(action: BityOrderCreateRequestedSwapAction): SagaIterator {
action: BityOrderCreateRequestedSwapAction
): SagaIterator {
const payload = action.payload; const payload = action.payload;
try { try {
yield put(stopLoadBityRatesSwap()); yield put(stopLoadBityRatesSwap());
@ -96,9 +79,7 @@ export function* postBityOrderCreate(
); );
if (order.error) { if (order.error) {
// TODO - handle better / like existing site? // TODO - handle better / like existing site?
yield put( yield put(showNotification('danger', `Bity Error: ${order.msg}`, TEN_SECONDS));
showNotification('danger', `Bity Error: ${order.msg}`, TEN_SECONDS)
);
yield put(bityOrderCreateFailedSwap()); yield put(bityOrderCreateFailedSwap());
} else { } else {
yield put(bityOrderCreateSucceededSwap(order.data)); yield put(bityOrderCreateSucceededSwap(order.data));
@ -127,9 +108,7 @@ export function* bityTimeRemaining(): SagaIterator {
yield call(delay, ONE_SECOND); yield call(delay, ONE_SECOND);
const swap = yield select(getSwap); const swap = yield select(getSwap);
// if (swap.bityOrder.status === 'OPEN') { // if (swap.bityOrder.status === 'OPEN') {
const createdTimeStampMoment = moment( const createdTimeStampMoment = moment(swap.orderTimestampCreatedISOString);
swap.orderTimestampCreatedISOString
);
const validUntil = moment(createdTimeStampMoment).add(swap.validFor, 's'); const validUntil = moment(createdTimeStampMoment).add(swap.validFor, 's');
const now = moment(); const now = moment();
if (validUntil.isAfter(now)) { if (validUntil.isAfter(now)) {
@ -145,9 +124,7 @@ export function* bityTimeRemaining(): SagaIterator {
yield put({ type: 'SWAP_STOP_LOAD_BITY_RATES' }); yield put({ type: 'SWAP_STOP_LOAD_BITY_RATES' });
if (!hasShownNotification) { if (!hasShownNotification) {
hasShownNotification = true; hasShownNotification = true;
yield put( yield put(showNotification('danger', BITY_TIMEOUT_MESSAGE, Infinity));
showNotification('danger', BITY_TIMEOUT_MESSAGE, Infinity)
);
} }
break; break;
case 'CANC': case 'CANC':
@ -155,17 +132,13 @@ export function* bityTimeRemaining(): SagaIterator {
yield put({ type: 'SWAP_STOP_LOAD_BITY_RATES' }); yield put({ type: 'SWAP_STOP_LOAD_BITY_RATES' });
if (!hasShownNotification) { if (!hasShownNotification) {
hasShownNotification = true; hasShownNotification = true;
yield put( yield put(showNotification('danger', BITY_TIMEOUT_MESSAGE, Infinity));
showNotification('danger', BITY_TIMEOUT_MESSAGE, Infinity)
);
} }
break; break;
case 'RCVE': case 'RCVE':
if (!hasShownNotification) { if (!hasShownNotification) {
hasShownNotification = true; hasShownNotification = true;
yield put( yield put(showNotification('warning', BITY_TIMEOUT_MESSAGE, Infinity));
showNotification('warning', BITY_TIMEOUT_MESSAGE, Infinity)
);
} }
break; break;
case 'FILL': case 'FILL':

View File

@ -27,27 +27,11 @@ declare module 'ethereumjs-util' {
export function zeros(bytes: number): Buffer; export function zeros(bytes: number): Buffer;
export function setLength( export function setLength(msg: Buffer, length: number, right: boolean): Buffer;
msg: Buffer, export function setLength(msg: number[], length: number, right: boolean): number[];
length: number,
right: boolean
): Buffer;
export function setLength(
msg: number[],
length: number,
right: boolean
): number[];
export function setLengthLeft( export function setLengthLeft(msg: Buffer, length: number, right: boolean): Buffer;
msg: Buffer, export function setLengthLeft(msg: number[], length: number, right: boolean): number[];
length: number,
right: boolean
): Buffer;
export function setLengthLeft(
msg: number[],
length: number,
right: boolean
): number[];
export function setLengthRight(msg: Buffer, length: number): Buffer; export function setLengthRight(msg: Buffer, length: number): Buffer;
export function setLengthRight(msg: number[], length: number): number[]; export function setLengthRight(msg: number[], length: number): number[];
@ -66,17 +50,11 @@ declare module 'ethereumjs-util' {
export function toUnsigned(num: BN): Buffer; export function toUnsigned(num: BN): Buffer;
export function sha3( export function sha3(a: Buffer | string | number | number[], bits?: number): Buffer;
a: Buffer | string | number | number[],
bits?: number
): Buffer;
export function sha256(a: Buffer | string | number | number[]): Buffer; export function sha256(a: Buffer | string | number | number[]): Buffer;
export function ripemd160( export function ripemd160(a: Buffer | string | number | number[], padded?: boolean): Buffer;
a: Buffer | string | number | number[],
padded?: boolean
): Buffer;
export function rlphash(a: Buffer | string | number | number[]): Buffer; export function rlphash(a: Buffer | string | number | number[]): Buffer;
@ -85,10 +63,7 @@ declare module 'ethereumjs-util' {
export function isValidPublic(publicKey: Buffer, sanitize?: boolean): boolean; export function isValidPublic(publicKey: Buffer, sanitize?: boolean): boolean;
export function pubToAddress(publicKey: Buffer, sanitize?: boolean): Buffer; export function pubToAddress(publicKey: Buffer, sanitize?: boolean): Buffer;
export function publicToAddress( export function publicToAddress(publicKey: Buffer, sanitize?: boolean): Buffer;
publicKey: Buffer,
sanitize?: boolean
): Buffer;
export function privateToPublic(privateKey: Buffer): Buffer; export function privateToPublic(privateKey: Buffer): Buffer;
@ -98,12 +73,7 @@ declare module 'ethereumjs-util' {
export function hashPersonalMessage(message: Buffer | string): Buffer; export function hashPersonalMessage(message: Buffer | string): Buffer;
export function ecrecover( export function ecrecover(msgHash: Buffer, v: number, r: Buffer, s: Buffer): Buffer;
msgHash: Buffer,
v: number,
r: Buffer,
s: Buffer
): Buffer;
export function toRpcSig(v: number, r: Buffer, s: Buffer): string; export function toRpcSig(v: number, r: Buffer, s: Buffer): string;

View File

@ -293,10 +293,7 @@ declare module 'ethereumjs-wallet' {
* @param input * @param input
* @param nonStrict * @param nonStrict
*/ */
function fromPublicKey( function fromPublicKey(input: Buffer, nonStrict?: boolean): IPublicKeyOnlyWallet;
input: Buffer,
nonStrict?: boolean
): IPublicKeyOnlyWallet;
/** /**
* @description create an instance based on a BIP32 extended public key (xpub) * @description create an instance based on a BIP32 extended public key (xpub)
@ -317,19 +314,12 @@ declare module 'ethereumjs-wallet' {
* @param password * @param password
* @param nonStrict * @param nonStrict
*/ */
function fromV3( function fromV3(input: IV3Wallet | string, password: string, nonStrict: boolean): IFullWallet;
input: IV3Wallet | string,
password: string,
nonStrict: boolean
): IFullWallet;
/** /**
* @description import an Ethereum Pre Sale wallet * @description import an Ethereum Pre Sale wallet
* @param input * @param input
* @param password * @param password
*/ */
function fromEthSale( function fromEthSale(input: IPresaleWallet | string, password: string): IFullWallet;
input: IPresaleWallet | string,
password: string
): IFullWallet;
} }

View File

@ -1,6 +1,4 @@
const isMobile = const isMobile =
window && window.navigator window && window.navigator ? /iPhone|iPad|iPod|Android/i.test(window.navigator.userAgent) : false;
? /iPhone|iPad|iPod|Android/i.test(window.navigator.userAgent)
: false;
export default isMobile; export default isMobile;

View File

@ -26,9 +26,7 @@ export function getNodeConfigFromId(
} }
} }
export function makeNodeConfigFromCustomConfig( export function makeNodeConfigFromCustomConfig(config: CustomNodeConfig): NodeConfig {
config: CustomNodeConfig
): NodeConfig {
return { return {
network: config.network, network: config.network,
lib: new CustomNode(config), lib: new CustomNode(config),

View File

@ -7,10 +7,7 @@ interface PrintOptions {
popupFeatures?: object; popupFeatures?: object;
} }
export default function( export default function(element: React.ReactElement<any>, opts: PrintOptions = {}) {
element: React.ReactElement<any>,
opts: PrintOptions = {}
) {
const options = { const options = {
styles: '', styles: '',
printTimeout: 500, printTimeout: 500,

View File

@ -134,11 +134,13 @@
"postinstall": "webpack --config=./webpack_config/webpack.dll.js", "postinstall": "webpack --config=./webpack_config/webpack.dll.js",
"start": "npm run dev", "start": "npm run dev",
"precommit": "lint-staged", "precommit": "lint-staged",
"formatAll":
"find ./common/ -name '*.ts*' | xargs prettier --write --config ./.prettierrc --config-precedence file-override",
"prepush": "npm run tslint && npm run tscheck" "prepush": "npm run tslint && npm run tscheck"
}, },
"lint-staged": { "lint-staged": {
"*.{ts,tsx}": [ "*.{ts,tsx}": [
"prettier --write", "prettier --write --config ./.prettierrc --config-precedence file-override",
"git add" "git add"
] ]
} }