Merge pull request #2017 from poanetwork/fix-to-from-filters

fix: fix to/from filters on tx list pages
pull/2050/head
Victor Baranov 6 years ago committed by GitHub
commit 24b4dfadf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 4
      apps/explorer/lib/explorer/chain/token_transfer.ex
  3. 8
      apps/explorer/test/explorer/chain/token_transfer_test.exs

@ -38,6 +38,7 @@
- [#1960](https://github.com/poanetwork/blockscout/pull/1960) - do not remove bold text in decompiled contacts
- [#1992](https://github.com/poanetwork/blockscout/pull/1992) - fix: support https for wobserver polling
- [#1966](https://github.com/poanetwork/blockscout/pull/1966) - fix: add fields for contract filter performance
- [#2017](https://github.com/poanetwork/blockscout/pull/2017) - fix: fix to/from filters on tx list pages
- [#2008](https://github.com/poanetwork/blockscout/pull/2008) - add new function clause for xDai network beneficiaries
- [#2009](https://github.com/poanetwork/blockscout/pull/2009) - addresses page improvements

@ -175,7 +175,7 @@ defmodule Explorer.Chain.TokenTransfer do
from(
tt in TokenTransfer,
where: tt.to_address_hash == ^address_hash,
select: tt.transaction_hash
select: type(tt.transaction_hash, :binary)
)
query
@ -189,7 +189,7 @@ defmodule Explorer.Chain.TokenTransfer do
from(
tt in TokenTransfer,
where: tt.from_address_hash == ^address_hash,
select: tt.transaction_hash
select: type(tt.transaction_hash, :binary)
)
query

@ -247,9 +247,11 @@ defmodule Explorer.Chain.TokenTransferTest do
amount: 1
)
{:ok, transaction_bytes} = Explorer.Chain.Hash.Full.dump(transaction.hash)
transactions_hashes = TokenTransfer.where_any_address_fields_match(:to, paul.hash, %PagingOptions{page_size: 1})
assert Enum.member?(transactions_hashes, transaction.hash) == true
assert Enum.member?(transactions_hashes, transaction_bytes) == true
end
test "when from_address_hash match returns transactions hashes list" do
@ -283,9 +285,11 @@ defmodule Explorer.Chain.TokenTransferTest do
amount: 1
)
{:ok, transaction_bytes} = Explorer.Chain.Hash.Full.dump(transaction.hash)
transactions_hashes = TokenTransfer.where_any_address_fields_match(:from, john.hash, %PagingOptions{page_size: 1})
assert Enum.member?(transactions_hashes, transaction.hash) == true
assert Enum.member?(transactions_hashes, transaction_bytes) == true
end
test "when to_from_address_hash or from_address_hash match returns transactions hashes list" do

Loading…
Cancel
Save