|
|
|
@ -8,7 +8,7 @@ defmodule Explorer.Etherscan do |
|
|
|
|
alias Explorer.Etherscan.Logs |
|
|
|
|
alias Explorer.{Chain, Repo} |
|
|
|
|
alias Explorer.Chain.Address.TokenBalance |
|
|
|
|
alias Explorer.Chain.{Block, Hash, InternalTransaction, Transaction} |
|
|
|
|
alias Explorer.Chain.{Block, Hash, InternalTransaction, TokenTransfer, Transaction} |
|
|
|
|
|
|
|
|
|
@default_options %{ |
|
|
|
|
order_by_direction: :desc, |
|
|
|
@ -318,10 +318,11 @@ defmodule Explorer.Etherscan do |
|
|
|
|
query = |
|
|
|
|
from( |
|
|
|
|
t in Transaction, |
|
|
|
|
inner_join: tt in assoc(t, :token_transfers), |
|
|
|
|
inner_join: tt in TokenTransfer, |
|
|
|
|
on: tt.transaction_hash == t.hash and tt.block_number == t.block_number and tt.block_hash == t.block_hash, |
|
|
|
|
inner_join: tkn in assoc(tt, :token), |
|
|
|
|
inner_join: b in assoc(t, :block), |
|
|
|
|
where: tt.from_address_hash == ^address_hash and b.number == tt.block_number and b.hash == t.block_hash, |
|
|
|
|
where: tt.from_address_hash == ^address_hash, |
|
|
|
|
or_where: tt.to_address_hash == ^address_hash, |
|
|
|
|
order_by: [{^options.order_by_direction, t.block_number}], |
|
|
|
|
limit: ^options.page_size, |
|
|
|
|