Merge branch 'master' into ab-add-index-to-consensus

pull/1509/head
Ayrat Badykov 6 years ago committed by GitHub
commit beee35cf58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex
  2. 3
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex
  3. 7
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
  4. 10
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
  5. 81
      apps/block_scout_web/priv/gettext/default.pot
  6. 81
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  7. 14
      apps/block_scout_web/test/block_scout_web/controllers/pending_transaction_controller_test.exs
  8. 15
      apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs
  9. 2
      apps/explorer/lib/explorer/chain.ex

@ -1,8 +1,9 @@
<% status = BlockScoutWeb.TransactionView.transaction_status(@transaction) %>
<div class="tile tile-type-<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %> fade-in" data-test="<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %>" data-identifier-hash="<%= @transaction.hash %>"> <div class="tile tile-type-<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %> fade-in" data-test="<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %>" data-identifier-hash="<%= @transaction.hash %>">
<div class="row" data-test="chain_transaction"> <div class="row" data-test="chain_transaction">
<div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4"> <div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4">
<span class="tile-label" data-test="transaction_type"> <%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %></span> <span class="tile-label" data-test="transaction_type"> <%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %></span>
<div class="tile-status-label ml-2 ml-md-0" data-test="transaction_status"><%= BlockScoutWeb.TransactionView.formatted_status(@transaction) %></div> <div class="tile-status-label ml-2 ml-md-0" data-test="transaction_status"><%= BlockScoutWeb.TransactionView.formatted_status(status) %></div>
</div> </div>
<div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0"> <div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0">
<%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @transaction.hash %> <%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @transaction.hash %>

@ -1,3 +1,4 @@
<% status = transaction_status(@transaction) %>
<div class="tile tile-type-<%= type_suffix(@transaction) %> fade-in <%= status_class(@transaction) %>" data-test="<%= type_suffix(@transaction) %>" data-identifier-hash="<%= @transaction.hash %>"> <div class="tile tile-type-<%= type_suffix(@transaction) %> fade-in <%= status_class(@transaction) %>" data-test="<%= type_suffix(@transaction) %>" data-identifier-hash="<%= @transaction.hash %>">
<div class="row tile-body" data-selector="token-transfers-toggle" data-test="chain_transaction"> <div class="row tile-body" data-selector="token-transfers-toggle" data-test="chain_transaction">
<div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4"> <div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4">
@ -11,7 +12,7 @@
<span class="loading-spinner-block-2"></span> <span class="loading-spinner-block-2"></span>
</div> </div>
<% end %> <% end %>
<%= formatted_status(@transaction) %> <%= formatted_status(status) %>
</span> </span>
</div> </div>
<div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0"> <div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0">

@ -1,5 +1,6 @@
<% block = @transaction.block %> <% block = @transaction.block %>
<% decoded_input_data = decoded_input_data(@transaction) %> <% decoded_input_data = decoded_input_data(@transaction) %>
<% status = transaction_status(@transaction) %>
<section data-page="transaction-details" data-page-transaction-hash="<%= @transaction %>"> <section data-page="transaction-details" data-page-transaction-hash="<%= @transaction %>">
<div class="row"> <div class="row">
<div class="col-md-12 col-lg-8"> <div class="col-md-12 col-lg-8">
@ -15,7 +16,7 @@
</div> </div>
<h1 class="card-title"><%= gettext "Transaction Details" %> </h1> <h1 class="card-title"><%= gettext "Transaction Details" %> </h1>
<%= if !block do %> <%= if status == :pending do %>
<div class="tile tile-muted d-flex justify-content-center align-items-center mb-4"> <div class="tile tile-muted d-flex justify-content-center align-items-center mb-4">
<div class="loading-spinner"> <div class="loading-spinner">
<span class="loading-spinner-block-1"></span> <span class="loading-spinner-block-1"></span>
@ -33,7 +34,7 @@
</span> </span>
<div class="d-flex flex-row justify-content-start text-muted"> <div class="d-flex flex-row justify-content-start text-muted">
<span class="mr-4 text-<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %>"><%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %></span> <span class="mr-4 text-<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %>"><%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %></span>
<span class="mr-4" data-transaction-status="<%= BlockScoutWeb.TransactionView.formatted_status(@transaction) %>"><%= BlockScoutWeb.TransactionView.formatted_status(@transaction) %></span> <span class="mr-4" data-transaction-status="<%= BlockScoutWeb.TransactionView.formatted_status(status) %>"><%= BlockScoutWeb.TransactionView.formatted_status(status) %></span>
<span class="mr-4"> <span class="mr-4">
<%= if block do %> <%= if block do %>
<span data-from-now="<%= @transaction.block.timestamp %>"></span> <span data-from-now="<%= @transaction.block.timestamp %>"></span>
@ -52,7 +53,7 @@
to: block_path(@conn, :show, block) to: block_path(@conn, :show, block)
) %> ) %>
<% else %> <% else %>
<%= gettext "Pending" %> <%= formatted_status(status) %>
<% end %> <% end %>
</dd> </dd>
</dl> </dl>

