Skip to content

Latest commit

 

History

History
72 lines (46 loc) · 3.91 KB

README.METHODS.md

File metadata and controls

72 lines (46 loc) · 3.91 KB

How to create new page for RPC Methods Documentation.

How to create a new page for Ethereum RPC Methods Documentation

    1. Go to References and click on the method you want to document to go to the page (further mentioned as Reference Page).
    1. Copy the method name and create a new file in pages/ethereum-api with the name methodName.mdx.
    1. Create a new component in components/method-docs/ethereum with the name EthereumMethod_methodName.tsx.
    1. Let's use EthereumMethod_getBlockByNumber.tsx as reference file for the new file creation. Copy the content of EthereumMethod_getBlockByNumber.tsx into the new file and replace the method name with the new method name.
    1. Import the new EthereumMethod_methodName.tsx component in the methodName.mdx file and render it.
    1. Add methodName to the _meta.json in pages/ethereum-api folder.

How to fill the content of code snippets in the new page

    1. Go to Reference Page, copy cURL request example as shown in the image below. cURL request example
    1. Go to ChatGPT conversation and paste the cURL request example in the chat with the following prompt:
Hi! I need the analogs for the following HTTP request code in JS, Python, Go and Rust.
Use fetch for JS and Node.js
The following code is:
-- here goes cURL request code from Reference Page--
    1. After that, ChatGPT should provide you with the code snippets in JS, Python, Go and Rust. Use this snippets to fill the content of the code snippets in the new page.

        1. Important: For cURL make sure to escape line-breaking symbol "\" (slash) with "\" (double-slash) in the code snippet.
        1. Important: Replace URL value in string with interpolated ${DRPC_ENDPOINT_URL} in each string literal snippet. You can see how it's done in existing pages.
    1. To get Response body from the Reference Page click on "Try" button as shown on the image below and paste it in the Response section of the new page.

cURL request example

How to fill Request Params and Response Params

    1. Now, I personally find it more convenient to fill the Request Params and Response Params by looking at the Quicknode Reference Page for the same methodName that you currently copy/fill from Reference Page.

For example, eth_getBlockByNumber page.

Request Params are shown like this:

Request Params

Response Params are shown like this:

Response Params

    1. Copy and paste the Request Params and Response Params from the Quicknode Reference Page to the new page component props as required by format.

You can see example on the existing pages like EthereumMethod_getBlockByNumber.tsx.

How to fill the content of Use Cases and Constrains props.

    1. Go to ChatGPT and ask it to give 3 use cases and 3 constraints for the method you are documenting. Use the following prompt:
Hi! I need 3 use cases and 3 constraints, 3-6 words for each, for the following Ethereum method:
-- here goes the method name. For example getBlockByNumber --

Note: This guide is for Ethereum API methods documentation. You still can use this guide for other API methods documentation by changing the method name.

How to create a new page for Solana RPC Methods Documentation

The main process for Solana is the same as for Ethereum, but with some differences.

For Solana, you can use the ALchemy Solana RPC API Reference to get the method name and the cURL request example.