Co-authored-by: jimmay5469 <jimmay5469@gmail.com>pull/156/head
parent
ae9ed5f5ce
commit
b0bc8ff932
@ -0,0 +1,45 @@ |
||||
defmodule ExplorerWeb.AddressInternalTransactionController do |
||||
@moduledoc """ |
||||
Display all the Transactions that terminate at this Address. |
||||
""" |
||||
|
||||
use ExplorerWeb, :controller |
||||
|
||||
alias Explorer.Chain |
||||
|
||||
def index(conn, %{"address_id" => address_hash}) do |
||||
case Chain.hash_to_address(address_hash) do |
||||
{:ok, address} -> |
||||
# options = [ |
||||
# necessity_by_association: %{ |
||||
# block: :required, |
||||
# from_address: :optional, |
||||
# to_address: :optional, |
||||
# receipt: :required |
||||
# }, |
||||
# pagination: params |
||||
# ] |
||||
|
||||
# page = |
||||
# Chain.address_to_transactions( |
||||
# address, |
||||
# Keyword.merge(options, current_filter(params)) |
||||
# ) |
||||
|
||||
render(conn, "index.html", address: address) |
||||
|
||||
{:error, :not_found} -> |
||||
not_found(conn) |
||||
end |
||||
end |
||||
|
||||
# defp current_filter(params) do |
||||
# params |
||||
# |> Map.get("filter") |
||||
# |> case do |
||||
# "to" -> [direction: :to] |
||||
# "from" -> [direction: :from] |
||||
# _ -> [] |
||||
# end |
||||
# end |
||||
end |
@ -0,0 +1,16 @@ |
||||
<div class="address__header"> |
||||
<h1 class="address__heading"><%= gettext "Address" %></h1> |
||||
<h3 class="address__subheading"><%= @address.hash %></h3> |
||||
</div> |
||||
<div class="address__container"> |
||||
<div class="address__attributes"> |
||||
<dl> |
||||
<div class="address__item"> |
||||
<dt class="address__item-key"><%= gettext "Balance" %></dt> |
||||
<dd class="address__item-value address__balance" title="<%= @address.hash %>"> |
||||
<%= balance(@address) %> <%= gettext "Ether" %> |
||||
</dd> |
||||
</div> |
||||
</dl> |
||||
</div> |
||||
</div> |
@ -0,0 +1,22 @@ |
||||
<section class="container__section block"> |
||||
<%= render ExplorerWeb.AddressView, "overview.html", assigns %> |
||||
|
||||
<div class="address__container"> |
||||
<div class="address__tabs"> |
||||
<h2 class="address__tab address__tab"> |
||||
<%= link( |
||||
gettext("Transactions"), |
||||
class: "address__link address__link", |
||||
to: address_transaction_path(@conn, :index, @conn.assigns.locale, @conn.params["address_id"]) |
||||
) %> |
||||
</h2> |
||||
<h2 class="address__tab address__tab--active"> |
||||
<%= link( |
||||
gettext("Internal Transactions"), |
||||
class: "address__link address__link--active", |
||||
to: address_internal_transaction_path(@conn, :index, @conn.assigns.locale, @conn.params["address_id"]) |
||||
) %> |
||||
</h2> |
||||
</div> |
||||
</div> |
||||
</section> |
@ -0,0 +1,3 @@ |
||||
defmodule ExplorerWeb.AddressInternalTransactionView do |
||||
use ExplorerWeb, :view |
||||
end |
@ -0,0 +1,25 @@ |
||||
defmodule ExplorerWeb.AddressPage do |
||||
@moduledoc false |
||||
|
||||
use Wallaby.DSL |
||||
import Wallaby.Query, only: [css: 1, css: 2] |
||||
|
||||
def visit_page(session, address_hash) do |
||||
visit(session, "/en/addresses/#{address_hash}") |
||||
end |
||||
|
||||
@internal_transactions_link_selector "[data-test='internal_transactions_tab_link']" |
||||
def click_internal_transactions(session) do |
||||
click(session, css(@internal_transactions_link_selector)) |
||||
end |
||||
|
||||
@transaction_selector ".transactions__link--long-hash" |
||||
def transaction(transaction_hash) do |
||||
css(@transaction_selector, text: transaction_hash) |
||||
end |
||||
|
||||
@internal_transactions_selector "[data-test='internal_transaction']" |
||||
def internal_transactions(count: count) do |
||||
css(@internal_transactions_selector, count: count) |
||||
end |
||||
end |
Loading…
Reference in new issue