diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
index e5c9debace..c7255dfe82 100644
--- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
+++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
@@ -14,14 +14,10 @@
- <%= render BlockScoutWeb.AddressView, "_link.html", address_hash: @transaction.from_address_hash, contract: BlockScoutWeb.AddressView.contract?(@transaction.from_address) %>
+
+ <%= BlockScoutWeb.AddressView.display_address_hash(assigns[:current_address], @transaction.from_address) %>
→
- <%= if @transaction.to_address_hash do %>
- <%= render BlockScoutWeb.AddressView, "_link.html", address_hash: @transaction.to_address_hash, contract: BlockScoutWeb.AddressView.contract?(@transaction.to_address) %>
- <% else %>
- <%= gettext("Contract Address Pending") %>
- <% end %>
+ <%= BlockScoutWeb.AddressView.display_address_hash(assigns[:current_address], @transaction.to_address) %>
<%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %>
diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_view.ex
index 5cfd4ec703..a35ce8d907 100644
--- a/apps/block_scout_web/lib/block_scout_web/views/address_view.ex
+++ b/apps/block_scout_web/lib/block_scout_web/views/address_view.ex
@@ -34,36 +34,10 @@ defmodule BlockScoutWeb.AddressView do
def contract?(nil), do: true
- def hash(%Address{hash: hash}) do
- to_string(hash)
- end
-
- def qr_code(%Address{hash: hash}) do
- hash
- |> to_string()
- |> QRCode.to_png()
- |> Base.encode64()
- end
-
- def smart_contract_verified?(%Address{smart_contract: %SmartContract{}}), do: true
-
- def smart_contract_verified?(%Address{smart_contract: nil}), do: false
-
- def trimmed_hash(%Hash{} = hash) do
- string_hash = to_string(hash)
- "#{String.slice(string_hash, 0..5)}–#{String.slice(string_hash, -6..-1)}"
- end
-
- def trimmed_hash(_), do: ""
-
- def smart_contract_with_read_only_functions?(%Address{smart_contract: %SmartContract{}} = address) do
- Enum.any?(address.smart_contract.abi, & &1["constant"])
- end
-
- def smart_contract_with_read_only_functions?(%Address{smart_contract: nil}), do: false
-
def display_address_hash(current_address, target_address, truncate \\ false)
+ def display_address_hash(nil, nil, _truncate), do: gettext("Contract Address Pending")
+
def display_address_hash(nil, target_address, truncate) do
render(
"_link.html",
@@ -90,4 +64,32 @@ defmodule BlockScoutWeb.AddressView do
)
end
end
+
+ def hash(%Address{hash: hash}) do
+ to_string(hash)
+ end
+
+ def qr_code(%Address{hash: hash}) do
+ hash
+ |> to_string()
+ |> QRCode.to_png()
+ |> Base.encode64()
+ end
+
+ def smart_contract_verified?(%Address{smart_contract: %SmartContract{}}), do: true
+
+ def smart_contract_verified?(%Address{smart_contract: nil}), do: false
+
+ def trimmed_hash(%Hash{} = hash) do
+ string_hash = to_string(hash)
+ "#{String.slice(string_hash, 0..5)}–#{String.slice(string_hash, -6..-1)}"
+ end
+
+ def trimmed_hash(_), do: ""
+
+ def smart_contract_with_read_only_functions?(%Address{smart_contract: %SmartContract{}} = address) do
+ Enum.any?(address.smart_contract.abi, & &1["constant"])
+ end
+
+ def smart_contract_with_read_only_functions?(%Address{smart_contract: nil}), do: false
end