commit
a101cd5327
@ -0,0 +1,62 @@ |
||||
.token-tile-view-more { |
||||
line-height: 0.5; |
||||
text-align: center; |
||||
|
||||
&:hover, :focus { |
||||
text-decoration: none; |
||||
} |
||||
} |
||||
.token-tile-view-more span { |
||||
display: inline-block; |
||||
position: relative; |
||||
} |
||||
.token-tile-view-more span:before, |
||||
.token-tile-view-more span:after { |
||||
content: ""; |
||||
position: absolute; |
||||
height: 5px; |
||||
border-bottom: 1px solid $border-color; |
||||
border-top: 1px solid $border-color; |
||||
top: 0; |
||||
width: 43%; |
||||
} |
||||
.token-tile-view-more span:before { |
||||
right: 55%; |
||||
margin-right: .9375rem; |
||||
} |
||||
.token-tile-view-more span:after { |
||||
left: 55%; |
||||
margin-left: .9375rem; |
||||
} |
||||
|
||||
|
||||
|
||||
@include media-breakpoint-down(md) { |
||||
|
||||
.token-tile-view-more span:before, |
||||
.token-tile-view-more span:after { |
||||
width: 40%; |
||||
} |
||||
.token-tile-view-more span:before { |
||||
right: 58%; |
||||
} |
||||
.token-tile-view-more span:after { |
||||
left: 58%; |
||||
} |
||||
|
||||
} |
||||
|
||||
@include media-breakpoint-down(sm) { |
||||
|
||||
.token-tile-view-more span:before, |
||||
.token-tile-view-more span:after { |
||||
width: 28%; |
||||
} |
||||
.token-tile-view-more span:before { |
||||
right: 66%; |
||||
} |
||||
.token-tile-view-more span:after { |
||||
left: 66%; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,3 @@ |
||||
$primary: #1b1b3a; |
||||
$secondary: #40ed9e; |
||||
$tertiary: #40ed9e; |
@ -1,5 +1,3 @@ |
||||
$logo-file-path: url("/../images/ethereum_logo.svg"); |
||||
|
||||
$primary: #12455b; |
||||
$secondary: #4786cb; |
||||
$tertiary: #77a4c5; |
||||
|
@ -0,0 +1,20 @@ |
||||
import $ from 'jquery' |
||||
|
||||
const tokenTransferToggle = (element) => { |
||||
const $element = $(element) |
||||
const $tokenTransferClose = $element.find("[data-selector='token-transfer-close']") |
||||
const $tokenTransferOpen = $element.find("[data-selector='token-transfer-open']") |
||||
|
||||
$element.on('show.bs.collapse', () => { |
||||
$tokenTransferOpen.addClass('d-none') |
||||
$tokenTransferClose.removeClass('d-none') |
||||
}) |
||||
|
||||
$element.on('hide.bs.collapse', () => { |
||||
$tokenTransferClose.addClass('d-none') |
||||
$tokenTransferOpen.removeClass('d-none') |
||||
}) |
||||
} |
||||
|
||||
// Initialize the script scoped for each card.
|
||||
$("[data-selector='token-transfers-toggle']").each((_index, element) => tokenTransferToggle(element)) |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 4.9 KiB |
@ -1,5 +1,5 @@ |
||||
<%= if @address_hash do %> |
||||
<%= link to: address_path(BlockScoutWeb.Endpoint, :show, @locale, @address_hash), "data-address-hash": @address_hash, "data-test": "address_hash_link" do %> |
||||
<%= render BlockScoutWeb.AddressView, "_responsive_hash.html", address_hash: @address_hash, contract: @contract %> |
||||
<%= link to: address_path(BlockScoutWeb.Endpoint, :show, @locale, @address_hash), "data-test": "address_hash_link" do %> |
||||
<%= render BlockScoutWeb.AddressView, "_responsive_hash.html", address_hash: @address_hash, contract: @contract, truncate: assigns[:truncate] %> |
||||
<% end %> |
||||
<% end %> |
||||
|
@ -1,4 +1,8 @@ |
||||
<span class="<%= if @contract do %>contract-address<% end %>"> |
||||
<span class="d-none d-md-none d-lg-inline"><%= @address_hash %></span> |
||||
<span class="d-md-inline-block d-lg-none "><%= BlockScoutWeb.AddressView.trimmed_hash(@address_hash) %></span> |
||||
<span class="<%= if @contract do %>contract-address<% end %>" data-address-hash="<%= @address_hash %>"> |
||||
<%= if assigns[:truncate] do %> |
||||
<%= BlockScoutWeb.AddressView.trimmed_hash(@address_hash) %> |
||||
<% else %> |
||||
<span class="d-none d-md-none d-lg-inline"><%= @address_hash %></span> |
||||
<span class="d-md-inline-block d-lg-none"><%= BlockScoutWeb.AddressView.trimmed_hash(@address_hash) %></span> |
||||
<% end%> |
||||
</span> |
||||
|
@ -1,99 +0,0 @@ |
||||
<div class="tile tile-type-<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %> fade-in tile-status--<%= BlockScoutWeb.TransactionView.status(@transaction) %>" data-transaction-hash="<%= @transaction.hash %>"> |
||||
<div class="row"> |
||||
<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"> |
||||
<%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %> |
||||
</span> |
||||
|
||||
<span class="tile-status-label ml-2 ml-md-0" data-test="transaction_status"> |
||||
<%= BlockScoutWeb.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 BlockScoutWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: @transaction.hash %> |
||||
<span class="text-nowrap"> |
||||
<%= if @address.hash == @transaction.from_address_hash do %> |
||||
<%= render BlockScoutWeb.AddressView, "_responsive_hash.html", address_hash: @transaction.from_address_hash, contract: BlockScoutWeb.AddressView.contract?(@transaction.from_address) %> |
||||
<% else %> |
||||
<%= render BlockScoutWeb.AddressView, "_link.html", address_hash: @transaction.from_address_hash, contract: BlockScoutWeb.AddressView.contract?(@transaction.from_address), locale: @locale %> |
||||
<% end %> |
||||
|
||||
→ |
||||
|
||||
<%= if @address.hash == BlockScoutWeb.TransactionView.to_address_hash(@transaction) do %> |
||||
<%= render BlockScoutWeb.AddressView, "_responsive_hash.html", address_hash: BlockScoutWeb.TransactionView.to_address_hash(@transaction), contract: BlockScoutWeb.AddressView.contract?(@transaction.to_address) %> |
||||
<% else %> |
||||
<%= render BlockScoutWeb.AddressView, "_link.html", address_hash: BlockScoutWeb.TransactionView.to_address_hash(@transaction), contract: BlockScoutWeb.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"> |
||||
<%= BlockScoutWeb.TransactionView.value(@transaction, include_label: false) %> <%= gettext "Ether" %> |
||||
</span> |
||||
<span class="ml-0 ml-md-1 text-nowrap"> |
||||
<%= BlockScoutWeb.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(BlockScoutWeb.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> |
||||
<% end %> |
||||
</div> |
||||
|
||||
<%= if BlockScoutWeb.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> |
||||
</div> |
||||
<% end %> |
||||
|
||||
<%= for token_transfer <- @transaction.token_transfers do %> |
||||
<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"> |
||||
<%= BlockScoutWeb.AddressView.display_address_hash(@address, token_transfer.from_address, @locale) %> |
||||
</span> |
||||
→ |
||||
<span data-test="token_transfer_address_hash"> |
||||
<%= BlockScoutWeb.AddressView.display_address_hash(@address, token_transfer.to_address, @locale) %> |
||||
</span> |
||||
</span> |
||||
<span class="tile-title"> |
||||
<%= token_transfer_amount(token_transfer) %> |
||||
<%= link(token_symbol(token_transfer.token), to: token_path(@conn, :show, @locale, token_transfer.token.contract_address_hash)) %> |
||||
</span> |
||||
</div> |
||||
<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 %> |
||||
<% end %> |
||||
</div> |
||||
<% end %> |
||||
</div> |
||||
</div> |
@ -1,35 +1,74 @@ |
||||
<div class="tile tile-type-<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %> tile-status--<%= BlockScoutWeb.TransactionView.status(@transaction) %> fade-up" data-test="<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %>" data-transaction-hash="<%= @transaction.hash %>"> |
||||
<div class="row" data-test="chain_transaction"> |
||||
<div class="tile tile-type-<%= type_suffix(@transaction) %> fade-in tile-status--<%= status(@transaction) %>" data-test="<%= type_suffix(@transaction) %>" data-transaction-hash="<%= @transaction.hash %>"> |
||||
<div class="row" data-selector="token-transfers-toggle" 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"> |
||||
<%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %> |
||||
<%= transaction_display_type(@transaction) %> |
||||
</span> |
||||
<span class="tile-status-label ml-2 ml-md-0" data-test="transaction_status"> |
||||
<%= formatted_status(@transaction) %> |
||||
</span> |
||||
<div class="tile-status-label ml-2 ml-md-0" data-test="transaction_status"> |
||||
<%= BlockScoutWeb.TransactionView.formatted_status(@transaction) %> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0"> |
||||
<%= render BlockScoutWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: @transaction.hash %> |
||||
<%= render "_link.html", locale: @locale, transaction_hash: @transaction.hash %> |
||||
<span class="text-nowrap"> |
||||
<%= render BlockScoutWeb.AddressView, "_link.html", address_hash: @transaction.from_address_hash, contract: BlockScoutWeb.AddressView.contract?(@transaction.from_address), locale: @locale %> |
||||
<%= BlockScoutWeb.AddressView.display_address_hash(assigns[:current_address], @transaction.from_address, @locale) %> |
||||
→ |
||||
<%= render BlockScoutWeb.AddressView, "_link.html", address_hash: BlockScoutWeb.TransactionView.to_address_hash(@transaction), contract: BlockScoutWeb.AddressView.contract?(@transaction.to_address), locale: @locale %> |
||||
<%= if assigns[:current_address] && assigns[:current_address].hash == to_address_hash(@transaction) do %> |
||||
<%= render BlockScoutWeb.AddressView, "_responsive_hash.html", address_hash: to_address_hash(@transaction), contract: BlockScoutWeb.AddressView.contract?(@transaction.to_address) %> |
||||
<% else %> |
||||
<%= render BlockScoutWeb.AddressView, "_link.html", address_hash: to_address_hash(@transaction), contract: BlockScoutWeb.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"> |
||||
<%= BlockScoutWeb.TransactionView.value(@transaction, include_label: false) %> <%= gettext "Ether" %> |
||||
<%= value(@transaction, include_label: false) %> <%= gettext "Ether" %> |
||||
</span> |
||||
<span class="ml-0 ml-md-1 text-nowrap"> |
||||
<%= formatted_fee(@transaction, denomination: :ether, include_label: false) %> <%= gettext "TX Fee" %> |
||||
</span> |
||||
<span class="ml-0 ml-md-1 text-nowrap"> <%= BlockScoutWeb.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 mt-3 mt-md-0"> |
||||
<span class="mr-2 mr-md-0"> |
||||
<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(BlockScoutWeb.Endpoint, :show, @locale, @transaction.block) |
||||
) %> |
||||
</span> |
||||
<span data-from-now="<%= @transaction.block.timestamp %>"></span> |
||||
<span class="mr-2 mr-md-0 order-2" data-from-now="<%= @transaction.block.timestamp %>"></span> |
||||
<%= if from_or_to_address?(@transaction, assigns[:current_address]) do %> |
||||
<span class="mr-2 mr-md-0 order-0 order-md-3"> |
||||
<%= if @transaction.from_address_hash == assigns[:current_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> |
||||
<% end %> |
||||
</div> |
||||
|
||||
<%= if involves_token_transfers?(@transaction) do %> |
||||
<div class="offset-md-2 col-md-10 col-lg-8 d-flex flex-column mt-2 mb-2"> |
||||
<% [first_token_transfer | remaining_token_transfers]= @transaction.token_transfers %> |
||||
<%= render "_token_transfer.html", address: assigns[:current_address], locale: @locale, token_transfer: first_token_transfer %> |
||||
<div class="collapse token-transfer-toggle" id="<%= @transaction.hash %>"> |
||||
<%= for token_transfer <- remaining_token_transfers do %> |
||||
<%= render "_token_transfer.html", address: assigns[:current_address], locale: @locale, token_transfer: token_transfer %> |
||||
<% end %> |
||||
</div> |
||||
</div> |
||||
<%= if Enum.any?(remaining_token_transfers) do %> |
||||
<div class="col-md-12 d-flex flex-column mt-1 mb-2 text-center token-tile-view-more"> |
||||
<span class="token-tile-more-lines"> |
||||
<%= link gettext("View More Transfers"), to: "##{@transaction.hash}", "data-toggle": "collapse", "data-selector": "token-transfer-open", "data-test": "token_transfers_expansion" %> |
||||
<%= link gettext("View Less Transfers"), class: "d-none", to: "##{@transaction.hash}", "data-toggle": "collapse", "data-selector": "token-transfer-close" %> |
||||
</span> |
||||
</div> |
||||
<% end %> |
||||
<% end %> |
||||
</div> |
||||
</div> |
||||
|
@ -0,0 +1,22 @@ |
||||
<div class="text-nowrap row mt-3 mt-sm-0" data-test="token_transfer"> |
||||
<span class="col-12 col-md-5"> |
||||
<%= if from_or_to_address?(@token_transfer, @address) do %> |
||||
<%= if @token_transfer.from_address_hash == @address.hash do %> |
||||
<span data-test="transaction_type" class="text-danger"> |
||||
↳ |
||||
</span> |
||||
<% else %> |
||||
<span data-test="transaction_type" class="text-success"> |
||||
↳ |
||||
</span> |
||||
<% end %> |
||||
<% end %> |
||||
<%= BlockScoutWeb.AddressView.display_address_hash(@address, @token_transfer.from_address, @locale, true) %> |
||||
→ |
||||
<%= BlockScoutWeb.AddressView.display_address_hash(@address, @token_transfer.to_address, @locale, true) %> |
||||
</span> |
||||
<span class="col-12 col-md-7 ml-3 ml-sm-0"> |
||||
<%= token_transfer_amount(@token_transfer) %> |
||||
<%= link(token_symbol(@token_transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, @locale, @token_transfer.token.contract_address_hash)) %> |
||||
</span> |
||||
</div> |
@ -1,18 +1,18 @@ |
||||
defmodule Explorer.Chain.BalanceTest do |
||||
defmodule Explorer.Chain.Address.CoinBalanceTest do |
||||
use Explorer.DataCase |
||||
|
||||
alias Ecto.Changeset |
||||
alias Explorer.Chain.Balance |
||||
alias Explorer.Chain.Address.CoinBalance |
||||
|
||||
describe "changeset/2" do |
||||
test "is valid with address_hash, block_number, and value" do |
||||
params = params_for(:fetched_balance) |
||||
|
||||
assert %Changeset{valid?: true} = Balance.changeset(%Balance{}, params) |
||||
assert %Changeset{valid?: true} = CoinBalance.changeset(%CoinBalance{}, params) |
||||
end |
||||
|
||||
test "address_hash and block_number is required" do |
||||
assert %Changeset{valid?: false, errors: errors} = Balance.changeset(%Balance{}, %{}) |
||||
assert %Changeset{valid?: false, errors: errors} = CoinBalance.changeset(%CoinBalance{}, %{}) |
||||
|
||||
assert is_list(errors) |
||||
assert length(errors) == 2 |
@ -1,6 +1,6 @@ |
||||
defmodule Indexer.Balances do |
||||
defmodule Indexer.Address.CoinBalances do |
||||
@moduledoc """ |
||||
Extracts `Explorer.Chain.Balance` params from other schema's params. |
||||
Extracts `Explorer.Chain.Address.CoinBalance` params from other schema's params. |
||||
""" |
||||
|
||||
def params_set(%{} = import_options) do |
Loading…
Reference in new issue