Tx page facelifting

pull/4475/head
Viktor Baranov 3 years ago
parent fe0c113286
commit cd34ebec92
  1. 3
      .dialyzer-ignore
  2. 1
      CHANGELOG.md
  3. 2
      apps/block_scout_web/assets/css/_mixins.scss
  4. 56
      apps/block_scout_web/assets/css/components/_btn_copy.scss
  5. 4
      apps/block_scout_web/assets/css/components/_i_tooltip.scss
  6. 7
      apps/block_scout_web/assets/css/components/_i_tooltip_2.scss
  7. 44
      apps/block_scout_web/assets/css/components/_label.scss
  8. 23
      apps/block_scout_web/assets/css/components/_transaction.scss
  9. 1
      apps/block_scout_web/assets/css/non-critical.scss
  10. 3
      apps/block_scout_web/assets/css/theme/_dark-theme.scss
  11. 13
      apps/block_scout_web/assets/js/lib/clipboard_buttons.js
  12. 5
      apps/block_scout_web/assets/js/lib/transaction_input_dropdown.js
  13. 4
      apps/block_scout_web/lib/block_scout_web/templates/common_components/_i_tooltip.html.eex
  14. 11
      apps/block_scout_web/lib/block_scout_web/templates/common_components/_i_tooltip_2.html.eex
  15. 10
      apps/block_scout_web/lib/block_scout_web/templates/common_components/_status_icon.html.eex
  16. 2
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex
  17. 4
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex
  18. 11
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers_from_to.html.eex
  19. 515
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
  20. 251
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
  21. 335
      apps/block_scout_web/priv/gettext/default.pot
  22. 335
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  23. 28
      apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs
  24. 24
      apps/explorer/lib/explorer/chain.ex

@ -29,3 +29,6 @@ lib/explorer/staking/stake_snapshotting.ex:15: Function do_snapshotting/7 has no
lib/explorer/staking/stake_snapshotting.ex:147
lib/explorer/third_party_integrations/sourcify.ex:70
lib/explorer/third_party_integrations/sourcify.ex:73
lib/block_scout_web/views/transaction_view.ex:137
lib/block_scout_web/views/transaction_view.ex:152
lib/block_scout_web/views/transaction_view.ex:197

@ -1,6 +1,7 @@
## Current
### Features
- [#4475](https://github.com/blockscout/blockscout/pull/4475) - Tx page facelifting
### Fixes
- [#4473](https://github.com/blockscout/blockscout/pull/4473) - Search autocomplete: fix for address/block/tx hash

@ -126,7 +126,7 @@
}
}
@mixin btn-line($bg-color: #fff, $text-color: $secondary) {
@mixin btn-line($bg-color: #fff, $text-color: $secondary, $font-size: 12px) {
-webkit-appearance: none !important;
align-items: center;
background-color: $bg-color;

@ -1,6 +1,62 @@
$btn-copy-color: $primary !default;
$btn-copy-dimensions: 31px !default;
$btn-copy-small-dimensions: 22px !default;
.btn-copy-icon {
@include square-icon-button($btn-copy-color, $btn-copy-dimensions);
&.btn-copy-icon-no-borders {
&:hover {
background-color: transparent;
path {
fill: $btn-copy-color;
}
}
border: none;
}
svg {
width: $btn-copy-dimensions;
height: $btn-copy-dimensions;
}
&.btn-copy-icon-small {
&.btn-copy-icon-custom {
position: absolute;
top: -1.2px;
}
@include square-icon-button($btn-copy-color, $btn-copy-small-dimensions);
&.btn-copy-icon-no-borders {
&:hover {
background-color: transparent;
path {
fill: $btn-copy-color;
}
}
border: none;
}
svg {
width: $btn-copy-small-dimensions;
height: $btn-copy-small-dimensions;
}
}
}
.btn-copy-mobile-container {
@include media-breakpoint-up(md) {
display: flex;
}
}
.btn-copy-mobile {
@include media-breakpoint-up(md) {
margin-left: 0.5rem;
}
}
.btn-copy-tx-raw-input-container {
position: relative;
width: 19px;
}
.btn-copy-tx-raw-input {
position: absolute;
bottom: 0;
}

@ -20,4 +20,8 @@ $i-tooltip-background-active: $primary !default;
fill: $i-tooltip-background-active;
}
}
&.ds-inline {
display: inline;
}
}

@ -0,0 +1,7 @@
.i-tooltip-2 {
color: $i-tooltip-background;
&:hover {
color: $i-tooltip-background-active;
}
}

@ -2,11 +2,15 @@
display: inline-block;
padding: 0 5px;
background: #f5f6fa;
color: #a3a9b5;
color: #77838f;
border-radius: 5px;
font-size: 10px;
height: 25px;
line-height: 25px;
&.large {
font-size: 14px;
}
font-size: 12px;
padding: 5px;
line-height: normal;
&.right {
margin-left: auto;
float: right;
@ -15,10 +19,6 @@
background: #6ca1e2;
color: #fff;
}
&.amb {
background: $secondary;
color: #fff;
}
&.destination-eth {
background: #253358;
color: #fff;
@ -27,6 +27,10 @@
background: #e7b941;
color: #fff;
}
&.destination-rinkeby {
background: #153550;
color: #fff;
}
&.bridged {
background: #70aee3;
color: #fff;
@ -45,4 +49,28 @@
&.from-dropdown {
margin-top: -3px;
}
&.success {
background: rgba(40, 167, 69, 0.2);
color: rgb(40, 167, 69);
}
}
.confirmations-label {
position: relative;
padding-left: 1.15rem;
border-top-right-radius: .25rem;
border-bottom-right-radius: .25rem;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
padding-right: 10px;
}
.confirmations-label:after {
position: absolute;
left: 0;
top: 0;
content: "";
border-top: .9rem solid transparent;
border-bottom: .9rem solid transparent;
border-left: .9rem solid #fff;
}

@ -56,4 +56,25 @@
@include media-breakpoint-up(sm) {
white-space: nowrap !important;
}
}
}
.address-mobile {
@include media-breakpoint-down(sm) {
width: 80px;
}
}
.transfers-list-mobile-container {
@include media-breakpoint-down(sm) {
margin-top: 0.5rem;
}
}
.transaction-details {
font-size: 14px;
}
.transaction-gas-used {
@media (min-width: 1200px) {
white-space: nowrap;
}
}

@ -9,6 +9,7 @@
@import "node_modules/bootstrap/scss/tooltip";
@import "components/i_tooltip";
@import "components/i_tooltip_2";
@import "components/check_tooltip";
@import "components/me_tooltip";
@import "components/tooltip";

@ -1150,3 +1150,6 @@ $dark-stakes-banned-background: #3e314c;
color: $dark-primary;
}
}
.dark-theme-applied .confirmations-label:after {
background: .7rem solid $dark-light-bg;
}

