Add tags on each address on transaction page

account
Oleg Sovetnik 3 years ago committed by Viktor Baranov
parent aafe2e2394
commit 611e305b72
  1. 7
      apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_controller.ex
  2. 8
      apps/block_scout_web/lib/block_scout_web/controllers/address_contract_controller.ex
  3. 8
      apps/block_scout_web/lib/block_scout_web/controllers/address_decompiled_contract_controller.ex
  4. 7
      apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex
  5. 9
      apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex
  6. 8
      apps/block_scout_web/lib/block_scout_web/controllers/address_read_contract_controller.ex
  7. 8
      apps/block_scout_web/lib/block_scout_web/controllers/address_read_proxy_controller.ex
  8. 13
      apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex
  9. 9
      apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex
  10. 9
      apps/block_scout_web/lib/block_scout_web/controllers/address_validation_controller.ex
  11. 8
      apps/block_scout_web/lib/block_scout_web/controllers/address_write_contract_controller.ex
  12. 8
      apps/block_scout_web/lib/block_scout_web/controllers/address_write_proxy_controller.ex
  13. 8
      apps/block_scout_web/lib/block_scout_web/controllers/tokens/contract_controller.ex
  14. 8
      apps/block_scout_web/lib/block_scout_web/controllers/tokens/holder_controller.ex
  15. 8
      apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex
  16. 4
      apps/block_scout_web/lib/block_scout_web/controllers/transaction_internal_transaction_controller.ex
  17. 4
      apps/block_scout_web/lib/block_scout_web/controllers/transaction_log_controller.ex
  18. 4
      apps/block_scout_web/lib/block_scout_web/controllers/transaction_raw_trace_controller.ex
  19. 4
      apps/block_scout_web/lib/block_scout_web/controllers/transaction_token_transfer_controller.ex
  20. 6
      apps/block_scout_web/lib/block_scout_web/models/get_address_tags.ex
  21. 2
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex
  22. 80
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex
  23. 3
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex

@ -5,7 +5,9 @@ defmodule BlockScoutWeb.AddressCoinBalanceController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.{AccessHelpers, AddressCoinBalanceView, Controller}
alias BlockScoutWeb.Account.AuthController
@ -72,16 +74,13 @@ defmodule BlockScoutWeb.AddressCoinBalanceController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(conn, "index.html",
address: address,
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
current_path: Controller.current_full_path(conn),
counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
{:restricted_access, _} ->

@ -2,6 +2,9 @@
defmodule BlockScoutWeb.AddressContractController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.AccessHelpers
alias BlockScoutWeb.Account.AuthController
alias BlockScoutWeb.AddressContractVerificationController, as: VerificationController
@ -24,9 +27,6 @@ defmodule BlockScoutWeb.AddressContractController do
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params),
_ <- VerificationController.check_and_verify(address_hash_string),
{:ok, address} <- Chain.find_contract_address(address_hash, address_options, true) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -34,7 +34,7 @@ defmodule BlockScoutWeb.AddressContractController do
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
{:restricted_access, _} ->

@ -1,6 +1,9 @@
defmodule BlockScoutWeb.AddressDecompiledContractController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.AccessHelpers
alias BlockScoutWeb.Account.AuthController
alias Explorer.{Chain, Market}
@ -11,9 +14,6 @@ defmodule BlockScoutWeb.AddressDecompiledContractController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.find_decompiled_contract_address(address_hash),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -21,7 +21,7 @@ defmodule BlockScoutWeb.AddressDecompiledContractController do
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
{:restricted_access, _} ->

