diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex
index f30c3cb0cd..daca492d7c 100644
--- a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex
+++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex
@@ -62,6 +62,7 @@ defmodule BlockScoutWeb.AddressTransactionController do
View.render_to_string(
TransactionView,
"_emission_reward_tile.html",
+ conn: conn,
current_address: address,
emission_funds: emission_reward,
validator: validator_reward
@@ -71,6 +72,7 @@ defmodule BlockScoutWeb.AddressTransactionController do
View.render_to_string(
TransactionView,
"_tile.html",
+ conn: conn,
current_address: address,
transaction: transaction
)
diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex
index 912e580224..b30ee3e8bd 100644
--- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex
+++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/instance/transfer_controller.ex
@@ -36,7 +36,7 @@ defmodule BlockScoutWeb.Tokens.Instance.TransferController do
"_token_transfer.html",
conn: conn,
token: token,
- transfer: transfer
+ token_transfer: transfer
)
end)
diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex
index 9b75087c45..e6b9b9b9e7 100644
--- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex
+++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex
@@ -29,7 +29,7 @@ defmodule BlockScoutWeb.Tokens.TransferController do
"_token_transfer.html",
conn: conn,
token: token,
- transfer: transfer
+ token_transfer: transfer
)
end)
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex
index 5b8959f0a3..3aed064e48 100644
--- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex
+++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex
@@ -6,29 +6,35 @@
- <%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @transfer.transaction_hash %>
+ <%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @token_transfer.transaction_hash %>
- <%= link to: address_token_transfers_path(@conn, :index, @transfer.from_address, @token.contract_address_hash), "data-test": "address_hash_link" do %>
+ <%= link to: address_token_transfers_path(@conn, :index, @token_transfer.from_address, @token.contract_address_hash), "data-test": "address_hash_link" do %>
<%= render(
BlockScoutWeb.AddressView,
"_responsive_hash.html",
- address: @transfer.from_address,
- contract: BlockScoutWeb.AddressView.contract?(@transfer.from_address)
+ address: @token_transfer.from_address,
+ contract: BlockScoutWeb.AddressView.contract?(@token_transfer.from_address)
) %>
<% end %>
→
- <%= link to: address_token_transfers_path(@conn, :index, @transfer.to_address, @token.contract_address_hash), "data-test": "address_hash_link" do %>
+ <%= link to: address_token_transfers_path(@conn, :index, @token_transfer.to_address, @token.contract_address_hash), "data-test": "address_hash_link" do %>
<%= render(
BlockScoutWeb.AddressView,
"_responsive_hash.html",
- address: @transfer.to_address,
- contract: BlockScoutWeb.AddressView.contract?(@transfer.to_address)
+ address: @token_transfer.to_address,
+ contract: BlockScoutWeb.AddressView.contract?(@token_transfer.to_address)
) %>
<% end %>
- <%= token_transfer_amount(@transfer) %> <%= @transfer.token.symbol %>
+ <%= case token_transfer_amount(@token_transfer) do %>
+ <% {:ok, :erc721_instance} -> %>
+ <%= "TokenID ["%><%= link(@token_transfer.token_id, to: token_instance_path(@conn, :show, to_string(@token_transfer.token_id), @token_transfer.token.contract_address_hash)) %><%= "]" %>
+ <% {:ok, value} -> %>
+ <%= value %>
+ <% end %>
+ <%= @token_transfer.token.symbol %>
@@ -36,11 +42,11 @@
<%= link(
- gettext("Block #%{number}", number: @transfer.block_number),
- to: block_path(BlockScoutWeb.Endpoint, :show, @transfer.block_number)
+ gettext("Block #%{number}", number: @token_transfer.block_number),
+ to: block_path(BlockScoutWeb.Endpoint, :show, @token_transfer.block_number)
) %>
-
+
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex
index 91a7d9973a..85711ca136 100644
--- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex
+++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex
@@ -38,11 +38,11 @@
<% [first_token_transfer | remaining_token_transfers] = @transaction.token_transfers %>
- <%= render "_token_transfer.html", address: assigns[:current_address], token_transfer: first_token_transfer %>
+ <%= render "_token_transfer.html", address: assigns[:current_address], token_transfer: first_token_transfer, conn: @conn %>
<%= for token_transfer <- remaining_token_transfers do %>
- <%= render "_token_transfer.html", address: assigns[:current_address], token_transfer: token_transfer %>
+ <%= render "_token_transfer.html", address: assigns[:current_address], token_transfer: token_transfer, conn: @conn %>
<% end %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_token_transfer.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_token_transfer.html.eex
index 8c88fdf87b..4143e66a9b 100644
--- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_token_transfer.html.eex
+++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_token_transfer.html.eex
@@ -20,6 +20,12 @@
- <%= token_transfer_amount(@token_transfer) %> <%= link(token_symbol(@token_transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, @token_transfer.token.contract_address_hash)) %>
+ <%= case token_transfer_amount(@token_transfer) do %>
+ <% {:ok, :erc721_instance} -> %>
+ <%= "TokenID ["%><%= link(@token_transfer.token_id, to: token_instance_path(@conn, :show, to_string(@token_transfer.token_id), @token_transfer.token.contract_address_hash)) %><%= "]" %>
+ <% {:ok, value} -> %>
+ <%= value %>
+ <% end %>
+ <%= link(token_symbol(@token_transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, @token_transfer.token.contract_address_hash)) %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
index 00266d92b3..cbba23ba90 100644
--- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
+++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
@@ -193,7 +193,12 @@
<%= for transfer <- aggregate_token_transfers(transaction_with_transfers.token_transfers) do %>
- <%= token_transfer_amount(transfer) %>
+ <%= case token_transfer_amount(@token_transfer) do %>
+ <% {:ok, :erc721_instance} -> %>
+ <%= "TokenID ["%><%= link(@token_transfer.token_id, to: token_instance_path(@conn, :show, to_string(@token_transfer.token_id), @token_transfer.token.contract_address_hash)) %><%= "]" %>
+ <% {:ok, value} -> %>
+ <%= value %>
+ <% end %>
<%= " "%>
<%= link(token_symbol(transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, transfer.token.contract_address_hash)) %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex
index 7c3c202f80..4396c7942c 100644
--- a/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex
+++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex
@@ -13,7 +13,13 @@
- <%= token_transfer_amount(@token_transfer) %> <%= link(token_symbol(@token_transfer.token), to: token_path(@conn, :show, @token_transfer.token.contract_address_hash)) %>
+ <%= case token_transfer_amount(@token_transfer) do%>
+ <% {:ok, :erc721_instance} -> %>
+ <%= "TokenID ["%><%= link(@token_transfer.token_id, to: token_instance_path(@conn, :show, to_string(@token_transfer.token_id), @token_transfer.token.contract_address_hash)) %><%= "]" %>
+ <% {:ok, value} -> %>
+ <%= value %>
+ <% end %>
+ <%= link(token_symbol(@token_transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, @token_transfer.token.contract_address_hash)) %>
diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/helpers.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/helpers.ex
index 33569f3a97..0cc90aad69 100644
--- a/apps/block_scout_web/lib/block_scout_web/views/tokens/helpers.ex
+++ b/apps/block_scout_web/lib/block_scout_web/views/tokens/helpers.ex
@@ -21,19 +21,19 @@ defmodule BlockScoutWeb.Tokens.Helpers do
end
defp do_token_transfer_amount(%Token{type: "ERC-20"}, nil, _token_id) do
- "--"
+ {:ok, "--"}
end
defp do_token_transfer_amount(%Token{type: "ERC-20", decimals: nil}, amount, _token_id) do
- CurrencyHelpers.format_according_to_decimals(amount, Decimal.new(0))
+ {:ok, CurrencyHelpers.format_according_to_decimals(amount, Decimal.new(0))}
end
defp do_token_transfer_amount(%Token{type: "ERC-20", decimals: decimals}, amount, _token_id) do
- CurrencyHelpers.format_according_to_decimals(amount, decimals)
+ {:ok, CurrencyHelpers.format_according_to_decimals(amount, decimals)}
end
- defp do_token_transfer_amount(%Token{type: "ERC-721"}, _amount, token_id) do
- "TokenID [#{token_id}]"
+ defp do_token_transfer_amount(%Token{type: "ERC-721"}, _amount, _token_id) do
+ {:ok, :erc721_instance}
end
defp do_token_transfer_amount(_token, _amount, _token_id) do