Merge pull request #3565 from poanetwork/vb-staking-unhealthy-dapp-message

Staking dapp: unhealthy state message
pull/3567/head
Victor Baranov 4 years ago committed by GitHub
commit 7828960c6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 13
      apps/block_scout_web/assets/js/pages/stakes.js
  3. 4
      apps/block_scout_web/lib/block_scout_web/channels/stakes_channel.ex
  4. 18
      apps/block_scout_web/priv/gettext/default.pot
  5. 18
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po

@ -6,6 +6,7 @@
### Fixes
### Chore
- [#3565](https://github.com/poanetwork/blockscout/pull/3565) - Staking dapp: unhealthy state alert message
## 3.5.1-beta

@ -48,7 +48,8 @@ export const initialState = {
tokenSymbol: '',
validatorSetApplyBlock: 0,
validatorSetContract: null,
web3: null
web3: null,
stakingErrorShown: false
}
// 100 - id of xDai network, 101 - id of xDai test network
@ -129,6 +130,11 @@ export function reducer (state = initialState, action) {
}
return state
}
case 'UNHEALTHY_APP_ERROR_SHOWN': {
return Object.assign({}, state, {
stakingErrorShown: true
})
}
default:
return state
}
@ -214,6 +220,11 @@ if ($stakesPage.length) {
}
})
if (msg.epoch_end_block === 0 && !state.stakingErrorShown) {
openErrorModal('Staking DApp is currently unavailable', 'Not all functions are active at the moment. Please try again later.')
store.dispatch({ type: 'UNHEALTHY_APP_ERROR_SHOWN' })
}
updating = false
}

@ -72,6 +72,7 @@ defmodule BlockScoutWeb.StakesChannel do
%{
block_number: BlockNumber.get_max(),
epoch_number: ContractState.get(:epoch_number, 0),
epoch_end_block: ContractState.get(:epoch_end_block, 0),
staking_allowed: ContractState.get(:staking_allowed, false),
staking_token_defined: ContractState.get(:token, nil) != nil,
validator_set_apply_block: ContractState.get(:validator_set_apply_block, 0)
@ -423,11 +424,14 @@ defmodule BlockScoutWeb.StakesChannel do
assign(socket, :staking_update_data, data)
end
epoch_end_block = if Map.has_key?(data, :epoch_end_block), do: data.epoch_end_block, else: 0
push(socket, "staking_update", %{
account: socket.assigns[:account],
block_number: data.block_number,
by_set_account: by_set_account,
epoch_number: data.epoch_number,
epoch_end_block: epoch_end_block,
staking_allowed: data.staking_allowed,
staking_token_defined: data.staking_token_defined,
validator_set_apply_block: data.validator_set_apply_block,

@ -2211,7 +2211,7 @@ msgid "It's me!"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:698
#: lib/block_scout_web/channels/stakes_channel.ex:702
msgid "JSON RPC error"
msgstr ""
@ -2286,7 +2286,7 @@ msgid "Pool"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:754
#: lib/block_scout_web/channels/stakes_channel.ex:758
msgid "Pools searching is already in progress for this address"
msgstr ""
@ -2319,7 +2319,7 @@ msgid "Remove My Pool"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:795
#: lib/block_scout_web/channels/stakes_channel.ex:799
msgid "Reward calculating is already in progress for this address"
msgstr ""
@ -2399,7 +2399,7 @@ msgid "Stakes Ratio"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:798
#: lib/block_scout_web/channels/stakes_channel.ex:802
msgid "Staking epochs are not specified or not in the allowed range"
msgstr ""
@ -2494,19 +2494,19 @@ msgid "Unable to find any pools you could claim a reward from."
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:761
#: lib/block_scout_web/channels/stakes_channel.ex:808
#: lib/block_scout_web/channels/stakes_channel.ex:765
#: lib/block_scout_web/channels/stakes_channel.ex:812
msgid "Unknown address of Staking contract. Please, contact support"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:801
#: lib/block_scout_web/channels/stakes_channel.ex:805
msgid "Unknown pool staking address. Please, contact support"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:757
#: lib/block_scout_web/channels/stakes_channel.ex:804
#: lib/block_scout_web/channels/stakes_channel.ex:761
#: lib/block_scout_web/channels/stakes_channel.ex:808
msgid "Unknown staker address. Please, choose your account in MetaMask"
msgstr ""

@ -2211,7 +2211,7 @@ msgid "It's me!"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:698
#: lib/block_scout_web/channels/stakes_channel.ex:702
msgid "JSON RPC error"
msgstr ""
@ -2286,7 +2286,7 @@ msgid "Pool"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:754
#: lib/block_scout_web/channels/stakes_channel.ex:758
msgid "Pools searching is already in progress for this address"
msgstr ""
@ -2319,7 +2319,7 @@ msgid "Remove My Pool"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:795
#: lib/block_scout_web/channels/stakes_channel.ex:799
msgid "Reward calculating is already in progress for this address"
msgstr ""
@ -2399,7 +2399,7 @@ msgid "Stakes Ratio"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:798
#: lib/block_scout_web/channels/stakes_channel.ex:802
msgid "Staking epochs are not specified or not in the allowed range"
msgstr ""
@ -2494,19 +2494,19 @@ msgid "Unable to find any pools you could claim a reward from."
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:761
#: lib/block_scout_web/channels/stakes_channel.ex:808
#: lib/block_scout_web/channels/stakes_channel.ex:765
#: lib/block_scout_web/channels/stakes_channel.ex:812
msgid "Unknown address of Staking contract. Please, contact support"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:801
#: lib/block_scout_web/channels/stakes_channel.ex:805
msgid "Unknown pool staking address. Please, contact support"
msgstr ""
#, elixir-format
#: lib/block_scout_web/channels/stakes_channel.ex:757
#: lib/block_scout_web/channels/stakes_channel.ex:804
#: lib/block_scout_web/channels/stakes_channel.ex:761
#: lib/block_scout_web/channels/stakes_channel.ex:808
msgid "Unknown staker address. Please, choose your account in MetaMask"
msgstr ""

Loading…
Cancel
Save