Merge pull request #1496 from poanetwork/remove-dropped-replaced-transactions-from-pending-transaction-list

feat: remove dropped/replaced transactions in pending transactions list
pull/1518/head
Victor Baranov 6 years ago committed by GitHub
commit faf6752736
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="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">
<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 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 %>

@ -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="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">
@ -11,7 +12,7 @@
<span class="loading-spinner-block-2"></span>
</div>
<% end %>
<%= formatted_status(@transaction) %>
<%= formatted_status(status) %>
</span>
</div>
<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 %>
<% decoded_input_data = decoded_input_data(@transaction) %>
<% status = transaction_status(@transaction) %>
<section data-page="transaction-details" data-page-transaction-hash="<%= @transaction %>">
<div class="row">
<div class="col-md-12 col-lg-8">
@ -15,7 +16,7 @@
</div>
<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="loading-spinner">
<span class="loading-spinner-block-1"></span>
@ -33,7 +34,7 @@
</span>
<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" 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">
<%= if block do %>
<span data-from-now="<%= @transaction.block.timestamp %>"></span>
@ -52,7 +53,7 @@
to: block_path(@conn, :show, block)
) %>
<% else %>
<%= gettext "Pending" %>
<%= formatted_status(status) %>
<% end %>
</dd>
</dl>

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

@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout"
msgstr ""
#, 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)"
msgstr ""
@ -145,7 +145,7 @@ msgid "Block %{block_number} - %{subnetwork} Explorer"
msgstr ""
#, 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"
msgstr ""
@ -160,7 +160,7 @@ msgid "Block Mined, awaiting import..."
msgstr ""
#, 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"
msgstr ""
@ -271,19 +271,19 @@ msgid "Contract Address"
msgstr ""
#, 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:69
msgid "Contract Address Pending"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:198
#: lib/block_scout_web/views/transaction_view.ex:200
msgid "Contract Call"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:197
#: lib/block_scout_web/views/transaction_view.ex:199
msgid "Contract Creation"
msgstr ""
@ -317,13 +317,13 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
#, elixir-format
#: 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"
msgstr ""
@ -377,12 +377,12 @@ msgid "Error trying to fetch balances."
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:125
#: lib/block_scout_web/views/transaction_view.ex:127
msgid "Error: %{reason}"
msgstr ""
#, 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)"
msgstr ""
@ -390,9 +390,9 @@ msgstr ""
#: 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/layout/app.html.eex:51
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:19
#: lib/block_scout_web/templates/transaction/_tile.html.eex:26
#: lib/block_scout_web/templates/transaction/overview.html.eex:140
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:27
#: lib/block_scout_web/templates/transaction/overview.html.eex:141
#: lib/block_scout_web/views/wei_helpers.ex:72
msgid "Ether"
msgstr ""
@ -431,7 +431,7 @@ msgid "GET"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:153
#: lib/block_scout_web/templates/transaction/overview.html.eex:154
msgid "Gas"
msgstr ""
@ -467,7 +467,7 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
@ -495,7 +495,7 @@ msgstr ""
#: 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/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"
msgstr ""
@ -513,7 +513,7 @@ msgid "Less than"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:165
#: lib/block_scout_web/templates/transaction/overview.html.eex:166
msgid "Limit"
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:48
#: 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"
msgstr ""
@ -609,13 +609,13 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
#, elixir-format
#: 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"
msgstr ""
@ -661,9 +661,8 @@ msgstr ""
#, elixir-format
#: 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:120
#: lib/block_scout_web/views/transaction_view.ex:154
#: lib/block_scout_web/views/transaction_view.ex:122
#: lib/block_scout_web/views/transaction_view.ex:156
msgid "Pending"
msgstr ""
@ -768,14 +767,14 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:72
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21
#: lib/block_scout_web/templates/transaction/_tile.html.eex:30
#: lib/block_scout_web/templates/transaction/overview.html.eex:73
msgid "TX Fee"
msgstr ""
@ -841,7 +840,7 @@ msgid "There are no transfers for this Token."
msgstr ""
#, 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."
msgstr ""
@ -879,7 +878,7 @@ msgstr ""
#, elixir-format
#: 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/views/transaction_view.ex:196
#: lib/block_scout_web/views/transaction_view.ex:198
msgid "Token Transfer"
msgstr ""
@ -891,7 +890,7 @@ msgstr ""
#: 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/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"
msgstr ""
@ -932,7 +931,7 @@ msgid "Total transactions"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:199
#: lib/block_scout_web/views/transaction_view.ex:201
msgid "Transaction"
msgstr ""
@ -948,7 +947,7 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
@ -999,7 +998,7 @@ msgid "Unique Token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:158
#: lib/block_scout_web/templates/transaction/overview.html.eex:159
msgid "Used"
msgstr ""
@ -1020,7 +1019,7 @@ msgid "Validations"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:140
#: lib/block_scout_web/templates/transaction/overview.html.eex:141
msgid "Value"
msgstr ""
@ -1050,12 +1049,12 @@ msgid "View Contract"
msgstr ""
#, 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"
msgstr ""
#, 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"
msgstr ""
@ -1216,7 +1215,7 @@ msgid "This API is provided for developers transitioning their applications from
msgstr ""
#, 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"
msgstr ""
@ -1639,17 +1638,17 @@ msgid "Transactions Sent"
msgstr ""
#, 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"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:116
#: lib/block_scout_web/templates/transaction/overview.html.eex:121
#: lib/block_scout_web/templates/transaction/overview.html.eex:117
#: lib/block_scout_web/templates/transaction/overview.html.eex:122
msgid "Hex (Default)"
msgstr ""
#, 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"
msgstr ""

