Merge remote-tracking branch 'origin/master' into ab-hide-percentage-of-marketcap

pull/2818/head
Ayrat Badykov 5 years ago
commit 4018a7732c
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 1
      CHANGELOG.md
  2. 44
      apps/block_scout_web/assets/js/pages/address.js
  3. 8
      apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_controller.ex
  4. 8
      apps/block_scout_web/lib/block_scout_web/controllers/address_contract_controller.ex
  5. 42
      apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex
  6. 7
      apps/block_scout_web/lib/block_scout_web/controllers/address_decompiled_contract_controller.ex
  7. 6
      apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex
  8. 6
      apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex
  9. 7
      apps/block_scout_web/lib/block_scout_web/controllers/address_read_contract_controller.ex
  10. 6
      apps/block_scout_web/lib/block_scout_web/controllers/address_token_controller.ex
  11. 7
      apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex
  12. 9
      apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex
  13. 7
      apps/block_scout_web/lib/block_scout_web/controllers/address_validation_controller.ex
  14. 14
      apps/block_scout_web/lib/block_scout_web/templates/address/_tabs.html.eex
  15. 29
      apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex
  16. 6
      apps/block_scout_web/lib/block_scout_web/views/address_view.ex
  17. 2
      apps/block_scout_web/lib/block_scout_web/web_router.ex
  18. 62
      apps/block_scout_web/priv/gettext/default.pot
  19. 62
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  20. 1
      apps/block_scout_web/test/block_scout_web/controllers/address_contract_controller_test.exs
  21. 13
      apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs
  22. 1
      apps/block_scout_web/test/block_scout_web/controllers/address_read_contract_controller_test.exs
  23. 2
      apps/explorer/lib/explorer/chain.ex

@ -1,6 +1,7 @@
## Current
### Features
- [#2787](https://github.com/poanetwork/blockscout/pull/2787) - async fetching of address counters
- [#2791](https://github.com/poanetwork/blockscout/pull/2791) - add ipc client
- [#2449](https://github.com/poanetwork/blockscout/pull/2449) - add ability to send notification events through postgres notify

@ -18,7 +18,8 @@ export const initialState = {
balanceCard: null,
fetchedCoinBalanceBlockNumber: null,
transactionCount: null,
validationCount: null
validationCount: null,
countersFetched: false
}
export function reducer (state = initialState, action) {
@ -34,6 +35,13 @@ export function reducer (state = initialState, action) {
channelDisconnected: true
})
}
case 'COUNTERS_FETCHED': {
return Object.assign({}, state, {
transactionCount: action.transactionCount,
validationCount: action.validationCount,
countersFetched: true
})
}
case 'RECEIVED_NEW_BLOCK': {
if (state.channelDisconnected) return state
@ -81,8 +89,15 @@ const elements = {
return { transactionCount: numeral($el.text()).value() }
},
render ($el, state, oldState) {
if (oldState.transactionCount === state.transactionCount) return
$el.empty().append(numeral(state.transactionCount).format())
if (state.countersFetched && state.transactionCount) {
if (oldState.transactionCount === state.transactionCount) return
$el.empty().append('>= ' + numeral(state.transactionCount).format() + ' Transactions')
$el.show()
$el.parent('.address-detail-item').removeAttr('style')
} else {
$el.hide()
$el.parent('.address-detail-item').css('display', 'none')
}
}
},
'[data-selector="fetched-coin-balance-block-number"]': {
@ -99,12 +114,29 @@ const elements = {
return { validationCount: numeral($el.text()).value() }
},
render ($el, state, oldState) {
if (oldState.validationCount === state.validationCount) return
$el.empty().append(numeral(state.validationCount).format())
if (state.countersFetched && state.validationCount) {
if (oldState.validationCount === state.validationCount) return
$el.empty().append(numeral(state.validationCount).format() + ' Blocks Validated')
$el.show()
} else {
$el.hide()
}
}
}
}
function loadCounters (store) {
const $element = $('[data-async-counters]')
const path = $element.data().asyncCounters
function fetchCounters () {
$.getJSON(path)
.done(response => store.dispatch(Object.assign({type: 'COUNTERS_FETCHED'}, humps.camelizeKeys(response))))
}
fetchCounters()
}
const $addressDetailsPage = $('[data-page="address-details"]')
if ($addressDetailsPage.length) {
const store = createStore(reducer)
@ -149,4 +181,6 @@ if ($addressDetailsPage.length) {
type: 'RECEIVED_UPDATED_BALANCE',
msg: humps.camelizeKeys(msg)
}))
loadCounters(store)
}

