Skip to content

Commit c46eb8d

Browse files
authored
Merge branch 'testnet' into 1795-fixexamples-use-correct-verifybatchinclusion-function-and-update-python-scripts-on-examplesverify
2 parents 7a37cf4 + 5c89400 commit c46eb8d

4 files changed

Lines changed: 20 additions & 1 deletion

File tree

explorer/lib/explorer_web/router.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ defmodule ExplorerWeb.Router do
2929
end
3030

3131
pipeline :api do
32+
plug CORSPlug, origin: "*"
3233
plug :accepts, ["json"]
3334
end
3435

explorer/mix.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ defmodule Explorer.MixProject do
6262
{:postgrex, ">= 0.0.0"},
6363
{:cachex, "~> 3.6"},
6464
{:mutex, "~> 2.0"},
65-
{:tails, "~> 0.1.5"}
65+
{:tails, "~> 0.1.5"},
66+
{:cors_plug, "~> 3.0"},
6667
]
6768
end
6869

telemetry_api/lib/telemetry_api/operators.ex

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
defmodule TelemetryApi.Operators do
2+
require Logger
3+
24
@moduledoc """
35
The Operators context.
46
"""
@@ -130,6 +132,7 @@ defmodule TelemetryApi.Operators do
130132
# {:error, string}
131133
#
132134
defp add_operator_metadata(op_data) do
135+
Logger.info("Fetching metadata for operator: #{op_data.address}")
133136
with {:ok, url} <- DelegationManager.get_operator_url(op_data.address),
134137
{:ok, metadata} <- TelemetryApi.Utils.fetch_json_data(url) do
135138
operator = %{
@@ -140,6 +143,17 @@ defmodule TelemetryApi.Operators do
140143
}
141144

142145
{:ok, operator}
146+
else
147+
{:error, reason} ->
148+
Logger.error("Failed to fetch metadata for operator: #{op_data.address}. Reason: #{inspect(reason)}")
149+
operator = %{
150+
id: op_data.id,
151+
address: op_data.address,
152+
stake: op_data.stake,
153+
name: op_data.address
154+
}
155+
156+
{:ok, operator}
143157
end
144158
end
145159

telemetry_api/lib/telemetry_api/utils.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
defmodule TelemetryApi.Utils do
2+
require Logger
3+
24
@moduledoc """
35
Some utility functions
46
"""
@@ -15,6 +17,7 @@ defmodule TelemetryApi.Utils do
1517
{:error, message}
1618
"""
1719
def fetch_json_data(url) do
20+
Logger.info("Fetching data from #{url}")
1821
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <- HTTPoison.get(url) do
1922
Jason.decode(body)
2023
else

0 commit comments

Comments
 (0)