@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout"
msgstr ""
#, 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)"
msgstr ""
@ -145,7 +145,7 @@ msgid "Block %{block_number} - %{subnetwork} Explorer"
msgstr ""
#, 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"
msgstr ""
@ -160,7 +160,7 @@ msgid "Block Mined, awaiting import..."
msgstr ""
#, 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"
msgstr ""
@ -271,19 +271,19 @@ msgid "Contract Address"
msgstr ""
#, 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:69
msgid "Contract Address Pending"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:198
#: lib/block_scout_web/views/transaction_view.ex:200
msgid "Contract Call"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:197
#: lib/block_scout_web/views/transaction_view.ex:199
msgid "Contract Creation"
msgstr ""
@ -317,13 +317,13 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
#, elixir-format
#: 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"
msgstr ""
@ -377,12 +377,12 @@ msgid "Error trying to fetch balances."
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:125
#: lib/block_scout_web/views/transaction_view.ex:127
msgid "Error: %{reason}"
msgstr ""
#, 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)"
msgstr ""
@ -390,9 +390,9 @@ msgstr ""
#: 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/layout/app.html.eex:51
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:19
#: lib/block_scout_web/templates/transaction/_tile.html.eex:26
#: lib/block_scout_web/templates/transaction/overview.html.eex:140
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:27
#: lib/block_scout_web/templates/transaction/overview.html.eex:141
#: lib/block_scout_web/views/wei_helpers.ex:72
msgid "Ether"
msgstr "POA"
@ -431,7 +431,7 @@ msgid "GET"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:153
#: lib/block_scout_web/templates/transaction/overview.html.eex:154
msgid "Gas"
msgstr ""
@ -467,7 +467,7 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
@ -495,7 +495,7 @@ msgstr ""
#: 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/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"
msgstr ""
@ -513,7 +513,7 @@ msgid "Less than"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:165
#: lib/block_scout_web/templates/transaction/overview.html.eex:166
msgid "Limit"
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:48
#: 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"
msgstr ""
@ -609,13 +609,13 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
#, elixir-format
#: 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"
msgstr ""
@ -661,9 +661,8 @@ msgstr ""
#, elixir-format
#: 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:120
#: lib/block_scout_web/views/transaction_view.ex:154
#: lib/block_scout_web/views/transaction_view.ex:122
#: lib/block_scout_web/views/transaction_view.ex:156
msgid "Pending"
msgstr ""
@ -768,14 +767,14 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:72
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21
#: lib/block_scout_web/templates/transaction/_tile.html.eex:30
#: lib/block_scout_web/templates/transaction/overview.html.eex:73
msgid "TX Fee"
msgstr ""
@ -841,7 +840,7 @@ msgid "There are no transfers for this Token."
msgstr ""
#, 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."
msgstr ""
@ -879,7 +878,7 @@ msgstr ""
#, elixir-format
#: 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/views/transaction_view.ex:196
#: lib/block_scout_web/views/transaction_view.ex:198
msgid "Token Transfer"
msgstr ""
@ -891,7 +890,7 @@ msgstr ""
#: 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/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"
msgstr ""
@ -932,7 +931,7 @@ msgid "Total transactions"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:199
#: lib/block_scout_web/views/transaction_view.ex:201
msgid "Transaction"
msgstr ""
@ -948,7 +947,7 @@ msgstr ""
#, elixir-format
#: 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"
msgstr ""
@ -999,7 +998,7 @@ msgid "Unique Token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:158
#: lib/block_scout_web/templates/transaction/overview.html.eex:159
msgid "Used"
msgstr ""
@ -1020,7 +1019,7 @@ msgid "Validations"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:140
#: lib/block_scout_web/templates/transaction/overview.html.eex:141
msgid "Value"
msgstr ""
@ -1050,12 +1049,12 @@ msgid "View Contract"
msgstr ""
#, 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"
msgstr ""
#, 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"
msgstr ""
@ -1216,7 +1215,7 @@ msgid "This API is provided for developers transitioning their applications from
msgstr ""
#, 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"
msgstr ""
@ -1639,17 +1638,17 @@ msgid "Transactions Sent"
msgstr ""
#, 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"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:116
#: lib/block_scout_web/templates/transaction/overview.html.eex:121
#: lib/block_scout_web/templates/transaction/overview.html.eex:117
#: lib/block_scout_web/templates/transaction/overview.html.eex:122
msgid "Hex (Default)"
msgstr ""
#, 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"
msgstr ""

@ -23,6 +23,20 @@ defmodule BlockScoutWeb.PendingTransactionControllerTest do
assert hd(json_response(conn, 200)["items"]) =~ to_string(transaction.hash)
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
insert(:transaction)

@ -159,7 +159,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert()
|> Repo.preload(:block)
assert TransactionView.formatted_status(transaction) == "Pending"
status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "Pending"
end
test "with block without status (pre-Byzantium/Ethereum Class)" do
@ -170,7 +171,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert()
|> 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
test "with receipt with status :ok" do
@ -181,7 +183,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert(gas: gas)
|> 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
test "with block with status :error without internal transactions indexed" do
@ -192,7 +195,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert()
|> 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
test "with block with status :error with internal transactions indexed uses `error`" do
@ -201,7 +205,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert()
|> 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

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

Loading…
Cancel
Save