From 6b18d64e568aa1a0740a50c6b83b25456c30c5bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=9F=D0=BE=D0=B7?= =?UTF-8?q?=D0=B4=D0=BD=D1=8F=D0=BA=D0=BE=D0=B2?= Date: Wed, 2 Nov 2022 19:17:21 +0300 Subject: [PATCH] Fix transactions response --- CHANGELOG.md | 1 + .../lib/block_scout_web/views/api/v2/transaction_view.ex | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be6c7081e0..2f386f5024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### Fixes +- [#6390](https://github.com/blockscout/blockscout/pull/6390) - Fix transactions responses in API v2 - [#6357](https://github.com/blockscout/blockscout/pull/6357) - Fix definitions of NETWORK_PATH, API_PATH, SOCKET_ROOT: process trailing slash - [#6338](https://github.com/blockscout/blockscout/pull/6338) - Fix token search with space - [#6329](https://github.com/blockscout/blockscout/pull/6329) - Prevent logger from truncating response from rust verifier service in case of an error diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex index 8b6c48f5b8..dc1b9ef006 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex @@ -19,14 +19,14 @@ defmodule BlockScoutWeb.API.V2.TransactionView do ApiView.render("message.json", assigns) end - def render("transactions.json", %{transactions: transactions, conn: conn}) do - Enum.map(transactions, &prepare_transaction(&1, conn, false)) - end - def render("transactions.json", %{transactions: transactions, next_page_params: next_page_params, conn: conn}) do %{"items" => Enum.map(transactions, &prepare_transaction(&1, conn, false)), "next_page_params" => next_page_params} end + def render("transactions.json", %{transactions: transactions, conn: conn}) do + Enum.map(transactions, &prepare_transaction(&1, conn, false)) + end + def render("transaction.json", %{transaction: transaction, conn: conn}) do prepare_transaction(transaction, conn, true) end