@ -113,10 +113,12 @@ defmodule BlockScoutWeb.TransactionView do
end end
end end
def formatted_status(transaction) do def transaction_status(transaction) do
transaction Chain.transaction_to_status(transaction)
|> Chain.transaction_to_status() end
|> case do
def formatted_status(status) do
case status do
:pending -> gettext("Pending") :pending -> gettext("Pending")
:awaiting_internal_transactions -> gettext("(Awaiting internal transactions for status)") :awaiting_internal_transactions -> gettext("(Awaiting internal transactions for status)")
:success -> gettext("Success") :success -> gettext("Success")

@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:121 #: lib/block_scout_web/views/transaction_view.ex:123
msgid "(Awaiting internal transactions for status)" msgid "(Awaiting internal transactions for status)"
msgstr "" msgstr ""
@ -145,7 +145,7 @@ msgid "Block %{block_number} - %{subnetwork} Explorer"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:60 #: lib/block_scout_web/templates/transaction/overview.html.eex:61
msgid "Block Confirmations" msgid "Block Confirmations"
msgstr "" msgstr ""
@ -160,7 +160,7 @@ msgid "Block Mined, awaiting import..."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:46 #: lib/block_scout_web/templates/transaction/overview.html.eex:47
msgid "Block Number" msgid "Block Number"
msgstr "" msgstr ""
@ -271,19 +271,19 @@ msgid "Contract Address"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:15 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16
#: lib/block_scout_web/views/address_view.ex:35 #: lib/block_scout_web/views/address_view.ex:35
#: lib/block_scout_web/views/address_view.ex:69 #: lib/block_scout_web/views/address_view.ex:69
msgid "Contract Address Pending" msgid "Contract Address Pending"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:198 #: lib/block_scout_web/views/transaction_view.ex:200
msgid "Contract Call" msgid "Contract Call"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:197 #: lib/block_scout_web/views/transaction_view.ex:199
msgid "Contract Creation" msgid "Contract Creation"
msgstr "" msgstr ""
@ -317,13 +317,13 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/not_found.html.eex:9 #: lib/block_scout_web/templates/transaction/not_found.html.eex:9
#: lib/block_scout_web/templates/transaction/overview.html.eex:11 #: lib/block_scout_web/templates/transaction/overview.html.eex:12
msgid "Copy Transaction Hash" msgid "Copy Transaction Hash"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/not_found.html.eex:9 #: lib/block_scout_web/templates/transaction/not_found.html.eex:9
#: lib/block_scout_web/templates/transaction/overview.html.eex:11 #: lib/block_scout_web/templates/transaction/overview.html.eex:12
msgid "Copy Txn Hash" msgid "Copy Txn Hash"
msgstr "" msgstr ""
@ -377,12 +377,12 @@ msgid "Error trying to fetch balances."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:125 #: lib/block_scout_web/views/transaction_view.ex:127
msgid "Error: %{reason}" msgid "Error: %{reason}"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:123 #: lib/block_scout_web/views/transaction_view.ex:125
msgid "Error: (Awaiting internal transactions for reason)" msgid "Error: (Awaiting internal transactions for reason)"
msgstr "" msgstr ""
@ -390,9 +390,9 @@ msgstr ""
#: lib/block_scout_web/templates/address/_balance_card.html.eex:13 #: lib/block_scout_web/templates/address/_balance_card.html.eex:13
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:16 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:16
#: lib/block_scout_web/templates/layout/app.html.eex:51 #: lib/block_scout_web/templates/layout/app.html.eex:51
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:19 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:26 #: lib/block_scout_web/templates/transaction/_tile.html.eex:27
#: lib/block_scout_web/templates/transaction/overview.html.eex:140 #: lib/block_scout_web/templates/transaction/overview.html.eex:141
#: lib/block_scout_web/views/wei_helpers.ex:72 #: lib/block_scout_web/views/wei_helpers.ex:72
msgid "Ether" msgid "Ether"
msgstr "" msgstr ""
@ -431,7 +431,7 @@ msgid "GET"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:153 #: lib/block_scout_web/templates/transaction/overview.html.eex:154
msgid "Gas" msgid "Gas"
msgstr "" msgstr ""
@ -467,7 +467,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:32 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:32
#: lib/block_scout_web/templates/transaction/_tile.html.eex:46 #: lib/block_scout_web/templates/transaction/_tile.html.eex:47
msgid "IN" msgid "IN"
msgstr "" msgstr ""
@ -495,7 +495,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:43 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:43
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:10 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:10
#: lib/block_scout_web/views/address_view.ex:270 #: lib/block_scout_web/views/address_view.ex:270
#: lib/block_scout_web/views/transaction_view.ex:251 #: lib/block_scout_web/views/transaction_view.ex:253
msgid "Internal Transactions" msgid "Internal Transactions"
msgstr "" msgstr ""
@ -513,7 +513,7 @@ msgid "Less than"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:165 #: lib/block_scout_web/templates/transaction/overview.html.eex:166
msgid "Limit" msgid "Limit"
msgstr "" msgstr ""
@ -521,7 +521,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:21 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:21
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:48 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:48
#: lib/block_scout_web/templates/transaction_log/index.html.eex:10 #: lib/block_scout_web/templates/transaction_log/index.html.eex:10
#: lib/block_scout_web/views/transaction_view.ex:252 #: lib/block_scout_web/views/transaction_view.ex:254
msgid "Logs" msgid "Logs"
msgstr "" msgstr ""
@ -609,13 +609,13 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/block/overview.html.eex:71 #: lib/block_scout_web/templates/block/overview.html.eex:71
#: lib/block_scout_web/templates/transaction/overview.html.eex:67 #: lib/block_scout_web/templates/transaction/overview.html.eex:68
msgid "Nonce" msgid "Nonce"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:30 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:30
#: lib/block_scout_web/templates/transaction/_tile.html.eex:42 #: lib/block_scout_web/templates/transaction/_tile.html.eex:43
msgid "OUT" msgid "OUT"
msgstr "" msgstr ""
@ -661,9 +661,8 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:44 #: lib/block_scout_web/templates/layout/_topnav.html.eex:44
#: lib/block_scout_web/templates/transaction/overview.html.eex:55 #: lib/block_scout_web/views/transaction_view.ex:122
#: lib/block_scout_web/views/transaction_view.ex:120 #: lib/block_scout_web/views/transaction_view.ex:156
#: lib/block_scout_web/views/transaction_view.ex:154
msgid "Pending" msgid "Pending"
msgstr "" msgstr ""
@ -768,14 +767,14 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8
#: lib/block_scout_web/views/transaction_view.ex:122 #: lib/block_scout_web/views/transaction_view.ex:124
msgid "Success" msgid "Success"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21
#: lib/block_scout_web/templates/transaction/_tile.html.eex:29 #: lib/block_scout_web/templates/transaction/_tile.html.eex:30
#: lib/block_scout_web/templates/transaction/overview.html.eex:72 #: lib/block_scout_web/templates/transaction/overview.html.eex:73
msgid "TX Fee" msgid "TX Fee"
msgstr "" msgstr ""
@ -841,7 +840,7 @@ msgid "There are no transfers for this Token."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:24 #: lib/block_scout_web/templates/transaction/overview.html.eex:25
msgid "This transaction is pending confirmation." msgid "This transaction is pending confirmation."
msgstr "" msgstr ""
@ -879,7 +878,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:4 #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/views/transaction_view.ex:196 #: lib/block_scout_web/views/transaction_view.ex:198
msgid "Token Transfer" msgid "Token Transfer"
msgstr "" msgstr ""
@ -891,7 +890,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:36 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:36
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10
#: lib/block_scout_web/views/tokens/overview_view.ex:35 #: lib/block_scout_web/views/tokens/overview_view.ex:35
#: lib/block_scout_web/views/transaction_view.ex:250 #: lib/block_scout_web/views/transaction_view.ex:252
msgid "Token Transfers" msgid "Token Transfers"
msgstr "" msgstr ""
@ -932,7 +931,7 @@ msgid "Total transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:199 #: lib/block_scout_web/views/transaction_view.ex:201
msgid "Transaction" msgid "Transaction"
msgstr "" msgstr ""
@ -948,7 +947,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/not_found.html.eex:14 #: lib/block_scout_web/templates/transaction/not_found.html.eex:14
#: lib/block_scout_web/templates/transaction/overview.html.eex:16 #: lib/block_scout_web/templates/transaction/overview.html.eex:17
msgid "Transaction Details" msgid "Transaction Details"
msgstr "" msgstr ""
@ -999,7 +998,7 @@ msgid "Unique Token"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:158 #: lib/block_scout_web/templates/transaction/overview.html.eex:159
msgid "Used" msgid "Used"
msgstr "" msgstr ""
@ -1020,7 +1019,7 @@ msgid "Validations"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:140 #: lib/block_scout_web/templates/transaction/overview.html.eex:141
msgid "Value" msgid "Value"
msgstr "" msgstr ""
@ -1050,12 +1049,12 @@ msgid "View Contract"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_tile.html.eex:70 #: lib/block_scout_web/templates/transaction/_tile.html.eex:71
msgid "View Less Transfers" msgid "View Less Transfers"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_tile.html.eex:69 #: lib/block_scout_web/templates/transaction/_tile.html.eex:70
msgid "View More Transfers" msgid "View More Transfers"
msgstr "" msgstr ""
@ -1216,7 +1215,7 @@ msgid "This API is provided for developers transitioning their applications from
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:94 #: lib/block_scout_web/templates/transaction/overview.html.eex:95
msgid "Raw Input" msgid "Raw Input"
msgstr "" msgstr ""
@ -1639,17 +1638,17 @@ msgid "Transactions Sent"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:85 #: lib/block_scout_web/templates/transaction/overview.html.eex:86
msgid "Transaction Speed" msgid "Transaction Speed"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:116 #: lib/block_scout_web/templates/transaction/overview.html.eex:117
#: lib/block_scout_web/templates/transaction/overview.html.eex:121 #: lib/block_scout_web/templates/transaction/overview.html.eex:122
msgid "Hex (Default)" msgid "Hex (Default)"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:125 #: lib/block_scout_web/templates/transaction/overview.html.eex:126
msgid "UTF-8" msgid "UTF-8"
msgstr "" msgstr ""

