From 3193cdc2b4a703fdbf9ad15307910914999113fb Mon Sep 17 00:00:00 2001 From: Fernando Date: Wed, 11 Mar 2020 10:11:42 -0300 Subject: [PATCH] MERGE development into master (#648) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix #597: USD value not load (#609) * Converts all the addresses to checksum values * Fix for empty address * fix the order of transactions, change updateSafe to upgradeSafe to avoid naming confusion with the updateSafe action (#610) * Fix #596: Notification when safe is already updated (#599) * Fix notification of update if the safe is already updated * Makes the notification clickable Displays the notification for owners only * Identify upgrade tx * Add red badge to Settings tab * Fixs Padding Removes the red dot if the user is not an owner Co-authored-by: Fernando * Bug: #482 - Address book Custom transactions Recipient validation (#577) * (fix) text input bottom border * Fix #482 input * Merge branch 'development' of https://github.com/gnosis/safe-react into fix/#482-address-book # Conflicts: # src/components/forms/TextField/index.jsx # src/routes/safe/components/Balances/SendModal/screens/AddressBookInput/index.jsx # src/routes/safe/components/Balances/SendModal/screens/SendFunds/TokenSelectField/index.jsx # src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx # yarn.lock * Fix custom tx addresses filtering * Merge branch 'development' of https://github.com/gnosis/safe-react into fix/#482-address-book # Conflicts: # yarn.lock * Remove console logs Fixed prettier issues * Remove unnecessary template string * Fix `tokenAddress` string conversion * Use `secondaryBackground` value Co-authored-by: Gabriel Rodríguez Alsina Co-authored-by: Fernando * (feature) Adding origin for Apps Transactions (#576) * Adding origin field when creates a TX * refactor: replace list of arg by object in getApprovalTransaction and getExecutionTransaction function * minor changes * Allow execute if threshold is 1 for the first tx - Related to issue #563 - `lastTx` is required due to #489 * - Normalizing logic between createTransaction and processTransaction - Moving shared function to a new file * Refactor `doesTxNeedApproval` back to the `isExecution`-related meaning * Rename function and variable names * Add tests for `getNewTxNonce` and `shouldExecuteTransaction` functions * Pass `safeInstance` instead of `safeAddress` to `getNewTxNonce` * Update Tests - remove mocked `getGnosisSafeInstanceAt` - pass `safeInstance` instead of `safeAddress` to `getNewTxNonce` Co-authored-by: Fernando * (Feature) Add checks into CI (#594) * Repare new dev and staging enviroments to deploy (#618) * Repare new dev and staging enviroments to deploy - Add to `deploy_pull_requests.sh` to the new path. - Replace upload-dir to deploy staging to the new path. * add /app/ public path for the webapp, remove duplicate yarn build from travis * add basename to app * deploy pr to /app * update travis * linter error fixes * fix travis build script Co-authored-by: David Albela Pérez <3659067+davidalbela@users.noreply.github.com> * (fix) sidebar contents' scrolling (#622) * (add) linter sorting rules (#614) * (add) linter sorting rules * (fix) linting errors according to the new rules Co-authored-by: Fernando * Rebase master onto development (#624) * v1.7.3 (#611) * Fix #597: USD value not load (#609) * Converts all the addresses to checksum values * Fix for empty address * fix the order of transactions, change updateSafe to upgradeSafe to avoid naming confusion with the updateSafe action (#610) * Fix #596: Notification when safe is already updated (#599) * Fix notification of update if the safe is already updated * Makes the notification clickable Displays the notification for owners only * Identify upgrade tx * Add red badge to Settings tab * Fixs Padding Removes the red dot if the user is not an owner Co-authored-by: Fernando Co-authored-by: Fernando Co-authored-by: Agustin Pane * Update package.json (#612) * Add public url to prod webpack config (#615) * add public url to prod webpack config * modify travis/webpack config to add public url * add slash * cherry pick new travis yml merge commit (#620) * Fix #596: Notification when safe is already updated (#599) * Fix notification of update if the safe is already updated * Makes the notification clickable Displays the notification for owners only * Identify upgrade tx * Add red badge to Settings tab * Fixs Padding Removes the red dot if the user is not an owner Co-authored-by: Fernando * Bug: #482 - Address book Custom transactions Recipient validation (#577) * (fix) text input bottom border * Fix #482 input * Merge branch 'development' of https://github.com/gnosis/safe-react into fix/#482-address-book # Conflicts: # src/components/forms/TextField/index.jsx # src/routes/safe/components/Balances/SendModal/screens/AddressBookInput/index.jsx # src/routes/safe/components/Balances/SendModal/screens/SendFunds/TokenSelectField/index.jsx # src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx # yarn.lock * Fix custom tx addresses filtering * Merge branch 'development' of https://github.com/gnosis/safe-react into fix/#482-address-book # Conflicts: # yarn.lock * Remove console logs Fixed prettier issues * Remove unnecessary template string * Fix `tokenAddress` string conversion * Use `secondaryBackground` value Co-authored-by: Gabriel Rodríguez Alsina Co-authored-by: Fernando * (feature) Adding origin for Apps Transactions (#576) * Adding origin field when creates a TX * refactor: replace list of arg by object in getApprovalTransaction and getExecutionTransaction function * minor changes * Allow execute if threshold is 1 for the first tx - Related to issue #563 - `lastTx` is required due to #489 * - Normalizing logic between createTransaction and processTransaction - Moving shared function to a new file * Refactor `doesTxNeedApproval` back to the `isExecution`-related meaning * Rename function and variable names * Add tests for `getNewTxNonce` and `shouldExecuteTransaction` functions * Pass `safeInstance` instead of `safeAddress` to `getNewTxNonce` * Update Tests - remove mocked `getGnosisSafeInstanceAt` - pass `safeInstance` instead of `safeAddress` to `getNewTxNonce` Co-authored-by: Fernando * (Feature) Add checks into CI (#594) * Repare new dev and staging enviroments to deploy (#618) * Repare new dev and staging enviroments to deploy - Add to `deploy_pull_requests.sh` to the new path. - Replace upload-dir to deploy staging to the new path. * add /app/ public path for the webapp, remove duplicate yarn build from travis * add basename to app * deploy pr to /app * update travis * linter error fixes * fix travis build script Co-authored-by: David Albela Pérez <3659067+davidalbela@users.noreply.github.com> * (fix) sidebar contents' scrolling (#622) * (add) linter sorting rules (#614) * (add) linter sorting rules * (fix) linting errors according to the new rules Co-authored-by: Fernando Co-authored-by: Mikhail Mikheev Co-authored-by: Agustin Pane Co-authored-by: Gabriel Rodríguez Alsina Co-authored-by: nicolas Co-authored-by: David Albela Pérez <3659067+davidalbela@users.noreply.github.com> * (feature): [Safe Apps] App Transaction List Details (#601) * Adding IconText component * Get origin for TXs in Redux * Adding Icon and name app to transaction list * Fix customTx condition * Fix HTML element for text * simplify condition * Bug: Accounts/Network are not updated in production build (#625) * Adding Apps info to toast notification (#621) * Adding APP_Name for APPs TXs in toast messages * refactor: save appId instead of appName in origin field * adding fallback icon and message to TX apps table * review changes * review fixes * force build * update Apps list info (#629) * update Apps list info * fix * Feature: replace web3connect with onboardjs (#456) * init onboard.js * dep bump * initial replacement of web3connect with onboard.js * use averta font in the modal * update onboard.js, add handlers for session murder * update preferred wallets * implement reconnecting to injected provider * fix duplicate wallet disconnected notification * update onboard dep * onboardjs fixes * test onboard js with hw * add https to rpcUrl * Added saved wallet and transactions validation * made Transactions validation * bnc-onboard version updated * Fix lock/unlock problem * bump onboardjs version * fixed material-ui lab version * Update onboard version * Added hw wallets integration * Updated preferred wallets * Add ledger modal * Merge with dev * Update onboard * BUmp new version of onboardjs * Added some logs * Added some logs * Update onboardjs version fix ledger connection * Update onboardjs version fix ledger connection * Bump new onboardjs version * Update new version * Made improvements * yarn.lock regenration * remove https=true * Remove comments and added some improvements * Updated package.json dep * Removed unused deps * Remove web3connect dep Co-authored-by: lukasschor Co-authored-by: Mati Dastugue * Passing ethBalance to Apps component (#636) * (Fix) Update safe modal verbiage (#633) * Fixs verbiage in update safe modal * Fixs yarn lock * Bump dependencies (#639) * Use hash history (#638) * v1.7.3 (#611) * Fix #597: USD value not load (#609) * Converts all the addresses to checksum values * Fix for empty address * fix the order of transactions, change updateSafe to upgradeSafe to avoid naming confusion with the updateSafe action (#610) * Fix #596: Notification when safe is already updated (#599) * Fix notification of update if the safe is already updated * Makes the notification clickable Displays the notification for owners only * Identify upgrade tx * Add red badge to Settings tab * Fixs Padding Removes the red dot if the user is not an owner Co-authored-by: Fernando Co-authored-by: Fernando Co-authored-by: Agustin Pane * Update package.json (#612) * Add public url to prod webpack config (#615) * add public url to prod webpack config * modify travis/webpack config to add public url * add slash * cherry pick new travis yml merge commit (#620) * use hash history Co-authored-by: Fernando Co-authored-by: Agustin Pane * - Updates how the transactions are ordered, now orders by nonce and then by date (#640) * (Fix) Lowercased safes address in URL (#631) * Return checksummed addrress from `safeParamAddressFromState` selector * Update `yarn.lock` * Remove redundant `toChecksumAddress` call Co-authored-by: Mikhail Mikheev * Rebase master into development (#647) * v1.7.3 (#611) * Fix #597: USD value not load (#609) * Converts all the addresses to checksum values * Fix for empty address * fix the order of transactions, change updateSafe to upgradeSafe to avoid naming confusion with the updateSafe action (#610) * Fix #596: Notification when safe is already updated (#599) * Fix notification of update if the safe is already updated * Makes the notification clickable Displays the notification for owners only * Identify upgrade tx * Add red badge to Settings tab * Fixs Padding Removes the red dot if the user is not an owner Co-authored-by: Fernando Co-authored-by: Fernando Co-authored-by: Agustin Pane * Update package.json (#612) * Add public url to prod webpack config (#615) * add public url to prod webpack config * modify travis/webpack config to add public url * add slash * cherry pick new travis yml merge commit (#620) * V1.7.5 release (#641) * use hash history * update package json * BUG: App index.html cached on production (#642) * remove caching for webapp index.html * keep --delete flag * Fix #596: Notification when safe is already updated (#599) * Fix notification of update if the safe is already updated * Makes the notification clickable Displays the notification for owners only * Identify upgrade tx * Add red badge to Settings tab * Fixs Padding Removes the red dot if the user is not an owner Co-authored-by: Fernando * Bug: #482 - Address book Custom transactions Recipient validation (#577) * (fix) text input bottom border * Fix #482 input * Merge branch 'development' of https://github.com/gnosis/safe-react into fix/#482-address-book # Conflicts: # src/components/forms/TextField/index.jsx # src/routes/safe/components/Balances/SendModal/screens/AddressBookInput/index.jsx # src/routes/safe/components/Balances/SendModal/screens/SendFunds/TokenSelectField/index.jsx # src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx # yarn.lock * Fix custom tx addresses filtering * Merge branch 'development' of https://github.com/gnosis/safe-react into fix/#482-address-book # Conflicts: # yarn.lock * Remove console logs Fixed prettier issues * Remove unnecessary template string * Fix `tokenAddress` string conversion * Use `secondaryBackground` value Co-authored-by: Gabriel Rodríguez Alsina Co-authored-by: Fernando * (feature) Adding origin for Apps Transactions (#576) * Adding origin field when creates a TX * refactor: replace list of arg by object in getApprovalTransaction and getExecutionTransaction function * minor changes * Allow execute if threshold is 1 for the first tx - Related to issue #563 - `lastTx` is required due to #489 * - Normalizing logic between createTransaction and processTransaction - Moving shared function to a new file * Refactor `doesTxNeedApproval` back to the `isExecution`-related meaning * Rename function and variable names * Add tests for `getNewTxNonce` and `shouldExecuteTransaction` functions * Pass `safeInstance` instead of `safeAddress` to `getNewTxNonce` * Update Tests - remove mocked `getGnosisSafeInstanceAt` - pass `safeInstance` instead of `safeAddress` to `getNewTxNonce` Co-authored-by: Fernando * (Feature) Add checks into CI (#594) * Repare new dev and staging enviroments to deploy (#618) * Repare new dev and staging enviroments to deploy - Add to `deploy_pull_requests.sh` to the new path. - Replace upload-dir to deploy staging to the new path. * add /app/ public path for the webapp, remove duplicate yarn build from travis * add basename to app * deploy pr to /app * update travis * linter error fixes * fix travis build script Co-authored-by: David Albela Pérez <3659067+davidalbela@users.noreply.github.com> * (fix) sidebar contents' scrolling (#622) * (add) linter sorting rules (#614) * (add) linter sorting rules * (fix) linting errors according to the new rules Co-authored-by: Fernando * (feature): [Safe Apps] App Transaction List Details (#601) * Adding IconText component * Get origin for TXs in Redux * Adding Icon and name app to transaction list * Fix customTx condition * Fix HTML element for text * simplify condition * Bug: Accounts/Network are not updated in production build (#625) * Adding Apps info to toast notification (#621) * Adding APP_Name for APPs TXs in toast messages * refactor: save appId instead of appName in origin field * adding fallback icon and message to TX apps table * review changes * review fixes * force build * update Apps list info (#629) * update Apps list info * fix * Feature: replace web3connect with onboardjs (#456) * init onboard.js * dep bump * initial replacement of web3connect with onboard.js * use averta font in the modal * update onboard.js, add handlers for session murder * update preferred wallets * implement reconnecting to injected provider * fix duplicate wallet disconnected notification * update onboard dep * onboardjs fixes * test onboard js with hw * add https to rpcUrl * Added saved wallet and transactions validation * made Transactions validation * bnc-onboard version updated * Fix lock/unlock problem * bump onboardjs version * fixed material-ui lab version * Update onboard version * Added hw wallets integration * Updated preferred wallets * Add ledger modal * Merge with dev * Update onboard * BUmp new version of onboardjs * Added some logs * Added some logs * Update onboardjs version fix ledger connection * Update onboardjs version fix ledger connection * Bump new onboardjs version * Update new version * Made improvements * yarn.lock regenration * remove https=true * Remove comments and added some improvements * Updated package.json dep * Removed unused deps * Remove web3connect dep Co-authored-by: lukasschor Co-authored-by: Mati Dastugue * Passing ethBalance to Apps component (#636) * (Fix) Update safe modal verbiage (#633) * Fixs verbiage in update safe modal * Fixs yarn lock * Bump dependencies (#639) * Use hash history (#638) * v1.7.3 (#611) * Fix #597: USD value not load (#609) * Converts all the addresses to checksum values * Fix for empty address * fix the order of transactions, change updateSafe to upgradeSafe to avoid naming confusion with the updateSafe action (#610) * Fix #596: Notification when safe is already updated (#599) * Fix notification of update if the safe is already updated * Makes the notification clickable Displays the notification for owners only * Identify upgrade tx * Add red badge to Settings tab * Fixs Padding Removes the red dot if the user is not an owner Co-authored-by: Fernando Co-authored-by: Fernando Co-authored-by: Agustin Pane * Update package.json (#612) * Add public url to prod webpack config (#615) * add public url to prod webpack config * modify travis/webpack config to add public url * add slash * cherry pick new travis yml merge commit (#620) * use hash history Co-authored-by: Fernando Co-authored-by: Agustin Pane * - Updates how the transactions are ordered, now orders by nonce and then by date (#640) * (Fix) Lowercased safes address in URL (#631) * Return checksummed addrress from `safeParamAddressFromState` selector * Update `yarn.lock` * Remove redundant `toChecksumAddress` call Co-authored-by: Mikhail Mikheev Co-authored-by: Mikhail Mikheev Co-authored-by: Agustin Pane Co-authored-by: Gabriel Rodríguez Alsina Co-authored-by: nicolas Co-authored-by: David Albela Pérez <3659067+davidalbela@users.noreply.github.com> Co-authored-by: lukasschor Co-authored-by: Mati Dastugue Co-authored-by: francovenica * Update safe relay and transaction endpoints * Master into development (#655) * Fix NODE_ENV development definition - Define develop build for development branches. - Use POSIX standard to call shell scripts in travis file. * Mark travis shell scripts as executable * Fix conditional statement at travis build.sh file * Set development endpoints to stable staging backends * Sync master dev (#656) * v1.7.3 (#611) * Fix #597: USD value not load (#609) * Converts all the addresses to checksum values * Fix for empty address * fix the order of transactions, change updateSafe to upgradeSafe to avoid naming confusion with the updateSafe action (#610) * Fix #596: Notification when safe is already updated (#599) * Fix notification of update if the safe is already updated * Makes the notification clickable Displays the notification for owners only * Identify upgrade tx * Add red badge to Settings tab * Fixs Padding Removes the red dot if the user is not an owner Co-authored-by: Fernando Co-authored-by: Fernando Co-authored-by: Agustin Pane * Update package.json (#612) * Add public url to prod webpack config (#615) * add public url to prod webpack config * modify travis/webpack config to add public url * add slash * cherry pick new travis yml merge commit (#620) * V1.7.5 release (#641) * use hash history * update package json * BUG: App index.html cached on production (#642) * remove caching for webapp index.html * keep --delete flag Co-authored-by: Mikhail Mikheev Co-authored-by: Fernando Co-authored-by: Agustin Pane Co-authored-by: Agustin Pane Co-authored-by: Mikhail Mikheev Co-authored-by: Gabriel Rodríguez Alsina Co-authored-by: nicolas Co-authored-by: David Albela Pérez <3659067+davidalbela@users.noreply.github.com> Co-authored-by: lukasschor Co-authored-by: Mati Dastugue Co-authored-by: francovenica Co-authored-by: Richard Meissner --- .eslintrc | 22 +- .travis.yml | 4 +- config/travis/build.sh | 0 .../travis/prepare_production_deployment.sh | 0 package.json | 118 +- .../dataDisplay/DividerLine/index.js | 7 +- .../dataDisplay/IconText/index.js | 25 + src/components-v2/dataDisplay/index.js | 1 + src/components-v2/feedback/Loader/index.jsx | 2 +- .../layouts/ListContentLayout/List.jsx | 10 +- .../layouts/ListContentLayout/style.js | 14 +- .../safeUtils/AddressInfo/index.js | 14 +- src/components-v2/surfaces/Collapse/index.js | 8 +- .../utils/modals/GenericModal/index.js | 12 +- src/components-v2/utils/modals/utils.js | 12 +- src/components/ConnectButton/index.jsx | 136 +- src/components/CookiesBanner/index.jsx | 29 +- src/components/CopyBtn/index.jsx | 20 +- src/components/EtherscanBtn/index.jsx | 12 +- src/components/EtherscanLink/index.jsx | 16 +- src/components/Footer/index.jsx | 23 +- .../Header/components/CircleDot.jsx | 21 +- src/components/Header/components/Layout.jsx | 34 +- .../Header/components/NetworkLabel.jsx | 13 +- src/components/Header/components/Provider.jsx | 17 +- .../ProviderDetails/ConnectDetails.jsx | 17 +- .../ProviderDetails/UserDetails.jsx | 55 +- .../ProviderInfo/ProviderAccessible.jsx | 25 +- .../ProviderInfo/ProviderDisconnected.jsx | 19 +- .../components/SafeListHeader/index.jsx | 27 +- src/components/Header/index.jsx | 41 +- src/components/Header/selector.js | 7 +- src/components/Identicon/index.jsx | 5 +- src/components/List/ListItemText/index.jsx | 5 +- src/components/Loader/index.jsx | 5 +- src/components/Modal/index.jsx | 19 +- src/components/NoSafe/index.jsx | 9 +- src/components/Notifier/index.js | 10 +- src/components/Notifier/selector.js | 1 + src/components/Root/OnboardCustom.scss | 6 + src/components/Root/index.js | 11 +- src/components/Root/index.scss | 2 +- src/components/ScanQRModal/index.jsx | 52 +- src/components/ScanQRModal/style.js | 2 +- .../Sidebar/SafeList/DefaultBadge.jsx | 17 +- src/components/Sidebar/SafeList/index.jsx | 54 +- src/components/Sidebar/index.jsx | 52 +- src/components/Sidebar/selectors.js | 3 +- src/components/Sidebar/style.js | 3 +- src/components/Stepper/Controls/index.jsx | 19 +- src/components/Stepper/OpenPaper/index.jsx | 7 +- src/components/Stepper/index.jsx | 34 +- src/components/Table/TableHead.jsx | 7 +- src/components/Table/index.jsx | 49 +- src/components/forms/AddressInput/index.jsx | 19 +- src/components/forms/Checkbox/index.jsx | 4 +- src/components/forms/GnoForm/index.jsx | 10 +- src/components/forms/SelectField/index.jsx | 18 +- src/components/forms/TextField/index.jsx | 53 +- src/components/forms/TextareaField/index.jsx | 7 +- src/components/forms/validator.js | 3 +- src/components/layout/Backdrop/index.jsx | 6 +- src/components/layout/Block/index.jsx | 8 +- src/components/layout/Button/index.jsx | 4 +- src/components/layout/ButtonLink/index.jsx | 15 +- src/components/layout/Col/index.jsx | 42 +- src/components/layout/Divider/index.js | 1 + src/components/layout/Hairline/index.js | 5 +- src/components/layout/Heading/index.jsx | 8 +- src/components/layout/Img/index.jsx | 7 +- src/components/layout/Link/index.jsx | 8 +- src/components/layout/Page/index.jsx | 3 +- src/components/layout/PageFrame/index.jsx | 38 +- src/components/layout/Paragraph/index.jsx | 5 +- src/components/layout/Pre/index.jsx | 1 + src/components/layout/Row/index.jsx | 6 +- src/components/layout/Table/index.jsx | 4 +- src/config/development-mainnet.js | 2 +- src/config/index.js | 5 +- src/config/production.js | 2 +- src/config/staging-mainnet.js | 2 +- src/index.js | 5 +- .../store/actions/addAddressBook.js | 1 + .../store/actions/addAddressBookEntry.js | 1 + .../store/actions/loadAddressBook.js | 1 + .../actions/loadAddressBookFromStorage.js | 9 +- .../store/actions/saveAndUpdateAddressBook.js | 7 +- .../store/actions/updateAddressBookEntry.js | 1 + .../store/middleware/addressBookMiddleware.js | 11 +- .../addressBook/store/reducer/addressBook.js | 11 +- .../addressBook/store/selectors/index.js | 7 +- src/logic/addressBook/utils/index.js | 3 +- src/logic/contracts/historicProxyCode.js | 2 +- src/logic/cookies/store/reducer/cookies.js | 3 +- src/logic/cookies/store/selectors/index.js | 2 +- src/logic/cookies/utils/index.js | 1 + .../api/fetchCurrenciesRates.js | 1 + .../api/fetchTokenCurrenciesBalances.js | 1 + .../actions/fetchCurrencySelectedValue.js | 9 +- .../store/actions/fetchCurrencyValues.js | 13 +- .../store/actions/saveCurrencySelected.js | 4 +- .../store/actions/setCurrencyBalances.js | 1 + .../store/actions/setCurrencySelected.js | 1 + .../store/reducer/currencyValues.js | 6 +- .../currencyValues/store/selectors/index.js | 3 +- .../store/actions/addViewedSafe.js | 3 +- .../actions/loadCurrentSessionFromStorage.js | 5 +- .../store/reducer/currentSession.js | 3 +- .../notifications/notificationBuilder.js | 88 +- src/logic/notifications/notificationTypes.js | 1 + .../store/actions/enqueueSnackbar.js | 5 +- .../store/reducer/notifications.js | 10 +- .../notifications/store/selectors/index.js | 7 +- src/logic/safe/api/estimateTxGas.js | 1 + src/logic/safe/safeTxSigner.js | 1 + .../safe/transactions/awaitingTransactions.js | 3 +- src/logic/safe/transactions/gas.js | 5 +- src/logic/safe/transactions/gasNew.js | 12 +- .../safe/transactions/incomingTxHistory.js | 2 +- .../safe/transactions/safeTxSignerEIP712.js | 2 +- src/logic/safe/transactions/send.js | 52 +- src/logic/safe/transactions/txHistory.js | 27 +- src/logic/safe/utils/safeVersion.js | 5 +- src/logic/safe/utils/upgradeSafe.js | 4 +- src/logic/tokens/api/fetchToken.js | 1 + src/logic/tokens/api/fetchTokenBalanceList.js | 1 + src/logic/tokens/api/fetchTokenList.js | 1 + .../store/actions/activateTokensByBalance.js | 11 +- src/logic/tokens/store/actions/addToken.js | 1 + src/logic/tokens/store/actions/fetchTokens.js | 14 +- .../tokens/store/actions/loadActiveTokens.js | 10 +- src/logic/tokens/store/actions/removeToken.js | 3 +- src/logic/tokens/store/actions/saveTokens.js | 1 + src/logic/tokens/store/reducer/tokens.js | 5 +- src/logic/tokens/store/selectors/index.js | 7 +- src/logic/tokens/utils/tokenHelpers.js | 5 +- src/logic/tokens/utils/tokensStorage.js | 1 + src/logic/wallets/ethAddresses.js | 3 +- src/logic/wallets/ethTransactions.js | 3 +- src/logic/wallets/getWeb3.js | 67 +- .../wallets/store/actions/addProvider.js | 1 + .../wallets/store/actions/fetchProvider.js | 24 +- .../wallets/store/actions/removeProvider.js | 20 +- .../store/middlewares/providerWatcher.js | 19 +- src/logic/wallets/store/reducer/provider.js | 5 +- src/logic/wallets/store/selectors/index.js | 3 +- src/logic/wallets/tokens.js | 1 + src/logic/wallets/transactionDataCheck.js | 27 + src/routes/index.js | 28 +- .../load/components/DetailsForm/index.jsx | 37 +- src/routes/load/components/Layout.jsx | 21 +- .../load/components/OwnerList/index.jsx | 35 +- .../components/ReviewInformation/index.jsx | 62 +- src/routes/load/container/Load.jsx | 27 +- src/routes/load/container/selector.js | 5 +- src/routes/open/components/Layout.jsx | 27 +- .../components/ReviewInformation/index.jsx | 56 +- .../open/components/SafeNameForm/index.jsx | 27 +- .../SafeOwnersConfirmationsForm/index.jsx | 98 +- .../SafeOwnersConfirmationsForm/style.js | 2 +- src/routes/open/container/Open.jsx | 29 +- src/routes/open/container/selector.js | 3 +- src/routes/open/utils/safeDataExtractor.js | 3 +- src/routes/opening/component/index.jsx | 26 +- src/routes/opening/container/index.jsx | 4 +- src/routes/opening/container/selector.js | 1 + .../CreateEditEntryModal/index.jsx | 72 +- .../AddressBook/DeleteEntryModal/index.jsx | 34 +- .../AddressBook/DeleteEntryModal/style.js | 2 +- .../EllipsisTransactionDetails/index.jsx | 25 +- .../safe/components/AddressBook/columns.js | 1 + .../safe/components/AddressBook/index.jsx | 108 +- .../safe/components/AddressBook/style.js | 2 +- src/routes/safe/components/Apps/appsList.js | 64 +- .../components/Apps/confirmTransactions.js | 16 +- src/routes/safe/components/Apps/index.jsx | 55 +- .../safe/components/Apps/sendTransactions.js | 15 +- .../Balances/AssetTableCell/index.jsx | 5 +- .../components/Balances/Receive/index.jsx | 39 +- .../Balances/SendModal/SafeInfo/index.jsx | 25 +- .../components/Balances/SendModal/index.jsx | 57 +- .../screens/AddressBookInput/index.jsx | 134 +- .../SendModal/screens/ChooseTxType/index.jsx | 34 +- .../screens/ReviewCustomTx/index.jsx | 95 +- .../SendModal/screens/ReviewCustomTx/style.js | 2 +- .../SendModal/screens/ReviewTx/index.jsx | 99 +- .../SendModal/screens/ReviewTx/style.js | 2 +- .../SendModal/screens/SendCustomTx/index.jsx | 122 +- .../SendFunds/TokenSelectField/index.jsx | 45 +- .../SendModal/screens/SendFunds/index.jsx | 144 +- .../components/Balances/Tokens/actions.js | 4 +- .../safe/components/Balances/Tokens/index.jsx | 58 +- .../Tokens/screens/AddCustomToken/index.jsx | 102 +- .../screens/AddCustomToken/validators.js | 7 +- .../Tokens/screens/TokenList/TokenRow.jsx | 26 +- .../Tokens/screens/TokenList/index.jsx | 50 +- .../Tokens/screens/TokenList/style.js | 2 +- .../safe/components/Balances/dataFetcher.js | 9 +- src/routes/safe/components/Balances/index.jsx | 88 +- src/routes/safe/components/Balances/style.js | 2 +- .../components/DropdownCurrency/index.jsx | 30 +- src/routes/safe/components/Layout.jsx | 193 +- src/routes/safe/components/NoRights/index.jsx | 11 +- .../ManageOwners/AddOwnerModal/index.jsx | 44 +- .../AddOwnerModal/screens/OwnerForm/index.jsx | 60 +- .../AddOwnerModal/screens/OwnerForm/style.js | 2 +- .../AddOwnerModal/screens/Review/index.jsx | 88 +- .../AddOwnerModal/screens/Review/style.js | 2 +- .../screens/ThresholdForm/index.jsx | 56 +- .../screens/ThresholdForm/style.js | 2 +- .../ManageOwners/EditOwnerModal/index.jsx | 70 +- .../ManageOwners/EditOwnerModal/style.js | 2 +- .../OwnerAddressTableCell/index.jsx | 9 +- .../ManageOwners/RemoveOwnerModal/index.jsx | 50 +- .../screens/CheckOwner/index.jsx | 50 +- .../screens/CheckOwner/style.js | 2 +- .../RemoveOwnerModal/screens/Review/index.jsx | 93 +- .../RemoveOwnerModal/screens/Review/style.js | 2 +- .../screens/ThresholdForm/index.jsx | 56 +- .../screens/ThresholdForm/style.js | 2 +- .../ManageOwners/ReplaceOwnerModal/index.jsx | 46 +- .../screens/OwnerForm/index.jsx | 78 +- .../screens/OwnerForm/style.js | 2 +- .../screens/Review/index.jsx | 105 +- .../ReplaceOwnerModal/screens/Review/style.js | 2 +- .../Settings/ManageOwners/dataFetcher.js | 5 +- .../Settings/ManageOwners/index.jsx | 157 +- .../Settings/RemoveSafeModal/index.jsx | 56 +- .../Settings/RemoveSafeModal/style.js | 2 +- .../components/Settings/SafeDetails/index.jsx | 52 +- .../components/Settings/SafeDetails/style.js | 2 +- .../ChangeThreshold/index.jsx | 49 +- .../ChangeThreshold/style.js | 2 +- .../Settings/ThresholdSettings/index.jsx | 46 +- .../Settings/ThresholdSettings/style.js | 2 +- .../Settings/UpdateSafeModal/index.jsx | 24 +- .../Settings/UpdateSafeModal/style.js | 2 +- .../safe/components/Settings/actions.js | 2 +- .../Settings/assets/icons/OwnersIcon.jsx | 2 +- .../icons/RequiredConfirmationsIcon.jsx | 2 +- .../Settings/assets/icons/SafeDetailsIcon.jsx | 8 +- src/routes/safe/components/Settings/index.jsx | 78 +- src/routes/safe/components/Settings/style.js | 14 +- .../ExpandedTx/ApproveTxModal/index.jsx | 62 +- .../ExpandedTx/ApproveTxModal/style.js | 2 +- .../IncomingTxDescription/index.jsx | 21 +- .../OwnersColumn/OwnerComponent.jsx | 34 +- .../ExpandedTx/OwnersColumn/OwnersList.jsx | 26 +- .../ExpandedTx/OwnersColumn/index.jsx | 43 +- .../TxsTable/ExpandedTx/OwnersColumn/style.js | 2 +- .../ExpandedTx/RejectTxModal/index.jsx | 65 +- .../ExpandedTx/RejectTxModal/style.js | 2 +- .../ExpandedTx/TxDescription/index.jsx | 70 +- .../ExpandedTx/TxDescription/utils.js | 5 +- .../TxsTable/ExpandedTx/index.jsx | 95 +- .../Transactions/TxsTable/ExpandedTx/style.js | 2 +- .../Transactions/TxsTable/Status/index.jsx | 20 +- .../Transactions/TxsTable/Status/style.js | 2 +- .../TxsTable/TxType/assets/appsIcon.svg | 13 + .../Transactions/TxsTable/TxType/index.jsx | 38 +- .../Transactions/TxsTable/TxType/style.js | 12 - .../Transactions/TxsTable/columns.js | 18 +- .../Transactions/TxsTable/index.jsx | 120 +- .../safe/components/Transactions/index.jsx | 19 +- .../components/assets/AddressBookIcon.jsx | 4 +- .../safe/components/assets/AppsIcon.jsx | 4 +- .../safe/components/assets/BalancesIcon.jsx | 4 +- .../safe/components/assets/SettingsIcon.jsx | 2 +- .../components/assets/TransactionsIcon.jsx | 2 +- src/routes/safe/components/style.js | 2 +- src/routes/safe/container/actions.js | 20 +- src/routes/safe/container/index.jsx | 98 +- src/routes/safe/container/selector.js | 38 +- .../store/actions/__tests__/utils.test.js | 117 + src/routes/safe/store/actions/addSafe.js | 11 +- .../safe/store/actions/createTransaction.js | 134 +- .../safe/store/actions/fetchEtherBalance.js | 5 +- src/routes/safe/store/actions/fetchSafe.js | 21 +- .../safe/store/actions/fetchTokenBalances.js | 12 +- .../safe/store/actions/fetchTransactions.js | 40 +- .../safe/store/actions/loadDefaultSafe.js | 6 +- .../store/actions/loadSafesFromStorage.js | 8 +- .../safe/store/actions/processTransaction.js | 109 +- .../safe/store/actions/updateActiveTokens.js | 4 +- .../store/actions/updateBlacklistedTokens.js | 4 +- .../safe/store/actions/updateSafeName.js | 4 +- src/routes/safe/store/actions/utils.js | 43 + .../middleware/notificationsMiddleware.js | 27 +- .../safe/store/middleware/safeStorage.js | 25 +- src/routes/safe/store/models/confirmation.js | 3 +- src/routes/safe/store/models/safe.js | 5 +- src/routes/safe/store/models/transaction.js | 15 +- .../store/reducer/cancellationTransactions.js | 3 +- .../store/reducer/incomingTransactions.js | 3 +- src/routes/safe/store/reducer/safe.js | 25 +- src/routes/safe/store/reducer/transactions.js | 3 +- src/routes/safe/store/selectors/index.js | 58 +- src/routes/welcome/components/Layout.jsx | 66 +- src/routes/welcome/container/index.jsx | 5 +- src/routes/welcome/container/selector.js | 1 + src/store/index.js | 56 +- src/theme/mui.js | 110 +- src/theme/size.js | 2 +- src/utils/googleAnalytics.js | 3 +- src/utils/storage/index.js | 1 + src/utils/storage/signatures.js | 1 + src/utils/storage/transactions.js | 1 + yarn.lock | 3671 +++++++++-------- 308 files changed, 5913 insertions(+), 5125 deletions(-) mode change 100644 => 100755 config/travis/build.sh mode change 100644 => 100755 config/travis/prepare_production_deployment.sh create mode 100644 src/components-v2/dataDisplay/IconText/index.js create mode 100644 src/components/Root/OnboardCustom.scss create mode 100644 src/logic/wallets/transactionDataCheck.js create mode 100644 src/routes/safe/components/Transactions/TxsTable/TxType/assets/appsIcon.svg delete mode 100644 src/routes/safe/components/Transactions/TxsTable/TxType/style.js create mode 100644 src/routes/safe/store/actions/__tests__/utils.test.js create mode 100644 src/routes/safe/store/actions/utils.js diff --git a/.eslintrc b/.eslintrc index 3a5f43cb..28b650c1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,7 +8,7 @@ "import/extensions": [".js", ".jsx"] }, "parser": "babel-eslint", - "plugins": ["react", "flowtype", "import", "jsx-a11y", "prettier"], + "plugins": ["react", "flowtype", "import", "jsx-a11y", "sort-destructure-keys", "prettier"], "extends": [ "eslint:recommended", "plugin:react/recommended", @@ -52,6 +52,12 @@ } ], "semi": ["error", "never"], + "sort-imports": [ + "error", + { + "ignoreDeclarationSort": true + } + ], "flowtype/require-valid-file-annotation": [ 2, "always", @@ -62,6 +68,16 @@ "import/extensions": 0, "import/no-extraneous-dependencies": 0, "import/no-unresolved": 0, + "import/order": [ + "error", + { + "groups": ["builtin", "external", "parent", "sibling", "index"], + "newlines-between": "always", + "alphabetize": { + "order": "asc" + } + } + ], "import/prefer-default-export": 0, "jsx-a11y/anchor-is-valid": [ "error", @@ -88,7 +104,9 @@ } ], "react/jsx-props-no-spreading": 0, + "react/jsx-sort-props": 2, "prettier/prettier": "error", - "jsx-a11y/no-autofocus": "warn" + "jsx-a11y/no-autofocus": "warn", + "sort-destructure-keys/sort-destructure-keys": 2 } } diff --git a/.travis.yml b/.travis.yml index 8e30656a..af578168 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,6 +69,6 @@ deploy: on: tags: true - provider: script - script: bash config/travis/prepare_production_deployment.sh + script: ./config/travis/prepare_production_deployment.sh on: - tags: true \ No newline at end of file + tags: true diff --git a/config/travis/build.sh b/config/travis/build.sh old mode 100644 new mode 100755 diff --git a/config/travis/prepare_production_deployment.sh b/config/travis/prepare_production_deployment.sh old mode 100644 new mode 100755 diff --git a/package.json b/package.json index 75c85dc0..4c0ec45a 100644 --- a/package.json +++ b/package.json @@ -43,24 +43,20 @@ "dependencies": { "@gnosis.pm/safe-contracts": "1.1.1-dev.1", "@gnosis.pm/util-contracts": "2.0.6", - "@material-ui/core": "4.8.0", - "@material-ui/icons": "4.5.1", + "@material-ui/core": "4.9.5", + "@material-ui/icons": "4.9.1", "@material-ui/lab": "4.0.0-alpha.39", - "@portis/web3": "^2.0.0-beta.45", - "@testing-library/jest-dom": "4.2.4", - "@toruslabs/torus-embed": "0.2.10", - "@walletconnect/web3-provider": "^1.0.0-beta.37", - "@welldone-software/why-did-you-render": "3.4.1", - "authereum": "^0.0.4-beta.83", - "axios": "0.19.0", + "@testing-library/jest-dom": "5.1.1", + "@welldone-software/why-did-you-render": "4.0.5", + "axios": "0.19.2", "bignumber.js": "9.0.0", - "connected-react-router": "6.6.1", + "bnc-onboard": "1.3.3", + "connected-react-router": "6.7.0", "currency-flags": "^2.1.1", - "date-fns": "2.8.1", + "date-fns": "2.10.0", "dotenv": "^8.2.0", "ethereum-ens": "0.8.0", - "final-form": "4.18.6", - "fortmatic": "^1.0.1", + "final-form": "4.18.7", "history": "4.10.1", "immortal-db": "^1.0.2", "immutable": "^4.0.0-rc.9", @@ -71,65 +67,64 @@ "optimize-css-assets-webpack-plugin": "5.0.3", "polished": "^3.4.2", "qrcode.react": "1.0.0", - "query-string": "6.9.0", - "react": "16.12.0", + "query-string": "6.11.1", + "react": "16.13.0", "react-dev-utils": "^10.0.0", - "react-dom": "16.12.0", - "react-final-form": "6.3.3", + "react-dom": "16.13.0", + "react-final-form": "6.3.5", "react-final-form-listeners": "^1.0.2", "react-ga": "^2.7.0", - "react-hot-loader": "4.12.18", + "react-hot-loader": "4.12.19", "react-qr-reader": "^2.2.1", - "react-redux": "7.1.3", + "react-redux": "7.2.0", "react-router-dom": "5.1.2", "react-window": "^1.8.5", "recompose": "^0.30.0", - "redux": "4.0.4", + "redux": "4.0.5", "redux-actions": "^2.6.5", "redux-thunk": "^2.3.0", "reselect": "^4.0.0", "semver": "^7.1.1", "styled-components": "^5.0.1", - "web3": "1.2.4", - "web3connect": "1.0.0-beta.25" + "web3": "1.2.6" }, "devDependencies": { - "@babel/cli": "7.7.5", - "@babel/core": "7.7.5", - "@babel/plugin-proposal-class-properties": "7.7.4", - "@babel/plugin-proposal-decorators": "7.7.4", - "@babel/plugin-proposal-do-expressions": "7.7.4", - "@babel/plugin-proposal-export-default-from": "7.7.4", - "@babel/plugin-proposal-export-namespace-from": "7.7.4", - "@babel/plugin-proposal-function-bind": "7.7.4", - "@babel/plugin-proposal-function-sent": "7.7.4", - "@babel/plugin-proposal-json-strings": "7.7.4", - "@babel/plugin-proposal-logical-assignment-operators": "7.7.4", - "@babel/plugin-proposal-nullish-coalescing-operator": "7.7.4", - "@babel/plugin-proposal-numeric-separator": "7.7.4", - "@babel/plugin-proposal-optional-chaining": "7.7.5", - "@babel/plugin-proposal-pipeline-operator": "7.7.4", - "@babel/plugin-proposal-throw-expressions": "7.7.4", - "@babel/plugin-syntax-dynamic-import": "7.7.4", - "@babel/plugin-syntax-import-meta": "7.7.4", - "@babel/plugin-transform-member-expression-literals": "7.7.4", - "@babel/plugin-transform-property-literals": "7.7.4", - "@babel/polyfill": "7.7.0", - "@babel/preset-env": "7.7.6", - "@babel/preset-flow": "7.7.4", - "@babel/preset-react": "7.7.4", - "@testing-library/react": "9.4.0", - "autoprefixer": "9.7.3", + "@babel/cli": "7.8.4", + "@babel/core": "7.8.7", + "@babel/plugin-proposal-class-properties": "7.8.3", + "@babel/plugin-proposal-decorators": "7.8.3", + "@babel/plugin-proposal-do-expressions": "7.8.3", + "@babel/plugin-proposal-export-default-from": "7.8.3", + "@babel/plugin-proposal-export-namespace-from": "7.8.3", + "@babel/plugin-proposal-function-bind": "7.8.3", + "@babel/plugin-proposal-function-sent": "7.8.3", + "@babel/plugin-proposal-json-strings": "7.8.3", + "@babel/plugin-proposal-logical-assignment-operators": "7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "7.8.3", + "@babel/plugin-proposal-numeric-separator": "7.8.3", + "@babel/plugin-proposal-optional-chaining": "7.8.3", + "@babel/plugin-proposal-pipeline-operator": "7.8.3", + "@babel/plugin-proposal-throw-expressions": "7.8.3", + "@babel/plugin-syntax-dynamic-import": "7.8.3", + "@babel/plugin-syntax-import-meta": "7.8.3", + "@babel/plugin-transform-member-expression-literals": "7.8.3", + "@babel/plugin-transform-property-literals": "7.8.3", + "@babel/polyfill": "7.8.7", + "@babel/preset-env": "7.8.7", + "@babel/preset-flow": "7.8.3", + "@babel/preset-react": "7.8.3", + "@testing-library/react": "9.5.0", + "autoprefixer": "9.7.4", "babel-core": "^7.0.0-bridge.0", - "babel-eslint": "10.0.3", - "babel-jest": "24.9.0", + "babel-eslint": "10.1.0", + "babel-jest": "25.1.0", "babel-loader": "8.0.6", "babel-plugin-dynamic-import-node": "^2.3.0", "babel-plugin-transform-es3-member-expression-literals": "^6.22.0", "babel-plugin-transform-es3-property-literals": "^6.22.0", "babel-polyfill": "^6.26.0", "classnames": "^2.2.6", - "css-loader": "3.4.0", + "css-loader": "3.4.2", "detect-port": "^1.3.0", "dotenv-expand": "^5.1.0", "eslint": "^6.8.0", @@ -139,33 +134,34 @@ "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.18.3", + "eslint-plugin-sort-destructure-keys": "^1.3.3", "ethereumjs-abi": "0.6.8", "extract-text-webpack-plugin": "^4.0.0-beta.0", - "file-loader": "5.0.2", - "flow-bin": "0.114.0", + "file-loader": "5.1.0", + "flow-bin": "0.120.1", "fs-extra": "8.1.0", "html-loader": "^0.5.5", "html-webpack-plugin": "^3.2.0", "husky": "^4.2.2", - "jest": "24.9.0", + "jest": "25.1.0", "jest-dom": "4.0.0", "json-loader": "^0.5.7", - "mini-css-extract-plugin": "0.8.1", + "mini-css-extract-plugin": "0.9.0", "postcss-loader": "^3.0.0", "postcss-mixins": "6.2.3", "postcss-simple-vars": "^5.0.2", "prettier": "^1.19.1", "run-with-testrpc": "0.3.1", - "style-loader": "1.0.2", - "terser-webpack-plugin": "2.3.1", - "truffle": "5.1.4", + "style-loader": "1.1.3", + "terser-webpack-plugin": "2.3.5", + "truffle": "5.1.16", "truffle-contract": "4.0.31", "truffle-solidity-loader": "0.1.32", "url-loader": "3.0.0", - "webpack": "4.41.3", + "webpack": "4.42.0", "webpack-bundle-analyzer": "3.6.0", - "webpack-cli": "3.3.10", - "webpack-dev-server": "3.9.0", + "webpack-cli": "3.3.11", + "webpack-dev-server": "3.10.3", "webpack-manifest-plugin": "2.2.0" } } diff --git a/src/components-v2/dataDisplay/DividerLine/index.js b/src/components-v2/dataDisplay/DividerLine/index.js index 0b5cb05e..2916502f 100644 --- a/src/components-v2/dataDisplay/DividerLine/index.js +++ b/src/components-v2/dataDisplay/DividerLine/index.js @@ -2,10 +2,11 @@ import React from 'react' import styled from 'styled-components' -import Hairline from '~/components/layout/Hairline' -import { sm, md } from '~/theme/variables' import ArrowDown from './arrow-down.svg' +import Hairline from '~/components/layout/Hairline' +import { md, sm } from '~/theme/variables' + const Wrapper = styled.div` display: flex; align-items: center; @@ -22,7 +23,7 @@ type Props = { const DividerLine = ({ withArrow }: Props) => ( - {withArrow && Arrow Down} + {withArrow && Arrow Down} ) diff --git a/src/components-v2/dataDisplay/IconText/index.js b/src/components-v2/dataDisplay/IconText/index.js new file mode 100644 index 00000000..f2e8ded2 --- /dev/null +++ b/src/components-v2/dataDisplay/IconText/index.js @@ -0,0 +1,25 @@ +// @flow +import React from 'react' +import styled from 'styled-components' + +const Wrapper = styled.div` + display: flex; + align-items: center; +` +const Icon = styled.img` + max-width: 15px; + max-height: 15px; + margin-right: 5px; +` +const Text = styled.span` + height: 17px; +` + +const IconText = ({ iconUrl, text }: { iconUrl: string, text: string }) => ( + + + {text} + +) + +export default IconText diff --git a/src/components-v2/dataDisplay/index.js b/src/components-v2/dataDisplay/index.js index e3c8326a..4ec1ea8c 100644 --- a/src/components-v2/dataDisplay/index.js +++ b/src/components-v2/dataDisplay/index.js @@ -1,3 +1,4 @@ // @flow export { default as DividerLine } from './DividerLine' export { default as TextBox } from './TextBox' +export { default as IconText } from './IconText' diff --git a/src/components-v2/feedback/Loader/index.jsx b/src/components-v2/feedback/Loader/index.jsx index 3d0a7ad3..501fa0c5 100644 --- a/src/components-v2/feedback/Loader/index.jsx +++ b/src/components-v2/feedback/Loader/index.jsx @@ -1,6 +1,6 @@ // @flow -import React from 'react' import CircularProgress from '@material-ui/core/CircularProgress' +import React from 'react' import styled from 'styled-components' const Wrapper = styled.div` diff --git a/src/components-v2/layouts/ListContentLayout/List.jsx b/src/components-v2/layouts/ListContentLayout/List.jsx index 29b87d98..2ae96666 100644 --- a/src/components-v2/layouts/ListContentLayout/List.jsx +++ b/src/components-v2/layouts/ListContentLayout/List.jsx @@ -1,9 +1,9 @@ // @flow +import { withStyles } from '@material-ui/core/styles' +import cn from 'classnames' import React from 'react' import styled from 'styled-components' -import cn from 'classnames' -import { withStyles } from '@material-ui/core/styles' // TODO: move these styles to a generic place import styles from './style' @@ -34,17 +34,17 @@ type Props = { classes: Object, } -const List = ({ items, activeItem, onItemClick, classes }: Props) => { +const List = ({ activeItem, classes, items, onItemClick }: Props) => { return ( {items.map(i => ( onItemClick(i.id)} >
- {i.iconUrl && } + {i.iconUrl && } {i.name}
diff --git a/src/components-v2/layouts/ListContentLayout/style.js b/src/components-v2/layouts/ListContentLayout/style.js index 9a5663d8..d5f9f2ab 100644 --- a/src/components-v2/layouts/ListContentLayout/style.js +++ b/src/components-v2/layouts/ListContentLayout/style.js @@ -1,15 +1,15 @@ // @flow import { - xs, - sm, - md, - border, - secondary, - bolderFont, background, - largeFontSize, + bolderFont, + border, fontColor, + largeFontSize, + md, screenSm, + secondary, + sm, + xs, } from '~/theme/variables' const styles = () => ({ diff --git a/src/components-v2/safeUtils/AddressInfo/index.js b/src/components-v2/safeUtils/AddressInfo/index.js index 22876719..64be3a8b 100644 --- a/src/components-v2/safeUtils/AddressInfo/index.js +++ b/src/components-v2/safeUtils/AddressInfo/index.js @@ -2,13 +2,13 @@ import React from 'react' import styled from 'styled-components' -import Paragraph from '~/components/layout/Paragraph' -import EtherscanBtn from '~/components/EtherscanBtn' import CopyBtn from '~/components/CopyBtn' +import EtherscanBtn from '~/components/EtherscanBtn' import Identicon from '~/components/Identicon' -import Bold from '~/components/layout/Bold' -import { xs, border } from '~/theme/variables' import Block from '~/components/layout/Block' +import Bold from '~/components/layout/Bold' +import Paragraph from '~/components/layout/Paragraph' +import { border, xs } from '~/theme/variables' const Wrapper = styled.div` display: flex; @@ -43,7 +43,7 @@ type Props = { ethBalance: string, } -const AddressInfo = ({ safeName, safeAddress, ethBalance }: Props) => { +const AddressInfo = ({ ethBalance, safeAddress, safeName }: Props) => { return (
@@ -51,12 +51,12 @@ const AddressInfo = ({ safeName, safeAddress, ethBalance }: Props) => {
{safeName && ( - + {safeName} )}
- + {safeAddress} diff --git a/src/components-v2/surfaces/Collapse/index.js b/src/components-v2/surfaces/Collapse/index.js index 34dbcffb..a3d67dd6 100644 --- a/src/components-v2/surfaces/Collapse/index.js +++ b/src/components-v2/surfaces/Collapse/index.js @@ -1,10 +1,10 @@ // @flow -import React from 'react' -import styled from 'styled-components' import CollapseMUI from '@material-ui/core/Collapse' import IconButton from '@material-ui/core/IconButton' import ExpandLess from '@material-ui/icons/ExpandLess' import ExpandMore from '@material-ui/icons/ExpandMore' +import React from 'react' +import styled from 'styled-components' const Wrapper = styled.div`` @@ -21,7 +21,7 @@ type Props = { description: React.Node, } -const Collapse = ({ title, description, children }: Props) => { +const Collapse = ({ children, description, title }: Props) => { const [open, setOpen] = React.useState(false) const handleClick = () => { @@ -32,7 +32,7 @@ const Collapse = ({ title, description, children }: Props) => { {title}
- + {open ? : } {description} diff --git a/src/components-v2/utils/modals/GenericModal/index.js b/src/components-v2/utils/modals/GenericModal/index.js index a2c25328..868babdf 100644 --- a/src/components-v2/utils/modals/GenericModal/index.js +++ b/src/components-v2/utils/modals/GenericModal/index.js @@ -1,9 +1,9 @@ // @flow +import IconButton from '@material-ui/core/IconButton' +import { createStyles, makeStyles } from '@material-ui/core/styles' +import Close from '@material-ui/icons/Close' import React from 'react' import styled from 'styled-components' -import Close from '@material-ui/icons/Close' -import { makeStyles, createStyles } from '@material-ui/core/styles' -import IconButton from '@material-ui/core/IconButton' import Modal from '~/components/Modal' import Hairline from '~/components/layout/Hairline' @@ -45,14 +45,14 @@ type Props = { onClose: () => void, } -const GenericModal = ({ title, body, footer, onClose }: Props) => { +const GenericModal = ({ body, footer, onClose, title }: Props) => { const classes = useStyles() return ( - + {title} - + diff --git a/src/components-v2/utils/modals/utils.js b/src/components-v2/utils/modals/utils.js index 4f12ea1c..afe3d543 100644 --- a/src/components-v2/utils/modals/utils.js +++ b/src/components-v2/utils/modals/utils.js @@ -2,8 +2,8 @@ import React from 'react' import styled from 'styled-components' -import Paragraph from '~/components/layout/Paragraph' import Button from '~/components/layout/Button' +import Paragraph from '~/components/layout/Paragraph' import { lg } from '~/theme/variables' const StyledParagraph = styled(Paragraph)` @@ -20,11 +20,11 @@ const TitleWrapper = styled.div` align-items: center; ` -export const ModalTitle = ({ title, iconUrl }: { title: string, iconUrl: string }) => { +export const ModalTitle = ({ iconUrl, title }: { title: string, iconUrl: string }) => { return ( - {iconUrl && } - + {iconUrl && } + {title} @@ -37,10 +37,10 @@ const FooterWrapper = styled.div` ` export const ModalFooterConfirmation = ({ - okText, cancelText, - handleOk, handleCancel, + handleOk, + okText, }: { okText: string, cancelText: string, diff --git a/src/components/ConnectButton/index.jsx b/src/components/ConnectButton/index.jsx index fd0ffaf0..72dfd6d6 100644 --- a/src/components/ConnectButton/index.jsx +++ b/src/components/ConnectButton/index.jsx @@ -1,68 +1,99 @@ // @flow +import Onboard from 'bnc-onboard' import React from 'react' -import Web3Connect from 'web3connect' -import Torus from '@toruslabs/torus-embed' -import WalletConnectProvider from '@walletconnect/web3-provider' -import Fortmatic from 'fortmatic' -import Portis from '@portis/web3' -import Authereum from 'authereum' + import Button from '~/components/layout/Button' -import { fetchProvider, removeProvider } from '~/logic/wallets/store/actions' -import { getNetwork } from '~/config' +import { getNetworkId } from '~/config' +import { getWeb3, setWeb3 } from '~/logic/wallets/getWeb3' +import { fetchProvider } from '~/logic/wallets/store/actions' +import transactionDataCheck from '~/logic/wallets/transactionDataCheck' import { store } from '~/store' const isMainnet = process.env.REACT_APP_NETWORK === 'mainnet' +const BLOCKNATIVE_API_KEY = isMainnet ? process.env.REACT_APP_BLOCKNATIVE_KEY : '7fbb9cee-7e97-4436-8770-8b29a9a8814c' const PORTIS_DAPP_ID = isMainnet ? process.env.REACT_APP_PORTIS_ID : '852b763d-f28b-4463-80cb-846d7ec5806b' // const SQUARELINK_CLIENT_ID = isMainnet ? process.env.REACT_APP_SQUARELINK_ID : '46ce08fe50913cfa1b78' const FORTMATIC_API_KEY = isMainnet ? process.env.REACT_APP_FORTMATIC_KEY : 'pk_test_CAD437AA29BE0A40' -export const web3Connect = new Web3Connect.Core({ - network: getNetwork().toLowerCase(), - providerOptions: { - walletconnect: { - package: WalletConnectProvider, - options: { - infuraId: process.env.REACT_APP_INFURA_TOKEN, - }, +const wallets = [ + { walletName: 'metamask', preferred: true }, + { + walletName: 'walletConnect', + preferred: true, + infuraKey: process.env.REACT_APP_INFURA_TOKEN, + }, + { + walletName: 'trezor', + appUrl: 'gnosis-safe.io', + preferred: true, + email: 'safe@gnosis.io', + rpcUrl: 'https://rinkeby.infura.io/v3/b42c928da8fd4c1f90374b18aa9ac6ba', + }, + { + walletName: 'ledger', + preferred: true, + rpcUrl: 'https://rinkeby.infura.io/v3/b42c928da8fd4c1f90374b18aa9ac6ba', + }, + { walletName: 'trust', preferred: true }, + { walletName: 'dapper' }, + { + walletName: 'fortmatic', + apiKey: FORTMATIC_API_KEY, + }, + { + walletName: 'portis', + apiKey: PORTIS_DAPP_ID, + label: 'Login with Email', + }, + { walletName: 'authereum' }, + { walletName: 'coinbase' }, + { walletName: 'opera' }, + { walletName: 'operaTouch' }, +] + +let lastUsedAddress = '' +let providerName + +export const onboard = new Onboard({ + dappId: BLOCKNATIVE_API_KEY, + networkId: getNetworkId(), + subscriptions: { + wallet: wallet => { + if (wallet.provider) { + // this function will intialize web3 and store it somewhere available throughout the dapp and + // can also instantiate your contracts with the web3 instance + setWeb3(wallet.provider) + providerName = wallet.name + } }, - portis: { - package: Portis, - options: { - id: PORTIS_DAPP_ID, - }, - }, - fortmatic: { - package: Fortmatic, - options: { - key: FORTMATIC_API_KEY, - }, - }, - torus: { - package: Torus, - options: { - enableLogging: false, - buttonPosition: 'bottom-left', - buildEnv: process.env.NODE_ENV, - showTorusButton: true, - }, - }, - authereum: { - package: Authereum, - options: {}, + address: address => { + if (!lastUsedAddress && address) { + lastUsedAddress = address + store.dispatch(fetchProvider(providerName)) + } + + // we don't have an unsubscribe event so we rely on this + if (!address && lastUsedAddress) { + lastUsedAddress = '' + providerName = undefined + } }, }, + walletSelect: { + wallets, + }, + walletCheck: [{ checkName: 'connect' }, transactionDataCheck(), { checkName: 'network' }, { checkName: 'accounts' }], }) -web3Connect.on('connect', (provider: any) => { - if (provider) { - store.dispatch(fetchProvider(provider)) - } -}) - -web3Connect.on('disconnect', () => { - store.dispatch(removeProvider()) -}) +export const onboardUser = async () => { + // before calling walletSelect you want to check if web3 has been instantiated + // which indicates that a wallet has already been selected + // and web3 has been instantiated with that provider + const web3 = getWeb3() + const walletSelected = web3 ? true : await onboard.walletSelect() + return walletSelected && onboard.walletCheck() +} type Props = { enqueueSnackbar: Function, @@ -72,11 +103,12 @@ type Props = { const ConnectButton = (props: Props) => ( diff --git a/src/components/CopyBtn/index.jsx b/src/components/CopyBtn/index.jsx index d31da79b..65705464 100644 --- a/src/components/CopyBtn/index.jsx +++ b/src/components/CopyBtn/index.jsx @@ -1,13 +1,15 @@ // @flow -import React, { useState } from 'react' import Tooltip from '@material-ui/core/Tooltip' import { makeStyles } from '@material-ui/core/styles' import cn from 'classnames' -import Img from '~/components/layout/Img' -import { copyToClipboard } from '~/utils/clipboard' -import { xs } from '~/theme/variables' +import React, { useState } from 'react' + import CopyIcon from './copy.svg' +import Img from '~/components/layout/Img' +import { xs } from '~/theme/variables' +import { copyToClipboard } from '~/utils/clipboard' + const useStyles = makeStyles({ container: { display: 'flex', @@ -39,8 +41,7 @@ const CopyBtn = ({ className, content, increaseZindex = false }: CopyBtnProps) = return ( { // this is fired before tooltip is closed // added setTimeout so the user doesn't see the text changing/jumping @@ -50,17 +51,18 @@ const CopyBtn = ({ className, content, increaseZindex = false }: CopyBtnProps) = } }, 300) }} - classes={customClasses} + placement="top" + title={clicked ? 'Copied' : 'Copy to clipboard'} >
Copy to clipboard { copyToClipboard(content) setClicked(true) }} + src={CopyIcon} />
diff --git a/src/components/EtherscanBtn/index.jsx b/src/components/EtherscanBtn/index.jsx index 70412948..4a7a7112 100644 --- a/src/components/EtherscanBtn/index.jsx +++ b/src/components/EtherscanBtn/index.jsx @@ -1,10 +1,12 @@ // @flow -import React from 'react' import Tooltip from '@material-ui/core/Tooltip' import { makeStyles } from '@material-ui/core/styles' import cn from 'classnames' -import Img from '~/components/layout/Img' +import React from 'react' + import EtherscanOpenIcon from './img/etherscan-open.svg' + +import Img from '~/components/layout/Img' import { getEtherScanLink } from '~/logic/wallets/getWeb3' import { xs } from '~/theme/variables' @@ -33,12 +35,12 @@ type EtherscanBtnProps = { value: string, } -const EtherscanBtn = ({ type, value, className, increaseZindex = false }: EtherscanBtnProps) => { +const EtherscanBtn = ({ className, increaseZindex = false, type, value }: EtherscanBtnProps) => { const classes = useStyles() const customClasses = increaseZindex ? { popper: classes.increasedPopperZindex } : {} return ( - + - Show on Etherscan + Show on Etherscan ) diff --git a/src/components/EtherscanLink/index.jsx b/src/components/EtherscanLink/index.jsx index a68b30f7..3dad04b2 100644 --- a/src/components/EtherscanLink/index.jsx +++ b/src/components/EtherscanLink/index.jsx @@ -1,14 +1,16 @@ // @flow -import React from 'react' import { withStyles } from '@material-ui/core/styles' import cn from 'classnames' -import Block from '~/components/layout/Block' +import React from 'react' + +import { styles } from './style.js' + import CopyBtn from '~/components/CopyBtn' import EtherscanBtn from '~/components/EtherscanBtn' -import { shortVersionOf } from '~/logic/wallets/ethAddresses' -import { styles } from './style.js' -import EllipsisTransactionDetails from '~/routes/safe/components/AddressBook/EllipsisTransactionDetails' +import Block from '~/components/layout/Block' import Span from '~/components/layout/Span' +import { shortVersionOf } from '~/logic/wallets/ethAddresses' +import EllipsisTransactionDetails from '~/routes/safe/components/AddressBook/EllipsisTransactionDetails' type EtherscanLinkProps = { classes: Object, @@ -18,14 +20,14 @@ type EtherscanLinkProps = { value: string, } -const EtherscanLink = ({ type, value, cut, classes, knownAddress }: EtherscanLinkProps) => ( +const EtherscanLink = ({ classes, cut, knownAddress, type, value }: EtherscanLinkProps) => ( {cut ? shortVersionOf(value, cut) : value} - {knownAddress !== undefined ? : null} + {knownAddress !== undefined ? : null} ) diff --git a/src/components/Footer/index.jsx b/src/components/Footer/index.jsx index c1c10f40..fcc28441 100644 --- a/src/components/Footer/index.jsx +++ b/src/components/Footer/index.jsx @@ -1,12 +1,13 @@ // @flow -import * as React from 'react' import { makeStyles } from '@material-ui/core/styles' -import { useDispatch } from 'react-redux' import cn from 'classnames' -import Link from '~/components/layout/Link' -import { secondary, screenSm, sm } from '~/theme/variables' -import { openCookieBanner } from '~/logic/cookies/store/actions/openCookieBanner' +import * as React from 'react' +import { useDispatch } from 'react-redux' + import GnoButtonLink from '~/components/layout/ButtonLink' +import Link from '~/components/layout/Link' +import { openCookieBanner } from '~/logic/cookies/store/actions/openCookieBanner' +import { screenSm, secondary, sm } from '~/theme/variables' const useStyles = makeStyles({ footer: { @@ -57,23 +58,23 @@ const Footer = () => {