diff --git a/CHANGELOG.md b/CHANGELOG.md index f4fb5ba..295ea5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.22.0 (24.07.2024) + +- Update the getHealth endpoint response + ## 0.21.0 (24.07.2024) - [Stellar Protocol 21 support](https://github.com/kommitters/soroban.ex/issues/158). diff --git a/README.md b/README.md index 5d0e4a1..d151065 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ ```elixir def deps do [ - {:soroban, "~> 0.21.0"} + {:soroban, "~> 0.22.0"} ] end ``` @@ -405,7 +405,13 @@ General node health check. server = Soroban.RPC.Server.testnet() Soroban.RPC.get_health(server) -{:ok, %Soroban.RPC.GetHealthResponse{status: "healthy"}} +{:ok, + %Soroban.RPC.GetHealthResponse{ + status: "healthy", + latest_ledger: 706073, + oldest_ledger: 688794, + ledger_retention_window: 17280 + }} ``` diff --git a/lib/rpc/responses/get_health_response.ex b/lib/rpc/responses/get_health_response.ex index f2899f1..f4bdfe9 100644 --- a/lib/rpc/responses/get_health_response.ex +++ b/lib/rpc/responses/get_health_response.ex @@ -5,11 +5,18 @@ defmodule Soroban.RPC.GetHealthResponse do @behaviour Soroban.RPC.Response.Spec @type status :: String.t() + @type latest_ledger :: non_neg_integer() + @type oldest_ledger :: non_neg_integer() + @type ledger_retention_window :: non_neg_integer() + @type t :: %__MODULE__{ - status: status() + status: status(), + latest_ledger: latest_ledger(), + oldest_ledger: oldest_ledger(), + ledger_retention_window: ledger_retention_window() } - defstruct [:status] + defstruct [:status, :latest_ledger, :oldest_ledger, :ledger_retention_window] @impl true def new(attrs), do: struct(%__MODULE__{}, attrs) diff --git a/mix.exs b/mix.exs index e26618d..5cbd1aa 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Soroban.MixProject do use Mix.Project - @version "0.21.0" + @version "0.22.0" @github_url "https://github.com/kommitters/soroban.ex" def project do diff --git a/test/rpc/responses/get_health_response_test.exs b/test/rpc/responses/get_health_response_test.exs index abd73e3..53ff6b5 100644 --- a/test/rpc/responses/get_health_response_test.exs +++ b/test/rpc/responses/get_health_response_test.exs @@ -6,7 +6,10 @@ defmodule Soroban.RPC.GetHealthResponseTest do setup do %{ result: %{ - status: "healthy" + status: "healthy", + latest_ledger: 706_073, + oldest_ledger: 688_794, + ledger_retention_window: 17_280 } } end diff --git a/test/rpc_test.exs b/test/rpc_test.exs index ab9e16f..4e308a8 100644 --- a/test/rpc_test.exs +++ b/test/rpc_test.exs @@ -100,7 +100,10 @@ defmodule Soroban.RPC.CannedRPCGetHealthClientImpl do {:ok, %{ - status: "healthy" + status: "healthy", + latest_ledger: 706_073, + oldest_ledger: 688_794, + ledger_retention_window: 17_280 }} end end