@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:121 #: lib/block_scout_web/views/transaction_view.ex:123
msgid "(Awaiting internal transactions for status)" msgid "(Awaiting internal transactions for status)"
msgstr "" msgstr ""
@ -145,7 +145,7 @@ msgid "Block %{block_number} - %{subnetwork} Explorer"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:60 #: lib/block_scout_web/templates/transaction/overview.html.eex:61
msgid "Block Confirmations" msgid "Block Confirmations"
msgstr "" msgstr ""
@ -160,7 +160,7 @@ msgid "Block Mined, awaiting import..."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:46 #: lib/block_scout_web/templates/transaction/overview.html.eex:47
msgid "Block Number" msgid "Block Number"
msgstr "" msgstr ""
@ -271,19 +271,19 @@ msgid "Contract Address"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:15 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16
#: lib/block_scout_web/views/address_view.ex:35 #: lib/block_scout_web/views/address_view.ex:35
#: lib/block_scout_web/views/address_view.ex:69 #: lib/block_scout_web/views/address_view.ex:69
msgid "Contract Address Pending" msgid "Contract Address Pending"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:198 #: lib/block_scout_web/views/transaction_view.ex:200
msgid "Contract Call" msgid "Contract Call"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:197 #: lib/block_scout_web/views/transaction_view.ex:199
msgid "Contract Creation" msgid "Contract Creation"
msgstr "" msgstr ""
@ -317,13 +317,13 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/not_found.html.eex:9 #: lib/block_scout_web/templates/transaction/not_found.html.eex:9
#: lib/block_scout_web/templates/transaction/overview.html.eex:11 #: lib/block_scout_web/templates/transaction/overview.html.eex:12
msgid "Copy Transaction Hash" msgid "Copy Transaction Hash"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/not_found.html.eex:9 #: lib/block_scout_web/templates/transaction/not_found.html.eex:9
#: lib/block_scout_web/templates/transaction/overview.html.eex:11 #: lib/block_scout_web/templates/transaction/overview.html.eex:12
msgid "Copy Txn Hash" msgid "Copy Txn Hash"
msgstr "" msgstr ""
@ -377,12 +377,12 @@ msgid "Error trying to fetch balances."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:125 #: lib/block_scout_web/views/transaction_view.ex:127
msgid "Error: %{reason}" msgid "Error: %{reason}"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:123 #: lib/block_scout_web/views/transaction_view.ex:125
msgid "Error: (Awaiting internal transactions for reason)" msgid "Error: (Awaiting internal transactions for reason)"
msgstr "" msgstr ""
@ -390,9 +390,9 @@ msgstr ""
#: lib/block_scout_web/templates/address/_balance_card.html.eex:13 #: lib/block_scout_web/templates/address/_balance_card.html.eex:13
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:16 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:16
#: lib/block_scout_web/templates/layout/app.html.eex:51 #: lib/block_scout_web/templates/layout/app.html.eex:51
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:19 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:26 #: lib/block_scout_web/templates/transaction/_tile.html.eex:27
#: lib/block_scout_web/templates/transaction/overview.html.eex:140 #: lib/block_scout_web/templates/transaction/overview.html.eex:141
#: lib/block_scout_web/views/wei_helpers.ex:72 #: lib/block_scout_web/views/wei_helpers.ex:72
msgid "Ether" msgid "Ether"
msgstr "POA" msgstr "POA"
@ -431,7 +431,7 @@ msgid "GET"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:153 #: lib/block_scout_web/templates/transaction/overview.html.eex:154
msgid "Gas" msgid "Gas"
msgstr "" msgstr ""
@ -467,7 +467,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:32 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:32
#: lib/block_scout_web/templates/transaction/_tile.html.eex:46 #: lib/block_scout_web/templates/transaction/_tile.html.eex:47
msgid "IN" msgid "IN"
msgstr "" msgstr ""
@ -495,7 +495,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:43 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:43
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:10 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:10
#: lib/block_scout_web/views/address_view.ex:270 #: lib/block_scout_web/views/address_view.ex:270
#: lib/block_scout_web/views/transaction_view.ex:251 #: lib/block_scout_web/views/transaction_view.ex:253
msgid "Internal Transactions" msgid "Internal Transactions"
msgstr "" msgstr ""
@ -513,7 +513,7 @@ msgid "Less than"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:165 #: lib/block_scout_web/templates/transaction/overview.html.eex:166
msgid "Limit" msgid "Limit"
msgstr "" msgstr ""
@ -521,7 +521,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:21 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:21
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:48 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:48
#: lib/block_scout_web/templates/transaction_log/index.html.eex:10 #: lib/block_scout_web/templates/transaction_log/index.html.eex:10
#: lib/block_scout_web/views/transaction_view.ex:252 #: lib/block_scout_web/views/transaction_view.ex:254
msgid "Logs" msgid "Logs"
msgstr "" msgstr ""
@ -609,13 +609,13 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/block/overview.html.eex:71 #: lib/block_scout_web/templates/block/overview.html.eex:71
#: lib/block_scout_web/templates/transaction/overview.html.eex:67 #: lib/block_scout_web/templates/transaction/overview.html.eex:68
msgid "Nonce" msgid "Nonce"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:30 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:30
#: lib/block_scout_web/templates/transaction/_tile.html.eex:42 #: lib/block_scout_web/templates/transaction/_tile.html.eex:43
msgid "OUT" msgid "OUT"
msgstr "" msgstr ""
@ -661,9 +661,8 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:44 #: lib/block_scout_web/templates/layout/_topnav.html.eex:44
#: lib/block_scout_web/templates/transaction/overview.html.eex:55 #: lib/block_scout_web/views/transaction_view.ex:122
#: lib/block_scout_web/views/transaction_view.ex:120 #: lib/block_scout_web/views/transaction_view.ex:156
#: lib/block_scout_web/views/transaction_view.ex:154
msgid "Pending" msgid "Pending"
msgstr "" msgstr ""
@ -768,14 +767,14 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8
#: lib/block_scout_web/views/transaction_view.ex:122 #: lib/block_scout_web/views/transaction_view.ex:124
msgid "Success" msgid "Success"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21
#: lib/block_scout_web/templates/transaction/_tile.html.eex:29 #: lib/block_scout_web/templates/transaction/_tile.html.eex:30
#: lib/block_scout_web/templates/transaction/overview.html.eex:72 #: lib/block_scout_web/templates/transaction/overview.html.eex:73
msgid "TX Fee" msgid "TX Fee"
msgstr "" msgstr ""
@ -841,7 +840,7 @@ msgid "There are no transfers for this Token."
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:24 #: lib/block_scout_web/templates/transaction/overview.html.eex:25
msgid "This transaction is pending confirmation." msgid "This transaction is pending confirmation."
msgstr "" msgstr ""
@ -879,7 +878,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:4 #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/views/transaction_view.ex:196 #: lib/block_scout_web/views/transaction_view.ex:198
msgid "Token Transfer" msgid "Token Transfer"
msgstr "" msgstr ""
@ -891,7 +890,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:36 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:36
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10
#: lib/block_scout_web/views/tokens/overview_view.ex:35 #: lib/block_scout_web/views/tokens/overview_view.ex:35
#: lib/block_scout_web/views/transaction_view.ex:250 #: lib/block_scout_web/views/transaction_view.ex:252
msgid "Token Transfers" msgid "Token Transfers"
msgstr "" msgstr ""
@ -932,7 +931,7 @@ msgid "Total transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:199 #: lib/block_scout_web/views/transaction_view.ex:201
msgid "Transaction" msgid "Transaction"
msgstr "" msgstr ""
@ -948,7 +947,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/not_found.html.eex:14 #: lib/block_scout_web/templates/transaction/not_found.html.eex:14
#: lib/block_scout_web/templates/transaction/overview.html.eex:16 #: lib/block_scout_web/templates/transaction/overview.html.eex:17
msgid "Transaction Details" msgid "Transaction Details"
msgstr "" msgstr ""
@ -999,7 +998,7 @@ msgid "Unique Token"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:158 #: lib/block_scout_web/templates/transaction/overview.html.eex:159
msgid "Used" msgid "Used"
msgstr "" msgstr ""
@ -1020,7 +1019,7 @@ msgid "Validations"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:140 #: lib/block_scout_web/templates/transaction/overview.html.eex:141
msgid "Value" msgid "Value"
msgstr "" msgstr ""
@ -1050,12 +1049,12 @@ msgid "View Contract"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_tile.html.eex:70 #: lib/block_scout_web/templates/transaction/_tile.html.eex:71
msgid "View Less Transfers" msgid "View Less Transfers"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_tile.html.eex:69 #: lib/block_scout_web/templates/transaction/_tile.html.eex:70
msgid "View More Transfers" msgid "View More Transfers"
msgstr "" msgstr ""
@ -1216,7 +1215,7 @@ msgid "This API is provided for developers transitioning their applications from
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:94 #: lib/block_scout_web/templates/transaction/overview.html.eex:95
msgid "Raw Input" msgid "Raw Input"
msgstr "" msgstr ""
@ -1639,17 +1638,17 @@ msgid "Transactions Sent"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:85 #: lib/block_scout_web/templates/transaction/overview.html.eex:86
msgid "Transaction Speed" msgid "Transaction Speed"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:116 #: lib/block_scout_web/templates/transaction/overview.html.eex:117
#: lib/block_scout_web/templates/transaction/overview.html.eex:121 #: lib/block_scout_web/templates/transaction/overview.html.eex:122
msgid "Hex (Default)" msgid "Hex (Default)"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:125 #: lib/block_scout_web/templates/transaction/overview.html.eex:126
msgid "UTF-8" msgid "UTF-8"
msgstr "" msgstr ""

