forked from blockscout/blockscout
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request blockscout#2167 from poanetwork/add_compatibility_…
…matrix feat: document eth rpc api mimicking endpoints
- Loading branch information
Showing
8 changed files
with
158 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
apps/block_scout_web/lib/block_scout_web/controllers/api_docs_controller.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
defmodule BlockScoutWeb.APIDocsController do | ||
use BlockScoutWeb, :controller | ||
|
||
alias BlockScoutWeb.API.RPC.EthController | ||
alias BlockScoutWeb.Etherscan | ||
|
||
def index(conn, _params) do | ||
conn | ||
|> assign(:documentation, Etherscan.get_documentation()) | ||
|> render("index.html") | ||
end | ||
|
||
def eth_rpc(conn, _params) do | ||
conn | ||
|> assign(:documentation, EthController.methods()) | ||
|> render("eth_rpc.html") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
apps/block_scout_web/lib/block_scout_web/templates/api_docs/eth_rpc.html.eex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<section class="container"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h1 class="card-title margin-bottom-sm"><%= gettext("ETH RPC API Documentation") %></h2> | ||
<p class="api-text-monospace" data-endpoint-url="<%= BlockScoutWeb.Endpoint.url() %>/api/eth_rpc">[ <%= gettext "Base URL:" %> <%= @conn.host %>/api/eth_rpc ]</p> | ||
<p class="card-subtitle margin-bottom-0"> | ||
<%= gettext "This API is provided to support some rpc methods in the exact format specified for ethereum nodes, which can be found " %> | ||
|
||
<a href="https://github.com/ethereum/wiki/wiki/JSON-RPC"><%= gettext "here." %></a> | ||
<%= gettext "This is useful to allow sending requests to blockscout without having to change anything about the request." %> | ||
<%= gettext "However, in general, the" %> <%= link( | ||
gettext("custom RPC"), | ||
to: api_docs_path(@conn, :index) | ||
) %> <%= gettext " is recommended." %> | ||
<%= gettext "Anything not in this list is not supported. Click on the method to be taken to the documentation for that method, and check the notes section for any potential differences." %> | ||
</p> | ||
</div> | ||
</div> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<table class="table"> | ||
<tr> | ||
<th>Supported Method</th> | ||
<th>Notes</th> | ||
</tr> | ||
<%= for {method, info} <- Map.to_list(@documentation) do %> | ||
<tr> | ||
<td> <a href="https://github.com/ethereum/wiki/wiki/JSON-RPC#<%= method %>"> <%= method %> </a> </td> | ||
<td> <%= Map.get(info, :notes, "N/A") %> </td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters