Remove joins to address table

Co-authored-by: Stamates <stamates@hotmail.com>
pull/249/head
Tim Mecklem 7 years ago
parent 563273b2b1
commit a66e2b6e83
  1. 4
      apps/explorer_web/lib/explorer_web/controllers/transaction_controller.ex
  2. 10
      apps/explorer_web/lib/explorer_web/templates/address/_link.html.eex
  3. 4
      apps/explorer_web/lib/explorer_web/templates/address_internal_transaction/index.html.eex
  4. 4
      apps/explorer_web/lib/explorer_web/templates/address_transaction/index.html.eex
  5. 4
      apps/explorer_web/lib/explorer_web/templates/block_transaction/index.html.eex
  6. 2
      apps/explorer_web/lib/explorer_web/templates/chain/_blocks.html.eex
  7. 4
      apps/explorer_web/lib/explorer_web/templates/chain/_transactions.html.eex
  8. 4
      apps/explorer_web/lib/explorer_web/templates/pending_transaction/index.html.eex
  9. 4
      apps/explorer_web/lib/explorer_web/templates/transaction/index.html.eex
  10. 4
      apps/explorer_web/lib/explorer_web/templates/transaction_internal_transaction/index.html.eex
  11. 3
      apps/explorer_web/lib/explorer_web/views/address_view.ex

@ -22,9 +22,7 @@ defmodule ExplorerWeb.TransactionController do
Keyword.merge(
[
necessity_by_association: %{
block: :required,
from_address: :optional,
to_address: :optional
block: :required
}
],
options

@ -1,14 +1,14 @@
<div class="address-link">
<%= if @address do %>
<%= link to: address_path(@conn, :show, @conn.assigns.locale, @address),
<%= if @address_hash do %>
<%= link to: address_path(@conn, :show, @conn.assigns.locale, @address_hash),
"data-toggle": "tooltip",
"data-placement": "top",
class: "address-link__font",
title: @address do %>
title: @address_hash do %>
<i class="address-link__type fas fa-address-card"></i>
<%= @address |> hash |> String.slice(0..3) %><i class="fas fa-ellipsis-v address-link__seperator"></i><%= @address |> hash |> String.slice(-4..-1) %>
<%= @address_hash |> hash() |> String.slice(0..3) %><i class="fas fa-ellipsis-v address-link__seperator"></i><%= @address_hash |> hash() |> String.slice(-4..-1) %>
<% end %>
<button class="address-link__copy-button" data-clipboard-text="<%= @address %>" aria-label="copy address">
<button class="address-link__copy-button" data-clipboard-text="<%= @address_hash %>" aria-label="copy address">
<i class="fa fa-copy"></i>
</button>
<% end %>

@ -96,10 +96,10 @@
</td>
<td><%= ExplorerWeb.BlockView.age(internal_transaction.transaction.block) %></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: internal_transaction.from_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: internal_transaction.from_address_hash %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: internal_transaction.to_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: internal_transaction.to_address_hash %>
</td>
<td><%= ExplorerWeb.TransactionView.value(internal_transaction, include_label: false) %></td>
</tr>

@ -103,11 +103,11 @@
</td>
<td><%= transaction.block.timestamp |> Timex.from_now %></td>
<td class="address-cell">
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.from_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.from_address_hash %>
</td>
<td class="u-text-center"><i class="fas fa-arrow-circle-right"></i></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.to_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.to_address_hash %>
</td>
<td><%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %></td>
<td><%= ExplorerWeb.TransactionView.formatted_fee(transaction, denomination: :ether) %></td>

@ -164,11 +164,11 @@
<%= transaction.block.timestamp |> Timex.from_now %>
</td>
<td class="address-cell">
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.from_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.from_address_hash %>
</td>
<td class="u-text-center"><i class="fas fa-arrow-circle-right"></i></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.to_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.to_address_hash %>
</td>
<td>
<%= ExplorerWeb.TransactionView.value(transaction) %>

@ -21,7 +21,7 @@
<td><%= block.transactions |> Enum.count %></td>
<td><%= block.gas_used |> Cldr.Number.to_string! %></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: block.miner %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: block.miner_hash %>
</td>
</tr>
<% end %>

@ -17,10 +17,10 @@
<%= render ExplorerWeb.TransactionView, "_link.html", conn: @conn, transaction: transaction %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.from_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.from_address_hash %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.to_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.to_address_hash %>
</td>
<td><%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %> </td>
<td><%= transaction.block.timestamp |> Timex.from_now() %></td>

@ -50,10 +50,10 @@
</td>
<td><%= last_seen(transaction) %></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.from_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.from_address_hash %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.to_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.to_address_hash %>
</td>
<td>
<%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %>

@ -59,10 +59,10 @@
<%= transaction.block.timestamp %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.from_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.from_address_hash %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.to_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.to_address_hash %>
</td>
<td>
<%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %>

@ -38,10 +38,10 @@
<tr>
<td><%= internal_transaction.call_type %></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: internal_transaction.from_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: internal_transaction.from_address_hash %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: internal_transaction.to_address %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: internal_transaction.to_address_hash %>
</td>
<td><%= ExplorerWeb.TransactionView.value(internal_transaction, include_label: false) %></td>
<td><%= ExplorerWeb.TransactionView.gas(internal_transaction) %></td>

@ -2,6 +2,7 @@ defmodule ExplorerWeb.AddressView do
use ExplorerWeb, :view
alias Explorer.Chain.{Address, Wei}
alias Explorer.Chain.Hash
alias Explorer.ExchangeRates.Token
alias ExplorerWeb.ExchangeRates.USD
@ -41,7 +42,7 @@ defmodule ExplorerWeb.AddressView do
end
end
def hash(%Address{hash: hash}) do
def hash(%Hash{} = hash) do
to_string(hash)
end

Loading…
Cancel
Save