@ -6,12 +6,15 @@ const clipboard = new ClipboardJS('[data-clipboard-text]')
clipboard.on('success', ({ trigger }) => {
const copyButton = $(trigger)
copyButton.tooltip('dispose')
copyButton.children().tooltip('dispose')
copyButton.tooltip({
title: 'Copied!',
trigger: 'click',
placement: 'top'
}).tooltip('show')
const originalTitle = copyButton.attr('data-original-title')
copyButton
.attr('data-original-title', 'Copied!')
.tooltip('show')
copyButton.attr('data-original-title', originalTitle)
setTimeout(() => {
copyButton.tooltip('dispose')

@ -4,9 +4,10 @@ $('.tx-input-dropdown').click(function (e) {
e.preventDefault()
const el = $(e.currentTarget)
const target = $(el.attr('data-target'))
const target = $(el.data('target'))
const targetToHide = $(el.data('target-to-hide'))
target.show()
target.siblings('.transaction-input').hide()
targetToHide.hide()
$('#tx-input-decoding-button').text(el.text())
})

@ -1,5 +1,5 @@
<div
class="i-tooltip"
class="i-tooltip <%= if assigns[:additional_classes] do @additional_classes |> Enum.join(" ") end %>"
data-boundary="window"
data-container="body"
data-html="true"
@ -7,7 +7,7 @@
data-toggle="tooltip"
title="<%= @text %>"
>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<svg xmlns="http://www.w3.org/2000/svg" width="<%= if assigns[:width] do @width else "16" end %>" height="<%= if assigns[:height] do @height else "16" end %>">
<path class="i-tooltip-circle" fill-rule="evenodd" d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0z"/>
<path class="i-tooltip-info" fill-rule="evenodd" d="M8 13a1 1 0 0 1-1-1V8a1 1 0 0 1 2 0v4a1 1 0 0 1-1 1zm0-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
</svg>

@ -0,0 +1,11 @@
<span
class="i-tooltip-2 <%= if assigns[:additional_classes] do @additional_classes |> Enum.join(" ") end %>"
data-boundary="window"
data-container="body"
data-html="true"
data-placement="top"
data-toggle="tooltip"
title="<%= @text %>"
>
<i class="fas fa-info-circle"></i>
</span>

@ -0,0 +1,10 @@
<%= case @status do %>
<% :success -> %>
<i style="color: #20b760;" class="far fa-check-circle"></i>
<% {:error, _} -> %>
<i style="color: #dc3545;" class="fas fa-exclamation-circle"></i>
<% :awaiting_internal_transactions -> %>
<i style="color: #f7b32b;" class="fas fa-exclamation-circle"></i>
<% :pending -> %>
<% _ -> %>
<% end %>

@ -3,7 +3,7 @@
<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"> <%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %></span>
<div class="tile-status-label ml-2 ml-md-0" data-test="transaction_status"><%= BlockScoutWeb.TransactionView.formatted_status(status) %></div>
<div class="tile-status-label ml-2 ml-md-0" data-test="transaction_status"><%= BlockScoutWeb.TransactionView.formatted_result(status) %></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", transaction_hash: @transaction.hash %>

@ -13,14 +13,14 @@
<span class="loading-spinner-block-2"></span>
</div>
<% end %>
<%= formatted_status(status) %>
<%= formatted_result(status) %>
</span>
</div>
<!-- Content -->
<div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0">
<span>
<div class="text-truncate d-flex">
<%= render "_link.html", transaction_hash: @transaction.hash %>
<%= render "_link.html", transaction_hash: @transaction.hash, data_test: "address_hash_link" %>
<% method_name = Transaction.get_method_name(@transaction) %>
<%= if method_name do %>
<%= render BlockScoutWeb.FormView, "_tag.html", text: method_name, additional_classes: ["method", "ml-1"] %>

@ -0,0 +1,11 @@
<%= with {:ok, from_address} <- Chain.hash_to_address(@transfer.from_address_hash),
{:ok, to_address} <- Chain.hash_to_address(@transfer.to_address_hash) do %>
<dl class="row mb-2" style="margin-left: 0px;">
<dt style="width: auto;"><b>From</b></dt><dd class="col-sm-1 col-md-4 address-mobile" style="padding-right: 0px; min-width: 100px; max-width: 335px; word-break: break-all;"><%= render BlockScoutWeb.AddressView, "_link.html", address: from_address, contract: BlockScoutWeb.AddressView.contract?(from_address), use_custom_tooltip: false, trimmed: false %></dd>
<dt style="width: auto; padding-left: 10px;"><b>To</b></dt><dd class="col-sm-1 col-md-4 address-mobile" style="padding-right: 0px; min-width: 100px; max-width: 335px; word-break: break-all;"><%= render BlockScoutWeb.AddressView, "_link.html", address: to_address, contract: BlockScoutWeb.AddressView.contract?(to_address), use_custom_tooltip: false, trimmed: false %></dd>
<dt style="width: auto; padding-left: 10px;"><b>For</b></dt>
<% end %>
<dd class="col-sm-12 col-md-12 col-lg-3 address-mobile" style="width: auto;">
<%= render BlockScoutWeb.TransactionView, "_total_transfers.html", transfer: @transfer %>
</dd>
</dl>

@ -1,17 +1,19 @@
<% block = @transaction.block %>
<% from_address_hash = @transaction.from_address_hash %>
<% to_address_hash = @transaction.to_address_hash %>
<% created_address_hash = @transaction.created_contract_address_hash %>
<% decoded_input_data = decoded_input_data(@transaction) %>
<% status = transaction_status(@transaction) %>
<% circles_addresses_list = CustomContractsHelpers.get_custom_addresses_list(:circles_addresses) %>
<% address_hash_str = if @transaction.to_address_hash, do: "0x" <> Base.encode16(@transaction.to_address_hash.bytes, case: :lower), else: nil %>
<% {:ok, created_from_address} = if @transaction.to_address_hash, do: Chain.hash_to_address(@transaction.to_address_hash), else: {:ok, nil} %>
<% address_hash_str = if to_address_hash, do: "0x" <> Base.encode16(to_address_hash.bytes, case: :lower), else: nil %>
<% {:ok, created_from_address} = if to_address_hash, do: Chain.hash_to_address(to_address_hash), else: {:ok, nil} %>
<% created_from_address_hash_str = if from_address_hash(created_from_address), do: "0x" <> Base.encode16(from_address_hash(created_from_address).bytes, case: :lower), else: nil %>
<%= render BlockScoutWeb.Advertisement.TextAdView, "index.html", conn: @conn %>
<section data-page="transaction-details" data-page-transaction-hash="<%= @transaction %>">
<section class="transaction-details" data-page="transaction-details" data-page-transaction-hash="<%= @transaction %>">
<div class="row">
<div class="col-md-12 col-lg-8 pr-0-md">
<div class="col-md-12">
<!-- Transaction Details -->
<div class="card card-mr-50-md js-ad-dependant-mb-3">
<div class="card js-ad-dependant-mb-3">
<div class="card-body">
<%= cond do %>
<% Enum.member?(circles_addresses_list, address_hash_str) -> %>
@ -26,32 +28,9 @@
<%= nil %>
<% end %>
<h1 class="card-title">
<%= gettext "Transaction Details" %>
<%= if status == :pending do %>
<span class="btn btn-danger btn-full-primary ml-2 js-cancel-transaction"
style="display: inline-flex;"
data-from="<%= from_address_hash %>"
data-nonce="<%= @transaction.nonce %>"
data-chain-id="<%= Chain.Cache.NetVersion.get_version() %>"
data-placement="top"
data-toggle="tooltip">Cancel transaction</span>
<% end %>
<!-- buttons -->
<span class="overview-title-buttons float-right">
<span data-clipboard-text="<%= @transaction %>">
<span
aria-label='<%= gettext("Copy Transaction Hash") %>'
class="btn-copy-icon"
data-placement="top"
data-toggle="tooltip"
title='<%= gettext("Copy Txn Hash") %>'
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.5 32.5" width="32" height="32">
<path fill-rule="evenodd" d="M23.5 20.5a1 1 0 0 1-1-1v-9h-9a1 1 0 0 1 0-2h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1zm-3-7v10a1 1 0 0 1-1 1h-10a1 1 0 0 1-1-1v-10a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1zm-2 1h-8v8h8v-8z"/>
</svg>
</span>
</span>
</span>
<div style="display: inline-block; vertical-align: bottom; line-height: 25px;">
<%= gettext "Transaction Details" %>
</div>
</h1>
<%= if status == :pending do %>
<div class="tile tile-muted d-flex justify-content-center align-items-center mb-4">
@ -62,36 +41,80 @@
<%= gettext("This transaction is pending confirmation.") %>
</div>
<% end %>
<h3 class="transaction-details-address" data-test="transaction_detail_hash"><%= @transaction %> </h3>
<span class="d-block mb-2 text-muted">
<%= @transaction |> BlockScoutWeb.AddressView.address_partial_selector(:from, nil) |> BlockScoutWeb.RenderHelpers.render_partial() %>
<span class="text-muted"> &rarr; </span>
<%= @transaction |> BlockScoutWeb.AddressView.address_partial_selector(:to, nil) |> BlockScoutWeb.RenderHelpers.render_partial() %>
</span>
<div class="d-flex flex-row justify-content-start text-muted">
<span class="mr-4 text-<%= BlockScoutWeb.TransactionView.type_suffix(@transaction) %>"><%= BlockScoutWeb.TransactionView.transaction_display_type(@transaction) %></span>
<span class="mr-4" data-transaction-status="<%= BlockScoutWeb.TransactionView.formatted_status(status) %>"><%= BlockScoutWeb.TransactionView.formatted_status(status) %></span>
<span class="mr-4">
<%= if block do %>
<span data-from-now="<%= @transaction.block.timestamp %>"></span>
<% end %>
</span>
</div>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("A TxHash or transaction hash is a unique 66 characters identifier that is generated whenever a transaction is executed.") %>
<%= gettext "Transaction Hash" %>
</dt>
<dd class="col-sm-9 col-lg-10 d-flex" style="word-break: break-all;">
<span class="transaction-details-address" data-test="transaction_detail_hash"><%= @transaction %> </span>
<span>
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"],
clipboard_text: @transaction,
aria_label: gettext("Copy Transaction Hash"),
title: gettext("Copy Txn Hash") %>
</span>
</dd>
</dl>
<!-- Verify in other explorers -->
<!-- <%= render BlockScoutWeb.AddressView, "_verify_other_explorers.html", hash: hash(@transaction), type: "tx" %> -->
<hr>
<!-- Result -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("The result of the transaction: success, error, pending, awaiting internal transactions.") %>
<%= gettext "Result" %>
</dt>
<dd class="col-sm-9 col-lg-10">
<% formatted_result = BlockScoutWeb.TransactionView.formatted_result(status) %>
<span class="mr-4" data-transaction-status="<%= formatted_result %>"><%= render BlockScoutWeb.CommonComponentsView, "_status_icon.html", status: status %><%= formatted_result %></span>
</dd>
</dl>
<!-- Status -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("The status of the transaction: confirmed, unconfirmed.") %>
<%= gettext "Status" %>
</dt>
<dd class="col-sm-9 col-lg-10">
<% formatted_status = BlockScoutWeb.TransactionView.formatted_status(status) %>
<% confirmations = confirmations(@transaction, block_height: @block_height) %>
<span class="mr-4">
<span data-transaction-status="<%= formatted_status %>">
<%= if status == :pending do %>
<%= render BlockScoutWeb.FormView, "_tag.html", text: formatted_status, additional_classes: ["large"] %></span>
<% else %>
<%= render BlockScoutWeb.FormView, "_tag.html", text: formatted_status, additional_classes: ["success", "large"] %></span>
<% end %>
<%= if confirmations > 0 do %>
<span class="bs-label large ml-2 confirmations-label"><%= gettext "Confirmed by " %><span data-selector="block-confirmations"><%= confirmations %></span><%= " " <> confirmations_ds_name(confirmations) %></span>
<% end %>
</span>
</dd>
</dl>
<!-- Revert reason -->
<%= if status == {:error, "Reverted"} do %>
<dl class="row">
<dt class="col-sm-3 text-muted"><%= gettext "Revert reason" %> </dt>
<dd class="col-sm-9" data-selector="block-number">
<%= BlockScoutWeb.TransactionView.transaction_revert_reason(@transaction) %>
</dd>
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("The revert reason of the transaction.") %>
<%= gettext "Revert reason" %> </dt>
<dd class="col-sm-9 col-lg-10">
<%= BlockScoutWeb.TransactionView.transaction_revert_reason(@transaction) %>
</dd>
</dl>
<% end %>
<!-- Block Hash -->
<!-- Block -->
<dl class="row">
<dt class="col-sm-3 text-muted"><%= gettext "Block Number" %> </dt>
<dd class="col-sm-9" data-selector="block-number">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("The number of the block in which the transaction was recorded. Block confirmation indicate how many blocks since the transaction is mined.") %>
<%= gettext "Block" %></dt>
<dd class="col-sm-9 col-lg-10" data-selector="block-number">
<%= if block do %>
<%= link(
block,
@ -99,25 +122,176 @@
to: block_path(@conn, :show, block)
) %>
<% else %>
<%= formatted_status(status) %>
<%= formatted_result(status) %>
<% end %>
</dd>
</dl>
<!-- Timestamp -->
<%= if block && block.timestamp do %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("The date and time at which a transaction is mined.") %>
<%= gettext "Timestamp" %>
</dt>
<dd class="col-sm-9 col-lg-10" data-selector="block-timestamp">
<i class="far fa-clock"></i>
<span>
<span data-from-now="<%= block.timestamp %>"></span>
</span>
<%= case processing_time_duration(@transaction) do %>
<% :pending -> %>
<% nil %>
<% :unknown -> %>
<% nil %>
<% {:ok, interval_string} -> %>
| <%= gettext("Confirmed within") %> <%= interval_string %>
<% end %>
</dd>
</dl>
<% end %>
<!-- From -->
<dl class="row">
<dt class="col-sm-3 text-muted"><%= gettext "Block Confirmations" %></dt>
<dd class="col-sm-9">
<span data-selector="block-confirmations"><%= confirmations(@transaction, block_height: @block_height) %></span>
</dd>
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("The sending party of the transaction (could be from a contract address).") %>
<%= gettext "From" %></dt>
<dd class="col-sm-9 col-lg-10 btn-copy-mobile-container">
<%= link(
from_address_hash,
to: address_path(@conn, :show, from_address_hash)
) %>
<span class="float-right">
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"],
clipboard_text: from_address_hash,
aria_label: gettext("Copy From Address"),
title: gettext("Copy From Address") %>
</span>
</dd>
</dl>
<!-- Nonce -->
<!-- To -->
<% to_address = @transaction |> Map.get(:to_address) || @transaction |> Map.get(:created_contract_address) %>
<% recipient_address_hash = to_address_hash || created_address_hash %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("The receiving party of the transaction (could be a contract address).") %>
<%= if BlockScoutWeb.AddressView.contract?(to_address) && !created_address_hash do %>
<%= gettext "Interacted With (To)" %>
<% else %>
<%= gettext "To" %>
<% end %>
</dt>
<dd class="col-sm-9 col-lg-10 btn-copy-mobile-container">
<%= if created_address_hash do %>
[<%= gettext("Contract") %>&nbsp;
<%= link(
recipient_address_hash,
to: address_path(@conn, :show, recipient_address_hash)
) %>
&nbsp;<%= gettext("created") %>]
<% else %>
<%= link(
recipient_address_hash,
to: address_path(@conn, :show, recipient_address_hash)
) %>
<% end %>
<span class="float-right">
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-custom", "btn-copy-icon-no-borders"],
clipboard_text: recipient_address_hash,
aria_label: gettext("Copy To Address"),
title: gettext("Copy To Address") %>
</span>
</dd>
</dl>
<%= case token_transfer_type(@transaction) do %>
<% {_type, %{token_transfers: token_transfers} = transaction_with_transfers} when is_list(token_transfers) and token_transfers != [] -> %>
<!-- Tokens Transferred -->
<% %{transfers: transfers, mintings: mintings, burnings: burnings, creations: creations} = aggregate_token_transfers(transaction_with_transfers.token_transfers) %>
<%= if Enum.count(transfers) > 0 do %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("List of token transferred in the transaction.") %>
<%= gettext "Tokens Transferred" %></dt>
<dd class="col-sm-9 col-lg-10 transfers-list-mobile-container">
<%= for transfer <- transfers do %>
<%= render BlockScoutWeb.TransactionView, "_total_transfers_from_to.html", Map.put(assigns, :transfer, transfer) %>
<% end %>
</dd>
</dl>
<% end %>
<!-- Tokens Minted -->
<%= if Enum.count(mintings) > 0 do %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("List of token minted in the transaction.") %>
<%= gettext "Tokens Minted" %>
</dt>
<dd class="col-sm-9 col-lg-10 transfers-list-mobile-container">
<%= for minting <- mintings do %>
<%= render BlockScoutWeb.TransactionView, "_total_transfers_from_to.html", Map.put(assigns, :transfer, minting) %>
<% end %>
</dd>
</dl>
<% end %>
<!-- Tokens Burnt -->
<%= if Enum.count(burnings) > 0 do %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("List of token burnt in the transaction.") %>
<%= gettext "Tokens Burnt" %></dt>
<dd class="col-sm-9 col-lg-10 transfers-list-mobile-container">
<%= for burning <- burnings do %>
<%= render BlockScoutWeb.TransactionView, "_total_transfers_from_to.html", Map.put(assigns, :transfer, burning) %>
<% end %>
</dd>
</dl>
<% end %>
<%= if Enum.count(creations) > 0 do %>
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("List of ERC-1155 tokens created in the transaction.") %>
<%= gettext "Tokens Created" %></dt>
<dd class="col-sm-9 col-lg-10 transfers-list-mobile-container">
<%= for creation <- creations do %>
<%= render BlockScoutWeb.TransactionView, "_total_transfers_from_to.html", Map.put(assigns, :transfer, creation) %>
<% end %>
</dd>
</dl>
<% end %>
<% _ -> %>
<% end %>
<!-- Value -->
<dl class="row">
<dt class="col-sm-3 text-muted"> <%= gettext "Nonce" %> </dt>
<dd class="col-sm-9"> <%= @transaction.nonce %> </dd>
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("The value being transacted in Ether and fiat value. Note: You can click the fiat value (if available) to see historical value at the time of transaction.") %>
<%= gettext "Value" %>
</dt>
<dd class="col-sm-9 col-lg-10"> <%= value(@transaction) %>
<%= if !empty_exchange_rate?(@exchange_rate) do %>
(<span class="address-current-balance large"
data-wei-value=<%= @transaction.value.value %>
data-usd-exchange-rate=<%= @exchange_rate.usd_value %>>
</span>)
<% end %>
</dd>
</dl>
<!-- TX Fee -->
<!-- Transaction Fee -->
<dl class="row">
<dt class="col-sm-3 text-muted"> <%= gettext "TX Fee" %> </dt>
<dd class="col-sm-9">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Amount paid to the miner for processing the transaction.") %>
<%= gettext "Transaction Fee" %>
</dt>
<dd class="col-sm-9 col-lg-10">
<%= formatted_fee(@transaction, denomination: :ether) %>
<%= if !empty_exchange_rate?(@exchange_rate) do %>
@ -125,76 +299,92 @@
<% end %>
</dd>
</dl>
<!-- Processing Time -->
<%= case processing_time_duration(@transaction) do %>
<% :pending -> %>
<% nil %>
<% :unknown -> %>
<% nil %>
<% {:ok, interval_string} -> %>
<dl class="row">
<dt class="col-sm-3 text-muted"> <%= gettext "Transaction Speed" %> </dt>
<dd class="col-sm-9">
<%= interval_string %>
</dd>
</dl>
<% end %>
<!-- Gas Price -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Cost per unit of gas specified for the transaction, in Ether and Gwei. The higher the gas price the higher chance of getting included in a block.") %>
<%= gettext "Gas Price" %>
</dt>
<dd class="col-sm-9 col-lg-10"> <%= gas_price(@transaction, :gwei) %> </dd>
</dl>
<hr>
<!-- Gas Limit -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Maximum amount of gas provided for the transaction. For normal Eth transfers, the value is 21,000. For contract this value is higher and bound by block gas limit.") %>
<%= gettext "Gas Limit" %>
</dt>
<dd class="col-sm-9 col-lg-10"> <%= format_gas_limit(@transaction.gas) %> </dd>
</dl>
<!-- Gas Used by Transaction -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted transaction-gas-used">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("The exact units of gas that was used for the transaction.") %>
<%= gettext "Gas Used by Transaction" %>
</dt>
<% gas_used_perc = gas_used_perc(@transaction) %>
<dd class="col-sm-9 col-lg-10"> <%= gas_used(@transaction) %> <%= if gas_used_perc, do: "(#{gas_used_perc} %)" %></dd>
</dl>
<!-- Nonce -->
<dl class="row">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Sequential running number for an address, beginning with 0 for the first transaction. For example, if the nonce of a transaction is 10, it would be the 11th transaction sent from the sender's address.") %>
<%= gettext "Nonce" %>
</dt>
<dd class="col-sm-9 col-lg-10"> <%= @transaction.nonce %> </dd>
</dl>
<%= unless value_transfer?(@transaction) do %>
<dl class="row">
<dt class="col-sm-3 text-muted"><%= gettext "Raw Input" %></dt>
<dd class="col-sm-9">
<dt class="col-sm-3 col-lg-2 text-muted">
<%= render BlockScoutWeb.CommonComponentsView, "_i_tooltip_2.html",
text: gettext("Additional information that is required for the transaction.") %>
<%= gettext "Raw Input" %>
</dt>
<dd class="col-sm-9 col-lg-10">
<div class="d-flex mb-3 justify-content-between">
<!-- Dropdown -->
<div class="dropdown">
<button class="btn-dropdown-line dropdown-toggle" type="button" id="tx-input-decoding-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<button class="btn-dropdown-line large dropdown-toggle" type="button" id="tx-input-decoding-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= gettext("Hex (Default)") %>
</button>
<div class="dropdown-menu" aria-labelledby="transaction-input-decoding-button">
<a href class="dropdown-item tx-input-dropdown" data-target=".tx-raw-input" id="tx-dropdown-raw">
<a href class="dropdown-item large tx-input-dropdown" data-target=".tx-raw-input" data-target-to-hide=".tx-utf8-input" id="tx-dropdown-raw">
<%= gettext("Hex (Default)") %>
</a>
<a href class="dropdown-item tx-input-dropdown" data-target=".tx-utf8-input" id="tx-dropdown-utf8">
<a href class="dropdown-item large tx-input-dropdown" data-target=".tx-utf8-input" data-target-to-hide=".tx-raw-input" id="tx-dropdown-utf8">
<%= gettext("UTF-8") %>
</a>
</div>
</div>
<!-- Copy -->
<span
aria-label="Copy Value"
class="btn-copy-icon tx-raw-input transaction-input"
id="tx-raw-input"
data-clipboard-text="<%= @transaction.input %>"
data-placement="top"
data-toggle="tooltip"
title='<%= gettext("Copy Txn Input") %>'
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.5 32.5" width="32" height="32">
<path fill-rule="evenodd" d="M23.5 20.5a1 1 0 0 1-1-1v-9h-9a1 1 0 0 1 0-2h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1zm-3-7v10a1 1 0 0 1-1 1h-10a1 1 0 0 1-1-1v-10a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1zm-2 1h-8v8h8v-8z"/>
</svg>
</span>
<!-- Copy -->
<span
aria-label="Copy Value"
class="btn-copy-icon tx-utf8-input transaction-input"
data-clipboard-text="<%= @transaction.input.bytes %>"
data-placement="top"
data-toggle="tooltip"
title='<%= gettext("Copy Txn Input") %>',
style="display: none;"
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.5 32.5" width="32" height="32">
<path fill-rule="evenodd" d="M23.5 20.5a1 1 0 0 1-1-1v-9h-9a1 1 0 0 1 0-2h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1zm-3-7v10a1 1 0 0 1-1 1h-10a1 1 0 0 1-1-1v-10a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1zm-2 1h-8v8h8v-8z"/>
</svg>
</span>
<div class="btn-copy-tx-raw-input-container">
<!-- Copy Hex input -->
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html",
id: "tx-raw-input",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-no-borders", "btn-copy-icon-ml-0", "btn-copy-tx-raw-input", "tx-raw-input"],
clipboard_text: @transaction.input,
aria_label: gettext("Copy Value"),
title: gettext("Copy Txn Hex Input") %>
<!-- Copy UTF-8 input -->
<%= render BlockScoutWeb.CommonComponentsView, "_btn_copy.html",
additional_classes: ["btn-copy-icon-small", "btn-copy-icon-no-borders", "btn-copy-icon-ml-0", "btn-copy-tx-raw-input", "tx-utf8-input"],
clipboard_text: @transaction.input.bytes,
aria_label: gettext("Copy Value"),
title: gettext("Copy Txn UTF-8 Input"),
style: "display: none;" %>
</div>
</div>
<!-- Textarea -->
<div class="transaction-input tx-raw-input">
<div class="tx-raw-input">
<div class="tile tile-muted">
<pre class="pre-scrollable pre-scrollable-shorty pre-wrap mb-0"><code><%= @transaction.input %></code></pre>
</div>
</div>
<!-- Textfield -->
<div class="transaction-input tx-utf8-input" style="display: none;">
<div class="tx-utf8-input" style="display: none;">
<div class="tile tile-muted">
<pre class="pre-scrollable pre-scrollable-shorty pre-wrap mb-0"><code><%= @transaction.input.bytes %></code></pre>
</div>
@ -205,101 +395,6 @@
</div>
</div>
</div>
<%= case token_transfer_type(@transaction) do %>
<% {type, %{token_transfers: token_transfers} = transaction_with_transfers} when is_list(token_transfers) and token_transfers != [] -> %>
<div class="col-md-12 col-lg-4 d-flex flex-column flex-md-row flex-lg-column pl-0">
<!-- Value -->
<div class="card card-background-1 mob-transaction flex-grow-1">
<div class="card-body card-body-flex-column-space-between">
<%= if @transaction.value && @transaction.value.value != Decimal.new(0) do %>
<h2 class="card-title balance-card-title"><%= gettext "Ether" %> <%= gettext "Value" %></h2>
<div class="text-right">
<h3 class="address-balance-text">
<%= value(@transaction) %>
</h3>
<%= if !empty_exchange_rate?(@exchange_rate) do %>
<p class="address-current-balance"
data-wei-value=<%= @transaction.value.value %>
data-usd-exchange-rate=<%= @exchange_rate.usd_value %>>
</p>
<% end %>
</div>
<% end %>
<% token_transfers = aggregate_token_transfers(transaction_with_transfers.token_transfers) %>
<%= if Enum.count(token_transfers) > 0 do %>
<h2 class="card-title balance-card-title"><%= token_type_name(type)%><%= gettext " Token Transfer" %></h2>
<div class="text-right">
<%= for transfer <- token_transfers do %>
<h3 class="address-balance-text">
<%= render BlockScoutWeb.TransactionView, "_total_transfers.html", Map.put(assigns, :transfer, transfer) %>
</h3>
<% end %>
</div>
<% end %>
<% mintings = aggregate_token_mintings(transaction_with_transfers.token_transfers) %>
<%= if Enum.count(mintings) > 0 do %>
<h2 class="card-title balance-card-title"><%= token_type_name(type)%><%= gettext " Token Minting" %></h2>
<div class="text-right">
<%= for transfer <- mintings do %>
<h3 class="address-balance-text">
<%= render BlockScoutWeb.TransactionView, "_total_transfers.html", Map.put(assigns, :transfer, transfer) %>
</h3>
<% end %>
</div>
<% end %>
<% burnings = aggregate_token_burnings(transaction_with_transfers.token_transfers) %>
<%= if Enum.count(burnings) > 0 do %>
<h2 class="card-title balance-card-title"><%= token_type_name(type)%><%= gettext " Token Burning" %></h2>
<div class="text-right">
<%= for transfer <- burnings do %>
<h3 class="address-balance-text">
<%= render BlockScoutWeb.TransactionView, "_total_transfers.html", Map.put(assigns, :transfer, transfer) %>
</h3>
<% end %>
</div>
<% end %>
</div>
</div>
<% _ -> %>
<div class="col-md-12 col-lg-4 d-flex flex-column flex-md-row flex-lg-column pl-0">
<!-- Value -->
<div class="card card-background-1 mob-transaction flex-grow-1">
<div class="card-body card-body-flex-column-space-between">
<h2 class="card-title balance-card-title"><%= gettext "Ether" %> <%= gettext "Value" %></h2>
<div class="text-right">
<h3 class="address-balance-text">
<%= value(@transaction) %>
</h3>
<%= if !empty_exchange_rate?(@exchange_rate) do %>
<p class="address-current-balance"
data-wei-value=<%= @transaction.value.value %>
data-usd-exchange-rate=<%= @exchange_rate.usd_value %>>
</p>
<% end %>
</div>
</div>
</div>
<% end %>
<!-- Gas -->
<div class="card mob-transaction flex-grow-1 ml-0 ml-md-5 ml-lg-0 js-ad-dependant-mb-3">
<div class="card-body card-body-flex-column-space-between">
<h2 class="card-title balance-card-title"> <%= gettext "Gas" %> </h2>
<div class="text-right">
<!-- Gas Used -->
<h3 class="address-balance-text">
<%= gettext "Used" %>
<%= gas_used(@transaction) %> @
<%= gas_price(@transaction, :gwei) %>
</h3>
<!-- Gas Limit -->
<p class="address-current-balance">
<%= gettext "Limit" %> <%= format_gas_limit(@transaction.gas) %>
</p>
</div>
</div>
</div>
</div>
</div>
<%= render BlockScoutWeb.Advertisement.BannersAdView, "_banner_728.html", conn: @conn %>
@ -312,4 +407,4 @@
</div>
<% end %>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/transaction.js") %>"></script>
</section>
</section>

@ -16,16 +16,15 @@ defmodule BlockScoutWeb.TransactionView do
@tabs ["token-transfers", "internal-transactions", "logs", "raw-trace"]
{:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000")
@burn_address_hash burn_address_hash
@token_burning_title "Token Burning"
@token_minting_title "Token Minting"
@token_transfer_title "Token Transfer"
@token_creation_title "Token Creation"
@token_burning_type "token-burning"
@token_minting_type "token-minting"
@token_transfer_type "token-transfer"
@token_burning_type :token_burning
@token_minting_type :token_minting
@token_creation_type :token_spawning
@token_transfer_type :token_transfer
defguardp is_transaction_type(mod) when mod in [InternalTransaction, Transaction]
@ -63,59 +62,101 @@ defmodule BlockScoutWeb.TransactionView do
end
def aggregate_token_transfers(token_transfers) do
{transfers, nft_transfers} =
%{
transfers: {ft_transfers, nft_transfers},
mintings: {ft_mintings, nft_mintings},
burnings: {ft_burnings, nft_burnings},
creations: {ft_creations, nft_creations}
} =
token_transfers
|> Enum.reduce({%{}, []}, fn token_transfer, acc ->
if token_transfer.to_address_hash != @burn_address_hash &&
token_transfer.from_address_hash != @burn_address_hash do
aggregate_reducer(token_transfer, acc)
else
acc
|> Enum.reduce(
%{
transfers: {[], []},
mintings: {[], []},
burnings: {[], []},
creations: {[], []}
},
fn token_transfer, acc ->
token_transfer_type = Chain.get_token_transfer_type(token_transfer)
case token_transfer_type do
:token_transfer ->
transfers = aggregate_reducer(token_transfer, acc.transfers)
%{
transfers: transfers,
mintings: acc.mintings,
burnings: acc.burnings,
creations: acc.creations
}
:token_burning ->
burnings = aggregate_reducer(token_transfer, acc.burnings)
%{
transfers: acc.transfers,
mintings: acc.mintings,
burnings: burnings,
creations: acc.creations
}
:token_minting ->
mintings = aggregate_reducer(token_transfer, acc.mintings)
%{
transfers: acc.transfers,
mintings: mintings,
burnings: acc.burnings,
creations: acc.creations
}
:token_spawning ->
creations = aggregate_reducer(token_transfer, acc.creations)
%{
transfers: acc.transfers,
mintings: acc.mintings,
burnings: acc.burnings,
creations: creations
}
end
end
end)
)
final_transfers = Map.values(transfers)
transfers = ft_transfers ++ nft_transfers
final_transfers ++ nft_transfers
end
mintings = ft_mintings ++ nft_mintings
def aggregate_token_mintings(token_transfers) do
{transfers, nft_transfers} =
token_transfers
|> Enum.reduce({%{}, []}, fn token_transfer, acc ->
if token_transfer.from_address_hash == @burn_address_hash do
aggregate_reducer(token_transfer, acc)
else
acc
end
end)
burnings = ft_burnings ++ nft_burnings
final_transfers = Map.values(transfers)
creations = ft_creations ++ nft_creations
final_transfers ++ nft_transfers
%{transfers: transfers, mintings: mintings, burnings: burnings, creations: creations}
end
def aggregate_token_burnings(token_transfers) do
{transfers, nft_transfers} =
token_transfers
|> Enum.reduce({%{}, []}, fn token_transfer, acc ->
if token_transfer.to_address_hash == @burn_address_hash do
aggregate_reducer(token_transfer, acc)
else
acc
end
end)
final_transfers = Map.values(transfers)
defp aggregate_reducer(%{amount: amount, amounts: amounts} = token_transfer, {acc1, acc2})
when is_nil(amount) and is_nil(amounts) do
new_entry = %{
token: token_transfer.token,
amount: nil,
amounts: [],
token_id: token_transfer.token_id,
token_ids: [],
to_address_hash: token_transfer.to_address_hash,
from_address_hash: token_transfer.from_address_hash
}
final_transfers ++ nft_transfers
{acc1, [new_entry | acc2]}
end
defp aggregate_reducer(%{amount: amount} = token_transfer, {acc1, acc2}) when is_nil(amount) do
defp aggregate_reducer(%{amount: amount, amounts: amounts} = token_transfer, {acc1, acc2})
when is_nil(amount) and not is_nil(amounts) do
new_entry = %{
token: token_transfer.token,
amount: nil,
token_id: token_transfer.token_id,
amounts: amounts,
token_id: nil,
token_ids: token_transfer.token_ids,
to_address_hash: token_transfer.to_address_hash,
from_address_hash: token_transfer.from_address_hash
}
@ -127,18 +168,50 @@ defmodule BlockScoutWeb.TransactionView do
new_entry = %{
token: token_transfer.token,
amount: token_transfer.amount,
amounts: [],
token_id: token_transfer.token_id,
token_ids: [],
to_address_hash: token_transfer.to_address_hash,
from_address_hash: token_transfer.from_address_hash
}
existing_entry = Map.get(acc1, token_transfer.token_contract_address, %{new_entry | amount: Decimal.new(0)})
existing_entry =
acc1
|> Enum.find(fn entry ->
entry.to_address_hash == token_transfer.to_address_hash &&
entry.from_address_hash == token_transfer.from_address_hash &&
entry.token == token_transfer.token
end)
new_acc1 =
Map.put(acc1, token_transfer.token_contract_address, %{
new_entry
| amount: Decimal.add(new_entry.amount, existing_entry.amount)
})
if token_transfer.token_id do
[new_entry | acc1]
else
if existing_entry do
acc1
|> Enum.map(fn entry ->
if entry.to_address_hash == token_transfer.to_address_hash &&
entry.from_address_hash == token_transfer.from_address_hash &&
entry.token == token_transfer.token do
updated_entry =
if new_entry.amount do
%{
entry
| amount: Decimal.add(new_entry.amount, entry.amount)
}
else
entry
end
updated_entry
else
entry
end
end)
else
[new_entry | acc1]
end
end
{new_acc1, acc2}
end
@ -218,6 +291,20 @@ defmodule BlockScoutWeb.TransactionView do
end
end
def confirmations_ds_name(blocks_amount_str) do
case Integer.parse(blocks_amount_str) do
{blocks_amount, ""} ->
if rem(blocks_amount, 10) == 1 do
"block"
else
"blocks"
end
_ ->
""
end
end
def contract_creation?(%Transaction{to_address: nil}), do: true
def contract_creation?(_), do: false
@ -257,6 +344,13 @@ defmodule BlockScoutWeb.TransactionView do
end
def formatted_status(status) do
case status do
:pending -> gettext("Unconfirmed")
_ -> gettext("Confirmed")
end
end
def formatted_result(status) do
case status do
:pending -> gettext("Pending")
:awaiting_internal_transactions -> gettext("(Awaiting internal transactions for status)")
@ -298,6 +392,20 @@ defmodule BlockScoutWeb.TransactionView do
Number.to_string!(gas_used)
end
def gas_used_perc(%Transaction{gas_used: nil}), do: nil
def gas_used_perc(%Transaction{gas_used: gas_used, gas: gas}) do
if Decimal.cmp(gas, 0) == :gt do
gas_used
|> Decimal.div(gas)
|> Decimal.mult(100)
|> Decimal.round(2)
|> Number.to_string!()
else
nil
end
end
def hash(%Transaction{hash: hash}) do
to_string(hash)
end
@ -336,11 +444,12 @@ defmodule BlockScoutWeb.TransactionView do
def transaction_display_type(%Transaction{} = transaction) do
cond do
involves_token_transfers?(transaction) ->
token_transfer_type = get_token_transfer_type(transaction.token_transfers)
token_transfer_type = get_transaction_type_from_token_transfers(transaction.token_transfers)
case token_transfer_type do
@token_minting_type -> gettext(@token_minting_title)
@token_burning_type -> gettext(@token_burning_title)
@token_creation_type -> gettext(@token_creation_title)
@token_transfer_type -> gettext(@token_transfer_title)
end
@ -407,35 +516,27 @@ defmodule BlockScoutWeb.TransactionView do
defp tab_name(["logs"]), do: gettext("Logs")
defp tab_name(["raw-trace"]), do: gettext("Raw Trace")
defp get_token_transfer_type(token_transfers) do
token_transfers
|> Enum.reduce("", fn token_transfer, type ->
cond do
token_transfer.to_address_hash == @burn_address_hash ->
update_transfer_type_if_burning(type)
defp get_transaction_type_from_token_transfers(token_transfers) do
token_transfers_types =
token_transfers
|> Enum.map(fn token_transfer ->
Chain.get_token_transfer_type(token_transfer)
end)
token_transfer.from_address_hash == @burn_address_hash ->
update_transfer_type_if_minting(type)
burnings_count =
Enum.count(token_transfers_types, fn token_transfers_type -> token_transfers_type == @token_burning_type end)
true ->
@token_transfer_type
end
end)
end
mintings_count =
Enum.count(token_transfers_types, fn token_transfers_type -> token_transfers_type == @token_minting_type end)
defp update_transfer_type_if_minting(type) do
case type do
"" -> @token_minting_type
@token_burning_type -> @token_transfer_type
_ -> type
end
end
creations_count =
Enum.count(token_transfers_types, fn token_transfers_type -> token_transfers_type == @token_creation_type end)
defp update_transfer_type_if_burning(type) do
case type do
"" -> @token_burning_type
@token_minting_type -> @token_transfer_type
_ -> type
cond do
Enum.count(token_transfers_types) == burnings_count -> @token_burning_type
Enum.count(token_transfers_types) == mintings_count -> @token_minting_type
Enum.count(token_transfers_types) == creations_count -> @token_creation_type
true -> @token_transfer_type
end
end
end

@ -25,21 +25,6 @@ msgstr[1] ""
msgid " - minimal bytecode implementation that delegates all calls to a known address"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:253
msgid " Token Burning"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:242
msgid " Token Minting"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:231
msgid " Token Transfer"
msgstr ""
#, elixir-format
#:
#: lib/block_scout_web/templates/stakes/_stakes_modal_delegators_list.html.eex:43
@ -93,7 +78,7 @@ msgid "%{subnetwork} Staking DApp - BlockScout"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:262
#: lib/block_scout_web/views/transaction_view.ex:356
msgid "(Awaiting internal transactions for status)"
msgstr ""
@ -307,6 +292,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/_coin_balances.html.eex:8
#: lib/block_scout_web/templates/transaction/overview.html.eex:116
msgid "Block"
msgstr ""
@ -322,11 +308,6 @@ msgstr ""
msgid "Block %{block_number} - %{subnetwork} Explorer"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:107
msgid "Block Confirmations"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block_transaction/404.html.eex:7
msgid "Block Details"
@ -343,12 +324,7 @@ msgid "Block Mined, awaiting import..."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:93
msgid "Block Number"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:34
#: lib/block_scout_web/views/transaction_view.ex:33
msgid "Block Pending"
msgstr ""
@ -595,12 +571,12 @@ msgid "Contract Address Pending"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:351
#: lib/block_scout_web/views/transaction_view.ex:460
msgid "Contract Call"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:348
#: lib/block_scout_web/views/transaction_view.ex:457
msgid "Contract Creation"
msgstr ""
@ -701,24 +677,20 @@ msgid "Copy Token ID"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:43
#: lib/block_scout_web/templates/transaction/overview.html.eex:56
msgid "Copy Transaction Hash"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:47
#: lib/block_scout_web/templates/transaction/overview.html.eex:57
msgid "Copy Txn Hash"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:169
#: lib/block_scout_web/templates/transaction/overview.html.eex:182
msgid "Copy Txn Input"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:20
#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:38
#: lib/block_scout_web/templates/transaction/overview.html.eex:369
#: lib/block_scout_web/templates/transaction/overview.html.eex:375
msgid "Copy Value"
msgstr ""
@ -886,12 +858,12 @@ msgid "EIP-1167"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:148
#: lib/block_scout_web/views/transaction_view.ex:221
msgid "ERC-20 "
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:149
#: lib/block_scout_web/views/transaction_view.ex:222
msgid "ERC-721 "
msgstr ""
@ -955,12 +927,12 @@ msgid "Error trying to fetch balances."
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:266
#: lib/block_scout_web/views/transaction_view.ex:360
msgid "Error: %{reason}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:264
#: lib/block_scout_web/views/transaction_view.ex:358
msgid "Error: (Awaiting internal transactions for reason)"
msgstr ""
@ -980,8 +952,6 @@ msgstr ""
#: lib/block_scout_web/templates/layout/app.html.eex:45
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:37
#: lib/block_scout_web/templates/transaction/overview.html.eex:216
#: lib/block_scout_web/templates/transaction/overview.html.eex:269
#: lib/block_scout_web/views/wei_helpers.ex:78
msgid "Ether"
msgstr ""
@ -1043,6 +1013,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:42
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:40
#: lib/block_scout_web/templates/address_transaction/index.html.eex:38
#: lib/block_scout_web/templates/transaction/overview.html.eex:158
#: lib/block_scout_web/views/address_internal_transaction_view.ex:9
#: lib/block_scout_web/views/address_token_transfer_view.ex:9
#: lib/block_scout_web/views/address_transaction_view.ex:9
@ -1054,15 +1025,11 @@ msgstr ""
msgid "GET"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:287
msgid "Gas"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/_tile.html.eex:57
#: lib/block_scout_web/templates/block/overview.html.eex:109
#: lib/block_scout_web/templates/block/overview.html.eex:166
#: lib/block_scout_web/templates/transaction/overview.html.eex:317
msgid "Gas Limit"
msgstr ""
@ -1101,8 +1068,8 @@ msgid "Hash"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:150
#: lib/block_scout_web/templates/transaction/overview.html.eex:154
#: lib/block_scout_web/templates/transaction/overview.html.eex:352
#: lib/block_scout_web/templates/transaction/overview.html.eex:356
msgid "Hex (Default)"
msgstr ""
@ -1173,7 +1140,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6
#: lib/block_scout_web/views/address_view.ex:344
#: lib/block_scout_web/views/transaction_view.ex:406
#: lib/block_scout_web/views/transaction_view.ex:515
msgid "Internal Transactions"
msgstr ""
@ -1250,11 +1217,6 @@ msgstr ""
msgid "Likelihood of Becoming a Validator on the Next Epoch"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:297
msgid "Limit"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:26
msgid "Loading chart"
@ -1292,7 +1254,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8
#: lib/block_scout_web/views/address_view.ex:355
#: lib/block_scout_web/views/transaction_view.ex:407
#: lib/block_scout_web/views/transaction_view.ex:516
msgid "Logs"
msgstr ""
@ -1325,7 +1287,7 @@ msgid "Max Amount to Move:"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:243
#: lib/block_scout_web/views/transaction_view.ex:330
msgid "Max of"
msgstr ""
@ -1459,7 +1421,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/overview.html.eex:74
#: lib/block_scout_web/templates/transaction/overview.html.eex:114
#: lib/block_scout_web/templates/transaction/overview.html.eex:336
msgid "Nonce"
msgstr ""
@ -1527,8 +1489,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:53
#: lib/block_scout_web/templates/stakes/_stakes_modal_delegators_list.html.eex:184
#: lib/block_scout_web/views/transaction_view.ex:261
#: lib/block_scout_web/views/transaction_view.ex:295
#: lib/block_scout_web/views/transaction_view.ex:355
#: lib/block_scout_web/views/transaction_view.ex:389
msgid "Pending"
msgstr ""
@ -1620,14 +1582,14 @@ msgid "RPC"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:144
#: lib/block_scout_web/templates/transaction/overview.html.eex:345
msgid "Raw Input"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:24
#: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7
#: lib/block_scout_web/views/transaction_view.ex:408
#: lib/block_scout_web/views/transaction_view.ex:517
msgid "Raw Trace"
msgstr ""
@ -1697,7 +1659,7 @@ msgid "Responses"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:85
#: lib/block_scout_web/templates/transaction/overview.html.eex:105
msgid "Revert reason"
msgstr ""
@ -1923,7 +1885,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8
#: lib/block_scout_web/views/transaction_view.ex:263
#: lib/block_scout_web/views/transaction_view.ex:357
msgid "Success"
msgstr ""
@ -1940,7 +1902,6 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21
#: lib/block_scout_web/templates/transaction/_tile.html.eex:40
#: lib/block_scout_web/templates/transaction/overview.html.eex:119
msgid "TX Fee"
msgstr ""
@ -2166,7 +2127,7 @@ msgid "This pool is banned until block #%{banned_until} (%{estimated_unban_day})
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:62
#: lib/block_scout_web/templates/transaction/overview.html.eex:41
msgid "This transaction is pending confirmation."
msgstr ""
@ -2174,6 +2135,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:36
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:34
#: lib/block_scout_web/templates/address_transaction/index.html.eex:32
#: lib/block_scout_web/templates/transaction/overview.html.eex:183
#: lib/block_scout_web/views/address_internal_transaction_view.ex:8
#: lib/block_scout_web/views/address_token_transfer_view.ex:8
#: lib/block_scout_web/views/address_transaction_view.ex:8
@ -2200,7 +2162,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:8
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:6
#: lib/block_scout_web/views/transaction_view.ex:343
#: lib/block_scout_web/views/transaction_view.ex:451
msgid "Token Burning"
msgstr ""
@ -2226,14 +2188,14 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:10
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:8
#: lib/block_scout_web/views/transaction_view.ex:342
#: lib/block_scout_web/views/transaction_view.ex:450
msgid "Token Minting"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:12
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:10
#: lib/block_scout_web/views/transaction_view.ex:344
#: lib/block_scout_web/views/transaction_view.ex:453
msgid "Token Transfer"
msgstr ""
@ -2249,7 +2211,7 @@ msgstr ""
#: lib/block_scout_web/views/address_view.ex:346
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:177
#: lib/block_scout_web/views/tokens/overview_view.ex:41
#: lib/block_scout_web/views/transaction_view.ex:405
#: lib/block_scout_web/views/transaction_view.ex:514
msgid "Token Transfers"
msgstr ""
@ -2307,7 +2269,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:25
#: lib/block_scout_web/views/transaction_view.ex:354
#: lib/block_scout_web/views/transaction_view.ex:463
msgid "Transaction"
msgstr ""
@ -2322,7 +2284,7 @@ msgid "Transaction %{transaction}, %{subnetwork} %{transaction}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:32
msgid "Transaction Details"
msgstr ""
@ -2332,11 +2294,6 @@ msgstr ""
msgid "Transaction Inputs"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:136
msgid "Transaction Speed"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:7
#: lib/block_scout_web/templates/address_transaction/index.html.eex:17
@ -2388,7 +2345,7 @@ msgid "Type"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:157
#: lib/block_scout_web/templates/transaction/overview.html.eex:359
msgid "UTF-8"
msgstr ""
@ -2436,11 +2393,6 @@ msgstr ""
msgid "Use the search box to find a hosted network, or select from the list of available networks below."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:291
msgid "Used"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:45
msgid "Validated"
@ -2477,8 +2429,7 @@ msgid "Validator pools can be banned for misbehavior (such as not revealing secr
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:216
#: lib/block_scout_web/templates/transaction/overview.html.eex:269
#: lib/block_scout_web/templates/transaction/overview.html.eex:276
msgid "Value"
msgstr ""
@ -2808,3 +2759,215 @@ msgstr ""
#: lib/block_scout_web/templates/stakes/_stakes_modal_become_candidate.html.eex:36
msgid "<p>To become a candidate, your staking address must be funded with %{tokenSymbol} tokens <strong>and</strong> %{coinSymbol} coins, and your OpenEthereum node must be active and configured with the mining address you specify here.</p>\n <p>To become a delegator, close this window and select an address from the list of pools you would like to place stake on. Click the <strong>Stake</strong> button next to the address to begin the process.</p>"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:47
msgid "A TxHash or transaction hash is a unique 66 characters identifier that is generated whenever a transaction is executed."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:344
msgid "Additional information that is required for the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:291
msgid "Amount paid to the miner for processing the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:349
msgid "Confirmed"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:94
msgid "Confirmed by "
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:148
msgid "Confirmed within"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:188
msgid "Contract"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:168
#: lib/block_scout_web/templates/transaction/overview.html.eex:169
msgid "Copy From Address"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:204
#: lib/block_scout_web/templates/transaction/overview.html.eex:205
msgid "Copy To Address"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:370
msgid "Copy Txn Hex Input"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:376
msgid "Copy Txn UTF-8 Input"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:306
msgid "Cost per unit of gas specified for the transaction, in Ether and Gwei. The higher the gas price the higher chance of getting included in a block."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:307
msgid "Gas Price"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:326
msgid "Gas Used by Transaction"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:181
msgid "Interacted With (To)"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:260
msgid "List of ERC-1155 tokens created in the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:246
msgid "List of token burnt in the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:231
msgid "List of token minted in the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:217
msgid "List of token transferred in the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:316
msgid "Maximum amount of gas provided for the transaction. For normal Eth transfers, the value is 21,000. For contract this value is higher and bound by block gas limit."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:68
msgid "Result"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:335
msgid "Sequential running number for an address, beginning with 0 for the first transaction. For example, if the nonce of a transaction is 10, it would be the 11th transaction sent from the sender's address."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:80
msgid "Status"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:134
msgid "The date and time at which a transaction is mined."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:325
msgid "The exact units of gas that was used for the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:115
msgid "The number of the block in which the transaction was recorded. Block confirmation indicate how many blocks since the transaction is mined."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:179
msgid "The receiving party of the transaction (could be a contract address)."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:67
msgid "The result of the transaction: success, error, pending, awaiting internal transactions."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:104
msgid "The revert reason of the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:157
msgid "The sending party of the transaction (could be from a contract address)."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:79
msgid "The status of the transaction: confirmed, unconfirmed."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:275
msgid "The value being transacted in Ether and fiat value. Note: You can click the fiat value (if available) to see historical value at the time of transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:135
msgid "Timestamp"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:452
msgid "Token Creation"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:247
msgid "Tokens Burnt"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:261
msgid "Tokens Created"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:232
msgid "Tokens Minted"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:218
msgid "Tokens Transferred"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:292
msgid "Transaction Fee"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:48
msgid "Transaction Hash"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:348
msgid "Unconfirmed"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:193
msgid "created"
msgstr ""

@ -25,21 +25,6 @@ msgstr[1] ""
msgid " - minimal bytecode implementation that delegates all calls to a known address"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:253
msgid " Token Burning"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:242
msgid " Token Minting"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:231
msgid " Token Transfer"
msgstr ""
#, elixir-format
#:
#: lib/block_scout_web/templates/stakes/_stakes_modal_delegators_list.html.eex:43
@ -93,7 +78,7 @@ msgid "%{subnetwork} Staking DApp - BlockScout"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:262
#: lib/block_scout_web/views/transaction_view.ex:356
msgid "(Awaiting internal transactions for status)"
msgstr ""
@ -307,6 +292,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/_coin_balances.html.eex:8
#: lib/block_scout_web/templates/transaction/overview.html.eex:116
msgid "Block"
msgstr ""
@ -322,11 +308,6 @@ msgstr ""
msgid "Block %{block_number} - %{subnetwork} Explorer"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:107
msgid "Block Confirmations"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block_transaction/404.html.eex:7
msgid "Block Details"
@ -343,12 +324,7 @@ msgid "Block Mined, awaiting import..."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:93
msgid "Block Number"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:34
#: lib/block_scout_web/views/transaction_view.ex:33
msgid "Block Pending"
msgstr ""
@ -595,12 +571,12 @@ msgid "Contract Address Pending"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:351
#: lib/block_scout_web/views/transaction_view.ex:460
msgid "Contract Call"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:348
#: lib/block_scout_web/views/transaction_view.ex:457
msgid "Contract Creation"
msgstr ""
@ -701,24 +677,20 @@ msgid "Copy Token ID"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:43
#: lib/block_scout_web/templates/transaction/overview.html.eex:56
msgid "Copy Transaction Hash"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:47
#: lib/block_scout_web/templates/transaction/overview.html.eex:57
msgid "Copy Txn Hash"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:169
#: lib/block_scout_web/templates/transaction/overview.html.eex:182
msgid "Copy Txn Input"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/log/_data_decoded_view.html.eex:20
#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:38
#: lib/block_scout_web/templates/transaction/overview.html.eex:369
#: lib/block_scout_web/templates/transaction/overview.html.eex:375
msgid "Copy Value"
msgstr ""
@ -886,12 +858,12 @@ msgid "EIP-1167"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:148
#: lib/block_scout_web/views/transaction_view.ex:221
msgid "ERC-20 "
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:149
#: lib/block_scout_web/views/transaction_view.ex:222
msgid "ERC-721 "
msgstr ""
@ -955,12 +927,12 @@ msgid "Error trying to fetch balances."
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:266
#: lib/block_scout_web/views/transaction_view.ex:360
msgid "Error: %{reason}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:264
#: lib/block_scout_web/views/transaction_view.ex:358
msgid "Error: (Awaiting internal transactions for reason)"
msgstr ""
@ -980,8 +952,6 @@ msgstr ""
#: lib/block_scout_web/templates/layout/app.html.eex:45
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:37
#: lib/block_scout_web/templates/transaction/overview.html.eex:216
#: lib/block_scout_web/templates/transaction/overview.html.eex:269
#: lib/block_scout_web/views/wei_helpers.ex:78
msgid "Ether"
msgstr ""
@ -1043,6 +1013,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:42
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:40
#: lib/block_scout_web/templates/address_transaction/index.html.eex:38
#: lib/block_scout_web/templates/transaction/overview.html.eex:158
#: lib/block_scout_web/views/address_internal_transaction_view.ex:9
#: lib/block_scout_web/views/address_token_transfer_view.ex:9
#: lib/block_scout_web/views/address_transaction_view.ex:9
@ -1054,15 +1025,11 @@ msgstr ""
msgid "GET"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:287
msgid "Gas"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/_tile.html.eex:57
#: lib/block_scout_web/templates/block/overview.html.eex:109
#: lib/block_scout_web/templates/block/overview.html.eex:166
#: lib/block_scout_web/templates/transaction/overview.html.eex:317
msgid "Gas Limit"
msgstr ""
@ -1101,8 +1068,8 @@ msgid "Hash"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:150
#: lib/block_scout_web/templates/transaction/overview.html.eex:154
#: lib/block_scout_web/templates/transaction/overview.html.eex:352
#: lib/block_scout_web/templates/transaction/overview.html.eex:356
msgid "Hex (Default)"
msgstr ""
@ -1173,7 +1140,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6
#: lib/block_scout_web/views/address_view.ex:344
#: lib/block_scout_web/views/transaction_view.ex:406
#: lib/block_scout_web/views/transaction_view.ex:515
msgid "Internal Transactions"
msgstr ""
@ -1250,11 +1217,6 @@ msgstr ""
msgid "Likelihood of Becoming a Validator on the Next Epoch"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:297
msgid "Limit"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:26
msgid "Loading chart"
@ -1292,7 +1254,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8
#: lib/block_scout_web/views/address_view.ex:355
#: lib/block_scout_web/views/transaction_view.ex:407
#: lib/block_scout_web/views/transaction_view.ex:516
msgid "Logs"
msgstr ""
@ -1325,7 +1287,7 @@ msgid "Max Amount to Move:"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:243
#: lib/block_scout_web/views/transaction_view.ex:330
msgid "Max of"
msgstr ""
@ -1459,7 +1421,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/overview.html.eex:74
#: lib/block_scout_web/templates/transaction/overview.html.eex:114
#: lib/block_scout_web/templates/transaction/overview.html.eex:336
msgid "Nonce"
msgstr ""
@ -1527,8 +1489,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:53
#: lib/block_scout_web/templates/stakes/_stakes_modal_delegators_list.html.eex:184
#: lib/block_scout_web/views/transaction_view.ex:261
#: lib/block_scout_web/views/transaction_view.ex:295
#: lib/block_scout_web/views/transaction_view.ex:355
#: lib/block_scout_web/views/transaction_view.ex:389
msgid "Pending"
msgstr ""
@ -1620,14 +1582,14 @@ msgid "RPC"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:144
#: lib/block_scout_web/templates/transaction/overview.html.eex:345
msgid "Raw Input"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:24
#: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7
#: lib/block_scout_web/views/transaction_view.ex:408
#: lib/block_scout_web/views/transaction_view.ex:517
msgid "Raw Trace"
msgstr ""
@ -1697,7 +1659,7 @@ msgid "Responses"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:85
#: lib/block_scout_web/templates/transaction/overview.html.eex:105
msgid "Revert reason"
msgstr ""
@ -1923,7 +1885,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8
#: lib/block_scout_web/views/transaction_view.ex:263
#: lib/block_scout_web/views/transaction_view.ex:357
msgid "Success"
msgstr ""
@ -1940,7 +1902,6 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21
#: lib/block_scout_web/templates/transaction/_tile.html.eex:40
#: lib/block_scout_web/templates/transaction/overview.html.eex:119
msgid "TX Fee"
msgstr ""
@ -2166,7 +2127,7 @@ msgid "This pool is banned until block #%{banned_until} (%{estimated_unban_day})
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:62
#: lib/block_scout_web/templates/transaction/overview.html.eex:41
msgid "This transaction is pending confirmation."
msgstr ""
@ -2174,6 +2135,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:36
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:34
#: lib/block_scout_web/templates/address_transaction/index.html.eex:32
#: lib/block_scout_web/templates/transaction/overview.html.eex:183
#: lib/block_scout_web/views/address_internal_transaction_view.ex:8
#: lib/block_scout_web/views/address_token_transfer_view.ex:8
#: lib/block_scout_web/views/address_transaction_view.ex:8
@ -2200,7 +2162,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:8
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:6
#: lib/block_scout_web/views/transaction_view.ex:343
#: lib/block_scout_web/views/transaction_view.ex:451
msgid "Token Burning"
msgstr ""
@ -2226,14 +2188,14 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:10
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:8
#: lib/block_scout_web/views/transaction_view.ex:342
#: lib/block_scout_web/views/transaction_view.ex:450
msgid "Token Minting"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:12
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:10
#: lib/block_scout_web/views/transaction_view.ex:344
#: lib/block_scout_web/views/transaction_view.ex:453
msgid "Token Transfer"
msgstr ""
@ -2249,7 +2211,7 @@ msgstr ""
#: lib/block_scout_web/views/address_view.ex:346
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:177
#: lib/block_scout_web/views/tokens/overview_view.ex:41
#: lib/block_scout_web/views/transaction_view.ex:405
#: lib/block_scout_web/views/transaction_view.ex:514
msgid "Token Transfers"
msgstr ""
@ -2307,7 +2269,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:25
#: lib/block_scout_web/views/transaction_view.ex:354
#: lib/block_scout_web/views/transaction_view.ex:463
msgid "Transaction"
msgstr ""
@ -2322,7 +2284,7 @@ msgid "Transaction %{transaction}, %{subnetwork} %{transaction}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:32
msgid "Transaction Details"
msgstr ""
@ -2332,11 +2294,6 @@ msgstr ""
msgid "Transaction Inputs"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:136
msgid "Transaction Speed"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:7
#: lib/block_scout_web/templates/address_transaction/index.html.eex:17
@ -2388,7 +2345,7 @@ msgid "Type"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:157
#: lib/block_scout_web/templates/transaction/overview.html.eex:359
msgid "UTF-8"
msgstr ""
@ -2436,11 +2393,6 @@ msgstr ""
msgid "Use the search box to find a hosted network, or select from the list of available networks below."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:291
msgid "Used"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:45
msgid "Validated"
@ -2477,8 +2429,7 @@ msgid "Validator pools can be banned for misbehavior (such as not revealing secr
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:216
#: lib/block_scout_web/templates/transaction/overview.html.eex:269
#: lib/block_scout_web/templates/transaction/overview.html.eex:276
msgid "Value"
msgstr ""
@ -2808,3 +2759,215 @@ msgstr ""
#: lib/block_scout_web/templates/stakes/_stakes_modal_become_candidate.html.eex:36
msgid "<p>To become a candidate, your staking address must be funded with %{tokenSymbol} tokens <strong>and</strong> %{coinSymbol} coins, and your OpenEthereum node must be active and configured with the mining address you specify here.</p>\n <p>To become a delegator, close this window and select an address from the list of pools you would like to place stake on. Click the <strong>Stake</strong> button next to the address to begin the process.</p>"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:47
msgid "A TxHash or transaction hash is a unique 66 characters identifier that is generated whenever a transaction is executed."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:344
msgid "Additional information that is required for the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:291
msgid "Amount paid to the miner for processing the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:349
msgid "Confirmed"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:94
msgid "Confirmed by "
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:148
msgid "Confirmed within"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:188
msgid "Contract"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:168
#: lib/block_scout_web/templates/transaction/overview.html.eex:169
msgid "Copy From Address"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:204
#: lib/block_scout_web/templates/transaction/overview.html.eex:205
msgid "Copy To Address"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:370
msgid "Copy Txn Hex Input"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:376
msgid "Copy Txn UTF-8 Input"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:306
msgid "Cost per unit of gas specified for the transaction, in Ether and Gwei. The higher the gas price the higher chance of getting included in a block."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:307
msgid "Gas Price"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:326
msgid "Gas Used by Transaction"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:181
msgid "Interacted With (To)"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:260
msgid "List of ERC-1155 tokens created in the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:246
msgid "List of token burnt in the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:231
msgid "List of token minted in the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:217
msgid "List of token transferred in the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:316
msgid "Maximum amount of gas provided for the transaction. For normal Eth transfers, the value is 21,000. For contract this value is higher and bound by block gas limit."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:68
msgid "Result"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:335
msgid "Sequential running number for an address, beginning with 0 for the first transaction. For example, if the nonce of a transaction is 10, it would be the 11th transaction sent from the sender's address."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:80
msgid "Status"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:134
msgid "The date and time at which a transaction is mined."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:325
msgid "The exact units of gas that was used for the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:115
msgid "The number of the block in which the transaction was recorded. Block confirmation indicate how many blocks since the transaction is mined."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:179
msgid "The receiving party of the transaction (could be a contract address)."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:67
msgid "The result of the transaction: success, error, pending, awaiting internal transactions."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:104
msgid "The revert reason of the transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:157
msgid "The sending party of the transaction (could be from a contract address)."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:79
msgid "The status of the transaction: confirmed, unconfirmed."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:275
msgid "The value being transacted in Ether and fiat value. Note: You can click the fiat value (if available) to see historical value at the time of transaction."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:135
msgid "Timestamp"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:452
msgid "Token Creation"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:247
msgid "Tokens Burnt"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:261
msgid "Tokens Created"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:232
msgid "Tokens Minted"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:218
msgid "Tokens Transferred"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:292
msgid "Transaction Fee"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:48
msgid "Transaction Hash"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:348
msgid "Unconfirmed"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:193
msgid "created"
msgstr ""

@ -149,7 +149,7 @@ defmodule BlockScoutWeb.TransactionViewTest do
end
end
describe "formatted_status/1" do
describe "formatted_result/1" do
test "without block" do
transaction =
:transaction
@ -157,7 +157,7 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> Repo.preload(:block)
status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "Pending"
assert TransactionView.formatted_result(status) == "Pending"
end
test "with block without status (pre-Byzantium/Ethereum Class)" do
@ -169,7 +169,7 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> with_block(block, status: nil)
status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "(Awaiting internal transactions for status)"
assert TransactionView.formatted_result(status) == "(Awaiting internal transactions for status)"
end
test "with receipt with status :ok" do
@ -181,7 +181,7 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> with_block(gas_used: gas - 1, status: :ok)
status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "Success"
assert TransactionView.formatted_result(status) == "Success"
end
test "with block with status :error without internal transactions indexed" do
@ -195,7 +195,7 @@ defmodule BlockScoutWeb.TransactionViewTest do
insert(:pending_block_operation, block_hash: block.hash, fetch_internal_transactions: true)
status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "Error: (Awaiting internal transactions for reason)"
assert TransactionView.formatted_result(status) == "Error: (Awaiting internal transactions for reason)"
end
test "with block with status :error with internal transactions indexed uses `error`" do
@ -205,7 +205,7 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> with_block(status: :error, error: "Out of Gas")
status = TransactionView.transaction_status(transaction)
assert TransactionView.formatted_status(status) == "Error: Out of Gas"
assert TransactionView.formatted_result(status) == "Error: Out of Gas"
end
end
@ -264,8 +264,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
result = TransactionView.aggregate_token_transfers([token_transfer, token_transfer, token_transfer])
assert Enum.count(result) == 1
assert List.first(result).amount == Decimal.new(3)
assert Enum.count(result.transfers) == 1
assert List.first(result.transfers).amount == Decimal.new(3)
end
test "does not aggregate NFT tokens" do
@ -274,12 +274,16 @@ defmodule BlockScoutWeb.TransactionViewTest do
|> insert()
|> with_block()
token_transfer = insert(:token_transfer, transaction: transaction, amount: nil)
token = insert(:token)
result = TransactionView.aggregate_token_transfers([token_transfer, token_transfer, token_transfer])
token_transfer1 = insert(:token_transfer, transaction: transaction, token: token, token_id: 1, amount: nil)
token_transfer2 = insert(:token_transfer, transaction: transaction, token: token, token_id: 2, amount: nil)
token_transfer3 = insert(:token_transfer, transaction: transaction, token: token, token_id: 3, amount: nil)
result = TransactionView.aggregate_token_transfers([token_transfer1, token_transfer2, token_transfer3])
assert Enum.count(result) == 3
assert List.first(result).amount == nil
assert Enum.count(result.transfers) == 3
assert List.first(result.transfers).amount == nil
end
end
end

@ -99,6 +99,8 @@ defmodule Explorer.Chain do
# keccak256("Error(string)")
@revert_error_method_id "08c379a0"
@burn_address_hash_str "0x0000000000000000000000000000000000000000"
@typedoc """
The name of an association on the `t:Ecto.Schema.t/0`
"""
@ -1719,7 +1721,7 @@ defmodule Explorer.Chain do
@spec fetch_sum_coin_total_supply_minus_burnt() :: non_neg_integer
def fetch_sum_coin_total_supply_minus_burnt do
{:ok, burn_address_hash} = string_to_address_hash("0x0000000000000000000000000000000000000000")
{:ok, burn_address_hash} = Chain.string_to_address_hash(@burn_address_hash_str)
query =
from(
@ -6564,4 +6566,24 @@ defmodule Explorer.Chain do
{:error, "An incorrect input date provided. It should be in ISO 8601 format (yyyy-mm-dd)."}
end
end
@spec get_token_transfer_type(TokenTransfer.t()) ::
:token_burning | :token_minting | :token_spawning | :token_transfer
def get_token_transfer_type(transfer) do
{:ok, burn_address_hash} = Chain.string_to_address_hash(@burn_address_hash_str)
cond do
transfer.to_address_hash == burn_address_hash && transfer.from_address_hash !== burn_address_hash ->
:token_burning
transfer.to_address_hash !== burn_address_hash && transfer.from_address_hash == burn_address_hash ->
:token_minting
transfer.to_address_hash == burn_address_hash && transfer.from_address_hash == burn_address_hash ->
:token_spawning
true ->
:token_transfer
end
end
end

Loading…
Cancel
Save