@ -5,7 +5,6 @@ defmodule BlockScoutWeb.AddressCoinBalanceController do
use BlockScoutWeb, :controller
import BlockScoutWeb.AddressController, only: [transaction_and_validation_count: 1]
import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1]
alias BlockScoutWeb.AddressCoinBalanceView
@ -60,15 +59,12 @@ defmodule BlockScoutWeb.AddressCoinBalanceController do
def index(conn, %{"address_id" => address_hash_string}) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash) do
{transaction_count, validation_count} = transaction_and_validation_count(address_hash)
render(conn, "index.html",
address: address,
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
transaction_count: transaction_count,
validation_count: validation_count,
current_path: current_path(conn)
current_path: current_path(conn),
counters_path: address_path(conn, :address_counters, %{"id" => to_string(address_hash)})
)
else
:error ->

@ -1,8 +1,7 @@
# credo:disable-for-this-file
defmodule BlockScoutWeb.AddressContractController do
use BlockScoutWeb, :controller
import BlockScoutWeb.AddressController, only: [transaction_and_validation_count: 1]
alias Explorer.{Chain, Market}
alias Explorer.ExchangeRates.Token
alias Indexer.Fetcher.CoinBalanceOnDemand
@ -20,16 +19,13 @@ defmodule BlockScoutWeb.AddressContractController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.find_contract_address(address_hash, address_options, true) do
{transaction_count, validation_count} = transaction_and_validation_count(address_hash)
render(
conn,
"index.html",
address: address,
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
transaction_count: transaction_count,
validation_count: validation_count
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string})
)
else
:error ->

@ -5,7 +5,6 @@ defmodule BlockScoutWeb.AddressController do
alias BlockScoutWeb.AddressView
alias Explorer.{Chain, Market}
alias Explorer.Chain.Hash
alias Explorer.ExchangeRates.Token
alias Phoenix.View
@ -68,19 +67,30 @@ defmodule BlockScoutWeb.AddressController do
redirect(conn, to: address_transaction_path(conn, :index, id))
end
def transaction_and_validation_count(%Hash{byte_count: unquote(Hash.Address.byte_count())} = address_hash) do
def address_counters(conn, %{"id" => address_hash_string}) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash) do
{transaction_count, validation_count} = transaction_and_validation_count(address)
json(conn, %{transaction_count: transaction_count, validation_count: validation_count})
else
_ -> not_found(conn)
end
end
defp transaction_and_validation_count(address) do
transaction_count_task =
Task.async(fn ->
transaction_count(address_hash)
transaction_count(address)
end)
validation_count_task =
Task.async(fn ->
validation_count(address_hash)
validation_count(address)
end)
[transaction_count_task, validation_count_task]
|> Task.yield_many(:timer.seconds(30))
|> Task.yield_many(:timer.seconds(60))
|> Enum.map(fn {_task, res} ->
case res do
{:ok, result} ->
@ -96,11 +106,25 @@ defmodule BlockScoutWeb.AddressController do
|> List.to_tuple()
end
def transaction_count(%Hash{byte_count: unquote(Hash.Address.byte_count())} = address_hash) do
Chain.total_transactions_sent_by_address(address_hash)
defp transaction_count(address) do
if contract?(address) do
incoming_transaction_count = Chain.address_to_incoming_transaction_count(address.hash)
if incoming_transaction_count == 0 do
Chain.total_transactions_sent_by_address(address.hash)
else
incoming_transaction_count
end
else
Chain.total_transactions_sent_by_address(address.hash)
end
end
def validation_count(%Hash{byte_count: unquote(Hash.Address.byte_count())} = address_hash) do
Chain.address_to_validation_count(address_hash)
defp validation_count(address) do
Chain.address_to_validation_count(address.hash)
end
defp contract?(%{contract_code: nil}), do: false
defp contract?(%{contract_code: _}), do: true
end

@ -1,8 +1,6 @@
defmodule BlockScoutWeb.AddressDecompiledContractController do
use BlockScoutWeb, :controller
import BlockScoutWeb.AddressController, only: [transaction_and_validation_count: 1]
alias Explorer.{Chain, Market}
alias Explorer.ExchangeRates.Token
alias Indexer.Fetcher.CoinBalanceOnDemand
@ -10,16 +8,13 @@ defmodule BlockScoutWeb.AddressDecompiledContractController do
def index(conn, %{"address_id" => address_hash_string}) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.find_decompiled_contract_address(address_hash) do
{transaction_count, validation_count} = transaction_and_validation_count(address_hash)
render(
conn,
"index.html",
address: address,
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
transaction_count: transaction_count,
validation_count: validation_count
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string})
)
else
:error ->