@ -5,7 +5,9 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import BlockScoutWeb.Chain, only: [current_filter: 1, paging_options: 1, next_page_params: 3, split_list_by_page: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.{AccessHelpers, Controller, InternalTransactionView}
alias BlockScoutWeb.Account.AuthController
@ -79,9 +81,6 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -91,7 +90,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionController do
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
filter: params["filter"],
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
{:restricted_access, _} ->

@ -3,8 +3,12 @@ defmodule BlockScoutWeb.AddressLogsController do
Manages events logs tab.
"""
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.{AccessHelpers, AddressLogsView, Controller}
alias BlockScoutWeb.Account.AuthController
alias Explorer.{Chain, Market}
@ -58,9 +62,6 @@ defmodule BlockScoutWeb.AddressLogsController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -69,7 +70,7 @@ defmodule BlockScoutWeb.AddressLogsController do
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
_ ->

@ -8,6 +8,9 @@
defmodule BlockScoutWeb.AddressReadContractController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.AccessHelpers
alias BlockScoutWeb.Account.AuthController
alias Explorer.{Chain, Market}
@ -30,9 +33,6 @@ defmodule BlockScoutWeb.AddressReadContractController do
{:ok, address} <- Chain.find_contract_address(address_hash, address_options, true),
false <- is_nil(address.smart_contract),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -42,7 +42,7 @@ defmodule BlockScoutWeb.AddressReadContractController do
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
_ ->

@ -2,6 +2,9 @@
defmodule BlockScoutWeb.AddressReadProxyController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.AccessHelpers
alias BlockScoutWeb.Account.AuthController
alias Explorer.{Chain, Market}
@ -24,9 +27,6 @@ defmodule BlockScoutWeb.AddressReadProxyController do
{:ok, address} <- Chain.find_contract_address(address_hash, address_options, true),
false <- is_nil(address.smart_contract),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -36,7 +36,7 @@ defmodule BlockScoutWeb.AddressReadProxyController do
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
_ ->

@ -1,6 +1,9 @@
defmodule BlockScoutWeb.AddressTokenTransferController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.{AccessHelpers, Controller, TransactionView}
alias BlockScoutWeb.Account.AuthController
alias Explorer.ExchangeRates.Token
@ -102,9 +105,6 @@ defmodule BlockScoutWeb.AddressTokenTransferController do
{:ok, address} <- Chain.hash_to_address(address_hash),
{:ok, token} <- Chain.token_from_address_hash(token_hash),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -114,7 +114,7 @@ defmodule BlockScoutWeb.AddressTokenTransferController do
current_path: Controller.current_full_path(conn),
token: token,
counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
{:restricted_access, _} ->
@ -197,9 +197,6 @@ defmodule BlockScoutWeb.AddressTokenTransferController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -209,7 +206,7 @@ defmodule BlockScoutWeb.AddressTokenTransferController do
filter: params["filter"],
current_path: Controller.current_full_path(conn),
counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
{:restricted_access, _} ->

@ -5,8 +5,12 @@ defmodule BlockScoutWeb.AddressTransactionController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import BlockScoutWeb.Chain, only: [current_filter: 1, paging_options: 1, next_page_params: 3, split_list_by_page: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.{AccessHelpers, Controller, TransactionView}
alias BlockScoutWeb.Account.AuthController
alias Explorer.{Chain, Market}
@ -115,9 +119,6 @@ defmodule BlockScoutWeb.AddressTransactionController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -127,7 +128,7 @@ defmodule BlockScoutWeb.AddressTransactionController do
filter: params["filter"],
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}),
current_path: Controller.current_full_path(conn),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
:error ->

@ -4,9 +4,13 @@ defmodule BlockScoutWeb.AddressValidationController do
"""
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import BlockScoutWeb.Chain,
only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.{AccessHelpers, BlockView, Controller}
alias BlockScoutWeb.Account.AuthController
alias Explorer.ExchangeRates.Token
@ -73,9 +77,6 @@ defmodule BlockScoutWeb.AddressValidationController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.find_or_insert_address_from_hash(address_hash),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -84,7 +85,7 @@ defmodule BlockScoutWeb.AddressValidationController do
current_path: Controller.current_full_path(conn),
counters_path: address_path(conn, :address_counters, %{"id" => address_hash_string}),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
{:restricted_access, _} ->

@ -8,6 +8,9 @@
defmodule BlockScoutWeb.AddressWriteContractController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.AccessHelpers
alias BlockScoutWeb.Account.AuthController
alias Explorer.{Chain, Market}
@ -30,9 +33,6 @@ defmodule BlockScoutWeb.AddressWriteContractController do
{:ok, address} <- Chain.find_contract_address(address_hash, address_options, true),
false <- is_nil(address.smart_contract),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -42,7 +42,7 @@ defmodule BlockScoutWeb.AddressWriteContractController do
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
_ ->

@ -2,6 +2,9 @@
defmodule BlockScoutWeb.AddressWriteProxyController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.AccessHelpers
alias BlockScoutWeb.Account.AuthController
alias Explorer.{Chain, Market}
@ -24,9 +27,6 @@ defmodule BlockScoutWeb.AddressWriteProxyController do
{:ok, address} <- Chain.find_contract_address(address_hash, address_options, true),
false <- is_nil(address.smart_contract),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -36,7 +36,7 @@ defmodule BlockScoutWeb.AddressWriteProxyController do
coin_balance_status: CoinBalanceOnDemand.trigger_fetch(address),
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
counters_path: address_path(conn, :address_counters, %{"id" => Address.checksum(address_hash)}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
_ ->

@ -1,6 +1,9 @@
defmodule BlockScoutWeb.Tokens.ContractController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.Account.AuthController
alias BlockScoutWeb.{AccessHelpers, TabHelpers}
alias Explorer.{Chain, Market}
@ -13,9 +16,6 @@ defmodule BlockScoutWeb.Tokens.ContractController do
:ok <- Chain.check_verified_smart_contract_exists(address_hash),
{:ok, token} <- Chain.token_from_address_hash(address_hash, options),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
%{type: type, action: action} =
cond do
TabHelpers.tab_active?("read-contract", conn.request_path) ->
@ -38,7 +38,7 @@ defmodule BlockScoutWeb.Tokens.ContractController do
action: action,
token: Market.add_price(token),
counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
{:restricted_access, _} ->

@ -1,6 +1,9 @@
defmodule BlockScoutWeb.Tokens.HolderController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.{AccessHelpers, Controller}
alias BlockScoutWeb.Account.AuthController
alias BlockScoutWeb.Tokens.HolderView
@ -62,16 +65,13 @@ defmodule BlockScoutWeb.Tokens.HolderController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, token} <- Chain.token_from_address_hash(address_hash, options),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
current_path: Controller.current_full_path(conn),
token: Market.add_price(token),
counters_path: token_path(conn, :token_counters, %{"id" => Address.checksum(address_hash)}),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
{:restricted_access, _} ->

@ -1,6 +1,9 @@
defmodule BlockScoutWeb.Tokens.TransferController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
alias BlockScoutWeb.{AccessHelpers, Controller}
alias BlockScoutWeb.Account.AuthController
alias BlockScoutWeb.Tokens.TransferView
@ -66,9 +69,6 @@ defmodule BlockScoutWeb.Tokens.TransferController do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, token} <- Chain.token_from_address_hash(address_hash, options),
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
current_user = AuthController.current_user(conn)
tags = GetAddressTags.call(address_hash, current_user)
render(
conn,
"index.html",
@ -76,7 +76,7 @@ defmodule BlockScoutWeb.Tokens.TransferController do
current_path: Controller.current_full_path(conn),
token: Market.add_price(token),
token_total_supply_status: TokenTotalSupplyOnDemand.trigger_fetch(address_hash),
tags: tags
tags: get_address_tags(address_hash, current_user(conn))
)
else
{:restricted_access, _} ->

