Merge pull request #493 from poanetwork/471-transaction-card-fix

471 transaction card fix
pull/484/head
Jimmy Lauzau 6 years ago committed by GitHub
commit 39eeaf5890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      apps/explorer_web/assets/css/components/_tile.scss
  2. 16
      apps/explorer_web/lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex
  3. 29
      apps/explorer_web/lib/explorer_web/templates/address_internal_transaction/index.html.eex
  4. 145
      apps/explorer_web/lib/explorer_web/templates/address_transaction/_transaction.html.eex
  5. 27
      apps/explorer_web/lib/explorer_web/templates/address_transaction/index.html.eex
  6. 53
      apps/explorer_web/lib/explorer_web/templates/block/overview.html.eex
  7. 2
      apps/explorer_web/lib/explorer_web/templates/chain/_block.html.eex
  8. 21
      apps/explorer_web/lib/explorer_web/templates/pending_transaction/index.html.eex
  9. 2
      apps/explorer_web/lib/explorer_web/templates/transaction/_link.html.eex
  10. 36
      apps/explorer_web/lib/explorer_web/templates/transaction/_tile.html.eex
  11. 66
      apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex
  12. 4
      apps/explorer_web/lib/explorer_web/templates/transaction_internal_transaction/_internal_transaction.html.eex
  13. 22
      apps/explorer_web/lib/explorer_web/views/address_transaction_view.ex
  14. 10
      apps/explorer_web/lib/explorer_web/views/transaction_view.ex
  15. 54
      apps/explorer_web/priv/gettext/default.pot
  16. 54
      apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po

