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
### 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
- [#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

@ -36,7 +36,14 @@ defmodule BlockScoutWeb.Notifier do
result
{:error, changeset} ->
{:ok, compiler_versions} = CompilerVersion.fetch_versions()
compiler_versions =
case CompilerVersion.fetch_versions() do
{:ok, compiler_versions} ->
compiler_versions
{:error, _} ->
[]
end
result =
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]
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
decimal

@ -776,7 +776,7 @@ defmodule BlockScoutWeb.API.RPC.LogsControllerTest do
[first_topic, second_topic, third_topic, fourth_topic]
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
decimal

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

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

Loading…
Cancel
Save