@ -5,7 +5,6 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do
use BlockScoutWeb, :controller
import BlockScoutWeb.AddressController, only: [transaction_and_validation_count: 1]
import BlockScoutWeb.Chain, only: [current_filter: 1, paging_options: 1, next_page_params: 3, split_list_by_page: 1]
alias BlockScoutWeb.InternalTransactionView
@ -63,8 +62,6 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do
def index(conn, %{"address_id" => address_hash_string} = params) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash) do
{transaction_count, validation_count} = transaction_and_validation_count(address_hash)
render(
conn,
"index.html",
@ -73,8 +70,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do
current_path: current_path(conn),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
filter: params["filter"],
transaction_count: transaction_count,
validation_count: validation_count
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string})
)
else
:error ->

@ -3,7 +3,6 @@ defmodule BlockScoutWeb.AddressLogsController do
Manages events logs tab.
"""
import BlockScoutWeb.AddressController, only: [transaction_and_validation_count: 1]
import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1]
alias BlockScoutWeb.AddressLogsView
@ -56,8 +55,6 @@ defmodule BlockScoutWeb.AddressLogsController do
def index(conn, %{"address_id" => address_hash_string}) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash) do
{transaction_count, validation_count} = transaction_and_validation_count(address_hash)
render(
conn,
"index.html",
@ -65,8 +62,7 @@ defmodule BlockScoutWeb.AddressLogsController do
current_path: current_path(conn),
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
transaction_count: transaction_count,
validation_count: validation_count
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string})
)
else
_ ->

@ -12,8 +12,6 @@ defmodule BlockScoutWeb.AddressReadContractController do
alias Explorer.ExchangeRates.Token
alias Indexer.Fetcher.CoinBalanceOnDemand
import BlockScoutWeb.AddressController, only: [transaction_and_validation_count: 1]
def index(conn, %{"address_id" => address_hash_string}) do
address_options = [
necessity_by_association: %{
@ -28,16 +26,13 @@ defmodule BlockScoutWeb.AddressReadContractController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.find_contract_address(address_hash, address_options, true),
false <- is_nil(address.smart_contract) do
{transaction_count, validation_count} = transaction_and_validation_count(address_hash)
render(
conn,
"index.html",
address: address,
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
transaction_count: transaction_count,
validation_count: validation_count
counters_path: address_path(conn, :address_counters, %{"id" => to_string(address_hash)})
)
else
_ ->

@ -1,7 +1,6 @@
defmodule BlockScoutWeb.AddressTokenController do
use BlockScoutWeb, :controller
import BlockScoutWeb.AddressController, only: [transaction_and_validation_count: 1]
import BlockScoutWeb.Chain, only: [next_page_params: 3, paging_options: 1, split_list_by_page: 1]
alias BlockScoutWeb.AddressTokenView
@ -57,8 +56,6 @@ defmodule BlockScoutWeb.AddressTokenController do
def index(conn, %{"address_id" => address_hash_string} = _params) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash) do
{transaction_count, validation_count} = transaction_and_validation_count(address_hash)
render(
conn,
"index.html",
@ -66,8 +63,7 @@ defmodule BlockScoutWeb.AddressTokenController do
current_path: current_path(conn),
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
transaction_count: transaction_count,
validation_count: validation_count
counters_path: address_path(conn, :address_counters, %{"id" => to_string(address_hash)})
)
else
:error ->

@ -7,8 +7,6 @@ defmodule BlockScoutWeb.AddressTokenTransferController do
alias Indexer.Fetcher.CoinBalanceOnDemand
alias Phoenix.View
import BlockScoutWeb.AddressController, only: [transaction_and_validation_count: 1]
import BlockScoutWeb.Chain,
only: [next_page_params: 3, paging_options: 1, split_list_by_page: 1]
@ -77,8 +75,6 @@ defmodule BlockScoutWeb.AddressTokenTransferController do
{:ok, token_hash} <- Chain.string_to_address_hash(token_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash),
{:ok, token} <- Chain.token_from_address_hash(token_hash) do
{transaction_count, validation_count} = transaction_and_validation_count(address_hash)
render(
conn,
"index.html",
@ -87,8 +83,7 @@ defmodule BlockScoutWeb.AddressTokenTransferController do
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
current_path: current_path(conn),
token: token,
transaction_count: transaction_count,
validation_count: validation_count
counters_path: address_path(conn, :address_counters, %{"id" => to_string(address_hash)})
)
else
:error ->

@ -5,7 +5,6 @@ defmodule BlockScoutWeb.AddressTransactionController do
use BlockScoutWeb, :controller
import BlockScoutWeb.AddressController, only: [transaction_and_validation_count: 1]
import BlockScoutWeb.Chain, only: [current_filter: 1, paging_options: 1, next_page_params: 3, split_list_by_page: 1]
alias BlockScoutWeb.TransactionView
@ -98,8 +97,6 @@ defmodule BlockScoutWeb.AddressTransactionController do
def index(conn, %{"address_id" => address_hash_string} = params) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash) do
{transaction_count, validation_count} = transaction_and_validation_count(address_hash)
render(
conn,
"index.html",
@ -107,8 +104,7 @@ defmodule BlockScoutWeb.AddressTransactionController do
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
filter: params["filter"],
transaction_count: transaction_count,
validation_count: validation_count,
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}),
current_path: current_path(conn)
)
else
@ -128,8 +124,7 @@ defmodule BlockScoutWeb.AddressTransactionController do
coin_balance_status: nil,
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
filter: params["filter"],
transaction_count: 0,
validation_count: 0,
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}),
current_path: current_path(conn)
)

@ -4,8 +4,6 @@ defmodule BlockScoutWeb.AddressValidationController do
"""
use BlockScoutWeb, :controller
import BlockScoutWeb.AddressController, only: [transaction_and_validation_count: 1]
import BlockScoutWeb.Chain,
only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1]
@ -69,16 +67,13 @@ defmodule BlockScoutWeb.AddressValidationController do
def index(conn, %{"address_id" => address_hash_string}) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.find_or_insert_address_from_hash(address_hash) do
{transaction_count, validation_count} = transaction_and_validation_count(address_hash)
render(
conn,
"index.html",
address: address,
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
current_path: current_path(conn),
transaction_count: transaction_count,
validation_count: validation_count,
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null()
)
else

