From 6e261016e56767d5d3c2ebf3d4f655842f7ed71e Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Tue, 6 Nov 2018 03:33:02 +0900 Subject: [PATCH 1/6] fix flow type errors --- .flowconfig | 1 + app/api/ada/adaAccount.js | 5 +- .../ada/adaTransactions/adaNewTransactions.js | 6 +- app/api/ada/lib/cardanoCrypto/cryptoUtils.js | 18 +++--- app/utils/passwordCipher.js | 3 +- flow/declarations/CardanoCrypto.js | 35 ++++++----- package-lock.json | 61 ++++++++++--------- 7 files changed, 70 insertions(+), 59 deletions(-) diff --git a/.flowconfig b/.flowconfig index 1e1a365597..c2a01f34d2 100755 --- a/.flowconfig +++ b/.flowconfig @@ -10,6 +10,7 @@ .*/.circleci/.* [include] +../node_modules/eslint-plugin-jsx-a11y [libs] flow/declarations/ diff --git a/app/api/ada/adaAccount.js b/app/api/ada/adaAccount.js index 8ebd702285..00a2711aa3 100644 --- a/app/api/ada/adaAccount.js +++ b/app/api/ada/adaAccount.js @@ -21,6 +21,7 @@ export function createCryptoAccount( accountIndex: number = ACCOUNT_INDEX ): CryptoAccount { const cryptoWallet = getCryptoWalletFromMasterKey(masterKey, walletPassword); - const result = getResultOrFail(Wallet.newAccount(cryptoWallet, accountIndex)); - return Object.assign({ account: accountIndex }, result); + // eslint-disable-next-line space-infix-ops + const result = getResultOrFail(Wallet.newAccount(cryptoWallet, accountIndex)); + return Object.assign({}, { account: accountIndex }, result); } diff --git a/app/api/ada/adaTransactions/adaNewTransactions.js b/app/api/ada/adaTransactions/adaNewTransactions.js index b7919ae918..6692c0cc6a 100644 --- a/app/api/ada/adaTransactions/adaNewTransactions.js +++ b/app/api/ada/adaTransactions/adaNewTransactions.js @@ -27,6 +27,7 @@ import { import { getResultOrFail } from '../lib/cardanoCrypto/cryptoUtils'; import type { AdaAddresses, + AdaAddress, AdaTransactionFee, UTXO } from '../adaTypes'; @@ -115,7 +116,7 @@ export async function getAdaTransactionFromSenders( receiver: string, amount: string, cryptoWallet: CryptoWallet -) { +): Promise<[SpendResponse, AdaAddress]> { const cryptoAccount = getSingleCryptoAccount(); const addressesMap = await getAdaAddressesMap(); const addresses = mapToList(addressesMap); @@ -124,7 +125,8 @@ export async function getAdaTransactionFromSenders( const outputs = [{ address: receiver, value: amount }]; const senderUtxos = await getAllUTXOsForAddresses(_getAddresses(senders)); const inputs = _mapUTXOsToInputs(senderUtxos, addressesMap); - const result = getResultOrFail(Wallet.spend(cryptoWallet, inputs, outputs, changeAddr)); + // eslint-disable-next-line space-infix-ops + const result = getResultOrFail(Wallet.spend(cryptoWallet, inputs, outputs, changeAddr)); return [result, changeAdaAddr]; } diff --git a/app/api/ada/lib/cardanoCrypto/cryptoUtils.js b/app/api/ada/lib/cardanoCrypto/cryptoUtils.js index 6e80e1d39d..15a348d08e 100644 --- a/app/api/ada/lib/cardanoCrypto/cryptoUtils.js +++ b/app/api/ada/lib/cardanoCrypto/cryptoUtils.js @@ -1,18 +1,18 @@ // @flow import CardanoCryptoError from './cryptoErrors'; -export function getResultOrFail( - result: any -): any { - if (result.failed) { - throw new CardanoCryptoError(result.msg); +export function getResultOrFail( + arg: { result: T, failed: boolean, msg: ?string } +): T { + if (arg.failed) { + throw new CardanoCryptoError(arg.msg); } - return result.result; + return arg.result; } -export function getOrFail( - result: ?any -): any { +export function getOrFail( + result: ?T | false +): T { if (!result) { throw new CardanoCryptoError('Result not defined'); } diff --git a/app/utils/passwordCipher.js b/app/utils/passwordCipher.js index 15cf278c07..3ead9dc588 100644 --- a/app/utils/passwordCipher.js +++ b/app/utils/passwordCipher.js @@ -12,7 +12,8 @@ export function encryptWithPassword( const salt = new Buffer(cryptoRandomString(2 * 32), 'hex'); const nonce = new Buffer(cryptoRandomString(2 * 12), 'hex'); const formattedPassword: Uint8Array = new TextEncoder().encode(password); - const encryptedBytes = getOrFail( + // eslint-disable-next-line space-infix-ops + const encryptedBytes = getOrFail( PasswordProtect.encryptWithPassword(formattedPassword, salt, nonce, bytes)); const encryptedHex = Buffer.from(encryptedBytes).toString('hex'); return encryptedHex; diff --git a/flow/declarations/CardanoCrypto.js b/flow/declarations/CardanoCrypto.js index 8aac5f5f86..e600606698 100644 --- a/flow/declarations/CardanoCrypto.js +++ b/flow/declarations/CardanoCrypto.js @@ -79,9 +79,7 @@ declare module 'rust-cardano-crypto' { msg: ?string }, newAccount(w: CryptoWallet, accountIndex: number): { - result: { - Ok: CryptoAccount - }, + result: CryptoAccount, failed: boolean, msg: ?string }, @@ -100,11 +98,7 @@ declare module 'rust-cardano-crypto' { outputs: Array, changeAddr: string ): { - result: { - cbor_encoded_tx: Array, - changed_used: boolean, - fee: number - }, + result: SpendResponse, failed: boolean, msg: ?string }, @@ -113,11 +107,7 @@ declare module 'rust-cardano-crypto' { inputs: Array, output: string ): { - result: { - cbor_encoded_tx: Array, - fee: number, - tx: CryptoTransaction - }, + result: MoveResponse, failed: boolean, msg: ?string } @@ -137,9 +127,22 @@ declare module 'rust-cardano-crypto' { } } + +declare type SpendResponse = { + cbor_encoded_tx: Array, + changed_used: boolean, + fee: number +} + +declare type MoveResponse = { + cbor_encoded_tx: Array, + fee: number, + tx: CryptoTransaction +} + declare type CryptoWallet = { root_key: string, - cached_root_key: string, + root_cached_key: string, config: CryptoConfig, selection_policy: SelectionPolicy, derivation_scheme: string @@ -147,7 +150,7 @@ declare type CryptoWallet = { declare type CryptoDaedalusWallet = { root_key: string, - cached_root_key: string, + root_cached_key: string, config: CryptoConfig, selection_policy: SelectionPolicy, derivation_scheme: DerivationScheme @@ -155,7 +158,7 @@ declare type CryptoDaedalusWallet = { declare type CryptoAccount = { account: number, - cached_account_key: string, + root_cached_key: string, derivation_scheme: string } diff --git a/package-lock.json b/package-lock.json index 5236fd70a2..7aca3496c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,7 +76,7 @@ }, "acorn-jsx": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", "dev": true, "requires": { @@ -85,7 +85,7 @@ "dependencies": { "acorn": { "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "resolved": "http://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", "dev": true } @@ -176,7 +176,7 @@ }, "ansi-escapes": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", "dev": true }, @@ -559,7 +559,7 @@ }, "babel-eslint": { "version": "7.1.0", - "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-7.1.0.tgz", + "resolved": "http://registry.npmjs.org/babel-eslint/-/babel-eslint-7.1.0.tgz", "integrity": "sha1-1QalF0uiJOJaLRfhKOK6iYcTndw=", "dev": true, "requires": { @@ -4736,7 +4736,7 @@ }, "eslint": { "version": "3.9.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.9.1.tgz", + "resolved": "http://registry.npmjs.org/eslint/-/eslint-3.9.1.tgz", "integrity": "sha1-WoWXcG/GBIvGBhrHVNSiEdKPT1s=", "dev": true, "requires": { @@ -4755,7 +4755,7 @@ "ignore": "3.3.10", "imurmurhash": "0.1.4", "inquirer": "0.12.0", - "is-my-json-valid": "2.17.2", + "is-my-json-valid": "2.19.0", "is-resolvable": "1.1.0", "js-yaml": "3.7.0", "json-stable-stringify": "1.0.1", @@ -4784,7 +4784,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -4822,7 +4822,7 @@ }, "eslint-config-airbnb": { "version": "12.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-12.0.0.tgz", + "resolved": "http://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-12.0.0.tgz", "integrity": "sha1-qygrdWol8D0ErCZMJNZzoIqAMnA=", "dev": true, "requires": { @@ -4831,7 +4831,7 @@ }, "eslint-config-airbnb-base": { "version": "8.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-8.0.0.tgz", + "resolved": "http://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-8.0.0.tgz", "integrity": "sha1-xelYpGmrivdq/waLQ9eE5a/nTKc=", "dev": true }, @@ -4857,7 +4857,7 @@ }, "eslint-plugin-import": { "version": "1.16.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-1.16.0.tgz", + "resolved": "http://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-1.16.0.tgz", "integrity": "sha1-svoH68xTUE0PKkR3WC7Iv/GHG58=", "dev": true, "requires": { @@ -4893,7 +4893,7 @@ }, "eslint-plugin-jsx-a11y": { "version": "2.2.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-2.2.3.tgz", + "resolved": "http://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-2.2.3.tgz", "integrity": "sha1-TjXLcbin23AqxBXIBuuOjZ6mxl0=", "dev": true, "requires": { @@ -4910,7 +4910,7 @@ }, "eslint-plugin-react": { "version": "6.5.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.5.0.tgz", + "resolved": "http://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.5.0.tgz", "integrity": "sha1-k/iUtkaZdDBGCeWciYOmo9yBc4w=", "dev": true, "requires": { @@ -4920,7 +4920,7 @@ }, "espree": { "version": "3.5.4", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", + "resolved": "http://registry.npmjs.org/espree/-/espree-3.5.4.tgz", "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", "dev": true, "requires": { @@ -5434,7 +5434,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -6047,10 +6047,13 @@ } }, "generate-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", - "dev": true + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", + "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", + "dev": true, + "requires": { + "is-property": "1.0.2" + } }, "generate-object-property": { "version": "1.2.0", @@ -6592,7 +6595,7 @@ }, "inquirer": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", + "resolved": "http://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", "dev": true, "requires": { @@ -6619,7 +6622,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -6842,12 +6845,12 @@ "dev": true }, "is-my-json-valid": { - "version": "2.17.2", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz", - "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.19.0.tgz", + "integrity": "sha512-mG0f/unGX1HZ5ep4uhRaPOS8EkAY8/j6mDRMJrutq4CqhoJWYp7qAlonIPy3TV7p3ju4TK9fo/PbnoksWmsp5Q==", "dev": true, "requires": { - "generate-function": "2.0.0", + "generate-function": "2.3.1", "generate-object-property": "1.2.0", "is-my-ip-valid": "1.0.0", "jsonpointer": "4.0.1", @@ -8877,7 +8880,7 @@ }, "onetime": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "dev": true }, @@ -11274,7 +11277,7 @@ }, "progress": { "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "resolved": "http://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, @@ -17008,7 +17011,7 @@ }, "slice-ansi": { "version": "0.0.4", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "resolved": "http://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", "dev": true }, @@ -17538,7 +17541,7 @@ }, "table": { "version": "3.8.3", - "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "resolved": "http://registry.npmjs.org/table/-/table-3.8.3.tgz", "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", "dev": true, "requires": { @@ -17574,7 +17577,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { From e81804021fe05c545b58d50168abc657015dfd94 Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Tue, 6 Nov 2018 23:40:19 +0900 Subject: [PATCH 2/6] first clear of eslint errors --- app/App.js | 3 +- app/api/ada/adaAccount.js | 1 - app/api/ada/adaAddress.js | 11 +- app/api/ada/adaLocalStorage.js | 2 +- .../ada/adaTransactions/adaNewTransactions.js | 16 +- .../adaTransactions/adaTransactionsHistory.js | 20 +- app/api/ada/adaWallet.js | 20 +- app/api/ada/daedalusTransfer.js | 14 +- app/api/ada/errors.js | 14 - app/api/ada/index.js | 36 +- app/api/ada/lib/cardanoCrypto/cryptoWallet.js | 11 +- app/api/ada/lib/lovefieldDatabase.js | 55 +- app/api/ada/lib/yoroi-backend-api.js | 41 +- app/api/ada/restoreAdaWallet.js | 53 +- app/api/common.js | 3 +- .../DaedalusTransferErrorPage.js | 3 +- .../DaedalusTransferFormPage.js | 7 +- .../DaedalusTransferInstructionsPage.js | 5 +- .../DaedalusTransferSummaryPage.js | 3 +- .../DaedalusTransferWaitingPage.js | 3 +- app/components/layout/CenteredLayout.js | 3 +- app/components/layout/SidebarLayout.js | 3 +- app/components/layout/TopBar.js | 3 +- app/components/layout/TopBarCategory.js | 3 +- app/components/layout/TopBarLayout.js | 3 +- .../layout/VerticalFlexContainer.js | 3 +- app/components/loading/Loading.js | 3 +- .../LanguageSelectionForm.js | 3 +- .../profile/terms-of-use/TermsOfUseForm.js | 5 +- .../profile/terms-of-use/TermsOfUseText.js | 3 +- app/components/settings/SettingsLayout.js | 3 +- .../settings/categories/GeneralSettings.js | 3 +- .../settings/categories/SupportSettings.js | 3 +- .../settings/categories/TermsOfUseSettings.js | 3 +- app/components/settings/menu/SettingsMenu.js | 3 +- .../settings/menu/SettingsMenuItem.js | 3 +- app/components/sidebar/Sidebar.js | 9 +- app/components/sidebar/SidebarCategory.js | 3 +- app/components/wallet/WalletAdd.js | 3 +- app/components/wallet/WalletBackupDialog.js | 9 +- app/components/wallet/WalletCreateDialog.js | 3 +- app/components/wallet/WalletReceive.js | 5 +- app/components/wallet/WalletRestoreDialog.js | 3 +- .../wallet/WalletSendConfirmationDialog.js | 6 +- app/components/wallet/WalletSendForm.js | 3 +- app/components/wallet/WalletSettings.js | 3 +- .../wallet/backup-recovery/MnemonicWord.js | 3 +- .../WalletBackupPrivacyWarningDialog.js | 3 +- .../WalletRecoveryInstructions.js | 3 +- .../WalletRecoveryPhraseDisplayDialog.js | 3 +- .../WalletRecoveryPhraseEntryDialog.js | 3 +- .../WalletRecoveryPhraseMnemonic.js | 3 +- .../wallet/layouts/WalletWithNavigation.js | 3 +- .../wallet/navigation/WalletNavButton.js | 3 +- .../wallet/navigation/WalletNavigation.js | 3 +- .../settings/ChangeWalletPasswordDialog.js | 3 +- .../wallet/summary/WalletSummary.js | 3 +- .../wallet/transactions/Transaction.js | 2 +- .../transactions/WalletNoTransactions.js | 3 +- .../transactions/WalletTransactionsList.js | 3 +- app/components/widgets/BorderedBox.js | 3 +- app/components/widgets/Dialog.js | 12 +- .../widgets/forms/InlineEditingInput.js | 3 +- app/components/widgets/forms/ReadOnlyInput.js | 3 +- app/config/numbersConfig.js | 1 + app/containers/LoadingPage.js | 3 +- app/containers/MainLayout.js | 3 +- app/containers/TopBarContainer.js | 3 +- .../daedalusTransfer/DaedalusTransferPage.js | 3 +- .../profile/LanguageSelectionPage.js | 3 +- app/containers/profile/TermsOfUsePage.js | 3 +- app/containers/settings/Settings.js | 7 +- .../categories/GeneralSettingsPage.js | 3 +- .../categories/SupportSettingsPage.js | 7 +- .../categories/TermsOfUseSettingsPage.js | 3 +- .../settings/categories/WalletSettingsPage.js | 3 +- app/containers/wallet/NoWalletsPage.js | 3 +- app/containers/wallet/Wallet.js | 3 +- app/containers/wallet/WalletAddPage.js | 9 +- app/containers/wallet/WalletReceivePage.js | 3 +- app/containers/wallet/WalletSendPage.js | 3 +- app/containers/wallet/WalletSummaryPage.js | 3 +- .../ChangeWalletPasswordDialogContainer.js | 3 +- .../dialogs/WalletBackupDialogContainer.js | 3 +- .../dialogs/WalletCreateDialogContainer.js | 3 +- .../dialogs/WalletRestoreDialogContainer.js | 3 +- .../WalletSendConfirmationDialogContainer.js | 3 +- app/domain/WalletTransaction.js | 11 +- app/i18n/global-messages.js | 4 +- app/scripts/generateSTxs.js | 13 +- app/stores/LoadingStore.js | 31 +- app/stores/ProfileStore.js | 3 +- app/stores/UiNotificationsStore.js | 3 +- app/stores/WalletBackupStore.js | 3 +- app/stores/ada/AdaWalletsStore.js | 2 +- app/stores/ada/DaedalusTransferStore.js | 2 +- app/stores/lib/LocalizedRequest.js | 4 + app/stores/lib/Request.js | 51 +- app/stores/lib/Store.js | 2 +- app/utils/passwordCipher.js | 11 +- js-cardano-wasm | 2 +- package-lock.json | 1173 +++++++++++------ package.json | 18 +- scripts/build.js | 1 - webpack/customPublicPath.js | 1 + 105 files changed, 1228 insertions(+), 668 deletions(-) diff --git a/app/App.js b/app/App.js index 504bf6560a..5c5f3634dc 100644 --- a/app/App.js +++ b/app/App.js @@ -18,8 +18,9 @@ import ThemeManager from './ThemeManager'; // https://github.com/yahoo/react-intl/wiki#loading-locale-data addLocaleData([...en, ...ko, ...ja, ...zh]); +export default @observer -export default class App extends Component<{ +class App extends Component<{ stores: StoresMap, actions: ActionsMap, history: Object, diff --git a/app/api/ada/adaAccount.js b/app/api/ada/adaAccount.js index 00a2711aa3..64dfedf6df 100644 --- a/app/api/ada/adaAccount.js +++ b/app/api/ada/adaAccount.js @@ -21,7 +21,6 @@ export function createCryptoAccount( accountIndex: number = ACCOUNT_INDEX ): CryptoAccount { const cryptoWallet = getCryptoWalletFromMasterKey(masterKey, walletPassword); - // eslint-disable-next-line space-infix-ops const result = getResultOrFail(Wallet.newAccount(cryptoWallet, accountIndex)); return Object.assign({}, { account: accountIndex }, result); } diff --git a/app/api/ada/adaAddress.js b/app/api/ada/adaAddress.js index bc21d4fad3..944cbd53b3 100644 --- a/app/api/ada/adaAddress.js +++ b/app/api/ada/adaAddress.js @@ -32,7 +32,7 @@ const { MAX_ALLOWED_UNUSED_ADDRESSES } = config.wallets; export function isValidAdaAddress(address: string): Promise { try { - const result = getResultOrFail(Wallet.checkAddress(getAddressInHex(address))); + const result = getResultOrFail(Wallet.checkAddress(getAddressInHex(address))); return Promise.resolve(result); } catch (validateAddressError) { Logger.error('adaAddress::isValidAdaAddress error: ' + @@ -94,8 +94,9 @@ export async function createAdaAddress( ): Promise { const filteredAddresses = await getAdaAddressesByType(addressType); const addressIndex = filteredAddresses.length; - const [address] = getResultOrFail( - Wallet.generateAddresses(cryptoAccount, addressType, [addressIndex])); + const [address] = getResultOrFail>( + Wallet.generateAddresses(cryptoAccount, addressType, [addressIndex]) + ); return toAdaAddress(cryptoAccount.account, addressType, addressIndex, address); } @@ -112,8 +113,8 @@ export async function saveAsAdaAddresses( addresses: Array, addressType: AddressType ): Promise { - const mappedAddresses: Array = addresses.map((hash, index) => + const mappedAddresses: Array = addresses.map((hash, index) => ( toAdaAddress(cryptoAccount.account, addressType, index, hash) - ); + )); return saveAddresses(mappedAddresses, addressType); } diff --git a/app/api/ada/adaLocalStorage.js b/app/api/ada/adaLocalStorage.js index 467bfa0771..64b9dc5a82 100644 --- a/app/api/ada/adaLocalStorage.js +++ b/app/api/ada/adaLocalStorage.js @@ -1,5 +1,5 @@ // @flow -import type { AdaWallet } from '../ada/adaTypes'; +import type { AdaWallet } from './adaTypes'; const storageKeys = { ACCOUNT_KEY: 'ACCOUNT', diff --git a/app/api/ada/adaTransactions/adaNewTransactions.js b/app/api/ada/adaTransactions/adaNewTransactions.js index 6692c0cc6a..761e4646c6 100644 --- a/app/api/ada/adaTransactions/adaNewTransactions.js +++ b/app/api/ada/adaTransactions/adaNewTransactions.js @@ -75,6 +75,7 @@ export async function newAdaTransaction( ): Promise { const masterKey = getWalletMasterKey(); const cryptoWallet = getCryptoWalletFromMasterKey(masterKey, password); + // eslint-disable-next-line camelcase const [{ cbor_encoded_tx, changed_used }, changeAdaAddr] = await _getAdaTransaction(receiver, amount, cryptoWallet); const signedTx = Buffer.from(cbor_encoded_tx).toString('base64'); @@ -100,10 +101,12 @@ export async function getAllUTXOsForAddresses( ): Promise> { try { const groupsOfAddresses = _.chunk(addresses, addressesLimit); - const promises = groupsOfAddresses.map(groupOfAddresses => - getUTXOsForAddresses(groupOfAddresses)); - return Promise.all(promises).then(groupsOfUTXOs => - groupsOfUTXOs.reduce((acc, groupOfUTXOs) => acc.concat(groupOfUTXOs), [])); + const promises = groupsOfAddresses + .map(groupOfAddresses => getUTXOsForAddresses(groupOfAddresses)); + return Promise.all(promises) + .then(groupsOfUTXOs => ( + groupsOfUTXOs.reduce((acc, groupOfUTXOs) => acc.concat(groupOfUTXOs), []) + )); } catch (getUtxosError) { Logger.error('adaNewTransactions::getAllUTXOsForAddresses error: ' + stringifyError(getUtxosError)); @@ -125,8 +128,9 @@ export async function getAdaTransactionFromSenders( const outputs = [{ address: receiver, value: amount }]; const senderUtxos = await getAllUTXOsForAddresses(_getAddresses(senders)); const inputs = _mapUTXOsToInputs(senderUtxos, addressesMap); - // eslint-disable-next-line space-infix-ops - const result = getResultOrFail(Wallet.spend(cryptoWallet, inputs, outputs, changeAddr)); + const result = getResultOrFail( + Wallet.spend(cryptoWallet, inputs, outputs, changeAddr) + ); return [result, changeAdaAddr]; } diff --git a/app/api/ada/adaTransactions/adaTransactionsHistory.js b/app/api/ada/adaTransactions/adaTransactionsHistory.js index e665098e2c..695074b2fc 100644 --- a/app/api/ada/adaTransactions/adaTransactionsHistory.js +++ b/app/api/ada/adaTransactions/adaTransactionsHistory.js @@ -27,7 +27,7 @@ import { UpdateAdaTxsHistoryError, } from '../errors'; import type - { +{ AdaTransaction, AdaTransactions, AdaTransactionInputOutput @@ -72,12 +72,12 @@ async function _updateAdaTxsHistory( ) { try { const mostRecentTx = Object.assign({}, existingTransactions[0]); - const dateFrom = mostRecentTx.ctMeta ? - moment(mostRecentTx.ctMeta.ctmUpdate) : - moment(new Date(0)); - const mappedTxs = await _getTxsForChunksOfAddresses(addresses, groupOfAddresses => + const dateFrom = mostRecentTx.ctMeta + ? moment(mostRecentTx.ctMeta.ctmUpdate) + : moment(new Date(0)); + const mappedTxs = await _getTxsForChunksOfAddresses(addresses, groupOfAddresses => ( _updateAdaTxsHistoryForGroupOfAddresses([], groupOfAddresses, dateFrom, addresses) - ); + )); return saveTxs(mappedTxs); } catch (error) { Logger.error('adaTransactionsHistory::updateAdaTxsHistory error: ' + stringifyError(error)); @@ -113,7 +113,8 @@ async function _updateAdaTxsHistoryForGroupOfAddresses( } const transactions = previousTxs.concat( - _mapToAdaTxs(history, allAddresses)); + _mapToAdaTxs(history, allAddresses) + ); if (history.length === transactionsLimit) { return await _updateAdaTxsHistoryForGroupOfAddresses( transactions, @@ -145,7 +146,7 @@ function _mapInputOutput(addresses, amounts): AdaTransactionInputOutput { } function _spenderData(txInputs, txOutputs, addresses) { - const sum = toSum => + const sum = toSum => ( toSum.reduce( ({ totalAmount, count }, [address, { getCCoin }]) => { if (addresses.indexOf(address) < 0) return { totalAmount, count }; @@ -158,7 +159,8 @@ function _spenderData(txInputs, txOutputs, addresses) { totalAmount: new BigNumber(0), count: 0 } - ); + ) + ); const incoming = sum(txOutputs); const outgoing = sum(txInputs); diff --git a/app/api/ada/adaWallet.js b/app/api/ada/adaWallet.js index ae52f5f78f..a70121b6d6 100644 --- a/app/api/ada/adaWallet.js +++ b/app/api/ada/adaWallet.js @@ -94,11 +94,13 @@ export function createAdaWallet({ return [adaWallet, masterKey]; } -export const isValidMnemonic = (phrase: string, numberOfWords: ?number) => - isValidAdaMnemonic(phrase, numberOfWords); +export const isValidMnemonic = (phrase: string, numberOfWords: ?number) => ( + isValidAdaMnemonic(phrase, numberOfWords) +); -export const getAdaAccountRecoveryPhrase = (): AdaWalletRecoveryPhraseResponse => - generateAdaMnemonic(); +export const getAdaAccountRecoveryPhrase = (): AdaWalletRecoveryPhraseResponse => ( + generateAdaMnemonic() +); export async function getBalance( addresses: Array @@ -108,8 +110,14 @@ export async function getBalance( const promises = groupsOfAddresses.map(groupOfAddresses => getUTXOsSumsForAddresses(groupOfAddresses)); const partialAmounts = await Promise.all(promises); - return partialAmounts.reduce((acc, partialAmount) => - acc.plus(partialAmount.sum ? new BigNumber(partialAmount.sum) : new BigNumber(0)), + return partialAmounts.reduce( + (acc, partialAmount) => ( + acc.plus( + partialAmount.sum + ? new BigNumber(partialAmount.sum) + : new BigNumber(0) + ) + ), new BigNumber(0) ); } catch (error) { diff --git a/app/api/ada/daedalusTransfer.js b/app/api/ada/daedalusTransfer.js index 66f25657d2..379589b192 100644 --- a/app/api/ada/daedalusTransfer.js +++ b/app/api/ada/daedalusTransfer.js @@ -9,7 +9,7 @@ import { Logger, stringifyError, } from '../../utils/logging'; -import { getResultOrFail } from '../ada/lib//cardanoCrypto/cryptoUtils'; +import { getResultOrFail } from './lib/cardanoCrypto/cryptoUtils'; import { LOVELACES_PER_ADA } from '../../config/numbersConfig'; import { getBalance } from './adaWallet'; import { @@ -39,10 +39,12 @@ export function getAddressesWithFunds(payload: { }): Array { try { const { secretWords, addresses } = payload; - const checker = - getResultOrFail(RandomAddressChecker.newCheckerFromMnemonics(secretWords)); - const addressesWithFunds = - getResultOrFail(RandomAddressChecker.checkAddresses(checker, addresses)); + const checker = getResultOrFail( + RandomAddressChecker.newCheckerFromMnemonics(secretWords) + ); + const addressesWithFunds = getResultOrFail>( + RandomAddressChecker.checkAddresses(checker, addresses) + ); return addressesWithFunds; } catch (error) { Logger.error(`daedalusTransfer::getAddressesWithFunds ${stringifyError(error)}`); @@ -65,7 +67,7 @@ export async function generateTransferTx(payload: { const wallet = getCryptoDaedalusWalletFromMnemonics(secretWords); const inputs = _getInputs(senderUtxos, addressesWithFunds); const output = await _getReceiverAddress(); - const tx = getResultOrFail(Wallet.move(wallet, inputs, output)); + const tx = getResultOrFail(Wallet.move(wallet, inputs, output)); return { recoveredBalance: recoveredBalance.dividedBy(LOVELACES_PER_ADA), fee: new BigNumber(tx.fee).dividedBy(LOVELACES_PER_ADA), diff --git a/app/api/ada/errors.js b/app/api/ada/errors.js index cf39af197c..ff9470f226 100644 --- a/app/api/ada/errors.js +++ b/app/api/ada/errors.js @@ -2,11 +2,6 @@ import { defineMessages } from 'react-intl'; import LocalizableError from '../../i18n/LocalizableError'; const messages = defineMessages({ - apiMethodNotYetImplementedError: { - id: 'api.errors.ApiMethodNotYetImplementedError', - defaultMessage: '!!!This API method is not yet implemented.', - description: '"This API method is not yet implemented." error message.' - }, walletAlreadyImportedError: { id: 'api.errors.WalletAlreadyImportedError', defaultMessage: '!!!Wallet you are trying to import already exists.', @@ -114,15 +109,6 @@ const messages = defineMessages({ } }); -export class ApiMethodNotYetImplementedError extends LocalizableError { - constructor() { - super({ - id: messages.apiMethodNotYetImplementedError.id, - defaultMessage: messages.apiMethodNotYetImplementedError.defaultMessage, - }); - } -} - export class WalletAlreadyImportedError extends LocalizableError { constructor() { super({ diff --git a/app/api/ada/index.js b/app/api/ada/index.js index 415b8cefe9..f18a0fe281 100644 --- a/app/api/ada/index.js +++ b/app/api/ada/index.js @@ -158,7 +158,9 @@ export default class AdaApi { Logger.debug('AdaApi::getWallets called'); try { const wallet = await getAdaWallet(); - const wallets: AdaWallets = wallet ? [wallet] : []; + const wallets: AdaWallets = wallet + ? [wallet] + : []; // Refresh wallet data Logger.debug('AdaApi::getWallets success: ' + stringifyData(wallets)); return wallets.map(data => _createWalletFromServerData(data)); @@ -176,12 +178,14 @@ export default class AdaApi { const adaAddresses: AdaAddresses = await getAdaAddressesByType('External'); Logger.debug('AdaApi::getAddresses success: ' + stringifyData(adaAddresses)); const addresses = adaAddresses.map((address => _createAddressFromServerData(address))); - return new Promise(resolve => - resolve({ - accountId: '0', /* We are using a SINGLE account */ - addresses - }) - ); + return new Promise(resolve => ( + resolve( + { + accountId: '0', /* We are using a SINGLE account */ + addresses + } + ) + )); } catch (error) { Logger.error('AdaApi::getAddresses error: ' + stringifyError(error)); throw new GenericApiError(); @@ -213,10 +217,12 @@ export default class AdaApi { await refreshTxs(); const history: AdaTransactions = await getAdaTxsHistoryByWallet(); Logger.debug('AdaApi::refreshTransactions success: ' + stringifyData(history)); - const transactions = limit ? history[0].slice(skip, skip + limit) : history[0]; - const mappedTransactions = transactions.map(data => + const transactions = limit + ? history[0].slice(skip, skip + limit) + : history[0]; + const mappedTransactions = transactions.map(data => ( _createTransactionFromServerData(data) - ); + )); return Promise.resolve({ transactions: mappedTransactions, total: history[1] @@ -302,8 +308,8 @@ export default class AdaApi { Logger.debug('AdaApi::calculateTransactionFee called'); const { receiver, amount } = request; try { - const response: AdaTransactionFee = await - getAdaTransactionFee(receiver, amount); + const response: AdaTransactionFee = + await getAdaTransactionFee(receiver, amount); Logger.debug( 'AdaApi::calculateTransactionFee success: ' + stringifyData(response) ); @@ -468,7 +474,7 @@ export default class AdaApi { const _createWalletFromServerData = action( 'AdaApi::_createWalletFromServerData', - (data: AdaWallet) => + (data: AdaWallet) => ( new Wallet({ id: data.cwId, amount: new BigNumber(data.cwAmount.getCCoin).dividedBy( @@ -478,11 +484,12 @@ const _createWalletFromServerData = action( assurance: data.cwMeta.cwAssurance, passwordUpdateDate: data.cwPassphraseLU }) + ) ); const _createAddressFromServerData = action( 'AdaApi::_createAddressFromServerData', - (data: AdaAddress) => + (data: AdaAddress) => ( new WalletAddress({ id: data.cadId, amount: new BigNumber(data.cadAmount.getCCoin).dividedBy( @@ -490,6 +497,7 @@ const _createAddressFromServerData = action( ), isUsed: data.cadIsUsed }) + ) ); const _conditionToTxState = (condition: string) => { diff --git a/app/api/ada/lib/cardanoCrypto/cryptoWallet.js b/app/api/ada/lib/cardanoCrypto/cryptoWallet.js index 270a977fc3..a2b8c1c928 100644 --- a/app/api/ada/lib/cardanoCrypto/cryptoWallet.js +++ b/app/api/ada/lib/cardanoCrypto/cryptoWallet.js @@ -17,11 +17,12 @@ export const generateAdaMnemonic = () => bip39.generateMnemonic(160).split(' '); export const isValidAdaMnemonic = ( phrase: string, numberOfWords: ?number = 15 -) => - phrase.split(' ').length === numberOfWords && bip39.validateMnemonic(phrase); +) => ( + phrase.split(' ').length === numberOfWords && bip39.validateMnemonic(phrase) +); export function generateWalletMasterKey(secretWords : string, password : string): string { - const entropy = new Buffer(bip39.mnemonicToEntropy(secretWords), 'hex'); + const entropy = Buffer.from(bip39.mnemonicToEntropy(secretWords), 'hex'); const masterKey: Uint8Array = HdWallet.fromEnhancedEntropy(entropy, ''); return encryptWithPassword(password, masterKey); } @@ -47,11 +48,11 @@ export function getCryptoWalletFromMasterKey( return wallet; } -/* FIXME: Should be pass a encrypted mnemonic and also the password to decrypt it*/ +// FIXME: Should be pass a encrypted mnemonic and also the password to decrypt it export function getCryptoDaedalusWalletFromMnemonics( secretWords: string, ): CryptoDaedalusWallet { - const wallet = getResultOrFail(Wallet.fromDaedalusMnemonic(secretWords)); + const wallet = getResultOrFail(Wallet.fromDaedalusMnemonic(secretWords)); wallet.config.protocol_magic = protocolMagic; return wallet; } diff --git a/app/api/ada/lib/lovefieldDatabase.js b/app/api/ada/lib/lovefieldDatabase.js index 1b13b40c04..006ce82be0 100644 --- a/app/api/ada/lib/lovefieldDatabase.js +++ b/app/api/ada/lib/lovefieldDatabase.js @@ -108,13 +108,11 @@ export const getAddressesListByType = addressType => { .where(addressesTable[addressesTableSchema.properties.type].eq(addressType)) .groupBy(addressesTable[addressesTableSchema.properties.id]) .exec() - .then(rows => rows.map(row => - Object.assign( - {}, - row[addressesTableSchema.name][addressesTableSchema.properties.value], - { cadIsUsed: !!row.timesUsed } - ) - )); + .then(rows => rows.map(row => Object.assign( + {}, + row[addressesTableSchema.name][addressesTableSchema.properties.value], + { cadIsUsed: !!row.timesUsed } + ))); }; export const saveAddresses = async (addresses, type) => { @@ -196,25 +194,32 @@ const _getAddressesIn = (addresses) => { .then(rows => rows.map(row => row[addressesTableSchema.properties.id])); }; -const _txToRow = (tx) => - _getTxsTable().createRow({ - id: tx.ctId, - date: tx.ctMeta.ctmDate, - value: tx, - state: tx.ctCondition, - lastUpdated: tx.ctMeta.ctmUpdate - }); - -const _addressToRow = (address, type) => - _getAddressesTable().createRow({ - id: address.cadId, - type, - value: address, - isUsed: address.cadIsUsed - }); +const _txToRow = (tx) => ( + _getTxsTable().createRow( + { + id: tx.ctId, + date: tx.ctMeta.ctmDate, + value: tx, + state: tx.ctCondition, + lastUpdated: tx.ctMeta.ctmUpdate + } + ) +); + +const _addressToRow = (address, type) => ( + _getAddressesTable().createRow( + { + id: address.cadId, + type, + value: address, + isUsed: address.cadIsUsed + } + ) +); -const _insertOrReplaceQuery = (rows, table) => - db.insertOrReplace().into(table).values(rows); +const _insertOrReplaceQuery = (rows, table) => ( + db.insertOrReplace().into(table).values(rows) +); const _getTable = (name) => db.getSchema().table(name); diff --git a/app/api/ada/lib/yoroi-backend-api.js b/app/api/ada/lib/yoroi-backend-api.js index 692f951f9b..74328d548f 100644 --- a/app/api/ada/lib/yoroi-backend-api.js +++ b/app/api/ada/lib/yoroi-backend-api.js @@ -20,8 +20,9 @@ const backendUrl = CONFIG.network.backendUrl; // TODO: Refactor service call in order to re-use common parameters -export const getUTXOsForAddresses = (addresses: Array) => - axios(`${backendUrl}/api/txs/utxoForAddresses`, +export const getUTXOsForAddresses = (addresses: Array) => ( + axios( + `${backendUrl}/api/txs/utxoForAddresses`, { method: 'post', data: { @@ -32,10 +33,12 @@ export const getUTXOsForAddresses = (addresses: Array) => .catch((error) => { Logger.error('yoroi-backend-api::getUTXOsForAddresses error: ' + stringifyError(error)); throw new GetUtxosForAddressesApiError(); - }); + }) +); -export const getUTXOsSumsForAddresses = (addresses: Array) => - axios(`${backendUrl}/api/txs/utxoSumForAddresses`, +export const getUTXOsSumsForAddresses = (addresses: Array) => ( + axios( + `${backendUrl}/api/txs/utxoSumForAddresses`, { method: 'post', data: { @@ -46,11 +49,12 @@ export const getUTXOsSumsForAddresses = (addresses: Array) => .catch((error) => { Logger.error('yoroi-backend-api::getUTXOsSumsForAddresses error: ' + stringifyError(error)); throw new GetUtxosSumsForAddressesApiError(); - }); + }) +); -export const getTransactionsHistoryForAddresses = (addresses: Array, - dateFrom: Moment) => - axios(`${backendUrl}/api/txs/history`, +export const getTransactionsHistoryForAddresses = (addresses: Array, dateFrom: Moment) => ( + axios( + `${backendUrl}/api/txs/history`, { method: 'post', data: { @@ -62,10 +66,12 @@ export const getTransactionsHistoryForAddresses = (addresses: Array, .catch((error) => { Logger.error('yoroi-backend-api::getTransactionsHistoryForAddresses error: ' + stringifyError(error)); throw new GetTxHistoryForAddressesApiError(); - }); + }) +); -export const sendTx = (signedTx: string) => - axios(`${backendUrl}/api/txs/signed`, +export const sendTx = (signedTx: string) => ( + axios( + `${backendUrl}/api/txs/signed`, { method: 'post', data: { @@ -79,10 +85,12 @@ export const sendTx = (signedTx: string) => throw new InvalidWitnessError(); } throw new SendTransactionApiError(); - }); + }) +); -export const checkAddressesInUse = (addresses: Array) => - axios(`${backendUrl}/api/addresses/filterUsed`, +export const checkAddressesInUse = (addresses: Array) => ( + axios( + `${backendUrl}/api/addresses/filterUsed`, { method: 'post', data: { @@ -93,4 +101,5 @@ export const checkAddressesInUse = (addresses: Array) => .catch((error) => { Logger.error('yoroi-backend-api::checkAddressesInUse error: ' + stringifyError(error)); throw new CheckAdressesInUseApiError(); - }); + }) +); diff --git a/app/api/ada/restoreAdaWallet.js b/app/api/ada/restoreAdaWallet.js index 635b61b1e3..222a232543 100644 --- a/app/api/ada/restoreAdaWallet.js +++ b/app/api/ada/restoreAdaWallet.js @@ -38,12 +38,13 @@ export async function restoreAdaWallet({ const [adaWallet, masterKey] = createAdaWallet({ walletPassword, walletInitData }); const cryptoAccount = createCryptoAccount(masterKey, walletPassword); try { - const externalAddressesToSave = await - _discoverAllAddressesFrom(cryptoAccount, 'External', -1, addressScanSize, addressRequestSize); - const internalAddressesToSave = await - _discoverAllAddressesFrom(cryptoAccount, 'Internal', -1, addressScanSize, addressRequestSize); + const externalAddressesToSave = + await _discoverAllAddressesFrom(cryptoAccount, 'External', -1, addressScanSize, addressRequestSize); + const internalAddressesToSave = + await _discoverAllAddressesFrom(cryptoAccount, 'Internal', -1, addressScanSize, addressRequestSize); if (externalAddressesToSave.length !== 0 || internalAddressesToSave.length !== 0) { // TODO: Store all at once + // eslint-disable-next-line no-await-in-loop await Promise.all([ saveAsAdaAddresses(cryptoAccount, externalAddressesToSave, 'External'), saveAsAdaAddresses(cryptoAccount, internalAddressesToSave, 'Internal') @@ -74,15 +75,24 @@ async function _discoverAllAddressesFrom( while (shouldScanNewBatch) { // Scans new batch (of size addressScanSize) to update the highestUsedIndex const [newHighestUsedIndex, newFetchedAddressesInfo] = - await _scanAddressesBatchFrom(fetchedAddressesInfo, cryptoAccount, addressType, - highestUsedIndex, scanSize, requestSize); + // TODO: make more efficient + // eslint-disable-next-line no-await-in-loop + await _scanAddressesBatchFrom( + fetchedAddressesInfo, + cryptoAccount, + addressType, + highestUsedIndex, + scanSize, + requestSize + ); shouldScanNewBatch = highestUsedIndex !== newHighestUsedIndex; highestUsedIndex = newHighestUsedIndex; fetchedAddressesInfo = newFetchedAddressesInfo; } - return fetchedAddressesInfo.slice(0, highestUsedIndex + 1) - .map((addressInfo) => addressInfo.address); + return fetchedAddressesInfo + .slice(0, highestUsedIndex + 1) + .map((addressInfo) => addressInfo.address); } async function _scanAddressesBatchFrom( @@ -94,8 +104,14 @@ async function _scanAddressesBatchFrom( requestSize: number, ) { const [newFetchedAddressesInfo, addressesToScan] = - await _getAddressToScan(fetchedAddressesInfo, cryptoAccount, - addressType, highestUsedIndex + 1, scanSize, requestSize); + await _getAddressToScan( + fetchedAddressesInfo, + cryptoAccount, + addressType, + highestUsedIndex + 1, + scanSize, + requestSize + ); const newHighestUsedIndex = addressesToScan.reduce((currentHighestIndex, addressInfo) => { if (addressInfo.index > currentHighestIndex && addressInfo.isUsed) { @@ -119,13 +135,20 @@ async function _getAddressToScan( // Requests new batch (of size addressRequestSize) to add to the currently fetched ones if (fetchedAddressesInfo.length < fromIndex + scanSize) { - const addressesIndex = _.range(fetchedAddressesInfo.length, - fetchedAddressesInfo.length + requestSize); + const addressesIndex = _.range( + fetchedAddressesInfo.length, + fetchedAddressesInfo.length + requestSize + ); const newAddresses = getResultOrFail( - Wallet.generateAddresses(cryptoAccount, addressType, addressesIndex)); + Wallet.generateAddresses(cryptoAccount, addressType, addressesIndex) + ); const usedAddresses = await checkAddressesInUse(newAddresses); - newFetchedAddressesInfo = _addFetchedAddressesInfo(fetchedAddressesInfo, newAddresses, - usedAddresses, addressesIndex); + newFetchedAddressesInfo = _addFetchedAddressesInfo( + fetchedAddressesInfo, + newAddresses, + usedAddresses, + addressesIndex + ); } return [ diff --git a/app/api/common.js b/app/api/common.js index 2ca88a3cbf..ac5aeb1285 100644 --- a/app/api/common.js +++ b/app/api/common.js @@ -1,6 +1,7 @@ import { defineMessages } from 'react-intl'; import LocalizableError from '../i18n/LocalizableError'; -import { WalletTransaction, Wallet } from '../domain/WalletTransaction'; +import WalletTransaction from '../domain/WalletTransaction'; +import Wallet from '../domain/Wallet'; const messages = defineMessages({ genericApiError: { diff --git a/app/components/daedalusTransfer/DaedalusTransferErrorPage.js b/app/components/daedalusTransfer/DaedalusTransferErrorPage.js index e7350efa3c..8a3a2197bd 100644 --- a/app/components/daedalusTransfer/DaedalusTransferErrorPage.js +++ b/app/components/daedalusTransfer/DaedalusTransferErrorPage.js @@ -26,8 +26,9 @@ type Props = { onCancel: Function }; +export default @observer -export default class DaedalusTransferErrorPage extends Component { +class DaedalusTransferErrorPage extends Component { static contextTypes = { intl: intlShape.isRequired diff --git a/app/components/daedalusTransfer/DaedalusTransferFormPage.js b/app/components/daedalusTransfer/DaedalusTransferFormPage.js index be0bd1d144..ad7716be3a 100644 --- a/app/components/daedalusTransfer/DaedalusTransferFormPage.js +++ b/app/components/daedalusTransfer/DaedalusTransferFormPage.js @@ -70,8 +70,9 @@ type Props = { suggestedMnemonics: Array, }; +export default @observer -export default class DaedalusTransferFormPage extends Component { +class DaedalusTransferFormPage extends Component { static contextTypes = { intl: intlShape.isRequired @@ -144,11 +145,11 @@ export default class DaedalusTransferFormPage extends Component {
    { - Array(2).fill().map((_, idx) => + Array(2).fill().map((_, idx) => (
    {intl.formatMessage({ id: messages[`step${idx}`].id })}
    - ) + )) }
diff --git a/app/components/daedalusTransfer/DaedalusTransferInstructionsPage.js b/app/components/daedalusTransfer/DaedalusTransferInstructionsPage.js index 2d67260af4..de98ec0111 100644 --- a/app/components/daedalusTransfer/DaedalusTransferInstructionsPage.js +++ b/app/components/daedalusTransfer/DaedalusTransferInstructionsPage.js @@ -81,8 +81,9 @@ type Props = { disableTransferFunds: boolean, }; +export default @observer -export default class DaedalusTransferInstructionsPage extends Component { +class DaedalusTransferInstructionsPage extends Component { static contextTypes = { intl: intlShape.isRequired @@ -116,7 +117,7 @@ export default class DaedalusTransferInstructionsPage extends Component { ]); return ( -
+
diff --git a/app/components/daedalusTransfer/DaedalusTransferSummaryPage.js b/app/components/daedalusTransfer/DaedalusTransferSummaryPage.js index 8555c534cd..b75ad4e878 100644 --- a/app/components/daedalusTransfer/DaedalusTransferSummaryPage.js +++ b/app/components/daedalusTransfer/DaedalusTransferSummaryPage.js @@ -62,8 +62,9 @@ type Props = { error: LocalizableError }; +export default @observer -export default class DaedalusTransferSummaryPage extends Component { +class DaedalusTransferSummaryPage extends Component { static contextTypes = { intl: intlShape.isRequired diff --git a/app/components/daedalusTransfer/DaedalusTransferWaitingPage.js b/app/components/daedalusTransfer/DaedalusTransferWaitingPage.js index d2d86f3212..f655b8ef73 100644 --- a/app/components/daedalusTransfer/DaedalusTransferWaitingPage.js +++ b/app/components/daedalusTransfer/DaedalusTransferWaitingPage.js @@ -32,8 +32,9 @@ type Props = { status: string }; +export default @observer -export default class DaedalusTransferWaitingPage extends Component { +class DaedalusTransferWaitingPage extends Component { static contextTypes = { intl: intlShape.isRequired diff --git a/app/components/layout/CenteredLayout.js b/app/components/layout/CenteredLayout.js index c9899bca80..1a4aefcd19 100644 --- a/app/components/layout/CenteredLayout.js +++ b/app/components/layout/CenteredLayout.js @@ -8,8 +8,9 @@ type Props = { children: Node, }; +export default @observer -export default class CenteredLayout extends Component { +class CenteredLayout extends Component { static defaultProps = { children: null diff --git a/app/components/layout/SidebarLayout.js b/app/components/layout/SidebarLayout.js index d4eed83f69..07aeec07d8 100644 --- a/app/components/layout/SidebarLayout.js +++ b/app/components/layout/SidebarLayout.js @@ -24,8 +24,9 @@ export const messages = defineMessages({ }, }); +export default @observer -export default class SidebarLayout extends Component { +class SidebarLayout extends Component { static defaultProps = { children: null diff --git a/app/components/layout/TopBar.js b/app/components/layout/TopBar.js index 110bc3e6d4..1fb2a0884a 100644 --- a/app/components/layout/TopBar.js +++ b/app/components/layout/TopBar.js @@ -25,8 +25,9 @@ type Props = { onCategoryClicked?: Function, }; +export default @observer -export default class TopBar extends Component { +class TopBar extends Component { render() { const { diff --git a/app/components/layout/TopBarCategory.js b/app/components/layout/TopBarCategory.js index 16983d7dd1..00469fdac9 100644 --- a/app/components/layout/TopBarCategory.js +++ b/app/components/layout/TopBarCategory.js @@ -13,8 +13,9 @@ type Props = { className: string, }; +export default @observer -export default class TopBarCategory extends Component { +class TopBarCategory extends Component { render() { const { icon, active, onClick, className } = this.props; const componentStyles = classNames([ diff --git a/app/components/layout/TopBarLayout.js b/app/components/layout/TopBarLayout.js index 7e662127a2..6398dd2f57 100644 --- a/app/components/layout/TopBarLayout.js +++ b/app/components/layout/TopBarLayout.js @@ -10,8 +10,9 @@ type Props = { notification?: ?Node, }; +export default @observer -export default class TopBarLayout extends Component { +class TopBarLayout extends Component { render() { const { children, topbar, notification } = this.props; diff --git a/app/components/layout/VerticalFlexContainer.js b/app/components/layout/VerticalFlexContainer.js index 996b022f56..5f46936439 100644 --- a/app/components/layout/VerticalFlexContainer.js +++ b/app/components/layout/VerticalFlexContainer.js @@ -8,8 +8,9 @@ type Props = { children?: ?Node, }; +export default @observer -export default class VerticalFlexContainer extends Component { +class VerticalFlexContainer extends Component { render() { const { children } = this.props; return ( diff --git a/app/components/loading/Loading.js b/app/components/loading/Loading.js index 241eddbde7..7f7de1509d 100644 --- a/app/components/loading/Loading.js +++ b/app/components/loading/Loading.js @@ -23,8 +23,9 @@ type Props = { error: ?LocalizableError }; +export default @observer -export default class Loading extends Component { +class Loading extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/profile/language-selection/LanguageSelectionForm.js b/app/components/profile/language-selection/LanguageSelectionForm.js index 989b90bc41..d820b7c873 100644 --- a/app/components/profile/language-selection/LanguageSelectionForm.js +++ b/app/components/profile/language-selection/LanguageSelectionForm.js @@ -32,8 +32,9 @@ type Props = { error?: ?LocalizableError, }; +export default @observer -export default class LanguageSelectionForm extends Component { +class LanguageSelectionForm extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/profile/terms-of-use/TermsOfUseForm.js b/app/components/profile/terms-of-use/TermsOfUseForm.js index 9a2d1cd29a..1fb61970d5 100644 --- a/app/components/profile/terms-of-use/TermsOfUseForm.js +++ b/app/components/profile/terms-of-use/TermsOfUseForm.js @@ -35,8 +35,9 @@ type State = { areTermsOfUseAccepted: boolean, }; +export default @observer -export default class TermsOfUseForm extends Component { +class TermsOfUseForm extends Component { static contextTypes = { intl: intlShape.isRequired, @@ -47,7 +48,7 @@ export default class TermsOfUseForm extends Component { }; toggleAcceptance() { - this.setState({ areTermsOfUseAccepted: !this.state.areTermsOfUseAccepted }); + this.setState(prevState => ({ areTermsOfUseAccepted: !prevState.areTermsOfUseAccepted })); } submit = () => { diff --git a/app/components/profile/terms-of-use/TermsOfUseText.js b/app/components/profile/terms-of-use/TermsOfUseText.js index bfc6689fdc..da861bb386 100644 --- a/app/components/profile/terms-of-use/TermsOfUseText.js +++ b/app/components/profile/terms-of-use/TermsOfUseText.js @@ -8,8 +8,9 @@ type Props = { localizedTermsOfUse: string, }; +export default @observer -export default class TermsOfUseText extends Component { +class TermsOfUseText extends Component { render() { return (
diff --git a/app/components/settings/SettingsLayout.js b/app/components/settings/SettingsLayout.js index a9d0017bd6..b1100188a7 100644 --- a/app/components/settings/SettingsLayout.js +++ b/app/components/settings/SettingsLayout.js @@ -9,8 +9,9 @@ type Props = { menu: Node, }; +export default @observer -export default class SettingsLayout extends Component { +class SettingsLayout extends Component { render() { const { menu, children } = this.props; return ( diff --git a/app/components/settings/categories/GeneralSettings.js b/app/components/settings/categories/GeneralSettings.js index 391edd3e33..a570460853 100644 --- a/app/components/settings/categories/GeneralSettings.js +++ b/app/components/settings/categories/GeneralSettings.js @@ -26,8 +26,9 @@ type Props = { error?: ?LocalizableError, }; +export default @observer -export default class GeneralSettings extends Component { +class GeneralSettings extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/settings/categories/SupportSettings.js b/app/components/settings/categories/SupportSettings.js index 3e20aff593..26c14ceece 100644 --- a/app/components/settings/categories/SupportSettings.js +++ b/app/components/settings/categories/SupportSettings.js @@ -63,8 +63,9 @@ type Props = { onDownloadLogs: Function, }; +export default @observer -export default class SupportSettings extends Component { +class SupportSettings extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/settings/categories/TermsOfUseSettings.js b/app/components/settings/categories/TermsOfUseSettings.js index 0fc4fb5b6a..fd005b52a4 100644 --- a/app/components/settings/categories/TermsOfUseSettings.js +++ b/app/components/settings/categories/TermsOfUseSettings.js @@ -8,8 +8,9 @@ type Props = { localizedTermsOfUse: string, }; +export default @observer -export default class TermsOfUseSettings extends Component { +class TermsOfUseSettings extends Component { render() { const { localizedTermsOfUse } = this.props; return ( diff --git a/app/components/settings/menu/SettingsMenu.js b/app/components/settings/menu/SettingsMenu.js index 93d9776f1b..3c90596044 100644 --- a/app/components/settings/menu/SettingsMenu.js +++ b/app/components/settings/menu/SettingsMenu.js @@ -35,8 +35,9 @@ type Props = { hasActiveWallet: boolean, }; +export default @observer -export default class SettingsMenu extends Component { +class SettingsMenu extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/settings/menu/SettingsMenuItem.js b/app/components/settings/menu/SettingsMenuItem.js index f93126fe6a..66b91d2a13 100644 --- a/app/components/settings/menu/SettingsMenuItem.js +++ b/app/components/settings/menu/SettingsMenuItem.js @@ -12,8 +12,9 @@ type Props = { disabled?: boolean, }; +export default @observer -export default class SettingsMenuItem extends Component { +class SettingsMenuItem extends Component { render() { const { label, active, disabled, onClick, className } = this.props; let state = styles.enabled; diff --git a/app/components/sidebar/Sidebar.js b/app/components/sidebar/Sidebar.js index b310324c2f..1b87b0c78d 100644 --- a/app/components/sidebar/Sidebar.js +++ b/app/components/sidebar/Sidebar.js @@ -20,8 +20,9 @@ type Props = { isDialogOpen: Function, }; +export default @observer -export default class Sidebar extends Component { +class Sidebar extends Component { static defaultProps = { isShowingSubMenus: false, @@ -32,8 +33,10 @@ export default class Sidebar extends Component { categories, activeSidebarCategory, onCategoryClicked, - /* openDialogAction, - isDialogOpen,*/ + /* + openDialogAction, + isDialogOpen, + */ } = this.props; const sidebarStyles = classNames([ diff --git a/app/components/sidebar/SidebarCategory.js b/app/components/sidebar/SidebarCategory.js index a7ca651f4b..4d9d8d9191 100644 --- a/app/components/sidebar/SidebarCategory.js +++ b/app/components/sidebar/SidebarCategory.js @@ -13,8 +13,9 @@ type Props = { className: string, }; +export default @observer -export default class SidebarCategory extends Component { +class SidebarCategory extends Component { render() { const { icon, active, onClick, className } = this.props; const componentStyles = classNames([ diff --git a/app/components/wallet/WalletAdd.js b/app/components/wallet/WalletAdd.js index 532c122823..b4d4fa0ebc 100644 --- a/app/components/wallet/WalletAdd.js +++ b/app/components/wallet/WalletAdd.js @@ -37,8 +37,9 @@ type Props = { isRestoreActive: boolean, }; +export default @observer -export default class WalletAdd extends Component { +class WalletAdd extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/WalletBackupDialog.js b/app/components/wallet/WalletBackupDialog.js index fc4450d7cf..f3a7476aa5 100644 --- a/app/components/wallet/WalletBackupDialog.js +++ b/app/components/wallet/WalletBackupDialog.js @@ -1,9 +1,9 @@ // @flow import React, { Component } from 'react'; import { observer } from 'mobx-react'; -import WalletBackupPrivacyWarningDialog from '../../components/wallet/backup-recovery/WalletBackupPrivacyWarningDialog'; -import WalletRecoveryPhraseDisplayDialog from '../../components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog'; -import WalletRecoveryPhraseEntryDialog from '../../components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog'; +import WalletBackupPrivacyWarningDialog from './backup-recovery/WalletBackupPrivacyWarningDialog'; +import WalletRecoveryPhraseDisplayDialog from './backup-recovery/WalletRecoveryPhraseDisplayDialog'; +import WalletRecoveryPhraseEntryDialog from './backup-recovery/WalletRecoveryPhraseEntryDialog'; type Props = { currentStep: ?string, @@ -30,8 +30,9 @@ type Props = { onRestartBackup: Function, }; +export default @observer -export default class WalletBackupDialog extends Component { +class WalletBackupDialog extends Component { render() { const { diff --git a/app/components/wallet/WalletCreateDialog.js b/app/components/wallet/WalletCreateDialog.js index 73bb16b355..7b162fc534 100644 --- a/app/components/wallet/WalletCreateDialog.js +++ b/app/components/wallet/WalletCreateDialog.js @@ -59,8 +59,9 @@ type State = { isSubmitting: boolean, }; +export default @observer -export default class WalletCreateDialog extends Component { +class WalletCreateDialog extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/WalletReceive.js b/app/components/wallet/WalletReceive.js index 5ea2c8420b..b7b4c6480c 100644 --- a/app/components/wallet/WalletReceive.js +++ b/app/components/wallet/WalletReceive.js @@ -71,8 +71,9 @@ type State = { showUsed: boolean, }; +export default @observer -export default class WalletReceive extends Component { +class WalletReceive extends Component { static contextTypes = { intl: intlShape.isRequired, @@ -83,7 +84,7 @@ export default class WalletReceive extends Component { }; toggleUsedAddresses = () => { - this.setState({ showUsed: !this.state.showUsed }); + this.setState(prevState => ({ showUsed: !prevState.showUsed })); }; submit = () => { diff --git a/app/components/wallet/WalletRestoreDialog.js b/app/components/wallet/WalletRestoreDialog.js index c75ffb4fbc..af05b49bd5 100644 --- a/app/components/wallet/WalletRestoreDialog.js +++ b/app/components/wallet/WalletRestoreDialog.js @@ -85,8 +85,9 @@ type Props = { suggestedMnemonics: Array, }; +export default @observer -export default class WalletRestoreDialog extends Component { +class WalletRestoreDialog extends Component { static contextTypes = { intl: intlShape.isRequired diff --git a/app/components/wallet/WalletSendConfirmationDialog.js b/app/components/wallet/WalletSendConfirmationDialog.js index 093e33ecf3..6608391c16 100644 --- a/app/components/wallet/WalletSendConfirmationDialog.js +++ b/app/components/wallet/WalletSendConfirmationDialog.js @@ -1,4 +1,7 @@ // @flow + +/* eslint react/jsx-one-expression-per-line: 0 */ // the   in the html breaks this + import React, { Component } from 'react'; import { observer } from 'mobx-react'; import classnames from 'classnames'; @@ -75,8 +78,9 @@ type Props = { currencyUnit: string, }; +export default @observer -export default class WalletSendConfirmationDialog extends Component { +class WalletSendConfirmationDialog extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/WalletSendForm.js b/app/components/wallet/WalletSendForm.js index 6b8fd03f3a..45f331933a 100755 --- a/app/components/wallet/WalletSendForm.js +++ b/app/components/wallet/WalletSendForm.js @@ -118,8 +118,9 @@ type State = { transactionFeeError: ?string, }; +export default @observer -export default class WalletSendForm extends Component { +class WalletSendForm extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/WalletSettings.js b/app/components/wallet/WalletSettings.js index 9e44152b3e..3b01744a8d 100644 --- a/app/components/wallet/WalletSettings.js +++ b/app/components/wallet/WalletSettings.js @@ -51,8 +51,9 @@ type Props = { lastUpdatedField: ?string, }; +export default @observer -export default class WalletSettings extends Component { +class WalletSettings extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/backup-recovery/MnemonicWord.js b/app/components/wallet/backup-recovery/MnemonicWord.js index ed0d99ff18..7e8e3633c3 100644 --- a/app/components/wallet/backup-recovery/MnemonicWord.js +++ b/app/components/wallet/backup-recovery/MnemonicWord.js @@ -13,8 +13,9 @@ type Props = { onClick: Function, }; +export default @observer -export default class MnemonicWord extends Component { +class MnemonicWord extends Component { render() { const { word, index, isActive, onClick } = this.props; diff --git a/app/components/wallet/backup-recovery/WalletBackupPrivacyWarningDialog.js b/app/components/wallet/backup-recovery/WalletBackupPrivacyWarningDialog.js index 1fa3d2beae..ec152f3e40 100644 --- a/app/components/wallet/backup-recovery/WalletBackupPrivacyWarningDialog.js +++ b/app/components/wallet/backup-recovery/WalletBackupPrivacyWarningDialog.js @@ -40,8 +40,9 @@ type Props = { onCancelBackup: Function, }; +export default @observer -export default class WalletBackupPrivacyWarningDialog extends Component { +class WalletBackupPrivacyWarningDialog extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/backup-recovery/WalletRecoveryInstructions.js b/app/components/wallet/backup-recovery/WalletRecoveryInstructions.js index cfdf103504..5cf767881d 100644 --- a/app/components/wallet/backup-recovery/WalletRecoveryInstructions.js +++ b/app/components/wallet/backup-recovery/WalletRecoveryInstructions.js @@ -8,8 +8,9 @@ type Props = { instructionsText: string | Element, }; +export default @observer -export default class WalletRecoveryInstructions extends Component { +class WalletRecoveryInstructions extends Component { render() { const { instructionsText } = this.props; diff --git a/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.js b/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.js index a221d08d91..ae8c7a8ca7 100644 --- a/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.js +++ b/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.js @@ -30,8 +30,9 @@ type Props = { onCancelBackup: Function, }; +export default @observer -export default class WalletRecoveryPhraseDisplayDialog extends Component { +class WalletRecoveryPhraseDisplayDialog extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.js b/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.js index 89e039d0d8..a069ed0950 100644 --- a/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.js +++ b/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.js @@ -60,8 +60,9 @@ type Props = { onFinishBackup: Function, }; +export default @observer -export default class WalletRecoveryPhraseEntryDialog extends Component { +class WalletRecoveryPhraseEntryDialog extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/backup-recovery/WalletRecoveryPhraseMnemonic.js b/app/components/wallet/backup-recovery/WalletRecoveryPhraseMnemonic.js index 43e50ea331..83630a4612 100644 --- a/app/components/wallet/backup-recovery/WalletRecoveryPhraseMnemonic.js +++ b/app/components/wallet/backup-recovery/WalletRecoveryPhraseMnemonic.js @@ -7,8 +7,9 @@ type Props = { phrase: string, }; +export default @observer -export default class WalletRecoveryPhraseMnemonic extends Component { +class WalletRecoveryPhraseMnemonic extends Component { render() { const { phrase } = this.props; diff --git a/app/components/wallet/layouts/WalletWithNavigation.js b/app/components/wallet/layouts/WalletWithNavigation.js index 196350305d..d9188a890f 100644 --- a/app/components/wallet/layouts/WalletWithNavigation.js +++ b/app/components/wallet/layouts/WalletWithNavigation.js @@ -11,8 +11,9 @@ type Props = { onWalletNavItemClick: Function, }; +export default @observer -export default class WalletWithNavigation extends Component { +class WalletWithNavigation extends Component { render() { const { children, isActiveScreen, onWalletNavItemClick } = this.props; diff --git a/app/components/wallet/navigation/WalletNavButton.js b/app/components/wallet/navigation/WalletNavButton.js index 587374ff55..d82a6a2960 100755 --- a/app/components/wallet/navigation/WalletNavButton.js +++ b/app/components/wallet/navigation/WalletNavButton.js @@ -13,8 +13,9 @@ type Props = { className?: string, }; +export default @observer -export default class WalletNavButton extends Component { +class WalletNavButton extends Component { render() { const { isActive, /* icon, */ onClick, className } = this.props; diff --git a/app/components/wallet/navigation/WalletNavigation.js b/app/components/wallet/navigation/WalletNavigation.js index 4fa5b52342..c988062c41 100755 --- a/app/components/wallet/navigation/WalletNavigation.js +++ b/app/components/wallet/navigation/WalletNavigation.js @@ -31,8 +31,9 @@ type Props = { onNavItemClick: Function, }; +export default @observer -export default class WalletNavigation extends Component { +class WalletNavigation extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/settings/ChangeWalletPasswordDialog.js b/app/components/wallet/settings/ChangeWalletPasswordDialog.js index 75c06bce08..483fec17ca 100644 --- a/app/components/wallet/settings/ChangeWalletPasswordDialog.js +++ b/app/components/wallet/settings/ChangeWalletPasswordDialog.js @@ -77,8 +77,9 @@ type State = { removePassword: boolean, }; +export default @observer -export default class ChangeWalletPasswordDialog extends Component { +class ChangeWalletPasswordDialog extends Component { static defaultProps = { currentPasswordValue: '', diff --git a/app/components/wallet/summary/WalletSummary.js b/app/components/wallet/summary/WalletSummary.js index 4447407f9f..e0939f4737 100644 --- a/app/components/wallet/summary/WalletSummary.js +++ b/app/components/wallet/summary/WalletSummary.js @@ -33,8 +33,9 @@ type Props = { isLoadingTransactions: boolean, }; +export default @observer -export default class WalletSummary extends Component { +class WalletSummary extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/transactions/Transaction.js b/app/components/wallet/transactions/Transaction.js index 2c45bf78f9..5f9a4efd1f 100644 --- a/app/components/wallet/transactions/Transaction.js +++ b/app/components/wallet/transactions/Transaction.js @@ -139,7 +139,7 @@ export default class Transaction extends Component { }; toggleDetails() { - this.setState({ isExpanded: !this.state.isExpanded }); + this.setState(prevState => ({ isExpanded: !prevState.isExpanded })); } render() { diff --git a/app/components/wallet/transactions/WalletNoTransactions.js b/app/components/wallet/transactions/WalletNoTransactions.js index f7a8006ff4..d866b81ae2 100644 --- a/app/components/wallet/transactions/WalletNoTransactions.js +++ b/app/components/wallet/transactions/WalletNoTransactions.js @@ -7,8 +7,9 @@ type Props = { label: string, }; +export default @observer -export default class WalletNoTransactions extends Component { +class WalletNoTransactions extends Component { render() { return ( diff --git a/app/components/wallet/transactions/WalletTransactionsList.js b/app/components/wallet/transactions/WalletTransactionsList.js index 716c3e40d9..4b0b70e9bb 100644 --- a/app/components/wallet/transactions/WalletTransactionsList.js +++ b/app/components/wallet/transactions/WalletTransactionsList.js @@ -42,8 +42,9 @@ type Props = { onLoadMore: Function, }; +export default @observer -export default class WalletTransactionsList extends Component { +class WalletTransactionsList extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/widgets/BorderedBox.js b/app/components/widgets/BorderedBox.js index 2ce9282e1a..e1ea9954ea 100644 --- a/app/components/widgets/BorderedBox.js +++ b/app/components/widgets/BorderedBox.js @@ -8,8 +8,9 @@ type Props = { children?: Node, }; +export default @observer -export default class BorderedBox extends Component { +class BorderedBox extends Component { render() { const { children } = this.props; diff --git a/app/components/widgets/Dialog.js b/app/components/widgets/Dialog.js index c343ac6dd3..8375a9e72f 100644 --- a/app/components/widgets/Dialog.js +++ b/app/components/widgets/Dialog.js @@ -42,19 +42,19 @@ export default class Dialog extends Component { >
- {title && + {title && (

{title}

-
+
) } - {children && + {children && (
{children} -
+
) } - {actions && + {actions && (
{_.map(actions, (action, key) => { const buttonClasses = classnames([ @@ -72,7 +72,7 @@ export default class Dialog extends Component { /> ); })} -
+
) } {closeButton ? React.cloneElement(closeButton, { onClose }) : null} diff --git a/app/components/widgets/forms/InlineEditingInput.js b/app/components/widgets/forms/InlineEditingInput.js index f225a52ca8..d7277733aa 100644 --- a/app/components/widgets/forms/InlineEditingInput.js +++ b/app/components/widgets/forms/InlineEditingInput.js @@ -44,8 +44,9 @@ type State = { isActive: boolean, }; +export default @observer -export default class InlineEditingInput extends Component { +class InlineEditingInput extends Component { state = { isActive: false, diff --git a/app/components/widgets/forms/ReadOnlyInput.js b/app/components/widgets/forms/ReadOnlyInput.js index b75e79a355..0e8539b2b8 100644 --- a/app/components/widgets/forms/ReadOnlyInput.js +++ b/app/components/widgets/forms/ReadOnlyInput.js @@ -15,8 +15,9 @@ type Props = { onClick: Function, }; +export default @observer -export default class ReadOnlyInput extends Component { +class ReadOnlyInput extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/config/numbersConfig.js b/app/config/numbersConfig.js index 72e3532da1..973a561c39 100644 --- a/app/config/numbersConfig.js +++ b/app/config/numbersConfig.js @@ -1,3 +1,4 @@ export const LOVELACES_PER_ADA = 1000000; export const MAX_INTEGER_PLACES_IN_ADA = 11; export const DECIMAL_PLACES_IN_ADA = 6; +export const MAX_ADA_WALLETS_COUNT = 1; diff --git a/app/containers/LoadingPage.js b/app/containers/LoadingPage.js index f882f568d2..153f7ecee1 100644 --- a/app/containers/LoadingPage.js +++ b/app/containers/LoadingPage.js @@ -16,8 +16,9 @@ export const messages = defineMessages({ }, }); +export default @inject('stores', 'actions') @observer -export default class LoadingPage extends Component { +class LoadingPage extends Component { render() { const { stores } = this.props; diff --git a/app/containers/MainLayout.js b/app/containers/MainLayout.js index 57337ebcce..4ab1433860 100644 --- a/app/containers/MainLayout.js +++ b/app/containers/MainLayout.js @@ -14,8 +14,9 @@ export type MainLayoutProps = { topbar: ?any }; +export default @inject('stores', 'actions') @observer -export default class MainLayout extends Component { +class MainLayout extends Component { static defaultProps = { actions: null, stores: null, diff --git a/app/containers/TopBarContainer.js b/app/containers/TopBarContainer.js index 6457d68258..6db3113371 100644 --- a/app/containers/TopBarContainer.js +++ b/app/containers/TopBarContainer.js @@ -10,8 +10,9 @@ const { formattedWalletAmount } = resolver('utils/formatters'); type Props = InjectedProps; +export default @observer -export default class TopBarContainer extends Component { +class TopBarContainer extends Component { static defaultProps = { actions: null, stores: null }; render() { diff --git a/app/containers/daedalusTransfer/DaedalusTransferPage.js b/app/containers/daedalusTransfer/DaedalusTransferPage.js index 3148724a7e..29c0b90087 100644 --- a/app/containers/daedalusTransfer/DaedalusTransferPage.js +++ b/app/containers/daedalusTransfer/DaedalusTransferPage.js @@ -25,8 +25,9 @@ const messages = defineMessages({ }, }); +export default @inject('stores', 'actions') @observer -export default class DaedalusTransferPage extends Component { +class DaedalusTransferPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/profile/LanguageSelectionPage.js b/app/containers/profile/LanguageSelectionPage.js index d82bcd712f..f247bde574 100644 --- a/app/containers/profile/LanguageSelectionPage.js +++ b/app/containers/profile/LanguageSelectionPage.js @@ -15,8 +15,9 @@ const messages = defineMessages({ }, }); +export default @inject('stores', 'actions') @observer -export default class LanguageSelectionPage extends Component { +class LanguageSelectionPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/profile/TermsOfUsePage.js b/app/containers/profile/TermsOfUsePage.js index af7d3f85ad..1aac3296ad 100644 --- a/app/containers/profile/TermsOfUsePage.js +++ b/app/containers/profile/TermsOfUsePage.js @@ -15,8 +15,9 @@ const messages = defineMessages({ }, }); +export default @inject('stores', 'actions') @observer -export default class TermsOfUsePage extends Component { +class TermsOfUsePage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/settings/Settings.js b/app/containers/settings/Settings.js index ba9dbf74f5..da8db70e4a 100644 --- a/app/containers/settings/Settings.js +++ b/app/containers/settings/Settings.js @@ -18,8 +18,9 @@ const messages = defineMessages({ }, }); +export default @inject('stores', 'actions') @observer -export default class Settings extends Component { +class Settings extends Component { static defaultProps = { actions: null, stores: null }; @@ -47,7 +48,7 @@ export default class Settings extends Component { ); return ( { @@ -56,7 +57,7 @@ export default class Settings extends Component { categories={sidebar.CATEGORIES} activeSidebarCategory={sidebar.activeSidebarCategory} /> - } + )} > {children} diff --git a/app/containers/settings/categories/GeneralSettingsPage.js b/app/containers/settings/categories/GeneralSettingsPage.js index 53d2833111..938231260f 100644 --- a/app/containers/settings/categories/GeneralSettingsPage.js +++ b/app/containers/settings/categories/GeneralSettingsPage.js @@ -4,8 +4,9 @@ import { observer, inject } from 'mobx-react'; import GeneralSettings from '../../../components/settings/categories/GeneralSettings'; import type { InjectedProps } from '../../../types/injectedPropsType'; +export default @inject('stores', 'actions') @observer -export default class GeneralSettingsPage extends Component { +class GeneralSettingsPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/settings/categories/SupportSettingsPage.js b/app/containers/settings/categories/SupportSettingsPage.js index b30511ca80..82d8360cec 100644 --- a/app/containers/settings/categories/SupportSettingsPage.js +++ b/app/containers/settings/categories/SupportSettingsPage.js @@ -3,11 +3,12 @@ import React, { Component } from 'react'; import { observer, inject } from 'mobx-react'; import { handleExternalLinkClick } from '../../../utils/routing'; import SupportSettings from '../../../components/settings/categories/SupportSettings'; -import { downloadLogs } from '../../../../app/utils/logging'; +import { downloadLogs } from '../../../utils/logging'; import type { InjectedProps } from '../../../types/injectedPropsType'; +export default @inject('stores', 'actions') @observer -export default class SupportSettingsPage extends Component { +class SupportSettingsPage extends Component { static defaultProps = { actions: null, stores: null }; @@ -23,6 +24,4 @@ export default class SupportSettingsPage extends Component { /> ); } - } - diff --git a/app/containers/settings/categories/TermsOfUseSettingsPage.js b/app/containers/settings/categories/TermsOfUseSettingsPage.js index 43da10cc2a..7f1274eba7 100644 --- a/app/containers/settings/categories/TermsOfUseSettingsPage.js +++ b/app/containers/settings/categories/TermsOfUseSettingsPage.js @@ -4,8 +4,9 @@ import { observer, inject } from 'mobx-react'; import TermsOfUseSettings from '../../../components/settings/categories/TermsOfUseSettings'; import type { InjectedProps } from '../../../types/injectedPropsType'; +export default @inject('stores') @observer -export default class TermsOfUseSettingsPage extends Component { +class TermsOfUseSettingsPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/settings/categories/WalletSettingsPage.js b/app/containers/settings/categories/WalletSettingsPage.js index 2abff6b885..c620dc5030 100644 --- a/app/containers/settings/categories/WalletSettingsPage.js +++ b/app/containers/settings/categories/WalletSettingsPage.js @@ -7,8 +7,9 @@ import { isValidWalletName } from '../../../utils/validations'; type Props = InjectedProps +export default @inject('stores', 'actions') @observer -export default class WalletSettingsPage extends Component { +class WalletSettingsPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/NoWalletsPage.js b/app/containers/wallet/NoWalletsPage.js index d4fd1c7120..c114f4c173 100644 --- a/app/containers/wallet/NoWalletsPage.js +++ b/app/containers/wallet/NoWalletsPage.js @@ -5,8 +5,9 @@ import resolver from '../../utils/imports'; const Layout = resolver('containers/MainLayout'); +export default @inject('stores', 'actions') @observer -export default class NoWalletsPage extends Component { +class NoWalletsPage extends Component { render() { return ( diff --git a/app/containers/wallet/Wallet.js b/app/containers/wallet/Wallet.js index b5f53daedf..3327498c9e 100644 --- a/app/containers/wallet/Wallet.js +++ b/app/containers/wallet/Wallet.js @@ -10,8 +10,9 @@ import type { InjectedContainerProps } from '../../types/injectedPropsType'; type Props = InjectedContainerProps; +export default @inject('stores', 'actions') @observer -export default class Wallet extends Component { +class Wallet extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/WalletAddPage.js b/app/containers/wallet/WalletAddPage.js index db2676e778..c402ee9f85 100644 --- a/app/containers/wallet/WalletAddPage.js +++ b/app/containers/wallet/WalletAddPage.js @@ -7,9 +7,9 @@ import WalletAdd from '../../components/wallet/WalletAdd'; import WalletRestoreDialog from '../../components/wallet/WalletRestoreDialog'; import WalletCreateDialog from '../../components/wallet/WalletCreateDialog'; import WalletBackupDialog from '../../components/wallet/WalletBackupDialog'; -import WalletRestoreDialogContainer from '../wallet/dialogs/WalletRestoreDialogContainer'; -import WalletCreateDialogContainer from '../wallet/dialogs/WalletCreateDialogContainer'; -import WalletBackupDialogContainer from '../wallet/dialogs/WalletBackupDialogContainer'; +import WalletRestoreDialogContainer from './dialogs/WalletRestoreDialogContainer'; +import WalletCreateDialogContainer from './dialogs/WalletCreateDialogContainer'; +import WalletBackupDialogContainer from './dialogs/WalletBackupDialogContainer'; import TextOnlyTopBar from '../../components/layout/TextOnlyTopbar'; import environment from '../../environment'; import resolver from '../../utils/imports'; @@ -26,8 +26,9 @@ const messages = defineMessages({ }, }); +export default @inject('actions', 'stores') @observer -export default class WalletAddPage extends Component { +class WalletAddPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/WalletReceivePage.js b/app/containers/wallet/WalletReceivePage.js index 21d0ebf9bb..2c6b6cf51f 100644 --- a/app/containers/wallet/WalletReceivePage.js +++ b/app/containers/wallet/WalletReceivePage.js @@ -24,8 +24,9 @@ type State = { copiedAddress: string, }; +export default @inject('stores', 'actions') @observer -export default class WalletReceivePage extends Component { +class WalletReceivePage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/WalletSendPage.js b/app/containers/wallet/WalletSendPage.js index 28a6e79153..db93a81674 100644 --- a/app/containers/wallet/WalletSendPage.js +++ b/app/containers/wallet/WalletSendPage.js @@ -9,8 +9,9 @@ import { DECIMAL_PLACES_IN_ADA, MAX_INTEGER_PLACES_IN_ADA } from '../../config/n type Props = InjectedProps; +export default @inject('stores', 'actions') @observer -export default class WalletSendPage extends Component { +class WalletSendPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/WalletSummaryPage.js b/app/containers/wallet/WalletSummaryPage.js index f856104e51..1c4ff6f376 100644 --- a/app/containers/wallet/WalletSummaryPage.js +++ b/app/containers/wallet/WalletSummaryPage.js @@ -28,8 +28,9 @@ export const messages = defineMessages({ } }); +export default @inject('stores', 'actions') @observer -export default class WalletSummaryPage extends Component { +class WalletSummaryPage extends Component { static defaultProps = { actions: null, stores: null }; static contextTypes = { diff --git a/app/containers/wallet/dialogs/ChangeWalletPasswordDialogContainer.js b/app/containers/wallet/dialogs/ChangeWalletPasswordDialogContainer.js index 115f57cf93..48c576acf8 100644 --- a/app/containers/wallet/dialogs/ChangeWalletPasswordDialogContainer.js +++ b/app/containers/wallet/dialogs/ChangeWalletPasswordDialogContainer.js @@ -5,8 +5,9 @@ import ChangeWalletPasswordDialog from '../../../components/wallet/settings/Chan import type { InjectedProps } from '../../../types/injectedPropsType'; import environment from '../../../environment'; +export default @inject('actions', 'stores') @observer -export default class ChangeWalletPasswordDialogContainer extends Component { +class ChangeWalletPasswordDialogContainer extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/dialogs/WalletBackupDialogContainer.js b/app/containers/wallet/dialogs/WalletBackupDialogContainer.js index 22356e3f83..39e5288988 100644 --- a/app/containers/wallet/dialogs/WalletBackupDialogContainer.js +++ b/app/containers/wallet/dialogs/WalletBackupDialogContainer.js @@ -7,8 +7,9 @@ import environment from '../../../environment'; type Props = InjectedDialogContainerProps; +export default @inject('stores', 'actions') @observer -export default class WalletBackupDialogContainer extends Component { +class WalletBackupDialogContainer extends Component { static defaultProps = { actions: null, stores: null, children: null, onClose: () => {} }; diff --git a/app/containers/wallet/dialogs/WalletCreateDialogContainer.js b/app/containers/wallet/dialogs/WalletCreateDialogContainer.js index 38f90cef8d..c169f370b1 100644 --- a/app/containers/wallet/dialogs/WalletCreateDialogContainer.js +++ b/app/containers/wallet/dialogs/WalletCreateDialogContainer.js @@ -7,8 +7,9 @@ import environment from '../../../environment'; type Props = InjectedDialogContainerProps; +export default @inject('stores', 'actions') @observer -export default class WalletCreateDialogContainer extends Component { +class WalletCreateDialogContainer extends Component { static defaultProps = { actions: null, stores: null, children: null, onClose: () => {} }; diff --git a/app/containers/wallet/dialogs/WalletRestoreDialogContainer.js b/app/containers/wallet/dialogs/WalletRestoreDialogContainer.js index b44a4ed748..fcfd748ea0 100644 --- a/app/containers/wallet/dialogs/WalletRestoreDialogContainer.js +++ b/app/containers/wallet/dialogs/WalletRestoreDialogContainer.js @@ -8,8 +8,9 @@ import environment from '../../../environment'; type Props = InjectedDialogContainerProps; +export default @inject('stores', 'actions') @observer -export default class WalletRestoreDialogContainer extends Component { +class WalletRestoreDialogContainer extends Component { static defaultProps = { actions: null, stores: null, children: null, onClose: () => {} }; diff --git a/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js b/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js index 7b8cbc30d0..cd5e85c841 100644 --- a/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js +++ b/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js @@ -19,8 +19,9 @@ type Props = { currencyUnit: string, }; +export default @inject('actions', 'stores') @observer -export default class WalletSendConfirmationDialogContainer extends Component { +class WalletSendConfirmationDialogContainer extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/domain/WalletTransaction.js b/app/domain/WalletTransaction.js index 19204018f8..e28b3eea4f 100644 --- a/app/domain/WalletTransaction.js +++ b/app/domain/WalletTransaction.js @@ -9,12 +9,12 @@ export type TransactionState = 'pending' | 'failed' | 'ok'; export type TransactionType = 'card' | 'expend' | 'income' | 'exchange'; export const transactionStates: { - PENDING: TransactionState, - FAILED: TransactionState, + PENDING: TransactionState, + FAILED: TransactionState, OK: TransactionState, } = { - PENDING: 'pending', - FAILED: 'failed', + PENDING: 'pending', + FAILED: 'failed', OK: 'ok', }; @@ -59,7 +59,8 @@ export default class WalletTransaction { getAssuranceLevelForMode(mode: AssuranceMode): AssuranceLevel { if (this.numberOfConfirmations < mode.low) { return assuranceLevels.LOW; - } else if (this.numberOfConfirmations < mode.medium) { + } + if (this.numberOfConfirmations < mode.medium) { return assuranceLevels.MEDIUM; } return assuranceLevels.HIGH; diff --git a/app/i18n/global-messages.js b/app/i18n/global-messages.js index b429ad905a..ac89e7f1bc 100644 --- a/app/i18n/global-messages.js +++ b/app/i18n/global-messages.js @@ -1,9 +1,9 @@ import { defineMessages } from 'react-intl'; -/* +/* * Some messages need to be used in multiple components * In order to avoid componenets depending on each other just to resuse translation messages - * We instead store the shared messages in this file + * We instead store the shared messages in this file */ export default defineMessages({ diff --git a/app/scripts/generateSTxs.js b/app/scripts/generateSTxs.js index a895f1280b..06d5f6db4b 100644 --- a/app/scripts/generateSTxs.js +++ b/app/scripts/generateSTxs.js @@ -1,5 +1,7 @@ // @flow +/* eslint no-await-in-loop: 0 */ // not a big deal since this is just a script for testing + import { mapToList } from '../api/ada/lib/utils'; import { getCryptoWalletFromMasterKey } from '../api/ada/lib/cardanoCrypto/cryptoWallet'; import { newAdaAddress, getAdaAddressesMap, saveAdaAddress, removeAdaAddress } from '../api/ada/adaAddress'; @@ -7,8 +9,7 @@ import { getAdaTransactionFromSenders, newAdaTransaction } from '../api/ada/adaT import { getSingleCryptoAccount, getWalletMasterKey } from '../api/ada/adaLocalStorage'; const CONFIRMATION_TIME = 40 * 1000; // 40 seconds -const AMOUNT_SENT = '180000'; // 0.18 ada. This amount should be bigger than - // the fee of the txs (In general ≃0.17) +const AMOUNT_SENT = '180000'; // 0.18 ada. This amount should be >= the fee of the txs (In general ≃0.17) const AMOUNT_TO_BE_SENT = '1'; // 0.000001 ada. Amount transfered on the generated stxs. /** @@ -22,9 +23,11 @@ const AMOUNT_TO_BE_SENT = '1'; // 0.000001 ada. Amount transfered on the g * @requires being called in a context where a wallet has been stored on local storage, * with it having 'numberOfTxs * 0.36' ada. */ -export async function generateSTxs(password: string, - numberOfTxs: number, - debugging: boolean = false) { +export async function generateSTxs( + password: string, + numberOfTxs: number, + debugging: boolean = false +) { const log = _logIfDebugging(debugging); const cryptoAccount = getSingleCryptoAccount(); diff --git a/app/stores/LoadingStore.js b/app/stores/LoadingStore.js index 9b65965669..934ed04466 100644 --- a/app/stores/LoadingStore.js +++ b/app/stores/LoadingStore.js @@ -18,21 +18,21 @@ export default class LoadingStore extends Store { setup() { when(this._isRefresh, this._redirectToLoading); Promise.all([loadRustModule(), loadLovefieldDB()]) - .then(async () => { - await this._checkingIfWalletsLoaded(); - runInAction(() => { - this.error = null; - this._loading = false; - }); - return undefined; - }) - .catch((error) => { - console.error('LoadingStore::setup Unable to load libraries', error); - runInAction(() => { - this.error = localizedError(new UnableToLoadError()); - this._loading = false; + .then(async () => { + await this._checkingIfWalletsLoaded(); + runInAction(() => { + this.error = null; + this._loading = false; + }); + return undefined; + }) + .catch((error) => { + console.error('LoadingStore::setup Unable to load libraries', error); + runInAction(() => { + this.error = localizedError(new UnableToLoadError()); + this._loading = false; + }); }); - }); } @computed get isLoading(): boolean { @@ -41,8 +41,9 @@ export default class LoadingStore extends Store { _isRefresh = () => this.isLoading; - _redirectToLoading = () => + _redirectToLoading = () => { this.actions.router.goToRoute.trigger({ route: ROUTES.ROOT }); + } _checkingIfWalletsLoaded = async () => { const { app } = this.stores; diff --git a/app/stores/ProfileStore.js b/app/stores/ProfileStore.js index 6abd5cb00a..8fa380c421 100644 --- a/app/stores/ProfileStore.js +++ b/app/stores/ProfileStore.js @@ -201,5 +201,6 @@ export default class SettingsStore extends Store { .catch(action((error) => { this.error = error; })); - });*/ + }); + */ } diff --git a/app/stores/UiNotificationsStore.js b/app/stores/UiNotificationsStore.js index 229a3fc8ac..d9e007b6ac 100644 --- a/app/stores/UiNotificationsStore.js +++ b/app/stores/UiNotificationsStore.js @@ -14,8 +14,9 @@ export default class UiNotificationsStore extends Store { isOpen = (id: string): boolean => !!this._findNotificationById(id); - _findNotificationById = (id: string): ?Notification => + _findNotificationById = (id: string): ?Notification => { this.activeNotifications.find(notification => notification.id === id); + }; @action _onOpen = ({ id, duration } : { id: string, duration?: number }) => { const notification = { diff --git a/app/stores/WalletBackupStore.js b/app/stores/WalletBackupStore.js index 7bd82bcd86..3fc7173474 100644 --- a/app/stores/WalletBackupStore.js +++ b/app/stores/WalletBackupStore.js @@ -6,7 +6,8 @@ import WalletBackupDialog from '../components/wallet/WalletBackupDialog'; export type walletBackupSteps = 'privacyWarning' | 'recoveryPhraseDisplay' | 'recoveryPhraseEntry' | null; -export default class WalletBackupStore extends Store { +export default +class WalletBackupStore extends Store { @observable inProgress = false; @observable currentStep: walletBackupSteps = null; diff --git a/app/stores/ada/AdaWalletsStore.js b/app/stores/ada/AdaWalletsStore.js index 23083b0c9e..0a12030326 100644 --- a/app/stores/ada/AdaWalletsStore.js +++ b/app/stores/ada/AdaWalletsStore.js @@ -4,7 +4,7 @@ import { observable, action, runInAction } from 'mobx'; import WalletStore from '../WalletStore'; import Wallet from '../../domain/Wallet'; import { matchRoute, buildRoute } from '../../utils/routing'; -import Request from '.././lib/LocalizedRequest'; +import Request from '../lib/LocalizedRequest'; import { ROUTES } from '../../routes-config'; import type { WalletImportFromFileParams } from '../../actions/ada/wallets-actions'; import type { ImportWalletFromFileResponse } from '../../api/ada/index'; diff --git a/app/stores/ada/DaedalusTransferStore.js b/app/stores/ada/DaedalusTransferStore.js index 53211690d0..fb4a7ac665 100644 --- a/app/stores/ada/DaedalusTransferStore.js +++ b/app/stores/ada/DaedalusTransferStore.js @@ -6,7 +6,7 @@ import { stringifyError } from '../../utils/logging'; import Store from '../lib/Store'; -import Request from '.././lib/LocalizedRequest'; +import Request from '../lib/LocalizedRequest'; import type { ConfigType } from '../../../config/config-types'; import { sendTx diff --git a/app/stores/lib/LocalizedRequest.js b/app/stores/lib/LocalizedRequest.js index df2a51f61f..e684904495 100644 --- a/app/stores/lib/LocalizedRequest.js +++ b/app/stores/lib/LocalizedRequest.js @@ -1,4 +1,8 @@ import Request from './Request'; import LocalizableError from '../../i18n/LocalizableError'; +/* +* We want all errors in our program to be localizable +* So we partially apply the LocalizableError to the Request template +*/ export default class LocalizedRequest extends Request {} diff --git a/app/stores/lib/Request.js b/app/stores/lib/Request.js index aff34db0c2..71986bf24e 100644 --- a/app/stores/lib/Request.js +++ b/app/stores/lib/Request.js @@ -2,20 +2,32 @@ import { observable, action, computed, isObservableArray } from 'mobx'; import { isEqual } from 'lodash/fp'; import ExtendableError from 'es6-error'; - -class NotExecutedYetError extends ExtendableError { - message = 'You have to call Request::execute before you can access it as promise'; -} +import { defineMessages } from 'react-intl'; +import LocalizableError from '../../i18n/LocalizableError'; + +const messages = defineMessages({ + apiMethodNotYetImplementedError: { + id: 'api.errors.ApiMethodNotYetImplementedError', + defaultMessage: '!!!This API method is not yet implemented.', + description: '"This API method is not yet implemented." error message.' + }, + promiseNotCalledYetError: { + id: 'api.errors.PromiseNotCalledYetError', + defaultMessage: '!!!You have to call Request::execute before you can access it as promise.', + description: 'When call chain is not correct.' + } +}); export type ApiCallType = { args: Array, result: any, }; -export default class Request { +// Note: Do not use this class directly. Only use LocalizedRequest. +export default class Request { @observable result: ?Result = null; - @observable error: ?Error = null; + @observable error: ?Err = null; @observable isExecuting: boolean = false; @observable isError: boolean = false; @observable wasExecuted: boolean = false; @@ -30,7 +42,7 @@ export default class Request { this._method = method; } - execute(...callArgs: Array): Request { + execute(...callArgs: Array): Request { // Do not continue if this request is already loading if (this._isWaitingForResponse) return this; @@ -42,7 +54,9 @@ export default class Request { // Issue api call & save it as promise that is handled to update the results of the operation this.promise = new Promise((resolve, reject) => { - if (!this._method) reject('Request method not defined'); + if (!this._method) { + reject(new ApiMethodNotYetImplementedError()); + } this._method(...callArgs) .then((result) => { setTimeout(action('Request::execute/then', () => { @@ -110,7 +124,7 @@ export default class Request { * * @returns {Promise} */ - patch(modify: Function): Promise> { + patch(modify: Function): Promise> { return new Promise((resolve) => { setTimeout(action(() => { const override = modify(this.result); @@ -121,7 +135,7 @@ export default class Request { }); } - @action reset(): Request { + @action reset(): Request { this.result = null; this.error = null; this.isError = false; @@ -131,5 +145,22 @@ export default class Request { this._currentApiCall = null; return this; } +} + +export class ApiMethodNotYetImplementedError extends LocalizableError { + constructor() { + super({ + id: messages.apiMethodNotYetImplementedError.id, + defaultMessage: messages.apiMethodNotYetImplementedError.defaultMessage, + }); + } +} +export class NotExecutedYetError extends LocalizableError { + constructor() { + super({ + id: messages.apiMethodNotYetImplementedError.id, + defaultMessage: messages.apiMethodNotYetImplementedError.defaultMessage, + }); + } } diff --git a/app/stores/lib/Store.js b/app/stores/lib/Store.js index 1b1b63c472..8bac400d5d 100644 --- a/app/stores/lib/Store.js +++ b/app/stores/lib/Store.js @@ -1,7 +1,7 @@ // @flow import Reaction from './Reaction'; import type { ActionsMap } from '../../actions/index'; -import type { StoresMap } from '../../stores/index'; +import type { StoresMap } from '../index'; import type { Api } from '../../api/index'; export default class Store { diff --git a/app/utils/passwordCipher.js b/app/utils/passwordCipher.js index 3ead9dc588..1bef254fa7 100644 --- a/app/utils/passwordCipher.js +++ b/app/utils/passwordCipher.js @@ -9,12 +9,12 @@ export function encryptWithPassword( password: string, bytes: Uint8Array ): string { - const salt = new Buffer(cryptoRandomString(2 * 32), 'hex'); - const nonce = new Buffer(cryptoRandomString(2 * 12), 'hex'); + const salt = Buffer.from(cryptoRandomString(2 * 32), 'hex'); + const nonce = Buffer.from(cryptoRandomString(2 * 12), 'hex'); const formattedPassword: Uint8Array = new TextEncoder().encode(password); - // eslint-disable-next-line space-infix-ops const encryptedBytes = getOrFail( - PasswordProtect.encryptWithPassword(formattedPassword, salt, nonce, bytes)); + PasswordProtect.encryptWithPassword(formattedPassword, salt, nonce, bytes) + ); const encryptedHex = Buffer.from(encryptedBytes).toString('hex'); return encryptedHex; } @@ -23,9 +23,8 @@ export function decryptWithPassword( password: string, encryptedHex: string ): Uint8Array { - const encryptedBytes = new Buffer(encryptedHex, 'hex'); + const encryptedBytes = Buffer.from(encryptedHex, 'hex'); const formattedPassword: Uint8Array = new TextEncoder().encode(password); - // FIXME: null or false is returned on invalid password const decryptedBytes: ?Uint8Array | false = PasswordProtect.decryptWithPassword(formattedPassword, encryptedBytes); if (!decryptedBytes) { diff --git a/js-cardano-wasm b/js-cardano-wasm index d7ac1e8add..e099e7e666 160000 --- a/js-cardano-wasm +++ b/js-cardano-wasm @@ -1 +1 @@ -Subproject commit d7ac1e8add9fe7d58e2f244722ca9dfcafa8000a +Subproject commit e099e7e666805b5efb4eac14103b5dafdb1b73de diff --git a/package-lock.json b/package-lock.json index 7aca3496c5..6bb0b3766f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,166 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", + "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0" + } + }, + "@babel/generator": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.1.3.tgz", + "integrity": "sha512-ZoCZGcfIJFJuZBqxcY9OjC1KW2lWK64qrX1o4UYL3yshVhwKFYgzpWZ0vvtGMNJdTlvkw0W+HR1VnYN8q3QPFQ==", + "dev": true, + "requires": { + "@babel/types": "7.1.3", + "jsesc": "2.5.1", + "lodash": "4.17.11", + "source-map": "0.5.7", + "trim-right": "1.0.1" + }, + "dependencies": { + "jsesc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", + "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/helper-function-name": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", + "integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "7.0.0", + "@babel/template": "7.1.2", + "@babel/types": "7.1.3" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", + "integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", + "dev": true, + "requires": { + "@babel/types": "7.1.3" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz", + "integrity": "sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag==", + "dev": true, + "requires": { + "@babel/types": "7.1.3" + } + }, + "@babel/highlight": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", + "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "dev": true, + "requires": { + "chalk": "2.3.2", + "esutils": "2.0.2", + "js-tokens": "4.0.0" + }, + "dependencies": { + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + } + } + }, + "@babel/parser": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.1.3.tgz", + "integrity": "sha512-gqmspPZOMW3MIRb9HlrnbZHXI1/KHTOroBwN1NcLL6pWxzqzEKGvRTq0W/PxS45OtQGbaFikSQpkS5zbnsQm2w==", + "dev": true + }, + "@babel/template": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.1.2.tgz", + "integrity": "sha512-SY1MmplssORfFiLDcOETrW7fCLl+PavlwMh92rrGcikQaRq4iWPVH0MpwPpY3etVMx6RnDjXtr6VZYr/IbP/Ag==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0", + "@babel/parser": "7.1.3", + "@babel/types": "7.1.3" + } + }, + "@babel/traverse": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.1.4.tgz", + "integrity": "sha512-my9mdrAIGdDiSVBuMjpn/oXYpva0/EZwWL3sm3Wcy/AVWO2eXnsoZruOT9jOGNRXU8KbCIu5zsKnXcAJ6PcV6Q==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0", + "@babel/generator": "7.1.3", + "@babel/helper-function-name": "7.1.0", + "@babel/helper-split-export-declaration": "7.0.0", + "@babel/parser": "7.1.3", + "@babel/types": "7.1.3", + "debug": "3.2.6", + "globals": "11.8.0", + "lodash": "4.17.11" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "2.1.1" + } + }, + "globals": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.8.0.tgz", + "integrity": "sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.1.3.tgz", + "integrity": "sha512-RpPOVfK+yatXyn8n4PB1NW6k9qjinrXrRR8ugBN8fD6hCy5RXI6PSbVqpOJBO9oSaY7Nom4ohj35feb0UR9hSA==", + "dev": true, + "requires": { + "esutils": "2.0.2", + "lodash": "4.17.11", + "to-fast-properties": "2.0.0" + }, + "dependencies": { + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + } + } + }, "@types/babel-types": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.1.tgz", @@ -75,21 +235,10 @@ } }, "acorn-jsx": { - "version": "3.0.1", - "resolved": "http://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", - "dev": true, - "requires": { - "acorn": "3.3.0" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "resolved": "http://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", - "dev": true - } - } + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.0.tgz", + "integrity": "sha512-XkB50fn0MURDyww9+UYL3c1yLbOBz0ZFvrdYlGB8l+Ije1oSC75qAqrzSPjYQbdnQUzhlUGNKuesryAv0gxZOg==", + "dev": true }, "ajv": { "version": "5.5.2", @@ -103,12 +252,6 @@ "json-schema-traverse": "0.3.1" } }, - "ajv-keywords": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", - "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", - "dev": true - }, "align-text": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", @@ -175,9 +318,9 @@ } }, "ansi-escapes": { - "version": "1.4.0", - "resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", - "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "version": "3.1.0", + "resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", "dev": true }, "ansi-html": { @@ -272,6 +415,16 @@ "sprintf-js": "1.0.3" } }, + "aria-query": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-3.0.0.tgz", + "integrity": "sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w=", + "dev": true, + "requires": { + "ast-types-flow": "0.0.7", + "commander": "2.15.0" + } + }, "arr-diff": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", @@ -302,6 +455,16 @@ "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", "dev": true }, + "array-includes": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", + "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", + "dev": true, + "requires": { + "define-properties": "1.1.2", + "es-abstract": "1.12.0" + } + }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", @@ -395,6 +558,12 @@ "integrity": "sha1-ECyenpAF0+fjgpvwxPok7oYu6bk=", "dev": true }, + "ast-types-flow": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", + "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=", + "dev": true + }, "async": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", @@ -468,6 +637,15 @@ "is-buffer": "1.1.6" } }, + "axobject-query": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.0.2.tgz", + "integrity": "sha512-MCeek8ZH7hKyO1rWUbKNQBbl4l2eY0ntk7OGi+q0RlafrCnfPxC06WZA+uebCfmYp4mNU9jRBP1AhGyf8+W3ww==", + "dev": true, + "requires": { + "ast-types-flow": "0.0.7" + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -558,15 +736,17 @@ } }, "babel-eslint": { - "version": "7.1.0", - "resolved": "http://registry.npmjs.org/babel-eslint/-/babel-eslint-7.1.0.tgz", - "integrity": "sha1-1QalF0uiJOJaLRfhKOK6iYcTndw=", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.0.1.tgz", + "integrity": "sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ==", "dev": true, "requires": { - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "lodash.pickby": "4.6.0" + "@babel/code-frame": "7.0.0", + "@babel/parser": "7.1.3", + "@babel/traverse": "7.1.4", + "@babel/types": "7.1.3", + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "1.0.0" } }, "babel-generator": { @@ -3137,6 +3317,12 @@ "is-regex": "1.0.4" } }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, "chokidar": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", @@ -3331,12 +3517,12 @@ "dev": true }, "cli-cursor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", - "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", "dev": true, "requires": { - "restore-cursor": "1.0.1" + "restore-cursor": "2.0.0" } }, "cli-table": { @@ -3572,18 +3758,6 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "1.1.0", - "inherits": "2.0.3", - "readable-stream": "2.3.5", - "typedarray": "0.0.6" - } - }, "config": { "version": "1.30.0", "resolved": "https://registry.npmjs.org/config/-/config-1.30.0.tgz", @@ -4438,13 +4612,12 @@ } }, "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" + "esutils": "2.0.2" } }, "doctypes": { @@ -4537,6 +4710,12 @@ "minimalistic-crypto-utils": "1.0.1" } }, + "emoji-regex": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-6.5.1.tgz", + "integrity": "sha512-PAHp6TxrCy7MGMFidro8uikr+zlJJKJ/Q6mm2ExZ7HwkyR9lSVFfE3kt36qcwa24BQL7y0G9axycGjK1A/0uNQ==", + "dev": true + }, "emojis-list": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", @@ -4620,6 +4799,30 @@ "escape-html": "1.0.3" } }, + "es-abstract": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", + "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", + "dev": true, + "requires": { + "es-to-primitive": "1.2.0", + "function-bind": "1.1.1", + "has": "1.0.1", + "is-callable": "1.1.4", + "is-regex": "1.0.4" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", + "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "dev": true, + "requires": { + "is-callable": "1.1.4", + "is-date-object": "1.0.1", + "is-symbol": "1.0.2" + } + }, "es5-ext": { "version": "0.10.40", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.40.tgz", @@ -4735,197 +4938,375 @@ } }, "eslint": { - "version": "3.9.1", - "resolved": "http://registry.npmjs.org/eslint/-/eslint-3.9.1.tgz", - "integrity": "sha1-WoWXcG/GBIvGBhrHVNSiEdKPT1s=", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.8.0.tgz", + "integrity": "sha512-Zok6Bru3y2JprqTNm14mgQ15YQu/SMDkWdnmHfFg770DIUlmMFd/gqqzCHekxzjHZJxXv3tmTpH0C1icaYJsRQ==", "dev": true, "requires": { - "babel-code-frame": "6.26.0", - "chalk": "1.1.3", - "concat-stream": "1.6.2", - "debug": "2.6.9", - "doctrine": "1.5.0", - "escope": "3.6.0", - "espree": "3.5.4", - "estraverse": "4.2.0", + "@babel/code-frame": "7.0.0", + "ajv": "6.5.5", + "chalk": "2.3.2", + "cross-spawn": "6.0.5", + "debug": "4.1.0", + "doctrine": "2.1.0", + "eslint-scope": "4.0.0", + "eslint-utils": "1.3.1", + "eslint-visitor-keys": "1.0.0", + "espree": "4.1.0", + "esquery": "1.0.1", "esutils": "2.0.2", "file-entry-cache": "2.0.0", + "functional-red-black-tree": "1.0.1", "glob": "7.1.2", - "globals": "9.18.0", - "ignore": "3.3.10", + "globals": "11.8.0", + "ignore": "4.0.6", "imurmurhash": "0.1.4", - "inquirer": "0.12.0", - "is-my-json-valid": "2.19.0", + "inquirer": "6.2.0", "is-resolvable": "1.1.0", - "js-yaml": "3.7.0", - "json-stable-stringify": "1.0.1", + "js-yaml": "3.12.0", + "json-stable-stringify-without-jsonify": "1.0.1", "levn": "0.3.0", "lodash": "4.17.11", + "minimatch": "3.0.4", "mkdirp": "0.5.1", "natural-compare": "1.4.0", "optionator": "0.8.2", "path-is-inside": "1.0.2", - "pluralize": "1.2.1", - "progress": "1.1.8", + "pluralize": "7.0.0", + "progress": "2.0.1", + "regexpp": "2.0.1", "require-uncached": "1.0.3", - "shelljs": "0.7.8", - "strip-bom": "3.0.0", - "strip-json-comments": "1.0.4", - "table": "3.8.3", - "text-table": "0.2.0", - "user-home": "2.0.0" + "semver": "5.6.0", + "strip-ansi": "4.0.0", + "strip-json-comments": "2.0.1", + "table": "5.1.0", + "text-table": "0.2.0" }, "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "ajv": { + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.5.tgz", + "integrity": "sha512-7q7gtRQDJSyuEHjuVgHoUa2VuemFiCMrfQc9Tc08XTAc4Zj/5U1buQJ0HU6i7fKjXU09SVgSmxa4sLvuvS8Iyg==", + "dev": true, + "requires": { + "fast-deep-equal": "2.0.1", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.4.1", + "uri-js": "4.2.2" + } + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "chalk": { - "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "nice-try": "1.0.5", + "path-key": "2.0.1", + "semver": "5.6.0", + "shebang-command": "1.2.0", + "which": "1.3.0" } }, - "shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", "dev": true, "requires": { - "glob": "7.1.2", - "interpret": "1.1.0", - "rechoir": "0.6.2" + "ms": "2.1.1" } }, - "strip-json-comments": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", - "integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=", + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "4.2.1", + "estraverse": "4.2.0" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "globals": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.8.0.tgz", + "integrity": "sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA==", "dev": true + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "1.0.10", + "esprima": "4.0.1" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "2.1.1" + } } } }, "eslint-config-airbnb": { - "version": "12.0.0", - "resolved": "http://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-12.0.0.tgz", - "integrity": "sha1-qygrdWol8D0ErCZMJNZzoIqAMnA=", + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-17.1.0.tgz", + "integrity": "sha512-R9jw28hFfEQnpPau01NO5K/JWMGLi6aymiF6RsnMURjTk+MqZKllCqGK/0tOvHkPi/NWSSOU2Ced/GX++YxLnw==", "dev": true, "requires": { - "eslint-config-airbnb-base": "8.0.0" + "eslint-config-airbnb-base": "13.1.0", + "object.assign": "4.1.0", + "object.entries": "1.0.4" } }, "eslint-config-airbnb-base": { - "version": "8.0.0", - "resolved": "http://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-8.0.0.tgz", - "integrity": "sha1-xelYpGmrivdq/waLQ9eE5a/nTKc=", - "dev": true + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-13.1.0.tgz", + "integrity": "sha512-XWwQtf3U3zIoKO1BbHh6aUhJZQweOwSt4c2JrPDg9FP3Ltv3+YfEv7jIDB8275tVnO/qOHbfuYg3kzw6Je7uWw==", + "dev": true, + "requires": { + "eslint-restricted-globals": "0.1.1", + "object.assign": "4.1.0", + "object.entries": "1.0.4" + } }, "eslint-import-resolver-node": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.2.3.tgz", - "integrity": "sha1-Wt2BBujJKNssuiMrzZ76hG49oWw=", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz", + "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", "dev": true, "requires": { "debug": "2.6.9", - "object-assign": "4.1.1", "resolve": "1.5.0" } }, + "eslint-module-utils": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz", + "integrity": "sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=", + "dev": true, + "requires": { + "debug": "2.6.9", + "pkg-dir": "1.0.0" + } + }, "eslint-plugin-flowtype": { - "version": "2.47.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.47.1.tgz", - "integrity": "sha512-8PSgM3Fvnpkz5yE8MedV16cWIbXG1vgT3okqdopLEy9mH8Ok+5xce+t+K2EmYhUzEUEJTdIRQPXE/7xSLuAkKA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.2.0.tgz", + "integrity": "sha512-baJmzngM6UKbEkJ5OY3aGw2zjXBt5L2QKZvTsOlXX7yHKIjNRrlJx2ods8Rng6EdqPR9rVNIQNYHpTs0qfn2qA==", "dev": true, "requires": { "lodash": "4.17.11" } }, "eslint-plugin-import": { - "version": "1.16.0", - "resolved": "http://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-1.16.0.tgz", - "integrity": "sha1-svoH68xTUE0PKkR3WC7Iv/GHG58=", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz", + "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==", "dev": true, "requires": { - "builtin-modules": "1.1.1", "contains-path": "0.1.0", "debug": "2.6.9", - "doctrine": "1.3.0", - "es6-map": "0.1.5", - "es6-set": "0.1.5", - "eslint-import-resolver-node": "0.2.3", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "0.3.2", + "eslint-module-utils": "2.2.0", "has": "1.0.1", - "lodash.cond": "4.5.2", - "lodash.endswith": "4.2.1", - "lodash.find": "4.6.0", - "lodash.findindex": "4.6.0", + "lodash": "4.17.11", "minimatch": "3.0.4", - "object-assign": "4.1.1", - "pkg-dir": "1.0.0", - "pkg-up": "1.0.0" + "read-pkg-up": "2.0.0", + "resolve": "1.8.1" }, "dependencies": { "doctrine": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.3.0.tgz", - "integrity": "sha1-E+dWgrVVGEJCdvfBc3g0Vu+RPSY=", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", "dev": true, "requires": { "esutils": "2.0.2", "isarray": "1.0.0" } + }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } } } }, "eslint-plugin-jsx-a11y": { - "version": "2.2.3", - "resolved": "http://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-2.2.3.tgz", - "integrity": "sha1-TjXLcbin23AqxBXIBuuOjZ6mxl0=", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.1.2.tgz", + "integrity": "sha512-7gSSmwb3A+fQwtw0arguwMdOdzmKUgnUcbSNlo+GjKLAQFuC2EZxWqG9XHRI8VscBJD5a8raz3RuxQNFW+XJbw==", "dev": true, "requires": { + "aria-query": "3.0.0", + "array-includes": "3.0.3", + "ast-types-flow": "0.0.7", + "axobject-query": "2.0.2", "damerau-levenshtein": "1.0.4", - "jsx-ast-utils": "1.4.1", - "object-assign": "4.1.1" + "emoji-regex": "6.5.1", + "has": "1.0.3", + "jsx-ast-utils": "2.0.1" + }, + "dependencies": { + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "1.1.1" + } + } } }, "eslint-plugin-promise": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-3.8.0.tgz", - "integrity": "sha512-JiFL9UFR15NKpHyGii1ZcvmtIqa3UTwiDAGb8atSffe43qJ3+1czVGN6UtkklpcJ2DVnqvTMzEKRaJdBkAL2aQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.0.1.tgz", + "integrity": "sha512-Si16O0+Hqz1gDHsys6RtFRrW7cCTB6P7p3OJmKp3Y3dxpQE2qwOA7d3xnV+0mBmrPoi0RBnxlCKvqu70te6wjg==", "dev": true }, "eslint-plugin-react": { - "version": "6.5.0", - "resolved": "http://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.5.0.tgz", - "integrity": "sha1-k/iUtkaZdDBGCeWciYOmo9yBc4w=", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz", + "integrity": "sha512-cVVyMadRyW7qsIUh3FHp3u6QHNhOgVrLQYdQEB1bPWBsgbNCHdFAeNMquBMCcZJu59eNthX053L70l7gRt4SCw==", "dev": true, "requires": { - "doctrine": "1.5.0", - "jsx-ast-utils": "1.4.1" + "array-includes": "3.0.3", + "doctrine": "2.1.0", + "has": "1.0.3", + "jsx-ast-utils": "2.0.1", + "prop-types": "15.6.2" + }, + "dependencies": { + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "1.1.1" + } + }, + "prop-types": { + "version": "15.6.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz", + "integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==", + "dev": true, + "requires": { + "loose-envify": "1.3.1", + "object-assign": "4.1.1" + } + } + } + }, + "eslint-restricted-globals": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz", + "integrity": "sha1-NfDVy8ZMLj7WLpO0saevBbp+1Nc=", + "dev": true + }, + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", + "dev": true, + "requires": { + "esrecurse": "4.2.1", + "estraverse": "4.2.0" } }, + "eslint-utils": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", + "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", + "dev": true + }, + "eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", + "dev": true + }, "espree": { - "version": "3.5.4", - "resolved": "http://registry.npmjs.org/espree/-/espree-3.5.4.tgz", - "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-4.1.0.tgz", + "integrity": "sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w==", "dev": true, "requires": { - "acorn": "5.5.3", - "acorn-jsx": "3.0.1" + "acorn": "6.0.4", + "acorn-jsx": "5.0.0", + "eslint-visitor-keys": "1.0.0" + }, + "dependencies": { + "acorn": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.4.tgz", + "integrity": "sha512-VY4i5EKSKkofY2I+6QLTbTTN/UvEQPCo6eiwzzSaSWfpaDhOmStMCMod6wmuPciNq+XS0faCglFu2lHZpdHUtg==", + "dev": true + } } }, "esprima": { @@ -4934,6 +5315,15 @@ "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", "dev": true }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, "esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", @@ -5007,12 +5397,6 @@ "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz", "integrity": "sha1-KueOhdmJQVhnCwPUe+wfA72Ru50=" }, - "exit-hook": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", - "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", - "dev": true - }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -5140,6 +5524,37 @@ } } }, + "external-editor": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", + "dev": true, + "requires": { + "chardet": "0.7.0", + "iconv-lite": "0.4.24", + "tmp": "0.0.33" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": "2.1.2" + } + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } + } + } + }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -5291,13 +5706,12 @@ } }, "figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", "dev": true, "requires": { - "escape-string-regexp": "1.0.5", - "object-assign": "4.1.1" + "escape-string-regexp": "1.0.5" } }, "file-entry-cache": { @@ -6021,6 +6435,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "gauge": { "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", @@ -6046,24 +6466,6 @@ "globule": "1.2.1" } }, - "generate-function": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", - "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", - "dev": true, - "requires": { - "is-property": "1.0.2" - } - }, - "generate-object-property": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", - "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", - "dev": true, - "requires": { - "is-property": "1.0.2" - } - }, "get-caller-file": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", @@ -6523,9 +6925,9 @@ "dev": true }, "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, "immediate": { @@ -6594,50 +6996,56 @@ "dev": true }, "inquirer": { - "version": "0.12.0", - "resolved": "http://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", - "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", "dev": true, "requires": { - "ansi-escapes": "1.4.0", - "ansi-regex": "2.1.1", - "chalk": "1.1.3", - "cli-cursor": "1.0.2", + "ansi-escapes": "3.1.0", + "chalk": "2.3.2", + "cli-cursor": "2.1.0", "cli-width": "2.2.0", - "figures": "1.7.0", + "external-editor": "3.0.3", + "figures": "2.0.0", "lodash": "4.17.11", - "readline2": "1.0.1", - "run-async": "0.1.0", - "rx-lite": "3.1.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rxjs": "6.3.3", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", "through": "2.3.8" }, "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "chalk": { - "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" } }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } } } }, @@ -6722,6 +7130,12 @@ "builtin-modules": "1.1.1" } }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "dev": true + }, "is-ci": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.1.0.tgz", @@ -6740,6 +7154,12 @@ "kind-of": "3.2.2" } }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -6838,25 +7258,6 @@ "is-path-inside": "1.0.1" } }, - "is-my-ip-valid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", - "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==", - "dev": true - }, - "is-my-json-valid": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.19.0.tgz", - "integrity": "sha512-mG0f/unGX1HZ5ep4uhRaPOS8EkAY8/j6mDRMJrutq4CqhoJWYp7qAlonIPy3TV7p3ju4TK9fo/PbnoksWmsp5Q==", - "dev": true, - "requires": { - "generate-function": "2.3.1", - "generate-object-property": "1.2.0", - "is-my-ip-valid": "1.0.0", - "jsonpointer": "4.0.1", - "xtend": "4.0.1" - } - }, "is-npm": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", @@ -6923,12 +7324,6 @@ "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", "dev": true }, - "is-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", - "dev": true - }, "is-redirect": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", @@ -6970,6 +7365,15 @@ "html-comment-regex": "1.1.1" } }, + "is-symbol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", + "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "dev": true, + "requires": { + "has-symbols": "1.0.0" + } + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -7507,6 +7911,12 @@ "jsonify": "0.0.0" } }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -7525,12 +7935,6 @@ "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", "dev": true }, - "jsonpointer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", - "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", - "dev": true - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -7554,10 +7958,13 @@ } }, "jsx-ast-utils": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", - "integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=", - "dev": true + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz", + "integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=", + "dev": true, + "requires": { + "array-includes": "3.0.3" + } }, "jszip": { "version": "3.1.5", @@ -7791,12 +8198,6 @@ "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "dev": true }, - "lodash.cond": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/lodash.cond/-/lodash.cond-4.5.2.tgz", - "integrity": "sha1-9HGh2khr5g9quVXRcRVSPdHSVdU=", - "dev": true - }, "lodash.deburr": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-3.2.0.tgz", @@ -7806,24 +8207,6 @@ "lodash._root": "3.0.1" } }, - "lodash.endswith": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/lodash.endswith/-/lodash.endswith-4.2.1.tgz", - "integrity": "sha1-/tWawXOO0+I27dcGTsRWRIs3vAk=", - "dev": true - }, - "lodash.find": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.find/-/lodash.find-4.6.0.tgz", - "integrity": "sha1-ywcE1Hq3F4n/oN6Ll92Sb7iLE7E=", - "dev": true - }, - "lodash.findindex": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.findindex/-/lodash.findindex-4.6.0.tgz", - "integrity": "sha1-oyRd7mH7m24GJLU1ElYku2nBEQY=", - "dev": true - }, "lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", @@ -7847,12 +8230,6 @@ "integrity": "sha1-brGa5aHuHdnfC5aeZs4Lf6MLXmA=", "dev": true }, - "lodash.pickby": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.pickby/-/lodash.pickby-4.6.0.tgz", - "integrity": "sha1-feoh2MGNdwOifHBMFdO4SmfjOv8=", - "dev": true - }, "lodash.tail": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.tail/-/lodash.tail-4.1.1.tgz", @@ -8467,9 +8844,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "mute-stream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", - "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", "dev": true }, "mz": { @@ -8539,6 +8916,12 @@ "integrity": "sha512-nJmSswG4As/MkRq7QZFuH/sf/yuv8ODdMZrY4Bedjp77a5MK4A6s7YbBB64c9u79EBUOfXUXBvArmvzTD0X+6g==", "dev": true }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, "no-case": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", @@ -8845,6 +9228,18 @@ "object-keys": "1.0.12" } }, + "object.entries": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.0.4.tgz", + "integrity": "sha1-G/mk3SKI9bM/Opk9JXZh8F0WGl8=", + "dev": true, + "requires": { + "define-properties": "1.1.2", + "es-abstract": "1.12.0", + "function-bind": "1.1.1", + "has": "1.0.1" + } + }, "object.pick": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", @@ -8879,10 +9274,13 @@ } }, "onetime": { - "version": "1.1.0", - "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", - "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", - "dev": true + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "1.2.0" + } }, "optionator": { "version": "0.8.2", @@ -9164,15 +9562,6 @@ "find-up": "1.1.2" } }, - "pkg-up": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-1.0.0.tgz", - "integrity": "sha1-Pgj7RhUlxEIWJKM7n35tCvWwWiY=", - "dev": true, - "requires": { - "find-up": "1.1.2" - } - }, "please-upgrade-node": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.0.2.tgz", @@ -9183,9 +9572,9 @@ } }, "pluralize": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", - "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", "dev": true }, "posix-character-classes": { @@ -11276,9 +11665,9 @@ "dev": true }, "progress": { - "version": "1.1.8", - "resolved": "http://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.1.tgz", + "integrity": "sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg==", "dev": true }, "promise": { @@ -11865,17 +12254,6 @@ "set-immediate-shim": "1.0.1" } }, - "readline2": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", - "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "mute-stream": "0.0.5" - } - }, "recast": { "version": "0.11.23", "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz", @@ -12020,6 +12398,12 @@ "safe-regex": "1.1.0" } }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "dev": true + }, "regexpu-core": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", @@ -12184,13 +12568,13 @@ "dev": true }, "restore-cursor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", - "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", "dev": true, "requires": { - "exit-hook": "1.1.1", - "onetime": "1.1.0" + "onetime": "2.0.1", + "signal-exit": "3.0.2" } }, "ret": { @@ -12252,12 +12636,12 @@ "integrity": "sha1-fR0J0zXkkJQDHqFpkaSnmwG74fQ=" }, "run-async": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", - "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", "dev": true, "requires": { - "once": "1.4.0" + "is-promise": "2.1.0" } }, "rust-cardano-crypto": { @@ -16557,11 +16941,14 @@ } } }, - "rx-lite": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", - "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", - "dev": true + "rxjs": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", + "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", + "dev": true, + "requires": { + "tslib": "1.9.3" + } }, "safe-buffer": { "version": "5.1.1", @@ -17010,10 +17397,21 @@ "dev": true }, "slice-ansi": { - "version": "0.0.4", - "resolved": "http://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", - "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", - "dev": true + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + } + } }, "snapdragon": { "version": "0.8.2", @@ -17540,27 +17938,27 @@ } }, "table": { - "version": "3.8.3", - "resolved": "http://registry.npmjs.org/table/-/table-3.8.3.tgz", - "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/table/-/table-5.1.0.tgz", + "integrity": "sha512-e542in22ZLhD/fOIuXs/8yDZ9W61ltF8daM88rkRNtgTIct+vI2fTnAyu/Db2TCfEcI8i7mjZz6meLq0nW7TYg==", "dev": true, "requires": { - "ajv": "4.11.8", - "ajv-keywords": "1.5.1", - "chalk": "1.1.3", + "ajv": "6.5.5", "lodash": "4.17.11", - "slice-ansi": "0.0.4", + "slice-ansi": "1.0.0", "string-width": "2.1.1" }, "dependencies": { "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.5.tgz", + "integrity": "sha512-7q7gtRQDJSyuEHjuVgHoUa2VuemFiCMrfQc9Tc08XTAc4Zj/5U1buQJ0HU6i7fKjXU09SVgSmxa4sLvuvS8Iyg==", "dev": true, "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" + "fast-deep-equal": "2.0.1", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.4.1", + "uri-js": "4.2.2" } }, "ansi-regex": { @@ -17569,31 +17967,30 @@ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", "dev": true }, - "chalk": { - "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -17602,24 +17999,25 @@ "requires": { "is-fullwidth-code-point": "2.0.0", "strip-ansi": "4.0.0" - }, - "dependencies": { - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } } }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "2.1.1" + } } } }, @@ -17818,6 +18216,12 @@ "glob": "7.1.2" } }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "dev": true + }, "tty-browserify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", @@ -18186,15 +18590,6 @@ } } }, - "user-home": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", - "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=", - "dev": true, - "requires": { - "os-homedir": "1.0.2" - } - }, "util": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", diff --git a/package.json b/package.json index 35001815a5..7f3bf7e624 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "compress-keygen": "crx keygen", "clean": "rimraf build/ dev/ *.zip *.crx dll/", "flow": "flow .", - "eslint": "eslint app chrome test scripts webpack/*.js", + "eslint": "eslint app chrome scripts webpack/*.js", "test-e2e": "npm run clean && npm run build-dll && npm run build -- --env 'test' && npm run compress-e2e-tests && cucumber-js --require-module 'babel-core/register' --compiler es6:babel-core/register features/*.feature", "test-by-tag": "npm run clean && npm run build-dll && npm run build -- --env 'test' && npm run compress-e2e-tests && cucumber-js --require-module 'babel-core/register' --compiler es6:babel-core/register features/*.feature --tags ", "test-by-feature": "npm run clean && npm run build-dll && npm run build -- --env 'test' && npm run compress-e2e-tests && cucumber-js --require-module 'babel-core/register' --compiler es6:babel-core/register ", @@ -41,7 +41,7 @@ "license": "MIT", "devDependencies": { "babel-core": "6.26.3", - "babel-eslint": "7.1.0", + "babel-eslint": "10.0.1", "babel-loader": "6.2.0", "babel-plugin-add-module-exports": "0.2.1", "babel-plugin-react-intl": "2.3.1", @@ -60,13 +60,13 @@ "crx": "3.2.1", "css-loader": "0.25.0", "cucumber": "4.2.1", - "eslint": "3.9.1", - "eslint-config-airbnb": "12.0.0", - "eslint-plugin-flowtype": "2.47.1", - "eslint-plugin-import": "1.16.0", - "eslint-plugin-jsx-a11y": "2.2.3", - "eslint-plugin-promise": "3.8.0", - "eslint-plugin-react": "6.5.0", + "eslint": "5.8.0", + "eslint-config-airbnb": "17.1.0", + "eslint-plugin-flowtype": "3.2.0", + "eslint-plugin-import": "2.14.0", + "eslint-plugin-jsx-a11y": "6.1.2", + "eslint-plugin-promise": "4.0.1", + "eslint-plugin-react": "7.11.1", "file-loader": "1.1.11", "flow-bin": "0.74.0", "html-loader": "0.4.5", diff --git a/scripts/build.js b/scripts/build.js index 918fa1aa21..732f9fc315 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -12,4 +12,3 @@ console.log('[Webpack Build]'); console.log('-'.repeat(80)); exec(`./node_modules/.bin/webpack --config webpack/${argv.env}.config.js --progress --profile --colors`); - diff --git a/webpack/customPublicPath.js b/webpack/customPublicPath.js index 2202757dcb..67b2d9feab 100644 --- a/webpack/customPublicPath.js +++ b/webpack/customPublicPath.js @@ -1,5 +1,6 @@ /* global __webpack_public_path__ __HOST__ __PORT__ */ /* eslint no-global-assign: 0 camelcase: 0 */ +/* eslint no-unused-vars: 0 */ if (process.env.NODE_ENV !== 'development') { __webpack_public_path__ = chrome.extension.getURL('/js/'); From eefd019cddc1a767bbb63c3f6ea5bd3849235288 Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Wed, 7 Nov 2018 05:53:25 +0900 Subject: [PATCH 3/6] fix remaining problems --- .eslintrc | 27 +++++++++++++++++-- app/App.js | 3 +-- app/api/ada/adaAccount.js | 2 +- app/api/ada/adaAddress.js | 4 +-- .../ada/adaTransactions/adaNewTransactions.js | 2 +- app/api/ada/daedalusTransfer.js | 6 ++--- app/api/ada/lib/cardanoCrypto/cryptoErrors.js | 4 +-- app/api/ada/lib/cardanoCrypto/cryptoUtils.js | 23 +++++----------- app/api/ada/lib/cardanoCrypto/cryptoWallet.js | 2 +- .../DaedalusTransferErrorPage.js | 3 +-- .../DaedalusTransferFormPage.js | 3 +-- .../DaedalusTransferInstructionsPage.js | 3 +-- .../DaedalusTransferSummaryPage.js | 3 +-- .../DaedalusTransferWaitingPage.js | 3 +-- app/components/layout/CenteredLayout.js | 3 +-- app/components/layout/SidebarLayout.js | 3 +-- app/components/layout/TopBar.js | 3 +-- app/components/layout/TopBarCategory.js | 3 +-- app/components/layout/TopBarLayout.js | 3 +-- .../layout/VerticalFlexContainer.js | 3 +-- app/components/loading/Loading.js | 3 +-- .../LanguageSelectionForm.js | 3 +-- .../profile/terms-of-use/TermsOfUseForm.js | 3 +-- .../profile/terms-of-use/TermsOfUseText.js | 3 +-- app/components/settings/SettingsLayout.js | 3 +-- .../settings/categories/GeneralSettings.js | 3 +-- .../settings/categories/SupportSettings.js | 3 +-- .../settings/categories/TermsOfUseSettings.js | 3 +-- app/components/settings/menu/SettingsMenu.js | 3 +-- .../settings/menu/SettingsMenuItem.js | 3 +-- app/components/sidebar/Sidebar.js | 3 +-- app/components/sidebar/SidebarCategory.js | 3 +-- app/components/wallet/WalletAdd.js | 3 +-- app/components/wallet/WalletBackupDialog.js | 7 +++-- app/components/wallet/WalletCreateDialog.js | 3 +-- app/components/wallet/WalletReceive.js | 3 +-- app/components/wallet/WalletRestoreDialog.js | 3 +-- .../wallet/WalletSendConfirmationDialog.js | 3 +-- app/components/wallet/WalletSendForm.js | 3 +-- app/components/wallet/WalletSettings.js | 3 +-- .../wallet/backup-recovery/MnemonicWord.js | 3 +-- .../WalletBackupPrivacyWarningDialog.js | 3 +-- .../WalletRecoveryInstructions.js | 3 +-- .../WalletRecoveryPhraseDisplayDialog.js | 3 +-- .../WalletRecoveryPhraseEntryDialog.js | 3 +-- .../WalletRecoveryPhraseMnemonic.js | 3 +-- .../wallet/layouts/WalletWithNavigation.js | 3 +-- .../wallet/navigation/WalletNavButton.js | 3 +-- .../wallet/navigation/WalletNavigation.js | 3 +-- .../settings/ChangeWalletPasswordDialog.js | 3 +-- .../wallet/summary/WalletSummary.js | 3 +-- .../transactions/WalletNoTransactions.js | 3 +-- .../transactions/WalletTransactionsList.js | 3 +-- app/components/widgets/BorderedBox.js | 3 +-- .../widgets/forms/InlineEditingInput.js | 3 +-- app/components/widgets/forms/ReadOnlyInput.js | 3 +-- app/containers/LoadingPage.js | 3 +-- app/containers/MainLayout.js | 3 +-- app/containers/TopBarContainer.js | 3 +-- .../daedalusTransfer/DaedalusTransferPage.js | 3 +-- .../profile/LanguageSelectionPage.js | 3 +-- app/containers/profile/TermsOfUsePage.js | 3 +-- app/containers/settings/Settings.js | 3 +-- .../categories/GeneralSettingsPage.js | 3 +-- .../categories/SupportSettingsPage.js | 3 +-- .../categories/TermsOfUseSettingsPage.js | 3 +-- .../settings/categories/WalletSettingsPage.js | 3 +-- app/containers/wallet/NoWalletsPage.js | 3 +-- app/containers/wallet/Wallet.js | 3 +-- app/containers/wallet/WalletAddPage.js | 3 +-- app/containers/wallet/WalletReceivePage.js | 3 +-- app/containers/wallet/WalletSendPage.js | 3 +-- app/containers/wallet/WalletSummaryPage.js | 3 +-- .../ChangeWalletPasswordDialogContainer.js | 3 +-- .../dialogs/WalletBackupDialogContainer.js | 3 +-- .../dialogs/WalletCreateDialogContainer.js | 3 +-- .../dialogs/WalletRestoreDialogContainer.js | 3 +-- .../WalletSendConfirmationDialogContainer.js | 3 +-- app/stores/WalletBackupStore.js | 7 +++-- app/stores/lib/LocalizedCachedRequest.js | 4 +++ app/stores/lib/Request.js | 3 +-- app/themes/README.md | 2 +- app/utils/passwordCipher.js | 10 +++---- package-lock.json | 8 +++--- package.json | 2 +- 85 files changed, 136 insertions(+), 184 deletions(-) diff --git a/.eslintrc b/.eslintrc index a316c30c7a..ed03cb7195 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,12 @@ { "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + "ecmaFeatures": { + "legacyDecorators": true + } +}, "extends": "airbnb", "env": { "browser": true, @@ -16,18 +23,35 @@ "import/no-unresolved": ["error", { "ignore": ["electron"] }], "import/no-extraneous-dependencies": "off", "import/no-dynamic-require": "off", + "import/no-named-as-default": "off", + "import/no-named-as-default-member": "off", "import/prefer-default-export": "off", + "import/order": "off", + "lines-between-class-members": "off", + "no-multi-spaces": "off", + "no-restricted-globals": "off", + "no-restricted-syntax": "off", + "no-return-await": "off", "no-use-before-define": "off", + "object-curly-newline": "off", + "operator-linebreak": 0, + "prefer-destructuring": 0, "promise/param-names": 2, "promise/always-return": 2, "promise/catch-or-return": 2, "promise/no-native": 0, + "react/button-has-type": 1, + "react/destructuring-assignment": 0, + "react/no-array-index-key": 1, "react/jsx-no-bind": "off", "react/jsx-filename-extension": ["error", { "extensions": [".js", ".jsx"] }], "react/jsx-closing-bracket-location": 1, + "react/jsx-one-expression-per-line": "off", + "react/jsx-wrap-multilines": "off", "react/prefer-stateless-function": "off", "react/no-unused-prop-types": "off", "react/prop-types": 0, + "react/require-default-props": 1, "react/sort-comp": 0, "class-methods-use-this": 0, "no-duplicate-imports": 0, @@ -40,7 +64,7 @@ "prefer-template": 0, "no-unused-vars": 1, "no-trailing-spaces": 1, - "padded-blocks": 1, + "padded-blocks": 0, "no-undef": 1, "arrow-body-style": 1, "key-spacing": 1, @@ -52,7 +76,6 @@ "spaced-comment": 1, "quotes": 1, "import/imports-first": 1, - "no-multi-spaces": 1, "no-multiple-empty-lines": 1, "react/jsx-indent": 1, "flowtype/define-flow-type": 1, diff --git a/app/App.js b/app/App.js index 5c5f3634dc..504bf6560a 100644 --- a/app/App.js +++ b/app/App.js @@ -18,9 +18,8 @@ import ThemeManager from './ThemeManager'; // https://github.com/yahoo/react-intl/wiki#loading-locale-data addLocaleData([...en, ...ko, ...ja, ...zh]); -export default @observer -class App extends Component<{ +export default class App extends Component<{ stores: StoresMap, actions: ActionsMap, history: Object, diff --git a/app/api/ada/adaAccount.js b/app/api/ada/adaAccount.js index 64dfedf6df..0e2f78e289 100644 --- a/app/api/ada/adaAccount.js +++ b/app/api/ada/adaAccount.js @@ -21,6 +21,6 @@ export function createCryptoAccount( accountIndex: number = ACCOUNT_INDEX ): CryptoAccount { const cryptoWallet = getCryptoWalletFromMasterKey(masterKey, walletPassword); - const result = getResultOrFail(Wallet.newAccount(cryptoWallet, accountIndex)); + const result: CryptoAccount = getResultOrFail(Wallet.newAccount(cryptoWallet, accountIndex)); return Object.assign({}, { account: accountIndex }, result); } diff --git a/app/api/ada/adaAddress.js b/app/api/ada/adaAddress.js index 944cbd53b3..25d557ab0c 100644 --- a/app/api/ada/adaAddress.js +++ b/app/api/ada/adaAddress.js @@ -32,7 +32,7 @@ const { MAX_ALLOWED_UNUSED_ADDRESSES } = config.wallets; export function isValidAdaAddress(address: string): Promise { try { - const result = getResultOrFail(Wallet.checkAddress(getAddressInHex(address))); + const result: boolean = getResultOrFail(Wallet.checkAddress(getAddressInHex(address))); return Promise.resolve(result); } catch (validateAddressError) { Logger.error('adaAddress::isValidAdaAddress error: ' + @@ -94,7 +94,7 @@ export async function createAdaAddress( ): Promise { const filteredAddresses = await getAdaAddressesByType(addressType); const addressIndex = filteredAddresses.length; - const [address] = getResultOrFail>( + const [address]: Array = getResultOrFail( Wallet.generateAddresses(cryptoAccount, addressType, [addressIndex]) ); return toAdaAddress(cryptoAccount.account, addressType, addressIndex, address); diff --git a/app/api/ada/adaTransactions/adaNewTransactions.js b/app/api/ada/adaTransactions/adaNewTransactions.js index 761e4646c6..fc4f00e2be 100644 --- a/app/api/ada/adaTransactions/adaNewTransactions.js +++ b/app/api/ada/adaTransactions/adaNewTransactions.js @@ -128,7 +128,7 @@ export async function getAdaTransactionFromSenders( const outputs = [{ address: receiver, value: amount }]; const senderUtxos = await getAllUTXOsForAddresses(_getAddresses(senders)); const inputs = _mapUTXOsToInputs(senderUtxos, addressesMap); - const result = getResultOrFail( + const result: SpendResponse = getResultOrFail( Wallet.spend(cryptoWallet, inputs, outputs, changeAddr) ); return [result, changeAdaAddr]; diff --git a/app/api/ada/daedalusTransfer.js b/app/api/ada/daedalusTransfer.js index 379589b192..341acc4fbc 100644 --- a/app/api/ada/daedalusTransfer.js +++ b/app/api/ada/daedalusTransfer.js @@ -39,10 +39,10 @@ export function getAddressesWithFunds(payload: { }): Array { try { const { secretWords, addresses } = payload; - const checker = getResultOrFail( + const checker: CryptoAddressChecker = getResultOrFail( RandomAddressChecker.newCheckerFromMnemonics(secretWords) ); - const addressesWithFunds = getResultOrFail>( + const addressesWithFunds: Array = getResultOrFail( RandomAddressChecker.checkAddresses(checker, addresses) ); return addressesWithFunds; @@ -67,7 +67,7 @@ export async function generateTransferTx(payload: { const wallet = getCryptoDaedalusWalletFromMnemonics(secretWords); const inputs = _getInputs(senderUtxos, addressesWithFunds); const output = await _getReceiverAddress(); - const tx = getResultOrFail(Wallet.move(wallet, inputs, output)); + const tx: MoveResponse = getResultOrFail(Wallet.move(wallet, inputs, output)); return { recoveredBalance: recoveredBalance.dividedBy(LOVELACES_PER_ADA), fee: new BigNumber(tx.fee).dividedBy(LOVELACES_PER_ADA), diff --git a/app/api/ada/lib/cardanoCrypto/cryptoErrors.js b/app/api/ada/lib/cardanoCrypto/cryptoErrors.js index 9cecbf5c5c..767ed69651 100644 --- a/app/api/ada/lib/cardanoCrypto/cryptoErrors.js +++ b/app/api/ada/lib/cardanoCrypto/cryptoErrors.js @@ -1,7 +1,7 @@ // @flow import ExtendableError from 'es6-error'; -class CardanoCryptoError extends ExtendableError { +export class CardanoCryptoError extends ExtendableError { constructor(message: ?string = 'Cardano crypto error') { super(message); } @@ -12,5 +12,3 @@ export class WrongPassphraseError extends CardanoCryptoError { super(message); } } - -export default CardanoCryptoError; diff --git a/app/api/ada/lib/cardanoCrypto/cryptoUtils.js b/app/api/ada/lib/cardanoCrypto/cryptoUtils.js index 15a348d08e..68ba400446 100644 --- a/app/api/ada/lib/cardanoCrypto/cryptoUtils.js +++ b/app/api/ada/lib/cardanoCrypto/cryptoUtils.js @@ -1,20 +1,11 @@ // @flow -import CardanoCryptoError from './cryptoErrors'; +import { CardanoCryptoError } from './cryptoErrors'; -export function getResultOrFail( - arg: { result: T, failed: boolean, msg: ?string } -): T { - if (arg.failed) { - throw new CardanoCryptoError(arg.msg); +export function getResultOrFail( + result: any +): any { + if (result.failed) { + throw new CardanoCryptoError(result.msg); } - return arg.result; -} - -export function getOrFail( - result: ?T | false -): T { - if (!result) { - throw new CardanoCryptoError('Result not defined'); - } - return result; + return result.result; } diff --git a/app/api/ada/lib/cardanoCrypto/cryptoWallet.js b/app/api/ada/lib/cardanoCrypto/cryptoWallet.js index a2b8c1c928..a448cb452e 100644 --- a/app/api/ada/lib/cardanoCrypto/cryptoWallet.js +++ b/app/api/ada/lib/cardanoCrypto/cryptoWallet.js @@ -52,7 +52,7 @@ export function getCryptoWalletFromMasterKey( export function getCryptoDaedalusWalletFromMnemonics( secretWords: string, ): CryptoDaedalusWallet { - const wallet = getResultOrFail(Wallet.fromDaedalusMnemonic(secretWords)); + const wallet: CryptoDaedalusWallet = getResultOrFail(Wallet.fromDaedalusMnemonic(secretWords)); wallet.config.protocol_magic = protocolMagic; return wallet; } diff --git a/app/components/daedalusTransfer/DaedalusTransferErrorPage.js b/app/components/daedalusTransfer/DaedalusTransferErrorPage.js index 8a3a2197bd..e7350efa3c 100644 --- a/app/components/daedalusTransfer/DaedalusTransferErrorPage.js +++ b/app/components/daedalusTransfer/DaedalusTransferErrorPage.js @@ -26,9 +26,8 @@ type Props = { onCancel: Function }; -export default @observer -class DaedalusTransferErrorPage extends Component { +export default class DaedalusTransferErrorPage extends Component { static contextTypes = { intl: intlShape.isRequired diff --git a/app/components/daedalusTransfer/DaedalusTransferFormPage.js b/app/components/daedalusTransfer/DaedalusTransferFormPage.js index ad7716be3a..51dc343237 100644 --- a/app/components/daedalusTransfer/DaedalusTransferFormPage.js +++ b/app/components/daedalusTransfer/DaedalusTransferFormPage.js @@ -70,9 +70,8 @@ type Props = { suggestedMnemonics: Array, }; -export default @observer -class DaedalusTransferFormPage extends Component { +export default class DaedalusTransferFormPage extends Component { static contextTypes = { intl: intlShape.isRequired diff --git a/app/components/daedalusTransfer/DaedalusTransferInstructionsPage.js b/app/components/daedalusTransfer/DaedalusTransferInstructionsPage.js index de98ec0111..3606608f14 100644 --- a/app/components/daedalusTransfer/DaedalusTransferInstructionsPage.js +++ b/app/components/daedalusTransfer/DaedalusTransferInstructionsPage.js @@ -81,9 +81,8 @@ type Props = { disableTransferFunds: boolean, }; -export default @observer -class DaedalusTransferInstructionsPage extends Component { +export default class DaedalusTransferInstructionsPage extends Component { static contextTypes = { intl: intlShape.isRequired diff --git a/app/components/daedalusTransfer/DaedalusTransferSummaryPage.js b/app/components/daedalusTransfer/DaedalusTransferSummaryPage.js index b75ad4e878..8555c534cd 100644 --- a/app/components/daedalusTransfer/DaedalusTransferSummaryPage.js +++ b/app/components/daedalusTransfer/DaedalusTransferSummaryPage.js @@ -62,9 +62,8 @@ type Props = { error: LocalizableError }; -export default @observer -class DaedalusTransferSummaryPage extends Component { +export default class DaedalusTransferSummaryPage extends Component { static contextTypes = { intl: intlShape.isRequired diff --git a/app/components/daedalusTransfer/DaedalusTransferWaitingPage.js b/app/components/daedalusTransfer/DaedalusTransferWaitingPage.js index f655b8ef73..d2d86f3212 100644 --- a/app/components/daedalusTransfer/DaedalusTransferWaitingPage.js +++ b/app/components/daedalusTransfer/DaedalusTransferWaitingPage.js @@ -32,9 +32,8 @@ type Props = { status: string }; -export default @observer -class DaedalusTransferWaitingPage extends Component { +export default class DaedalusTransferWaitingPage extends Component { static contextTypes = { intl: intlShape.isRequired diff --git a/app/components/layout/CenteredLayout.js b/app/components/layout/CenteredLayout.js index 1a4aefcd19..c9899bca80 100644 --- a/app/components/layout/CenteredLayout.js +++ b/app/components/layout/CenteredLayout.js @@ -8,9 +8,8 @@ type Props = { children: Node, }; -export default @observer -class CenteredLayout extends Component { +export default class CenteredLayout extends Component { static defaultProps = { children: null diff --git a/app/components/layout/SidebarLayout.js b/app/components/layout/SidebarLayout.js index 07aeec07d8..d4eed83f69 100644 --- a/app/components/layout/SidebarLayout.js +++ b/app/components/layout/SidebarLayout.js @@ -24,9 +24,8 @@ export const messages = defineMessages({ }, }); -export default @observer -class SidebarLayout extends Component { +export default class SidebarLayout extends Component { static defaultProps = { children: null diff --git a/app/components/layout/TopBar.js b/app/components/layout/TopBar.js index 1fb2a0884a..110bc3e6d4 100644 --- a/app/components/layout/TopBar.js +++ b/app/components/layout/TopBar.js @@ -25,9 +25,8 @@ type Props = { onCategoryClicked?: Function, }; -export default @observer -class TopBar extends Component { +export default class TopBar extends Component { render() { const { diff --git a/app/components/layout/TopBarCategory.js b/app/components/layout/TopBarCategory.js index 00469fdac9..16983d7dd1 100644 --- a/app/components/layout/TopBarCategory.js +++ b/app/components/layout/TopBarCategory.js @@ -13,9 +13,8 @@ type Props = { className: string, }; -export default @observer -class TopBarCategory extends Component { +export default class TopBarCategory extends Component { render() { const { icon, active, onClick, className } = this.props; const componentStyles = classNames([ diff --git a/app/components/layout/TopBarLayout.js b/app/components/layout/TopBarLayout.js index 6398dd2f57..7e662127a2 100644 --- a/app/components/layout/TopBarLayout.js +++ b/app/components/layout/TopBarLayout.js @@ -10,9 +10,8 @@ type Props = { notification?: ?Node, }; -export default @observer -class TopBarLayout extends Component { +export default class TopBarLayout extends Component { render() { const { children, topbar, notification } = this.props; diff --git a/app/components/layout/VerticalFlexContainer.js b/app/components/layout/VerticalFlexContainer.js index 5f46936439..996b022f56 100644 --- a/app/components/layout/VerticalFlexContainer.js +++ b/app/components/layout/VerticalFlexContainer.js @@ -8,9 +8,8 @@ type Props = { children?: ?Node, }; -export default @observer -class VerticalFlexContainer extends Component { +export default class VerticalFlexContainer extends Component { render() { const { children } = this.props; return ( diff --git a/app/components/loading/Loading.js b/app/components/loading/Loading.js index 7f7de1509d..241eddbde7 100644 --- a/app/components/loading/Loading.js +++ b/app/components/loading/Loading.js @@ -23,9 +23,8 @@ type Props = { error: ?LocalizableError }; -export default @observer -class Loading extends Component { +export default class Loading extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/profile/language-selection/LanguageSelectionForm.js b/app/components/profile/language-selection/LanguageSelectionForm.js index d820b7c873..989b90bc41 100644 --- a/app/components/profile/language-selection/LanguageSelectionForm.js +++ b/app/components/profile/language-selection/LanguageSelectionForm.js @@ -32,9 +32,8 @@ type Props = { error?: ?LocalizableError, }; -export default @observer -class LanguageSelectionForm extends Component { +export default class LanguageSelectionForm extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/profile/terms-of-use/TermsOfUseForm.js b/app/components/profile/terms-of-use/TermsOfUseForm.js index 1fb61970d5..f01bf25ead 100644 --- a/app/components/profile/terms-of-use/TermsOfUseForm.js +++ b/app/components/profile/terms-of-use/TermsOfUseForm.js @@ -35,9 +35,8 @@ type State = { areTermsOfUseAccepted: boolean, }; -export default @observer -class TermsOfUseForm extends Component { +export default class TermsOfUseForm extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/profile/terms-of-use/TermsOfUseText.js b/app/components/profile/terms-of-use/TermsOfUseText.js index da861bb386..bfc6689fdc 100644 --- a/app/components/profile/terms-of-use/TermsOfUseText.js +++ b/app/components/profile/terms-of-use/TermsOfUseText.js @@ -8,9 +8,8 @@ type Props = { localizedTermsOfUse: string, }; -export default @observer -class TermsOfUseText extends Component { +export default class TermsOfUseText extends Component { render() { return (
diff --git a/app/components/settings/SettingsLayout.js b/app/components/settings/SettingsLayout.js index b1100188a7..a9d0017bd6 100644 --- a/app/components/settings/SettingsLayout.js +++ b/app/components/settings/SettingsLayout.js @@ -9,9 +9,8 @@ type Props = { menu: Node, }; -export default @observer -class SettingsLayout extends Component { +export default class SettingsLayout extends Component { render() { const { menu, children } = this.props; return ( diff --git a/app/components/settings/categories/GeneralSettings.js b/app/components/settings/categories/GeneralSettings.js index a570460853..391edd3e33 100644 --- a/app/components/settings/categories/GeneralSettings.js +++ b/app/components/settings/categories/GeneralSettings.js @@ -26,9 +26,8 @@ type Props = { error?: ?LocalizableError, }; -export default @observer -class GeneralSettings extends Component { +export default class GeneralSettings extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/settings/categories/SupportSettings.js b/app/components/settings/categories/SupportSettings.js index 26c14ceece..3e20aff593 100644 --- a/app/components/settings/categories/SupportSettings.js +++ b/app/components/settings/categories/SupportSettings.js @@ -63,9 +63,8 @@ type Props = { onDownloadLogs: Function, }; -export default @observer -class SupportSettings extends Component { +export default class SupportSettings extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/settings/categories/TermsOfUseSettings.js b/app/components/settings/categories/TermsOfUseSettings.js index fd005b52a4..0fc4fb5b6a 100644 --- a/app/components/settings/categories/TermsOfUseSettings.js +++ b/app/components/settings/categories/TermsOfUseSettings.js @@ -8,9 +8,8 @@ type Props = { localizedTermsOfUse: string, }; -export default @observer -class TermsOfUseSettings extends Component { +export default class TermsOfUseSettings extends Component { render() { const { localizedTermsOfUse } = this.props; return ( diff --git a/app/components/settings/menu/SettingsMenu.js b/app/components/settings/menu/SettingsMenu.js index 3c90596044..93d9776f1b 100644 --- a/app/components/settings/menu/SettingsMenu.js +++ b/app/components/settings/menu/SettingsMenu.js @@ -35,9 +35,8 @@ type Props = { hasActiveWallet: boolean, }; -export default @observer -class SettingsMenu extends Component { +export default class SettingsMenu extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/settings/menu/SettingsMenuItem.js b/app/components/settings/menu/SettingsMenuItem.js index 66b91d2a13..f93126fe6a 100644 --- a/app/components/settings/menu/SettingsMenuItem.js +++ b/app/components/settings/menu/SettingsMenuItem.js @@ -12,9 +12,8 @@ type Props = { disabled?: boolean, }; -export default @observer -class SettingsMenuItem extends Component { +export default class SettingsMenuItem extends Component { render() { const { label, active, disabled, onClick, className } = this.props; let state = styles.enabled; diff --git a/app/components/sidebar/Sidebar.js b/app/components/sidebar/Sidebar.js index 1b87b0c78d..70856cf236 100644 --- a/app/components/sidebar/Sidebar.js +++ b/app/components/sidebar/Sidebar.js @@ -20,9 +20,8 @@ type Props = { isDialogOpen: Function, }; -export default @observer -class Sidebar extends Component { +export default class Sidebar extends Component { static defaultProps = { isShowingSubMenus: false, diff --git a/app/components/sidebar/SidebarCategory.js b/app/components/sidebar/SidebarCategory.js index 4d9d8d9191..a7ca651f4b 100644 --- a/app/components/sidebar/SidebarCategory.js +++ b/app/components/sidebar/SidebarCategory.js @@ -13,9 +13,8 @@ type Props = { className: string, }; -export default @observer -class SidebarCategory extends Component { +export default class SidebarCategory extends Component { render() { const { icon, active, onClick, className } = this.props; const componentStyles = classNames([ diff --git a/app/components/wallet/WalletAdd.js b/app/components/wallet/WalletAdd.js index b4d4fa0ebc..532c122823 100644 --- a/app/components/wallet/WalletAdd.js +++ b/app/components/wallet/WalletAdd.js @@ -37,9 +37,8 @@ type Props = { isRestoreActive: boolean, }; -export default @observer -class WalletAdd extends Component { +export default class WalletAdd extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/WalletBackupDialog.js b/app/components/wallet/WalletBackupDialog.js index f3a7476aa5..932873a0dd 100644 --- a/app/components/wallet/WalletBackupDialog.js +++ b/app/components/wallet/WalletBackupDialog.js @@ -30,9 +30,8 @@ type Props = { onRestartBackup: Function, }; -export default @observer -class WalletBackupDialog extends Component { +export default class WalletBackupDialog extends Component { render() { const { @@ -91,5 +90,9 @@ class WalletBackupDialog extends Component { /> ); } + + // We should never get to this point + // TODO: use proper types to make sure this is not possible + return
; } } diff --git a/app/components/wallet/WalletCreateDialog.js b/app/components/wallet/WalletCreateDialog.js index 7b162fc534..73bb16b355 100644 --- a/app/components/wallet/WalletCreateDialog.js +++ b/app/components/wallet/WalletCreateDialog.js @@ -59,9 +59,8 @@ type State = { isSubmitting: boolean, }; -export default @observer -class WalletCreateDialog extends Component { +export default class WalletCreateDialog extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/WalletReceive.js b/app/components/wallet/WalletReceive.js index b7b4c6480c..6931b16ab0 100644 --- a/app/components/wallet/WalletReceive.js +++ b/app/components/wallet/WalletReceive.js @@ -71,9 +71,8 @@ type State = { showUsed: boolean, }; -export default @observer -class WalletReceive extends Component { +export default class WalletReceive extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/WalletRestoreDialog.js b/app/components/wallet/WalletRestoreDialog.js index af05b49bd5..c75ffb4fbc 100644 --- a/app/components/wallet/WalletRestoreDialog.js +++ b/app/components/wallet/WalletRestoreDialog.js @@ -85,9 +85,8 @@ type Props = { suggestedMnemonics: Array, }; -export default @observer -class WalletRestoreDialog extends Component { +export default class WalletRestoreDialog extends Component { static contextTypes = { intl: intlShape.isRequired diff --git a/app/components/wallet/WalletSendConfirmationDialog.js b/app/components/wallet/WalletSendConfirmationDialog.js index 6608391c16..cc6ba3110e 100644 --- a/app/components/wallet/WalletSendConfirmationDialog.js +++ b/app/components/wallet/WalletSendConfirmationDialog.js @@ -78,9 +78,8 @@ type Props = { currencyUnit: string, }; -export default @observer -class WalletSendConfirmationDialog extends Component { +export default class WalletSendConfirmationDialog extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/WalletSendForm.js b/app/components/wallet/WalletSendForm.js index 45f331933a..6b8fd03f3a 100755 --- a/app/components/wallet/WalletSendForm.js +++ b/app/components/wallet/WalletSendForm.js @@ -118,9 +118,8 @@ type State = { transactionFeeError: ?string, }; -export default @observer -class WalletSendForm extends Component { +export default class WalletSendForm extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/WalletSettings.js b/app/components/wallet/WalletSettings.js index 3b01744a8d..9e44152b3e 100644 --- a/app/components/wallet/WalletSettings.js +++ b/app/components/wallet/WalletSettings.js @@ -51,9 +51,8 @@ type Props = { lastUpdatedField: ?string, }; -export default @observer -class WalletSettings extends Component { +export default class WalletSettings extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/backup-recovery/MnemonicWord.js b/app/components/wallet/backup-recovery/MnemonicWord.js index 7e8e3633c3..ed0d99ff18 100644 --- a/app/components/wallet/backup-recovery/MnemonicWord.js +++ b/app/components/wallet/backup-recovery/MnemonicWord.js @@ -13,9 +13,8 @@ type Props = { onClick: Function, }; -export default @observer -class MnemonicWord extends Component { +export default class MnemonicWord extends Component { render() { const { word, index, isActive, onClick } = this.props; diff --git a/app/components/wallet/backup-recovery/WalletBackupPrivacyWarningDialog.js b/app/components/wallet/backup-recovery/WalletBackupPrivacyWarningDialog.js index ec152f3e40..1fa3d2beae 100644 --- a/app/components/wallet/backup-recovery/WalletBackupPrivacyWarningDialog.js +++ b/app/components/wallet/backup-recovery/WalletBackupPrivacyWarningDialog.js @@ -40,9 +40,8 @@ type Props = { onCancelBackup: Function, }; -export default @observer -class WalletBackupPrivacyWarningDialog extends Component { +export default class WalletBackupPrivacyWarningDialog extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/backup-recovery/WalletRecoveryInstructions.js b/app/components/wallet/backup-recovery/WalletRecoveryInstructions.js index 5cf767881d..cfdf103504 100644 --- a/app/components/wallet/backup-recovery/WalletRecoveryInstructions.js +++ b/app/components/wallet/backup-recovery/WalletRecoveryInstructions.js @@ -8,9 +8,8 @@ type Props = { instructionsText: string | Element, }; -export default @observer -class WalletRecoveryInstructions extends Component { +export default class WalletRecoveryInstructions extends Component { render() { const { instructionsText } = this.props; diff --git a/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.js b/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.js index ae8c7a8ca7..a221d08d91 100644 --- a/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.js +++ b/app/components/wallet/backup-recovery/WalletRecoveryPhraseDisplayDialog.js @@ -30,9 +30,8 @@ type Props = { onCancelBackup: Function, }; -export default @observer -class WalletRecoveryPhraseDisplayDialog extends Component { +export default class WalletRecoveryPhraseDisplayDialog extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.js b/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.js index a069ed0950..89e039d0d8 100644 --- a/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.js +++ b/app/components/wallet/backup-recovery/WalletRecoveryPhraseEntryDialog.js @@ -60,9 +60,8 @@ type Props = { onFinishBackup: Function, }; -export default @observer -class WalletRecoveryPhraseEntryDialog extends Component { +export default class WalletRecoveryPhraseEntryDialog extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/backup-recovery/WalletRecoveryPhraseMnemonic.js b/app/components/wallet/backup-recovery/WalletRecoveryPhraseMnemonic.js index 83630a4612..43e50ea331 100644 --- a/app/components/wallet/backup-recovery/WalletRecoveryPhraseMnemonic.js +++ b/app/components/wallet/backup-recovery/WalletRecoveryPhraseMnemonic.js @@ -7,9 +7,8 @@ type Props = { phrase: string, }; -export default @observer -class WalletRecoveryPhraseMnemonic extends Component { +export default class WalletRecoveryPhraseMnemonic extends Component { render() { const { phrase } = this.props; diff --git a/app/components/wallet/layouts/WalletWithNavigation.js b/app/components/wallet/layouts/WalletWithNavigation.js index d9188a890f..196350305d 100644 --- a/app/components/wallet/layouts/WalletWithNavigation.js +++ b/app/components/wallet/layouts/WalletWithNavigation.js @@ -11,9 +11,8 @@ type Props = { onWalletNavItemClick: Function, }; -export default @observer -class WalletWithNavigation extends Component { +export default class WalletWithNavigation extends Component { render() { const { children, isActiveScreen, onWalletNavItemClick } = this.props; diff --git a/app/components/wallet/navigation/WalletNavButton.js b/app/components/wallet/navigation/WalletNavButton.js index d82a6a2960..587374ff55 100755 --- a/app/components/wallet/navigation/WalletNavButton.js +++ b/app/components/wallet/navigation/WalletNavButton.js @@ -13,9 +13,8 @@ type Props = { className?: string, }; -export default @observer -class WalletNavButton extends Component { +export default class WalletNavButton extends Component { render() { const { isActive, /* icon, */ onClick, className } = this.props; diff --git a/app/components/wallet/navigation/WalletNavigation.js b/app/components/wallet/navigation/WalletNavigation.js index c988062c41..4fa5b52342 100755 --- a/app/components/wallet/navigation/WalletNavigation.js +++ b/app/components/wallet/navigation/WalletNavigation.js @@ -31,9 +31,8 @@ type Props = { onNavItemClick: Function, }; -export default @observer -class WalletNavigation extends Component { +export default class WalletNavigation extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/settings/ChangeWalletPasswordDialog.js b/app/components/wallet/settings/ChangeWalletPasswordDialog.js index 483fec17ca..75c06bce08 100644 --- a/app/components/wallet/settings/ChangeWalletPasswordDialog.js +++ b/app/components/wallet/settings/ChangeWalletPasswordDialog.js @@ -77,9 +77,8 @@ type State = { removePassword: boolean, }; -export default @observer -class ChangeWalletPasswordDialog extends Component { +export default class ChangeWalletPasswordDialog extends Component { static defaultProps = { currentPasswordValue: '', diff --git a/app/components/wallet/summary/WalletSummary.js b/app/components/wallet/summary/WalletSummary.js index e0939f4737..4447407f9f 100644 --- a/app/components/wallet/summary/WalletSummary.js +++ b/app/components/wallet/summary/WalletSummary.js @@ -33,9 +33,8 @@ type Props = { isLoadingTransactions: boolean, }; -export default @observer -class WalletSummary extends Component { +export default class WalletSummary extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/wallet/transactions/WalletNoTransactions.js b/app/components/wallet/transactions/WalletNoTransactions.js index d866b81ae2..f7a8006ff4 100644 --- a/app/components/wallet/transactions/WalletNoTransactions.js +++ b/app/components/wallet/transactions/WalletNoTransactions.js @@ -7,9 +7,8 @@ type Props = { label: string, }; -export default @observer -class WalletNoTransactions extends Component { +export default class WalletNoTransactions extends Component { render() { return ( diff --git a/app/components/wallet/transactions/WalletTransactionsList.js b/app/components/wallet/transactions/WalletTransactionsList.js index 4b0b70e9bb..716c3e40d9 100644 --- a/app/components/wallet/transactions/WalletTransactionsList.js +++ b/app/components/wallet/transactions/WalletTransactionsList.js @@ -42,9 +42,8 @@ type Props = { onLoadMore: Function, }; -export default @observer -class WalletTransactionsList extends Component { +export default class WalletTransactionsList extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/components/widgets/BorderedBox.js b/app/components/widgets/BorderedBox.js index e1ea9954ea..2ce9282e1a 100644 --- a/app/components/widgets/BorderedBox.js +++ b/app/components/widgets/BorderedBox.js @@ -8,9 +8,8 @@ type Props = { children?: Node, }; -export default @observer -class BorderedBox extends Component { +export default class BorderedBox extends Component { render() { const { children } = this.props; diff --git a/app/components/widgets/forms/InlineEditingInput.js b/app/components/widgets/forms/InlineEditingInput.js index d7277733aa..f225a52ca8 100644 --- a/app/components/widgets/forms/InlineEditingInput.js +++ b/app/components/widgets/forms/InlineEditingInput.js @@ -44,9 +44,8 @@ type State = { isActive: boolean, }; -export default @observer -class InlineEditingInput extends Component { +export default class InlineEditingInput extends Component { state = { isActive: false, diff --git a/app/components/widgets/forms/ReadOnlyInput.js b/app/components/widgets/forms/ReadOnlyInput.js index 0e8539b2b8..b75e79a355 100644 --- a/app/components/widgets/forms/ReadOnlyInput.js +++ b/app/components/widgets/forms/ReadOnlyInput.js @@ -15,9 +15,8 @@ type Props = { onClick: Function, }; -export default @observer -class ReadOnlyInput extends Component { +export default class ReadOnlyInput extends Component { static contextTypes = { intl: intlShape.isRequired, diff --git a/app/containers/LoadingPage.js b/app/containers/LoadingPage.js index 153f7ecee1..f882f568d2 100644 --- a/app/containers/LoadingPage.js +++ b/app/containers/LoadingPage.js @@ -16,9 +16,8 @@ export const messages = defineMessages({ }, }); -export default @inject('stores', 'actions') @observer -class LoadingPage extends Component { +export default class LoadingPage extends Component { render() { const { stores } = this.props; diff --git a/app/containers/MainLayout.js b/app/containers/MainLayout.js index 4ab1433860..57337ebcce 100644 --- a/app/containers/MainLayout.js +++ b/app/containers/MainLayout.js @@ -14,9 +14,8 @@ export type MainLayoutProps = { topbar: ?any }; -export default @inject('stores', 'actions') @observer -class MainLayout extends Component { +export default class MainLayout extends Component { static defaultProps = { actions: null, stores: null, diff --git a/app/containers/TopBarContainer.js b/app/containers/TopBarContainer.js index 6db3113371..6457d68258 100644 --- a/app/containers/TopBarContainer.js +++ b/app/containers/TopBarContainer.js @@ -10,9 +10,8 @@ const { formattedWalletAmount } = resolver('utils/formatters'); type Props = InjectedProps; -export default @observer -class TopBarContainer extends Component { +export default class TopBarContainer extends Component { static defaultProps = { actions: null, stores: null }; render() { diff --git a/app/containers/daedalusTransfer/DaedalusTransferPage.js b/app/containers/daedalusTransfer/DaedalusTransferPage.js index 29c0b90087..3148724a7e 100644 --- a/app/containers/daedalusTransfer/DaedalusTransferPage.js +++ b/app/containers/daedalusTransfer/DaedalusTransferPage.js @@ -25,9 +25,8 @@ const messages = defineMessages({ }, }); -export default @inject('stores', 'actions') @observer -class DaedalusTransferPage extends Component { +export default class DaedalusTransferPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/profile/LanguageSelectionPage.js b/app/containers/profile/LanguageSelectionPage.js index f247bde574..d82bcd712f 100644 --- a/app/containers/profile/LanguageSelectionPage.js +++ b/app/containers/profile/LanguageSelectionPage.js @@ -15,9 +15,8 @@ const messages = defineMessages({ }, }); -export default @inject('stores', 'actions') @observer -class LanguageSelectionPage extends Component { +export default class LanguageSelectionPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/profile/TermsOfUsePage.js b/app/containers/profile/TermsOfUsePage.js index 1aac3296ad..af7d3f85ad 100644 --- a/app/containers/profile/TermsOfUsePage.js +++ b/app/containers/profile/TermsOfUsePage.js @@ -15,9 +15,8 @@ const messages = defineMessages({ }, }); -export default @inject('stores', 'actions') @observer -class TermsOfUsePage extends Component { +export default class TermsOfUsePage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/settings/Settings.js b/app/containers/settings/Settings.js index da8db70e4a..3472b56522 100644 --- a/app/containers/settings/Settings.js +++ b/app/containers/settings/Settings.js @@ -18,9 +18,8 @@ const messages = defineMessages({ }, }); -export default @inject('stores', 'actions') @observer -class Settings extends Component { +export default class Settings extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/settings/categories/GeneralSettingsPage.js b/app/containers/settings/categories/GeneralSettingsPage.js index 938231260f..53d2833111 100644 --- a/app/containers/settings/categories/GeneralSettingsPage.js +++ b/app/containers/settings/categories/GeneralSettingsPage.js @@ -4,9 +4,8 @@ import { observer, inject } from 'mobx-react'; import GeneralSettings from '../../../components/settings/categories/GeneralSettings'; import type { InjectedProps } from '../../../types/injectedPropsType'; -export default @inject('stores', 'actions') @observer -class GeneralSettingsPage extends Component { +export default class GeneralSettingsPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/settings/categories/SupportSettingsPage.js b/app/containers/settings/categories/SupportSettingsPage.js index 82d8360cec..38b706de29 100644 --- a/app/containers/settings/categories/SupportSettingsPage.js +++ b/app/containers/settings/categories/SupportSettingsPage.js @@ -6,9 +6,8 @@ import SupportSettings from '../../../components/settings/categories/SupportSett import { downloadLogs } from '../../../utils/logging'; import type { InjectedProps } from '../../../types/injectedPropsType'; -export default @inject('stores', 'actions') @observer -class SupportSettingsPage extends Component { +export default class SupportSettingsPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/settings/categories/TermsOfUseSettingsPage.js b/app/containers/settings/categories/TermsOfUseSettingsPage.js index 7f1274eba7..43da10cc2a 100644 --- a/app/containers/settings/categories/TermsOfUseSettingsPage.js +++ b/app/containers/settings/categories/TermsOfUseSettingsPage.js @@ -4,9 +4,8 @@ import { observer, inject } from 'mobx-react'; import TermsOfUseSettings from '../../../components/settings/categories/TermsOfUseSettings'; import type { InjectedProps } from '../../../types/injectedPropsType'; -export default @inject('stores') @observer -class TermsOfUseSettingsPage extends Component { +export default class TermsOfUseSettingsPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/settings/categories/WalletSettingsPage.js b/app/containers/settings/categories/WalletSettingsPage.js index c620dc5030..2abff6b885 100644 --- a/app/containers/settings/categories/WalletSettingsPage.js +++ b/app/containers/settings/categories/WalletSettingsPage.js @@ -7,9 +7,8 @@ import { isValidWalletName } from '../../../utils/validations'; type Props = InjectedProps -export default @inject('stores', 'actions') @observer -class WalletSettingsPage extends Component { +export default class WalletSettingsPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/NoWalletsPage.js b/app/containers/wallet/NoWalletsPage.js index c114f4c173..d4fd1c7120 100644 --- a/app/containers/wallet/NoWalletsPage.js +++ b/app/containers/wallet/NoWalletsPage.js @@ -5,9 +5,8 @@ import resolver from '../../utils/imports'; const Layout = resolver('containers/MainLayout'); -export default @inject('stores', 'actions') @observer -class NoWalletsPage extends Component { +export default class NoWalletsPage extends Component { render() { return ( diff --git a/app/containers/wallet/Wallet.js b/app/containers/wallet/Wallet.js index 3327498c9e..b5f53daedf 100644 --- a/app/containers/wallet/Wallet.js +++ b/app/containers/wallet/Wallet.js @@ -10,9 +10,8 @@ import type { InjectedContainerProps } from '../../types/injectedPropsType'; type Props = InjectedContainerProps; -export default @inject('stores', 'actions') @observer -class Wallet extends Component { +export default class Wallet extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/WalletAddPage.js b/app/containers/wallet/WalletAddPage.js index c402ee9f85..4c9f3a8372 100644 --- a/app/containers/wallet/WalletAddPage.js +++ b/app/containers/wallet/WalletAddPage.js @@ -26,9 +26,8 @@ const messages = defineMessages({ }, }); -export default @inject('actions', 'stores') @observer -class WalletAddPage extends Component { +export default class WalletAddPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/WalletReceivePage.js b/app/containers/wallet/WalletReceivePage.js index 2c6b6cf51f..21d0ebf9bb 100644 --- a/app/containers/wallet/WalletReceivePage.js +++ b/app/containers/wallet/WalletReceivePage.js @@ -24,9 +24,8 @@ type State = { copiedAddress: string, }; -export default @inject('stores', 'actions') @observer -class WalletReceivePage extends Component { +export default class WalletReceivePage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/WalletSendPage.js b/app/containers/wallet/WalletSendPage.js index db93a81674..28a6e79153 100644 --- a/app/containers/wallet/WalletSendPage.js +++ b/app/containers/wallet/WalletSendPage.js @@ -9,9 +9,8 @@ import { DECIMAL_PLACES_IN_ADA, MAX_INTEGER_PLACES_IN_ADA } from '../../config/n type Props = InjectedProps; -export default @inject('stores', 'actions') @observer -class WalletSendPage extends Component { +export default class WalletSendPage extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/WalletSummaryPage.js b/app/containers/wallet/WalletSummaryPage.js index 1c4ff6f376..f856104e51 100644 --- a/app/containers/wallet/WalletSummaryPage.js +++ b/app/containers/wallet/WalletSummaryPage.js @@ -28,9 +28,8 @@ export const messages = defineMessages({ } }); -export default @inject('stores', 'actions') @observer -class WalletSummaryPage extends Component { +export default class WalletSummaryPage extends Component { static defaultProps = { actions: null, stores: null }; static contextTypes = { diff --git a/app/containers/wallet/dialogs/ChangeWalletPasswordDialogContainer.js b/app/containers/wallet/dialogs/ChangeWalletPasswordDialogContainer.js index 48c576acf8..115f57cf93 100644 --- a/app/containers/wallet/dialogs/ChangeWalletPasswordDialogContainer.js +++ b/app/containers/wallet/dialogs/ChangeWalletPasswordDialogContainer.js @@ -5,9 +5,8 @@ import ChangeWalletPasswordDialog from '../../../components/wallet/settings/Chan import type { InjectedProps } from '../../../types/injectedPropsType'; import environment from '../../../environment'; -export default @inject('actions', 'stores') @observer -class ChangeWalletPasswordDialogContainer extends Component { +export default class ChangeWalletPasswordDialogContainer extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/containers/wallet/dialogs/WalletBackupDialogContainer.js b/app/containers/wallet/dialogs/WalletBackupDialogContainer.js index 39e5288988..22356e3f83 100644 --- a/app/containers/wallet/dialogs/WalletBackupDialogContainer.js +++ b/app/containers/wallet/dialogs/WalletBackupDialogContainer.js @@ -7,9 +7,8 @@ import environment from '../../../environment'; type Props = InjectedDialogContainerProps; -export default @inject('stores', 'actions') @observer -class WalletBackupDialogContainer extends Component { +export default class WalletBackupDialogContainer extends Component { static defaultProps = { actions: null, stores: null, children: null, onClose: () => {} }; diff --git a/app/containers/wallet/dialogs/WalletCreateDialogContainer.js b/app/containers/wallet/dialogs/WalletCreateDialogContainer.js index c169f370b1..38f90cef8d 100644 --- a/app/containers/wallet/dialogs/WalletCreateDialogContainer.js +++ b/app/containers/wallet/dialogs/WalletCreateDialogContainer.js @@ -7,9 +7,8 @@ import environment from '../../../environment'; type Props = InjectedDialogContainerProps; -export default @inject('stores', 'actions') @observer -class WalletCreateDialogContainer extends Component { +export default class WalletCreateDialogContainer extends Component { static defaultProps = { actions: null, stores: null, children: null, onClose: () => {} }; diff --git a/app/containers/wallet/dialogs/WalletRestoreDialogContainer.js b/app/containers/wallet/dialogs/WalletRestoreDialogContainer.js index fcfd748ea0..b44a4ed748 100644 --- a/app/containers/wallet/dialogs/WalletRestoreDialogContainer.js +++ b/app/containers/wallet/dialogs/WalletRestoreDialogContainer.js @@ -8,9 +8,8 @@ import environment from '../../../environment'; type Props = InjectedDialogContainerProps; -export default @inject('stores', 'actions') @observer -class WalletRestoreDialogContainer extends Component { +export default class WalletRestoreDialogContainer extends Component { static defaultProps = { actions: null, stores: null, children: null, onClose: () => {} }; diff --git a/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js b/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js index cd5e85c841..7b8cbc30d0 100644 --- a/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js +++ b/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js @@ -19,9 +19,8 @@ type Props = { currencyUnit: string, }; -export default @inject('actions', 'stores') @observer -class WalletSendConfirmationDialogContainer extends Component { +export default class WalletSendConfirmationDialogContainer extends Component { static defaultProps = { actions: null, stores: null }; diff --git a/app/stores/WalletBackupStore.js b/app/stores/WalletBackupStore.js index 3fc7173474..db202fe476 100644 --- a/app/stores/WalletBackupStore.js +++ b/app/stores/WalletBackupStore.js @@ -6,14 +6,17 @@ import WalletBackupDialog from '../components/wallet/WalletBackupDialog'; export type walletBackupSteps = 'privacyWarning' | 'recoveryPhraseDisplay' | 'recoveryPhraseEntry' | null; +type RecoveryPhraseWordArray = Array<{ word: string }>; +type RecoveryPhraseShuffledArray = Array<{ word: string, isActive: boolean }>; + export default class WalletBackupStore extends Store { @observable inProgress = false; @observable currentStep: walletBackupSteps = null; @observable recoveryPhrase = []; - @observable recoveryPhraseWords = []; - @observable recoveryPhraseShuffled = []; + @observable recoveryPhraseWords: RecoveryPhraseWordArray = []; + @observable recoveryPhraseShuffled: RecoveryPhraseShuffledArray = []; @observable completed = false; @observable enteredPhrase = []; @observable isPrivacyNoticeAccepted = false; diff --git a/app/stores/lib/LocalizedCachedRequest.js b/app/stores/lib/LocalizedCachedRequest.js index f411071aa9..76809ca198 100644 --- a/app/stores/lib/LocalizedCachedRequest.js +++ b/app/stores/lib/LocalizedCachedRequest.js @@ -1,5 +1,9 @@ import CachedRequest from './CachedRequest'; import LocalizableError from '../../i18n/LocalizableError'; +/* +* We want all errors in our program to be localizable +* So we partially apply the LocalizableError to the CachedRequest template +*/ // eslint-disable-next-line export default class LocalizedCachedRequest extends CachedRequest {} diff --git a/app/stores/lib/Request.js b/app/stores/lib/Request.js index 71986bf24e..0b8b757877 100644 --- a/app/stores/lib/Request.js +++ b/app/stores/lib/Request.js @@ -1,7 +1,6 @@ // @flow import { observable, action, computed, isObservableArray } from 'mobx'; import { isEqual } from 'lodash/fp'; -import ExtendableError from 'es6-error'; import { defineMessages } from 'react-intl'; import LocalizableError from '../../i18n/LocalizableError'; @@ -23,7 +22,7 @@ export type ApiCallType = { result: any, }; -// Note: Do not use this class directly. Only use LocalizedRequest. +// Note: Do not use this class directly. Only use LocalizedRequest or CachedLocalizedRequest export default class Request { @observable result: ?Result = null; diff --git a/app/themes/README.md b/app/themes/README.md index aa385579f9..d2c1e23895 100644 --- a/app/themes/README.md +++ b/app/themes/README.md @@ -4,7 +4,7 @@ This folder serves three independent theme (css) related concepts ## 1) Overriding the default theme -Yoroi uses [React-Polymorph](https://github.com/input-output-hk/react-polymorph/) to separtae the theming (style/css) of a component from its UI logic and its skin (markup). +Yoroi uses [React-Polymorph](https://github.com/input-output-hk/react-polymorph/) to separate the theming (style/css) of a component from its UI logic and its skin (markup). React-Polymorph comes with a default theme for each component (called the `simple` theme) but we want to allow ourselves to easily extend/modify it as needed. To do this, we : diff --git a/app/utils/passwordCipher.js b/app/utils/passwordCipher.js index 1bef254fa7..f71c529d15 100644 --- a/app/utils/passwordCipher.js +++ b/app/utils/passwordCipher.js @@ -2,8 +2,7 @@ import { PasswordProtect } from 'rust-cardano-crypto'; import cryptoRandomString from 'crypto-random-string'; -import { getOrFail } from '../api/ada/lib/cardanoCrypto/cryptoUtils'; -import { WrongPassphraseError } from '../api/ada/lib/cardanoCrypto/cryptoErrors'; +import { WrongPassphraseError, CardanoCryptoError } from '../api/ada/lib/cardanoCrypto/cryptoErrors'; export function encryptWithPassword( password: string, @@ -12,9 +11,10 @@ export function encryptWithPassword( const salt = Buffer.from(cryptoRandomString(2 * 32), 'hex'); const nonce = Buffer.from(cryptoRandomString(2 * 12), 'hex'); const formattedPassword: Uint8Array = new TextEncoder().encode(password); - const encryptedBytes = getOrFail( - PasswordProtect.encryptWithPassword(formattedPassword, salt, nonce, bytes) - ); + const encryptedBytes = PasswordProtect.encryptWithPassword(formattedPassword, salt, nonce, bytes); + if (!encryptedBytes) { + throw new CardanoCryptoError('Result not defined'); + } const encryptedHex = Buffer.from(encryptedBytes).toString('hex'); return encryptedHex; } diff --git a/package-lock.json b/package-lock.json index 6bb0b3766f..bff70c285e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5848,7 +5848,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -5861,9 +5861,9 @@ "dev": true }, "flow-bin": { - "version": "0.74.0", - "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.74.0.tgz", - "integrity": "sha512-tIN9J5qg71S4UbofCu80tve8a+p7Hj7ytwUtu79cLg9KJVVTNnVVJXKgCghVzaZT1Rvl9SMHVPlDs9uYhPHEGQ==", + "version": "0.83.0", + "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.83.0.tgz", + "integrity": "sha512-1K83EL/U9Gh0BaXPKkZe6TRizSmNSKx9Wuws1c8gh7DJEwiburtCxYT+4o7in1+GnNEm3CZWnbnVV8n9HMpiDA==", "dev": true }, "follow-redirects": { diff --git a/package.json b/package.json index 7f3bf7e624..6be93b6a43 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "eslint-plugin-promise": "4.0.1", "eslint-plugin-react": "7.11.1", "file-loader": "1.1.11", - "flow-bin": "0.74.0", + "flow-bin": "0.83.0", "html-loader": "0.4.5", "json-server": "0.13.0", "markdown-loader": "2.0.0", From c078f9bb14e3ecdc35bd21400e86ef796f4ab12e Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Wed, 7 Nov 2018 05:58:29 +0900 Subject: [PATCH 4/6] update translation file --- app/i18n/locales/en-US.json | 1 + app/i18n/locales/ja-JP.json | 1 + app/i18n/locales/ko-KR.json | 1 + app/i18n/locales/zh-Hans.json | 3 ++- app/i18n/locales/zh-Hant.json | 3 ++- 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/i18n/locales/en-US.json b/app/i18n/locales/en-US.json index a4f0229a14..96dd081e5c 100644 --- a/app/i18n/locales/en-US.json +++ b/app/i18n/locales/en-US.json @@ -3,6 +3,7 @@ "api.errors.GenericApiError": "An error occurred, please try again later.", "api.errors.IncorrectPasswordError": "Incorrect wallet password.", "api.errors.NotEnoughMoneyToSendError": "Not enough money to make this transaction.", + "api.errors.PromiseNotCalledYetError": "You have to call Request::execute before you can access it as promise.", "api.errors.RedeemAdaError": "Your ADA could not be redeemed correctly.", "api.errors.ReportRequestError": "There was a problem sending the support request.", "api.errors.WalletAlreadyImportedError": "Wallet you are trying to import already exists.", diff --git a/app/i18n/locales/ja-JP.json b/app/i18n/locales/ja-JP.json index 7b5418019b..a4c6a236ed 100644 --- a/app/i18n/locales/ja-JP.json +++ b/app/i18n/locales/ja-JP.json @@ -3,6 +3,7 @@ "api.errors.GenericApiError": "エラーが発生しました。後ほど再度お試しください。", "api.errors.IncorrectPasswordError": "ウォレットのパスワードが誤っています。", "api.errors.NotEnoughMoneyToSendError": "金額が不足しています。", + "api.errors.PromiseNotCalledYetError": "!!!You have to call Request::execute before you can access it as promise.", "api.errors.RedeemAdaError": "ADAの転送に失敗しました。", "api.errors.ReportRequestError": "サポート依頼の送信中にエラーが発生しました。", "api.errors.WalletAlreadyImportedError": "インポートしようとしたウォレットは既に存在しています。", diff --git a/app/i18n/locales/ko-KR.json b/app/i18n/locales/ko-KR.json index 03e167f090..f2447cdfc8 100644 --- a/app/i18n/locales/ko-KR.json +++ b/app/i18n/locales/ko-KR.json @@ -3,6 +3,7 @@ "api.errors.GenericApiError": "오류가 발생했습니다. 나중에 다시 시도하십시오.", "api.errors.IncorrectPasswordError": "지갑 암호가 틀렸습니다.", "api.errors.NotEnoughMoneyToSendError": "이 거래를 할 충분한 돈이 없습니다.", + "api.errors.PromiseNotCalledYetError": "!!!You have to call Request::execute before you can access it as promise.", "api.errors.RedeemAdaError": "ADA를 정확하게 신청할 수 없습니다.", "api.errors.ReportRequestError": "이 지원 요청을 전송하는 데 문제가 있습니다.", "api.errors.WalletAlreadyImportedError": "가져오려는 지갑이 이미 있습니다.", diff --git a/app/i18n/locales/zh-Hans.json b/app/i18n/locales/zh-Hans.json index 9b63fa83ee..eac8e4017d 100644 --- a/app/i18n/locales/zh-Hans.json +++ b/app/i18n/locales/zh-Hans.json @@ -3,6 +3,7 @@ "api.errors.GenericApiError": "发生错误,请稍后重试。", "api.errors.IncorrectPasswordError": "钱包密码不正确。", "api.errors.NotEnoughMoneyToSendError": "没有足够的资金进行此交易。", + "api.errors.PromiseNotCalledYetError": "!!!You have to call Request::execute before you can access it as promise.", "api.errors.RedeemAdaError": "您的 ADA 无法正确赎回。", "api.errors.ReportRequestError": "发送支援请求时出现问题。", "api.errors.WalletAlreadyImportedError": "您要导入的钱包已存在。", @@ -225,4 +226,4 @@ "wallet.transaction.type": "{currency} 交易", "wallet.transaction.type.card": "卡支付", "wallet.transaction.type.exchange": "交易所" -} +} \ No newline at end of file diff --git a/app/i18n/locales/zh-Hant.json b/app/i18n/locales/zh-Hant.json index a7c81f8c58..ca9d0c14a0 100644 --- a/app/i18n/locales/zh-Hant.json +++ b/app/i18n/locales/zh-Hant.json @@ -3,6 +3,7 @@ "api.errors.GenericApiError": "已發生錯誤,請稍候再試一次。", "api.errors.IncorrectPasswordError": "錢包密碼不正確。", "api.errors.NotEnoughMoneyToSendError": "達成交易所需的資金不足。", + "api.errors.PromiseNotCalledYetError": "!!!You have to call Request::execute before you can access it as promise.", "api.errors.RedeemAdaError": "您的 ADA 無法正確兌換。", "api.errors.ReportRequestError": "傳送支援要求時出現問題。", "api.errors.WalletAlreadyImportedError": "您嘗試匯入的錢包已存在。", @@ -225,4 +226,4 @@ "wallet.transaction.type": "{currency} 交易", "wallet.transaction.type.card": "卡支付", "wallet.transaction.type.exchange": "兌換" -} +} \ No newline at end of file From df4b50c21bfa4b6289e6be597608b8caa64bf422 Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Wed, 7 Nov 2018 06:01:32 +0900 Subject: [PATCH 5/6] undo change to wasm directory --- js-cardano-wasm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js-cardano-wasm b/js-cardano-wasm index e099e7e666..d7ac1e8add 160000 --- a/js-cardano-wasm +++ b/js-cardano-wasm @@ -1 +1 @@ -Subproject commit e099e7e666805b5efb4eac14103b5dafdb1b73de +Subproject commit d7ac1e8add9fe7d58e2f244722ca9dfcafa8000a From d0c26b96b2fcd68e3e66f8f55e1ad606c41fea51 Mon Sep 17 00:00:00 2001 From: sebastiengllmt Date: Wed, 7 Nov 2018 06:43:35 +0900 Subject: [PATCH 6/6] fix typo during cleanup --- app/stores/LoadingStore.js | 6 +++--- app/stores/UiNotificationsStore.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/stores/LoadingStore.js b/app/stores/LoadingStore.js index 934ed04466..40ad0ee80c 100644 --- a/app/stores/LoadingStore.js +++ b/app/stores/LoadingStore.js @@ -41,9 +41,9 @@ export default class LoadingStore extends Store { _isRefresh = () => this.isLoading; - _redirectToLoading = () => { - this.actions.router.goToRoute.trigger({ route: ROUTES.ROOT }); - } + _redirectToLoading = () => ( + this.actions.router.goToRoute.trigger({ route: ROUTES.ROOT }) + ); _checkingIfWalletsLoaded = async () => { const { app } = this.stores; diff --git a/app/stores/UiNotificationsStore.js b/app/stores/UiNotificationsStore.js index d9e007b6ac..a01c1dd730 100644 --- a/app/stores/UiNotificationsStore.js +++ b/app/stores/UiNotificationsStore.js @@ -14,9 +14,9 @@ export default class UiNotificationsStore extends Store { isOpen = (id: string): boolean => !!this._findNotificationById(id); - _findNotificationById = (id: string): ?Notification => { - this.activeNotifications.find(notification => notification.id === id); - }; + _findNotificationById = (id: string): ?Notification => ( + this.activeNotifications.find(notification => notification.id === id) + ); @action _onOpen = ({ id, duration } : { id: string, duration?: number }) => { const notification = {