@ -23,6 +23,20 @@ defmodule BlockScoutWeb.PendingTransactionControllerTest do
assert hd(json_response(conn, 200)["items"]) =~ to_string(transaction.hash) assert hd(json_response(conn, 200)["items"]) =~ to_string(transaction.hash)
end end
test "does not show dropped/replaced transactions", %{conn: conn} do
transaction = insert(:transaction)
dropped_replaced =
:transaction
|> insert(status: 0, error: "dropped/replaced")
|> with_block()
conn = get(conn, pending_transaction_path(BlockScoutWeb.Endpoint, :index, %{"type" => "JSON"}))
assert hd(json_response(conn, 200)["items"]) =~ to_string(transaction.hash)
refute hd(json_response(conn, 200)["items"]) =~ to_string(dropped_replaced.hash)
end
test "returns a count of pending transactions", %{conn: conn} do test "returns a count of pending transactions", %{conn: conn} do
insert(:transaction) insert(:transaction)

@ -159,7 +159,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert() |> insert()
|> Repo.preload(:block) |> Repo.preload(:block)
assert TransactionView.formatted_status(transaction) == "Pending" status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "Pending"
end end
test "with block without status (pre-Byzantium/Ethereum Class)" do test "with block without status (pre-Byzantium/Ethereum Class)" do
@ -170,7 +171,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert() |> insert()
|> with_block(block, status: nil) |> with_block(block, status: nil)
assert TransactionView.formatted_status(transaction) == "(Awaiting internal transactions for status)" status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "(Awaiting internal transactions for status)"
end end
test "with receipt with status :ok" do test "with receipt with status :ok" do
@ -181,7 +183,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert(gas: gas) |> insert(gas: gas)
|> with_block(gas_used: gas - 1, status: :ok) |> with_block(gas_used: gas - 1, status: :ok)
assert TransactionView.formatted_status(transaction) == "Success" status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "Success"
end end
test "with block with status :error without internal transactions indexed" do test "with block with status :error without internal transactions indexed" do
@ -192,7 +195,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert() |> insert()
|> with_block(block, status: :error) |> with_block(block, status: :error)
assert TransactionView.formatted_status(transaction) == "Error: (Awaiting internal transactions for reason)" status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "Error: (Awaiting internal transactions for reason)"
end end
test "with block with status :error with internal transactions indexed uses `error`" do test "with block with status :error with internal transactions indexed uses `error`" do
@ -201,7 +205,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert() |> insert()
|> with_block(status: :error, internal_transactions_indexed_at: DateTime.utc_now(), error: "Out of Gas") |> with_block(status: :error, internal_transactions_indexed_at: DateTime.utc_now(), error: "Out of Gas")
assert TransactionView.formatted_status(transaction) == "Error: Out of Gas" status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "Error: Out of Gas"
end end
end end

