From 1c81b866bd30971f044bad1371dbbdfa50e6e9bb Mon Sep 17 00:00:00 2001 From: Elias Date: Fri, 25 Jun 2021 17:07:00 +0200 Subject: [PATCH 01/12] Fetch coordinatorState in the app view each 30 secs --- src/constants.js | 8 +-- src/store/global/global.thunks.js | 5 ++ src/store/transaction/transaction.thunks.js | 4 +- .../account-details/account-details.view.jsx | 6 --- src/views/app.view.jsx | 50 ++++++++++--------- src/views/home/home.view.jsx | 6 --- .../transaction-details.view.jsx | 7 --- 7 files changed, 40 insertions(+), 46 deletions(-) diff --git a/src/constants.js b/src/constants.js index 90e4b0f12..de2f20e83 100644 --- a/src/constants.js +++ b/src/constants.js @@ -35,9 +35,11 @@ export const PRIVACY_POLICY_URL = 'https://hermez.io/privacy-policy' export const TERMS_OF_SERVICE_URL = 'https://hermez.io/terms-of-service' -export const AUTO_REFRESH_RATE = 60000 // 1min +export const AUTO_REFRESH_RATE = 60_000 // 1min -export const RETRY_POOL_TXS_RATE = 60000 // 10min +export const RETRY_POOL_TXS_RATE = 6000_000 // 10min + +export const COORDINATOR_STATE_REFRESH_RATE = 30_000 // 30s export const STORAGE_VERSION_KEY = 'hermezWalletStorageVersion' @@ -49,7 +51,7 @@ export const HERMEZ_HELP_CENTER_URL = 'https://docs.hermez.io/#/faq/end-users' export const HERMEZ_WEB_URL = 'https://hermez.io' -export const DEPOSIT_TX_TIMEOUT = 86400000 // 24h +export const DEPOSIT_TX_TIMEOUT = 8_640_0000 // 24h export const AIRDROP_MORE_INFO_URL = 'https://blog.hermez.io/hermez-community-rewards' diff --git a/src/store/global/global.thunks.js b/src/store/global/global.thunks.js index 246f971cc..6ff7600c7 100644 --- a/src/store/global/global.thunks.js +++ b/src/store/global/global.thunks.js @@ -14,6 +14,7 @@ import * as airdropApi from '../../apis/rewards' import * as storage from '../../utils/storage' import * as constants from '../../constants' import { isTxMined, hasTxBeenReverted, isTxCanceled, isTxExpectedToFail } from '../../utils/ethereum' +import { CurrencySymbol } from '../../utils/currencies' /** * Sets the environment to use in hermezjs. If the chainId is supported will pick it up @@ -86,6 +87,10 @@ function changeRedirectRoute (redirectRoute) { */ function fetchFiatExchangeRates (symbols) { return (dispatch) => { + const symbols = Object.values(CurrencySymbol) + .filter(currency => currency.code !== CurrencySymbol.USD.code) + .map((currency) => currency.code) + dispatch(globalActions.loadFiatExchangeRates()) return fiatExchangeRatesApi.getFiatExchangeRates(symbols) diff --git a/src/store/transaction/transaction.thunks.js b/src/store/transaction/transaction.thunks.js index 9e1f5af83..b5d5a57d4 100644 --- a/src/store/transaction/transaction.thunks.js +++ b/src/store/transaction/transaction.thunks.js @@ -196,7 +196,9 @@ function fetchAccountBalance () { * @returns {void} */ function fetchFees () { - return function (dispatch) { + return function (dispatch, getState) { + const { global: { coordinatorStateTask } } = getState() + console.log(coordinatorStateTask) dispatch(transactionActions.loadFees()) return CoordinatorAPI.getState() diff --git a/src/views/account-details/account-details.view.jsx b/src/views/account-details/account-details.view.jsx index 783b7ae0d..b396f2449 100644 --- a/src/views/account-details/account-details.view.jsx +++ b/src/views/account-details/account-details.view.jsx @@ -49,7 +49,6 @@ function AccountDetails ({ onCheckPendingDeposits, onAddPendingDelayedWithdraw, onRemovePendingDelayedWithdraw, - onLoadCoordinatorState, onCheckPendingDelayedWithdrawals, onCheckPendingWithdrawals, onNavigateToTransactionDetails, @@ -78,10 +77,6 @@ function AccountDetails ({ onChangeHeader(accountTask.data?.token.name) }, [accountTask, onChangeHeader]) - React.useEffect(() => { - onLoadCoordinatorState() - }, []) - React.useEffect(() => { const loadInitialData = () => { onCheckPendingDeposits() @@ -366,7 +361,6 @@ const mapDispatchToProps = (dispatch) => ({ dispatch(globalThunks.addPendingDelayedWithdraw(pendingDelayedWithdraw)), onRemovePendingDelayedWithdraw: (pendingDelayedWithdrawId) => dispatch(globalThunks.removePendingDelayedWithdraw(pendingDelayedWithdrawId)), - onLoadCoordinatorState: () => dispatch(globalThunks.fetchCoordinatorState()), onCheckPendingWithdrawals: () => dispatch(globalThunks.checkPendingWithdrawals()), onCheckPendingDelayedWithdrawals: () => diff --git a/src/views/app.view.jsx b/src/views/app.view.jsx index 8baf9d6be..c4ae62650 100644 --- a/src/views/app.view.jsx +++ b/src/views/app.view.jsx @@ -9,14 +9,15 @@ import Layout from './shared/layout/layout.view' import routes from '../routing/routes' import * as globalThunks from '../store/global/global.thunks' import Spinner from './shared/spinner/spinner.view' -import { CurrencySymbol } from '../utils/currencies' -import { RETRY_POOL_TXS_RATE } from '../constants' +import { COORDINATOR_STATE_REFRESH_RATE, RETRY_POOL_TXS_RATE } from '../constants' function App ({ wallet, hermezStatusTask, ethereumNetworkTask, + coordinatorStateTask, fiatExchangeRatesTask, + onLoadCoordinatorState, onLoadFiatExchangeRates, onCheckHermezStatus, onLoadReward, @@ -34,10 +35,16 @@ function App ({ }, [onCheckHermezStatus]) React.useEffect(() => { - if (process.env.REACT_APP_ENABLE_AIRDROP) { - onLoadReward() + let intervalId + + if (ethereumNetworkTask.status === 'successful') { + intervalId = setInterval(onLoadCoordinatorState, COORDINATOR_STATE_REFRESH_RATE) + + onLoadCoordinatorState() } - }, []) + + return () => { clearInterval(intervalId) } + }, [ethereumNetworkTask]) React.useEffect(() => { if (hermezStatusTask.status === 'successful' && !hermezStatusTask.data.isUnderMaintenance) { @@ -46,6 +53,12 @@ function App ({ } }, [hermezStatusTask, onSetHermezEnvironment, onLoadFiatExchangeRates]) + React.useEffect(() => { + if (process.env.REACT_APP_ENABLE_AIRDROP) { + onLoadReward() + } + }, []) + React.useEffect(() => { let intervalId @@ -75,18 +88,14 @@ function App ({ if ( ( - hermezStatusTask.status !== 'successful' || - ( - hermezStatusTask.status === 'successful' && - hermezStatusTask.data.isUnderMaintenance === false - ) - ) && - ( + hermezStatusTask.status === 'pending' || + hermezStatusTask.status === 'loading' || ethereumNetworkTask.status === 'pending' || ethereumNetworkTask.status === 'loading' || fiatExchangeRatesTask.status === 'pending' || fiatExchangeRatesTask.status === 'loading' || - fiatExchangeRatesTask.status === 'failure' + coordinatorStateTask.status === 'pending' || + coordinatorStateTask.status === 'loading' ) ) { return ( @@ -120,23 +129,18 @@ App.propTypes = { const mapStateToProps = (state) => ({ wallet: state.global.wallet, hermezStatusTask: state.global.hermezStatusTask, - fiatExchangeRatesTask: state.global.fiatExchangeRatesTask, - ethereumNetworkTask: state.global.ethereumNetworkTask + ethereumNetworkTask: state.global.ethereumNetworkTask, + coordinatorStateTask: state.global.coordinatorStateTask, + fiatExchangeRatesTask: state.global.fiatExchangeRatesTask }) const mapDispatchToProps = (dispatch) => ({ onSetHermezEnvironment: () => dispatch(globalThunks.setHermezEnvironment()), onCheckHermezStatus: () => dispatch(globalThunks.checkHermezStatus()), + onLoadCoordinatorState: () => dispatch(globalThunks.fetchCoordinatorState()), + onLoadFiatExchangeRates: () => dispatch(globalThunks.fetchFiatExchangeRates()), onLoadReward: () => dispatch(globalThunks.fetchReward()), - onLoadFiatExchangeRates: () => - dispatch( - globalThunks.fetchFiatExchangeRates( - Object.values(CurrencySymbol) - .filter(currency => currency.code !== CurrencySymbol.USD.code) - .map((currency) => currency.code) - ) - ), onCheckPendingTransactions: () => dispatch(globalThunks.checkPendingTransactions()), onChangeNetworkStatus: (networkStatus, backgroundColor) => dispatch(globalThunks.changeNetworkStatus(networkStatus, backgroundColor)), diff --git a/src/views/home/home.view.jsx b/src/views/home/home.view.jsx index ab369a1d5..d68fddb2a 100644 --- a/src/views/home/home.view.jsx +++ b/src/views/home/home.view.jsx @@ -44,7 +44,6 @@ function Home ({ coordinatorStateTask, rewards, onChangeHeader, - onLoadCoordinatorState, onCheckPendingDeposits, onLoadTotalBalance, onLoadAccounts, @@ -87,10 +86,6 @@ function Home ({ onChangeHeader(theme.palette.primary.main) }, [theme, onChangeHeader]) - React.useEffect(() => { - onLoadCoordinatorState() - }, []) - React.useEffect(() => { onCheckPendingDeposits() onLoadPoolTransactions() @@ -330,7 +325,6 @@ const mapDispatchToProps = (dispatch) => ({ onChangeHeader: () => dispatch(changeHeader({ type: 'main' })), onCheckPendingDeposits: () => dispatch(globalThunks.checkPendingDeposits()), - onLoadCoordinatorState: () => dispatch(globalThunks.fetchCoordinatorState()), onLoadTotalBalance: (hermezEthereumAddress, poolTransactions, pendingDeposits, fiatExchangeRates, preferredCurrency) => dispatch(homeThunks.fetchTotalBalance(hermezEthereumAddress, poolTransactions, pendingDeposits, fiatExchangeRates, preferredCurrency)), onLoadAccounts: (hermezEthereumAddress, fromItem, poolTransactions, pendingDeposits, fiatExchangeRates, preferredCurrency) => diff --git a/src/views/transaction-details/transaction-details.view.jsx b/src/views/transaction-details/transaction-details.view.jsx index 021fe68f8..ea0fdc25d 100644 --- a/src/views/transaction-details/transaction-details.view.jsx +++ b/src/views/transaction-details/transaction-details.view.jsx @@ -13,7 +13,6 @@ import withAuthGuard from '../shared/with-auth-guard/with-auth-guard.view' import { getFixedTokenAmount, getAmountInPreferredCurrency, getTokenAmountInPreferredCurrency, getFeeInUsd } from '../../utils/currencies' import Container from '../shared/container/container.view' import { changeHeader, openSnackbar } from '../../store/global/global.actions' -import { fetchCoordinatorState } from '../../store/global/global.thunks' import FiatAmount from '../shared/fiat-amount/fiat-amount.view' import TokenBalance from '../shared/token-balance/token-balance.view' import { ACCOUNT_INDEX_SEPARATOR, MAX_TOKEN_DECIMALS } from '../../constants' @@ -29,7 +28,6 @@ function TransactionDetails ({ preferredCurrency, coordinatorStateTask, onLoadTransaction, - onLoadCoordinatorState, onChangeHeader, onOpenSnackbar }) { @@ -38,10 +36,6 @@ function TransactionDetails ({ const { accountIndex, transactionId } = useParams() const [, accountTokenSymbol] = accountIndex.split(ACCOUNT_INDEX_SEPARATOR) - React.useEffect(() => { - onLoadCoordinatorState() - }, []) - React.useEffect(() => { onLoadTransaction(transactionId) }, [transactionId, onLoadTransaction]) @@ -241,7 +235,6 @@ function getHeaderTitle (transactionType) { const mapDispatchToProps = (dispatch) => ({ onLoadTransaction: (transactionIdOrHash) => dispatch(transactionDetailsThunks.fetchTransaction(transactionIdOrHash)), - onLoadCoordinatorState: () => dispatch(fetchCoordinatorState()), onOpenSnackbar: (message) => dispatch(openSnackbar(message)), onChangeHeader: (transactionType, accountIndex) => dispatch( From 68e501a27780579ed5182157ddb3b02209e6006f Mon Sep 17 00:00:00 2001 From: Elias Date: Mon, 28 Jun 2021 10:58:30 +0200 Subject: [PATCH 02/12] Move the withAuthGuard to a PrivateRoute component --- src/routing/routes.jsx | 3 +- .../account-details/account-details.view.jsx | 3 +- src/views/app.view.jsx | 32 ++++++++++++----- src/views/home/home.view.jsx | 3 +- src/views/my-account/my-account.view.jsx | 3 +- src/views/my-code/my-code.view.jsx | 3 +- .../private-route/private-route.view.jsx | 27 ++++++++++++++ .../with-auth-guard/with-auth-guard.view.jsx | 35 ------------------- .../transaction-details.view.jsx | 3 +- src/views/transaction/transaction.view.jsx | 3 +- 10 files changed, 59 insertions(+), 56 deletions(-) create mode 100644 src/views/shared/private-route/private-route.view.jsx delete mode 100644 src/views/shared/with-auth-guard/with-auth-guard.view.jsx diff --git a/src/routing/routes.jsx b/src/routing/routes.jsx index 403bdcd37..3d3e4011d 100644 --- a/src/routing/routes.jsx +++ b/src/routing/routes.jsx @@ -2,11 +2,11 @@ import React from 'react' import { TxType } from '@hermeznetwork/hermezjs/src/enums' import Home from '../views/home/home.view' +import Login from '../views/login/login.view' import Transaction from '../views/transaction/transaction.view' import MyAccount from '../views/my-account/my-account.view' import AccountDetails from '../views/account-details/account-details.view' import TransactionDetails from '../views/transaction-details/transaction-details.view' -import Login from '../views/login/login.view' import MyCode from '../views/my-code/my-code.view' const routes = [ @@ -16,6 +16,7 @@ const routes = [ }, { path: '/login', + isPublic: true, render: () => }, { diff --git a/src/views/account-details/account-details.view.jsx b/src/views/account-details/account-details.view.jsx index b396f2449..94a874d7e 100644 --- a/src/views/account-details/account-details.view.jsx +++ b/src/views/account-details/account-details.view.jsx @@ -11,7 +11,6 @@ import * as globalThunks from '../../store/global/global.thunks' import * as accountDetailsThunks from '../../store/account-details/account-details.thunks' import Spinner from '../shared/spinner/spinner.view' import TransactionList from './components/transaction-list/transaction-list.view' -import withAuthGuard from '../shared/with-auth-guard/with-auth-guard.view' import { getFixedTokenAmount, getTokenAmountInPreferredCurrency } from '../../utils/currencies' import Container from '../shared/container/container.view' import { changeHeader } from '../../store/global/global.actions' @@ -371,4 +370,4 @@ const mapDispatchToProps = (dispatch) => ({ dispatch(resetState()) }) -export default withAuthGuard(connect(mapStateToProps, mapDispatchToProps)(AccountDetails)) +export default connect(mapStateToProps, mapDispatchToProps)(AccountDetails) diff --git a/src/views/app.view.jsx b/src/views/app.view.jsx index c4ae62650..d3d13508e 100644 --- a/src/views/app.view.jsx +++ b/src/views/app.view.jsx @@ -10,6 +10,7 @@ import routes from '../routing/routes' import * as globalThunks from '../store/global/global.thunks' import Spinner from './shared/spinner/spinner.view' import { COORDINATOR_STATE_REFRESH_RATE, RETRY_POOL_TXS_RATE } from '../constants' +import PrivateRoute from './shared/private-route/private-route.view' function App ({ wallet, @@ -17,6 +18,7 @@ function App ({ ethereumNetworkTask, coordinatorStateTask, fiatExchangeRatesTask, + onChangeRedirectRoute, onLoadCoordinatorState, onLoadFiatExchangeRates, onCheckHermezStatus, @@ -108,14 +110,27 @@ function App ({ return ( - {routes.map(route => - - )} + <> + {routes.map((route) => ( + route.isPublic + ? ( + + ) + : ( + + ) + ))} + @@ -135,6 +150,7 @@ const mapStateToProps = (state) => ({ }) const mapDispatchToProps = (dispatch) => ({ + onChangeRedirectRoute: (redirectRoute) => dispatch(globalThunks.changeRedirectRoute(redirectRoute)), onSetHermezEnvironment: () => dispatch(globalThunks.setHermezEnvironment()), onCheckHermezStatus: () => dispatch(globalThunks.checkHermezStatus()), onLoadCoordinatorState: () => dispatch(globalThunks.fetchCoordinatorState()), diff --git a/src/views/home/home.view.jsx b/src/views/home/home.view.jsx index d68fddb2a..265310d5b 100644 --- a/src/views/home/home.view.jsx +++ b/src/views/home/home.view.jsx @@ -10,7 +10,6 @@ import * as homeThunks from '../../store/home/home.thunks' import FiatAmount from '../shared/fiat-amount/fiat-amount.view' import AccountList from '../shared/account-list/account-list.view' import Spinner from '../shared/spinner/spinner.view' -import withAuthGuard from '../shared/with-auth-guard/with-auth-guard.view.jsx' import Container from '../shared/container/container.view' import { copyToClipboard } from '../../utils/browser' import { changeHeader, openSnackbar } from '../../store/global/global.actions' @@ -352,4 +351,4 @@ const mapDispatchToProps = (dispatch) => ({ onCleanup: () => dispatch(resetState()) }) -export default withAuthGuard(connect(mapStateToProps, mapDispatchToProps)(Home)) +export default connect(mapStateToProps, mapDispatchToProps)(Home) diff --git a/src/views/my-account/my-account.view.jsx b/src/views/my-account/my-account.view.jsx index 2a2a8ed8e..4640d9b55 100644 --- a/src/views/my-account/my-account.view.jsx +++ b/src/views/my-account/my-account.view.jsx @@ -10,7 +10,6 @@ import { changeHeader, openSnackbar } from '../../store/global/global.actions' import { changePreferredCurrency } from '../../store/my-account/my-account.thunks' import { disconnectWallet } from '../../store/global/global.thunks' import Container from '../shared/container/container.view' -import withAuthGuard from '../shared/with-auth-guard/with-auth-guard.view' import { ReactComponent as ExchangeIcon } from '../../images/icons/exchange.svg' import { ReactComponent as ExitIcon } from '../../images/icons/exit.svg' import { ReactComponent as OpenInNewTabIcon } from '../../images/icons/open-in-new-tab.svg' @@ -195,4 +194,4 @@ const mapDispatchToProps = (dispatch) => ({ onOpenRewardsSidenav: () => dispatch(globalActions.openRewardsSidenav()) }) -export default withAuthGuard(connect(mapStateToProps, mapDispatchToProps)(MyAccount)) +export default connect(mapStateToProps, mapDispatchToProps)(MyAccount) diff --git a/src/views/my-code/my-code.view.jsx b/src/views/my-code/my-code.view.jsx index 3ef0c6b0d..b0deac33f 100644 --- a/src/views/my-code/my-code.view.jsx +++ b/src/views/my-code/my-code.view.jsx @@ -6,7 +6,6 @@ import { push } from 'connected-react-router' import { useLocation } from 'react-router-dom' import useMyCodeStyles from './my-code.styles' -import withAuthGuard from '../shared/with-auth-guard/with-auth-guard.view' import Container from '../shared/container/container.view' import { changeHeader } from '../../store/global/global.actions' import { MY_CODE } from '../../constants' @@ -120,4 +119,4 @@ const mapDispatchToProps = (dispatch) => ({ dispatch(push(`/transfer?receiver=${hermezEthereumAddress}`)) }) -export default withAuthGuard(connect(mapStateToProps, mapDispatchToProps)(MyCode)) +export default connect(mapStateToProps, mapDispatchToProps)(MyCode) diff --git a/src/views/shared/private-route/private-route.view.jsx b/src/views/shared/private-route/private-route.view.jsx new file mode 100644 index 000000000..429bf41e9 --- /dev/null +++ b/src/views/shared/private-route/private-route.view.jsx @@ -0,0 +1,27 @@ +import React from 'react' +import { Route, useLocation, Redirect } from 'react-router-dom' + +function PrivateRoute ({ isUserLoggedIn, route, onChangeRedirectRoute }) { + const { pathname, search } = useLocation() + + return ( + { + if (isUserLoggedIn) { + return route.render() + } else { + const currentRoute = `${pathname}${search}` + + onChangeRedirectRoute(currentRoute) + + return + } + }} + /> + ) +} + +export default PrivateRoute diff --git a/src/views/shared/with-auth-guard/with-auth-guard.view.jsx b/src/views/shared/with-auth-guard/with-auth-guard.view.jsx deleted file mode 100644 index 33fff5a47..000000000 --- a/src/views/shared/with-auth-guard/with-auth-guard.view.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react' -import { connect } from 'react-redux' -import { Redirect, useLocation } from 'react-router-dom' - -import { changeRedirectRoute } from '../../../store/global/global.thunks' - -const withAuth = (Component) => ({ wallet, onChangeRedirectRoute, ...props }) => { - const { pathname, search } = useLocation() - - if (wallet) { - return - } else { - const currentRoute = `${pathname}${search}` - - onChangeRedirectRoute(currentRoute) - - return - } -} - -const mapStateToProps = (state) => ({ - wallet: state.global.wallet -}) - -const mapDispatchToProps = (dispatch) => ({ - onChangeRedirectRoute: (redirectRoute) => dispatch(changeRedirectRoute(redirectRoute)) -}) - -const withAuthGuard = (Component) => (props) => { - const ConnectedComponent = connect(mapStateToProps, mapDispatchToProps)(withAuth(Component)) - - return -} - -export default withAuthGuard diff --git a/src/views/transaction-details/transaction-details.view.jsx b/src/views/transaction-details/transaction-details.view.jsx index ea0fdc25d..3f16549ac 100644 --- a/src/views/transaction-details/transaction-details.view.jsx +++ b/src/views/transaction-details/transaction-details.view.jsx @@ -9,7 +9,6 @@ import { TxType, TxLevel, TxState } from '@hermeznetwork/hermezjs/src/enums' import useTransactionDetailsStyles from './transaction-details.styles' import * as transactionDetailsThunks from '../../store/transaction-details/transaction-details.thunks' import Spinner from '../shared/spinner/spinner.view' -import withAuthGuard from '../shared/with-auth-guard/with-auth-guard.view' import { getFixedTokenAmount, getAmountInPreferredCurrency, getTokenAmountInPreferredCurrency, getFeeInUsd } from '../../utils/currencies' import Container from '../shared/container/container.view' import { changeHeader, openSnackbar } from '../../store/global/global.actions' @@ -248,4 +247,4 @@ const mapDispatchToProps = (dispatch) => ({ ) }) -export default withAuthGuard(connect(mapStateToProps, mapDispatchToProps)(TransactionDetails)) +export default connect(mapStateToProps, mapDispatchToProps)(TransactionDetails) diff --git a/src/views/transaction/transaction.view.jsx b/src/views/transaction/transaction.view.jsx index a817ea2c0..be2b5ed12 100644 --- a/src/views/transaction/transaction.view.jsx +++ b/src/views/transaction/transaction.view.jsx @@ -11,7 +11,6 @@ import * as globalThunks from '../../store/global/global.thunks' import useTransactionStyles from './transaction.styles' import TransactionForm from './components/transaction-form/transaction-form.view' import TransactionOverview from './components/transaction-overview/transaction-overview.view' -import withAuthGuard from '../shared/with-auth-guard/with-auth-guard.view' import { STEP_NAME } from '../../store/transaction/transaction.reducer' import AccountSelector from './components/account-selector/account-selector.view' import TransactionConfirmation from './components/transaction-confirmation/transaction-confirmation.view' @@ -381,4 +380,4 @@ const mapDispatchToProps = (dispatch) => ({ dispatch(transactionActions.resetState()) }) -export default withAuthGuard(connect(mapStateToProps, mapDispatchToProps)(Transaction)) +export default connect(mapStateToProps, mapDispatchToProps)(Transaction) From 7f373eae8c61f1e1a241441231382e2fe634fb05 Mon Sep 17 00:00:00 2001 From: Elias Date: Mon, 28 Jun 2021 11:05:57 +0200 Subject: [PATCH 03/12] Fix app spinner condition --- src/views/app.view.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/views/app.view.jsx b/src/views/app.view.jsx index d3d13508e..3cdb3dff7 100644 --- a/src/views/app.view.jsx +++ b/src/views/app.view.jsx @@ -89,6 +89,13 @@ function App ({ }, [onDisconnectAccount, onReloadApp]) if ( + ( + hermezStatusTask.status !== 'successful' || + ( + hermezStatusTask.status === 'successful' && + hermezStatusTask.data.isUnderMaintenance === false + ) + ) && ( hermezStatusTask.status === 'pending' || hermezStatusTask.status === 'loading' || From 658e60baccf875bfbc33547336b8cab6131f16a9 Mon Sep 17 00:00:00 2001 From: Elias Date: Mon, 28 Jun 2021 16:49:58 +0200 Subject: [PATCH 04/12] Fix leftovers --- src/store/global/global.thunks.js | 2 +- src/store/transaction/transaction.thunks.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/store/global/global.thunks.js b/src/store/global/global.thunks.js index 6ff7600c7..1deab18b6 100644 --- a/src/store/global/global.thunks.js +++ b/src/store/global/global.thunks.js @@ -85,7 +85,7 @@ function changeRedirectRoute (redirectRoute) { * @param {string[]} symbols - ISO 4217 currency codes * @returns {void} */ -function fetchFiatExchangeRates (symbols) { +function fetchFiatExchangeRates () { return (dispatch) => { const symbols = Object.values(CurrencySymbol) .filter(currency => currency.code !== CurrencySymbol.USD.code) diff --git a/src/store/transaction/transaction.thunks.js b/src/store/transaction/transaction.thunks.js index b5d5a57d4..55ed1b2e2 100644 --- a/src/store/transaction/transaction.thunks.js +++ b/src/store/transaction/transaction.thunks.js @@ -197,8 +197,6 @@ function fetchAccountBalance () { */ function fetchFees () { return function (dispatch, getState) { - const { global: { coordinatorStateTask } } = getState() - console.log(coordinatorStateTask) dispatch(transactionActions.loadFees()) return CoordinatorAPI.getState() From b00d91547ad996140c53b1946cef029494533153 Mon Sep 17 00:00:00 2001 From: Elias Date: Tue, 29 Jun 2021 10:55:21 +0200 Subject: [PATCH 05/12] Move nextForgerUrls to a util --- src/store/global/global.reducer.js | 3 --- src/store/global/global.thunks.js | 6 ++++-- src/store/login/login.thunks.js | 6 ++++-- src/store/transaction/transaction.thunks.js | 12 +++++++----- src/utils/coordinator.js | 13 +++++++++++++ 5 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 src/utils/coordinator.js diff --git a/src/store/global/global.reducer.js b/src/store/global/global.reducer.js index 77db885b8..5c5ae069c 100644 --- a/src/store/global/global.reducer.js +++ b/src/store/global/global.reducer.js @@ -40,7 +40,6 @@ function getInitialGlobalState () { pendingDepositsCheckTask: { status: 'pending' }, - nextForgers: [], coordinatorStateTask: { status: 'pending' }, @@ -417,10 +416,8 @@ function globalReducer (state = getInitialGlobalState(), action) { } } case globalActionTypes.LOAD_COORDINATOR_STATE_SUCCESS: { - const nextForgers = [...new Set(action.coordinatorState.network.nextForgers.map((nextForger) => nextForger.coordinator.URL))] return { ...state, - nextForgers, coordinatorStateTask: { status: 'successful', data: action.coordinatorState diff --git a/src/store/global/global.thunks.js b/src/store/global/global.thunks.js index 1deab18b6..91b7bf9c4 100644 --- a/src/store/global/global.thunks.js +++ b/src/store/global/global.thunks.js @@ -15,6 +15,7 @@ import * as storage from '../../utils/storage' import * as constants from '../../constants' import { isTxMined, hasTxBeenReverted, isTxCanceled, isTxExpectedToFail } from '../../utils/ethereum' import { CurrencySymbol } from '../../utils/currencies' +import { getNextForgerUrls } from '../../utils/coordinator' /** * Sets the environment to use in hermezjs. If the chainId is supported will pick it up @@ -507,7 +508,8 @@ function checkPendingDeposits () { function checkPendingTransactions () { return (_, getState) => { - const { global: { wallet, nextForgers } } = getState() + const { global: { wallet, coordinatorStateTask } } = getState() + const nextForgerUrls = getNextForgerUrls(coordinatorStateTask.data) hermezjs.TxPool.getPoolTransactions(undefined, wallet.publicKeyCompressedHex) .then((poolTransactions) => { @@ -538,7 +540,7 @@ function checkPendingTransactions () { fee: transaction.fee } - return Tx.generateAndSendL2Tx(txData, wallet, transaction.token, nextForgers, false) + return Tx.generateAndSendL2Tx(txData, wallet, transaction.token, nextForgerUrls, false) .catch(() => {}) }) diff --git a/src/store/login/login.thunks.js b/src/store/login/login.thunks.js index 76e000dde..07c8c5c50 100644 --- a/src/store/login/login.thunks.js +++ b/src/store/login/login.thunks.js @@ -11,6 +11,7 @@ import { buildEthereumBIP44Path } from '../../utils/hw-wallets' import { HttpStatusCode } from '../../utils/http' import { STEP_NAME } from './login.reducer' import { WalletName } from '../../views/login/login.view' +import { getNextForgerUrls } from '../../utils/coordinator' async function getSignerData (provider, walletName, accountData) { switch (walletName) { @@ -148,8 +149,9 @@ function postCreateAccountAuthorization (wallet) { return (dispatch, getState) => { const { login: { accountAuthSignatures }, - global: { redirectRoute, ethereumNetworkTask, nextForgers } + global: { redirectRoute, ethereumNetworkTask, coordinatorStateTask } } = getState() + const nextForgerUrls = getNextForgerUrls(coordinatorStateTask.data) const chainIdSignatures = accountAuthSignatures[ethereumNetworkTask.data.chainId] || {} const currentSignature = chainIdSignatures[wallet.hermezEthereumAddress] @@ -165,7 +167,7 @@ function postCreateAccountAuthorization (wallet) { wallet.hermezEthereumAddress, wallet.publicKeyBase64, signature, - nextForgers + nextForgerUrls ).catch((error) => { // If the coordinators already have the CreateAccountsAuth signature, // we ignore the error diff --git a/src/store/transaction/transaction.thunks.js b/src/store/transaction/transaction.thunks.js index 55ed1b2e2..4a78a3b26 100644 --- a/src/store/transaction/transaction.thunks.js +++ b/src/store/transaction/transaction.thunks.js @@ -11,6 +11,7 @@ import { getFixedTokenAmount, getTokenAmountInPreferredCurrency } from '../../ut import { getProvider } from '@hermeznetwork/hermezjs/src/providers' import { ETHER_TOKEN_ID } from '@hermeznetwork/hermezjs/src/constants' import { getEthereumAddress } from '@hermeznetwork/hermezjs/src/addresses' +import { getNextForgerUrls } from '../../utils/coordinator' /** * Fetches the account details for a token id in an Ethereum wallet. @@ -374,7 +375,8 @@ function forceExit (amount, account) { function exit (amount, account, fee) { return (dispatch, getState) => { - const { global: { wallet, nextForgers } } = getState() + const { global: { wallet, coordinatorStateTask } } = getState() + const nextForgerUrls = getNextForgerUrls(coordinatorStateTask.data) const txData = { type: TxType.Exit, from: account.accountIndex, @@ -382,7 +384,7 @@ function exit (amount, account, fee) { fee } - return Tx.generateAndSendL2Tx(txData, wallet, account.token, nextForgers) + return Tx.generateAndSendL2Tx(txData, wallet, account.token, nextForgerUrls) .then(() => dispatch(transactionActions.goToFinishTransactionStep())) .catch((error) => { console.error(error) @@ -394,8 +396,8 @@ function exit (amount, account, fee) { function transfer (amount, from, to, fee) { return (dispatch, getState) => { - const { global: { wallet, nextForgers } } = getState() - + const { global: { wallet, coordinatorStateTask } } = getState() + const nextForgerUrls = getNextForgerUrls(coordinatorStateTask.data) const txData = { from: from.accountIndex, to: to.accountIndex || to.hezEthereumAddress || to.hezBjjAddress, @@ -403,7 +405,7 @@ function transfer (amount, from, to, fee) { fee } - return Tx.generateAndSendL2Tx(txData, wallet, from.token, nextForgers) + return Tx.generateAndSendL2Tx(txData, wallet, from.token, nextForgerUrls) .then(() => dispatch(transactionActions.goToFinishTransactionStep())) .catch((error) => { console.error(error) diff --git a/src/utils/coordinator.js b/src/utils/coordinator.js new file mode 100644 index 000000000..ac58da105 --- /dev/null +++ b/src/utils/coordinator.js @@ -0,0 +1,13 @@ +/** + * Extracts the nextForgerUrls without duplicates from the coordinator state returned by + * the Hermez API + * @param {Object} coordinatorState - Coordinator state returned by the Hermez API + * @returns URL's of the next forgers + */ +function getNextForgerUrls (coordinatorState) { + const nextForgerUrls = coordinatorState.network.nextForgers.map((nextForger) => nextForger.coordinator.URL) + + return [...new Set(nextForgerUrls)] +} + +export { getNextForgerUrls } From e24c681057aa51ad2a9db531b129a55b660f7797 Mon Sep 17 00:00:00 2001 From: Elias Date: Tue, 29 Jun 2021 11:38:33 +0200 Subject: [PATCH 06/12] Add a getNextForgers util --- src/store/transaction/transaction.thunks.js | 5 +++- src/utils/coordinator.js | 26 ++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/store/transaction/transaction.thunks.js b/src/store/transaction/transaction.thunks.js index 4a78a3b26..395b78839 100644 --- a/src/store/transaction/transaction.thunks.js +++ b/src/store/transaction/transaction.thunks.js @@ -11,7 +11,7 @@ import { getFixedTokenAmount, getTokenAmountInPreferredCurrency } from '../../ut import { getProvider } from '@hermeznetwork/hermezjs/src/providers' import { ETHER_TOKEN_ID } from '@hermeznetwork/hermezjs/src/constants' import { getEthereumAddress } from '@hermeznetwork/hermezjs/src/addresses' -import { getNextForgerUrls } from '../../utils/coordinator' +import { getNextForgers, getNextForgerUrls } from '../../utils/coordinator' /** * Fetches the account details for a token id in an Ethereum wallet. @@ -198,6 +198,9 @@ function fetchAccountBalance () { */ function fetchFees () { return function (dispatch, getState) { + const { global: { coordinatorStateTask } } = getState() + console.log(getNextForgers(coordinatorStateTask.data)) + dispatch(transactionActions.loadFees()) return CoordinatorAPI.getState() diff --git a/src/utils/coordinator.js b/src/utils/coordinator.js index ac58da105..62cf5b5c1 100644 --- a/src/utils/coordinator.js +++ b/src/utils/coordinator.js @@ -1,3 +1,19 @@ +/** + * Extracts the next forgers without duplicates from the coordinator state returned by + * the Hermez API + * @param {Object} coordinatorState - Coordinator state returned by the Hermez API + * @returns Next forgers + */ +function getNextForgers (coordinatorState) { + return coordinatorState.network.nextForgers.reduce((acc, curr) => { + const doesItemExist = acc.find(elem => elem.coordinator.forgerAddr === curr.coordinator.forgerAddr) + + return doesItemExist + ? acc + : [...acc, curr] + }, []) +} + /** * Extracts the nextForgerUrls without duplicates from the coordinator state returned by * the Hermez API @@ -5,9 +21,13 @@ * @returns URL's of the next forgers */ function getNextForgerUrls (coordinatorState) { - const nextForgerUrls = coordinatorState.network.nextForgers.map((nextForger) => nextForger.coordinator.URL) + const nextForgerUrls = getNextForgers(coordinatorState) + .map((nextForger) => nextForger.coordinator.URL) - return [...new Set(nextForgerUrls)] + return nextForgerUrls } -export { getNextForgerUrls } +export { + getNextForgers, + getNextForgerUrls +} From 284546a0444114dd8153cb0c2cb689597afd4ac1 Mon Sep 17 00:00:00 2001 From: Elias Date: Tue, 29 Jun 2021 12:28:50 +0200 Subject: [PATCH 07/12] Fetch the fees from the next best forger --- src/constants.js | 2 ++ src/store/transaction/transaction.thunks.js | 6 ++-- src/utils/coordinator.js | 33 ++++++++++++++++++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/constants.js b/src/constants.js index de2f20e83..fca29b629 100644 --- a/src/constants.js +++ b/src/constants.js @@ -58,3 +58,5 @@ export const AIRDROP_MORE_INFO_URL = 'https://blog.hermez.io/hermez-community-re export const HEZ_TOKEN_ID = 1 export const METAMASK_UPDATE_HELP_LINK = 'https://twitter.com/hermez_network/status/1405812176053538817' + +export const DELAY_TO_NEXT_FORGER = 30_000 // 30s diff --git a/src/store/transaction/transaction.thunks.js b/src/store/transaction/transaction.thunks.js index 395b78839..f279c9e15 100644 --- a/src/store/transaction/transaction.thunks.js +++ b/src/store/transaction/transaction.thunks.js @@ -11,7 +11,7 @@ import { getFixedTokenAmount, getTokenAmountInPreferredCurrency } from '../../ut import { getProvider } from '@hermeznetwork/hermezjs/src/providers' import { ETHER_TOKEN_ID } from '@hermeznetwork/hermezjs/src/constants' import { getEthereumAddress } from '@hermeznetwork/hermezjs/src/addresses' -import { getNextForgers, getNextForgerUrls } from '../../utils/coordinator' +import { getNextBestForger, getNextForgerUrls } from '../../utils/coordinator' /** * Fetches the account details for a token id in an Ethereum wallet. @@ -199,11 +199,11 @@ function fetchAccountBalance () { function fetchFees () { return function (dispatch, getState) { const { global: { coordinatorStateTask } } = getState() - console.log(getNextForgers(coordinatorStateTask.data)) + const nextForger = getNextBestForger(coordinatorStateTask.data) dispatch(transactionActions.loadFees()) - return CoordinatorAPI.getState() + return CoordinatorAPI.getState({}, nextForger.coordinator.URL) .then(res => dispatch(transactionActions.loadFeesSuccess(res.recommendedFee))) .catch(err => dispatch(transactionActions.loadFeesFailure(err))) } diff --git a/src/utils/coordinator.js b/src/utils/coordinator.js index 62cf5b5c1..875289478 100644 --- a/src/utils/coordinator.js +++ b/src/utils/coordinator.js @@ -1,3 +1,5 @@ +import { DELAY_TO_NEXT_FORGER } from '../constants' + /** * Extracts the next forgers without duplicates from the coordinator state returned by * the Hermez API @@ -27,7 +29,36 @@ function getNextForgerUrls (coordinatorState) { return nextForgerUrls } +/** + * Returns the next best forger of the network + * @param {Object} coordinatorState - Coordinator state returned by the Hermez API + * @returns Next best forger + */ +function getNextBestForger (coordinatorState) { + const nextForgers = getNextForgers(coordinatorState) + + if (nextForgers.length === 0) { + return undefined + } + + if (nextForgers.length === 1) { + return nextForgers[0] + } + + const bestNextForgers = nextForgers.filter((forger) => { + const toTimestamp = new Date(forger.period.toTimestamp).getTime() + const expectedMinTime = Date.now() + DELAY_TO_NEXT_FORGER + + return expectedMinTime <= toTimestamp + }) + + return bestNextForgers.length === 0 + ? nextForgers[1] + : bestNextForgers[0] +} + export { getNextForgers, - getNextForgerUrls + getNextForgerUrls, + getNextBestForger } From 8568bb960be4cc0dacad643e55f39ba006401cf0 Mon Sep 17 00:00:00 2001 From: mmilenkovic Date: Tue, 29 Jun 2021 15:31:46 +0200 Subject: [PATCH 08/12] make sure comparison with INTERNAL_ACCOUNT_ETH_ADDR is correct (#566) --- src/views/shared/transaction-info/transaction-info.view.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/shared/transaction-info/transaction-info.view.jsx b/src/views/shared/transaction-info/transaction-info.view.jsx index 3329eb87b..932c595bc 100644 --- a/src/views/shared/transaction-info/transaction-info.view.jsx +++ b/src/views/shared/transaction-info/transaction-info.view.jsx @@ -44,7 +44,7 @@ function TransactionInfo ({ } function handleCopyToAddress () { - copyToClipboard(txData.toHezEthereumAddress === INTERNAL_ACCOUNT_ETH_ADDR + copyToClipboard(txData.toHezEthereumAddress.toLowerCase() === INTERNAL_ACCOUNT_ETH_ADDR.toLowerCase() ? (txData.toBjj || txData.toBJJ) : txData.toHezEthereumAddress) onToCopyClick() @@ -87,7 +87,7 @@ function TransactionInfo ({ value: getPartiallyHiddenHermezAddress(txData.fromHezEthereumAddress) }} to={{ - subtitle: txData.toHezEthereumAddress === INTERNAL_ACCOUNT_ETH_ADDR + subtitle: txData.toHezEthereumAddress.toLowerCase() === INTERNAL_ACCOUNT_ETH_ADDR.toLowerCase() ? getPartiallyHiddenHermezAddress(txData.toBjj || txData.toBJJ) : getPartiallyHiddenHermezAddress(txData.toHezEthereumAddress) }} From a90091efaa11af4eb068366bf43e61e98bebc1e9 Mon Sep 17 00:00:00 2001 From: Elias Date: Tue, 29 Jun 2021 19:28:48 +0200 Subject: [PATCH 09/12] Improve getNextBestForger doc --- src/utils/coordinator.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/coordinator.js b/src/utils/coordinator.js index 875289478..5a9a5cecf 100644 --- a/src/utils/coordinator.js +++ b/src/utils/coordinator.js @@ -30,7 +30,10 @@ function getNextForgerUrls (coordinatorState) { } /** - * Returns the next best forger of the network + * Returns the next best forger of the network. The next best forger is the one which will + * be forging for at least enough time to pick the transaction that we are going to send + * afterwards. If it's about to finish forging, the next forger matching this criteria + * will be picked up * @param {Object} coordinatorState - Coordinator state returned by the Hermez API * @returns Next best forger */ From 39cae400e332c4abb7cff3d38a5b0b8363731470 Mon Sep 17 00:00:00 2001 From: Elias Date: Wed, 30 Jun 2021 10:40:38 +0200 Subject: [PATCH 10/12] Update hermezjs --- package-lock.json | 18 +++++++++--------- package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index a339ddc1e..feba74c1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { "name": "wallet-ui", - "version": "v1.1.0", + "version": "v1.1.5", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "v1.1.0", + "version": "v1.1.5", "dependencies": { - "@hermeznetwork/hermezjs": "1.1.6", + "@hermeznetwork/hermezjs": "1.1.7", "@walletconnect/web3-provider": "^1.4.1", "axios": "^0.21.1", "big-integer": "^1.6.48", @@ -2684,9 +2684,9 @@ } }, "node_modules/@hermeznetwork/hermezjs": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@hermeznetwork/hermezjs/-/hermezjs-1.1.6.tgz", - "integrity": "sha512-i2NZgfVZjsCJvU8InnpK593uI9f958PUHhFMoF1Z9ifM7xtdDk2WSv/4t2+Qdzzih6hfQgz3g4slSwvAIaGTNg==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@hermeznetwork/hermezjs/-/hermezjs-1.1.7.tgz", + "integrity": "sha512-IzlQwWh5dVrSA6LICMv7jrHJxH726JK4sIrxak+gINjMaVsUjzA+kcMorenenpSpCD7jfXwCqRIsBXGwXRjGRQ==", "dependencies": { "@ethersproject/keccak256": "^5.0.7", "@ledgerhq/hw-app-eth": "^5.35.1", @@ -28361,9 +28361,9 @@ } }, "@hermeznetwork/hermezjs": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@hermeznetwork/hermezjs/-/hermezjs-1.1.6.tgz", - "integrity": "sha512-i2NZgfVZjsCJvU8InnpK593uI9f958PUHhFMoF1Z9ifM7xtdDk2WSv/4t2+Qdzzih6hfQgz3g4slSwvAIaGTNg==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@hermeznetwork/hermezjs/-/hermezjs-1.1.7.tgz", + "integrity": "sha512-IzlQwWh5dVrSA6LICMv7jrHJxH726JK4sIrxak+gINjMaVsUjzA+kcMorenenpSpCD7jfXwCqRIsBXGwXRjGRQ==", "requires": { "@ethersproject/keccak256": "^5.0.7", "@ledgerhq/hw-app-eth": "^5.35.1", diff --git a/package.json b/package.json index 561f7444d..f9364ab28 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lint:fix": "standard --fix" }, "dependencies": { - "@hermeznetwork/hermezjs": "1.1.6", + "@hermeznetwork/hermezjs": "1.1.7", "@walletconnect/web3-provider": "^1.4.1", "axios": "^0.21.1", "big-integer": "^1.6.48", From 6f423b19cb6d978c61820fc9b19856f3e1085e15 Mon Sep 17 00:00:00 2001 From: Elias Date: Wed, 30 Jun 2021 10:54:11 +0200 Subject: [PATCH 11/12] Fix PageHeader styles --- src/styles/theme.js | 2 +- src/views/my-account/my-account.styles.js | 2 +- .../shared/page-header/page-header.styles.js | 18 +++---- .../shared/page-header/page-header.view.jsx | 48 +++++++++---------- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/src/styles/theme.js b/src/styles/theme.js index 0e524943e..e4b6a1a02 100644 --- a/src/styles/theme.js +++ b/src/styles/theme.js @@ -43,7 +43,7 @@ const theme = { upSm: '@media (min-width: 576px)' }, spacing: (value) => value * 8, - headerHeight: 80, + headerHeight: 84, sidenavWidth: 295 } diff --git a/src/views/my-account/my-account.styles.js b/src/views/my-account/my-account.styles.js index 9c4e403a6..1ea5b231b 100644 --- a/src/views/my-account/my-account.styles.js +++ b/src/views/my-account/my-account.styles.js @@ -8,7 +8,7 @@ const useMyAccountStyles = createUseStyles(theme => ({ fontSize: theme.spacing(2.5), fontWeight: theme.fontWeights.medium, textAlign: 'center', - marginTop: theme.spacing(2), + marginTop: theme.spacing(3.5), marginBottom: theme.spacing(2.5) }, topSection: { diff --git a/src/views/shared/page-header/page-header.styles.js b/src/views/shared/page-header/page-header.styles.js index b9e23eb34..18d050ead 100644 --- a/src/views/shared/page-header/page-header.styles.js +++ b/src/views/shared/page-header/page-header.styles.js @@ -6,17 +6,22 @@ const usePageHeaderStyles = createUseStyles(theme => ({ position: 'absolute', height: theme.headerHeight, display: 'flex', - alignItems: 'center', + alignItems: 'flex-end', zIndex: 998, background: 'transparent' }, - headerContent: { + headerWrapper: { + width: '100%', + display: 'flex', + flexDirection: 'column', + alignItems: 'center' + }, + titleWrapper: { width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', - position: 'relative', - marginTop: theme.spacing(3) + position: 'relative' }, buttonBase: { position: 'absolute', @@ -37,9 +42,6 @@ const usePageHeaderStyles = createUseStyles(theme => ({ right: 0, marginRight: -(theme.spacing(2)) }, - titleWrapper: { - textAlign: 'center' - }, title: { fontSize: theme.spacing(3), fontWeight: theme.fontWeights.extraBold @@ -48,7 +50,7 @@ const usePageHeaderStyles = createUseStyles(theme => ({ fontSize: theme.spacing(2), fontWeight: theme.fontWeights.medium, color: theme.palette.grey.dark, - paddingTop: theme.spacing(1.5), + paddingTop: theme.spacing(1.25), margin: 0 } })) diff --git a/src/views/shared/page-header/page-header.view.jsx b/src/views/shared/page-header/page-header.view.jsx index 183f84a3e..460a7464a 100644 --- a/src/views/shared/page-header/page-header.view.jsx +++ b/src/views/shared/page-header/page-header.view.jsx @@ -20,33 +20,33 @@ function PageHeader ({ return (
-
- {goBackAction && ( - - )} +
+ {goBackAction && ( + + )}

{title || ''}

- {subtitle &&

{subtitle}

} + {closeAction && ( + + )}
- {closeAction && ( - - )} + {subtitle &&

{subtitle}

}
From 7ec2633b34f8e48b7fa82b0c0d8b4246b47b5d80 Mon Sep 17 00:00:00 2001 From: Elias Date: Tue, 6 Jul 2021 01:09:40 +0200 Subject: [PATCH 12/12] Update version to v1.1.6 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index feba74c1a..4b8de1a37 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "wallet-ui", - "version": "v1.1.5", + "version": "v1.1.6", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "v1.1.5", + "version": "v1.1.6", "dependencies": { "@hermeznetwork/hermezjs": "1.1.7", "@walletconnect/web3-provider": "^1.4.1", diff --git a/package.json b/package.json index f9364ab28..e6bdd4d52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wallet-ui", - "version": "v1.1.5", + "version": "v1.1.6", "private": true, "scripts": { "start:dev": "react-scripts start",