Fix dialyzer error

pull/6582/head
POA 2 years ago
parent 1579c758ba
commit d11271e99a
  1. 1
      .dialyzer-ignore
  2. 6
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions.html.eex
  3. 8
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex

@ -33,4 +33,3 @@ lib/block_scout_web/views/transaction_view.ex:197
lib/indexer/buffered_task.ex:402
lib/indexer/buffered_task.ex:451
lib/indexer/memory/monitor.ex:160
lib/block_scout_web/templates/transaction/_actions.html.eex:1

@ -5,10 +5,8 @@
<i class="fa fa-caret-right"></i>
<% address_string = Map.get(@action.data, "address") %>
<% {address_hash_status, address_hash} = Chain.string_to_address_hash(address_string) %>
<% {address_status, address} = Chain.hash_to_address(address_hash) %>
<% address_is_ok = (address_hash_status == :ok and address_status == :ok) %>
<% address = if address_is_ok, do: render_to_string(BlockScoutWeb.AddressView, "_link.html", address: address, contract: BlockScoutWeb.AddressView.contract?(address), use_custom_tooltip: false, trimmed: false), else: render_to_string(BlockScoutWeb.TransactionView, "_actions_address.html", address_string: address_string, action: @action) %>
<% {address_status, address} = transaction_action_string_to_address(address_string) %>
<% address = if address_status == :ok, do: render_to_string(BlockScoutWeb.AddressView, "_link.html", address: address, contract: BlockScoutWeb.AddressView.contract?(address), use_custom_tooltip: false, trimmed: false), else: render_to_string(BlockScoutWeb.TransactionView, "_actions_address.html", address_string: address_string, action: @action) %>
<% to_address = Map.get(@action.data, "to") %>
<% to_content = raw(render_to_string BlockScoutWeb.TransactionView, "_actions_to.html", address: to_address) %>
<% to = link to: address_path(BlockScoutWeb.Endpoint, :show, to_address), "data-test": "address_hash_link", do: to_content %>

@ -329,6 +329,14 @@ defmodule BlockScoutWeb.TransactionView do
|> BlockScoutWeb.CldrHelper.Number.to_string!(format: "#,##0.##################")
end
def transaction_action_string_to_address(address) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address) do
Chain.hash_to_address(address_hash)
else
_ -> {:error, nil}
end
end
def transaction_status(transaction) do
Chain.transaction_to_status(transaction)
end

Loading…
Cancel
Save