Skip to content

Commit

Permalink
drop api
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorv-2204 committed Dec 2, 2022
1 parent 068c972 commit bb070f8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
38 changes: 0 additions & 38 deletions lib/archethic_web/controllers/api/web_hosting_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -399,42 +399,4 @@ defmodule ArchethicWeb.API.WebHostingController do
end

defp get_file_content(_, _, _), do: :file_error

def checksum(conn, %{"address" => ref_address}) do
with {:ok, addr_binary} <- Base.decode16(ref_address, case: :mixed),
true <- Crypto.valid_address?(addr_binary),
{:ok, last_address_bin} <- Archethic.get_last_transaction_address(addr_binary),
{:ok, ref_txn} <- Archethic.search_transaction(last_address_bin),
%Transaction{data: %TransactionData{content: content}} <- ref_txn,
{:ok, json_data} <- Jason.decode(content) do
conn
|> put_status(200)
|> json(json_data)
else
:error ->
conn
|> put_status(200)
|> json(%{error: "Invalid Hex"})

false ->
conn
|> put_status(200)
|> json(%{error: "Invalid Address"})

error
when error in [
{:error, :network_issue},
{:error, :transaction_not_exists},
{:error, :transaction_invalid}
] ->
conn
|> put_status(200)
|> json(%{error: "Network Issue"})

_e ->
conn
|> put_status(200)
|> json(%{error: "Invalid Content"})
end
end
end
2 changes: 0 additions & 2 deletions lib/archethic_web/explorer_router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ defmodule ArchethicWeb.ExplorerRouter do
:last_transaction_content
)

get("/web_hosting/checksum/:address", ArchethicWeb.API.WebHostingController, :checksum)

get("/web_hosting/:address/*url_path", ArchethicWeb.API.WebHostingController, :web_hosting)

post("/origin_key", ArchethicWeb.API.OriginKeyController, :origin_key)
Expand Down

0 comments on commit bb070f8

Please sign in to comment.