From da93fb1684abcd5c853a30fa91d9792605a6ce4a Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Mon, 18 Dec 2017 18:29:26 -0500 Subject: [PATCH] Prettier Reformat (#619) * Add repo wide prettier command to prepush * Make config file explict, remove formatAll to prepush --- common/actions/customTokens/actionCreators.ts | 8 +--- .../deterministicWallets/actionCreators.ts | 4 +- .../actions/generateWallet/actionCreators.ts | 4 +- .../actions/notifications/actionCreators.ts | 4 +- common/actions/notifications/actionTypes.ts | 4 +- common/actions/rates/actionCreators.ts | 4 +- common/actions/rates/actionTypes.ts | 5 +- common/components/AlphaAgreement/index.tsx | 18 +++----- .../TransactionSucceeded.tsx | 18 ++------ common/components/Footer/PreFooter.tsx | 6 +-- common/components/PaperWallet/index.tsx | 4 +- common/components/WalletDecrypt/Keystore.tsx | 11 +---- common/components/WalletDecrypt/index.tsx | 12 ++--- common/components/hocs/Conditional.tsx | 4 +- common/components/renderCbs/GasQuery.tsx | 4 +- common/components/renderCbs/TokenQuery.tsx | 8 +--- .../components/renderCbs/WhenQueryExists.tsx | 14 +----- common/components/ui/ColorDropdown.tsx | 29 ++++-------- common/components/ui/ConditionalInput.tsx | 4 +- common/components/ui/DropdownShell.tsx | 16 +------ common/components/ui/Spinner.tsx | 9 +--- common/config/dpaths.ts | 9 +--- .../containers/TabSection/NotificationRow.tsx | 6 +-- .../containers/TabSection/Notifications.tsx | 11 +---- .../GeneralInfoPanel/GeneralInfoNode.tsx | 34 ++++---------- .../containers/Tabs/ENS/components/Title.tsx | 20 ++++---- .../components/CryptoWarning.tsx | 13 ++---- .../components/DownloadWallet.tsx | 4 +- .../GenerateWallet/components/PaperWallet.tsx | 4 +- .../GenerateWallet/components/Template.tsx | 8 +--- .../SendTransaction/components/Donate.tsx | 11 ++--- .../components/SignMessage/SignButton.tsx | 5 +- .../Swap/components/SwapInfoHeaderTitle.tsx | 21 ++------- common/freezer.ts | 12 +---- common/libs/contracts/types.ts | 4 +- common/libs/decrypt.ts | 5 +- common/libs/nodes/INode.ts | 5 +- common/libs/nodes/etherscan/requests.ts | 5 +- common/libs/nodes/rpc/requests.ts | 9 +--- common/libs/signing.ts | 14 ++---- common/libs/wallet/deterministic/ledger.ts | 26 +++++------ common/libs/wallet/deterministic/mnemonic.ts | 11 +---- common/libs/wallet/deterministic/trezor.ts | 8 +--- .../libs/wallet/non-deterministic/helpers.ts | 6 +-- .../libs/wallet/non-deterministic/wallets.ts | 6 +-- common/libs/wallet/non-deterministic/web3.ts | 6 +-- common/reducers/customTokens.ts | 10 +--- common/reducers/deterministicWallets.ts | 5 +- common/reducers/generateWallet.ts | 5 +- common/reducers/index.ts | 5 +- common/reducers/notifications.ts | 5 +- common/reducers/rates.ts | 10 +--- common/sagas/deterministicWallets.ts | 14 +----- common/sagas/notifications.ts | 9 +--- common/sagas/swap/orders.ts | 43 ++++------------- common/typescript/ethereumjs-util.d.ts | 46 ++++--------------- common/typescript/ethereumjs-wallet.d.ts | 16 ++----- common/utils/isMobile.ts | 4 +- common/utils/node.ts | 4 +- common/utils/printElement.ts | 5 +- package.json | 4 +- 61 files changed, 158 insertions(+), 480 deletions(-) diff --git a/common/actions/customTokens/actionCreators.ts b/common/actions/customTokens/actionCreators.ts index 300bacde..a18e8435 100644 --- a/common/actions/customTokens/actionCreators.ts +++ b/common/actions/customTokens/actionCreators.ts @@ -3,9 +3,7 @@ import * as interfaces from './actionTypes'; import { TypeKeys } from './constants'; export type TAddCustomToken = typeof addCustomToken; -export function addCustomToken( - payload: Token -): interfaces.AddCustomTokenAction { +export function addCustomToken(payload: Token): interfaces.AddCustomTokenAction { return { type: TypeKeys.CUSTOM_TOKEN_ADD, payload @@ -14,9 +12,7 @@ export function addCustomToken( export type TRemoveCustomToken = typeof removeCustomToken; -export function removeCustomToken( - payload: string -): interfaces.RemoveCustomTokenAction { +export function removeCustomToken(payload: string): interfaces.RemoveCustomTokenAction { return { type: TypeKeys.CUSTOM_TOKEN_REMOVE, payload diff --git a/common/actions/deterministicWallets/actionCreators.ts b/common/actions/deterministicWallets/actionCreators.ts index fb043d7c..396cd2d7 100644 --- a/common/actions/deterministicWallets/actionCreators.ts +++ b/common/actions/deterministicWallets/actionCreators.ts @@ -26,9 +26,7 @@ export function setDeterministicWallets( }; } -export function setDesiredToken( - token: string | undefined -): interfaces.SetDesiredTokenAction { +export function setDesiredToken(token: string | undefined): interfaces.SetDesiredTokenAction { return { type: TypeKeys.DW_SET_DESIRED_TOKEN, payload: token diff --git a/common/actions/generateWallet/actionCreators.ts b/common/actions/generateWallet/actionCreators.ts index 2ae69f21..88bf4c8e 100644 --- a/common/actions/generateWallet/actionCreators.ts +++ b/common/actions/generateWallet/actionCreators.ts @@ -3,9 +3,7 @@ import * as interfaces from './actionTypes'; import { TypeKeys } from './constants'; export type TGenerateNewWallet = typeof generateNewWallet; -export function generateNewWallet( - password: string -): interfaces.GenerateNewWalletAction { +export function generateNewWallet(password: string): interfaces.GenerateNewWalletAction { return { type: TypeKeys.GENERATE_WALLET_GENERATE_WALLET, wallet: generate(), diff --git a/common/actions/notifications/actionCreators.ts b/common/actions/notifications/actionCreators.ts index bfda0fa3..99949933 100644 --- a/common/actions/notifications/actionCreators.ts +++ b/common/actions/notifications/actionCreators.ts @@ -20,9 +20,7 @@ export function showNotification( } export type TCloseNotification = typeof closeNotification; -export function closeNotification( - notification: types.Notification -): types.CloseNotificationAction { +export function closeNotification(notification: types.Notification): types.CloseNotificationAction { return { type: TypeKeys.CLOSE_NOTIFICATION, payload: notification diff --git a/common/actions/notifications/actionTypes.ts b/common/actions/notifications/actionTypes.ts index f6b70117..3a7377f1 100644 --- a/common/actions/notifications/actionTypes.ts +++ b/common/actions/notifications/actionTypes.ts @@ -23,6 +23,4 @@ export interface ShowNotificationAction { } /*** Union Type ***/ -export type NotificationsAction = - | ShowNotificationAction - | CloseNotificationAction; +export type NotificationsAction = ShowNotificationAction | CloseNotificationAction; diff --git a/common/actions/rates/actionCreators.ts b/common/actions/rates/actionCreators.ts index ef5705c1..98f1e2e7 100644 --- a/common/actions/rates/actionCreators.ts +++ b/common/actions/rates/actionCreators.ts @@ -11,9 +11,7 @@ export function fetchCCRates(symbols: string[] = []): interfaces.FetchCCRates { } export type TFetchCCRatesSucceeded = typeof fetchCCRatesSucceeded; -export function fetchCCRatesSucceeded( - payload: CCResponse -): interfaces.FetchCCRatesSucceeded { +export function fetchCCRatesSucceeded(payload: CCResponse): interfaces.FetchCCRatesSucceeded { return { type: TypeKeys.RATES_FETCH_CC_SUCCEEDED, payload diff --git a/common/actions/rates/actionTypes.ts b/common/actions/rates/actionTypes.ts index 0609c318..f0d3ca4a 100644 --- a/common/actions/rates/actionTypes.ts +++ b/common/actions/rates/actionTypes.ts @@ -17,7 +17,4 @@ export interface FetchCCRatesFailed { } /*** Union Type ***/ -export type RatesAction = - | FetchCCRates - | FetchCCRatesSucceeded - | FetchCCRatesFailed; +export type RatesAction = FetchCCRates | FetchCCRatesSucceeded | FetchCCRatesFailed; diff --git a/common/components/AlphaAgreement/index.tsx b/common/components/AlphaAgreement/index.tsx index 0be1ea3e..cce81bbc 100644 --- a/common/components/AlphaAgreement/index.tsx +++ b/common/components/AlphaAgreement/index.tsx @@ -25,23 +25,19 @@ export default class AlphaAgreement extends React.Component<{}, State> {

This is an Unstable Version of MEW

- You are about to access an alpha version of MyEtherWallet that is - currently in development. In its current state, it should only be - used for testing, not for important transactions. + You are about to access an alpha version of MyEtherWallet that is currently in + development. In its current state, it should only be used for testing, not for important + transactions.

- Any wallets you generate should not hold a significant value, and - any transactions you make should be for small amounts. MEW does not - claim responsibility for any issues that happen while using the - alpha version. + Any wallets you generate should not hold a significant value, and any transactions you + make should be for small amounts. MEW does not claim responsibility for any issues that + happen while using the alpha version.

Are you sure you would like to continue?

-
); diff --git a/common/components/WalletDecrypt/Keystore.tsx b/common/components/WalletDecrypt/Keystore.tsx index efc5210c..bb42ace5 100644 --- a/common/components/WalletDecrypt/Keystore.tsx +++ b/common/components/WalletDecrypt/Keystore.tsx @@ -42,21 +42,14 @@ export default class KeystoreDecrypt extends Component { onChange={this.handleFileSelection} />

{translate('ADD_Label_3')}

0 ? 'is-valid' : 'is-invalid' - }`} + className={`form-control ${password.length > 0 ? 'is-valid' : 'is-invalid'}`} value={password} onChange={this.onPasswordChange} onKeyDown={this.onKeyDown} diff --git a/common/components/WalletDecrypt/index.tsx b/common/components/WalletDecrypt/index.tsx index 3bfda0b2..bb4faf49 100644 --- a/common/components/WalletDecrypt/index.tsx +++ b/common/components/WalletDecrypt/index.tsx @@ -84,18 +84,14 @@ export class WalletDecrypt extends Component { password: '' }, unlock: this.props.unlockKeystore, - helpLink: `${ - knowledgeBaseURL - }/private-keys-passwords/difference-beween-private-key-and-keystore-file.html` + helpLink: `${knowledgeBaseURL}/private-keys-passwords/difference-beween-private-key-and-keystore-file.html` }, 'mnemonic-phrase': { lid: 'x_Mnemonic', component: MnemonicDecrypt, initialParams: {}, unlock: this.props.unlockMnemonic, - helpLink: `${ - knowledgeBaseURL - }/private-keys-passwords/difference-beween-private-key-and-keystore-file.html` + helpLink: `${knowledgeBaseURL}/private-keys-passwords/difference-beween-private-key-and-keystore-file.html` }, 'private-key': { lid: 'x_PrivKey2', @@ -105,9 +101,7 @@ export class WalletDecrypt extends Component { password: '' }, unlock: this.props.unlockPrivateKey, - helpLink: `${ - knowledgeBaseURL - }/private-keys-passwords/difference-beween-private-key-and-keystore-file.html` + helpLink: `${knowledgeBaseURL}/private-keys-passwords/difference-beween-private-key-and-keystore-file.html` }, 'view-only': { lid: 'View with Address Only', diff --git a/common/components/hocs/Conditional.tsx b/common/components/hocs/Conditional.tsx index 93fb03e1..50075a70 100644 --- a/common/components/hocs/Conditional.tsx +++ b/common/components/hocs/Conditional.tsx @@ -17,9 +17,7 @@ export const withConditional = ( public render() { const { condition, conditionalProps, ...passedProps } = this.props as any; return condition ? ( - + ) : ( ); diff --git a/common/components/renderCbs/GasQuery.tsx b/common/components/renderCbs/GasQuery.tsx index ede566b0..1cd0764c 100644 --- a/common/components/renderCbs/GasQuery.tsx +++ b/common/components/renderCbs/GasQuery.tsx @@ -8,8 +8,6 @@ interface Props { export const GasQuery: React.SFC = ({ withQuery }) => ( - withQuery({ gasLimit: limit || gaslimit }) - } + withQuery={({ limit, gaslimit }) => withQuery({ gasLimit: limit || gaslimit })} /> ); diff --git a/common/components/renderCbs/TokenQuery.tsx b/common/components/renderCbs/TokenQuery.tsx index dde911e5..4286dec9 100644 --- a/common/components/renderCbs/TokenQuery.tsx +++ b/common/components/renderCbs/TokenQuery.tsx @@ -14,16 +14,12 @@ class TokenQueryClass extends Component { return ( - this.props.withQuery(this.paramGetter(tokenSymbol)) - } + withQuery={({ tokenSymbol }) => this.props.withQuery(this.paramGetter(tokenSymbol))} /> ); } private paramGetter = (unit: string | null) => - unit - ? { token: this.props.tokens.find(t => t.symbol === unit) } - : { token: null }; + unit ? { token: this.props.tokens.find(t => t.symbol === unit) } : { token: null }; } export const TokenQuery = connect((state: AppState) => ({ diff --git a/common/components/renderCbs/WhenQueryExists.tsx b/common/components/renderCbs/WhenQueryExists.tsx index 5b4f6458..a2a8ced8 100644 --- a/common/components/renderCbs/WhenQueryExists.tsx +++ b/common/components/renderCbs/WhenQueryExists.tsx @@ -5,21 +5,11 @@ interface Props { whenQueryExists: React.ReactElement | null; } -const params: Param[] = [ - 'to', - 'data', - 'tokenSymbol', - 'value', - 'gaslimit', - 'limit', - 'readOnly' -]; +const params: Param[] = ['to', 'data', 'tokenSymbol', 'value', 'gaslimit', 'limit', 'readOnly']; export const WhenQueryExists: React.SFC = ({ whenQueryExists }) => ( - Object.values(queries).some(v => !!v) ? whenQueryExists : null - } + withQuery={queries => (Object.values(queries).some(v => !!v) ? whenQueryExists : null)} /> ); diff --git a/common/components/ui/ColorDropdown.tsx b/common/components/ui/ColorDropdown.tsx index 9a90b116..93bad7b5 100644 --- a/common/components/ui/ColorDropdown.tsx +++ b/common/components/ui/ColorDropdown.tsx @@ -58,16 +58,14 @@ export default class ColorDropdown extends Component, {}> { private renderOptions = () => { const { options, value, menuAlign, extra } = this.props; - const listItems = options - .filter(opt => !opt.hidden) - .reduce((prev: any[], opt) => { - const prevOpt = prev.length ? prev[prev.length - 1] : null; - if (prevOpt && !prevOpt.divider && prevOpt.color !== opt.color) { - prev.push({ divider: true }); - } - prev.push(opt); - return prev; - }, []); + const listItems = options.filter(opt => !opt.hidden).reduce((prev: any[], opt) => { + const prevOpt = prev.length ? prev[prev.length - 1] : null; + if (prevOpt && !prevOpt.divider && prevOpt.color !== opt.color) { + prev.push({ divider: true }); + } + prev.push(opt); + return prev; + }, []); const menuClass = classnames({ ColorDropdown: true, @@ -82,11 +80,7 @@ export default class ColorDropdown extends Component, {}> { return
  • ; } else { return ( -
  • +
  • extends Component, {}> { } }; - private onRemove( - onRemove: () => void, - ev?: React.SyntheticEvent - ) { + private onRemove(onRemove: () => void, ev?: React.SyntheticEvent) { if (ev) { ev.preventDefault(); ev.stopPropagation(); diff --git a/common/components/ui/ConditionalInput.tsx b/common/components/ui/ConditionalInput.tsx index 1b55e2a5..31411bfc 100644 --- a/common/components/ui/ConditionalInput.tsx +++ b/common/components/ui/ConditionalInput.tsx @@ -1,7 +1,5 @@ import React from 'react'; import { withConditional } from 'components/hocs'; -const Input: React.SFC> = props => ( - -); +const Input: React.SFC> = props => ; export const ConditionalInput = withConditional(Input); diff --git a/common/components/ui/DropdownShell.tsx b/common/components/ui/DropdownShell.tsx index 99c38aa5..35f10285 100644 --- a/common/components/ui/DropdownShell.tsx +++ b/common/components/ui/DropdownShell.tsx @@ -35,21 +35,9 @@ export default class DropdownComponent extends Component { } public render() { - const { - ariaLabel, - color, - disabled, - size, - renderOptions, - renderLabel - } = this.props; + const { ariaLabel, color, disabled, size, renderOptions, renderLabel } = this.props; const { expanded } = this.state; - const toggleClasses = classnames([ - 'dropdown-toggle', - 'btn', - `btn-${color}`, - `btn-${size}` - ]); + const toggleClasses = classnames(['dropdown-toggle', 'btn', `btn-${color}`, `btn-${size}`]); return ( { const color = light ? 'Spinner-light' : 'Spinner-dark'; return ( - + ); }; diff --git a/common/config/dpaths.ts b/common/config/dpaths.ts index 3e1d1d6a..14243fcd 100644 --- a/common/config/dpaths.ts +++ b/common/config/dpaths.ts @@ -35,14 +35,7 @@ const EXPANSE = { const TREZOR = [ETH_TREZOR, ETC_TREZOR, TESTNET]; -const MNEMONIC = [ - ETH_DEFAULT, - ETH_LEDGER, - ETC_LEDGER, - ETC_TREZOR, - TESTNET, - EXPANSE -]; +const MNEMONIC = [ETH_DEFAULT, ETH_LEDGER, ETC_LEDGER, ETC_TREZOR, TESTNET, EXPANSE]; const LEDGER = [ETH_LEDGER, ETC_LEDGER, TESTNET]; diff --git a/common/containers/TabSection/NotificationRow.tsx b/common/containers/TabSection/NotificationRow.tsx index f194cdd4..2c4e5f41 100644 --- a/common/containers/TabSection/NotificationRow.tsx +++ b/common/containers/TabSection/NotificationRow.tsx @@ -21,11 +21,7 @@ export default class NotificationRow extends Component {
    {level}
    {msg}
    -
    ); } diff --git a/common/containers/TabSection/Notifications.tsx b/common/containers/TabSection/Notifications.tsx index 3b560eea..e56c4991 100644 --- a/common/containers/TabSection/Notifications.tsx +++ b/common/containers/TabSection/Notifications.tsx @@ -1,8 +1,4 @@ -import { - closeNotification, - Notification, - TCloseNotification -} from 'actions/notifications'; +import { closeNotification, Notification, TCloseNotification } from 'actions/notifications'; import React from 'react'; import { connect } from 'react-redux'; import { TransitionGroup, CSSTransition } from 'react-transition-group'; @@ -29,10 +25,7 @@ export class Notifications extends React.Component { {this.props.notifications.map(n => { return ( - + ); })} diff --git a/common/containers/Tabs/ENS/components/GeneralInfoPanel/GeneralInfoNode.tsx b/common/containers/Tabs/ENS/components/GeneralInfoPanel/GeneralInfoNode.tsx index 7af4ce7e..5b995502 100644 --- a/common/containers/Tabs/ENS/components/GeneralInfoPanel/GeneralInfoNode.tsx +++ b/common/containers/Tabs/ENS/components/GeneralInfoPanel/GeneralInfoNode.tsx @@ -1,44 +1,28 @@ import React from 'react'; import { HeaderProps, ListProps, NodeProps, NodeState } from './types'; -const InfoHeader = ({ children, onClickHandler }: HeaderProps) => +const InfoHeader = ({ children, onClickHandler }: HeaderProps) => (
    + {children} -
    ; + +); -const InfoList = ({ children, isOpen }: ListProps) => - isOpen - ?
      - {children} -
    - : null; +const InfoList = ({ children, isOpen }: ListProps) => (isOpen ?
      {children}
    : null); -export default class GeneralInfoNode extends React.Component< - NodeProps, - NodeState -> { +export default class GeneralInfoNode extends React.Component { public state = { isOpen: false }; - public toggleVisibility = () => - this.setState(prevState => ({ isOpen: !prevState.isOpen })); + public toggleVisibility = () => this.setState(prevState => ({ isOpen: !prevState.isOpen })); public render() { - const { - toggleVisibility, - props: { innerList, headerContent }, - state: { isOpen } - } = this; + const { toggleVisibility, props: { innerList, headerContent }, state: { isOpen } } = this; return (
    - - {headerContent} - - - {innerList} - + {headerContent} + {innerList}
    ); } diff --git a/common/containers/Tabs/ENS/components/Title.tsx b/common/containers/Tabs/ENS/components/Title.tsx index 0c94d5f5..12cd39dd 100644 --- a/common/containers/Tabs/ENS/components/Title.tsx +++ b/common/containers/Tabs/ENS/components/Title.tsx @@ -2,23 +2,23 @@ import { NewTabLink } from 'components/ui'; import React from 'react'; import translate from 'translations'; -const ENSDocsLink = () => +const ENSDocsLink = () => ( ; + /> +); -const ENSTitle = () => +const ENSTitle = () => (
    -

    - {translate('NAV_ENS')} -

    +

    {translate('NAV_ENS')}

    - The is a distributed, open, and extensible naming system - based on the Ethereum blockchain. Once you have a name, you can tell your - friends to send ETH to mewtopia.eth instead of + The is a distributed, open, and extensible naming system based on the Ethereum + blockchain. Once you have a name, you can tell your friends to send ETH to{' '} + mewtopia.eth instead of 0x7cB57B5A97eAbe942......

    -
    ; + +); export default ENSTitle; diff --git a/common/containers/Tabs/GenerateWallet/components/CryptoWarning.tsx b/common/containers/Tabs/GenerateWallet/components/CryptoWarning.tsx index 0fd75caa..7cc722a3 100644 --- a/common/containers/Tabs/GenerateWallet/components/CryptoWarning.tsx +++ b/common/containers/Tabs/GenerateWallet/components/CryptoWarning.tsx @@ -28,9 +28,7 @@ const BROWSERS = [ const CryptoWarning: React.SFC<{}> = () => (
    -

    - Your Browser Cannot Generate a Wallet -

    +

    Your Browser Cannot Generate a Wallet

    {isMobile ? ` @@ -55,13 +53,8 @@ const CryptoWarning: React.SFC<{}> = () => ( className="CryptoWarning-browsers-browser" >

    - -
    - {browser.name} -
    + +
    {browser.name}
    ))} diff --git a/common/containers/Tabs/GenerateWallet/components/DownloadWallet.tsx b/common/containers/Tabs/GenerateWallet/components/DownloadWallet.tsx index 527ce182..5c9e8a8c 100644 --- a/common/containers/Tabs/GenerateWallet/components/DownloadWallet.tsx +++ b/common/containers/Tabs/GenerateWallet/components/DownloadWallet.tsx @@ -104,9 +104,7 @@ export default class DownloadWallet extends Component {
  • {translate('GEN_Help_14')} diff --git a/common/containers/Tabs/GenerateWallet/components/PaperWallet.tsx b/common/containers/Tabs/GenerateWallet/components/PaperWallet.tsx index bd15e050..c7784e4d 100644 --- a/common/containers/Tabs/GenerateWallet/components/PaperWallet.tsx +++ b/common/containers/Tabs/GenerateWallet/components/PaperWallet.tsx @@ -66,9 +66,7 @@ const help = (
  • {translate('GEN_Help_16')} diff --git a/common/containers/Tabs/GenerateWallet/components/Template.tsx b/common/containers/Tabs/GenerateWallet/components/Template.tsx index 447be817..d35ba5d0 100644 --- a/common/containers/Tabs/GenerateWallet/components/Template.tsx +++ b/common/containers/Tabs/GenerateWallet/components/Template.tsx @@ -12,15 +12,11 @@ export default class GenerateWalletTemplate extends React.Component { return (
    -
    - {content} -
    +
    {content}
    - +
    ); diff --git a/common/containers/Tabs/SendTransaction/components/Donate.tsx b/common/containers/Tabs/SendTransaction/components/Donate.tsx index 296f4f1c..6effd42f 100644 --- a/common/containers/Tabs/SendTransaction/components/Donate.tsx +++ b/common/containers/Tabs/SendTransaction/components/Donate.tsx @@ -15,16 +15,13 @@ export default class Donate extends React.Component { public render() { return (
    -

    - {translate('sidebar_donation')} -

    +

    {translate('sidebar_donation')}

    {translate('sidebar_donate')} - {this.state.clicked && -
    - {translate('sidebar_thanks')} -
    } + {this.state.clicked && ( +
    {translate('sidebar_thanks')}
    + )}
    ); } diff --git a/common/containers/Tabs/SignAndVerifyMessage/components/SignMessage/SignButton.tsx b/common/containers/Tabs/SignAndVerifyMessage/components/SignMessage/SignButton.tsx index 7a1940b2..0513778e 100644 --- a/common/containers/Tabs/SignAndVerifyMessage/components/SignMessage/SignButton.tsx +++ b/common/containers/Tabs/SignAndVerifyMessage/components/SignMessage/SignButton.tsx @@ -14,10 +14,7 @@ interface Props { export default class SignMessageButton extends React.Component { public render() { return ( - ); diff --git a/common/containers/Tabs/Swap/components/SwapInfoHeaderTitle.tsx b/common/containers/Tabs/Swap/components/SwapInfoHeaderTitle.tsx index 1080b6e9..caef2f67 100644 --- a/common/containers/Tabs/Swap/components/SwapInfoHeaderTitle.tsx +++ b/common/containers/Tabs/Swap/components/SwapInfoHeaderTitle.tsx @@ -9,34 +9,21 @@ export interface SwapInfoHeaderTitleProps { restartSwap(): RestartSwapAction; } -export default class SwapInfoHeaderTitle extends Component< - SwapInfoHeaderTitleProps, - {} -> { +export default class SwapInfoHeaderTitle extends Component { public render() { return (
    -
    -

    - {translate('SWAP_information')} -

    +

    {translate('SWAP_information')}

    diff --git a/common/freezer.ts b/common/freezer.ts index 34b74724..08ac3b05 100644 --- a/common/freezer.ts +++ b/common/freezer.ts @@ -17,11 +17,7 @@ const start = async () => { const { frozen } = JSON.parse(packageStr); if (frozen === undefined) { - console.log( - `Freezer: No config found in package.json on branch ${ - ORACLE_BRANCH - }. Exiting.` - ); + console.log(`Freezer: No config found in package.json on branch ${ORACLE_BRANCH}. Exiting.`); return; } @@ -119,11 +115,7 @@ const validateConfig = () => { const { frozen } = JSON.parse(fs.readFileSync(packagePath, 'utf8')); if (frozen === undefined) { - console.log( - `Freezer: No config found in package.json on branch ${ - ORACLE_BRANCH - }. Exiting.` - ); + console.log(`Freezer: No config found in package.json on branch ${ORACLE_BRANCH}. Exiting.`); return; } diff --git a/common/libs/contracts/types.ts b/common/libs/contracts/types.ts index a33ce1d8..861ad080 100644 --- a/common/libs/contracts/types.ts +++ b/common/libs/contracts/types.ts @@ -20,10 +20,10 @@ export interface Input { export type Output = Input; /** - * + * * @export * @interface ABIFunction - * @template T + * @template T */ export interface ContractOutputMappings { [key: string]: string[]; diff --git a/common/libs/decrypt.ts b/common/libs/decrypt.ts index 98d4b0be..7cca2c3d 100644 --- a/common/libs/decrypt.ts +++ b/common/libs/decrypt.ts @@ -13,10 +13,7 @@ export function decryptPrivKey(encprivkey: string, password: string): Buffer { ivsize: 16 }); const decipher = createDecipheriv('aes-256-cbc', evp.key, evp.iv); - const privKey = decipherBuffer( - decipher, - new Buffer(decryptedCipher.ciphertext) - ); + const privKey = decipherBuffer(decipher, new Buffer(decryptedCipher.ciphertext)); return new Buffer(privKey.toString(), 'hex'); } diff --git a/common/libs/nodes/INode.ts b/common/libs/nodes/INode.ts index 3a7cabb0..1edf0d90 100644 --- a/common/libs/nodes/INode.ts +++ b/common/libs/nodes/INode.ts @@ -14,10 +14,7 @@ export interface INode { ping(): Promise; getBalance(address: string): Promise; getTokenBalance(address: string, token: Token): Promise; - getTokenBalances( - address: string, - tokens: Token[] - ): Promise; + getTokenBalances(address: string, tokens: Token[]): Promise; estimateGas(tx: Partial): Promise; getTransactionCount(address: string): Promise; sendRawTx(tx: string): Promise; diff --git a/common/libs/nodes/etherscan/requests.ts b/common/libs/nodes/etherscan/requests.ts index d13415e3..c87107fa 100644 --- a/common/libs/nodes/etherscan/requests.ts +++ b/common/libs/nodes/etherscan/requests.ts @@ -58,10 +58,7 @@ export default class EtherscanRequests extends RPCRequests { }; } - public getTokenBalance( - address: string, - token: Token - ): GetTokenBalanceRequest { + public getTokenBalance(address: string, token: Token): GetTokenBalanceRequest { return this.ethCall({ to: token.address, data: ERC20.balanceOf.encodeInput({ _owner: address }) diff --git a/common/libs/nodes/rpc/requests.ts b/common/libs/nodes/rpc/requests.ts index 4d6dcfb5..4422bd34 100644 --- a/common/libs/nodes/rpc/requests.ts +++ b/common/libs/nodes/rpc/requests.ts @@ -44,19 +44,14 @@ export default class RPCRequests { }; } - public getTransactionCount( - address: string - ): GetTransactionCountRequest | any { + public getTransactionCount(address: string): GetTransactionCountRequest | any { return { method: 'eth_getTransactionCount', params: [address, 'pending'] }; } - public getTokenBalance( - address: string, - token: Token - ): GetTokenBalanceRequest | any { + public getTokenBalance(address: string, token: Token): GetTokenBalanceRequest | any { return { method: 'eth_call', params: [ diff --git a/common/libs/signing.ts b/common/libs/signing.ts index 12c16343..f2ecd12f 100644 --- a/common/libs/signing.ts +++ b/common/libs/signing.ts @@ -39,23 +39,15 @@ export interface ISignedMessage { // adapted from: // https://github.com/kvhnuke/etherwallet/blob/2a5bc0db1c65906b14d8c33ce9101788c70d3774/app/scripts/controllers/signMsgCtrl.js#L118 -export function verifySignedMessage({ - address, - message, - signature, - version -}: ISignedMessage) { +export function verifySignedMessage({ address, message, signature, version }: ISignedMessage) { const sig = new Buffer(stripHexPrefixAndLower(signature), 'hex'); if (sig.length !== 65) { return false; } //TODO: explain what's going on here sig[64] = sig[64] === 0 || sig[64] === 1 ? sig[64] + 27 : sig[64]; - const hash = - version === '2' ? hashPersonalMessage(toBuffer(message)) : sha3(message); + const hash = version === '2' ? hashPersonalMessage(toBuffer(message)) : sha3(message); const pubKey = ecrecover(hash, sig[64], sig.slice(0, 32), sig.slice(32, 64)); - return ( - stripHexPrefixAndLower(address) === pubToAddress(pubKey).toString('hex') - ); + return stripHexPrefixAndLower(address) === pubToAddress(pubKey).toString('hex'); } diff --git a/common/libs/wallet/deterministic/ledger.ts b/common/libs/wallet/deterministic/ledger.ts index 5e1d208f..0c02f372 100644 --- a/common/libs/wallet/deterministic/ledger.ts +++ b/common/libs/wallet/deterministic/ledger.ts @@ -54,22 +54,18 @@ export class LedgerWallet extends DeterministicWallet implements IFullWallet { const msgHex = Buffer.from(msg).toString('hex'); return new Promise((resolve, reject) => { - this.ethApp.signPersonalMessage_async( - this.getPath(), - msgHex, - 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); - } + this.ethApp.signPersonalMessage_async(this.getPath(), msgHex, 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); + } + }); }); } } diff --git a/common/libs/wallet/deterministic/mnemonic.ts b/common/libs/wallet/deterministic/mnemonic.ts index 67fc2287..09e522c2 100644 --- a/common/libs/wallet/deterministic/mnemonic.ts +++ b/common/libs/wallet/deterministic/mnemonic.ts @@ -2,12 +2,5 @@ import { decryptMnemonicToPrivKey } from 'libs/decrypt'; import { fromPrivateKey } from 'ethereumjs-wallet'; import { signWrapper } from 'libs/wallet'; -export const MnemonicWallet = ( - phrase: string, - pass: string, - path: string, - address: string -) => - signWrapper( - fromPrivateKey(decryptMnemonicToPrivKey(phrase, pass, path, address)) - ); +export const MnemonicWallet = (phrase: string, pass: string, path: string, address: string) => + signWrapper(fromPrivateKey(decryptMnemonicToPrivKey(phrase, pass, path, address))); diff --git a/common/libs/wallet/deterministic/trezor.ts b/common/libs/wallet/deterministic/trezor.ts index 8929e742..a681958b 100644 --- a/common/libs/wallet/deterministic/trezor.ts +++ b/common/libs/wallet/deterministic/trezor.ts @@ -15,10 +15,7 @@ export class TrezorWallet extends DeterministicWallet implements IFullWallet { return new Promise((resolve, reject) => { const { chainId, ...strTx } = getTransactionFields(tx); // stripHexPrefixAndLower identical to ethFuncs.getNakedAddress - const cleanedTx = mapValues( - mapValues(strTx, stripHexPrefixAndLower), - padLeftEven - ); + const cleanedTx = mapValues(mapValues(strTx, stripHexPrefixAndLower), padLeftEven); (TrezorConnect as any).ethereumSignTx( // Args @@ -52,8 +49,7 @@ export class TrezorWallet extends DeterministicWallet implements IFullWallet { }); } - public signMessage = () => - Promise.reject(new Error('Signing via Trezor not yet supported.')); + public signMessage = () => Promise.reject(new Error('Signing via Trezor not yet supported.')); // works, but returns a signature that can only be verified with a Trezor device /* diff --git a/common/libs/wallet/non-deterministic/helpers.ts b/common/libs/wallet/non-deterministic/helpers.ts index 921c5609..1dc7a008 100644 --- a/common/libs/wallet/non-deterministic/helpers.ts +++ b/common/libs/wallet/non-deterministic/helpers.ts @@ -27,10 +27,8 @@ export type WrappedWallet = IFullWallet & ISignWrapper; export const signWrapper = (walletToWrap: IFullWallet): WrappedWallet => Object.assign(walletToWrap, { - signRawTransaction: (t: Tx) => - signRawTxWithPrivKey(walletToWrap.getPrivateKey(), t), - signMessage: (msg: string) => - signMessageWithPrivKeyV2(walletToWrap.getPrivateKey(), msg), + signRawTransaction: (t: Tx) => signRawTxWithPrivKey(walletToWrap.getPrivateKey(), t), + signMessage: (msg: string) => signMessageWithPrivKeyV2(walletToWrap.getPrivateKey(), msg), unlock: () => Promise.resolve() }); diff --git a/common/libs/wallet/non-deterministic/wallets.ts b/common/libs/wallet/non-deterministic/wallets.ts index 26beb6cb..9227aed5 100644 --- a/common/libs/wallet/non-deterministic/wallets.ts +++ b/common/libs/wallet/non-deterministic/wallets.ts @@ -5,10 +5,8 @@ import { decryptPrivKey } from 'libs/decrypt'; import Web3Wallet from './web3'; import AddressOnlyWallet from './address'; -const EncryptedPrivateKeyWallet = ( - encryptedPrivateKey: string, - password: string -) => signWrapper(fromPrivateKey(decryptPrivKey(encryptedPrivateKey, password))); +const EncryptedPrivateKeyWallet = (encryptedPrivateKey: string, password: string) => + signWrapper(fromPrivateKey(decryptPrivKey(encryptedPrivateKey, password))); const PresaleWallet = (keystore: string, password: string) => signWrapper(fromEthSale(keystore, password)); diff --git a/common/libs/wallet/non-deterministic/web3.ts b/common/libs/wallet/non-deterministic/web3.ts index fa5d9c83..2db1d939 100644 --- a/common/libs/wallet/non-deterministic/web3.ts +++ b/common/libs/wallet/non-deterministic/web3.ts @@ -70,9 +70,9 @@ export default class Web3Wallet implements IFullWallet { const netName = networkIdToName(netId); if (this.network !== netName) { throw new Error( - `Expected MetaMask / Mist network to be ${this.network}, but got ${ - netName - }. Please change the network or restart MyEtherWallet.` + `Expected MetaMask / Mist network to be ${ + this.network + }, but got ${netName}. Please change the network or restart MyEtherWallet.` ); } } diff --git a/common/reducers/customTokens.ts b/common/reducers/customTokens.ts index 306ad5c0..137758dd 100644 --- a/common/reducers/customTokens.ts +++ b/common/reducers/customTokens.ts @@ -17,17 +17,11 @@ function addCustomToken(state: State, action: AddCustomTokenAction): State { return [...state, action.payload]; } -function removeCustomToken( - state: State, - action: RemoveCustomTokenAction -): State { +function removeCustomToken(state: State, action: RemoveCustomTokenAction): State { return state.filter(token => token.symbol !== action.payload); } -export function customTokens( - state: State = INITIAL_STATE, - action: CustomTokenAction -): State { +export function customTokens(state: State = INITIAL_STATE, action: CustomTokenAction): State { switch (action.type) { case TypeKeys.CUSTOM_TOKEN_ADD: return addCustomToken(state, action); diff --git a/common/reducers/deterministicWallets.ts b/common/reducers/deterministicWallets.ts index d6e2dd15..27b67ad5 100644 --- a/common/reducers/deterministicWallets.ts +++ b/common/reducers/deterministicWallets.ts @@ -1,7 +1,4 @@ -import { - DeterministicWalletAction, - DeterministicWalletData -} from 'actions/deterministicWallets'; +import { DeterministicWalletAction, DeterministicWalletData } from 'actions/deterministicWallets'; import { TypeKeys } from 'actions/deterministicWallets/constants'; export interface State { diff --git a/common/reducers/generateWallet.ts b/common/reducers/generateWallet.ts index debd27fc..9a8c8cc9 100644 --- a/common/reducers/generateWallet.ts +++ b/common/reducers/generateWallet.ts @@ -14,10 +14,7 @@ export const INITIAL_STATE: State = { password: null }; -export function generateWallet( - state: State = INITIAL_STATE, - action: GenerateWalletAction -): State { +export function generateWallet(state: State = INITIAL_STATE, action: GenerateWalletAction): State { switch (action.type) { case TypeKeys.GENERATE_WALLET_GENERATE_WALLET: { return { diff --git a/common/reducers/index.ts b/common/reducers/index.ts index d27f8568..9229833c 100644 --- a/common/reducers/index.ts +++ b/common/reducers/index.ts @@ -2,10 +2,7 @@ import { routerReducer } from 'react-router-redux'; import { combineReducers } from 'redux'; import { config, State as ConfigState } from './config'; import { customTokens, State as CustomTokensState } from './customTokens'; -import { - deterministicWallets, - State as DeterministicWalletsState -} from './deterministicWallets'; +import { deterministicWallets, State as DeterministicWalletsState } from './deterministicWallets'; import { ens, State as EnsState } from './ens'; import { generateWallet, State as GenerateWalletState } from './generateWallet'; import { notifications, State as NotificationsState } from './notifications'; diff --git a/common/reducers/notifications.ts b/common/reducers/notifications.ts index d7ea2355..e4b63633 100644 --- a/common/reducers/notifications.ts +++ b/common/reducers/notifications.ts @@ -19,10 +19,7 @@ function closeNotification(state, action: CloseNotificationAction): State { return state; } -export function notifications( - state: State = INITIAL_STATE, - action: NotificationsAction -): State { +export function notifications(state: State = INITIAL_STATE, action: NotificationsAction): State { switch (action.type) { case TypeKeys.SHOW_NOTIFICATION: return showNotification(state, action); diff --git a/common/reducers/rates.ts b/common/reducers/rates.ts index 8c4c3bbc..731e4860 100644 --- a/common/reducers/rates.ts +++ b/common/reducers/rates.ts @@ -12,10 +12,7 @@ export const INITIAL_STATE: State = { ratesError: null }; -function fetchCCRatesSucceeded( - state: State, - action: FetchCCRatesSucceeded -): State { +function fetchCCRatesSucceeded(state: State, action: FetchCCRatesSucceeded): State { return { ...state, rates: { @@ -33,10 +30,7 @@ function fetchCCRatesFailed(state: State): State { }; } -export function rates( - state: State = INITIAL_STATE, - action: RatesAction -): State { +export function rates(state: State = INITIAL_STATE, action: RatesAction): State { switch (action.type) { case TypeKeys.RATES_FETCH_CC_SUCCEEDED: return fetchCCRatesSucceeded(state, action); diff --git a/common/sagas/deterministicWallets.ts b/common/sagas/deterministicWallets.ts index b7ac41e4..475d3140 100644 --- a/common/sagas/deterministicWallets.ts +++ b/common/sagas/deterministicWallets.ts @@ -10,24 +10,14 @@ import { publicToAddress, toChecksumAddress } from 'ethereumjs-util'; import HDKey from 'hdkey'; import { INode } from 'libs/nodes/INode'; import { SagaIterator } from 'redux-saga'; -import { - all, - apply, - fork, - put, - select, - takeEvery, - takeLatest -} from 'redux-saga/effects'; +import { all, apply, fork, put, select, takeEvery, takeLatest } from 'redux-saga/effects'; import { getNodeLib } from 'selectors/config'; import { getDesiredToken, getWallets } from 'selectors/deterministicWallets'; import { getTokens } from 'selectors/wallet'; import translate from 'translations'; import { TokenValue } from 'libs/units'; -export function* getDeterministicWallets( - action: GetDeterministicWalletsAction -): SagaIterator { +export function* getDeterministicWallets(action: GetDeterministicWalletsAction): SagaIterator { const { seed, dPath, publicKey, chainCode, limit, offset } = action.payload; let pathBase; let hdk; diff --git a/common/sagas/notifications.ts b/common/sagas/notifications.ts index e9686dc7..3b2351a8 100644 --- a/common/sagas/notifications.ts +++ b/common/sagas/notifications.ts @@ -1,13 +1,8 @@ -import { - closeNotification, - ShowNotificationAction -} from 'actions/notifications'; +import { closeNotification, ShowNotificationAction } from 'actions/notifications'; import { delay, SagaIterator } from 'redux-saga'; import { call, put, takeEvery } from 'redux-saga/effects'; -export function* handleNotification( - action: ShowNotificationAction -): SagaIterator { +export function* handleNotification(action: ShowNotificationAction): SagaIterator { const { duration } = action.payload; // show forever if (duration === 0 || duration === Infinity) { diff --git a/common/sagas/swap/orders.ts b/common/sagas/swap/orders.ts index 3b111d5f..057c26fc 100644 --- a/common/sagas/swap/orders.ts +++ b/common/sagas/swap/orders.ts @@ -17,16 +17,7 @@ import moment from 'moment'; import { AppState } from 'reducers'; import { State as SwapState } from 'reducers/swap'; import { delay, SagaIterator } from 'redux-saga'; -import { - call, - cancel, - cancelled, - fork, - put, - select, - take, - takeEvery -} from 'redux-saga/effects'; +import { call, cancel, cancelled, fork, put, select, take, takeEvery } from 'redux-saga/effects'; export const getSwap = (state: AppState): SwapState => state.swap; const ONE_SECOND = 1000; @@ -45,13 +36,7 @@ export function* pollBityOrderStatus(): SagaIterator { yield put(orderStatusRequestedSwap()); const orderStatus = yield call(getOrderStatus, swap.orderId); if (orderStatus.error) { - yield put( - showNotification( - 'danger', - `Bity Error: ${orderStatus.msg}`, - TEN_SECONDS - ) - ); + yield put(showNotification('danger', `Bity Error: ${orderStatus.msg}`, TEN_SECONDS)); } else { yield put(orderStatusSucceededSwap(orderStatus.data)); yield call(delay, ONE_SECOND * 5); @@ -81,9 +66,7 @@ export function* pollBityOrderStatusSaga(): SagaIterator { } } -export function* postBityOrderCreate( - action: BityOrderCreateRequestedSwapAction -): SagaIterator { +export function* postBityOrderCreate(action: BityOrderCreateRequestedSwapAction): SagaIterator { const payload = action.payload; try { yield put(stopLoadBityRatesSwap()); @@ -96,9 +79,7 @@ export function* postBityOrderCreate( ); if (order.error) { // TODO - handle better / like existing site? - yield put( - showNotification('danger', `Bity Error: ${order.msg}`, TEN_SECONDS) - ); + yield put(showNotification('danger', `Bity Error: ${order.msg}`, TEN_SECONDS)); yield put(bityOrderCreateFailedSwap()); } else { yield put(bityOrderCreateSucceededSwap(order.data)); @@ -127,9 +108,7 @@ export function* bityTimeRemaining(): SagaIterator { yield call(delay, ONE_SECOND); const swap = yield select(getSwap); // if (swap.bityOrder.status === 'OPEN') { - const createdTimeStampMoment = moment( - swap.orderTimestampCreatedISOString - ); + const createdTimeStampMoment = moment(swap.orderTimestampCreatedISOString); const validUntil = moment(createdTimeStampMoment).add(swap.validFor, 's'); const now = moment(); if (validUntil.isAfter(now)) { @@ -145,9 +124,7 @@ export function* bityTimeRemaining(): SagaIterator { yield put({ type: 'SWAP_STOP_LOAD_BITY_RATES' }); if (!hasShownNotification) { hasShownNotification = true; - yield put( - showNotification('danger', BITY_TIMEOUT_MESSAGE, Infinity) - ); + yield put(showNotification('danger', BITY_TIMEOUT_MESSAGE, Infinity)); } break; case 'CANC': @@ -155,17 +132,13 @@ export function* bityTimeRemaining(): SagaIterator { yield put({ type: 'SWAP_STOP_LOAD_BITY_RATES' }); if (!hasShownNotification) { hasShownNotification = true; - yield put( - showNotification('danger', BITY_TIMEOUT_MESSAGE, Infinity) - ); + yield put(showNotification('danger', BITY_TIMEOUT_MESSAGE, Infinity)); } break; case 'RCVE': if (!hasShownNotification) { hasShownNotification = true; - yield put( - showNotification('warning', BITY_TIMEOUT_MESSAGE, Infinity) - ); + yield put(showNotification('warning', BITY_TIMEOUT_MESSAGE, Infinity)); } break; case 'FILL': diff --git a/common/typescript/ethereumjs-util.d.ts b/common/typescript/ethereumjs-util.d.ts index 2c41e42c..0c4f5f3a 100644 --- a/common/typescript/ethereumjs-util.d.ts +++ b/common/typescript/ethereumjs-util.d.ts @@ -27,27 +27,11 @@ declare module 'ethereumjs-util' { export function zeros(bytes: number): Buffer; - export function setLength( - msg: Buffer, - length: number, - right: boolean - ): Buffer; - export function setLength( - msg: number[], - length: number, - right: boolean - ): number[]; + export function setLength(msg: Buffer, length: number, right: boolean): Buffer; + export function setLength(msg: number[], length: number, right: boolean): number[]; - export function setLengthLeft( - msg: Buffer, - length: number, - right: boolean - ): Buffer; - export function setLengthLeft( - msg: number[], - length: number, - right: boolean - ): number[]; + export function setLengthLeft(msg: Buffer, 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: number[], length: number): number[]; @@ -66,17 +50,11 @@ declare module 'ethereumjs-util' { export function toUnsigned(num: BN): Buffer; - export function sha3( - a: Buffer | string | number | number[], - bits?: number - ): Buffer; + export function sha3(a: Buffer | string | number | number[], bits?: number): Buffer; export function sha256(a: Buffer | string | number | number[]): Buffer; - export function ripemd160( - a: Buffer | string | number | number[], - padded?: boolean - ): Buffer; + export function ripemd160(a: Buffer | string | number | number[], padded?: boolean): 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 pubToAddress(publicKey: Buffer, sanitize?: boolean): Buffer; - export function publicToAddress( - publicKey: Buffer, - sanitize?: boolean - ): Buffer; + export function publicToAddress(publicKey: Buffer, sanitize?: boolean): Buffer; export function privateToPublic(privateKey: Buffer): Buffer; @@ -98,12 +73,7 @@ declare module 'ethereumjs-util' { export function hashPersonalMessage(message: Buffer | string): Buffer; - export function ecrecover( - msgHash: Buffer, - v: number, - r: Buffer, - s: Buffer - ): Buffer; + export function ecrecover(msgHash: Buffer, v: number, r: Buffer, s: Buffer): Buffer; export function toRpcSig(v: number, r: Buffer, s: Buffer): string; diff --git a/common/typescript/ethereumjs-wallet.d.ts b/common/typescript/ethereumjs-wallet.d.ts index 502c63da..acaa9e1c 100644 --- a/common/typescript/ethereumjs-wallet.d.ts +++ b/common/typescript/ethereumjs-wallet.d.ts @@ -293,10 +293,7 @@ declare module 'ethereumjs-wallet' { * @param input * @param nonStrict */ - function fromPublicKey( - input: Buffer, - nonStrict?: boolean - ): IPublicKeyOnlyWallet; + function fromPublicKey(input: Buffer, nonStrict?: boolean): IPublicKeyOnlyWallet; /** * @description create an instance based on a BIP32 extended public key (xpub) @@ -317,19 +314,12 @@ declare module 'ethereumjs-wallet' { * @param password * @param nonStrict */ - function fromV3( - input: IV3Wallet | string, - password: string, - nonStrict: boolean - ): IFullWallet; + function fromV3(input: IV3Wallet | string, password: string, nonStrict: boolean): IFullWallet; /** * @description import an Ethereum Pre Sale wallet * @param input * @param password */ - function fromEthSale( - input: IPresaleWallet | string, - password: string - ): IFullWallet; + function fromEthSale(input: IPresaleWallet | string, password: string): IFullWallet; } diff --git a/common/utils/isMobile.ts b/common/utils/isMobile.ts index 998c33ab..94575cc8 100644 --- a/common/utils/isMobile.ts +++ b/common/utils/isMobile.ts @@ -1,6 +1,4 @@ const isMobile = - window && window.navigator - ? /iPhone|iPad|iPod|Android/i.test(window.navigator.userAgent) - : false; + window && window.navigator ? /iPhone|iPad|iPod|Android/i.test(window.navigator.userAgent) : false; export default isMobile; diff --git a/common/utils/node.ts b/common/utils/node.ts index 629f7cd1..2973f82c 100644 --- a/common/utils/node.ts +++ b/common/utils/node.ts @@ -26,9 +26,7 @@ export function getNodeConfigFromId( } } -export function makeNodeConfigFromCustomConfig( - config: CustomNodeConfig -): NodeConfig { +export function makeNodeConfigFromCustomConfig(config: CustomNodeConfig): NodeConfig { return { network: config.network, lib: new CustomNode(config), diff --git a/common/utils/printElement.ts b/common/utils/printElement.ts index 207bfa26..e4e0b593 100644 --- a/common/utils/printElement.ts +++ b/common/utils/printElement.ts @@ -7,10 +7,7 @@ interface PrintOptions { popupFeatures?: object; } -export default function( - element: React.ReactElement, - opts: PrintOptions = {} -) { +export default function(element: React.ReactElement, opts: PrintOptions = {}) { const options = { styles: '', printTimeout: 500, diff --git a/package.json b/package.json index 6208a534..7e8281a1 100644 --- a/package.json +++ b/package.json @@ -134,11 +134,13 @@ "postinstall": "webpack --config=./webpack_config/webpack.dll.js", "start": "npm run dev", "precommit": "lint-staged", + "formatAll": + "find ./common/ -name '*.ts*' | xargs prettier --write --config ./.prettierrc --config-precedence file-override", "prepush": "npm run tslint && npm run tscheck" }, "lint-staged": { "*.{ts,tsx}": [ - "prettier --write", + "prettier --write --config ./.prettierrc --config-precedence file-override", "git add" ] }