@ -27,14 +27,12 @@
class: "card-tab #{tab_status("logs", @conn.request_path)}",
to: address_logs_path(@conn, :index, @address.hash)
) %>
<%= if BlockScoutWeb.AddressView.validator?(@validation_count) do %>
<%= link(
gettext("Blocks Validated"),
class: "card-tab #{tab_status("validations", @conn.request_path)}",
"data-test": "validations_tab_link",
to: address_validation_path(@conn, :index, @address.hash)
) %>
<% end %>
<%= link(
gettext("Blocks Validated"),
class: "card-tab #{tab_status("validations", @conn.request_path)}",
"data-test": "validations_tab_link",
to: address_validation_path(@conn, :index, @address.hash)
) %>
<%= if contract?(@address) do %>
<%= link(
to: address_contract_path(@conn, :index, @address.hash),

@ -1,4 +1,4 @@
<section class="address-overview" data-page="address-details" data-page-address-hash="<%= @address.hash %>">
<section class="address-overview" data-page="address-details" data-page-address-hash="<%= @address.hash %>" data-async-counters="<%= @counters_path %>">
<div class="row">
<!-- Address details -->
<div class="card-section col-md-12 col-lg-8 pr-0-md">
@ -70,33 +70,20 @@
</span>
<% end %>
<span>
<span class="address-detail-item">
<%= if contract?(@address) do %>
<%= gettext(">=") %>
<span data-selector="transaction-count">
<%= incoming_transaction_count(@address.hash) %>
</span>
<%= gettext("Incoming Transactions") %>
<% else %>
<span data-selector="transaction-count">
<%= BlockScoutWeb.Cldr.Number.to_string!(@transaction_count, format: "#,###") %>
</span>
<%= gettext("Transactions Sent") %>
<% end %>
<span class="address-detail-item" style="display: none">
<span data-selector="transaction-count">
</span>
</span>
<%= if @address.fetched_coin_balance_block_number do %>
<span class="address-detail-item">
<%= gettext("Last Balance Update: Block #") %><span data-selector="fetched-coin-balance-block-number"><%= @address.fetched_coin_balance_block_number %></span>
</span>
<% end %>
<%= if validator?(@validation_count) do %>
<span class="address-detail-item">
<span data-selector="validation-count">
<%= BlockScoutWeb.Cldr.Number.to_string!(@validation_count, format: "#,###") %>
</span>
<%= gettext("Blocks Validated") %>
<span class="address-detail-item">
<span data-selector="validation-count">
</span>
<% end %>
</span>
</span>
</div>
<% from_address_hash = from_address_hash(@address) %>

@ -223,12 +223,6 @@ defmodule BlockScoutWeb.AddressView do
def token_title(%Token{name: name, symbol: symbol}), do: "#{name} (#{symbol})"
def incoming_transaction_count(address_hash) do
address_hash
|> Chain.address_to_incoming_transaction_count()
|> BlockScoutWeb.Cldr.Number.to_string!(format: "#,###")
end
def trimmed_hash(%Hash{} = hash) do
string_hash = to_string(hash)
"#{String.slice(string_hash, 0..5)}#{String.slice(string_hash, -6..-1)}"

@ -208,6 +208,8 @@ defmodule BlockScoutWeb.WebRouter do
as: :smart_contract
)
get("/address_counters", AddressController, :address_counters)
get("/search", ChainController, :search)
get("/search_logs", AddressLogsController, :search_logs)