@ -1644,6 +1644,7 @@ defmodule Explorer.Chain do
|> page_pending_transaction(paging_options) |> page_pending_transaction(paging_options)
|> limit(^paging_options.page_size) |> limit(^paging_options.page_size)
|> pending_transactions_query() |> pending_transactions_query()
|> where([transaction], is_nil(transaction.error) or transaction.error != "dropped/replaced")
|> order_by([transaction], desc: transaction.inserted_at, desc: transaction.hash) |> order_by([transaction], desc: transaction.inserted_at, desc: transaction.hash)
|> join_associations(necessity_by_association) |> join_associations(necessity_by_association)
|> preload([{:token_transfers, [:token, :from_address, :to_address]}]) |> preload([{:token_transfers, [:token, :from_address, :to_address]}])
@ -1866,6 +1867,7 @@ defmodule Explorer.Chain do
| :success | :success
| {:error, :awaiting_internal_transactions} | {:error, :awaiting_internal_transactions}
| {:error, reason :: String.t()} | {:error, reason :: String.t()}
def transaction_to_status(%Transaction{error: "dropped/replaced"}), do: {:error, "dropped/replaced"}
def transaction_to_status(%Transaction{block_hash: nil, status: nil}), do: :pending def transaction_to_status(%Transaction{block_hash: nil, status: nil}), do: :pending
def transaction_to_status(%Transaction{status: nil}), do: :awaiting_internal_transactions def transaction_to_status(%Transaction{status: nil}), do: :awaiting_internal_transactions
def transaction_to_status(%Transaction{status: :ok}), do: :success def transaction_to_status(%Transaction{status: :ok}), do: :success

Loading…
Cancel
Save