@ -3,6 +3,7 @@ defmodule BlockScoutWeb.TransactionInternalTransactionController do
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1]
import GetAddressTags, only: [get_address_tags: 2]
import GetTransactionTags, only: [get_transaction_tags: 2]
alias BlockScoutWeb.{AccessHelpers, Controller, InternalTransactionView, TransactionController}
@ -103,9 +104,12 @@ defmodule BlockScoutWeb.TransactionInternalTransactionController do
"index.html",
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
current_path: Controller.current_full_path(conn),
current_user: current_user(conn),
block_height: Chain.block_height(),
show_token_transfers: Chain.transaction_has_token_transfers?(transaction_hash),
transaction: transaction,
from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)),
to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)),
personal_tx_tag:
get_transaction_tags(
transaction_hash,

@ -3,6 +3,7 @@ defmodule BlockScoutWeb.TransactionLogController do
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1]
import GetAddressTags, only: [get_address_tags: 2]
import GetTransactionTags, only: [get_transaction_tags: 2]
alias BlockScoutWeb.{AccessHelpers, Controller, TransactionController, TransactionLogView}
@ -97,8 +98,11 @@ defmodule BlockScoutWeb.TransactionLogController do
block_height: Chain.block_height(),
show_token_transfers: Chain.transaction_has_token_transfers?(transaction_hash),
current_path: Controller.current_full_path(conn),
current_user: current_user(conn),
transaction: transaction,
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)),
to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)),
personal_tx_tag:
get_transaction_tags(
transaction_hash,

@ -2,6 +2,7 @@ defmodule BlockScoutWeb.TransactionRawTraceController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import GetAddressTags, only: [get_address_tags: 2]
import GetTransactionTags, only: [get_transaction_tags: 2]
alias BlockScoutWeb.{AccessHelpers, TransactionController}
@ -95,8 +96,11 @@ defmodule BlockScoutWeb.TransactionRawTraceController do
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
internal_transactions: internal_transactions,
block_height: Chain.block_height(),
current_user: current_user(conn),
show_token_transfers: Chain.transaction_has_token_transfers?(hash),
transaction: transaction,
from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)),
to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)),
personal_tx_tag:
get_transaction_tags(
transaction.hash,

@ -3,6 +3,7 @@ defmodule BlockScoutWeb.TransactionTokenTransferController do
import BlockScoutWeb.Account.AuthController, only: [current_user: 1]
import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1]
import GetAddressTags, only: [get_address_tags: 2]
import GetTransactionTags, only: [get_transaction_tags: 2]
alias BlockScoutWeb.{AccessHelpers, Controller, TransactionController, TransactionTokenTransferView}
@ -108,8 +109,11 @@ defmodule BlockScoutWeb.TransactionTokenTransferController do
exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(),
block_height: Chain.block_height(),
current_path: Controller.current_full_path(conn),
current_user: current_user(conn),
show_token_transfers: true,
transaction: transaction,
from_tags: get_address_tags(transaction.from_address_hash, current_user(conn)),
to_tags: get_address_tags(transaction.to_address_hash, current_user(conn)),
personal_tx_tag:
get_transaction_tags(
transaction_hash,

@ -10,10 +10,10 @@ defmodule GetAddressTags do
alias Explorer.Repo
alias Explorer.Tags.{AddressTag, AddressToTag}
def call(nil, nil),
def get_address_tags(nil, nil),
do: %{personal_tags: [], watchlist_names: []}
def call(%Hash{} = address_hash, current_user) do
def get_address_tags(%Hash{} = address_hash, current_user) do
%{
# common_tags: get_tags_on_address(address_hash),
personal_tags: get_personal_tags(address_hash, current_user),
@ -21,7 +21,7 @@ defmodule GetAddressTags do
}
end
def call(_, _), do: %{personal_tags: [], watchlist_names: []}
def get_address_tags(_, _), do: %{personal_tags: [], watchlist_names: []}
def get_tags_on_address(%Hash{} = address_hash) do
query =

@ -1,7 +1,7 @@
<% status = transaction_status(@transaction) %>
<% error_in_internal_tx = @transaction.has_error_in_internal_txs %>
<% current_user = AuthController.current_user(@conn) %>
<% tags = GetAddressTags.call(@transaction.to_address_hash, current_user) %>
<% tags = GetAddressTags.get_address_tags(@transaction.to_address_hash, current_user) %>
<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">
<!-- Color Block -->

@ -1,45 +1,49 @@
<%= with {:ok, from_address} <- Chain.hash_to_address(@transfer.from_address_hash),
{:ok, to_address} <- Chain.hash_to_address(@transfer.to_address_hash) do %>
{:ok, to_address} <- Chain.hash_to_address(@transfer.to_address_hash) do %>
<% IO.inspect @current_user %>
<% from_tags = GetAddressTags.get_address_tags(@transfer.from_address_hash, @current_user) %>
<% to_tags = GetAddressTags.get_address_tags(@transfer.to_address_hash, @current_user) %>
<tr>
<td style="width: 1%;">
<b style="margin-right: 15px;">From</b>
</td>
<td class="address-mobile" style="word-break: break-all; width: 1%; white-space: nowrap;">
<%= render BlockScoutWeb.AddressView, "_link.html", address: from_address, contract: BlockScoutWeb.AddressView.contract?(from_address), use_custom_tooltip: false, trimmed: false %>
</td>
<td style="word-break: break-all; white-space: nowrap;">
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy_for_table.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders", "btn-copy-token-transfer"],
clipboard_text: from_address,
aria_label: gettext("Copy From Address"),
title: gettext("Copy From Address"),
style: "position: relative;" %>
</td>
<td style="width: 1%;">
<b style="margin-right: 15px;">From</b>
</td>
<td class="address-mobile" style="word-break: break-all; width: 1%; white-space: nowrap;">
<%= render BlockScoutWeb.AddressView, "_link.html", address: from_address, contract: BlockScoutWeb.AddressView.contract?(from_address), use_custom_tooltip: false, trimmed: false %>
<%= render BlockScoutWeb.AddressView, "_labels.html", tags: from_tags %>
</td>
<td style="word-break: break-all; white-space: nowrap;">
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy_for_table.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders", "btn-copy-token-transfer"],
clipboard_text: from_address,
aria_label: gettext("Copy From Address"),
title: gettext("Copy From Address"),
style: "position: relative;" %>
</td>
</tr>
<tr>
<td style="width: 1%;">
<b>To</b>
</td>
<td class="address-mobile" style="word-break: break-all; width: 1%; white-space: nowrap;">
<%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: BlockScoutWeb.AddressView.contract?(to_address), use_custom_tooltip: false, trimmed: false %>
</td>
<td style="word-break: break-all; white-space: nowrap;">
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy_for_table.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders", "btn-copy-token-transfer"],
clipboard_text: to_address,
aria_label: gettext("Copy To Address"),
title: gettext("Copy To Address"),
style: "position: relative;"%>
</td>
<td style="width: 1%;">
<b>To</b>
</td>
<td class="address-mobile" style="word-break: break-all; width: 1%; white-space: nowrap;">
<%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: BlockScoutWeb.AddressView.contract?(to_address), use_custom_tooltip: false, trimmed: false %>
<%= render BlockScoutWeb.AddressView, "_labels.html", tags: to_tags %>
</td>
<td style="word-break: break-all; white-space: nowrap;">
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy_for_table.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders", "btn-copy-token-transfer"],
clipboard_text: to_address,
aria_label: gettext("Copy To Address"),
title: gettext("Copy To Address"),
style: "position: relative;"%>
</td>
</tr>
<tr>
<td valign="top" style="width: 1%;">
<b>For</b>
</td>
<% end %>
<td class="address-mobile" style="word-break: break-all; white-space: nowrap;">
<%= render BlockScoutWeb.TransactionView, "_total_transfers.html", transfer: @transfer %>
</td>
<td valign="top" style="width: 1%;">
<b>For</b>
</td>
<% end %>
<td class="address-mobile" style="word-break: break-all; white-space: nowrap;">
<%= render BlockScoutWeb.TransactionView, "_total_transfers.html", transfer: @transfer %>
</td>
</tr>
<tr><td style="height: 10px;"></td></tr>
<tr><td style="height: 10px;"></td></tr>

@ -201,6 +201,7 @@
<%= gettext "From" %></dt>
<dd class="col-sm-9 col-lg-10">
<%= render BlockScoutWeb.AddressView, "_link.html", address: from_address, contract: BlockScoutWeb.AddressView.contract?(from_address), use_custom_tooltip: false, trimmed: false %>
<%= render BlockScoutWeb.AddressView, "_labels.html", tags: @from_tags %>
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"],
clipboard_text: from_address_hash,
@ -226,6 +227,7 @@
<% created_address_hash -> %>
[<%= gettext("Contract") %>&nbsp;
<%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: BlockScoutWeb.AddressView.contract?(to_address), use_custom_tooltip: false, trimmed: false %>
<%= render BlockScoutWeb.AddressView, "_labels.html", tags: @to_tags %>
&nbsp;<%= gettext("created") %>]
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"],
@ -234,6 +236,7 @@
title: gettext("Copy To Address") %>
<% recipient_address_hash -> %>
<%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: BlockScoutWeb.AddressView.contract?(to_address), use_custom_tooltip: false, trimmed: false %>
<%= render BlockScoutWeb.AddressView, "_labels.html", tags: @to_tags %>
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"],
clipboard_text: recipient_address_hash,

Loading…
Cancel
Save