diff --git a/CHANGELOG.md b/CHANGELOG.md index 37eda79bda..1597306cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - [#2403](https://github.com/poanetwork/blockscout/pull/2403) - Return gasPrice field at the result of gettxinfo method ### Fixes +- [#2528](https://github.com/poanetwork/blockscout/pull/2528) - fix coin history chart data - [#2520](https://github.com/poanetwork/blockscout/pull/2520) - Hide loading message when fetching is failed - [#2523](https://github.com/poanetwork/blockscout/pull/2523) - Avoid importing internal_transactions of pending transactions - [#2519](https://github.com/poanetwork/blockscout/pull/2519) - enable `First` page button in pagination diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex index 6af67c4861..b440fc7d9f 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_coin_balance_by_day_controller.ex @@ -9,7 +9,12 @@ defmodule BlockScoutWeb.AddressCoinBalanceByDayController do def index(conn, %{"address_id" => address_hash_string, "type" => "JSON"}) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string) do - balances_by_day = Chain.address_to_balances_by_day(address_hash) + balances_by_day = + address_hash + |> Chain.address_to_balances_by_day() + |> Enum.map(fn %{value: value} = map -> + Map.put(map, :value, Decimal.to_float(value)) + end) json(conn, balances_by_day) end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_coin_balance_by_day_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_coin_balance_by_day_controller_test.exs index e835ba71ce..1496bb24e9 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_coin_balance_by_day_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_coin_balance_by_day_controller_test.exs @@ -14,7 +14,10 @@ defmodule BlockScoutWeb.AddressCoinBalanceByDayControllerTest do response = json_response(conn, 200) - assert length(response) == 2 + assert [ + %{"date" => _, "value" => 2.0e-15}, + %{"date" => _, "value" => 1.0e-15} + ] = response end end end