Remove unused view helpers

Co-authored-by: tmecklem <timothy@mecklem.com>
pull/199/head
jimmay5469 7 years ago
parent af2aaa9593
commit 0f2f1723bc
  1. 5
      apps/explorer_web/lib/explorer_web/views/address_transaction_view.ex
  2. 4
      apps/explorer_web/lib/explorer_web/views/block_transaction_view.ex
  3. 3
      apps/explorer_web/lib/explorer_web/views/pending_transaction_view.ex
  4. 20
      apps/explorer_web/lib/explorer_web/views/transaction_view.ex

@ -3,10 +3,6 @@ defmodule ExplorerWeb.AddressTransactionView do
alias ExplorerWeb.TransactionView
defdelegate block(transaction), to: TransactionView
defdelegate from_address(transaction), to: TransactionView
defdelegate hash(transaction), to: TransactionView
def format_current_filter(filter) do
case filter do
"to" -> gettext("To")
@ -16,5 +12,4 @@ defmodule ExplorerWeb.AddressTransactionView do
end
defdelegate status(transaction), to: TransactionView
defdelegate to_address(transaction), to: TransactionView
end

@ -4,10 +4,6 @@ defmodule ExplorerWeb.BlockTransactionView do
alias ExplorerWeb.{BlockView, TransactionView}
defdelegate age(block), to: BlockView
defdelegate block(transaction), to: TransactionView
defdelegate formatted_timestamp(block), to: BlockView
defdelegate from_address(transaction), to: TransactionView
defdelegate hash(transaction), to: TransactionView
defdelegate status(transacton), to: TransactionView
defdelegate to_address(transaction), to: TransactionView
end

@ -5,8 +5,5 @@ defmodule ExplorerWeb.PendingTransactionView do
@dialyzer :no_match
defdelegate from_address(transaction), to: TransactionView
defdelegate hash(transaction), to: TransactionView
defdelegate last_seen(transaction), to: TransactionView
defdelegate to_address(transaction), to: TransactionView
end

@ -3,16 +3,9 @@ defmodule ExplorerWeb.TransactionView do
alias Cldr.Number
alias Explorer.Chain
alias Explorer.Chain.{Address, Block, InternalTransaction, Transaction, Wei}
alias Explorer.Chain.{Block, InternalTransaction, Transaction, Wei}
alias ExplorerWeb.BlockView
def block(%Transaction{block: block}) do
case block do
nil -> gettext("Pending")
_ -> to_string(block.number)
end
end
def confirmations(%Transaction{block: block}, named_arguments) when is_list(named_arguments) do
case block do
nil -> 0
@ -62,10 +55,6 @@ defmodule ExplorerWeb.TransactionView do
end
end
def from_address(%Transaction{from_address: %Address{hash: hash}}) do
to_string(hash)
end
defguardp is_transaction_type(mod) when mod in [InternalTransaction, Transaction]
def gas(%type{gas: gas}) when is_transaction_type(type) do
@ -102,13 +91,6 @@ defmodule ExplorerWeb.TransactionView do
end
end
def to_address(%Transaction{to_address: to_address}) do
case to_address do
nil -> "Contract Creation"
_ -> to_string(to_address)
end
end
@doc """
Converts a transaction's Wei value to Ether and returns a formatted display value.

Loading…
Cancel
Save