From 505568657889b24a5b89d2e9aaabe8c243eee885 Mon Sep 17 00:00:00 2001 From: robertoschneiders Date: Thu, 1 Nov 2018 09:55:13 -0300 Subject: [PATCH] Fixes the topics order in the gettxinfo endpoint --- .../block_scout_web/views/api/rpc/transaction_view.ex | 4 +--- .../api/rpc/transaction_controller_test.exs | 11 +++++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex index 2820163235..73dae614e6 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex @@ -76,8 +76,6 @@ defmodule BlockScoutWeb.API.RPC.TransactionView do end defp get_topics(log) do - log - |> Map.take([:first_topic, :second_topic, :third_topic, :fourth_topic]) - |> Map.values() + [log.first_topic, log.second_topic, log.third_topic, log.fourth_topic] end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs index 7d28864e5f..bc0cfcca96 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs @@ -374,7 +374,14 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do |> with_block(block, status: :ok) 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 = %{ "module" => "transaction", @@ -398,7 +405,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do %{ "address" => "#{address}", "data" => "#{log.data}", - "topics" => [nil, nil, nil, nil] + "topics" => ["first topic", "second topic", nil, nil] } ] }