Display Gas Used on transaction page
pull/215/head
Jimmy Lauzau 7 years ago committed by GitHub
commit 07a3546b20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex
  2. 11
      apps/explorer_web/lib/explorer_web/views/transaction_view.ex
  3. 17
      apps/explorer_web/priv/gettext/default.pot
  4. 17
      apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po

@ -119,7 +119,7 @@
<%= gettext "Gas Limit" %>
</th>
<td title="<%= format_gas_limit(@transaction.gas) %>">
<%= format_gas_limit(@transaction.gas) %> <%= gettext("Gas") %>
<%= format_gas_limit(@transaction.gas) %>
</td>
</tr>
<tr>
@ -142,10 +142,10 @@
</tr>
<tr>
<th scope="row">
<%= gettext "Total Gas Used" %>
<%= gettext "Gas Used" %>
</th>
<td title="<%= cumulative_gas_used(@transaction) %>">
<%= cumulative_gas_used(@transaction) %> <%= gettext("Wei") %>
<td title="<%= gas_used(@transaction) %>">
<%= gas_used(@transaction) %>
</td>
</tr>
<tr>

@ -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

@ -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 ""

@ -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 ""

Loading…
Cancel
Save