diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fe8e7c168..91567e98d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - [#3106](https://github.com/poanetwork/blockscout/pull/3106), [#3115](https://github.com/poanetwork/blockscout/pull/3115) - Fix verification of contracts, created from factory (from internal transaction) ### Chore +- [#3124](https://github.com/poanetwork/blockscout/pull/3124) - Display upper border for tx speed if the value cannot be calculated ## 3.1.2-beta diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex index 252df60bf5..1c01ab80a3 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex @@ -6,6 +6,7 @@ defmodule BlockScoutWeb.TransactionView do alias Explorer.{Chain, Repo} alias Explorer.Chain.Block.Reward alias Explorer.Chain.{Address, Block, InternalTransaction, Transaction, Wei} + alias Explorer.Counters.AverageBlockTime alias Explorer.ExchangeRates.Token alias Timex.Duration @@ -144,7 +145,17 @@ defmodule BlockScoutWeb.TransactionView do end def processing_time_duration(%Transaction{earliest_processing_start: nil}) do - :unknown + avg_time = AverageBlockTime.average_block_time() + + if avg_time == {:error, :disabled} do + :unknown + else + avg_time_in_secs = + avg_time + |> Duration.to_seconds() + + {:ok, "<= #{avg_time_in_secs} seconds"} + end end def processing_time_duration(%Transaction{ diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 0b467a05bf..6aa0491090 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -59,7 +59,7 @@ msgid "%{subnetwork} Explorer - BlockScout" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:236 +#: lib/block_scout_web/views/transaction_view.ex:247 msgid "(Awaiting internal transactions for status)" msgstr "" @@ -218,7 +218,7 @@ msgid "Block Number" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:32 +#: lib/block_scout_web/views/transaction_view.ex:33 msgid "Block Pending" msgstr "" @@ -355,12 +355,12 @@ msgid "Contract Byte Code" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:325 +#: lib/block_scout_web/views/transaction_view.ex:336 msgid "Contract Call" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:322 +#: lib/block_scout_web/views/transaction_view.ex:333 msgid "Contract Creation" msgstr "" @@ -558,12 +558,12 @@ msgid "During times when the network is busy (i.e during ICOs) it can take a whi msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:136 +#: lib/block_scout_web/views/transaction_view.ex:137 msgid "ERC-20 " msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:137 +#: lib/block_scout_web/views/transaction_view.ex:138 msgid "ERC-721 " msgstr "" @@ -621,12 +621,12 @@ msgid "Error trying to fetch balances." msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:240 +#: lib/block_scout_web/views/transaction_view.ex:251 msgid "Error: %{reason}" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:238 +#: lib/block_scout_web/views/transaction_view.ex:249 msgid "Error: (Awaiting internal transactions for reason)" msgstr "" @@ -776,7 +776,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:237 +#: lib/block_scout_web/views/transaction_view.ex:248 msgid "Success" msgstr "" @@ -891,7 +891,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:12 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:10 -#: lib/block_scout_web/views/transaction_view.ex:318 +#: lib/block_scout_web/views/transaction_view.ex:329 msgid "Token Transfer" msgstr "" @@ -906,7 +906,7 @@ msgstr "" #: lib/block_scout_web/views/address_view.ex:325 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:90 #: lib/block_scout_web/views/tokens/overview_view.ex:35 -#: lib/block_scout_web/views/transaction_view.ex:379 +#: lib/block_scout_web/views/transaction_view.ex:390 msgid "Token Transfers" msgstr "" @@ -922,7 +922,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:18 -#: lib/block_scout_web/views/transaction_view.ex:328 +#: lib/block_scout_web/views/transaction_view.ex:339 msgid "Transaction" msgstr "" @@ -1046,7 +1046,7 @@ msgid "Market Cap" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:221 +#: lib/block_scout_web/views/transaction_view.ex:232 msgid "Max of" msgstr "" @@ -1159,8 +1159,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/layout/_topnav.html.eex:59 -#: lib/block_scout_web/views/transaction_view.ex:235 -#: lib/block_scout_web/views/transaction_view.ex:269 +#: lib/block_scout_web/views/transaction_view.ex:246 +#: lib/block_scout_web/views/transaction_view.ex:280 msgid "Pending" msgstr "" @@ -1208,7 +1208,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 #: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:382 +#: lib/block_scout_web/views/transaction_view.ex:393 msgid "Raw Trace" msgstr "" @@ -1838,7 +1838,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: lib/block_scout_web/views/address_view.ex:324 -#: lib/block_scout_web/views/transaction_view.ex:380 +#: lib/block_scout_web/views/transaction_view.ex:391 msgid "Internal Transactions" msgstr "" @@ -1848,7 +1848,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: lib/block_scout_web/views/address_view.ex:331 -#: lib/block_scout_web/views/transaction_view.ex:381 +#: lib/block_scout_web/views/transaction_view.ex:392 msgid "Logs" msgstr "" @@ -1888,7 +1888,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:8 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:6 -#: lib/block_scout_web/views/transaction_view.ex:317 +#: lib/block_scout_web/views/transaction_view.ex:328 msgid "Token Burning" msgstr "" @@ -1900,7 +1900,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:10 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:316 +#: lib/block_scout_web/views/transaction_view.ex:327 msgid "Token Minting" msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index 0b467a05bf..6aa0491090 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -59,7 +59,7 @@ msgid "%{subnetwork} Explorer - BlockScout" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:236 +#: lib/block_scout_web/views/transaction_view.ex:247 msgid "(Awaiting internal transactions for status)" msgstr "" @@ -218,7 +218,7 @@ msgid "Block Number" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:32 +#: lib/block_scout_web/views/transaction_view.ex:33 msgid "Block Pending" msgstr "" @@ -355,12 +355,12 @@ msgid "Contract Byte Code" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:325 +#: lib/block_scout_web/views/transaction_view.ex:336 msgid "Contract Call" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:322 +#: lib/block_scout_web/views/transaction_view.ex:333 msgid "Contract Creation" msgstr "" @@ -558,12 +558,12 @@ msgid "During times when the network is busy (i.e during ICOs) it can take a whi msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:136 +#: lib/block_scout_web/views/transaction_view.ex:137 msgid "ERC-20 " msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:137 +#: lib/block_scout_web/views/transaction_view.ex:138 msgid "ERC-721 " msgstr "" @@ -621,12 +621,12 @@ msgid "Error trying to fetch balances." msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:240 +#: lib/block_scout_web/views/transaction_view.ex:251 msgid "Error: %{reason}" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:238 +#: lib/block_scout_web/views/transaction_view.ex:249 msgid "Error: (Awaiting internal transactions for reason)" msgstr "" @@ -776,7 +776,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:237 +#: lib/block_scout_web/views/transaction_view.ex:248 msgid "Success" msgstr "" @@ -891,7 +891,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:12 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:10 -#: lib/block_scout_web/views/transaction_view.ex:318 +#: lib/block_scout_web/views/transaction_view.ex:329 msgid "Token Transfer" msgstr "" @@ -906,7 +906,7 @@ msgstr "" #: lib/block_scout_web/views/address_view.ex:325 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:90 #: lib/block_scout_web/views/tokens/overview_view.ex:35 -#: lib/block_scout_web/views/transaction_view.ex:379 +#: lib/block_scout_web/views/transaction_view.ex:390 msgid "Token Transfers" msgstr "" @@ -922,7 +922,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:18 -#: lib/block_scout_web/views/transaction_view.ex:328 +#: lib/block_scout_web/views/transaction_view.ex:339 msgid "Transaction" msgstr "" @@ -1046,7 +1046,7 @@ msgid "Market Cap" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:221 +#: lib/block_scout_web/views/transaction_view.ex:232 msgid "Max of" msgstr "" @@ -1159,8 +1159,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/layout/_topnav.html.eex:59 -#: lib/block_scout_web/views/transaction_view.ex:235 -#: lib/block_scout_web/views/transaction_view.ex:269 +#: lib/block_scout_web/views/transaction_view.ex:246 +#: lib/block_scout_web/views/transaction_view.ex:280 msgid "Pending" msgstr "" @@ -1208,7 +1208,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 #: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:382 +#: lib/block_scout_web/views/transaction_view.ex:393 msgid "Raw Trace" msgstr "" @@ -1838,7 +1838,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: lib/block_scout_web/views/address_view.ex:324 -#: lib/block_scout_web/views/transaction_view.ex:380 +#: lib/block_scout_web/views/transaction_view.ex:391 msgid "Internal Transactions" msgstr "" @@ -1848,7 +1848,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: lib/block_scout_web/views/address_view.ex:331 -#: lib/block_scout_web/views/transaction_view.ex:381 +#: lib/block_scout_web/views/transaction_view.ex:392 msgid "Logs" msgstr "" @@ -1888,7 +1888,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:8 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:6 -#: lib/block_scout_web/views/transaction_view.ex:317 +#: lib/block_scout_web/views/transaction_view.ex:328 msgid "Token Burning" msgstr "" @@ -1900,7 +1900,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:10 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:316 +#: lib/block_scout_web/views/transaction_view.ex:327 msgid "Token Minting" msgstr ""