From eeb7f8562bf04998b85893fadc21669929a73f83 Mon Sep 17 00:00:00 2001 From: james-prado Date: Mon, 16 Jul 2018 17:13:21 +0100 Subject: [PATCH] merge --- .travis.yml | 28 +- README.md | 49 +- common/Root.tsx | 73 +- common/actions/addressBook/actionCreators.ts | 68 -- common/actions/addressBook/constants.ts | 9 - common/actions/addressBook/index.ts | 3 - common/actions/config/actionCreators.ts | 153 --- common/actions/config/actionTypes.ts | 127 -- common/actions/config/constants.ts | 26 - common/actions/config/index.ts | 3 - common/actions/customTokens/actionCreators.ts | 20 - common/actions/customTokens/constants.ts | 4 - common/actions/customTokens/index.ts | 3 - .../deterministicWallets/actionCreators.ts | 43 - .../actions/deterministicWallets/constants.ts | 6 - common/actions/deterministicWallets/index.ts | 2 - common/actions/ens/actionCreators/index.ts | 1 - .../ens/actionCreators/resolveDomain.ts | 35 - common/actions/ens/actionTypes/actionTypes.ts | 4 - common/actions/ens/actionTypes/index.ts | 1 - .../actions/ens/actionTypes/resolveDomain.ts | 28 - common/actions/ens/constants.ts | 6 - common/actions/ens/index.ts | 3 - common/actions/gas/actionCreators.ts | 19 - common/actions/gas/actionTypes.ts | 14 - common/actions/gas/constants.ts | 4 - common/actions/gas/index.ts | 3 - common/actions/message/actionCreators.ts | 28 - common/actions/message/constants.ts | 5 - common/actions/message/index.ts | 3 - .../actions/notifications/actionCreators.ts | 28 - common/actions/notifications/actionTypes.ts | 26 - common/actions/notifications/constants.ts | 4 - common/actions/notifications/index.ts | 2 - .../actions/onboardStatus/actionCreators.ts | 31 - common/actions/onboardStatus/actionTypes.ts | 24 - common/actions/onboardStatus/constants.ts | 6 - common/actions/onboardStatus/index.ts | 2 - common/actions/paritySigner/actionTypes.ts | 30 - common/actions/paritySigner/constants.ts | 5 - common/actions/paritySigner/index.ts | 3 - common/actions/rates/actionCreators.ts | 26 - common/actions/rates/actionTypes.ts | 20 - common/actions/rates/constants.ts | 5 - common/actions/rates/index.ts | 2 - .../actions/schedule/actionCreators/fields.ts | 117 -- .../actions/schedule/actionCreators/index.ts | 7 - .../actionCreators/scheduleTimestamp.ts | 21 - .../schedule/actionCreators/scheduleType.ts | 10 - .../actionCreators/schedulingToggle.ts | 12 - .../schedule/actionCreators/timeBounty.ts | 12 - .../schedule/actionCreators/windowSize.ts | 12 - .../schedule/actionCreators/windowStart.ts | 12 - .../schedule/actionTypes/actionTypes.ts | 5 - common/actions/schedule/actionTypes/fields.ts | 116 -- common/actions/schedule/actionTypes/index.ts | 1 - .../schedule/actionTypes/scheduleTimestamp.ts | 17 - .../schedule/actionTypes/scheduleType.ts | 12 - .../schedule/actionTypes/schedulingToggle.ts | 12 - .../schedule/actionTypes/timeBounty.ts | 12 - .../schedule/actionTypes/windowSize.ts | 12 - .../schedule/actionTypes/windowStart.ts | 12 - common/actions/schedule/constants.ts | 21 - common/actions/schedule/index.ts | 3 - common/actions/swap/actionCreators.ts | 269 ----- common/actions/swap/actionTypes.ts | 272 ----- common/actions/swap/constants.ts | 34 - common/actions/swap/index.ts | 2 - .../transaction/actionCreators/broadcast.ts | 55 - .../transaction/actionCreators/current.ts | 16 - .../transaction/actionCreators/fields.ts | 124 -- .../transaction/actionCreators/index.ts | 7 - .../transaction/actionCreators/meta.ts | 36 - .../transaction/actionCreators/network.ts | 90 -- .../actionCreators/sendEverything.ts | 30 - .../transaction/actionCreators/sign.ts | 45 - .../transaction/actionCreators/swap.ts | 33 - .../transaction/actionTypes/actionTypes.ts | 40 - .../transaction/actionTypes/broadcast.ts | 35 - .../transaction/actionTypes/current.ts | 17 - .../actions/transaction/actionTypes/fields.ts | 102 -- .../actions/transaction/actionTypes/index.ts | 1 - .../actions/transaction/actionTypes/meta.ts | 48 - .../transaction/actionTypes/network.ts | 62 - .../transaction/actionTypes/sendEverything.ts | 23 - .../actions/transaction/actionTypes/sign.ts | 40 - .../actions/transaction/actionTypes/swap.ts | 40 - common/actions/transaction/constants.ts | 59 - common/actions/transaction/index.ts | 3 - common/actions/transactions/actionCreators.ts | 35 - common/actions/transactions/actionTypes.ts | 33 - common/actions/transactions/constants.ts | 7 - common/actions/transactions/index.ts | 3 - common/actions/wallet/actionTypes.ts | 156 --- common/actions/wallet/constants.ts | 25 - common/actions/wallet/index.ts | 3 - common/api/gas.ts | 3 +- common/api/rates.ts | 1 + common/api/shapeshift.spec.ts | 125 ++ common/api/shapeshift.ts | 109 +- common/assets/images/icon-theme-dark.svg | 10 + common/assets/images/icon-theme-light.svg | 6 + common/assets/images/wallets/file.svg | 3 + common/assets/images/wallets/hardware.svg | 12 + .../assets/images/wallets/parity-signer.svg | 152 +-- common/badBrowserCheckA.js | 9 + common/badBrowserCheckB.js | 33 + common/components/AddressBookTable.scss | 4 +- common/components/AddressBookTable.tsx | 62 +- common/components/AddressBookTableRow.tsx | 3 +- common/components/AddressField.tsx | 24 +- .../AddressFieldDropdown.scss | 8 +- .../AddressFieldDropdown.tsx | 20 +- .../AddressFieldFactory.tsx | 15 +- .../AddressInputFactory.scss | 2 +- .../AddressInputFactory.tsx | 39 +- common/components/AmountField.tsx | 10 +- .../AmountFieldFactory/AmountFieldFactory.tsx | 13 +- .../AmountFieldFactory/AmountInputFactory.tsx | 8 +- .../AppAlphaNotice/AlphaNotice.scss | 53 - .../components/AppAlphaNotice/AlphaNotice.tsx | 72 -- .../components/AppAlphaNotice/AppExpired.scss | 44 - .../components/AppAlphaNotice/AppExpired.tsx | 25 - common/components/AppAlphaNotice/index.tsx | 14 - .../BalanceSidebar/AccountAddress.tsx | 69 +- .../BalanceSidebar/AccountInfo.scss | 31 +- .../components/BalanceSidebar/AccountInfo.tsx | 43 +- .../BalanceSidebar/EquivalentValues.scss | 4 +- .../BalanceSidebar/EquivalentValues.tsx | 40 +- .../PromoComponents/Coinbase.tsx | 1 + .../PromoComponents/HardwareWallets.tsx | 1 + .../PromoComponents/Shapeshift.tsx | 1 + common/components/BalanceSidebar/Promos.scss | 8 +- common/components/BalanceSidebar/Promos.tsx | 17 +- .../TokenBalances/AddCustomTokenForm.tsx | 166 --- .../AddCustomTokenForm.scss | 2 +- .../AddCustomTokenForm/AddCustomTokenForm.tsx | 120 ++ .../AddCustomTokenForm/AddressField.tsx | 59 + .../AddCustomTokenForm/BalanceField.tsx | 124 ++ .../AddCustomTokenForm/DecimalField.tsx | 34 + .../AddCustomTokenForm/FieldInput.tsx | 134 +++ .../AddCustomTokenForm/SymbolField.tsx | 40 + .../TokenBalances/AddCustomTokenForm/index.ts | 1 + .../BalanceSidebar/TokenBalances/Balances.tsx | 13 +- .../TokenBalances/TokenRow.scss | 2 +- .../BalanceSidebar/TokenBalances/TokenRow.tsx | 23 +- .../BalanceSidebar/TokenBalances/index.scss | 4 +- .../BalanceSidebar/TokenBalances/index.tsx | 55 +- common/components/BalanceSidebar/index.tsx | 13 +- common/components/BetaAgreement/index.tsx | 74 ++ .../ConfirmationModal/ConfirmationModal.tsx | 8 +- .../components/Body/Body.scss | 6 +- .../components/Body/Body.tsx | 13 +- .../components/Body/components/Addresses.scss | 4 +- .../components/Body/components/Addresses.tsx | 34 +- .../components/Body/components/Amounts.scss | 10 +- .../components/Body/components/Amounts.tsx | 23 +- .../components/Body/components/Details.scss | 5 +- .../components/Body/components/Details.tsx | 21 +- .../components/Body/components/Node.tsx | 10 +- .../ConfirmationModalTemplate.scss | 2 +- .../ConfirmationModalTemplate.tsx | 36 +- common/components/CurrentCustomMessage.tsx | 16 +- .../CustomNodeModal/CustomNodeModal.tsx | 92 +- common/components/DataField.tsx | 5 +- .../DataFieldFactory/DataFieldFactory.tsx | 18 +- .../DataFieldFactory/DataInputFactory.tsx | 15 +- common/components/DisclaimerModal.scss | 2 +- common/components/DisclaimerModal.tsx | 7 +- .../components/ElectronNav/ElectronNav.scss | 43 +- common/components/ElectronNav/ElectronNav.tsx | 35 +- .../ElectronNav/LanguageSelect.scss | 10 +- .../components/ElectronNav/LanguageSelect.tsx | 6 +- .../components/ElectronNav/NetworkSelect.tsx | 3 +- .../components/ElectronNav/NetworkStatus.scss | 8 +- .../components/ElectronNav/NetworkStatus.tsx | 5 +- common/components/ElectronNav/index.tsx | 3 +- common/components/ErrorScreen/index.scss | 2 +- common/components/ErrorScreen/index.tsx | 1 + common/components/Errorable.tsx | 11 +- .../TransactionSucceeded.tsx | 5 +- common/components/Footer/PreFooter.scss | 2 +- common/components/Footer/PreFooter.tsx | 3 +- common/components/Footer/ThemeToggle.scss | 76 ++ common/components/Footer/ThemeToggle.tsx | 43 + common/components/Footer/index.scss | 15 +- common/components/Footer/index.tsx | 12 +- common/components/GasLimitField.tsx | 7 +- .../GasLimitFieldFactory.tsx | 17 +- .../GasLimitInputFactory.tsx | 13 +- .../GenerateKeystoreModal/index.tsx | 9 +- common/components/GenerateTransaction.tsx | 3 +- .../GenerateTransactionFactory/Container.tsx | 13 +- .../GenerateTransactionFactory.tsx | 47 +- .../Header/components/Navigation.scss | 26 +- .../Header/components/Navigation.tsx | 10 +- .../Header/components/NetworkDropdown.tsx | 5 +- .../Header/components/OnlineStatus.scss | 6 +- .../Header/components/OnlineStatus.tsx | 1 + .../components/Header/components/constants.ts | 10 + common/components/Header/index.scss | 20 +- common/components/Header/index.tsx | 100 +- common/components/LogOutPrompt.tsx | 15 +- common/components/NavigationLink.tsx | 19 +- .../NetworkSelector/NetworkOption.scss | 34 +- .../NetworkSelector/NetworkSelector.scss | 11 +- .../NetworkSelector/NetworkSelector.tsx | 15 +- .../NetworkSelector/NodeOption.scss | 23 +- .../components/NetworkSelector/NodeOption.tsx | 2 +- common/components/NewAppReleaseModal.tsx | 3 +- common/components/NonceField.tsx | 35 +- .../NonceFieldFactory/NonceFieldFactory.tsx | 11 +- .../NonceFieldFactory/NonceInputFactory.tsx | 13 +- .../components/PageNotFound/PageNotFound.tsx | 3 +- common/components/PageNotFound/index.ts | 4 +- common/components/Palette/index.scss | 33 + common/components/Palette/index.tsx | 59 + common/components/PaperWallet/index.scss | 91 ++ common/components/PaperWallet/index.tsx | 144 +-- common/components/ParityQrSigner.scss | 4 +- common/components/ParityQrSigner.tsx | 3 +- common/components/PrintableWallet/index.tsx | 87 +- common/components/SendButton.tsx | 5 +- .../SendButtonFactory/OfflineBroadcast.tsx | 5 +- .../SendButtonFactory/OnlineSend.tsx | 42 +- .../SendButtonFactory/SendButtonFactory.tsx | 41 +- .../SendEverything/SendEverything.tsx | 13 +- common/components/SigningStatus.tsx | 10 +- common/components/SubTabs/SubTabs.scss | 16 +- common/components/SubTabs/index.tsx | 3 +- .../TXMetaDataPanel/TXMetaDataPanel.tsx | 64 +- .../components/AdvancedGas.tsx | 33 +- .../components/FeeSummary.scss | 2 +- .../TXMetaDataPanel/components/FeeSummary.tsx | 27 +- .../TXMetaDataPanel/components/SimpleGas.scss | 10 +- .../TXMetaDataPanel/components/SimpleGas.tsx | 55 +- common/components/TXMetaDataPanel/index.tsx | 3 +- common/components/TogglablePassword.scss | 4 +- common/components/TogglablePassword.tsx | 3 +- .../TransactionDataTable.scss | 8 +- .../TransactionDataTable.tsx | 3 +- .../TransactionStatus/TransactionStatus.scss | 2 +- .../TransactionStatus/TransactionStatus.tsx | 20 +- common/components/TransactionStatus/index.tsx | 3 +- common/components/Translate.tsx | 1 + .../components/UnitDropDown/UnitDropDown.tsx | 32 +- .../WalletDecrypt/WalletDecrypt.scss | 11 + .../WalletDecrypt/WalletDecrypt.tsx | 124 +- .../components/DeprecationWarning.tsx | 12 - .../components/DeterministicWalletsModal.scss | 2 + .../components/DeterministicWalletsModal.tsx | 51 +- .../components/InsecureWalletWarning.scss | 48 +- .../components/InsecureWalletWarning.tsx | 116 +- .../WalletDecrypt/components/Keystore.tsx | 9 +- .../WalletDecrypt/components/LedgerNano.scss | 113 +- .../WalletDecrypt/components/LedgerNano.tsx | 88 +- .../WalletDecrypt/components/Mnemonic.tsx | 17 +- .../WalletDecrypt/components/ParitySigner.tsx | 23 +- .../WalletDecrypt/components/PrivateKey.tsx | 7 +- .../WalletDecrypt/components/Trezor.tsx | 47 +- .../components/UnsupportedNetwork.tsx | 5 +- .../WalletDecrypt/components/ViewOnly.scss | 2 +- .../WalletDecrypt/components/ViewOnly.tsx | 20 +- .../components/WalletButton.scss | 25 +- .../WalletDecrypt/components/WalletButton.tsx | 4 +- .../WalletDecrypt/components/Web3.tsx | 1 + common/components/WalletDecrypt/index.tsx | 4 +- common/components/WelcomeModal.tsx | 2 +- common/components/index.ts | 4 +- .../components/renderCbs/FullWalletOnly.tsx | 3 +- common/components/renderCbs/GasQuery.tsx | 1 + common/components/renderCbs/OnlyUnlocked.tsx | 7 +- common/components/renderCbs/Query.tsx | 5 +- .../renderCbs/SerializedTransaction.ts | 7 +- common/components/renderCbs/TokenQuery.tsx | 18 +- common/components/renderCbs/UnitConverter.tsx | 9 +- .../components/renderCbs/WhenQueryExists.tsx | 1 + common/components/ui/Address.tsx | 48 +- common/components/ui/CodeBlock.scss | 6 +- common/components/ui/CodeBlock.tsx | 1 + common/components/ui/ColorDropdown.tsx | 128 ++ common/components/ui/Dropdown.tsx | 6 +- common/components/ui/Help.tsx | 1 + common/components/ui/HelpLink.tsx | 3 +- common/components/ui/Identicon.scss | 23 + common/components/ui/Identicon.tsx | 54 +- common/components/ui/InlineSpinner.scss | 2 +- common/components/ui/InlineSpinner.tsx | 1 + common/components/ui/Input.scss | 39 +- common/components/ui/Input.tsx | 35 +- common/components/ui/Modal/ModalBody.tsx | 10 +- common/components/ui/Modal/index.scss | 8 +- common/components/ui/Modal/index.tsx | 26 +- common/components/ui/OfflineSymbol.tsx | 1 + common/components/ui/OldDropdown.tsx | 1 + common/components/ui/SimpleButton.tsx | 1 + common/components/ui/Spinner.scss | 4 +- common/components/ui/Spinner.tsx | 1 + common/components/ui/SwapDropdown.scss | 15 +- common/components/ui/SwapDropdown.tsx | 20 +- common/components/ui/TextArea.tsx | 1 + common/components/ui/Toggle.tsx | 1 + common/components/ui/Tooltip.scss | 12 +- common/components/ui/Tooltip.tsx | 1 + common/components/ui/UnitDisplay.tsx | 5 +- common/components/ui/UnlockHeader.tsx | 4 +- common/components/ui/Warning.scss | 35 + common/components/ui/Warning.tsx | 22 + common/components/ui/index.ts | 1 + common/config/bity.ts | 5 +- common/config/contracts/esn.json | 16 + common/config/contracts/index.ts | 4 +- common/config/contracts/rsk.json | 9 +- common/config/contracts/rsk_testnet.json | 8 + common/config/data.tsx | 26 +- common/config/dpaths.ts | 32 +- common/config/helpArticles.ts | 1 + common/config/languages.json | 2 +- common/config/tokens/esn.json | 14 + common/config/tokens/eth.json | 31 +- common/config/tokens/index.ts | 4 +- common/config/tokens/rsk.json | 2 +- common/config/tokens/rsk_testnet.json | 1 + .../components/BlockchainSlide.tsx | 3 +- .../OnboardModal/components/FinalSlide.tsx | 7 +- .../components/InterfaceSlide.tsx | 3 +- .../OnboardModal/components/NotABankSlide.tsx | 3 +- .../OnboardModal/components/OnboardSlide.scss | 2 +- .../OnboardModal/components/OnboardSlide.tsx | 1 + .../components/SecureSlideOne.tsx | 3 +- .../components/SecureSlideThree.tsx | 3 +- .../components/SecureSlideTwo.tsx | 3 +- .../OnboardModal/components/WelcomeSlide.scss | 27 - .../OnboardModal/components/WelcomeSlide.tsx | 26 +- .../components/WhyMyCryptoSlide.tsx | 3 +- .../OnboardModal/components/WhySlide.tsx | 3 +- common/containers/OnboardModal/index.tsx | 44 +- common/containers/QrSignerModal/index.tsx | 13 +- .../TabSection/ElectronTemplate.scss | 4 +- .../TabSection/ElectronTemplate.tsx | 10 +- .../containers/TabSection/NotificationRow.tsx | 37 +- .../containers/TabSection/Notifications.scss | 4 + .../containers/TabSection/Notifications.tsx | 15 +- common/containers/TabSection/OfflineTab.scss | 2 +- common/containers/TabSection/OfflineTab.tsx | 1 + common/containers/TabSection/WebTemplate.tsx | 9 +- common/containers/Tabs/BroadcastTx/index.tsx | 42 +- .../components/TxHashInput.scss | 2 +- .../components/TxHashInput.tsx | 23 +- .../Tabs/CheckTransaction/index.tsx | 17 +- .../Tabs/Contracts/components/Deploy.tsx | 25 +- .../components/AmountField.tsx | 2 +- .../InteractExplorer/components/Fields.tsx | 3 +- .../components/InteractExplorer/index.tsx | 85 +- .../components/InteractForm/index.tsx | 33 +- .../Contracts/components/Interact/index.tsx | 19 +- common/containers/Tabs/Contracts/index.tsx | 11 +- .../GeneralInfoPanel/GeneralInfoNode.tsx | 1 + .../ENS/components/GeneralInfoPanel/index.tsx | 5 +- .../Tabs/ENS/components/NameInput.tsx | 15 +- .../NameResolve/components/NameAuction.tsx | 9 +- .../NameResolve/components/NameForbidden.tsx | 3 +- .../components/NameNotYetAvailable.tsx | 1 + .../NameResolve/components/NameOpen.tsx | 7 +- .../NameResolve/components/NameOwned.tsx | 7 +- .../NameResolve/components/NameReveal.tsx | 11 +- .../Tabs/ENS/components/NameResolve/index.tsx | 7 +- common/containers/Tabs/ENS/index.tsx | 7 +- .../Tabs/GenerateWallet/GenerateWallet.tsx | 9 +- .../components/CryptoWarning.scss | 2 +- .../components/CryptoWarning.tsx | 4 +- .../GenerateWallet/components/FinalSteps.scss | 6 +- .../GenerateWallet/components/FinalSteps.tsx | 3 +- .../components/Keystore/DownloadWallet.tsx | 5 +- .../components/Keystore/EnterPassword.tsx | 6 +- .../components/Keystore/Keystore.tsx | 8 +- .../components/Keystore/PaperWallet.tsx | 13 +- .../components/Keystore/index.tsx | 3 +- .../components/Mnemonic/Mnemonic.tsx | 7 +- .../components/Mnemonic/Word.scss | 10 +- .../components/Mnemonic/Word.tsx | 3 +- .../components/Mnemonic/index.tsx | 3 +- .../GenerateWallet/components/Template.scss | 4 +- .../GenerateWallet/components/Template.tsx | 15 +- .../components/WalletTypes.scss | 203 +++- .../GenerateWallet/components/WalletTypes.tsx | 305 ++++- .../containers/Tabs/GenerateWallet/index.tsx | 3 +- .../Fields/ScheduleDepositField.tsx | 22 +- .../Fields/ScheduleGasLimitField.tsx | 22 +- .../Fields/ScheduleGasPriceField.tsx | 18 +- .../ScheduleTimestampField.tsx | 22 +- .../ScheduleTimezoneDropDown.tsx | 18 +- .../Fields/ScheduleType/ScheduleType.tsx | 14 +- .../SchedulingToggle/SchedulingToggle.tsx | 14 +- .../Fields/TimeBounty/TimeBountyField.tsx | 3 +- .../TimeBountyFieldFactory.tsx | 16 +- .../TimeBountyInputFactory.tsx | 17 +- .../Fields/WindowSize/WindowSizeField.tsx | 5 +- .../WindowSizeFieldFactory.tsx | 28 +- .../WindowSizeInputFactory.tsx | 27 +- .../Fields/WindowStart/WindowStartField.tsx | 1 + .../WindowStartFieldFactory.tsx | 18 +- .../WindowStartInputFactory.tsx | 22 +- .../GenerateScheduleTransactionButton.tsx | 1 + .../components/ScheduleFields.scss | 4 +- .../components/ScheduleFields.tsx | 25 +- .../components/ScheduleTransactionFactory.tsx | 33 +- .../SendScheduleTransactionButton.tsx | 11 +- .../SendScheduleTransactionButtonFactory.tsx | 33 +- .../components/AddressBook.tsx | 1 + .../SendTransaction/components/Donate.tsx | 3 +- .../components/Fields/ETHFields.tsx | 58 +- .../components/Fields/XMRFields.tsx | 15 +- .../components/NonStandardTransaction.tsx | 7 +- .../components/RecentTransaction.scss | 13 +- .../components/RecentTransaction.tsx | 5 +- .../components/RecentTransactions.scss | 4 +- .../components/RecentTransactions.tsx | 15 +- .../components/RequestPayment.tsx | 63 +- .../SendTransaction/components/SideBar.tsx | 1 + .../components/UnavailableWallets.tsx | 7 +- .../components/WalletInfo.scss | 4 +- .../SendTransaction/components/WalletInfo.tsx | 68 +- .../containers/Tabs/SendTransaction/index.tsx | 29 +- .../components/SignMessage/SignButton.tsx | 5 +- .../components/SignMessage/index.tsx | 24 +- .../components/VerifyMessage/index.tsx | 15 +- .../Tabs/SignAndVerifyMessage/index.tsx | 9 +- common/containers/Tabs/SupportPage/index.scss | 25 +- common/containers/Tabs/SupportPage/index.tsx | 8 +- .../Tabs/Swap/components/BitcoinQR.scss | 17 +- .../Tabs/Swap/components/BitcoinQR.tsx | 9 +- .../Tabs/Swap/components/CurrencySwap.scss | 2 +- .../Tabs/Swap/components/CurrencySwap.tsx | 16 +- .../Tabs/Swap/components/CurrentRates.scss | 13 +- .../Tabs/Swap/components/CurrentRates.tsx | 29 +- .../Tabs/Swap/components/LiteSend/Fields.tsx | 25 +- .../Swap/components/LiteSend/LiteSend.tsx | 17 +- .../Tabs/Swap/components/PartThree.tsx | 29 +- .../Tabs/Swap/components/PaymentInfo.scss | 40 +- .../Tabs/Swap/components/PaymentInfo.tsx | 44 +- .../containers/Tabs/Swap/components/Rates.tsx | 13 +- .../Tabs/Swap/components/ReceivingAddress.tsx | 48 +- .../Tabs/Swap/components/SupportFooter.scss | 25 +- .../Tabs/Swap/components/SupportFooter.tsx | 18 +- .../Tabs/Swap/components/SwapInfoHeader.scss | 8 +- .../Tabs/Swap/components/SwapInfoHeader.tsx | 8 +- .../Swap/components/SwapInfoHeaderTitle.tsx | 9 +- .../Tabs/Swap/components/SwapProgress.scss | 45 +- .../Tabs/Swap/components/SwapProgress.tsx | 30 +- common/containers/Tabs/Swap/index.tsx | 146 +-- common/containers/Tabs/ViewWallet/index.tsx | 1 + common/containers/index.ts | 3 +- .../features/addressBook/actions.spec.ts | 40 +- common/features/addressBook/actions.ts | 65 + common/features/addressBook/constants.ts | 2 + common/features/addressBook/index.ts | 15 + .../features/addressBook/reducer.spec.ts | 32 +- common/features/addressBook/reducer.ts | 82 ++ .../features/addressBook/sagas.spec.ts | 99 +- common/features/addressBook/sagas.ts | 190 +++ .../features/addressBook/selectors.spec.ts | 45 +- .../addressBook/selectors.ts} | 26 +- .../addressBook/types.ts} | 36 +- .../config/__snapshots__/sagas.spec.ts.snap | 6 +- common/features/config/actions.ts | 8 + common/features/config/index.ts | 9 + .../features/config/meta/actions.spec.ts | 5 +- common/features/config/meta/actions.ts | 53 + common/features/config/meta/index.ts | 4 + common/features/config/meta/reducer.spec.ts | 82 ++ common/features/config/meta/reducer.ts | 83 ++ .../config/meta/selectors.ts} | 15 +- common/features/config/meta/types.ts | 54 + common/features/config/networks/actions.ts | 11 + .../config/networks/custom/actions.ts | 21 + .../features/config/networks/custom/index.ts | 4 + .../config/networks/custom/reducer.spec.ts | 16 +- .../config/networks/custom/reducer.ts | 38 + .../config/networks/custom/selectors.ts | 5 + .../features/config/networks/custom/types.ts | 22 + common/features/config/networks/index.ts | 7 + common/features/config/networks/reducer.ts | 10 + common/features/config/networks/selectors.ts | 26 + .../config/networks/static/actions.ts | 1 + .../features/config/networks/static/index.ts | 3 + .../config/networks/static/reducer.spec.ts | 8 +- .../config/networks/static/reducer.ts} | 147 ++- .../config/networks/static/selectors.ts | 34 + .../features/config/networks/static/types.ts | 5 + common/features/config/networks/types.ts | 16 + .../features/config/nodes/custom/actions.ts | 19 + common/features/config/nodes/custom/index.ts | 4 + .../config/nodes/custom/reducer.spec.ts | 20 +- .../features/config/nodes/custom/reducer.ts | 38 + .../features/config/nodes/custom/selectors.ts | 26 + common/features/config/nodes/custom/types.ts | 22 + common/features/config/nodes/index.ts | 7 + common/features/config/nodes/reducer.ts | 12 + .../features/config/nodes/selected/actions.ts | 49 + .../features/config/nodes/selected/index.ts | 4 + .../config/nodes/selected/reducer.spec.ts | 13 +- .../config/nodes/selected/reducer.ts} | 29 +- .../config/nodes/selected/selectors.ts | 21 + .../features/config/nodes/selected/types.ts | 55 + common/features/config/nodes/selectors.ts | 42 + .../features/config/nodes/static/actions.ts | 15 + .../features/config/nodes/static/helpers.ts | 31 + common/features/config/nodes/static/index.ts | 4 + .../config/nodes/static/reducer.spec.ts | 19 +- .../features/config/nodes/static/reducer.ts | 25 + .../features/config/nodes/static/selectors.ts | 25 + common/features/config/nodes/static/types.ts | 19 + common/features/config/nodes/types.ts | 9 + common/features/config/reducer.ts | 12 + .../features/config/sagas.spec.ts | 261 ++-- common/features/config/sagas.ts | 386 ++++++ common/features/config/selectors.ts | 291 +++++ common/features/config/types.ts | 31 + common/{store => features}/configAndTokens.ts | 35 +- .../store.ts => features/configureStore.ts} | 47 +- common/features/customTokens/actions.ts | 19 + common/features/customTokens/index.ts | 6 + common/features/customTokens/reducer.spec.ts | 31 + common/features/customTokens/reducer.ts | 34 + .../customTokens/selectors.ts} | 2 +- .../customTokens/types.ts} | 14 +- .../__snapshots__/sagas.spec.ts.snap | 12 +- .../features/deterministicWallets/actions.ts | 43 + common/features/deterministicWallets/index.ts | 13 + .../deterministicWallets/reducer.spec.ts | 31 +- .../features/deterministicWallets/reducer.ts | 50 + .../deterministicWallets/sagas.spec.ts | 78 +- .../deterministicWallets/sagas.ts} | 63 +- .../deterministicWallets/selectors.ts | 15 + .../deterministicWallets/types.ts} | 20 +- common/features/ens/actions.ts | 30 + common/features/ens/domainRequests/index.ts | 5 + common/features/ens/domainRequests/reducer.ts | 75 ++ .../features/ens/domainRequests/selectors.ts | 5 + common/features/ens/domainRequests/types.ts | 16 + common/features/ens/domainSelector/index.ts | 5 + common/features/ens/domainSelector/reducer.ts | 37 + .../features/ens/domainSelector/selectors.ts | 5 + common/features/ens/domainSelector/types.ts | 3 + .../modeMap.ts => features/ens/helpers.ts} | 31 +- common/features/ens/index.ts | 9 + .../features/ens/reducer.spec.ts | 11 +- common/features/ens/reducer.ts | 10 + common/features/ens/sagas.ts | 73 ++ .../ens.ts => features/ens/selectors.ts} | 27 +- common/features/ens/types.ts | 43 + common/features/gas/actions.ts | 18 + common/features/gas/index.ts | 6 + .../features/gas/reducer.spec.ts | 12 +- common/features/gas/reducer.ts | 38 + .../features/gas/sagas.spec.ts | 50 +- .../{sagas/gas.ts => features/gas/sagas.ts} | 29 +- .../gas.ts => features/gas/selectors.ts} | 3 +- common/features/gas/types.ts | 23 + common/features/handleMetaMaskPolling.spec.ts | 108 ++ common/features/handleMetaMaskPolling.ts | 57 + .../transaction => features}/helpers.ts | 14 +- common/features/index.ts | 1 + common/features/message/actions.ts | 27 + common/features/message/index.ts | 5 + common/features/message/reducer.ts | 36 + common/features/message/sagas.ts | 118 ++ .../message/types.ts} | 18 +- common/features/notifications/actions.ts | 49 + common/features/notifications/index.ts | 5 + common/features/notifications/reducer.spec.ts | 25 + common/features/notifications/reducer.ts | 33 + .../features/notifications/sagas.spec.ts | 20 +- common/features/notifications/sagas.ts | 21 + common/features/notifications/types.ts | 39 + .../features/onboardStatus/actions.spec.ts | 10 +- common/features/onboardStatus/actions.ts | 30 + common/features/onboardStatus/index.ts | 5 + common/features/onboardStatus/reducer.spec.ts | 11 + .../onboardStatus/reducer.ts} | 23 +- common/features/onboardStatus/types.ts | 34 + .../paritySigner/actions.ts} | 9 +- common/features/paritySigner/index.ts | 5 + common/features/paritySigner/reducer.ts | 48 + common/features/paritySigner/types.ts | 43 + common/features/rates/actions.ts | 25 + common/features/rates/index.ts | 6 + .../features/rates/reducer.spec.ts | 14 +- common/features/rates/reducer.ts | 41 + .../features/rates/sagas.spec.ts | 14 +- common/features/rates/sagas.ts | 21 + common/features/rates/selectors.ts | 3 + common/features/rates/types.ts | 29 + common/features/reducers.ts | 77 ++ common/features/rehydrateAddressBook.ts | 48 + common/features/sagas.ts | 35 + common/features/schedule/actions.ts | 159 +++ .../schedule/helpers.ts | 39 +- common/features/schedule/index.ts | 7 + .../schedule/reducer.ts} | 53 +- common/features/schedule/sagas.ts | 210 ++++ common/features/schedule/selectors.ts | 149 +++ common/features/schedule/types.ts | 198 +++ common/features/selectors.ts | 660 ++++++++++ common/features/store.ts | 99 ++ common/features/swap/actions.ts | 266 ++++ common/features/swap/index.ts | 6 + .../features/swap/reducer.spec.ts | 182 +-- .../index.ts => features/swap/reducer.ts} | 131 +- common/features/swap/sagas.spec.ts | 837 +++++++++++++ common/features/swap/sagas.ts | 565 +++++++++ .../swap.ts => features/swap/selectors.ts} | 4 +- common/features/swap/types.ts | 392 ++++++ .../features/testHelpers.ts | 2 +- common/features/transaction/actions.ts | 59 + .../features/transaction/broadcast/actions.ts | 35 + .../features/transaction/broadcast/index.ts | 13 + .../transaction/broadcast/reducer.ts} | 45 +- .../transaction/broadcast/sagas.spec.tsx | 296 +++++ .../features/transaction/broadcast/sagas.tsx | 144 +++ .../transaction/broadcast/selectors.ts | 9 + .../features/transaction/broadcast/types.ts | 57 + common/features/transaction/fields/actions.ts | 91 ++ common/features/transaction/fields/index.ts | 13 + common/features/transaction/fields/reducer.ts | 91 ++ .../features/transaction/fields/sagas.spec.ts | 189 +++ common/features/transaction/fields/sagas.ts | 62 + .../features/transaction/fields/selectors.ts | 11 + common/features/transaction/fields/types.ts | 107 ++ common/features/transaction/helpers.spec.tsx | 328 +++++ .../transaction/helpers.tsx} | 37 +- common/features/transaction/index.ts | 19 + common/features/transaction/meta/actions.ts | 35 + common/features/transaction/meta/index.ts | 13 + common/features/transaction/meta/reducer.ts | 108 ++ .../features/transaction/meta/sagas.spec.ts | 407 +++++++ common/features/transaction/meta/sagas.ts | 155 +++ common/features/transaction/meta/selectors.ts | 9 + common/features/transaction/meta/types.ts | 57 + .../features/transaction/network/actions.ts | 60 + common/features/transaction/network/index.ts | 13 + .../features/transaction/network/reducer.ts | 77 ++ .../transaction/network/sagas.spec.ts | 463 +++++++ common/features/transaction/network/sagas.ts | 245 ++++ .../features/transaction/network/selectors.ts | 28 + common/features/transaction/network/types.ts | 82 ++ common/features/transaction/reducer.spec.ts | 484 ++++++++ common/features/transaction/reducer.ts | 21 + common/features/transaction/sagas.spec.ts | 678 +++++++++++ common/features/transaction/sagas.ts | 307 +++++ common/features/transaction/selectors.spec.ts | 465 +++++++ common/features/transaction/selectors.ts | 58 + common/features/transaction/sign/actions.ts | 30 + common/features/transaction/sign/index.ts | 13 + common/features/transaction/sign/reducer.ts | 64 + .../features/transaction/sign/sagas.spec.ts | 156 +++ common/features/transaction/sign/sagas.ts | 198 +++ common/features/transaction/sign/selectors.ts | 7 + common/features/transaction/sign/types.ts | 57 + common/features/transaction/types.ts | 108 ++ common/features/transactions/actions.ts | 34 + common/features/transactions/index.ts | 6 + common/features/transactions/reducer.ts | 77 ++ .../transactions/sagas.ts} | 70 +- common/features/transactions/selectors.ts | 10 + common/features/transactions/types.ts | 50 + common/features/types.ts | 25 + .../wallet/__snapshots__/sagas.spec.ts.snap | 2 +- .../wallet/actions.ts} | 48 +- common/features/wallet/index.ts | 6 + .../features/wallet/reducer.spec.ts | 29 +- .../wallet.ts => features/wallet/reducer.ts} | 119 +- .../features/wallet/sagas.spec.ts | 150 ++- common/features/wallet/sagas.ts | 319 +++++ common/features/wallet/selectors.ts | 49 + common/features/wallet/types.ts | 211 ++++ common/index.html | 39 +- common/index.tsx | 18 +- common/libs/contracts/ABIFunction.ts | 29 +- common/libs/decrypt.ts | 3 +- common/libs/erc20.ts | 79 +- common/libs/formatters.ts | 7 + common/libs/nodes/configs.ts | 52 +- common/libs/nodes/index.ts | 7 +- common/libs/nodes/rpc/index.ts | 2 +- common/libs/nodes/web3/index.ts | 7 +- common/libs/scheduling/index.ts | 5 +- common/libs/signing.ts | 3 +- common/libs/transaction/utils/ether.ts | 13 +- common/libs/units.ts | 2 +- common/libs/validators.ts | 62 +- common/libs/values.ts | 10 +- common/libs/wallet/IWallet.ts | 5 +- common/libs/wallet/deterministic/enclave.ts | 67 ++ common/libs/wallet/deterministic/hardware.ts | 22 + common/libs/wallet/deterministic/index.ts | 14 +- common/libs/wallet/deterministic/ledger.ts | 169 ++- common/libs/wallet/deterministic/trezor.ts | 64 +- .../libs/wallet/non-deterministic/helpers.ts | 49 +- .../libs/wallet/non-deterministic/wallets.ts | 41 +- common/libs/wallet/non-deterministic/web3.ts | 33 +- common/libs/web-workers/generateKeystore.ts | 6 +- common/reducers/addressBook.ts | 93 -- common/reducers/config/index.ts | 12 - common/reducers/config/meta/index.ts | 1 - common/reducers/config/meta/meta.ts | 71 -- .../config/networks/customNetworks.ts | 29 - common/reducers/config/networks/index.ts | 16 - common/reducers/config/networks/types.ts | 10 - common/reducers/config/nodes/customNodes.ts | 29 - common/reducers/config/nodes/index.ts | 15 - common/reducers/config/nodes/staticNodes.ts | 49 - common/reducers/config/nodes/types.ts | 23 - common/reducers/customTokens.ts | 33 - common/reducers/deterministicWallets.ts | 56 - common/reducers/ens/domainRequests.ts | 82 -- common/reducers/ens/domainSelector.ts | 40 - common/reducers/ens/index.ts | 11 - common/reducers/gas.ts | 38 - common/reducers/index.ts | 60 - common/reducers/message.ts | 35 - common/reducers/notifications.ts | 31 - common/reducers/paritySigner.ts | 57 - common/reducers/rates.ts | 43 - common/reducers/schedule/index.ts | 1 - common/reducers/schedule/typings.ts | 27 - common/reducers/swap/schema.ts | 10 - common/reducers/swap/types.ts | 49 - .../reducers/transaction/broadcast/index.ts | 2 - .../reducers/transaction/broadcast/typings.ts | 10 - common/reducers/transaction/fields/fields.ts | 89 -- common/reducers/transaction/fields/index.ts | 2 - common/reducers/transaction/fields/typings.ts | 16 - common/reducers/transaction/index.ts | 1 - common/reducers/transaction/meta/index.ts | 2 - common/reducers/transaction/meta/meta.ts | 106 -- common/reducers/transaction/meta/typings.ts | 16 - common/reducers/transaction/network/index.ts | 2 - .../reducers/transaction/network/network.ts | 77 -- .../reducers/transaction/network/typings.ts | 12 - common/reducers/transaction/sign/index.ts | 2 - common/reducers/transaction/sign/sign.ts | 66 - common/reducers/transaction/sign/typings.ts | 10 - common/reducers/transaction/transaction.ts | 24 - common/reducers/transactions.ts | 77 -- common/sagas/addressBook.ts | 168 --- common/sagas/config/index.ts | 9 - common/sagas/config/network.ts | 29 - common/sagas/config/node.ts | 290 ----- common/sagas/config/web3.ts | 139 --- common/sagas/ens/ens.ts | 70 -- common/sagas/ens/helpers.ts | 17 - common/sagas/ens/index.ts | 1 - common/sagas/index.ts | 33 - common/sagas/message/helpers.ts | 38 - common/sagas/message/index.ts | 7 - common/sagas/message/signing.ts | 89 -- common/sagas/notifications.ts | 19 - common/sagas/rates.ts | 20 - .../schedule/currentScheduleTimestamp.ts | 20 - .../sagas/schedule/currentScheduleTimezone.ts | 18 - .../sagas/schedule/currentSchedulingToggle.ts | 26 - common/sagas/schedule/currentTimeBounty.ts | 30 - common/sagas/schedule/currentWindowSize.ts | 24 - common/sagas/schedule/currentWindowStart.ts | 20 - common/sagas/schedule/index.ts | 21 - common/sagas/schedule/paramsValidity.ts | 71 -- common/sagas/swap/liteSend.ts | 112 -- common/sagas/swap/orders.ts | 361 ------ common/sagas/swap/rates.ts | 93 -- .../sagas/transaction/broadcast/broadcast.ts | 38 - .../sagas/transaction/broadcast/helpers.tsx | 98 -- common/sagas/transaction/broadcast/index.ts | 1 - common/sagas/transaction/broadcast/typings.ts | 17 - common/sagas/transaction/current/currentTo.ts | 50 - .../sagas/transaction/current/currentValue.ts | 74 -- common/sagas/transaction/current/index.ts | 4 - common/sagas/transaction/fields/fields.ts | 62 - common/sagas/transaction/fields/index.ts | 1 - common/sagas/transaction/index.ts | 23 - common/sagas/transaction/meta/index.ts | 3 - common/sagas/transaction/meta/token.ts | 42 - common/sagas/transaction/meta/unitSwap.ts | 108 -- common/sagas/transaction/network/from.ts | 26 - common/sagas/transaction/network/gas.ts | 167 --- common/sagas/transaction/network/index.ts | 5 - common/sagas/transaction/network/nonce.ts | 44 - common/sagas/transaction/reset.ts | 67 -- common/sagas/transaction/sendEverything.ts | 67 -- common/sagas/transaction/signing/helpers.ts | 85 -- common/sagas/transaction/signing/index.ts | 1 - common/sagas/transaction/signing/signing.ts | 112 -- common/sagas/wallet/helpers.ts | 40 - common/sagas/wallet/index.ts | 4 - common/sagas/wallet/wallet.ts | 301 ----- common/sass/mixins.scss | 12 +- common/sass/styles.scss | 8 +- common/sass/styles/alerts.scss | 74 ++ common/sass/styles/badbrowser.scss | 2 +- common/sass/styles/buttons.scss | 280 +++++ common/sass/styles/code.scss | 8 +- common/sass/styles/forms.scss | 132 ++ common/sass/styles/overrides.scss | 7 +- common/sass/styles/overrides/alerts.scss | 43 - .../sass/styles/overrides/button-groups.scss | 10 - common/sass/styles/overrides/buttons.scss | 111 -- common/sass/styles/overrides/dropdowns.scss | 12 +- common/sass/styles/overrides/forms.scss | 10 +- common/sass/styles/overrides/rc-slider.scss | 11 +- .../sass/styles/overrides/react-datetime.scss | 6 +- .../sass/styles/overrides/react-select.scss | 44 +- common/sass/styles/overrides/tables.scss | 12 + common/sass/styles/overrides/type.scss | 23 +- common/sass/styles/scaffolding.scss | 4 +- common/sass/styles/tab.scss | 2 +- common/sass/styles/themes.scss | 25 + common/sass/variables.scss | 302 +---- common/sass/variables/buttons.scss | 33 - common/sass/variables/colors.scss | 187 ++- common/sass/variables/forms.scss | 37 - common/sass/variables/links.scss | 3 - common/sass/variables/tables.scss | 2 + common/sass/variables/tooltips.scss | 1 - common/selectors/config/index.ts | 4 - common/selectors/config/networks.ts | 92 -- common/selectors/config/nodes.ts | 133 -- common/selectors/config/tokens.ts | 51 - common/selectors/config/wallet.ts | 77 -- common/selectors/derived.ts | 9 - common/selectors/deterministicWallets.ts | 10 - common/selectors/rates.ts | 68 -- .../schedule/current/scheduleTimestamp.ts | 28 - .../schedule/current/scheduleTimezone.ts | 12 - .../schedule/current/scheduleType.ts | 11 - .../schedule/current/schedulingToggle.ts | 11 - .../selectors/schedule/current/timeBounty.ts | 19 - .../selectors/schedule/current/windowSize.ts | 29 - .../selectors/schedule/current/windowStart.ts | 22 - common/selectors/schedule/fields.ts | 67 -- common/selectors/schedule/index.ts | 2 - common/selectors/schedule/transaction.ts | 212 ---- common/selectors/transaction/broadcast.ts | 42 - common/selectors/transaction/current.ts | 68 -- common/selectors/transaction/fields.ts | 42 - common/selectors/transaction/index.ts | 7 - common/selectors/transaction/meta.ts | 87 -- common/selectors/transaction/network.ts | 26 - common/selectors/transaction/sign.ts | 52 - common/selectors/transaction/transaction.ts | 97 -- common/selectors/transactions.ts | 30 - common/selectors/wallet.ts | 207 ---- common/store/index.ts | 1 - common/translations/index.tsx | 24 +- common/translations/lang/en.json | 86 +- common/translations/lang/fr.json | 1066 +++++++++-------- common/translations/lang/ko.json | 1055 ++++++++-------- common/typescript/custom.d.ts | 5 + common/typescript/ledger/hw-app-eth.d.ts | 10 +- common/typescript/ledgerco.d.ts | 45 - common/typescript/rskjs-util.d.ts | 19 + common/typescript/trezor-connect.d.ts | 69 ++ common/typescript/trezor-js.d.ts | 191 +++ common/typescript/trezor-link.d.ts | 39 + common/utils/consoleAdvertisement.ts | 2 +- common/utils/fixAddressBookErrors.ts | 28 - common/utils/formatters.ts | 16 +- common/utils/keystore.ts | 2 +- common/utils/localStorage.ts | 5 +- common/utils/printElement.ts | 52 - electron-app/main/contextMenu.ts | 106 ++ electron-app/main/index.ts | 5 + electron-app/main/window.ts | 13 +- electron-app/preload/index.ts | 2 + jenkins/Jenkinsfile.linux.master | 2 +- jest_config/jest.config.json | 1 + jest_config/jest.int.config.json | 1 + package.json | 23 +- shared/enclave/README.md | 34 + shared/enclave/client/index.ts | 35 + shared/enclave/client/requests.ts | 17 + shared/enclave/preload.ts | 7 + .../enclave/server/handlers/displayAddress.ts | 7 + .../enclave/server/handlers/getChainCode.ts | 7 + shared/enclave/server/handlers/index.ts | 20 + shared/enclave/server/handlers/signMessage.ts | 7 + .../server/handlers/signTransaction.ts | 7 + shared/enclave/server/index.ts | 69 ++ shared/enclave/server/views/passphrase.html | 154 +++ shared/enclave/server/views/passphrase.ts | 8 + shared/enclave/server/views/pin.html | 248 ++++ shared/enclave/server/views/pin.ts | 8 + shared/enclave/server/views/showPrompt.ts | 45 + shared/enclave/server/wallets/index.ts | 14 + shared/enclave/server/wallets/keepkey.ts | 21 + shared/enclave/server/wallets/ledger.ts | 86 ++ shared/enclave/server/wallets/trezor.ts | 132 ++ shared/enclave/types.ts | 105 ++ shared/enclave/utils.ts | 6 + shared/types/network.d.ts | 13 +- shared/types/node.d.ts | 3 +- spec/config/contracts.spec.ts | 3 +- spec/config/tokens.spec.ts | 3 +- spec/integration/data.int.ts | 2 +- spec/integration/derivationChecker.int.ts | 4 +- spec/libs/decrypt.spec.ts | 5 +- spec/libs/erc20.spec.ts | 4 +- spec/libs/units.spec.ts | 3 +- spec/libs/validators.spec.ts | 52 +- spec/pages/ENS.spec.tsx | 8 +- spec/pages/SendTransaction.spec.tsx | 4 +- spec/pages/Swap.spec.tsx | 11 +- spec/pages/__snapshots__/Swap.spec.tsx.snap | 3 + spec/reducers/config/meta/meta.spec.ts | 83 -- spec/reducers/customTokens.spec.ts | 29 - spec/reducers/notifications.spec.ts | 25 - spec/reducers/onboardStatus.spec.ts | 11 - .../transaction/broadcast/broadcast.spec.ts | 56 - .../transaction/fields/fields.spec.ts | 122 -- spec/reducers/transaction/meta/meta.spec.ts | 110 -- .../transaction/network/network.spec.ts | 55 - .../reducers/transaction/signing/sign.spec.ts | 62 - spec/sagas/config/node.spec.ts | 131 -- spec/sagas/swap/liteSend.spec.ts | 34 - spec/sagas/swap/orders.spec.ts | 609 ---------- spec/sagas/swap/rates.spec.ts | 199 --- .../transaction/broadcast/broadcast.spec.ts | 72 -- .../transaction/broadcast/helpers.spec.tsx | 233 ---- .../transaction/current/currentTo.spec.ts | 110 -- .../transaction/current/currentValue.spec.ts | 305 ----- spec/sagas/transaction/fields/fields.spec.ts | 193 --- spec/sagas/transaction/meta/token.spec.ts | 112 -- spec/sagas/transaction/meta/unitSwap.spec.ts | 281 ----- spec/sagas/transaction/network/from.spec.ts | 48 - spec/sagas/transaction/network/gas.spec.ts | 306 ----- spec/sagas/transaction/network/nonce.spec.ts | 96 -- spec/sagas/transaction/reset.spec.ts | 21 - spec/sagas/transaction/sendEverything.spec.ts | 185 --- spec/sagas/transaction/sign/signing.spec.ts | 79 -- .../sagas/transaction/signing/helpers.spec.ts | 147 --- .../sagas/transaction/signing/signing.spec.ts | 81 -- .../transaction/validationHelpers.spec.ts | 172 --- spec/selectors/transaction/broadcast.spec.ts | 63 - spec/selectors/transaction/current.spec.ts | 81 -- spec/selectors/transaction/fields.spec.ts | 88 -- spec/selectors/transaction/helpers.spec.ts | 99 -- spec/selectors/transaction/meta.spec.ts | 71 -- spec/selectors/transaction/network.spec.ts | 48 - spec/selectors/transaction/sign.spec.ts | 44 - spec/utils/formatters.spec.ts | 10 +- static/robots.txt | 2 + static/sitemap.xml | 13 + travis-scripts/test-linux.sh | 12 + travis-scripts/test-osx.sh | 7 + webpack_config/makeConfig.js | 7 +- webpack_config/webpack.electron-dev.js | 24 +- webpack_config/webpack.electron-prod.js | 7 + yarn.lock | 836 +++++++++---- 958 files changed, 24817 insertions(+), 20078 deletions(-) delete mode 100644 common/actions/addressBook/actionCreators.ts delete mode 100644 common/actions/addressBook/constants.ts delete mode 100644 common/actions/addressBook/index.ts delete mode 100644 common/actions/config/actionCreators.ts delete mode 100644 common/actions/config/actionTypes.ts delete mode 100644 common/actions/config/constants.ts delete mode 100644 common/actions/config/index.ts delete mode 100644 common/actions/customTokens/actionCreators.ts delete mode 100644 common/actions/customTokens/constants.ts delete mode 100644 common/actions/customTokens/index.ts delete mode 100644 common/actions/deterministicWallets/actionCreators.ts delete mode 100644 common/actions/deterministicWallets/constants.ts delete mode 100644 common/actions/deterministicWallets/index.ts delete mode 100644 common/actions/ens/actionCreators/index.ts delete mode 100644 common/actions/ens/actionCreators/resolveDomain.ts delete mode 100644 common/actions/ens/actionTypes/actionTypes.ts delete mode 100644 common/actions/ens/actionTypes/index.ts delete mode 100644 common/actions/ens/actionTypes/resolveDomain.ts delete mode 100644 common/actions/ens/constants.ts delete mode 100644 common/actions/ens/index.ts delete mode 100644 common/actions/gas/actionCreators.ts delete mode 100644 common/actions/gas/actionTypes.ts delete mode 100644 common/actions/gas/constants.ts delete mode 100644 common/actions/gas/index.ts delete mode 100644 common/actions/message/actionCreators.ts delete mode 100644 common/actions/message/constants.ts delete mode 100644 common/actions/message/index.ts delete mode 100644 common/actions/notifications/actionCreators.ts delete mode 100644 common/actions/notifications/actionTypes.ts delete mode 100644 common/actions/notifications/constants.ts delete mode 100644 common/actions/notifications/index.ts delete mode 100644 common/actions/onboardStatus/actionCreators.ts delete mode 100644 common/actions/onboardStatus/actionTypes.ts delete mode 100644 common/actions/onboardStatus/constants.ts delete mode 100644 common/actions/onboardStatus/index.ts delete mode 100644 common/actions/paritySigner/actionTypes.ts delete mode 100644 common/actions/paritySigner/constants.ts delete mode 100644 common/actions/paritySigner/index.ts delete mode 100644 common/actions/rates/actionCreators.ts delete mode 100644 common/actions/rates/actionTypes.ts delete mode 100644 common/actions/rates/constants.ts delete mode 100644 common/actions/rates/index.ts delete mode 100644 common/actions/schedule/actionCreators/fields.ts delete mode 100644 common/actions/schedule/actionCreators/index.ts delete mode 100644 common/actions/schedule/actionCreators/scheduleTimestamp.ts delete mode 100644 common/actions/schedule/actionCreators/scheduleType.ts delete mode 100644 common/actions/schedule/actionCreators/schedulingToggle.ts delete mode 100644 common/actions/schedule/actionCreators/timeBounty.ts delete mode 100644 common/actions/schedule/actionCreators/windowSize.ts delete mode 100644 common/actions/schedule/actionCreators/windowStart.ts delete mode 100644 common/actions/schedule/actionTypes/actionTypes.ts delete mode 100644 common/actions/schedule/actionTypes/fields.ts delete mode 100644 common/actions/schedule/actionTypes/index.ts delete mode 100644 common/actions/schedule/actionTypes/scheduleTimestamp.ts delete mode 100644 common/actions/schedule/actionTypes/scheduleType.ts delete mode 100644 common/actions/schedule/actionTypes/schedulingToggle.ts delete mode 100644 common/actions/schedule/actionTypes/timeBounty.ts delete mode 100644 common/actions/schedule/actionTypes/windowSize.ts delete mode 100644 common/actions/schedule/actionTypes/windowStart.ts delete mode 100644 common/actions/schedule/constants.ts delete mode 100644 common/actions/schedule/index.ts delete mode 100644 common/actions/swap/actionCreators.ts delete mode 100644 common/actions/swap/actionTypes.ts delete mode 100644 common/actions/swap/constants.ts delete mode 100644 common/actions/swap/index.ts delete mode 100644 common/actions/transaction/actionCreators/broadcast.ts delete mode 100644 common/actions/transaction/actionCreators/current.ts delete mode 100644 common/actions/transaction/actionCreators/fields.ts delete mode 100644 common/actions/transaction/actionCreators/index.ts delete mode 100644 common/actions/transaction/actionCreators/meta.ts delete mode 100644 common/actions/transaction/actionCreators/network.ts delete mode 100644 common/actions/transaction/actionCreators/sendEverything.ts delete mode 100644 common/actions/transaction/actionCreators/sign.ts delete mode 100644 common/actions/transaction/actionCreators/swap.ts delete mode 100644 common/actions/transaction/actionTypes/actionTypes.ts delete mode 100644 common/actions/transaction/actionTypes/broadcast.ts delete mode 100644 common/actions/transaction/actionTypes/current.ts delete mode 100644 common/actions/transaction/actionTypes/fields.ts delete mode 100644 common/actions/transaction/actionTypes/index.ts delete mode 100644 common/actions/transaction/actionTypes/meta.ts delete mode 100644 common/actions/transaction/actionTypes/network.ts delete mode 100644 common/actions/transaction/actionTypes/sendEverything.ts delete mode 100644 common/actions/transaction/actionTypes/sign.ts delete mode 100644 common/actions/transaction/actionTypes/swap.ts delete mode 100644 common/actions/transaction/constants.ts delete mode 100644 common/actions/transaction/index.ts delete mode 100644 common/actions/transactions/actionCreators.ts delete mode 100644 common/actions/transactions/actionTypes.ts delete mode 100644 common/actions/transactions/constants.ts delete mode 100644 common/actions/transactions/index.ts delete mode 100644 common/actions/wallet/actionTypes.ts delete mode 100644 common/actions/wallet/constants.ts delete mode 100644 common/actions/wallet/index.ts create mode 100644 common/api/shapeshift.spec.ts create mode 100644 common/assets/images/icon-theme-dark.svg create mode 100644 common/assets/images/icon-theme-light.svg create mode 100644 common/assets/images/wallets/file.svg create mode 100644 common/assets/images/wallets/hardware.svg create mode 100644 common/badBrowserCheckA.js create mode 100644 common/badBrowserCheckB.js delete mode 100644 common/components/AppAlphaNotice/AlphaNotice.scss delete mode 100644 common/components/AppAlphaNotice/AlphaNotice.tsx delete mode 100644 common/components/AppAlphaNotice/AppExpired.scss delete mode 100644 common/components/AppAlphaNotice/AppExpired.tsx delete mode 100644 common/components/AppAlphaNotice/index.tsx delete mode 100644 common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm.tsx rename common/components/BalanceSidebar/TokenBalances/{ => AddCustomTokenForm}/AddCustomTokenForm.scss (93%) create mode 100644 common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddCustomTokenForm.tsx create mode 100644 common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddressField.tsx create mode 100644 common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/BalanceField.tsx create mode 100644 common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/DecimalField.tsx create mode 100644 common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/FieldInput.tsx create mode 100644 common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/SymbolField.tsx create mode 100644 common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/index.ts create mode 100644 common/components/BetaAgreement/index.tsx create mode 100644 common/components/Footer/ThemeToggle.scss create mode 100644 common/components/Footer/ThemeToggle.tsx create mode 100644 common/components/Header/components/constants.ts create mode 100644 common/components/Palette/index.scss create mode 100644 common/components/Palette/index.tsx create mode 100644 common/components/PaperWallet/index.scss delete mode 100644 common/components/WalletDecrypt/components/DeprecationWarning.tsx create mode 100644 common/components/ui/ColorDropdown.tsx create mode 100644 common/components/ui/Identicon.scss create mode 100644 common/components/ui/Warning.scss create mode 100644 common/components/ui/Warning.tsx create mode 100644 common/config/contracts/esn.json create mode 100644 common/config/contracts/rsk_testnet.json create mode 100644 common/config/tokens/esn.json create mode 100644 common/config/tokens/rsk_testnet.json delete mode 100644 common/containers/OnboardModal/components/WelcomeSlide.scss rename spec/actions/addressBook.spec.ts => common/features/addressBook/actions.spec.ts (61%) create mode 100644 common/features/addressBook/actions.ts create mode 100644 common/features/addressBook/constants.ts create mode 100644 common/features/addressBook/index.ts rename spec/reducers/addressBook.spec.ts => common/features/addressBook/reducer.spec.ts (65%) create mode 100644 common/features/addressBook/reducer.ts rename spec/sagas/addressBook.spec.ts => common/features/addressBook/sagas.spec.ts (74%) create mode 100644 common/features/addressBook/sagas.ts rename spec/selectors/addressBook.spec.ts => common/features/addressBook/selectors.spec.ts (60%) rename common/{selectors/addressBook.ts => features/addressBook/selectors.ts} (58%) rename common/{actions/addressBook/actionTypes.ts => features/addressBook/types.ts} (52%) rename spec/reducers/config/__snapshots__/config.spec.ts.snap => common/features/config/__snapshots__/sagas.spec.ts.snap (76%) create mode 100644 common/features/config/actions.ts create mode 100644 common/features/config/index.ts rename spec/actions/config.spec.ts => common/features/config/meta/actions.spec.ts (66%) create mode 100644 common/features/config/meta/actions.ts create mode 100644 common/features/config/meta/index.ts create mode 100644 common/features/config/meta/reducer.spec.ts create mode 100644 common/features/config/meta/reducer.ts rename common/{selectors/config/meta.ts => features/config/meta/selectors.ts} (61%) create mode 100644 common/features/config/meta/types.ts create mode 100644 common/features/config/networks/actions.ts create mode 100644 common/features/config/networks/custom/actions.ts create mode 100644 common/features/config/networks/custom/index.ts rename spec/reducers/config/networks/customNetworks.spec.ts => common/features/config/networks/custom/reducer.spec.ts (71%) create mode 100644 common/features/config/networks/custom/reducer.ts create mode 100644 common/features/config/networks/custom/selectors.ts create mode 100644 common/features/config/networks/custom/types.ts create mode 100644 common/features/config/networks/index.ts create mode 100644 common/features/config/networks/reducer.ts create mode 100644 common/features/config/networks/selectors.ts create mode 100644 common/features/config/networks/static/actions.ts create mode 100644 common/features/config/networks/static/index.ts rename spec/reducers/config/networks/staticNetworks.spec.ts => common/features/config/networks/static/reducer.spec.ts (55%) rename common/{reducers/config/networks/staticNetworks.ts => features/config/networks/static/reducer.ts} (73%) create mode 100644 common/features/config/networks/static/selectors.ts create mode 100644 common/features/config/networks/static/types.ts create mode 100644 common/features/config/networks/types.ts create mode 100644 common/features/config/nodes/custom/actions.ts create mode 100644 common/features/config/nodes/custom/index.ts rename spec/reducers/config/nodes/customNodes.spec.ts => common/features/config/nodes/custom/reducer.spec.ts (68%) create mode 100644 common/features/config/nodes/custom/reducer.ts create mode 100644 common/features/config/nodes/custom/selectors.ts create mode 100644 common/features/config/nodes/custom/types.ts create mode 100644 common/features/config/nodes/index.ts create mode 100644 common/features/config/nodes/reducer.ts create mode 100644 common/features/config/nodes/selected/actions.ts create mode 100644 common/features/config/nodes/selected/index.ts rename spec/reducers/config/nodes/selectedNode.spec.ts => common/features/config/nodes/selected/reducer.spec.ts (66%) rename common/{reducers/config/nodes/selectedNode.ts => features/config/nodes/selected/reducer.ts} (66%) create mode 100644 common/features/config/nodes/selected/selectors.ts create mode 100644 common/features/config/nodes/selected/types.ts create mode 100644 common/features/config/nodes/selectors.ts create mode 100644 common/features/config/nodes/static/actions.ts create mode 100644 common/features/config/nodes/static/helpers.ts create mode 100644 common/features/config/nodes/static/index.ts rename spec/reducers/config/nodes/staticNodes.spec.ts => common/features/config/nodes/static/reducer.spec.ts (55%) create mode 100644 common/features/config/nodes/static/reducer.ts create mode 100644 common/features/config/nodes/static/selectors.ts create mode 100644 common/features/config/nodes/static/types.ts create mode 100644 common/features/config/nodes/types.ts create mode 100644 common/features/config/reducer.ts rename spec/reducers/config/config.spec.ts => common/features/config/sagas.spec.ts (60%) create mode 100644 common/features/config/sagas.ts create mode 100644 common/features/config/selectors.ts create mode 100644 common/features/config/types.ts rename common/{store => features}/configAndTokens.ts (84%) rename common/{store/store.ts => features/configureStore.ts} (80%) create mode 100644 common/features/customTokens/actions.ts create mode 100644 common/features/customTokens/index.ts create mode 100644 common/features/customTokens/reducer.spec.ts create mode 100644 common/features/customTokens/reducer.ts rename common/{selectors/customTokens.ts => features/customTokens/selectors.ts} (70%) rename common/{actions/customTokens/actionTypes.ts => features/customTokens/types.ts} (53%) rename spec/sagas/__snapshots__/deterministicWallets.spec.ts.snap => common/features/deterministicWallets/__snapshots__/sagas.spec.ts.snap (94%) create mode 100644 common/features/deterministicWallets/actions.ts create mode 100644 common/features/deterministicWallets/index.ts rename spec/reducers/deterministicWallets.spec.ts => common/features/deterministicWallets/reducer.spec.ts (55%) create mode 100644 common/features/deterministicWallets/reducer.ts rename spec/sagas/deterministicWallets.spec.ts => common/features/deterministicWallets/sagas.spec.ts (65%) rename common/{sagas/deterministicWallets.ts => features/deterministicWallets/sagas.ts} (59%) create mode 100644 common/features/deterministicWallets/selectors.ts rename common/{actions/deterministicWallets/actionTypes.ts => features/deterministicWallets/types.ts} (71%) create mode 100644 common/features/ens/actions.ts create mode 100644 common/features/ens/domainRequests/index.ts create mode 100644 common/features/ens/domainRequests/reducer.ts create mode 100644 common/features/ens/domainRequests/selectors.ts create mode 100644 common/features/ens/domainRequests/types.ts create mode 100644 common/features/ens/domainSelector/index.ts create mode 100644 common/features/ens/domainSelector/reducer.ts create mode 100644 common/features/ens/domainSelector/selectors.ts create mode 100644 common/features/ens/domainSelector/types.ts rename common/{sagas/ens/modeMap.ts => features/ens/helpers.ts} (80%) create mode 100644 common/features/ens/index.ts rename spec/reducers/ens.spec.ts => common/features/ens/reducer.spec.ts (60%) create mode 100644 common/features/ens/reducer.ts create mode 100644 common/features/ens/sagas.ts rename common/{selectors/ens.ts => features/ens/selectors.ts} (64%) create mode 100644 common/features/ens/types.ts create mode 100644 common/features/gas/actions.ts create mode 100644 common/features/gas/index.ts rename spec/reducers/gas.spec.ts => common/features/gas/reducer.spec.ts (62%) create mode 100644 common/features/gas/reducer.ts rename spec/sagas/gas.spec.ts => common/features/gas/sagas.spec.ts (71%) rename common/{sagas/gas.ts => features/gas/sagas.ts} (68%) rename common/{selectors/gas.ts => features/gas/selectors.ts} (81%) create mode 100644 common/features/gas/types.ts create mode 100644 common/features/handleMetaMaskPolling.spec.ts create mode 100644 common/features/handleMetaMaskPolling.ts rename common/{selectors/transaction => features}/helpers.ts (82%) create mode 100644 common/features/index.ts create mode 100644 common/features/message/actions.ts create mode 100644 common/features/message/index.ts create mode 100644 common/features/message/reducer.ts create mode 100644 common/features/message/sagas.ts rename common/{actions/message/actionTypes.ts => features/message/types.ts} (50%) create mode 100644 common/features/notifications/actions.ts create mode 100644 common/features/notifications/index.ts create mode 100644 common/features/notifications/reducer.spec.ts create mode 100644 common/features/notifications/reducer.ts rename spec/sagas/notifications.spec.ts => common/features/notifications/sagas.spec.ts (55%) create mode 100644 common/features/notifications/sagas.ts create mode 100644 common/features/notifications/types.ts rename spec/actions/onboardStatus.spec.ts => common/features/onboardStatus/actions.spec.ts (77%) create mode 100644 common/features/onboardStatus/actions.ts create mode 100644 common/features/onboardStatus/index.ts create mode 100644 common/features/onboardStatus/reducer.spec.ts rename common/{reducers/onboardStatus.ts => features/onboardStatus/reducer.ts} (52%) create mode 100644 common/features/onboardStatus/types.ts rename common/{actions/paritySigner/actionCreators.ts => features/paritySigner/actions.ts} (75%) create mode 100644 common/features/paritySigner/index.ts create mode 100644 common/features/paritySigner/reducer.ts create mode 100644 common/features/paritySigner/types.ts create mode 100644 common/features/rates/actions.ts create mode 100644 common/features/rates/index.ts rename spec/reducers/rates.spec.ts => common/features/rates/reducer.spec.ts (54%) create mode 100644 common/features/rates/reducer.ts rename spec/sagas/rates.spec.ts => common/features/rates/sagas.spec.ts (59%) create mode 100644 common/features/rates/sagas.ts create mode 100644 common/features/rates/selectors.ts create mode 100644 common/features/rates/types.ts create mode 100644 common/features/reducers.ts create mode 100644 common/features/rehydrateAddressBook.ts create mode 100644 common/features/sagas.ts create mode 100644 common/features/schedule/actions.ts rename common/{selectors => features}/schedule/helpers.ts (61%) create mode 100644 common/features/schedule/index.ts rename common/{reducers/schedule/schedule.ts => features/schedule/reducer.ts} (64%) create mode 100644 common/features/schedule/sagas.ts create mode 100644 common/features/schedule/selectors.ts create mode 100644 common/features/schedule/types.ts create mode 100644 common/features/selectors.ts create mode 100644 common/features/store.ts create mode 100644 common/features/swap/actions.ts create mode 100644 common/features/swap/index.ts rename spec/reducers/swap.spec.ts => common/features/swap/reducer.spec.ts (61%) rename common/{reducers/swap/index.ts => features/swap/reducer.ts} (57%) create mode 100644 common/features/swap/sagas.spec.ts create mode 100644 common/features/swap/sagas.ts rename common/{selectors/swap.ts => features/swap/selectors.ts} (77%) create mode 100644 common/features/swap/types.ts rename spec/selectors/helpers.ts => common/features/testHelpers.ts (84%) create mode 100644 common/features/transaction/actions.ts create mode 100644 common/features/transaction/broadcast/actions.ts create mode 100644 common/features/transaction/broadcast/index.ts rename common/{reducers/transaction/broadcast/broadcast.ts => features/transaction/broadcast/reducer.ts} (50%) create mode 100644 common/features/transaction/broadcast/sagas.spec.tsx create mode 100644 common/features/transaction/broadcast/sagas.tsx create mode 100644 common/features/transaction/broadcast/selectors.ts create mode 100644 common/features/transaction/broadcast/types.ts create mode 100644 common/features/transaction/fields/actions.ts create mode 100644 common/features/transaction/fields/index.ts create mode 100644 common/features/transaction/fields/reducer.ts create mode 100644 common/features/transaction/fields/sagas.spec.ts create mode 100644 common/features/transaction/fields/sagas.ts create mode 100644 common/features/transaction/fields/selectors.ts create mode 100644 common/features/transaction/fields/types.ts create mode 100644 common/features/transaction/helpers.spec.tsx rename common/{sagas/transaction/validationHelpers.ts => features/transaction/helpers.tsx} (70%) create mode 100644 common/features/transaction/index.ts create mode 100644 common/features/transaction/meta/actions.ts create mode 100644 common/features/transaction/meta/index.ts create mode 100644 common/features/transaction/meta/reducer.ts create mode 100644 common/features/transaction/meta/sagas.spec.ts create mode 100644 common/features/transaction/meta/sagas.ts create mode 100644 common/features/transaction/meta/selectors.ts create mode 100644 common/features/transaction/meta/types.ts create mode 100644 common/features/transaction/network/actions.ts create mode 100644 common/features/transaction/network/index.ts create mode 100644 common/features/transaction/network/reducer.ts create mode 100644 common/features/transaction/network/sagas.spec.ts create mode 100644 common/features/transaction/network/sagas.ts create mode 100644 common/features/transaction/network/selectors.ts create mode 100644 common/features/transaction/network/types.ts create mode 100644 common/features/transaction/reducer.spec.ts create mode 100644 common/features/transaction/reducer.ts create mode 100644 common/features/transaction/sagas.spec.ts create mode 100644 common/features/transaction/sagas.ts create mode 100644 common/features/transaction/selectors.spec.ts create mode 100644 common/features/transaction/selectors.ts create mode 100644 common/features/transaction/sign/actions.ts create mode 100644 common/features/transaction/sign/index.ts create mode 100644 common/features/transaction/sign/reducer.ts create mode 100644 common/features/transaction/sign/sagas.spec.ts create mode 100644 common/features/transaction/sign/sagas.ts create mode 100644 common/features/transaction/sign/selectors.ts create mode 100644 common/features/transaction/sign/types.ts create mode 100644 common/features/transaction/types.ts create mode 100644 common/features/transactions/actions.ts create mode 100644 common/features/transactions/index.ts create mode 100644 common/features/transactions/reducer.ts rename common/{sagas/transactions.ts => features/transactions/sagas.ts} (56%) create mode 100644 common/features/transactions/selectors.ts create mode 100644 common/features/transactions/types.ts create mode 100644 common/features/types.ts rename spec/sagas/__snapshots__/wallet.spec.tsx.snap => common/features/wallet/__snapshots__/sagas.spec.ts.snap (98%) rename common/{actions/wallet/actionCreators.ts => features/wallet/actions.ts} (75%) create mode 100644 common/features/wallet/index.ts rename spec/reducers/wallet.spec.ts => common/features/wallet/reducer.spec.ts (55%) rename common/{reducers/wallet.ts => features/wallet/reducer.ts} (52%) rename spec/sagas/wallet.spec.tsx => common/features/wallet/sagas.spec.ts (67%) create mode 100644 common/features/wallet/sagas.ts create mode 100644 common/features/wallet/selectors.ts create mode 100644 common/features/wallet/types.ts create mode 100644 common/libs/formatters.ts create mode 100644 common/libs/wallet/deterministic/enclave.ts create mode 100644 common/libs/wallet/deterministic/hardware.ts delete mode 100644 common/reducers/addressBook.ts delete mode 100644 common/reducers/config/index.ts delete mode 100644 common/reducers/config/meta/index.ts delete mode 100644 common/reducers/config/meta/meta.ts delete mode 100644 common/reducers/config/networks/customNetworks.ts delete mode 100644 common/reducers/config/networks/index.ts delete mode 100644 common/reducers/config/networks/types.ts delete mode 100644 common/reducers/config/nodes/customNodes.ts delete mode 100644 common/reducers/config/nodes/index.ts delete mode 100644 common/reducers/config/nodes/staticNodes.ts delete mode 100644 common/reducers/config/nodes/types.ts delete mode 100644 common/reducers/customTokens.ts delete mode 100644 common/reducers/deterministicWallets.ts delete mode 100644 common/reducers/ens/domainRequests.ts delete mode 100644 common/reducers/ens/domainSelector.ts delete mode 100644 common/reducers/ens/index.ts delete mode 100644 common/reducers/gas.ts delete mode 100644 common/reducers/index.ts delete mode 100644 common/reducers/message.ts delete mode 100644 common/reducers/notifications.ts delete mode 100644 common/reducers/paritySigner.ts delete mode 100644 common/reducers/rates.ts delete mode 100644 common/reducers/schedule/index.ts delete mode 100644 common/reducers/schedule/typings.ts delete mode 100644 common/reducers/swap/schema.ts delete mode 100644 common/reducers/swap/types.ts delete mode 100644 common/reducers/transaction/broadcast/index.ts delete mode 100644 common/reducers/transaction/broadcast/typings.ts delete mode 100644 common/reducers/transaction/fields/fields.ts delete mode 100644 common/reducers/transaction/fields/index.ts delete mode 100644 common/reducers/transaction/fields/typings.ts delete mode 100644 common/reducers/transaction/index.ts delete mode 100644 common/reducers/transaction/meta/index.ts delete mode 100644 common/reducers/transaction/meta/meta.ts delete mode 100644 common/reducers/transaction/meta/typings.ts delete mode 100644 common/reducers/transaction/network/index.ts delete mode 100644 common/reducers/transaction/network/network.ts delete mode 100644 common/reducers/transaction/network/typings.ts delete mode 100644 common/reducers/transaction/sign/index.ts delete mode 100644 common/reducers/transaction/sign/sign.ts delete mode 100644 common/reducers/transaction/sign/typings.ts delete mode 100644 common/reducers/transaction/transaction.ts delete mode 100644 common/reducers/transactions.ts delete mode 100644 common/sagas/addressBook.ts delete mode 100644 common/sagas/config/index.ts delete mode 100644 common/sagas/config/network.ts delete mode 100644 common/sagas/config/node.ts delete mode 100644 common/sagas/config/web3.ts delete mode 100644 common/sagas/ens/ens.ts delete mode 100644 common/sagas/ens/helpers.ts delete mode 100644 common/sagas/ens/index.ts delete mode 100644 common/sagas/index.ts delete mode 100644 common/sagas/message/helpers.ts delete mode 100644 common/sagas/message/index.ts delete mode 100644 common/sagas/message/signing.ts delete mode 100644 common/sagas/notifications.ts delete mode 100644 common/sagas/rates.ts delete mode 100644 common/sagas/schedule/currentScheduleTimestamp.ts delete mode 100644 common/sagas/schedule/currentScheduleTimezone.ts delete mode 100644 common/sagas/schedule/currentSchedulingToggle.ts delete mode 100644 common/sagas/schedule/currentTimeBounty.ts delete mode 100644 common/sagas/schedule/currentWindowSize.ts delete mode 100644 common/sagas/schedule/currentWindowStart.ts delete mode 100644 common/sagas/schedule/index.ts delete mode 100644 common/sagas/schedule/paramsValidity.ts delete mode 100644 common/sagas/swap/liteSend.ts delete mode 100644 common/sagas/swap/orders.ts delete mode 100644 common/sagas/swap/rates.ts delete mode 100644 common/sagas/transaction/broadcast/broadcast.ts delete mode 100644 common/sagas/transaction/broadcast/helpers.tsx delete mode 100644 common/sagas/transaction/broadcast/index.ts delete mode 100644 common/sagas/transaction/broadcast/typings.ts delete mode 100644 common/sagas/transaction/current/currentTo.ts delete mode 100644 common/sagas/transaction/current/currentValue.ts delete mode 100644 common/sagas/transaction/current/index.ts delete mode 100644 common/sagas/transaction/fields/fields.ts delete mode 100644 common/sagas/transaction/fields/index.ts delete mode 100644 common/sagas/transaction/index.ts delete mode 100644 common/sagas/transaction/meta/index.ts delete mode 100644 common/sagas/transaction/meta/token.ts delete mode 100644 common/sagas/transaction/meta/unitSwap.ts delete mode 100644 common/sagas/transaction/network/from.ts delete mode 100644 common/sagas/transaction/network/gas.ts delete mode 100644 common/sagas/transaction/network/index.ts delete mode 100644 common/sagas/transaction/network/nonce.ts delete mode 100644 common/sagas/transaction/reset.ts delete mode 100644 common/sagas/transaction/sendEverything.ts delete mode 100644 common/sagas/transaction/signing/helpers.ts delete mode 100644 common/sagas/transaction/signing/index.ts delete mode 100644 common/sagas/transaction/signing/signing.ts delete mode 100644 common/sagas/wallet/helpers.ts delete mode 100644 common/sagas/wallet/index.ts delete mode 100644 common/sagas/wallet/wallet.ts create mode 100644 common/sass/styles/alerts.scss create mode 100644 common/sass/styles/buttons.scss create mode 100644 common/sass/styles/forms.scss delete mode 100644 common/sass/styles/overrides/alerts.scss delete mode 100644 common/sass/styles/overrides/button-groups.scss delete mode 100644 common/sass/styles/overrides/buttons.scss create mode 100644 common/sass/styles/themes.scss delete mode 100644 common/sass/variables/buttons.scss delete mode 100644 common/sass/variables/forms.scss delete mode 100644 common/sass/variables/links.scss delete mode 100644 common/selectors/config/index.ts delete mode 100644 common/selectors/config/networks.ts delete mode 100644 common/selectors/config/nodes.ts delete mode 100644 common/selectors/config/tokens.ts delete mode 100644 common/selectors/config/wallet.ts delete mode 100644 common/selectors/derived.ts delete mode 100644 common/selectors/deterministicWallets.ts delete mode 100644 common/selectors/rates.ts delete mode 100644 common/selectors/schedule/current/scheduleTimestamp.ts delete mode 100644 common/selectors/schedule/current/scheduleTimezone.ts delete mode 100644 common/selectors/schedule/current/scheduleType.ts delete mode 100644 common/selectors/schedule/current/schedulingToggle.ts delete mode 100644 common/selectors/schedule/current/timeBounty.ts delete mode 100644 common/selectors/schedule/current/windowSize.ts delete mode 100644 common/selectors/schedule/current/windowStart.ts delete mode 100644 common/selectors/schedule/fields.ts delete mode 100644 common/selectors/schedule/index.ts delete mode 100644 common/selectors/schedule/transaction.ts delete mode 100644 common/selectors/transaction/broadcast.ts delete mode 100644 common/selectors/transaction/current.ts delete mode 100644 common/selectors/transaction/fields.ts delete mode 100644 common/selectors/transaction/index.ts delete mode 100644 common/selectors/transaction/meta.ts delete mode 100644 common/selectors/transaction/network.ts delete mode 100644 common/selectors/transaction/sign.ts delete mode 100644 common/selectors/transaction/transaction.ts delete mode 100644 common/selectors/transactions.ts delete mode 100644 common/selectors/wallet.ts delete mode 100644 common/store/index.ts delete mode 100644 common/typescript/ledgerco.d.ts create mode 100644 common/typescript/rskjs-util.d.ts create mode 100644 common/typescript/trezor-connect.d.ts create mode 100644 common/typescript/trezor-js.d.ts create mode 100644 common/typescript/trezor-link.d.ts delete mode 100644 common/utils/fixAddressBookErrors.ts delete mode 100644 common/utils/printElement.ts create mode 100644 electron-app/main/contextMenu.ts create mode 100644 electron-app/preload/index.ts create mode 100644 shared/enclave/README.md create mode 100644 shared/enclave/client/index.ts create mode 100644 shared/enclave/client/requests.ts create mode 100644 shared/enclave/preload.ts create mode 100644 shared/enclave/server/handlers/displayAddress.ts create mode 100644 shared/enclave/server/handlers/getChainCode.ts create mode 100644 shared/enclave/server/handlers/index.ts create mode 100644 shared/enclave/server/handlers/signMessage.ts create mode 100644 shared/enclave/server/handlers/signTransaction.ts create mode 100644 shared/enclave/server/index.ts create mode 100644 shared/enclave/server/views/passphrase.html create mode 100644 shared/enclave/server/views/passphrase.ts create mode 100644 shared/enclave/server/views/pin.html create mode 100644 shared/enclave/server/views/pin.ts create mode 100644 shared/enclave/server/views/showPrompt.ts create mode 100644 shared/enclave/server/wallets/index.ts create mode 100644 shared/enclave/server/wallets/keepkey.ts create mode 100644 shared/enclave/server/wallets/ledger.ts create mode 100644 shared/enclave/server/wallets/trezor.ts create mode 100644 shared/enclave/types.ts create mode 100644 shared/enclave/utils.ts delete mode 100644 spec/reducers/config/meta/meta.spec.ts delete mode 100644 spec/reducers/customTokens.spec.ts delete mode 100644 spec/reducers/notifications.spec.ts delete mode 100644 spec/reducers/onboardStatus.spec.ts delete mode 100644 spec/reducers/transaction/broadcast/broadcast.spec.ts delete mode 100644 spec/reducers/transaction/fields/fields.spec.ts delete mode 100644 spec/reducers/transaction/meta/meta.spec.ts delete mode 100644 spec/reducers/transaction/network/network.spec.ts delete mode 100644 spec/reducers/transaction/signing/sign.spec.ts delete mode 100644 spec/sagas/config/node.spec.ts delete mode 100644 spec/sagas/swap/liteSend.spec.ts delete mode 100644 spec/sagas/swap/orders.spec.ts delete mode 100644 spec/sagas/swap/rates.spec.ts delete mode 100644 spec/sagas/transaction/broadcast/broadcast.spec.ts delete mode 100644 spec/sagas/transaction/broadcast/helpers.spec.tsx delete mode 100644 spec/sagas/transaction/current/currentTo.spec.ts delete mode 100644 spec/sagas/transaction/current/currentValue.spec.ts delete mode 100644 spec/sagas/transaction/fields/fields.spec.ts delete mode 100644 spec/sagas/transaction/meta/token.spec.ts delete mode 100644 spec/sagas/transaction/meta/unitSwap.spec.ts delete mode 100644 spec/sagas/transaction/network/from.spec.ts delete mode 100644 spec/sagas/transaction/network/gas.spec.ts delete mode 100644 spec/sagas/transaction/network/nonce.spec.ts delete mode 100644 spec/sagas/transaction/reset.spec.ts delete mode 100644 spec/sagas/transaction/sendEverything.spec.ts delete mode 100644 spec/sagas/transaction/sign/signing.spec.ts delete mode 100644 spec/sagas/transaction/signing/helpers.spec.ts delete mode 100644 spec/sagas/transaction/signing/signing.spec.ts delete mode 100644 spec/sagas/transaction/validationHelpers.spec.ts delete mode 100644 spec/selectors/transaction/broadcast.spec.ts delete mode 100644 spec/selectors/transaction/current.spec.ts delete mode 100644 spec/selectors/transaction/fields.spec.ts delete mode 100644 spec/selectors/transaction/helpers.spec.ts delete mode 100644 spec/selectors/transaction/meta.spec.ts delete mode 100644 spec/selectors/transaction/network.spec.ts delete mode 100644 spec/selectors/transaction/sign.spec.ts create mode 100644 static/robots.txt create mode 100644 static/sitemap.xml create mode 100644 travis-scripts/test-linux.sh create mode 100644 travis-scripts/test-osx.sh diff --git a/.travis.yml b/.travis.yml index 0b22ddef..3224ba73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,31 +35,21 @@ before_install: sh -e /etc/init.d/xvfb start # uncomment once integration tests are included in CI # docker pull dternyak/eth-priv-to-addr:latest - sudo apt-get install libusb-1.0 + sudo apt-get install libusb-1.0 fi - + install: - yarn --silent -script: - - | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - npm run prettier:diff - npm run test:coverage -- --maxWorkers=2 - npm run report-coverage - npm run tslint - npm run tscheck - npm run freezer - npm run freezer:validate - fi +before_script: + - chmod +x ./travis-scripts/test-{linux,osx}.sh + +script: + - ./travis-scripts/test-linux.sh + - ./travis-scripts/test-osx.sh - - | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - npm run build:electron - ls -la dist/electron-builds - fi notifications: email: on_success: never - on_failure: never + on_failure: never \ No newline at end of file diff --git a/README.md b/README.md index d48875ee..30023f22 100644 --- a/README.md +++ b/README.md @@ -5,40 +5,52 @@ * **Just looking to download?** Grab our [latest release](https://github.com/MyCryptoHQ/MyCrypto/releases). * **Looking for the old site?** Check out [https://legacy.mycrypto.com](https://legacy.mycrypto.com) or the source at [MyCryptoHQ/mycrypto.com](https://github.com/MyCryptoHQ/mycrypto.com) +## Requirements + +* Node 8.9.4\* +* Yarn >= 1.7.0\*\* +* Python 2.7.X\*\*\* + +\*Higher versions should work fine, but may cause inconsistencies. It's suggested you run 8.9.4 using `nvm`. +
+**npm is NOT supported for package management. MyCrypto uses yarn.lock to ensure sub-dependency versions are pinned, so yarn is required to install node_modules +
+\***Python 3 is **not** supported, since our dependencies use `node-gyp`. + ## Running the App -This codebase targets Node 8.9.4 (LTS). After `npm install`ing all dependencies (You may be required to install additional system dependencies, due to some node modules relying on them) you can run various commands depending on what you want to do: +After `yarn`ing all dependencies you can run various commands depending on what you want to do: #### Development ```bash # run app in dev mode in browser, rebuild on file changes -npm run dev +yarn dev ``` ```bash # run app in dev mode in electron, rebuild on file changes -npm run dev:electron +yarn dev:electron ``` #### Build Releases ```bash # builds the production server app -npm run build +yarn build ``` ```bash # builds the downloadable version of the site -npm run build:downloadable +yarn build:downloadable ``` ```bash # builds the electron apps -npm run build:electron +yarn build:electron # builds only one OS's electron app -npm run build:electron:(osx|linux|windows) +yarn build:electron:(osx|linux|windows) ``` All of these builds are output to a folder in `dist/`. @@ -47,26 +59,26 @@ All of these builds are output to a folder in `dist/`. ```bash # run unit tests with Jest -npm run test +yarn test ``` #### Integration Tests: ```bash # run integration tests with Jest -npm run test:int +yarn test:int ``` #### Dev (HTTPS): Some parts of the site, such as the Ledger wallet, require an HTTPS environment to work. To develop on HTTPS, do the following: -1. Create your own SSL Certificate (Heroku has a [nice guide here](https://devcenter.heroku.com/articles/ssl-certificate-self)) -2. Move the `.key` and `.crt` files into `webpack_config/server.*` -3. Run the following command: +1. Create your own SSL Certificate (Heroku has a [nice guide here](https://devcenter.heroku.com/articles/ssl-certificate-self)) +2. Move the `.key` and `.crt` files into `webpack_config/server.*` +3. Run the following command: ```bash -npm run dev:https +yarn dev:https ``` #### Address Derivation Checker: @@ -79,20 +91,20 @@ To test for correct address derivation, the address derivation checker uses mult ##### The derivation checker utility assumes that you have: -1. Docker installed/available -2. [dternyak/eth-priv-to-addr](https://hub.docker.com/r/dternyak/eth-priv-to-addr/) pulled from DockerHub +1. Docker installed/available +2. [dternyak/eth-priv-to-addr](https://hub.docker.com/r/dternyak/eth-priv-to-addr/) pulled from DockerHub ##### Docker setup instructions: -1. Install docker (on macOS, [Docker for Mac](https://docs.docker.com/docker-for-mac/) is suggested) -2. `docker pull dternyak/eth-priv-to-addr` +1. Install docker (on macOS, [Docker for Mac](https://docs.docker.com/docker-for-mac/) is suggested) +2. `docker pull dternyak/eth-priv-to-addr` ##### Run Derivation Checker The derivation checker utility runs as part of the integration test suite. ```bash -npm run test:int +yarn test:int ``` ## Folder structure: @@ -134,4 +146,3 @@ npm run test:int Cross browser testing and debugging provided by the very lovely team at BrowserStack. - diff --git a/common/Root.tsx b/common/Root.tsx index 59dba1a1..d283b1f2 100644 --- a/common/Root.tsx +++ b/common/Root.tsx @@ -1,6 +1,11 @@ import React, { Component } from 'react'; +import { Store } from 'redux'; import { Provider, connect } from 'react-redux'; -import { withRouter, Switch, Redirect, HashRouter, Route, BrowserRouter } from 'react-router-dom'; +import { withRouter, Switch, HashRouter, Route, BrowserRouter } from 'react-router-dom'; + +import { AppState } from 'features/reducers'; +import { getNetworkUnit, getTheme } from 'features/config'; +import { transactionMetaActions } from 'features/transaction'; // Components import Contracts from 'containers/Tabs/Contracts'; import ENS from 'containers/Tabs/ENS'; @@ -18,26 +23,23 @@ import QrSignerModal from 'containers/QrSignerModal'; import OnboardModal from 'containers/OnboardModal'; import WelcomeModal from 'components/WelcomeModal'; import NewAppReleaseModal from 'components/NewAppReleaseModal'; -import { Store } from 'redux'; -import { pollOfflineStatus, TPollOfflineStatus } from 'actions/config'; -import { AppState } from 'reducers'; +import PalettePage from 'components/Palette'; import { RouteNotFound } from 'components/RouteNotFound'; import { RedirectWithQuery } from 'components/RedirectWithQuery'; +import { Theme } from 'config'; import 'what-input'; -import { setUnitMeta, TSetUnitMeta } from 'actions/transaction'; -import { getNetworkUnit } from 'selectors/config'; interface OwnProps { store: Store; } interface StateProps { - networkUnit: string; + networkUnit: ReturnType; + theme: ReturnType; } interface DispatchProps { - pollOfflineStatus: TPollOfflineStatus; - setUnitMeta: TSetUnitMeta; + setUnitMeta: transactionMetaActions.TSetUnitMeta; } type Props = OwnProps & StateProps & DispatchProps; @@ -52,15 +54,21 @@ class RootClass extends Component { }; public componentDidMount() { - this.props.pollOfflineStatus(); this.props.setUnitMeta(this.props.networkUnit); this.addBodyClasses(); + this.updateTheme(this.props.theme); } public componentDidCatch(error: Error) { this.setState({ error }); } + public componentDidUpdate(prevProps: Props) { + if (this.props.theme !== prevProps.theme) { + this.updateTheme(this.props.theme, prevProps.theme); + } + } + public render() { const { store } = this.props; const { error } = this.state; @@ -69,18 +77,9 @@ class RootClass extends Component { return ; } - const CaptureRouteNotFound = withRouter(({ children, location }) => { - return location && location.state && location.state.error ? ( - - ) : ( - (children as JSX.Element) - ); - }); - const routes = ( - @@ -90,6 +89,10 @@ class RootClass extends Component { + {process.env.NODE_ENV !== 'production' && ( + + )} + @@ -102,8 +105,8 @@ class RootClass extends Component { return ( - - + + {routes} @@ -141,6 +144,14 @@ class RootClass extends Component { document.body.className += ` ${classes.join(' ')}`; } + + private updateTheme(theme: Theme, oldTheme?: Theme) { + const root = document.documentElement; + if (oldTheme) { + root.classList.remove(`theme--${oldTheme}`); + } + root.classList.add(`theme--${theme}`); + } } const LegacyRoutes = withRouter(props => { @@ -183,13 +194,19 @@ const LegacyRoutes = withRouter(props => { ); }); -const mapStateToProps = (state: AppState) => { - return { - networkUnit: getNetworkUnit(state) - }; -}; +const CaptureRouteNotFound = withRouter(({ children, location }) => { + return location && location.state && location.state.error ? ( + + ) : ( + (children as JSX.Element) + ); +}); + +const mapStateToProps = (state: AppState): StateProps => ({ + networkUnit: getNetworkUnit(state), + theme: getTheme(state) +}); export default connect(mapStateToProps, { - pollOfflineStatus, - setUnitMeta + setUnitMeta: transactionMetaActions.setUnitMeta })(RootClass); diff --git a/common/actions/addressBook/actionCreators.ts b/common/actions/addressBook/actionCreators.ts deleted file mode 100644 index 72682775..00000000 --- a/common/actions/addressBook/actionCreators.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { TypeKeys } from './constants'; -import { - AddressLabel, - AddressLabelEntry, - SetAddressLabel, - ClearAddressLabel, - SetAddressLabelEntry, - ChangeAddressLabelEntry, - SaveAddressLabelEntry, - ClearAddressLabelEntry, - RemoveAddressLabelEntry -} from './actionTypes'; - -export type TSetAddressLabel = typeof setAddressLabel; -export function setAddressLabel(payload: AddressLabel): SetAddressLabel { - return { - type: TypeKeys.SET_ADDRESS_LABEL, - payload - }; -} - -export type TClearAddressLabel = typeof clearAddressLabel; -export function clearAddressLabel(payload: string): ClearAddressLabel { - return { - type: TypeKeys.CLEAR_ADDRESS_LABEL, - payload - }; -} - -export type TSetAddressLabelEntry = typeof setAddressLabelEntry; -export function setAddressLabelEntry(payload: AddressLabelEntry): SetAddressLabelEntry { - return { - type: TypeKeys.SET_ADDRESS_LABEL_ENTRY, - payload - }; -} - -export type TChangeAddressLabelEntry = typeof changeAddressLabelEntry; -export function changeAddressLabelEntry(payload: AddressLabelEntry): ChangeAddressLabelEntry { - return { - type: TypeKeys.CHANGE_ADDRESS_LABEL_ENTRY, - payload - }; -} - -export type TSaveAddressLabelEntry = typeof saveAddressLabelEntry; -export function saveAddressLabelEntry(payload: string): SaveAddressLabelEntry { - return { - type: TypeKeys.SAVE_ADDRESS_LABEL_ENTRY, - payload - }; -} - -export type TClearAddressLabelEntry = typeof clearAddressLabelEntry; -export function clearAddressLabelEntry(payload: string): ClearAddressLabelEntry { - return { - type: TypeKeys.CLEAR_ADDRESS_LABEL_ENTRY, - payload - }; -} - -export type TRemoveAddressLabelEntry = typeof removeAddressLabelEntry; -export function removeAddressLabelEntry(payload: string): RemoveAddressLabelEntry { - return { - type: TypeKeys.REMOVE_ADDRESS_LABEL_ENTRY, - payload - }; -} diff --git a/common/actions/addressBook/constants.ts b/common/actions/addressBook/constants.ts deleted file mode 100644 index 604a4c89..00000000 --- a/common/actions/addressBook/constants.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum TypeKeys { - SET_ADDRESS_LABEL = 'SET_ADDRESS_LABEL', - CLEAR_ADDRESS_LABEL = 'CLEAR_ADDRESS_LABEL', - SET_ADDRESS_LABEL_ENTRY = 'SET_ADDRESS_LABEL_TEMPORARY_ENTRY', - CHANGE_ADDRESS_LABEL_ENTRY = 'CHANGE_ADDRESS_LABEL_ENTRY', - SAVE_ADDRESS_LABEL_ENTRY = 'SAVE_ADDRESS_LABEL_ENTRY', - CLEAR_ADDRESS_LABEL_ENTRY = 'CLEAR_ADDRESS_LABEL_ENTRY', - REMOVE_ADDRESS_LABEL_ENTRY = 'REMOVE_ADDRESS_LABEL_ENTRY' -} diff --git a/common/actions/addressBook/index.ts b/common/actions/addressBook/index.ts deleted file mode 100644 index 5a707547..00000000 --- a/common/actions/addressBook/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './actionTypes'; -export * from './actionCreators'; -export * from './constants'; diff --git a/common/actions/config/actionCreators.ts b/common/actions/config/actionCreators.ts deleted file mode 100644 index c1e6c26a..00000000 --- a/common/actions/config/actionCreators.ts +++ /dev/null @@ -1,153 +0,0 @@ -import * as interfaces from './actionTypes'; -import { TypeKeys } from './constants'; - -export function setOnline(): interfaces.SetOnlineAction { - return { - type: TypeKeys.CONFIG_SET_ONLINE - }; -} - -export function setOffline(): interfaces.SetOfflineAction { - return { - type: TypeKeys.CONFIG_SET_OFFLINE - }; -} - -export type TToggleAutoGasLimit = typeof toggleAutoGasLimit; -export function toggleAutoGasLimit(): interfaces.ToggleAutoGasLimitAction { - return { - type: TypeKeys.CONFIG_TOGGLE_AUTO_GAS_LIMIT - }; -} - -export type TChangeLanguage = typeof changeLanguage; -export function changeLanguage(sign: string): interfaces.ChangeLanguageAction { - return { - type: TypeKeys.CONFIG_LANGUAGE_CHANGE, - payload: sign - }; -} - -export type TPollOfflineStatus = typeof pollOfflineStatus; -export function pollOfflineStatus(): interfaces.PollOfflineStatus { - return { - type: TypeKeys.CONFIG_POLL_OFFLINE_STATUS - }; -} - -export type TChangeNodeRequested = typeof changeNodeRequested; -export function changeNodeRequested(payload: string): interfaces.ChangeNodeRequestedAction { - return { - type: TypeKeys.CONFIG_CHANGE_NODE_REQUESTED, - payload - }; -} - -export type TChangeNodeSucceded = typeof changeNodeSucceeded; -export function changeNodeSucceeded( - payload: interfaces.ChangeNodeSucceededAction['payload'] -): interfaces.ChangeNodeSucceededAction { - return { - type: TypeKeys.CONFIG_CHANGE_NODE_SUCCEEDED, - payload - }; -} - -export type TChangeNodeFailed = typeof changeNodeFailed; -export function changeNodeFailed(): interfaces.ChangeNodeFailedAction { - return { - type: TypeKeys.CONFIG_CHANGE_NODE_FAILED - }; -} - -export type TChangeNodeRequestedOneTime = typeof changeNodeRequestedOneTime; -export function changeNodeRequestedOneTime( - payload: string -): interfaces.ChangeNodeRequestedOneTimeAction { - return { - type: TypeKeys.CONFIG_CHANGE_NODE_REQUESTED_ONETIME, - payload - }; -} - -export type TChangeNodeForce = typeof changeNodeForce; -export function changeNodeForce(payload: string): interfaces.ChangeNodeForceAction { - return { - type: TypeKeys.CONFIG_CHANGE_NODE_FORCE, - payload - }; -} - -export type TChangeNetworkRequested = typeof changeNetworkRequested; -export function changeNetworkRequested( - payload: interfaces.ChangeNetworkRequestedAction['payload'] -): interfaces.ChangeNetworkRequestedAction { - return { - type: TypeKeys.CONFIG_CHANGE_NETWORK_REQUESTED, - payload - }; -} - -export type TAddCustomNode = typeof addCustomNode; -export function addCustomNode( - payload: interfaces.AddCustomNodeAction['payload'] -): interfaces.AddCustomNodeAction { - return { - type: TypeKeys.CONFIG_ADD_CUSTOM_NODE, - payload - }; -} - -export type TRemoveCustomNode = typeof removeCustomNode; -export function removeCustomNode( - payload: interfaces.RemoveCustomNodeAction['payload'] -): interfaces.RemoveCustomNodeAction { - return { - type: TypeKeys.CONFIG_REMOVE_CUSTOM_NODE, - payload - }; -} - -export type TAddCustomNetwork = typeof addCustomNetwork; -export function addCustomNetwork( - payload: interfaces.AddCustomNetworkAction['payload'] -): interfaces.AddCustomNetworkAction { - return { - type: TypeKeys.CONFIG_ADD_CUSTOM_NETWORK, - payload - }; -} - -export type TRemoveCustomNetwork = typeof removeCustomNetwork; -export function removeCustomNetwork( - payload: interfaces.RemoveCustomNetworkAction['payload'] -): interfaces.RemoveCustomNetworkAction { - return { - type: TypeKeys.CONFIG_REMOVE_CUSTOM_NETWORK, - payload - }; -} - -export type TSetLatestBlock = typeof setLatestBlock; -export function setLatestBlock(payload: string): interfaces.SetLatestBlockAction { - return { - type: TypeKeys.CONFIG_SET_LATEST_BLOCK, - payload - }; -} - -export function web3SetNode( - payload: interfaces.Web3setNodeAction['payload'] -): interfaces.Web3setNodeAction { - return { - type: TypeKeys.CONFIG_NODE_WEB3_SET, - payload - }; -} - -export type TWeb3UnsetNode = typeof web3UnsetNode; -export function web3UnsetNode(): interfaces.Web3UnsetNodeAction { - return { - type: TypeKeys.CONFIG_NODE_WEB3_UNSET - }; -} diff --git a/common/actions/config/actionTypes.ts b/common/actions/config/actionTypes.ts deleted file mode 100644 index bd2c11a1..00000000 --- a/common/actions/config/actionTypes.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { TypeKeys } from './constants'; -import { CustomNodeConfig, StaticNodeConfig } from 'types/node'; -import { CustomNetworkConfig } from 'types/network'; - -export interface SetOnlineAction { - type: TypeKeys.CONFIG_SET_ONLINE; -} - -export interface SetOfflineAction { - type: TypeKeys.CONFIG_SET_OFFLINE; -} - -export interface ToggleAutoGasLimitAction { - type: TypeKeys.CONFIG_TOGGLE_AUTO_GAS_LIMIT; -} - -/*** Change Language ***/ -export interface ChangeLanguageAction { - type: TypeKeys.CONFIG_LANGUAGE_CHANGE; - payload: string; -} - -/*** Poll offline status ***/ -export interface PollOfflineStatus { - type: TypeKeys.CONFIG_POLL_OFFLINE_STATUS; -} - -/*** Change Node Requested ***/ -export interface ChangeNodeRequestedAction { - type: TypeKeys.CONFIG_CHANGE_NODE_REQUESTED; - payload: string; -} - -/*** Change Node Succeeded ***/ -export interface ChangeNodeSucceededAction { - type: TypeKeys.CONFIG_CHANGE_NODE_SUCCEEDED; - payload: { - nodeId: string; - networkId: string; - }; -} - -/*** Change Node Failed ***/ -export interface ChangeNodeFailedAction { - type: TypeKeys.CONFIG_CHANGE_NODE_FAILED; -} - -/*** Change Node Onetime ***/ -export interface ChangeNodeRequestedOneTimeAction { - type: TypeKeys.CONFIG_CHANGE_NODE_REQUESTED_ONETIME; - payload: string; -} - -/*** Force Change Node ***/ -export interface ChangeNodeForceAction { - type: TypeKeys.CONFIG_CHANGE_NODE_FORCE; - payload: string; -} - -/*** Change Network Intent ***/ -export interface ChangeNetworkRequestedAction { - type: TypeKeys.CONFIG_CHANGE_NETWORK_REQUESTED; - payload: string; -} - -/*** Add Custom Node ***/ -export interface AddCustomNodeAction { - type: TypeKeys.CONFIG_ADD_CUSTOM_NODE; - payload: CustomNodeConfig; -} - -/*** Remove Custom Node ***/ -export interface RemoveCustomNodeAction { - type: TypeKeys.CONFIG_REMOVE_CUSTOM_NODE; - payload: string; -} - -/*** Add Custom Network ***/ -export interface AddCustomNetworkAction { - type: TypeKeys.CONFIG_ADD_CUSTOM_NETWORK; - payload: CustomNetworkConfig; -} - -/*** Remove Custom Network ***/ -export interface RemoveCustomNetworkAction { - type: TypeKeys.CONFIG_REMOVE_CUSTOM_NETWORK; - payload: string; -} - -/*** Set Latest Block ***/ -export interface SetLatestBlockAction { - type: TypeKeys.CONFIG_SET_LATEST_BLOCK; - payload: string; -} - -/*** Unset Web3 as a Node ***/ -export interface Web3UnsetNodeAction { - type: TypeKeys.CONFIG_NODE_WEB3_UNSET; -} - -/*** Set Web3 as a Node ***/ -export interface Web3setNodeAction { - type: TypeKeys.CONFIG_NODE_WEB3_SET; - payload: { id: 'web3'; config: StaticNodeConfig }; -} - -export type CustomNetworkAction = AddCustomNetworkAction | RemoveCustomNetworkAction; - -export type CustomNodeAction = AddCustomNodeAction | RemoveCustomNodeAction; - -export type NodeAction = - | ChangeNodeSucceededAction - | ChangeNodeRequestedAction - | ChangeNodeFailedAction - | Web3UnsetNodeAction - | Web3setNodeAction; - -export type MetaAction = - | ChangeLanguageAction - | SetOnlineAction - | SetOfflineAction - | ToggleAutoGasLimitAction - | PollOfflineStatus - | SetLatestBlockAction; - -/*** Union Type ***/ -export type ConfigAction = CustomNetworkAction | CustomNodeAction | NodeAction | MetaAction; diff --git a/common/actions/config/constants.ts b/common/actions/config/constants.ts deleted file mode 100644 index 7a720c6c..00000000 --- a/common/actions/config/constants.ts +++ /dev/null @@ -1,26 +0,0 @@ -export enum TypeKeys { - CONFIG_LANGUAGE_CHANGE = 'CONFIG_LANGUAGE_CHANGE', - - CONFIG_SET_ONLINE = 'CONFIG_SET_ONLINE', - CONFIG_SET_OFFLINE = 'CONFIG_SET_OFFLINE', - - CONFIG_TOGGLE_OFFLINE = 'CONFIG_TOGGLE_OFFLINE', - CONFIG_TOGGLE_AUTO_GAS_LIMIT = 'CONFIG_TOGGLE_AUTO_GAS_LIMIT', - CONFIG_POLL_OFFLINE_STATUS = 'CONFIG_POLL_OFFLINE_STATUS', - CONFIG_SET_LATEST_BLOCK = 'CONFIG_SET_LATEST_BLOCK', - - CONFIG_NODE_WEB3_SET = 'CONFIG_NODE_WEB3_SET', - CONFIG_NODE_WEB3_UNSET = 'CONFIG_NODE_WEB3_UNSET', - CONFIG_CHANGE_NODE_REQUESTED = 'CONFIG_CHANGE_NODE_REQUESTED', - CONFIG_CHANGE_NODE_SUCCEEDED = 'CONFIG_CHANGE_NODE_SUCCEEDED', - CONFIG_CHANGE_NODE_FAILED = 'CONFIG_CHANGE_NODE_FAILED', - CONFIG_CHANGE_NODE_REQUESTED_ONETIME = 'CONFIG_CHANGE_NODE_REQUESTED_ONETIME', - CONFIG_CHANGE_NODE_FORCE = 'CONFIG_CHANGE_NODE_FORCE', - CONFIG_CHANGE_NETWORK_REQUESTED = 'CONFIG_CHANGE_NETWORK_REQUESTED', - - CONFIG_ADD_CUSTOM_NODE = 'CONFIG_ADD_CUSTOM_NODE', - CONFIG_REMOVE_CUSTOM_NODE = 'CONFIG_REMOVE_CUSTOM_NODE', - - CONFIG_ADD_CUSTOM_NETWORK = 'CONFIG_ADD_CUSTOM_NETWORK', - CONFIG_REMOVE_CUSTOM_NETWORK = 'CONFIG_REMOVE_CUSTOM_NETWORK' -} diff --git a/common/actions/config/index.ts b/common/actions/config/index.ts deleted file mode 100644 index 51fcd517..00000000 --- a/common/actions/config/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './actionCreators'; -export * from './actionTypes'; -export * from './constants'; diff --git a/common/actions/customTokens/actionCreators.ts b/common/actions/customTokens/actionCreators.ts deleted file mode 100644 index 72d5246d..00000000 --- a/common/actions/customTokens/actionCreators.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as interfaces from './actionTypes'; -import { TypeKeys } from './constants'; -import { Token } from 'types/network'; - -export type TAddCustomToken = typeof addCustomToken; -export function addCustomToken(payload: Token): interfaces.AddCustomTokenAction { - return { - type: TypeKeys.CUSTOM_TOKEN_ADD, - payload - }; -} - -export type TRemoveCustomToken = typeof removeCustomToken; - -export function removeCustomToken(payload: string): interfaces.RemoveCustomTokenAction { - return { - type: TypeKeys.CUSTOM_TOKEN_REMOVE, - payload - }; -} diff --git a/common/actions/customTokens/constants.ts b/common/actions/customTokens/constants.ts deleted file mode 100644 index 7a5dcaa3..00000000 --- a/common/actions/customTokens/constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum TypeKeys { - CUSTOM_TOKEN_ADD = 'CUSTOM_TOKEN_ADD', - CUSTOM_TOKEN_REMOVE = 'CUSTOM_TOKEN_REMOVE' -} diff --git a/common/actions/customTokens/index.ts b/common/actions/customTokens/index.ts deleted file mode 100644 index 51fcd517..00000000 --- a/common/actions/customTokens/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './actionCreators'; -export * from './actionTypes'; -export * from './constants'; diff --git a/common/actions/deterministicWallets/actionCreators.ts b/common/actions/deterministicWallets/actionCreators.ts deleted file mode 100644 index 396cd2d7..00000000 --- a/common/actions/deterministicWallets/actionCreators.ts +++ /dev/null @@ -1,43 +0,0 @@ -import * as interfaces from './actionTypes'; -import { TypeKeys } from './constants'; -export function getDeterministicWallets( - args: interfaces.GetDeterministicWalletsArgs -): interfaces.GetDeterministicWalletsAction { - const { seed, dPath, publicKey, chainCode, limit, offset } = args; - return { - type: TypeKeys.DW_GET_WALLETS, - payload: { - seed, - dPath, - publicKey, - chainCode, - limit: limit || 5, - offset: offset || 0 - } - }; -} - -export function setDeterministicWallets( - wallets: interfaces.DeterministicWalletData[] -): interfaces.SetDeterministicWalletsAction { - return { - type: TypeKeys.DW_SET_WALLETS, - payload: wallets - }; -} - -export function setDesiredToken(token: string | undefined): interfaces.SetDesiredTokenAction { - return { - type: TypeKeys.DW_SET_DESIRED_TOKEN, - payload: token - }; -} - -export function updateDeterministicWallet( - args: interfaces.UpdateDeterministicWalletArgs -): interfaces.UpdateDeterministicWalletAction { - return { - type: TypeKeys.DW_UPDATE_WALLET, - payload: args - }; -} diff --git a/common/actions/deterministicWallets/constants.ts b/common/actions/deterministicWallets/constants.ts deleted file mode 100644 index b7e566a5..00000000 --- a/common/actions/deterministicWallets/constants.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum TypeKeys { - DW_GET_WALLETS = 'DW_GET_WALLETS', - DW_SET_WALLETS = 'DW_SET_WALLETS', - DW_SET_DESIRED_TOKEN = 'DW_SET_DESIRED_TOKEN', - DW_UPDATE_WALLET = 'DW_UPDATE_WALLET' -} diff --git a/common/actions/deterministicWallets/index.ts b/common/actions/deterministicWallets/index.ts deleted file mode 100644 index 2608a18e..00000000 --- a/common/actions/deterministicWallets/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './actionTypes'; -export * from './actionCreators'; diff --git a/common/actions/ens/actionCreators/index.ts b/common/actions/ens/actionCreators/index.ts deleted file mode 100644 index 9ea71985..00000000 --- a/common/actions/ens/actionCreators/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './resolveDomain'; diff --git a/common/actions/ens/actionCreators/resolveDomain.ts b/common/actions/ens/actionCreators/resolveDomain.ts deleted file mode 100644 index c402ed24..00000000 --- a/common/actions/ens/actionCreators/resolveDomain.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as ActionTypes from '../actionTypes'; -import { TypeKeys } from '../constants'; -import { DomainRequest } from 'libs/ens'; -import { ResolveDomainCached } from 'actions/ens'; - -export type TResolveDomainRequested = typeof resolveDomainRequested; -export const resolveDomainRequested = (domain: string): ActionTypes.ResolveDomainRequested => ({ - type: TypeKeys.ENS_RESOLVE_DOMAIN_REQUESTED, - payload: { domain } -}); - -export const resolveDomainCached = ( - payload: ResolveDomainCached['payload'] -): ResolveDomainCached => ({ - type: TypeKeys.ENS_RESOLVE_DOMAIN_CACHED, - payload -}); - -export type TResolveDomainSucceeded = typeof resolveDomainSucceeded; -export const resolveDomainSucceeded = ( - domain: string, - domainData: DomainRequest -): ActionTypes.ResolveDomainSucceeded => ({ - type: TypeKeys.ENS_RESOLVE_DOMAIN_SUCCEEDED, - payload: { domain, domainData } -}); - -export type TResolveDomainFailed = typeof resolveDomainFailed; -export const resolveDomainFailed = ( - domain: string, - error: Error -): ActionTypes.ResolveDomainFailed => ({ - type: TypeKeys.ENS_RESOLVE_DOMAIN_FAILED, - payload: { domain, error } -}); diff --git a/common/actions/ens/actionTypes/actionTypes.ts b/common/actions/ens/actionTypes/actionTypes.ts deleted file mode 100644 index e9d035f9..00000000 --- a/common/actions/ens/actionTypes/actionTypes.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ResolveDomainAction } from './resolveDomain'; -export * from './resolveDomain'; - -export type EnsAction = ResolveDomainAction; diff --git a/common/actions/ens/actionTypes/index.ts b/common/actions/ens/actionTypes/index.ts deleted file mode 100644 index 3eb256de..00000000 --- a/common/actions/ens/actionTypes/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './actionTypes'; diff --git a/common/actions/ens/actionTypes/resolveDomain.ts b/common/actions/ens/actionTypes/resolveDomain.ts deleted file mode 100644 index aab2d357..00000000 --- a/common/actions/ens/actionTypes/resolveDomain.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { TypeKeys } from '../constants'; -import { DomainRequest } from 'libs/ens'; - -export interface ResolveDomainRequested { - type: TypeKeys.ENS_RESOLVE_DOMAIN_REQUESTED; - payload: { domain: string }; -} - -export interface ResolveDomainSucceeded { - type: TypeKeys.ENS_RESOLVE_DOMAIN_SUCCEEDED; - payload: { domain: string; domainData: DomainRequest }; -} - -export interface ResolveDomainCached { - type: TypeKeys.ENS_RESOLVE_DOMAIN_CACHED; - payload: { domain: string }; -} - -export interface ResolveDomainFailed { - type: TypeKeys.ENS_RESOLVE_DOMAIN_FAILED; - payload: { domain: string; error: Error }; -} - -export type ResolveDomainAction = - | ResolveDomainRequested - | ResolveDomainSucceeded - | ResolveDomainFailed - | ResolveDomainCached; diff --git a/common/actions/ens/constants.ts b/common/actions/ens/constants.ts deleted file mode 100644 index fdab3be9..00000000 --- a/common/actions/ens/constants.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum TypeKeys { - ENS_RESOLVE_DOMAIN_REQUESTED = 'ENS_RESOLVE_DOMAIN_REQUESTED', - ENS_RESOLVE_DOMAIN_SUCCEEDED = 'ENS_RESOLVE_DOMAIN_SUCCEEDED', - ENS_RESOLVE_DOMAIN_FAILED = 'ENS_RESOLVE_DOMAIN_FAILED', - ENS_RESOLVE_DOMAIN_CACHED = 'ENS_RESOLVE_DOMAIN_CACHED' -} diff --git a/common/actions/ens/index.ts b/common/actions/ens/index.ts deleted file mode 100644 index fee14683..00000000 --- a/common/actions/ens/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './constants'; -export * from './actionTypes'; -export * from './actionCreators'; diff --git a/common/actions/gas/actionCreators.ts b/common/actions/gas/actionCreators.ts deleted file mode 100644 index c09b1bfe..00000000 --- a/common/actions/gas/actionCreators.ts +++ /dev/null @@ -1,19 +0,0 @@ -import * as interfaces from './actionTypes'; -import { TypeKeys } from './constants'; - -export type TFetchGasEstimates = typeof fetchGasEstimates; -export function fetchGasEstimates(): interfaces.FetchGasEstimatesAction { - return { - type: TypeKeys.GAS_FETCH_ESTIMATES - }; -} - -export type TSetGasEstimates = typeof setGasEstimates; -export function setGasEstimates( - payload: interfaces.SetGasEstimatesAction['payload'] -): interfaces.SetGasEstimatesAction { - return { - type: TypeKeys.GAS_SET_ESTIMATES, - payload - }; -} diff --git a/common/actions/gas/actionTypes.ts b/common/actions/gas/actionTypes.ts deleted file mode 100644 index a66b86c0..00000000 --- a/common/actions/gas/actionTypes.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { TypeKeys } from './constants'; -import { GasEstimates } from 'api/gas'; - -export interface FetchGasEstimatesAction { - type: TypeKeys.GAS_FETCH_ESTIMATES; -} - -export interface SetGasEstimatesAction { - type: TypeKeys.GAS_SET_ESTIMATES; - payload: GasEstimates; -} - -/*** Union Type ***/ -export type GasAction = FetchGasEstimatesAction | SetGasEstimatesAction; diff --git a/common/actions/gas/constants.ts b/common/actions/gas/constants.ts deleted file mode 100644 index 569bcb6b..00000000 --- a/common/actions/gas/constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum TypeKeys { - GAS_FETCH_ESTIMATES = 'GAS_FETCH_ESTIMATES', - GAS_SET_ESTIMATES = 'GAS_SET_ESTIMATES' -} diff --git a/common/actions/gas/index.ts b/common/actions/gas/index.ts deleted file mode 100644 index 51fcd517..00000000 --- a/common/actions/gas/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './actionCreators'; -export * from './actionTypes'; -export * from './constants'; diff --git a/common/actions/message/actionCreators.ts b/common/actions/message/actionCreators.ts deleted file mode 100644 index a71c5549..00000000 --- a/common/actions/message/actionCreators.ts +++ /dev/null @@ -1,28 +0,0 @@ -import * as interfaces from './actionTypes'; -import { TypeKeys } from './constants'; -import { ISignedMessage } from 'libs/signing'; - -export type TSignMessageRequested = typeof signMessageRequested; -export function signMessageRequested(payload: string): interfaces.SignMessageRequestedAction { - return { - type: TypeKeys.SIGN_MESSAGE_REQUESTED, - payload - }; -} - -export type TSignLocalMessageSucceeded = typeof signLocalMessageSucceeded; -export function signLocalMessageSucceeded( - payload: ISignedMessage -): interfaces.SignLocalMessageSucceededAction { - return { - type: TypeKeys.SIGN_LOCAL_MESSAGE_SUCCEEDED, - payload - }; -} - -export type TSignMessageFailed = typeof signMessageFailed; -export function signMessageFailed(): interfaces.SignMessageFailedAction { - return { - type: TypeKeys.SIGN_MESSAGE_FAILED - }; -} diff --git a/common/actions/message/constants.ts b/common/actions/message/constants.ts deleted file mode 100644 index 335bfdff..00000000 --- a/common/actions/message/constants.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum TypeKeys { - SIGN_MESSAGE_REQUESTED = 'SIGN_MESSAGE_REQUESTED', - SIGN_LOCAL_MESSAGE_SUCCEEDED = 'SIGN_LOCAL_MESSAGE_SUCCEEDED', - SIGN_MESSAGE_FAILED = 'SIGN_MESSAGE_FAILED' -} diff --git a/common/actions/message/index.ts b/common/actions/message/index.ts deleted file mode 100644 index d5122d97..00000000 --- a/common/actions/message/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './actionCreators'; -export * from './constants'; -export * from './actionTypes'; diff --git a/common/actions/notifications/actionCreators.ts b/common/actions/notifications/actionCreators.ts deleted file mode 100644 index 99949933..00000000 --- a/common/actions/notifications/actionCreators.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { ReactElement } from 'react'; -import * as types from './actionTypes'; -import { TypeKeys } from './constants'; - -export type TShowNotification = typeof showNotification; -export function showNotification( - level: types.NOTIFICATION_LEVEL = 'info', - msg: ReactElement | string, - duration?: number -): types.ShowNotificationAction { - return { - type: TypeKeys.SHOW_NOTIFICATION, - payload: { - level, - msg, - duration, - id: Math.random() - } - }; -} - -export type TCloseNotification = typeof closeNotification; -export function closeNotification(notification: types.Notification): types.CloseNotificationAction { - return { - type: TypeKeys.CLOSE_NOTIFICATION, - payload: notification - }; -} diff --git a/common/actions/notifications/actionTypes.ts b/common/actions/notifications/actionTypes.ts deleted file mode 100644 index 3a7377f1..00000000 --- a/common/actions/notifications/actionTypes.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ReactElement } from 'react'; -import { TypeKeys } from './constants'; -/*** Shared types ***/ -export type NOTIFICATION_LEVEL = 'danger' | 'warning' | 'success' | 'info'; - -export interface Notification { - level: NOTIFICATION_LEVEL; - msg: ReactElement | string; - id: number; - duration?: number; -} - -/*** Close notification ***/ -export interface CloseNotificationAction { - type: TypeKeys.CLOSE_NOTIFICATION; - payload: Notification; -} - -/*** Show Notification ***/ -export interface ShowNotificationAction { - type: TypeKeys.SHOW_NOTIFICATION; - payload: Notification; -} - -/*** Union Type ***/ -export type NotificationsAction = ShowNotificationAction | CloseNotificationAction; diff --git a/common/actions/notifications/constants.ts b/common/actions/notifications/constants.ts deleted file mode 100644 index 8529f18e..00000000 --- a/common/actions/notifications/constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum TypeKeys { - SHOW_NOTIFICATION = 'SHOW_NOTIFICATION', - CLOSE_NOTIFICATION = 'CLOSE_NOTIFICATION' -} diff --git a/common/actions/notifications/index.ts b/common/actions/notifications/index.ts deleted file mode 100644 index 2608a18e..00000000 --- a/common/actions/notifications/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './actionTypes'; -export * from './actionCreators'; diff --git a/common/actions/onboardStatus/actionCreators.ts b/common/actions/onboardStatus/actionCreators.ts deleted file mode 100644 index fc0a40a9..00000000 --- a/common/actions/onboardStatus/actionCreators.ts +++ /dev/null @@ -1,31 +0,0 @@ -import * as interfaces from './actionTypes'; -import { TypeKeys } from './constants'; - -export type TStartOnboardSession = typeof startOnboardSession; -export function startOnboardSession(): interfaces.StartOnboardSessionAction { - return { - type: TypeKeys.START_ONBOARD_SESSION - }; -} - -export type TResumeSlide = typeof resumeSlide; -export function resumeSlide(slideNumber: number): interfaces.ResumeSlideAction { - return { - type: TypeKeys.RESUME_SLIDE, - slideNumber - }; -} - -export type TDecrementSlide = typeof decrementSlide; -export function decrementSlide(): interfaces.DecrementSlideAction { - return { - type: TypeKeys.DECREMENT_SLIDE - }; -} - -export type TIncrementSlide = typeof incrementSlide; -export function incrementSlide(): interfaces.IncrementSlideAction { - return { - type: TypeKeys.INCREMENT_SLIDE - }; -} diff --git a/common/actions/onboardStatus/actionTypes.ts b/common/actions/onboardStatus/actionTypes.ts deleted file mode 100644 index a2eae24b..00000000 --- a/common/actions/onboardStatus/actionTypes.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TypeKeys } from './constants'; - -export interface StartOnboardSessionAction { - type: TypeKeys.START_ONBOARD_SESSION; -} - -export interface ResumeSlideAction { - type: TypeKeys.RESUME_SLIDE; - slideNumber: number; -} - -export interface DecrementSlideAction { - type: TypeKeys.DECREMENT_SLIDE; -} - -export interface IncrementSlideAction { - type: TypeKeys.INCREMENT_SLIDE; -} - -export type OnboardStatusAction = - | StartOnboardSessionAction - | ResumeSlideAction - | DecrementSlideAction - | IncrementSlideAction; diff --git a/common/actions/onboardStatus/constants.ts b/common/actions/onboardStatus/constants.ts deleted file mode 100644 index 859e539a..00000000 --- a/common/actions/onboardStatus/constants.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum TypeKeys { - START_ONBOARD_SESSION = 'START_ONBOARD_SESSION', - RESUME_SLIDE = 'RESUME_SLIDE', - DECREMENT_SLIDE = 'DECREMENT_SLIDE', - INCREMENT_SLIDE = 'INCREMENT_SLIDE' -} diff --git a/common/actions/onboardStatus/index.ts b/common/actions/onboardStatus/index.ts deleted file mode 100644 index 2608a18e..00000000 --- a/common/actions/onboardStatus/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './actionTypes'; -export * from './actionCreators'; diff --git a/common/actions/paritySigner/actionTypes.ts b/common/actions/paritySigner/actionTypes.ts deleted file mode 100644 index e5318006..00000000 --- a/common/actions/paritySigner/actionTypes.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { TypeKeys } from './constants'; - -export interface RequestTransactionSignatureAction { - type: TypeKeys.PARITY_SIGNER_REQUEST_TX_SIGNATURE; - payload: { - isMessage: false; - data: string; - from: string; - }; -} - -export interface RequestMessageSignatureAction { - type: TypeKeys.PARITY_SIGNER_REQUEST_MSG_SIGNATURE; - payload: { - isMessage: true; - data: string; - from: string; - }; -} - -export interface FinalizeSignatureAction { - type: TypeKeys.PARITY_SIGNER_FINALIZE_SIGNATURE; - payload: string | null; -} - -/*** Union Type ***/ -export type ParitySignerAction = - | RequestTransactionSignatureAction - | RequestMessageSignatureAction - | FinalizeSignatureAction; diff --git a/common/actions/paritySigner/constants.ts b/common/actions/paritySigner/constants.ts deleted file mode 100644 index e61fed3f..00000000 --- a/common/actions/paritySigner/constants.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum TypeKeys { - PARITY_SIGNER_REQUEST_TX_SIGNATURE = 'PARITY_SIGNER_REQUEST_TX_SIGNATURE', - PARITY_SIGNER_REQUEST_MSG_SIGNATURE = 'PARITY_SIGNER_REQUEST_MSG_SIGNATURE', - PARITY_SIGNER_FINALIZE_SIGNATURE = 'PARITY_SIGNER_FINALIZE_SIGNATURE' -} diff --git a/common/actions/paritySigner/index.ts b/common/actions/paritySigner/index.ts deleted file mode 100644 index fee14683..00000000 --- a/common/actions/paritySigner/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './constants'; -export * from './actionTypes'; -export * from './actionCreators'; diff --git a/common/actions/rates/actionCreators.ts b/common/actions/rates/actionCreators.ts deleted file mode 100644 index 22b82167..00000000 --- a/common/actions/rates/actionCreators.ts +++ /dev/null @@ -1,26 +0,0 @@ -import * as interfaces from './actionTypes'; -import { TypeKeys } from './constants'; -import { CCResponse } from 'api/rates'; - -export type TFetchCCRatesRequested = typeof fetchCCRatesRequested; -export function fetchCCRatesRequested(symbols: string[] = []): interfaces.FetchCCRatesRequested { - return { - type: TypeKeys.RATES_FETCH_CC_REQUESTED, - payload: symbols - }; -} - -export type TFetchCCRatesSucceeded = typeof fetchCCRatesSucceeded; -export function fetchCCRatesSucceeded(payload: CCResponse): interfaces.FetchCCRatesSucceeded { - return { - type: TypeKeys.RATES_FETCH_CC_SUCCEEDED, - payload - }; -} - -export type TFetchCCRatesFailed = typeof fetchCCRatesFailed; -export function fetchCCRatesFailed(): interfaces.FetchCCRatesFailed { - return { - type: TypeKeys.RATES_FETCH_CC_FAILED - }; -} diff --git a/common/actions/rates/actionTypes.ts b/common/actions/rates/actionTypes.ts deleted file mode 100644 index abd4d9eb..00000000 --- a/common/actions/rates/actionTypes.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { TypeKeys } from './constants'; -import { CCResponse } from 'api/rates'; - -export interface FetchCCRatesRequested { - type: TypeKeys.RATES_FETCH_CC_REQUESTED; - payload: string[]; -} - -/*** Set rates ***/ -export interface FetchCCRatesSucceeded { - type: TypeKeys.RATES_FETCH_CC_SUCCEEDED; - payload: CCResponse; -} - -export interface FetchCCRatesFailed { - type: TypeKeys.RATES_FETCH_CC_FAILED; -} - -/*** Union Type ***/ -export type RatesAction = FetchCCRatesRequested | FetchCCRatesSucceeded | FetchCCRatesFailed; diff --git a/common/actions/rates/constants.ts b/common/actions/rates/constants.ts deleted file mode 100644 index 419a1c30..00000000 --- a/common/actions/rates/constants.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum TypeKeys { - RATES_FETCH_CC_REQUESTED = 'RATES_FETCH_CC_REQUESTED', - RATES_FETCH_CC_FAILED = 'RATES_FETCH_CC_FAILED', - RATES_FETCH_CC_SUCCEEDED = 'RATES_FETCH_CC_SUCCEEDED' -} diff --git a/common/actions/rates/index.ts b/common/actions/rates/index.ts deleted file mode 100644 index 113dd69a..00000000 --- a/common/actions/rates/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './actionCreators'; -export * from './actionTypes'; diff --git a/common/actions/schedule/actionCreators/fields.ts b/common/actions/schedule/actionCreators/fields.ts deleted file mode 100644 index ab1cf3d4..00000000 --- a/common/actions/schedule/actionCreators/fields.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { - SetTimeBountyFieldAction, - SetWindowSizeFieldAction, - SetWindowStartFieldAction, - SetScheduleTimestampFieldAction, - SetScheduleTypeAction, - SetSchedulingToggleAction, - SetScheduleTimezoneAction, - SetScheduleGasPriceFieldAction, - SetScheduleGasLimitFieldAction, - SetScheduleDepositFieldAction, - SetScheduleParamsValidityAction -} from '../actionTypes'; -import { TypeKeys } from 'actions/schedule/constants'; - -type TSetTimeBountyField = typeof setTimeBountyField; -const setTimeBountyField = ( - payload: SetTimeBountyFieldAction['payload'] -): SetTimeBountyFieldAction => ({ - type: TypeKeys.TIME_BOUNTY_FIELD_SET, - payload -}); - -type TSetWindowSizeField = typeof setWindowSizeField; -const setWindowSizeField = ( - payload: SetWindowSizeFieldAction['payload'] -): SetWindowSizeFieldAction => ({ - type: TypeKeys.WINDOW_SIZE_FIELD_SET, - payload -}); - -type TSetWindowStartField = typeof setWindowStartField; -const setWindowStartField = ( - payload: SetWindowStartFieldAction['payload'] -): SetWindowStartFieldAction => ({ - type: TypeKeys.WINDOW_START_FIELD_SET, - payload -}); - -type TSetScheduleTimestampField = typeof setScheduleTimestampField; -const setScheduleTimestampField = ( - payload: SetScheduleTimestampFieldAction['payload'] -): SetScheduleTimestampFieldAction => ({ - type: TypeKeys.SCHEDULE_TIMESTAMP_FIELD_SET, - payload -}); - -type TSetScheduleType = typeof setScheduleType; -const setScheduleType = (payload: SetScheduleTypeAction['payload']): SetScheduleTypeAction => ({ - type: TypeKeys.SCHEDULE_TYPE_SET, - payload -}); - -type TSetSchedulingToggle = typeof setSchedulingToggle; -const setSchedulingToggle = ( - payload: SetSchedulingToggleAction['payload'] -): SetSchedulingToggleAction => ({ - type: TypeKeys.SCHEDULING_TOGGLE_SET, - payload -}); - -type TSetScheduleTimezone = typeof setScheduleTimezone; -const setScheduleTimezone = ( - payload: SetScheduleTimezoneAction['payload'] -): SetScheduleTimezoneAction => ({ - type: TypeKeys.SCHEDULE_TIMEZONE_SET, - payload -}); - -type TSetScheduleGasPriceField = typeof setScheduleGasPriceField; -const setScheduleGasPriceField = (payload: SetScheduleGasPriceFieldAction['payload']) => ({ - type: TypeKeys.SCHEDULE_GAS_PRICE_FIELD_SET, - payload -}); - -type TSetScheduleGasLimitField = typeof setScheduleGasLimitField; -const setScheduleGasLimitField = (payload: SetScheduleGasLimitFieldAction['payload']) => ({ - type: TypeKeys.SCHEDULE_GAS_LIMIT_FIELD_SET, - payload -}); - -type TSetScheduleDepositField = typeof setScheduleDepositField; -const setScheduleDepositField = (payload: SetScheduleDepositFieldAction['payload']) => ({ - type: TypeKeys.SCHEDULE_DEPOSIT_FIELD_SET, - payload -}); - -type TSetScheduleParamsValidity = typeof setScheduleParamsValidity; -const setScheduleParamsValidity = (payload: SetScheduleParamsValidityAction['payload']) => ({ - type: TypeKeys.SCHEDULE_PARAMS_VALIDITY_SET, - payload -}); - -export { - TSetWindowSizeField, - TSetWindowStartField, - TSetTimeBountyField, - TSetScheduleTimestampField, - TSetScheduleType, - TSetSchedulingToggle, - TSetScheduleTimezone, - TSetScheduleGasPriceField, - TSetScheduleGasLimitField, - TSetScheduleDepositField, - TSetScheduleParamsValidity, - setTimeBountyField, - setWindowSizeField, - setWindowStartField, - setScheduleTimestampField, - setScheduleType, - setSchedulingToggle, - setScheduleTimezone, - setScheduleGasPriceField, - setScheduleGasLimitField, - setScheduleDepositField, - setScheduleParamsValidity -}; diff --git a/common/actions/schedule/actionCreators/index.ts b/common/actions/schedule/actionCreators/index.ts deleted file mode 100644 index a58fba82..00000000 --- a/common/actions/schedule/actionCreators/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './fields'; -export * from './scheduleTimestamp'; -export * from './scheduleType'; -export * from './schedulingToggle'; -export * from './timeBounty'; -export * from './windowSize'; -export * from './windowStart'; diff --git a/common/actions/schedule/actionCreators/scheduleTimestamp.ts b/common/actions/schedule/actionCreators/scheduleTimestamp.ts deleted file mode 100644 index caa0839c..00000000 --- a/common/actions/schedule/actionCreators/scheduleTimestamp.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { TypeKeys } from 'actions/schedule'; -import { - SetCurrentScheduleTimestampAction, - SetCurrentScheduleTimezoneAction -} from '../actionTypes/scheduleTimestamp'; - -export type TSetCurrentScheduleTimestamp = typeof setCurrentScheduleTimestamp; -export const setCurrentScheduleTimestamp = ( - payload: SetCurrentScheduleTimestampAction['payload'] -): SetCurrentScheduleTimestampAction => ({ - type: TypeKeys.CURRENT_SCHEDULE_TIMESTAMP_SET, - payload -}); - -export type TSetCurrentScheduleTimezone = typeof setCurrentScheduleTimezone; -export const setCurrentScheduleTimezone = ( - payload: SetCurrentScheduleTimezoneAction['payload'] -): SetCurrentScheduleTimezoneAction => ({ - type: TypeKeys.CURRENT_SCHEDULE_TIMEZONE_SET, - payload -}); diff --git a/common/actions/schedule/actionCreators/scheduleType.ts b/common/actions/schedule/actionCreators/scheduleType.ts deleted file mode 100644 index 9e5c78ed..00000000 --- a/common/actions/schedule/actionCreators/scheduleType.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { TypeKeys } from 'actions/schedule'; -import { SetCurrentScheduleTypeAction } from '../actionTypes/scheduleType'; - -export type TSetCurrentScheduleType = typeof setCurrentScheduleType; -export const setCurrentScheduleType = ( - payload: SetCurrentScheduleTypeAction['payload'] -): SetCurrentScheduleTypeAction => ({ - type: TypeKeys.CURRENT_SCHEDULE_TYPE, - payload -}); diff --git a/common/actions/schedule/actionCreators/schedulingToggle.ts b/common/actions/schedule/actionCreators/schedulingToggle.ts deleted file mode 100644 index 10c69a3b..00000000 --- a/common/actions/schedule/actionCreators/schedulingToggle.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SetCurrentSchedulingToggleAction } from '../actionTypes/schedulingToggle'; -import { TypeKeys } from 'actions/schedule'; - -type TSetCurrentSchedulingToggle = typeof setCurrentSchedulingToggle; -const setCurrentSchedulingToggle = ( - payload: SetCurrentSchedulingToggleAction['payload'] -): SetCurrentSchedulingToggleAction => ({ - type: TypeKeys.CURRENT_SCHEDULING_TOGGLE, - payload -}); - -export { TSetCurrentSchedulingToggle, setCurrentSchedulingToggle }; diff --git a/common/actions/schedule/actionCreators/timeBounty.ts b/common/actions/schedule/actionCreators/timeBounty.ts deleted file mode 100644 index 8d138d81..00000000 --- a/common/actions/schedule/actionCreators/timeBounty.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SetCurrentTimeBountyAction } from '../actionTypes/timeBounty'; -import { TypeKeys } from 'actions/schedule'; - -type TSetCurrentTimeBounty = typeof setCurrentTimeBounty; -const setCurrentTimeBounty = ( - payload: SetCurrentTimeBountyAction['payload'] -): SetCurrentTimeBountyAction => ({ - type: TypeKeys.CURRENT_TIME_BOUNTY_SET, - payload -}); - -export { setCurrentTimeBounty, TSetCurrentTimeBounty }; diff --git a/common/actions/schedule/actionCreators/windowSize.ts b/common/actions/schedule/actionCreators/windowSize.ts deleted file mode 100644 index 0c321801..00000000 --- a/common/actions/schedule/actionCreators/windowSize.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SetCurrentWindowSizeAction } from '../actionTypes/windowSize'; -import { TypeKeys } from 'actions/schedule'; - -type TSetCurrentWindowSize = typeof setCurrentWindowSize; -const setCurrentWindowSize = ( - payload: SetCurrentWindowSizeAction['payload'] -): SetCurrentWindowSizeAction => ({ - type: TypeKeys.CURRENT_WINDOW_SIZE_SET, - payload -}); - -export { setCurrentWindowSize, TSetCurrentWindowSize }; diff --git a/common/actions/schedule/actionCreators/windowStart.ts b/common/actions/schedule/actionCreators/windowStart.ts deleted file mode 100644 index c22a6dcb..00000000 --- a/common/actions/schedule/actionCreators/windowStart.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SetCurrentWindowStartAction } from '../actionTypes/windowStart'; -import { TypeKeys } from 'actions/schedule'; - -type TSetCurrentWindowStart = typeof setCurrentWindowStart; -const setCurrentWindowStart = ( - payload: SetCurrentWindowStartAction['payload'] -): SetCurrentWindowStartAction => ({ - type: TypeKeys.CURRENT_WINDOW_START_SET, - payload -}); - -export { setCurrentWindowStart, TSetCurrentWindowStart }; diff --git a/common/actions/schedule/actionTypes/actionTypes.ts b/common/actions/schedule/actionTypes/actionTypes.ts deleted file mode 100644 index fd0ead35..00000000 --- a/common/actions/schedule/actionTypes/actionTypes.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ScheduleFieldAction } from './fields'; - -export * from './fields'; - -export type ScheduleAction = ScheduleFieldAction; diff --git a/common/actions/schedule/actionTypes/fields.ts b/common/actions/schedule/actionTypes/fields.ts deleted file mode 100644 index 33177bd9..00000000 --- a/common/actions/schedule/actionTypes/fields.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { TypeKeys } from 'actions/schedule/constants'; -import { Wei } from 'libs/units'; - -interface SetTimeBountyFieldAction { - type: TypeKeys.TIME_BOUNTY_FIELD_SET; - payload: { - raw: string; - value: Wei | null; - }; -} - -interface SetWindowSizeFieldAction { - type: TypeKeys.WINDOW_SIZE_FIELD_SET; - payload: { - raw: string; - value: Wei | null; - }; -} - -interface SetWindowStartFieldAction { - type: TypeKeys.WINDOW_START_FIELD_SET; - payload: { - raw: string; - value: number | null; - }; -} - -interface SetScheduleTimestampFieldAction { - type: TypeKeys.SCHEDULE_TIMESTAMP_FIELD_SET; - payload: { - raw: string; - value: Date; - }; -} - -interface SetScheduleTypeAction { - type: TypeKeys.SCHEDULE_TYPE_SET; - payload: { - raw: string; - value: string | null; - }; -} - -interface SetSchedulingToggleAction { - type: TypeKeys.SCHEDULING_TOGGLE_SET; - payload: { - value: boolean; - }; -} - -interface SetScheduleTimezoneAction { - type: TypeKeys.SCHEDULE_TIMEZONE_SET; - payload: { - raw: string; - value: string; - }; -} - -interface SetScheduleGasPriceFieldAction { - type: TypeKeys.SCHEDULE_GAS_PRICE_FIELD_SET; - payload: { - raw: string; - value: Wei | null; - }; -} - -interface SetScheduleGasLimitFieldAction { - type: TypeKeys.SCHEDULE_GAS_LIMIT_FIELD_SET; - payload: { - raw: string; - value: Wei | null; - }; -} - -interface SetScheduleDepositFieldAction { - type: TypeKeys.SCHEDULE_DEPOSIT_FIELD_SET; - payload: { - raw: string; - value: Wei | null; - }; -} - -interface SetScheduleParamsValidityAction { - type: TypeKeys.SCHEDULE_PARAMS_VALIDITY_SET; - payload: { - value: boolean; - }; -} - -type ScheduleFieldAction = - | SetTimeBountyFieldAction - | SetWindowSizeFieldAction - | SetWindowStartFieldAction - | SetScheduleTimestampFieldAction - | SetScheduleTypeAction - | SetSchedulingToggleAction - | SetScheduleGasPriceFieldAction - | SetScheduleGasLimitFieldAction - | SetScheduleDepositFieldAction - | SetScheduleTimezoneAction - | SetScheduleParamsValidityAction; - -export { - ScheduleFieldAction, - SetTimeBountyFieldAction, - SetWindowSizeFieldAction, - SetWindowStartFieldAction, - SetScheduleTimestampFieldAction, - SetScheduleTypeAction, - SetSchedulingToggleAction, - SetScheduleGasPriceFieldAction, - SetScheduleGasLimitFieldAction, - SetScheduleDepositFieldAction, - SetScheduleTimezoneAction, - SetScheduleParamsValidityAction -}; diff --git a/common/actions/schedule/actionTypes/index.ts b/common/actions/schedule/actionTypes/index.ts deleted file mode 100644 index 3eb256de..00000000 --- a/common/actions/schedule/actionTypes/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './actionTypes'; diff --git a/common/actions/schedule/actionTypes/scheduleTimestamp.ts b/common/actions/schedule/actionTypes/scheduleTimestamp.ts deleted file mode 100644 index 118aeffe..00000000 --- a/common/actions/schedule/actionTypes/scheduleTimestamp.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { TypeKeys } from 'actions/schedule'; - -/* user input */ - -interface SetCurrentScheduleTimestampAction { - type: TypeKeys.CURRENT_SCHEDULE_TIMESTAMP_SET; - payload: string; -} - -type CurrentAction = SetCurrentScheduleTimestampAction; - -interface SetCurrentScheduleTimezoneAction { - type: TypeKeys.CURRENT_SCHEDULE_TIMEZONE_SET; - payload: string; -} - -export { SetCurrentScheduleTimestampAction, CurrentAction, SetCurrentScheduleTimezoneAction }; diff --git a/common/actions/schedule/actionTypes/scheduleType.ts b/common/actions/schedule/actionTypes/scheduleType.ts deleted file mode 100644 index a1cd667f..00000000 --- a/common/actions/schedule/actionTypes/scheduleType.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { TypeKeys } from 'actions/schedule'; - -/* user input */ - -interface SetCurrentScheduleTypeAction { - type: TypeKeys.CURRENT_SCHEDULE_TYPE; - payload: string; -} - -type CurrentAction = SetCurrentScheduleTypeAction; - -export { SetCurrentScheduleTypeAction, CurrentAction }; diff --git a/common/actions/schedule/actionTypes/schedulingToggle.ts b/common/actions/schedule/actionTypes/schedulingToggle.ts deleted file mode 100644 index 64fb3d93..00000000 --- a/common/actions/schedule/actionTypes/schedulingToggle.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { TypeKeys } from 'actions/schedule'; - -/* user input */ - -interface SetCurrentSchedulingToggleAction { - type: TypeKeys.CURRENT_SCHEDULING_TOGGLE; - payload: string; -} - -type CurrentAction = SetCurrentSchedulingToggleAction; - -export { SetCurrentSchedulingToggleAction, CurrentAction }; diff --git a/common/actions/schedule/actionTypes/timeBounty.ts b/common/actions/schedule/actionTypes/timeBounty.ts deleted file mode 100644 index ac35eacd..00000000 --- a/common/actions/schedule/actionTypes/timeBounty.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { TypeKeys } from 'actions/schedule'; - -/* user input */ - -interface SetCurrentTimeBountyAction { - type: TypeKeys.CURRENT_TIME_BOUNTY_SET; - payload: string; -} - -type CurrentAction = SetCurrentTimeBountyAction; - -export { SetCurrentTimeBountyAction, CurrentAction }; diff --git a/common/actions/schedule/actionTypes/windowSize.ts b/common/actions/schedule/actionTypes/windowSize.ts deleted file mode 100644 index fd1465a7..00000000 --- a/common/actions/schedule/actionTypes/windowSize.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { TypeKeys } from 'actions/schedule'; - -/* user input */ - -interface SetCurrentWindowSizeAction { - type: TypeKeys.CURRENT_WINDOW_SIZE_SET; - payload: string; -} - -type CurrentAction = SetCurrentWindowSizeAction; - -export { SetCurrentWindowSizeAction, CurrentAction }; diff --git a/common/actions/schedule/actionTypes/windowStart.ts b/common/actions/schedule/actionTypes/windowStart.ts deleted file mode 100644 index cc528316..00000000 --- a/common/actions/schedule/actionTypes/windowStart.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { TypeKeys } from 'actions/schedule'; - -/* user input */ - -interface SetCurrentWindowStartAction { - type: TypeKeys.CURRENT_WINDOW_START_SET; - payload: string; -} - -type CurrentAction = SetCurrentWindowStartAction; - -export { SetCurrentWindowStartAction, CurrentAction }; diff --git a/common/actions/schedule/constants.ts b/common/actions/schedule/constants.ts deleted file mode 100644 index c3d4b698..00000000 --- a/common/actions/schedule/constants.ts +++ /dev/null @@ -1,21 +0,0 @@ -export enum TypeKeys { - CURRENT_TIME_BOUNTY_SET = 'CURRENT_TIME_BOUNTY_SET', - CURRENT_WINDOW_SIZE_SET = 'CURRENT_WINDOW_SIZE_SET', - CURRENT_WINDOW_START_SET = 'CURRENT_WINDOW_START_SET', - CURRENT_SCHEDULE_TIMESTAMP_SET = 'CURRENT_SCHEDULE_TIMESTAMP_SET', - CURRENT_SCHEDULE_TIMEZONE_SET = 'CURRENT_SCHEDULE_TIMEZONE_SET', - CURRENT_SCHEDULE_TYPE = 'CURRENT_SCHEDULE_TYPE', - CURRENT_SCHEDULING_TOGGLE = 'CURRENT_SCHEDULING_TOGGLE', - - TIME_BOUNTY_FIELD_SET = 'TIME_BOUNTY_FIELD_SET', - WINDOW_SIZE_FIELD_SET = 'WINDOW_SIZE_FIELD_SET', - WINDOW_START_FIELD_SET = 'WINDOW_START_FIELD_SET', - SCHEDULE_GAS_PRICE_FIELD_SET = 'SCHEDULE_GAS_PRICE_SET', - SCHEDULE_GAS_LIMIT_FIELD_SET = 'SCHEDULE_GAS_LIMIT_SET', - SCHEDULE_TIMESTAMP_FIELD_SET = 'SCHEDULE_TIMESTAMP_FIELD_SET', - SCHEDULE_TIMEZONE_SET = 'SCHEDULE_TIMEZONE_SET', - SCHEDULE_TYPE_SET = 'SCHEDULE_TYPE_SET', - SCHEDULING_TOGGLE_SET = 'SCHEDULING_TOGGLE_SET', - SCHEDULE_DEPOSIT_FIELD_SET = 'SCHEDULE_DEPOSIT_FIELD_SET', - SCHEDULE_PARAMS_VALIDITY_SET = 'SCHEDULE_PARAMS_VALIDITY_SET' -} diff --git a/common/actions/schedule/index.ts b/common/actions/schedule/index.ts deleted file mode 100644 index d5122d97..00000000 --- a/common/actions/schedule/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './actionCreators'; -export * from './constants'; -export * from './actionTypes'; diff --git a/common/actions/swap/actionCreators.ts b/common/actions/swap/actionCreators.ts deleted file mode 100644 index 2958a84f..00000000 --- a/common/actions/swap/actionCreators.ts +++ /dev/null @@ -1,269 +0,0 @@ -import * as interfaces from './actionTypes'; -import { TypeKeys } from './constants'; - -export type TChangeStepSwap = typeof changeStepSwap; -export function changeStepSwap(payload: number): interfaces.ChangeStepSwapAction { - return { - type: TypeKeys.SWAP_STEP, - payload - }; -} - -export type TInitSwap = typeof initSwap; -export function initSwap(payload: interfaces.SwapInputs): interfaces.InitSwap { - return { - type: TypeKeys.SWAP_INIT, - payload - }; -} - -export type TLoadBityRatesSucceededSwap = typeof loadBityRatesSucceededSwap; -export function loadBityRatesSucceededSwap( - payload: interfaces.ApiResponse -): interfaces.LoadBityRatesSucceededSwapAction { - return { - type: TypeKeys.SWAP_LOAD_BITY_RATES_SUCCEEDED, - payload - }; -} - -export type TLoadShapeshiftRatesSucceededSwap = typeof loadShapeshiftRatesSucceededSwap; -export function loadShapeshiftRatesSucceededSwap( - payload: interfaces.LoadShapeshiftRatesSucceededSwapAction['payload'] -): interfaces.LoadShapeshiftRatesSucceededSwapAction { - return { - type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_SUCCEEDED, - payload - }; -} - -export type TDestinationAddressSwap = typeof destinationAddressSwap; -export function destinationAddressSwap(payload?: string): interfaces.DestinationAddressSwapAction { - return { - type: TypeKeys.SWAP_DESTINATION_ADDRESS, - payload - }; -} - -export type TRestartSwap = typeof restartSwap; -export function restartSwap(): interfaces.RestartSwapAction { - return { - type: TypeKeys.SWAP_RESTART - }; -} - -export type TLoadBityRatesRequestedSwap = typeof loadBityRatesRequestedSwap; -export function loadBityRatesRequestedSwap(): interfaces.LoadBityRatesRequestedSwapAction { - return { - type: TypeKeys.SWAP_LOAD_BITY_RATES_REQUESTED - }; -} - -export type TLoadShapeshiftRatesRequestedSwap = typeof loadShapeshiftRatesRequestedSwap; -export function loadShapeshiftRatesRequestedSwap(): interfaces.LoadShapeshiftRatesRequestedSwapAction { - return { - type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED - }; -} - -export type TLoadBityRatesFailedSwap = typeof loadBityRatesFailedSwap; -export function loadBityRatesFailedSwap(): interfaces.LoadBityRatesFailedSwapAction { - return { - type: TypeKeys.SWAP_LOAD_BITY_RATES_FAILED - }; -} - -export type TLoadShapeshiftFailedSwap = typeof loadShapeshiftRatesFailedSwap; -export function loadShapeshiftRatesFailedSwap(): interfaces.LoadShapeshiftRatesFailedSwapAction { - return { - type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_FAILED - }; -} - -export type TStopLoadBityRatesSwap = typeof stopLoadBityRatesSwap; -export function stopLoadBityRatesSwap(): interfaces.StopLoadBityRatesSwapAction { - return { - type: TypeKeys.SWAP_STOP_LOAD_BITY_RATES - }; -} - -export type TStopLoadShapeshiftRatesSwap = typeof stopLoadShapeshiftRatesSwap; -export function stopLoadShapeshiftRatesSwap(): interfaces.StopLoadShapeshiftRatesSwapAction { - return { - type: TypeKeys.SWAP_STOP_LOAD_SHAPESHIFT_RATES - }; -} - -export type TOrderTimeSwap = typeof orderTimeSwap; -export function orderTimeSwap(payload: number): interfaces.OrderSwapTimeSwapAction { - return { - type: TypeKeys.SWAP_ORDER_TIME, - payload - }; -} - -export type TBityOrderCreateSucceededSwap = typeof bityOrderCreateSucceededSwap; -export function bityOrderCreateSucceededSwap( - payload: interfaces.BityOrderPostResponse -): interfaces.BityOrderCreateSucceededSwapAction { - return { - type: TypeKeys.SWAP_BITY_ORDER_CREATE_SUCCEEDED, - payload - }; -} - -export type TShapeshiftOrderCreateSucceededSwap = typeof shapeshiftOrderCreateSucceededSwap; -export function shapeshiftOrderCreateSucceededSwap( - payload: interfaces.ShapeshiftOrderResponse -): interfaces.ShapeshiftOrderCreateSucceededSwapAction { - return { - type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_SUCCEEDED, - payload - }; -} - -export type TBityOrderCreateRequestedSwap = typeof bityOrderCreateRequestedSwap; -export function bityOrderCreateRequestedSwap( - amount: number, - destinationAddress: string, - pair: string, - mode: number = 0 -): interfaces.BityOrderCreateRequestedSwapAction { - return { - type: TypeKeys.SWAP_BITY_ORDER_CREATE_REQUESTED, - payload: { - amount, - destinationAddress, - pair, - mode - } - }; -} - -export type TShapeshiftOrderCreateRequestedSwap = typeof shapeshiftOrderCreateRequestedSwap; -export function shapeshiftOrderCreateRequestedSwap( - withdrawal: string, - originKind: string, - destinationKind: string, - destinationAmount: number -): interfaces.ShapeshiftOrderCreateRequestedSwapAction { - return { - type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_REQUESTED, - payload: { - withdrawal, - originKind, - destinationKind, - destinationAmount - } - }; -} - -export function bityOrderCreateFailedSwap(): interfaces.BityOrderCreateFailedSwapAction { - return { - type: TypeKeys.SWAP_BITY_ORDER_CREATE_FAILED - }; -} - -export function shapeshiftOrderCreateFailedSwap(): interfaces.ShapeshiftOrderCreateFailedSwapAction { - return { - type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_FAILED - }; -} - -export type TBityOrderStatusSucceededSwap = typeof bityOrderStatusSucceededSwap; -export function bityOrderStatusSucceededSwap( - payload: interfaces.BityOrderResponse -): interfaces.BityOrderStatusSucceededSwapAction { - return { - type: TypeKeys.SWAP_BITY_ORDER_STATUS_SUCCEEDED, - payload - }; -} - -export type TShapeshiftOrderStatusSucceededSwap = typeof shapeshiftOrderStatusSucceededSwap; -export function shapeshiftOrderStatusSucceededSwap( - payload: interfaces.ShapeshiftStatusResponse -): interfaces.ShapeshiftOrderStatusSucceededSwapAction { - return { - type: TypeKeys.SWAP_SHAPESHIFT_ORDER_STATUS_SUCCEEDED, - payload - }; -} - -export type TBityOrderStatusRequestedSwap = typeof bityOrderStatusRequested; -export function bityOrderStatusRequested(): interfaces.BityOrderStatusRequestedSwapAction { - return { - type: TypeKeys.SWAP_BITY_ORDER_STATUS_REQUESTED - }; -} - -export type TShapeshiftOrderStatusRequestedSwap = typeof shapeshiftOrderStatusRequested; -export function shapeshiftOrderStatusRequested(): interfaces.ShapeshiftOrderStatusRequestedSwapAction { - return { - type: TypeKeys.SWAP_SHAPESHIFT_ORDER_STATUS_REQUESTED - }; -} - -export type TStartOrderTimerSwap = typeof startOrderTimerSwap; -export function startOrderTimerSwap(): interfaces.StartOrderTimerSwapAction { - return { - type: TypeKeys.SWAP_ORDER_START_TIMER - }; -} - -export type TStopOrderTimerSwap = typeof stopOrderTimerSwap; -export function stopOrderTimerSwap(): interfaces.StopOrderTimerSwapAction { - return { - type: TypeKeys.SWAP_ORDER_STOP_TIMER - }; -} - -export type TStartPollBityOrderStatus = typeof startPollBityOrderStatus; -export function startPollBityOrderStatus(): interfaces.StartPollBityOrderStatusAction { - return { - type: TypeKeys.SWAP_START_POLL_BITY_ORDER_STATUS - }; -} - -export type TStartPollShapeshiftOrderStatus = typeof startPollShapeshiftOrderStatus; -export function startPollShapeshiftOrderStatus(): interfaces.StartPollShapeshiftOrderStatusAction { - return { - type: TypeKeys.SWAP_START_POLL_SHAPESHIFT_ORDER_STATUS - }; -} - -export type TStopPollBityOrderStatus = typeof stopPollBityOrderStatus; -export function stopPollBityOrderStatus(): interfaces.StopPollBityOrderStatusAction { - return { - type: TypeKeys.SWAP_STOP_POLL_BITY_ORDER_STATUS - }; -} - -export type TStopPollShapeshiftOrderStatus = typeof stopPollShapeshiftOrderStatus; -export function stopPollShapeshiftOrderStatus(): interfaces.StopPollShapeshiftOrderStatusAction { - return { - type: TypeKeys.SWAP_STOP_POLL_SHAPESHIFT_ORDER_STATUS - }; -} - -export type TConfigureLiteSend = typeof configureLiteSend; -export function configureLiteSend(): interfaces.ConfigureLiteSendAction { - return { type: TypeKeys.SWAP_CONFIGURE_LITE_SEND }; -} - -export type TShowLiteSend = typeof showLiteSend; -export function showLiteSend( - payload: interfaces.ShowLiteSendAction['payload'] -): interfaces.ShowLiteSendAction { - return { type: TypeKeys.SWAP_SHOW_LITE_SEND, payload }; -} - -export type TChangeSwapProvider = typeof changeSwapProvider; -export function changeSwapProvider( - payload: interfaces.ProviderName -): interfaces.ChangeProviderSwapAcion { - return { - type: TypeKeys.SWAP_CHANGE_PROVIDER, - payload - }; -} diff --git a/common/actions/swap/actionTypes.ts b/common/actions/swap/actionTypes.ts deleted file mode 100644 index b5b636e1..00000000 --- a/common/actions/swap/actionTypes.ts +++ /dev/null @@ -1,272 +0,0 @@ -import { TypeKeys } from './constants'; - -export interface Pairs { - ETHBTC: number; - ETHREP: number; - BTCETH: number; - BTCREP: number; -} - -export interface SwapInput { - label: string; - amount: number | string; -} - -export interface SwapInputs { - origin: SwapInput; - destination: SwapInput; -} - -export interface InitSwap { - type: TypeKeys.SWAP_INIT; - payload: SwapInputs; -} - -export interface Option { - id: string; - status?: string; - image?: string; -} - -export interface ApiResponseObj { - id: string; - options: Option[]; - rate: number; -} - -export interface ApiResponse { - [name: string]: ApiResponseObj; -} - -export interface LoadBityRatesSucceededSwapAction { - type: TypeKeys.SWAP_LOAD_BITY_RATES_SUCCEEDED; - payload: ApiResponse; -} - -export interface LoadShapeshiftRatesSucceededSwapAction { - type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_SUCCEEDED; - payload: ApiResponse; -} - -export interface DestinationAddressSwapAction { - type: TypeKeys.SWAP_DESTINATION_ADDRESS; - payload?: string; -} - -export interface RestartSwapAction { - type: TypeKeys.SWAP_RESTART; -} - -export interface LoadBityRatesRequestedSwapAction { - type: TypeKeys.SWAP_LOAD_BITY_RATES_REQUESTED; -} - -export interface LoadShapeshiftRatesRequestedSwapAction { - type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED; -} - -export interface LoadBityRatesFailedSwapAction { - type: TypeKeys.SWAP_LOAD_BITY_RATES_FAILED; -} - -export interface LoadShapeshiftRatesFailedSwapAction { - type: TypeKeys.SWAP_LOAD_SHAPESHIFT_RATES_FAILED; -} - -export interface ChangeStepSwapAction { - type: TypeKeys.SWAP_STEP; - payload: number; -} - -export interface StopLoadBityRatesSwapAction { - type: TypeKeys.SWAP_STOP_LOAD_BITY_RATES; -} - -export interface StopLoadShapeshiftRatesSwapAction { - type: TypeKeys.SWAP_STOP_LOAD_SHAPESHIFT_RATES; -} - -export interface OrderSwapTimeSwapAction { - type: TypeKeys.SWAP_ORDER_TIME; - payload: number; -} - -export interface BityOrderCreateRequestedSwapAction { - type: TypeKeys.SWAP_BITY_ORDER_CREATE_REQUESTED; - payload: { - amount: number; - destinationAddress: string; - pair: string; - mode: number; - }; -} - -export interface ShapeshiftOrderCreateRequestedSwapAction { - type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_REQUESTED; - payload: { - withdrawal: string; - originKind: string; - destinationKind: string; - destinationAmount: number; - }; -} - -export interface BityOrderInput { - amount: string; - currency: string; - reference: string; - status: string; -} - -export interface BityOrderOutput { - amount: string; - currency: string; - reference: string; - status: string; -} - -export interface BityOrderResponse { - input: BityOrderInput; - output: BityOrderOutput; - status: string; -} - -export interface ShapeshiftOrderResponse { - apiPubKey?: string; - deposit: string; - depositAmount: string; - expiration: number; - expirationFormatted?: string; - inputCurrency?: string; - maxLimit: number; - minerFee: string; - orderId: string; - outputCurrency?: string; - pair: string; // e.g. eth_bat - provider?: ProviderName; // shapeshift - quotedRate: string; - withdrawal: string; - withdrawalAmount: string; -} - -export interface ShapeshiftStatusResponse { - status: string; - address?: string; - withdraw?: string; - transaction: string; -} - -export type BityOrderPostResponse = BityOrderResponse & { - payment_address: string; - status: string; - input: BityOrderInput; - output: BityOrderOutput; - timestamp_created: string; - validFor: number; - id: string; -}; - -export type ProviderName = 'shapeshift' | 'bity'; - -export interface BityOrderCreateSucceededSwapAction { - type: TypeKeys.SWAP_BITY_ORDER_CREATE_SUCCEEDED; - payload: BityOrderPostResponse; -} - -export interface ShapeshiftOrderCreateSucceededSwapAction { - type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_SUCCEEDED; - payload: ShapeshiftOrderResponse; -} - -export interface BityOrderCreateFailedSwapAction { - type: TypeKeys.SWAP_BITY_ORDER_CREATE_FAILED; -} - -export interface ShapeshiftOrderCreateFailedSwapAction { - type: TypeKeys.SWAP_SHAPESHIFT_ORDER_CREATE_FAILED; -} - -export interface BityOrderStatusRequestedSwapAction { - type: TypeKeys.SWAP_BITY_ORDER_STATUS_REQUESTED; -} - -export interface ShapeshiftOrderStatusRequestedSwapAction { - type: TypeKeys.SWAP_SHAPESHIFT_ORDER_STATUS_REQUESTED; -} - -export interface BityOrderStatusSucceededSwapAction { - type: TypeKeys.SWAP_BITY_ORDER_STATUS_SUCCEEDED; - payload: BityOrderResponse; -} - -export interface ShapeshiftOrderStatusSucceededSwapAction { - type: TypeKeys.SWAP_SHAPESHIFT_ORDER_STATUS_SUCCEEDED; - payload: ShapeshiftStatusResponse; -} - -export interface StartOrderTimerSwapAction { - type: TypeKeys.SWAP_ORDER_START_TIMER; -} - -export interface StopOrderTimerSwapAction { - type: TypeKeys.SWAP_ORDER_STOP_TIMER; -} - -export interface StartPollBityOrderStatusAction { - type: TypeKeys.SWAP_START_POLL_BITY_ORDER_STATUS; -} - -export interface StartPollShapeshiftOrderStatusAction { - type: TypeKeys.SWAP_START_POLL_SHAPESHIFT_ORDER_STATUS; -} - -export interface StopPollBityOrderStatusAction { - type: TypeKeys.SWAP_STOP_POLL_BITY_ORDER_STATUS; -} - -export interface StopPollShapeshiftOrderStatusAction { - type: TypeKeys.SWAP_STOP_POLL_SHAPESHIFT_ORDER_STATUS; -} - -export interface ChangeProviderSwapAcion { - type: TypeKeys.SWAP_CHANGE_PROVIDER; - payload: ProviderName; -} - -export interface ConfigureLiteSendAction { - type: TypeKeys.SWAP_CONFIGURE_LITE_SEND; -} - -export interface ShowLiteSendAction { - type: TypeKeys.SWAP_SHOW_LITE_SEND; - payload: boolean; -} - -/*** Action Type Union ***/ -export type SwapAction = - | ChangeStepSwapAction - | InitSwap - | DestinationAddressSwapAction - | RestartSwapAction - | LoadBityRatesRequestedSwapAction - | LoadBityRatesSucceededSwapAction - | LoadBityRatesFailedSwapAction - | LoadShapeshiftRatesRequestedSwapAction - | LoadShapeshiftRatesSucceededSwapAction - | LoadShapeshiftRatesFailedSwapAction - | StopLoadBityRatesSwapAction - | StopLoadShapeshiftRatesSwapAction - | BityOrderCreateRequestedSwapAction - | ShapeshiftOrderCreateRequestedSwapAction - | BityOrderCreateSucceededSwapAction - | ShapeshiftOrderCreateSucceededSwapAction - | BityOrderStatusSucceededSwapAction - | ShapeshiftOrderStatusSucceededSwapAction - | StartPollBityOrderStatusAction - | StartPollShapeshiftOrderStatusAction - | BityOrderCreateFailedSwapAction - | ShapeshiftOrderCreateFailedSwapAction - | OrderSwapTimeSwapAction - | ChangeProviderSwapAcion - | ConfigureLiteSendAction - | ShowLiteSendAction; diff --git a/common/actions/swap/constants.ts b/common/actions/swap/constants.ts deleted file mode 100644 index 1fdfc4f3..00000000 --- a/common/actions/swap/constants.ts +++ /dev/null @@ -1,34 +0,0 @@ -export enum TypeKeys { - SWAP_STEP = 'SWAP_STEP', - SWAP_INIT = 'SWAP_INIT', - SWAP_LOAD_BITY_RATES_SUCCEEDED = 'SWAP_LOAD_BITY_RATES_SUCCEEDED', - SWAP_LOAD_SHAPESHIFT_RATES_SUCCEEDED = 'SWAP_LOAD_SHAPESHIFT_RATES_SUCCEEDED', - SWAP_DESTINATION_ADDRESS = 'SWAP_DESTINATION_ADDRESS', - SWAP_RESTART = 'SWAP_RESTART', - SWAP_LOAD_BITY_RATES_REQUESTED = 'SWAP_LOAD_BITY_RATES_REQUESTED', - SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED = 'SWAP_LOAD_SHAPESHIFT_RATES_REQUESTED', - SWAP_LOAD_BITY_RATES_FAILED = 'SWAP_LOAD_BITY_RATES_FAILED', - SWAP_LOAD_SHAPESHIFT_RATES_FAILED = 'SWAP_LOAD_SHAPESHIFT_RATES_FAILED', - SWAP_STOP_LOAD_BITY_RATES = 'SWAP_STOP_LOAD_BITY_RATES', - SWAP_STOP_LOAD_SHAPESHIFT_RATES = 'SWAP_STOP_LOAD_SHAPESHIFT_RATES', - SWAP_ORDER_TIME = 'SWAP_ORDER_TIME', - SWAP_BITY_ORDER_CREATE_SUCCEEDED = 'SWAP_BITY_ORDER_CREATE_SUCCEEDED', - SWAP_SHAPESHIFT_ORDER_CREATE_SUCCEEDED = 'SWAP_SHAPESHIFT_ORDER_CREATE_SUCCEEDED', - SWAP_BITY_ORDER_STATUS_SUCCEEDED = 'SWAP_BITY_ORDER_STATUS_SUCCEEDED', - SWAP_SHAPESHIFT_ORDER_STATUS_SUCCEEDED = 'SWAP_SHAPESHIFT_ORDER_STATUS_SUCCEEDED', - SWAP_BITY_ORDER_STATUS_REQUESTED = 'SWAP_BITY_ORDER_STATUS_REQUESTED', - SWAP_SHAPESHIFT_ORDER_STATUS_REQUESTED = 'SWAP_SHAPESHIFT_ORDER_STATUS_REQUESTED', - SWAP_ORDER_START_TIMER = 'SWAP_ORDER_START_TIMER', - SWAP_ORDER_STOP_TIMER = 'SWAP_ORDER_STOP_TIMER', - SWAP_START_POLL_BITY_ORDER_STATUS = 'SWAP_START_POLL_BITY_ORDER_STATUS', - SWAP_START_POLL_SHAPESHIFT_ORDER_STATUS = 'SWAP_START_POLL_SHAPESHIFT_ORDER_STATUS', - SWAP_STOP_POLL_BITY_ORDER_STATUS = 'SWAP_STOP_POLL_BITY_ORDER_STATUS', - SWAP_STOP_POLL_SHAPESHIFT_ORDER_STATUS = 'SWAP_STOP_POLL_SHAPESHIFT_ORDER_STATUS', - SWAP_BITY_ORDER_CREATE_REQUESTED = 'SWAP_ORDER_CREATE_REQUESTED', - SWAP_SHAPESHIFT_ORDER_CREATE_REQUESTED = 'SWAP_SHAPESHIFT_ORDER_CREATE_REQUESTED', - SWAP_BITY_ORDER_CREATE_FAILED = 'SWAP_ORDER_CREATE_FAILED', - SWAP_SHAPESHIFT_ORDER_CREATE_FAILED = 'SWAP_SHAPESHIFT_ORDER_CREATE_FAILED', - SWAP_CHANGE_PROVIDER = 'SWAP_CHANGE_PROVIDER', - SWAP_CONFIGURE_LITE_SEND = 'SWAP_CONFIGURE_LITE_SEND', - SWAP_SHOW_LITE_SEND = 'SWAP_SHOW_LITE_SEND' -} diff --git a/common/actions/swap/index.ts b/common/actions/swap/index.ts deleted file mode 100644 index 2608a18e..00000000 --- a/common/actions/swap/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './actionTypes'; -export * from './actionCreators'; diff --git a/common/actions/transaction/actionCreators/broadcast.ts b/common/actions/transaction/actionCreators/broadcast.ts deleted file mode 100644 index 1b50d676..00000000 --- a/common/actions/transaction/actionCreators/broadcast.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { - BroadcastLocalTransactionRequestedAction, - BroadcastWeb3TransactionRequestedAction, - BroadcastTransactionFailedAction, - BroadcastTransactionSucceededAction, - BroadcastTransactionQueuedAction -} from '../actionTypes'; -import { TypeKeys } from '../constants'; - -type TBroadcastLocalTransactionRequested = typeof broadcastLocalTransactionRequested; -const broadcastLocalTransactionRequested = (): BroadcastLocalTransactionRequestedAction => ({ - type: TypeKeys.BROADCAST_LOCAL_TRANSACTION_REQUESTED -}); - -type TBroadcastWeb3TransactionRequested = typeof broadcastWeb3TransactionRequested; -const broadcastWeb3TransactionRequested = (): BroadcastWeb3TransactionRequestedAction => ({ - type: TypeKeys.BROADCAST_WEB3_TRANSACTION_REQUESTED -}); - -type TBroadcastTransactionSucceeded = typeof broadcastTransactionSucceeded; -const broadcastTransactionSucceeded = ( - payload: BroadcastTransactionSucceededAction['payload'] -): BroadcastTransactionSucceededAction => ({ - type: TypeKeys.BROADCAST_TRANSACTION_SUCCEEDED, - payload -}); - -type TBroadcastTransactionFailed = typeof broadcastTransactionFailed; -const broadcastTransactionFailed = ( - payload: BroadcastTransactionFailedAction['payload'] -): BroadcastTransactionFailedAction => ({ - type: TypeKeys.BROADCAST_TRASACTION_FAILED, - payload -}); - -type TBroadcastTransactionQueued = typeof broadcastTransactionQueued; -const broadcastTransactionQueued = ( - payload: BroadcastTransactionQueuedAction['payload'] -): BroadcastTransactionQueuedAction => ({ - type: TypeKeys.BROADCAST_TRANSACTION_QUEUED, - payload -}); - -export { - broadcastLocalTransactionRequested, - broadcastWeb3TransactionRequested, - broadcastTransactionSucceeded, - broadcastTransactionFailed, - broadcastTransactionQueued, - TBroadcastLocalTransactionRequested, - TBroadcastWeb3TransactionRequested, - TBroadcastTransactionSucceeded, - TBroadcastTransactionFailed, - TBroadcastTransactionQueued -}; diff --git a/common/actions/transaction/actionCreators/current.ts b/common/actions/transaction/actionCreators/current.ts deleted file mode 100644 index c9c1f29b..00000000 --- a/common/actions/transaction/actionCreators/current.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { SetCurrentToAction, SetCurrentValueAction } from '../actionTypes/current'; -import { TypeKeys } from '../'; - -type TSetCurrentValue = typeof setCurrentValue; -const setCurrentValue = (payload: SetCurrentValueAction['payload']): SetCurrentValueAction => ({ - type: TypeKeys.CURRENT_VALUE_SET, - payload -}); - -type TSetCurrentTo = typeof setCurrentTo; -const setCurrentTo = (payload: SetCurrentToAction['payload']): SetCurrentToAction => ({ - type: TypeKeys.CURRENT_TO_SET, - payload -}); - -export { setCurrentValue, setCurrentTo, TSetCurrentTo, TSetCurrentValue }; diff --git a/common/actions/transaction/actionCreators/fields.ts b/common/actions/transaction/actionCreators/fields.ts deleted file mode 100644 index 2df5bb1a..00000000 --- a/common/actions/transaction/actionCreators/fields.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { - SetGasLimitFieldAction, - SetDataFieldAction, - SetToFieldAction, - SetNonceFieldAction, - SetValueFieldAction, - InputGasLimitAction, - InputGasPriceAction, - InputGasPriceIntentAction, - InputDataAction, - InputNonceAction, - ResetTransactionRequestedAction, - ResetTransactionSuccessfulAction, - SetGasPriceFieldAction -} from '../actionTypes'; -import { TypeKeys } from 'actions/transaction/constants'; - -type TInputGasLimit = typeof inputGasLimit; -const inputGasLimit = (payload: InputGasLimitAction['payload']) => ({ - type: TypeKeys.GAS_LIMIT_INPUT, - payload -}); - -type TInputGasPrice = typeof inputGasPrice; -const inputGasPrice = (payload: InputGasPriceAction['payload']) => ({ - type: TypeKeys.GAS_PRICE_INPUT, - payload -}); - -type TInputGasPriceIntent = typeof inputGasPrice; -const inputGasPriceIntent = (payload: InputGasPriceIntentAction['payload']) => ({ - type: TypeKeys.GAS_PRICE_INPUT_INTENT, - payload -}); - -type TInputNonce = typeof inputNonce; -const inputNonce = (payload: InputNonceAction['payload']) => ({ - type: TypeKeys.NONCE_INPUT, - payload -}); - -type TInputData = typeof inputData; -const inputData = (payload: InputDataAction['payload']) => ({ - type: TypeKeys.DATA_FIELD_INPUT, - payload -}); - -type TSetGasLimitField = typeof setGasLimitField; -const setGasLimitField = (payload: SetGasLimitFieldAction['payload']): SetGasLimitFieldAction => ({ - type: TypeKeys.GAS_LIMIT_FIELD_SET, - payload -}); - -type TSetDataField = typeof setDataField; -const setDataField = (payload: SetDataFieldAction['payload']): SetDataFieldAction => ({ - type: TypeKeys.DATA_FIELD_SET, - payload -}); - -type TSetToField = typeof setToField; -const setToField = (payload: SetToFieldAction['payload']): SetToFieldAction => ({ - type: TypeKeys.TO_FIELD_SET, - payload -}); - -type TSetNonceField = typeof setNonceField; -const setNonceField = (payload: SetNonceFieldAction['payload']): SetNonceFieldAction => ({ - type: TypeKeys.NONCE_FIELD_SET, - payload -}); - -type TSetValueField = typeof setValueField; -const setValueField = (payload: SetValueFieldAction['payload']): SetValueFieldAction => ({ - type: TypeKeys.VALUE_FIELD_SET, - payload -}); - -type TSetGasPriceField = typeof setGasPriceField; -const setGasPriceField = (payload: SetGasPriceFieldAction['payload']): SetGasPriceFieldAction => ({ - type: TypeKeys.GAS_PRICE_FIELD_SET, - payload -}); - -type TResetTransactionRequested = typeof resetTransactionRequested; -const resetTransactionRequested = (): ResetTransactionRequestedAction => ({ - type: TypeKeys.RESET_REQUESTED -}); - -type TResetTransactionSuccessful = typeof resetTransactionSuccessful; -const resetTransactionSuccessful = ( - payload: ResetTransactionSuccessfulAction['payload'] -): ResetTransactionSuccessfulAction => ({ - type: TypeKeys.RESET_SUCCESSFUL, - payload -}); - -export { - TInputGasLimit, - TInputGasPrice, - TInputGasPriceIntent, - TInputNonce, - TInputData, - TSetGasLimitField, - TSetDataField, - TSetToField, - TSetNonceField, - TSetValueField, - TSetGasPriceField, - TResetTransactionRequested, - TResetTransactionSuccessful, - inputGasLimit, - inputGasPrice, - inputGasPriceIntent, - inputNonce, - inputData, - setGasLimitField, - setDataField, - setToField, - setNonceField, - setValueField, - setGasPriceField, - resetTransactionRequested, - resetTransactionSuccessful -}; diff --git a/common/actions/transaction/actionCreators/index.ts b/common/actions/transaction/actionCreators/index.ts deleted file mode 100644 index 32cc4be7..00000000 --- a/common/actions/transaction/actionCreators/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './fields'; -export * from './meta'; -export * from './network'; -export * from './sign'; -export * from './broadcast'; -export * from './current'; -export * from './sendEverything'; diff --git a/common/actions/transaction/actionCreators/meta.ts b/common/actions/transaction/actionCreators/meta.ts deleted file mode 100644 index 912d586f..00000000 --- a/common/actions/transaction/actionCreators/meta.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { - TypeKeys, - SetUnitMetaAction, - SetTokenValueMetaAction, - SetTokenToMetaAction, - SetAsContractInteractionAction, - SetAsViewAndSendAction -} from 'actions/transaction'; - -export type TSetTokenTo = typeof setTokenTo; -export const setTokenTo = (payload: SetTokenToMetaAction['payload']): SetTokenToMetaAction => ({ - type: TypeKeys.TOKEN_TO_META_SET, - payload -}); - -export type TSetTokenValue = typeof setTokenValue; -export const setTokenValue = ( - payload: SetTokenValueMetaAction['payload'] -): SetTokenValueMetaAction => ({ - type: TypeKeys.TOKEN_VALUE_META_SET, - payload -}); - -export type TSetUnitMeta = typeof setUnitMeta; -export const setUnitMeta = (payload: SetUnitMetaAction['payload']): SetUnitMetaAction => ({ - type: TypeKeys.UNIT_META_SET, - payload -}); - -export type TSetAsContractInteraction = typeof setAsContractInteraction; -export const setAsContractInteraction = (): SetAsContractInteractionAction => ({ - type: TypeKeys.IS_CONTRACT_INTERACTION -}); - -export type TSetAsViewAndSend = typeof setAsViewAndSend; -export const setAsViewAndSend = (): SetAsViewAndSendAction => ({ type: TypeKeys.IS_VIEW_AND_SEND }); diff --git a/common/actions/transaction/actionCreators/network.ts b/common/actions/transaction/actionCreators/network.ts deleted file mode 100644 index 94aa6f25..00000000 --- a/common/actions/transaction/actionCreators/network.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { - TypeKeys, - EstimateGasFailedAction, - EstimateGasRequestedAction, - EstimateGasTimeoutAction, - EstimateGasSucceededAction, - GetFromRequestedAction, - GetFromSucceededAction, - GetFromFailedAction, - GetNonceRequestedAction, - GetNonceSucceededAction, - GetNonceFailedAction -} from 'actions/transaction'; - -type TEstimateGasRequested = typeof estimateGasRequested; -const estimateGasRequested = ( - payload: EstimateGasRequestedAction['payload'] -): EstimateGasRequestedAction => ({ - type: TypeKeys.ESTIMATE_GAS_REQUESTED, - payload -}); - -type TEstimateGasSucceeded = typeof estimateGasSucceeded; -const estimateGasSucceeded = (): EstimateGasSucceededAction => ({ - type: TypeKeys.ESTIMATE_GAS_SUCCEEDED -}); - -type TEstimateGasFailed = typeof estimateGasFailed; -const estimateGasFailed = (): EstimateGasFailedAction => ({ - type: TypeKeys.ESTIMATE_GAS_FAILED -}); - -type TEstimateGasTimedout = typeof estimateGasTimedout; -const estimateGasTimedout = (): EstimateGasTimeoutAction => ({ - type: TypeKeys.ESTIMATE_GAS_TIMEDOUT -}); - -type TGetFromRequested = typeof getFromRequested; -const getFromRequested = (): GetFromRequestedAction => ({ - type: TypeKeys.GET_FROM_REQUESTED -}); - -type TGetFromSucceeded = typeof getFromSucceeded; -const getFromSucceeded = (payload: GetFromSucceededAction['payload']): GetFromSucceededAction => ({ - type: TypeKeys.GET_FROM_SUCCEEDED, - payload -}); - -type TGetFromFailed = typeof getFromFailed; -const getFromFailed = (): GetFromFailedAction => ({ - type: TypeKeys.GET_FROM_FAILED -}); - -type TGetNonceRequested = typeof getNonceRequested; -const getNonceRequested = (): GetNonceRequestedAction => ({ - type: TypeKeys.GET_NONCE_REQUESTED -}); - -type TGetNonceSucceeded = typeof getNonceSucceeded; -const getNonceSucceeded = ( - payload: GetNonceSucceededAction['payload'] -): GetNonceSucceededAction => ({ type: TypeKeys.GET_NONCE_SUCCEEDED, payload }); - -type TGetNonceFailed = typeof getNonceFailed; -const getNonceFailed = (): GetNonceFailedAction => ({ - type: TypeKeys.GET_NONCE_FAILED -}); - -export { - estimateGasRequested, - estimateGasFailed, - estimateGasTimedout, - estimateGasSucceeded, - getFromRequested, - getFromSucceeded, - getFromFailed, - getNonceRequested, - getNonceFailed, - getNonceSucceeded, - TEstimateGasRequested, - TEstimateGasFailed, - TEstimateGasSucceeded, - TEstimateGasTimedout, - TGetFromRequested, - TGetFromSucceeded, - TGetNonceRequested, - TGetNonceSucceeded, - TGetNonceFailed, - TGetFromFailed -}; diff --git a/common/actions/transaction/actionCreators/sendEverything.ts b/common/actions/transaction/actionCreators/sendEverything.ts deleted file mode 100644 index c9a86471..00000000 --- a/common/actions/transaction/actionCreators/sendEverything.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { - SendEverythingFailedAction, - SendEverythingRequestedAction, - SendEverythingSucceededAction -} from '../actionTypes/sendEverything'; -import { TypeKeys } from 'actions/transaction'; - -type TSendEverythingRequested = typeof sendEverythingRequested; -const sendEverythingRequested = (): SendEverythingRequestedAction => ({ - type: TypeKeys.SEND_EVERYTHING_REQUESTED -}); - -type TSendEverythingFailed = typeof sendEverythingFailed; -const sendEverythingFailed = (): SendEverythingFailedAction => ({ - type: TypeKeys.SEND_EVERYTHING_FAILED -}); - -type TSendEverythingSucceeded = typeof sendEverythingSucceeded; -const sendEverythingSucceeded = (): SendEverythingSucceededAction => ({ - type: TypeKeys.SEND_EVERYTHING_SUCCEEDED -}); - -export { - TSendEverythingRequested, - TSendEverythingFailed, - TSendEverythingSucceeded, - sendEverythingRequested, - sendEverythingFailed, - sendEverythingSucceeded -}; diff --git a/common/actions/transaction/actionCreators/sign.ts b/common/actions/transaction/actionCreators/sign.ts deleted file mode 100644 index 2ede9c25..00000000 --- a/common/actions/transaction/actionCreators/sign.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - SignTransactionFailedAction, - SignLocalTransactionSucceededAction, - SignWeb3TransactionSucceededAction, - SignTransactionRequestedAction -} from '../actionTypes'; -import { TypeKeys } from '../constants'; - -type TSignTransactionFailed = typeof signTransactionFailed; -const signTransactionFailed = (): SignTransactionFailedAction => ({ - type: TypeKeys.SIGN_TRANSACTION_FAILED -}); - -type TSignTransactionRequested = typeof signTransactionRequested; -const signTransactionRequested = (payload: SignTransactionRequestedAction['payload']) => ({ - type: TypeKeys.SIGN_TRANSACTION_REQUESTED, - payload -}); - -type TSignLocalTransactionSucceeded = typeof signLocalTransactionSucceeded; -const signLocalTransactionSucceeded = ( - payload: SignLocalTransactionSucceededAction['payload'] -): SignLocalTransactionSucceededAction => ({ - type: TypeKeys.SIGN_LOCAL_TRANSACTION_SUCCEEDED, - payload -}); - -type TSignWeb3TransactionSucceeded = typeof signWeb3TransactionSucceeded; -const signWeb3TransactionSucceeded = ( - payload: SignWeb3TransactionSucceededAction['payload'] -): SignWeb3TransactionSucceededAction => ({ - type: TypeKeys.SIGN_WEB3_TRANSACTION_SUCCEEDED, - payload -}); - -export { - signTransactionRequested, - signTransactionFailed, - signLocalTransactionSucceeded, - signWeb3TransactionSucceeded, - TSignLocalTransactionSucceeded, - TSignWeb3TransactionSucceeded, - TSignTransactionFailed, - TSignTransactionRequested -}; diff --git a/common/actions/transaction/actionCreators/swap.ts b/common/actions/transaction/actionCreators/swap.ts deleted file mode 100644 index be92e192..00000000 --- a/common/actions/transaction/actionCreators/swap.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { - SwapEtherToTokenAction, - SwapTokenToEtherAction, - SwapTokenToTokenAction -} from '../actionTypes'; -import { TypeKeys } from '../constants'; - -type TSwapTokenToEther = typeof swapTokenToEther; -const swapTokenToEther = (payload: SwapTokenToEtherAction['payload']): SwapTokenToEtherAction => ({ - type: TypeKeys.TOKEN_TO_ETHER_SWAP, - payload -}); - -type TSwapEtherToToken = typeof swapEtherToToken; -const swapEtherToToken = (payload: SwapEtherToTokenAction['payload']): SwapEtherToTokenAction => ({ - payload, - type: TypeKeys.ETHER_TO_TOKEN_SWAP -}); - -type TSwapTokenToToken = typeof swapTokenToToken; -const swapTokenToToken = (payload: SwapTokenToTokenAction['payload']): SwapTokenToTokenAction => ({ - payload, - type: TypeKeys.TOKEN_TO_TOKEN_SWAP -}); - -export { - swapEtherToToken, - swapTokenToEther, - swapTokenToToken, - TSwapTokenToEther, - TSwapEtherToToken, - TSwapTokenToToken -}; diff --git a/common/actions/transaction/actionTypes/actionTypes.ts b/common/actions/transaction/actionTypes/actionTypes.ts deleted file mode 100644 index fb7863ee..00000000 --- a/common/actions/transaction/actionTypes/actionTypes.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { TypeKeys } from '../constants'; -import { BroadcastAction } from './broadcast'; -import { FieldAction, InputFieldAction } from './fields'; -import { MetaAction } from './meta'; -import { NetworkAction } from './network'; -import { SignAction } from './sign'; -import { SwapAction } from './swap'; -import { CurrentAction } from './current'; -import { SendEverythingAction } from './sendEverything'; - -export * from './broadcast'; -export * from './fields'; -export * from './meta'; -export * from './network'; -export * from './sign'; -export * from './swap'; -export * from './current'; -export * from './sendEverything'; - -export interface ResetTransactionRequestedAction { - type: TypeKeys.RESET_REQUESTED; -} - -export interface ResetTransactionSuccessfulAction { - type: TypeKeys.RESET_SUCCESSFUL; - payload: { isContractInteraction: boolean }; -} - -export type TransactionAction = - | InputFieldAction - | BroadcastAction - | FieldAction - | MetaAction - | NetworkAction - | SignAction - | SwapAction - | ResetTransactionRequestedAction - | ResetTransactionSuccessfulAction - | CurrentAction - | SendEverythingAction; diff --git a/common/actions/transaction/actionTypes/broadcast.ts b/common/actions/transaction/actionTypes/broadcast.ts deleted file mode 100644 index 7cefd93d..00000000 --- a/common/actions/transaction/actionTypes/broadcast.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { TypeKeys } from 'actions/transaction'; -/* Broadcasting actions */ -interface BroadcastLocalTransactionRequestedAction { - type: TypeKeys.BROADCAST_LOCAL_TRANSACTION_REQUESTED; -} -interface BroadcastWeb3TransactionRequestedAction { - type: TypeKeys.BROADCAST_WEB3_TRANSACTION_REQUESTED; -} -interface BroadcastTransactionSucceededAction { - type: TypeKeys.BROADCAST_TRANSACTION_SUCCEEDED; - payload: { indexingHash: string; broadcastedHash: string }; -} -interface BroadcastTransactionQueuedAction { - type: TypeKeys.BROADCAST_TRANSACTION_QUEUED; - payload: { indexingHash: string; serializedTransaction: Buffer }; -} -interface BroadcastTransactionFailedAction { - type: TypeKeys.BROADCAST_TRASACTION_FAILED; - payload: { indexingHash: string }; -} -type BroadcastAction = - | BroadcastLocalTransactionRequestedAction - | BroadcastTransactionSucceededAction - | BroadcastWeb3TransactionRequestedAction - | BroadcastTransactionQueuedAction - | BroadcastTransactionFailedAction; - -export { - BroadcastLocalTransactionRequestedAction, - BroadcastTransactionSucceededAction, - BroadcastWeb3TransactionRequestedAction, - BroadcastTransactionQueuedAction, - BroadcastTransactionFailedAction, - BroadcastAction -}; diff --git a/common/actions/transaction/actionTypes/current.ts b/common/actions/transaction/actionTypes/current.ts deleted file mode 100644 index 643022c6..00000000 --- a/common/actions/transaction/actionTypes/current.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { TypeKeys } from '../constants'; - -/* user input */ - -interface SetCurrentValueAction { - type: TypeKeys.CURRENT_VALUE_SET; - payload: string; -} - -interface SetCurrentToAction { - type: TypeKeys.CURRENT_TO_SET; - payload: string; -} - -type CurrentAction = SetCurrentValueAction | SetCurrentToAction; - -export { SetCurrentValueAction, SetCurrentToAction, CurrentAction }; diff --git a/common/actions/transaction/actionTypes/fields.ts b/common/actions/transaction/actionTypes/fields.ts deleted file mode 100644 index a4183a94..00000000 --- a/common/actions/transaction/actionTypes/fields.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { TypeKeys } from 'actions/transaction/constants'; -import { Wei, Data, Address, Nonce } from 'libs/units'; - -/* User Input */ -interface InputGasLimitAction { - type: TypeKeys.GAS_LIMIT_INPUT; - payload: string; -} -interface InputGasPriceAction { - type: TypeKeys.GAS_PRICE_INPUT; - payload: string; -} -interface InputGasPriceIntentAction { - type: TypeKeys.GAS_PRICE_INPUT_INTENT; - payload: string; -} -interface InputDataAction { - type: TypeKeys.DATA_FIELD_INPUT; - payload: string; -} -interface InputNonceAction { - type: TypeKeys.NONCE_INPUT; - payload: string; -} - -/*Field Actions -- Reducer input*/ - -// We can compute field validity by checking if the value is null - -interface SetGasLimitFieldAction { - type: TypeKeys.GAS_LIMIT_FIELD_SET; - payload: { - raw: string; - value: Wei | null; - }; -} - -interface SetGasPriceFieldAction { - type: TypeKeys.GAS_PRICE_FIELD_SET; - payload: { - raw: string; - value: Wei | null; - }; -} - -interface SetDataFieldAction { - type: TypeKeys.DATA_FIELD_SET; - payload: { - raw: string; - value: Data | null; - }; -} - -interface SetToFieldAction { - type: TypeKeys.TO_FIELD_SET; - payload: { - raw: string; - value: Address | null; - }; -} - -interface SetNonceFieldAction { - type: TypeKeys.NONCE_FIELD_SET; - payload: { - raw: string; - value: Nonce | null; - }; -} - -interface SetValueFieldAction { - type: TypeKeys.VALUE_FIELD_SET; - payload: { - raw: string; - value: Wei | null; - }; -} - -type InputFieldAction = InputNonceAction | InputGasLimitAction | InputDataAction; - -type FieldAction = - | SetGasLimitFieldAction - | SetDataFieldAction - | SetToFieldAction - | SetNonceFieldAction - | SetValueFieldAction - | SetGasPriceFieldAction; - -export { - InputGasLimitAction, - InputGasPriceAction, - InputGasPriceIntentAction, - InputDataAction, - InputNonceAction, - SetGasLimitFieldAction, - SetDataFieldAction, - SetToFieldAction, - SetNonceFieldAction, - SetValueFieldAction, - FieldAction, - InputFieldAction, - SetGasPriceFieldAction -}; diff --git a/common/actions/transaction/actionTypes/index.ts b/common/actions/transaction/actionTypes/index.ts deleted file mode 100644 index 3eb256de..00000000 --- a/common/actions/transaction/actionTypes/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './actionTypes'; diff --git a/common/actions/transaction/actionTypes/meta.ts b/common/actions/transaction/actionTypes/meta.ts deleted file mode 100644 index 93156a81..00000000 --- a/common/actions/transaction/actionTypes/meta.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { TypeKeys } from 'actions/transaction/constants'; -import { Address, TokenValue } from 'libs/units'; -/*Meta Actions*/ - -interface SetTokenToMetaAction { - type: TypeKeys.TOKEN_TO_META_SET; - payload: { - raw: string; - value: Address | null; - }; -} - -interface SetUnitMetaAction { - type: TypeKeys.UNIT_META_SET; - payload: string; -} - -interface SetTokenValueMetaAction { - type: TypeKeys.TOKEN_VALUE_META_SET; - payload: { - raw: string; - value: TokenValue | null; - }; -} - -interface SetAsContractInteractionAction { - type: TypeKeys.IS_CONTRACT_INTERACTION; -} - -interface SetAsViewAndSendAction { - type: TypeKeys.IS_VIEW_AND_SEND; -} - -type TransactionMetaAction = SetUnitMetaAction | SetTokenValueMetaAction | SetTokenToMetaAction; -type TransactionTypeMetaAction = SetAsContractInteractionAction | SetAsViewAndSendAction; - -type MetaAction = TransactionMetaAction | TransactionTypeMetaAction; - -export { - TransactionMetaAction, - TransactionTypeMetaAction, - MetaAction, - SetUnitMetaAction, - SetTokenToMetaAction, - SetTokenValueMetaAction, - SetAsContractInteractionAction, - SetAsViewAndSendAction -}; diff --git a/common/actions/transaction/actionTypes/network.ts b/common/actions/transaction/actionTypes/network.ts deleted file mode 100644 index ac660fa2..00000000 --- a/common/actions/transaction/actionTypes/network.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { TypeKeys } from 'actions/transaction/constants'; -import { IHexStrTransaction } from 'libs/transaction'; -/* Network actions */ -interface EstimateGasRequestedAction { - type: TypeKeys.ESTIMATE_GAS_REQUESTED; - payload: Partial; -} -interface EstimateGasSucceededAction { - type: TypeKeys.ESTIMATE_GAS_SUCCEEDED; -} -interface EstimateGasFailedAction { - type: TypeKeys.ESTIMATE_GAS_FAILED; -} -interface EstimateGasTimeoutAction { - type: TypeKeys.ESTIMATE_GAS_TIMEDOUT; -} -interface GetFromRequestedAction { - type: TypeKeys.GET_FROM_REQUESTED; -} -interface GetFromSucceededAction { - type: TypeKeys.GET_FROM_SUCCEEDED; - payload: string; -} -interface GetFromFailedAction { - type: TypeKeys.GET_FROM_FAILED; -} -interface GetNonceRequestedAction { - type: TypeKeys.GET_NONCE_REQUESTED; -} -interface GetNonceSucceededAction { - type: TypeKeys.GET_NONCE_SUCCEEDED; - payload: string; -} -interface GetNonceFailedAction { - type: TypeKeys.GET_NONCE_FAILED; -} - -type NetworkAction = - | EstimateGasFailedAction - | EstimateGasRequestedAction - | EstimateGasSucceededAction - | EstimateGasTimeoutAction - | GetFromRequestedAction - | GetFromSucceededAction - | GetFromFailedAction - | GetNonceRequestedAction - | GetNonceSucceededAction - | GetNonceFailedAction; - -export { - EstimateGasRequestedAction, - EstimateGasSucceededAction, - EstimateGasFailedAction, - EstimateGasTimeoutAction, - GetFromRequestedAction, - GetFromSucceededAction, - GetFromFailedAction, - GetNonceRequestedAction, - GetNonceSucceededAction, - GetNonceFailedAction, - NetworkAction -}; diff --git a/common/actions/transaction/actionTypes/sendEverything.ts b/common/actions/transaction/actionTypes/sendEverything.ts deleted file mode 100644 index ff4c6bfb..00000000 --- a/common/actions/transaction/actionTypes/sendEverything.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { TypeKeys } from 'actions/transaction'; - -interface SendEverythingRequestedAction { - type: TypeKeys.SEND_EVERYTHING_REQUESTED; -} -interface SendEverythingSucceededAction { - type: TypeKeys.SEND_EVERYTHING_SUCCEEDED; -} -interface SendEverythingFailedAction { - type: TypeKeys.SEND_EVERYTHING_FAILED; -} - -type SendEverythingAction = - | SendEverythingRequestedAction - | SendEverythingSucceededAction - | SendEverythingFailedAction; - -export { - SendEverythingAction, - SendEverythingSucceededAction, - SendEverythingFailedAction, - SendEverythingRequestedAction -}; diff --git a/common/actions/transaction/actionTypes/sign.ts b/common/actions/transaction/actionTypes/sign.ts deleted file mode 100644 index f9bf5509..00000000 --- a/common/actions/transaction/actionTypes/sign.ts +++ /dev/null @@ -1,40 +0,0 @@ -import EthTx from 'ethereumjs-tx'; -import { TypeKeys } from 'actions/transaction/constants'; - -/* - * Difference between the web3/local is that a local sign will actually sign the tx - * While a web3 sign just gathers the rest of the nessesary parameters of the ethereum tx - * to do the sign + broadcast in 1 step later on - */ - -/* Signing / Async actions */ -interface SignTransactionRequestedAction { - type: TypeKeys.SIGN_TRANSACTION_REQUESTED; - payload: EthTx; -} -interface SignLocalTransactionSucceededAction { - type: TypeKeys.SIGN_LOCAL_TRANSACTION_SUCCEEDED; - payload: { signedTransaction: Buffer; indexingHash: string; noVerify?: boolean }; // dont verify against fields, for pushTx -} - -interface SignWeb3TransactionSucceededAction { - type: TypeKeys.SIGN_WEB3_TRANSACTION_SUCCEEDED; - payload: { transaction: Buffer; indexingHash: string; noVerify?: boolean }; -} -interface SignTransactionFailedAction { - type: TypeKeys.SIGN_TRANSACTION_FAILED; -} - -type SignAction = - | SignTransactionRequestedAction - | SignLocalTransactionSucceededAction - | SignWeb3TransactionSucceededAction - | SignTransactionFailedAction; - -export { - SignTransactionRequestedAction, - SignLocalTransactionSucceededAction, - SignWeb3TransactionSucceededAction, - SignTransactionFailedAction, - SignAction -}; diff --git a/common/actions/transaction/actionTypes/swap.ts b/common/actions/transaction/actionTypes/swap.ts deleted file mode 100644 index 6e7f338a..00000000 --- a/common/actions/transaction/actionTypes/swap.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { TypeKeys } from 'actions/transaction/constants'; -import { - SetToFieldAction, - SetValueFieldAction, - SetTokenToMetaAction, - SetTokenValueMetaAction, - SetDataFieldAction -} from 'actions/transaction'; - -/* Swapping actions */ -interface SwapTokenToEtherAction { - type: TypeKeys.TOKEN_TO_ETHER_SWAP; - payload: { - to: SetToFieldAction['payload']; - value: SetValueFieldAction['payload']; - decimal: number; - }; -} -interface SwapEtherToTokenAction { - type: TypeKeys.ETHER_TO_TOKEN_SWAP; - payload: { - to: SetToFieldAction['payload']; - data: SetDataFieldAction['payload']; - tokenTo: SetTokenToMetaAction['payload']; - tokenValue: SetTokenValueMetaAction['payload']; - decimal: number; - }; -} -interface SwapTokenToTokenAction { - type: TypeKeys.TOKEN_TO_TOKEN_SWAP; - payload: { - to: SetToFieldAction['payload']; - data: SetDataFieldAction['payload']; - tokenValue: SetTokenValueMetaAction['payload']; - decimal: number; - }; -} -type SwapAction = SwapEtherToTokenAction | SwapTokenToEtherAction | SwapTokenToTokenAction; - -export { SwapTokenToEtherAction, SwapEtherToTokenAction, SwapAction, SwapTokenToTokenAction }; diff --git a/common/actions/transaction/constants.ts b/common/actions/transaction/constants.ts deleted file mode 100644 index 1add2622..00000000 --- a/common/actions/transaction/constants.ts +++ /dev/null @@ -1,59 +0,0 @@ -export enum TypeKeys { - ESTIMATE_GAS_REQUESTED = 'ESTIMATE_GAS_REQUESTED', - ESTIMATE_GAS_SUCCEEDED = 'ESTIMATE_GAS_SUCCEEDED', - ESTIMATE_GAS_FAILED = 'ESTIMATE_GAS_FAILED', - ESTIMATE_GAS_TIMEDOUT = 'ESTIMATE_GAS_TIMEDOUT', - - GET_FROM_REQUESTED = 'GET_FROM_REQUESTED', - GET_FROM_SUCCEEDED = 'GET_FROM_SUCCEEDED', - GET_FROM_FAILED = 'GET_FROM_FAILED', - - GET_NONCE_REQUESTED = 'GET_NONCE_REQUESTED', - GET_NONCE_SUCCEEDED = 'GET_NONCE_SUCCEEDED', - GET_NONCE_FAILED = 'GET_NONCE_FAILED', - - SIGN_TRANSACTION_REQUESTED = 'SIGN_TRANSACTION_REQUESTED', - SIGN_WEB3_TRANSACTION_SUCCEEDED = 'SIGN_WEB3_TRANSACTION_SUCCEEDED', - SIGN_LOCAL_TRANSACTION_SUCCEEDED = 'SIGN_LOCAL_TRANSACTION_SUCCEEDED', - SIGN_TRANSACTION_FAILED = 'SIGN_TRANSACTION_FAILED', - - BROADCAST_WEB3_TRANSACTION_REQUESTED = 'BROADCAST_WEB3_TRANSACTION_REQUESTED', - BROADCAST_TRANSACTION_SUCCEEDED = 'BROADCAST_TRANSACTION_SUCCEEDED', - BROADCAST_LOCAL_TRANSACTION_REQUESTED = 'BROADCAST_LOCAL_TRANSACTION_REQUESTED', - BROADCAST_TRANSACTION_QUEUED = 'BROADCAST_TRANSACTION_QUEUED', - BROADCAST_TRASACTION_FAILED = 'BROADCAST_TRASACTION_FAILED', - - CURRENT_VALUE_SET = 'CURRENT_VALUE_SET', - CURRENT_TO_SET = 'CURRENT_TO_SET', - - DATA_FIELD_INPUT = 'DATA_FIELD_INPUT', - GAS_LIMIT_INPUT = 'GAS_LIMIT_INPUT', - GAS_PRICE_INPUT = 'GAS_PRICE_INPUT', - GAS_PRICE_INPUT_INTENT = 'GAS_PRICE_INPUT_INTENT', - NONCE_INPUT = 'NONCE_INPUT', - - DATA_FIELD_SET = 'DATA_FIELD_SET', - GAS_LIMIT_FIELD_SET = 'GAS_LIMIT_FIELD_SET', - TO_FIELD_SET = 'TO_FIELD_SET', - VALUE_FIELD_SET = 'VALUE_FIELD_SET', - NONCE_FIELD_SET = 'NONCE_FIELD_SET', - GAS_PRICE_FIELD_SET = 'GAS_PRICE_FIELD_SET', - - TOKEN_TO_META_SET = 'TOKEN_TO_META_SET', - UNIT_META_SET = 'UNIT_META_SET', - TOKEN_VALUE_META_SET = 'TOKEN_VALUE_META_SET', - - TOKEN_TO_ETHER_SWAP = 'TOKEN_TO_ETHER_SWAP', - ETHER_TO_TOKEN_SWAP = 'ETHER_TO_TOKEN_SWAP', - TOKEN_TO_TOKEN_SWAP = 'TOKEN_TO_TOKEN_SWAP', - - SEND_EVERYTHING_REQUESTED = 'SEND_EVERYTHING_REQUESTED', - SEND_EVERYTHING_SUCCEEDED = 'SEND_EVERYTHING_SUCCEEDED', - SEND_EVERYTHING_FAILED = 'SEND_EVERYTHING_FAILED', - - IS_CONTRACT_INTERACTION = 'IS_CONTRACT_INTERACTION', - IS_VIEW_AND_SEND = 'IS_VIEW_AND_SEND', - - RESET_REQUESTED = 'TRANSACTION_RESET_REQUESTED', - RESET_SUCCESSFUL = 'TRANSACTION_RESET_SUCCESSFUL' -} diff --git a/common/actions/transaction/index.ts b/common/actions/transaction/index.ts deleted file mode 100644 index d5122d97..00000000 --- a/common/actions/transaction/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './actionCreators'; -export * from './constants'; -export * from './actionTypes'; diff --git a/common/actions/transactions/actionCreators.ts b/common/actions/transactions/actionCreators.ts deleted file mode 100644 index 48c40ef2..00000000 --- a/common/actions/transactions/actionCreators.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as interfaces from './actionTypes'; -import { TypeKeys } from './constants'; - -export type TFetchTransactionData = typeof fetchTransactionData; -export function fetchTransactionData(txhash: string): interfaces.FetchTransactionDataAction { - return { - type: TypeKeys.TRANSACTIONS_FETCH_TRANSACTION_DATA, - payload: txhash - }; -} - -export type TSetTransactionData = typeof setTransactionData; -export function setTransactionData( - payload: interfaces.SetTransactionDataAction['payload'] -): interfaces.SetTransactionDataAction { - return { - type: TypeKeys.TRANSACTIONS_SET_TRANSACTION_DATA, - payload - }; -} - -export type TResetTransactionData = typeof resetTransactionData; -export function resetTransactionData(): interfaces.ResetTransactionDataAction { - return { type: TypeKeys.TRANSACTIONS_RESET_TRANSACTION_DATA }; -} - -export type TAddRecentTransaction = typeof addRecentTransaction; -export function addRecentTransaction( - payload: interfaces.AddRecentTransactionAction['payload'] -): interfaces.AddRecentTransactionAction { - return { - type: TypeKeys.TRANSACTIONS_ADD_RECENT_TRANSACTION, - payload - }; -} diff --git a/common/actions/transactions/actionTypes.ts b/common/actions/transactions/actionTypes.ts deleted file mode 100644 index fd7686b2..00000000 --- a/common/actions/transactions/actionTypes.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { TypeKeys } from './constants'; -import { SavedTransaction, TransactionData, TransactionReceipt } from 'types/transactions'; - -export interface FetchTransactionDataAction { - type: TypeKeys.TRANSACTIONS_FETCH_TRANSACTION_DATA; - payload: string; -} - -export interface SetTransactionDataAction { - type: TypeKeys.TRANSACTIONS_SET_TRANSACTION_DATA; - payload: { - txhash: string; - data: TransactionData | null; - receipt: TransactionReceipt | null; - error: string | null; - }; -} - -export interface ResetTransactionDataAction { - type: TypeKeys.TRANSACTIONS_RESET_TRANSACTION_DATA; -} - -export interface AddRecentTransactionAction { - type: TypeKeys.TRANSACTIONS_ADD_RECENT_TRANSACTION; - payload: SavedTransaction; -} - -/*** Union Type ***/ -export type TransactionsAction = - | FetchTransactionDataAction - | SetTransactionDataAction - | ResetTransactionDataAction - | AddRecentTransactionAction; diff --git a/common/actions/transactions/constants.ts b/common/actions/transactions/constants.ts deleted file mode 100644 index a1834597..00000000 --- a/common/actions/transactions/constants.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum TypeKeys { - TRANSACTIONS_FETCH_TRANSACTION_DATA = 'TRANSACTIONS_FETCH_TRANSACTION_DATA', - TRANSACTIONS_SET_TRANSACTION_DATA = 'TRANSACTIONS_SET_TRANSACTION_DATA', - TRANSACTIONS_SET_TRANSACTION_ERROR = 'TRANSACTIONS_SET_TRANSACTION_ERROR', - TRANSACTIONS_RESET_TRANSACTION_DATA = 'TRANSACTIONS_RESET_TRANSACTION_DATA', - TRANSACTIONS_ADD_RECENT_TRANSACTION = 'TRANSACTIONS_ADD_RECENT_TRANSACTION' -} diff --git a/common/actions/transactions/index.ts b/common/actions/transactions/index.ts deleted file mode 100644 index 51fcd517..00000000 --- a/common/actions/transactions/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './actionCreators'; -export * from './actionTypes'; -export * from './constants'; diff --git a/common/actions/wallet/actionTypes.ts b/common/actions/wallet/actionTypes.ts deleted file mode 100644 index d8c37877..00000000 --- a/common/actions/wallet/actionTypes.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { Wei, TokenValue } from 'libs/units'; -import { IWallet, WalletConfig } from 'libs/wallet'; -import { TypeKeys } from './constants'; - -/*** Unlock Private Key ***/ -export interface PrivateKeyUnlockParams { - key: string; - password: string; -} - -export interface UnlockPrivateKeyAction { - type: TypeKeys.WALLET_UNLOCK_PRIVATE_KEY; - payload: PrivateKeyUnlockParams; -} -export interface UnlockMnemonicAction { - type: TypeKeys.WALLET_UNLOCK_MNEMONIC; - payload: MnemonicUnlockParams; -} - -export interface UnlockWeb3Action { - type: TypeKeys.WALLET_UNLOCK_WEB3; -} - -/*** Set Wallet ***/ -export interface SetWalletAction { - type: TypeKeys.WALLET_SET; - payload: IWallet; -} - -/*** Reset Wallet ***/ -export interface ResetWalletAction { - type: TypeKeys.WALLET_RESET; -} - -export interface SetWalletPendingAction { - type: TypeKeys.WALLET_SET_PENDING; - payload: boolean; -} - -/*** Set Balance ***/ -export interface SetBalancePendingAction { - type: TypeKeys.WALLET_SET_BALANCE_PENDING; -} -export interface SetBalanceFullfilledAction { - type: TypeKeys.WALLET_SET_BALANCE_FULFILLED; - payload: Wei; -} -export interface SetBalanceRejectedAction { - type: TypeKeys.WALLET_SET_BALANCE_REJECTED; -} - -/*** Set Token Balance ***/ -export interface SetTokenBalancesPendingAction { - type: TypeKeys.WALLET_SET_TOKEN_BALANCES_PENDING; -} - -export interface SetTokenBalancesFulfilledAction { - type: TypeKeys.WALLET_SET_TOKEN_BALANCES_FULFILLED; - payload: { - [key: string]: { - balance: TokenValue; - error: string | null; - }; - }; -} - -export interface SetTokenBalancesRejectedAction { - type: TypeKeys.WALLET_SET_TOKEN_BALANCES_REJECTED; -} - -export interface SetTokenBalancePendingAction { - type: TypeKeys.WALLET_SET_TOKEN_BALANCE_PENDING; - payload: { tokenSymbol: string }; -} - -export interface SetTokenBalanceFulfilledAction { - type: TypeKeys.WALLET_SET_TOKEN_BALANCE_FULFILLED; - payload: { - [key: string]: { - balance: TokenValue; - error: string | null; - }; - }; -} - -export interface SetTokenBalanceRejectedAction { - type: TypeKeys.WALLET_SET_TOKEN_BALANCE_REJECTED; -} - -export interface ScanWalletForTokensAction { - type: TypeKeys.WALLET_SCAN_WALLET_FOR_TOKENS; - payload: IWallet; -} - -export interface SetWalletTokensAction { - type: TypeKeys.WALLET_SET_WALLET_TOKENS; - payload: string[]; -} - -/*** Unlock Mnemonic ***/ -export interface MnemonicUnlockParams { - phrase: string; - pass: string; - path: string; - address: string; -} - -/*** Unlock Keystore File ***/ -export interface KeystoreUnlockParams { - file: string; - password: string; -} - -export interface UnlockKeystoreAction { - type: TypeKeys.WALLET_UNLOCK_KEYSTORE; - payload: KeystoreUnlockParams; -} - -export interface SetWalletConfigAction { - type: TypeKeys.WALLET_SET_CONFIG; - payload: WalletConfig; -} - -export interface SetPasswordPendingAction { - type: TypeKeys.WALLET_SET_PASSWORD_PENDING; -} - -export interface RefreshAccountBalanceAction { - type: TypeKeys.WALLET_REFRESH_ACCOUNT_BALANCE; -} - -export interface RefreshTokenBalancesAction { - type: TypeKeys.WALLET_REFRESH_TOKEN_BALANCES; -} - -/*** Union Type ***/ -export type WalletAction = - | UnlockPrivateKeyAction - | SetWalletAction - | SetWalletPendingAction - | ResetWalletAction - | SetBalancePendingAction - | SetBalanceFullfilledAction - | SetBalanceRejectedAction - | SetTokenBalancesPendingAction - | SetTokenBalancesFulfilledAction - | SetTokenBalancesRejectedAction - | SetTokenBalancePendingAction - | SetTokenBalanceFulfilledAction - | SetTokenBalanceRejectedAction - | ScanWalletForTokensAction - | SetWalletTokensAction - | SetWalletConfigAction - | SetPasswordPendingAction - | RefreshAccountBalanceAction - | RefreshTokenBalancesAction; diff --git a/common/actions/wallet/constants.ts b/common/actions/wallet/constants.ts deleted file mode 100644 index 59332b8d..00000000 --- a/common/actions/wallet/constants.ts +++ /dev/null @@ -1,25 +0,0 @@ -export enum TypeKeys { - WALLET_UNLOCK_PRIVATE_KEY = 'WALLET_UNLOCK_PRIVATE_KEY', - WALLET_UNLOCK_KEYSTORE = 'WALLET_UNLOCK_KEYSTORE', - WALLET_UNLOCK_MNEMONIC = 'WALLET_UNLOCK_MNEMONIC', - WALLET_UNLOCK_WEB3 = 'WALLET_UNLOCK_WEB3', - WALLET_SET = 'WALLET_SET', - WALLET_SET_BALANCE_PENDING = 'WALLET_SET_BALANCE_PENDING', - WALLET_SET_BALANCE_FULFILLED = 'WALLET_SET_BALANCE_FULFILLED', - WALLET_SET_BALANCE_REJECTED = 'WALLET_SET_BALANCE_REJECTED', - WALLET_SET_TOKEN_BALANCES_PENDING = 'WALLET_SET_TOKEN_BALANCES_PENDING', - WALLET_SET_TOKEN_BALANCES_FULFILLED = 'WALLET_SET_TOKEN_BALANCES_FULFILLED', - WALLET_SET_TOKEN_BALANCES_REJECTED = 'WALLET_SET_TOKEN_BALANCES_REJECTED', - WALLET_SET_PENDING = 'WALLET_SET_PENDING', - WALLET_SET_NOT_PENDING = 'WALLET_SET_NOT_PENDING', - WALLET_SET_TOKEN_BALANCE_PENDING = 'WALLET_SET_TOKEN_BALANCE_PENDING', - WALLET_SET_TOKEN_BALANCE_FULFILLED = 'WALLET_SET_TOKEN_BALANCE_FULFILLED', - WALLET_SET_TOKEN_BALANCE_REJECTED = 'WALLET_SET_TOKEN_BALANCE_REJECTED', - WALLET_SCAN_WALLET_FOR_TOKENS = 'WALLET_SCAN_WALLET_FOR_TOKENS', - WALLET_SET_WALLET_TOKENS = 'WALLET_SET_WALLET_TOKENS', - WALLET_SET_CONFIG = 'WALLET_SET_CONFIG', - WALLET_RESET = 'WALLET_RESET', - WALLET_SET_PASSWORD_PENDING = 'WALLET_SET_PASSWORD_PENDING', - WALLET_REFRESH_ACCOUNT_BALANCE = 'WALLET_REFRESH_ACCOUNT_BALANCE', - WALLET_REFRESH_TOKEN_BALANCES = 'WALLET_REFRESH_TOKEN_BALANCES' -} diff --git a/common/actions/wallet/index.ts b/common/actions/wallet/index.ts deleted file mode 100644 index fee14683..00000000 --- a/common/actions/wallet/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './constants'; -export * from './actionTypes'; -export * from './actionCreators'; diff --git a/common/api/gas.ts b/common/api/gas.ts index 3bdd3b70..a111db9d 100644 --- a/common/api/gas.ts +++ b/common/api/gas.ts @@ -1,6 +1,7 @@ -import { checkHttpStatus, parseJSON } from './utils'; import { Omit } from 'react-redux'; +import { checkHttpStatus, parseJSON } from './utils'; + const MAX_GAS_FAST = 250; interface RawGasEstimates { diff --git a/common/api/rates.ts b/common/api/rates.ts index 5c7dcfff..ae58b9ff 100644 --- a/common/api/rates.ts +++ b/common/api/rates.ts @@ -1,4 +1,5 @@ import { handleJSONResponse } from 'api/utils'; + interface IRateSymbols { symbols: { all: TAllSymbols; diff --git a/common/api/shapeshift.spec.ts b/common/api/shapeshift.spec.ts new file mode 100644 index 00000000..8df9ceb4 --- /dev/null +++ b/common/api/shapeshift.spec.ts @@ -0,0 +1,125 @@ +import shapeshift, { SHAPESHIFT_BASE_URL } from './shapeshift'; + +describe('ShapeShift service', () => { + beforeEach(() => { + (global as any).fetch = jest.fn().mockImplementation( + (url: string) => + new Promise(resolve => { + const returnValues = { + [`${SHAPESHIFT_BASE_URL}/marketinfo`]: { + status: 200, + json: () => [ + { + limit: 1, + maxLimit: 2, + min: 1, + minerFee: 2, + pair: 'BTC_ETH', + rate: '1.0' + }, + { + limit: 1, + maxLimit: 2, + min: 1, + minerFee: 2, + pair: 'ETH_BTC', + rate: '1.0' + } + ] + }, + [`${SHAPESHIFT_BASE_URL}/getcoins`]: { + status: 200, + json: () => ({ + BTC: { + name: 'Bitcoin', + symbol: 'BTC', + image: '', + imageSmall: '', + status: 'available', + minerFee: 1 + }, + ETH: { + name: 'Ethereum', + symbol: 'ETH', + image: '', + imageSmall: '', + status: 'available', + minerFee: 1 + }, + XMR: { + name: 'Monero', + symbol: 'XMR', + image: '', + imageSmall: '', + status: 'unavailable', + minerFee: 1 + } + }) + } + }; + + resolve(returnValues[url]); + }) + ); + }); + it('provides a collection of all available and unavailable coins and tokens', async done => { + const rates = await shapeshift.getAllRates(); + + expect(rates).toEqual({ + BTCETH: { + id: 'BTCETH', + rate: '1.0', + limit: 1, + min: 1, + options: [ + { + id: 'BTC', + image: '', + name: 'Bitcoin', + status: 'available' + }, + { + id: 'ETH', + image: '', + name: 'Ethereum', + status: 'available' + } + ] + }, + ETHBTC: { + id: 'ETHBTC', + rate: '1.0', + limit: 1, + min: 1, + options: [ + { + id: 'ETH', + image: '', + name: 'Ethereum', + status: 'available' + }, + { + id: 'BTC', + image: '', + name: 'Bitcoin', + status: 'available' + } + ] + }, + __XMR: { + id: '__XMR', + limit: 0, + min: 0, + options: [ + { + id: 'XMR', + image: '', + name: 'Monero', + status: 'unavailable' + } + ] + } + }); + done(); + }); +}); diff --git a/common/api/shapeshift.ts b/common/api/shapeshift.ts index 3cd255fa..1f1d040c 100644 --- a/common/api/shapeshift.ts +++ b/common/api/shapeshift.ts @@ -1,9 +1,12 @@ +import flatten from 'lodash/flatten'; +import uniqBy from 'lodash/uniqBy'; + import { checkHttpStatus, parseJSON } from 'api/utils'; -const SHAPESHIFT_API_KEY = +export const SHAPESHIFT_API_KEY = '8abde0f70ca69d5851702d57b10305705d7333e93263124cc2a2649dab7ff9cf86401fc8de7677e8edcd0e7f1eed5270b1b49be8806937ef95d64839e319e6d9'; -const SHAPESHIFT_BASE_URL = 'https://shapeshift.io'; +export const SHAPESHIFT_BASE_URL = 'https://shapeshift.io'; export const SHAPESHIFT_TOKEN_WHITELIST = [ 'OMG', @@ -26,7 +29,7 @@ export const SHAPESHIFT_TOKEN_WHITELIST = [ 'TRST', 'GUP' ]; -export const SHAPESHIFT_WHITELIST = [...SHAPESHIFT_TOKEN_WHITELIST, 'ETH', 'ETC', 'BTC']; +export const SHAPESHIFT_WHITELIST = [...SHAPESHIFT_TOKEN_WHITELIST, 'ETH', 'ETC', 'BTC', 'XMR']; interface IPairData { limit: number; @@ -66,6 +69,29 @@ interface TokenMap { }; } +interface ShapeshiftCoinInfo { + image: string; + imageSmall: string; + minerFee: number; + name: string; + status: string; + symbol: string; +} + +interface ShapeshiftCoinInfoMap { + [id: string]: ShapeshiftCoinInfo; +} + +interface ShapeshiftOption { + id?: string; + status?: string; + image?: string; +} + +interface ShapeshiftOptionMap { + [symbol: string]: ShapeshiftOption; +} + class ShapeshiftService { public whitelist = SHAPESHIFT_WHITELIST; private url = SHAPESHIFT_BASE_URL; @@ -73,6 +99,8 @@ class ShapeshiftService { private postHeaders = { 'Content-Type': 'application/json' }; + private supportedCoinsAndTokens: ShapeshiftCoinInfoMap = {}; + private fetchedSupportedCoinsAndTokens = false; public checkStatus(address: string) { return fetch(`${this.url}/txStat/${address}`) @@ -118,19 +146,76 @@ class ShapeshiftService { public getAllRates = async () => { const marketInfo = await this.getMarketInfo(); - const pairRates = await this.filterPairs(marketInfo); + const pairRates = this.filterPairs(marketInfo); const checkAvl = await this.checkAvl(pairRates); const mappedRates = this.mapMarketInfo(checkAvl); - return mappedRates; + const allRates = this.addUnavailableCoinsAndTokens(mappedRates); + + return allRates; + }; + + public addUnavailableCoinsAndTokens = (availableCoinsAndTokens: TokenMap) => { + if (this.fetchedSupportedCoinsAndTokens) { + /** @desc Create a hash for efficiently checking which tokens are currently available. */ + const allOptions = flatten( + Object.values(availableCoinsAndTokens).map(({ options }) => options) + ); + const availableOptions: ShapeshiftOptionMap = uniqBy(allOptions, 'id').reduce( + (prev: ShapeshiftOptionMap, next) => { + prev[next.id] = next; + return prev; + }, + {} + ); + + const unavailableCoinsAndTokens = this.whitelist + .map(token => { + /** @desc ShapeShift claims support for the token and it is available. */ + const availableCoinOrToken = availableOptions[token]; + + if (availableCoinOrToken) { + return null; + } + + /** @desc ShapeShift claims support for the token, but it is unavailable. */ + const supportedCoinOrToken = this.supportedCoinsAndTokens[token]; + + if (supportedCoinOrToken) { + const { symbol: id, image, name, status } = supportedCoinOrToken; + + return { + /** @desc Preface the false id with '__' to differentiate from actual pairs. */ + id: `__${id}`, + limit: 0, + min: 0, + options: [{ id, image, name, status }] + }; + } + + /** @desc We claim support for the coin or token, but ShapeShift doesn't. */ + return null; + }) + .reduce((prev: ShapeshiftOptionMap, next) => { + if (next) { + prev[next.id] = next; + + return prev; + } + + return prev; + }, {}); + + return { ...availableCoinsAndTokens, ...unavailableCoinsAndTokens }; + } + + return availableCoinsAndTokens; }; private filterPairs(marketInfo: ShapeshiftMarketInfo[]) { return marketInfo.filter(obj => { const { pair } = obj; const pairArr = pair.split('_'); - return this.whitelist.includes(pairArr[0]) && this.whitelist.includes(pairArr[1]) - ? true - : false; + return this.whitelist.includes(pairArr[0]) && this.whitelist.includes(pairArr[1]); }); } @@ -165,7 +250,13 @@ class ShapeshiftService { private getAvlCoins() { return fetch(`${this.url}/getcoins`) .then(checkHttpStatus) - .then(parseJSON); + .then(parseJSON) + .then(supportedCoinsAndTokens => { + this.supportedCoinsAndTokens = supportedCoinsAndTokens; + this.fetchedSupportedCoinsAndTokens = true; + + return supportedCoinsAndTokens; + }); } private getMarketInfo() { diff --git a/common/assets/images/icon-theme-dark.svg b/common/assets/images/icon-theme-dark.svg new file mode 100644 index 00000000..59738a28 --- /dev/null +++ b/common/assets/images/icon-theme-dark.svg @@ -0,0 +1,10 @@ + + + + Artboard + Created with Sketch. + + + + + \ No newline at end of file diff --git a/common/assets/images/icon-theme-light.svg b/common/assets/images/icon-theme-light.svg new file mode 100644 index 00000000..d89d3326 --- /dev/null +++ b/common/assets/images/icon-theme-light.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/common/assets/images/wallets/file.svg b/common/assets/images/wallets/file.svg new file mode 100644 index 00000000..31f2a29e --- /dev/null +++ b/common/assets/images/wallets/file.svg @@ -0,0 +1,3 @@ + + + diff --git a/common/assets/images/wallets/hardware.svg b/common/assets/images/wallets/hardware.svg new file mode 100644 index 00000000..0821465f --- /dev/null +++ b/common/assets/images/wallets/hardware.svg @@ -0,0 +1,12 @@ + + + + Artboard + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/common/assets/images/wallets/parity-signer.svg b/common/assets/images/wallets/parity-signer.svg index 3a521834..63065b75 100644 --- a/common/assets/images/wallets/parity-signer.svg +++ b/common/assets/images/wallets/parity-signer.svg @@ -1,149 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - + + + + + - diff --git a/common/badBrowserCheckA.js b/common/badBrowserCheckA.js new file mode 100644 index 00000000..ec2a1658 --- /dev/null +++ b/common/badBrowserCheckA.js @@ -0,0 +1,9 @@ + +// use dates as vars so they're not stripped out by minification +let letCheck = new Date(); +const constCheck = new Date(); +const arrowCheck = (() => new Date())(); + +if (letCheck && constCheck && arrowCheck) { + window.localStorage.setItem('goodBrowser', 'true'); +} diff --git a/common/badBrowserCheckB.js b/common/badBrowserCheckB.js new file mode 100644 index 00000000..51a82334 --- /dev/null +++ b/common/badBrowserCheckB.js @@ -0,0 +1,33 @@ +var badBrowser = false; + +try { + // Local storage + window.localStorage.setItem('test', 'test'); + window.localStorage.removeItem('test'); + + // Flexbox + var elTest = document.createElement('div'); + elTest.style.display = 'flex'; + if (elTest.style.display !== 'flex') { + badBrowser = true; + } + + // const and let check from badBrowserCheckA.js + if (window.localStorage.goodBrowser !== 'true') { + badBrowser = true; + } + window.localStorage.removeItem('goodBrowser'); + +} catch (err) { + badBrowser = true; +} + +if (badBrowser) { + var el = document.getElementsByClassName('BadBrowser')[0]; + el.className += ' is-open'; + // Dumb check for known mobile OS's. Not important to catch all, just + // displays more appropriate information. + if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) { + el.className += ' is-mobile'; + } +} diff --git a/common/components/AddressBookTable.scss b/common/components/AddressBookTable.scss index a4784d50..1b56cd71 100644 --- a/common/components/AddressBookTable.scss +++ b/common/components/AddressBookTable.scss @@ -23,7 +23,7 @@ align-self: stretch; padding: 0; box-shadow: none; - color: $brand-danger; + color: color(brand-danger); &-temporary-input--non-mobile { flex: 1; @@ -122,7 +122,7 @@ } &-error { - color: $brand-danger; + color: color(brand-danger); align-self: end; } } diff --git a/common/components/AddressBookTable.tsx b/common/components/AddressBookTable.tsx index c01c5f51..1667b5f4 100644 --- a/common/components/AddressBookTable.tsx +++ b/common/components/AddressBookTable.tsx @@ -1,37 +1,31 @@ import React from 'react'; import { connect, MapStateToProps } from 'react-redux'; import classnames from 'classnames'; -import { AppState } from 'reducers'; + import translate, { translateRaw } from 'translations'; +import { AppState } from 'features/reducers'; +import { getChecksumAddressFn } from 'features/config'; import { - changeAddressLabelEntry, - TChangeAddressLabelEntry, - saveAddressLabelEntry, - TSaveAddressLabelEntry, - removeAddressLabelEntry, - TRemoveAddressLabelEntry -} from 'actions/addressBook'; -import { - getAddressLabels, - getLabelAddresses, - getAddressLabelRows, - getAddressBookTableEntry -} from 'selectors/addressBook'; + addressBookConstants, + addressBookActions, + addressBookSelectors +} from 'features/addressBook'; import { Input, Identicon } from 'components/ui'; import AddressBookTableRow from './AddressBookTableRow'; import './AddressBookTable.scss'; interface DispatchProps { - changeAddressLabelEntry: TChangeAddressLabelEntry; - saveAddressLabelEntry: TSaveAddressLabelEntry; - removeAddressLabelEntry: TRemoveAddressLabelEntry; + changeAddressLabelEntry: addressBookActions.TChangeAddressLabelEntry; + saveAddressLabelEntry: addressBookActions.TSaveAddressLabelEntry; + removeAddressLabelEntry: addressBookActions.TRemoveAddressLabelEntry; } interface StateProps { - rows: ReturnType; - entry: ReturnType; - addressLabels: ReturnType; - labelAddresses: ReturnType; + rows: ReturnType; + entry: ReturnType; + addressLabels: ReturnType; + labelAddresses: ReturnType; + toChecksumAddress: ReturnType; } type Props = DispatchProps & StateProps; @@ -44,8 +38,6 @@ interface State { labelBlurred: boolean; } -export const ADDRESS_BOOK_TABLE_ID: string = 'ADDRESS_BOOK_TABLE_ID'; - class AddressBookTable extends React.Component { public state: State = { editingRow: null, @@ -180,7 +172,7 @@ class AddressBookTable extends React.Component { this.labelInput.focus(); } - this.props.saveAddressLabelEntry(ADDRESS_BOOK_TABLE_ID); + this.props.saveAddressLabelEntry(addressBookConstants.ADDRESS_BOOK_TABLE_ID); if (!addressError && !labelError) { this.clearFieldStatuses(); @@ -200,7 +192,8 @@ class AddressBookTable extends React.Component { private makeLabelRow = (row: any, index: number) => { const { editingRow } = this.state; - const { id, address, label, temporaryLabel, labelError } = row; + const { id, label, temporaryLabel, labelError } = row; + const address = this.props.toChecksumAddress(row.address); const isEditing = index === editingRow; const onChange = (newLabel: string) => this.props.changeAddressLabelEntry({ @@ -262,7 +255,7 @@ class AddressBookTable extends React.Component { const label = entry.temporaryLabel || ''; this.props.changeAddressLabelEntry({ - id: ADDRESS_BOOK_TABLE_ID, + id: addressBookConstants.ADDRESS_BOOK_TABLE_ID, address, label }); @@ -287,7 +280,7 @@ class AddressBookTable extends React.Component { const label = e.target.value; this.props.changeAddressLabelEntry({ - id: ADDRESS_BOOK_TABLE_ID, + id: addressBookConstants.ADDRESS_BOOK_TABLE_ID, address, label }); @@ -305,16 +298,17 @@ class AddressBookTable extends React.Component { } const mapStateToProps: MapStateToProps = state => ({ - rows: getAddressLabelRows(state), - entry: getAddressBookTableEntry(state), - addressLabels: getAddressLabels(state), - labelAddresses: getLabelAddresses(state) + rows: addressBookSelectors.getAddressLabelRows(state), + entry: addressBookSelectors.getAddressBookTableEntry(state), + addressLabels: addressBookSelectors.getAddressLabels(state), + labelAddresses: addressBookSelectors.getLabelAddresses(state), + toChecksumAddress: getChecksumAddressFn(state) }); const mapDispatchToProps: DispatchProps = { - changeAddressLabelEntry, - saveAddressLabelEntry, - removeAddressLabelEntry + changeAddressLabelEntry: addressBookActions.changeAddressLabelEntry, + saveAddressLabelEntry: addressBookActions.saveAddressLabelEntry, + removeAddressLabelEntry: addressBookActions.removeAddressLabelEntry }; export default connect(mapStateToProps, mapDispatchToProps)(AddressBookTable); diff --git a/common/components/AddressBookTableRow.tsx b/common/components/AddressBookTableRow.tsx index 757fbad0..2804e1d6 100644 --- a/common/components/AddressBookTableRow.tsx +++ b/common/components/AddressBookTableRow.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import translate, { translateRaw } from 'translations'; import noop from 'lodash/noop'; + +import translate, { translateRaw } from 'translations'; import { Input, Identicon } from 'components/ui'; interface Props { diff --git a/common/components/AddressField.tsx b/common/components/AddressField.tsx index 3ab21c4d..d92b4657 100644 --- a/common/components/AddressField.tsx +++ b/common/components/AddressField.tsx @@ -1,11 +1,14 @@ import React from 'react'; -import { AddressFieldFactory } from './AddressFieldFactory'; +import { connect } from 'react-redux'; + import { donationAddressMap } from 'config'; import translate from 'translations'; +import { AppState } from 'features/reducers'; +import { getChecksumAddressFn } from 'features/config'; import { Input } from 'components/ui'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { AddressFieldFactory } from './AddressFieldFactory'; -interface Props { +interface OwnProps { isReadOnly?: boolean; isSelfAddress?: boolean; showBlockies?: boolean; @@ -14,13 +17,20 @@ interface Props { placeholder?: string; } -export const AddressField: React.SFC = ({ +interface StateProps { + toChecksumAddress: ReturnType; +} + +type Props = OwnProps & StateProps; + +const AddressField: React.SFC = ({ isReadOnly, isSelfAddress, isCheckSummed, showBlockies, showLabelMatch, - placeholder + placeholder, + toChecksumAddress }) => ( = ({ )} /> ); + +export default connect((state: AppState): StateProps => ({ + toChecksumAddress: getChecksumAddressFn(state) +}))(AddressField); diff --git a/common/components/AddressFieldFactory/AddressFieldDropdown.scss b/common/components/AddressFieldFactory/AddressFieldDropdown.scss index 36efa3a3..49dbda4e 100644 --- a/common/components/AddressFieldFactory/AddressFieldDropdown.scss +++ b/common/components/AddressFieldFactory/AddressFieldDropdown.scss @@ -6,9 +6,9 @@ position: absolute; top: calc(100% - 1.5rem); width: 100%; - border: 1px solid $gray-lighter; + border: 1px solid color(gray-lighter); border-top: none; - background: $component-active-color; + background: color(component-active-color); z-index: 2; list-style-type: none; margin: 0; @@ -30,7 +30,7 @@ &:hover { cursor: pointer; - background: $gray-lightest; + background: color(gray-lightest); } &-identicon { @@ -76,7 +76,7 @@ } &--active { - background: $gray-lighter; + background: color(gray-lighter); } } } diff --git a/common/components/AddressFieldFactory/AddressFieldDropdown.tsx b/common/components/AddressFieldFactory/AddressFieldDropdown.tsx index 9fbdd8dc..7806b501 100644 --- a/common/components/AddressFieldFactory/AddressFieldDropdown.tsx +++ b/common/components/AddressFieldFactory/AddressFieldDropdown.tsx @@ -1,20 +1,20 @@ import React from 'react'; import { connect } from 'react-redux'; -import { AppState } from 'reducers'; + import translate, { translateRaw } from 'translations'; -import { setCurrentTo, TSetCurrentTo } from 'actions/transaction'; -import { getLabelAddresses } from 'selectors/addressBook'; -import { getToRaw } from 'selectors/transaction/fields'; +import { AppState } from 'features/reducers'; +import { transactionActions, transactionSelectors } from 'features/transaction'; +import { addressBookSelectors } from 'features/addressBook'; import { Address, Identicon } from 'components/ui'; import './AddressFieldDropdown.scss'; interface StateProps { - labelAddresses: ReturnType; - currentTo: ReturnType; + labelAddresses: ReturnType; + currentTo: ReturnType; } interface DispatchProps { - setCurrentTo: TSetCurrentTo; + setCurrentTo: transactionActions.TSetCurrentTo; } type Props = StateProps & DispatchProps; @@ -161,8 +161,8 @@ class AddressFieldDropdown extends React.Component { export default connect( (state: AppState) => ({ - labelAddresses: getLabelAddresses(state), - currentTo: getToRaw(state) + labelAddresses: addressBookSelectors.getLabelAddresses(state), + currentTo: transactionSelectors.getToRaw(state) }), - { setCurrentTo } + { setCurrentTo: transactionActions.setCurrentTo } )(AddressFieldDropdown); diff --git a/common/components/AddressFieldFactory/AddressFieldFactory.tsx b/common/components/AddressFieldFactory/AddressFieldFactory.tsx index bdee5252..85fdc692 100644 --- a/common/components/AddressFieldFactory/AddressFieldFactory.tsx +++ b/common/components/AddressFieldFactory/AddressFieldFactory.tsx @@ -1,13 +1,14 @@ -import { Query } from 'components/renderCbs'; -import { setCurrentTo, TSetCurrentTo } from 'actions/transaction'; -import { AddressInputFactory } from './AddressInputFactory'; import React from 'react'; import { connect } from 'react-redux'; -import { ICurrentTo } from 'selectors/transaction'; + +import { ICurrentTo } from 'features/types'; +import { transactionActions } from 'features/transaction'; +import { Query } from 'components/renderCbs'; +import { AddressInputFactory } from './AddressInputFactory'; import './AddressFieldFactory.scss'; interface DispatchProps { - setCurrentTo: TSetCurrentTo; + setCurrentTo: transactionActions.TSetCurrentTo; } interface OwnProps { @@ -84,7 +85,9 @@ class AddressFieldFactoryClass extends React.Component { private setBlurTimeout = () => (this.goingToBlur = window.setTimeout(this.blur, 150)); } -const AddressFieldFactory = connect(null, { setCurrentTo })(AddressFieldFactoryClass); +const AddressFieldFactory = connect(null, { setCurrentTo: transactionActions.setCurrentTo })( + AddressFieldFactoryClass +); interface DefaultAddressFieldProps { isSelfAddress?: boolean; diff --git a/common/components/AddressFieldFactory/AddressInputFactory.scss b/common/components/AddressFieldFactory/AddressInputFactory.scss index e24ee34d..7693e552 100644 --- a/common/components/AddressFieldFactory/AddressInputFactory.scss +++ b/common/components/AddressFieldFactory/AddressInputFactory.scss @@ -18,7 +18,7 @@ &-label { position: relative; width: 100%; - color: darken($brand-success, 15%); + color: color(brand-success-darker); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; diff --git a/common/components/AddressFieldFactory/AddressInputFactory.tsx b/common/components/AddressFieldFactory/AddressInputFactory.tsx index 44d981b7..b113d8a4 100644 --- a/common/components/AddressFieldFactory/AddressInputFactory.tsx +++ b/common/components/AddressFieldFactory/AddressInputFactory.tsx @@ -1,22 +1,18 @@ import React, { Component } from 'react'; -import { Identicon, Spinner } from 'components/ui'; -import { Query } from 'components/renderCbs'; -import { translateRaw } from 'translations'; -import { - ICurrentTo, - getCurrentTo, - isValidCurrentTo, - isCurrentToLabelEntry -} from 'selectors/transaction'; -import { getCurrentToLabel } from 'selectors/addressBook'; import { connect } from 'react-redux'; -import { AppState } from 'reducers'; -import { CallbackProps } from 'components/AddressFieldFactory'; import { addHexPrefix } from 'ethereumjs-util'; -import { getWalletInst } from 'selectors/wallet'; -import { getResolvingDomain } from 'selectors/ens'; + +import translate, { translateRaw } from 'translations'; import { isValidENSAddress } from 'libs/validators'; import { Address } from 'libs/units'; +import { ICurrentTo } from 'features/types'; +import { AppState } from 'features/reducers'; +import * as selectors from 'features/selectors'; +import { walletSelectors } from 'features/wallet'; +import { ensSelectors } from 'features/ens'; +import { Identicon, Spinner } from 'components/ui'; +import { Query } from 'components/renderCbs'; +import { CallbackProps } from 'components/AddressFieldFactory'; import AddressFieldDropdown from './AddressFieldDropdown'; import './AddressInputFactory.scss'; @@ -45,7 +41,8 @@ const ENSStatus: React.SFC<{ isLoading: boolean; ensAddress: string; rawAddress: rawAddress }) => { const isENS = isValidENSAddress(ensAddress); - const text = 'Loading ENS address...'; + const text = translate('LOADING_ENS_ADDRESS'); + if (isLoading) { return ( @@ -120,21 +117,21 @@ class AddressInputFactoryClass extends Component { export const AddressInputFactory = connect((state: AppState, ownProps: OwnProps) => { let currentTo: ICurrentTo; if (ownProps.isSelfAddress) { - const wallet = getWalletInst(state); + const wallet = walletSelectors.getWalletInst(state); const addr = wallet ? wallet.getAddressString() : ''; currentTo = { raw: addr, value: Address(addr) }; } else { - currentTo = getCurrentTo(state); + currentTo = selectors.getCurrentTo(state); } return { currentTo, - label: getCurrentToLabel(state), - isResolving: getResolvingDomain(state), - isValid: isValidCurrentTo(state), - isLabelEntry: isCurrentToLabelEntry(state) + label: selectors.getCurrentToLabel(state), + isResolving: ensSelectors.getResolvingDomain(state), + isValid: selectors.isValidCurrentTo(state), + isLabelEntry: selectors.isCurrentToLabelEntry(state) }; })(AddressInputFactoryClass); diff --git a/common/components/AmountField.tsx b/common/components/AmountField.tsx index 1792217a..a4f82420 100644 --- a/common/components/AmountField.tsx +++ b/common/components/AmountField.tsx @@ -1,8 +1,9 @@ import React from 'react'; -import { AmountFieldFactory } from './AmountFieldFactory'; -import { UnitDropDown, SendEverything } from 'components'; + import translate from 'translations'; +import { UnitDropDown, SendEverything } from 'components'; import { Input } from 'components/ui'; +import { AmountFieldFactory } from './AmountFieldFactory'; import './AmountField.scss'; interface Props { @@ -11,6 +12,7 @@ interface Props { hasUnitDropdown?: boolean; hasSendEverything?: boolean; showAllTokens?: boolean; + showInvalidWithoutValue?: boolean; customValidator?(rawAmount: string): boolean; } @@ -20,7 +22,8 @@ export const AmountField: React.SFC = ({ hasSendEverything, showAllTokens, networkId, - customValidator + customValidator, + showInvalidWithoutValue }) => ( ( @@ -41,6 +44,7 @@ export const AmountField: React.SFC = ({ value={raw} readOnly={!!readOnly} onChange={onChange} + showInvalidWithoutValue={showInvalidWithoutValue} /> {hasUnitDropdown ? ( diff --git a/common/components/AmountFieldFactory/AmountFieldFactory.tsx b/common/components/AmountFieldFactory/AmountFieldFactory.tsx index 44457faf..15f4849a 100644 --- a/common/components/AmountFieldFactory/AmountFieldFactory.tsx +++ b/common/components/AmountFieldFactory/AmountFieldFactory.tsx @@ -1,9 +1,10 @@ import React, { Component } from 'react'; -import { Query } from 'components/renderCbs'; -import { setCurrentValue, TSetCurrentValue } from 'actions/transaction'; import { connect } from 'react-redux'; + +import { AppState } from 'features/reducers'; +import { transactionActions } from 'features/transaction'; +import { Query } from 'components/renderCbs'; import { AmountInput } from './AmountInputFactory'; -import { AppState } from 'reducers'; export interface CallbackProps { isValid: boolean; @@ -15,7 +16,7 @@ export interface CallbackProps { } interface DispatchProps { - setCurrentValue: TSetCurrentValue; + setCurrentValue: transactionActions.TSetCurrentValue; } interface OwnProps { @@ -43,7 +44,9 @@ class AmountFieldClass extends Component { }; } -const AmountField = connect(null, { setCurrentValue })(AmountFieldClass); +const AmountField = connect(null, { setCurrentValue: transactionActions.setCurrentValue })( + AmountFieldClass +); interface DefaultAmountFieldProps { withProps(props: CallbackProps): React.ReactElement | null; diff --git a/common/components/AmountFieldFactory/AmountInputFactory.tsx b/common/components/AmountFieldFactory/AmountInputFactory.tsx index 1c52c476..0a1ac297 100644 --- a/common/components/AmountFieldFactory/AmountInputFactory.tsx +++ b/common/components/AmountFieldFactory/AmountInputFactory.tsx @@ -1,9 +1,11 @@ import React, { Component } from 'react'; -import { Query } from 'components/renderCbs'; -import { ICurrentValue, getCurrentValue, nonStandardTransaction } from 'selectors/transaction'; -import { AppState } from 'reducers'; import { connect } from 'react-redux'; + +import { AppState } from 'features/reducers'; +import { ICurrentValue } from 'features/types'; +import { getCurrentValue, nonStandardTransaction } from 'features/selectors'; import { CallbackProps } from 'components/AmountFieldFactory'; +import { Query } from 'components/renderCbs'; interface OwnProps { onChange(ev: React.FormEvent): void; diff --git a/common/components/AppAlphaNotice/AlphaNotice.scss b/common/components/AppAlphaNotice/AlphaNotice.scss deleted file mode 100644 index c14ec0b0..00000000 --- a/common/components/AppAlphaNotice/AlphaNotice.scss +++ /dev/null @@ -1,53 +0,0 @@ -@import 'common/sass/variables'; -@import 'common/sass/mixins'; - -.AppAlpha { - @include cover-message; - background: $brand-info; - left: $electron-sidebar-width - 1; - - &-content { - h2 { - text-align: center; - } - - p { - text-align: justify; - } - - &-btn { - display: block; - width: 100%; - max-width: 280px; - margin: 40px auto 0; - border: none; - padding: 0; - transition: $transition; - height: 60px; - line-height: 60px; - font-size: 22px; - background: rgba(#fff, 0.96); - color: $gray-dark; - border-radius: 4px; - - &:hover { - background: #fff; - color: $gray-darker; - } - } - } - - // Fade out - &.is-fading { - pointer-events: none; - opacity: 0; - background: #fff; - transition: all 500ms ease 400ms; - - .AppAlpha-content { - opacity: 0; - transform: translateY(15px); - transition: all 500ms ease; - } - } -} diff --git a/common/components/AppAlphaNotice/AlphaNotice.tsx b/common/components/AppAlphaNotice/AlphaNotice.tsx deleted file mode 100644 index 6c1c90be..00000000 --- a/common/components/AppAlphaNotice/AlphaNotice.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import React from 'react'; -import moment from 'moment'; -import { NewTabLink } from 'components/ui'; -import { discordURL, APP_ALPHA_EXPIRATION } from 'config'; -import './AlphaNotice.scss'; - -interface State { - isFading: boolean; - isClosed: boolean; -} - -let hasAcknowledged = false; - -export default class AppAlphaNotice extends React.PureComponent<{}, State> { - public state = { - isFading: false, - isClosed: hasAcknowledged - }; - - public render() { - if (this.state.isClosed) { - return null; - } - - const isFading = this.state.isFading ? 'is-fading' : ''; - const expDate = moment(APP_ALPHA_EXPIRATION).format('MMMM Do, YYYY'); - - return ( -
-
-

Welcome to the MyCrypto Desktop App Alpha

-

- Thank you for testing out the new MyCrypto desktop app. This is an early release to be - tested by the community before a full launch. We recommend continuing to use the - production site for large or otherwise important transactions. -

-

- Because this is for testing purposes only,{' '} - this build of the app will only be accessible until {expDate}. You’ll - then be required to update the application to continue using it. -

-

- Feedback and bug reports are greatly appreciated. You can file issues on our{' '} - - GitHub repository - {' '} - or join our Discord server to discuss the - app. -

-

- - For critical reports & vulnerabilities, please use{' '} - HackerOne. - -

- - -
-
- ); - } - - private doContinue = () => { - hasAcknowledged = true; - this.setState({ isFading: true }); - setTimeout(() => { - this.setState({ isClosed: true }); - }, 1000); - }; -} diff --git a/common/components/AppAlphaNotice/AppExpired.scss b/common/components/AppAlphaNotice/AppExpired.scss deleted file mode 100644 index 438fb0e0..00000000 --- a/common/components/AppAlphaNotice/AppExpired.scss +++ /dev/null @@ -1,44 +0,0 @@ -@import 'common/sass/variables'; -@import 'common/sass/mixins'; - -.AppExpired { - @include cover-message; - background: $brand-danger; - display: flex; - align-items: center; - - &-content { - padding-bottom: 60px; - - h2 { - text-align: center; - } - - p { - text-align: justify; - } - - &-btn { - display: block; - width: 100%; - max-width: 280px; - margin: 40px auto 0; - text-align: center; - border: none; - padding: 0; - transition: $transition; - height: 60px; - line-height: 60px; - font-size: 22px; - background: rgba(#fff, 0.96); - color: $gray-dark; - border-radius: 4px; - text-shadow: none; - - &:hover { - background: #fff; - color: $gray-darker; - } - } - } -} diff --git a/common/components/AppAlphaNotice/AppExpired.tsx b/common/components/AppAlphaNotice/AppExpired.tsx deleted file mode 100644 index b241d5e6..00000000 --- a/common/components/AppAlphaNotice/AppExpired.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import { NewTabLink } from 'components/ui'; -import './AppExpired.scss'; - -const AppExpired: React.SFC<{}> = () => ( -
-
-

Your Alpha Build Has Expired

-

- To ensure the safety of your funds, we are expiring alpha builds one month after release and - requiring users to update. All you have to do is download a new build from our GitHub, and - you can continue to use the app. Sorry for the hassle! -

- - - Download a New Build - -
-
-); - -export default AppExpired; diff --git a/common/components/AppAlphaNotice/index.tsx b/common/components/AppAlphaNotice/index.tsx deleted file mode 100644 index 538260e5..00000000 --- a/common/components/AppAlphaNotice/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import { APP_ALPHA_EXPIRATION } from 'config'; -import AlphaNotice from './AlphaNotice'; -import AppExpired from './AppExpired'; - -const AppAlphaNotice: React.SFC<{}> = () => { - if (APP_ALPHA_EXPIRATION < Date.now()) { - return ; - } else { - return ; - } -}; - -export default AppAlphaNotice; diff --git a/common/components/BalanceSidebar/AccountAddress.tsx b/common/components/BalanceSidebar/AccountAddress.tsx index 6b93416c..552af505 100644 --- a/common/components/BalanceSidebar/AccountAddress.tsx +++ b/common/components/BalanceSidebar/AccountAddress.tsx @@ -1,27 +1,23 @@ import React from 'react'; import { connect, MapStateToProps } from 'react-redux'; import translate, { translateRaw } from 'translations'; -import { AppState } from 'reducers'; +import { AppState } from 'features/reducers'; import { - changeAddressLabelEntry, - TChangeAddressLabelEntry, - saveAddressLabelEntry, - TSaveAddressLabelEntry, - removeAddressLabelEntry, - TRemoveAddressLabelEntry -} from 'actions/addressBook'; -import { getAccountAddressEntry, getAddressLabels } from 'selectors/addressBook'; + addressBookConstants, + addressBookActions, + addressBookSelectors +} from 'features/addressBook'; import { Address, Identicon, Input } from 'components/ui'; interface StateProps { - entry: ReturnType; - addressLabels: ReturnType; + entry: ReturnType; + addressLabel: string; } interface DispatchProps { - changeAddressLabelEntry: TChangeAddressLabelEntry; - saveAddressLabelEntry: TSaveAddressLabelEntry; - removeAddressLabelEntry: TRemoveAddressLabelEntry; + changeAddressLabelEntry: addressBookActions.TChangeAddressLabelEntry; + saveAddressLabelEntry: addressBookActions.TSaveAddressLabelEntry; + removeAddressLabelEntry: addressBookActions.TRemoveAddressLabelEntry; } interface OwnProps { @@ -36,8 +32,6 @@ interface State { labelInputTouched: boolean; } -export const ACCOUNT_ADDRESS_ID: string = 'ACCOUNT_ADDRESS_ID'; - class AccountAddress extends React.Component { public state = { editingLabel: false, @@ -55,8 +49,7 @@ class AccountAddress extends React.Component { } public render() { - const { address, addressLabels, networkId } = this.props; - const label = addressLabels[address]; + const { address, addressLabel, networkId } = this.props; const labelContent = this.generateLabelContent(); return ( @@ -73,7 +66,7 @@ class AccountAddress extends React.Component { >
@@ -97,10 +90,9 @@ class AccountAddress extends React.Component { private setLabelInputRef = (node: HTMLInputElement) => (this.labelInput = node); private generateLabelContent = () => { - const { address, addressLabels, entry: { temporaryLabel, labelError } } = this.props; + const { addressLabel, entry: { temporaryLabel, labelError } } = this.props; const { editingLabel, labelInputTouched } = this.state; - const storedLabel = addressLabels[address]; - const newLabelSameAsPrevious = temporaryLabel === storedLabel; + const newLabelSameAsPrevious = temporaryLabel === addressLabel; const labelInputTouchedWithError = labelInputTouched && !newLabelSameAsPrevious && labelError; let labelContent = null; @@ -111,7 +103,7 @@ class AccountAddress extends React.Component { { labelContent = (
- {!!storedLabel && storedLabel.length > 0 - ? storedLabel + {!!addressLabel && addressLabel.length > 0 + ? addressLabel : translate('SIDEBAR_ACCOUNTADDR')}
- -
- - ); - } - - public getErrors() { - const { address, symbol, decimal } = this.state; - const errors: { [key: string]: string } = {}; - - // Formatting errors - if (decimal && !isPositiveIntegerOrZero(Number(decimal))) { - errors.decimal = 'Invalid decimal'; - } - if (address) { - if (!isValidETHAddress(address)) { - errors.address = 'Not a valid address'; - } - if (this.state.tokenAddressLookup[address]) { - errors.address = 'A token with this address already exists'; - } - } - - // Message errors - if (symbol && this.state.tokenSymbolLookup[symbol]) { - errors.symbol = 'A token with this symbol already exists'; - } - - return errors; - } - - public isValid() { - const { address, symbol, decimal } = this.state; - return !Object.keys(this.getErrors()).length && address && symbol && decimal; - } - - public onFieldChange = (e: React.FormEvent) => { - // TODO: typescript bug: https://github.com/Microsoft/TypeScript/issues/13948 - const name: any = e.currentTarget.name; - const value = e.currentTarget.value; - this.setState({ [name]: value }); - }; - - public onSave = (ev: React.FormEvent) => { - ev.preventDefault(); - if (!this.isValid()) { - return; - } - - const { address, symbol, decimal } = this.state; - this.props.onSave({ address, symbol, decimal: parseInt(decimal, 10) }); - }; - - private generateSymbolLookup() { - return this.tknArrToMap('symbol'); - } - - private generateAddressMap() { - return this.tknArrToMap('address'); - } - - private tknArrToMap(key: Exclude) { - const tokens = this.props.allTokens; - return tokens.reduce<{ [k: string]: boolean }>((prev, tk) => { - prev[tk[key]] = true; - return prev; - }, {}); - } -} diff --git a/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm.scss b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddCustomTokenForm.scss similarity index 93% rename from common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm.scss rename to common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddCustomTokenForm.scss index def1066f..fa18991c 100644 --- a/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm.scss +++ b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddCustomTokenForm.scss @@ -7,7 +7,7 @@ &-error { font-size: 13px; font-weight: normal; - color: $brand-danger; + color: color(brand-danger); } } diff --git a/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddCustomTokenForm.tsx b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddCustomTokenForm.tsx new file mode 100644 index 00000000..655b1ba0 --- /dev/null +++ b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddCustomTokenForm.tsx @@ -0,0 +1,120 @@ +import React from 'react'; +import { Result } from 'mycrypto-nano-result'; + +import { HELP_ARTICLE } from 'config'; +import translate from 'translations'; +import { Token } from 'types/network'; +import { HelpLink } from 'components/ui'; +import { AddressField } from './AddressField'; +import { DecimalField } from './DecimalField'; +import { SymbolField } from './SymbolField'; +import { BalanceField } from './BalanceField'; +import './AddCustomTokenForm.scss'; + +interface Props { + allTokens: Token[]; + onSave(params: Token): void; + toggleForm(): void; +} + +export interface IGenerateSymbolLookup { + [tokenSymbol: string]: boolean; +} + +export interface IGenerateAddressLookup { + [address: string]: boolean; +} + +interface State { + address: Result; + symbol: Result; + decimal: Result; +} + +export class AddCustomTokenForm extends React.PureComponent { + public state: State = { + address: Result.from({ err: 'This field is empty' }), + symbol: Result.from({ err: 'This field is empty' }), + decimal: Result.from({ err: 'This field is empty' }) + }; + + private tokenSymbolLookup = this.generateSymbolLookup(); + private tokenAddressLookup = this.generateAddressMap(); + + public render() { + const address = this.state.address.toVal().res; + + return ( +
+ + + + + + {translate('ADD_CUSTOM_TKN_HELP')} + +
+ + +
+ + ); + } + + public onSave = (ev: React.FormEvent) => { + ev.preventDefault(); + if (!this.isValid()) { + return; + } + + const { address, symbol, decimal } = this.state; + this.props.onSave({ + address: address.unwrap(), + symbol: symbol.unwrap(), + decimal: parseInt(decimal.unwrap(), 10) + }); + }; + + private handleFieldChange = (fieldName: keyof State) => (res: Result) => { + this.setState({ [fieldName as any]: res }); + }; + + private isValid() { + const { address, decimal, symbol } = this.state; + const valid = address.ok() && decimal.ok() && symbol.ok(); + return valid; + } + + private generateSymbolLookup() { + return this.tokenArrayToMap('symbol'); + } + + private generateAddressMap() { + return this.tokenArrayToMap('address'); + } + + private tokenArrayToMap(key: Exclude) { + const tokens = this.props.allTokens; + return tokens.reduce<{ [k: string]: boolean }>((prev, tk) => { + prev[tk[key]] = true; + return prev; + }, {}); + } +} diff --git a/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddressField.tsx b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddressField.tsx new file mode 100644 index 00000000..6ed11eff --- /dev/null +++ b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/AddressField.tsx @@ -0,0 +1,59 @@ +import React from 'react'; +import { Result } from 'mycrypto-nano-result'; + +import { translateRaw } from 'translations'; +import { isValidETHAddress } from 'libs/validators'; +import { Input } from 'components/ui'; +import { IGenerateAddressLookup } from './AddCustomTokenForm'; + +interface OwnProps { + addressLookup: IGenerateAddressLookup; + onChange(address: Result): void; +} + +enum ErrType { + INVALIDADDR = 'Not a valid address', + ADDRTAKEN = 'A token with this address already exists' +} + +interface State { + address: Result; + userInput: string; +} + +export class AddressField extends React.Component { + public state: State = { + address: Result.from({ res: '' }), + userInput: '' + }; + + public render() { + const { userInput, address } = this.state; + + return ( + + ); + } + + private handleFieldChange = (e: React.FormEvent) => { + const userInput = e.currentTarget.value; + const addrTaken = this.props.addressLookup[userInput]; + const validAddr = isValidETHAddress(userInput); + const err = addrTaken ? ErrType.ADDRTAKEN : !validAddr ? ErrType.INVALIDADDR : undefined; + const address: Result = err ? Result.from({ err }) : Result.from({ res: userInput }); + + this.setState({ userInput, address }); + this.props.onChange(address); + }; +} diff --git a/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/BalanceField.tsx b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/BalanceField.tsx new file mode 100644 index 00000000..427b3522 --- /dev/null +++ b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/BalanceField.tsx @@ -0,0 +1,124 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import { Result } from 'mycrypto-nano-result'; + +import ERC20 from 'libs/erc20'; +import { shepherdProvider } from 'libs/nodes'; +import { AppState } from 'features/reducers'; +import { walletSelectors } from 'features/wallet'; +import Spinner from 'components/ui/Spinner'; +import { Input } from 'components/ui'; + +interface OwnProps { + address?: string; +} + +interface StateProps { + walletInst: ReturnType; +} + +interface State { + balance: Result; + addressToLoad?: string; + loading: boolean; +} + +type Props = OwnProps & StateProps; + +class BalanceFieldClass extends React.Component { + public static getDerivedStateFromProps( + nextProps: OwnProps, + prevState: State + ): Partial | null { + if (nextProps.address && nextProps.address !== prevState.addressToLoad) { + return { loading: true, addressToLoad: nextProps.address }; + } + return null; + } + + public state: State = { + balance: Result.from({ res: '' }), + loading: false + }; + + private currentRequest: Promise | null; + + public componentDidUpdate() { + if (this.state.addressToLoad && this.state.loading) { + this.attemptToLoadBalance(this.state.addressToLoad); + } + } + + public componentWillUnmount() { + if (this.currentRequest) { + this.currentRequest = null; + } + } + public render() { + const { balance, loading } = this.state; + + return ( + + ); + } + + private attemptToLoadBalance(address: string) { + // process request + this.currentRequest = this.loadBalance(address) + // set state on successful request e.g it was not cancelled + // and then also set our current request to null + .then(({ balance }) => + this.setState({ + balance, + loading: false + }) + ) + .catch(e => { + console.error(e); + // if the component is unmounted, then dont call set state + if (!this.currentRequest) { + return; + } + + // otherwise it was a failed fetch call + this.setState({ loading: false }); + }) + .then(() => (this.currentRequest = null)); + } + + private loadBalance(address: string) { + if (!this.props.walletInst) { + return Promise.reject('No wallet found'); + } + + const owner = this.props.walletInst.getAddressString(); + return shepherdProvider + .sendCallRequest({ data: ERC20.balanceOf.encodeInput({ _owner: owner }), to: address }) + .then(ERC20.balanceOf.decodeOutput) + .then(({ balance }) => { + const result = Result.from({ res: balance }); + return { balance: result }; + }); + } +} + +function mapStateToProps(state: AppState): StateProps { + return { walletInst: walletSelectors.getWalletInst(state) }; +} + +export const BalanceField = connect(mapStateToProps)(BalanceFieldClass); diff --git a/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/DecimalField.tsx b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/DecimalField.tsx new file mode 100644 index 00000000..9a4a42cf --- /dev/null +++ b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/DecimalField.tsx @@ -0,0 +1,34 @@ +import React from 'react'; +import { Result } from 'mycrypto-nano-result'; + +import { translateRaw } from 'translations'; +import { isPositiveIntegerOrZero } from 'libs/validators'; +import { FieldInput } from './FieldInput'; + +interface OwnProps { + address?: string; + onChange(decimals: Result): void; +} + +export class DecimalField extends React.Component { + public render() { + return ( + !(req.toVal().res === '0')} + address={this.props.address} + userInputValidator={this.isValidUserInput} + onChange={this.props.onChange} + /> + ); + } + + private isValidUserInput = (userInput: string) => { + const validDecimals = isPositiveIntegerOrZero(Number(userInput)); + const decimals: Result = validDecimals + ? Result.from({ res: userInput }) + : Result.from({ err: 'Invalid decimal' }); + return decimals; + }; +} diff --git a/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/FieldInput.tsx b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/FieldInput.tsx new file mode 100644 index 00000000..892f09a7 --- /dev/null +++ b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/FieldInput.tsx @@ -0,0 +1,134 @@ +import React from 'react'; +import { Result } from 'mycrypto-nano-result'; + +import { shepherdProvider } from 'libs/nodes'; +import ERC20 from 'libs/erc20'; +import Spinner from 'components/ui/Spinner'; +import { Input } from 'components/ui'; + +interface OwnProps { + fieldToFetch: keyof Pick; + fieldName: string; + address?: string; + userInputValidator(input: string): Result; + fetchedFieldValidator?(input: any): Result; + shouldEnableAutoField(input: Result): boolean; + onChange(symbol: Result): void; +} + +interface State { + field: Result; + autoField: boolean; + userInput: string; + addressToLoad?: string; + loading: boolean; +} + +export class FieldInput extends React.Component { + public static getDerivedStateFromProps( + nextProps: OwnProps, + prevState: State + ): Partial | null { + if (nextProps.address && nextProps.address !== prevState.addressToLoad) { + return { loading: true, autoField: true, addressToLoad: nextProps.address }; + } + return null; + } + + public state: State = { + userInput: '', + autoField: true, + field: Result.from({ res: '' }), + loading: false + }; + + private currentRequest: Promise | null; + + public componentDidUpdate() { + if (this.state.addressToLoad && this.state.loading) { + this.attemptToLoadField(this.state.addressToLoad); + } + } + + public componentWillUnmount() { + if (this.currentRequest) { + this.currentRequest = null; + } + } + + public render() { + const { userInput, field, autoField, loading } = this.state; + + return ( + + ); + } + + private handleFieldChange = (args: React.FormEvent) => { + const userInput = args.currentTarget.value; + const field = this.props.userInputValidator(userInput); + this.setState({ userInput, field }); + this.props.onChange(field); + }; + + private attemptToLoadField(address: string) { + // process request + this.currentRequest = this.loadField(address) + // set state on successful request e.g it was not cancelled + // and then also set our current request to null + .then(({ [this.props.fieldToFetch]: field }) => + this.setState({ + field, + loading: false, + autoField: this.props.shouldEnableAutoField(field) + }) + ) + .catch(e => { + console.error(e); + // if the component is unmounted, then dont call set state + if (!this.currentRequest) { + return; + } + + // otherwise it was a failed fetch call + this.setState({ autoField: false, loading: false }); + }) + .then(() => (this.currentRequest = null)); + } + + private loadField(address: string) { + const { fieldToFetch } = this.props; + return shepherdProvider + .sendCallRequest({ data: ERC20[fieldToFetch].encodeInput(), to: address }) + .then(ERC20[fieldToFetch].decodeOutput as any) + .then(({ [fieldToFetch]: field }) => { + let result: Result; + if (this.props.fetchedFieldValidator) { + result = this.props.fetchedFieldValidator(field); + } else { + result = Result.from({ res: field }); + } + + // + // + this.props.onChange(result); + return { [fieldToFetch]: result }; + }); + } +} diff --git a/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/SymbolField.tsx b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/SymbolField.tsx new file mode 100644 index 00000000..b325c9f3 --- /dev/null +++ b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/SymbolField.tsx @@ -0,0 +1,40 @@ +import React from 'react'; +import { Result } from 'mycrypto-nano-result'; + +import { translateRaw } from 'translations'; +import { IGenerateSymbolLookup } from './AddCustomTokenForm'; +import { FieldInput } from './FieldInput'; + +interface OwnProps { + address?: string; + symbolLookup: IGenerateSymbolLookup; + onChange(symbol: Result): void; +} + +export class SymbolField extends React.Component { + public render() { + return ( + !req.err()} + address={this.props.address} + userInputValidator={this.isValidUserInput} + fetchedFieldValidator={field => + field + ? Result.from({ res: field }) + : Result.from({ err: 'No Symbol found, please input the token symbol manually' }) + } + onChange={this.props.onChange} + /> + ); + } + + private isValidUserInput = (userInput: string) => { + const validSymbol = !this.props.symbolLookup[userInput]; + const symbol: Result = validSymbol + ? Result.from({ res: userInput }) + : Result.from({ err: 'A token with this symbol already exists' }); + return symbol; + }; +} diff --git a/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/index.ts b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/index.ts new file mode 100644 index 00000000..bd180f65 --- /dev/null +++ b/common/components/BalanceSidebar/TokenBalances/AddCustomTokenForm/index.ts @@ -0,0 +1 @@ +export * from './AddCustomTokenForm'; diff --git a/common/components/BalanceSidebar/TokenBalances/Balances.tsx b/common/components/BalanceSidebar/TokenBalances/Balances.tsx index c21f35d1..ac1776de 100644 --- a/common/components/BalanceSidebar/TokenBalances/Balances.tsx +++ b/common/components/BalanceSidebar/TokenBalances/Balances.tsx @@ -1,13 +1,14 @@ import React from 'react'; + import translate from 'translations'; -import { TokenBalance } from 'selectors/wallet'; -import AddCustomTokenForm from './AddCustomTokenForm'; -import TokenRow from './TokenRow'; import { Token } from 'types/network'; +import { walletTypes } from 'features/wallet'; +import { AddCustomTokenForm } from './AddCustomTokenForm'; +import TokenRow from './TokenRow'; interface Props { allTokens: Token[]; - tokenBalances: TokenBalance[]; + tokenBalances: walletTypes.TokenBalance[]; hasSavedWalletTokens: boolean; scanWalletForTokens(): any; setWalletTokens(tokens: string[]): any; @@ -46,7 +47,7 @@ export default class TokenBalances extends React.PureComponent { let bottom; let help; if (tokenBalances.length && !hasSavedWalletTokens && !this.onlyCustomTokens()) { - help = 'Select which tokens you would like to keep track of'; + help = translate('SELECT_WHICH_TOKENS'); bottom = (
+ +
+
+ + ); + } + + private doContinue = () => { + localStorage.setItem(LS_KEY, 'true'); + this.setState({ isFading: true }); + + setTimeout(() => { + this.setState({ hasAcknowledged: true }); + }, 1000); + }; + + private reject = () => { + window.location.assign('https://mycrypto.com'); + }; +} diff --git a/common/components/ConfirmationModal/ConfirmationModal.tsx b/common/components/ConfirmationModal/ConfirmationModal.tsx index e151bebf..b6be7dfa 100644 --- a/common/components/ConfirmationModal/ConfirmationModal.tsx +++ b/common/components/ConfirmationModal/ConfirmationModal.tsx @@ -1,10 +1,12 @@ -import { Body } from './components'; +import React from 'react'; +import { Omit } from 'react-redux'; + import { ConfirmationModalTemplate, OwnProps as TemplateProps } from 'components/ConfirmationModalTemplate'; -import React from 'react'; -import { Omit } from 'react-redux'; +import { Body } from './components'; + type Props = Omit; export const ConfirmationModal: React.SFC = props => ( diff --git a/common/components/ConfirmationModal/components/Body/Body.scss b/common/components/ConfirmationModal/components/Body/Body.scss index 3e3b72df..358c96a8 100644 --- a/common/components/ConfirmationModal/components/Body/Body.scss +++ b/common/components/ConfirmationModal/components/Body/Body.scss @@ -8,11 +8,11 @@ .tx-modal-testnet-warn { text-align: center; - background-color: $brand-warning; - border-radius: 3px; + background-color: color(brand-warning); + border-radius: 2px; padding: 0.5rem 0.75rem; font-weight: 400; - color: white; + color: color(text-color-inverted); margin: auto; margin-bottom: 1rem; } diff --git a/common/components/ConfirmationModal/components/Body/Body.tsx b/common/components/ConfirmationModal/components/Body/Body.tsx index 8c4ab0d2..b11394da 100644 --- a/common/components/ConfirmationModal/components/Body/Body.tsx +++ b/common/components/ConfirmationModal/components/Body/Body.tsx @@ -1,13 +1,14 @@ +import React from 'react'; +import { connect } from 'react-redux'; + +import translate from 'translations'; +import { NetworkConfig } from 'types/network'; +import { AppState } from 'features/reducers'; +import { getNetworkConfig } from 'features/config'; import { Addresses } from './components/Addresses'; import { Amounts } from './components/Amounts'; import { Details } from './components/Details'; -import React from 'react'; -import { connect } from 'react-redux'; -import { AppState } from 'reducers'; import './Body.scss'; -import { getNetworkConfig } from 'selectors/config'; -import { NetworkConfig } from 'types/network'; -import translate from 'translations'; interface State { showDetails: boolean; diff --git a/common/components/ConfirmationModal/components/Body/components/Addresses.scss b/common/components/ConfirmationModal/components/Body/components/Addresses.scss index 7f510ccf..fde6c803 100644 --- a/common/components/ConfirmationModal/components/Body/components/Addresses.scss +++ b/common/components/ConfirmationModal/components/Body/components/Addresses.scss @@ -35,7 +35,7 @@ margin: 0; font-family: $font-family-monospace; font-weight: 400; - opacity: 0.54; + color: shade-dark(0.4); word-wrap: break-word; } } @@ -50,7 +50,7 @@ margin: 0; padding: 0; font-weight: 400; - color: rgba(0, 0, 0, 0.54); + color: shade-dark(0.4); } &-link { font-family: $font-family-monospace; diff --git a/common/components/ConfirmationModal/components/Body/components/Addresses.tsx b/common/components/ConfirmationModal/components/Body/components/Addresses.tsx index f69f821b..27857328 100644 --- a/common/components/ConfirmationModal/components/Body/components/Addresses.tsx +++ b/common/components/ConfirmationModal/components/Body/components/Addresses.tsx @@ -1,28 +1,29 @@ import React, { Component } from 'react'; -import ERC20 from 'libs/erc20'; -import { Identicon } from 'components/ui'; -import arrow from 'assets/images/tail-triangle-down.svg'; -import './Addresses.scss'; -import { ETHAddressExplorer } from 'config'; import { connect } from 'react-redux'; -import { SerializedTransaction } from 'components/renderCbs'; -import { AppState } from 'reducers'; -import { getFrom, getUnit, isEtherTransaction } from 'selectors/transaction'; -import { toChecksumAddress } from 'ethereumjs-util'; + +import { ETHAddressExplorer } from 'config'; import translate from 'translations'; +import ERC20 from 'libs/erc20'; +import { AppState } from 'features/reducers'; +import * as selectors from 'features/selectors'; +import { getChecksumAddressFn } from 'features/config'; +import arrow from 'assets/images/tail-triangle-down.svg'; +import { SerializedTransaction } from 'components/renderCbs'; +import { Identicon } from 'components/ui'; +import './Addresses.scss'; interface StateProps { - from: AppState['transaction']['meta']['from']; - unit: AppState['transaction']['meta']['unit']; + from: ReturnType; + unit: ReturnType; isToken: boolean; + toChecksumAddress: ReturnType; } const size = '3rem'; class AddressesClass extends Component { public render() { - const { from, isToken, unit } = this.props; - + const { from, isToken, unit, toChecksumAddress } = this.props; return ( { @@ -90,9 +91,10 @@ class AddressesClass extends Component { } const mapStateToProps = (state: AppState): StateProps => ({ - from: getFrom(state), - isToken: !isEtherTransaction(state), - unit: getUnit(state) + from: selectors.getFrom(state), + isToken: !selectors.isEtherTransaction(state), + unit: selectors.getUnit(state), + toChecksumAddress: getChecksumAddressFn(state) }); export const Addresses = connect(mapStateToProps)(AddressesClass); diff --git a/common/components/ConfirmationModal/components/Body/components/Amounts.scss b/common/components/ConfirmationModal/components/Body/components/Amounts.scss index 9a0c8c77..bed66ba1 100644 --- a/common/components/ConfirmationModal/components/Body/components/Amounts.scss +++ b/common/components/ConfirmationModal/components/Body/components/Amounts.scss @@ -12,17 +12,21 @@ @media screen and (max-width: 525px) { font-size: 1rem; } + > td { padding: 0.5rem 0; text-align: right; - opacity: 0.54; + color: shade-dark(0.5); + &:not(:first-child) { padding-left: 0.5rem; } + &:first-child { text-align: left; - opacity: 1; + color: color(text-color); } + &:last-child { font-size: 85%; } @@ -36,7 +40,7 @@ } &-total { - background-image: linear-gradient(to right, #c2cfd6 33%, #fff0 0%); + background-image: linear-gradient(to right, color(control-border) 33%, transparent 0%); background-position: top; background-size: 5px 1px; background-repeat: repeat-x; diff --git a/common/components/ConfirmationModal/components/Body/components/Amounts.tsx b/common/components/ConfirmationModal/components/Body/components/Amounts.tsx index 0b06da73..d05637a3 100644 --- a/common/components/ConfirmationModal/components/Body/components/Amounts.tsx +++ b/common/components/ConfirmationModal/components/Body/components/Amounts.tsx @@ -1,15 +1,18 @@ import React, { Component } from 'react'; +import { connect } from 'react-redux'; + +import translate from 'translations'; +import { NetworkConfig } from 'types/network'; +import { AppState } from 'features/reducers'; +import * as derivedSelectors from 'features/selectors'; +import { getNetworkConfig } from 'features/config'; +import { transactionSignTypes } from 'features/transaction'; import { UnitDisplay } from 'components/ui'; import './Amounts.scss'; -import { AppState } from 'reducers'; -import { getAllUSDValuesFromSerializedTx, AllUSDValues } from 'selectors/rates'; -import { SerializedTxParams, getParamsFromSerializedTx } from 'selectors/transaction'; -import { connect } from 'react-redux'; -import { getNetworkConfig } from 'selectors/config'; -import { NetworkConfig } from 'types/network'; -import translate from 'translations'; -interface StateProps extends SerializedTxParams, AllUSDValues { +interface StateProps + extends transactionSignTypes.SerializedTxParams, + derivedSelectors.AllUSDValues { network: NetworkConfig; } @@ -107,8 +110,8 @@ class AmountsClass extends Component { } const mapStateToProps = (state: AppState): StateProps => ({ - ...getParamsFromSerializedTx(state), - ...getAllUSDValuesFromSerializedTx(state), + ...derivedSelectors.getParamsFromSerializedTx(state), + ...derivedSelectors.getAllUSDValuesFromSerializedTx(state), network: getNetworkConfig(state) }); diff --git a/common/components/ConfirmationModal/components/Body/components/Details.scss b/common/components/ConfirmationModal/components/Body/components/Details.scss index 3ae76f69..c023005e 100644 --- a/common/components/ConfirmationModal/components/Body/components/Details.scss +++ b/common/components/ConfirmationModal/components/Body/components/Details.scss @@ -5,7 +5,7 @@ &-network-info { text-align: center; font-weight: 400; - color: rgba(0, 0, 0, 0.54); + color: shade-dark(0.5); } &-button { display: block; @@ -14,8 +14,9 @@ border: none; border-radius: 3px; transition: background-color 300ms; + background-color: transparent; &:hover { - background-color: rgba(153, 153, 153, 0.12); + background-color: shade-dark(0.06); } } } diff --git a/common/components/ConfirmationModal/components/Body/components/Details.tsx b/common/components/ConfirmationModal/components/Body/components/Details.tsx index 3760e40e..d83b3c16 100644 --- a/common/components/ConfirmationModal/components/Body/components/Details.tsx +++ b/common/components/ConfirmationModal/components/Body/components/Details.tsx @@ -1,14 +1,15 @@ import React, { Component } from 'react'; -import './Details.scss'; -import { SerializedTransaction } from 'components/renderCbs'; -import { AppState } from 'reducers'; -import { getNodeConfig } from 'selectors/config'; import { connect } from 'react-redux'; -import { NodeConfig } from 'types/node'; -import translate from 'translations'; -import { CodeBlock, Input } from 'components/ui'; import { addHexPrefix } from 'ethereumjs-util'; +import translate, { translateRaw } from 'translations'; +import { NodeConfig } from 'types/node'; +import { CodeBlock, Input } from 'components/ui'; +import { AppState } from 'features/reducers'; +import { getNodeConfig } from 'features/config'; +import { SerializedTransaction } from 'components/renderCbs'; +import './Details.scss'; + interface StateProps { node: NodeConfig; } @@ -19,12 +20,14 @@ class DetailsClass extends Component { return (
diff --git a/common/components/ConfirmationModal/components/Body/components/Node.tsx b/common/components/ConfirmationModal/components/Body/components/Node.tsx index f8941f1e..2dfe85e7 100644 --- a/common/components/ConfirmationModal/components/Body/components/Node.tsx +++ b/common/components/ConfirmationModal/components/Body/components/Node.tsx @@ -1,8 +1,10 @@ import React, { Component } from 'react'; -import { AppState } from 'reducers'; import { connect } from 'react-redux'; -import { getNodeConfig } from 'selectors/config'; + +import translate from 'translations'; import { StaticNodeConfig } from 'types/node'; +import { AppState } from 'features/reducers'; +import { getNodeConfig } from 'features/config'; interface StateProps { node: StaticNodeConfig; @@ -12,8 +14,8 @@ class NodeClass extends Component { public render() { return (
  • - You are interacting with the {this.props.node.network} network provided by{' '} - {this.props.node.service} + {translate('YOU_ARE_INTERACTING')} {this.props.node.network} + {translate('NETWORK')} {translate('PROVIDED_BY')} {this.props.node.service}
  • ); } diff --git a/common/components/ConfirmationModalTemplate/ConfirmationModalTemplate.scss b/common/components/ConfirmationModalTemplate/ConfirmationModalTemplate.scss index 3477ea74..e40bc7a1 100644 --- a/common/components/ConfirmationModalTemplate/ConfirmationModalTemplate.scss +++ b/common/components/ConfirmationModalTemplate/ConfirmationModalTemplate.scss @@ -36,7 +36,7 @@ $button-break: 'max-width: 620px'; } &-currency { - color: $brand-danger; + color: color(brand-danger); } } } diff --git a/common/components/ConfirmationModalTemplate/ConfirmationModalTemplate.tsx b/common/components/ConfirmationModalTemplate/ConfirmationModalTemplate.tsx index 78a8c111..d07912cf 100644 --- a/common/components/ConfirmationModalTemplate/ConfirmationModalTemplate.tsx +++ b/common/components/ConfirmationModalTemplate/ConfirmationModalTemplate.tsx @@ -1,28 +1,23 @@ import React from 'react'; +import { connect } from 'react-redux'; + +import { translateRaw, translate } from 'translations'; +import { AppState } from 'features/reducers'; +import { getLanguageSelection } from 'features/config'; +import { transactionBroadcastActions, transactionSelectors } from 'features/transaction'; +import { walletSelectors } from 'features/wallet'; import Modal, { IButton } from 'components/ui/Modal'; import Spinner from 'components/ui/Spinner'; -import { connect } from 'react-redux'; -import { getWalletType, IWalletType } from 'selectors/wallet'; -import { getLanguageSelection } from 'selectors/config'; -import { - broadcastLocalTransactionRequested, - TBroadcastLocalTransactionRequested, - broadcastWeb3TransactionRequested, - TBroadcastWeb3TransactionRequested -} from 'actions/transaction'; -import { currentTransactionBroadcasting } from 'selectors/transaction'; import './ConfirmationModalTemplate.scss'; -import { AppState } from 'reducers'; -import { translateRaw, translate } from 'translations'; interface DispatchProps { - broadcastLocalTransactionRequested: TBroadcastLocalTransactionRequested; - broadcastWeb3TransactionRequested: TBroadcastWeb3TransactionRequested; + broadcastLocalTransactionRequested: transactionBroadcastActions.TBroadcastLocalTransactionRequested; + broadcastWeb3TransactionRequested: transactionBroadcastActions.TBroadcastWeb3TransactionRequested; } interface StateProps { lang: string; - walletTypes: IWalletType; + walletTypes: walletSelectors.IWalletType; transactionBroadcasting: boolean; } @@ -105,6 +100,7 @@ class ConfirmationModalTemplateClass extends React.Component { buttons={buttons} handleClose={onClose} disableButtons={transactionBroadcasting} + hideButtons={transactionBroadcasting} isOpen={isOpen} > {transactionBroadcasting ? ( @@ -133,9 +129,13 @@ class ConfirmationModalTemplateClass extends React.Component { export const ConfirmationModalTemplate = connect( (state: AppState) => ({ - transactionBroadcasting: currentTransactionBroadcasting(state), + transactionBroadcasting: transactionSelectors.currentTransactionBroadcasting(state), lang: getLanguageSelection(state), - walletTypes: getWalletType(state) + walletTypes: walletSelectors.getWalletType(state) }), - { broadcastLocalTransactionRequested, broadcastWeb3TransactionRequested } + { + broadcastLocalTransactionRequested: + transactionBroadcastActions.broadcastLocalTransactionRequested, + broadcastWeb3TransactionRequested: transactionBroadcastActions.broadcastWeb3TransactionRequested + } )(ConfirmationModalTemplateClass); diff --git a/common/components/CurrentCustomMessage.tsx b/common/components/CurrentCustomMessage.tsx index 18c913e9..c035b87a 100644 --- a/common/components/CurrentCustomMessage.tsx +++ b/common/components/CurrentCustomMessage.tsx @@ -1,12 +1,14 @@ import React, { PureComponent } from 'react'; import { connect } from 'react-redux'; -import { AppState } from 'reducers'; -import { getCurrentTo, ICurrentTo } from 'selectors/transaction'; -import { getAllTokens } from 'selectors/config'; -import { getWalletInst } from 'selectors/wallet'; + import { getAddressMessage } from 'config'; -import { Address } from 'components/ui'; import { Token } from 'types/network'; +import { ICurrentTo } from 'features/types'; +import { AppState } from 'features/reducers'; +import * as derivedSelectors from 'features/selectors'; +import { getAllTokens } from 'features/config'; +import { walletSelectors } from 'features/wallet'; +import { Address } from 'components/ui'; interface ReduxProps { currentTo: ICurrentTo; @@ -116,7 +118,7 @@ class CurrentCustomMessageClass extends PureComponent { } export const CurrentCustomMessage = connect((state: AppState): ReduxProps => ({ - currentTo: getCurrentTo(state), + currentTo: derivedSelectors.getCurrentTo(state), tokens: getAllTokens(state), - wallet: getWalletInst(state) + wallet: walletSelectors.getWalletInst(state) }))(CurrentCustomMessageClass); diff --git a/common/components/CustomNodeModal/CustomNodeModal.tsx b/common/components/CustomNodeModal/CustomNodeModal.tsx index 883f8679..5efdb552 100644 --- a/common/components/CustomNodeModal/CustomNodeModal.tsx +++ b/common/components/CustomNodeModal/CustomNodeModal.tsx @@ -1,17 +1,21 @@ import React from 'react'; -import Modal, { IButton } from 'components/ui/Modal'; +import { connect } from 'react-redux'; +import { exists, SuccessConfig, FailConfig } from 'mycrypto-eth-exists'; + import translate, { translateRaw } from 'translations'; import { CustomNetworkConfig } from 'types/network'; import { CustomNodeConfig } from 'types/node'; -import { TAddCustomNetwork, addCustomNetwork, AddCustomNodeAction } from 'actions/config'; -import { connect } from 'react-redux'; -import { AppState } from 'reducers'; +import { AppState } from 'features/reducers'; import { getCustomNetworkConfigs, + getStaticNetworkConfigs, getCustomNodeConfigs, - getStaticNetworkConfigs -} from 'selectors/config'; + AddCustomNodeAction, + TAddCustomNetwork, + addCustomNetwork +} from 'features/config'; import { Input, Dropdown } from 'components/ui'; +import Modal, { IButton } from 'components/ui/Modal'; import './CustomNodeModal.scss'; const CUSTOM = { label: 'Custom', value: 'custom' }; @@ -42,12 +46,13 @@ interface State { hasAuth: boolean; username: string; password: string; + defaultNodes: ((SuccessConfig | FailConfig) & { display: string; index: number })[]; } type Props = OwnProps & StateProps & DispatchProps; class CustomNodeModal extends React.Component { - public INITIAL_STATE = { + public INITIAL_STATE: State = { name: '', url: '', network: Object.keys(this.props.staticNetworks)[0], @@ -56,10 +61,19 @@ class CustomNodeModal extends React.Component { customNetworkChainId: '', hasAuth: false, username: '', - password: '' + password: '', + defaultNodes: [] }; + public state: State = this.INITIAL_STATE; + private timer: number | null; + + constructor(props: Props) { + super(props); + this.pollForDefaultNodes(); + } + public componentDidUpdate(prevProps: Props) { // Reset state when modal opens if (!prevProps.isOpen && prevProps.isOpen !== this.props.isOpen) { @@ -67,6 +81,13 @@ class CustomNodeModal extends React.Component { } } + public componentWillUnmount() { + if (this.timer) { + window.clearInterval(this.timer); + } + this.timer = null; + } + public render() { const { customNetworks, handleClose, staticNetworks, isOpen } = this.props; const { network, customNetworkChainId } = this.state; @@ -114,6 +135,8 @@ class CustomNodeModal extends React.Component {
    )} + {this.renderDefaultNodeDropdown()} +
    diff --git a/common/components/GasLimitField.tsx b/common/components/GasLimitField.tsx index ec63952b..690d7256 100644 --- a/common/components/GasLimitField.tsx +++ b/common/components/GasLimitField.tsx @@ -1,10 +1,11 @@ import React from 'react'; -import { GasLimitFieldFactory } from './GasLimitFieldFactory'; + import translate from 'translations'; import { gasLimitValidator } from 'libs/validators'; -import { InlineSpinner } from 'components/ui/InlineSpinner'; -import './GasLimitField.scss'; import { Input } from 'components/ui'; +import { InlineSpinner } from 'components/ui/InlineSpinner'; +import { GasLimitFieldFactory } from './GasLimitFieldFactory'; +import './GasLimitField.scss'; interface Props { customLabel?: string; diff --git a/common/components/GasLimitFieldFactory/GasLimitFieldFactory.tsx b/common/components/GasLimitFieldFactory/GasLimitFieldFactory.tsx index 4b279e15..cea0fcc1 100644 --- a/common/components/GasLimitFieldFactory/GasLimitFieldFactory.tsx +++ b/common/components/GasLimitFieldFactory/GasLimitFieldFactory.tsx @@ -1,11 +1,12 @@ import React, { Component } from 'react'; +import { connect } from 'react-redux'; + +import { sanitizeNumericalInput } from 'libs/values'; +import { AppState } from 'features/reducers'; +import { transactionFieldsActions } from 'features/transaction'; +import { scheduleSelectors } from 'features/schedule'; import { GasQuery } from 'components/renderCbs'; import { GasLimitInput } from './GasLimitInputFactory'; -import { inputGasLimit, TInputGasLimit } from 'actions/transaction'; -import { connect } from 'react-redux'; -import { AppState } from 'reducers'; -import { sanitizeNumericalInput } from 'libs/values'; -import { getSchedulingToggle } from 'selectors/schedule/fields'; const defaultGasLimit = '21000'; @@ -17,7 +18,7 @@ export interface CallBackProps { } interface DispatchProps { - inputGasLimit: TInputGasLimit; + inputGasLimit: transactionFieldsActions.TInputGasLimit; } interface OwnProps { @@ -56,9 +57,9 @@ class GasLimitFieldClass extends Component { const GasLimitField = connect( (state: AppState) => ({ - scheduling: getSchedulingToggle(state).value + scheduling: scheduleSelectors.getSchedulingToggle(state).value }), - { inputGasLimit } + { inputGasLimit: transactionFieldsActions.inputGasLimit } )(GasLimitFieldClass); interface DefaultGasLimitFieldProps { diff --git a/common/components/GasLimitFieldFactory/GasLimitInputFactory.tsx b/common/components/GasLimitFieldFactory/GasLimitInputFactory.tsx index 38a5e7d1..763a8a86 100644 --- a/common/components/GasLimitFieldFactory/GasLimitInputFactory.tsx +++ b/common/components/GasLimitFieldFactory/GasLimitInputFactory.tsx @@ -1,10 +1,11 @@ import React, { Component } from 'react'; -import { Query } from 'components/renderCbs'; import { connect } from 'react-redux'; -import { AppState } from 'reducers'; -import { getGasLimit, getGasEstimationPending } from 'selectors/transaction'; + +import { AppState } from 'features/reducers'; +import { getAutoGasLimitEnabled } from 'features/config'; +import { transactionFieldsSelectors, transactionNetworkSelectors } from 'features/transaction'; import { CallBackProps } from 'components/GasLimitFieldFactory'; -import { getAutoGasLimitEnabled } from 'selectors/config'; +import { Query } from 'components/renderCbs'; interface StateProps { gasLimit: AppState['transaction']['fields']['gasLimit']; @@ -37,7 +38,7 @@ class GasLimitInputClass extends Component { } } export const GasLimitInput = connect((state: AppState) => ({ - gasLimit: getGasLimit(state), - gasEstimationPending: getGasEstimationPending(state), + gasLimit: transactionFieldsSelectors.getGasLimit(state), + gasEstimationPending: transactionNetworkSelectors.getGasEstimationPending(state), autoGasLimitEnabled: getAutoGasLimitEnabled(state) }))(GasLimitInputClass); diff --git a/common/components/GenerateKeystoreModal/index.tsx b/common/components/GenerateKeystoreModal/index.tsx index 57a0cc28..c7106428 100644 --- a/common/components/GenerateKeystoreModal/index.tsx +++ b/common/components/GenerateKeystoreModal/index.tsx @@ -1,10 +1,11 @@ import React from 'react'; -import { generateKeystoreFileInfo, KeystoreFile } from 'utils/keystore'; -import Modal from 'components/ui/Modal'; -import { TogglablePassword } from 'components'; -import translate, { translateRaw } from 'translations'; + import { MINIMUM_PASSWORD_LENGTH } from 'config'; +import translate, { translateRaw } from 'translations'; +import { generateKeystoreFileInfo, KeystoreFile } from 'utils/keystore'; import { isValidPrivKey } from 'libs/validators'; +import { TogglablePassword } from 'components'; +import Modal from 'components/ui/Modal'; import './index.scss'; interface Props { diff --git a/common/components/GenerateTransaction.tsx b/common/components/GenerateTransaction.tsx index 2345db8c..82f028a4 100644 --- a/common/components/GenerateTransaction.tsx +++ b/common/components/GenerateTransaction.tsx @@ -1,7 +1,8 @@ -import { GenerateTransactionFactory } from './GenerateTransactionFactory'; import React from 'react'; + import translate from 'translations'; import { SigningStatus } from 'components'; +import { GenerateTransactionFactory } from './GenerateTransactionFactory'; import './GenerateTransaction.scss'; export const GenerateTransaction: React.SFC<{}> = () => ( diff --git a/common/components/GenerateTransactionFactory/Container.tsx b/common/components/GenerateTransactionFactory/Container.tsx index d7814ead..702437d1 100644 --- a/common/components/GenerateTransactionFactory/Container.tsx +++ b/common/components/GenerateTransactionFactory/Container.tsx @@ -1,14 +1,17 @@ -import { signTransactionRequested, TSignTransactionRequested } from 'actions/transaction'; import React, { Component } from 'react'; import { connect } from 'react-redux'; +import { transactionSignActions } from 'features/transaction'; + interface DispatchProps { - signTransactionRequested: TSignTransactionRequested; + signTransactionRequested: transactionSignActions.TSignTransactionRequested; } interface OwnProps { isWeb3: boolean; - withSigner(signer: TSignTransactionRequested): React.ReactElement | null; + withSigner( + signer: transactionSignActions.TSignTransactionRequested + ): React.ReactElement | null; } class Container extends Component { @@ -17,4 +20,6 @@ class Container extends Component { } } -export const WithSigner = connect(null, { signTransactionRequested })(Container); +export const WithSigner = connect(null, { + signTransactionRequested: transactionSignActions.signTransactionRequested +})(Container); diff --git a/common/components/GenerateTransactionFactory/GenerateTransactionFactory.tsx b/common/components/GenerateTransactionFactory/GenerateTransactionFactory.tsx index 1e78c0f4..ba0b133d 100644 --- a/common/components/GenerateTransactionFactory/GenerateTransactionFactory.tsx +++ b/common/components/GenerateTransactionFactory/GenerateTransactionFactory.tsx @@ -1,22 +1,21 @@ -import { WithSigner } from './Container'; -import EthTx from 'ethereumjs-tx'; import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { AppState } from 'reducers'; -import { - getTransaction, - isNetworkRequestPending, - isValidGasPrice, - isValidGasLimit, - getSignedTx, - getSerializedTransaction -} from 'selectors/transaction'; -import { getWalletType, IWalletType } from 'selectors/wallet'; -import { OfflineBroadcast } from 'components/SendButtonFactory/OfflineBroadcast'; -import { getTransactionFields, makeTransaction } from 'libs/transaction'; -import translate from 'translations'; +import EthTx from 'ethereumjs-tx'; import { addHexPrefix } from 'ethereumjs-util'; + +import translate from 'translations'; +import { getTransactionFields, makeTransaction } from 'libs/transaction'; +import { AppState } from 'features/reducers'; +import * as derivedSelectors from 'features/selectors'; +import { + transactionNetworkSelectors, + transactionSignSelectors, + transactionSelectors +} from 'features/transaction'; +import { walletSelectors } from 'features/wallet'; +import { OfflineBroadcast } from 'components/SendButtonFactory/OfflineBroadcast'; import { CodeBlock } from 'components/ui'; +import { WithSigner } from './Container'; export interface CallbackProps { disabled: boolean; @@ -26,7 +25,7 @@ export interface CallbackProps { interface StateProps { transaction: EthTx; - walletType: IWalletType; + walletType: walletSelectors.IWalletType; serializedTransaction: AppState['transaction']['sign']['local']['signedTransaction']; networkRequestPending: boolean; isFullTransaction: boolean; @@ -102,12 +101,12 @@ export class GenerateTransactionFactoryClass extends Component { } export const GenerateTransactionFactory = connect((state: AppState) => ({ - ...getTransaction(state), - walletType: getWalletType(state), - serializedTransaction: getSerializedTransaction(state), - networkRequestPending: isNetworkRequestPending(state), - isWeb3Wallet: getWalletType(state).isWeb3Wallet, - validGasPrice: isValidGasPrice(state), - validGasLimit: isValidGasLimit(state), - signedTx: !!getSignedTx(state) + ...derivedSelectors.getTransaction(state), + walletType: walletSelectors.getWalletType(state), + serializedTransaction: derivedSelectors.getSerializedTransaction(state), + networkRequestPending: transactionNetworkSelectors.isNetworkRequestPending(state), + isWeb3Wallet: walletSelectors.getWalletType(state).isWeb3Wallet, + validGasPrice: transactionSelectors.isValidGasPrice(state), + validGasLimit: transactionSelectors.isValidGasLimit(state), + signedTx: !!transactionSignSelectors.getSignedTx(state) }))(GenerateTransactionFactoryClass); diff --git a/common/components/Header/components/Navigation.scss b/common/components/Header/components/Navigation.scss index 180cab60..2ab87047 100644 --- a/common/components/Header/components/Navigation.scss +++ b/common/components/Header/components/Navigation.scss @@ -4,10 +4,10 @@ width: 100%; position: relative; overflow-y: hidden; - border-top: 3px solid $brand-primary; + border-top: 3px solid color(brand-primary); transition: border 300ms ease; - background: #fff; - border-bottom: 1px solid #eee; + background: color(control-bg); + border-bottom: 1px solid color(control-border); &-scroll { -ms-overflow-style: -ms-autohiding-scrollbar; @@ -34,7 +34,7 @@ &-arrow { background-color: white; bottom: 12px; - color: #d6d6d6; + color: color(gray-light); font-size: 33px; line-height: 1.3; min-width: 50px; @@ -51,9 +51,9 @@ left: 3%; background: linear-gradient( to left, - rgba(255, 255, 255, 0) 0%, - rgba(255, 255, 255, 1) 47%, - rgba(255, 255, 255, 1) 100% + transparent 0%, + color(control-bg) 47%, + color(control-bg) 100% ); padding-left: 5px; text-align: left; @@ -66,9 +66,9 @@ right: 3%; background: linear-gradient( to right, - rgba(255, 255, 255, 0) 0%, - rgba(255, 255, 255, 1) 47%, - rgba(255, 255, 255, 1) 100% + transparent 0%, + color(control-bg) 47%, + color(control-bg) 100% ); padding-right: 5px; text-align: right; @@ -84,7 +84,7 @@ display: inline-block; &-link { - color: darken($link-color, 15%); + color: color(tab-color); display: block; font-size: 16px; font-weight: 300; @@ -101,7 +101,7 @@ &:after { content: ''; - background: $brand-primary; + background: color(tab-active-color); height: 2px; width: 100%; left: 0px; @@ -114,7 +114,7 @@ &.is-active, &:hover, &:focus { - color: $brand-primary; + color: color(tab-active-color); text-decoration: none; transition: all 250ms ease 0s; diff --git a/common/components/Header/components/Navigation.tsx b/common/components/Header/components/Navigation.tsx index 4cfe43f2..51b8860a 100644 --- a/common/components/Header/components/Navigation.tsx +++ b/common/components/Header/components/Navigation.tsx @@ -1,10 +1,13 @@ import React, { PureComponent } from 'react'; -import NavigationLink from 'components/NavigationLink'; + import { navigationLinks } from 'config'; +import NavigationLink from 'components/NavigationLink'; import './Navigation.scss'; +import { TAB } from './constants'; interface Props { color?: string | false; + unsupportedTabs?: TAB[]; } interface State { @@ -23,7 +26,7 @@ export default class Navigation extends PureComponent { }; public render() { - const { color } = this.props; + const { color, unsupportedTabs } = this.props; const borderStyle: BorderStyle = {}; if (color) { @@ -52,6 +55,9 @@ export default class Navigation extends PureComponent { isHomepage={link === navigationLinks[0]} disabled={!['NAV_VIEW', 'NAV_SWAP'].includes(link.name)} className="NavigationLink" + isNotEnabled={ + unsupportedTabs && unsupportedTabs.map(tab => tab.toString()).includes(link.name) + } /> ))} diff --git a/common/components/Header/components/NetworkDropdown.tsx b/common/components/Header/components/NetworkDropdown.tsx index ea67f526..92972c29 100644 --- a/common/components/Header/components/NetworkDropdown.tsx +++ b/common/components/Header/components/NetworkDropdown.tsx @@ -1,9 +1,10 @@ import React from 'react'; import { connect } from 'react-redux'; + +import { AppState } from 'features/reducers'; +import { getNodeConfig, getSelectedNodeLabel } from 'features/config'; import { DropdownShell } from 'components/ui'; import NetworkSelector from 'components/NetworkSelector'; -import { getNodeConfig, getSelectedNodeLabel } from 'selectors/config'; -import { AppState } from 'reducers'; import './NetworkDropdown.scss'; interface OwnProps { diff --git a/common/components/Header/components/OnlineStatus.scss b/common/components/Header/components/OnlineStatus.scss index c92840f1..8dda80b1 100644 --- a/common/components/Header/components/OnlineStatus.scss +++ b/common/components/Header/components/OnlineStatus.scss @@ -21,15 +21,15 @@ @include show-tooltip-on-hover; &.is-online { - background: lighten($brand-success, 10%); + background: color(brand-success-light); } &.is-offline { - background: lighten($brand-danger, 5%); + background: color(brand-danger-light); } &.is-connecting { - background: #FFF; + background: color(brand-warning); animation: online-pulse 800ms ease infinite; } } diff --git a/common/components/Header/components/OnlineStatus.tsx b/common/components/Header/components/OnlineStatus.tsx index b7dba55d..80be2c64 100644 --- a/common/components/Header/components/OnlineStatus.tsx +++ b/common/components/Header/components/OnlineStatus.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { Tooltip } from 'components/ui'; import './OnlineStatus.scss'; diff --git a/common/components/Header/components/constants.ts b/common/components/Header/components/constants.ts new file mode 100644 index 00000000..9d24d6d2 --- /dev/null +++ b/common/components/Header/components/constants.ts @@ -0,0 +1,10 @@ +export enum TAB { + VIEW = 'NAV_VIEW', + CREATE = 'NAV_GENERATEWALLET', + SWAP = 'NAV_SWAP', + CONTRACTS = 'NAV_CONTRACTS', + ENS = 'NAV_ENS', + SIGN = 'NAV_SIGN', + TXSTATUS = 'NAV_TXSTATUS', + BROADCAST = 'NAV_BROADCAST' +} diff --git a/common/components/Header/index.scss b/common/components/Header/index.scss index a510acd5..01c79644 100644 --- a/common/components/Header/index.scss +++ b/common/components/Header/index.scss @@ -41,7 +41,11 @@ $small-size: 900px; font-weight: 300; color: #fff; transition: background-color 80ms ease; - background: $gray-darker; + background: color(gray-darker); + + @include theme(dark) { + background: color(gray-lighter); + } a { color: #fff; @@ -56,24 +60,24 @@ $small-size: 900px; // Colors &.is-primary { - background: $brand-primary; + background: color(brand-primary); } &.is-warning { - background: $brand-warning; + background: color(brand-warning); } &.is-danger { - background: $brand-danger; + background: color(brand-danger); } &.is-success { - background: $brand-success; + background: color(brand-success); } &.is-info { - background: $brand-info; - border-bottom: 1px solid rgba(#fff, 0.6); + background: color(brand-info); + border-bottom: 1px solid rgba(#fff, 0.4); } } @@ -117,7 +121,7 @@ $small-size: 900px; &-right { font-size: 18px; font-weight: 300; - color: white; + color: color(text-color-inverted); flex: 1 auto; text-align: right; padding: 0 0 5px; diff --git a/common/components/Header/index.tsx b/common/components/Header/index.tsx index 8b021849..e3341080 100644 --- a/common/components/Header/index.tsx +++ b/common/components/Header/index.tsx @@ -1,37 +1,36 @@ +import React, { Component } from 'react'; +import { MapStateToProps, connect } from 'react-redux'; +import { Link } from 'react-router-dom'; +import classnames from 'classnames'; + +import { ANNOUNCEMENT_MESSAGE, ANNOUNCEMENT_TYPE, languages } from 'config'; +import { NetworkConfig } from 'types/network'; +import { getKeyByValue } from 'utils/helpers'; +import logo from 'assets/images/logo-mycrypto.svg'; +import { OldDropDown } from 'components/ui'; import { + AddCustomNodeAction, + TAddCustomNetwork, + TAddCustomNode, TChangeLanguage, TChangeNodeRequestedOneTime, - TAddCustomNode, TRemoveCustomNode, - TAddCustomNetwork, - AddCustomNodeAction, + getLanguageSelection, + getNetworkConfig, + getOffline, + isNodeChanging, + isStaticNodeId, changeLanguage, changeNodeRequestedOneTime, addCustomNode, removeCustomNode, addCustomNetwork -} from 'actions/config'; -import logo from 'assets/images/logo-mycrypto.svg'; -import { OldDropDown } from 'components/ui'; -import React, { Component } from 'react'; -import classnames from 'classnames'; -import { Link } from 'react-router-dom'; -import { TSetGasPriceField, setGasPriceField } from 'actions/transaction'; -import { ANNOUNCEMENT_MESSAGE, ANNOUNCEMENT_TYPE, languages } from 'config'; -import Navigation from './components/Navigation'; -import NetworkDropdown from './components/NetworkDropdown'; +} from 'features/config'; +import { AppState } from 'features/reducers'; +import { transactionFieldsActions } from 'features/transaction'; import CustomNodeModal from 'components/CustomNodeModal'; -import { getKeyByValue } from 'utils/helpers'; -import { AppState } from 'reducers'; -import { - getOffline, - isNodeChanging, - getLanguageSelection, - getNetworkConfig, - isStaticNodeId -} from 'selectors/config'; -import { NetworkConfig } from 'types/network'; -import { connect, MapStateToProps } from 'react-redux'; +import NetworkDropdown from './components/NetworkDropdown'; +import Navigation from './components/Navigation'; import './index.scss'; interface OwnProps { @@ -41,7 +40,7 @@ interface OwnProps { interface DispatchProps { changeLanguage: TChangeLanguage; changeNodeRequestedOneTime: TChangeNodeRequestedOneTime; - setGasPriceField: TSetGasPriceField; + setGasPriceField: transactionFieldsActions.TSetGasPriceField; addCustomNode: TAddCustomNode; removeCustomNode: TRemoveCustomNode; addCustomNetwork: TAddCustomNetwork; @@ -50,31 +49,11 @@ interface DispatchProps { interface StateProps { shouldSetNodeFromQS: boolean; network: NetworkConfig; - languageSelection: AppState['config']['meta']['languageSelection']; - isChangingNode: AppState['config']['nodes']['selectedNode']['pending']; - isOffline: AppState['config']['meta']['offline']; + languageSelection: ReturnType; + isChangingNode: ReturnType; + isOffline: ReturnType; } -const mapStateToProps: MapStateToProps = ( - state, - { networkParam } -): StateProps => ({ - shouldSetNodeFromQS: !!(networkParam && isStaticNodeId(state, networkParam)), - isOffline: getOffline(state), - isChangingNode: isNodeChanging(state), - languageSelection: getLanguageSelection(state), - network: getNetworkConfig(state) -}); - -const mapDispatchToProps: DispatchProps = { - setGasPriceField, - changeLanguage, - changeNodeRequestedOneTime, - addCustomNode, - removeCustomNode, - addCustomNetwork -}; - interface State { isAddingCustomNode: boolean; } @@ -138,7 +117,10 @@ class Header extends Component { - + { } } +const mapStateToProps: MapStateToProps = ( + state, + { networkParam } +): StateProps => ({ + shouldSetNodeFromQS: !!(networkParam && isStaticNodeId(state, networkParam)), + isOffline: getOffline(state), + isChangingNode: isNodeChanging(state), + languageSelection: getLanguageSelection(state), + network: getNetworkConfig(state) +}); + +const mapDispatchToProps: DispatchProps = { + setGasPriceField: transactionFieldsActions.setGasPriceField, + changeLanguage, + changeNodeRequestedOneTime, + addCustomNode, + removeCustomNode, + addCustomNetwork +}; + export default connect(mapStateToProps, mapDispatchToProps)(Header); diff --git a/common/components/LogOutPrompt.tsx b/common/components/LogOutPrompt.tsx index 09032c7d..3774d7e0 100644 --- a/common/components/LogOutPrompt.tsx +++ b/common/components/LogOutPrompt.tsx @@ -1,15 +1,16 @@ import React from 'react'; -import { connect } from 'react-redux'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import Modal, { IButton } from 'components/ui/Modal'; -import { AppState } from 'reducers'; -import { resetWallet, TResetWallet } from 'actions/wallet'; +import { connect } from 'react-redux'; + import translate, { translateRaw } from 'translations'; -import { TWeb3UnsetNode, web3UnsetNode } from 'actions/config'; +import { AppState } from 'features/reducers'; +import { TWeb3UnsetNode, web3UnsetNode } from 'features/config'; +import { walletActions } from 'features/wallet'; +import Modal, { IButton } from 'components/ui/Modal'; interface DispatchProps { web3UnsetNode: TWeb3UnsetNode; - resetWallet: TResetWallet; + resetWallet: walletActions.TResetWallet; } interface StateProps { @@ -90,6 +91,6 @@ function mapStateToProps(state: AppState) { } export default connect(mapStateToProps, { - resetWallet, + resetWallet: walletActions.resetWallet, web3UnsetNode })(withRouter(LogOutPromptClass)); diff --git a/common/components/NavigationLink.tsx b/common/components/NavigationLink.tsx index 6d677689..c69eddf9 100644 --- a/common/components/NavigationLink.tsx +++ b/common/components/NavigationLink.tsx @@ -1,8 +1,8 @@ -import classnames from 'classnames'; import React from 'react'; import { Link, withRouter, RouteComponentProps } from 'react-router-dom'; -import translate, { translateRaw } from 'translations'; + import { NavigationLink } from 'config'; +import translate, { translateRaw } from 'translations'; interface Props extends RouteComponentProps<{}> { link: NavigationLink; @@ -26,17 +26,13 @@ class NavigationLinkClass extends React.PureComponent { location.pathname === link.to || isSubRoute || (isHomepage && location.pathname === '/'); } - const linkClasses = classnames({ - [`${className}-link`]: true, - 'is-disabled': !link.to || disabled, - 'is-active': isActive - }); const linkLabel = `nav item: ${translateRaw(link.name)}`; const linkEl = link.external || !link.to ? ( { {translate(link.name)} ) : ( - + {translate(link.name)} ); diff --git a/common/components/NetworkSelector/NetworkOption.scss b/common/components/NetworkSelector/NetworkOption.scss index a20b59a2..5c465837 100644 --- a/common/components/NetworkSelector/NetworkOption.scss +++ b/common/components/NetworkSelector/NetworkOption.scss @@ -13,7 +13,7 @@ $left-border-size: 2px; .NetworkOption { border-left: $left-border-size solid; - border-bottom: 1px solid $gray-lighter; + border-bottom: 1px solid shade-dark(0.08); &-label { display: flex; @@ -36,34 +36,40 @@ $left-border-size: 2px; position: relative; top: 1px; display: inline-block; - border: 1px solid rgba($gray-light, 0.4); + border: 1px solid shade-dark(0.15); border-radius: 100%; height: $radio-size; width: $radio-size; margin-right: $space-xs; - box-shadow: 0 0 0 1px #FFF inset; + box-shadow: 0 0 0 1px color(control-bg) inset; } &:hover { &:before { - border-color: rgba($gray-light, 0.7); + border-color: shade-dark(0.3); } } &.is-selected { &:before { - background: $brand-primary; - border-color: $brand-primary; + background: color(brand-primary); + border-color: color(brand-primary); } } &.is-specific-node { &:before { - background: linear-gradient(135deg, #FFF, #FFF 45%, $brand-primary 45%, $brand-primary 100%); + background: linear-gradient( + 135deg, + transparent, + transparent 45%, + color(brand-primary) 45%, + color(brand-primary) 100% + ); } &:hover:before { - background: rgba($brand-primary, 0.6); + background: color(brand-primary-lighter); } } @@ -80,19 +86,19 @@ $left-border-size: 2px; width: 20px; height: 20px; font-size: 10px; - color: $gray-light; + color: shade-dark(0.4); border-radius: 100%; transition-property: color, background-color, transform; transition-duration: 75ms; transition-timing-function: ease; &:hover { - color: $gray-dark; - background: rgba(#000, 0.1); + color: shade-dark(0.6); + background: shade-dark(0.1); } &.is-expanded { - color: $gray-dark; + color: shade-dark(0.6); transform: rotate(180deg); } } @@ -100,7 +106,7 @@ $left-border-size: 2px; &-nodes { padding: 0.2rem 0.5rem; - background: $gray-lightest; - border-top: 1px solid $gray-lighter; + background: shade-dark(0.02); + border-top: 1px solid shade-dark(0.08); } } diff --git a/common/components/NetworkSelector/NetworkSelector.scss b/common/components/NetworkSelector/NetworkSelector.scss index 51f127bc..0792773d 100644 --- a/common/components/NetworkSelector/NetworkSelector.scss +++ b/common/components/NetworkSelector/NetworkSelector.scss @@ -13,7 +13,8 @@ $button-font-size: $font-size-small; .NetworkSelector { width: 100%; text-align: left; - color: $text-color; + color: color(text-color); + background: color(control-bg); font-size: $font-size-base; &-add, @@ -23,11 +24,11 @@ $button-font-size: $font-size-small; width: 100%; padding: $button-padding; text-align: center; - color: $text-color; + color: color(text-color); font-size: $button-font-size; &:hover { - color: $link-hover-color; + color: color(link-hover-color); } .fa { @@ -40,12 +41,12 @@ $button-font-size: $font-size-small; } &-alts { - border-bottom: 1px solid $gray-lighter; + border-bottom: 1px solid shade-dark(0.08); } @if ($is-electron) { &-add { - border-bottom: 1px solid $gray-lighter; + border-bottom: 1px solid shade-dark(0.08); } } } diff --git a/common/components/NetworkSelector/NetworkSelector.tsx b/common/components/NetworkSelector/NetworkSelector.tsx index 02bd9e03..bf258528 100644 --- a/common/components/NetworkSelector/NetworkSelector.tsx +++ b/common/components/NetworkSelector/NetworkSelector.tsx @@ -1,22 +1,21 @@ import React from 'react'; import { connect } from 'react-redux'; + import translate, { translateRaw } from 'translations'; -import NetworkOption from './NetworkOption'; +import { NodeConfig } from 'types/node'; +import { NetworkConfig } from 'types/network'; +import { AppState } from 'features/reducers'; import { TChangeNodeRequested, changeNodeRequested, TChangeNetworkRequested, - changeNetworkRequested -} from 'actions/config'; -import { + changeNetworkRequested, getNodeConfig, getNetworkConfig, getAllNodes, getAllNetworkConfigs -} from 'selectors/config'; -import { NodeConfig } from 'types/node'; -import { NetworkConfig } from 'types/network'; -import { AppState } from 'reducers'; +} from 'features/config'; +import NetworkOption from './NetworkOption'; import './NetworkSelector.scss'; const CORE_NETWORKS = ['ETH', 'XMR', 'ETC', 'Ropsten', 'Kovan', 'Rinkeby']; diff --git a/common/components/NetworkSelector/NodeOption.scss b/common/components/NetworkSelector/NodeOption.scss index 51c4e661..300d5b2a 100644 --- a/common/components/NetworkSelector/NodeOption.scss +++ b/common/components/NetworkSelector/NodeOption.scss @@ -18,35 +18,40 @@ $radio-size: 10px; &:before { content: ''; display: inline-block; - border: 1px solid rgba($gray-light, 0.4); + border: 1px solid shade-dark(0.15); border-radius: 100%; height: $radio-size; width: $radio-size; margin-right: $space-xs; - background: #FFF; - box-shadow: 0 0 0 1px #FFF inset; + background: color(control-bg); + box-shadow: 0 0 0 1px color(control-bg) inset; } &:hover { &:before { - border-color: rgba($gray-light, 0.8); + border-color: shade-dark(0.3); } } &.is-selected { &:before { - border-color: $brand-primary; - background: $brand-primary; + border-color: color(brand-primary); + background: color(brand-primary); } } &.is-auto-selected { &:before { - background: rgba($brand-primary, 0.3); + background: color(brand-primary); + opacity: 0.3; + + &:hover { + opacity: 0.8; + } } &:hover:before { - background: rgba($brand-primary, 0.8); + opacity: 0.8; } } } @@ -57,7 +62,7 @@ $radio-size: 10px; font-size: 14px; &:hover { - color: $brand-danger; + color: color(brand-danger); opacity: 0.8; } } diff --git a/common/components/NetworkSelector/NodeOption.tsx b/common/components/NetworkSelector/NodeOption.tsx index 9fd3894b..6f3f89ca 100644 --- a/common/components/NetworkSelector/NodeOption.tsx +++ b/common/components/NetworkSelector/NodeOption.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import classnames from 'classnames'; import { translateRaw } from 'translations'; -import { TRemoveCustomNode, removeCustomNode } from 'actions/config'; +import { TRemoveCustomNode, removeCustomNode } from 'features/config'; import { NodeConfig } from 'types/node'; import './NodeOption.scss'; diff --git a/common/components/NewAppReleaseModal.tsx b/common/components/NewAppReleaseModal.tsx index 2030365e..2d423f8d 100644 --- a/common/components/NewAppReleaseModal.tsx +++ b/common/components/NewAppReleaseModal.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import translate, { translateRaw } from 'translations'; import Modal, { IButton } from 'components/ui/Modal'; import { getLatestElectronRelease } from 'utils/versioning'; @@ -9,7 +10,7 @@ interface State { newRelease?: string; } -export default class NewAppReleaseModal extends React.Component<{}, State> { +export default class NewAppReleaseModal extends React.PureComponent<{}, State> { public state: State = { isOpen: false }; diff --git a/common/components/NonceField.tsx b/common/components/NonceField.tsx index 17abf052..09846b46 100644 --- a/common/components/NonceField.tsx +++ b/common/components/NonceField.tsx @@ -1,17 +1,18 @@ import React from 'react'; -import translate from 'translations'; -import { NonceFieldFactory } from 'components/NonceFieldFactory'; -import Help from 'components/ui/Help'; -import { Spinner, Input } from 'components/ui'; import { connect } from 'react-redux'; -import { getNonceRequested, TGetNonceRequested } from 'actions/transaction'; -import { nonceRequestPending } from 'selectors/transaction'; -import { getOffline } from 'selectors/config'; -import { AppState } from 'reducers'; + +import translate from 'translations'; +import { AppState } from 'features/reducers'; +import { getOffline } from 'features/config'; +import { transactionNetworkActions, transactionNetworkSelectors } from 'features/transaction'; +import { Spinner, Input } from 'components/ui'; +import Help from 'components/ui/Help'; +import { NonceFieldFactory } from 'components/NonceFieldFactory'; import './NonceField.scss'; interface OwnProps { alwaysDisplay: boolean; + showInvalidBeforeBlur?: boolean; } interface StateProps { @@ -20,14 +21,20 @@ interface StateProps { } interface DispatchProps { - requestNonce: TGetNonceRequested; + requestNonce: transactionNetworkActions.TGetNonceRequested; } type Props = OwnProps & DispatchProps & StateProps; class NonceField extends React.Component { public render() { - const { alwaysDisplay, requestNonce, noncePending, isOffline } = this.props; + const { + alwaysDisplay, + showInvalidBeforeBlur, + requestNonce, + noncePending, + isOffline + } = this.props; return ( { @@ -50,6 +57,8 @@ class NonceField extends React.Component { readOnly={readOnly} onChange={onChange} disabled={noncePending} + showInvalidWithoutValue={true} + showInvalidBeforeBlur={showInvalidBeforeBlur} /> {noncePending ? (
    @@ -77,8 +86,10 @@ class NonceField extends React.Component { const mapStateToProps = (state: AppState): StateProps => { return { isOffline: getOffline(state), - noncePending: nonceRequestPending(state) + noncePending: transactionNetworkSelectors.nonceRequestPending(state) }; }; -export default connect(mapStateToProps, { requestNonce: getNonceRequested })(NonceField); +export default connect(mapStateToProps, { + requestNonce: transactionNetworkActions.getNonceRequested +})(NonceField); diff --git a/common/components/NonceFieldFactory/NonceFieldFactory.tsx b/common/components/NonceFieldFactory/NonceFieldFactory.tsx index 2eef88b3..fc8e520c 100644 --- a/common/components/NonceFieldFactory/NonceFieldFactory.tsx +++ b/common/components/NonceFieldFactory/NonceFieldFactory.tsx @@ -1,9 +1,10 @@ -import { NonceInputFactory } from './NonceInputFactory'; -import { inputNonce, TInputNonce } from 'actions/transaction'; import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { AppState } from 'reducers'; + import { sanitizeNumericalInput } from 'libs/values'; +import { AppState } from 'features/reducers'; +import { transactionFieldsActions } from 'features/transaction'; +import { NonceInputFactory } from './NonceInputFactory'; export interface CallbackProps { nonce: AppState['transaction']['fields']['nonce']; @@ -13,7 +14,7 @@ export interface CallbackProps { } interface DispatchProps { - inputNonce: TInputNonce; + inputNonce: transactionFieldsActions.TInputNonce; } interface OwnProps { @@ -34,5 +35,5 @@ class NonceFieldClass extends Component { } export const NonceFieldFactory = connect(null, { - inputNonce + inputNonce: transactionFieldsActions.inputNonce })(NonceFieldClass); diff --git a/common/components/NonceFieldFactory/NonceInputFactory.tsx b/common/components/NonceFieldFactory/NonceInputFactory.tsx index 57349135..b90f8d18 100644 --- a/common/components/NonceFieldFactory/NonceInputFactory.tsx +++ b/common/components/NonceFieldFactory/NonceInputFactory.tsx @@ -1,10 +1,11 @@ import React, { Component } from 'react'; -import { Query } from 'components/renderCbs'; -import { getNonce, nonceRequestFailed } from 'selectors/transaction'; -import { getOffline } from 'selectors/config'; -import { AppState } from 'reducers'; import { connect } from 'react-redux'; + +import { AppState } from 'features/reducers'; +import { getOffline } from 'features/config'; +import { transactionFieldsSelectors, transactionNetworkSelectors } from 'features/transaction'; import { CallbackProps } from 'components/NonceFieldFactory'; +import { Query } from 'components/renderCbs'; interface OwnProps { onChange(ev: React.FormEvent): void; @@ -34,6 +35,6 @@ class NonceInputFactoryClass extends Component { } export const NonceInputFactory = connect((state: AppState) => ({ - shouldDisplay: getOffline(state) || nonceRequestFailed(state), - nonce: getNonce(state) + shouldDisplay: getOffline(state) || transactionNetworkSelectors.nonceRequestFailed(state), + nonce: transactionFieldsSelectors.getNonce(state) }))(NonceInputFactoryClass); diff --git a/common/components/PageNotFound/PageNotFound.tsx b/common/components/PageNotFound/PageNotFound.tsx index 8924b20a..7667aa92 100644 --- a/common/components/PageNotFound/PageNotFound.tsx +++ b/common/components/PageNotFound/PageNotFound.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { Link } from 'react-router-dom'; -import TabSection from '../../containers/TabSection/index'; + +import TabSection from 'containers/TabSection'; import './PageNotFound.scss'; const PageNotFound: React.SFC = () => ( diff --git a/common/components/PageNotFound/index.ts b/common/components/PageNotFound/index.ts index 127f677c..10e6acdd 100644 --- a/common/components/PageNotFound/index.ts +++ b/common/components/PageNotFound/index.ts @@ -1,3 +1 @@ -import PageNotFound from './PageNotFound'; - -export default PageNotFound; +export { default } from './PageNotFound'; diff --git a/common/components/Palette/index.scss b/common/components/Palette/index.scss new file mode 100644 index 00000000..9e126d1b --- /dev/null +++ b/common/components/Palette/index.scss @@ -0,0 +1,33 @@ +@import 'common/sass/variables/colors'; + +.Palette { + &-group { + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 2rem; + + &-color { + margin-right: 1rem; + text-align: center; + + &-blob { + height: 120px; + width: 120px; + margin-bottom: 0.5rem; + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3); + + @each $name, $color in $theme-light { + &.color--#{$name} { + background: color($name); + } + } + } + + &-name { + font-size: 12px; + color: shade-dark(0.7); + } + } + } +} diff --git a/common/components/Palette/index.tsx b/common/components/Palette/index.tsx new file mode 100644 index 00000000..85ef32e6 --- /dev/null +++ b/common/components/Palette/index.tsx @@ -0,0 +1,59 @@ +import React from 'react'; +import TabSection from 'containers/TabSection/index'; +import './index.scss'; + +const COLORS = [ + ['gray-base', 'gray-darker', 'gray-dark', 'gray', 'gray-light', 'gray-lighter', 'gray-lightest'], + [ + 'brand-primary-darker', + 'brand-primary-dark', + 'brand-primary', + 'brand-primary-light', + 'brand-primary-lighter' + ], + ['brand-info-darker', 'brand-info-dark', 'brand-info', 'brand-info-light', 'brand-info-lighter'], + [ + 'brand-success-darker', + 'brand-success-dark', + 'brand-success', + 'brand-success-light', + 'brand-success-lighter' + ], + [ + 'brand-warning-darker', + 'brand-warning-dark', + 'brand-warning', + 'brand-warning-light', + 'brand-warning-lighter' + ], + [ + 'brand-danger-darker', + 'brand-danger-dark', + 'brand-danger', + 'brand-danger-light', + 'brand-danger-lighter' + ], + ['text-color', 'text-inverted-color', 'link-color', 'link-hover-color'], + ['control-bg', 'control-color', 'control-border'] +]; + +const Palette: React.SFC = () => ( + +
    +
    + {COLORS.map(colors => ( +
    + {colors.map(c => ( +
    +
    +
    {c}
    +
    + ))} +
    + ))} +
    +
    +
    +); + +export default Palette; diff --git a/common/components/PaperWallet/index.scss b/common/components/PaperWallet/index.scss new file mode 100644 index 00000000..340f85c1 --- /dev/null +++ b/common/components/PaperWallet/index.scss @@ -0,0 +1,91 @@ +// Use px and don't use variables here, we want the wallet to look +// consistent regardless of theme or screen size. + +$wallet-width: 680px; +$wallet-height: 280px; + +.PaperWallet { + position: relative; + margin: 0 auto; + width: $wallet-width; + height: $wallet-height; + border: 1px solid #163151; + user-select: none; + cursor: default; + background: #FFF; + color: #333; + + &-sidebar { + float: left; + height: 100%; + width: auto; + } + + &-block { + position: relative; + float: left; + width: 27.5%; + padding: 20px; + + &-box { + width: 150px; + height: 150px; + + &.is-shaded { + background: rgba(#000, 0.02); + } + } + + &-text { + position: absolute; + top: 50%; + left: 100%; + width: 100%; + margin: 0; + transform: translate(-50%, -50%) rotate(-90deg); + font-size: 13px; + font-weight: 600; + color: #0b7290; + text-align: center; + text-transform: uppercase; + letter-spacing: 1px; + } + } + + &-info { + float: left; + width: 85%; + padding: 0 20px; + + &-text { + margin: 0 0 5px; + text-align: left; + font-size: 14px; + font-family: 'Roboto Mono', 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace; + font-weight: 300; + + &-label { + font-weight: 600; + } + } + } + + &-identicon { + position: absolute; + right: 15px; + bottom: 45px; + + &-left { + float: left; + } + + &-text { + float: left; + width: 130px; + padding: 0 5px; + margin: 12px 0 0; + font-size: 9px; + text-align: center; + } + } +} diff --git a/common/components/PaperWallet/index.tsx b/common/components/PaperWallet/index.tsx index db23352f..ea74aecc 100644 --- a/common/components/PaperWallet/index.tsx +++ b/common/components/PaperWallet/index.tsx @@ -1,93 +1,11 @@ -import { Identicon, QRCode } from 'components/ui'; import React from 'react'; +import html2canvas from 'html2canvas'; +import { addHexPrefix, toChecksumAddress } from 'ethereumjs-util'; -import ethLogo from 'assets/images/logo-ethereum-1.png'; import notesBg from 'assets/images/notes-bg.png'; import sidebarImg from 'assets/images/print-sidebar.png'; - -const walletWidth = 680; -const walletHeight = 280; - -const styles: any = { - container: { - position: 'relative', - margin: '0 auto', - width: `${walletWidth}px`, - height: `${walletHeight}px`, - border: '1px solid #163151', - userSelect: 'none', - cursor: 'default' - }, - - // Images - sidebar: { - float: 'left', - height: '100%', - width: 'auto' - }, - ethLogo: { - position: 'absolute', - left: '86px', - height: '100%', - width: 'auto', - zIndex: '-1' - }, - - // Blocks / QR Codes - block: { - position: 'relative', - float: 'left', - width: '27.5%', - padding: '20px' - }, - blockText: { - position: 'absolute', - top: '50%', - left: '100%', - width: '100%', - margin: 0, - transform: 'translate(-50%, -50%) rotate(-90deg)', - fontSize: '13px', - fontWeight: '600', - color: '#0b7290', - textAlign: 'center', - textTransform: 'uppercase', - letterSpacing: '1px' - }, - // Address / private key info - infoContainer: { - float: 'left', - width: '85%', - padding: '0 20px' - }, - infoText: { - margin: '0 0 8px', - textAlign: 'left', - fontSize: '14px', - fontFamily: '"Roboto Mono", Menlo, Monaco, Consolas, "Courier New", monospace', - fontWeight: 300 - }, - infoLabel: { - fontWeight: 600 - }, - identiconContainer: { - position: 'absolute', - right: '15px', - bottom: '45px' - }, - identiconText: { - float: 'left', - width: '130px', - padding: '0 5px', - margin: '12px 0 0', - fontSize: '9px', - textAlign: 'center' - }, - box: { - width: 150, - height: 150 - } -}; +import { Identicon, QRCode } from 'components/ui'; +import './index.scss'; interface Props { address: string; @@ -95,53 +13,65 @@ interface Props { } export default class PaperWallet extends React.Component { + private container: HTMLElement | null; + public render() { - const { privateKey, address } = this.props; + const { privateKey } = this.props; + const address = toChecksumAddress(addHexPrefix(this.props.address)); return ( -
    - MyCrypto Logo - ETH Logo +
    (this.container = el)}> + MyCrypto Logo -
    -
    +
    +
    -

    YOUR ADDRESS

    +

    YOUR ADDRESS

    -
    - -

    AMOUNT / NOTES

    +
    + +

    AMOUNT / NOTES

    -
    -
    +
    +
    -

    YOUR PRIVATE KEY

    +

    YOUR PRIVATE KEY

    -
    -

    - Your Address: +

    +

    + Your Address:
    {address}

    -

    - Your Private Key: +

    + Your Private Key:
    {privateKey}

    -
    -
    +
    +
    -

    Always look for this icon when sending to this wallet

    +

    + Always look for this icon when sending to this wallet +

    ); } + + public toPNG = async () => { + if (!this.container) { + return ''; + } + const canvas = await html2canvas(this.container); + return canvas.toDataURL('image/png'); + }; } diff --git a/common/components/ParityQrSigner.scss b/common/components/ParityQrSigner.scss index 221cd13b..20bd531c 100644 --- a/common/components/ParityQrSigner.scss +++ b/common/components/ParityQrSigner.scss @@ -12,13 +12,13 @@ overflow: hidden; &.is-disabled { - background: $gray-lighter; + background: color(gray-lighter); } &-error { padding: $space; font-size: $font-size-small; - color: $gray-light; + color: color(gray-light); &-icon { display: block; diff --git a/common/components/ParityQrSigner.tsx b/common/components/ParityQrSigner.tsx index aca8bf94..5d508a43 100644 --- a/common/components/ParityQrSigner.tsx +++ b/common/components/ParityQrSigner.tsx @@ -1,8 +1,9 @@ import React from 'react'; import classnames from 'classnames'; +import QrSigner from '@parity/qr-signer'; + import translate from 'translations'; import { Spinner } from 'components/ui'; -import QrSigner from '@parity/qr-signer'; import './ParityQrSigner.scss'; interface State { diff --git a/common/components/PrintableWallet/index.tsx b/common/components/PrintableWallet/index.tsx index 3800b5b3..e55dcde0 100644 --- a/common/components/PrintableWallet/index.tsx +++ b/common/components/PrintableWallet/index.tsx @@ -1,53 +1,54 @@ -import { PaperWallet } from 'components'; import React from 'react'; -import printElement from 'utils/printElement'; -import { stripHexPrefix } from 'libs/values'; -import translate, { translateRaw } from 'translations'; -export const print = (address: string, privateKey: string) => () => - address && - privateKey && - printElement(, { - popupFeatures: { - scrollbars: 'no' - }, - styles: ` - * { - box-sizing: border-box; - } - - body { - font-family: Lato, sans-serif; - font-size: 1rem; - line-height: 1.4; - margin: 0; - } - ` - }); +import translate from 'translations'; +import { stripHexPrefix } from 'libs/formatters'; +import { PaperWallet } from 'components'; interface Props { address: string; privateKey: string; } -const PrintableWallet: React.SFC = ({ address, privateKey }) => { - const pkey = stripHexPrefix(privateKey); +interface State { + paperWalletImage: string; +} - return ( - - ); -}; +export default class PrintableWallet extends React.Component { + public state: State = { + paperWalletImage: '' + }; -export default PrintableWallet; + private paperWallet: PaperWallet | null; + + public componentDidMount() { + setTimeout(() => { + if (!this.paperWallet) { + return this.componentDidMount(); + } + + this.paperWallet.toPNG().then(png => this.setState({ paperWalletImage: png })); + }, 500); + } + + public render() { + const { address, privateKey } = this.props; + const { paperWalletImage } = this.state; + const pkey = stripHexPrefix(privateKey); + const disabled = paperWalletImage ? '' : 'disabled'; + + return ( +
    + (this.paperWallet = c)} /> + + {translate('X_SAVE_PAPER')} + +
    + ); + } +} diff --git a/common/components/SendButton.tsx b/common/components/SendButton.tsx index 4664480e..d17c5e94 100644 --- a/common/components/SendButton.tsx +++ b/common/components/SendButton.tsx @@ -1,8 +1,9 @@ import React from 'react'; -import { SendButtonFactory } from './SendButtonFactory'; + import translate from 'translations'; -import { ConfirmationModal } from 'components/ConfirmationModal'; import { SigningStatus } from 'components'; +import { ConfirmationModal } from 'components/ConfirmationModal'; +import { SendButtonFactory } from './SendButtonFactory'; import './SendButton.scss'; export const SendButton: React.SFC<{ diff --git a/common/components/SendButtonFactory/OfflineBroadcast.tsx b/common/components/SendButtonFactory/OfflineBroadcast.tsx index 1caf46a5..dde98c5b 100644 --- a/common/components/SendButtonFactory/OfflineBroadcast.tsx +++ b/common/components/SendButtonFactory/OfflineBroadcast.tsx @@ -1,8 +1,9 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; -import { AppState } from 'reducers'; -import { getOffline } from 'selectors/config'; + +import { AppState } from 'features/reducers'; +import { getOffline } from 'features/config'; import { NewTabLink } from 'components/ui'; interface StateProps { diff --git a/common/components/SendButtonFactory/OnlineSend.tsx b/common/components/SendButtonFactory/OnlineSend.tsx index 124ad123..a9a9d482 100644 --- a/common/components/SendButtonFactory/OnlineSend.tsx +++ b/common/components/SendButtonFactory/OnlineSend.tsx @@ -1,22 +1,21 @@ import React, { Component } from 'react'; -import { getOffline } from 'selectors/config'; -import { AppState } from 'reducers'; import { connect } from 'react-redux'; + +import { AppState } from 'features/reducers'; +import * as derivedSelectors from 'features/selectors'; +import { getOffline } from 'features/config'; import { - getCurrentTransactionStatus, - currentTransactionBroadcasted, - signaturePending, - getSignedTx, - getWeb3Tx -} from 'selectors/transaction'; -import { showNotification, TShowNotification } from 'actions/notifications'; -import { ITransactionStatus } from 'reducers/transaction/broadcast'; -import { TSignTransactionRequested, signTransactionRequested } from 'actions/transaction'; + transactionBroadcastTypes, + transactionSignActions, + transactionSignSelectors, + transactionSelectors +} from 'features/transaction'; +import { notificationsActions } from 'features/notifications'; import { ConfirmationModal } from 'components/ConfirmationModal'; interface StateProps { offline: boolean; - currentTransaction: false | ITransactionStatus | null; + currentTransaction: false | transactionBroadcastTypes.ITransactionStatus | null; transactionBroadcasted: boolean; signaturePending: boolean; signedTx: boolean; @@ -27,9 +26,8 @@ interface State { } interface DispatchProps { - showNotification: TShowNotification; - - signTransactionRequested: TSignTransactionRequested; + showNotification: notificationsActions.TShowNotification; + signTransactionRequested: transactionSignActions.TSignTransactionRequested; } interface OwnProps { @@ -90,10 +88,14 @@ class OnlineSendClass extends Component { export const OnlineSend = connect( (state: AppState) => ({ offline: getOffline(state), - currentTransaction: getCurrentTransactionStatus(state), - transactionBroadcasted: currentTransactionBroadcasted(state), - signaturePending: signaturePending(state).isSignaturePending, - signedTx: !!getSignedTx(state) || !!getWeb3Tx(state) + currentTransaction: transactionSelectors.getCurrentTransactionStatus(state), + transactionBroadcasted: transactionSelectors.currentTransactionBroadcasted(state), + signaturePending: derivedSelectors.signaturePending(state).isSignaturePending, + signedTx: + !!transactionSignSelectors.getSignedTx(state) || !!transactionSignSelectors.getWeb3Tx(state) }), - { showNotification, signTransactionRequested } + { + showNotification: notificationsActions.showNotification, + signTransactionRequested: transactionSignActions.signTransactionRequested + } )(OnlineSendClass); diff --git a/common/components/SendButtonFactory/SendButtonFactory.tsx b/common/components/SendButtonFactory/SendButtonFactory.tsx index 5bed56d6..0f00ad96 100644 --- a/common/components/SendButtonFactory/SendButtonFactory.tsx +++ b/common/components/SendButtonFactory/SendButtonFactory.tsx @@ -1,19 +1,17 @@ -import EthTx from 'ethereumjs-tx'; -import { OnlineSend } from './OnlineSend'; -import { getWalletType, IWalletType } from 'selectors/wallet'; import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { AppState } from 'reducers'; -import { ConfirmationModal } from 'components/ConfirmationModal'; +import EthTx from 'ethereumjs-tx'; + +import { AppState } from 'features/reducers'; +import * as derivedSelectors from 'features/selectors'; +import { walletSelectors } from 'features/wallet'; import { - getSerializedTransaction, - getTransaction, - isNetworkRequestPending, - isValidGasPrice, - isValidGasLimit, - getSignedTx, - getWeb3Tx -} from 'selectors/transaction'; + transactionNetworkSelectors, + transactionSignSelectors, + transactionSelectors +} from 'features/transaction'; +import { ConfirmationModal } from 'components/ConfirmationModal'; +import { OnlineSend } from './OnlineSend'; export interface CallbackProps { disabled: boolean; @@ -22,7 +20,7 @@ export interface CallbackProps { } interface StateProps { - walletType: IWalletType; + walletType: walletSelectors.IWalletType; serializedTransaction: AppState['transaction']['sign']['local']['signedTransaction']; transaction: EthTx; isFullTransaction: boolean; @@ -76,13 +74,14 @@ export class SendButtonFactoryClass extends Component { const mapStateToProps = (state: AppState) => { return { - walletType: getWalletType(state), - serializedTransaction: getSerializedTransaction(state), - ...getTransaction(state), - networkRequestPending: isNetworkRequestPending(state), - validGasPrice: isValidGasPrice(state), - validGasLimit: isValidGasLimit(state), - signedTx: !!getSignedTx(state) || !!getWeb3Tx(state) + walletType: walletSelectors.getWalletType(state), + serializedTransaction: derivedSelectors.getSerializedTransaction(state), + ...derivedSelectors.getTransaction(state), + networkRequestPending: transactionNetworkSelectors.isNetworkRequestPending(state), + validGasPrice: transactionSelectors.isValidGasPrice(state), + validGasLimit: transactionSelectors.isValidGasLimit(state), + signedTx: + !!transactionSignSelectors.getSignedTx(state) || !!transactionSignSelectors.getWeb3Tx(state) }; }; diff --git a/common/components/SendEverything/SendEverything.tsx b/common/components/SendEverything/SendEverything.tsx index 44c37d4a..1e84e049 100644 --- a/common/components/SendEverything/SendEverything.tsx +++ b/common/components/SendEverything/SendEverything.tsx @@ -1,11 +1,12 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { Query } from 'components/renderCbs'; -import { TokenValue, Wei } from 'libs/units'; + import translate, { translateRaw } from 'translations'; -import { sendEverythingRequested, TSendEverythingRequested } from 'actions/transaction'; -import { getCurrentBalance } from 'selectors/wallet'; -import { AppState } from 'reducers'; +import { TokenValue, Wei } from 'libs/units'; +import { AppState } from 'features/reducers'; +import { sendEverythingRequested, TSendEverythingRequested } from 'features/transaction/actions'; +import * as selectors from 'features/selectors'; +import { Query } from 'components/renderCbs'; import './SendEverything.scss'; interface DispatchProps { @@ -44,6 +45,6 @@ class SendEverythingClass extends Component { }; } export const SendEverything = connect( - (state: AppState) => ({ currentBalance: getCurrentBalance(state) }), + (state: AppState) => ({ currentBalance: selectors.getCurrentBalance(state) }), { sendEverythingRequested } )(SendEverythingClass); diff --git a/common/components/SigningStatus.tsx b/common/components/SigningStatus.tsx index ff65d57c..a2200124 100644 --- a/common/components/SigningStatus.tsx +++ b/common/components/SigningStatus.tsx @@ -1,10 +1,12 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { AppState } from 'reducers'; -import { signaturePending } from 'selectors/transaction'; + +import { translate } from 'translations'; +import { AppState } from 'features/reducers'; +import * as selectors from 'features/selectors'; import { Spinner } from 'components/ui'; import './SigningStatus.scss'; -import { translate } from 'translations'; + interface StateProps { isSignaturePending: boolean; isHardwareWallet: boolean; @@ -30,6 +32,6 @@ class SigningStatusClass extends Component { } } -export const SigningStatus = connect((state: AppState) => signaturePending(state))( +export const SigningStatus = connect((state: AppState) => selectors.signaturePending(state))( SigningStatusClass ); diff --git a/common/components/SubTabs/SubTabs.scss b/common/components/SubTabs/SubTabs.scss index 3a823483..360eed66 100644 --- a/common/components/SubTabs/SubTabs.scss +++ b/common/components/SubTabs/SubTabs.scss @@ -17,16 +17,24 @@ font-size: $font-size-base; text-align: center; font-weight: 300; - color: $ether-navy; - border-bottom: 2px solid $gray-lighter; + color: color(tab-color); + border-bottom: 2px solid color(tab-border); transition-duration: 100ms; + opacity: 0.7; + + &:hover { + opacity: 1; + color: color(tab-active-color); + } &.is-active { - border-bottom-color: $brand-primary; + color: color(tab-active-color); + border-bottom-color: color(tab-active-border); + opacity: 1; } &.is-disabled { - color: $gray-light; + color: color(gray-light); pointer-events: none; text-decoration: line-through; } diff --git a/common/components/SubTabs/index.tsx b/common/components/SubTabs/index.tsx index c9819a0a..7f18d33a 100644 --- a/common/components/SubTabs/index.tsx +++ b/common/components/SubTabs/index.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import Select, { Option } from 'react-select'; import { NavLink, RouteComponentProps } from 'react-router-dom'; +import Select, { Option } from 'react-select'; + import './SubTabs.scss'; export interface Tab { diff --git a/common/components/TXMetaDataPanel/TXMetaDataPanel.tsx b/common/components/TXMetaDataPanel/TXMetaDataPanel.tsx index 763e3cb5..fb65bdb3 100644 --- a/common/components/TXMetaDataPanel/TXMetaDataPanel.tsx +++ b/common/components/TXMetaDataPanel/TXMetaDataPanel.tsx @@ -1,26 +1,21 @@ import React from 'react'; -import BN from 'bn.js'; import { connect } from 'react-redux'; -import { - inputGasPrice, - TInputGasPrice, - inputGasPriceIntent, - TInputGasPriceIntent, - getNonceRequested, - TGetNonceRequested, - resetTransactionRequested, - TResetTransactionRequested -} from 'actions/transaction'; -import { fetchCCRatesRequested, TFetchCCRatesRequested } from 'actions/rates'; -import { getNetworkConfig, getOffline } from 'selectors/config'; -import { AppState } from 'reducers'; -import { Units } from 'libs/units'; -import SimpleGas from './components/SimpleGas'; -import AdvancedGas, { AdvancedOptions } from './components/AdvancedGas'; -import './TXMetaDataPanel.scss'; -import { getGasPrice } from 'selectors/transaction'; -import { NetworkConfig } from 'types/network'; +import BN from 'bn.js'; + import { translateRaw } from 'translations'; +import { NetworkConfig } from 'types/network'; +import { Units } from 'libs/units'; +import { AppState } from 'features/reducers'; +import { getOffline, getNetworkConfig } from 'features/config'; +import { + transactionFieldsActions, + transactionFieldsSelectors, + transactionNetworkActions +} from 'features/transaction'; +import { ratesActions } from 'features/rates'; +import AdvancedGas, { AdvancedOptions } from './components/AdvancedGas'; +import SimpleGas from './components/SimpleGas'; +import './TXMetaDataPanel.scss'; type SliderStates = 'simple' | 'advanced'; @@ -31,11 +26,11 @@ interface StateProps { } interface DispatchProps { - inputGasPrice: TInputGasPrice; - inputGasPriceIntent: TInputGasPriceIntent; - fetchCCRates: TFetchCCRatesRequested; - getNonceRequested: TGetNonceRequested; - resetTransactionRequested: TResetTransactionRequested; + inputGasPrice: transactionFieldsActions.TInputGasPrice; + inputGasPriceIntent: transactionFieldsActions.TInputGasPriceIntent; + fetchCCRates: ratesActions.TFetchCCRatesRequested; + getNonceRequested: transactionNetworkActions.TGetNonceRequested; + resetTransactionRequested: transactionFieldsActions.TResetTransactionRequested; } // Set default props for props that can't be truthy or falsy @@ -68,9 +63,14 @@ class TXMetaDataPanel extends React.Component { sliderState: (this.props as DefaultProps).initialState }; - public componentDidMount() { + public componentWillMount() { if (!this.props.offline) { this.props.resetTransactionRequested(); + } + } + + public componentDidMount() { + if (!this.props.offline) { this.props.fetchCCRates([this.props.network.unit]); this.props.getNonceRequested(); } @@ -142,16 +142,16 @@ class TXMetaDataPanel extends React.Component { function mapStateToProps(state: AppState): StateProps { return { - gasPrice: getGasPrice(state), + gasPrice: transactionFieldsSelectors.getGasPrice(state), offline: getOffline(state), network: getNetworkConfig(state) }; } export default connect(mapStateToProps, { - inputGasPrice, - inputGasPriceIntent, - fetchCCRates: fetchCCRatesRequested, - getNonceRequested, - resetTransactionRequested + inputGasPrice: transactionFieldsActions.inputGasPrice, + inputGasPriceIntent: transactionFieldsActions.inputGasPriceIntent, + fetchCCRates: ratesActions.fetchCCRatesRequested, + getNonceRequested: transactionNetworkActions.getNonceRequested, + resetTransactionRequested: transactionFieldsActions.resetTransactionRequested })(TXMetaDataPanel); diff --git a/common/components/TXMetaDataPanel/components/AdvancedGas.tsx b/common/components/TXMetaDataPanel/components/AdvancedGas.tsx index b426bfc6..607b128e 100644 --- a/common/components/TXMetaDataPanel/components/AdvancedGas.tsx +++ b/common/components/TXMetaDataPanel/components/AdvancedGas.tsx @@ -1,17 +1,16 @@ import React from 'react'; -import { translateRaw } from 'translations'; +import { connect } from 'react-redux'; + +import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling'; +import translate, { translateRaw } from 'translations'; +import { AppState } from 'features/reducers'; +import { TToggleAutoGasLimit, toggleAutoGasLimit, getAutoGasLimitEnabled } from 'features/config'; +import { scheduleSelectors } from 'features/schedule'; +import { transactionFieldsActions, transactionSelectors } from 'features/transaction'; +import { NonceField, GasLimitField, DataField } from 'components'; +import { Input } from 'components/ui'; import FeeSummary, { RenderData } from './FeeSummary'; import './AdvancedGas.scss'; -import { TToggleAutoGasLimit, toggleAutoGasLimit } from 'actions/config'; -import { AppState } from 'reducers'; -import { TInputGasPrice } from 'actions/transaction'; -import { NonceField, GasLimitField, DataField } from 'components'; -import { connect } from 'react-redux'; -import { getAutoGasLimitEnabled } from 'selectors/config'; -import { isValidGasPrice } from 'selectors/transaction'; -import { Input } from 'components/ui'; -import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling'; -import { getScheduleGasPrice, getTimeBounty } from 'selectors/schedule'; export interface AdvancedOptions { gasPriceField?: boolean; @@ -22,7 +21,7 @@ export interface AdvancedOptions { } interface OwnProps { - inputGasPrice: TInputGasPrice; + inputGasPrice: transactionFieldsActions.TInputGasPrice; gasPrice: AppState['transaction']['fields']['gasPrice']; options?: AdvancedOptions; scheduling?: boolean; @@ -70,7 +69,7 @@ class AdvancedGas extends React.Component { defaultChecked={autoGasLimitEnabled} onChange={this.handleToggleAutoGasLimit} /> - Automatically Calculate Gas Limit + {translate('TRANS_AUTO_GAS_TOGGLE')}
    @@ -107,7 +106,7 @@ class AdvancedGas extends React.Component { )} {nonceField && (
    - +
    )}
    @@ -185,9 +184,9 @@ class AdvancedGas extends React.Component { export default connect( (state: AppState) => ({ autoGasLimitEnabled: getAutoGasLimitEnabled(state), - scheduleGasPrice: getScheduleGasPrice(state), - timeBounty: getTimeBounty(state), - validGasPrice: isValidGasPrice(state) + scheduleGasPrice: scheduleSelectors.getScheduleGasPrice(state), + timeBounty: scheduleSelectors.getTimeBounty(state), + validGasPrice: transactionSelectors.isValidGasPrice(state) }), { toggleAutoGasLimit } )(AdvancedGas); diff --git a/common/components/TXMetaDataPanel/components/FeeSummary.scss b/common/components/TXMetaDataPanel/components/FeeSummary.scss index 00eab85a..2a3f85ae 100644 --- a/common/components/TXMetaDataPanel/components/FeeSummary.scss +++ b/common/components/TXMetaDataPanel/components/FeeSummary.scss @@ -1,7 +1,7 @@ @import 'common/sass/variables'; .FeeSummary { - background: $gray-lighter; + background: shade-dark(0.08); height: 42px; line-height: 42px; padding: 0 12px; diff --git a/common/components/TXMetaDataPanel/components/FeeSummary.tsx b/common/components/TXMetaDataPanel/components/FeeSummary.tsx index 5165af52..5005ce34 100644 --- a/common/components/TXMetaDataPanel/components/FeeSummary.tsx +++ b/common/components/TXMetaDataPanel/components/FeeSummary.tsx @@ -1,16 +1,17 @@ import React from 'react'; -import BN from 'bn.js'; import { connect } from 'react-redux'; -import { AppState } from 'reducers'; +import BN from 'bn.js'; import classNames from 'classnames'; -import { getNetworkConfig, getOffline } from 'selectors/config'; -import { getIsEstimating } from 'selectors/gas'; -import { getGasLimit } from 'selectors/transaction'; -import { UnitDisplay, Spinner } from 'components/ui'; + import { NetworkConfig } from 'types/network'; -import './FeeSummary.scss'; -import { getScheduleGasLimit, getTimeBounty, getSchedulingToggle } from 'selectors/schedule'; import { calcEACTotalCost } from 'libs/scheduling'; +import { AppState } from 'features/reducers'; +import { getOffline, getNetworkConfig } from 'features/config'; +import { gasSelectors } from 'features/gas'; +import { transactionFieldsSelectors } from 'features/transaction'; +import { scheduleSelectors } from 'features/schedule'; +import { UnitDisplay, Spinner } from 'components/ui'; +import './FeeSummary.scss'; export interface RenderData { gasPriceWei: string; @@ -143,14 +144,14 @@ class FeeSummary extends React.Component { function mapStateToProps(state: AppState): ReduxStateProps { return { - gasLimit: getGasLimit(state), + gasLimit: transactionFieldsSelectors.getGasLimit(state), rates: state.rates.rates, network: getNetworkConfig(state), isOffline: getOffline(state), - isGasEstimating: getIsEstimating(state), - scheduling: getSchedulingToggle(state).value, - scheduleGasLimit: getScheduleGasLimit(state), - timeBounty: getTimeBounty(state) + isGasEstimating: gasSelectors.getIsEstimating(state), + scheduling: scheduleSelectors.getSchedulingToggle(state).value, + scheduleGasLimit: scheduleSelectors.getScheduleGasLimit(state), + timeBounty: scheduleSelectors.getTimeBounty(state) }; } diff --git a/common/components/TXMetaDataPanel/components/SimpleGas.scss b/common/components/TXMetaDataPanel/components/SimpleGas.scss index 4a7a3f1c..a8d67632 100644 --- a/common/components/TXMetaDataPanel/components/SimpleGas.scss +++ b/common/components/TXMetaDataPanel/components/SimpleGas.scss @@ -8,18 +8,22 @@ display: flex; > .SimpleGas-slider { flex-grow: 1; - margin-right: $input-padding-x; + margin-right: $space; } + > .FeeSummary { - margin-left: $input-padding-x; + margin-left: $space; min-width: 224px; } + @media screen and (max-width: $screen-md) { flex-wrap: wrap; + > .SimpleGas-slider { width: 100%; margin-right: 0; } + > .FeeSummary { width: 100%; margin-left: 0; @@ -39,7 +43,7 @@ flex: 1; padding: 0 $space-xs; text-align: center; - color: $gray-light; + color: shade-dark(0.4); font-size: $font-size-xs; &:first-child { diff --git a/common/components/TXMetaDataPanel/components/SimpleGas.tsx b/common/components/TXMetaDataPanel/components/SimpleGas.tsx index eb89b927..22e44240 100644 --- a/common/components/TXMetaDataPanel/components/SimpleGas.tsx +++ b/common/components/TXMetaDataPanel/components/SimpleGas.tsx @@ -1,29 +1,24 @@ import React from 'react'; -import Slider, { createSliderWithTooltip } from 'rc-slider'; -import translate from 'translations'; -import './SimpleGas.scss'; -import { AppState } from 'reducers'; -import { - getGasLimitEstimationTimedOut, - getGasEstimationPending, - nonceRequestPending -} from 'selectors/transaction'; import { connect } from 'react-redux'; -import { fetchGasEstimates, TFetchGasEstimates } from 'actions/gas'; -import { getIsWeb3Node } from 'selectors/config'; -import { getEstimates, getIsEstimating } from 'selectors/gas'; -import { Wei, fromWei } from 'libs/units'; +import Slider, { createSliderWithTooltip } from 'rc-slider'; + import { gasPriceDefaults } from 'config'; +import translate from 'translations'; +import { Wei, fromWei } from 'libs/units'; +import { AppState } from 'features/reducers'; +import { getIsWeb3Node } from 'features/config'; +import { transactionFieldsActions, transactionNetworkSelectors } from 'features/transaction'; +import { gasActions, gasSelectors } from 'features/gas'; +import { scheduleSelectors } from 'features/schedule'; import { InlineSpinner } from 'components/ui/InlineSpinner'; -import { TInputGasPrice } from 'actions/transaction'; import FeeSummary from './FeeSummary'; -import { getScheduleGasPrice } from 'selectors/schedule'; +import './SimpleGas.scss'; const SliderWithTooltip = createSliderWithTooltip(Slider); interface OwnProps { gasPrice: AppState['transaction']['fields']['gasPrice']; - setGasPrice: TInputGasPrice; + setGasPrice: transactionFieldsActions.TInputGasPrice; inputGasPrice(rawGas: string): void; } @@ -39,7 +34,7 @@ interface StateProps { } interface ActionProps { - fetchGasEstimates: TFetchGasEstimates; + fetchGasEstimates: gasActions.TFetchGasEstimates; } type Props = OwnProps & StateProps & ActionProps; @@ -81,6 +76,16 @@ class SimpleGas extends React.Component { min: gasEstimates ? gasEstimates.safeLow : gasPriceDefaults.min }; + /** + * @desc On retrieval of gas estimates, + * the current gas price may be lower than the lowest recommended price. + * `rc-slider` will force the onChange if the value is too low, so we + * ensure it at least passes the lower boundary. + * When this occurs, the logic in `UNSAFE_componentWillReceiveProps` fires, + * and it cannot happen again from that point forward. + */ + const actualGasPrice = Math.max(this.getGasPriceGwei(gasPrice.value), bounds.min); + return (
    @@ -108,7 +113,7 @@ class SimpleGas extends React.Component { min={bounds.min} max={bounds.max} step={bounds.min < 1 ? 0.1 : 1} - value={this.getGasPriceGwei(gasPrice.value)} + value={actualGasPrice} tipFormatter={this.formatTooltip} disabled={isGasEstimating} /> @@ -152,15 +157,15 @@ class SimpleGas extends React.Component { export default connect( (state: AppState): StateProps => ({ - gasEstimates: getEstimates(state), - isGasEstimating: getIsEstimating(state), - noncePending: nonceRequestPending(state), - gasLimitPending: getGasEstimationPending(state), - gasLimitEstimationTimedOut: getGasLimitEstimationTimedOut(state), + gasEstimates: gasSelectors.getEstimates(state), + isGasEstimating: gasSelectors.getIsEstimating(state), + noncePending: transactionNetworkSelectors.nonceRequestPending(state), + gasLimitPending: transactionNetworkSelectors.getGasEstimationPending(state), + gasLimitEstimationTimedOut: transactionNetworkSelectors.getGasLimitEstimationTimedOut(state), isWeb3Node: getIsWeb3Node(state), - scheduleGasPrice: getScheduleGasPrice(state) + scheduleGasPrice: scheduleSelectors.getScheduleGasPrice(state) }), { - fetchGasEstimates + fetchGasEstimates: gasActions.fetchGasEstimates } )(SimpleGas); diff --git a/common/components/TXMetaDataPanel/index.tsx b/common/components/TXMetaDataPanel/index.tsx index eed93731..7f68f3ca 100644 --- a/common/components/TXMetaDataPanel/index.tsx +++ b/common/components/TXMetaDataPanel/index.tsx @@ -1,2 +1 @@ -import TXMetaDataPanel from './TXMetaDataPanel'; -export default TXMetaDataPanel; +export { default } from './TXMetaDataPanel'; diff --git a/common/components/TogglablePassword.scss b/common/components/TogglablePassword.scss index ae4fb8d6..0ef15abf 100644 --- a/common/components/TogglablePassword.scss +++ b/common/components/TogglablePassword.scss @@ -3,11 +3,11 @@ .TogglablePassword { &-toggle { cursor: pointer; - color: $gray; + color: shade-dark(0.4); transition: $transition; &:hover { - color: $gray-darker; + color: shade-dark(0.7); } } } diff --git a/common/components/TogglablePassword.tsx b/common/components/TogglablePassword.tsx index 4c2aa657..a5c25eba 100644 --- a/common/components/TogglablePassword.tsx +++ b/common/components/TogglablePassword.tsx @@ -3,8 +3,9 @@ // Pass `isVisible` and `handleToggleVisibility` to control the visibility // yourself, otherwise all visibiility changes are managed in internal state. import React from 'react'; -import './TogglablePassword.scss'; + import { Input, TextArea } from 'components/ui'; +import './TogglablePassword.scss'; interface Props { // Shared props diff --git a/common/components/TransactionStatus/TransactionDataTable.scss b/common/components/TransactionStatus/TransactionDataTable.scss index be38bb82..2e4b6b1c 100644 --- a/common/components/TransactionStatus/TransactionDataTable.scss +++ b/common/components/TransactionStatus/TransactionDataTable.scss @@ -23,13 +23,13 @@ font-weight: bold; &.is-success { - color: $brand-success; + color: color(brand-success); } &.is-warning { - color: $brand-warning; + color: color(brand-warning); } &.is-danger { - color: $brand-danger; + color: color(brand-danger); } } @@ -42,7 +42,7 @@ display: block; width: 100%; height: 7.2rem; - background: $gray-lighter; + background: color(gray-lighter); } } } diff --git a/common/components/TransactionStatus/TransactionDataTable.tsx b/common/components/TransactionStatus/TransactionDataTable.tsx index ff9cd069..158b950e 100644 --- a/common/components/TransactionStatus/TransactionDataTable.tsx +++ b/common/components/TransactionStatus/TransactionDataTable.tsx @@ -1,8 +1,9 @@ import React from 'react'; + import translate from 'translations'; -import { Identicon, UnitDisplay, NewTabLink, Address, CodeBlock } from 'components/ui'; import { TransactionData, TransactionReceipt } from 'types/transactions'; import { NetworkConfig } from 'types/network'; +import { Identicon, UnitDisplay, NewTabLink, Address, CodeBlock } from 'components/ui'; import './TransactionDataTable.scss'; interface TableRow { diff --git a/common/components/TransactionStatus/TransactionStatus.scss b/common/components/TransactionStatus/TransactionStatus.scss index a9a0e5a5..17cf39e6 100644 --- a/common/components/TransactionStatus/TransactionStatus.scss +++ b/common/components/TransactionStatus/TransactionStatus.scss @@ -21,7 +21,7 @@ margin: 0 auto; &-title { - color: $brand-danger; + color: color(brand-danger); } &-desc { diff --git a/common/components/TransactionStatus/TransactionStatus.tsx b/common/components/TransactionStatus/TransactionStatus.tsx index 13f417a5..247b4c1b 100644 --- a/common/components/TransactionStatus/TransactionStatus.tsx +++ b/common/components/TransactionStatus/TransactionStatus.tsx @@ -1,14 +1,14 @@ import React from 'react'; import { connect } from 'react-redux'; + import translate from 'translations'; -import { fetchTransactionData, TFetchTransactionData } from 'actions/transactions'; -import { getTransactionDatas } from 'selectors/transactions'; -import { getNetworkConfig } from 'selectors/config'; -import { Spinner } from 'components/ui'; -import TransactionDataTable from './TransactionDataTable'; -import { AppState } from 'reducers'; import { NetworkConfig } from 'types/network'; import { TransactionState } from 'types/transactions'; +import { AppState } from 'features/reducers'; +import { getNetworkConfig } from 'features/config'; +import { transactionsActions, transactionsSelectors } from 'features/transactions'; +import { Spinner } from 'components/ui'; +import TransactionDataTable from './TransactionDataTable'; import './TransactionStatus.scss'; interface OwnProps { @@ -21,7 +21,7 @@ interface StateProps { } interface ActionProps { - fetchTransactionData: TFetchTransactionData; + fetchTransactionData: transactionsActions.TFetchTransactionData; } type Props = OwnProps & StateProps & ActionProps; @@ -79,9 +79,11 @@ function mapStateToProps(state: AppState, ownProps: OwnProps): StateProps { const { txHash } = ownProps; return { - tx: getTransactionDatas(state)[txHash], + tx: transactionsSelectors.getTransactionDatas(state)[txHash], network: getNetworkConfig(state) }; } -export default connect(mapStateToProps, { fetchTransactionData })(TransactionStatus); +export default connect(mapStateToProps, { + fetchTransactionData: transactionsActions.fetchTransactionData +})(TransactionStatus); diff --git a/common/components/TransactionStatus/index.tsx b/common/components/TransactionStatus/index.tsx index ae3b19f8..d0d15c43 100644 --- a/common/components/TransactionStatus/index.tsx +++ b/common/components/TransactionStatus/index.tsx @@ -1,2 +1 @@ -import TransactionStatus from './TransactionStatus'; -export default TransactionStatus; +export { default } from './TransactionStatus'; diff --git a/common/components/Translate.tsx b/common/components/Translate.tsx index ca35d3c8..30a72f64 100644 --- a/common/components/Translate.tsx +++ b/common/components/Translate.tsx @@ -1,5 +1,6 @@ import React from 'react'; import Markdown from 'react-markdown'; + import NewTabLink from 'components/ui/NewTabLink'; interface Props { diff --git a/common/components/UnitDropDown/UnitDropDown.tsx b/common/components/UnitDropDown/UnitDropDown.tsx index 0bad9e2e..ef64e621 100644 --- a/common/components/UnitDropDown/UnitDropDown.tsx +++ b/common/components/UnitDropDown/UnitDropDown.tsx @@ -1,22 +1,23 @@ import React, { Component } from 'react'; -import { setUnitMeta, TSetUnitMeta } from 'actions/transaction'; -import { TokenBalance, MergedToken, getShownTokenBalances, getTokens } from 'selectors/wallet'; -import { Query } from 'components/renderCbs'; import { connect } from 'react-redux'; -import { AppState } from 'reducers'; -import { getUnit } from 'selectors/transaction'; -import { getNetworkUnit } from 'selectors/config'; import { Option } from 'react-select'; + +import { AppState } from 'features/reducers'; +import * as selectors from 'features/selectors'; +import { transactionMetaActions } from 'features/transaction'; +import { getNetworkUnit } from 'features/config'; +import { walletTypes } from 'features/wallet'; +import { Query } from 'components/renderCbs'; import { Dropdown } from 'components/ui'; interface DispatchProps { - setUnitMeta: TSetUnitMeta; + setUnitMeta: transactionMetaActions.TSetUnitMeta; } interface StateProps { unit: string; - tokens: TokenBalance[]; - allTokens: MergedToken[]; + tokens: walletTypes.TokenBalance[]; + allTokens: walletTypes.MergedToken[]; showAllTokens?: boolean; networkUnit: string; } @@ -49,15 +50,18 @@ class UnitDropdownClass extends Component { this.props.setUnitMeta(unit.value); }; } -const getTokenSymbols = (tokens: (TokenBalance | MergedToken)[]) => tokens.map(t => t.symbol); +const getTokenSymbols = (tokens: (walletTypes.TokenBalance | walletTypes.MergedToken)[]) => + tokens.map(t => t.symbol); function mapStateToProps(state: AppState) { return { - tokens: getShownTokenBalances(state, true), - allTokens: getTokens(state), - unit: getUnit(state), + tokens: selectors.getShownTokenBalances(state, true), + allTokens: selectors.getTokens(state), + unit: selectors.getUnit(state), networkUnit: getNetworkUnit(state) }; } -export const UnitDropDown = connect(mapStateToProps, { setUnitMeta })(UnitDropdownClass); +export const UnitDropDown = connect(mapStateToProps, { + setUnitMeta: transactionMetaActions.setUnitMeta +})(UnitDropdownClass); diff --git a/common/components/WalletDecrypt/WalletDecrypt.scss b/common/components/WalletDecrypt/WalletDecrypt.scss index 5cdd53a9..47a0be7e 100644 --- a/common/components/WalletDecrypt/WalletDecrypt.scss +++ b/common/components/WalletDecrypt/WalletDecrypt.scss @@ -124,6 +124,17 @@ $speed: 500ms; overflow: hidden; text-overflow: ellipsis; } + + &-override { + position: absolute; + bottom: 0; + right: 0; + opacity: 0.3; + + &:hover { + opacity: 1; + } + } } } diff --git a/common/components/WalletDecrypt/WalletDecrypt.tsx b/common/components/WalletDecrypt/WalletDecrypt.tsx index dded9aee..e1c26e14 100644 --- a/common/components/WalletDecrypt/WalletDecrypt.tsx +++ b/common/components/WalletDecrypt/WalletDecrypt.tsx @@ -1,22 +1,32 @@ import React, { Component } from 'react'; +import { TransitionGroup, CSSTransition } from 'react-transition-group'; +import { withRouter, RouteComponentProps } from 'react-router'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import isEmpty from 'lodash/isEmpty'; -import { TransitionGroup, CSSTransition } from 'react-transition-group'; + import { - setWallet, - TSetWallet, - unlockKeystore, - TUnlockKeystore, - unlockMnemonic, - TUnlockMnemonic, - unlockPrivateKey, - TUnlockPrivateKey, - unlockWeb3, - TUnlockWeb3 -} from 'actions/wallet'; -import { resetTransactionRequested, TResetTransactionRequested } from 'actions/transaction'; + SecureWalletName, + InsecureWalletName, + MiscWalletName, + WalletName, + knowledgeBaseURL, + donationAddressMap +} from 'config'; import translate, { translateRaw } from 'translations'; +import { isWeb3NodeAvailable } from 'libs/nodes/web3'; +import { wikiLink as paritySignerHelpLink } from 'libs/wallet/non-deterministic/parity'; +import { AppState } from 'features/reducers'; +import * as derivedSelectors from 'features/selectors'; +import { walletActions } from 'features/wallet'; +import { transactionFieldsActions } from 'features/transaction'; +import { notificationsActions } from 'features/notifications'; +import LedgerIcon from 'assets/images/wallets/ledger.svg'; +import TrezorIcon from 'assets/images/wallets/trezor.svg'; +import ParitySignerIcon from 'assets/images/wallets/parity-signer.svg'; +import { Errorable } from 'components'; +import { DisabledWallets } from './disables'; +import { getWeb3ProviderInfo } from 'utils/web3'; import { KeystoreDecrypt, LedgerNanoSDecrypt, @@ -30,28 +40,8 @@ import { ParitySignerDecrypt, InsecureWalletWarning } from './components'; -import { AppState } from 'reducers'; -import { showNotification, TShowNotification } from 'actions/notifications'; -import { getDisabledWallets } from 'selectors/wallet'; -import { DisabledWallets } from './disables'; -import { - SecureWalletName, - InsecureWalletName, - MiscWalletName, - WalletName, - knowledgeBaseURL, - donationAddressMap -} from 'config'; -import { isWeb3NodeAvailable } from 'libs/nodes/web3'; -import { getWeb3ProviderInfo } from 'utils/web3'; -import LedgerIcon from 'assets/images/wallets/ledger.svg'; -import TrezorIcon from 'assets/images/wallets/trezor.svg'; -import ParitySignerIcon from 'assets/images/wallets/parity-signer.svg'; -import { wikiLink as paritySignerHelpLink } from 'libs/wallet/non-deterministic/parity'; import './WalletDecrypt.scss'; -import { withRouter, RouteComponentProps } from 'react-router'; -import { Errorable } from 'components'; -import { getNetworkConfig } from 'selectors/config'; +import { getNetworkConfig } from 'features/config'; interface OwnProps { hidden?: boolean; @@ -60,13 +50,13 @@ interface OwnProps { } interface DispatchProps { - unlockKeystore: TUnlockKeystore; - unlockMnemonic: TUnlockMnemonic; - unlockPrivateKey: TUnlockPrivateKey; - unlockWeb3: TUnlockWeb3; - setWallet: TSetWallet; - resetTransactionRequested: TResetTransactionRequested; - showNotification: TShowNotification; + unlockKeystore: walletActions.TUnlockKeystore; + unlockMnemonic: walletActions.TUnlockMnemonic; + unlockPrivateKey: walletActions.TUnlockPrivateKey; + unlockWeb3: walletActions.TUnlockWeb3; + setWallet: walletActions.TSetWallet; + resetTransactionRequested: transactionFieldsActions.TResetTransactionRequested; + showNotification: notificationsActions.TShowNotification; } interface StateProps { @@ -81,8 +71,8 @@ type Props = OwnProps & StateProps & DispatchProps & RouteComponentProps<{}>; type UnlockParams = {} | PrivateKeyValue; interface State { selectedWalletKey: WalletName | null; + isInsecureOverridden: boolean; value: UnlockParams | null; - hasAcknowledgedInsecure: boolean; } interface BaseWalletInfo { @@ -206,8 +196,8 @@ const WalletDecrypt = withRouter( public state: State = { selectedWalletKey: null, - value: null, - hasAcknowledgedInsecure: false + isInsecureOverridden: false, + value: null }; public UNSAFE_componentWillReceiveProps(nextProps: Props) { @@ -230,20 +220,28 @@ const WalletDecrypt = withRouter( } public getDecryptionComponent() { - const { selectedWalletKey, hasAcknowledgedInsecure } = this.state; + const { selectedWalletKey, isInsecureOverridden } = this.state; const selectedWallet = this.getSelectedWallet(); if (!selectedWalletKey || !selectedWallet) { return null; } - if (INSECURE_WALLETS.includes(selectedWalletKey) && !hasAcknowledgedInsecure) { + const isInsecure = INSECURE_WALLETS.includes(selectedWalletKey); + if (isInsecure && !isInsecureOverridden && !process.env.BUILD_DOWNLOADABLE) { return (
    + {process.env.NODE_ENV !== 'production' && ( + + )}
    ); } @@ -286,10 +284,6 @@ const WalletDecrypt = withRouter( ); } - public handleAcknowledgeInsecure = () => { - this.setState({ hasAcknowledgedInsecure: true }); - }; - public buildWalletOptions() { const { computedDisabledWallets } = this.props; const { reasons } = computedDisabledWallets; @@ -387,8 +381,7 @@ const WalletDecrypt = withRouter( window.setTimeout(() => { this.setState({ selectedWalletKey: walletType, - value: wallet.initialParams, - hasAcknowledgedInsecure: false + value: wallet.initialParams }); }, timeout); }; @@ -396,8 +389,7 @@ const WalletDecrypt = withRouter( public clearWalletChoice = () => { this.setState({ selectedWalletKey: null, - value: null, - hasAcknowledgedInsecure: false + value: null }); }; @@ -449,12 +441,18 @@ const WalletDecrypt = withRouter( private isWalletDisabled = (walletKey: WalletName) => { return this.props.computedDisabledWallets.wallets.indexOf(walletKey) !== -1; }; + + private overrideInsecureWarning = () => { + if (process.env.NODE_ENV !== 'production') { + this.setState({ isInsecureOverridden: true }); + } + }; } ); function mapStateToProps(state: AppState, ownProps: Props) { const { disabledWallets } = ownProps; - let computedDisabledWallets = getDisabledWallets(state); + let computedDisabledWallets = derivedSelectors.getDisabledWallets(state); if (disabledWallets) { computedDisabledWallets = { @@ -475,11 +473,11 @@ function mapStateToProps(state: AppState, ownProps: Props) { } export default connect(mapStateToProps, { - unlockKeystore, - unlockMnemonic, - unlockPrivateKey, - unlockWeb3, - setWallet, - resetTransactionRequested, - showNotification + unlockKeystore: walletActions.unlockKeystore, + unlockMnemonic: walletActions.unlockMnemonic, + unlockPrivateKey: walletActions.unlockPrivateKey, + unlockWeb3: walletActions.unlockWeb3, + setWallet: walletActions.setWallet, + resetTransactionRequested: transactionFieldsActions.resetTransactionRequested, + showNotification: notificationsActions.showNotification })(WalletDecrypt) as React.ComponentClass; diff --git a/common/components/WalletDecrypt/components/DeprecationWarning.tsx b/common/components/WalletDecrypt/components/DeprecationWarning.tsx deleted file mode 100644 index 82eab917..00000000 --- a/common/components/WalletDecrypt/components/DeprecationWarning.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; -import translate from 'translations'; - -const DeprecationWarning: React.SFC<{}> = () => { - if (process.env.BUILD_DOWNLOADABLE) { - return null; - } - - return
    {translate('INSECURE_WALLET_DEPRECATION')}
    ; -}; - -export default DeprecationWarning; diff --git a/common/components/WalletDecrypt/components/DeterministicWalletsModal.scss b/common/components/WalletDecrypt/components/DeterministicWalletsModal.scss index 4791dfce..c031278b 100644 --- a/common/components/WalletDecrypt/components/DeterministicWalletsModal.scss +++ b/common/components/WalletDecrypt/components/DeterministicWalletsModal.scss @@ -49,6 +49,8 @@ &-token { width: 82px; + background: color(control-bg); + color: control(control-color); } &-address { diff --git a/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx b/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx index bca64960..17550c33 100644 --- a/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx +++ b/common/components/WalletDecrypt/components/DeterministicWalletsModal.tsx @@ -1,23 +1,19 @@ import React from 'react'; -import { connect } from 'react-redux'; import Select, { Option } from 'react-select'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { connect } from 'react-redux'; + import translate, { translateRaw } from 'translations'; -import { - DeterministicWalletData, - getDeterministicWallets, - GetDeterministicWalletsAction, - GetDeterministicWalletsArgs, - setDesiredToken, - SetDesiredTokenAction -} from 'actions/deterministicWallets'; -import Modal, { IButton } from 'components/ui/Modal'; -import { AppState } from 'reducers'; import { isValidPath } from 'libs/validators'; -import { getNetworkConfig } from 'selectors/config'; -import { getTokens } from 'selectors/wallet'; -import { getAddressLabels } from 'selectors/addressBook'; +import { AppState } from 'features/reducers'; +import { getNetworkConfig } from 'features/config'; +import * as selectors from 'features/selectors'; +import { + deterministicWalletsTypes, + deterministicWalletsActions +} from 'features/deterministicWallets'; +import { addressBookSelectors } from 'features/addressBook'; import { UnitDisplay, Input } from 'components/ui'; +import Modal, { IButton } from 'components/ui/Modal'; import './DeterministicWalletsModal.scss'; const WALLETS_PER_PAGE = 5; @@ -32,16 +28,18 @@ interface OwnProps { } interface StateProps { - addressLabels: ReturnType; + addressLabels: ReturnType; wallets: AppState['deterministicWallets']['wallets']; desiredToken: AppState['deterministicWallets']['desiredToken']; network: ReturnType; - tokens: ReturnType; + tokens: ReturnType; } interface DispatchProps { - getDeterministicWallets(args: GetDeterministicWalletsArgs): GetDeterministicWalletsAction; - setDesiredToken(tkn: string | undefined): SetDesiredTokenAction; + getDeterministicWallets( + args: deterministicWalletsTypes.GetDeterministicWalletsArgs + ): deterministicWalletsTypes.GetDeterministicWalletsAction; + setDesiredToken(tkn: string | undefined): deterministicWalletsTypes.SetDesiredTokenAction; onCancel(): void; onConfirmAddress(address: string, addressIndex: number): void; onPathChange(dPath: DPath): void; @@ -201,14 +199,13 @@ class DeterministicWalletsModalClass extends React.PureComponent { private getAddresses(props: Props = this.props) { const { dPath, publicKey, chainCode, seed } = props; - if (dPath && ((publicKey && chainCode) || seed)) { if (isValidPath(dPath.value)) { this.props.getDeterministicWallets({ seed, + dPath: dPath.value, publicKey, chainCode, - dPath: dPath.value, limit: WALLETS_PER_PAGE, offset: WALLETS_PER_PAGE * this.state.page }); @@ -277,10 +274,10 @@ class DeterministicWalletsModalClass extends React.PureComponent { ); } - private renderWalletRow(wallet: DeterministicWalletData) { + private renderWalletRow(wallet: deterministicWalletsTypes.DeterministicWalletData) { const { desiredToken, network, addressLabels } = this.props; const { selectedAddress } = this.state; - const label = addressLabels[toChecksumAddress(wallet.address)]; + const label = addressLabels[wallet.address.toLowerCase()]; const spanClassName = label ? 'DWModal-addresses-table-address-text' : ''; // Get renderable values, but keep 'em short @@ -342,17 +339,17 @@ class DeterministicWalletsModalClass extends React.PureComponent { function mapStateToProps(state: AppState): StateProps { return { - addressLabels: getAddressLabels(state), + addressLabels: addressBookSelectors.getAddressLabels(state), wallets: state.deterministicWallets.wallets, desiredToken: state.deterministicWallets.desiredToken, network: getNetworkConfig(state), - tokens: getTokens(state) + tokens: selectors.getTokens(state) }; } const DeterministicWalletsModal = connect(mapStateToProps, { - getDeterministicWallets, - setDesiredToken + getDeterministicWallets: deterministicWalletsActions.getDeterministicWallets, + setDesiredToken: deterministicWalletsActions.setDesiredToken })(DeterministicWalletsModalClass); export default DeterministicWalletsModal; diff --git a/common/components/WalletDecrypt/components/InsecureWalletWarning.scss b/common/components/WalletDecrypt/components/InsecureWalletWarning.scss index d93742a9..901dab58 100644 --- a/common/components/WalletDecrypt/components/InsecureWalletWarning.scss +++ b/common/components/WalletDecrypt/components/InsecureWalletWarning.scss @@ -1,36 +1,48 @@ @import 'common/sass/variables'; +@import 'common/sass/mixins'; .WalletWarning { - max-width: 780px; + max-width: 820px; margin: 0 auto; - text-align: left; + text-align: center; &-title { - color: $brand-danger; - margin-top: 0; + color: color(brand-danger); + margin: 0 0 $space; } &-desc { - margin-bottom: $space; - } - - &-check { - margin-bottom: $space * 2; - } - - &-checkboxes { margin-bottom: $space * 2; } &-buttons { display: flex; + flex-direction: column; flex-wrap: wrap; - margin-bottom: -$space-sm; + justify-content: center; + max-width: 440px; + margin: 0 auto #{-$space}; - .btn { - flex: 1; - min-width: 280px; - margin: 0 $space-sm $space-sm; + &-btn { + width: 100%; + margin: 0 0 $space; + + &.is-cancel { + @include reset-button; + opacity: 0.4; + transition: $transition; + + &:hover { + opacity: 1; + } + + .fa { + position: relative; + top: -1px; + margin-right: $space-xs; + font-size: 11px; + } + } } } } @@ -38,7 +50,7 @@ .AcknowledgeCheckbox { margin-bottom: $space-sm; - &-checkbox[type="checkbox"] { + &-checkbox[type='checkbox'] { display: inline-block; margin-right: $space-sm; margin-top: 0; diff --git a/common/components/WalletDecrypt/components/InsecureWalletWarning.tsx b/common/components/WalletDecrypt/components/InsecureWalletWarning.tsx index d1d32845..f24abef6 100644 --- a/common/components/WalletDecrypt/components/InsecureWalletWarning.tsx +++ b/common/components/WalletDecrypt/components/InsecureWalletWarning.tsx @@ -1,129 +1,43 @@ import React from 'react'; -import { HELP_ARTICLE, DOWNLOAD_MYCRYPTO_LINK } from 'config'; -import './InsecureWalletWarning.scss'; import translate from 'translations'; -import { knowledgeBaseURL } from 'config/data'; +import { NewTabLink } from 'components/ui'; +import './InsecureWalletWarning.scss'; interface Props { walletType: string; - onContinue(): void; onCancel(): void; } -interface State { - hasConfirmedSite: boolean; - hasAcknowledgedDownload: boolean; - hasAcknowledgedWallets: boolean; -} - -interface Checkbox { - name: keyof State; - label: string | React.ReactElement; -} - -export class InsecureWalletWarning extends React.Component { - public state: State = { - hasConfirmedSite: false, - hasAcknowledgedDownload: false, - hasAcknowledgedWallets: false - }; - +export class InsecureWalletWarning extends React.Component { constructor(props: Props) { super(props); - if (process.env.BUILD_DOWNLOADABLE) { - props.onContinue(); - } } public render() { - if (process.env.BUILD_DOWNLOADABLE) { - return null; - } - - const { walletType, onContinue, onCancel } = this.props; - const checkboxes: Checkbox[] = [ - { - name: 'hasAcknowledgedWallets', - label: translate('INSECURE_WALLET_WARNING_1') - }, - { - name: 'hasAcknowledgedDownload', - label: translate('INSECURE_WALLET_WARNING_2') - }, - { - name: 'hasConfirmedSite', - label: translate('INSECURE_WALLET_WARNING_3') - } - ]; - const canContinue = checkboxes.reduce( - (prev, checkbox) => prev && this.state[checkbox.name], - true - ); + const { walletType, onCancel } = this.props; return (
    -

    {translate('INSECURE_WALLET_TYPE_TITLE')}

    +

    + {translate('INSECURE_WALLET_TYPE_TITLE', { $wallet_type: walletType })} +

    {translate('INSECURE_WALLET_TYPE_DESC', { $wallet_type: walletType })}

    -
      -
    • - {translate('INSECURE_WALLET_RECOMMEND_1', { - $metamask_article: knowledgeBaseURL + '/' + HELP_ARTICLE.MIGRATE_TO_METAMASK, - $hardware_wallet_article: - knowledgeBaseURL + '/' + HELP_ARTICLE.HARDWARE_WALLET_RECOMMENDATIONS - })} -
    • -
    • - {translate('INSECURE_WALLET_RECOMMEND_2', { - $download_mycrypto: DOWNLOAD_MYCRYPTO_LINK - })} -
    • -
    • - {translate('INSECURE_WALLET_RECOMMEND_3', { - $secure_your_eth_article: knowledgeBaseURL + '/' + HELP_ARTICLE.SECURING_YOUR_ETH - })} -
    • -
    -

    - {translate('WALLET_WARNING_CHECK', { $wallet_type: walletType })} -

    -
    {checkboxes.map(this.makeCheckbox)}
    - -
    ); } - - private makeCheckbox = (checkbox: Checkbox) => { - return ( - - ); - }; - - private handleCheckboxChange = (ev: React.FormEvent) => { - this.setState({ - [ev.currentTarget.name as any]: !!ev.currentTarget.checked - }); - }; } diff --git a/common/components/WalletDecrypt/components/Keystore.tsx b/common/components/WalletDecrypt/components/Keystore.tsx index 20c890a0..142f30d2 100644 --- a/common/components/WalletDecrypt/components/Keystore.tsx +++ b/common/components/WalletDecrypt/components/Keystore.tsx @@ -1,10 +1,10 @@ -import { isKeystorePassRequired } from 'libs/wallet'; import React, { PureComponent } from 'react'; + import translate, { translateRaw } from 'translations'; +import { isKeystorePassRequired } from 'libs/wallet'; +import { notificationsActions } from 'features/notifications'; import Spinner from 'components/ui/Spinner'; -import { TShowNotification } from 'actions/notifications'; import { Input } from 'components/ui'; -import DeprecationWarning from './DeprecationWarning'; export interface KeystoreValue { file: string; @@ -35,7 +35,7 @@ export class KeystoreDecrypt extends PureComponent { isPasswordPending: boolean; onChange(value: KeystoreValue): void; onUnlock(): void; - showNotification(level: string, message: string): TShowNotification; + showNotification(level: string, message: string): notificationsActions.TShowNotification; }; public render() { @@ -45,7 +45,6 @@ export class KeystoreDecrypt extends PureComponent { return ( -
    p { - font-size: 1rem; - font-weight: 400; - color: #a8adb3; - text-align: left; - &:first-child { - color: #333; - margin-right: 0.5rem; + justify-content: center; + align-items: center; + + .Spinner { + margin-right: 16px; + } + } + + &-illustration { + margin-bottom: 2rem; + width: 128px; + } + + &-tip { + &-wrapper { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + margin: auto; + margin-bottom: 3rem; + max-width: 360px; + > p { + font-size: 1rem; + font-weight: 400; + color: #a8adb3; + text-align: left; + &:first-child { + color: #333; + margin-right: 0.5rem; + } } } } - } - &-btn { - &-wrapper { - display: flex; - flex-direction: row; - flex-wrap: nowrap; + &-btn { + &-wrapper { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + } } } } diff --git a/common/components/WalletDecrypt/components/LedgerNano.tsx b/common/components/WalletDecrypt/components/LedgerNano.tsx index 6ffb5b60..50f4679d 100644 --- a/common/components/WalletDecrypt/components/LedgerNano.tsx +++ b/common/components/WalletDecrypt/components/LedgerNano.tsx @@ -1,17 +1,16 @@ import React, { PureComponent } from 'react'; -import ledger from 'ledgerco'; +import { connect } from 'react-redux'; + +import { SecureWalletName } from 'config'; import translate, { translateRaw } from 'translations'; -import DeterministicWalletsModal from './DeterministicWalletsModal'; -import UnsupportedNetwork from './UnsupportedNetwork'; import { LedgerWallet } from 'libs/wallet'; +import { NetworkConfig } from 'types/network'; +import { AppState } from 'features/reducers'; +import { getNetworkConfig, getPaths, getSingleDPath } from 'features/config'; import { NewTabLink } from 'components/ui'; import { PrimaryButton, SecondaryButton } from 'components'; -import { connect } from 'react-redux'; -import { AppState } from 'reducers'; -import { SecureWalletName } from 'config'; -import { getPaths, getSingleDPath } from 'selectors/config/wallet'; -import { getNetworkConfig } from 'selectors/config'; -import { NetworkConfig } from 'types/network'; +import UnsupportedNetwork from './UnsupportedNetwork'; +import DeterministicWalletsModal from './DeterministicWalletsModal'; import img from 'assets/images/ledger-nano-illustration.svg'; import './LedgerNano.scss'; @@ -32,7 +31,6 @@ interface State { dPath: DPath; error: string | null; isLoading: boolean; - showTip: boolean; } type Props = OwnProps & StateProps; @@ -43,14 +41,7 @@ class LedgerNanoSDecryptClass extends PureComponent { chainCode: '', dPath: this.props.dPath || this.props.dPaths[0], error: null, - isLoading: false, - showTip: false - }; - - public showTip = () => { - this.setState({ - showTip: true - }); + isLoading: false }; public UNSAFE_componentWillReceiveProps(nextProps: Props) { @@ -67,7 +58,7 @@ class LedgerNanoSDecryptClass extends PureComponent { return ; } - if (window.location.protocol !== 'https:') { + if (!process.env.BUILD_ELECTRON && window.location.protocol !== 'https:') { return (
    @@ -127,56 +118,31 @@ class LedgerNanoSDecryptClass extends PureComponent { private handlePathChange = (dPath: DPath) => { this.handleConnect(dPath); + this.setState({ + dPath + }); }; private handleConnect = (dPath: DPath) => { this.setState({ isLoading: true, - error: null, - showTip: false + error: null }); - ledger.comm_u2f.create_async().then((comm: any) => { - new ledger.eth(comm) - .getAddress_async(dPath.value, false, true) - .then(res => { - this.setState({ - publicKey: res.publicKey, - chainCode: res.chainCode, - isLoading: false - }); - }) - .catch((err: any) => { - let showTip; - let errMsg; - // Timeout - if (err && err.metaData && err.metaData.code === 5) { - showTip = true; - errMsg = translateRaw('LEDGER_TIMEOUT'); - } - // Wrong app logged into - if (err && err.includes && err.includes('6804')) { - showTip = true; - errMsg = translateRaw('LEDGER_WRONG_APP'); - } - // Ledger locked - if (err && err.includes && err.includes('6801')) { - errMsg = translateRaw('LEDGER_LOCKED'); - } - // Other - if (!errMsg) { - errMsg = err && err.metaData ? err.metaData.type : err.toString(); - } - - this.setState({ - error: errMsg, - isLoading: false - }); - if (showTip) { - this.showTip(); - } + LedgerWallet.getChainCode(dPath.value) + .then(res => { + this.setState({ + publicKey: res.publicKey, + chainCode: res.chainCode, + isLoading: false }); - }); + }) + .catch(err => { + this.setState({ + error: translateRaw(err.message), + isLoading: false + }); + }); }; private handleCancel = () => { diff --git a/common/components/WalletDecrypt/components/Mnemonic.tsx b/common/components/WalletDecrypt/components/Mnemonic.tsx index ba4a5d95..93427a83 100644 --- a/common/components/WalletDecrypt/components/Mnemonic.tsx +++ b/common/components/WalletDecrypt/components/Mnemonic.tsx @@ -1,15 +1,15 @@ -import { mnemonicToSeed, validateMnemonic } from 'bip39'; import React, { PureComponent } from 'react'; -import translate, { translateRaw } from 'translations'; -import DeterministicWalletsModal from './DeterministicWalletsModal'; -import { formatMnemonic } from 'utils/formatters'; -import { InsecureWalletName } from 'config'; -import { AppState } from 'reducers'; import { connect } from 'react-redux'; -import { getSingleDPath, getPaths } from 'selectors/config/wallet'; +import { mnemonicToSeed, validateMnemonic } from 'bip39'; + +import { InsecureWalletName } from 'config'; +import translate, { translateRaw } from 'translations'; +import { formatMnemonic } from 'utils/formatters'; +import { AppState } from 'features/reducers'; +import { getSingleDPath, getPaths } from 'features/config'; import { TogglablePassword } from 'components'; import { Input } from 'components/ui'; -import DeprecationWarning from './DeprecationWarning'; +import DeterministicWalletsModal from './DeterministicWalletsModal'; interface OwnProps { onUnlock(param: any): void; @@ -51,7 +51,6 @@ class MnemonicDecryptClass extends PureComponent { return ( -
    { public render() { return ( @@ -44,16 +51,16 @@ class ParitySignerDecryptClass extends PureComponent { ); } - private unlockAddress = (address: string) => { - if (!isValidETHAddress(address)) { + private unlockAddress = (content: SignerQrContent) => { + if (typeof content === 'string' || !isValidETHAddress(content.address)) { this.props.showNotification('danger', 'Not a valid address!'); return; } - this.props.onUnlock(new ParitySignerWallet(address)); + this.props.onUnlock(new ParitySignerWallet(content.address)); }; } -export const ParitySignerDecrypt = connect(() => ({}), { showNotification })( - ParitySignerDecryptClass -); +export const ParitySignerDecrypt = connect(() => ({}), { + showNotification: notificationsActions.showNotification +})(ParitySignerDecryptClass); diff --git a/common/components/WalletDecrypt/components/PrivateKey.tsx b/common/components/WalletDecrypt/components/PrivateKey.tsx index 34ed90d0..5ec44418 100644 --- a/common/components/WalletDecrypt/components/PrivateKey.tsx +++ b/common/components/WalletDecrypt/components/PrivateKey.tsx @@ -1,10 +1,10 @@ -import { isValidEncryptedPrivKey, isValidPrivKey } from 'libs/validators'; -import { stripHexPrefix } from 'libs/values'; import React, { PureComponent } from 'react'; + import translate, { translateRaw } from 'translations'; +import { isValidEncryptedPrivKey, isValidPrivKey } from 'libs/validators'; +import { stripHexPrefix } from 'libs/formatters'; import { TogglablePassword } from 'components'; import { Input } from 'components/ui'; -import DeprecationWarning from './DeprecationWarning'; export interface PrivateKeyValue { key: string; @@ -55,7 +55,6 @@ export class PrivateKeyDecrypt extends PureComponent { return ( -