diff --git a/apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex b/apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex index 3fe5baa64b..25a21483ec 100644 --- a/apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex +++ b/apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex @@ -119,7 +119,7 @@ <%= gettext "Gas Limit" %> - <%= format_gas_limit(@transaction.gas) %> <%= gettext("Gas") %> + <%= format_gas_limit(@transaction.gas) %> @@ -142,10 +142,10 @@ - <%= gettext "Total Gas Used" %> + <%= gettext "Gas Used" %> - - <%= cumulative_gas_used(@transaction) %> <%= gettext("Wei") %> + + <%= gas_used(@transaction) %> diff --git a/apps/explorer_web/lib/explorer_web/views/transaction_view.ex b/apps/explorer_web/lib/explorer_web/views/transaction_view.ex index a9136ae0bc..139d70b109 100644 --- a/apps/explorer_web/lib/explorer_web/views/transaction_view.ex +++ b/apps/explorer_web/lib/explorer_web/views/transaction_view.ex @@ -3,7 +3,7 @@ defmodule ExplorerWeb.TransactionView do alias Cldr.Number alias Explorer.Chain - alias Explorer.Chain.{Block, InternalTransaction, Transaction, Wei} + alias Explorer.Chain.{InternalTransaction, Receipt, Transaction, Wei} alias Explorer.ExchangeRates.Token alias ExplorerWeb.BlockView alias ExplorerWeb.ExchangeRates.USD @@ -15,11 +15,10 @@ defmodule ExplorerWeb.TransactionView do end end - def cumulative_gas_used(%Transaction{block: block}) do - case block do - nil -> gettext("Pending") - %Block{gas_used: gas_used} -> Number.to_string!(gas_used) - end + def gas_used(%Transaction{receipt: nil}), do: gettext("Pending") + + def gas_used(%Transaction{receipt: %Receipt{gas_used: gas_used}}) do + Number.to_string!(gas_used) end def formatted_fee(%Transaction{} = transaction, opts) do diff --git a/apps/explorer_web/priv/gettext/default.pot b/apps/explorer_web/priv/gettext/default.pot index 9363b9920e..90061d72fc 100644 --- a/apps/explorer_web/priv/gettext/default.pot +++ b/apps/explorer_web/priv/gettext/default.pot @@ -29,6 +29,7 @@ msgstr "" #: lib/explorer_web/templates/block/index.html.eex:20 #: lib/explorer_web/templates/block_transaction/index.html.eex:88 +#: lib/explorer_web/templates/transaction/overview.html.eex:145 msgid "Gas Used" msgstr "" @@ -129,7 +130,6 @@ msgstr "" #: lib/explorer_web/templates/block/index.html.eex:20 #: lib/explorer_web/templates/block/index.html.eex:21 #: lib/explorer_web/templates/chain/_blocks.html.eex:10 -#: lib/explorer_web/templates/transaction/overview.html.eex:122 #: lib/explorer_web/templates/transaction_internal_transaction/index.html.eex:34 msgid "Gas" msgstr "" @@ -176,7 +176,7 @@ msgstr "" msgid "Overview" msgstr "" -#: lib/explorer_web/views/transaction_view.ex:110 +#: lib/explorer_web/views/transaction_view.ex:109 msgid "Success" msgstr "" @@ -236,10 +236,10 @@ msgstr "" #: lib/explorer_web/templates/transaction/index.html.eex:21 #: lib/explorer_web/templates/transaction/overview.html.eex:65 #: lib/explorer_web/templates/transaction/overview.html.eex:81 -#: lib/explorer_web/views/transaction_view.ex:20 -#: lib/explorer_web/views/transaction_view.ex:66 -#: lib/explorer_web/views/transaction_view.ex:73 -#: lib/explorer_web/views/transaction_view.ex:109 +#: lib/explorer_web/views/transaction_view.ex:18 +#: lib/explorer_web/views/transaction_view.ex:65 +#: lib/explorer_web/views/transaction_view.ex:72 +#: lib/explorer_web/views/transaction_view.ex:108 msgid "Pending" msgstr "" @@ -302,11 +302,11 @@ msgstr "" msgid "Next Page" msgstr "" -#: lib/explorer_web/views/transaction_view.ex:107 +#: lib/explorer_web/views/transaction_view.ex:106 msgid "Failed" msgstr "" -#: lib/explorer_web/views/transaction_view.ex:108 +#: lib/explorer_web/views/transaction_view.ex:107 msgid "Out of Gas" msgstr "" @@ -375,7 +375,6 @@ msgstr "" msgid "Type" msgstr "" -#: lib/explorer_web/templates/transaction/overview.html.eex:148 #: lib/explorer_web/views/wei_helpers.ex:69 msgid "Wei" msgstr "" diff --git a/apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po index a785979d96..aa48ed530e 100644 --- a/apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po @@ -41,6 +41,7 @@ msgstr "%{year} POA Network Ltd. All rights reserved" #: lib/explorer_web/templates/block/index.html.eex:20 #: lib/explorer_web/templates/block_transaction/index.html.eex:88 +#: lib/explorer_web/templates/transaction/overview.html.eex:145 msgid "Gas Used" msgstr "Gas Used" @@ -141,7 +142,6 @@ msgstr "Cumulative Gas Used" #: lib/explorer_web/templates/block/index.html.eex:20 #: lib/explorer_web/templates/block/index.html.eex:21 #: lib/explorer_web/templates/chain/_blocks.html.eex:10 -#: lib/explorer_web/templates/transaction/overview.html.eex:122 #: lib/explorer_web/templates/transaction_internal_transaction/index.html.eex:34 msgid "Gas" msgstr "Gas" @@ -188,7 +188,7 @@ msgstr "From" msgid "Overview" msgstr "Overview" -#: lib/explorer_web/views/transaction_view.ex:110 +#: lib/explorer_web/views/transaction_view.ex:109 msgid "Success" msgstr "Success" @@ -248,10 +248,10 @@ msgstr "Showing %{count} Transactions" #: lib/explorer_web/templates/transaction/index.html.eex:21 #: lib/explorer_web/templates/transaction/overview.html.eex:65 #: lib/explorer_web/templates/transaction/overview.html.eex:81 -#: lib/explorer_web/views/transaction_view.ex:20 -#: lib/explorer_web/views/transaction_view.ex:66 -#: lib/explorer_web/views/transaction_view.ex:73 -#: lib/explorer_web/views/transaction_view.ex:109 +#: lib/explorer_web/views/transaction_view.ex:18 +#: lib/explorer_web/views/transaction_view.ex:65 +#: lib/explorer_web/views/transaction_view.ex:72 +#: lib/explorer_web/views/transaction_view.ex:108 msgid "Pending" msgstr "Pending" @@ -314,11 +314,11 @@ msgstr "" msgid "Next Page" msgstr "" -#: lib/explorer_web/views/transaction_view.ex:107 +#: lib/explorer_web/views/transaction_view.ex:106 msgid "Failed" msgstr "" -#: lib/explorer_web/views/transaction_view.ex:108 +#: lib/explorer_web/views/transaction_view.ex:107 msgid "Out of Gas" msgstr "" @@ -387,7 +387,6 @@ msgstr "" msgid "Type" msgstr "" -#: lib/explorer_web/templates/transaction/overview.html.eex:148 #: lib/explorer_web/views/wei_helpers.ex:69 msgid "Wei" msgstr ""