From 8a872407f8e5d82a44ff534cbdeb8c5ac23f375a Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 24 May 2019 13:49:21 +0300 Subject: [PATCH] trimmed verification link --- .../lib/block_scout_web/views/address_view.ex | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 37073f0509..657873f6ba 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 @@ -232,6 +232,13 @@ defmodule BlockScoutWeb.AddressView do def trimmed_hash(_), do: "" + def trimmed_verify_link(hash) do + string_hash = to_string(hash) + "#{String.slice(string_hash, 0..21)}..." + end + + def trimmed_verify_link(_), do: "" + def transaction_hash(%Address{contracts_creation_internal_transaction: %InternalTransaction{}} = address) do address.contracts_creation_internal_transaction.transaction_hash end @@ -258,7 +265,7 @@ defmodule BlockScoutWeb.AddressView do if full do link <> to_string(address) else - link <> trimmed_hash(address) + trimmed_verify_link(link <> to_string(address)) end end