-
Notifications
You must be signed in to change notification settings - Fork 189
feat(docs): RPC methods reference #6630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
c535fa8
feat(docs): RPC methods reference
LesnyRumcajs e17b7a9
track specs
LesnyRumcajs 2b5a5b2
move rpc docs around
LesnyRumcajs 29dc97e
update workflows
LesnyRumcajs cddba98
update gitignore
LesnyRumcajs 99a6484
not necessarily all paths changed, ignore in message
LesnyRumcajs b9b73e2
prefer to use mise
LesnyRumcajs 50ce691
remove needless docs
LesnyRumcajs 6b4b4be
fix build
LesnyRumcajs ac2cdb1
docs: remove obsolete openrpc.json file
LesnyRumcajs b5d84ef
docs: improve accessibility of RPC reference toggles
LesnyRumcajs b8cf511
docs: add rel="noopener noreferrer" to external links
LesnyRumcajs 8278f1f
fix(docs): prevent hash handler re-runs and improve clipboard handling
LesnyRumcajs ecd1bdd
fix(docs): improve RPC reference robustness and HTML validity
LesnyRumcajs 55b0d7f
fix(docs): improve error visibility and code quality
LesnyRumcajs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,38 @@ | ||
| # This workflow, run daily, updates the Forest RPC reference docs, and submits a PR with the changes. | ||
| name: Update Forest RPC reference docs | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: "0 0 * * *" | ||
|
|
||
| jobs: | ||
| update-docs: | ||
| runs-on: ubuntu-slim | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Generate OpenRPC specifications | ||
| run: | | ||
| cd docs/scripts | ||
| ./generate-openrpc-specs.sh docker | ||
| # This is needed in order to have the commits signed. | ||
| - uses: actions/create-github-app-token@v2 | ||
| id: generate-token | ||
| with: | ||
| app-id: ${{ secrets.LESHY_APP_ID }} | ||
| private-key: ${{ secrets.LESHY_APP_PRIVATE_KEY }} | ||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v8 | ||
| with: | ||
| base: main | ||
| branch: leshy/update-forest-rpc-docs | ||
| token: ${{ steps.generate-token.outputs.token }} | ||
| commit-message: Update Forest RPC reference docs | ||
| sign-commits: true | ||
| title: "[automated] Update Forest RPC reference docs" | ||
| add-paths: | | ||
| docs/openrpc-specs/ | ||
| body: | | ||
| ### Changes | ||
| - Updates Forest RPC reference docs to the latest commit in the `main` branch. | ||
| - Regenerates OpenRPC specifications (v0, v1, v2) from latest Forest code. | ||
This file contains hidden or 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 hidden or 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,14 @@ | ||
| # OpenRPC specification files (auto-generated from Forest) | ||
| openrpc-specs/ | ||
|
|
||
| # Lock files | ||
| pnpm-lock.yaml | ||
| package-lock.json | ||
| yarn.lock | ||
|
|
||
| # Build output | ||
| build/ | ||
| .docusaurus/ | ||
|
|
||
| # Generated data | ||
| src/data/rpc-methods.json |
This file contains hidden or 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 hidden or 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,8 @@ | ||
| { | ||
| "label": "JSON-RPC", | ||
| "position": 4, | ||
| "link": { | ||
| "type": "generated-index", | ||
| "description": "Forest JSON-RPC API documentation including schema explorer and method reference." | ||
| } | ||
| } |
This file contains hidden or 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,30 @@ | ||
| --- | ||
| title: Methods Reference | ||
| sidebar_position: 2 | ||
| --- | ||
|
|
||
| import RPCReference from "@site/src/components/RPCReference"; | ||
|
|
||
| # JSON-RPC Methods Reference | ||
|
|
||
| This page provides a comprehensive reference for all RPC methods supported by Forest across multiple API versions. You can search, filter by namespace, switch between API versions, and expand individual methods to see detailed parameter and return type information. | ||
|
|
||
| :::info | ||
|
|
||
| This reference is automatically generated from the OpenRPC specifications in the repository. For the interactive schema explorer, see the [Schema Explorer](./schema.mdx) page. | ||
|
|
||
| ::: | ||
|
|
||
| ## API Versions | ||
|
|
||
| Forest supports multiple RPC API versions: | ||
|
|
||
| - **V0** - Deprecated API | ||
| - **V1** - Stable API - Recommended for production use | ||
| - **V2** - Experimental API | ||
|
|
||
| Use the version selector to switch between versions and see the methods available in each. | ||
|
|
||
| --- | ||
|
|
||
| <RPCReference /> |
This file contains hidden or 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 hidden or 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,103 @@ | ||
| --- | ||
| title: Schema Explorer | ||
| sidebar_position: 1 | ||
| --- | ||
|
|
||
| export const style = { | ||
| fontSize: "1.3em", | ||
| textDecoration: "underline", | ||
| }; | ||
|
|
||
| export const versionStyle = { | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| gap: "1rem", | ||
| marginBottom: "2rem", | ||
| }; | ||
|
|
||
| export const versionCard = { | ||
| padding: "1rem", | ||
| border: "1px solid var(--ifm-color-emphasis-300)", | ||
| borderRadius: "8px", | ||
| backgroundColor: "var(--ifm-background-surface-color)", | ||
| }; | ||
|
|
||
| # JSON-RPC Schema Explorer | ||
|
|
||
| Forest implements multiple API versions, each with its own OpenRPC specification. Use the interactive schema explorer to browse available methods, parameters, and return types for each version. | ||
|
|
||
| ## API Versions | ||
|
|
||
| <div style={versionStyle}> | ||
| <div style={versionCard}> | ||
| <h3>RPC v0 API</h3> | ||
| <p>Deprecated API</p> | ||
| <a | ||
| href="https://playground.open-rpc.org/?uiSchema[appBar][ui:darkMode]=true&uiSchema[appBar][ui:examplesDropdown]=false&uiSchema[appBar][ui:splitView]=false&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:title]=Forest%20RPC%20v0&schemaUrl=https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v0.json" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| style={style} | ||
| > | ||
| 👉 View v0 Spec in Schema Explorer | ||
| </a> | ||
| <br /> | ||
| <a | ||
| href="https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v0.json" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| 📄 Raw v0 Spec (JSON) | ||
| </a> | ||
| </div> | ||
|
|
||
| <div style={versionCard}> | ||
| <h3>RPC v1 API</h3> | ||
| <p>Stable API - Recommended for production use</p> | ||
| <a | ||
| href="https://playground.open-rpc.org/?uiSchema[appBar][ui:darkMode]=true&uiSchema[appBar][ui:examplesDropdown]=false&uiSchema[appBar][ui:splitView]=false&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:title]=Forest%20RPC%20v1&schemaUrl=https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v1.json" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| style={style} | ||
| > | ||
| 👉 View v1 Spec in Schema Explorer | ||
| </a> | ||
| <br /> | ||
| <a | ||
| href="https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v1.json" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| 📄 Raw v1 Spec (JSON) | ||
| </a> | ||
| </div> | ||
|
|
||
| <div style={versionCard}> | ||
| <h3>RPC v2 API</h3> | ||
| <p>Experimental API</p> | ||
| <a | ||
| href="https://playground.open-rpc.org/?uiSchema[appBar][ui:darkMode]=true&uiSchema[appBar][ui:examplesDropdown]=false&uiSchema[appBar][ui:splitView]=false&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:title]=Forest%20RPC%20v2&schemaUrl=https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v2.json" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| style={style} | ||
| > | ||
| 👉 View v2 Spec in Schema Explorer | ||
| </a> | ||
| <br /> | ||
| <a | ||
| href="https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v2.json" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| 📄 Raw v2 Spec (JSON) | ||
|
LesnyRumcajs marked this conversation as resolved.
|
||
| </a> | ||
| </div> | ||
| </div> | ||
|
|
||
| :::tip | ||
| For a searchable, filterable reference of all RPC methods, see the [Methods Reference](./methods.mdx) page. | ||
| ::: | ||
|
|
||
| #### References | ||
|
|
||
| - [OpenRPC Specification](https://spec.open-rpc.org/) | ||
| - [JSON Schema](https://json-schema.org/) | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.