@ -85,12 +85,16 @@
}
}
}
}
.tile-title {
font-size: 12px;
font-weight: 600;
color: $gray-700;
margin-bottom: 0;
.tile-title {
font-size: 14px;
font-weight: 600;
color: $gray-700;
margin-bottom: 0;
&-hash {
font-weight: 300;
}
}

@ -1,9 +1,9 @@
<div class="tile tile-type-internal-transaction fade-in" data-test="internal_transaction" data-internal-transaction-id="<%= @internal_transaction.id %>">
<div class="row justify-content-end">
<div class="col-md-3 col-lg-2 d-flex align-items-center justify-content-start justify-content-lg-center tile-label">
<div class="row">
<div class="col-md-2 d-flex flex-column align-items-left justify-content-start justify-content-lg-center tile-label mb-1 mb-md-0 pl-md-4">
<%= gettext("Internal Transaction") %>
</div>
<div class="col-md-9 col-lg-7 d-flex flex-column text-nowrap">
<div class="col-md-8 col-lg-8 d-flex flex-column text-nowrap pr-2 pr-sm-2 pr-md-0">
<%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: @internal_transaction.transaction_hash %>
<span class="text-nowrap">
<%= if @address.hash == @internal_transaction.from_address_hash do %>
@ -18,16 +18,16 @@
<%= render ExplorerWeb.AddressView, "_link.html", address_hash: ExplorerWeb.InternalTransactionView.to_address_hash(@internal_transaction), contract: ExplorerWeb.AddressView.contract?(@internal_transaction.to_address), locale: @locale %>
<% end %>
</span>
<span class="tile-title text-truncate mt-3 mt-md-0">
<%= ExplorerWeb.TransactionView.value(@internal_transaction, include_label: false) %> <%= gettext "Ether" %>
</span>
</div>
<div class="col-md-2 d-flex flex-row flex-md-column justify-content-start align-items-end mt-3 mt-md-0">
<%= if @address.hash == @internal_transaction.from_address_hash do %>
<span class="badge badge-danger tile-badge"><%= gettext "OUT" %></span>
<% else %>
<span class="badge badge-success tile-badge"><%= gettext "IN" %></span>
<% end %>
</div>
<div class="col-md-9 col-lg-3 d-flex flex-row flex-md-column justify-content-start text-lg-right mt-3 mt-lg-0">
<span class="tile-title">
<%= ExplorerWeb.TransactionView.value(@internal_transaction, include_label: false) %> <%= gettext "Ether" %>
</span>
</div>
</div>
</div>

@ -126,20 +126,23 @@
<span><%= gettext "There are no internal transactions for this address." %></span>
</div>
<% end %>
<div>
<%= if @next_page_params do %>
<%= link(
gettext("Older"),
class: "button button--secondary button--sm float-right",
to: address_internal_transaction_path(
@conn,
:index,
@conn.assigns.locale,
@address,
@next_page_params
)
) %>
<% end %>
</div>
</div>
</div>
<%= if @next_page_params do %>
<%= link(
gettext("Older"),
class: "button button--secondary button--sm u-float-right mt-3",
to: address_internal_transaction_path(
@conn,
:index,
@conn.assigns.locale,
@address,
@next_page_params
)
) %>
<% end %>
</section>
</section>

@ -1,69 +1,64 @@
<div class="tile tile-type-<%= ExplorerWeb.TransactionView.type_suffix(@transaction) %> fade-in tile-status--<%= ExplorerWeb.TransactionView.status(@transaction) %>" data-transaction-hash="<%= @transaction.hash %>">
<div class="row">
<div class="col-md-3 col-lg-2 d-flex align-items-lg-center">
<div class="d-flex flex-md-column ml-md-4">
<span class="tile-label mr-1 mr-md-0">
<%= ExplorerWeb.TransactionView.transaction_display_type(@transaction) %>
</span>
<span class="tile-status-label" data-test="transaction_status">
<%= ExplorerWeb.TransactionView.formatted_status(@transaction) %>
</span>
</div>
</div>
<div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4">
<span class="tile-label">
<%= ExplorerWeb.TransactionView.transaction_display_type(@transaction) %>
</span>
<div class="col-md-9 col-lg-7 d-flex flex-column">
<span class="tile-status-label ml-2 ml-md-0" data-test="transaction_status">
<%= ExplorerWeb.TransactionView.formatted_status(@transaction) %>
</span>
</div>
<div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0">
<%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: @transaction.hash %>
<span class="text-nowrap">
<%= if @address.hash == @transaction.from_address_hash do %>
<%= render ExplorerWeb.AddressView, "_responsive_hash.html", address_hash: @transaction.from_address_hash, contract: ExplorerWeb.AddressView.contract?(@transaction.from_address) %>
<% else %>
<%= render ExplorerWeb.AddressView, "_link.html", address_hash: @transaction.from_address_hash, contract: ExplorerWeb.AddressView.contract?(@transaction.from_address), locale: @locale %>
<% end %>
<%= if Enum.empty?(@transaction.token_transfers) || transfered_value?(@transaction.value) do %>
<span class="text-nowrap">
<%= if @address.hash == @transaction.from_address_hash do %>
<%= render ExplorerWeb.AddressView, "_responsive_hash.html", address_hash: @transaction.from_address_hash, contract: ExplorerWeb.AddressView.contract?(@transaction.from_address) %>
<% else %>
<%= render ExplorerWeb.AddressView, "_link.html", address_hash: @transaction.from_address_hash, contract: ExplorerWeb.AddressView.contract?(@transaction.from_address), locale: @locale %>
<% end %>
&rarr;
&rarr;
<%= if @address.hash == ExplorerWeb.TransactionView.to_address_hash(@transaction) do %>
<%= render ExplorerWeb.AddressView, "_responsive_hash.html", address_hash: ExplorerWeb.TransactionView.to_address_hash(@transaction), contract: ExplorerWeb.AddressView.contract?(@transaction.to_address) %>
<% else %>
<%= render ExplorerWeb.AddressView, "_link.html", address_hash: ExplorerWeb.TransactionView.to_address_hash(@transaction), contract: ExplorerWeb.AddressView.contract?(@transaction.to_address), locale: @locale %>
<% end %>
<%= if @address.hash == ExplorerWeb.TransactionView.to_address_hash(@transaction) do %>
<%= render ExplorerWeb.AddressView, "_responsive_hash.html", address_hash: ExplorerWeb.TransactionView.to_address_hash(@transaction), contract: ExplorerWeb.AddressView.contract?(@transaction.to_address) %>
<% else %>
<%= render ExplorerWeb.AddressView, "_link.html", address_hash: ExplorerWeb.TransactionView.to_address_hash(@transaction), contract: ExplorerWeb.AddressView.contract?(@transaction.to_address), locale: @locale %>
<% end %>
</span>
<span class="d-flex flex-md-row flex-column mt-3 mt-md-0">
<span class="tile-title">
<%= ExplorerWeb.TransactionView.value(@transaction, include_label: false) %> <%= gettext "Ether" %>
</span>
<span>
<%= if @transaction.from_address_hash == @address.hash || @transaction.to_address_hash == @address.hash do %>
<%= if @transaction.from_address_hash == @address.hash do %>
<span data-test="transaction_type" class="mr-1 badge badge-danger tile-badge">
<%= gettext "OUT" %>
</span>
<% else %>
<span data-test="transaction_type" class="mr-1 badge badge-success tile-badge">
<%= gettext "IN" %>
</span>
<% end %>
<span class="ml-0 ml-md-1 text-nowrap">
<%= ExplorerWeb.TransactionView.formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %>
</span>
</span>
</div>
<div class="col-md-3 col-lg-2 d-flex flex-row flex-md-column flex-nowrap justify-content-start text-md-right mt-3 mt-md-0">
<span class="mr-2 mr-md-0 order-1">
<%= link(
gettext("Block #%{number}", number: to_string(@transaction.block.number)),
to: block_path(ExplorerWeb.Endpoint, :show, @locale, @transaction.block)
) %>
</span>
<span class="mr-2 mr-md-0 order-2" data-from-now="<%= @transaction.block.timestamp %>"></span>
<%= if from_or_to_address?(@transaction, @address) do %>
<span class="mr-2 mr-md-0 order-0 order-md-3">
<%= if @transaction.from_address_hash == @address.hash do %>
<span data-test="transaction_type" class="badge badge-danger tile-badge">
<%= gettext "OUT" %>
</span>
<% else %>
<span data-test="transaction_type" class="badge badge-success tile-badge">
<%= gettext "IN" %>
</span>
<% end %>
<span data-from-now="<%= @transaction.block.timestamp %>"></span>
<span class="ml-1">
<%= link(
gettext("Block #%{number}", number: to_string(@transaction.block.number)),
to: block_path(ExplorerWeb.Endpoint, :show, @locale, @transaction.block)
) %>
</span>
</span>
<% end %>
</div>
<%= if Enum.empty?(@transaction.token_transfers) || transfered_value?(@transaction.value) do %>
<div class="col-md-9 col-lg-3 d-flex flex-column flex-md-row flex-lg-column justify-content-start text-lg-right mt-3 mt-lg-0">
<span class="tile-title mr-1 mr-lg-0">
<%= ExplorerWeb.TransactionView.value(@transaction, include_label: false) %> <%= gettext "Ether" %>
</span>
<span> <%= ExplorerWeb.TransactionView.formatted_fee(@transaction, denomination: :ether) %> <%= gettext "Fee" %></span>
</div>
<% end %>
<%= if ExplorerWeb.TransactionView.involves_token_transfers?(@transaction) && transfered_value?(@transaction.value) do %>
<%= if ExplorerWeb.TransactionView.involves_token_transfers?(@transaction) do %>
<div class="offset-md-2 col-md-10">
<hr class="mt-3 mb-3 w-100" />
<p class="tile-title"><%= gettext "Transfers" %></p>
@ -71,8 +66,8 @@
<% end %>
<%= for token_transfer <- @transaction.token_transfers do %>
<div class="offset-md-2 col-sm-7 col-lg-8 d-flex flex-column">
<span data-test="token_transfer">
<div class="offset-md-2 col-md-7 col-lg-8 d-flex flex-column mt-1 mb-2">
<span class="text-nowrap" data-test="token_transfer">
<span data-test="token_transfer_address_hash">
<%= ExplorerWeb.AddressView.display_address_hash(@address, token_transfer.from_address, @locale) %>
</span>
@ -81,38 +76,22 @@
<%= ExplorerWeb.AddressView.display_address_hash(@address, token_transfer.to_address, @locale) %>
</span>
</span>
</div>
<div class="col-sm-3 col-lg-2 d-flex flex-row flex-sm-column align-items-end">
<span class="tile-title">
<%= formatted_token_amount(token_transfer.amount, token_transfer.token.decimals) %> <%= token_transfer.token.symbol %>
</span>
</div>
<% end %>
<%= if Enum.any?(@transaction.token_transfers) && !transfered_value?(@transaction.value) do %>
<div class="mt-3 offset-md-2 col-sm-7 col-lg-8 d-flex flex-column">
<span>
<%= if !address_sending_and_receiving_tokens?(@transaction, @address.hash) do %>
<%= if address_sending_tokens?(@transaction, @address.hash) do %>
<span data-test="transaction_type" class="mr-1 badge badge-danger tile-badge">
<%= gettext "OUT" %>
</span>
<% else %>
<%= if address_receiving_tokens?(@transaction, @address.hash) do %>
<span data-test="transaction_type" class="mr-1 badge badge-success tile-badge">
<%= gettext "IN" %>
</span>
<% end %>
<% end %>
<div class="col-md-3 col-lg-2 d-flex flex-row flex-md-column align-items-end">
<%= if from_or_to_address?(token_transfer, @address) do %>
<%= if token_transfer.from_address_hash == @address.hash do %>
<span data-test="transaction_type" class="badge badge-danger tile-badge">
<%= gettext "OUT" %>
</span>
<% else %>
<span data-test="transaction_type" class="badge badge-success tile-badge">
<%= gettext "IN" %>
</span>
<% end %>
<span data-from-now="<%= @transaction.block.timestamp %>"></span>
<span class="ml-1">
<%= link(
gettext("Block #%{number}", number: to_string(@transaction.block.number)),
to: block_path(ExplorerWeb.Endpoint, :show, @locale, @transaction.block)
) %>
</span>
</span>
<% end %>
</div>
<% end %>
</div>

@ -139,20 +139,21 @@
<span data-selector="empty-transactions-list"><%= gettext "There are no transactions for this address." %></span>
</div>
<% end %>
<%= if @next_page_params do %>
<%= link(
gettext("Older"),
class: "button button--secondary button--sm float-right",
to: address_transaction_path(
@conn,
:index,
@conn.assigns.locale,
@address,
@next_page_params
)
) %>
<% end %>
</div>
</div>
<%= if @next_page_params do %>
<%= link(
gettext("Older"),
class: "button button--secondary button--sm u-float-right mt-3",
to: address_transaction_path(
@conn,
:index,
@conn.assigns.locale,
@address,
@next_page_params
)
) %>
<% end %>
</section>
</section>

@ -1,6 +1,6 @@
<section>
<div class="row">
<div class="col-md-8">
<div class="col-md-12 col-lg-8">
<!-- Block Details -->
<div class="card">
<div class="card-body">
@ -63,33 +63,38 @@
</div>
</div>
<div class="col-md-4">
<div class="col-md-12 col-lg-4">
<div class="row">
<div class="col-md-6 col-lg-12">
<!-- Validator -->
<div class="card bg-primary">
<div class="card-body">
<h2 class="card-title text-white"> <%= gettext "Miner" %> </h2>
<div class="text-right">
<!-- Validator's Name -->
<!-- Until we can get the validator's name we are using the Validator's address hash -->
<h3 class="text-white text-truncate"> <%= link @block.miner, class: "text-white", to: address_path(ExplorerWeb.Endpoint, :show, @locale, @block.miner) %> </h3>
<!-- Validator's address hash -->
<span class="text-light text-truncate"> </span>
<div class="card bg-primary">
<div class="card-body">
<h2 class="card-title text-white"> <%= gettext "Miner" %> </h2>
<div class="text-right">
<!-- Validator's Name -->
<!-- Until we can get the validator's name we are using the Validator's address hash -->
<h3 class="text-white text-truncate"> <%= link @block.miner, class: "text-white", to: address_path(ExplorerWeb.Endpoint, :show, @locale, @block.miner) %> </h3>
<!-- Validator's address hash -->
<span class="text-light text-truncate"> </span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-lg-12">
<!-- Gas -->
<div class="card">
<div class="card-body">
<h2 class="card-title"> <%= gettext "Gas Used" %> </h2>
<div class="text-right">
<!-- Gas Used -->
<h3>
<%= @block.gas_used |> Cldr.Number.to_string! %>
<span class="text-muted"> (<%= (@block.gas_used / @block.gas_limit) |> Cldr.Number.to_string!(format: "#.#%") %>) </span>
</h3>
<!-- Gas Limit -->
<span class="text-muted"> <%= @block.gas_limit |> Cldr.Number.to_string! %> <%= gettext "Gas Limit" %> </span>
<div class="card">
<div class="card-body">
<h2 class="card-title"> <%= gettext "Gas Used" %> </h2>
<div class="text-right">
<!-- Gas Used -->
<h3>
<%= @block.gas_used |> Cldr.Number.to_string! %>
<span class="text-muted"> (<%= (@block.gas_used / @block.gas_limit) |> Cldr.Number.to_string!(format: "#.#%") %>) </span>
</h3>
<!-- Gas Limit -->
<span class="text-muted"> <%= @block.gas_limit |> Cldr.Number.to_string! %> <%= gettext "Gas Limit" %> </span>
</div>
</div>
</div>
</div>
</div>

@ -1,4 +1,4 @@
<div class="col-sm-3 fade-up-blocks-homepage" data-selector="chain-block" data-block-number="<%= @block.number %>">
<div class="col-sm-3 fade-up-blocks-homepage mb-3 mb-sm-0" data-selector="chain-block" data-block-number="<%= @block.number %>">
<div class="tile d-flex flex-column">
<%= link(@block, to: block_path(ExplorerWeb.Endpoint, :show, @locale, @block), class: "tile-title") %>
<div>

@ -48,14 +48,12 @@
<%= for transaction <- @transactions do %>
<div class="tile tile-type-<%= ExplorerWeb.TransactionView.type_suffix(transaction) %>" data-test="<%= ExplorerWeb.TransactionView.type_suffix(transaction) %>" data-transaction-hash="<%= transaction.hash %>">
<div class="row justify-content-end" data-test="chain_transaction">
<div class="col-md-3 col-lg-2 d-flex align-items-lg-center">
<div class="d-flex flex-md-column ml-md-4">
<span class="tile-label mr-1 mr-md-0" data-test="transaction_type"> <%= ExplorerWeb.TransactionView.transaction_display_type(transaction) %></span>
<div data-test="transaction_status"><%= ExplorerWeb.TransactionView.formatted_status(transaction) %></div>
</div>
<div class="row" data-test="chain_transaction">
<div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4">
<span class="tile-label" data-test="transaction_type"> <%= ExplorerWeb.TransactionView.transaction_display_type(transaction) %></span>
<div class="tile-status-label ml-2 ml-md-0" data-test="transaction_status"><%= ExplorerWeb.TransactionView.formatted_status(transaction) %></div>
</div>
<div class="col-md-9 col-lg-7 d-flex flex-column">
<div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0">
<%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: transaction.hash %>
<span class="text-nowrap">
<%= render ExplorerWeb.AddressView, "_link.html", address_hash: transaction.from_address_hash, contract: ExplorerWeb.AddressView.contract?(transaction.from_address), locale: @locale %>
@ -66,10 +64,11 @@
<%= gettext("Contract Address Pending") %>
<% end %>
</span>
</div>
<div class="col-md-9 col-lg-3 d-flex flex-column flex-md-row flex-lg-column justify-content-start text-lg-right mt-3 mt-lg-0">
<span class="tile-title mr-1 mr-lg-0"><%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %> <%= gettext "Ether" %></span>
<span> <%= ExplorerWeb.TransactionView.formatted_fee(transaction, denomination: :ether) %> <%= gettext "Fee" %></span>
<span class="d-flex flex-md-row flex-column mt-3 mt-md-0">
<span class="tile-title"><%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %> <%= gettext "Ether" %></span>
<span class="ml-0 ml-md-1 text-nowrap"> <%= ExplorerWeb.TransactionView.formatted_fee(transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %></span>
</span>
</div>
</div>
</div>

@ -1,4 +1,4 @@
<%= link(@transaction_hash,
to: transaction_path(ExplorerWeb.Endpoint, :show, @locale, @transaction_hash),
"data-test": "transaction_hash_link",
"class": "tile-title text-truncate") %>
"class": "text-truncate") %>

@ -1,31 +1,35 @@
<div class="tile tile-type-<%= ExplorerWeb.TransactionView.type_suffix(@transaction) %> tile-status--<%= ExplorerWeb.TransactionView.status(@transaction) %> fade-up" data-test="<%= ExplorerWeb.TransactionView.type_suffix(@transaction) %>" data-transaction-hash="<%= @transaction.hash %>">
<div class="row" data-test="chain_transaction">
<div class="pl-5 col-md-2 d-flex flex-column align-items-left justify-content-start justify-content-lg-center">
<span class="tile-label" data-test="transaction_type"> <%= ExplorerWeb.TransactionView.transaction_display_type(@transaction) %></span>
<div class="tile-status-label" data-test="transaction_status"><%= ExplorerWeb.TransactionView.formatted_status(@transaction) %></div>
<div class="col-md-2 d-flex flex-row flex-md-column align-items-left justify-content-start justify-content-lg-center mb-1 mb-md-0 pl-md-4">
<span class="tile-label" data-test="transaction_type">
<%= ExplorerWeb.TransactionView.transaction_display_type(@transaction) %>
</span>
<div class="tile-status-label ml-2 ml-md-0" data-test="transaction_status">
<%= ExplorerWeb.TransactionView.formatted_status(@transaction) %>
</div>
</div>
<div class="col-md-7 col-lg-8 d-flex flex-column">
<%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: @transaction.hash %>
<div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0">
<%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: @transaction.hash %>
<span class="text-nowrap">
<%= render ExplorerWeb.AddressView, "_link.html", address_hash: @transaction.from_address_hash, contract: ExplorerWeb.AddressView.contract?(@transaction.from_address), locale: @locale %>
&rarr;
<%= render ExplorerWeb.AddressView, "_link.html", address_hash: ExplorerWeb.TransactionView.to_address_hash(@transaction), contract: ExplorerWeb.AddressView.contract?(@transaction.to_address), locale: @locale %>
</span>
<span>
<span data-from-now="<%= @transaction.block.timestamp %>"></span>
<span class="ml-1">
<%= link(
gettext("Block #%{number}", number: to_string(@transaction.block.number)),
to: block_path(ExplorerWeb.Endpoint, :show, @locale, @transaction.block)
) %>
<span class="d-flex flex-md-row flex-column mt-3 mt-md-0">
<span class="tile-title">
<%= ExplorerWeb.TransactionView.value(@transaction, include_label: false) %> <%= gettext "Ether" %>
</span>
<span class="ml-0 ml-md-1 text-nowrap"> <%= ExplorerWeb.TransactionView.formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %></span>
</span>
</div>
<div class="col-md-3 col-lg-2 d-flex flex-row flex-md-column justify-content-start text-md-right">
<span class="tile-title">
<%= ExplorerWeb.TransactionView.value(@transaction, include_label: false) %> <%= gettext "Ether" %>
<div class="col-md-3 col-lg-2 d-flex flex-row flex-md-column justify-content-start text-md-right mt-3 mt-md-0">
<span class="mr-2 mr-md-0">
<%= link(
gettext("Block #%{number}", number: to_string(@transaction.block.number)),
to: block_path(ExplorerWeb.Endpoint, :show, @locale, @transaction.block)
) %>
</span>
<span><%= ExplorerWeb.TransactionView.formatted_fee(@transaction, denomination: :ether) %> <%= gettext "Fee" %></span>
<span data-from-now="<%= @transaction.block.timestamp %>"></span>
</div>
</div>
</div>

@ -1,8 +1,8 @@
<% block = @transaction.block %>
<section>
<div class="row">
<div class="col-md-8">
<!-- Block Details -->
<div class="col-md-12 col-lg-8">
<!-- Transaction Details -->
<div class="card">
<div class="card-body">
<h1 class="card-title"><%= gettext "Transaction Details" %> </h1>
@ -74,36 +74,44 @@
</div>
</div>
</div>
<!-- Value -->
<div class="col-md-4">
<div class="card bg-primary">
<div class="card-body">
<h2 class="card-title text-white"><%= gettext "Ether" %> <%= gettext "Value" %></h2>
<div class="text-right">
<h3 class="text-white"> <%= value(@transaction) %></h3>
<span class="text-light"> <%= formatted_usd_value(@transaction, @exchange_rate) %></span>
<div class="col-md-12 col-lg-4">
<div class="row">
<div class="col-md-6 col-lg-12">
<!-- Value -->
<div class="card bg-primary ">
<div class="card-body">
<h2 class="card-title text-white"><%= gettext "Ether" %> <%= gettext "Value" %></h2>
<div class="text-right">
<h3 class="text-white"> <%= value(@transaction) %></h3>
<span class="text-light"> <%= formatted_usd_value(@transaction, @exchange_rate) %></span>
</div>
</div>
</div>
</div>
</div>
<!-- Gas -->
<div class="card">
<div class="card-body">
<h2 class="card-title"> <%= gettext "Gas" %> </h2>
<div class="text-right">
<!-- Gas Used -->
<h3>
<span>
<%= gettext "Used" %>
<%= gas_used(@transaction) %> @
<%= gas_price(@transaction, :gwei) %>
</span>
</h3>
<!-- Gas Limit -->
<span class="text-muted">
<%= gettext "Limit" %>
<%= format_gas_limit(@transaction.gas) %>
</span>
<div class="col-md-6 col-lg-12">
<!-- Gas -->
<div class="card">
<div class="card-body">
<h2 class="card-title"> <%= gettext "Gas" %> </h2>
<div class="text-right">
<!-- Gas Used -->
<h3>
<span>
<%= gettext "Used" %>
<%= gas_used(@transaction) %> @
<%= gas_price(@transaction, :gwei) %>
</span>
</h3>
<!-- Gas Limit -->
<span class="text-muted">
<%= gettext "Limit" %>
<%= format_gas_limit(@transaction.gas) %>
</span>
</div>
</div>
</div>
</div>
</div>
</div>

@ -1,6 +1,6 @@
<div class="tile tile-type-internal-transaction fade-in" data-test="internal_transaction" data-internal-transaction-id="<%= @internal_transaction.id %>">
<div class="row justify-content-end">
<div class="col-md-3 col-lg-2 d-flex align-items-center justify-content-start justify-content-lg-center tile-label">
<div class="row">
<div class="col-md-2 d-flex flex-column align-items-left justify-content-start justify-content-lg-center tile-label">
<%= gettext("Internal Transaction") %>
</div>
<div class="col-md-9 col-lg-10 d-flex flex-column text-nowrap">

@ -1,7 +1,7 @@
defmodule ExplorerWeb.AddressTransactionView do
use ExplorerWeb, :view
alias Explorer.Chain.{Transaction}
alias Explorer.Chain.Address
import ExplorerWeb.AddressView,
only: [contract?: 1, smart_contract_verified?: 1, smart_contract_with_read_only_functions?: 1]
@ -14,22 +14,6 @@ defmodule ExplorerWeb.AddressTransactionView do
end
end
def address_sending_and_receiving_tokens?(%Transaction{} = transaction, address_hash) do
address_receiving_tokens?(transaction, address_hash) && address_sending_tokens?(transaction, address_hash)
end
def address_receiving_tokens?(%Transaction{token_transfers: token_transfers}, address_hash) do
Enum.any?(token_transfers, &(&1.to_address_hash == address_hash))
end
def address_sending_tokens?(%Transaction{token_transfers: token_transfers}, address_hash) do
Enum.any?(token_transfers, &(&1.from_address_hash == address_hash))
end
def transfered_value?(%Explorer.Chain.Wei{value: value}) do
Decimal.to_integer(value) != 0
end
@doc """
Formats the given amount according to given decimals.
@ -52,4 +36,8 @@ defmodule ExplorerWeb.AddressTransactionView do
|> Decimal.reduce()
|> Decimal.to_string(:normal)
end
def from_or_to_address?(%{from_address_hash: from_hash, to_address_hash: to_hash}, %Address{hash: hash}) do
from_hash == hash || to_hash == hash
end
end

@ -132,10 +132,6 @@ defmodule ExplorerWeb.TransactionView do
format_wei_value(value, :ether, include_unit_label: include_label?)
end
defp fee_to_currency({fee_type, fee}, denomination: denomination) do
{fee_type, format_wei_value(Wei.from(fee, :wei), denomination)}
end
defp fee_to_currency({fee_type, fee}, exchange_rate: %Token{} = exchange_rate) do
formatted =
fee
@ -145,4 +141,10 @@ defmodule ExplorerWeb.TransactionView do
{fee_type, formatted}
end
defp fee_to_currency({fee_type, fee}, opts) do
denomination = Keyword.get(opts, :denomination)
include_label? = Keyword.get(opts, :include_label, true)
{fee_type, format_wei_value(Wei.from(fee, :wei), denomination, include_unit_label: include_label?)}
end
end

@ -16,7 +16,7 @@ msgid "Copyright %{year} POA"
msgstr ""
#: lib/explorer_web/templates/block/_tile.html.eex:37
#: lib/explorer_web/templates/block/overview.html.eex:84
#: lib/explorer_web/templates/block/overview.html.eex:87
msgid "Gas Used"
msgstr ""
@ -50,7 +50,7 @@ msgstr ""
msgid "Transactions"
msgstr ""
#: lib/explorer_web/templates/transaction/overview.html.eex:81
#: lib/explorer_web/templates/transaction/overview.html.eex:84
msgid "Value"
msgstr ""
@ -63,12 +63,12 @@ msgid "Difficulty"
msgstr ""
#: lib/explorer_web/templates/block/_tile.html.eex:45
#: lib/explorer_web/templates/block/overview.html.eex:92
#: lib/explorer_web/templates/block/overview.html.eex:95
msgid "Gas Limit"
msgstr ""
#: lib/explorer_web/templates/block/_tile.html.eex:24
#: lib/explorer_web/templates/block/overview.html.eex:70
#: lib/explorer_web/templates/block/overview.html.eex:72
#: lib/explorer_web/templates/chain/_block.html.eex:9
msgid "Miner"
msgstr ""
@ -110,7 +110,7 @@ msgstr ""
msgid "Cumulative Gas Used"
msgstr ""
#: lib/explorer_web/templates/transaction/overview.html.eex:92
#: lib/explorer_web/templates/transaction/overview.html.eex:97
msgid "Gas"
msgstr ""
@ -283,11 +283,11 @@ msgid "Showing #%{number}"
msgstr ""
#:
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:29
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:60
#: lib/explorer_web/templates/pending_transaction/index.html.eex:71
#: lib/explorer_web/templates/transaction/_tile.html.eex:26
#: lib/explorer_web/templates/transaction/overview.html.eex:81
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:22
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:31
#: lib/explorer_web/templates/pending_transaction/index.html.eex:68
#: lib/explorer_web/templates/transaction/_tile.html.eex:20
#: lib/explorer_web/templates/transaction/overview.html.eex:84
#: lib/explorer_web/templates/transaction_internal_transaction/_internal_transaction.html.eex:16
#: lib/explorer_web/views/wei_helpers.ex:71
msgid "Ether"
@ -443,6 +443,9 @@ msgstr ""
msgid "View All"
msgstr ""
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:34
#: lib/explorer_web/templates/pending_transaction/index.html.eex:69
#: lib/explorer_web/templates/transaction/_tile.html.eex:22
#: lib/explorer_web/templates/transaction/overview.html.eex:57
msgid "TX Fee"
msgstr ""
@ -463,11 +466,11 @@ msgstr ""
msgid "There are no Transactions"
msgstr ""
#: lib/explorer_web/templates/address_internal_transaction/index.html.eex:133
#: lib/explorer_web/templates/address_transaction/index.html.eex:146
#: lib/explorer_web/templates/address_internal_transaction/index.html.eex:132
#: lib/explorer_web/templates/address_transaction/index.html.eex:145
#: lib/explorer_web/templates/block/index.html.eex:15
#: lib/explorer_web/templates/block_transaction/index.html.eex:51
#: lib/explorer_web/templates/pending_transaction/index.html.eex:79
#: lib/explorer_web/templates/pending_transaction/index.html.eex:78
#: lib/explorer_web/templates/transaction/index.html.eex:66
msgid "Older"
msgstr ""
@ -598,7 +601,7 @@ msgid "There are no transactions for this address."
msgstr ""
#, elixir-format
#: lib/explorer_web/templates/pending_transaction/index.html.eex:66
#: lib/explorer_web/templates/pending_transaction/index.html.eex:64
#: lib/explorer_web/templates/transaction/overview.html.eex:16
msgid "Contract Address Pending"
msgstr ""
@ -619,25 +622,24 @@ msgid "at"
msgstr ""
#, elixir-format
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:49
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:111
#: lib/explorer_web/templates/transaction/_tile.html.eex:18
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:41
#: lib/explorer_web/templates/transaction/_tile.html.eex:28
msgid "Block #%{number}"
msgstr ""
#, elixir-format
#:
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:24
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:42
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:103
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:29
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:54
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:91
msgid "IN"
msgstr ""
#, elixir-format
#:
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:22
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:38
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:98
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:27
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:50
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:87
msgid "OUT"
msgstr ""
@ -685,7 +687,7 @@ msgid "Block Confirmations"
msgstr ""
#, elixir-format
#: lib/explorer_web/templates/transaction/overview.html.eex:104
#: lib/explorer_web/templates/transaction/overview.html.eex:109
msgid "Limit"
msgstr ""
@ -700,7 +702,7 @@ msgid "There are no logs for this transaction."
msgstr ""
#, elixir-format
#: lib/explorer_web/templates/transaction/overview.html.eex:97
#: lib/explorer_web/templates/transaction/overview.html.eex:102
msgid "Used"
msgstr ""
@ -710,7 +712,7 @@ msgid "Token Transfer"
msgstr ""
#, elixir-format
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:69
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:64
msgid "Transfers"
msgstr ""

@ -28,7 +28,7 @@ msgid "Copyright %{year} POA"
msgstr "%{year} POA Network Ltd. All rights reserved"
#: lib/explorer_web/templates/block/_tile.html.eex:37
#: lib/explorer_web/templates/block/overview.html.eex:84
#: lib/explorer_web/templates/block/overview.html.eex:87
msgid "Gas Used"
msgstr "Gas Used"
@ -62,7 +62,7 @@ msgstr "POA Network Explorer"
msgid "Transactions"
msgstr "Transactions"
#: lib/explorer_web/templates/transaction/overview.html.eex:81
#: lib/explorer_web/templates/transaction/overview.html.eex:84
msgid "Value"
msgstr "Value"
@ -75,12 +75,12 @@ msgid "Difficulty"
msgstr "Difficulty"
#: lib/explorer_web/templates/block/_tile.html.eex:45
#: lib/explorer_web/templates/block/overview.html.eex:92
#: lib/explorer_web/templates/block/overview.html.eex:95
msgid "Gas Limit"
msgstr "Gas Limit"
#: lib/explorer_web/templates/block/_tile.html.eex:24
#: lib/explorer_web/templates/block/overview.html.eex:70
#: lib/explorer_web/templates/block/overview.html.eex:72
#: lib/explorer_web/templates/chain/_block.html.eex:9
msgid "Miner"
msgstr "Validator"
@ -122,7 +122,7 @@ msgstr "Transaction Details"
msgid "Cumulative Gas Used"
msgstr "Cumulative Gas Used"
#: lib/explorer_web/templates/transaction/overview.html.eex:92
#: lib/explorer_web/templates/transaction/overview.html.eex:97
msgid "Gas"
msgstr "Gas"
@ -295,11 +295,11 @@ msgid "Showing #%{number}"
msgstr ""
#:
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:29
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:60
#: lib/explorer_web/templates/pending_transaction/index.html.eex:71
#: lib/explorer_web/templates/transaction/_tile.html.eex:26
#: lib/explorer_web/templates/transaction/overview.html.eex:81
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:22
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:31
#: lib/explorer_web/templates/pending_transaction/index.html.eex:68
#: lib/explorer_web/templates/transaction/_tile.html.eex:20
#: lib/explorer_web/templates/transaction/overview.html.eex:84
#: lib/explorer_web/templates/transaction_internal_transaction/_internal_transaction.html.eex:16
#: lib/explorer_web/views/wei_helpers.ex:71
msgid "Ether"
@ -455,6 +455,9 @@ msgstr ""
msgid "View All"
msgstr ""
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:34
#: lib/explorer_web/templates/pending_transaction/index.html.eex:69
#: lib/explorer_web/templates/transaction/_tile.html.eex:22
#: lib/explorer_web/templates/transaction/overview.html.eex:57
msgid "TX Fee"
msgstr ""
@ -475,11 +478,11 @@ msgstr ""
msgid "There are no Transactions"
msgstr ""
#: lib/explorer_web/templates/address_internal_transaction/index.html.eex:133
#: lib/explorer_web/templates/address_transaction/index.html.eex:146
#: lib/explorer_web/templates/address_internal_transaction/index.html.eex:132
#: lib/explorer_web/templates/address_transaction/index.html.eex:145
#: lib/explorer_web/templates/block/index.html.eex:15
#: lib/explorer_web/templates/block_transaction/index.html.eex:51
#: lib/explorer_web/templates/pending_transaction/index.html.eex:79
#: lib/explorer_web/templates/pending_transaction/index.html.eex:78
#: lib/explorer_web/templates/transaction/index.html.eex:66
msgid "Older"
msgstr ""
@ -610,7 +613,7 @@ msgid "There are no transactions for this address."
msgstr ""
#, elixir-format
#: lib/explorer_web/templates/pending_transaction/index.html.eex:66
#: lib/explorer_web/templates/pending_transaction/index.html.eex:64
#: lib/explorer_web/templates/transaction/overview.html.eex:16
msgid "Contract Address Pending"
msgstr ""
@ -631,25 +634,24 @@ msgid "at"
msgstr ""
#, elixir-format
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:49
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:111
#: lib/explorer_web/templates/transaction/_tile.html.eex:18
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:41
#: lib/explorer_web/templates/transaction/_tile.html.eex:28
msgid "Block #%{number}"
msgstr ""
#, elixir-format
#:
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:24
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:42
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:103
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:29
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:54
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:91
msgid "IN"
msgstr ""
#, elixir-format
#:
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:22
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:38
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:98
#: lib/explorer_web/templates/address_internal_transaction/_internal_transaction.html.eex:27
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:50
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:87
msgid "OUT"
msgstr ""
@ -697,7 +699,7 @@ msgid "Block Confirmations"
msgstr ""
#, elixir-format
#: lib/explorer_web/templates/transaction/overview.html.eex:104
#: lib/explorer_web/templates/transaction/overview.html.eex:109
msgid "Limit"
msgstr ""
@ -712,7 +714,7 @@ msgid "There are no logs for this transaction."
msgstr ""
#, elixir-format
#: lib/explorer_web/templates/transaction/overview.html.eex:97
#: lib/explorer_web/templates/transaction/overview.html.eex:102
msgid "Used"
msgstr ""
@ -722,7 +724,7 @@ msgid "Token Transfer"
msgstr ""
#, elixir-format
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:69
#: lib/explorer_web/templates/address_transaction/_transaction.html.eex:64
msgid "Transfers"
msgstr ""

Loading…
Cancel
Save