|
|
@ -45,20 +45,21 @@ defmodule Explorer.Etherscan do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@transaction_fields [ |
|
|
|
@transaction_fields [ |
|
|
|
:block_number, |
|
|
|
|
|
|
|
:hash, |
|
|
|
|
|
|
|
:nonce, |
|
|
|
|
|
|
|
:block_hash, |
|
|
|
:block_hash, |
|
|
|
:index, |
|
|
|
:block_number, |
|
|
|
|
|
|
|
:created_contract_address_hash, |
|
|
|
|
|
|
|
:cumulative_gas_used, |
|
|
|
:from_address_hash, |
|
|
|
:from_address_hash, |
|
|
|
:to_address_hash, |
|
|
|
|
|
|
|
:value, |
|
|
|
|
|
|
|
:gas, |
|
|
|
:gas, |
|
|
|
:gas_price, |
|
|
|
:gas_price, |
|
|
|
:status, |
|
|
|
:gas_used, |
|
|
|
|
|
|
|
:hash, |
|
|
|
|
|
|
|
:index, |
|
|
|
:input, |
|
|
|
:input, |
|
|
|
:cumulative_gas_used, |
|
|
|
:nonce, |
|
|
|
:gas_used |
|
|
|
:status, |
|
|
|
|
|
|
|
:to_address_hash, |
|
|
|
|
|
|
|
:value |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
defp list_transactions(address_hash, max_block_number, options) do |
|
|
|
defp list_transactions(address_hash, max_block_number, options) do |
|
|
@ -66,17 +67,15 @@ defmodule Explorer.Etherscan do |
|
|
|
from( |
|
|
|
from( |
|
|
|
t in Transaction, |
|
|
|
t in Transaction, |
|
|
|
inner_join: b in assoc(t, :block), |
|
|
|
inner_join: b in assoc(t, :block), |
|
|
|
left_join: it in assoc(t, :internal_transactions), |
|
|
|
|
|
|
|
where: t.to_address_hash == ^address_hash, |
|
|
|
where: t.to_address_hash == ^address_hash, |
|
|
|
or_where: t.from_address_hash == ^address_hash, |
|
|
|
or_where: t.from_address_hash == ^address_hash, |
|
|
|
or_where: it.transaction_hash == t.hash and it.type == ^"create", |
|
|
|
or_where: t.created_contract_address_hash == ^address_hash, |
|
|
|
order_by: [{^options.order_by_direction, t.block_number}], |
|
|
|
order_by: [{^options.order_by_direction, t.block_number}], |
|
|
|
limit: ^options.page_size, |
|
|
|
limit: ^options.page_size, |
|
|
|
offset: ^offset(options), |
|
|
|
offset: ^offset(options), |
|
|
|
select: |
|
|
|
select: |
|
|
|
merge(map(t, ^@transaction_fields), %{ |
|
|
|
merge(map(t, ^@transaction_fields), %{ |
|
|
|
block_timestamp: b.timestamp, |
|
|
|
block_timestamp: b.timestamp, |
|
|
|
created_contract_address_hash: it.created_contract_address_hash, |
|
|
|
|
|
|
|
confirmations: fragment("? - ?", ^max_block_number, t.block_number) |
|
|
|
confirmations: fragment("? - ?", ^max_block_number, t.block_number) |
|
|
|
}) |
|
|
|
}) |
|
|
|
) |
|
|
|
) |
|
|
|