Fixes the topics order in the gettxinfo endpoint

pull/1034/head
robertoschneiders 6 years ago
parent b50b80dd1e
commit 5055686578
  1. 4
      apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex
  2. 11
      apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs

@ -76,8 +76,6 @@ defmodule BlockScoutWeb.API.RPC.TransactionView do
end end
defp get_topics(log) do defp get_topics(log) do
log [log.first_topic, log.second_topic, log.third_topic, log.fourth_topic]
|> Map.take([:first_topic, :second_topic, :third_topic, :fourth_topic])
|> Map.values()
end end
end end

@ -374,7 +374,14 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do
|> with_block(block, status: :ok) |> with_block(block, status: :ok)
address = insert(:address) address = insert(:address)
log = insert(:log, address: address, transaction: transaction)
log =
insert(:log,
address: address,
transaction: transaction,
first_topic: "first topic",
second_topic: "second topic"
)
params = %{ params = %{
"module" => "transaction", "module" => "transaction",
@ -398,7 +405,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do
%{ %{
"address" => "#{address}", "address" => "#{address}",
"data" => "#{log.data}", "data" => "#{log.data}",
"topics" => [nil, nil, nil, nil] "topics" => ["first topic", "second topic", nil, nil]
} }
] ]
} }

Loading…
Cancel
Save