@ -76,11 +76,6 @@ msgstr ""
msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:75
msgid ">="
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:73
msgid "A string with the name of the action to be invoked."
@ -470,7 +465,7 @@ msgid "Create2"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:107
#: lib/block_scout_web/templates/address/overview.html.eex:94
msgid "Created by"
msgstr ""
@ -502,7 +497,7 @@ msgid "Decoded"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:52
#: lib/block_scout_web/templates/address/_tabs.html.eex:50
msgid "Decompiled code"
msgstr ""
@ -634,7 +629,7 @@ msgid "Error: (Awaiting internal transactions for reason)"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:120
#: lib/block_scout_web/templates/address/overview.html.eex:107
msgid "Error: Could not determine contract creator."
msgstr ""
@ -922,11 +917,6 @@ msgstr ""
msgid "If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:79
msgid "Incoming Transactions"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:55
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:108
@ -963,7 +953,7 @@ msgid "It could still be in the TX Pool of a different node, waiting to be broad
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:89
#: lib/block_scout_web/templates/address/overview.html.eex:79
msgid "Last Balance Update: Block #"
msgstr ""
@ -1037,8 +1027,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:31
#: lib/block_scout_web/templates/layout/app.html.eex:60
#: lib/block_scout_web/views/address_view.ex:125
#: lib/block_scout_web/views/address_view.ex:125
#: lib/block_scout_web/views/address_view.ex:121
#: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap"
msgstr ""
@ -1177,7 +1167,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:33
#: lib/block_scout_web/templates/address/overview.html.eex:144
#: lib/block_scout_web/templates/address/overview.html.eex:131
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:51
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:93
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36
@ -1488,12 +1478,7 @@ msgid "Transaction Speed"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:84
msgid "Transactions Sent"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tile.html.eex:33
#: lib/block_scout_web/templates/address/_tile.html.eex:31
msgid "Transactions sent"
msgstr ""
@ -1665,7 +1650,7 @@ msgid "Yes"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:112
#: lib/block_scout_web/templates/address/overview.html.eex:99
msgid "at"
msgstr ""
@ -1723,8 +1708,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37
#: lib/block_scout_web/templates/address/overview.html.eex:145
#: lib/block_scout_web/templates/address/overview.html.eex:153
#: lib/block_scout_web/templates/address/overview.html.eex:132
#: lib/block_scout_web/templates/address/overview.html.eex:140
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:94
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:102
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106
@ -1803,31 +1788,30 @@ msgid "Copy Txn Input"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:32
#: lib/block_scout_web/templates/address/overview.html.eex:97
#: lib/block_scout_web/templates/address/_tabs.html.eex:31
#: lib/block_scout_web/templates/address_validation/index.html.eex:13
#: lib/block_scout_web/views/address_view.ex:317
#: lib/block_scout_web/views/address_view.ex:307
msgid "Blocks Validated"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:42
#: lib/block_scout_web/templates/address/_tabs.html.eex:40
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149
#: lib/block_scout_web/views/address_view.ex:313
#: lib/block_scout_web/views/address_view.ex:303
msgid "Code"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:20
#: lib/block_scout_web/views/address_view.ex:316
#: lib/block_scout_web/views/address_view.ex:306
msgid "Coin Balance History"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/address_view.ex:314
#: lib/block_scout_web/views/address_view.ex:304
msgid "Decompiled Code"
msgstr ""
@ -1836,7 +1820,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6
#: lib/block_scout_web/views/address_view.ex:312
#: lib/block_scout_web/views/address_view.ex:302
#: lib/block_scout_web/views/transaction_view.ex:314
msgid "Internal Transactions"
msgstr ""
@ -1846,15 +1830,15 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/index.html.eex:8
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8
#: lib/block_scout_web/views/address_view.ex:318
#: lib/block_scout_web/views/address_view.ex:308
#: lib/block_scout_web/views/transaction_view.ex:315
msgid "Logs"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:58
#: lib/block_scout_web/templates/address/_tabs.html.eex:56
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25
#: lib/block_scout_web/views/address_view.ex:315
#: lib/block_scout_web/views/address_view.ex:305
#: lib/block_scout_web/views/tokens/overview_view.ex:37
msgid "Read Contract"
msgstr ""
@ -1863,7 +1847,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:8
#: lib/block_scout_web/templates/address_token/index.html.eex:8
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9
#: lib/block_scout_web/views/address_view.ex:310
#: lib/block_scout_web/views/address_view.ex:300
msgid "Tokens"
msgstr ""
@ -1874,6 +1858,6 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:145
#: lib/block_scout_web/templates/layout/_topnav.html.eex:50
#: lib/block_scout_web/views/address_view.ex:311
#: lib/block_scout_web/views/address_view.ex:301
msgid "Transactions"
msgstr ""

