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

@ -3,7 +3,7 @@ defmodule ExplorerWeb.TransactionView do
alias Cldr.Number alias Cldr.Number
alias Explorer.Chain alias Explorer.Chain
alias Explorer.Chain.{Block, InternalTransaction, Transaction, Wei} alias Explorer.Chain.{InternalTransaction, Receipt, Transaction, Wei}
alias Explorer.ExchangeRates.Token alias Explorer.ExchangeRates.Token
alias ExplorerWeb.BlockView alias ExplorerWeb.BlockView
alias ExplorerWeb.ExchangeRates.USD alias ExplorerWeb.ExchangeRates.USD
@ -15,11 +15,10 @@ defmodule ExplorerWeb.TransactionView do
end end
end end
def cumulative_gas_used(%Transaction{block: block}) do def gas_used(%Transaction{receipt: nil}), do: gettext("Pending")
case block do
nil -> gettext("Pending") def gas_used(%Transaction{receipt: %Receipt{gas_used: gas_used}}) do
%Block{gas_used: gas_used} -> Number.to_string!(gas_used) Number.to_string!(gas_used)
end
end end
def formatted_fee(%Transaction{} = transaction, opts) do 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/index.html.eex:20
#: lib/explorer_web/templates/block_transaction/index.html.eex:88 #: lib/explorer_web/templates/block_transaction/index.html.eex:88
#: lib/explorer_web/templates/transaction/overview.html.eex:145
msgid "Gas Used" msgid "Gas Used"
msgstr "" msgstr ""
@ -129,7 +130,6 @@ msgstr ""
#: lib/explorer_web/templates/block/index.html.eex:20 #: lib/explorer_web/templates/block/index.html.eex:20
#: lib/explorer_web/templates/block/index.html.eex:21 #: lib/explorer_web/templates/block/index.html.eex:21
#: lib/explorer_web/templates/chain/_blocks.html.eex:10 #: 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 #: lib/explorer_web/templates/transaction_internal_transaction/index.html.eex:34
msgid "Gas" msgid "Gas"
msgstr "" msgstr ""
@ -176,7 +176,7 @@ msgstr ""
msgid "Overview" msgid "Overview"
msgstr "" msgstr ""
#: lib/explorer_web/views/transaction_view.ex:110 #: lib/explorer_web/views/transaction_view.ex:109
msgid "Success" msgid "Success"
msgstr "" msgstr ""
@ -236,10 +236,10 @@ msgstr ""
#: lib/explorer_web/templates/transaction/index.html.eex:21 #: 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:65
#: lib/explorer_web/templates/transaction/overview.html.eex:81 #: lib/explorer_web/templates/transaction/overview.html.eex:81
#: lib/explorer_web/views/transaction_view.ex:20 #: lib/explorer_web/views/transaction_view.ex:18
#: lib/explorer_web/views/transaction_view.ex:66 #: lib/explorer_web/views/transaction_view.ex:65
#: lib/explorer_web/views/transaction_view.ex:73 #: lib/explorer_web/views/transaction_view.ex:72
#: lib/explorer_web/views/transaction_view.ex:109 #: lib/explorer_web/views/transaction_view.ex:108
msgid "Pending" msgid "Pending"
msgstr "" msgstr ""
@ -302,11 +302,11 @@ msgstr ""
msgid "Next Page" msgid "Next Page"
msgstr "" msgstr ""
#: lib/explorer_web/views/transaction_view.ex:107 #: lib/explorer_web/views/transaction_view.ex:106
msgid "Failed" msgid "Failed"
msgstr "" msgstr ""
#: lib/explorer_web/views/transaction_view.ex:108 #: lib/explorer_web/views/transaction_view.ex:107
msgid "Out of Gas" msgid "Out of Gas"
msgstr "" msgstr ""
@ -375,7 +375,6 @@ msgstr ""
msgid "Type" msgid "Type"
msgstr "" msgstr ""
#: lib/explorer_web/templates/transaction/overview.html.eex:148
#: lib/explorer_web/views/wei_helpers.ex:69 #: lib/explorer_web/views/wei_helpers.ex:69
msgid "Wei" msgid "Wei"
msgstr "" 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/index.html.eex:20
#: lib/explorer_web/templates/block_transaction/index.html.eex:88 #: lib/explorer_web/templates/block_transaction/index.html.eex:88
#: lib/explorer_web/templates/transaction/overview.html.eex:145
msgid "Gas Used" msgid "Gas Used"
msgstr "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:20
#: lib/explorer_web/templates/block/index.html.eex:21 #: lib/explorer_web/templates/block/index.html.eex:21
#: lib/explorer_web/templates/chain/_blocks.html.eex:10 #: 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 #: lib/explorer_web/templates/transaction_internal_transaction/index.html.eex:34
msgid "Gas" msgid "Gas"
msgstr "Gas" msgstr "Gas"
@ -188,7 +188,7 @@ msgstr "From"
msgid "Overview" msgid "Overview"
msgstr "Overview" msgstr "Overview"
#: lib/explorer_web/views/transaction_view.ex:110 #: lib/explorer_web/views/transaction_view.ex:109
msgid "Success" msgid "Success"
msgstr "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/index.html.eex:21
#: lib/explorer_web/templates/transaction/overview.html.eex:65 #: lib/explorer_web/templates/transaction/overview.html.eex:65
#: lib/explorer_web/templates/transaction/overview.html.eex:81 #: lib/explorer_web/templates/transaction/overview.html.eex:81
#: lib/explorer_web/views/transaction_view.ex:20 #: lib/explorer_web/views/transaction_view.ex:18
#: lib/explorer_web/views/transaction_view.ex:66 #: lib/explorer_web/views/transaction_view.ex:65
#: lib/explorer_web/views/transaction_view.ex:73 #: lib/explorer_web/views/transaction_view.ex:72
#: lib/explorer_web/views/transaction_view.ex:109 #: lib/explorer_web/views/transaction_view.ex:108
msgid "Pending" msgid "Pending"
msgstr "Pending" msgstr "Pending"
@ -314,11 +314,11 @@ msgstr ""
msgid "Next Page" msgid "Next Page"
msgstr "" msgstr ""
#: lib/explorer_web/views/transaction_view.ex:107 #: lib/explorer_web/views/transaction_view.ex:106
msgid "Failed" msgid "Failed"
msgstr "" msgstr ""
#: lib/explorer_web/views/transaction_view.ex:108 #: lib/explorer_web/views/transaction_view.ex:107
msgid "Out of Gas" msgid "Out of Gas"
msgstr "" msgstr ""
@ -387,7 +387,6 @@ msgstr ""
msgid "Type" msgid "Type"
msgstr "" msgstr ""
#: lib/explorer_web/templates/transaction/overview.html.eex:148
#: lib/explorer_web/views/wei_helpers.ex:69 #: lib/explorer_web/views/wei_helpers.ex:69
msgid "Wei" msgid "Wei"
msgstr "" msgstr ""

Loading…
Cancel
Save