select distinct token transfers by transaction hash

pull/2825/head
Ayrat Badykov 5 years ago
parent 35aaae8489
commit 67e0e3c333
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 1
      apps/block_scout_web/lib/block_scout_web/controllers/address_token_transfer_controller.ex
  2. 7
      apps/explorer/lib/explorer/chain/token_transfer.ex

@ -170,7 +170,6 @@ defmodule BlockScoutWeb.AddressTokenTransferController do
) do ) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash) do {:ok, address} <- Chain.hash_to_address(address_hash) do
render( render(
conn, conn,
"index.html", "index.html",

@ -215,7 +215,8 @@ defmodule Explorer.Chain.TokenTransfer do
from( from(
tt in TokenTransfer, tt in TokenTransfer,
where: tt.to_address_hash == ^address_hash, where: tt.to_address_hash == ^address_hash,
select: type(tt.transaction_hash, :binary) select: type(tt.transaction_hash, :binary),
distinct: tt.transaction_hash
) )
query query
@ -229,7 +230,8 @@ defmodule Explorer.Chain.TokenTransfer do
from( from(
tt in TokenTransfer, tt in TokenTransfer,
where: tt.from_address_hash == ^address_hash, where: tt.from_address_hash == ^address_hash,
select: type(tt.transaction_hash, :binary) select: type(tt.transaction_hash, :binary),
distinct: tt.transaction_hash
) )
query query
@ -249,6 +251,7 @@ defmodule Explorer.Chain.TokenTransfer do
from(token_transfer in TokenTransfer, from(token_transfer in TokenTransfer,
where: token_transfer.to_address_hash == ^address_bytes or token_transfer.from_address_hash == ^address_bytes, where: token_transfer.to_address_hash == ^address_bytes or token_transfer.from_address_hash == ^address_bytes,
select: type(token_transfer.transaction_hash, :binary), select: type(token_transfer.transaction_hash, :binary),
distinct: token_transfer.transaction_hash,
limit: ^page_size limit: ^page_size
) )

Loading…
Cancel
Save