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 ## Current
### Features ### 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 - [#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 - [#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, balanceCard: null,
fetchedCoinBalanceBlockNumber: null, fetchedCoinBalanceBlockNumber: null,
transactionCount: null, transactionCount: null,
validationCount: null validationCount: null,
countersFetched: false
} }
export function reducer (state = initialState, action) { export function reducer (state = initialState, action) {
@ -34,6 +35,13 @@ export function reducer (state = initialState, action) {
channelDisconnected: true channelDisconnected: true
}) })
} }
case 'COUNTERS_FETCHED': {
return Object.assign({}, state, {
transactionCount: action.transactionCount,
validationCount: action.validationCount,
countersFetched: true
})
}
case 'RECEIVED_NEW_BLOCK': { case 'RECEIVED_NEW_BLOCK': {
if (state.channelDisconnected) return state if (state.channelDisconnected) return state
@ -81,8 +89,15 @@ const elements = {
return { transactionCount: numeral($el.text()).value() } return { transactionCount: numeral($el.text()).value() }
}, },
render ($el, state, oldState) { render ($el, state, oldState) {
if (oldState.transactionCount === state.transactionCount) return if (state.countersFetched && state.transactionCount) {
$el.empty().append(numeral(state.transactionCount).format()) 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"]': { '[data-selector="fetched-coin-balance-block-number"]': {
@ -99,12 +114,29 @@ const elements = {
return { validationCount: numeral($el.text()).value() } return { validationCount: numeral($el.text()).value() }
}, },
render ($el, state, oldState) { render ($el, state, oldState) {
if (oldState.validationCount === state.validationCount) return if (state.countersFetched && state.validationCount) {
$el.empty().append(numeral(state.validationCount).format()) 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"]') const $addressDetailsPage = $('[data-page="address-details"]')
if ($addressDetailsPage.length) { if ($addressDetailsPage.length) {
const store = createStore(reducer) const store = createStore(reducer)
@ -149,4 +181,6 @@ if ($addressDetailsPage.length) {
type: 'RECEIVED_UPDATED_BALANCE', type: 'RECEIVED_UPDATED_BALANCE',
msg: humps.camelizeKeys(msg) msg: humps.camelizeKeys(msg)
})) }))
loadCounters(store)
} }

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

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

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

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

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

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

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

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

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

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

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

@ -27,14 +27,12 @@
class: "card-tab #{tab_status("logs", @conn.request_path)}", class: "card-tab #{tab_status("logs", @conn.request_path)}",
to: address_logs_path(@conn, :index, @address.hash) to: address_logs_path(@conn, :index, @address.hash)
) %> ) %>
<%= if BlockScoutWeb.AddressView.validator?(@validation_count) do %> <%= link(
<%= link( gettext("Blocks Validated"),
gettext("Blocks Validated"), class: "card-tab #{tab_status("validations", @conn.request_path)}",
class: "card-tab #{tab_status("validations", @conn.request_path)}", "data-test": "validations_tab_link",
"data-test": "validations_tab_link", to: address_validation_path(@conn, :index, @address.hash)
to: address_validation_path(@conn, :index, @address.hash) ) %>
) %>
<% end %>
<%= if contract?(@address) do %> <%= if contract?(@address) do %>
<%= link( <%= link(
to: address_contract_path(@conn, :index, @address.hash), 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"> <div class="row">
<!-- Address details --> <!-- Address details -->
<div class="card-section col-md-12 col-lg-8 pr-0-md"> <div class="card-section col-md-12 col-lg-8 pr-0-md">
@ -70,33 +70,20 @@
</span> </span>
<% end %> <% end %>
<span> <span>
<span class="address-detail-item"> <span class="address-detail-item" style="display: none">
<%= if contract?(@address) do %> <span data-selector="transaction-count">
<%= gettext(">=") %> </span>
<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> </span>
<%= if @address.fetched_coin_balance_block_number do %> <%= if @address.fetched_coin_balance_block_number do %>
<span class="address-detail-item"> <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> <%= gettext("Last Balance Update: Block #") %><span data-selector="fetched-coin-balance-block-number"><%= @address.fetched_coin_balance_block_number %></span>
</span> </span>
<% end %> <% end %>
<%= if validator?(@validation_count) do %>
<span class="address-detail-item"> <span class="address-detail-item">
<span data-selector="validation-count"> <span data-selector="validation-count">
<%= BlockScoutWeb.Cldr.Number.to_string!(@validation_count, format: "#,###") %>
</span>
<%= gettext("Blocks Validated") %>
</span> </span>
<% end %> </span>
</span> </span>
</div> </div>
<% from_address_hash = from_address_hash(@address) %> <% 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 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 def trimmed_hash(%Hash{} = hash) do
string_hash = to_string(hash) string_hash = to_string(hash)
"#{String.slice(string_hash, 0..5)}#{String.slice(string_hash, -6..-1)}" "#{String.slice(string_hash, 0..5)}#{String.slice(string_hash, -6..-1)}"

@ -208,6 +208,8 @@ defmodule BlockScoutWeb.WebRouter do
as: :smart_contract as: :smart_contract
) )
get("/address_counters", AddressController, :address_counters)
get("/search", ChainController, :search) get("/search", ChainController, :search)
get("/search_logs", AddressLogsController, :search_logs) 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." msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr "" msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:75
msgid ">="
msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:73 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:73
msgid "A string with the name of the action to be invoked." msgid "A string with the name of the action to be invoked."
@ -470,7 +465,7 @@ msgid "Create2"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "Created by"
msgstr "" msgstr ""
@ -502,7 +497,7 @@ msgid "Decoded"
msgstr "" msgstr ""
#, elixir-format #, 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" msgid "Decompiled code"
msgstr "" msgstr ""
@ -634,7 +629,7 @@ msgid "Error: (Awaiting internal transactions for reason)"
msgstr "" msgstr ""
#, elixir-format #, 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." msgid "Error: Could not determine contract creator."
msgstr "" 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." msgid "If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page."
msgstr "" msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:79
msgid "Incoming Transactions"
msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:55 #: lib/block_scout_web/templates/address_logs/_logs.html.eex:55
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:108 #: 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 "" msgstr ""
#, elixir-format #, 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 #" msgid "Last Balance Update: Block #"
msgstr "" msgstr ""
@ -1037,8 +1027,8 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:31 #: lib/block_scout_web/templates/chain/show.html.eex:31
#: lib/block_scout_web/templates/layout/app.html.eex:60 #: 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:121
#: lib/block_scout_web/views/address_view.ex:125 #: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap" msgid "Market Cap"
msgstr "" msgstr ""
@ -1177,7 +1167,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:33 #: 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:51
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:93 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:93
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36
@ -1488,12 +1478,7 @@ msgid "Transaction Speed"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:84 #: lib/block_scout_web/templates/address/_tile.html.eex:31
msgid "Transactions Sent"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tile.html.eex:33
msgid "Transactions sent" msgid "Transactions sent"
msgstr "" msgstr ""
@ -1665,7 +1650,7 @@ msgid "Yes"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:112 #: lib/block_scout_web/templates/address/overview.html.eex:99
msgid "at" msgid "at"
msgstr "" msgstr ""
@ -1723,8 +1708,8 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 #: 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:132
#: lib/block_scout_web/templates/address/overview.html.eex:153 #: 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:94
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:102 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:102
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106
@ -1803,31 +1788,30 @@ msgid "Copy Txn Input"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:32 #: lib/block_scout_web/templates/address/_tabs.html.eex:31
#: lib/block_scout_web/templates/address/overview.html.eex:97
#: lib/block_scout_web/templates/address_validation/index.html.eex:13 #: 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" msgid "Blocks Validated"
msgstr "" msgstr ""
#, elixir-format #, 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:165
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187 #: 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:126
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149 #: 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" msgid "Code"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:20 #: 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" msgid "Coin Balance History"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/views/address_view.ex:314 #: lib/block_scout_web/views/address_view.ex:304
msgid "Decompiled Code" msgid "Decompiled Code"
msgstr "" msgstr ""
@ -1836,7 +1820,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19 #: 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/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: 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 #: lib/block_scout_web/views/transaction_view.ex:314
msgid "Internal Transactions" msgid "Internal Transactions"
msgstr "" msgstr ""
@ -1846,15 +1830,15 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/index.html.eex:8 #: 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/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: 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 #: lib/block_scout_web/views/transaction_view.ex:315
msgid "Logs" msgid "Logs"
msgstr "" msgstr ""
#, elixir-format #, 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/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 #: lib/block_scout_web/views/tokens/overview_view.ex:37
msgid "Read Contract" msgid "Read Contract"
msgstr "" msgstr ""
@ -1863,7 +1847,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:8 #: 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/index.html.eex:8
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9 #: 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" msgid "Tokens"
msgstr "" msgstr ""
@ -1874,6 +1858,6 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18 #: 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/chain/show.html.eex:145
#: lib/block_scout_web/templates/layout/_topnav.html.eex:50 #: 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" msgid "Transactions"
msgstr "" msgstr ""

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

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

@ -45,4 +45,17 @@ defmodule BlockScoutWeb.AddressControllerTest do
assert redirected_to(conn) =~ "/address/0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed/transactions" assert redirected_to(conn) =~ "/address/0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed/transactions"
end end
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 end

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

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

Loading…
Cancel
Save