-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6582 from blockscout/va-tx-actions
Transaction actions indexer
- Loading branch information
Showing
33 changed files
with
2,004 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import $ from 'jquery' | ||
import 'malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min' | ||
|
||
$(function () { | ||
const scrollBar = $('.mCustomScrollbar') | ||
scrollBar.mCustomScrollbar({ | ||
callbacks: { | ||
onOverflowY: () => { | ||
$('#actions-list-scroll-note').css('display', 'block') | ||
scrollBar.removeClass('mCS_no_scrollbar_y') | ||
}, | ||
onOverflowYNone: () => { | ||
$('#actions-list-scroll-note').css('display', 'none') | ||
scrollBar.addClass('mCS_no_scrollbar_y') | ||
} | ||
}, | ||
theme: 'dark', | ||
autoHideScrollbar: true, | ||
scrollButtons: { enable: false }, | ||
scrollbarPosition: 'outside' | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions.html.eex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<%= if @action.protocol == :uniswap_v3 do %> | ||
<%= if @action.type == :mint_nft do %> | ||
<div class="<%= if @isLast, do: "lastItem", else: "" %>"> | ||
<span class="actions-item"> | ||
<i class="fa fa-caret-right"></i> | ||
|
||
<% address_string = Map.get(@action.data, "address") %> | ||
<% {address_status, address} = transaction_action_string_to_address(address_string) %> | ||
<% address = if address_status == :ok, do: render_to_string(BlockScoutWeb.AddressView, "_link.html", address: address, contract: BlockScoutWeb.AddressView.contract?(address), use_custom_tooltip: false, trimmed: false), else: render_to_string(BlockScoutWeb.TransactionView, "_actions_address.html", address_string: address_string, action: @action) %> | ||
<% to_address = Map.get(@action.data, "to") %> | ||
<% to_content = raw(render_to_string BlockScoutWeb.TransactionView, "_actions_to.html", address: to_address) %> | ||
<% to = link to: address_path(BlockScoutWeb.Endpoint, :show, to_address), "data-test": "address_hash_link", do: to_content %> | ||
|
||
<%= gettext("Mint of %{address} <span class=\"text-muted\">To</span> %{to}", address: address, to: safe_to_string(to)) |> raw() %> | ||
</span> | ||
<br /> | ||
|
||
<% token_ids = Map.get(@action.data, "ids") %> | ||
<%= for id <- token_ids do %> | ||
<span class="actions-item subitem"> | ||
<i class="fa fa-caret-right"></i> | ||
<% link_to_id = link id, to: token_instance_path(BlockScoutWeb.Endpoint, :show, address_string, id), "data-test": "token_link" %> | ||
<%= gettext("%{qty} of <span class=\"text-muted\">Token ID [%{link_to_id}]</span>", qty: 1, link_to_id: safe_to_string(link_to_id)) |> raw() %> | ||
</span> | ||
<br /> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<%= if Enum.member?([:mint, :burn, :collect, :swap], @action.type) do %> | ||
<div class="<%= if @isLast, do: "lastItem", else: "" %>"> | ||
<span class="actions-item"> | ||
<% amount0 = formatted_action_amount(@action.data, "amount0") %> | ||
<% amount1 = formatted_action_amount(@action.data, "amount1") %> | ||
|
||
<% symbol0 = Map.get(@action.data, "symbol0") %> | ||
<% address0 = Map.get(@action.data, "address0") %> | ||
<% symbol1 = Map.get(@action.data, "symbol1") %> | ||
<% address1 = Map.get(@action.data, "address1") %> | ||
|
||
<i class="fa fa-caret-right"></i> | ||
|
||
<% symbol0 = if symbol0 != "Ether", do: link(symbol0, to: token_path(BlockScoutWeb.Endpoint, :show, address0), "data-test": "token_link"), else: raw(symbol0) %> | ||
|
||
<% symbol1 = if symbol1 != "Ether", do: link(symbol1, to: token_path(BlockScoutWeb.Endpoint, :show, address1), "data-test": "token_link"), else: raw(symbol1) %> | ||
|
||
<%= if @action.type == :mint do %> | ||
<%= render BlockScoutWeb.TransactionView, "_actions_uniswap.html", action: "Add", amount0: amount0, symbol0: symbol0, conjunction: "And", amount1: amount1, symbol1: symbol1, tail: "Liquidity To Uniswap V3" %> | ||
<% end %> | ||
<%= if @action.type == :burn do %> | ||
<%= render BlockScoutWeb.TransactionView, "_actions_uniswap.html", action: "Remove", amount0: amount0, symbol0: symbol0, conjunction: "And", amount1: amount1, symbol1: symbol1, tail: "Liquidity From Uniswap V3" %> | ||
<% end %> | ||
<%= if @action.type == :collect do %> | ||
<%= render BlockScoutWeb.TransactionView, "_actions_uniswap.html", action: "Collect", amount0: amount0, symbol0: symbol0, conjunction: "And", amount1: amount1, symbol1: symbol1, tail: "From Uniswap V3" %> | ||
<% end %> | ||
<%= if @action.type == :swap do %> | ||
<%= render BlockScoutWeb.TransactionView, "_actions_uniswap.html", action: "Swap", amount0: amount0, symbol0: symbol0, conjunction: "For", amount1: amount1, symbol1: symbol1, tail: "On Uniswap V3" %> | ||
<% end %> | ||
</span> | ||
<br /> | ||
</div> | ||
<% end %> | ||
<% end %> |
13 changes: 13 additions & 0 deletions
13
apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_address.html.eex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<%= link to: address_path(BlockScoutWeb.Endpoint, :show, @address_string), "data-test": "address_hash_link" do %> | ||
<% name = Map.get(@action.data, "name") %> | ||
<span data-toggle="tooltip" data-placement="top" title="<%= name %>"> | ||
<span class="d-none d-md-none d-lg-inline d-xl-inline"><%= AddressView.short_string(name, 15) %></span> | ||
<span class="d-inline d-md-inline d-lg-none d-xl-none"><%= AddressView.short_string(name, 5) %></span> | ||
</span> | ||
|
||
<% symbol = Map.get(@action.data, "symbol") %> | ||
<span data-toggle="tooltip" data-placement="top" title="<%= symbol %>"> | ||
<span class="d-none d-md-none d-lg-inline d-xl-inline">(<%= AddressView.short_string(symbol, 15) %>)</span> | ||
<span class="d-inline d-md-inline d-lg-none d-xl-none">(<%= AddressView.short_string(symbol, 5) %>)</span> | ||
</span> | ||
<% end %> |
4 changes: 4 additions & 0 deletions
4
apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_to.html.eex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<span data-toggle="tooltip" data-placement="top" title="<%= @address %>"> | ||
<span class="d-none d-md-none d-xl-inline"><%= @address %></span> | ||
<span class="d-md-inline-block d-xl-none"><%= BlockScoutWeb.AddressView.trimmed_hash(@address) %></span> | ||
</span> |
1 change: 1 addition & 0 deletions
1
apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions_uniswap.html.eex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<span class="text-muted"><%= @action %></span> <%= @amount0 %> <%= @symbol0 %> <span class="text-muted"><%= @conjunction %></span> <%= @amount1 %> <%= @symbol1 %> <span class="text-muted"><%= @tail %></span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.