@ -76,11 +76,6 @@ msgstr ""
msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:75
msgid ">="
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:73
msgid "A string with the name of the action to be invoked."
@ -470,7 +465,7 @@ msgid "Create2"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:107
#: lib/block_scout_web/templates/address/overview.html.eex:94
msgid "Created by"
msgstr ""
@ -502,7 +497,7 @@ msgid "Decoded"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:52
#: lib/block_scout_web/templates/address/_tabs.html.eex:50
msgid "Decompiled code"
msgstr ""
@ -634,7 +629,7 @@ msgid "Error: (Awaiting internal transactions for reason)"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:120
#: lib/block_scout_web/templates/address/overview.html.eex:107
msgid "Error: Could not determine contract creator."
msgstr ""
@ -922,11 +917,6 @@ msgstr ""
msgid "If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:79
msgid "Incoming Transactions"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:55
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:108
@ -963,7 +953,7 @@ msgid "It could still be in the TX Pool of a different node, waiting to be broad
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:89
#: lib/block_scout_web/templates/address/overview.html.eex:79
msgid "Last Balance Update: Block #"
msgstr ""
@ -1037,8 +1027,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:31
#: lib/block_scout_web/templates/layout/app.html.eex:60
#: lib/block_scout_web/views/address_view.ex:125
#: lib/block_scout_web/views/address_view.ex:125
#: lib/block_scout_web/views/address_view.ex:121
#: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap"
msgstr ""
@ -1177,7 +1167,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:33
#: lib/block_scout_web/templates/address/overview.html.eex:144
#: lib/block_scout_web/templates/address/overview.html.eex:131
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:51
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:93
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36
@ -1488,12 +1478,7 @@ msgid "Transaction Speed"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:84
msgid "Transactions Sent"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tile.html.eex:33
#: lib/block_scout_web/templates/address/_tile.html.eex:31
msgid "Transactions sent"
msgstr ""
@ -1665,7 +1650,7 @@ msgid "Yes"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:112
#: lib/block_scout_web/templates/address/overview.html.eex:99
msgid "at"
msgstr ""
@ -1723,8 +1708,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37
#: lib/block_scout_web/templates/address/overview.html.eex:145
#: lib/block_scout_web/templates/address/overview.html.eex:153
#: lib/block_scout_web/templates/address/overview.html.eex:132
#: lib/block_scout_web/templates/address/overview.html.eex:140
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:94
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:102
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106
@ -1803,31 +1788,30 @@ msgid "Copy Txn Input"
msgstr ""
#, elixir-format, fuzzy
#: lib/block_scout_web/templates/address/_tabs.html.eex:32
#: lib/block_scout_web/templates/address/overview.html.eex:97
#: lib/block_scout_web/templates/address/_tabs.html.eex:31
#: lib/block_scout_web/templates/address_validation/index.html.eex:13
#: lib/block_scout_web/views/address_view.ex:317
#: lib/block_scout_web/views/address_view.ex:307
msgid "Blocks Validated"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:42
#: lib/block_scout_web/templates/address/_tabs.html.eex:40
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149
#: lib/block_scout_web/views/address_view.ex:313
#: lib/block_scout_web/views/address_view.ex:303
msgid "Code"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:20
#: lib/block_scout_web/views/address_view.ex:316
#: lib/block_scout_web/views/address_view.ex:306
msgid "Coin Balance History"
msgstr ""
#, elixir-format, fuzzy
#: lib/block_scout_web/views/address_view.ex:314
#: lib/block_scout_web/views/address_view.ex:304
msgid "Decompiled Code"
msgstr ""
@ -1836,7 +1820,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6
#: lib/block_scout_web/views/address_view.ex:312
#: lib/block_scout_web/views/address_view.ex:302
#: lib/block_scout_web/views/transaction_view.ex:314
msgid "Internal Transactions"
msgstr ""
@ -1846,15 +1830,15 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/index.html.eex:8
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8
#: lib/block_scout_web/views/address_view.ex:318
#: lib/block_scout_web/views/address_view.ex:308
#: lib/block_scout_web/views/transaction_view.ex:315
msgid "Logs"
msgstr ""
#, elixir-format, fuzzy
#: lib/block_scout_web/templates/address/_tabs.html.eex:58
#: lib/block_scout_web/templates/address/_tabs.html.eex:56
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25
#: lib/block_scout_web/views/address_view.ex:315
#: lib/block_scout_web/views/address_view.ex:305
#: lib/block_scout_web/views/tokens/overview_view.ex:37
msgid "Read Contract"
msgstr ""
@ -1863,7 +1847,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:8
#: lib/block_scout_web/templates/address_token/index.html.eex:8
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9
#: lib/block_scout_web/views/address_view.ex:310
#: lib/block_scout_web/views/address_view.ex:300
msgid "Tokens"
msgstr ""
@ -1874,6 +1858,6 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:145
#: lib/block_scout_web/templates/layout/_topnav.html.eex:50
#: lib/block_scout_web/views/address_view.ex:311
#: lib/block_scout_web/views/address_view.ex:301
msgid "Transactions"
msgstr ""

