Fix logs api response

pull/3323/head
Victor Baranov 4 years ago
parent 13f76c1c41
commit 984f499910
  1. 1
      CHANGELOG.md
  2. 9
      apps/block_scout_web/lib/block_scout_web/notifier.ex
  3. 2
      apps/block_scout_web/lib/block_scout_web/views/api/rpc/logs_view.ex
  4. 2
      apps/block_scout_web/test/block_scout_web/controllers/api/rpc/logs_controller_test.exs
  5. 9
      apps/explorer/lib/explorer/chain.ex
  6. 14
      apps/explorer/lib/explorer/etherscan/logs.ex

@ -12,6 +12,7 @@
- [#3261](https://github.com/poanetwork/blockscout/pull/3261) - Bridged tokens table - [#3261](https://github.com/poanetwork/blockscout/pull/3261) - Bridged tokens table
### Fixes ### Fixes
- [#3323](https://github.com/poanetwork/blockscout/pull/3323) - Fix logs list API endpoint response
- [#3319](https://github.com/poanetwork/blockscout/pull/3319) - Eliminate horizontal scroll - [#3319](https://github.com/poanetwork/blockscout/pull/3319) - Eliminate horizontal scroll
- [#3314](https://github.com/poanetwork/blockscout/pull/3314) - Handle nil values from response of CoinGecko price API - [#3314](https://github.com/poanetwork/blockscout/pull/3314) - Handle nil values from response of CoinGecko price API
- [#3313](https://github.com/poanetwork/blockscout/pull/3313) - Fix xDai styles: invisible tokens on address - [#3313](https://github.com/poanetwork/blockscout/pull/3313) - Fix xDai styles: invisible tokens on address

@ -36,7 +36,14 @@ defmodule BlockScoutWeb.Notifier do
result result
{:error, changeset} -> {:error, changeset} ->
{:ok, compiler_versions} = CompilerVersion.fetch_versions() compiler_versions =
case CompilerVersion.fetch_versions() do
{:ok, compiler_versions} ->
compiler_versions
{:error, _} ->
[]
end
result = result =
View.render_to_string(AddressContractVerificationView, "new.html", View.render_to_string(AddressContractVerificationView, "new.html",

@ -36,7 +36,7 @@ defmodule BlockScoutWeb.API.RPC.LogsView do
[first_topic, second_topic, third_topic, fourth_topic] [first_topic, second_topic, third_topic, fourth_topic]
end end
defp integer_to_hex(integer), do: Integer.to_string(integer, 16) defp integer_to_hex(integer), do: "0x" <> String.downcase(Integer.to_string(integer, 16))
defp decimal_to_hex(decimal) do defp decimal_to_hex(decimal) do
decimal decimal

@ -776,7 +776,7 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do
[first_topic, second_topic, third_topic, fourth_topic] [first_topic, second_topic, third_topic, fourth_topic]
end end
defp integer_to_hex(integer), do: Integer.to_string(integer, 16) defp integer_to_hex(integer), do: "0x" <> String.downcase(Integer.to_string(integer, 16))
defp decimal_to_hex(decimal) do defp decimal_to_hex(decimal) do
decimal decimal

@ -237,13 +237,8 @@ defmodule Explorer.Chain do
|> union(^query_from_address_hash_wrapped) |> union(^query_from_address_hash_wrapped)
|> union(^query_created_contract_address_hash_wrapped) |> union(^query_created_contract_address_hash_wrapped)
full_wrapped_query = full_query
from( |> wrapped_union_subquery()
q in subquery(full_query),
select: q
)
full_wrapped_query
|> order_by( |> order_by(
[q], [q],
desc: q.block_number, desc: q.block_number,

@ -109,9 +109,11 @@ defmodule Explorer.Etherscan.Logs do
transaction.from_address_hash == ^address_hash or transaction.from_address_hash == ^address_hash or
transaction.created_contract_address_hash == ^address_hash, transaction.created_contract_address_hash == ^address_hash,
select: map(log, ^@log_fields), select: map(log, ^@log_fields),
select_merge: map(transaction, [:gas_price, :gas_used, :block_number]),
select_merge: %{ select_merge: %{
transaction_index: transaction.index gas_price: transaction.gas_price,
gas_used: transaction.gas_used,
transaction_index: transaction.index,
block_number: transaction.block_number
}, },
union: ^internal_transaction_log_query union: ^internal_transaction_log_query
) )
@ -124,9 +126,11 @@ defmodule Explorer.Etherscan.Logs do
order_by: block.number, order_by: block.number,
limit: 1000, limit: 1000,
select_merge: %{ select_merge: %{
transaction_index: log_transaction_data.transaction_index,
block_hash: block.hash,
block_number: block.number,
block_timestamp: block.timestamp, block_timestamp: block.timestamp,
block_consensus: block.consensus, block_consensus: block.consensus
block_hash: block.hash
} }
) )
@ -270,7 +274,7 @@ defmodule Explorer.Etherscan.Logs do
gas_price: transaction.gas_price, gas_price: transaction.gas_price,
gas_used: transaction.gas_used, gas_used: transaction.gas_used,
transaction_index: transaction.index, transaction_index: transaction.index,
block_number: transaction.block_number block_number: internal_transaction.block_number
}) })
) )

Loading…
Cancel
Save