@ -49,7 +49,6 @@ defmodule BlockScoutWeb.AddressContractControllerTest do
assert html_response(conn, 200)
assert address.hash == conn.assigns.address.hash
assert %Token{} = conn.assigns.exchange_rate
assert conn.assigns.transaction_count
end
end
end

@ -45,4 +45,17 @@ defmodule BlockScoutWeb.AddressControllerTest do
assert redirected_to(conn) =~ "/address/0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed/transactions"
end
end
describe "GET address_counters/2" do
test "returns address counters" do
address = insert(:address)
conn = get(conn, "/address_counters", %{"id" => to_string(address.hash)})
assert conn.status == 200
{:ok, response} = Jason.decode(conn.resp_body)
assert %{"transaction_count" => 0, "validation_count" => 0} == response
end
end
end

@ -37,7 +37,6 @@ defmodule BlockScoutWeb.AddressReadContractControllerTest do
assert html_response(conn, 200)
assert contract_address.hash == conn.assigns.address.hash
assert %Token{} = conn.assigns.exchange_rate
assert conn.assigns.transaction_count
end
test "returns not found for an unverified contract", %{conn: conn} do

@ -211,7 +211,7 @@ defmodule Explorer.Chain do
last_nonce =
address_hash
|> Transaction.last_nonce_by_address_query()
|> Repo.one()
|> Repo.one(timeout: :infinity)
case last_nonce do
nil -> 0

Loading…
Cancel
Save